2020-03-09 02:12:24 +01:00
|
|
|
#include "panic.h"
|
2020-03-10 17:50:55 +01:00
|
|
|
#include <Platform.h>
|
2020-03-09 02:12:24 +01:00
|
|
|
|
2020-03-10 17:50:55 +01:00
|
|
|
//extern "C" {
|
|
|
|
//#include <Library/BaseLib.h> // for CpuDeadLoop
|
|
|
|
//}
|
2020-03-09 02:12:24 +01:00
|
|
|
|
2020-03-11 15:23:58 +01:00
|
|
|
bool stop_at_panic = true;
|
|
|
|
bool i_have_panicked = false;
|
|
|
|
|
2020-03-09 09:09:29 +01:00
|
|
|
/*
|
|
|
|
*
|
2020-03-11 15:23:58 +01:00
|
|
|
* Function panic_ seems useless. It's same as panic(). It's to be able to put a breakpoint in gdb with br panic_(). This is done in gdb_launch script in Qemu
|
2020-03-09 09:09:29 +01:00
|
|
|
*/
|
2020-03-11 15:23:58 +01:00
|
|
|
void panic_(const char* s)
|
|
|
|
{
|
|
|
|
if ( stop_at_panic ) {
|
2020-03-25 19:32:44 +01:00
|
|
|
if ( s ) DebugLog(2, "%s\n", s);
|
2020-03-11 15:23:58 +01:00
|
|
|
DebugLog(2, "A fatal error happened. System halted\n");
|
|
|
|
CpuDeadLoop();
|
|
|
|
}else{
|
2020-03-25 19:32:44 +01:00
|
|
|
// if ( s ) DebugLog(2, "%s\n", s);
|
2020-03-11 15:23:58 +01:00
|
|
|
// DebugLog(2, "A fatal error happened. Continue for testing\n");
|
|
|
|
i_have_panicked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void panic(const char* s)
|
|
|
|
{
|
|
|
|
panic_(s);
|
|
|
|
}
|
|
|
|
|
2020-03-09 09:09:29 +01:00
|
|
|
|
2020-03-09 02:12:24 +01:00
|
|
|
void panic(void)
|
|
|
|
{
|
2020-03-11 15:23:58 +01:00
|
|
|
panic_(nullptr);
|
2020-03-09 02:12:24 +01:00
|
|
|
}
|