From 0057604ad214808f70bcbe5943801e1f4e9cee9a Mon Sep 17 00:00:00 2001 From: wuyangyong Date: Wed, 10 Oct 2012 16:39:49 +0000 Subject: [PATCH] update hdisr_gcc.S: push argument for ISR. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2341 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- libcpu/ia32/hdisr_gcc.S | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/libcpu/ia32/hdisr_gcc.S b/libcpu/ia32/hdisr_gcc.S index 60a3e1b70f..cc622ff52c 100644 --- a/libcpu/ia32/hdisr_gcc.S +++ b/libcpu/ia32/hdisr_gcc.S @@ -28,7 +28,7 @@ jmp _hdinterrupts;\ .data;\ .long name;\ - .text + .text .globl hdinterrupt_func .data @@ -59,7 +59,7 @@ HDINTERRUPTFNC(irq15, 15) .globl _hdinterrupts .type _hdinterrupts,@function .globl rt_interrupt_enter -.globl rt_interrupt_leave +.globl rt_interrupt_leave .globl isr_table .globl rt_thread_switch_interrupt_flag .globl rt_interrupt_from_thread @@ -73,14 +73,20 @@ _hdinterrupts: movw %ax, %ds movw %ax, %es pushl %esp + call rt_interrupt_enter - movl %esp, %eax /* get irqno */ - addl $0x2c, %eax - movl (%eax), %eax /* each item takes up 4bytes in isr_table,equl to isr_table[irqno] */ - shll $0x2, %eax - movl $isr_table, %ebx - addl %eax,%ebx + + movl %esp, %eax /* copy esp to eax */ + addl $0x2c, %eax /* move to vector address */ + movl (%eax), %eax /* vector(eax) = *eax */ + + pushl %eax /* push argument : int vector */ + shll $0x2, %eax /* each item takes up 4bytes in isr_table. */ + movl $isr_table, %ebx /* ebx = &isr_table[0] */ + addl %eax, %ebx /* eax = &isr_table[vector] */ call *(%ebx) + add $4, %esp /* restore argument */ + call rt_interrupt_leave /* if rt_thread_switch_interrupt_flag set, jump to _interrupt_thread_switch and don't return */ @@ -88,7 +94,7 @@ _hdinterrupts: movl (%eax), %ebx cmp $0x1, %ebx jz _interrupt_thread_switch - + popl %esp popal pop %es @@ -98,7 +104,7 @@ _hdinterrupts: _interrupt_thread_switch: popl %esp - + movl $0x0, %ebx movl %ebx, (%eax) @@ -109,7 +115,7 @@ _interrupt_thread_switch: movl $rt_interrupt_to_thread, %ecx movl (%ecx), %edx movl (%edx), %esp - + popal pop %es pop %ds