nova: PIC compatible syscall_5

Addressing must be PC-relative, so adapt the approach from the other
nova_x86_32 syscall bindings (description by @ssumpf):

  Use call to push the current IP on the stack and add the distance of
  label 0 and label 1 in order to determine the return address, which
  NOVA requires in edx.

The bug only showed up with "-O0" in libc.lib.so in form of a unwanted
text relocation.

Fixes #1721
This commit is contained in:
Christian Helmuth 2015-09-28 15:37:31 +02:00
parent 7fff1770e0
commit 985c01116b
1 changed files with 5 additions and 2 deletions

View File

@ -166,9 +166,12 @@ namespace Nova {
asm volatile (" push %%ebx;"
" mov %%ecx, %%ebx;"
" movl %%esp, %%ecx;"
" movl $1f, %%edx;"
" mov %%esp, %%ecx;"
" call 0f;"
"0:"
" addl $(1f-0b), (%%esp);"
" mov (%%esp), %%edx;"
"sysenter;"
"1:"