Last change
on this file since 643 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
918 bytes
|
Line | |
---|
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 |
---|
13 | |
---|
14 | movi r5, 7 |
---|
15 | addi r2, 7 // round up to 8 bytes |
---|
16 | andn r2, r5 |
---|
17 | |
---|
18 | addu r4, r2 // save updated pointer |
---|
19 | stw r4, (r3) |
---|
20 | jmp r15 |
---|
21 | |
---|
22 | // brk() could go in here too... |
---|
23 | |
---|
24 | .data |
---|
25 | .import _end |
---|
26 | brkval: .long _end |
---|
27 | |
---|
28 | |
---|
29 | FUNC_START _exit |
---|
30 | mov r1, r1 // accomodate simulator glitch... |
---|
31 | .short 0x5000 |
---|
32 | br _exit // hard loop here |
---|
33 | |
---|
34 | // 0x5001 - printf |
---|
35 | // 0x5002 - scanf |
---|
36 | |
---|
37 | FUNC_START utime |
---|
38 | .short 0x5003 |
---|
39 | jmp r15 |
---|
40 | |
---|
41 | |
---|
42 | .macro stub name value |
---|
43 | FUNC_START \name |
---|
44 | movi r1, \value |
---|
45 | .short 0x50FF |
---|
46 | jmp r15 |
---|
47 | .endm |
---|
48 | |
---|
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 |
---|
61 | |
---|
62 | //stub profil 98 // movi r6, 2 |
---|
63 | //stub lprofil 98 // movi r6, 4 |
---|
64 | |
---|
Note: See
TracBrowser
for help on using the repository browser.