[RFA] _exit tweak for h8300
Michael Snyder
msnyder@redhat.com
Thu Jan 30 01:18:00 GMT 2003
Again, this is for the benefit of gdb. I've copied a trick
that's used in a number of libgloss targets where the trap
instruction is overloaded -- namely letting _exit set a magic
value in one or more registers, so that the simulator can
differentiate _exit from a breakpoint.
-------------- next part --------------
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:07:00
*************** 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" (tmp) : "r1");
! rc2 = 0xbeef;
! asm("mov.w %0,r2" : : "r" (tmp) : "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" (tmp) : "r1");
! rc2 = 0xbeef;
! asm("mov.w %0,r2" : : "r" (tmp) : "r2");
! rc2 = rc << 8;
asm("mov.w %0,r0\n\tsleep" : : "r" (rc2) : "r0");
}
More information about the Newlib
mailing list