Add GCC inline assembler to generate the Symbian exception descriptor - bug 2921 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Tue, 06 Jul 2010 13:05:35 +0100
branchGCC_SURGE
changeset 195 3411883d8fcf
parent 193 082ffed484fb
child 197 adb088c9cfcf
Add GCC inline assembler to generate the Symbian exception descriptor - bug 2921
kernel/eka/euser/epoc/arm/uc_dll.cia
kernel/eka/euser/epoc/arm/uc_exe.cia
kernel/eka/include/cpudefs.h
--- a/kernel/eka/euser/epoc/arm/uc_dll.cia	Mon Jul 05 08:12:03 2010 +0100
+++ b/kernel/eka/euser/epoc/arm/uc_dll.cia	Tue Jul 06 13:05:35 2010 +0100
@@ -72,6 +72,32 @@
 #endif
 
 #endif
+#elif defined(__GCCE__)
+#ifdef __SUPPORT_CPP_EXCEPTIONS__
+
+
+  /* It is possible no functions included in the image require
+   * a handler table. Therefore make only a weak reference to
+   * the handler table base symbol, which may be absent.
+   */
+  asm(".weak .ARM.extab$$Base");
+  asm(".global Symbian$$CPP$$Exception$$Descriptor");
+
+  /* Symbian$$CPP$$Exception$$Descriptor is referenced from the Image header.
+   * A pointer to this object can be cached by the unwinder in the UCB
+   * on the assumption that the EHT for the previous frame is likely to be right
+   * for the current frame
+   */
+
+  asm("Symbian$$CPP$$Exception$$Descriptor:");
+#ifdef __LEAVE_EQUALS_THROW__
+  asm(".word .ARM.exidx$$Base");   /* index table base */
+  asm(".word .ARM.exidx$$Limit");  /* index table limit */
+#endif
+  asm(".word Image$$ER_RO$$Base + 1"); /* RO segment base + mark as ehabi v2 */
+  asm(".word Image$$ER_RO$$Limit");    /* RO segment limit */
+  asm(".word 0");                      /* reserved for future use */
+#endif
 #endif
 	}
 }
--- a/kernel/eka/euser/epoc/arm/uc_exe.cia	Mon Jul 05 08:12:03 2010 +0100
+++ b/kernel/eka/euser/epoc/arm/uc_exe.cia	Tue Jul 06 13:05:35 2010 +0100
@@ -61,15 +61,11 @@
 
 	asm("mov r11, sp ");		// save stack pointer
 
-#if 0 /* IMK: Temorarily deleting these __EH_FRAME calls to discover if the suspect
-	GCCE definitions of them are behind a kernel panic. */
-
 	// The frame starts 84 bytes (up) from r11 i.e. CFA is r11 + 84
 	__EH_FRAME_ADDRESS(sp, 84) // Reg needs to be sp (=r11) here for gcce
 	// we can only restore callee-save values, but that's what we want if we 'leave'
 	// saved link is -8 bytes from CFA (= r11 + 0x24 + 0x20 + 0x8)
 	__EH_FRAME_SAVE1(lr, -8)
-#endif
 
 	// the other callee saves start at -48 from CFA (= r11 + 0x24)
 #if 0
@@ -80,9 +76,7 @@
 #if defined(__ARMCC__)
 	FRAME SAVE {r4-r11}, -48
 #elif defined(__GCCE__)
-#if 0 /* IMK: see above */
 	__EH_FRAME_SAVE1(r4-r11,-48)
-#endif
 #else
 #error What compiler?	
 #endif
@@ -127,6 +121,32 @@
 #endif
 
 #endif
+#elif defined(__GCCE__)
+#ifdef __SUPPORT_CPP_EXCEPTIONS__
+
+
+  /* It is possible no functions included in the image require
+   * a handler table. Therefore make only a weak reference to
+   * the handler table base symbol, which may be absent.
+   */
+  asm(".weak .ARM.extab$$Base");
+  asm(".global Symbian$$CPP$$Exception$$Descriptor");
+
+  /* Symbian$$CPP$$Exception$$Descriptor is referenced from the Image header.
+   * A pointer to this object can be cached by the unwinder in the UCB
+   * on the assumption that the EHT for the previous frame is likely to be right
+   * for the current frame
+   */
+
+  asm("Symbian$$CPP$$Exception$$Descriptor:");
+#ifdef __LEAVE_EQUALS_THROW__
+  asm(".word .ARM.exidx$$Base");   /* index table base */
+  asm(".word .ARM.exidx$$Limit");  /* index table limit */
+#endif
+  asm(".word Image$$ER_RO$$Base + 1"); /* RO segment base + mark as ehabi v2 */
+  asm(".word Image$$ER_RO$$Limit");    /* RO segment limit */
+  asm(".word 0");                      /* reserved for future use */
+#endif
 #endif
 
 	}
--- a/kernel/eka/include/cpudefs.h	Mon Jul 05 08:12:03 2010 +0100
+++ b/kernel/eka/include/cpudefs.h	Tue Jul 06 13:05:35 2010 +0100
@@ -245,10 +245,10 @@
 	#define __HEAP_MACHINE_CODED__
 	#define __REALS_MACHINE_CODED__
 	#define __COBJECT_MACHINE_CODED__
-//	#define __CACTIVESCHEDULER_MACHINE_CODED__ IMK: working around bug #1409
-//	#define __CSERVER_MACHINE_CODED__ IMK: working around bug #1409
-//	#define __ARRAY_MACHINE_CODED__ IMK: working around bug #2976, #2976 
-//	#define __HUFFMAN_MACHINE_CODED__ IMK: working around bug #1409
+	#define __CACTIVESCHEDULER_MACHINE_CODED__
+	#define __CSERVER_MACHINE_CODED__
+//	#define __ARRAY_MACHINE_CODED__ IMK working around bug #2976
+	#define __HUFFMAN_MACHINE_CODED__
 #if defined(__MARM_ARM4__) || defined(__MARM_ARMI__) || defined(__MARM_THUMB__) || defined(__MARM_ARMV4__) || defined(__MARM_ARMV5__)
 	#define __DES16_MACHINE_CODED_HWORD__
 #endif