summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/kernel_entry.asm7
-rw-r--r--boot/mbr.asm2
-rw-r--r--boot/mp.asm41
3 files changed, 50 insertions, 0 deletions
diff --git a/boot/kernel_entry.asm b/boot/kernel_entry.asm
index adb6b51..3b1fb26 100644
--- a/boot/kernel_entry.asm
+++ b/boot/kernel_entry.asm
@@ -10,5 +10,12 @@
[extern kernel_main]
+push 0x1
+
+cmp eax,1
+je multiproc
+push 0x0
+multiproc:
+
push esp
call kernel_main ; jumps in the world of C
diff --git a/boot/mbr.asm b/boot/mbr.asm
index c565f33..4ece914 100644
--- a/boot/mbr.asm
+++ b/boot/mbr.asm
@@ -149,6 +149,8 @@ boot_32_pm:
mov al, 0xdd ; command 0xdd: enable a20
; ;mov al, 0xdf ; command 0xdf: disable a20
out 0x64, al ; send command to controller
+
+ mov eax,0
;
call KERNEL_OFFSET ;jump into our Kernel!
;
diff --git a/boot/mp.asm b/boot/mp.asm
new file mode 100644
index 0000000..6c794bc
--- /dev/null
+++ b/boot/mp.asm
@@ -0,0 +1,41 @@
+; other processors will enter here!
+
+[org 0x7000]
+
+jmp switch_to_pm
+
+%include "boot/GDT.asm"
+
+[bits 16]
+switch_to_pm:
+
+ cli ;switch off interrupts!
+ lgdt [gdt_descriptor] ;load descriptor table!
+
+ ;switch on 32-bit protected mode
+ mov eax, cr0
+ or eax,0x1
+ mov cr0, eax
+
+ jmp 0x8:init_pm
+
+[bits 32]
+init_pm:
+
+ mov ax, 0x10
+ mov ds, ax
+ mov ss, ax
+ mov es, ax
+ mov fs, ax
+ mov gs, ax
+
+ mov ebp, 0x95000
+ mov esp, ebp
+
+ call boot_32_pm ;continue booting in 32-bit protected mode
+
+boot_32_pm
+
+ mov eax,1
+;
+ call 0x1000 ;jump into our Kernel!