| 1 | #ifndef LIB__REAL_H__ |
| 2 | #define LIB__REAL_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stdnoreturn.h> |
| 6 | |
| 7 | #define rm_seg(x) ((uint16_t)(((int)(x) & 0xffff0) >> 4)) |
| 8 | #define rm_off(x) ((uint16_t)(((int)(x) & 0x0000f) >> 0)) |
| 9 | |
| 10 | #define rm_desegment(seg, off) (((uint32_t)(seg) << 4) + (uint32_t)(off)) |
| 11 | |
| 12 | #define EFLAGS_CF (1 << 0) |
| 13 | #define EFLAGS_ZF (1 << 6) |
| 14 | |
| 15 | struct rm_regs { |
| 16 | uint16_t gs; |
| 17 | uint16_t fs; |
| 18 | uint16_t es; |
| 19 | uint16_t ds; |
| 20 | uint32_t eflags; |
| 21 | uint32_t ebp; |
| 22 | uint32_t edi; |
| 23 | uint32_t esi; |
| 24 | uint32_t edx; |
| 25 | uint32_t ecx; |
| 26 | uint32_t ebx; |
| 27 | uint32_t eax; |
| 28 | } __attribute__((packed)); |
| 29 | |
| 30 | void rm_int(uint8_t int_no, struct rm_regs *out_regs, struct rm_regs *in_regs); |
| 31 | |
| 32 | noreturn void rm_hcf(void); |
| 33 | |
| 34 | #endif |