Skip to content
Advertisement

Tag: assembly

why called function can get arguments of parent-function by va_start()?

I implemented a function with variable arguments below: Then I hope to implement another named “errExit()” based on the function above. I just tried like below.It works as I hoped but I dont’t think it correct. I tried errExit(“hello,%s,%s,%s”, “arg1″,”arg2”, “arg3”); and it printed “hello,arg1,arg2,arg3” correctly. But after I added two line code like below, it throwed error Segmentation fault.

How to increase the size of memory region allocated with mmap()

I’m allocating memory using mmap Linux syscall. Is it possible to increase the size of allocated memory region preserving its start address and contents? How to do it properly? Answer On Linux, use the mremap(2) Linux-specific system call without MREMAP_MAYMOVE to extend the existing mapping, without considering the option of remapping those physical pages to a different virtual address where

get a char passed as parameter

I would like to write a function in NASM System V ABI x86-64 (Intel Syntax) that I could use in a C program. Here is the prototype of the function: I therefore retrieve the parameters in order (const char *s = rdi, int c = rsi) First, I get the character stored in the register rsi and put it in

Advertisement