mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-02 02:49:15 +00:00
Merge remote-tracking branch 'Kernel/master'
This commit is contained in:
118
Kernel/include/kexcept/cxxabi.h
Normal file
118
Kernel/include/kexcept/cxxabi.h
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_KERNEL_CXXABI_H__
|
||||
#define __FENNIX_KERNEL_CXXABI_H__
|
||||
|
||||
#include <types.h>
|
||||
#include <kexcept/unwind.h>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace __cxxabiv1
|
||||
{
|
||||
#define ATEXIT_MAX_FUNCS 128
|
||||
|
||||
typedef unsigned uarch_t;
|
||||
|
||||
struct atexit_func_entry_t
|
||||
{
|
||||
void (*destructor_func)(void *);
|
||||
void *obj_ptr;
|
||||
void *dso_handle;
|
||||
};
|
||||
|
||||
struct __cxa_exception
|
||||
{
|
||||
#ifdef __LP64__
|
||||
char __padding[8];
|
||||
uintptr_t referenceCount;
|
||||
#endif
|
||||
std::type_info *exceptionType;
|
||||
void (*exceptionDestructor)(void *);
|
||||
std::terminate_handler unexpectedHandler;
|
||||
std::terminate_handler terminateHandler;
|
||||
__cxa_exception *nextException;
|
||||
int handlerCount;
|
||||
#ifdef __arm__
|
||||
__cxa_exception *nextPropagatingException;
|
||||
int propagationCount;
|
||||
#else
|
||||
int handlerSwitchValue;
|
||||
const unsigned char *actionRecord;
|
||||
const unsigned char *languageSpecificData;
|
||||
void *catchTemp;
|
||||
void *adjustedPtr;
|
||||
#endif
|
||||
#ifndef __LP64__
|
||||
uintptr_t referenceCount;
|
||||
#endif
|
||||
_Unwind_Exception unwindHeader;
|
||||
};
|
||||
|
||||
struct __cxa_dependent_exception
|
||||
{
|
||||
#ifdef __LP64__
|
||||
char __padding[8];
|
||||
void *primaryException;
|
||||
#endif
|
||||
std::type_info *exceptionType;
|
||||
void (*exceptionDestructor)(void *);
|
||||
std::unexpected_handler unexpectedHandler;
|
||||
std::terminate_handler terminateHandler;
|
||||
__cxa_exception *nextException;
|
||||
int handlerCount;
|
||||
#ifdef __arm__
|
||||
_Unwind_Exception *nextCleanup;
|
||||
int cleanupCount;
|
||||
#endif
|
||||
int handlerSwitchValue;
|
||||
const char *actionRecord;
|
||||
const char *languageSpecificData;
|
||||
void *catchTemp;
|
||||
void *adjustedPtr;
|
||||
#ifndef __LP64__
|
||||
void *primaryException;
|
||||
#endif
|
||||
_Unwind_Exception unwindHeader;
|
||||
};
|
||||
|
||||
struct __cxa_eh_globals
|
||||
{
|
||||
__cxa_exception *caughtExceptions;
|
||||
unsigned int uncaughtExceptions;
|
||||
};
|
||||
|
||||
enum ExceptionState
|
||||
{
|
||||
ES_None,
|
||||
ES_Caught,
|
||||
ES_Rethrown
|
||||
};
|
||||
}
|
||||
|
||||
struct ExceptionInfo
|
||||
{
|
||||
std::terminate_handler terminateHandler;
|
||||
std::unexpected_handler unexpectedHandler;
|
||||
_Unwind_Exception *exceptionObject;
|
||||
__cxxabiv1::ExceptionState state;
|
||||
__cxxabiv1::__cxa_eh_globals globals;
|
||||
};
|
||||
|
||||
ExceptionInfo *GetExceptionInfo();
|
||||
|
||||
#endif // !__FENNIX_KERNEL_CXXABI_H__
|
74
Kernel/include/kexcept/unwind.h
Normal file
74
Kernel/include/kexcept/unwind.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FENNIX_KERNEL_UNWIND_H__
|
||||
#define __FENNIX_KERNEL_UNWIND_H__
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
_URC_NO_REASON = 0,
|
||||
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
|
||||
_URC_FATAL_PHASE2_ERROR = 2,
|
||||
_URC_FATAL_PHASE1_ERROR = 3,
|
||||
_URC_NORMAL_STOP = 4,
|
||||
_URC_END_OF_STACK = 5,
|
||||
_URC_HANDLER_FOUND = 6,
|
||||
_URC_INSTALL_CONTEXT = 7,
|
||||
_URC_CONTINUE_UNWIND = 8
|
||||
} _Unwind_Reason_Code;
|
||||
|
||||
typedef void *_Unwind_Context_Reg_Val;
|
||||
typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));
|
||||
typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
|
||||
typedef unsigned _Unwind_Word __attribute__((__mode__(__unwind_word__)));
|
||||
typedef signed _Unwind_Sword __attribute__((__mode__(__unwind_word__)));
|
||||
typedef int _Unwind_Action;
|
||||
|
||||
#define _UA_SEARCH_PHASE 1
|
||||
#define _UA_CLEANUP_PHASE 2
|
||||
#define _UA_HANDLER_FRAME 4
|
||||
#define _UA_FORCE_UNWIND 8
|
||||
#define _UA_END_OF_STACK 16
|
||||
|
||||
typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code, struct _Unwind_Exception *);
|
||||
|
||||
typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(int, _Unwind_Action,
|
||||
_Unwind_Exception_Class,
|
||||
struct _Unwind_Exception *,
|
||||
struct _Unwind_Context *);
|
||||
|
||||
struct _Unwind_Exception
|
||||
{
|
||||
_Unwind_Exception_Class exception_class;
|
||||
_Unwind_Exception_Cleanup_Fn exception_cleanup;
|
||||
_Unwind_Word private_1;
|
||||
_Unwind_Word private_2;
|
||||
} __attribute__((__aligned__));
|
||||
|
||||
struct _Unwind_Context
|
||||
{
|
||||
int __stub;
|
||||
};
|
||||
|
||||
struct _Unwind_FrameState
|
||||
{
|
||||
_Unwind_Personality_Fn personality;
|
||||
};
|
||||
|
||||
#endif // !__FENNIX_KERNEL_UNWIND_H__
|
Reference in New Issue
Block a user