ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/ppc_asm.tmpl
Revision: 1.7
Committed: 2005-06-28T16:47:32Z (19 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.6: +34 -2 lines
Log Message:
The alternate stack trick never worked as you can't modify an active stack.
i.e. it returned EPERM and ran into stack corruption to eventually crash the
emulator. This is noticeable in !hw_mac_cursor_accl mode (e.g. fullscreen DGA).

In order to the sigalstack() to be effective, we must kludge the kernel to
think it's running on another stack. In practise, we provide another stack
for the SIGUSR2 handler. sigusr2_handler_init() fulfills that purpose.

I hope this fixes remaining issues forever. At some point, I had multiple
*_init() handlers in case this is necessary.

File Contents

# User Rev Content
1 gbeauche 1.5 /* Define usage of "reserved" registers */
2     #if defined(__linux__)
3     #define SYSTEM_CLOBBERS_R2 1 /* Pointer to Thread Local Storage */
4     #define SYSTEM_CLOBBERS_R13 1 /* Pointer to .sdata section */
5     #endif
6    
7     #ifdef __ASSEMBLY__
8     /* Helper macros */
9     #ifdef SYSTEM_CLOBBERS_R2
10     #define RESTORE_SYSTEM_R2 lwz r2,XLM_TOC(0)
11     #define SAVE_SYSTEM_R2 stw r2,XLM_TOC(0)
12     #else
13     #define RESTORE_SYSTEM_R2
14     #define SAVE_SYSTEM_R2
15     #endif
16     #ifdef SYSTEM_CLOBBERS_R13
17     #define RESTORE_SYSTEM_R13 lwz r13,XLM_R13(0)
18     #define SAVE_SYSTEM_R13 stw r13,XLM_R13(0)
19     #else
20     #define RESTORE_SYSTEM_R13
21     #define SAVE_SYSTEM_R13
22     #endif
23    
24 gbeauche 1.7 /* Helper macros */
25     #define xglue(x, y) x ## y
26     #define glue(x, y) xglue(x, y)
27    
28 gbeauche 1.5 /* Apple assembler perticularities */
29 gbeauche 1.2 #if (defined(__APPLE__) && defined(__MACH__))
30 gbeauche 1.7 #define C_SYMBOL_NAME(NAME) glue(_, NAME)
31     #define ASM_TYPE(NAME, TYPE) /* nothing */
32     #define ASM_ALIGN_2(EXP) EXP
33     #define ASM_HA16(VAR) ha16(VAR)
34     #define ASM_LO16(VAR, REG) lo16(VAR)(REG)
35 gbeauche 1.3 #define ASM_MACRO_END .endmacro
36 gbeauche 1.7 #define ASM_MACRO_ARG_SEP ,
37 gbeauche 1.6 #define ASM_MACRO_ARG0_DEF /* nothing! */
38     #define ASM_MACRO_ARG0 $0
39 gbeauche 1.7 #define ASM_MACRO_ARG1_DEF /* nothing! */
40 gbeauche 1.6 #define ASM_MACRO_ARG1 $1
41 gbeauche 1.7 #define ASM_MACRO_ARG2_DEF /* nothing! */
42     #define ASM_MACRO_ARG2 $2
43     #define ASM_MACRO_ARG3_DEF /* nothing! */
44     #define ASM_MACRO_ARG3 $3
45 gbeauche 1.3 #endif
46    
47     /* Defaults for GNU assembler */
48 gbeauche 1.7 #ifndef ASM_TYPE
49     #define ASM_TYPE(NAME, TYPE) .type NAME, TYPE
50     #endif
51     #ifndef ASM_ALIGN_2
52     #define ASM_ALIGN_2(EXP) (1 << (EXP))
53     #endif
54     #ifndef ASM_HA16
55     #define ASM_HA16(VAR) VAR@ha
56     #endif
57     #ifndef ASM_LO16
58     #define ASM_LO16(VAR, REG) VAR@l(REG)
59     #endif
60 gbeauche 1.3 #ifndef ASM_MACRO_START
61     #define ASM_MACRO_START .macro
62     #endif
63     #ifndef ASM_MACRO_END
64     #define ASM_MACRO_END .endm
65 gbeauche 1.2 #endif
66 gbeauche 1.7 #ifndef ASM_MACRO_ARG_SEP
67     #define ASM_MACRO_ARG_SEP
68     #endif
69 gbeauche 1.6 #ifndef ASM_MACRO_ARG0_DEF
70     #define ASM_MACRO_ARG0_DEF __asm_macro_arg0
71     #define ASM_MACRO_ARG0 \__asm_macro_arg0
72     #define ASM_MACRO_ARG1_DEF , __asm_macro_arg1
73     #define ASM_MACRO_ARG1 \__asm_macro_arg1
74 gbeauche 1.7 #define ASM_MACRO_ARG2_DEF , __asm_macro_arg2
75     #define ASM_MACRO_ARG2 \__asm_macro_arg2
76     #define ASM_MACRO_ARG3_DEF , __asm_macro_arg3
77     #define ASM_MACRO_ARG3 \__asm_macro_arg3
78 gbeauche 1.6 #endif
79 gbeauche 1.2 #ifndef C_SYMBOL_NAME
80 gbeauche 1.3 #define C_SYMBOL_NAME(NAME) NAME
81 gbeauche 1.2 #endif
82     #ifndef ASM_GLOBAL_DIRECTIVE
83 gbeauche 1.3 #define ASM_GLOBAL_DIRECTIVE .globl
84 gbeauche 1.2 #endif
85    
86 cebix 1.1 /* Register names */
87 gbeauche 1.4 #if defined(__linux__) || defined(__NetBSD__)
88 cebix 1.1 #define r0 0
89     #define r1 1
90     #define r2 2
91     #define r3 3
92     #define r4 4
93     #define r5 5
94     #define r6 6
95     #define r7 7
96     #define r8 8
97     #define r9 9
98     #define r10 10
99     #define r11 11
100     #define r12 12
101     #define r13 13
102     #define r14 14
103     #define r15 15
104     #define r16 16
105     #define r17 17
106     #define r18 18
107     #define r19 19
108     #define r20 20
109     #define r21 21
110     #define r22 22
111     #define r23 23
112     #define r24 24
113     #define r25 25
114     #define r26 26
115     #define r27 27
116     #define r28 28
117     #define r29 29
118     #define r30 30
119     #define r31 31
120 gbeauche 1.2 #endif
121 cebix 1.1
122 gbeauche 1.4 #if defined(__linux__) || defined(__NetBSD__)
123 cebix 1.1 #define f0 0
124     #define f1 1
125     #define f2 2
126     #define f3 3
127     #define f4 4
128     #define f5 5
129     #define f6 6
130     #define f7 7
131     #define f8 8
132     #define f9 9
133     #define f10 10
134     #define f11 11
135     #define f12 12
136     #define f13 13
137     #define f14 14
138     #define f15 15
139     #define f16 16
140     #define f17 17
141     #define f18 18
142     #define f19 19
143     #define f20 20
144     #define f21 21
145     #define f22 22
146     #define f23 23
147     #define f24 24
148     #define f25 25
149     #define f26 26
150     #define f27 27
151     #define f28 28
152     #define f29 29
153     #define f30 30
154     #define f31 31
155 gbeauche 1.2 #endif
156 gbeauche 1.5 #endif