Changeset dcbc8be in mainline for arch/ia32/src
- Timestamp:
- 2005-06-02T23:56:26Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ac5d02b
- Parents:
- 7dcbc0a1
- Location:
- arch/ia32/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/boot/boot.S
r7dcbc0a1 rdcbc8be 40 40 # 41 41 kernel_image_start: 42 cli 42 43 call memmap_arch_init 43 cli44 44 xorw %ax,%ax 45 45 movw %ax,%ds … … 63 63 lidt idtr 64 64 65 # 66 # Here we setup mapping for both the unmapped and mapped sections of the kernel. 67 # For simplicity, we set only one 4M page for 0x00000000 and one for 0x80000000. 68 # 69 movl %cr4, %ecx 70 orl $(1<<4), %ecx 71 movl %ecx, %cr4 # turn PSE on 72 73 movl $((1<<7)|(1<<0)), %eax 74 movl %eax, page_directory # mapping 0x00000000 => 0x00000000 75 76 movl $(page_directory+(4096/2)), %edx 77 movl %eax, (%edx) # mapping 0x80000000 => 0x00000000 78 79 leal page_directory, %eax 80 movl %eax, %cr3 81 82 # turn on paging 83 movl %cr0, %ebx 84 orl $(1<<31), %ebx 85 movl %ebx, %cr0 86 87 movl $_hardcoded_ktext_size, hardcoded_ktext_size 88 movl $_hardcoded_kdata_size, hardcoded_kdata_size 89 movl $_hardcoded_load_address, hardcoded_load_address 90 65 91 call main_bsp # never returns 66 67 92 68 93 cli 69 94 hlt 95 96 .section K_DATA_START 97 98 .align 4096 99 page_directory: 100 .space 4096, 0 -
arch/ia32/src/boot/memmap.S
r7dcbc0a1 rdcbc8be 29 29 30 30 #include <arch/boot/memmap.h> 31 32 .global memmap_arch_init33 34 .code1635 .section K_TEXT_START36 37 31 38 32 E820_RECORD_SIZE = MEMMAP_E820_RECORD_SIZE -
arch/ia32/src/mm/frame.c
r7dcbc0a1 rdcbc8be 38 38 { 39 39 if (config.cpu_active == 1) { 40 __u32 kernel_frames_max; 41 42 kernel_frames_max = ((KERNEL_ADDRESS_SPACE_END+1)/FRAME_SIZE); 43 44 kernel_frames_free = kernel_frames = frames < kernel_frames_max ? frames : kernel_frames_max; 40 kernel_frames = frames; 41 kernel_frames_free = frames_free; 45 42 frame_kernel_bitmap = frame_bitmap; 46 43 -
arch/ia32/src/mm/page.c
r7dcbc0a1 rdcbc8be 54 54 55 55 if (config.cpu_active == 1) { 56 dba = frame_alloc(FRAME_KA | FRAME_PANIC);56 dba = KA2PA(frame_alloc(FRAME_KA | FRAME_PANIC)); 57 57 memsetb(dba, PAGE_SIZE, 0); 58 cpu_write_dba(dba);59 58 60 59 bootstrap_dba = dba; … … 62 61 /* 63 62 * Identity mapping for all but 0th page. 63 * PA2KA(identity) mapping for all but 0th page. 64 64 */ 65 for (i = 1; i < frames; i++) 65 for (i = 1; i < frames; i++) { 66 66 map_page_to_frame(i * PAGE_SIZE, i * PAGE_SIZE, PAGE_CACHEABLE, 0); 67 map_page_to_frame(PA2KA(i * PAGE_SIZE), i * PAGE_SIZE, PAGE_CACHEABLE, 0); 68 } 67 69 68 70 trap_register(14, page_fault); 71 cpu_write_dba(dba); 69 72 } 70 73 else { … … 105 108 int pde, pte; 106 109 107 dba = cpu_read_dba(); 110 // TODO: map_page_to_frame should take dba as a parameter 111 // dba = cpu_read_dba(); 112 dba = bootstrap_dba; 108 113 109 114 pde = page >> 22; /* page directory entry */ … … 117 122 * frame for the page table and clean it. 118 123 */ 119 newpt = frame_alloc(FRAME_KA);124 newpt = KA2PA(frame_alloc(FRAME_KA)); 120 125 pd[pde].frame_address = newpt >> 12; 121 126 memsetb(newpt, PAGE_SIZE, 0); … … 124 129 } 125 130 if (copy) { 126 newpt = frame_alloc(FRAME_KA);131 newpt = KA2PA(frame_alloc(FRAME_KA)); 127 132 memcopy(pd[pde].frame_address << 12, newpt, PAGE_SIZE); 128 133 pd[pde].frame_address = newpt >> 12; -
arch/ia32/src/pm.c
r7dcbc0a1 rdcbc8be 67 67 68 68 /* gdtr is changed by kmp before next CPU is initialized */ 69 struct ptr_16_32 gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = (__address) gdt};70 struct ptr_16_32 idtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(idt), .base = (__address) idt};69 struct ptr_16_32 gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; 70 struct ptr_16_32 idtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(idt), .base = KA2PA((__address) idt) }; 71 71 72 72 void gdt_setbase(struct descriptor *d, __address base) 73 73 { 74 d->base_0_15 = base& 0xffff;75 d->base_16_23 = ( base>> 16) & 0xff;76 d->base_24_31 = ( base>> 24) & 0xff;74 d->base_0_15 = KA2PA(base) & 0xffff; 75 d->base_16_23 = (KA2PA(base) >> 16) & 0xff; 76 d->base_24_31 = (KA2PA(base) >> 24) & 0xff; 77 77 } 78 78 79 void gdt_setlimit(struct descriptor *d, __ addresslimit)79 void gdt_setlimit(struct descriptor *d, __u32 limit) 80 80 { 81 81 d->limit_0_15 = limit & 0xffff; … … 85 85 void idt_setoffset(struct idescriptor *d, __address offset) 86 86 { 87 d->offset_0_15 = offset& 0xffff;88 d->offset_16_31 = offset>> 16;87 d->offset_0_15 = KA2PA(offset) & 0xffff; 88 d->offset_16_31 = KA2PA(offset) >> 16; 89 89 } 90 90
Note:
See TracChangeset
for help on using the changeset viewer.