I made a tutorial: http://www.henkessoft.de/OS_Dev/OS_Dev1 ... ocId652294
I can assemble, compile and link the files and boot the os with qemu,
but when i want to load the c-kernel (call main), the system will hang in the protected mode.
the quellcode and the image are attached as *.zip file.
the linkscript
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(RealMode)
SECTIONS
{
.text 0x8000 : {
*(.text)
*(.rodata*)
}
.data : {
*(.data)
}
.bss : {
*(.bss)
}
}
(I use 64bit kubuntu 11.10)
Code: Select all
nasm -f bin boot.asm -o boot1.bin
nasm -f elf32 kernel.asm -o kernel1.o
gcc -c -m32 ckernel.c -o ckernel1.o
ld -m elf_i386 -T kernel.ld kernel1.o ckernel1.o
cat boot.bin a.out > testOs.img
qemu -d out_asm -fda testOs.img
but why i cant call a extern function? what i made wrong?
Edit:
the last entries in the qemu logfile:
Code: Select all
0x411b4a4f: mov %r13d,0x20(%r14)
0x411b4a53: mov $0x6,%edi
0x411b4a58: mov $0x6,%r13d
0x411b4a5e: mov %r13d,0x30(%r14)
0x411b4a62: mov %ebp,0x28(%r14)
0x411b4a66: mov %r12d,0x2c(%r14)
0x411b4a6a: mov %ebx,0x8(%r14)
0x411b4a6e: mov $0x7f9cee123160,%r10
0x411b4a78: callq *%r10
thanks in advance.