123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- /*
- * cpu.h
- *
- * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef __MONOLITHIUM_CPU_H__
- #define __MONOLITHIUM_CPU_H__
- #define CPU_MAX_FPU_DATA_SIZE 512
- #define CPU_STATUS_FLAG_CF (1 << 0)
- #define CPU_STATUS_FLAG_PF (1 << 2)
- #define CPU_STATUS_FLAG_AF (1 << 4)
- #define CPU_STATUS_FLAG_ZF (1 << 6)
- #define CPU_STATUS_FLAG_SF (1 << 7)
- #define CPU_STATUS_FLAG_TF (1 << 8)
- #define CPU_STATUS_FLAG_IF (1 << 9)
- #define CPU_STATUS_FLAG_DF (1 << 10)
- #define CPU_STATUS_FLAG_OF (1 << 11)
- #define CPU_STATUS_FLAG_NT (1 << 14)
- #define CPU_STATUS_FLAG_RF (1 << 16)
- #define CPU_STATUS_FLAG_VM (1 << 17)
- #define CPU_STATUS_FLAG_AC (1 << 18)
- #define CPU_STATUS_FLAG_VIF (1 << 19)
- #define CPU_STATUS_FLAG_VIP (1 << 20)
- #define CPU_STATUS_FLAG_ID (1 << 21)
- typedef struct
- {
- dword_t data_selector;
- dword_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
- dword_t error_code;
- dword_t eip, cs, eflags;
- } registers_t;
- typedef struct
- {
- dword_t data_selector;
- dword_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
- dword_t error_code;
- dword_t eip, cs, eflags, esp3, ss;
- } registers_ext_t;
- typedef struct
- {
- dword_t data_selector;
- dword_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
- dword_t error_code;
- dword_t eip, cs, eflags, esp3, ss, es, ds, fs, gs;
- } registers_ext_vm86_t;
- typedef enum
- {
- CPU_EXCEPTION_DE = 0x00,
- CPU_EXCEPTION_DB = 0x01,
- CPU_EXCEPTION_NMI = 0x02,
- CPU_EXCEPTION_BP = 0x03,
- CPU_EXCEPTION_OF = 0x04,
- CPU_EXCEPTION_BR = 0x05,
- CPU_EXCEPTION_UD = 0x06,
- CPU_EXCEPTION_NM = 0x07,
- CPU_EXCEPTION_DF = 0x08,
- CPU_EXCEPTION_TS = 0x0A,
- CPU_EXCEPTION_NP = 0x0B,
- CPU_EXCEPTION_SS = 0x0C,
- CPU_EXCEPTION_GP = 0x0D,
- CPU_EXCEPTION_PF = 0x0E,
- CPU_EXCEPTION_MF = 0x10,
- CPU_EXCEPTION_AC = 0x11,
- CPU_EXCEPTION_MC = 0x12,
- CPU_EXCEPTION_XM = 0x13,
- CPU_EXCEPTION_VE = 0x14,
- CPU_EXCEPTION_SX = 0x1E,
- CPU_EXCEPTION_MAX
- } cpu_exception_t;
- #endif
|