Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ed35d779
authored
Sep 09, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed up the gdt, still crashing
parent
781eab06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
boot.asm
boot.asm
View file @
ed35d779
...
@@ -101,7 +101,9 @@ str1 db 'Hello World', 0 ; Hello World
...
@@ -101,7 +101,9 @@ str1 db 'Hello World', 0 ; Hello World
str2
db
'
WHY
IS
THIS
'
,
0
str2
db
'
WHY
IS
THIS
'
,
0
hexChars
db
'
0123456789
abcdef
'
; Used for hex formatting
hexChars
db
'
0123456789
abcdef
'
; Used for hex formatting
gdtr
:
dw
48
dw
0x0
dw
gdt
Main
:
;main section
Main
:
;main section
nop
nop
nop
nop
...
@@ -114,23 +116,22 @@ Main: ;main section
...
@@ -114,23 +116,22 @@ Main: ;main section
int
0x15
int
0x15
;; now to try protected mode...
;; now to try protected mode...
cli
cli
gdtr
:
dw
0
dd
0
setGdt
:
setGdt
:
xor
eax
,
eax
;
xor eax, eax
mov
ax
,
ds
;
mov ax, ds
shl
eax
,
4
;
shl eax, 4
add
eax
,
gdt
;
add eax, gdt
;jp $
;jp $
mov
[
gdtr
+
2
]
,
eax
;
mov [gdtr + 2], eax
;jp $ ;
;jp $ ;
mov
eax
,
gdt_end
;
mov eax, gdt_end
;jp $
;jp $
sub
eax
,
gdt
;
sub eax, gdt
mov
[gdtr],
ax
;
mov [gdtr], ax
lgdt
[gdtr]
lgdt
[gdtr]
mov
eax
,
cr0
mov
eax
,
cr0
or
al
,
1
or
eax
,
1
mov
cr0
,
eax
mov
cr0
,
eax
jmp
08
h
:
PMain
jmp
08
h
:
PMain
...
@@ -149,8 +150,8 @@ gdt:
...
@@ -149,8 +150,8 @@ gdt:
db
0x10
; load protected-mode kernel to 100000h
db
0x10
; load protected-mode kernel to 100000h
db
0x93
; data access rights
db
0x93
; data access rights
dw
0
dw
0
times
1
6
db
0
times
1
5
db
0
gdt_end
:
gdt_end
:
db
0
;; .null: times 8 db 0
;; .null: times 8 db 0
;; .code: dw 0x0400 ; limit (4MiB)
;; .code: dw 0x0400 ; limit (4MiB)
;; dw 0x0000 ; base 0-15
;; dw 0x0000 ; base 0-15
...
@@ -171,6 +172,7 @@ gdt_end:
...
@@ -171,6 +172,7 @@ gdt_end:
;; db 0xC0
;; db 0xC0
;; db 0x0C
;; db 0x0C
PMain
:
PMain
:
[
bits
32
]
mov
si
,
str1
mov
si
,
str1
call
PrintStr
call
PrintStr
nop
nop
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment