Still many thanks for the help
So:
- No error or warning during compilation
- Since today I'm using bochs
- Here is my budilding script (full/written by me):
Code: Select all
#!/bin/sh
build=Build
compiler=i586-elf-gcc
linker=i586-elf-ld
opt="-Wall -O -fstrength-reduce -fomit-frame-pointer -nostdinc -fno-builtin -I./Include -c -fno-strict-aliasing -fno-common -fno-stack-protector"
isodir=A_isodir
isoname=OS.iso
echo "Setting Path..."
echo "==========="
export PATH="/opt/cross/bin:$PATH"
echo "Removing Old Files..."
echo "==========="
rm -r ./Build/*
rm kernel.bin
rm $isoname
rm ./A_isodir/boot/kernel.bin
echo "Building..."
echo "==========="
# Build C files
$compiler $opt -o $build/main.o ./Kernel/main.c
$compiler $opt -o $build/string.o ./Lib/string.c
$compiler $opt -o $build/stdio.o ./Lib/stdio.c
$compiler $opt -o $build/DebugDisplay.o ./Kernel/DebugDisplay.c
$compiler $opt -o $build/stdint.o ./Include/stdint.c
$compiler $opt -o $build/Hal.o ./Hal/Hal.c
$compiler $opt -o $build/cpu.o ./Hal/cpu.c
$compiler $opt -o $build/gdt.o ./Hal/gdt.c
$compiler $opt -o $build/idt.o ./Hal/idt.c
$compiler $opt -o $build/pic.o ./Hal/pic.c
$compiler $opt -o $build/pit.o ./Hal/pit.c
$compiler $opt -o $build/exception.o ./Kernel/exception.c
$compiler $opt -o $build/panic.o ./Kernel/panic.c
# Build ASM files
nasm -f elf ./Kernel/bootstrap.asm -o $build/bootstrap.o
nasm -f elf ./Hal/i86_pit_irq.asm -o $build/i86_pit_irq.o
# Link
$linker -T linker.ld $build/*.o
# Copy the kernel to iso building dir and create our ISO file
cp kernel.bin $isodir/boot
grub-mkrescue -o $isoname $isodir
# Launch our OS on qemu or bochs
#qemu-system-i386 -cdrom $isoname
bochs
Code: Select all
global i86_pit_irq
align 4
extern i86_pit_irq_c
i86_pit_irq:
pusha
call i86_pit_irq_c
popa
iret
Code: Select all
void i86_pit_irq_c(void){
_pit_ticks++;
interruptdone(0);
}
Code: Select all
void i86_pit_initialize(){
setvect(32,i86_pit_irq);
_pit_isinit = 1;
}
Code: Select all
00017845491i[BIOS ] Booting from 07c0:0000
00025688379i[PIT81] Changing GATE 2 to: 0
00025688390i[PIT81] Changing GATE 2 to: 1
00025908095i[PIT81] Changing GATE 2 to: 0
00083333320e[CPU0 ] check_cs(0x0010): not a valid code segment !
Sorry for the so long post, but I'm tring to give as much informations as I can so you can try to help me.
In case, I can upload the full source on github
EDIT: oh I forgot to say that I've to remove those underscore from asm because I can't compile the source with them !
EDIT2: Oh, also bochs instead of giving me default handler error, it give me kernel panic stop 13 (general protection fault)