[boot] Improve non-printing error handling

Add an implicit __LINE__ to the try_or_raise macro, which gets set in
r11 on cpu_assert. Also made status lines smarter about when to call
cpu_assert.
This commit is contained in:
Justin C. Miller
2021-01-20 01:18:31 -08:00
parent 847d7ab38d
commit 14aad62e02
6 changed files with 24 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ class console;
namespace error {
/// Halt or exit the program with the given error status/message
[[ noreturn ]] void raise(uefi::status status, const wchar_t *message);
[[ noreturn ]] void raise(uefi::status status, const wchar_t *message, size_t line = 0);
const wchar_t * message(uefi::status status);
@@ -28,6 +28,6 @@ void debug_break();
#define try_or_raise(s, m) \
do { \
uefi::status _s = (s); \
if (uefi::is_error(_s)) ::boot::error::raise(_s, (m)); \
if (uefi::is_error(_s)) ::boot::error::raise(_s, (m), __LINE__); \
} while(0)