git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SpiderScript - Bugs, Documentation and a few language features
[tpg/acess2.git]
/
Kernel
/
arch
/
x86
/
start.asm
diff --git
a/Kernel/arch/x86/start.asm
b/Kernel/arch/x86/start.asm
index
f79c647
..
4be4130
100644
(file)
--- a/
Kernel/arch/x86/start.asm
+++ b/
Kernel/arch/x86/start.asm
@@
-22,7
+22,7
@@
mboot:
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
- dd mboot
- KERNEL_BASE
;Location of Multiboot Header
+ dd mboot
; - KERNEL_BASE
;Location of Multiboot Header
; Multiboot 2 Header
;mboot2:
; Multiboot 2 Header
;mboot2:
@@
-59,6
+59,8
@@
mboot:
[extern kmain]
[global start]
start:
[extern kmain]
[global start]
start:
+ ; Just show we're here
+ mov WORD [0xB8000], 0x0741 ; 'A'
; Set up stack
mov esp, Kernel_Stack_Top
; Set up stack
mov esp, Kernel_Stack_Top
@@
-71,13
+73,20
@@
start:
or ecx, 0x80010000 ; PG and WP
mov cr0, ecx
or ecx, 0x80010000 ; PG and WP
mov cr0, ecx
+ mov WORD [0xB8002], 0x0763 ; 'c'
+ mov WORD [0xB8004], 0x0765 ; 'e'
+
lea ecx, [.higherHalf]
jmp ecx
.higherHalf:
lea ecx, [.higherHalf]
jmp ecx
.higherHalf:
+
+ mov WORD [0xB8006], 0x0773 ; 's'
+ mov WORD [0xB8008], 0x0773 ; 's'
; Call the kernel
push ebx ; Multiboot Info
push eax ; Multiboot Magic Value
; Call the kernel
push ebx ; Multiboot Info
push eax ; Multiboot Magic Value
+ mov WORD [0xB800A], 0x0732 ; '2'
call kmain
; Halt the Machine
call kmain
; Halt the Machine
@@
-118,8
+127,8
@@
APStartup:
mov ds, ax
lgdt [DWORD ds:lGDTPtr-KERNEL_BASE-0xFFFF0]
mov eax, cr0
mov ds, ax
lgdt [DWORD ds:lGDTPtr-KERNEL_BASE-0xFFFF0]
mov eax, cr0
- or
al, 1
- mov
cr0, eax
+ or al, 1
+ mov cr0, eax
jmp 08h:DWORD .ProtectedMode-KERNEL_BASE
[bits 32]
.ProtectedMode:
jmp 08h:DWORD .ProtectedMode-KERNEL_BASE
[bits 32]
.ProtectedMode:
@@
-134,7
+143,7
@@
APStartup:
mov eax, gaInitPageDir - KERNEL_BASE
mov cr3, eax
mov eax, cr0
mov eax, gaInitPageDir - KERNEL_BASE
mov cr3, eax
mov eax, cr0
- or
eax, 0x80010000
; PG and WP
+ or
eax, 0x80010000
; PG and WP
mov cr0, eax
; Jump to higher half
lea eax, [.higherHalf]
mov cr0, eax
; Jump to higher half
lea eax, [.higherHalf]
@@
-145,26
+154,30
@@
APStartup:
lidt [gIDTPtr]
mov ebp, [gpMP_LocalAPIC]
lidt [gIDTPtr]
mov ebp, [gpMP_LocalAPIC]
- mov e
si, [eax
+0x20] ; Read ID
- shr e
si
, 24
+ mov e
bx, [ebp
+0x20] ; Read ID
+ shr e
bx
, 24
;xchg bx, bx ; MAGIC BREAK
; CL is now local APIC ID
;xchg bx, bx ; MAGIC BREAK
; CL is now local APIC ID
- mov cl, BYTE [gaAPIC_to_CPU+esi]
- ; CL is now the CPU ID
- mov BYTE [gaCPUs+esi*8+1], 1
+ mov cl, BYTE [gaAPIC_to_CPU+ebx]
+ xor ebx, ebx
+ mov bl, cl
+ ; BL is now the CPU ID
+ mov BYTE [gaCPUs+ebx*8+1], 1
; Decrement the remaining CPU count
dec DWORD [giNumInitingCPUs]
; Create a stack
; Decrement the remaining CPU count
dec DWORD [giNumInitingCPUs]
; Create a stack
- lea edx, [e
si
+1]
+ lea edx, [e
bx
+1]
shl edx, 5+2 ; *32 *4
lea esp, [gInitAPStacks+edx]
call MM_NewKStack
mov esp, eax
; Set TSS
shl edx, 5+2 ; *32 *4
lea esp, [gInitAPStacks+edx]
call MM_NewKStack
mov esp, eax
; Set TSS
- lea ecx, [e
si
*8+0x30]
+ lea ecx, [e
bx
*8+0x30]
ltr cx
ltr cx
+ ; Save the CPU number to a debug register
+ mov dr1, ebx
;xchg bx, bx ; MAGIC_BREAK
; Enable Local APIC
;xchg bx, bx ; MAGIC_BREAK
; Enable Local APIC
@@
-217,10
+230,12
@@
CallWithArgArray:
[global gaInitPageTable]
align 0x1000
gaInitPageDir:
[global gaInitPageTable]
align 0x1000
gaInitPageDir:
- dd gaInitPageTable-KERNEL_BASE+3 ; 0x00
- times 1024-256-1 dd 0
- dd gaInitPageTable-KERNEL_BASE+3 ; 0xC0
- times 256-1 dd 0
+ dd gaInitPageTable-KERNEL_BASE+3 ; 0x000 - Low kernel
+ times 0x300-0x000-1 dd 0
+ dd gaInitPageTable-KERNEL_BASE+3 ; 0xC00 - High kernel
+ times 0x3F0-0x300-1 dd 0
+ dd gaInitPageDir-KERNEL_BASE+3 ; 0xFC0 - Fractal
+ times 0x400-0x3F0-1 dd 0
align 0x1000
gaInitPageTable:
%assign i 0
align 0x1000
gaInitPageTable:
%assign i 0
UCC
git Repository :: git.ucc.asn.au