Changeset f6297e0 in mainline for arch/ia32/src/boot


Ignore:
Timestamp:
2005-09-03T15:45:14Z (20 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab08b42
Parents:
2f08a55d
Message:

proper way of initializing GDT during boot on IA-32, fixes the nasty hack
SMP might be still broken

File:
1 edited

Legend:

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

    r2f08a55d rf6297e0  
    3232.global kernel_image_start
    3333
     34KTEXT=8
     35KDATA=16
     36
    3437.code16
    3538#
     
    4548        xorw %ax, %ax
    4649        movw %ax, %ds
    47         movw %ax, %ss                   # initialize stack segment register
    48         movl $0x7c00, %esp              # initialize stack pointer
     50        movw %ax, %ss                                                   # initialize stack segment register
     51        movl $BOOTSTRAP_OFFSET - 0x400, %esp    # initialize stack pointer
    4952       
    5053        call memmap_arch_init
    5154       
    52         lgdt gdtr                       # initialize Global Descriptor Table register
     55        lgdt bsp_bootstrap_gdtr                                 # initialize Global Descriptor Table register
    5356       
    5457        movl %cr0, %eax
    5558        orl $0x1, %eax
    56         movl %eax, %cr0                 # switch to protected mode
     59        movl %eax, %cr0                                                 # switch to protected mode
    5760       
    58         jmpl $8, $boot_image_start
     61        jmpl $KTEXT, $boot_image_start
    5962       
    6063.code32
     
    7174       
    7275boot_image_start:
    73         movw $16, %ax
     76        movw $KDATA, %ax
    7477        movw %ax, %es
    7578        movw %ax, %gs
     
    8588        outb %al, $0x60
    8689       
    87         movl $0x8000, %esi
    88         movl $0x8000 + BOOT_OFFSET, %edi
     90        movl $BOOTSTRAP_OFFSET, %esi
     91        movl $BOOTSTRAP_OFFSET + BOOT_OFFSET, %edi
    8992        movl $_hardcoded_kernel_size, %ecx
    9093        cld
     
    9497       
    9598multiboot_image_start:
    96         movl $0x7c00, %esp              # initialize stack pointer
     99        movl BOOTSTRAP_OFFSET - 0x400, %esp             # initialize stack pointer
    97100       
    98         lgdt gdtr
     101        lgdt gdtr                                                               # initialize Global Descriptor Table register
    99102
    100         movw $16, %ax
     103        movw $KDATA, %ax
    101104        movw %ax, %es
    102105        movw %ax, %gs
    103106        movw %ax, %fs
    104         movw %ax, %ds                   # kernel data + stack
     107        movw %ax, %ds                                                   # kernel data + stack
    105108        movw %ax, %ss
    106109       
    107         call map_kernel                 # map kernel and turn paging on
     110        call map_kernel                                                 # map kernel and turn paging on
    108111       
    109112protected:
    110         call main_bsp                   # never returns
     113        call main_bsp           # never returns
    111114
    112115        cli
Note: See TracChangeset for help on using the changeset viewer.