summaryrefslogtreecommitdiff
path: root/arch/um/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel')
-rw-r--r--arch/um/kernel/dyn.lds.S12
-rw-r--r--arch/um/kernel/exec.c1
-rw-r--r--arch/um/kernel/init_task.c1
-rw-r--r--arch/um/kernel/irq.c8
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/physmem.c15
-rw-r--r--arch/um/kernel/process.c16
-rw-r--r--arch/um/kernel/ptrace.c18
-rw-r--r--arch/um/kernel/skas/process.c4
-rw-r--r--arch/um/kernel/syscall.c1
-rw-r--r--arch/um/kernel/trap.c29
-rw-r--r--arch/um/kernel/uml.lds.S11
12 files changed, 46 insertions, 72 deletions
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 24547741b205..41850906116e 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -71,11 +71,13 @@ SECTIONS
*(.gnu.warning)
. = ALIGN(4096);
- __syscall_stub_start = .;
- *(.__syscall_stub*)
- __syscall_stub_end = .;
- . = ALIGN(4096);
} =0x90909090
+ . = ALIGN(4096);
+ .syscall_stub : {
+ __syscall_stub_start = .;
+ *(.__syscall_stub*)
+ __syscall_stub_end = .;
+ }
.fini : {
KEEP (*(.fini))
} =0x90909090
@@ -138,8 +140,8 @@ SECTIONS
.got : { *(.got.plt) *(.got) }
_edata = .;
PROVIDE (edata = .);
- __bss_start = .;
.bss : {
+ __bss_start = .;
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 356e50f5aaed..ce6828fd396f 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -6,6 +6,7 @@
#include "linux/slab.h"
#include "linux/smp_lock.h"
#include "linux/ptrace.h"
+#include "linux/fs.h"
#include "asm/ptrace.h"
#include "asm/pgtable.h"
#include "asm/tlbflush.h"
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index d4f1d1ab252b..cba516e6c99a 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -4,6 +4,7 @@
*/
#include "linux/mm.h"
+#include "linux/fs.h"
#include "linux/module.h"
#include "linux/sched.h"
#include "linux/init_task.h"
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index dba04d88b432..cf0dd9cf8c43 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -30,7 +30,6 @@
#include "irq_kern.h"
#include "os.h"
#include "sigio.h"
-#include "um_malloc.h"
#include "misc_constants.h"
#include "as-layout.h"
@@ -519,13 +518,13 @@ int init_aio_irq(int irq, char *name, irq_handler_t handler)
static unsigned long pending_mask;
-unsigned long to_irq_stack(int sig, unsigned long *mask_out)
+unsigned long to_irq_stack(unsigned long *mask_out)
{
struct thread_info *ti;
unsigned long mask, old;
int nested;
- mask = xchg(&pending_mask, 1 << sig);
+ mask = xchg(&pending_mask, *mask_out);
if(mask != 0){
/* If any interrupts come in at this point, we want to
* make sure that their bits aren't lost by our
@@ -535,7 +534,7 @@ unsigned long to_irq_stack(int sig, unsigned long *mask_out)
* and pending_mask contains a bit for each interrupt
* that came in.
*/
- old = 1 << sig;
+ old = *mask_out;
do {
old |= mask;
mask = xchg(&pending_mask, old);
@@ -551,6 +550,7 @@ unsigned long to_irq_stack(int sig, unsigned long *mask_out)
task = cpu_tasks[ti->cpu].task;
tti = task_thread_info(task);
+
*ti = *tti;
ti->real_thread = tti;
task->stack = ti;
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 72ff85693a39..d2b11f242698 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -62,7 +62,7 @@ static void setup_highmem(unsigned long highmem_start,
}
#endif
-void mem_init(void)
+void __init mem_init(void)
{
/* clear the zero-page */
memset((void *) empty_zero_page, 0, PAGE_SIZE);
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 3ba6e4c841da..5ee7e851bbc1 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -28,7 +28,8 @@ unsigned long high_physmem;
extern unsigned long long physmem_size;
-int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
+int __init init_maps(unsigned long physmem, unsigned long iomem,
+ unsigned long highmem)
{
struct page *p, *map;
unsigned long phys_len, phys_pages, highmem_len, highmem_pages;
@@ -47,13 +48,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
total_pages = phys_pages + iomem_pages + highmem_pages;
total_len = phys_len + iomem_len + highmem_len;
- if(kmalloc_ok){
- map = kmalloc(total_len, GFP_KERNEL);
- if(map == NULL)
- map = vmalloc(total_len);
- }
- else map = alloc_bootmem_low_pages(total_len);
-
+ map = alloc_bootmem_low_pages(total_len);
if(map == NULL)
return -ENOMEM;
@@ -98,8 +93,8 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
extern int __syscall_stub_start;
-void setup_physmem(unsigned long start, unsigned long reserve_end,
- unsigned long len, unsigned long long highmem)
+void __init setup_physmem(unsigned long start, unsigned long reserve_end,
+ unsigned long len, unsigned long long highmem)
{
unsigned long reserve = reserve_end - start;
int pfn = PFN_UP(__pa(reserve_end));
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 8d2c5496532b..bfa52f206bb6 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -46,7 +46,6 @@
#include "mode.h"
#include "mode_kern.h"
#include "choose-mode.h"
-#include "um_malloc.h"
/* This is a per-cpu array. A processor only modifies its entry and it only
* cares about its entry, so it's OK if another processor is modifying its
@@ -262,21 +261,6 @@ void dump_thread(struct pt_regs *regs, struct user *u)
{
}
-void *um_kmalloc(int size)
-{
- return kmalloc(size, GFP_KERNEL);
-}
-
-void *um_kmalloc_atomic(int size)
-{
- return kmalloc(size, GFP_ATOMIC);
-}
-
-void *um_vmalloc(int size)
-{
- return vmalloc(size);
-}
-
int __cant_sleep(void) {
return in_atomic() || irqs_disabled() || in_interrupt();
/* Is in_interrupt() really needed? */
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 627742d89434..6916c8888dba 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -52,17 +52,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
switch (request) {
/* when I and D space are separate, these will need to be fixed. */
case PTRACE_PEEKTEXT: /* read word at location addr. */
- case PTRACE_PEEKDATA: {
- unsigned long tmp;
- int copied;
-
- ret = -EIO;
- copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
- if (copied != sizeof(tmp))
- break;
- ret = put_user(tmp, p);
+ case PTRACE_PEEKDATA:
+ ret = generic_ptrace_peekdata(child, addr, data);
break;
- }
/* read the word at location addr in the USER area. */
case PTRACE_PEEKUSR:
@@ -72,11 +64,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
/* when I and D space are separate, this will have to be fixed. */
case PTRACE_POKETEXT: /* write the word at location addr. */
case PTRACE_POKEDATA:
- ret = -EIO;
- if (access_process_vm(child, addr, &data, sizeof(data),
- 1) != sizeof(data))
- break;
- ret = 0;
+ ret = generic_ptrace_pokedata(child, addr, data);
break;
case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 2a69a7ce5792..48051a98525f 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -145,7 +145,7 @@ void init_idle_skas(void)
extern void start_kernel(void);
-static int start_kernel_proc(void *unused)
+static int __init start_kernel_proc(void *unused)
{
int pid;
@@ -165,7 +165,7 @@ extern int userspace_pid[];
extern char cpu0_irqstack[];
-int start_uml_skas(void)
+int __init start_uml_skas(void)
{
stack_protections((unsigned long) &cpu0_irqstack);
set_sigstack(cpu0_irqstack, THREAD_SIZE);
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 237c4eab7cfd..7b3b67333ff3 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -7,6 +7,7 @@
#include "linux/file.h"
#include "linux/smp_lock.h"
#include "linux/mm.h"
+#include "linux/fs.h"
#include "linux/utsname.h"
#include "linux/msg.h"
#include "linux/shm.h"
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index abab90c3803f..3850d53f79fd 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -76,23 +76,24 @@ good_area:
goto out;
do {
+ int fault;
survive:
- switch (handle_mm_fault(mm, vma, address, is_write)){
- case VM_FAULT_MINOR:
- current->min_flt++;
- break;
- case VM_FAULT_MAJOR:
- current->maj_flt++;
- break;
- case VM_FAULT_SIGBUS:
- err = -EACCES;
- goto out;
- case VM_FAULT_OOM:
- err = -ENOMEM;
- goto out_of_memory;
- default:
+ fault = handle_mm_fault(mm, vma, address, is_write);
+ if (unlikely(fault & VM_FAULT_ERROR)) {
+ if (fault & VM_FAULT_OOM) {
+ err = -ENOMEM;
+ goto out_of_memory;
+ } else if (fault & VM_FAULT_SIGBUS) {
+ err = -EACCES;
+ goto out;
+ }
BUG();
}
+ if (fault & VM_FAULT_MAJOR)
+ current->maj_flt++;
+ else
+ current->min_flt++;
+
pgd = pgd_offset(mm, address);
pud = pud_offset(pgd, address);
pmd = pmd_offset(pud, address);
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 307b9373676b..81acdc24348e 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -44,12 +44,13 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
+ }
- . = ALIGN(4096);
- __syscall_stub_start = .;
- *(.__syscall_stub*)
- __syscall_stub_end = .;
- . = ALIGN(4096);
+ . = ALIGN(4096);
+ .syscall_stub : {
+ __syscall_stub_start = .;
+ *(.__syscall_stub*)
+ __syscall_stub_end = .;
}
#include "asm/common.lds.S"