[MIPS] Always pass -msoft-float.
[linux-2.6/openmoko-kernel/knife-kernel.git] / arch / um / include / sysdep-i386 / ptrace.h
blobc8ee9559f3ab2d3994fc83e424627b9c53993607
1 /*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #ifndef __SYSDEP_I386_PTRACE_H
7 #define __SYSDEP_I386_PTRACE_H
9 #include "uml-config.h"
10 #include "user_constants.h"
11 #include "sysdep/faultinfo.h"
12 #include "choose-mode.h"
14 #define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
15 #define MAX_REG_OFFSET (UM_FRAME_SIZE)
17 extern void update_debugregs(int seq);
19 /* syscall emulation path in ptrace */
21 #ifndef PTRACE_SYSEMU
22 #define PTRACE_SYSEMU 31
23 #endif
25 void set_using_sysemu(int value);
26 int get_using_sysemu(void);
27 extern int sysemu_supported;
29 #ifdef UML_CONFIG_MODE_TT
30 #include "sysdep/sc.h"
31 #endif
33 #ifdef UML_CONFIG_MODE_SKAS
35 #include "skas_ptregs.h"
37 #define REGS_IP(r) ((r)[HOST_IP])
38 #define REGS_SP(r) ((r)[HOST_SP])
39 #define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
40 #define REGS_EAX(r) ((r)[HOST_EAX])
41 #define REGS_EBX(r) ((r)[HOST_EBX])
42 #define REGS_ECX(r) ((r)[HOST_ECX])
43 #define REGS_EDX(r) ((r)[HOST_EDX])
44 #define REGS_ESI(r) ((r)[HOST_ESI])
45 #define REGS_EDI(r) ((r)[HOST_EDI])
46 #define REGS_EBP(r) ((r)[HOST_EBP])
47 #define REGS_CS(r) ((r)[HOST_CS])
48 #define REGS_SS(r) ((r)[HOST_SS])
49 #define REGS_DS(r) ((r)[HOST_DS])
50 #define REGS_ES(r) ((r)[HOST_ES])
51 #define REGS_FS(r) ((r)[HOST_FS])
52 #define REGS_GS(r) ((r)[HOST_GS])
54 #define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res)
56 #define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
58 #endif
59 #ifndef PTRACE_SYSEMU_SINGLESTEP
60 #define PTRACE_SYSEMU_SINGLESTEP 32
61 #endif
63 union uml_pt_regs {
64 #ifdef UML_CONFIG_MODE_TT
65 struct tt_regs {
66 long syscall;
67 void *sc;
68 struct faultinfo faultinfo;
69 } tt;
70 #endif
71 #ifdef UML_CONFIG_MODE_SKAS
72 struct skas_regs {
73 unsigned long regs[HOST_FRAME_SIZE];
74 unsigned long fp[HOST_FP_SIZE];
75 unsigned long xfp[HOST_XFP_SIZE];
76 struct faultinfo faultinfo;
77 long syscall;
78 int is_user;
79 } skas;
80 #endif
83 #define EMPTY_UML_PT_REGS { }
85 extern int mode_tt;
87 #define UPT_SC(r) ((r)->tt.sc)
88 #define UPT_IP(r) \
89 __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs))
90 #define UPT_SP(r) \
91 __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs))
92 #define UPT_EFLAGS(r) \
93 __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs))
94 #define UPT_EAX(r) \
95 __CHOOSE_MODE(SC_EAX(UPT_SC(r)), REGS_EAX((r)->skas.regs))
96 #define UPT_EBX(r) \
97 __CHOOSE_MODE(SC_EBX(UPT_SC(r)), REGS_EBX((r)->skas.regs))
98 #define UPT_ECX(r) \
99 __CHOOSE_MODE(SC_ECX(UPT_SC(r)), REGS_ECX((r)->skas.regs))
100 #define UPT_EDX(r) \
101 __CHOOSE_MODE(SC_EDX(UPT_SC(r)), REGS_EDX((r)->skas.regs))
102 #define UPT_ESI(r) \
103 __CHOOSE_MODE(SC_ESI(UPT_SC(r)), REGS_ESI((r)->skas.regs))
104 #define UPT_EDI(r) \
105 __CHOOSE_MODE(SC_EDI(UPT_SC(r)), REGS_EDI((r)->skas.regs))
106 #define UPT_EBP(r) \
107 __CHOOSE_MODE(SC_EBP(UPT_SC(r)), REGS_EBP((r)->skas.regs))
108 #define UPT_ORIG_EAX(r) \
109 __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
110 #define UPT_CS(r) \
111 __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
112 #define UPT_SS(r) \
113 __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs))
114 #define UPT_DS(r) \
115 __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs))
116 #define UPT_ES(r) \
117 __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs))
118 #define UPT_FS(r) \
119 __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs))
120 #define UPT_GS(r) \
121 __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs))
123 #define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
124 #define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
125 #define UPT_SYSCALL_ARG3(r) UPT_EDX(r)
126 #define UPT_SYSCALL_ARG4(r) UPT_ESI(r)
127 #define UPT_SYSCALL_ARG5(r) UPT_EDI(r)
128 #define UPT_SYSCALL_ARG6(r) UPT_EBP(r)
130 extern int user_context(unsigned long sp);
132 #define UPT_IS_USER(r) \
133 CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
135 struct syscall_args {
136 unsigned long args[6];
139 #define SYSCALL_ARGS(r) ((struct syscall_args) \
140 { .args = { UPT_SYSCALL_ARG1(r), \
141 UPT_SYSCALL_ARG2(r), \
142 UPT_SYSCALL_ARG3(r), \
143 UPT_SYSCALL_ARG4(r), \
144 UPT_SYSCALL_ARG5(r), \
145 UPT_SYSCALL_ARG6(r) } } )
147 #define UPT_REG(regs, reg) \
148 ({ unsigned long val; \
149 switch(reg){ \
150 case EIP: val = UPT_IP(regs); break; \
151 case UESP: val = UPT_SP(regs); break; \
152 case EAX: val = UPT_EAX(regs); break; \
153 case EBX: val = UPT_EBX(regs); break; \
154 case ECX: val = UPT_ECX(regs); break; \
155 case EDX: val = UPT_EDX(regs); break; \
156 case ESI: val = UPT_ESI(regs); break; \
157 case EDI: val = UPT_EDI(regs); break; \
158 case EBP: val = UPT_EBP(regs); break; \
159 case ORIG_EAX: val = UPT_ORIG_EAX(regs); break; \
160 case CS: val = UPT_CS(regs); break; \
161 case SS: val = UPT_SS(regs); break; \
162 case DS: val = UPT_DS(regs); break; \
163 case ES: val = UPT_ES(regs); break; \
164 case FS: val = UPT_FS(regs); break; \
165 case GS: val = UPT_GS(regs); break; \
166 case EFL: val = UPT_EFLAGS(regs); break; \
167 default : \
168 panic("Bad register in UPT_REG : %d\n", reg); \
169 val = -1; \
171 val; \
175 #define UPT_SET(regs, reg, val) \
176 do { \
177 switch(reg){ \
178 case EIP: UPT_IP(regs) = val; break; \
179 case UESP: UPT_SP(regs) = val; break; \
180 case EAX: UPT_EAX(regs) = val; break; \
181 case EBX: UPT_EBX(regs) = val; break; \
182 case ECX: UPT_ECX(regs) = val; break; \
183 case EDX: UPT_EDX(regs) = val; break; \
184 case ESI: UPT_ESI(regs) = val; break; \
185 case EDI: UPT_EDI(regs) = val; break; \
186 case EBP: UPT_EBP(regs) = val; break; \
187 case ORIG_EAX: UPT_ORIG_EAX(regs) = val; break; \
188 case CS: UPT_CS(regs) = val; break; \
189 case SS: UPT_SS(regs) = val; break; \
190 case DS: UPT_DS(regs) = val; break; \
191 case ES: UPT_ES(regs) = val; break; \
192 case FS: UPT_FS(regs) = val; break; \
193 case GS: UPT_GS(regs) = val; break; \
194 case EFL: UPT_EFLAGS(regs) = val; break; \
195 default : \
196 panic("Bad register in UPT_SET : %d\n", reg); \
197 break; \
199 } while (0)
201 #define UPT_SET_SYSCALL_RETURN(r, res) \
202 CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \
203 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
205 #define UPT_RESTART_SYSCALL(r) \
206 CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
207 REGS_RESTART_SYSCALL((r)->skas.regs))
209 #define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
210 #define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
211 #define UPT_SYSCALL_RET(r) UPT_EAX(r)
213 #define UPT_FAULTINFO(r) \
214 CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
216 #endif
219 * Overrides for Emacs so that we follow Linus's tabbing style.
220 * Emacs will notice this stuff at the end of the file and automatically
221 * adjust the settings for this buffer only. This must remain at the end
222 * of the file.
223 * ---------------------------------------------------------------------------
224 * Local variables:
225 * c-file-style: "linux"
226 * End: