From 6602ba129f062e26a875d8f3b947504500dcc261 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 12 Dec 2008 14:23:17 +0000 Subject: smaller brk() for i386. Inspected assembly to see it's still valid. text data bss dec hex filename - 44 0 4 48 30 libc/sysdeps/linux/i386/brk.o + 42 0 4 46 2e libc/sysdeps/linux/i386/brk.o --- libc/sysdeps/linux/i386/brk.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c index 2be9c1802..744d1d037 100644 --- a/libc/sysdeps/linux/i386/brk.c +++ b/libc/sysdeps/linux/i386/brk.c @@ -27,23 +27,21 @@ void *__curbrk attribute_hidden = 0; /* libc_hidden_proto(brk) */ int brk (void *addr) { - void *__unbounded newbrk, *__unbounded scratch; + void *newbrk, *ebx; - __asm__ ("movl %%ebx, %1\n" /* Save %ebx in scratch register. */ - "movl %3, %%ebx\n" /* Put ADDR in %ebx to be syscall arg. */ - "int $0x80 # %2\n" /* Perform the system call. */ - "movl %1, %%ebx\n" /* Restore %ebx from scratch register. */ - : "=a" (newbrk), "=r" (scratch) - : "0" (__NR_brk), "g" (__ptrvalue (addr))); + __asm__ ( + "int $0x80\n" + : "=a" (newbrk), "=b" (ebx) + : "0" (__NR_brk), "1" (addr) + ); - __curbrk = newbrk; + __curbrk = newbrk; - if (newbrk < addr) - { - __set_errno (ENOMEM); - return -1; - } + if (newbrk < addr) { + __set_errno(ENOMEM); + return -1; + } - return 0; + return 0; } libc_hidden_def(brk) -- cgit v1.2.3