| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | 
|  | 3 | * Licensed under the GPL | 
|  | 4 | */ | 
|  | 5 |  | 
|  | 6 | #ifndef __UM_PTRACE_I386_H | 
|  | 7 | #define __UM_PTRACE_I386_H | 
|  | 8 |  | 
| Jeff Dike | 79d20b1 | 2005-05-03 07:54:51 +0100 | [diff] [blame] | 9 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 | 
|  | 10 |  | 
| Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 11 | #include "linux/compiler.h" | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include "sysdep/ptrace.h" | 
|  | 13 | #include "asm/ptrace-generic.h" | 
| Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 14 | #include "asm/host_ldt.h" | 
|  | 15 | #include "choose-mode.h" | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 |  | 
|  | 17 | #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) | 
|  | 18 | #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) | 
|  | 19 | #define PT_REGS_ECX(r) UPT_ECX(&(r)->regs) | 
|  | 20 | #define PT_REGS_EDX(r) UPT_EDX(&(r)->regs) | 
|  | 21 | #define PT_REGS_ESI(r) UPT_ESI(&(r)->regs) | 
|  | 22 | #define PT_REGS_EDI(r) UPT_EDI(&(r)->regs) | 
|  | 23 | #define PT_REGS_EBP(r) UPT_EBP(&(r)->regs) | 
|  | 24 |  | 
|  | 25 | #define PT_REGS_CS(r) UPT_CS(&(r)->regs) | 
|  | 26 | #define PT_REGS_SS(r) UPT_SS(&(r)->regs) | 
|  | 27 | #define PT_REGS_DS(r) UPT_DS(&(r)->regs) | 
|  | 28 | #define PT_REGS_ES(r) UPT_ES(&(r)->regs) | 
|  | 29 | #define PT_REGS_FS(r) UPT_FS(&(r)->regs) | 
|  | 30 | #define PT_REGS_GS(r) UPT_GS(&(r)->regs) | 
|  | 31 |  | 
|  | 32 | #define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) | 
|  | 33 |  | 
|  | 34 | #define PT_REGS_ORIG_SYSCALL(r) PT_REGS_EAX(r) | 
|  | 35 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r) | 
|  | 36 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | 
|  | 37 |  | 
| Paolo 'Blaisorblade' Giarrusso | 84dd8d7 | 2005-06-25 14:55:26 -0700 | [diff] [blame] | 38 | /* Cope with a conditional i386 definition. */ | 
|  | 39 | #undef profile_pc | 
|  | 40 | #define profile_pc(regs) PT_REGS_IP(regs) | 
|  | 41 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | 
|  | 43 |  | 
| Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 44 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, | 
|  | 45 | struct user_desc __user *user_desc); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 |  | 
| Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 47 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, | 
|  | 48 | struct user_desc __user *user_desc); | 
|  | 49 |  | 
|  | 50 | extern int do_set_thread_area_skas(struct user_desc *info); | 
|  | 51 | extern int do_get_thread_area_skas(struct user_desc *info); | 
|  | 52 |  | 
|  | 53 | extern int do_set_thread_area_tt(struct user_desc *info); | 
|  | 54 | extern int do_get_thread_area_tt(struct user_desc *info); | 
|  | 55 |  | 
|  | 56 | extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to); | 
|  | 57 | extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to); | 
|  | 58 |  | 
| Paolo 'Blaisorblade' Giarrusso | 5b0e947 | 2006-04-10 22:53:34 -0700 | [diff] [blame] | 59 | extern void arch_switch_to_tt(struct task_struct *from, struct task_struct *to); | 
|  | 60 | extern void arch_switch_to_skas(struct task_struct *from, struct task_struct *to); | 
|  | 61 |  | 
| Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 62 | static inline int do_get_thread_area(struct user_desc *info) | 
|  | 63 | { | 
|  | 64 | return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info); | 
|  | 65 | } | 
|  | 66 |  | 
|  | 67 | static inline int do_set_thread_area(struct user_desc *info) | 
|  | 68 | { | 
|  | 69 | return CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, info); | 
|  | 70 | } | 
|  | 71 |  | 
|  | 72 | struct task_struct; | 
|  | 73 |  | 
|  | 74 | #endif |