diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-11-15 09:56:37 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-11-15 10:00:08 +0100 |
commit | acacb633e92c2c7facc11a9c18e6dda16c044e95 (patch) | |
tree | 2915c20509e8442717e0a934d0b950e93ca84c0e /CRT | |
parent | 9ae0188f77e9a00af73648f0f6f4504bd464c32d (diff) |
Partial SEH support.
* Removed linker script; .edata *and* .pdata required by MingW for SEH.
* Removed buggy `-fdata-sections` and `-ffunction-sections`.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'CRT')
-rw-r--r-- | CRT/except.h | 35 | ||||
-rw-r--r-- | CRT/kcrt.c | 2 |
2 files changed, 37 insertions, 0 deletions
diff --git a/CRT/except.h b/CRT/except.h new file mode 100644 index 0000000..7f39eac --- /dev/null +++ b/CRT/except.h @@ -0,0 +1,35 @@ +#ifndef EXCEPT_H +#define EXCEPT_H 1 + +#ifndef __SEH__ +#error "SEH not supported by your toolchain!" +#endif + +#ifdef __try1 +#undef __try1 +#endif + +#ifdef __except1 +#undef __except1 +#endif + +#define __dpptry(handler, counter) \ + __asm__ goto( \ + ".seh_handler __C_specific_handler, @except\n\t" \ + ".seh_handlerdata\n\t" \ + ".long 1\n\t" \ + ".rva .l_startw" #counter ", .l_endw" #counter ", " #handler ", .l_exceptw" #counter \ + "\n\t" \ + ".section .text\n" \ + ".l_startw" #counter ":" :: ::except); + +#define __dppexcept(counter) \ + goto end; \ + except: \ + __asm__(".l_exceptw" #counter ":"); + +#define __dpptryend(counter) \ + end: \ + __asm__(".l_endw" #counter ":"); + +#endif @@ -6,6 +6,8 @@ #include <ntddk.h> +#include "except.h" + #define KCRT_POOL_DEFAULT_TAG 0xDEADBEEF extern void (*__CTOR_LIST__)(); |