Hi All,
I have the following code, and I need to make some changes so save is called inline. Any idea?
Thanks
I have the following code, and I need to make some changes so save is called inline. Any idea?
Thanks
call save
push (_irq_handlers+4*irq)
call _intr_handle
pop ecx
cmp (_irq_actids+4*irq), 0
jz 0f
inb INT_CTLMASK
orb al, [1<<irq]
outb INT_CTLMASK
0: movb al, END_OF_INT
outb INT_CTL
ret
it's seem you want to make a macro :D
it is a macro, hHere is the complete code. hwint_master needs to call save inline
below is the code for save
#define hwint_master(irq) \
call save /* save interrupted process state */;\
push (_irq_handlers+4*irq) /* irq_handlers */;\
call _intr_handle /* intr_handle(irq_handlers) */;\
pop ecx ;\
cmp (_irq_actids+4*irq), 0 /* interrupt still active? */;\
jz 0f ;\
inb INT_CTLMASK /* get current mask */ ;\
orb al, [1<<irq] /* mask irq */ ;\
outb INT_CTLMASK /* disable the irq */;\
0: movb al, END_OF_INT ;\
outb INT_CTL /* reenable master 8259 */;\
ret
below is the code for save
.align 16
save:
cld ! set direction flag to a known value
pushad ! save "general" registers
o16 push ds ! save ds
o16 push es ! save es
o16 push fs ! save fs
o16 push gs ! save gs
mov dx, ss ! ss is kernel data segment
mov ds, dx ! load rest of kernel segments
mov es, dx ! kernel does not use fs, gs
mov eax, esp ! prepare to return
incb (_k_reenter) ! from -1 if not reentering
jnz set_restart1 ! stack is already kernel stack
mov esp, k_stktop
push _restart ! build return address for int handler
xor ebp, ebp ! for stacktrace
jmp RETADR-P_STACKBASE(eax)
.align 4
set_restart1:
push restart1
jmp RETADR-P_STACKBASE(eax)
I believe what secmask tried to say is that you want to make the save routine a macro as well - assemblers generally don't do automatic inlining of functions, that's a HLL compiler's job.
Thats the Rule, not the Exception - OA32 supports inline methods - and yes, they are.