Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 279 → Rev 280

/SPARTAN/trunk/arch/ia32/include/boot/boot.h
29,10 → 29,12
#ifndef __ia32_BOOT_H__
#define __ia32_BOOT_H__
 
#define BOOTSTRAP_OFFSET 0x8000
#define BOOTSTRAP_OFFSET 0x8000
#define BOOT_OFFSET 0x100000
 
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define MULTIBOOT_HEADER_FLAGS 0x00010003
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
#define MULTIBOOT_HEADER_FLAGS 0x00010003
 
#define MULTIBOOT_LOADER_MAGIC 0x2BADB002
 
#endif
/SPARTAN/trunk/arch/ia32/src/boot/boot.S
103,18 → 103,50
lgdt protected_bootstrap_gdtr - 0x80000000 # initialize Global Descriptor Table register
 
movw $KDATA, %ax
movw %ax, %es
movw %ax, %gs
movw %ax, %fs
movw %ax, %ds # kernel data + stack
movw %ax, %ss
movw $KDATA, %cx
movw %cx, %es
movw %cx, %gs
movw %cx, %fs
movw %cx, %ds # kernel data + stack
movw %cx, %ss
jmpl $KTEXT, $multiboot_meeting_point + BOOT_OFFSET
multiboot_meeting_point:
pushl %ebx
pushl %eax
call map_kernel # map kernel and turn paging on
popl %eax
popl %ebx
cmpl $MULTIBOOT_LOADER_MAGIC, %eax
je valid_boot
# ...
jmp invalid_boot
valid_boot:
movl (%ebx), %eax
# ... check flags in eax
movl 4(%ebx), %ecx
addl 8(%ebx), %ecx
movl %ecx, e801memorysize
# movl 44(%ebx), %ecx
xorl %ecx, %ecx
movl %ecx, e820counter
# movl 48(%ebx), %esi
# movl $e820table, %edi
# cld
# rep movsb
invalid_boot:
call main_bsp - BOOT_OFFSET # never returns
 
cli