optimized isr.asm a bit
git-svn-id: svn://anubis/hos/trunk@64 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
parent
339eef5976
commit
1105e6e203
@ -2,6 +2,7 @@
|
|||||||
; C ISR routine
|
; C ISR routine
|
||||||
[extern isr]
|
[extern isr]
|
||||||
|
|
||||||
|
|
||||||
; Macro for creating a single ISR label
|
; Macro for creating a single ISR label
|
||||||
; We need to push a junk value on the stack first
|
; We need to push a junk value on the stack first
|
||||||
; if the interrupt number is not 8 or 10-14.
|
; if the interrupt number is not 8 or 10-14.
|
||||||
@ -13,49 +14,44 @@ isr_%1:
|
|||||||
%if ( (%1 != 8) && (%1 < 10 || %1 > 14) )
|
%if ( (%1 != 8) && (%1 < 10 || %1 > 14) )
|
||||||
push eax ; junk value to take error code stack space
|
push eax ; junk value to take error code stack space
|
||||||
%endif
|
%endif
|
||||||
push eax
|
pusha ; eax, ecx, edx, ebx, esp, ebp, esi, edi
|
||||||
mov al, %1 ; save interrupt number in al
|
mov al, %1 ; save interrupt number in al
|
||||||
jmp isr_common
|
%if ($ - isr_common) < 127 ; do a short jump and save 3 bytes if we can
|
||||||
|
jmp short isr_common
|
||||||
|
%else
|
||||||
|
jmp isr_common
|
||||||
|
%endif
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
; Loop to create all of our ISR labels
|
|
||||||
|
; The common ISR routine
|
||||||
|
isr_common:
|
||||||
|
push ds
|
||||||
|
push es
|
||||||
|
push fs
|
||||||
|
push gs
|
||||||
|
|
||||||
|
push esp ; pointer to interrupt stack
|
||||||
|
push eax ; interrupt number
|
||||||
|
; TODO: uncomment when isr() is defined so the build won't break
|
||||||
|
; call isr
|
||||||
|
pop eax ; restore stack pointer (this is shorter
|
||||||
|
pop eax ; than "add esp, 8" and "lea esp, [esp+8]")
|
||||||
|
|
||||||
|
pop gs
|
||||||
|
pop fs
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
popa ; edi, esi, ebp, <null>, ebx, edx, ecx, eax
|
||||||
|
lea esp, [esp+4]
|
||||||
|
|
||||||
|
iret
|
||||||
|
|
||||||
|
|
||||||
|
; Loop to create all of our ISR entry points
|
||||||
%assign i 0
|
%assign i 0
|
||||||
%rep 50
|
%rep 50
|
||||||
isr_label i
|
isr_label i
|
||||||
%assign i i+1
|
%assign i i+1
|
||||||
%endrep
|
%endrep
|
||||||
|
|
||||||
; The common ISR routine
|
|
||||||
isr_common:
|
|
||||||
push ebx
|
|
||||||
push ecx
|
|
||||||
push edx
|
|
||||||
push edi
|
|
||||||
push esi
|
|
||||||
push ebp
|
|
||||||
push ds
|
|
||||||
push es
|
|
||||||
push fs
|
|
||||||
push gs
|
|
||||||
|
|
||||||
push esp
|
|
||||||
push eax
|
|
||||||
; TODO: currently commented since there is no isr()
|
|
||||||
; so the build will not break
|
|
||||||
; call isr
|
|
||||||
add esp, 8
|
|
||||||
|
|
||||||
pop gs
|
|
||||||
pop fs
|
|
||||||
pop es
|
|
||||||
pop ds
|
|
||||||
pop ebp
|
|
||||||
pop esi
|
|
||||||
pop edi
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax ; error code can be ignored now
|
|
||||||
pop eax
|
|
||||||
|
|
||||||
iret
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user