Compare commits
4 Commits
f341a50b78
...
3da2af2d2d
| Author | SHA1 | Date | |
|---|---|---|---|
| 3da2af2d2d | |||
| 75d77e92e1 | |||
| 8e6c823a00 | |||
| fca8a5d573 |
2
Makefile
2
Makefile
@@ -108,7 +108,7 @@ imgz: $(IMGZ)
|
|||||||
# Helpers
|
# Helpers
|
||||||
|
|
||||||
run: $(IMG)
|
run: $(IMG)
|
||||||
@$(QEMU) $(QEMU_OPTS) -drive file=$(IMG),if=ide,index=0,media=disk,format=raw \
|
@$(QEMU) $(QEMU_ARGS) -drive file=$(IMG),if=ide,index=0,media=disk,format=raw \
|
||||||
|
|
||||||
run_bochs: $(IMG)
|
run_bochs: $(IMG)
|
||||||
@bochs -q
|
@bochs -q
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Stevia Bootloader
|
# Stevia Bootloader
|
||||||
|
|
||||||
Stevia is a lightweight, hobby bootloader written in Assembly and C, designed for educational purposes. It targets 686+ and aims to be simple, approachable, and understandable, focusing on minimalism and core functionality.
|
Stevia is a lightweight, hobby bootloader written in Assembly (NASM) and is designed for educational purposes. It targets 686+ and aims to be simple, approachable, and understandable, focusing on minimalism and core functionality.
|
||||||
|
|
||||||
|
Please note: **Most development currently takes place in Bochs (and maybe is tested on QEMU), due to this, the code in this repo has not been tested throughly aginist real hardware. As with most projects of this nature, there is a risk of damage due to improper programing of hardware, while careful effort is taken to not break the computer...accidents and mistakes can/do happen.**
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -56,6 +58,8 @@ To build and run Stevia, you will need the following tools installed on your sys
|
|||||||
|
|
||||||
Stevia is intended to be a learning tool for those interested in low-level programming, focusing on understanding the basics of how a computer starts up and manages early system resources.
|
Stevia is intended to be a learning tool for those interested in low-level programming, focusing on understanding the basics of how a computer starts up and manages early system resources.
|
||||||
|
|
||||||
|
You are welcome to fork/review the code base but I am generally not accepting PR's/Contributions to the code at this time.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the GPLv3 License. See the [LICENSE](LICENSE.md) or [COPYING](COPYING) file for more details.
|
This project is licensed under the GPLv3 License. See the [LICENSE](LICENSE.md) or [COPYING](COPYING) file for more details.
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
; __CDECL16_PROC_ARGS nargs
|
; __CDECL16_PROC_ARGS nargs
|
||||||
; Creates %$arg1 .. %$argN as [bp+4], [bp+6], ...
|
; Creates %$arg1 .. %$argN as [bp+4], [bp+6], ...
|
||||||
; for use inside of function bodies
|
; for use inside of function bodies
|
||||||
|
; BUG: still needs to be tested
|
||||||
%ifnmacro __CDECL16_PROC_ARGS
|
%ifnmacro __CDECL16_PROC_ARGS
|
||||||
%macro __CDECL16_PROC_ARGS 1
|
%macro __CDECL16_PROC_ARGS 1
|
||||||
%push __CDECL16_PROC_ARGS
|
%push __CDECL16_PROC_ARGS
|
||||||
@@ -78,6 +79,7 @@
|
|||||||
; __CDECL16_CALL_ARGS_SIZED func, size1[, size2 ...] ; sizes in BYTES
|
; __CDECL16_CALL_ARGS_SIZED func, size1[, size2 ...] ; sizes in BYTES
|
||||||
; if you *need* to pass dword sized args in 16-bit mode, use this to properly
|
; if you *need* to pass dword sized args in 16-bit mode, use this to properly
|
||||||
; count the stack frame to restore later!
|
; count the stack frame to restore later!
|
||||||
|
; BUG: still needs to be tested
|
||||||
%ifnmacro __CDECL16_CALL_ARGS_SIZED
|
%ifnmacro __CDECL16_CALL_ARGS_SIZED
|
||||||
%macro __CDECL16_CALL_ARGS_SIZED 2-*
|
%macro __CDECL16_CALL_ARGS_SIZED 2-*
|
||||||
%push __CDECL16_CALL_ARGS_SIZED
|
%push __CDECL16_CALL_ARGS_SIZED
|
||||||
@@ -124,13 +126,21 @@
|
|||||||
%endmacro
|
%endmacro
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
;
|
||||||
|
; Only setup the minimum stack frame
|
||||||
|
; unlike the above, everything is caller save
|
||||||
|
;
|
||||||
%ifnmacro __FASTCALL16_ENTRY
|
%ifnmacro __FASTCALL16_ENTRY
|
||||||
%macro __FASTCALL16_ENTRY 0
|
%macro __FASTCALL16_ENTRY 0-1
|
||||||
push bp
|
push bp
|
||||||
mov bp, sp
|
mov bp, sp
|
||||||
|
%if %0 = 1
|
||||||
|
sub sp, %1 ; reserve locals only when needed
|
||||||
|
%endif
|
||||||
%endmacro
|
%endmacro
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
; restore minimum stack frame, all regs are caller save
|
||||||
%ifnmacro __FASTCALL16_EXIT
|
%ifnmacro __FASTCALL16_EXIT
|
||||||
%macro __FASTCALL16_EXIT 0
|
%macro __FASTCALL16_EXIT 0
|
||||||
mov sp, bp
|
mov sp, bp
|
||||||
|
|||||||
@@ -146,9 +146,9 @@ main:
|
|||||||
call kmemcpy ; copy partition table to bss
|
call kmemcpy ; copy partition table to bss
|
||||||
add sp, 0x6
|
add sp, 0x6
|
||||||
|
|
||||||
mov si, word [bp - 4]
|
mov si, word [bp - 4] ; partition_offset address
|
||||||
mov dl, byte [bp - 2]
|
mov dl, byte [bp - 2] ; pass drive # from BIOS to VBR in dl
|
||||||
mov bx, partition_table
|
mov bx, partition_table ; partition_table address
|
||||||
jmp word 0x0000:VBR_ENTRY
|
jmp word 0x0000:VBR_ENTRY
|
||||||
|
|
||||||
; ###############
|
; ###############
|
||||||
|
|||||||
Reference in New Issue
Block a user