From 2afdb3854c824a1eec5f31e72100cecb48fce5de Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sat, 25 Aug 2018 01:48:28 +0200 Subject: [PATCH] Add generic support for syscalls for Linux/i386 --- tools/arch/i386/start.S | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/arch/i386/start.S b/tools/arch/i386/start.S index 4e10e8e..6ec1352 100644 --- a/tools/arch/i386/start.S +++ b/tools/arch/i386/start.S @@ -5,8 +5,26 @@ .section .text _syscall: +#ifdef __linux__ + push %ebx + push %esi + push %edi + mov 0x10(%esp), %ebx + mov 0x14(%esp), %ecx + mov 0x18(%esp), %edx + mov 0x1c(%esp), %esi + mov 0x20(%esp), %edi + int $0x80 + pop %edi + pop %esi + pop %ebx + cmp $0, %eax + jge .errnoret + neg %eax +#else int $0x80 jnc .errnoret +#endif .errno: mov %eax, errno mov $-1, %eax