Fix kernel entrypoint
This commit is contained in:
parent
37f8c7d1ae
commit
2d42ee3202
2 changed files with 22 additions and 8 deletions
|
@ -1,22 +1,31 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::{arch::asm, panic::PanicInfo};
|
||||
use core::{
|
||||
arch::{asm, global_asm},
|
||||
panic::PanicInfo,
|
||||
};
|
||||
|
||||
use gdt::setup_gdt;
|
||||
use log::{error, info};
|
||||
|
||||
mod gdt;
|
||||
|
||||
static mut STACK: [u8; 8 * 1024] = [0; 8 * 1024];
|
||||
global_asm!(
|
||||
"
|
||||
.global _start
|
||||
_start:
|
||||
mov $stack, %rsp
|
||||
call main
|
||||
.section .bss
|
||||
.align 16
|
||||
.skip 0x2000
|
||||
stack:
|
||||
",
|
||||
options(att_syntax)
|
||||
);
|
||||
|
||||
#[no_mangle]
|
||||
fn _start() -> ! {
|
||||
unsafe {
|
||||
asm!("mov rsp, {}", in(reg) STACK.as_ptr().add(STACK.len()));
|
||||
}
|
||||
main();
|
||||
}
|
||||
fn main() -> ! {
|
||||
com_logger::init();
|
||||
info!("Starting kernel...");
|
||||
|
|
5
qemu.sh
Executable file
5
qemu.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC2068
|
||||
set -e
|
||||
./build.sh
|
||||
qemu-system-x86_64 -M q35 -m 256M -L /usr/share/OVMF -bios OVMF_CODE.fd -drive file=img/os.img,format=raw $@
|
Loading…
Add table
Reference in a new issue