From b865b36b38d951de28cc4df5fa67338b8245a1c3 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 17 Oct 2024 13:12:29 +0200 Subject: Implement support for `std::terminate` via `::abort` --- arch/x86_64/src/exception_handling/abort.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 arch/x86_64/src/exception_handling/abort.cpp (limited to 'arch/x86_64/src/exception_handling/abort.cpp') diff --git a/arch/x86_64/src/exception_handling/abort.cpp b/arch/x86_64/src/exception_handling/abort.cpp new file mode 100644 index 0000000..dc40008 --- /dev/null +++ b/arch/x86_64/src/exception_handling/abort.cpp @@ -0,0 +1,17 @@ +#include "arch/exception_handling/panic.hpp" + +#include + +namespace teachos::arch::exception_handling +{ + + /** + * @brief Override for the newlib abort function. + * + * newlib defines @p ::abort as a weak symbol, thus allowing implementations to override it by simply providing a + * matching implementation. Since the default implemenatation calls a number of functions the kernel does not + * currently implement, @p ::abort gets overridden to simply panic. + */ + extern "C" auto abort() -> void { panic("Terminate was called, possibly due to an unhandled exception"); } + +} // namespace teachos::arch::exception_handling \ No newline at end of file -- cgit v1.2.3 From da2341ec12128d3b4983a67d39aeaf76b1781fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Sun, 20 Oct 2024 12:02:20 +0000 Subject: Add printf like behaviour to assert --- arch/x86_64/src/exception_handling/abort.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/x86_64/src/exception_handling/abort.cpp') diff --git a/arch/x86_64/src/exception_handling/abort.cpp b/arch/x86_64/src/exception_handling/abort.cpp index dc40008..77576b1 100644 --- a/arch/x86_64/src/exception_handling/abort.cpp +++ b/arch/x86_64/src/exception_handling/abort.cpp @@ -4,7 +4,6 @@ namespace teachos::arch::exception_handling { - /** * @brief Override for the newlib abort function. * @@ -14,4 +13,4 @@ namespace teachos::arch::exception_handling */ extern "C" auto abort() -> void { panic("Terminate was called, possibly due to an unhandled exception"); } -} // namespace teachos::arch::exception_handling \ No newline at end of file +} // namespace teachos::arch::exception_handling -- cgit v1.2.3 From 2129bdb22bab7dc5a9d23a31c23f38e847511a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Sun, 20 Oct 2024 12:17:44 +0000 Subject: =?UTF-8?q?Revert=20assert=20with=20printf=20functionality,=20requ?= =?UTF-8?q?ires=20malloc=20=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arch/x86_64/src/exception_handling/abort.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/x86_64/src/exception_handling/abort.cpp') diff --git a/arch/x86_64/src/exception_handling/abort.cpp b/arch/x86_64/src/exception_handling/abort.cpp index 77576b1..e331d34 100644 --- a/arch/x86_64/src/exception_handling/abort.cpp +++ b/arch/x86_64/src/exception_handling/abort.cpp @@ -12,5 +12,4 @@ namespace teachos::arch::exception_handling * currently implement, @p ::abort gets overridden to simply panic. */ extern "C" auto abort() -> void { panic("Terminate was called, possibly due to an unhandled exception"); } - } // namespace teachos::arch::exception_handling -- cgit v1.2.3 From ba054441f93a30e2042a71d632a6a5fb04007d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Tue, 22 Oct 2024 06:16:51 +0000 Subject: Adjust all briefs --- arch/x86_64/src/exception_handling/abort.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/x86_64/src/exception_handling/abort.cpp') diff --git a/arch/x86_64/src/exception_handling/abort.cpp b/arch/x86_64/src/exception_handling/abort.cpp index e331d34..e12e4cb 100644 --- a/arch/x86_64/src/exception_handling/abort.cpp +++ b/arch/x86_64/src/exception_handling/abort.cpp @@ -7,8 +7,8 @@ namespace teachos::arch::exception_handling /** * @brief Override for the newlib abort function. * - * newlib defines @p ::abort as a weak symbol, thus allowing implementations to override it by simply providing a - * matching implementation. Since the default implemenatation calls a number of functions the kernel does not + * @note newlib defines @p ::abort as a weak symbol, thus allowing implementations to override it by simply providing + * a matching implementation. Since the default implemenatation calls a number of functions the kernel does not * currently implement, @p ::abort gets overridden to simply panic. */ extern "C" auto abort() -> void { panic("Terminate was called, possibly due to an unhandled exception"); } -- cgit v1.2.3