__asm__(".code16gcc\n");
__asm__("jmp _start\n");
int extern __attribute__((noinline)) __attribute__((regparm(3))) sprintf(char * buf, const char *fmt, ...)
{
__asm__ __volatile__ ("int 0x10" : : "a" (0x0E00 | *fmt), "b"(144));
}
void __attribute__((noreturn)) _start()
{
char buf[128];
sprintf(buf, "Sasha%d", 123);
while(1);
} But if substitute '...' by 'int x' in args list, in Qemu 'S' symbol will be outputed.
There is the finish bootloader's fragment:
mov ax, SETUP_ADDR>>4 ; SETUP_SEG mov es, ax mov ds, ax mov cs, ax mov ss, ax mov sp, StackSeg ; at the end, after aidding bytes to 512 jmp SETUP_ADDR>>4:0and compilation script:
#!/bin/bash gcc -c -Wall -save-temps -march=i386 -ffreestanding -Wno-main -fno-builtin -masm=intel -O0 -o kernel.o kernel.c ld -nostdlib -static -Ttext 0 --oformat binary -o kernel.bin kernel.o nasm boot.asm -o boot.bsrand pure source.
Thanx and sorry, my English isn't so good :)


Sign In
Create Account

Back to top










