diff options
-rw-r--r-- | arch/um/include/skas/mode_kern_skas.h | 3 | ||||
-rw-r--r-- | arch/um/kernel/physmem.c | 50 |
2 files changed, 23 insertions, 30 deletions
diff --git a/arch/um/include/skas/mode_kern_skas.h b/arch/um/include/skas/mode_kern_skas.h index 8ee6285dfacc..c29485109a9a 100644 --- a/arch/um/include/skas/mode_kern_skas.h +++ b/arch/um/include/skas/mode_kern_skas.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -9,6 +9,7 @@ | |||
9 | #include "linux/sched.h" | 9 | #include "linux/sched.h" |
10 | #include "asm/page.h" | 10 | #include "asm/page.h" |
11 | #include "asm/ptrace.h" | 11 | #include "asm/ptrace.h" |
12 | #include "mem_user.h" | ||
12 | 13 | ||
13 | extern void flush_thread_skas(void); | 14 | extern void flush_thread_skas(void); |
14 | extern void switch_to_skas(void *prev, void *next); | 15 | extern void switch_to_skas(void *prev, void *next); |
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 8aeac4d93511..fb695e48fad7 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c | |||
@@ -1,25 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/mm.h" | ||
7 | #include "linux/rbtree.h" | ||
8 | #include "linux/slab.h" | ||
9 | #include "linux/vmalloc.h" | ||
10 | #include "linux/bootmem.h" | 6 | #include "linux/bootmem.h" |
11 | #include "linux/module.h" | 7 | #include "linux/mm.h" |
12 | #include "linux/pfn.h" | 8 | #include "linux/pfn.h" |
13 | #include "asm/types.h" | 9 | #include "asm/page.h" |
14 | #include "asm/pgtable.h" | ||
15 | #include "kern_util.h" | ||
16 | #include "as-layout.h" | 10 | #include "as-layout.h" |
11 | #include "init.h" | ||
12 | #include "kern.h" | ||
17 | #include "mode_kern.h" | 13 | #include "mode_kern.h" |
18 | #include "mem.h" | ||
19 | #include "mem_user.h" | ||
20 | #include "os.h" | 14 | #include "os.h" |
21 | #include "kern.h" | ||
22 | #include "init.h" | ||
23 | 15 | ||
24 | static int physmem_fd = -1; | 16 | static int physmem_fd = -1; |
25 | 17 | ||
@@ -49,10 +41,10 @@ int __init init_maps(unsigned long physmem, unsigned long iomem, | |||
49 | total_len = phys_len + iomem_len + highmem_len; | 41 | total_len = phys_len + iomem_len + highmem_len; |
50 | 42 | ||
51 | map = alloc_bootmem_low_pages(total_len); | 43 | map = alloc_bootmem_low_pages(total_len); |
52 | if(map == NULL) | 44 | if (map == NULL) |
53 | return -ENOMEM; | 45 | return -ENOMEM; |
54 | 46 | ||
55 | for(i = 0; i < total_pages; i++){ | 47 | for (i = 0; i < total_pages; i++) { |
56 | p = &map[i]; | 48 | p = &map[i]; |
57 | memset(p, 0, sizeof(struct page)); | 49 | memset(p, 0, sizeof(struct page)); |
58 | SetPageReserved(p); | 50 | SetPageReserved(p); |
@@ -68,7 +60,7 @@ static unsigned long kmem_top = 0; | |||
68 | 60 | ||
69 | unsigned long get_kmem_end(void) | 61 | unsigned long get_kmem_end(void) |
70 | { | 62 | { |
71 | if(kmem_top == 0) | 63 | if (kmem_top == 0) |
72 | kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); | 64 | kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); |
73 | return kmem_top; | 65 | return kmem_top; |
74 | } | 66 | } |
@@ -81,8 +73,8 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len, | |||
81 | 73 | ||
82 | fd = phys_mapping(phys, &offset); | 74 | fd = phys_mapping(phys, &offset); |
83 | err = os_map_memory((void *) virt, fd, offset, len, r, w, x); | 75 | err = os_map_memory((void *) virt, fd, offset, len, r, w, x); |
84 | if(err) { | 76 | if (err) { |
85 | if(err == -ENOMEM) | 77 | if (err == -ENOMEM) |
86 | printk("try increasing the host's " | 78 | printk("try increasing the host's " |
87 | "/proc/sys/vm/max_map_count to <physical " | 79 | "/proc/sys/vm/max_map_count to <physical " |
88 | "memory size>/4096\n"); | 80 | "memory size>/4096\n"); |
@@ -106,7 +98,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, | |||
106 | offset = uml_reserved - uml_physmem; | 98 | offset = uml_reserved - uml_physmem; |
107 | err = os_map_memory((void *) uml_reserved, physmem_fd, offset, | 99 | err = os_map_memory((void *) uml_reserved, physmem_fd, offset, |
108 | len - offset, 1, 1, 1); | 100 | len - offset, 1, 1, 1); |
109 | if(err < 0){ | 101 | if (err < 0) { |
110 | os_print_error(err, "Mapping memory"); | 102 | os_print_error(err, "Mapping memory"); |
111 | exit(1); | 103 | exit(1); |
112 | } | 104 | } |
@@ -126,16 +118,16 @@ int phys_mapping(unsigned long phys, __u64 *offset_out) | |||
126 | { | 118 | { |
127 | int fd = -1; | 119 | int fd = -1; |
128 | 120 | ||
129 | if(phys < physmem_size){ | 121 | if (phys < physmem_size) { |
130 | fd = physmem_fd; | 122 | fd = physmem_fd; |
131 | *offset_out = phys; | 123 | *offset_out = phys; |
132 | } | 124 | } |
133 | else if(phys < __pa(end_iomem)){ | 125 | else if (phys < __pa(end_iomem)) { |
134 | struct iomem_region *region = iomem_regions; | 126 | struct iomem_region *region = iomem_regions; |
135 | 127 | ||
136 | while(region != NULL){ | 128 | while (region != NULL) { |
137 | if((phys >= region->phys) && | 129 | if ((phys >= region->phys) && |
138 | (phys < region->phys + region->size)){ | 130 | (phys < region->phys + region->size)) { |
139 | fd = region->fd; | 131 | fd = region->fd; |
140 | *offset_out = phys - region->phys; | 132 | *offset_out = phys - region->phys; |
141 | break; | 133 | break; |
@@ -143,7 +135,7 @@ int phys_mapping(unsigned long phys, __u64 *offset_out) | |||
143 | region = region->next; | 135 | region = region->next; |
144 | } | 136 | } |
145 | } | 137 | } |
146 | else if(phys < __pa(end_iomem) + highmem){ | 138 | else if (phys < __pa(end_iomem) + highmem) { |
147 | fd = physmem_fd; | 139 | fd = physmem_fd; |
148 | *offset_out = phys - iomem_size; | 140 | *offset_out = phys - iomem_size; |
149 | } | 141 | } |
@@ -188,8 +180,8 @@ unsigned long find_iomem(char *driver, unsigned long *len_out) | |||
188 | { | 180 | { |
189 | struct iomem_region *region = iomem_regions; | 181 | struct iomem_region *region = iomem_regions; |
190 | 182 | ||
191 | while(region != NULL){ | 183 | while (region != NULL) { |
192 | if(!strcmp(region->driver, driver)){ | 184 | if (!strcmp(region->driver, driver)) { |
193 | *len_out = region->size; | 185 | *len_out = region->size; |
194 | return region->virt; | 186 | return region->virt; |
195 | } | 187 | } |
@@ -206,10 +198,10 @@ int setup_iomem(void) | |||
206 | unsigned long iomem_start = high_physmem + PAGE_SIZE; | 198 | unsigned long iomem_start = high_physmem + PAGE_SIZE; |
207 | int err; | 199 | int err; |
208 | 200 | ||
209 | while(region != NULL){ | 201 | while (region != NULL) { |
210 | err = os_map_memory((void *) iomem_start, region->fd, 0, | 202 | err = os_map_memory((void *) iomem_start, region->fd, 0, |
211 | region->size, 1, 1, 0); | 203 | region->size, 1, 1, 0); |
212 | if(err) | 204 | if (err) |
213 | printk("Mapping iomem region for driver '%s' failed, " | 205 | printk("Mapping iomem region for driver '%s' failed, " |
214 | "errno = %d\n", region->driver, -err); | 206 | "errno = %d\n", region->driver, -err); |
215 | else { | 207 | else { |