cpu.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * cpu.h
  3. *
  4. * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __MONOLITHIUM_CPU_H__
  20. #define __MONOLITHIUM_CPU_H__
  21. typedef struct
  22. {
  23. dword_t data_selector;
  24. dword_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
  25. dword_t error_code;
  26. dword_t eip, cs, eflags;
  27. } registers_t;
  28. typedef struct
  29. {
  30. dword_t data_selector;
  31. dword_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
  32. dword_t error_code;
  33. dword_t eip, cs, eflags, esp3, ss;
  34. } registers_ext_t;
  35. typedef struct
  36. {
  37. dword_t data_selector;
  38. dword_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
  39. dword_t error_code;
  40. dword_t eip, cs, eflags, esp3, ss, es, ds, fs, gs;
  41. } registers_ext_vm86_t;
  42. typedef enum
  43. {
  44. CPU_EXCEPTION_DE = 0x00,
  45. CPU_EXCEPTION_DB = 0x01,
  46. CPU_EXCEPTION_NMI = 0x02,
  47. CPU_EXCEPTION_BP = 0x03,
  48. CPU_EXCEPTION_OF = 0x04,
  49. CPU_EXCEPTION_BR = 0x05,
  50. CPU_EXCEPTION_UD = 0x06,
  51. CPU_EXCEPTION_NM = 0x07,
  52. CPU_EXCEPTION_DF = 0x08,
  53. CPU_EXCEPTION_TS = 0x0A,
  54. CPU_EXCEPTION_NP = 0x0B,
  55. CPU_EXCEPTION_SS = 0x0C,
  56. CPU_EXCEPTION_GP = 0x0D,
  57. CPU_EXCEPTION_PF = 0x0E,
  58. CPU_EXCEPTION_MF = 0x10,
  59. CPU_EXCEPTION_AC = 0x11,
  60. CPU_EXCEPTION_MC = 0x12,
  61. CPU_EXCEPTION_XM = 0x13,
  62. CPU_EXCEPTION_VE = 0x14,
  63. CPU_EXCEPTION_SX = 0x1E,
  64. CPU_EXCEPTION_MAX
  65. } cpu_exception_t;
  66. #endif