Changeset 66def8d in mainline for arch/ia32/src


Ignore:
Timestamp:
2006-01-08T17:51:36Z (20 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
8725fb4
Parents:
078a0a1
Message:

simplify and cleanup ia32 boot process, remove obsolete stuff

Location:
arch/ia32/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/boot/boot.S

    r078a0a1 r66def8d  
    11#
    22# Copyright (C) 2001-2004 Jakub Jermar
     3# Copyright (C) 2005-2006 Martin Decky
    34# All rights reserved.
    45#
     
    3233#include <arch/pm.h>
    3334
     35#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
     36
    3437.section K_TEXT_START, "ax"
    3538
     
    3942.code32
    4043.align 4
     44.global multiboot_image_start
    4145multiboot_header:
    4246        .long MULTIBOOT_HEADER_MAGIC
    4347        .long MULTIBOOT_HEADER_FLAGS
    4448        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)        # checksum
    45         .long multiboot_header + BOOT_OFFSET
    46         .long unmapped_ktext_start + BOOT_OFFSET
     49        .long multiboot_header
     50        .long unmapped_ktext_start
    4751        .long 0
    4852        .long 0
    49         .long multiboot_image_start + BOOT_OFFSET
     53        .long multiboot_image_start
    5054       
    5155multiboot_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
    5558
    5659        movw $KDATA, %cx
     
    5861        movw %cx, %gs
    5962        movw %cx, %fs
    60         movw %cx, %ds                                                   # kernel data + stack
     63        movw %cx, %ds                                   # kernel data + stack
    6164        movw %cx, %ss
    6265       
    63         jmpl $KTEXT, $multiboot_meeting_point + BOOT_OFFSET
     66        jmpl $KTEXT, $multiboot_meeting_point
    6467        multiboot_meeting_point:
    6568       
    6669        pushl %ebx                                                      # save parameters from GRUB
    6770        pushl %eax
    68        
    69         movl $BOOTSTRAP_OFFSET + BOOT_OFFSET, %esi
    70         movl $BOOTSTRAP_OFFSET, %edi
    71         movl $_hardcoded_unmapped_size, %ecx
    72         cld
    73         rep movsb
    7471       
    7572        call map_kernel                                                 # map kernel and turn paging on
     
    171168        invalid_boot:
    172169       
    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
    174183
    175184        cli
     
    215224page_directory:
    216225        .space 4096, 0
    217 
    218 .global real_bootstrap_gdtr_boot
    219 real_bootstrap_gdtr_boot:
    220         .word selector(GDT_ITEMS)
    221         .long KA2PA(gdt)-BOOT_OFFSET
    222 
  • arch/ia32/src/mm/frame.c

    r078a0a1 r66def8d  
    5151                frame_region_not_free(0, FRAME_SIZE);
    5252               
    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
    5557               
    5658                for (i = 0; i < e820counter; i++) {
  • arch/ia32/src/pm.c

    r078a0a1 r66def8d  
    7272
    7373/* 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) };
     74struct ptr_16_32 bootstrap_gdtr = { .limit = sizeof(gdt), .base = KA2PA((__address) gdt) };
    7575struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = (__address) gdt };
    7676
  • arch/ia32/src/smp/ap.S

    r078a0a1 r66def8d  
    11#
    22# Copyright (C) 2001-2004 Jakub Jermar
     3# Copyright (C) 2005-2006 Martin Decky
    34# All rights reserved.
    45#
     
    3132#
    3233
    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"
    3440
    3541#ifdef CONFIG_SMP
    3642
    37 .global ap_boot
     43.global unmapped_ap_boot
    3844
    3945KTEXT=8
     
    4551
    4652.align 4096
    47 ap_boot:
     53unmapped_ap_boot:
    4854.code16
    4955        cli
     
    5157        movw %ax, %ds
    5258
    53         lgdt real_bootstrap_gdtr_boot   # initialize Global Descriptor Table register
     59        lgdt ap_gdtr            # initialize Global Descriptor Table register
    5460       
    5561        movl %cr0, %eax
    5662        orl $1, %eax
    5763        movl %eax, %cr0                         # switch to protected mode
    58         jmpl $KTEXT, $jump_to_kernel
     64        jmpl $KTEXT, $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET
    5965       
    6066jump_to_kernel:
     
    6470        movw %ax, %es
    6571        movw %ax, %ss
    66         movl $(ctx-0x80000000), %eax    # KA2PA((__address) &ctx)
     72        movl $KA2PA(ctx), %eax                  # KA2PA((__address) &ctx)
    6773        movl (%eax), %esp
    6874        subl $0x80000000, %esp                  # KA2PA(ctx.sp)
     
    7581
    7682#endif /* CONFIG_SMP */
     83
     84
     85.section K_DATA_START, "ax"
     86
     87#ifdef CONFIG_SMP
     88
     89.global unmapped_ap_gdtr
     90
     91unmapped_ap_gdtr:
     92        .word 0
     93        .long 0
     94
     95#endif /* CONFIG_SMP */
  • arch/ia32/src/smp/apic.c

    r078a0a1 r66def8d  
    3131#include <arch/smp/ap.h>
    3232#include <arch/smp/mps.h>
     33#include <arch/boot/boot.h>
    3334#include <mm/page.h>
    3435#include <time/delay.h>
  • arch/ia32/src/smp/smp.c

    r078a0a1 r66def8d  
    3131#include <arch/smp/mps.h>
    3232#include <arch/smp/ap.h>
     33#include <arch/boot/boot.h>
    3334#include <genarch/acpi/acpi.h>
    3435#include <genarch/acpi/madt.h>
     
    142143                        panic("couldn't allocate memory for GDT\n");
    143144
    144                 memcpy(gdt_new, gdt, GDT_ITEMS*sizeof(struct descriptor));
     145                memcpy(gdt_new, gdt, GDT_ITEMS * sizeof(struct descriptor));
    145146                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);
    147149                gdtr.base = (__address) gdt_new;
    148150
Note: See TracChangeset for help on using the changeset viewer.