e2k: use separate array for global regs
This commit is contained in:
parent
cecd5ff38b
commit
7019241cc9
|
@ -226,9 +226,9 @@ static void target_setup_frame(int sig, struct target_sigaction *ka,
|
||||||
__put_user(env->ilcr, &frame->ilcr);
|
__put_user(env->ilcr, &frame->ilcr);
|
||||||
__put_user(env->ilcr_lcnt, &frame->ilcr_lcnt);
|
__put_user(env->ilcr_lcnt, &frame->ilcr_lcnt);
|
||||||
copy_to_user(frame_addr + offsetof(struct target_sigframe, gregs),
|
copy_to_user(frame_addr + offsetof(struct target_sigframe, gregs),
|
||||||
&env->regs[E2K_NR_COUNT + 16], 16 * sizeof(E2KReg));
|
&env->greg[16], 16 * sizeof(E2KReg));
|
||||||
copy_to_user(frame_addr + offsetof(struct target_sigframe, gtags),
|
copy_to_user(frame_addr + offsetof(struct target_sigframe, gtags),
|
||||||
&env->tags[E2K_NR_COUNT + 16], 16);
|
&env->gtag[16], 16);
|
||||||
|
|
||||||
if (ka->sa_flags & TARGET_SA_RESTORER) {
|
if (ka->sa_flags & TARGET_SA_RESTORER) {
|
||||||
// TODO: sa_restorer?
|
// TODO: sa_restorer?
|
||||||
|
@ -329,9 +329,9 @@ long do_rt_sigreturn(CPUE2KState *env)
|
||||||
__get_user(env->lsr_lcnt, &frame->lsr_lcnt);
|
__get_user(env->lsr_lcnt, &frame->lsr_lcnt);
|
||||||
__get_user(env->ilcr, &frame->ilcr);
|
__get_user(env->ilcr, &frame->ilcr);
|
||||||
__get_user(env->ilcr_lcnt, &frame->ilcr_lcnt);
|
__get_user(env->ilcr_lcnt, &frame->ilcr_lcnt);
|
||||||
copy_from_user(&env->regs[E2K_NR_COUNT + 16], frame_addr
|
copy_from_user(&env->greg[16], frame_addr
|
||||||
+ offsetof(struct target_sigframe, gregs), 16 * sizeof(E2KReg));
|
+ offsetof(struct target_sigframe, gregs), 16 * sizeof(E2KReg));
|
||||||
copy_from_user(&env->tags[E2K_NR_COUNT + 16], frame_addr
|
copy_from_user(&env->gtag[16], frame_addr
|
||||||
+ offsetof(struct target_sigframe, gtags), 16);
|
+ offsetof(struct target_sigframe, gtags), 16);
|
||||||
|
|
||||||
if (do_sigaltstack(frame_addr +
|
if (do_sigaltstack(frame_addr +
|
||||||
|
|
|
@ -72,12 +72,12 @@ static inline void cpu_clone_regs_parent(CPUE2KState *env, unsigned flags)
|
||||||
|
|
||||||
static inline void cpu_set_tls(CPUE2KState *env, target_ulong newtls)
|
static inline void cpu_set_tls(CPUE2KState *env, target_ulong newtls)
|
||||||
{
|
{
|
||||||
env->regs[E2K_TLS_REG].lo = newtls;
|
env->greg[E2K_TLS_REG].lo = newtls;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline target_ulong cpu_get_tls(CPUE2KState *env)
|
static inline target_ulong cpu_get_tls(CPUE2KState *env)
|
||||||
{
|
{
|
||||||
return env->regs[E2K_TLS_REG].lo;
|
return env->greg[E2K_TLS_REG].lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline abi_ulong get_sp_from_cpustate(CPUE2KState *env)
|
static inline abi_ulong get_sp_from_cpustate(CPUE2KState *env)
|
||||||
|
|
|
@ -136,8 +136,7 @@ static void dump_regs(CPUE2KState *env, FILE *f, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
int index = E2K_NR_COUNT + i;
|
dump_reg(f, 'g', i, env->gtag[i], env->greg[i]);
|
||||||
dump_reg(f, 'g', i, env->tags[index], env->regs[index]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,7 @@ void e2k_tcg_initialize(void);
|
||||||
#define E2K_WR_COUNT 64 /* %rN [0, 64) */
|
#define E2K_WR_COUNT 64 /* %rN [0, 64) */
|
||||||
#define E2K_BR_COUNT 128 /* %b[N] [0, 128) */
|
#define E2K_BR_COUNT 128 /* %b[N] [0, 128) */
|
||||||
#define E2K_NR_COUNT 224
|
#define E2K_NR_COUNT 224
|
||||||
#define E2K_GR_COUNT 32 /* %gN [0, 32) */
|
#define E2K_TLS_REG 13
|
||||||
#define E2K_BGR_COUNT 8 /* %gN [24, 32) */
|
|
||||||
#define E2K_REG_COUNT (E2K_NR_COUNT + E2K_GR_COUNT)
|
|
||||||
#define E2K_TLS_REG (E2K_NR_COUNT + 13)
|
|
||||||
|
|
||||||
#define E2K_PR_COUNT 32 /* %predN [0, 32) */
|
#define E2K_PR_COUNT 32 /* %predN [0, 32) */
|
||||||
|
|
||||||
|
@ -787,10 +784,12 @@ typedef union {
|
||||||
} E2KWinInfo;
|
} E2KWinInfo;
|
||||||
|
|
||||||
typedef struct CPUArchState {
|
typedef struct CPUArchState {
|
||||||
/* Registers Tags File */
|
/* Window registers */
|
||||||
uint8_t tags[E2K_REG_COUNT];
|
E2KReg regs[E2K_NR_COUNT];
|
||||||
/* Registers File */
|
uint8_t tags[E2K_NR_COUNT];
|
||||||
E2KReg regs[E2K_REG_COUNT];
|
/* Global registers */
|
||||||
|
uint8_t gtag[32];
|
||||||
|
E2KReg greg[32];
|
||||||
/* Predicate Registers File */
|
/* Predicate Registers File */
|
||||||
uint64_t pregs;
|
uint64_t pregs;
|
||||||
/* Instruction Address */
|
/* Instruction Address */
|
||||||
|
|
|
@ -49,7 +49,7 @@ int e2k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (3 <= n && n < 35) {
|
if (3 <= n && n < 35) {
|
||||||
return gdb_get_reg64(mem_buf, env->regs[E2K_NR_COUNT + n - 3].lo);
|
return gdb_get_reg64(mem_buf, env->greg[n - 3].lo);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
|
@ -202,20 +202,20 @@ int e2k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||||
|
|
||||||
if (356 <= n && n < 360) {
|
if (356 <= n && n < 360) {
|
||||||
uint64_t tags = 0;
|
uint64_t tags = 0;
|
||||||
int i, offset = E2K_NR_COUNT + (n - 356) * 8;
|
int i, offset = (n - 356) * 8;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
tags |= (uint64_t) env->tags[offset + i] << (i * 8);
|
tags |= (uint64_t) env->gtag[offset + i] << (i * 8);
|
||||||
}
|
}
|
||||||
return gdb_get_reg64(mem_buf, tags); // gN tags (tag len is 1 byte)
|
return gdb_get_reg64(mem_buf, tags); // gN tags (tag len is 1 byte)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (360 <= n && n < 368) {
|
if (360 <= n && n < 368) {
|
||||||
uint64_t ext = 0;
|
uint64_t ext = 0;
|
||||||
int i, offset = E2K_NR_COUNT + (n - 360) * 4;
|
int i, offset = (n - 360) * 4;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
ext |= ((uint64_t) env->regs[offset + i].hi & 0xffff) << (i * 16);
|
ext |= ((uint64_t) env->greg[offset + i].hi & 0xffff) << (i * 16);
|
||||||
}
|
}
|
||||||
return gdb_get_reg64(mem_buf, ext); // xgN
|
return gdb_get_reg64(mem_buf, ext); // xgN
|
||||||
}
|
}
|
||||||
|
@ -343,10 +343,10 @@ static int gdb_get_v5(CPUE2KState *env, GByteArray *buf, int n)
|
||||||
return gdb_get_reg64(buf, env->ilcr_lcnt);
|
return gdb_get_reg64(buf, env->ilcr_lcnt);
|
||||||
} else if (n >= 2 && n < 34) {
|
} else if (n >= 2 && n < 34) {
|
||||||
/* xgN (upper 64-bit) */
|
/* xgN (upper 64-bit) */
|
||||||
return gdb_get_reg64(buf, env->regs[E2K_NR_COUNT + n - 2].hi);
|
return gdb_get_reg64(buf, env->greg[n - 2].hi);
|
||||||
} else if (n >= 34 && n < 66) {
|
} else if (n >= 34 && n < 66) {
|
||||||
/* qpgN tags */
|
/* qpgN tags */
|
||||||
return gdb_get_reg8(buf, env->tags[E2K_NR_COUNT + n - 34]);
|
return gdb_get_reg8(buf, env->gtag[n - 34]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1372,12 +1372,12 @@ static Tagged gen_reg(DisasContext *ctx, TaggedKind kind, uint8_t reg)
|
||||||
tag_ptr = cpu_env;
|
tag_ptr = cpu_env;
|
||||||
tag_offset = offsetof(CPUE2KState, tags[index]);
|
tag_offset = offsetof(CPUE2KState, tags[index]);
|
||||||
} else if (IS_GLOBAL(reg)) {
|
} else if (IS_GLOBAL(reg)) {
|
||||||
index = GET_GLOBAL(reg) + E2K_NR_COUNT;
|
index = GET_GLOBAL(reg);
|
||||||
reg_ptr = cpu_env;
|
reg_ptr = cpu_env;
|
||||||
offset_lo = offsetof(CPUE2KState, regs[index].lo);
|
offset_lo = offsetof(CPUE2KState, greg[index].lo);
|
||||||
offset_hi = offsetof(CPUE2KState, regs[index].hi);
|
offset_hi = offsetof(CPUE2KState, greg[index].hi);
|
||||||
tag_ptr = cpu_env;
|
tag_ptr = cpu_env;
|
||||||
tag_offset = offsetof(CPUE2KState, tags[index]);
|
tag_offset = offsetof(CPUE2KState, gtag[index]);
|
||||||
} else {
|
} else {
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
|
@ -1460,12 +1460,12 @@ static void gen_set_reg(DisasContext *ctx, Tagged *value, uint8_t reg)
|
||||||
tag_ptr = cpu_env;
|
tag_ptr = cpu_env;
|
||||||
tag_offset = offsetof(CPUE2KState, tags[index]);
|
tag_offset = offsetof(CPUE2KState, tags[index]);
|
||||||
} else if (IS_GLOBAL(reg)) {
|
} else if (IS_GLOBAL(reg)) {
|
||||||
index = GET_GLOBAL(reg) + E2K_NR_COUNT;
|
index = GET_GLOBAL(reg);
|
||||||
reg_ptr = cpu_env;
|
reg_ptr = cpu_env;
|
||||||
offset_lo = offsetof(CPUE2KState, regs[index].lo);
|
offset_lo = offsetof(CPUE2KState, greg[index].lo);
|
||||||
offset_hi = offsetof(CPUE2KState, regs[index].hi);
|
offset_hi = offsetof(CPUE2KState, greg[index].hi);
|
||||||
tag_ptr = cpu_env;
|
tag_ptr = cpu_env;
|
||||||
tag_offset = offsetof(CPUE2KState, tags[index]);
|
tag_offset = offsetof(CPUE2KState, gtag[index]);
|
||||||
} else {
|
} else {
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue