Skip to content
Snippets Groups Projects
Commit 7bd211cb authored by Bensong Liu's avatar Bensong Liu
Browse files

64bit kernel working

parent fb3c98b5
No related branches found
No related tags found
1 merge request!2X64 MBR mode done.
...@@ -70,7 +70,7 @@ _load_kern: ...@@ -70,7 +70,7 @@ _load_kern:
disk_io_error: disk_io_error:
mov bx, _motd_disk_error mov bx, _motd_disk_error
call println_bios call println_bios
jmp _stall jmp $
...@@ -121,7 +121,7 @@ _call_kern_32: ...@@ -121,7 +121,7 @@ _call_kern_32:
; Kernel returns. ; Kernel returns.
mov ebx, _motd_endk mov ebx, _motd_endk
call println_vga call println_vga
jmp _stall jmp $
[bits 64] [bits 64]
_call_kern_64: _call_kern_64:
...@@ -129,15 +129,12 @@ _call_kern_64: ...@@ -129,15 +129,12 @@ _call_kern_64:
call KERN_ADDR call KERN_ADDR
; Kernel returns. ; Kernel returns.
mov ebx, _motd_endk ;mov ebx, _motd_endk
call println_vga ;call println_vga
jmp _stall ; TODO: add 64bit println_vga and error msg
[bits 32]
_stall:
jmp $ jmp $
_motd_disk_error: _motd_disk_error:
db 'MED', 0x0 db 'MED', 0x0
_motd_32: _motd_32:
......
...@@ -16,11 +16,11 @@ assemble: kernel head ...@@ -16,11 +16,11 @@ assemble: kernel head
truncate --size=65024 kernel.img truncate --size=65024 kernel.img
head: head:
nasm -f elf -DBITS=$(BITS) image_head.asm -o image_head.o nasm -f elf$(BITS) -DTARGET_BITS=$(BITS) image_head.asm -o image_head.o
kernel: kernel:
g++ -ffreestanding -fno-pie -c kernel.cc -o kernel.o -m$(BITS) -std=c++17 g++ -ffreestanding -fno-pie -c kernel.cc -o kernel.o -m$(BITS) -std=c++17
clean: clean:
rm *.o *.img rm -f *.o *.img
[bits 32] [bits TARGET_BITS]
[extern main] [extern main]
call main call main
ret ret
[bits 64]
[extern main]
call main
ret
...@@ -12,7 +12,6 @@ constexpr uint16_t VGA_MAKE_CHAR(char c, uint8_t color) { ...@@ -12,7 +12,6 @@ constexpr uint16_t VGA_MAKE_CHAR(char c, uint8_t color) {
} }
constexpr uint8_t default_color = 0x0f; constexpr uint8_t default_color = 0x0f;
inline void trigger_scroll(uint16_t *pos) { inline void trigger_scroll(uint16_t *pos) {
for(uint16_t row = 1; row < VGA_HEIGHT; ++row) { for(uint16_t row = 1; row < VGA_HEIGHT; ++row) {
memcpy(VGA_BEGIN_ADDR + (row-1)*VGA_WIDTH, VGA_BEGIN_ADDR + row*VGA_WIDTH, VGA_WIDTH); memcpy(VGA_BEGIN_ADDR + (row-1)*VGA_WIDTH, VGA_BEGIN_ADDR + row*VGA_WIDTH, VGA_WIDTH);
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
for(auto x = 0; x < 80; ++x) { for(auto x = 0; x < 80; ++x) {
char c = x%10 + '0'; char c = x%10 + '0';
char color = x + y*80; char color = x + y*80;
set_char(x, y, ' ', 0x0f); set_char(x, y, 'F', 0x0f);
} }
} }
print("Hello world!\n"); print("Hello world!\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment