Skip to content

Commit

Permalink
vfork: do not use hard coded 4 for performing syscalls
Browse files Browse the repository at this point in the history
JIRA: RTOS-697
  • Loading branch information
badochov committed Dec 6, 2023
1 parent ae1c008 commit ad3048d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/ia32/syscalls.S
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@

.text

#define SYSCALLNUM(sym) syscalls_num_ ## sym

#define SYSCALLDEF(sym, sn) \
.equ SYSCALLNUM(sym), sn; \
.globl sym; \
.type sym, @function; \
.align 4, 0x90; \
sym: \
.cfi_startproc; \
movl $sn, %eax; \
mov $SYSCALLNUM(sym), %eax; \
int $0x80; \
ret; \
.cfi_endproc; \
Expand All @@ -40,7 +42,7 @@ vfork:
* Syscalls restore all registers but %eax thus %edx will not be overwritten.
* %edx is used as it need not to be restored before function exit. */
mov (%esp), %edx
movl $4, %eax
mov $SYSCALLNUM(vforksvc), %eax
int $0x80
mov %edx, (%esp)
ret
Expand Down

0 comments on commit ad3048d

Please sign in to comment.