[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / um / include / sysdep-x86_64 / ptrace.h
blob348e8fcd513fe6b4759a943603327bcb927fbad2
1 /*
2 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
7 #ifndef __SYSDEP_X86_64_PTRACE_H
8 #define __SYSDEP_X86_64_PTRACE_H
10 #include "uml-config.h"
11 #include "user_constants.h"
12 #include "sysdep/faultinfo.h"
14 #define MAX_REG_OFFSET (UM_FRAME_SIZE)
15 #define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
17 #ifdef UML_CONFIG_MODE_TT
18 #include "sysdep/sc.h"
19 #endif
21 #ifdef UML_CONFIG_MODE_SKAS
22 #include "skas_ptregs.h"
24 #define REGS_IP(r) ((r)[HOST_IP])
25 #define REGS_SP(r) ((r)[HOST_SP])
27 #define REGS_RBX(r) ((r)[HOST_RBX])
28 #define REGS_RCX(r) ((r)[HOST_RCX])
29 #define REGS_RDX(r) ((r)[HOST_RDX])
30 #define REGS_RSI(r) ((r)[HOST_RSI])
31 #define REGS_RDI(r) ((r)[HOST_RDI])
32 #define REGS_RBP(r) ((r)[HOST_RBP])
33 #define REGS_RAX(r) ((r)[HOST_RAX])
34 #define REGS_R8(r) ((r)[HOST_R8])
35 #define REGS_R9(r) ((r)[HOST_R9])
36 #define REGS_R10(r) ((r)[HOST_R10])
37 #define REGS_R11(r) ((r)[HOST_R11])
38 #define REGS_R12(r) ((r)[HOST_R12])
39 #define REGS_R13(r) ((r)[HOST_R13])
40 #define REGS_R14(r) ((r)[HOST_R14])
41 #define REGS_R15(r) ((r)[HOST_R15])
42 #define REGS_CS(r) ((r)[HOST_CS])
43 #define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
44 #define REGS_SS(r) ((r)[HOST_SS])
46 #define HOST_FS_BASE 21
47 #define HOST_GS_BASE 22
48 #define HOST_DS 23
49 #define HOST_ES 24
50 #define HOST_FS 25
51 #define HOST_GS 26
53 #define REGS_FS_BASE(r) ((r)[HOST_FS_BASE])
54 #define REGS_GS_BASE(r) ((r)[HOST_GS_BASE])
55 #define REGS_DS(r) ((r)[HOST_DS])
56 #define REGS_ES(r) ((r)[HOST_ES])
57 #define REGS_FS(r) ((r)[HOST_FS])
58 #define REGS_GS(r) ((r)[HOST_GS])
60 #define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_RAX])
62 #define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res)
64 #define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
66 #define REGS_SEGV_IS_FIXABLE(r) SEGV_IS_FIXABLE((r)->trap_type)
68 #define REGS_FAULT_ADDR(r) ((r)->fault_addr)
70 #define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type)
72 #define REGS_TRAP(r) ((r)->trap_type)
74 #define REGS_ERR(r) ((r)->fault_type)
76 #endif
78 #include "choose-mode.h"
80 /* XXX */
81 union uml_pt_regs {
82 #ifdef UML_CONFIG_MODE_TT
83 struct tt_regs {
84 long syscall;
85 unsigned long orig_rax;
86 void *sc;
87 struct faultinfo faultinfo;
88 } tt;
89 #endif
90 #ifdef UML_CONFIG_MODE_SKAS
91 struct skas_regs {
92 /* XXX */
93 unsigned long regs[27];
94 unsigned long fp[65];
95 struct faultinfo faultinfo;
96 long syscall;
97 int is_user;
98 } skas;
99 #endif
102 #define EMPTY_UML_PT_REGS { }
104 /* XXX */
105 extern int mode_tt;
107 #define UPT_RBX(r) __CHOOSE_MODE(SC_RBX(UPT_SC(r)), REGS_RBX((r)->skas.regs))
108 #define UPT_RCX(r) __CHOOSE_MODE(SC_RCX(UPT_SC(r)), REGS_RCX((r)->skas.regs))
109 #define UPT_RDX(r) __CHOOSE_MODE(SC_RDX(UPT_SC(r)), REGS_RDX((r)->skas.regs))
110 #define UPT_RSI(r) __CHOOSE_MODE(SC_RSI(UPT_SC(r)), REGS_RSI((r)->skas.regs))
111 #define UPT_RDI(r) __CHOOSE_MODE(SC_RDI(UPT_SC(r)), REGS_RDI((r)->skas.regs))
112 #define UPT_RBP(r) __CHOOSE_MODE(SC_RBP(UPT_SC(r)), REGS_RBP((r)->skas.regs))
113 #define UPT_RAX(r) __CHOOSE_MODE(SC_RAX(UPT_SC(r)), REGS_RAX((r)->skas.regs))
114 #define UPT_R8(r) __CHOOSE_MODE(SC_R8(UPT_SC(r)), REGS_R8((r)->skas.regs))
115 #define UPT_R9(r) __CHOOSE_MODE(SC_R9(UPT_SC(r)), REGS_R9((r)->skas.regs))
116 #define UPT_R10(r) __CHOOSE_MODE(SC_R10(UPT_SC(r)), REGS_R10((r)->skas.regs))
117 #define UPT_R11(r) __CHOOSE_MODE(SC_R11(UPT_SC(r)), REGS_R11((r)->skas.regs))
118 #define UPT_R12(r) __CHOOSE_MODE(SC_R12(UPT_SC(r)), REGS_R12((r)->skas.regs))
119 #define UPT_R13(r) __CHOOSE_MODE(SC_R13(UPT_SC(r)), REGS_R13((r)->skas.regs))
120 #define UPT_R14(r) __CHOOSE_MODE(SC_R14(UPT_SC(r)), REGS_R14((r)->skas.regs))
121 #define UPT_R15(r) __CHOOSE_MODE(SC_R15(UPT_SC(r)), REGS_R15((r)->skas.regs))
122 #define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
123 #define UPT_FS(r) __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs))
124 #define UPT_GS(r) __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs))
125 #define UPT_DS(r) __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs))
126 #define UPT_ES(r) __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs))
127 #define UPT_CS(r) __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
128 #define UPT_ORIG_RAX(r) \
129 __CHOOSE_MODE((r)->tt.orig_rax, REGS_ORIG_RAX((r)->skas.regs))
131 #define UPT_IP(r) __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs))
132 #define UPT_SP(r) __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs))
134 #define UPT_EFLAGS(r) \
135 __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs))
136 #define UPT_SC(r) ((r)->tt.sc)
137 #define UPT_SYSCALL_NR(r) __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
139 extern int user_context(unsigned long sp);
141 #define UPT_IS_USER(r) \
142 CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
144 #define UPT_SYSCALL_ARG1(r) UPT_RDI(r)
145 #define UPT_SYSCALL_ARG2(r) UPT_RSI(r)
146 #define UPT_SYSCALL_ARG3(r) UPT_RDX(r)
147 #define UPT_SYSCALL_ARG4(r) UPT_R10(r)
148 #define UPT_SYSCALL_ARG5(r) UPT_R8(r)
149 #define UPT_SYSCALL_ARG6(r) UPT_R9(r)
151 struct syscall_args {
152 unsigned long args[6];
155 #define SYSCALL_ARGS(r) ((struct syscall_args) \
156 { .args = { UPT_SYSCALL_ARG1(r), \
157 UPT_SYSCALL_ARG2(r), \
158 UPT_SYSCALL_ARG3(r), \
159 UPT_SYSCALL_ARG4(r), \
160 UPT_SYSCALL_ARG5(r), \
161 UPT_SYSCALL_ARG6(r) } } )
163 #define UPT_REG(regs, reg) \
164 ({ unsigned long val; \
165 switch(reg){ \
166 case R8: val = UPT_R8(regs); break; \
167 case R9: val = UPT_R9(regs); break; \
168 case R10: val = UPT_R10(regs); break; \
169 case R11: val = UPT_R11(regs); break; \
170 case R12: val = UPT_R12(regs); break; \
171 case R13: val = UPT_R13(regs); break; \
172 case R14: val = UPT_R14(regs); break; \
173 case R15: val = UPT_R15(regs); break; \
174 case RIP: val = UPT_IP(regs); break; \
175 case RSP: val = UPT_SP(regs); break; \
176 case RAX: val = UPT_RAX(regs); break; \
177 case RBX: val = UPT_RBX(regs); break; \
178 case RCX: val = UPT_RCX(regs); break; \
179 case RDX: val = UPT_RDX(regs); break; \
180 case RSI: val = UPT_RSI(regs); break; \
181 case RDI: val = UPT_RDI(regs); break; \
182 case RBP: val = UPT_RBP(regs); break; \
183 case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \
184 case CS: val = UPT_CS(regs); break; \
185 case DS: val = UPT_DS(regs); break; \
186 case ES: val = UPT_ES(regs); break; \
187 case FS: val = UPT_FS(regs); break; \
188 case GS: val = UPT_GS(regs); break; \
189 case EFLAGS: val = UPT_EFLAGS(regs); break; \
190 default : \
191 panic("Bad register in UPT_REG : %d\n", reg); \
192 val = -1; \
194 val; \
198 #define UPT_SET(regs, reg, val) \
199 ({ unsigned long val; \
200 switch(reg){ \
201 case R8: UPT_R8(regs) = val; break; \
202 case R9: UPT_R9(regs) = val; break; \
203 case R10: UPT_R10(regs) = val; break; \
204 case R11: UPT_R11(regs) = val; break; \
205 case R12: UPT_R12(regs) = val; break; \
206 case R13: UPT_R13(regs) = val; break; \
207 case R14: UPT_R14(regs) = val; break; \
208 case R15: UPT_R15(regs) = val; break; \
209 case RIP: UPT_IP(regs) = val; break; \
210 case RSP: UPT_SP(regs) = val; break; \
211 case RAX: UPT_RAX(regs) = val; break; \
212 case RBX: UPT_RBX(regs) = val; break; \
213 case RCX: UPT_RCX(regs) = val; break; \
214 case RDX: UPT_RDX(regs) = val; break; \
215 case RSI: UPT_RSI(regs) = val; break; \
216 case RDI: UPT_RDI(regs) = val; break; \
217 case RBP: UPT_RBP(regs) = val; break; \
218 case ORIG_RAX: UPT_ORIG_RAX(regs) = val; break; \
219 case CS: UPT_CS(regs) = val; break; \
220 case DS: UPT_DS(regs) = val; break; \
221 case ES: UPT_ES(regs) = val; break; \
222 case FS: UPT_FS(regs) = val; break; \
223 case GS: UPT_GS(regs) = val; break; \
224 case EFLAGS: UPT_EFLAGS(regs) = val; break; \
225 default : \
226 panic("Bad register in UPT_SET : %d\n", reg); \
227 break; \
229 val; \
232 #define UPT_SET_SYSCALL_RETURN(r, res) \
233 CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \
234 REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
236 #define UPT_RESTART_SYSCALL(r) \
237 CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
238 REGS_RESTART_SYSCALL((r)->skas.regs))
240 #define UPT_SEGV_IS_FIXABLE(r) \
241 CHOOSE_MODE(SC_SEGV_IS_FIXABLE(UPT_SC(r)), \
242 REGS_SEGV_IS_FIXABLE(&r->skas))
244 #define UPT_FAULTINFO(r) \
245 CHOOSE_MODE((&(r)->tt.faultinfo), (&(r)->skas.faultinfo))
247 #endif
250 * Overrides for Emacs so that we follow Linus's tabbing style.
251 * Emacs will notice this stuff at the end of the file and automatically
252 * adjust the settings for this buffer only. This must remain at the end
253 * of the file.
254 * ---------------------------------------------------------------------------
255 * Local variables:
256 * c-file-style: "linux"
257 * End: