Update of /cvsroot/linux-vax/toolchain/patches
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24184
Added Files:
uclibc-000006-update_brk_function.patch
Log Message:
- Another drop. The externally visible symbol __brk_addr was renamed
to __currbrk. While fixing this, I also made some touch-ups.
--- NEW FILE: uclibc-000006-update_brk_function.patch ---
diff -Nurp src-uclibc-fresh/libc/sysdeps/linux/vax/brk.c src-uclibc-hacked/libc/sysdeps/linux/vax/brk.c
--- src-uclibc-fresh/libc/sysdeps/linux/vax/brk.c 2005-09-29 18:34:41.000000000 +0200
+++ src-uclibc-hacked/libc/sysdeps/linux/vax/brk.c 2005-09-29 18:35:57.000000000 +0200
@@ -1,5 +1,5 @@
/* brk system call for Linux/VAX.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,34 +21,31 @@
#include <unistd.h>
#include <sys/syscall.h>
-void *___brk_addr = 0;
+/* This must be initialized data because commons can't have aliases. */
+void *__curbrk = NULL;
int brk (void *addr)
{
- void *newbrk;
+ register unsigned long int result __asm__ ("%%r0");
- {
- register long int res __asm__ ("%%r0");
+ asm (
+ " pushl %%ap \n" /* Start frame */
+ " pushl %2 \n" /* New top address we wish to get */
+ " pushl $1 \n" /* One argument */
+ " movl %%sp, %%ap \n" /* Finish frame */
+ " chmk %1 \n" /* Perform the system call */
+ " addl2 $8, %%sp \n"
+ " movl (%%sp)+, %%ap \n"
+ : "=r" (result)
+ : "0" (__NR_brk),
+ "g" (addr));
+
+ if ((void *) result < addr) {
+ __set_errno (ENOMEM);
+ return -1;
+ } else
+ __curbrk = (void *) result;
- asm ("pushl %%ap\n"
- "pushl %2\n" /* Save %ebx in scratch register. */
- "pushl $1\n" /* Put ADDR in %ebx to be syscall arg. */
- "movl %%sp, %%ap\n"
- "chmk %1\n" /* Perform the system call. */
- "addl2 $8, %%sp\n"
- "movl (%%sp)+, %%ap\n"
- : "=r" (res)
- : "0" (__NR_brk), "g" (addr));
-
- newbrk = (void *) res;
- }
- ___brk_addr = newbrk;
-
- if (newbrk < addr)
- {
- __set_errno (ENOMEM);
- return -1;
- }
-
- return 0;
+ return 0;
}
+
|