Cygwin: pinfo: raise MAX_PID to 4194304
[newlib-cygwin.git] / libgloss / nds32 / vh.h
blobca3a43f30d53c65f833dd912fdc9a54c48fdcfc0
1 #ifndef _VH_H
2 #define _VH_H
4 /*
5 BREAK #SWID definition:
6 0x00 – 0x1F: Free to use
7 0x20 – 0x1FF: Reserved for EX9
8 0x0200 – 0x7EFF: Free to use
9 0x7F00 – 0x7FFF: Reserved for virtual hosting
11 /* These are #SWID defined for Virtual Hosting. */
12 #define VH_FOPEN 0x7F00
13 #define VH_FREOPEN 0x7F01
14 #define VH_FCLOSE 0x7F02
15 #define VH_FFLUSH 0x7F03
16 #define VH_FREAD 0x7F04
17 #define VH_FWRITE 0x7F05
18 #define VH_FGETC 0x7F06
19 #define VH_FGETS 0x7F07
20 #define VH_FPUTC 0x7F08
21 #define VH_FPUTS 0x7F09
22 #define VH_UNGETC 0x7F0A
23 #define VH_FTELL 0x7F0B
24 #define VH_FSEEK 0x7F0C
25 #define VH_REWIND 0x7F0D
26 #define VH_CLEARERR 0x7F0E
27 #define VH_FEOF 0x7F0F
28 #define VH_FERROR 0x7F10
29 #define VH_REMOVE 0x7F11
30 #define VH_TMPFILE 0x7F12
31 /* From here, define Low-level routines. */
32 #define VH_EXIT 0x7F20
33 #define VH_OPEN 0x7F21
34 #define VH_CLOSE 0x7F22
35 #define VH_READ 0x7F23
36 #define VH_WRITE 0x7F24
37 #define VH_LSEEK 0x7F25
38 #define VH_UNLINK 0x7F26
39 #define VH_RENAME 0x7F27
40 #define VH_FSTAT 0x7F28
41 #define VH_STAT 0x7F29
42 #define VH_GETTIMEOFDAY 0x7F2A
43 #define VH_ISATTY 0x7F2B
44 #define VH_SYSTEM 0x7F2C
45 #define VH_GETERR 0x7F2D /* The method we get errno. */
46 #define VH_GETPID 0x7F2E
47 #define VH_KILL 0x7F2F
48 #define VH_TIMES 0x7F30
51 /* Define macros that generate assembly output.
52 Generate a System Call exception to notify GDB
53 to handle this virtual I/O routine. */
55 .macro TYPE0 name num
56 /* If r0 is not NULL(0), set errno. */
57 .text
58 .global \name
59 .type \name, @function
60 .align 2
61 \name:
62 BREAK \num /* Generate_Exception(Breakpoint); */
63 bnez $r0, 1f /* Branch if success.
64 r0 value is not NULL(0). */
65 BREAK VH_GETERR
66 l.w $r15, _impure_ptr
67 swi $r0, [$r15] /* Set errno. */
68 move $r0, 0 /* Set return value as 0. */
70 ret
71 .size \name, .-\name
72 .endm
74 .macro TYPE1 name num
75 /* If r0 is EOF(-1), set errno. */
76 .text
77 .global \name
78 .type \name, @function
79 .align 2
80 \name:
81 BREAK \num /* Generate_Exception(Breakpoint); */
82 addi $r15, $r0, 1
83 bnezs8 1f /* Branch if success.
84 r0 value is EOF(-1). */
85 BREAK VH_GETERR
86 l.w $r15, _impure_ptr
87 swi $r0, [$r15] /* Set errno. */
88 move $r0, -1 /* Set return value as -1. */
90 ret
91 .size \name, .-\name
92 .endm
94 .macro TYPE2 name num
95 /* If r0 is less than r2, set errno. */
96 .text
97 .global \name
98 .type \name, @function
99 .align 2
100 \name:
101 BREAK \num /* Generate_Exception(Breakpoint); */
102 slt $r15, $r0, $r2 /* If r15 is set, set errno. */
103 beqzs8 1f /* Branch if success.
104 r15 is zero. */
105 move $r4, $r0 /* Keep return value r0. */
106 BREAK VH_GETERR
107 l.w $r15, _impure_ptr
108 swi $r0, [$r15] /* Set errno. */
109 move $r0, $r4 /* Restore r0. */
112 .size \name, .-\name
113 .endm
115 .macro TYPE3 name num
116 /* No errors are defined. */
117 .text
118 .global \name
119 .type \name, @function
120 .align 2
121 \name:
122 BREAK \num /* Generate_Exception(Breakpoint); */
124 .size \name, .-\name
125 .endm
126 #endif /* _VH_H */