Files
Ronald Caesar c45acbf6ad cpu: add explicit padding to bal_cpu_t
Signed-off-by: Ronald Caesar <github43132@proton.me>
2026-06-15 03:34:17 -04:00

44 lines
1.1 KiB
C

//! Holds the state of the ARM guest CPU.
#ifndef BALLISTIC_BAL_CPU_H
#define BALLISTIC_BAL_CPU_H
#include "bal_attributes.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
BAL_ALIGNED(64) typedef struct
{
uint64_t x[32];
uint64_t pc;
// ARM's Carry flag is inverted compared to x86's Carry during subtraction operations.
// Compiler's must handle this.
uint8_t flag_c; // ARM C -> x86 CF
uint8_t flag_z; // ARM Z -> x86 ZF
uint8_t flag_n; // ARM N -> x86 SF
uint8_t flag_v; // ARM V -> x86 OF
uint32_t _pad_flags;
/// Tracks executed guest instructions.
///
/// This only increments if the engine flag [`BAL_ENGINE_FLAG_INSTRUCTION_COUNTING`] is set.
uint64_t instruction_count;
char pad[40];
} bal_cpu_t;
/// The function signature of a JIT-compiled basic block.
typedef void (*bal_jit_block_t)(bal_cpu_t *cpu);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // BALLISTIC_BAL_CPU_H
/*** end of file ***/