mirror of
https://github.com/pound-emu/ballistic.git
synced 2026-06-17 04:16:48 -07:00
be64332f20
Adds BAL_ERROR_BRANCH_OFFSET_OVERFLOW to bal_error_t. This should be returned when a branch offset exceeds its normal accepted range. Signed-off-by: Ronald Caesar <github43132@proton.me>
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/** @file bal_errors.h
|
|
*
|
|
* @brief Defines Ballistic error types.
|
|
*/
|
|
|
|
#ifndef BAL_ERRORS_H
|
|
#define BAL_ERRORS_H
|
|
|
|
#include "bal_attributes.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif /* __cplusplus */
|
|
|
|
typedef enum
|
|
{
|
|
// General Errors.
|
|
//
|
|
BAL_SUCCESS = 0,
|
|
BAL_ERROR_INVALID_ARGUMENT = -1,
|
|
BAL_ERROR_ALLOCATION_FAILED = -2,
|
|
|
|
/// Guest code tried to execute an unaligned instruction.
|
|
BAL_ERROR_PC_ALIGNMENT = -3,
|
|
BAL_ERROR_MEMORY_ALIGNMENT = -4,
|
|
|
|
/// Ballistic tried to access memory it was not allowed to access.
|
|
BAL_ERROR_MEMORY_FAULT = -5,
|
|
BAL_ERROR_UNKNOWN_INSTRUCTION = -6,
|
|
|
|
/// Error when creating a thread.
|
|
BAL_ERROR_THREAD_CREATION = -7,
|
|
|
|
/// Error on thread clean up. The user will need to manually clean up the thread's
|
|
/// resources.
|
|
BAL_ERROR_THREAD_CLEANUP = -8,
|
|
|
|
BAL_ERROR_ENGINE_ALREADY_RUNNING = -9,
|
|
|
|
// IR / Assembler Errors.
|
|
//
|
|
BAL_ERROR_INSTRUCTION_OVERFLOW = -100,
|
|
|
|
/// The decoded register type does not match the expected type.
|
|
BAL_ERROR_INCORRECT_REGISTER_TYPE = -101,
|
|
|
|
/// The relative jump or branch offset exceeded the capacity of the target displacement
|
|
/// field.
|
|
BAL_ERROR_BRANCH_OFFSET_OVERFLOW = -102,
|
|
} bal_error_t;
|
|
|
|
/// Converts the enum into a readable string for error handling.
|
|
BAL_COLD const char *bal_error_to_string(bal_error_t error);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* BAL_ERRORS_H */
|
|
|
|
/*** end of file ***/
|