From c579d575316ac15ef275437c6471b4c46167e0f2 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Thu, 10 Mar 2016 12:18:25 -0500 Subject: [PATCH] Some tweaks to the local static ABI functions Cast to char * Print an OOPS if initialization fails --- src/cxa.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cxa.cc b/src/cxa.cc index 40650c4..7b0157f 100644 --- a/src/cxa.cc +++ b/src/cxa.cc @@ -7,6 +7,8 @@ * variables can be initialized properly. */ +#include "Console.hh" + namespace __cxxabiv1 { // 64-bit integer type to service as mutex-like guard. @@ -27,21 +29,24 @@ extern "C" { int __cxa_guard_acquire(__guard *g) { - return !*(g); + return !*(char *)(g); } void __cxa_guard_release(__guard *g) { - *g = 1; + *(char *)g = 1; } void __cxa_guard_abort(__guard *) { - // TODO: What would be useful to do here? + kernel::Console console; + console.clear(kernel::Console::Color::Red); + console.writeString("OOPS!\n"); + console.writeString("Unhandled exception initializing static variable.\n"); } }