Some tweaks to the local static ABI functions

Cast to char *
Print an OOPS if initialization fails
This commit is contained in:
Eryn Wells 2016-03-10 12:18:25 -05:00
parent ff2ef8b1ac
commit c579d57531

View file

@ -7,6 +7,8 @@
* variables can be initialized properly. * variables can be initialized properly.
*/ */
#include "Console.hh"
namespace __cxxabiv1 { namespace __cxxabiv1 {
// 64-bit integer type to service as mutex-like guard. // 64-bit integer type to service as mutex-like guard.
@ -27,21 +29,24 @@ extern "C" {
int int
__cxa_guard_acquire(__guard *g) __cxa_guard_acquire(__guard *g)
{ {
return !*(g); return !*(char *)(g);
} }
void void
__cxa_guard_release(__guard *g) __cxa_guard_release(__guard *g)
{ {
*g = 1; *(char *)g = 1;
} }
void void
__cxa_guard_abort(__guard *) __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");
} }
} }