I guess it barely prints a thing
This commit is contained in:
commit
f30433dd27
5 changed files with 79 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.elf
|
||||
*.o
|
13
Makefile
Normal file
13
Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
all: kernel-i386.elf
|
||||
clean:
|
||||
rm *.o *.elf
|
||||
|
||||
start32.o: start32.asm
|
||||
fasm start32.asm
|
||||
kernel.o: kernel.c
|
||||
../tinycc/tcc -m32 -c kernel.c
|
||||
kernel-i386.elf: kernel.o start32.o
|
||||
../tinycc/tcc -m32 -nostdlib -Wl,-Ttext,0x100000 start32.o kernel.o -o kernel-i386.elf
|
||||
|
||||
qemu: kernel-i386.elf
|
||||
qemu-system-i386 -kernel kernel-i386.elf
|
9
README.md
Normal file
9
README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# KoalemOS
|
||||
Multiboot compatible stupid useless OS-like project.
|
||||
## Compatibility
|
||||
32bit x86 legacy BIOS system
|
||||
## Building
|
||||
FASM and TinyCCompiler are used.
|
||||
TCC might need manual compilation for 32bit crosscompilation
|
||||
on 64bit systems.
|
||||
Just download the source and `make cross` or something.
|
12
kernel.c
Normal file
12
kernel.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
void kmain (void) {
|
||||
*((unsigned char *) 0xB8000) = 'H';
|
||||
*((unsigned char *) 0xB8001) = 0x1F;
|
||||
*((unsigned char *) 0xB8002) = 'E';
|
||||
*((unsigned char *) 0xB8003) = 0x1F;
|
||||
*((unsigned char *) 0xB8004) = 'L';
|
||||
*((unsigned char *) 0xB8005) = 0x1F;
|
||||
*((unsigned char *) 0xB8006) = 'L';
|
||||
*((unsigned char *) 0xB8007) = 0x1F;
|
||||
*((unsigned char *) 0xB8008) = 'O';
|
||||
*((unsigned char *) 0xB8009) = 0x1F;
|
||||
}
|
43
start32.asm
Normal file
43
start32.asm
Normal file
|
@ -0,0 +1,43 @@
|
|||
; Tutorial: A small kernel with Fasm & TCC
|
||||
; By Tommy.
|
||||
|
||||
format elf
|
||||
use32
|
||||
|
||||
;
|
||||
; Equates
|
||||
;
|
||||
MULTIBOOT_PAGE_ALIGN equ (1 shl 0)
|
||||
MULTIBOOT_MEMORY_INFO equ (1 shl 1)
|
||||
MULTIBOOT_AOUT_KLUDGE equ (1 shl 16)
|
||||
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
|
||||
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO
|
||||
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
|
||||
|
||||
|
||||
;
|
||||
; Multiboot header
|
||||
;
|
||||
.multiboot: align 4
|
||||
dd MULTIBOOT_HEADER_MAGIC
|
||||
dd MULTIBOOT_HEADER_FLAGS
|
||||
dd MULTIBOOT_CHECKSUM
|
||||
|
||||
|
||||
section '.bss' writable align 16
|
||||
stack_bottom:
|
||||
rb 16384
|
||||
stack_top:
|
||||
|
||||
section '.text' executable
|
||||
;
|
||||
; Kernel entry point.
|
||||
;
|
||||
public _start
|
||||
extrn kmain
|
||||
_start:
|
||||
; Call the main kernel function.
|
||||
call kmain
|
||||
|
||||
@@:
|
||||
jmp @b
|
Loading…
Reference in a new issue