diff options
| author | Aleksa Vučković <aleksav013@gmail.com> | 2021-10-25 22:41:21 +0200 |
|---|---|---|
| committer | Aleksa Vučković <aleksav013@gmail.com> | 2021-10-25 22:41:21 +0200 |
| commit | 39822cdb0acdd1eec66c2e18e0711fd3cd6f033d (patch) | |
| tree | 313eb08002f6e6e1c6564f2d411287745079da22 /src/c/stack_protector.c | |
| parent | 20dd72e40dc2728d3c5335d860e4b8ab8da14fcc (diff) | |
Adding first 32 IRQs; PIT finally working
Diffstat (limited to 'src/c/stack_protector.c')
| -rw-r--r-- | src/c/stack_protector.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/c/stack_protector.c b/src/c/stack_protector.c new file mode 100644 index 0000000..50e4316 --- /dev/null +++ b/src/c/stack_protector.c @@ -0,0 +1,22 @@ +#include <stdint.h> +#include"../include/stdio.h" + +#if UINT32_MAX == UINTPTR_MAX +#define STACK_CHK_GUARD 0xe2dee396 +#else +#define STACK_CHK_GUARD 0x595e9fbd94fda766 +#endif + +uintptr_t __stack_chk_guard = STACK_CHK_GUARD; + +__attribute__((noreturn)) +void __stack_chk_fail(void) +{ +#if __STDC_HOSTED__ + printf("Stack smashing detected\n"); + abort(); +#elif __is_myos_kernel + printf("Stack smashing detected\n"); + panic("Stack smashing detected"); +#endif +} |
