static void push_ehdr(void *eh, void *fp) { if (start == null) { void **new_start = (void **)MemoryOperations.GcMalloc(stack_length * sizeof(void *)); fixed(void ***start_addr = &start) { if (OtherOperations.CompareExchange((void **)start_addr, (void *)new_start) == null) { end = start + stack_length; cur = start; System.Diagnostics.Debugger.Log(0, "libsupcs", "new ehdr stack at " + ((ulong)start).ToString("X") + "-" + ((ulong)end).ToString("X")); } } } if ((cur + 1) >= end) { System.Diagnostics.Debugger.Break(); throw new OutOfMemoryException("exception header stack overflowed"); } //if(System.Threading.Thread.CurrentThread.ManagedThreadId != 1) // System.Diagnostics.Debugger.Log(0, "libsupcs", "exceptions: push_ehdr: " + ((ulong)eh).ToString("X")); // the following should be atomic for the current stack only, so disabling interrupts is // sufficient var state = OtherOperations.EnterUninterruptibleSection(); *cur++ = eh; *cur++ = fp; OtherOperations.ExitUninterruptibleSection(state); }
internal static int Assert_ShowDefaultAssertDialog(string conditionString, string message, string stackTrace, string windowTitle) { OtherOperations.EnterUninterruptibleSection(); System.Diagnostics.Debugger.Log(0, "Assert", windowTitle); System.Diagnostics.Debugger.Log(0, "Assert", conditionString); System.Diagnostics.Debugger.Log(0, "Assert", message); System.Diagnostics.Debugger.Log(0, "Assert", stackTrace); while (true) { ; } }
static void *peek_ehdr() { if (start == null || (void **)cur <= (void **)start) { return(null); } var state = OtherOperations.EnterUninterruptibleSection(); var ret = *(cur - 2); OtherOperations.ExitUninterruptibleSection(state); return(ret); }
static void *pop_fp() { if (start == null || cur <= start) { System.Diagnostics.Debugger.Break(); throw new OutOfMemoryException("exception header stack underflowed"); } var state = OtherOperations.EnterUninterruptibleSection(); var ret = *--cur; OtherOperations.ExitUninterruptibleSection(state); return(ret); }
static void *pop_ehdr() { if (start == null || (void **)cur <= (void **)start) { System.Diagnostics.Debugger.Break(); throw new OutOfMemoryException("exception header stack underflowed"); } var state = OtherOperations.EnterUninterruptibleSection(); var ret = *--cur; OtherOperations.ExitUninterruptibleSection(state); return(ret); //if (System.Threading.Thread.CurrentThread.ManagedThreadId != 1) // System.Diagnostics.Debugger.Log(0, "libsupcs", "exceptions: pop_ehdr: " + ((ulong)*cur).ToString("X")); }