target-alpha: Move palcode support helpers to sys_helper.c.
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
2958620f67
commit
69163fbb0c
@ -96,7 +96,7 @@ libobj-y += cpu_init.o
|
||||
endif
|
||||
libobj-$(TARGET_SPARC) += int32_helper.o
|
||||
libobj-$(TARGET_SPARC64) += int64_helper.o
|
||||
libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o
|
||||
libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o
|
||||
|
||||
libobj-y += disas.o
|
||||
libobj-$(CONFIG_TCI_DIS) += tci-dis.o
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "def-helper.h"
|
||||
|
||||
DEF_HELPER_3(excp, void, env, int, int)
|
||||
DEF_HELPER_FLAGS_0(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64)
|
||||
DEF_HELPER_FLAGS_1(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64, env)
|
||||
|
||||
DEF_HELPER_3(addqv, i64, env, i64, i64)
|
||||
DEF_HELPER_3(addlv, i64, env, i64, i64)
|
||||
@ -100,7 +100,7 @@ DEF_HELPER_2(ieee_input_cmp, i64, env, i64)
|
||||
DEF_HELPER_2(ieee_input_s, i64, env, i64)
|
||||
|
||||
#if !defined (CONFIG_USER_ONLY)
|
||||
DEF_HELPER_1(hw_ret, void, i64)
|
||||
DEF_HELPER_2(hw_ret, void, env, i64)
|
||||
|
||||
DEF_HELPER_1(ldl_phys, i64, i64)
|
||||
DEF_HELPER_1(ldq_phys, i64, i64)
|
||||
@ -111,13 +111,13 @@ DEF_HELPER_2(stq_phys, void, i64, i64)
|
||||
DEF_HELPER_2(stl_c_phys, i64, i64, i64)
|
||||
DEF_HELPER_2(stq_c_phys, i64, i64, i64)
|
||||
|
||||
DEF_HELPER_FLAGS_0(tbia, TCG_CALL_CONST, void)
|
||||
DEF_HELPER_FLAGS_1(tbis, TCG_CALL_CONST, void, i64)
|
||||
DEF_HELPER_FLAGS_1(tbia, TCG_CALL_CONST, void, env)
|
||||
DEF_HELPER_FLAGS_2(tbis, TCG_CALL_CONST, void, env, i64)
|
||||
|
||||
DEF_HELPER_1(halt, void, i64);
|
||||
|
||||
DEF_HELPER_FLAGS_0(get_time, TCG_CALL_CONST, i64)
|
||||
DEF_HELPER_FLAGS_1(set_alarm, TCG_CALL_CONST, void, i64)
|
||||
DEF_HELPER_FLAGS_2(set_alarm, TCG_CALL_CONST, void, env, i64)
|
||||
#endif
|
||||
|
||||
#include "def-helper.h"
|
||||
|
@ -25,71 +25,6 @@
|
||||
#include "sysemu.h"
|
||||
#include "qemu-timer.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Exceptions processing helpers */
|
||||
|
||||
uint64_t helper_load_pcc (void)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* In system mode we have access to a decent high-resolution clock.
|
||||
In order to make OS-level time accounting work with the RPCC,
|
||||
present it with a well-timed clock fixed at 250MHz. */
|
||||
return (((uint64_t)env->pcc_ofs << 32)
|
||||
| (uint32_t)(qemu_get_clock_ns(vm_clock) >> 2));
|
||||
#else
|
||||
/* In user-mode, vm_clock doesn't exist. Just pass through the host cpu
|
||||
clock ticks. Also, don't bother taking PCC_OFS into account. */
|
||||
return (uint32_t)cpu_get_real_ticks();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* PALcode support special instructions */
|
||||
#if !defined (CONFIG_USER_ONLY)
|
||||
void helper_hw_ret (uint64_t a)
|
||||
{
|
||||
env->pc = a & ~3;
|
||||
env->intr_flag = 0;
|
||||
env->lock_addr = -1;
|
||||
if ((a & 1) == 0) {
|
||||
env->pal_mode = 0;
|
||||
swap_shadow_regs(env);
|
||||
}
|
||||
}
|
||||
|
||||
void helper_tbia(void)
|
||||
{
|
||||
tlb_flush(env, 1);
|
||||
}
|
||||
|
||||
void helper_tbis(uint64_t p)
|
||||
{
|
||||
tlb_flush_page(env, p);
|
||||
}
|
||||
|
||||
void helper_halt(uint64_t restart)
|
||||
{
|
||||
if (restart) {
|
||||
qemu_system_reset_request();
|
||||
} else {
|
||||
qemu_system_shutdown_request();
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t helper_get_time(void)
|
||||
{
|
||||
return qemu_get_clock_ns(rtc_clock);
|
||||
}
|
||||
|
||||
void helper_set_alarm(uint64_t expire)
|
||||
{
|
||||
if (expire) {
|
||||
env->alarm_expire = expire;
|
||||
qemu_mod_timer(env->alarm_timer, expire);
|
||||
} else {
|
||||
qemu_del_timer(env->alarm_timer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Softmmu support */
|
||||
|
87
target-alpha/sys_helper.c
Normal file
87
target-alpha/sys_helper.c
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Helpers for system instructions.
|
||||
*
|
||||
* Copyright (c) 2007 Jocelyn Mayer
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cpu.h"
|
||||
#include "helper.h"
|
||||
#include "sysemu.h"
|
||||
#include "qemu-timer.h"
|
||||
|
||||
|
||||
uint64_t helper_load_pcc(CPUAlphaState *env)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* In system mode we have access to a decent high-resolution clock.
|
||||
In order to make OS-level time accounting work with the RPCC,
|
||||
present it with a well-timed clock fixed at 250MHz. */
|
||||
return (((uint64_t)env->pcc_ofs << 32)
|
||||
| (uint32_t)(qemu_get_clock_ns(vm_clock) >> 2));
|
||||
#else
|
||||
/* In user-mode, vm_clock doesn't exist. Just pass through the host cpu
|
||||
clock ticks. Also, don't bother taking PCC_OFS into account. */
|
||||
return (uint32_t)cpu_get_real_ticks();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* PALcode support special instructions */
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
void helper_hw_ret(CPUAlphaState *env, uint64_t a)
|
||||
{
|
||||
env->pc = a & ~3;
|
||||
env->intr_flag = 0;
|
||||
env->lock_addr = -1;
|
||||
if ((a & 1) == 0) {
|
||||
env->pal_mode = 0;
|
||||
swap_shadow_regs(env);
|
||||
}
|
||||
}
|
||||
|
||||
void helper_tbia(CPUAlphaState *env)
|
||||
{
|
||||
tlb_flush(env, 1);
|
||||
}
|
||||
|
||||
void helper_tbis(CPUAlphaState *env, uint64_t p)
|
||||
{
|
||||
tlb_flush_page(env, p);
|
||||
}
|
||||
|
||||
void helper_halt(uint64_t restart)
|
||||
{
|
||||
if (restart) {
|
||||
qemu_system_reset_request();
|
||||
} else {
|
||||
qemu_system_shutdown_request();
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t helper_get_time(void)
|
||||
{
|
||||
return qemu_get_clock_ns(rtc_clock);
|
||||
}
|
||||
|
||||
void helper_set_alarm(CPUAlphaState *env, uint64_t expire)
|
||||
{
|
||||
if (expire) {
|
||||
env->alarm_expire = expire;
|
||||
qemu_mod_timer(env->alarm_timer, expire);
|
||||
} else {
|
||||
qemu_del_timer(env->alarm_timer);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_USER_ONLY */
|
@ -1678,12 +1678,12 @@ static ExitStatus gen_mtpr(DisasContext *ctx, int rb, int regno)
|
||||
switch (regno) {
|
||||
case 255:
|
||||
/* TBIA */
|
||||
gen_helper_tbia();
|
||||
gen_helper_tbia(cpu_env);
|
||||
break;
|
||||
|
||||
case 254:
|
||||
/* TBIS */
|
||||
gen_helper_tbis(tmp);
|
||||
gen_helper_tbis(cpu_env, tmp);
|
||||
break;
|
||||
|
||||
case 253:
|
||||
@ -1699,7 +1699,7 @@ static ExitStatus gen_mtpr(DisasContext *ctx, int rb, int regno)
|
||||
|
||||
case 251:
|
||||
/* ALARM */
|
||||
gen_helper_set_alarm(tmp);
|
||||
gen_helper_set_alarm(cpu_env, tmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2793,11 +2793,11 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
|
||||
if (ra != 31) {
|
||||
if (use_icount) {
|
||||
gen_io_start();
|
||||
gen_helper_load_pcc(cpu_ir[ra]);
|
||||
gen_helper_load_pcc(cpu_ir[ra], cpu_env);
|
||||
gen_io_end();
|
||||
ret = EXIT_PC_STALE;
|
||||
} else {
|
||||
gen_helper_load_pcc(cpu_ir[ra]);
|
||||
gen_helper_load_pcc(cpu_ir[ra], cpu_env);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3143,10 +3143,10 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
|
||||
emulation PALcode, so continue to accept it. */
|
||||
TCGv tmp = tcg_temp_new();
|
||||
tcg_gen_ld_i64(tmp, cpu_env, offsetof(CPUAlphaState, exc_addr));
|
||||
gen_helper_hw_ret(tmp);
|
||||
gen_helper_hw_ret(cpu_env, tmp);
|
||||
tcg_temp_free(tmp);
|
||||
} else {
|
||||
gen_helper_hw_ret(cpu_ir[rb]);
|
||||
gen_helper_hw_ret(cpu_env, cpu_ir[rb]);
|
||||
}
|
||||
ret = EXIT_PC_UPDATED;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user