In Linux, on entry of a sys call, what is the value in

后端 未结 2 1675
一生所求
一生所求 2020-12-18 04:26

When a syscall returns, I get the syscall return value in %eax, however on entry I am getting -38, which is 0xFFFFFFDA in hex. This is for both write/read. What is this numb

2条回答
  •  感动是毒
    2020-12-18 04:40

    I still not get when you get the -38 in eax, but when doing a syscall eax contains a number that defines the syscall (in a 2.6 Kernel you can have a look at arch/x86/include/asm/unistd_64.h to see the numbers for each call).

    So the sequence is the following:

    1. your programm
    2. set eax to syscall (dep on call, also some other regs)
    3. init syscall (via int 0x80)
    4. result of syscall in eax
    5. your programm again

    Maybe your question is not so formulated, but if you are not writing kernel code/driver the easiest way to tell, wether you are before syscall entry or after syscall exit is: TRUE when you are in your code ;-). The entry/exit itself happen (more or less) instant in one instruction, so either you are in the syscall (then you would know because it must be some kernel code or the blocking call) or you are not (almost everytime when you debug your code).

提交回复
热议问题