-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlib-sim.S
52 lines (44 loc) · 947 Bytes
/
lib-sim.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Use reserved instruction.
* See gdb/sim/mips/interp.c:signal_exception(),sim_monitor()
* (ReservedInstruction)
* Memory address is defined by K0BASE. (See gdb/sim/mips/interp.c)
*/
#define SYS_exit 17
#define SYS_open 6
#define SYS_read 7
#define SYS_write 8
#define SYS_close 10
#if 1 /* New definition (changed from gdb-7.11) */
#define RSVD_INSTRUCTION 0x00000039
#else /* Old definition (until gdb-7.10.1) */
#define RSVD_INSTRUCTION 0x00000005
#endif
#define RSVD(arg) ((((arg) << 1) << 6) | RSVD_INSTRUCTION)
/* #define EXIT_BY_SYSCALL */
#define EXIT_BY_BREAK
.section .text
.globl __read
.type __read, @function
__read:
.long RSVD(SYS_read)
jr $ra
nop
.globl __write
.type __write, @function
__write:
.long RSVD(SYS_write)
jr $ra
nop
.globl __open
.type __open, @function
__open:
.long RSVD(SYS_open)
jr $ra
nop
.globl __close
.type __close, @function
__close:
.long RSVD(SYS_close)
jr $ra
nop