Author Topic: Setting the RSI flags register for system calls  (Read 4982 times)

Offline jedi

  • Jr. Member
  • *
  • Posts: 9
Setting the RSI flags register for system calls
« 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.

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Setting the RSI flags register for system calls
« Reply #1 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.

Offline jedi

  • Jr. Member
  • *
  • Posts: 9
Re: Setting the RSI flags register for system calls
« Reply #2 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