Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ros-playground
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
ros-playground
Commits
aa814a9c
There was an error fetching the commit references. Please try again later.
Commit
aa814a9c
authored
4 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
add kern loader, debugging
parent
1036cac9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+4
-0
4 additions, 0 deletions
Makefile
bootloader/boot.asm
+35
-3
35 additions, 3 deletions
bootloader/boot.asm
kernel/Makefile
+3
-1
3 additions, 1 deletion
kernel/Makefile
with
42 additions
and
4 deletions
Makefile
+
4
−
0
View file @
aa814a9c
default
:
assemble
bootloader
:
$(
MAKE
)
-C
bootloader
kernel
:
$(
MAKE
)
-C
kernel
.PHONY
:
bootloader kernel
build
:
bootloader kernel
assemble
:
build
...
...
This diff is collapsed.
Click to expand it.
bootloader/boot.asm
+
35
−
3
View file @
aa814a9c
[
bits
16
]
[
org
0x7c00
]
mov
[
_boot_drive_id
],
dl
jmp
_init_prot_mode
gdt_begin:
...
...
@@ -61,14 +62,45 @@ _prot_begin:
mov
ebx
,
_motd_32
call
println_vga
KERN_ADDR
equ
0x1000
; Load the kernel image from boot disk, disk offset 512B to 64KB.
KERN_ADDR
equ
0x7e00
mov
ah
,
0x02
mov
ch
,
0
mov
dh
,
0
mov
cl
,
2
; from the second one,
mov
al
,
127
; read 127 sectors in total.
mov
bx
,
KERN_ADDR
int
0x13
; Set carry on error, and set AL to sectors that actual read.
jmp
_stall
jc
di
sk_io_error
mov
dl
,
0x7f
cmp
dl
,
al
jne
di
sk_io_error
; kernel successfully loaded now!
mov
ebx
,
_motd_kern_ok
call
println_vga
_stall:
jmp
$
disk_io_error:
mov
ebx
,
_motd_disk_error
call
println_vga
jmp
_stall
_motd_disk_error:
db
'DISK_IO_ERROR'
,
0x0
_motd_32:
db
'[ENTER X86 MODE SUCC] [LOADING KERN..]'
,
0x0
db
'[ENTER X86 MODE SUCC]'
,
0x0
_motd_kern_ok:
db
'[ENTER X86 MODE SUCC] [LOAD KERN SUCC]'
,
0x0
_motd_endk:
db
'[ENTER X86 MODE SUCC] [LOADING KERN..] [KERN EXITED]'
,
0x0
db
'[ENTER X86 MODE SUCC] [LOAD KERN SUCC] [KERN EXITED]'
,
0x0
_boot_drive_id:
db
0x0
%include "./mbr_end.inc"
...
...
This diff is collapsed.
Click to expand it.
kernel/Makefile
+
3
−
1
View file @
aa814a9c
kernel
:
gcc
-ffreestanding
-c
kernel.c
-o
kernel.o
# -m32
ld
-o
kernel.img
-Ttext
0x1000
--oformat
binary kernel.o
# -m elf_i386
ld
-o
kernel.img
-Ttext
0x7e00
--oformat
binary kernel.o
# -m elf_i386
# Sector 1 = bootloader, Sector 2 -
(
512B TO 64K
)
=
kernel
truncate
--size
=
65024 kernel.img
clean
:
rm
*
.o
*
.img
...
...
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