scc-patches

scc patches
Log | Files | Refs | README

0002-lib-c-Update-Linux-write-syscall-for-i386.patch (1263B)


      1 From d6f8975e63efd811c6da1aa22015120bb0eed132 Mon Sep 17 00:00:00 2001
      2 From: zerous Naveen Narayanan <zerous@nocebo.space>
      3 Date: Thu, 31 Oct 2019 13:59:21 +0100
      4 Subject: [PATCH 02/10] [lib/c] Update Linux write syscall for i386
      5 
      6 Pass args using appropriate registers for _write syscall
      7 Remove _write from syscall.lst as it doesn't conform to the generic template
      8 ---
      9  src/libc/arch/i386/linux/_write.s    | 13 +++++++++++++
     10  src/libc/arch/i386/linux/syscall.lst |  1 -
     11  2 files changed, 13 insertions(+), 1 deletion(-)
     12  create mode 100644 src/libc/arch/i386/linux/_write.s
     13 
     14 diff --git a/src/libc/arch/i386/linux/_write.s b/src/libc/arch/i386/linux/_write.s
     15 new file mode 100644
     16 index 00000000..2c30050f
     17 --- /dev/null
     18 +++ b/src/libc/arch/i386/linux/_write.s
     19 @@ -0,0 +1,13 @@
     20 +	.file	"_write.s"
     21 +
     22 +	.globl	_write
     23 +_write:
     24 +	pushl	%ebp
     25 +	movl	%esp,%ebp
     26 +	movl	8(%ebp),%ebx
     27 +	movl	12(%ebp),%ecx
     28 +	movl	16(%ebp),%edx
     29 +	movl	$4,%eax
     30 +	int	$0x80
     31 +	popl	%ebp
     32 +	jmp	_cerrno
     33 diff --git a/src/libc/arch/i386/linux/syscall.lst b/src/libc/arch/i386/linux/syscall.lst
     34 index 71a811f4..743bf682 100644
     35 --- a/src/libc/arch/i386/linux/syscall.lst
     36 +++ b/src/libc/arch/i386/linux/syscall.lst
     37 @@ -1,6 +1,5 @@
     38  #number name
     39  3	_read
     40 -4	_write
     41  5	_open
     42  6	_close
     43  19	_lseek
     44 -- 
     45 2.23.0
     46