repo.or.cz
/
planlOS.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
- Implemented execp*.
[planlOS.git]
/
system
/
kernel
/
ke
/
smpstart.S
blob
a0e09163ad69848564e84502e7708a1ca8a12b82
1
2
.section .text
3
.code16
4
.org 0x0
5
.globl _start
6
7
_start:
8
jmp smpstart
9
10
// Entry function
11
entry:
12
.long 0
13
// Page directory
14
page_directory:
15
.long 0
16
stack_array:
17
.long 0
18
19
smpstart:
20
// Get into protected mode
21
mov $0, %ax
22
mov %ax, %ds
23
lgdt (gdtptr)
24
mov %cr0, %eax
25
or $1, %eax
26
mov %eax, %cr0
27
28
ljmp $0x08, $pm
29
.code32
30
pm:
31
mov $0x10, %ax
32
mov %ax, %ds
33
mov %ax, %es
34
mov %ax, %fs
35
mov %ax, %gs
36
mov %ax, %ss
37
38
// Activate paging
39
mov $0, %eax
40
mov %eax, %cr2
41
mov page_directory, %eax
42
mov %eax, %cr3
43
mov %cr0, %eax
44
or $0x80000000, %eax
45
mov %eax, %cr0
46
// Allocate stack
47
//mov $0x2000, %esp
48
mov $1, %eax
49
cpuid
50
shr $24, %ebx
51
imul $4, %ebx
52
mov stack_array, %esi
53
add %ebx, %esi
54
mov (%esi), %esp
55
56
// Jump into kernel
57
mov (entry), %eax
58
jmp *%eax
59
cli
60
hlt
61
62
gdtptr:
63
.short gdtend - gdt - 1
64
.long gdt
65
66
67
gdt:
68
.long 0x00000000, 0x00000000
69
.long 0x0000ffff, 0x00cf9a00
70
.long 0x0000ffff, 0x00cf9200
71
gdtend:
72