1 #include "arch/x86/console.h"
2 #include "arch/x86/hlt.h"
4 #include "libs/string.h"
7 error::error(const char *msg
) : base_err(0), er_message(msg
) {}
8 error::error(error
*er
) : base_err(er
) {}
9 error::error(error
*er
, const char *msg
) : base_err(er
), er_message(msg
) {}
11 void error::critical() {
13 er_print("Critical Quarn OS error has occurred!\n", arch::scr_red
);
14 for (error
*er
= this; er
; er
= er
->base_err
)
15 er_print(er
->er_message
, arch::scr_red
);
16 er_print("\nSystem is halted.", arch::scr_red
);
21 void error::assertion() {
22 #if DEBUG_MODE == CONF_YES
25 er_print("Assertion failed!\n", arch::scr_yellow
);
26 for (error
*er
= this; er
; er
= er
->base_err
)
27 er_print(er
->er_message
, arch::scr_yellow
);
28 er_print("\nPress any key to continue...", arch::scr_yellow
);
33 #if DEBUG_MODE == CONF_YES
34 extern unsigned int last_call0
;
35 extern unsigned int last_call1
;
39 #if DEBUG_MODE == CONF_YES
42 er_print("(", arch::scr_darkgray
);
43 for (error
*er
= this; er
; er
= er
->base_err
)
44 er_print(er
->er_message
, arch::scr_darkgray
);
45 er_print(((string
)" [last call: 0x" + string(last_call0
,true) + ", 0x" + string(last_call1
,true) + "]"),arch::scr_darkgray
);
46 er_print(")", arch::scr_darkgray
);
51 void error::er_print(const char *message
, arch::scr_color color
) {
52 assert("error: null error message", message
== 0);
54 for (int i
= 0; message
[i
] != 0; i
++) {
56 if (message
[i
] == '\n') {
60 arch::screen_print(message
[i
],color
,x
,y
);
64 y
+= x
/ arch::scr_width
;
65 x
= x
% arch::scr_width
;