53 lines
1.4 KiB
C
53 lines
1.4 KiB
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOX_CPU_H
|
|
#define NOX_CPU_H
|
|
|
|
#include "utils/stdtypes.h"
|
|
|
|
typedef enum {
|
|
CPU_FLAG_CARRY = 0,
|
|
CPU_FLAG_PARITY = 2,
|
|
CPU_FLAG_AUXILIARY = 4,
|
|
CPU_FLAG_ZERO = 6,
|
|
CPU_FLAG_SIGN = 7,
|
|
CPU_FLAG_TRAP = 8,
|
|
CPU_FLAG_INTERRUPT_ENABLE = 9,
|
|
CPU_FLAG_DIRECTION = 10,
|
|
CPU_FLAG_OVERFLOW = 11,
|
|
CPU_FLAG_IO_PRIVILEGE_0 = 12,
|
|
CPU_FLAG_IO_PRIVILEGE_1 = 13,
|
|
CPU_FLAG_NESTED_TASK = 14,
|
|
CPU_FLAG_RESUME = 16,
|
|
CPU_FLAG_VIRTUAL_8086 = 17,
|
|
CPU_FLAG_ALIGNMENT_CHECK = 18,
|
|
CPU_FLAG_VIRTUAL_INTERRUPT = 19,
|
|
CPU_FLAG_VIRTUAL_INTERRUPT_PENDING = 20,
|
|
CPU_FLAG_CPUID = 21
|
|
} cpu_flags_E;
|
|
|
|
typedef struct {
|
|
// Registers saved by assembly function
|
|
uint64_t cr3;
|
|
uint64_t rax;
|
|
uint64_t rbx;
|
|
uint64_t rcx;
|
|
uint64_t rdx;
|
|
uint64_t rsi;
|
|
uint64_t rdi;
|
|
uint64_t rbp;
|
|
|
|
// Manually pushed
|
|
uint64_t interrupt_id;
|
|
uint64_t error_code;
|
|
|
|
// Saved by CPU
|
|
uint64_t rip;
|
|
uint64_t cs;
|
|
uint64_t flags;
|
|
uint64_t rsp;
|
|
uint64_t ss;
|
|
} cpu_state_T;
|
|
|
|
#endif //NOX_CPU_H
|