diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-10-22 14:34:09 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-22 14:34:09 -0400 |
commit | f20e3b5fe7ead0615309433260b9784d8da0bbbd (patch) | |
tree | eabb2e47a0355ac4e8024b7087b4e7cb9f324358 /arch/parisc/kernel | |
parent | bcbfe664e7af019e698cef2feb85ac2b4f1ac11d (diff) | |
parent | f030d7b65e4e6399f23de2a41a58d1b607b6bd89 (diff) |
Merge branch 'for-rmk' of git://git.android.com/kernel into devel
Diffstat (limited to 'arch/parisc/kernel')
-rw-r--r-- | arch/parisc/kernel/.gitignore | 1 | ||||
-rw-r--r-- | arch/parisc/kernel/asm-offsets.c | 3 | ||||
-rw-r--r-- | arch/parisc/kernel/firmware.c | 69 | ||||
-rw-r--r-- | arch/parisc/kernel/head.S | 2 | ||||
-rw-r--r-- | arch/parisc/kernel/ptrace.c | 429 | ||||
-rw-r--r-- | arch/parisc/kernel/real2.S | 12 | ||||
-rw-r--r-- | arch/parisc/kernel/setup.c | 29 | ||||
-rw-r--r-- | arch/parisc/kernel/syscall_table.S | 8 | ||||
-rw-r--r-- | arch/parisc/kernel/time.c | 20 | ||||
-rw-r--r-- | arch/parisc/kernel/unwind.c | 4 |
10 files changed, 290 insertions, 287 deletions
diff --git a/arch/parisc/kernel/.gitignore b/arch/parisc/kernel/.gitignore new file mode 100644 index 000000000000..c5f676c3c224 --- /dev/null +++ b/arch/parisc/kernel/.gitignore | |||
@@ -0,0 +1 @@ | |||
vmlinux.lds | |||
diff --git a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c index 3efc0b73e4ff..699cf8ef2118 100644 --- a/arch/parisc/kernel/asm-offsets.c +++ b/arch/parisc/kernel/asm-offsets.c | |||
@@ -290,5 +290,8 @@ int main(void) | |||
290 | DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip)); | 290 | DEFINE(EXCDATA_IP, offsetof(struct exception_data, fault_ip)); |
291 | DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space)); | 291 | DEFINE(EXCDATA_SPACE, offsetof(struct exception_data, fault_space)); |
292 | DEFINE(EXCDATA_ADDR, offsetof(struct exception_data, fault_addr)); | 292 | DEFINE(EXCDATA_ADDR, offsetof(struct exception_data, fault_addr)); |
293 | BLANK(); | ||
294 | DEFINE(ASM_PDC_RESULT_SIZE, NUM_PDC_RESULT * sizeof(unsigned long)); | ||
295 | BLANK(); | ||
293 | return 0; | 296 | return 0; |
294 | } | 297 | } |
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c index 7177a6cd1b7f..03f26bd75bd8 100644 --- a/arch/parisc/kernel/firmware.c +++ b/arch/parisc/kernel/firmware.c | |||
@@ -71,8 +71,8 @@ | |||
71 | #include <asm/processor.h> /* for boot_cpu_data */ | 71 | #include <asm/processor.h> /* for boot_cpu_data */ |
72 | 72 | ||
73 | static DEFINE_SPINLOCK(pdc_lock); | 73 | static DEFINE_SPINLOCK(pdc_lock); |
74 | static unsigned long pdc_result[32] __attribute__ ((aligned (8))); | 74 | extern unsigned long pdc_result[NUM_PDC_RESULT]; |
75 | static unsigned long pdc_result2[32] __attribute__ ((aligned (8))); | 75 | extern unsigned long pdc_result2[NUM_PDC_RESULT]; |
76 | 76 | ||
77 | #ifdef CONFIG_64BIT | 77 | #ifdef CONFIG_64BIT |
78 | #define WIDE_FIRMWARE 0x1 | 78 | #define WIDE_FIRMWARE 0x1 |
@@ -150,26 +150,40 @@ static void convert_to_wide(unsigned long *addr) | |||
150 | #endif | 150 | #endif |
151 | } | 151 | } |
152 | 152 | ||
153 | #ifdef CONFIG_64BIT | ||
154 | void __init set_firmware_width_unlocked(void) | ||
155 | { | ||
156 | int ret; | ||
157 | |||
158 | ret = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, | ||
159 | __pa(pdc_result), 0); | ||
160 | convert_to_wide(pdc_result); | ||
161 | if (pdc_result[0] != NARROW_FIRMWARE) | ||
162 | parisc_narrow_firmware = 0; | ||
163 | } | ||
164 | |||
153 | /** | 165 | /** |
154 | * set_firmware_width - Determine if the firmware is wide or narrow. | 166 | * set_firmware_width - Determine if the firmware is wide or narrow. |
155 | * | 167 | * |
156 | * This function must be called before any pdc_* function that uses the convert_to_wide | 168 | * This function must be called before any pdc_* function that uses the |
157 | * function. | 169 | * convert_to_wide function. |
158 | */ | 170 | */ |
159 | void __init set_firmware_width(void) | 171 | void __init set_firmware_width(void) |
160 | { | 172 | { |
161 | #ifdef CONFIG_64BIT | ||
162 | int retval; | ||
163 | unsigned long flags; | 173 | unsigned long flags; |
174 | spin_lock_irqsave(&pdc_lock, flags); | ||
175 | set_firmware_width_unlocked(); | ||
176 | spin_unlock_irqrestore(&pdc_lock, flags); | ||
177 | } | ||
178 | #else | ||
179 | void __init set_firmware_width_unlocked(void) { | ||
180 | return; | ||
181 | } | ||
164 | 182 | ||
165 | spin_lock_irqsave(&pdc_lock, flags); | 183 | void __init set_firmware_width(void) { |
166 | retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0); | 184 | return; |
167 | convert_to_wide(pdc_result); | ||
168 | if(pdc_result[0] != NARROW_FIRMWARE) | ||
169 | parisc_narrow_firmware = 0; | ||
170 | spin_unlock_irqrestore(&pdc_lock, flags); | ||
171 | #endif | ||
172 | } | 185 | } |
186 | #endif /*CONFIG_64BIT*/ | ||
173 | 187 | ||
174 | /** | 188 | /** |
175 | * pdc_emergency_unlock - Unlock the linux pdc lock | 189 | * pdc_emergency_unlock - Unlock the linux pdc lock |
@@ -288,6 +302,20 @@ int pdc_chassis_warn(unsigned long *warn) | |||
288 | return retval; | 302 | return retval; |
289 | } | 303 | } |
290 | 304 | ||
305 | int __init pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info) | ||
306 | { | ||
307 | int ret; | ||
308 | |||
309 | ret = mem_pdc_call(PDC_COPROC, PDC_COPROC_CFG, __pa(pdc_result)); | ||
310 | convert_to_wide(pdc_result); | ||
311 | pdc_coproc_info->ccr_functional = pdc_result[0]; | ||
312 | pdc_coproc_info->ccr_present = pdc_result[1]; | ||
313 | pdc_coproc_info->revision = pdc_result[17]; | ||
314 | pdc_coproc_info->model = pdc_result[18]; | ||
315 | |||
316 | return ret; | ||
317 | } | ||
318 | |||
291 | /** | 319 | /** |
292 | * pdc_coproc_cfg - To identify coprocessors attached to the processor. | 320 | * pdc_coproc_cfg - To identify coprocessors attached to the processor. |
293 | * @pdc_coproc_info: Return buffer address. | 321 | * @pdc_coproc_info: Return buffer address. |
@@ -297,19 +325,14 @@ int pdc_chassis_warn(unsigned long *warn) | |||
297 | */ | 325 | */ |
298 | int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info) | 326 | int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info) |
299 | { | 327 | { |
300 | int retval; | 328 | int ret; |
301 | unsigned long flags; | 329 | unsigned long flags; |
302 | 330 | ||
303 | spin_lock_irqsave(&pdc_lock, flags); | 331 | spin_lock_irqsave(&pdc_lock, flags); |
304 | retval = mem_pdc_call(PDC_COPROC, PDC_COPROC_CFG, __pa(pdc_result)); | 332 | ret = pdc_coproc_cfg_unlocked(pdc_coproc_info); |
305 | convert_to_wide(pdc_result); | 333 | spin_unlock_irqrestore(&pdc_lock, flags); |
306 | pdc_coproc_info->ccr_functional = pdc_result[0]; | ||
307 | pdc_coproc_info->ccr_present = pdc_result[1]; | ||
308 | pdc_coproc_info->revision = pdc_result[17]; | ||
309 | pdc_coproc_info->model = pdc_result[18]; | ||
310 | spin_unlock_irqrestore(&pdc_lock, flags); | ||
311 | 334 | ||
312 | return retval; | 335 | return ret; |
313 | } | 336 | } |
314 | 337 | ||
315 | /** | 338 | /** |
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S index a84e31e82876..0e3d9f9b9e33 100644 --- a/arch/parisc/kernel/head.S +++ b/arch/parisc/kernel/head.S | |||
@@ -121,7 +121,7 @@ $pgt_fill_loop: | |||
121 | copy %r0,%r2 | 121 | copy %r0,%r2 |
122 | 122 | ||
123 | /* And the RFI Target address too */ | 123 | /* And the RFI Target address too */ |
124 | load32 start_kernel,%r11 | 124 | load32 start_parisc,%r11 |
125 | 125 | ||
126 | /* And the initial task pointer */ | 126 | /* And the initial task pointer */ |
127 | load32 init_thread_union,%r6 | 127 | load32 init_thread_union,%r6 |
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 49c637970789..90904f9dfc50 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2000 Hewlett-Packard Co, Linuxcare Inc. | 4 | * Copyright (C) 2000 Hewlett-Packard Co, Linuxcare Inc. |
5 | * Copyright (C) 2000 Matthew Wilcox <matthew@wil.cx> | 5 | * Copyright (C) 2000 Matthew Wilcox <matthew@wil.cx> |
6 | * Copyright (C) 2000 David Huggins-Daines <dhd@debian.org> | 6 | * Copyright (C) 2000 David Huggins-Daines <dhd@debian.org> |
7 | * Copyright (C) 2008 Helge Deller <deller@gmx.de> | ||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
@@ -27,15 +28,149 @@ | |||
27 | /* PSW bits we allow the debugger to modify */ | 28 | /* PSW bits we allow the debugger to modify */ |
28 | #define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB) | 29 | #define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB) |
29 | 30 | ||
30 | #undef DEBUG_PTRACE | 31 | /* |
32 | * Called by kernel/ptrace.c when detaching.. | ||
33 | * | ||
34 | * Make sure single step bits etc are not set. | ||
35 | */ | ||
36 | void ptrace_disable(struct task_struct *task) | ||
37 | { | ||
38 | task->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP); | ||
31 | 39 | ||
32 | #ifdef DEBUG_PTRACE | 40 | /* make sure the trap bits are not set */ |
33 | #define DBG(x...) printk(x) | 41 | pa_psw(task)->r = 0; |
34 | #else | 42 | pa_psw(task)->t = 0; |
35 | #define DBG(x...) | 43 | pa_psw(task)->h = 0; |
36 | #endif | 44 | pa_psw(task)->l = 0; |
45 | } | ||
46 | |||
47 | /* | ||
48 | * The following functions are called by ptrace_resume() when | ||
49 | * enabling or disabling single/block tracing. | ||
50 | */ | ||
51 | void user_disable_single_step(struct task_struct *task) | ||
52 | { | ||
53 | ptrace_disable(task); | ||
54 | } | ||
55 | |||
56 | void user_enable_single_step(struct task_struct *task) | ||
57 | { | ||
58 | task->ptrace &= ~PT_BLOCKSTEP; | ||
59 | task->ptrace |= PT_SINGLESTEP; | ||
60 | |||
61 | if (pa_psw(task)->n) { | ||
62 | struct siginfo si; | ||
63 | |||
64 | /* Nullified, just crank over the queue. */ | ||
65 | task_regs(task)->iaoq[0] = task_regs(task)->iaoq[1]; | ||
66 | task_regs(task)->iasq[0] = task_regs(task)->iasq[1]; | ||
67 | task_regs(task)->iaoq[1] = task_regs(task)->iaoq[0] + 4; | ||
68 | pa_psw(task)->n = 0; | ||
69 | pa_psw(task)->x = 0; | ||
70 | pa_psw(task)->y = 0; | ||
71 | pa_psw(task)->z = 0; | ||
72 | pa_psw(task)->b = 0; | ||
73 | ptrace_disable(task); | ||
74 | /* Don't wake up the task, but let the | ||
75 | parent know something happened. */ | ||
76 | si.si_code = TRAP_TRACE; | ||
77 | si.si_addr = (void __user *) (task_regs(task)->iaoq[0] & ~3); | ||
78 | si.si_signo = SIGTRAP; | ||
79 | si.si_errno = 0; | ||
80 | force_sig_info(SIGTRAP, &si, task); | ||
81 | /* notify_parent(task, SIGCHLD); */ | ||
82 | return; | ||
83 | } | ||
84 | |||
85 | /* Enable recovery counter traps. The recovery counter | ||
86 | * itself will be set to zero on a task switch. If the | ||
87 | * task is suspended on a syscall then the syscall return | ||
88 | * path will overwrite the recovery counter with a suitable | ||
89 | * value such that it traps once back in user space. We | ||
90 | * disable interrupts in the tasks PSW here also, to avoid | ||
91 | * interrupts while the recovery counter is decrementing. | ||
92 | */ | ||
93 | pa_psw(task)->r = 1; | ||
94 | pa_psw(task)->t = 0; | ||
95 | pa_psw(task)->h = 0; | ||
96 | pa_psw(task)->l = 0; | ||
97 | } | ||
98 | |||
99 | void user_enable_block_step(struct task_struct *task) | ||
100 | { | ||
101 | task->ptrace &= ~PT_SINGLESTEP; | ||
102 | task->ptrace |= PT_BLOCKSTEP; | ||
103 | |||
104 | /* Enable taken branch trap. */ | ||
105 | pa_psw(task)->r = 0; | ||
106 | pa_psw(task)->t = 1; | ||
107 | pa_psw(task)->h = 0; | ||
108 | pa_psw(task)->l = 0; | ||
109 | } | ||
110 | |||
111 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | ||
112 | { | ||
113 | unsigned long tmp; | ||
114 | long ret = -EIO; | ||
37 | 115 | ||
38 | #ifdef CONFIG_64BIT | 116 | switch (request) { |
117 | |||
118 | /* Read the word at location addr in the USER area. For ptraced | ||
119 | processes, the kernel saves all regs on a syscall. */ | ||
120 | case PTRACE_PEEKUSR: | ||
121 | if ((addr & (sizeof(long)-1)) || | ||
122 | (unsigned long) addr >= sizeof(struct pt_regs)) | ||
123 | break; | ||
124 | tmp = *(unsigned long *) ((char *) task_regs(child) + addr); | ||
125 | ret = put_user(tmp, (unsigned long *) data); | ||
126 | break; | ||
127 | |||
128 | /* Write the word at location addr in the USER area. This will need | ||
129 | to change when the kernel no longer saves all regs on a syscall. | ||
130 | FIXME. There is a problem at the moment in that r3-r18 are only | ||
131 | saved if the process is ptraced on syscall entry, and even then | ||
132 | those values are overwritten by actual register values on syscall | ||
133 | exit. */ | ||
134 | case PTRACE_POKEUSR: | ||
135 | /* Some register values written here may be ignored in | ||
136 | * entry.S:syscall_restore_rfi; e.g. iaoq is written with | ||
137 | * r31/r31+4, and not with the values in pt_regs. | ||
138 | */ | ||
139 | if (addr == PT_PSW) { | ||
140 | /* Allow writing to Nullify, Divide-step-correction, | ||
141 | * and carry/borrow bits. | ||
142 | * BEWARE, if you set N, and then single step, it won't | ||
143 | * stop on the nullified instruction. | ||
144 | */ | ||
145 | data &= USER_PSW_BITS; | ||
146 | task_regs(child)->gr[0] &= ~USER_PSW_BITS; | ||
147 | task_regs(child)->gr[0] |= data; | ||
148 | ret = 0; | ||
149 | break; | ||
150 | } | ||
151 | |||
152 | if ((addr & (sizeof(long)-1)) || | ||
153 | (unsigned long) addr >= sizeof(struct pt_regs)) | ||
154 | break; | ||
155 | if ((addr >= PT_GR1 && addr <= PT_GR31) || | ||
156 | addr == PT_IAOQ0 || addr == PT_IAOQ1 || | ||
157 | (addr >= PT_FR0 && addr <= PT_FR31 + 4) || | ||
158 | addr == PT_SAR) { | ||
159 | *(unsigned long *) ((char *) task_regs(child) + addr) = data; | ||
160 | ret = 0; | ||
161 | } | ||
162 | break; | ||
163 | |||
164 | default: | ||
165 | ret = ptrace_request(child, request, addr, data); | ||
166 | break; | ||
167 | } | ||
168 | |||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | |||
173 | #ifdef CONFIG_COMPAT | ||
39 | 174 | ||
40 | /* This function is needed to translate 32 bit pt_regs offsets in to | 175 | /* This function is needed to translate 32 bit pt_regs offsets in to |
41 | * 64 bit pt_regs offsets. For example, a 32 bit gdb under a 64 bit kernel | 176 | * 64 bit pt_regs offsets. For example, a 32 bit gdb under a 64 bit kernel |
@@ -61,106 +196,25 @@ static long translate_usr_offset(long offset) | |||
61 | else | 196 | else |
62 | return -1; | 197 | return -1; |
63 | } | 198 | } |
64 | #endif | ||
65 | 199 | ||
66 | /* | 200 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
67 | * Called by kernel/ptrace.c when detaching.. | 201 | compat_ulong_t addr, compat_ulong_t data) |
68 | * | ||
69 | * Make sure single step bits etc are not set. | ||
70 | */ | ||
71 | void ptrace_disable(struct task_struct *child) | ||
72 | { | 202 | { |
73 | /* make sure the trap bits are not set */ | 203 | compat_uint_t tmp; |
74 | pa_psw(child)->r = 0; | 204 | long ret = -EIO; |
75 | pa_psw(child)->t = 0; | ||
76 | pa_psw(child)->h = 0; | ||
77 | pa_psw(child)->l = 0; | ||
78 | } | ||
79 | |||
80 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | ||
81 | { | ||
82 | long ret; | ||
83 | #ifdef DEBUG_PTRACE | ||
84 | long oaddr=addr, odata=data; | ||
85 | #endif | ||
86 | 205 | ||
87 | switch (request) { | 206 | switch (request) { |
88 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | ||
89 | case PTRACE_PEEKDATA: { | ||
90 | #ifdef CONFIG_64BIT | ||
91 | if (__is_compat_task(child)) { | ||
92 | int copied; | ||
93 | unsigned int tmp; | ||
94 | |||
95 | addr &= 0xffffffffL; | ||
96 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); | ||
97 | ret = -EIO; | ||
98 | if (copied != sizeof(tmp)) | ||
99 | goto out_tsk; | ||
100 | ret = put_user(tmp,(unsigned int *) data); | ||
101 | DBG("sys_ptrace(PEEK%s, %d, %lx, %lx) returning %ld, data %x\n", | ||
102 | request == PTRACE_PEEKTEXT ? "TEXT" : "DATA", | ||
103 | pid, oaddr, odata, ret, tmp); | ||
104 | } | ||
105 | else | ||
106 | #endif | ||
107 | ret = generic_ptrace_peekdata(child, addr, data); | ||
108 | goto out_tsk; | ||
109 | } | ||
110 | 207 | ||
111 | /* when I and D space are separate, this will have to be fixed. */ | 208 | case PTRACE_PEEKUSR: |
112 | case PTRACE_POKETEXT: /* write the word at location addr. */ | 209 | if (addr & (sizeof(compat_uint_t)-1)) |
113 | case PTRACE_POKEDATA: | 210 | break; |
114 | ret = 0; | 211 | addr = translate_usr_offset(addr); |
115 | #ifdef CONFIG_64BIT | 212 | if (addr < 0) |
116 | if (__is_compat_task(child)) { | 213 | break; |
117 | unsigned int tmp = (unsigned int)data; | ||
118 | DBG("sys_ptrace(POKE%s, %d, %lx, %lx)\n", | ||
119 | request == PTRACE_POKETEXT ? "TEXT" : "DATA", | ||
120 | pid, oaddr, odata); | ||
121 | addr &= 0xffffffffL; | ||
122 | if (access_process_vm(child, addr, &tmp, sizeof(tmp), 1) == sizeof(tmp)) | ||
123 | goto out_tsk; | ||
124 | } | ||
125 | else | ||
126 | #endif | ||
127 | { | ||
128 | if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data)) | ||
129 | goto out_tsk; | ||
130 | } | ||
131 | ret = -EIO; | ||
132 | goto out_tsk; | ||
133 | |||
134 | /* Read the word at location addr in the USER area. For ptraced | ||
135 | processes, the kernel saves all regs on a syscall. */ | ||
136 | case PTRACE_PEEKUSR: { | ||
137 | ret = -EIO; | ||
138 | #ifdef CONFIG_64BIT | ||
139 | if (__is_compat_task(child)) { | ||
140 | unsigned int tmp; | ||
141 | |||
142 | if (addr & (sizeof(int)-1)) | ||
143 | goto out_tsk; | ||
144 | if ((addr = translate_usr_offset(addr)) < 0) | ||
145 | goto out_tsk; | ||
146 | |||
147 | tmp = *(unsigned int *) ((char *) task_regs(child) + addr); | ||
148 | ret = put_user(tmp, (unsigned int *) data); | ||
149 | DBG("sys_ptrace(PEEKUSR, %d, %lx, %lx) returning %ld, addr %lx, data %x\n", | ||
150 | pid, oaddr, odata, ret, addr, tmp); | ||
151 | } | ||
152 | else | ||
153 | #endif | ||
154 | { | ||
155 | unsigned long tmp; | ||
156 | 214 | ||
157 | if ((addr & (sizeof(long)-1)) || (unsigned long) addr >= sizeof(struct pt_regs)) | 215 | tmp = *(compat_uint_t *) ((char *) task_regs(child) + addr); |
158 | goto out_tsk; | 216 | ret = put_user(tmp, (compat_uint_t *) (unsigned long) data); |
159 | tmp = *(unsigned long *) ((char *) task_regs(child) + addr); | 217 | break; |
160 | ret = put_user(tmp, (unsigned long *) data); | ||
161 | } | ||
162 | goto out_tsk; | ||
163 | } | ||
164 | 218 | ||
165 | /* Write the word at location addr in the USER area. This will need | 219 | /* Write the word at location addr in the USER area. This will need |
166 | to change when the kernel no longer saves all regs on a syscall. | 220 | to change when the kernel no longer saves all regs on a syscall. |
@@ -169,185 +223,46 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
169 | those values are overwritten by actual register values on syscall | 223 | those values are overwritten by actual register values on syscall |
170 | exit. */ | 224 | exit. */ |
171 | case PTRACE_POKEUSR: | 225 | case PTRACE_POKEUSR: |
172 | ret = -EIO; | ||
173 | /* Some register values written here may be ignored in | 226 | /* Some register values written here may be ignored in |
174 | * entry.S:syscall_restore_rfi; e.g. iaoq is written with | 227 | * entry.S:syscall_restore_rfi; e.g. iaoq is written with |
175 | * r31/r31+4, and not with the values in pt_regs. | 228 | * r31/r31+4, and not with the values in pt_regs. |
176 | */ | 229 | */ |
177 | /* PT_PSW=0, so this is valid for 32 bit processes under 64 | ||
178 | * bit kernels. | ||
179 | */ | ||
180 | if (addr == PT_PSW) { | 230 | if (addr == PT_PSW) { |
181 | /* PT_PSW=0, so this is valid for 32 bit processes | 231 | /* Since PT_PSW==0, it is valid for 32 bit processes |
182 | * under 64 bit kernels. | 232 | * under 64 bit kernels as well. |
183 | * | ||
184 | * Allow writing to Nullify, Divide-step-correction, | ||
185 | * and carry/borrow bits. | ||
186 | * BEWARE, if you set N, and then single step, it won't | ||
187 | * stop on the nullified instruction. | ||
188 | */ | 233 | */ |
189 | DBG("sys_ptrace(POKEUSR, %d, %lx, %lx)\n", | 234 | ret = arch_ptrace(child, request, addr, data); |
190 | pid, oaddr, odata); | 235 | } else { |
191 | data &= USER_PSW_BITS; | 236 | if (addr & (sizeof(compat_uint_t)-1)) |
192 | task_regs(child)->gr[0] &= ~USER_PSW_BITS; | 237 | break; |
193 | task_regs(child)->gr[0] |= data; | 238 | addr = translate_usr_offset(addr); |
194 | ret = 0; | 239 | if (addr < 0) |
195 | goto out_tsk; | 240 | break; |
196 | } | ||
197 | #ifdef CONFIG_64BIT | ||
198 | if (__is_compat_task(child)) { | ||
199 | if (addr & (sizeof(int)-1)) | ||
200 | goto out_tsk; | ||
201 | if ((addr = translate_usr_offset(addr)) < 0) | ||
202 | goto out_tsk; | ||
203 | DBG("sys_ptrace(POKEUSR, %d, %lx, %lx) addr %lx\n", | ||
204 | pid, oaddr, odata, addr); | ||
205 | if (addr >= PT_FR0 && addr <= PT_FR31 + 4) { | 241 | if (addr >= PT_FR0 && addr <= PT_FR31 + 4) { |
206 | /* Special case, fp regs are 64 bits anyway */ | 242 | /* Special case, fp regs are 64 bits anyway */ |
207 | *(unsigned int *) ((char *) task_regs(child) + addr) = data; | 243 | *(__u64 *) ((char *) task_regs(child) + addr) = data; |
208 | ret = 0; | 244 | ret = 0; |
209 | } | 245 | } |
210 | else if ((addr >= PT_GR1+4 && addr <= PT_GR31+4) || | 246 | else if ((addr >= PT_GR1+4 && addr <= PT_GR31+4) || |
211 | addr == PT_IAOQ0+4 || addr == PT_IAOQ1+4 || | 247 | addr == PT_IAOQ0+4 || addr == PT_IAOQ1+4 || |
212 | addr == PT_SAR+4) { | 248 | addr == PT_SAR+4) { |
213 | /* Zero the top 32 bits */ | 249 | /* Zero the top 32 bits */ |
214 | *(unsigned int *) ((char *) task_regs(child) + addr - 4) = 0; | 250 | *(__u32 *) ((char *) task_regs(child) + addr - 4) = 0; |
215 | *(unsigned int *) ((char *) task_regs(child) + addr) = data; | 251 | *(__u32 *) ((char *) task_regs(child) + addr) = data; |
216 | ret = 0; | 252 | ret = 0; |
217 | } | 253 | } |
218 | goto out_tsk; | ||
219 | } | 254 | } |
220 | else | 255 | break; |
221 | #endif | ||
222 | { | ||
223 | if ((addr & (sizeof(long)-1)) || (unsigned long) addr >= sizeof(struct pt_regs)) | ||
224 | goto out_tsk; | ||
225 | if ((addr >= PT_GR1 && addr <= PT_GR31) || | ||
226 | addr == PT_IAOQ0 || addr == PT_IAOQ1 || | ||
227 | (addr >= PT_FR0 && addr <= PT_FR31 + 4) || | ||
228 | addr == PT_SAR) { | ||
229 | *(unsigned long *) ((char *) task_regs(child) + addr) = data; | ||
230 | ret = 0; | ||
231 | } | ||
232 | goto out_tsk; | ||
233 | } | ||
234 | |||
235 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | ||
236 | case PTRACE_CONT: | ||
237 | ret = -EIO; | ||
238 | DBG("sys_ptrace(%s)\n", | ||
239 | request == PTRACE_SYSCALL ? "SYSCALL" : "CONT"); | ||
240 | if (!valid_signal(data)) | ||
241 | goto out_tsk; | ||
242 | child->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP); | ||
243 | if (request == PTRACE_SYSCALL) { | ||
244 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
245 | } else { | ||
246 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
247 | } | ||
248 | child->exit_code = data; | ||
249 | goto out_wake_notrap; | ||
250 | |||
251 | case PTRACE_KILL: | ||
252 | /* | ||
253 | * make the child exit. Best I can do is send it a | ||
254 | * sigkill. perhaps it should be put in the status | ||
255 | * that it wants to exit. | ||
256 | */ | ||
257 | ret = 0; | ||
258 | DBG("sys_ptrace(KILL)\n"); | ||
259 | if (child->exit_state == EXIT_ZOMBIE) /* already dead */ | ||
260 | goto out_tsk; | ||
261 | child->exit_code = SIGKILL; | ||
262 | goto out_wake_notrap; | ||
263 | |||
264 | case PTRACE_SINGLEBLOCK: | ||
265 | DBG("sys_ptrace(SINGLEBLOCK)\n"); | ||
266 | ret = -EIO; | ||
267 | if (!valid_signal(data)) | ||
268 | goto out_tsk; | ||
269 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
270 | child->ptrace &= ~PT_SINGLESTEP; | ||
271 | child->ptrace |= PT_BLOCKSTEP; | ||
272 | child->exit_code = data; | ||
273 | |||
274 | /* Enable taken branch trap. */ | ||
275 | pa_psw(child)->r = 0; | ||
276 | pa_psw(child)->t = 1; | ||
277 | pa_psw(child)->h = 0; | ||
278 | pa_psw(child)->l = 0; | ||
279 | goto out_wake; | ||
280 | |||
281 | case PTRACE_SINGLESTEP: | ||
282 | DBG("sys_ptrace(SINGLESTEP)\n"); | ||
283 | ret = -EIO; | ||
284 | if (!valid_signal(data)) | ||
285 | goto out_tsk; | ||
286 | |||
287 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
288 | child->ptrace &= ~PT_BLOCKSTEP; | ||
289 | child->ptrace |= PT_SINGLESTEP; | ||
290 | child->exit_code = data; | ||
291 | |||
292 | if (pa_psw(child)->n) { | ||
293 | struct siginfo si; | ||
294 | |||
295 | /* Nullified, just crank over the queue. */ | ||
296 | task_regs(child)->iaoq[0] = task_regs(child)->iaoq[1]; | ||
297 | task_regs(child)->iasq[0] = task_regs(child)->iasq[1]; | ||
298 | task_regs(child)->iaoq[1] = task_regs(child)->iaoq[0] + 4; | ||
299 | pa_psw(child)->n = 0; | ||
300 | pa_psw(child)->x = 0; | ||
301 | pa_psw(child)->y = 0; | ||
302 | pa_psw(child)->z = 0; | ||
303 | pa_psw(child)->b = 0; | ||
304 | ptrace_disable(child); | ||
305 | /* Don't wake up the child, but let the | ||
306 | parent know something happened. */ | ||
307 | si.si_code = TRAP_TRACE; | ||
308 | si.si_addr = (void __user *) (task_regs(child)->iaoq[0] & ~3); | ||
309 | si.si_signo = SIGTRAP; | ||
310 | si.si_errno = 0; | ||
311 | force_sig_info(SIGTRAP, &si, child); | ||
312 | //notify_parent(child, SIGCHLD); | ||
313 | //ret = 0; | ||
314 | goto out_wake; | ||
315 | } | ||
316 | |||
317 | /* Enable recovery counter traps. The recovery counter | ||
318 | * itself will be set to zero on a task switch. If the | ||
319 | * task is suspended on a syscall then the syscall return | ||
320 | * path will overwrite the recovery counter with a suitable | ||
321 | * value such that it traps once back in user space. We | ||
322 | * disable interrupts in the childs PSW here also, to avoid | ||
323 | * interrupts while the recovery counter is decrementing. | ||
324 | */ | ||
325 | pa_psw(child)->r = 1; | ||
326 | pa_psw(child)->t = 0; | ||
327 | pa_psw(child)->h = 0; | ||
328 | pa_psw(child)->l = 0; | ||
329 | /* give it a chance to run. */ | ||
330 | goto out_wake; | ||
331 | |||
332 | case PTRACE_GETEVENTMSG: | ||
333 | ret = put_user(child->ptrace_message, (unsigned int __user *) data); | ||
334 | goto out_tsk; | ||
335 | 256 | ||
336 | default: | 257 | default: |
337 | ret = ptrace_request(child, request, addr, data); | 258 | ret = compat_ptrace_request(child, request, addr, data); |
338 | goto out_tsk; | 259 | break; |
339 | } | 260 | } |
340 | 261 | ||
341 | out_wake_notrap: | ||
342 | ptrace_disable(child); | ||
343 | out_wake: | ||
344 | wake_up_process(child); | ||
345 | ret = 0; | ||
346 | out_tsk: | ||
347 | DBG("arch_ptrace(%ld, %d, %lx, %lx) returning %ld\n", | ||
348 | request, pid, oaddr, odata, ret); | ||
349 | return ret; | 262 | return ret; |
350 | } | 263 | } |
264 | #endif | ||
265 | |||
351 | 266 | ||
352 | void syscall_trace(void) | 267 | void syscall_trace(void) |
353 | { | 268 | { |
diff --git a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S index 7a92695d95a6..5f3d3a1f9037 100644 --- a/arch/parisc/kernel/real2.S +++ b/arch/parisc/kernel/real2.S | |||
@@ -8,12 +8,24 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <asm/pdc.h> | ||
11 | #include <asm/psw.h> | 12 | #include <asm/psw.h> |
12 | #include <asm/assembly.h> | 13 | #include <asm/assembly.h> |
14 | #include <asm/asm-offsets.h> | ||
13 | 15 | ||
14 | #include <linux/linkage.h> | 16 | #include <linux/linkage.h> |
15 | 17 | ||
18 | |||
16 | .section .bss | 19 | .section .bss |
20 | |||
21 | .export pdc_result | ||
22 | .export pdc_result2 | ||
23 | .align 8 | ||
24 | pdc_result: | ||
25 | .block ASM_PDC_RESULT_SIZE | ||
26 | pdc_result2: | ||
27 | .block ASM_PDC_RESULT_SIZE | ||
28 | |||
17 | .export real_stack | 29 | .export real_stack |
18 | .export real32_stack | 30 | .export real32_stack |
19 | .export real64_stack | 31 | .export real64_stack |
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c index 39e7c5a5946a..7d27853ff8c8 100644 --- a/arch/parisc/kernel/setup.c +++ b/arch/parisc/kernel/setup.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <asm/pdc_chassis.h> | 44 | #include <asm/pdc_chassis.h> |
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <asm/setup.h> | 46 | #include <asm/setup.h> |
47 | #include <asm/unwind.h> | ||
47 | 48 | ||
48 | static char __initdata command_line[COMMAND_LINE_SIZE]; | 49 | static char __initdata command_line[COMMAND_LINE_SIZE]; |
49 | 50 | ||
@@ -123,6 +124,7 @@ void __init setup_arch(char **cmdline_p) | |||
123 | #ifdef CONFIG_64BIT | 124 | #ifdef CONFIG_64BIT |
124 | extern int parisc_narrow_firmware; | 125 | extern int parisc_narrow_firmware; |
125 | #endif | 126 | #endif |
127 | unwind_init(); | ||
126 | 128 | ||
127 | init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */ | 129 | init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */ |
128 | 130 | ||
@@ -368,6 +370,31 @@ static int __init parisc_init(void) | |||
368 | 370 | ||
369 | return 0; | 371 | return 0; |
370 | } | 372 | } |
371 | |||
372 | arch_initcall(parisc_init); | 373 | arch_initcall(parisc_init); |
373 | 374 | ||
375 | void start_parisc(void) | ||
376 | { | ||
377 | extern void start_kernel(void); | ||
378 | |||
379 | int ret, cpunum; | ||
380 | struct pdc_coproc_cfg coproc_cfg; | ||
381 | |||
382 | cpunum = smp_processor_id(); | ||
383 | |||
384 | set_firmware_width_unlocked(); | ||
385 | |||
386 | ret = pdc_coproc_cfg_unlocked(&coproc_cfg); | ||
387 | if (ret >= 0 && coproc_cfg.ccr_functional) { | ||
388 | mtctl(coproc_cfg.ccr_functional, 10); | ||
389 | |||
390 | cpu_data[cpunum].fp_rev = coproc_cfg.revision; | ||
391 | cpu_data[cpunum].fp_model = coproc_cfg.model; | ||
392 | |||
393 | asm volatile ("fstd %fr0,8(%sp)"); | ||
394 | } else { | ||
395 | panic("must have an fpu to boot linux"); | ||
396 | } | ||
397 | |||
398 | start_kernel(); | ||
399 | // not reached | ||
400 | } | ||
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index c7e59f548817..303d2b647e41 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -87,7 +87,7 @@ | |||
87 | ENTRY_SAME(setuid) | 87 | ENTRY_SAME(setuid) |
88 | ENTRY_SAME(getuid) | 88 | ENTRY_SAME(getuid) |
89 | ENTRY_COMP(stime) /* 25 */ | 89 | ENTRY_COMP(stime) /* 25 */ |
90 | ENTRY_SAME(ptrace) | 90 | ENTRY_COMP(ptrace) |
91 | ENTRY_SAME(alarm) | 91 | ENTRY_SAME(alarm) |
92 | /* see stat comment */ | 92 | /* see stat comment */ |
93 | ENTRY_COMP(newfstat) | 93 | ENTRY_COMP(newfstat) |
@@ -407,6 +407,12 @@ | |||
407 | ENTRY_SAME(timerfd_create) | 407 | ENTRY_SAME(timerfd_create) |
408 | ENTRY_COMP(timerfd_settime) | 408 | ENTRY_COMP(timerfd_settime) |
409 | ENTRY_COMP(timerfd_gettime) | 409 | ENTRY_COMP(timerfd_gettime) |
410 | ENTRY_COMP(signalfd4) | ||
411 | ENTRY_SAME(eventfd2) /* 310 */ | ||
412 | ENTRY_SAME(epoll_create1) | ||
413 | ENTRY_SAME(dup3) | ||
414 | ENTRY_SAME(pipe2) | ||
415 | ENTRY_SAME(inotify_init1) | ||
410 | 416 | ||
411 | /* Nothing yet */ | 417 | /* Nothing yet */ |
412 | 418 | ||
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 24be86bba94d..4d09203bc693 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/profile.h> | 24 | #include <linux/profile.h> |
25 | #include <linux/clocksource.h> | 25 | #include <linux/clocksource.h> |
26 | #include <linux/platform_device.h> | ||
26 | 27 | ||
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
28 | #include <asm/io.h> | 29 | #include <asm/io.h> |
@@ -215,6 +216,24 @@ void __init start_cpu_itimer(void) | |||
215 | cpu_data[cpu].it_value = next_tick; | 216 | cpu_data[cpu].it_value = next_tick; |
216 | } | 217 | } |
217 | 218 | ||
219 | struct platform_device rtc_parisc_dev = { | ||
220 | .name = "rtc-parisc", | ||
221 | .id = -1, | ||
222 | }; | ||
223 | |||
224 | static int __init rtc_init(void) | ||
225 | { | ||
226 | int ret; | ||
227 | |||
228 | ret = platform_device_register(&rtc_parisc_dev); | ||
229 | if (ret < 0) | ||
230 | printk(KERN_ERR "unable to register rtc device...\n"); | ||
231 | |||
232 | /* not necessarily an error */ | ||
233 | return 0; | ||
234 | } | ||
235 | module_init(rtc_init); | ||
236 | |||
218 | void __init time_init(void) | 237 | void __init time_init(void) |
219 | { | 238 | { |
220 | static struct pdc_tod tod_data; | 239 | static struct pdc_tod tod_data; |
@@ -245,4 +264,3 @@ void __init time_init(void) | |||
245 | xtime.tv_nsec = 0; | 264 | xtime.tv_nsec = 0; |
246 | } | 265 | } |
247 | } | 266 | } |
248 | |||
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index 701b2d2d8882..6773c582e457 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c | |||
@@ -170,7 +170,7 @@ void unwind_table_remove(struct unwind_table *table) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | /* Called from setup_arch to import the kernel unwind info */ | 172 | /* Called from setup_arch to import the kernel unwind info */ |
173 | static int unwind_init(void) | 173 | int unwind_init(void) |
174 | { | 174 | { |
175 | long start, stop; | 175 | long start, stop; |
176 | register unsigned long gp __asm__ ("r27"); | 176 | register unsigned long gp __asm__ ("r27"); |
@@ -417,5 +417,3 @@ int unwind_to_user(struct unwind_frame_info *info) | |||
417 | 417 | ||
418 | return ret; | 418 | return ret; |
419 | } | 419 | } |
420 | |||
421 | module_init(unwind_init); | ||