[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
- [PATCH v2 0/6] Add initial support for booting x86_64 from grub, Luca Dariz, 2022/02/05
- [PATCH 3/6] fix register corruption in irq on qemu,
Luca Dariz <=
- [PATCH 4/6] fix console setting from cmdline, Luca Dariz, 2022/02/05
- [PATCH 1/6] add support for booting from grub with x86_64, Luca Dariz, 2022/02/05
- [PATCH 2/6] cleanup multiboot, Luca Dariz, 2022/02/05
- [PATCH 6/6] fix Task State Segment layout for 64 bit, Luca Dariz, 2022/02/05
- [PATCH 5/6] enable user access, Luca Dariz, 2022/02/05