fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / libgloss / mcore / syscalls.S
blob61a2847aaa7223bdfbfeefd4f40fea7077510fa5
1 .macro FUNC_START name
2         .text
3         .globl \name
4         .globl _\name
5 \name:
6 _\name:
7 .endm
8         
9 FUNC_START _sbrk
10         mov     r4, r2                  // save increment
11         lrw     r3, brkval
12         ldw     r2, (r3)                // get next spot
14         movi    r5, 7
15         addi    r2, 7                   // round up to 8 bytes
16         andn    r2, r5
18         addu    r4, r2                  // save updated pointer
19         stw     r4, (r3)
20         jmp     r15
22 // brk() could go in here too...
24         .data
25         .import _end
26 brkval: .long   _end
28         
29 FUNC_START _exit
30         mov     r1, r1          // accomodate simulator glitch...
31         .short  0x5000
32         br      _exit           // hard loop here
34 // 0x5001 - printf
35 // 0x5002 - scanf
36         
37 FUNC_START utime
38         .short  0x5003
39         jmp     r15
42 .macro stub name value
43 FUNC_START \name
44         movi    r1, \value
45         .short  0x50FF
46         jmp     r15
47 .endm
49 stub _close   6
50 stub _lseek  19
51 stub _open    5 
52 stub _read    3
53 stub _times  43
54 stub _unlink 10
55 stub _write   4
56         
57 //stub access  33
58 //stub creat    8
59 //stub link     9
60 //stub time    13
62 //stub profil 98  // movi r6, 2
63 //stub lprofil 98 // movi r6, 4
64