NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: jedi on July 17, 2013, 04:17:33 PM

Title: Setting the RSI flags register for system calls
Post by: jedi on July 17, 2013, 04:17:33 PM
The documentation for the Linux open() system call says that the RSI register stores a series of OR'd values for flag instructions. It then lists a bunch of options in alphabetical order. I've been having trouble figuring out which options are which bits, does anyone mind taking a look and explain to me how one goes about this. This will help me for error codes and future functions too. Thank you.
Title: Re: Setting the RSI flags register for system calls
Post by: Rob Neff on July 17, 2013, 04:27:45 PM
One simple method is to grep through the <sys/stat.h> or <fcntl.h> files in gcc's include directory for the defines such as O_RDONLY, O_WRONLY, O_RDWR, etc..  Those will be the bits you seek.
Title: Re: Setting the RSI flags register for system calls
Post by: jedi on July 17, 2013, 04:51:32 PM
I think your method is the best/only way I suppose. Grep'ing is a pain because it's hard to find the right file. I searched for and found what I needed in here: http://lxr.linux.no/linux+v3.10.1/include/uapi/asm-generic/fcntl.h#L19