Page 1 of 1

Interrupts.s gives various errors

Posted: Fri May 06, 2022 9:02 am
by Mehmetdev1
Hello. The interrupt.S file gives various errors, what is the solution, I am posting the code and screenshot:

Interrupt.s Code:

Code: Select all

.set IRQ_BASE, 0x20
 
.section .text

.extern _ZN16InterruptManager15handleInterruptEhj

.global _ZN16InterruptManager22IgnoreInterruptRequestEv






.macro HandleException num
.global _ZN16InterruptManager16HandleException\num\()Ev
_ZN16InterruptManager16HandleException\num\()Ev:
    movb $\num, (interruptNumber)
    jmp int_bottom
.endm

.macro HandleInterruptRequest num
.global _ZN16InterruptManager26HandleInterruptRequest\num\()Ev
_ZN16InterruptManager26HandleInterruptRequest\num\()Ev:
             movb $\num + IRQ_BASE, (interruptNumber)
             jmp int_bottom
        .endm     



HandleInterruptRequest 0x00
HandleInterruptRequest 0x01




int_bottom:

   pusha
   pushl %ds
   pushl %es
   pushl %fs
   pushl %gs
   
   pushl %esp
   push (interruptNumber)
   call _ZN16InterruptManager15handleInterruptEhj
   # addl $5, %esp
   movl %eax, %esp
   
   popl %gs
   popl %fs
   popl %es
   popl %ds
   popa
   
   
_ZN16InterruptManager22IgnoreInterruptRequestEv:
   
   
   iret
   
   
.data
    .interruptnumber: .byte 0
   

Re: Interrupts.s gives various errors

Posted: Fri May 06, 2022 9:37 am
by iansjack
Again, the error messages are telling you exactly what the problem is. Time to learn x86 assembler programming, and the meaning of the various directives and defines.

Re: Interrupts.s gives various errors

Posted: Fri May 06, 2022 3:10 pm
by davmac314
"interruptnumber" is not declared as a global (via the ".global" directive), and is inconsistently spelled (once as ".interruptnumber", once as "interruptNumber").