Some tweaks to the local static ABI functions
Cast to char * Print an OOPS if initialization fails
This commit is contained in:
parent
ff2ef8b1ac
commit
c579d57531
1 changed files with 8 additions and 3 deletions
11
src/cxa.cc
11
src/cxa.cc
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue