Skip to content
Snippets Groups Projects
Commit 1036cac9 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

reorder dir

parent 23771ca8
No related branches found
No related tags found
No related merge requests found
build: bootloader:
cc -c boot.c -o boot.o -m32 $(MAKE) -C bootloader
ld -o boot.img -Ttext 0x0 --oformat binary boot.o -m elf_i386
# objcopy -O binary boot.o boot.img
# [[ $$(stat boot.img --printf='%s') -lt 510 ]]
truncate --size=510 boot.img
printf '\x55\xAA' >> boot.img
run: build kernel:
qemu-system-x86_64 boot.img $(MAKE) -C kernel
build: bootloader kernel
assemble: build
cat bootloader/boot.img kernel/kernel.img > disk.img
run: assemble
qemu-system-x86_64 disk.img
clean:
rm *.o
void main();
void __entry() {
main();
}
void print_char(char to_print) {
asm inline (
"mov $0x0e, %%ah\n\t"
"mov %0, %%al\n\t"
"int $0x10"
:
: "Ir" (to_print)
: "ax"
);
}
void println(char *s) {
while(*s != 0) {
print_char(*s);
}
}
void main() {
asm (
"mov $0x0e, %ah\n\t"
"mov $0x55, %al\n\t"
"int $0x10"
);
//print_char('X');
//println("Hello world!");
//println("Recolic Booting OS HERE...");
asm (
"jmp 0x-2\n\t"
);
}
File moved
...@@ -58,18 +58,17 @@ _prot_begin: ...@@ -58,18 +58,17 @@ _prot_begin:
mov ebp, 0x90000 ; 600KB free space here, until 0x7c00 + 0x200 byte (MBR sector 0) mov ebp, 0x90000 ; 600KB free space here, until 0x7c00 + 0x200 byte (MBR sector 0)
mov esp, ebp mov esp, ebp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 32BIT PROTECTED MODE BEGIN ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 32BIT PROTECTED MODE BEGIN ;;;;;;;;;;;;;;;;;;;;;;;;;;
_dead_loop:
mov ebx, _motd_32 mov ebx, _motd_32
call println_vga call println_vga
mov ebx, _motd_32p
call println_vga KERN_ADDR equ 0x1000
jmp _dead_loop
jmp $
_motd_32: _motd_32:
db '----- CPU is in INTEL x86 protected mode now -----', 0x0 db '[ENTER X86 MODE SUCC] [LOADING KERN..]', 0x0
_motd_32p: _motd_endk:
db '+++++ CPU is in INTEL x86 protected mode now +++++', 0x0 db '[ENTER X86 MODE SUCC] [LOADING KERN..] [KERN EXITED]', 0x0
%include "./mbr_end.inc" %include "./mbr_end.inc"
......
File moved
File moved
File moved
File moved
kernel:
gcc -ffreestanding -c kernel.c -o kernel.o # -m32
ld -o kernel.img -Ttext 0x1000 --oformat binary kernel.o # -m elf_i386
clean:
rm *.o *.img
void main() {
char *vga_begin = (char *)0xb8000;
*vga_begin = 'X';
}
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