#pragma once #include namespace x86 { struct cpu_state { /* registers stored by pusha */ // indexes and pointers uint32_t edi; // destination index: string, memory copying and setting, far pointer addressing with ES uint32_t esi; // source index: string and memory copying uint32_t ebp; // stack base pointer uint32_t esp; // stack pointer; this register is not used by popa // general registers uint32_t ebx; // base register: base pointer for memory access uint32_t edx; // data register: I/O ports, arithmetic uint32_t ecx; // counter register: loop counter, for shifts uint32_t eax; // accumulator register: I/O ports, arithmetic /* pushed by interrupt handler macros */ uint32_t irq; // interrupt number uint32_t error; // error code /* stack frame, pushed by cpu */ uint32_t eip; uint32_t cs; uint32_t eflags; uint32_t __esp; uint32_t ss; } __attribute__((packed)); } // namespace x86 typedef x86::cpu_state cpu_state_t;