[PATCH unit-tests 12/16] Fix exception handling on i386 arch.

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

 



Pass parameter to exception handler in correct register.

Signed-off-by: Gleb Natapov <gleb@xxxxxxxxxx>
---
 lib/x86/desc.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index 2f73a5a..aa0b4f4 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -111,6 +111,9 @@ struct ex_record {
 
 extern struct ex_record exception_table_start, exception_table_end;
 
+#ifndef __x86_64__
+__attribute__((regparm(1)))
+#endif
 void do_handle_exception(struct ex_regs *regs)
 {
     struct ex_record *ex;
@@ -162,7 +165,11 @@ asm (".pushsection .text \n\t"
 #endif
      "push %"R"di; push %"R"si; push %"R"bp; sub $"S", %"R"sp \n\t"
      "push %"R"bx; push %"R"dx; push %"R"cx; push %"R"ax \n\t"
+#ifdef __x86_64__
      "mov %"R"sp, %"R"di \n\t"
+#else
+     "mov %"R"sp, %"R"ax \n\t"
+#endif
      "call do_handle_exception \n\t"
      "pop %"R"ax; pop %"R"cx; pop %"R"dx; pop %"R"bx \n\t"
      "add $"S", %"R"sp; pop %"R"bp; pop %"R"si; pop %"R"di \n\t"
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux