diff options
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r-- | arch/sh/kernel/ptrace.c | 44 | ||||
-rw-r--r-- | arch/sh/kernel/setup.c | 26 |
2 files changed, 9 insertions, 61 deletions
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c index 1fbe5a428e31..1a8be06519ec 100644 --- a/arch/sh/kernel/ptrace.c +++ b/arch/sh/kernel/ptrace.c | |||
@@ -80,48 +80,11 @@ void ptrace_disable(struct task_struct *child) | |||
80 | /* nothing to do.. */ | 80 | /* nothing to do.. */ |
81 | } | 81 | } |
82 | 82 | ||
83 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | 83 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
84 | { | 84 | { |
85 | struct task_struct *child; | ||
86 | struct user * dummy = NULL; | 85 | struct user * dummy = NULL; |
87 | int ret; | 86 | int ret; |
88 | 87 | ||
89 | lock_kernel(); | ||
90 | ret = -EPERM; | ||
91 | if (request == PTRACE_TRACEME) { | ||
92 | /* are we already being traced? */ | ||
93 | if (current->ptrace & PT_PTRACED) | ||
94 | goto out; | ||
95 | ret = security_ptrace(current->parent, current); | ||
96 | if (ret) | ||
97 | goto out; | ||
98 | /* set the ptrace bit in the process flags. */ | ||
99 | current->ptrace |= PT_PTRACED; | ||
100 | ret = 0; | ||
101 | goto out; | ||
102 | } | ||
103 | ret = -ESRCH; | ||
104 | read_lock(&tasklist_lock); | ||
105 | child = find_task_by_pid(pid); | ||
106 | if (child) | ||
107 | get_task_struct(child); | ||
108 | read_unlock(&tasklist_lock); | ||
109 | if (!child) | ||
110 | goto out; | ||
111 | |||
112 | ret = -EPERM; | ||
113 | if (pid == 1) /* you may not mess with init */ | ||
114 | goto out_tsk; | ||
115 | |||
116 | if (request == PTRACE_ATTACH) { | ||
117 | ret = ptrace_attach(child); | ||
118 | goto out_tsk; | ||
119 | } | ||
120 | |||
121 | ret = ptrace_check_attach(child, request == PTRACE_KILL); | ||
122 | if (ret < 0) | ||
123 | goto out_tsk; | ||
124 | |||
125 | switch (request) { | 88 | switch (request) { |
126 | /* when I and D space are separate, these will need to be fixed. */ | 89 | /* when I and D space are separate, these will need to be fixed. */ |
127 | case PTRACE_PEEKTEXT: /* read word at location addr. */ | 90 | case PTRACE_PEEKTEXT: /* read word at location addr. */ |
@@ -289,10 +252,7 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | |||
289 | ret = ptrace_request(child, request, addr, data); | 252 | ret = ptrace_request(child, request, addr, data); |
290 | break; | 253 | break; |
291 | } | 254 | } |
292 | out_tsk: | 255 | |
293 | put_task_struct(child); | ||
294 | out: | ||
295 | unlock_kernel(); | ||
296 | return ret; | 256 | return ret; |
297 | } | 257 | } |
298 | 258 | ||
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 25b9d9ebe858..036050b377cd 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -83,9 +83,9 @@ static struct sh_machine_vector* __init get_mv_byname(const char* name); | |||
83 | /* ... */ | 83 | /* ... */ |
84 | #define COMMAND_LINE ((char *) (PARAM+0x100)) | 84 | #define COMMAND_LINE ((char *) (PARAM+0x100)) |
85 | 85 | ||
86 | #define RAMDISK_IMAGE_START_MASK 0x07FF | 86 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
87 | #define RAMDISK_PROMPT_FLAG 0x8000 | 87 | #define RAMDISK_PROMPT_FLAG 0x8000 |
88 | #define RAMDISK_LOAD_FLAG 0x4000 | 88 | #define RAMDISK_LOAD_FLAG 0x4000 |
89 | 89 | ||
90 | static char command_line[COMMAND_LINE_SIZE] = { 0, }; | 90 | static char command_line[COMMAND_LINE_SIZE] = { 0, }; |
91 | 91 | ||
@@ -284,18 +284,6 @@ void __init setup_arch(char **cmdline_p) | |||
284 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | 284 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) |
285 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | 285 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) |
286 | 286 | ||
287 | #ifdef CONFIG_DISCONTIGMEM | ||
288 | NODE_DATA(0)->bdata = &discontig_node_bdata[0]; | ||
289 | NODE_DATA(1)->bdata = &discontig_node_bdata[1]; | ||
290 | |||
291 | bootmap_size = init_bootmem_node(NODE_DATA(1), | ||
292 | PFN_UP(__MEMORY_START_2ND), | ||
293 | PFN_UP(__MEMORY_START_2ND), | ||
294 | PFN_DOWN(__MEMORY_START_2ND+__MEMORY_SIZE_2ND)); | ||
295 | free_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, __MEMORY_SIZE_2ND); | ||
296 | reserve_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, bootmap_size); | ||
297 | #endif | ||
298 | |||
299 | /* | 287 | /* |
300 | * Find the highest page frame number we have available | 288 | * Find the highest page frame number we have available |
301 | */ | 289 | */ |
@@ -306,10 +294,10 @@ void __init setup_arch(char **cmdline_p) | |||
306 | */ | 294 | */ |
307 | max_low_pfn = max_pfn; | 295 | max_low_pfn = max_pfn; |
308 | 296 | ||
309 | /* | 297 | /* |
310 | * Partially used pages are not usable - thus | 298 | * Partially used pages are not usable - thus |
311 | * we are rounding upwards: | 299 | * we are rounding upwards: |
312 | */ | 300 | */ |
313 | start_pfn = PFN_UP(__pa(_end)); | 301 | start_pfn = PFN_UP(__pa(_end)); |
314 | 302 | ||
315 | /* | 303 | /* |
@@ -360,12 +348,12 @@ void __init setup_arch(char **cmdline_p) | |||
360 | reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE); | 348 | reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE); |
361 | 349 | ||
362 | #ifdef CONFIG_BLK_DEV_INITRD | 350 | #ifdef CONFIG_BLK_DEV_INITRD |
363 | ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); | 351 | ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); |
364 | if (&__rd_start != &__rd_end) { | 352 | if (&__rd_start != &__rd_end) { |
365 | LOADER_TYPE = 1; | 353 | LOADER_TYPE = 1; |
366 | INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START; | 354 | INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START; |
367 | INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start; | 355 | INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start; |
368 | } | 356 | } |
369 | 357 | ||
370 | if (LOADER_TYPE && INITRD_START) { | 358 | if (LOADER_TYPE && INITRD_START) { |
371 | if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { | 359 | if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { |