[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 38/45] target/hppa: Implement a pause instruction
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v3 38/45] target/hppa: Implement a pause instruction |
Date: |
Wed, 24 Jan 2018 15:26:18 -0800 |
This is an extension to the base ISA, but we can use this in
the kernel idle loop to reduce the host cpu time consumed.
Signed-off-by: Richard Henderson <address@hidden>
---
target/hppa/translate.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index cf67ca026e..d84090d479 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -2826,9 +2826,45 @@ static DisasJumpType trans_ds(DisasContext *ctx,
uint32_t insn,
return nullify_end(ctx, DISAS_NEXT);
}
+#ifndef CONFIG_USER_ONLY
+/* These are QEMU extensions and are nops in the real architecture:
+ *
+ * or %r10,%r10,%r10 -- idle loop; wait for interrupt
+ * or %r31,%r31,%r31 -- death loop; offline cpu
+ * currently implemented as idle.
+ */
+static DisasJumpType trans_pause(DisasContext *ctx, uint32_t insn,
+ const DisasInsn *di)
+{
+ TCGv_i32 tmp;
+
+ /* No need to check for supervisor, as userland can only pause
+ until the next timer interrupt. */
+ nullify_over(ctx);
+
+ /* Advance the instruction queue. */
+ copy_iaoq_entry(cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b);
+ copy_iaoq_entry(cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var);
+ nullify_set(ctx, 0);
+
+ /* Tell the qemu main loop to halt until this cpu has work. */
+ tmp = tcg_const_i32(1);
+ tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) +
+ offsetof(CPUState, halted));
+ tcg_temp_free_i32(tmp);
+ gen_excp_1(EXCP_HALTED);
+
+ return nullify_end(ctx, DISAS_NORETURN);
+}
+#endif
+
static const DisasInsn table_arith_log[] = {
{ 0x08000240u, 0xfc00ffffu, trans_nop }, /* or x,y,0 */
{ 0x08000240u, 0xffe0ffe0u, trans_copy }, /* or x,0,t */
+#ifndef CONFIG_USER_ONLY
+ { 0x094a024au, 0xffffffffu, trans_pause }, /* or r10,r10,r10 */
+ { 0x0bff025fu, 0xffffffffu, trans_pause }, /* or r31,r31,r31 */
+#endif
{ 0x08000000u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_andc_reg },
{ 0x08000200u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_and_reg },
{ 0x08000240u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_or_reg },
--
2.14.3
- [Qemu-devel] [PATCH v3 27/45] target/hppa: Implement halt and reset instructions, (continued)
- [Qemu-devel] [PATCH v3 27/45] target/hppa: Implement halt and reset instructions, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 28/45] target/hppa: Optimize for flat addressing space, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 31/45] target/hppa: Implement B,GATE insn, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 29/45] target/hppa: Add system registers to gdbstub, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 30/45] target/hppa: Add migration for the cpu, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 33/45] qom: Add MMU_DEBUG_LOAD, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 32/45] target/hppa: Only use EXCP_DTLB_MISS, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 34/45] target/hppa: Use MMU_DEBUG_LOAD when reloading for CR[IIR], Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 35/45] target/hppa: Increase number of temp regs, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 36/45] target/hppa: Fix comment, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 38/45] target/hppa: Implement a pause instruction,
Richard Henderson <=
- [Qemu-devel] [PATCH v3 39/45] target/hppa: Implement STWA, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 37/45] target/hppa: Implement LDSID for system mode, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 40/45] target/hppa: Enable MTTCG, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 41/45] hw/hppa: Implement DINO system board, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 44/45] target/hppa: Fix 32-bit operand masks for 0E FCVT, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 43/45] hw/hppa: Add MAINTAINERS entry, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 45/45] target/hppa: Implement PROBE for system mode, Richard Henderson, 2018/01/24
- [Qemu-devel] [PATCH v3 42/45] pc-bios: Add hppa-firmware.img and git submodule, Richard Henderson, 2018/01/24