svn commit: trunk/uClibc/libc/sysdeps/linux/i386

vda at uclibc.org vda at uclibc.org
Fri Dec 12 14:23:17 UTC 2008


Author: vda
Date: 2008-12-12 06:23:17 -0800 (Fri, 12 Dec 2008)
New Revision: 24394

Log:
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



Modified:
   trunk/uClibc/libc/sysdeps/linux/i386/brk.c


Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/i386/brk.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/i386/brk.c	2008-12-12 13:30:21 UTC (rev 24393)
+++ trunk/uClibc/libc/sysdeps/linux/i386/brk.c	2008-12-12 14:23:17 UTC (rev 24394)
@@ -27,23 +27,21 @@
 /* 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)




More information about the uClibc-cvs mailing list