diff runtime/internal/eh.d @ 741:4ac97ec7c18e

Applied easy part from wilsonk's x86-64 patch in #107
author Christian Kamm <kamm incasoftware de>
date Thu, 30 Oct 2008 11:08:34 +0100
parents 6aaa3d3c1183
children 661384d6a936
line wrap: on
line diff
--- a/runtime/internal/eh.d	Thu Oct 30 10:17:05 2008 +0100
+++ b/runtime/internal/eh.d	Thu Oct 30 11:08:34 2008 +0100
@@ -15,6 +15,9 @@
     version(linux) version=X86_UNWIND;
     version(darwin) version=X86_UNWIND;
 }
+version(X86_64) {
+    version(linux) version=X86_UNWIND;
+}
 
 private extern(C) void abort();
 private extern(C) int printf(char*, ...);
@@ -168,7 +171,7 @@
 // x86 unwind specific implementation of personality function
 // and helpers
 //
-version(X86_UNWIND) 
+version(X86_UNWIND)
 {
 
 // the personality routine gets called by the unwind handler and is responsible for
@@ -296,9 +299,15 @@
 // These are the register numbers for SetGR that
 // llvm's eh.exception and eh.selector intrinsics
 // will pick up.
-// Found by trial-and-error and probably platform dependent!
-private int eh_exception_regno = 0;
-private int eh_selector_regno = 2;
+// Found by trial-and-error :/
+version (X86_64)
+{
+  private int eh_exception_regno = 3;
+  private int eh_selector_regno = 1;
+} else {
+  private int eh_exception_regno = 0;
+  private int eh_selector_regno = 2;
+}
 
 private _Unwind_Reason_Code _d_eh_install_catch_context(_Unwind_Action actions, ptrdiff_t switchval, ulong landing_pad, _d_exception* exception_struct, _Unwind_Context_Ptr context)
 {