C inline assembly question
Posted: Sun Mar 19, 2017 10:47 am
Hi!
I have some trouble with using the inline assembly when writing in c.
I have this code:
However, when I try to compile it I get an error:
Can someone please help me with that?
I have some trouble with using the inline assembly when writing in c.
I have this code:
Code: Select all
void isr0() {
__asm__ (
"pusha\n"
"push gs\n"
"push fs\n"
"push ds\n"
"push es\n"
"call interrupt_0\n"
"pop es\n"
"pop ds\n"
"pop fs\n"
"pop gs\n"
"popa\n"
"iret\n"
);
}
void interrupt_0() {
print("Divide by 0!\n");
asm("cli");
asm("hlt");
}
Code: Select all
kernel.o:kernel.c:(.text+0x2a9): undefined reference to `gs'
kernel.o:kernel.c:(.text+0x2af): undefined reference to `fs'
kernel.o:kernel.c:(.text+0x2b5): undefined reference to `ds'
kernel.o:kernel.c:(.text+0x2bb): undefined reference to `es'
kernel.o:kernel.c:(.text+0x2c0): undefined reference to `interrupt_0'
kernel.o:kernel.c:(.text+0x2c6): undefined reference to `es'
kernel.o:kernel.c:(.text+0x2cc): undefined reference to `ds'
kernel.o:kernel.c:(.text+0x2d2): undefined reference to `fs'
kernel.o:kernel.c:(.text+0x2d8): undefined reference to `gs'