Error compile GDT and Interrupt
Posted: Mon Jul 01, 2019 11:04 am
Good evening all. Now, I am learning OS Development from James Molloy. But I've got problem here.
Error like this
I'm sorry, I don't using cross compiler (You know this is really bad habbit for OSDev). I'm using cygwin in Windows 10 for OSDevelopment. But I need help alot. I want continue this lesson more depth (I still newbie).
code in gdt.s
Interrupt code
Error like this
Code: Select all
ld -mi386pe -nostdlib --nmagic -T linker.ld -o kernel.pe loader.o kernel.o common.o monitor.o descriptor_table.o gdt.o isr.o interrupt.o
descriptor_table.o: In function `init_gdt':
/cygdrive/d/AnantaOS/src/descriptor_table.c:75: undefined reference to `gdt_flush'
interrupt.o:fake:(.text+0x150): undefined reference to `isr_handler'
interrupt.o:fake:(.text+0x6): undefined reference to `isr_common'
interrupt.o:fake:(.text+0x10): undefined reference to `isr_common'
interrupt.o:fake:(.text+0x1a): undefined reference to `isr_common'
interrupt.o:fake:(.text+0x24): undefined reference to `isr_common'
interrupt.o:fake:(.text+0x2e): undefined reference to `isr_common'
interrupt.o:fake:(.text+0x38): more undefined references to `isr_common' follow
make: *** [Makefile:14: kernel.pe] Error 1
code in gdt.s
Code: Select all
.section .text
.align 4
.global gdt_flush
gdt_flush:
mov 4(%esp),%eax
lgdt (%eax)
mov $0x10,%ax
mov %ax,%ds
mov %ax,%es
mov %ax,%fs
mov %ax,%ss
mov %ax,%gs
jmp $0x08, $.flush
.flush:
ret
.global idt_flush
idt_flush:
mov 4(%esp),%eax
lidt (%eax)
ret
Code: Select all
.section .text
.align 4
.macro ISR_NOERR index
.global _isr\index
_isr\index:
cli
push $0
push $\index
jmp isr_common
.endm
.macro ISR_ERR index
.global _isr\index
_isr\index:
cli
push $\index
jmp isr_common
.endm
/* Standard X86 interrupt service routines */
ISR_NOERR 0
ISR_NOERR 1
ISR_NOERR 2
ISR_NOERR 3
ISR_NOERR 4
ISR_NOERR 5
ISR_NOERR 6
ISR_NOERR 7
ISR_ERR 8
ISR_NOERR 9
ISR_ERR 10
ISR_ERR 11
ISR_ERR 12
ISR_ERR 13
ISR_ERR 14
ISR_NOERR 15
ISR_NOERR 16
ISR_NOERR 17
ISR_NOERR 18
ISR_NOERR 19
ISR_NOERR 20
ISR_NOERR 21
ISR_NOERR 22
ISR_NOERR 23
ISR_NOERR 24
ISR_NOERR 25
ISR_NOERR 26
ISR_NOERR 27
ISR_NOERR 28
ISR_NOERR 29
ISR_NOERR 30
ISR_NOERR 31
ISR_NOERR 127
.extern isr_handler
isr_common_stub:
pusha
mov %ds,%ax
push %eax
mov $0x10, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
call isr_handler
pop %eax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
popa
add $8, %esp
iret