Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bootloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
bootloader
Commits
cc1aee98
Commit
cc1aee98
authored
8 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Bootloader fixes on systems with wrong CS
parent
ad6d3ee3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
x86_64/bootsector.asm
+45
-59
45 additions, 59 deletions
x86_64/bootsector.asm
x86_64/print16.asm
+5
-4
5 additions, 4 deletions
x86_64/print16.asm
x86_64/startup-common.asm
+1
-1
1 addition, 1 deletion
x86_64/startup-common.asm
with
51 additions
and
64 deletions
x86_64/bootsector.asm
+
45
−
59
View file @
cc1aee98
...
@@ -12,6 +12,14 @@ boot: ; dl comes with disk
...
@@ -12,6 +12,14 @@ boot: ; dl comes with disk
; initialize stack
; initialize stack
mov
sp
,
0x7C00
mov
sp
,
0x7C00
; initialize CS
push
ax
push
word
.set_cs
retf
.set_cs:
; save disk number
mov
[
di
sk
],
dl
mov
[
di
sk
],
dl
mov
si
,
name
mov
si
,
name
...
@@ -45,16 +53,16 @@ boot: ; dl comes with disk
...
@@ -45,16 +53,16 @@ boot: ; dl comes with disk
; TODO rewrite to (eventually) move larger parts at once
; TODO rewrite to (eventually) move larger parts at once
; if that is done increase buffer_size_sectors in startup-common to that (max 0x80000 - startup_end)
; if that is done increase buffer_size_sectors in startup-common to that (max 0x80000 - startup_end)
load:
load:
cmp
cx
,
12
8
cmp
cx
,
12
7
jbe
.good_size
jbe
.good_size
pusha
pusha
mov
cx
,
12
8
mov
cx
,
12
7
call
load
call
load
popa
popa
add
ax
,
12
8
add
ax
,
12
7
add
dx
,
12
8
*
512
/
16
add
dx
,
12
7
*
512
/
16
sub
cx
,
12
8
sub
cx
,
12
7
jmp
load
jmp
load
.good_size:
.good_size:
...
@@ -63,31 +71,7 @@ load:
...
@@ -63,31 +71,7 @@ load:
mov
[
DAPACK.count
],
cx
mov
[
DAPACK.count
],
cx
mov
[
DAPACK.seg
],
dx
mov
[
DAPACK.seg
],
dx
mov
bx
,
[
DAPACK.addr
+
2
]
call
print_dapack
call
print_num
mov
bx
,
[
DAPACK.addr
]
call
print_num
mov
al
,
'#'
call
print_char
mov
bx
,
[
DAPACK.count
]
call
print_num
mov
al
,
' '
call
print_char
mov
bx
,
[
DAPACK.seg
]
call
print_num
mov
al
,
':'
call
print_char
mov
bx
,
[
DAPACK.buf
]
call
print_num
call
print_line
mov
dl
,
[
di
sk
]
mov
dl
,
[
di
sk
]
mov
si
,
DAPACK
mov
si
,
DAPACK
...
@@ -108,16 +92,16 @@ load:
...
@@ -108,16 +92,16 @@ load:
; TODO rewrite to (eventually) move larger parts at once
; TODO rewrite to (eventually) move larger parts at once
; if that is done increase buffer_size_sectors in startup-common to that (max 0x80000 - startup_end)
; if that is done increase buffer_size_sectors in startup-common to that (max 0x80000 - startup_end)
store:
store:
cmp
cx
,
12
8
cmp
cx
,
12
7
jbe
.good_size
jbe
.good_size
pusha
pusha
mov
cx
,
12
8
mov
cx
,
12
7
call
store
call
store
popa
popa
add
ax
,
12
8
add
ax
,
12
7
add
dx
,
12
8
*
512
/
16
add
dx
,
12
7
*
512
/
16
sub
cx
,
12
8
sub
cx
,
12
7
jmp
store
jmp
store
.good_size:
.good_size:
...
@@ -126,38 +110,41 @@ load:
...
@@ -126,38 +110,41 @@ load:
mov
[
DAPACK.count
],
cx
mov
[
DAPACK.count
],
cx
mov
[
DAPACK.seg
],
dx
mov
[
DAPACK.seg
],
dx
mov
bx
,
[
DAPACK.addr
+
2
]
call
print_dapack
call
print_num
mov
dl
,
[
di
sk
]
mov
si
,
DAPACK
mov
ah
,
0x43
int
0x13
jc
error
ret
mov
bx
,
[
DAPACK.addr
]
print_dapack:
call
print_num
mov
bx
,
[
DAPACK.addr
+
2
]
call
print_num
mov
al
,
'#'
mov
bx
,
[
DAPACK.addr
]
call
print_
char
call
print_
num
mov
bx
,
[
DAPACK.count
]
mov
al
,
'#'
call
print_
num
call
print_
char
mov
al
,
' '
mov
bx
,
[
DAPACK.count
]
call
print_
char
call
print_
num
mov
bx
,
[
DAPACK.seg
]
mov
al
,
' '
call
print_
num
call
print_
char
mov
al
,
':'
mov
bx
,
[
DAPACK.seg
]
call
print_
char
call
print_
num
mov
bx
,
[
DAPACK.buf
]
mov
al
,
':'
call
print_
num
call
print_
char
call
print_line
mov
bx
,
[
DAPACK.buf
]
call
print_num
mov
dl
,
[
di
sk
]
jmp
print_line
mov
si
,
DAPACK
mov
ah
,
0x43
int
0x13
jc
error
ret
error:
error:
mov
bh
,
0
mov
bh
,
0
...
@@ -180,7 +167,6 @@ error:
...
@@ -180,7 +167,6 @@ error:
name:
db
"
Redox
Loader
-
Stage
One
",0
name:
db
"
Redox
Loader
-
Stage
One
",0
errored: db "
Could
not
read
di
sk
"
,
0
errored: db "
Could
not
read
di
sk
"
,
0
finished:
db
"Redox Loader - Stage Two"
,
0
finished:
db
"Redox Loader - Stage Two"
,
0
line:
db
13
,
10
,
0
disk:
db
0
disk:
db
0
...
...
This diff is collapsed.
Click to expand it.
x86_64/print16.asm
+
5
−
4
View file @
cc1aee98
...
@@ -4,7 +4,7 @@ USE16
...
@@ -4,7 +4,7 @@ USE16
; a newline
; a newline
newline:
db
0xD
,
0xA
,
0
newline:
db
13
,
10
,
0
; print a string and a newline
; print a string and a newline
; IN
; IN
...
@@ -13,8 +13,7 @@ newline: db 0xD, 0xA, 0
...
@@ -13,8 +13,7 @@ newline: db 0xD, 0xA, 0
; ax
; ax
print_line:
print_line:
mov
si
,
newline
mov
si
,
newline
call
print
jmp
print
ret
; print a string
; print a string
; IN
; IN
...
@@ -22,11 +21,13 @@ print_line:
...
@@ -22,11 +21,13 @@ print_line:
; CLOBBER
; CLOBBER
; ax
; ax
print:
print:
cld
.loop:
lodsb
lodsb
test
al
,
al
test
al
,
al
jz
.done
jz
.done
call
print_char
call
print_char
jmp
print
jmp
.loop
.done:
.done:
ret
ret
...
...
This diff is collapsed.
Click to expand it.
x86_64/startup-common.asm
+
1
−
1
View file @
cc1aee98
...
@@ -14,7 +14,7 @@ startup:
...
@@ -14,7 +14,7 @@ startup:
; buffersize in multiple of sectors (512 Bytes)
; buffersize in multiple of sectors (512 Bytes)
; min 1
; min 1
; max (0x70000 - startup_end) / 512
; max (0x70000 - startup_end) / 512
buffer_size_sectors
equ
12
8
buffer_size_sectors
equ
12
7
; buffer size in Bytes
; buffer size in Bytes
buffer_size_bytes
equ
buffer_size_sectors
*
512
buffer_size_bytes
equ
buffer_size_sectors
*
512
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment