x86-64

Does mmap with MAP_NORESERVE reserve physical memory?

两盒软妹~` 提交于 2019-12-17 12:31:11
问题 The mmap documentation says following about the flag MAP_NORESERVE. Do not reserve swap space for this mapping. When swap space is reserved, one has the guarantee that it is possible to modify the mapping. When swap space is not reserved one might get SIGSEGV upon a write if no physical memory is available. What I want actually is to only reserve virtual memory addresses and not have actual physical memory allocated. Can this be done with mmap with MAP_NORESERVE? If I want to use any physical

Why not store function parameters in XMM vector registers?

丶灬走出姿态 提交于 2019-12-17 10:55:02
问题 I'm currently reading the book: "Computer Systems - A Programmers Perspective". I've found out that, on the x86-64 architecture, we are limited to 6 integral parameters which will be passed to a function in registers. The next parameters will be passed on the stack. And also, the first up-to-8 FP or vector args are passed in xmm0..7. Why not use float registers in order to store the next parameters, even when the parameters are not single/double precision variables? It would be much more

Why not store function parameters in XMM vector registers?

荒凉一梦 提交于 2019-12-17 10:54:08
问题 I'm currently reading the book: "Computer Systems - A Programmers Perspective". I've found out that, on the x86-64 architecture, we are limited to 6 integral parameters which will be passed to a function in registers. The next parameters will be passed on the stack. And also, the first up-to-8 FP or vector args are passed in xmm0..7. Why not use float registers in order to store the next parameters, even when the parameters are not single/double precision variables? It would be much more

Load from a 64-bit address into other register than rax

做~自己de王妃 提交于 2019-12-17 09:56:21
问题 On x64, loading from a 64-bit absolute address (that is, dereferencing a 64-bit immediate) can be done by movabs addr64, %rax However, when the destination register is any other than rax the assembler gives an error message saying operand size mismatch for movabs . What am I missing? 回答1: From the MOV instruction document you can see that you can move a 64-bit immediate to any registers, but loads/stores involving a 64-bit immediate absolute address can only work with Areg A0 MOV AL,moffs8*

basic assembly not working on Mac (x86_64+Lion)?

冷暖自知 提交于 2019-12-17 09:54:14
问题 here is the code(exit.s): .section .data, .section .text, .globl _start _start: movl $1, %eax movl $32, %ebx syscall when I execute " as exit.s -o exit.o && ld exit.o -o exit -e _start && ./exit" the return is "Bus error: 10" and the output of " echo $? " is 138 I also tried the example of the correct answer in this question: Process command line in Linux 64 bit stil get "bus error"... 回答1: First, you are using old 32-bit Linux kernel calling convention on Mac OS X - this absolutely doesn't

Process Linkage Table and Global Offset Table

亡梦爱人 提交于 2019-12-17 09:48:42
问题 I am reading this article on PLT (Process Linkage Table) and GOT (Global Offset Table). While the purpose of PLT is clear to me, I'm still confused about GOT. What I've understood from the article is that GOT is only necessary for variables declared as extern in a shared library. For global variables declared as static in a shared library code, it is not required. Is my understanding right, or am I completely missing the point. 回答1: Perhaps your confusion is with the meaning of extern . Since

Segmentation fault on printf - NASM 64bit Linux

不问归期 提交于 2019-12-17 07:51:15
问题 I trying to input four floats using scanf , store them onto the stack, and then use vmovupd to copy them over to a register for use. My problem is when I try to output those 4 numbers, the program seg faults at printf . I presume it is something with the stack but I've tried popping numerous times (multiple instructions at once) to no avail. I'm still new to Assembly coding so using gdb is a bit too advanced for me. You will notice that I have included a file called debug . It allows me to

Segmentation fault on printf - NASM 64bit Linux

怎甘沉沦 提交于 2019-12-17 07:51:04
问题 I trying to input four floats using scanf , store them onto the stack, and then use vmovupd to copy them over to a register for use. My problem is when I try to output those 4 numbers, the program seg faults at printf . I presume it is something with the stack but I've tried popping numerous times (multiple instructions at once) to no avail. I'm still new to Assembly coding so using gdb is a bit too advanced for me. You will notice that I have included a file called debug . It allows me to

gfortran for dummies: What does mcmodel=medium do exactly?

左心房为你撑大大i 提交于 2019-12-17 06:39:09
问题 I have some code that is giving me relocation errors when compiling, below is an example which illustrates the problem: program main common/baz/a,b,c real a,b,c b = 0.0 call foo() print*, b end subroutine foo() common/baz/a,b,c real a,b,c integer, parameter :: nx = 450 integer, parameter :: ny = 144 integer, parameter :: nz = 144 integer, parameter :: nf = 23*3 real :: bar(nf,nx*ny*nz) !real, allocatable,dimension(:,:) :: bar !allocate(bar(nf,nx*ny*nz)) bar = 1.0 b = bar(12,32*138*42) return

gfortran for dummies: What does mcmodel=medium do exactly?

孤人 提交于 2019-12-17 06:39:07
问题 I have some code that is giving me relocation errors when compiling, below is an example which illustrates the problem: program main common/baz/a,b,c real a,b,c b = 0.0 call foo() print*, b end subroutine foo() common/baz/a,b,c real a,b,c integer, parameter :: nx = 450 integer, parameter :: ny = 144 integer, parameter :: nz = 144 integer, parameter :: nf = 23*3 real :: bar(nf,nx*ny*nz) !real, allocatable,dimension(:,:) :: bar !allocate(bar(nf,nx*ny*nz)) bar = 1.0 b = bar(12,32*138*42) return