[MIPS] Always pass -msoft-float.
[linux-2.6/openmoko-kernel/knife-kernel.git] / arch / um / sys-x86_64 / ptrace.c
blob74eee5c7c6dd7aa3b6b79d244bb54d2cda33439a
1 /*
2 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
7 #define __FRAME_OFFSETS
8 #include <asm/ptrace.h>
9 #include <linux/sched.h>
10 #include <linux/errno.h>
11 #include <asm/uaccess.h>
12 #include <asm/elf.h>
14 /* XXX x86_64 */
15 unsigned long not_ss;
16 unsigned long not_ds;
17 unsigned long not_es;
19 #define SC_SS(r) (not_ss)
20 #define SC_DS(r) (not_ds)
21 #define SC_ES(r) (not_es)
23 /* determines which flags the user has access to. */
24 /* 1 = access 0 = no access */
25 #define FLAG_MASK 0x44dd5UL
27 int putreg(struct task_struct *child, int regno, unsigned long value)
29 unsigned long tmp;
31 #ifdef TIF_IA32
32 /* Some code in the 64bit emulation may not be 64bit clean.
33 Don't take any chances. */
34 if (test_tsk_thread_flag(child, TIF_IA32))
35 value &= 0xffffffff;
36 #endif
37 switch (regno){
38 case FS:
39 case GS:
40 case DS:
41 case ES:
42 case SS:
43 case CS:
44 if (value && (value & 3) != 3)
45 return -EIO;
46 value &= 0xffff;
47 break;
49 case FS_BASE:
50 case GS_BASE:
51 if (!((value >> 48) == 0 || (value >> 48) == 0xffff))
52 return -EIO;
53 break;
55 case EFLAGS:
56 value &= FLAG_MASK;
57 tmp = PT_REGS_EFLAGS(&child->thread.regs) & ~FLAG_MASK;
58 value |= tmp;
59 break;
62 PT_REGS_SET(&child->thread.regs, regno, value);
63 return 0;
66 int poke_user(struct task_struct *child, long addr, long data)
68 if ((addr & 3) || addr < 0)
69 return -EIO;
71 if (addr < MAX_REG_OFFSET)
72 return putreg(child, addr, data);
74 #if 0 /* Need x86_64 debugregs handling */
75 else if((addr >= offsetof(struct user, u_debugreg[0])) &&
76 (addr <= offsetof(struct user, u_debugreg[7]))){
77 addr -= offsetof(struct user, u_debugreg[0]);
78 addr = addr >> 2;
79 if((addr == 4) || (addr == 5)) return -EIO;
80 child->thread.arch.debugregs[addr] = data;
81 return 0;
83 #endif
84 return -EIO;
87 unsigned long getreg(struct task_struct *child, int regno)
89 unsigned long retval = ~0UL;
90 switch (regno) {
91 case FS:
92 case GS:
93 case DS:
94 case ES:
95 case SS:
96 case CS:
97 retval = 0xffff;
98 /* fall through */
99 default:
100 retval &= PT_REG(&child->thread.regs, regno);
101 #ifdef TIF_IA32
102 if (test_tsk_thread_flag(child, TIF_IA32))
103 retval &= 0xffffffff;
104 #endif
106 return retval;
109 int peek_user(struct task_struct *child, long addr, long data)
111 /* read the word at location addr in the USER area. */
112 unsigned long tmp;
114 if ((addr & 3) || addr < 0)
115 return -EIO;
117 tmp = 0; /* Default return condition */
118 if(addr < MAX_REG_OFFSET){
119 tmp = getreg(child, addr);
121 #if 0 /* Need x86_64 debugregs handling */
122 else if((addr >= offsetof(struct user, u_debugreg[0])) &&
123 (addr <= offsetof(struct user, u_debugreg[7]))){
124 addr -= offsetof(struct user, u_debugreg[0]);
125 addr = addr >> 2;
126 tmp = child->thread.arch.debugregs[addr];
128 #endif
129 return put_user(tmp, (unsigned long *) data);
132 void arch_switch(void)
134 /* XXX
135 printk("arch_switch\n");
139 int is_syscall(unsigned long addr)
141 panic("is_syscall");
144 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
146 panic("dump_fpu");
147 return(1);
150 int get_fpregs(unsigned long buf, struct task_struct *child)
152 panic("get_fpregs");
153 return(0);
156 int set_fpregs(unsigned long buf, struct task_struct *child)
158 panic("set_fpregs");
159 return(0);
162 int get_fpxregs(unsigned long buf, struct task_struct *tsk)
164 panic("get_fpxregs");
165 return(0);
168 int set_fpxregs(unsigned long buf, struct task_struct *tsk)
170 panic("set_fxpregs");
171 return(0);
175 * Overrides for Emacs so that we follow Linus's tabbing style.
176 * Emacs will notice this stuff at the end of the file and automatically
177 * adjust the settings for this buffer only. This must remain at the end
178 * of the file.
179 * ---------------------------------------------------------------------------
180 * Local variables:
181 * c-file-style: "linux"
182 * End: