bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/6] fix register corruption in irq on qemu


From: Luca Dariz
Subject: [PATCH 3/6] fix register corruption in irq on qemu
Date: Sat, 5 Feb 2022 18:51:26 +0100

rbx was used to compute the irq index in iunit and ivect arrays,
however it should be preserved by pushing it in to the stack.  As a
solution, we use rax instead, that is preserved across function calls
and is not used as a function argument.

Signed-off-by: Luca Dariz <luca@orpolo.org>
---
 x86_64/interrupt.S | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/x86_64/interrupt.S b/x86_64/interrupt.S
index fccf6e28..73151b06 100644
--- a/x86_64/interrupt.S
+++ b/x86_64/interrupt.S
@@ -38,15 +38,15 @@ ENTRY(interrupt)
        pushq   %rax                    /* save irq number */
        call    spl7                    /* set ipl */
        pushq   %rax                    /* save previous ipl */
-       movl    8(%esp),%edx            /* set irq number as 3rd arg */
-       movl    %edx,%ebx               /* copy irq number */
-       shll    $2,%ebx                 /* irq * 4 */
-       movl    EXT(iunit)(%ebx),%edi   /* get device unit number as 1st arg */
        movl    %eax, %esi              /* previous ipl as 2nd arg */
+       movl    8(%esp),%edx            /* set irq number as 3rd arg */
+       movl    %edx,%eax               /* copy irq number */
+       shll    $2,%eax                 /* irq * 4 */
+       movl    EXT(iunit)(%eax),%edi   /* get device unit number as 1st arg */
        movq    16(%esp), %rcx          /* return address as 4th arg */
        movq    24(%esp), %r8           /* address of interrupted registers as 
5th arg */
-       shll    $1,%ebx                 /* irq * 8 */
-       call    *EXT(ivect)(%ebx)       /* call interrupt handler */
+       shll    $1,%eax                 /* irq * 8 */
+       call    *EXT(ivect)(%eax)       /* call interrupt handler */
        popq    %rdi                    /* restore previous ipl */
        call    splx_cli                /* restore previous ipl */
 
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]