Changeset 66def8d in mainline
- Timestamp:
- 2006-01-08T17:51:36Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8725fb4
- Parents:
- 078a0a1
- Location:
- arch/ia32
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/_link.ld.in
r078a0a1 r66def8d 14 14 15 15 SECTIONS { 16 .unmapped BOOT STRAP_OFFSET: AT (BOOTSTRAP_OFFSET) {16 .unmapped BOOT_OFFSET: AT (0) { 17 17 unmapped_ktext_start = .; 18 18 *(K_TEXT_START); 19 *(K_TEXT_START_2);20 19 unmapped_ktext_end = .; 21 20 … … 25 24 } 26 25 27 .mapped (PA2KA(BOOT_OFFSET +BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)): AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) {26 .mapped (PA2KA(BOOT_OFFSET)+SIZEOF(.unmapped)): AT (SIZEOF(.unmapped)) { 28 27 ktext_start = .; 29 28 *(.text); … … 35 34 *(COMMON); /* global variables */ 36 35 hardcoded_load_address = .; 37 LONG(PA2KA(BOOT_OFFSET +BOOTSTRAP_OFFSET));36 LONG(PA2KA(BOOT_OFFSET)); 38 37 hardcoded_ktext_size = .; 39 38 LONG((ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start)); … … 54 53 *(.comment); 55 54 } 55 56 #ifdef CONFIG_SMP 57 58 _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start); 59 ap_boot = unmapped_ap_boot - BOOT_OFFSET + AP_BOOT_OFFSET; 60 ap_gdtr = unmapped_ap_gdtr - BOOT_OFFSET + AP_BOOT_OFFSET; 61 protected_ap_gdtr = PA2KA(ap_gdtr); 56 62 57 58 _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start); 59 _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start); 60 61 e820table_boot = KA2PA(e820table) - BOOT_OFFSET; 62 e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET; 63 real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot); 63 #endif /* CONFIG_SMP */ 64 64 65 } -
arch/ia32/include/boot/boot.h
r078a0a1 r66def8d 30 30 #define __ia32_BOOT_H__ 31 31 32 #define BOOTSTRAP_OFFSET 0x8000 33 #define BOOT_OFFSET 0x100000 32 #define BOOT_OFFSET 0x108000 33 #define AP_BOOT_OFFSET 0x8000 34 #define BOOT_STACK_SIZE 0x400 34 35 35 36 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 -
arch/ia32/include/pm.h
r078a0a1 r66def8d 132 132 133 133 extern struct ptr_16_32 gdtr; 134 extern struct ptr_16_32 real_bootstrap_gdtr;135 extern struct ptr_16_32 protected_ bootstrap_gdtr;134 extern struct ptr_16_32 bootstrap_gdtr; 135 extern struct ptr_16_32 protected_ap_gdtr; 136 136 extern struct tss *tss_p; 137 137 -
arch/ia32/src/boot/boot.S
r078a0a1 r66def8d 1 1 # 2 2 # Copyright (C) 2001-2004 Jakub Jermar 3 # Copyright (C) 2005-2006 Martin Decky 3 4 # All rights reserved. 4 5 # … … 32 33 #include <arch/pm.h> 33 34 35 #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) 36 34 37 .section K_TEXT_START, "ax" 35 38 … … 39 42 .code32 40 43 .align 4 44 .global multiboot_image_start 41 45 multiboot_header: 42 46 .long MULTIBOOT_HEADER_MAGIC 43 47 .long MULTIBOOT_HEADER_FLAGS 44 48 .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) # checksum 45 .long multiboot_header + BOOT_OFFSET46 .long unmapped_ktext_start + BOOT_OFFSET49 .long multiboot_header 50 .long unmapped_ktext_start 47 51 .long 0 48 52 .long 0 49 .long multiboot_image_start + BOOT_OFFSET53 .long multiboot_image_start 50 54 51 55 multiboot_image_start: 52 movl $BOOTSTRAP_OFFSET - 0x400, %esp # initialize stack pointer 53 54 lgdt protected_bootstrap_gdtr - 0x80000000 # initialize Global Descriptor Table register 56 movl $START_STACK, %esp # initialize stack pointer 57 lgdt KA2PA(bootstrap_gdtr) # initialize Global Descriptor Table register 55 58 56 59 movw $KDATA, %cx … … 58 61 movw %cx, %gs 59 62 movw %cx, %fs 60 movw %cx, %ds 63 movw %cx, %ds # kernel data + stack 61 64 movw %cx, %ss 62 65 63 jmpl $KTEXT, $multiboot_meeting_point + BOOT_OFFSET66 jmpl $KTEXT, $multiboot_meeting_point 64 67 multiboot_meeting_point: 65 68 66 69 pushl %ebx # save parameters from GRUB 67 70 pushl %eax 68 69 movl $BOOTSTRAP_OFFSET + BOOT_OFFSET, %esi70 movl $BOOTSTRAP_OFFSET, %edi71 movl $_hardcoded_unmapped_size, %ecx72 cld73 rep movsb74 71 75 72 call map_kernel # map kernel and turn paging on … … 171 168 invalid_boot: 172 169 173 call main_bsp - BOOT_OFFSET # never returns 170 #ifdef CONFIG_SMP 171 172 # copy AP bootstrap routines below 1 MB 173 174 movl $BOOT_OFFSET, %esi 175 movl $AP_BOOT_OFFSET, %edi 176 movl $_hardcoded_unmapped_size, %ecx 177 cld 178 rep movsb 179 180 #endif 181 182 call main_bsp # never returns 174 183 175 184 cli … … 215 224 page_directory: 216 225 .space 4096, 0 217 218 .global real_bootstrap_gdtr_boot219 real_bootstrap_gdtr_boot:220 .word selector(GDT_ITEMS)221 .long KA2PA(gdt)-BOOT_OFFSET222 -
arch/ia32/src/mm/frame.c
r078a0a1 r66def8d 51 51 frame_region_not_free(0, FRAME_SIZE); 52 52 53 /* Reserve real mode bootstrap memory */ 54 frame_region_not_free(BOOTSTRAP_OFFSET, hardcoded_unmapped_ktext_size + hardcoded_unmapped_kdata_size); 53 #ifdef CONFIG_SMP 54 /* Reserve AP real mode bootstrap memory */ 55 frame_region_not_free(AP_BOOT_OFFSET, hardcoded_unmapped_ktext_size + hardcoded_unmapped_kdata_size); 56 #endif 55 57 56 58 for (i = 0; i < e820counter; i++) { -
arch/ia32/src/pm.c
r078a0a1 r66def8d 72 72 73 73 /* gdtr is changed by kmp before next CPU is initialized */ 74 struct ptr_16_32 protected_bootstrap_gdtr = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) };74 struct ptr_16_32 bootstrap_gdtr = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) }; 75 75 struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = (__address) gdt }; 76 76 -
arch/ia32/src/smp/ap.S
r078a0a1 r66def8d 1 1 # 2 2 # Copyright (C) 2001-2004 Jakub Jermar 3 # Copyright (C) 2005-2006 Martin Decky 3 4 # All rights reserved. 4 5 # … … 31 32 # 32 33 33 .section K_TEXT_START_2, "ax" 34 #include <arch/boot/boot.h> 35 #include <arch/boot/memmap.h> 36 #include <arch/mm/page.h> 37 #include <arch/pm.h> 38 39 .section K_TEXT_START, "ax" 34 40 35 41 #ifdef CONFIG_SMP 36 42 37 .global ap_boot43 .global unmapped_ap_boot 38 44 39 45 KTEXT=8 … … 45 51 46 52 .align 4096 47 ap_boot:53 unmapped_ap_boot: 48 54 .code16 49 55 cli … … 51 57 movw %ax, %ds 52 58 53 lgdt real_bootstrap_gdtr_boot# initialize Global Descriptor Table register59 lgdt ap_gdtr # initialize Global Descriptor Table register 54 60 55 61 movl %cr0, %eax 56 62 orl $1, %eax 57 63 movl %eax, %cr0 # switch to protected mode 58 jmpl $KTEXT, $jump_to_kernel 64 jmpl $KTEXT, $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET 59 65 60 66 jump_to_kernel: … … 64 70 movw %ax, %es 65 71 movw %ax, %ss 66 movl $ (ctx-0x80000000), %eax# KA2PA((__address) &ctx)72 movl $KA2PA(ctx), %eax # KA2PA((__address) &ctx) 67 73 movl (%eax), %esp 68 74 subl $0x80000000, %esp # KA2PA(ctx.sp) … … 75 81 76 82 #endif /* CONFIG_SMP */ 83 84 85 .section K_DATA_START, "ax" 86 87 #ifdef CONFIG_SMP 88 89 .global unmapped_ap_gdtr 90 91 unmapped_ap_gdtr: 92 .word 0 93 .long 0 94 95 #endif /* CONFIG_SMP */ -
arch/ia32/src/smp/apic.c
r078a0a1 r66def8d 31 31 #include <arch/smp/ap.h> 32 32 #include <arch/smp/mps.h> 33 #include <arch/boot/boot.h> 33 34 #include <mm/page.h> 34 35 #include <time/delay.h> -
arch/ia32/src/smp/smp.c
r078a0a1 r66def8d 31 31 #include <arch/smp/mps.h> 32 32 #include <arch/smp/ap.h> 33 #include <arch/boot/boot.h> 33 34 #include <genarch/acpi/acpi.h> 34 35 #include <genarch/acpi/madt.h> … … 142 143 panic("couldn't allocate memory for GDT\n"); 143 144 144 memcpy(gdt_new, gdt, GDT_ITEMS *sizeof(struct descriptor));145 memcpy(gdt_new, gdt, GDT_ITEMS * sizeof(struct descriptor)); 145 146 memsetb((__address)(&gdt_new[TSS_DES]), sizeof(struct descriptor), 0); 146 real_bootstrap_gdtr.base = KA2PA((__address) gdt_new); 147 protected_ap_gdtr.limit = GDT_ITEMS * sizeof(struct descriptor); 148 protected_ap_gdtr.base = KA2PA((__address) gdt_new); 147 149 gdtr.base = (__address) gdt_new; 148 150
Note:
See TracChangeset
for help on using the changeset viewer.