I have a problem with my bootloader, when I call a function to write a screen-> printString, the function don't launch. I don't know why. The code is:
/*generate 16-bit code*/
__asm__(".code16gcc\n");
/*jump boot code entry*/
__asm__("jmpl $0x0000, $main\n");
void printString(char *);
/* user defined function to print series of characters terminated by null character */
void main() {
/* calling the printString function passing string as an argument */
printString("Hello, World");
while(1);
}
void printString(char *string) {
__asm__ __volatile__("movb $'H' , %al\n");
__asm__ __volatile__("movb $0x0e, %ah\n");
__asm__ __volatile__("int $0x10\n");
while(*string) {
__asm__ __volatile__ (
"int $0x10" : : "a"(0x0e00 | *string)
);
string++;
}
}
The linkable file, ld is:
ENTRY(main);
SECTIONS
{
. = 0x7C00;
.text : AT(0x7C00)
{
*(.text);
}
.sig : AT(0x7DFE)
{
SHORT(0xaa55);
}
}
The makefile is:
bash -c "gcc -c -g -Os -march=i686 -m16 -ffreestanding -Wall -Werror ../project/kernel/bootloader/boot.c -o boot.o"
bash -c "ld -static -melf_i386 -Ttest.ld -nostdlib --nmagic -o boot.elf boot.o"
bash -c "objcopy -O binary boot.elf boot.bin"
I wonder that the function launch