2018-01-26 08:43:22 +00:00
|
|
|
#ifndef _KERNEL_HAL_INTR_H_
|
|
|
|
#define _KERNEL_HAL_INTR_H_
|
2016-06-15 07:29:46 +00:00
|
|
|
|
2017-06-16 07:19:03 +00:00
|
|
|
#include "type.h"
|
2016-06-23 04:50:29 +00:00
|
|
|
|
2018-01-26 08:43:22 +00:00
|
|
|
/**
|
|
|
|
* IRQL Definitions
|
|
|
|
*/
|
|
|
|
typedef uint32_t irql_t;
|
|
|
|
#define IRQL_DISABLED_LEVEL (1 << 3)
|
|
|
|
#define IRQL_DPC_LEVEL (1 << 2)
|
|
|
|
#define IRQL_APC_LEVEL (1 << 1)
|
|
|
|
#define IRQL_PASSIVE_LEVEL (1 << 0)
|
|
|
|
|
|
|
|
irql_t KABI hal_set_irql(irql_t irql);
|
|
|
|
irql_t KABI hal_get_irql(void);
|
|
|
|
uint32_t KABI hal_get_core_id(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interrupt Handler Registration
|
|
|
|
*/
|
2016-06-23 04:50:29 +00:00
|
|
|
typedef struct
|
2016-06-15 07:29:46 +00:00
|
|
|
{
|
2016-06-23 04:50:29 +00:00
|
|
|
uint32_t timer_intr_vec;
|
|
|
|
uint32_t apc_intr_vec;
|
|
|
|
uint32_t dpc_intr_vec;
|
2017-02-01 03:26:08 +00:00
|
|
|
} intr_info_t;
|
2016-06-23 04:50:29 +00:00
|
|
|
|
2018-01-26 08:43:22 +00:00
|
|
|
typedef void (KABI * intr_handler_t)(void *context, void *intr_stack);
|
|
|
|
|
|
|
|
void KABI hal_register_interrupt_handler(uint32_t coreid, uint32_t index, intr_handler_t handler, void* context);
|
|
|
|
|
|
|
|
void KABI hal_deregister_interrupt_handler(uint32_t coreid, uint32_t index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exception Handler Registration
|
|
|
|
*/
|
2016-06-25 01:47:29 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
unrecoverable_exc,
|
|
|
|
div_by_zero_exc,
|
|
|
|
general_protection_exc,
|
|
|
|
invalid_op_exc,
|
|
|
|
page_fault_exc,
|
|
|
|
unsupported_exc,
|
|
|
|
debug_exc
|
2017-02-01 03:26:08 +00:00
|
|
|
} exc_type_t;
|
2016-06-25 01:47:29 +00:00
|
|
|
|
2018-01-26 08:43:22 +00:00
|
|
|
typedef void (KABI *exc_handler_t)(uint64_t exc_addr, uint64_t exc_stack, uint64_t error_code);
|
2016-06-25 01:47:29 +00:00
|
|
|
|
2018-01-26 08:43:22 +00:00
|
|
|
void KABI hal_register_exception_handler(uint32_t coreid, uint32_t index, exc_handler_t handler);
|
2016-06-25 01:47:29 +00:00
|
|
|
|
2018-01-26 08:43:22 +00:00
|
|
|
void KABI hal_deregister_exception_handler(uint32_t coreid, uint32_t index);
|
2016-06-15 07:29:46 +00:00
|
|
|
|
|
|
|
#endif
|