-/* exceptions_get_and_clear_exception ******************************************
-
- Gets the exception pointer of the current thread and clears it.
- This function may return NULL.
-
-*******************************************************************************/
-
-java_objectheader *exceptions_get_and_clear_exception(void)
-{
- java_objectheader **p;
- java_objectheader *e;
-
- /* get the pointer of the exception pointer */
-
- p = exceptionptr;
-
- /* get the exception */
-
- e = *p;
-
- /* and clear the exception */
-
- *p = NULL;
-
- /* return the exception */
-
- return e;
-}
-
-
-/* exceptions_new_hardware_exception *******************************************
-
- Creates the correct exception for a hardware-exception thrown and
- caught by a signal handler.
-
-*******************************************************************************/
-
-java_objectheader *exceptions_new_hardware_exception(u1 *pv, u1 *sp, u1 *ra, u1 *xpc, s4 type, ptrint val)
-{
- stackframeinfo sfi;
- java_objectheader *e;
- java_objectheader *o;
- s4 index;
-
- /* create stackframeinfo */
-
- stacktrace_create_extern_stackframeinfo(&sfi, pv, sp, ra, xpc);
-
- switch (type) {
- case EXCEPTION_HARDWARE_NULLPOINTER:
- e = exceptions_new_nullpointerexception();
- break;
-
- case EXCEPTION_HARDWARE_ARITHMETIC:
- e = exceptions_new_arithmeticexception();
- break;
-
- case EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS:
- index = (s4) val;
- e = exceptions_new_arrayindexoutofboundsexception(index);
- break;
-
- case EXCEPTION_HARDWARE_CLASSCAST:
- o = (java_objectheader *) val;
- e = exceptions_new_classcastexception(o);
- break;
-
- case EXCEPTION_HARDWARE_EXCEPTION:
- e = exceptions_fillinstacktrace();
- break;
-
- default:
- /* let's try to get a backtrace */
-
- codegen_get_pv_from_pc(xpc);
-
- /* if that does not work, print more debug info */
-
- log_println("exceptions_new_hardware_exception: unknown exception type %d", type);
-
-#if SIZEOF_VOID_P == 8
- log_println("PC=0x%016lx", xpc);
-#else
- log_println("PC=0x%08x", xpc);
-#endif
-
-#if defined(ENABLE_DISASSEMBLER)
- log_println("machine instruction at PC:");
- disassinstr(xpc);
-#endif
-
- vm_abort("Exiting...");
-
- /* keep compiler happy */
-
- e = NULL;
- }
-
- /* remove stackframeinfo */
-
- stacktrace_remove_stackframeinfo(&sfi);
-
- /* return the exception object */
-
- return e;
-}
-
-