x86-64

compiling 64 bit linux kernel with gcc

南笙酒味 提交于 2019-12-24 01:55:26
问题 While trying to compile a 64 bit linux kernel using gcc, I see the following error : kernel/bounds.c:1: error: code model ‘kernel’ not supported in the 32 bit mode kernel/bounds.c:1: sorry, unimplemented: 64-bit mode not compiled in This is what gcc -v reports : Using built-in specs. Target: i586-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/ bugzilla --enable-bootstrap --enable-shared -

macro to allocate space in memory

自闭症网瘾萝莉.ら 提交于 2019-12-24 01:55:13
问题 i need to make an assembly programmer to calculate pascal triangle . so that every line of pascal triangle stored in memory place separate from other line i want to make one but i have no idea how to do it in assembly using macro . macro take an number and allocate that number of dword in memory i did a try but i don't know if it is the correct way to do it %macro Malloc 2 %2 : resd %1 %endmacro i want to know 2 thing : first i want the second arg ( %2 ) to have a string name automatically

macro to allocate space in memory

时光怂恿深爱的人放手 提交于 2019-12-24 01:54:59
问题 i need to make an assembly programmer to calculate pascal triangle . so that every line of pascal triangle stored in memory place separate from other line i want to make one but i have no idea how to do it in assembly using macro . macro take an number and allocate that number of dword in memory i did a try but i don't know if it is the correct way to do it %macro Malloc 2 %2 : resd %1 %endmacro i want to know 2 thing : first i want the second arg ( %2 ) to have a string name automatically

how to reference local variables on the stack properly

送分小仙女□ 提交于 2019-12-24 01:45:22
问题 Enter in function, standard prologue push rbp mov rbp, rsp sub rsp, 128 ; large space for storing doubles, for example How to reference local variables now, via rsp + positive offset, or via rbp + negative offset? Reading https://en.wikibooks.org/wiki/X86_Disassembly/Functions_and_Stack_Frames, indeed quite understandable. It writes ...the value of esp cannot be reliably used to determine (using the appropriate offset) the memory location of a specific local variable. To solve this problem,

how to reference local variables on the stack properly

若如初见. 提交于 2019-12-24 01:45:18
问题 Enter in function, standard prologue push rbp mov rbp, rsp sub rsp, 128 ; large space for storing doubles, for example How to reference local variables now, via rsp + positive offset, or via rbp + negative offset? Reading https://en.wikibooks.org/wiki/X86_Disassembly/Functions_and_Stack_Frames, indeed quite understandable. It writes ...the value of esp cannot be reliably used to determine (using the appropriate offset) the memory location of a specific local variable. To solve this problem,

Assembly - How to score a CPU instruction by latency and throughput

瘦欲@ 提交于 2019-12-24 00:24:11
问题 I'm looking for a type of a formula / way to measure how fast an instruction is, or more specific to give a "score" each of the instruction by CPU cycles. Let's take the follow assembly program for an example, nop mov eax,dword ptr [rbp+34h] inc eax mov dword ptr [rbp+34h],eax and the following Intel Skylake information: mov r,m : Throughput=0.5 Latency=2 mov m,r : Throughput=1 Latency=2 nop : Throughput=0.25 Latency=non inc : Throughput=0.25 Latency=1 I know that the order of the

What's the name of this finding square root algorithm?

筅森魡賤 提交于 2019-12-23 22:55:42
问题 The algorithm is as follows: res <- 0 for i from 15 downto 0 do: change the ith bit of result to 1 if res^2 > x then: change the ith bit of res back to 0 return res I completely understand how it works, but I don't know what this method is called. I've been looking at the wiki for computing methods of square root but to no avail. Is this the digit-by-digit method? (related: How to compute the integer square root of a number in x86-64, without using div?) 回答1: As Peter Cordes mentioned in

How to make gcc emit multibyte NOPs for -fpatchable-function-entry?

拟墨画扇 提交于 2019-12-23 20:01:37
问题 gcc does have the ability to use multi-byte NOPs for aligning loops and functions. However when I tried the -fpatchable-function-entry option it always emits single-byte NOPs You can see in this example that gcc aligns the function with nop DWORD PTR [rax+rax*1+0x0] and nop WORD PTR cs:[rax+rax*1+0x0] but uses eight 0x90 NOPs at the function entry when I specify -fpatchable-function-entry=8,3 I saw this in the document -fpatchable-function-entry=N[,M] Generate N NOPs right at the beginning of

What does “set accordingly” in Intel Assembly mean? [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-23 13:23:00
问题 This question already has an answer here : How does the NEG instruction affect the flags on x86? (1 answer) Closed 2 years ago . Here is what I see in the documentation of Intel x86-64 for the neg instruction that is confusing. "The OF , SF , ZF , AF , and PF flags are set according to the result." I'm assuming that sf = dest < 0 , zf = dest == 0 , but can't figure out how the other flags are set. I see this "set according to the result" phrase everywhere and would appreciate your help in

How to reserve bottom 4GB VM in an x64 C++ app

丶灬走出姿态 提交于 2019-12-23 12:26:58
问题 Working on porting a 32bit Windows C++ app to 64 bit. Unfortunately, the code uses frequent casting in both directions between DWORD and pointer values. One of the ideas is to reserve the first 4GB of virtual process space as early as possible during process startup so that all subsequent calls to reserve memory will be from virtual addresses greater than 4 GB. This would cause an access violation error any unsafe cast from pointer to DWORD and then back to pointer and would help catch errors