Changeset e49e234 in mainline for kernel/arch
- Timestamp:
- 2009-02-27T11:32:31Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1f7f6ea
- Parents:
- 5f0f29ce
- Location:
- kernel/arch
- Files:
-
- 21 edited
-
amd64/include/mm/frame.h (modified) (2 diffs)
-
amd64/src/mm/page.c (modified) (3 diffs)
-
arm32/include/mm/frame.h (modified) (4 diffs)
-
arm32/src/mm/frame.c (modified) (3 diffs)
-
arm32/src/mm/page.c (modified) (2 diffs)
-
ia32/include/boot/memmap.h (modified) (2 diffs)
-
ia32/include/mm/frame.h (modified) (3 diffs)
-
ia32/src/mm/frame.c (modified) (1 diff)
-
ia32/src/mm/page.c (modified) (5 diffs)
-
ia64/include/mm/frame.h (modified) (3 diffs)
-
ia64/src/mm/frame.c (modified) (2 diffs)
-
ia64/src/mm/page.c (modified) (3 diffs)
-
mips32/include/mm/frame.h (modified) (2 diffs)
-
mips32/src/mm/frame.c (modified) (2 diffs)
-
mips32/src/mm/page.c (modified) (2 diffs)
-
ppc32/include/mm/frame.h (modified) (3 diffs)
-
ppc32/src/mm/frame.c (modified) (2 diffs)
-
ppc32/src/mm/page.c (modified) (3 diffs)
-
sparc64/include/mm/frame.h (modified) (1 diff)
-
sparc64/src/mm/frame.c (modified) (3 diffs)
-
sparc64/src/mm/page.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/mm/frame.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup amd64mm 29 /** @addtogroup amd64mm 30 30 * @{ 31 31 */ … … 40 40 #endif /* __ASM__ */ 41 41 42 #define FRAME_WIDTH 12/* 4K */43 #define FRAME_SIZE (1 << FRAME_WIDTH)42 #define FRAME_WIDTH 12 /* 4K */ 43 #define FRAME_SIZE (1 << FRAME_WIDTH) 44 44 45 45 #ifndef __ASM__ 46 46 extern uintptr_t last_frame; 47 extern uintptr_t end_frame;48 47 extern void frame_arch_init(void); 49 48 extern void physmem_print(void); -
kernel/arch/amd64/src/mm/page.c
r5f0f29ce re49e234 35 35 #include <arch/mm/page.h> 36 36 #include <genarch/mm/page_pt.h> 37 #include <genarch/drivers/ega/ega.h>38 #include <genarch/drivers/legacy/ia32/io.h>39 37 #include <arch/mm/frame.h> 40 38 #include <mm/page.h> … … 49 47 #include <panic.h> 50 48 #include <align.h> 51 #include <ddi/ddi.h>52 53 /** Physical memory area for devices. */54 static parea_t dev_area;55 static parea_t ega_area;56 49 57 50 /* Definitions for identity page mapper */ … … 222 215 } 223 216 224 void hw_area(void)225 {226 dev_area.pbase = end_frame;227 dev_area.frames = SIZE2FRAMES(0xfffffffffffff - end_frame);228 ddi_parea_register(&dev_area);229 230 ega_area.pbase = EGA_VIDEORAM;231 ega_area.frames = SIZE2FRAMES(EGA_VRAM_SIZE);232 ddi_parea_register(&ega_area);233 }234 235 217 /** @} 236 218 */ -
kernel/arch/arm32/include/mm/frame.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup arm32mm 29 /** @addtogroup arm32mm 30 30 * @{ 31 31 */ … … 37 37 #define KERN_arm32_FRAME_H_ 38 38 39 #define FRAME_WIDTH 12/* 4KB frames */40 #define FRAME_SIZE (1 << FRAME_WIDTH)39 #define FRAME_WIDTH 12 /* 4KB frames */ 40 #define FRAME_SIZE (1 << FRAME_WIDTH) 41 41 42 42 #ifdef KERNEL … … 45 45 #include <arch/types.h> 46 46 47 #define BOOT_PAGE_TABLE_SIZE 0x400048 #define BOOT_PAGE_TABLE_ADDRESS 0x400047 #define BOOT_PAGE_TABLE_SIZE 0x4000 48 #define BOOT_PAGE_TABLE_ADDRESS 0x4000 49 49 50 50 #define BOOT_PAGE_TABLE_START_FRAME (BOOT_PAGE_TABLE_ADDRESS >> FRAME_WIDTH) … … 52 52 53 53 extern uintptr_t last_frame; 54 extern uintptr_t end_frame;55 54 56 55 extern void frame_arch_init(void); -
kernel/arch/arm32/src/mm/frame.c
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup arm32mm 29 /** @addtogroup arm32mm 30 30 * @{ 31 31 */ … … 42 42 /** Address of the last frame in the memory. */ 43 43 uintptr_t last_frame = 0; 44 uintptr_t end_frame = 0;45 44 46 45 /** Creates memory zones. */ … … 51 50 BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0); 52 51 last_frame = machine_get_memory_size(); 53 end_frame = last_frame;54 52 55 53 /* blacklist boot page table */ -
kernel/arch/arm32/src/mm/page.c
r5f0f29ce re49e234 44 44 #include <interrupt.h> 45 45 #include <arch/mm/frame.h> 46 #include <ddi/ddi.h>47 48 /** Physical memory area for devices. */49 static parea_t dev_area;50 46 51 47 /** Initializes page tables. … … 111 107 } 112 108 113 void hw_area(void)114 {115 dev_area.pbase = end_frame;116 dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);117 ddi_parea_register(&dev_area);118 }119 120 109 /** @} 121 110 */ -
kernel/arch/ia32/include/boot/memmap.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup ia32 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ia32_MEMMAP_H_ 37 37 38 /* E820h memory range types - other values*/ 39 /* Free memory */ 40 #define MEMMAP_MEMORY_AVAILABLE 1 41 /* Not available for OS */ 42 #define MEMMAP_MEMORY_RESERVED 2 43 /* OS may use it after reading ACPI table */ 44 #define MEMMAP_MEMORY_ACPI 3 45 /* Unusable, required to be saved and restored across an NVS sleep */ 46 #define MEMMAP_MEMORY_NVS 4 47 /* Corrupted memory */ 48 #define MEMMAP_MEMORY_UNUSABLE 5 38 /* E820h memory range types */ 49 39 50 /* size of one entry */ 51 #define MEMMAP_E820_RECORD_SIZE 20 52 /* maximum entries */ 53 #define MEMMAP_E820_MAX_RECORDS 32 40 /* Free memory */ 41 #define MEMMAP_MEMORY_AVAILABLE 1 54 42 43 /* Not available for OS */ 44 #define MEMMAP_MEMORY_RESERVED 2 45 46 /* OS may use it after reading ACPI table */ 47 #define MEMMAP_MEMORY_ACPI 3 48 49 /* Unusable, required to be saved and restored across an NVS sleep */ 50 #define MEMMAP_MEMORY_NVS 4 51 52 /* Corrupted memory */ 53 #define MEMMAP_MEMORY_UNUSABLE 5 54 55 /* Size of one entry */ 56 #define MEMMAP_E820_RECORD_SIZE 20 57 58 /* Maximum entries */ 59 #define MEMMAP_E820_MAX_RECORDS 32 55 60 56 61 #ifndef __ASM__ -
kernel/arch/ia32/include/mm/frame.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup ia32mm 29 /** @addtogroup ia32mm 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ia32_FRAME_H_ 37 37 38 #define FRAME_WIDTH 12/* 4K */39 #define FRAME_SIZE (1 << FRAME_WIDTH)38 #define FRAME_WIDTH 12 /* 4K */ 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 41 #ifdef KERNEL … … 45 45 46 46 extern uintptr_t last_frame; 47 extern uintptr_t end_frame;48 47 49 48 extern void frame_arch_init(void); -
kernel/arch/ia32/src/mm/frame.c
r5f0f29ce re49e234 51 51 52 52 uintptr_t last_frame = 0; 53 uintptr_t end_frame = 0;54 53 55 54 static void init_e820_memory(pfn_t minconf) 56 55 { 57 56 unsigned int i; 58 pfn_t start, conf;59 size_t size;60 61 57 for (i = 0; i < e820counter; i++) { 58 uint64_t base = e820table[i].base_address; 59 uint64_t size = e820table[i].size; 60 61 #ifdef __32_BITS__ 62 63 /* Ignore physical memory above 4 GB */ 64 if ((base >> 32) != 0) 65 continue; 66 67 /* Clip regions above 4 GB */ 68 if (((base + size) >> 32) != 0) 69 size = 0xffffffff - base; 70 71 #endif 72 pfn_t pfn; 73 count_t count; 74 62 75 if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) { 63 start = ADDR2PFN(ALIGN_UP(e820table[i].base_address, FRAME_SIZE)); 64 size = SIZE2FRAMES(ALIGN_DOWN(e820table[i].size, FRAME_SIZE)); 76 /* To be safe, make available zone possibly smaller */ 77 pfn = ADDR2PFN(ALIGN_UP(base, FRAME_SIZE)); 78 count = SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)); 65 79 66 if ((minconf < start) || (minconf >= start + size)) 67 conf = start; 80 pfn_t conf; 81 if ((minconf < pfn) || (minconf >= pfn + count)) 82 conf = pfn; 68 83 else 69 84 conf = minconf; 70 85 71 zone_create( start, size, conf, 0);86 zone_create(pfn, count, conf, ZONE_AVAILABLE); 72 87 73 if (last_frame < ALIGN_UP(e820table[i].base_address + 74 e820table[i].size, FRAME_SIZE)) 75 last_frame = 76 ALIGN_UP(e820table[i].base_address + e820table[i].size, FRAME_SIZE); 88 // XXX this has to be removed 89 if (last_frame < ALIGN_UP(base + size, FRAME_SIZE)) 90 last_frame = ALIGN_UP(base + size, FRAME_SIZE); 91 } 92 93 if (e820table[i].type == MEMMAP_MEMORY_RESERVED) { 94 /* To be safe, make reserved zone possibly larger */ 95 pfn = ADDR2PFN(ALIGN_DOWN(base, FRAME_SIZE)); 96 count = SIZE2FRAMES(ALIGN_UP(size, FRAME_SIZE)); 97 98 zone_create(pfn, count, 0, ZONE_RESERVED); 99 } 100 101 if (e820table[i].type == MEMMAP_MEMORY_ACPI) { 102 /* To be safe, make firmware zone possibly larger */ 103 pfn = ADDR2PFN(ALIGN_DOWN(base, (uintptr_t) FRAME_SIZE)); 104 count = SIZE2FRAMES(ALIGN_UP(size, (uintptr_t) FRAME_SIZE)); 105 106 zone_create(pfn, count, 0, ZONE_FIRMWARE); 77 107 } 78 108 } 79 80 end_frame = last_frame;81 109 } 82 110 -
kernel/arch/ia32/src/mm/page.c
r5f0f29ce re49e234 35 35 #include <arch/mm/page.h> 36 36 #include <genarch/mm/page_pt.h> 37 #include <genarch/drivers/ega/ega.h>38 #include <genarch/drivers/legacy/ia32/io.h>39 37 #include <arch/mm/frame.h> 40 38 #include <mm/frame.h> … … 51 49 #include <print.h> 52 50 #include <interrupt.h> 53 #include <ddi/ddi.h>54 55 /** Physical memory area for devices. */56 static parea_t dev_area;57 static parea_t ega_area;58 51 59 52 void page_arch_init(void) … … 61 54 uintptr_t cur; 62 55 int flags; 63 56 64 57 if (config.cpu_active == 1) { 65 58 page_mapping_operations = &pt_mapping_operations; … … 74 67 page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags); 75 68 } 76 69 77 70 exc_register(14, "page_fault", (iroutine) page_fault); 78 71 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 79 72 } else 80 73 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 81 74 82 75 paging_on(); 83 76 } … … 99 92 100 93 return virtaddr; 101 }102 103 void hw_area(void)104 {105 dev_area.pbase = end_frame;106 dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);107 ddi_parea_register(&dev_area);108 109 ega_area.pbase = EGA_VIDEORAM;110 ega_area.frames = SIZE2FRAMES(EGA_VRAM_SIZE);111 ddi_parea_register(&ega_area);112 94 } 113 95 -
kernel/arch/ia64/include/mm/frame.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup ia64mm 29 /** @addtogroup ia64mm 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ia64_FRAME_H_ 37 37 38 #define FRAME_WIDTH 14/* 16K */39 #define FRAME_SIZE (1 << FRAME_WIDTH)38 #define FRAME_WIDTH 14 /* 16K */ 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 41 #ifdef KERNEL … … 45 45 46 46 extern uintptr_t last_frame; 47 extern uintptr_t end_frame;48 47 49 48 extern void frame_arch_init(void); -
kernel/arch/ia64/src/mm/frame.c
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup ia64mm 29 /** @addtogroup ia64mm 30 30 * @{ 31 31 */ … … 52 52 53 53 uintptr_t last_frame = 0; 54 uintptr_t end_frame = 0;55 54 56 55 void frame_arch_init(void) -
kernel/arch/ia64/src/mm/page.c
r5f0f29ce re49e234 49 49 #include <memstr.h> 50 50 #include <align.h> 51 #include <ddi/ddi.h>52 53 /** Physical memory area for devices. */54 static parea_t dev_area;55 51 56 52 static void set_environment(void); … … 68 64 { 69 65 region_register rr; 70 pta_register pta; 66 pta_register pta; 71 67 int i; 72 #ifdef CONFIG_VHPT 68 #ifdef CONFIG_VHPT 73 69 uintptr_t vhpt_base; 74 70 #endif … … 279 275 } 280 276 281 void hw_area(void)282 {283 dev_area.pbase = end_frame;284 dev_area.frames = SIZE2FRAMES(0x7fffffffffffffffUL - end_frame);285 ddi_parea_register(&dev_area);286 }287 288 277 /** @} 289 278 */ -
kernel/arch/mips32/include/mm/frame.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup mips32mm 29 /** @addtogroup mips32mm 30 30 * @{ 31 31 */ … … 47 47 extern void physmem_print(void); 48 48 49 extern uintptr_t end_frame;50 51 49 #endif /* __ASM__ */ 52 50 #endif /* KERNEL */ -
kernel/arch/mips32/src/mm/frame.c
r5f0f29ce re49e234 65 65 static count_t phys_regions_count = 0; 66 66 static phys_region_t phys_regions[MAX_REGIONS]; 67 68 uintptr_t end_frame = 0;69 67 70 68 … … 239 237 } 240 238 241 end_frame = frame; 242 243 frame_add_region(start_frame, end_frame); 239 frame_add_region(start_frame, frame); 244 240 245 241 /* Blacklist interrupt vector frame */ -
kernel/arch/mips32/src/mm/page.c
r5f0f29ce re49e234 37 37 #include <mm/page.h> 38 38 #include <mm/frame.h> 39 #include <ddi/ddi.h>40 41 /** Physical memory area for devices. */42 static parea_t dev_area;43 39 44 40 void page_arch_init(void) … … 56 52 } 57 53 58 void hw_area(void)59 {60 dev_area.pbase = end_frame;61 dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);62 ddi_parea_register(&dev_area);63 }64 65 54 /** @} 66 55 */ -
kernel/arch/ppc32/include/mm/frame.h
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup ppc32mm 29 /** @addtogroup ppc32mm 30 30 * @{ 31 31 */ … … 36 36 #define KERN_ppc32_FRAME_H_ 37 37 38 #define FRAME_WIDTH 12/* 4K */39 #define FRAME_SIZE (1 << FRAME_WIDTH)38 #define FRAME_WIDTH 12 /* 4K */ 39 #define FRAME_SIZE (1 << FRAME_WIDTH) 40 40 41 41 #ifdef KERNEL … … 45 45 46 46 extern uintptr_t last_frame; 47 extern uintptr_t end_frame;48 47 49 48 extern void frame_arch_init(void); -
kernel/arch/ppc32/src/mm/frame.c
r5f0f29ce re49e234 41 41 42 42 uintptr_t last_frame = 0; 43 uintptr_t end_frame = 0;44 43 45 44 void physmem_print(void) … … 77 76 } 78 77 79 end_frame = last_frame;80 81 78 /* First is exception vector, second is 'implementation specific', 82 79 third and fourth is reserved, other contain real mode code */ -
kernel/arch/ppc32/src/mm/page.c
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup ppc32mm 29 /** @addtogroup ppc32mm 30 30 * @{ 31 31 */ … … 38 38 #include <align.h> 39 39 #include <config.h> 40 #include <ddi/ddi.h>41 42 /** Physical memory area for devices. */43 static parea_t dev_area;44 40 45 41 void page_arch_init(void) … … 68 64 } 69 65 70 void hw_area(void)71 {72 dev_area.pbase = end_frame;73 dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);74 ddi_parea_register(&dev_area);75 }76 77 66 /** @} 78 67 */ -
kernel/arch/sparc64/include/mm/frame.h
r5f0f29ce re49e234 74 74 75 75 extern uintptr_t last_frame; 76 extern uintptr_t end_frame;77 76 extern void frame_arch_init(void); 78 77 #define physmem_print() -
kernel/arch/sparc64/src/mm/frame.c
r5f0f29ce re49e234 27 27 */ 28 28 29 /** @addtogroup sparc64mm 29 /** @addtogroup sparc64mm 30 30 * @{ 31 31 */ … … 42 42 43 43 uintptr_t last_frame = NULL; 44 uintptr_t end_frame = NULL;45 44 46 45 /** Create memory zones according to information stored in bootinfo. … … 81 80 frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1); 82 81 } 83 84 end_frame = last_frame;85 82 } 86 83 -
kernel/arch/sparc64/src/mm/page.c
r5f0f29ce re49e234 42 42 #include <align.h> 43 43 #include <config.h> 44 #include <ddi/ddi.h>45 46 /** Physical memory area for devices. */47 static parea_t dev_area;48 44 49 45 #ifdef CONFIG_SMP … … 169 165 } 170 166 171 void hw_area(void)172 {173 dev_area.pbase = end_frame;174 dev_area.frames = SIZE2FRAMES(0x7ffffffffff - end_frame);175 ddi_parea_register(&dev_area);176 }177 178 167 /** @} 179 168 */
Note:
See TracChangeset
for help on using the changeset viewer.
