This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Corrected patch for _exit.c


Sorry, the patch I sent earlier was buggy: here's a fixed one.
2003-01-29  Michael Snyder  <msnyder@redhat.com>

	* libc/sys/h8300hms/_exit.c (_exit, __exit):  Slip a magic cookie
	into registers r1 and r2, so that the simulator can distinguish
	this trap from a breakpoint trap.  Copied from libgloss.

Index: _exit.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libc/sys/h8300hms/_exit.c,v
retrieving revision 1.3
diff -p -r1.3 _exit.c
*** _exit.c	1996/03/11 19:29:04	1.3
--- _exit.c	2003/01/30 01:29:51
*************** void
*** 10,16 ****
  _DEFUN (_exit,(rc),
       int rc)
  {
!   short rc2 = rc << 8;
    asm("mov.w %0,r0\n\tsleep" : : "r" (rc2) : "r0");
  }
  
--- 10,22 ----
  _DEFUN (_exit,(rc),
       int rc)
  {
!   short rc2;
! 
!   rc2 = 0xdead;
!   asm("mov.w %0,r1" : : "r" (rc2) : "r1");
!   rc2 = 0xbeef;
!   asm("mov.w %0,r2" : : "r" (rc2) : "r2");
!   rc2 = rc << 8;
    asm("mov.w %0,r0\n\tsleep" : : "r" (rc2) : "r0");
  }
  
*************** void
*** 18,23 ****
  _DEFUN (__exit,(rc),
       int rc)
  {
!   short rc2 = rc << 8;
    asm("mov.w %0,r0\n\tsleep" : : "r" (rc2) : "r0");
  }
--- 24,35 ----
  _DEFUN (__exit,(rc),
       int rc)
  {
!   short rc2;
! 
!   rc2 = 0xdead;
!   asm("mov.w %0,r1" : : "r" (rc2) : "r1");
!   rc2 = 0xbeef;
!   asm("mov.w %0,r2" : : "r" (rc2) : "r2");
!   rc2 = rc << 8;
    asm("mov.w %0,r0\n\tsleep" : : "r" (rc2) : "r0");
  }

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