qemu-e2k/target/e2k/cpu.h

102 lines
2.5 KiB
C
Raw Normal View History

2020-10-15 16:08:01 +02:00
#ifndef E2K_CPU_H
#define E2K_CPU_H
#include "qemu/bswap.h"
#include "cpu-qom.h"
#include "exec/cpu-defs.h"
2020-11-08 19:27:47 +01:00
void e2k_tcg_initialize(void);
#define MMU_USER_IDX 1
#define CPU_RESOLVING_TYPE TYPE_E2K_CPU
2020-11-11 10:28:06 +01:00
#define WREGS_SIZE 192
2020-11-11 11:23:38 +01:00
// size of regular reg in bytes
#define REG_SIZE (sizeof(target_ulong))
2020-11-08 19:27:47 +01:00
2020-11-12 14:52:51 +01:00
typedef enum {
E2K_EXCP_UNIMPL = 0x01,
E2K_EXCP_SYSCALL = 0x02,
2020-11-12 14:52:51 +01:00
} Exception;
2020-11-08 19:27:47 +01:00
struct e2k_def_t {
const char *name;
uint32_t isa_version;
};
typedef struct CPUArchState {
2020-10-15 16:08:01 +02:00
/* register file */
target_ulong gregs[32]; // global regs
target_ulong wregs[WREGS_SIZE]; // window regs
2020-11-11 10:28:06 +01:00
target_ulong *win_ptr;
2020-11-10 23:32:28 +01:00
uint64_t pregs;
uint32_t wbs; // Real window regs offset, in bundle it comes divided by 2
uint32_t wsz; // Real window regs size, in bundle it comes divided by 2
uint32_t nfx; // TODO
uint32_t dbl; // TODO
uint32_t rbs; // Real based regs offset, in bundle it comes divided by 2
uint32_t rsz; // Real based regs size, in bundle it comes divided by 2 minus 2
uint32_t rcur; // Real based regs current index, in bundle it comes divided by 2
uint32_t psz; // pred regs window size
uint32_t syscall_wbs;
2020-10-15 16:08:01 +02:00
/* control registers */
2020-11-10 23:32:28 +01:00
target_ulong ctprs[3]; // Control Transfer Preparation Register (CTPR)
2020-10-15 16:08:01 +02:00
/* special registers */
2020-11-10 23:32:28 +01:00
target_ulong ip; /* instruction address, next instruction address */
2020-10-15 16:08:01 +02:00
uint32_t pfpfr; // Packed Floating Point Flag Register (PFPFR)
uint32_t fpcr; // Floating point control register (FPCR)
uint32_t fpsr; // Floating point state register (FPSR)
2020-11-08 19:27:47 +01:00
int interrupt_index;
/* Fields up to this point are cleared by a CPU reset */
struct {} end_reset_fields;
uint32_t version;
struct e2k_def_t def;
} CPUE2KState;
2020-10-15 16:08:01 +02:00
/**
* E2KCPU:
* @env: #CPUE2KState
*
* An Elbrus CPU.
*/
struct ArchCPU {
2020-10-15 16:08:01 +02:00
/*< private >*/
CPUState parent_obj;
/*< public >*/
CPUNegativeOffsetState neg;
CPUE2KState env;
};
2020-11-08 19:27:47 +01:00
static inline void cpu_get_tb_cpu_state(CPUE2KState *env, target_ulong *pc,
target_ulong *cs_base, uint32_t *pflags)
{
*pc = env->ip;
2020-11-10 23:32:28 +01:00
*cs_base = 0;
2020-11-08 19:27:47 +01:00
*pflags = MMU_USER_IDX;
}
static inline int cpu_mmu_index(CPUE2KState *env, bool ifetch)
{
#ifdef CONFIG_USER_ONLY
return MMU_USER_IDX;
#else
#error softmmu is not supported on E2K
#endif
}
int e2k_cpu_signal_handler(int host_signum, void *pinfo, void *puc);
#define cpu_signal_handler e2k_cpu_signal_handler
#include "exec/cpu-all.h"
2020-10-15 16:08:01 +02:00
#endif