This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to libc/sys/arm/syscalls.c


Nick Clifton has authorized me to check in the following patch.

It is a small change but important to prevent a register to be clobbered by a system call to the Angel monitor C library
support.

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@cygnus.com


Index: ChangeLog
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/ChangeLog,v
retrieving revision 1.868
diff -c -p -r1.868 ChangeLog
*** ChangeLog   2000/02/25 20:31:52     1.868
--- ChangeLog   2000/03/23 20:00:04
***************
*** 1,3 ****
--- 1,8 ----
+ Thu Mar 22 14:57:00 2000  Fernando Nasser <fnasser@redhat.com>
+ 
+       * libc/sys/arm/syscalls.c (do_AngelSWI): Prevent registers with valid
+       information to be clobbered by an Angel C support syscall. 
+ 
  Fri Feb 25 15:30:00 2000  Jeff Johnston <jjohnstn@cygnus.com>
  
        * libc/stdio/flags.c (__sflags): Added check to ensure

Index: syscalls.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libc/sys/arm/syscalls.c,v
retrieving revision 1.23
diff -c -p -r1.23 syscalls.c
*** syscalls.c  1999/11/26 02:31:24     1.23
--- syscalls.c  2000/03/23 19:16:26
*************** do_AngelSWI (int reason, void * arg)
*** 103,110 ****
    asm volatile ("mov r0, %1; mov r1, %2; swi %a3; mov %0, r0"
         : "=r" (value) /* Outputs */
         : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
!        : "r0", "r1", "lr"
                /* Clobbers r0 and r1, and lr if in supervisor mode */);
    return value;
  }
  #endif /* ARM_RDI_MONITOR */
--- 103,115 ----
    asm volatile ("mov r0, %1; mov r1, %2; swi %a3; mov %0, r0"
         : "=r" (value) /* Outputs */
         : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
!        : "r0", "r1", "r2", "r3", "ip", "lr", "memory"
                /* Clobbers r0 and r1, and lr if in supervisor mode */);
+                 /* Accordingly to page 13-77 of ARM DUI 0040D other registers
+                    can also be clobbered.  Some memory positions may also be
+                    changed by a system call, so they should not be kept in
+                    registers. Note: we are assuming the manual is right and
+                    Angel is respecting the APCS */
    return value;
  }
  #endif /* ARM_RDI_MONITOR */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]