e2k: set default procedure stack size to page size
This commit is contained in:
parent
b3a68870d5
commit
8e133a3e89
@ -18,7 +18,7 @@
|
||||
/* double-NRs */
|
||||
|
||||
#define E2K_DEFAULT_PCS_SIZE (TARGET_PAGE_SIZE)
|
||||
#define E2K_DEFAULT_PS_SIZE (TARGET_PAGE_SIZE * 4)
|
||||
#define E2K_DEFAULT_PS_SIZE (TARGET_PAGE_SIZE)
|
||||
|
||||
typedef uint64_t e2k_greg_t; // double word
|
||||
|
||||
|
@ -143,18 +143,6 @@ static void crs_read(CPUE2KState *env, target_ulong addr, E2KCrs *crs)
|
||||
crs->cr1.hi = cpu_ldq_le_data(env, addr + offsetof(E2KCrs, cr1.hi));
|
||||
}
|
||||
|
||||
static void pcs_push(CPUE2KState *env, E2KCrs *crs)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
if ((env->pcsp.index + sizeof(E2KCrs) * 2) > env->pcsp.size) {
|
||||
raise_exception(env, E2K_EXCP_CHAIN_STACK_BOUNDS);
|
||||
}
|
||||
#endif
|
||||
|
||||
env->pcsp.index += sizeof(E2KCrs);
|
||||
crs_write(env, env->pcsp.base + env->pcsp.index, crs);
|
||||
}
|
||||
|
||||
static void pcs_pop(CPUE2KState *env, E2KCrs *crs)
|
||||
{
|
||||
crs_read(env, env->pcsp.base + env->pcsp.index, crs);
|
||||
@ -171,6 +159,10 @@ void e2k_proc_call(CPUE2KState *env, int base, target_ulong ret_ip,
|
||||
{
|
||||
E2KCrs crs;
|
||||
|
||||
if ((env->pcsp.size - env->pcsp.index) <= (sizeof(E2KCrs) * 2)) {
|
||||
raise_exception_ra(env, E2K_EXCP_CHAIN_STACK_BOUNDS, GETPC());
|
||||
}
|
||||
|
||||
crs.cr0_lo = env->pregs;
|
||||
crs.cr0_hi = ret_ip & ~7;
|
||||
crs.cr1.wbs = base / 2;
|
||||
@ -182,7 +174,9 @@ void e2k_proc_call(CPUE2KState *env, int base, target_ulong ret_ip,
|
||||
crs.cr1.br = env_br_get(env);
|
||||
crs.cr1.ussz = env->usd.size >> 4;
|
||||
|
||||
pcs_push(env, &crs);
|
||||
env->pcsp.index += sizeof(E2KCrs);
|
||||
crs_write(env, env->pcsp.base + env->pcsp.index, &crs);
|
||||
|
||||
callee_window(env, base, env->wd.size, env->wd.fx || force_fx);
|
||||
|
||||
env->wd.fx = true;
|
||||
@ -236,19 +230,6 @@ void HELPER(call)(CPUE2KState *env, uint64_t ctpr_raw, int call_wbs,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
void HELPER(expand_stacks)(CPUE2KState *env)
|
||||
{
|
||||
if ((env->psp.size - env->psp.index) <= (E2K_REG_LEN * E2K_NR_COUNT * 4)) {
|
||||
raise_exception_ra(env, E2K_EXCP_PROC_STACK_BOUNDS, GETPC());
|
||||
}
|
||||
|
||||
if ((env->pcsp.size - env->pcsp.index) <= (sizeof(E2KCrs) * 2)) {
|
||||
raise_exception_ra(env, E2K_EXCP_CHAIN_STACK_BOUNDS, GETPC());
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_USER_ONLY */
|
||||
|
||||
uint64_t HELPER(prep_return)(CPUE2KState *env, int ipd)
|
||||
{
|
||||
E2KCtpr ret = { 0 };
|
||||
@ -329,6 +310,10 @@ void HELPER(setwd)(CPUE2KState *env, int size, int nfx, int dbl)
|
||||
raise_exception(env, E2K_EXCP_ILLEGAL_OPCODE);
|
||||
}
|
||||
|
||||
if ((env->psp.size - env->psp.index) <= (E2K_REG_LEN * E2K_NR_COUNT * 4)) {
|
||||
raise_exception_ra(env, E2K_EXCP_PROC_STACK_BOUNDS, GETPC());
|
||||
}
|
||||
|
||||
env->wd.size = size;
|
||||
env->wd.fx = nfx == 0;
|
||||
env->wdbl = dbl;
|
||||
|
@ -2,9 +2,6 @@
|
||||
#define vec i128
|
||||
|
||||
DEF_HELPER_2(raise_exception, noreturn, env, int)
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
DEF_HELPER_1(expand_stacks, void, env)
|
||||
#endif
|
||||
|
||||
DEF_HELPER_4(call, void, env, i64, int, tl)
|
||||
DEF_HELPER_2(prep_return, i64, env, int)
|
||||
|
@ -7698,13 +7698,6 @@ static void e2k_tr_translate_insn(DisasContextBase *db, CPUState *cs)
|
||||
default:
|
||||
{
|
||||
pc_next = do_decode(ctx, cs);
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
if (ctx->cs1.type == CS1_CALL) {
|
||||
gen_save_cpu_state(ctx);
|
||||
gen_helper_expand_stacks(tcg_env);
|
||||
}
|
||||
#endif /* CONFIG_USER_ONLY */
|
||||
|
||||
ctx->loop_mode = (ctx->bundle.hs & (1 << 10)) != 0;
|
||||
if (validate_bundle(ctx)) {
|
||||
gen_setwd(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user