Changeset f6297e0 in mainline
- Timestamp:
- 2005-09-03T15:45:14Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab08b42
- Parents:
- 2f08a55d
- Location:
- arch/ia32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/_link.ld
r2f08a55d rf6297e0 18 18 *(K_TEXT_START_2); 19 19 unmapped_ktext_end = .; 20 20 21 unmapped_kdata_start = .; 21 22 *(K_DATA_START); 22 23 unmapped_kdata_end = .; 23 24 } 24 25 .mapped (0x80100000+ SIZEOF(.unmapped)+0x8000): AT (0x8000+SIZEOF(.unmapped)) {25 26 .mapped (0x80100000+0x8000+SIZEOF(.unmapped)): AT (0x8000+SIZEOF(.unmapped)) { 26 27 ktext_start = .; 27 28 *(BOOT_DATA) 28 29 *(.text); 29 30 ktext_end = .; 30 31 31 32 kdata_start = .; 32 33 *(.data); /* initialized data */ … … 39 40 hardcoded_kdata_size = .; 40 41 LONG(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start)); 42 hardcoded_unmapped_ktext_size = .; 43 LONG(unmapped_ktext_end - unmapped_ktext_start); 44 hardcoded_unmapped_kdata_size = .; 45 LONG(unmapped_kdata_end - unmapped_kdata_start); 41 46 *(.bss); /* uninitialized static variables */ 42 47 *(K_DATA_END); … … 45 50 46 51 _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); 47 52 48 53 _map_address = 0x80100000; 49 54 e820table_boot = e820table - _map_address; -
arch/ia32/include/boot/boot.h
r2f08a55d rf6297e0 30 30 #define __ia32_BOOT_H__ 31 31 32 #define BOOT_OFFSET 0x100000 32 #define BOOTSTRAP_OFFSET 0x8000 33 #define BOOT_OFFSET 0x100000 34 33 35 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 34 36 #define MULTIBOOT_HEADER_FLAGS 0x00010003 -
arch/ia32/src/boot/boot.S
r2f08a55d rf6297e0 32 32 .global kernel_image_start 33 33 34 KTEXT=8 35 KDATA=16 36 34 37 .code16 35 38 # … … 45 48 xorw %ax, %ax 46 49 movw %ax, %ds 47 movw %ax, %ss # initialize stack segment register48 movl $ 0x7c00, %esp# initialize stack pointer50 movw %ax, %ss # initialize stack segment register 51 movl $BOOTSTRAP_OFFSET - 0x400, %esp # initialize stack pointer 49 52 50 53 call memmap_arch_init 51 54 52 lgdt gdtr# initialize Global Descriptor Table register55 lgdt bsp_bootstrap_gdtr # initialize Global Descriptor Table register 53 56 54 57 movl %cr0, %eax 55 58 orl $0x1, %eax 56 movl %eax, %cr0 # switch to protected mode59 movl %eax, %cr0 # switch to protected mode 57 60 58 jmpl $ 8, $boot_image_start61 jmpl $KTEXT, $boot_image_start 59 62 60 63 .code32 … … 71 74 72 75 boot_image_start: 73 movw $ 16, %ax76 movw $KDATA, %ax 74 77 movw %ax, %es 75 78 movw %ax, %gs … … 85 88 outb %al, $0x60 86 89 87 movl $ 0x8000, %esi88 movl $ 0x8000+ BOOT_OFFSET, %edi90 movl $BOOTSTRAP_OFFSET, %esi 91 movl $BOOTSTRAP_OFFSET + BOOT_OFFSET, %edi 89 92 movl $_hardcoded_kernel_size, %ecx 90 93 cld … … 94 97 95 98 multiboot_image_start: 96 movl $0x7c00, %esp # initialize stack pointer99 movl BOOTSTRAP_OFFSET - 0x400, %esp # initialize stack pointer 97 100 98 lgdt gdtr 101 lgdt gdtr # initialize Global Descriptor Table register 99 102 100 movw $ 16, %ax103 movw $KDATA, %ax 101 104 movw %ax, %es 102 105 movw %ax, %gs 103 106 movw %ax, %fs 104 movw %ax, %ds # kernel data + stack107 movw %ax, %ds # kernel data + stack 105 108 movw %ax, %ss 106 109 107 call map_kernel # map kernel and turn paging on110 call map_kernel # map kernel and turn paging on 108 111 109 112 protected: 110 call main_bsp 113 call main_bsp # never returns 111 114 112 115 cli -
arch/ia32/src/ia32.c
r2f08a55d rf6297e0 58 58 if (config.cpu_active == 1) { 59 59 bios_init(); 60 i8042_init(); /* a20 bit*/60 i8042_init(); /* keyboard controller */ 61 61 i8259_init(); /* PIC */ 62 62 i8254_init(); /* hard clock */ -
arch/ia32/src/mm/frame.c
r2f08a55d rf6297e0 31 31 #include <mm/vm.h> 32 32 #include <config.h> 33 #include <arch/boot/boot.h> 33 34 #include <arch/boot/memmap.h> 34 35 35 #include <print.h> 36 size_t hardcoded_unmapped_ktext_size = 0; 37 size_t hardcoded_unmapped_kdata_size = 0; 36 38 37 39 void frame_arch_init(void) … … 40 42 41 43 if (config.cpu_active == 1) { 44 /* Reserve the NULL frame */ 42 45 frame_not_free(0x0); 43 46 47 /* Reserve well-known memory regions */ 44 48 frame_region_not_free(0xa0000,0xff000); 45 49 frame_region_not_free(0xfec00000,0xffffffff); 46 50 47 /* This is a nasty hack, which should be fixed soon*/48 frame_region_not_free( 0x0, 0xfffff);51 /* Reserve real mode bootstrap memory */ 52 frame_region_not_free(BOOTSTRAP_OFFSET, BOOTSTRAP_OFFSET + hardcoded_unmapped_ktext_size + hardcoded_unmapped_kdata_size); 49 53 50 54 for (i=e820counter;i>0;i--) { -
arch/ia32/src/pm.c
r2f08a55d rf6297e0 71 71 72 72 /* gdtr is changed by kmp before next CPU is initialized */ 73 struct ptr_16_32 gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt - BOOT_OFFSET) }; 73 struct ptr_16_32 bsp_bootstrap_gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt - BOOT_OFFSET) }; 74 struct ptr_16_32 ap_bootstrap_gdtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; 75 struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; 74 76 struct ptr_16_32 idtr __attribute__ ((section ("K_DATA_START"))) = { .limit = sizeof(idt), .base = KA2PA((__address) idt) }; 75 77 … … 171 173 * Update addresses in GDT and IDT to their virtual counterparts. 172 174 */ 173 gdtr.base = KA2PA(gdtr.base);175 gdtr.base = (__address) gdt; 174 176 idtr.base = (__address) idt; 175 177 __asm__ volatile ("lgdt %0\n" : : "m" (gdtr)); -
arch/ia32/src/smp/ap.S
r2f08a55d rf6297e0 48 48 .code16 49 49 cli 50 xorw %ax, %ax51 movw %ax, %ds50 xorw %ax, %ax 51 movw %ax, %ds 52 52 53 lgdt gdtr# initialize Global Descriptor Table register53 lgdt ap_bootstrap_gdtr # initialize Global Descriptor Table register 54 54 55 movl %cr0,%eax 56 orl $1,%eax 57 movl %eax,%cr0 # switch to protected mode 58 jmpl $KTEXT,$jump_to_kernel 55 movl %cr0, %eax 56 orl $1, %eax 57 movl %eax, %cr0 # switch to protected mode 58 jmpl $KTEXT, $jump_to_kernel 59 59 60 jump_to_kernel: 60 61 .code32 61 movw $KDATA, %ax62 movw %ax, %ds63 movw %ax, %es64 movw %ax, %ss65 movl $(ctx-0x80000000), %eax # KA2PA((__address) &ctx)66 movl (%eax), %esp67 subl $0x80000000, %esp# KA2PA(ctx.sp)62 movw $KDATA, %ax 63 movw %ax, %ds 64 movw %ax, %es 65 movw %ax, %ss 66 movl $(ctx-0x80000000), %eax # KA2PA((__address) &ctx) 67 movl (%eax), %esp 68 subl $0x80000000, %esp # KA2PA(ctx.sp) 68 69 69 call map_kernel # map kernel and turn paging on 70 call map_kernel # map kernel and turn paging on 71 72 movb $0xd1, %al # enable A20 using the keyboard controller 73 outb %al, $0x64 74 movb $0xdf, %al 75 outb %al, $0x60 70 76 71 jmpl $KTEXT, $main_ap77 jmpl $KTEXT, $main_ap 72 78 73 79 #endif /* __SMP__ */
Note:
See TracChangeset
for help on using the changeset viewer.