source: trunk/libs/newlib/src/libgloss/m32r/trap0.S @ 536

Last change on this file since 536 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 451 bytes
Line 
1; Trap 0 handler (syscall interface).
2;
3; The trap handler returns the result in r0 and the error code (errno value)
4; in r2.  r1 is reserved in case an 8 byte quantity ever needs to be
5; returned in registers.
6
7        .text
8        .global __trap0
9__trap0:
10        trap    #0              ; trap 0 returns result in r0, error code in r2
11        cmpui   r2,#1           ; is error code zero?
12        bc      .Lret           ; yes, skip setting errno
13        ld      r4,@(sp)        ; no, set errno
14        st      r2,@r4
15.Lret:
16        jmp     lr              ; return to caller
Note: See TracBrowser for help on using the repository browser.