bond/inc/arch/intr.h

61 lines
999 B
C
Raw Normal View History

2018-10-01 17:01:00 +00:00
#pragma once
2019-06-26 05:47:18 +00:00
#include <arch/intr.h>
#include <kern/status.h>
2018-10-01 17:01:00 +00:00
/**
* Interrupt context structure
*/
2018-10-02 06:43:30 +00:00
struct interrupt_context
2018-10-01 17:01:00 +00:00
{
const uint64 rip;
const uint64 cs;
const uint64 rflags;
const uint64 rsp;
const uint64 ss;
2018-10-02 06:43:30 +00:00
};
2018-10-01 17:01:00 +00:00
/**
* IDT Defns
*/
#define GATE_DPL_0 (0ull << 13)
#define GATE_DPL_1 (1ull << 13)
#define GATE_DPL_2 (2ull << 13)
#define GATE_DPL_3 (3ull << 13)
#define GATE_PRESENT (1ull << 15)
#define GATE_TYPE_CALL (12ull << 8)
#define GATE_TYPE_INTERRUPT (14ull << 8)
#define GATE_TYPE_TRAP (15ull << 8)
#define IDT_ENTRY_NUM 256
#define IDT_ENTRY_SIZE 16
2019-06-26 05:47:18 +00:00
#define IRQL_DPC (1)
2018-10-01 17:01:00 +00:00
/**
2018-10-02 06:43:30 +00:00
* C declaration
2018-10-01 17:01:00 +00:00
*/
2019-11-28 18:02:52 +00:00
void
2019-06-26 05:47:18 +00:00
arch_intr_init(void);
2018-10-01 17:01:00 +00:00
/**
2018-10-02 06:43:30 +00:00
* Exported Dispatchers for asm code
2018-10-01 17:01:00 +00:00
*/
2019-06-26 05:47:18 +00:00
void KABI
arch_intr_disp(uint64 int_vec, struct interrupt_context *context);
2018-10-01 17:01:00 +00:00
2019-06-26 05:47:18 +00:00
void KABI
arch_exc_disp(uint64 exc_vec, struct interrupt_context *context, uint32 errorcode);
2018-10-02 06:43:30 +00:00
/**
* ASM declaration
*/
2019-11-28 18:02:52 +00:00
int
arch_raise_irql(int irql);
2018-10-02 06:43:30 +00:00
2019-11-28 18:02:52 +00:00
int
arch_lower_irql(int irql);
2018-10-01 17:01:00 +00:00
2019-11-28 18:02:52 +00:00
int
arch_get_irql();