diff options
author | Luca Dariz <luca.dariz@gmail.com> | 2022-02-05 18:51:26 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-27 21:03:18 +0200 |
commit | 19670a6df24b18a05a542ae932d8c44ed97c7c71 (patch) | |
tree | b0fe129bf086917b959ed611823825ef51bcb0b0 | |
parent | 6c3c3c7a2e633e4dedd1701e6e2134f223b38574 (diff) | |
download | gnumach-19670a6df24b18a05a542ae932d8c44ed97c7c71.tar.gz gnumach-19670a6df24b18a05a542ae932d8c44ed97c7c71.tar.bz2 gnumach-19670a6df24b18a05a542ae932d8c44ed97c7c71.zip |
fix register corruption in irq on qemu
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, which is caller-saved.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-4-luca@orpolo.org>
-rw-r--r-- | x86_64/interrupt.S | 12 |
1 files 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 */ |