2016-12-15 22:26:14 +03:00
|
|
|
/*
|
|
|
|
* PA-RISC emulation cpu definitions for qemu.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016 Richard Henderson <rth@twiddle.net>
|
|
|
|
*
|
|
|
|
* 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
|
2020-10-23 15:33:53 +03:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2016-12-15 22:26:14 +03:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HPPA_CPU_H
|
|
|
|
#define HPPA_CPU_H
|
|
|
|
|
|
|
|
#include "cpu-qom.h"
|
2019-03-22 21:51:19 +03:00
|
|
|
#include "exec/cpu-defs.h"
|
2022-03-23 18:57:39 +03:00
|
|
|
#include "qemu/cpu-float.h"
|
2023-10-27 08:21:47 +03:00
|
|
|
#include "qemu/interval-tree.h"
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2018-01-07 03:02:27 +03:00
|
|
|
/* PA-RISC 1.x processors have a strong memory model. */
|
|
|
|
/* ??? While we do not yet implement PA-RISC 2.0, those processors have
|
|
|
|
a weak memory model, but with TLB bits that force ordering on a per-page
|
|
|
|
basis. It's probably easier to fall back to a strong memory model. */
|
|
|
|
#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL
|
|
|
|
|
2023-11-07 23:13:17 +03:00
|
|
|
#define MMU_ABS_W_IDX 6
|
|
|
|
#define MMU_ABS_IDX 7
|
|
|
|
#define MMU_KERNEL_IDX 8
|
|
|
|
#define MMU_KERNEL_P_IDX 9
|
|
|
|
#define MMU_PL1_IDX 10
|
|
|
|
#define MMU_PL1_P_IDX 11
|
|
|
|
#define MMU_PL2_IDX 12
|
|
|
|
#define MMU_PL2_P_IDX 13
|
|
|
|
#define MMU_USER_IDX 14
|
|
|
|
#define MMU_USER_P_IDX 15
|
|
|
|
|
|
|
|
#define MMU_IDX_MMU_DISABLED(MIDX) ((MIDX) < MMU_KERNEL_IDX)
|
2023-11-02 01:17:04 +03:00
|
|
|
#define MMU_IDX_TO_PRIV(MIDX) (((MIDX) - MMU_KERNEL_IDX) / 2)
|
|
|
|
#define MMU_IDX_TO_P(MIDX) (((MIDX) - MMU_KERNEL_IDX) & 1)
|
|
|
|
#define PRIV_P_TO_MMU_IDX(PRIV, P) ((PRIV) * 2 + !!(P) + MMU_KERNEL_IDX)
|
2023-08-07 12:32:09 +03:00
|
|
|
|
2023-10-27 12:46:44 +03:00
|
|
|
#define TARGET_INSN_START_EXTRA_WORDS 2
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2023-11-07 23:13:17 +03:00
|
|
|
/* No need to flush MMU_ABS*_IDX */
|
2023-08-07 12:42:11 +03:00
|
|
|
#define HPPA_MMU_FLUSH_MASK \
|
2023-11-02 01:17:04 +03:00
|
|
|
(1 << MMU_KERNEL_IDX | 1 << MMU_KERNEL_P_IDX | \
|
|
|
|
1 << MMU_PL1_IDX | 1 << MMU_PL1_P_IDX | \
|
|
|
|
1 << MMU_PL2_IDX | 1 << MMU_PL2_P_IDX | \
|
|
|
|
1 << MMU_USER_IDX | 1 << MMU_USER_P_IDX)
|
|
|
|
|
2023-11-14 19:09:54 +03:00
|
|
|
/* Indices to flush for access_id changes. */
|
2023-11-02 01:17:04 +03:00
|
|
|
#define HPPA_MMU_FLUSH_P_MASK \
|
|
|
|
(1 << MMU_KERNEL_P_IDX | 1 << MMU_PL1_P_IDX | \
|
|
|
|
1 << MMU_PL2_P_IDX | 1 << MMU_USER_P_IDX)
|
2023-08-07 12:42:11 +03:00
|
|
|
|
2023-07-14 14:23:51 +03:00
|
|
|
/* Hardware exceptions, interrupts, faults, and traps. */
|
2017-10-11 20:03:02 +03:00
|
|
|
#define EXCP_HPMC 1 /* high priority machine check */
|
|
|
|
#define EXCP_POWER_FAIL 2
|
|
|
|
#define EXCP_RC 3 /* recovery counter */
|
|
|
|
#define EXCP_EXT_INTERRUPT 4 /* external interrupt */
|
|
|
|
#define EXCP_LPMC 5 /* low priority machine check */
|
|
|
|
#define EXCP_ITLB_MISS 6 /* itlb miss / instruction page fault */
|
|
|
|
#define EXCP_IMP 7 /* instruction memory protection trap */
|
|
|
|
#define EXCP_ILL 8 /* illegal instruction trap */
|
|
|
|
#define EXCP_BREAK 9 /* break instruction */
|
|
|
|
#define EXCP_PRIV_OPR 10 /* privileged operation trap */
|
|
|
|
#define EXCP_PRIV_REG 11 /* privileged register trap */
|
|
|
|
#define EXCP_OVERFLOW 12 /* signed overflow trap */
|
|
|
|
#define EXCP_COND 13 /* trap-on-condition */
|
|
|
|
#define EXCP_ASSIST 14 /* assist exception trap */
|
|
|
|
#define EXCP_DTLB_MISS 15 /* dtlb miss / data page fault */
|
|
|
|
#define EXCP_NA_ITLB_MISS 16 /* non-access itlb miss */
|
|
|
|
#define EXCP_NA_DTLB_MISS 17 /* non-access dtlb miss */
|
|
|
|
#define EXCP_DMP 18 /* data memory protection trap */
|
|
|
|
#define EXCP_DMB 19 /* data memory break trap */
|
|
|
|
#define EXCP_TLB_DIRTY 20 /* tlb dirty bit trap */
|
|
|
|
#define EXCP_PAGE_REF 21 /* page reference trap */
|
|
|
|
#define EXCP_ASSIST_EMU 22 /* assist emulation trap */
|
|
|
|
#define EXCP_HPT 23 /* high-privilege transfer trap */
|
|
|
|
#define EXCP_LPT 24 /* low-privilege transfer trap */
|
|
|
|
#define EXCP_TB 25 /* taken branch trap */
|
|
|
|
#define EXCP_DMAR 26 /* data memory access rights trap */
|
|
|
|
#define EXCP_DMPI 27 /* data memory protection id trap */
|
|
|
|
#define EXCP_UNALIGN 28 /* unaligned data reference trap */
|
|
|
|
#define EXCP_PER_INTERRUPT 29 /* performance monitor interrupt */
|
|
|
|
|
|
|
|
/* Exceptions for linux-user emulation. */
|
|
|
|
#define EXCP_SYSCALL 30
|
|
|
|
#define EXCP_SYSCALL_LWS 31
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2022-01-06 01:09:04 +03:00
|
|
|
/* Emulated hardware TOC button */
|
|
|
|
#define EXCP_TOC 32 /* TOC = Transfer of control (NMI) */
|
|
|
|
|
|
|
|
#define CPU_INTERRUPT_NMI CPU_INTERRUPT_TGT_EXT_3 /* TOC */
|
|
|
|
|
2017-10-09 02:00:40 +03:00
|
|
|
/* Taken from Linux kernel: arch/parisc/include/asm/psw.h */
|
|
|
|
#define PSW_I 0x00000001
|
|
|
|
#define PSW_D 0x00000002
|
|
|
|
#define PSW_P 0x00000004
|
|
|
|
#define PSW_Q 0x00000008
|
|
|
|
#define PSW_R 0x00000010
|
|
|
|
#define PSW_F 0x00000020
|
|
|
|
#define PSW_G 0x00000040 /* PA1.x only */
|
|
|
|
#define PSW_O 0x00000080 /* PA2.0 only */
|
|
|
|
#define PSW_CB 0x0000ff00
|
|
|
|
#define PSW_M 0x00010000
|
|
|
|
#define PSW_V 0x00020000
|
|
|
|
#define PSW_C 0x00040000
|
|
|
|
#define PSW_B 0x00080000
|
|
|
|
#define PSW_X 0x00100000
|
|
|
|
#define PSW_N 0x00200000
|
|
|
|
#define PSW_L 0x00400000
|
|
|
|
#define PSW_H 0x00800000
|
|
|
|
#define PSW_T 0x01000000
|
|
|
|
#define PSW_S 0x02000000
|
|
|
|
#define PSW_E 0x04000000
|
|
|
|
#define PSW_W 0x08000000 /* PA2.0 only */
|
|
|
|
#define PSW_Z 0x40000000 /* PA1.x only */
|
|
|
|
#define PSW_Y 0x80000000 /* PA1.x only */
|
|
|
|
|
|
|
|
#define PSW_SM (PSW_W | PSW_E | PSW_O | PSW_G | PSW_F \
|
|
|
|
| PSW_R | PSW_Q | PSW_P | PSW_D | PSW_I)
|
|
|
|
|
|
|
|
/* ssm/rsm instructions number PSW_W and PSW_E differently */
|
|
|
|
#define PSW_SM_I PSW_I /* Enable External Interrupts */
|
|
|
|
#define PSW_SM_D PSW_D
|
|
|
|
#define PSW_SM_P PSW_P
|
|
|
|
#define PSW_SM_Q PSW_Q /* Enable Interrupt State Collection */
|
|
|
|
#define PSW_SM_R PSW_R /* Enable Recover Counter Trap */
|
|
|
|
#define PSW_SM_E 0x100
|
|
|
|
#define PSW_SM_W 0x200 /* PA2.0 only : Enable Wide Mode */
|
|
|
|
|
2017-10-11 07:19:34 +03:00
|
|
|
#define CR_RC 0
|
2023-10-17 12:36:37 +03:00
|
|
|
#define CR_PSW_DEFAULT 6 /* see SeaBIOS PDC_PSW firmware call */
|
|
|
|
#define PDC_PSW_WIDE_BIT 2
|
2019-03-11 22:16:00 +03:00
|
|
|
#define CR_PID1 8
|
|
|
|
#define CR_PID2 9
|
|
|
|
#define CR_PID3 12
|
|
|
|
#define CR_PID4 13
|
2017-10-11 07:19:34 +03:00
|
|
|
#define CR_SCRCCR 10
|
|
|
|
#define CR_SAR 11
|
|
|
|
#define CR_IVA 14
|
|
|
|
#define CR_EIEM 15
|
|
|
|
#define CR_IT 16
|
|
|
|
#define CR_IIASQ 17
|
|
|
|
#define CR_IIAOQ 18
|
|
|
|
#define CR_IIR 19
|
|
|
|
#define CR_ISR 20
|
|
|
|
#define CR_IOR 21
|
|
|
|
#define CR_IPSW 22
|
|
|
|
#define CR_EIRR 23
|
|
|
|
|
2023-10-27 08:13:12 +03:00
|
|
|
typedef struct HPPATLBEntry {
|
2023-10-27 10:24:30 +03:00
|
|
|
union {
|
|
|
|
IntervalTreeNode itree;
|
|
|
|
struct HPPATLBEntry *unused_next;
|
|
|
|
};
|
2023-10-27 08:21:47 +03:00
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong pa;
|
2023-10-27 11:09:21 +03:00
|
|
|
|
|
|
|
unsigned entry_valid : 1;
|
|
|
|
|
2017-10-27 11:17:12 +03:00
|
|
|
unsigned u : 1;
|
|
|
|
unsigned t : 1;
|
|
|
|
unsigned d : 1;
|
|
|
|
unsigned b : 1;
|
|
|
|
unsigned ar_type : 3;
|
|
|
|
unsigned ar_pl1 : 2;
|
|
|
|
unsigned ar_pl2 : 2;
|
|
|
|
unsigned access_id : 16;
|
2023-10-27 08:13:12 +03:00
|
|
|
} HPPATLBEntry;
|
2017-10-27 11:17:12 +03:00
|
|
|
|
2022-02-07 15:35:58 +03:00
|
|
|
typedef struct CPUArchState {
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong iaoq_f; /* front */
|
|
|
|
target_ulong iaoq_b; /* back, aka next instruction */
|
target/hppa: Move iaoq registers and thus reduce generated code size
On hppa the Instruction Address Offset Queue (IAOQ) registers specifies
the next to-be-executed instructions addresses. Each generated TB writes those
registers at least once, so those registers are used heavily in generated
code.
Looking at the generated assembly, for a x86-64 host this code
to write the address $0x7ffe826f into iaoq_f is generated:
0x7f73e8000184: c7 85 d4 01 00 00 6f 82 movl $0x7ffe826f, 0x1d4(%rbp)
0x7f73e800018c: fe 7f
0x7f73e800018e: c7 85 d8 01 00 00 73 82 movl $0x7ffe8273, 0x1d8(%rbp)
0x7f73e8000196: fe 7f
With the trivial change, by moving the variables iaoq_f and iaoq_b to
the top of struct CPUArchState, the offset to %rbp is reduced (from
0x1d4 to 0), which allows the x86-64 tcg to generate 3 bytes less of
generated code per move instruction:
0x7fc1e800018c: c7 45 00 6f 82 fe 7f movl $0x7ffe826f, (%rbp)
0x7fc1e8000193: c7 45 04 73 82 fe 7f movl $0x7ffe8273, 4(%rbp)
Overall this is a reduction of generated code (not a reduction of
number of instructions).
A test run with checks the generated code size by running "/bin/ls"
with qemu-user shows that the code size shrinks from 1616767 to 1569273
bytes, which is ~97% of the former size.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: qemu-stable@nongnu.org
2023-07-30 19:30:19 +03:00
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong gr[32];
|
2016-12-15 22:26:14 +03:00
|
|
|
uint64_t fr[32];
|
2017-10-10 08:54:12 +03:00
|
|
|
uint64_t sr[8]; /* stored shifted into place for gva */
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong psw; /* All psw bits except the following: */
|
|
|
|
target_ulong psw_n; /* boolean */
|
|
|
|
target_long psw_v; /* in most significant bit */
|
2016-12-15 22:26:14 +03:00
|
|
|
|
|
|
|
/* Splitting the carry-borrow field into the MSB and "the rest", allows
|
|
|
|
* for "the rest" to be deleted when it is unused, but the MSB is in use.
|
|
|
|
* In addition, it's easier to compute carry-in for bit B+1 than it is to
|
|
|
|
* compute carry-out for bit B (3 vs 4 insns for addition, assuming the
|
|
|
|
* host has the appropriate add-with-carry insn to compute the msb).
|
|
|
|
* Therefore the carry bits are stored as: cb_msb : cb & 0x11111110.
|
|
|
|
*/
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong psw_cb; /* in least significant bit of next nibble */
|
|
|
|
target_ulong psw_cb_msb; /* boolean */
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2017-10-22 08:53:35 +03:00
|
|
|
uint64_t iasq_f;
|
|
|
|
uint64_t iasq_b;
|
2016-12-15 22:26:14 +03:00
|
|
|
|
|
|
|
uint32_t fr0_shadow; /* flags, c, ca/cq, rm, d, enables */
|
|
|
|
float_status fp_status;
|
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong cr[32]; /* control registers */
|
|
|
|
target_ulong cr_back[2]; /* back of cr17/cr18 */
|
|
|
|
target_ulong shadow[7]; /* shadow registers */
|
2017-10-11 07:19:34 +03:00
|
|
|
|
2023-10-27 12:46:44 +03:00
|
|
|
/*
|
|
|
|
* During unwind of a memory insn, the base register of the address.
|
|
|
|
* This is used to construct CR_IOR for pa2.0.
|
|
|
|
*/
|
|
|
|
uint32_t unwind_breg;
|
|
|
|
|
2023-10-13 03:46:55 +03:00
|
|
|
/*
|
|
|
|
* ??? The number of entries isn't specified by the architecture.
|
|
|
|
* BTLBs are not supported in 64-bit machines.
|
|
|
|
*/
|
|
|
|
#define PA10_BTLB_FIXED 16
|
|
|
|
#define PA10_BTLB_VARIABLE 0
|
2020-08-27 14:10:32 +03:00
|
|
|
#define HPPA_TLB_ENTRIES 256
|
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
/* Index for round-robin tlb eviction. */
|
2017-10-27 11:17:12 +03:00
|
|
|
uint32_t tlb_last;
|
2023-10-27 10:24:30 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* For pa1.x, the partial initialized, still invalid tlb entry
|
|
|
|
* which has had ITLBA performed, but not yet ITLBP.
|
|
|
|
*/
|
|
|
|
HPPATLBEntry *tlb_partial;
|
|
|
|
|
|
|
|
/* Linked list of all invalid (unused) tlb entries. */
|
|
|
|
HPPATLBEntry *tlb_unused;
|
|
|
|
|
|
|
|
/* Root of the search tree for all valid tlb entries. */
|
|
|
|
IntervalTreeRoot tlb_root;
|
|
|
|
|
|
|
|
HPPATLBEntry tlb[HPPA_TLB_ENTRIES];
|
2022-02-07 15:35:58 +03:00
|
|
|
} CPUHPPAState;
|
2016-12-15 22:26:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* HPPACPU:
|
|
|
|
* @env: #CPUHPPAState
|
|
|
|
*
|
|
|
|
* An HPPA CPU.
|
|
|
|
*/
|
2022-02-14 19:15:16 +03:00
|
|
|
struct ArchCPU {
|
2016-12-15 22:26:14 +03:00
|
|
|
CPUState parent_obj;
|
|
|
|
|
|
|
|
CPUHPPAState env;
|
2017-12-29 04:50:14 +03:00
|
|
|
QEMUTimer *alarm_timer;
|
2016-12-15 22:26:14 +03:00
|
|
|
};
|
|
|
|
|
2023-10-13 12:35:04 +03:00
|
|
|
/**
|
|
|
|
* HPPACPUClass:
|
|
|
|
* @parent_realize: The parent class' realize handler.
|
|
|
|
* @parent_reset: The parent class' reset handler.
|
|
|
|
*
|
|
|
|
* An HPPA CPU model.
|
|
|
|
*/
|
|
|
|
struct HPPACPUClass {
|
|
|
|
CPUClass parent_class;
|
|
|
|
|
|
|
|
DeviceRealize parent_realize;
|
|
|
|
DeviceReset parent_reset;
|
|
|
|
};
|
|
|
|
|
2016-12-15 22:26:14 +03:00
|
|
|
#include "exec/cpu-all.h"
|
|
|
|
|
2023-09-18 01:31:47 +03:00
|
|
|
static inline bool hppa_is_pa20(CPUHPPAState *env)
|
|
|
|
{
|
|
|
|
return object_dynamic_cast(OBJECT(env_cpu(env)), TYPE_HPPA64_CPU) != NULL;
|
|
|
|
}
|
|
|
|
|
2023-10-13 03:46:55 +03:00
|
|
|
static inline int HPPA_BTLB_ENTRIES(CPUHPPAState *env)
|
|
|
|
{
|
|
|
|
return hppa_is_pa20(env) ? 0 : PA10_BTLB_FIXED + PA10_BTLB_VARIABLE;
|
|
|
|
}
|
|
|
|
|
2024-01-29 02:22:51 +03:00
|
|
|
int hppa_cpu_mmu_index(CPUState *cs, bool ifetch);
|
2016-12-15 22:26:14 +03:00
|
|
|
static inline int cpu_mmu_index(CPUHPPAState *env, bool ifetch)
|
|
|
|
{
|
2017-10-09 20:17:24 +03:00
|
|
|
#ifdef CONFIG_USER_ONLY
|
|
|
|
return MMU_USER_IDX;
|
|
|
|
#else
|
2024-01-29 02:22:51 +03:00
|
|
|
return hppa_cpu_mmu_index(env_cpu(env), ifetch);
|
2017-10-09 20:17:24 +03:00
|
|
|
#endif
|
2016-12-15 22:26:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void hppa_translate_init(void);
|
|
|
|
|
2018-02-07 13:40:25 +03:00
|
|
|
#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
static inline target_ulong hppa_form_gva_psw(target_ulong psw, uint64_t spc,
|
|
|
|
target_ulong off)
|
2017-10-22 08:53:35 +03:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_USER_ONLY
|
|
|
|
return off;
|
|
|
|
#else
|
2023-09-17 02:52:51 +03:00
|
|
|
off &= psw & PSW_W ? MAKE_64BIT_MASK(0, 62) : MAKE_64BIT_MASK(0, 32);
|
2017-10-22 08:53:35 +03:00
|
|
|
return spc | off;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline target_ulong hppa_form_gva(CPUHPPAState *env, uint64_t spc,
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong off)
|
2017-10-22 08:53:35 +03:00
|
|
|
{
|
|
|
|
return hppa_form_gva_psw(env->psw, spc, off);
|
|
|
|
}
|
|
|
|
|
2023-09-18 00:54:16 +03:00
|
|
|
hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr);
|
|
|
|
hwaddr hppa_abs_to_phys_pa2_w1(vaddr addr);
|
|
|
|
|
2021-12-27 18:01:26 +03:00
|
|
|
/*
|
|
|
|
* Since PSW_{I,CB} will never need to be in tb->flags, reuse them.
|
2017-11-06 23:10:33 +03:00
|
|
|
* TB_FLAG_SR_SAME indicates that SR4 through SR7 all contain the
|
|
|
|
* same value.
|
|
|
|
*/
|
|
|
|
#define TB_FLAG_SR_SAME PSW_I
|
2017-10-22 08:53:35 +03:00
|
|
|
#define TB_FLAG_PRIV_SHIFT 8
|
2021-12-27 18:01:26 +03:00
|
|
|
#define TB_FLAG_UNALIGN 0x400
|
2017-10-22 08:53:35 +03:00
|
|
|
|
2023-06-21 16:56:24 +03:00
|
|
|
static inline void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc,
|
|
|
|
uint64_t *cs_base, uint32_t *pflags)
|
2016-12-15 22:26:14 +03:00
|
|
|
{
|
2017-10-22 08:53:35 +03:00
|
|
|
uint32_t flags = env->psw_n * PSW_N;
|
|
|
|
|
|
|
|
/* TB lookup assumes that PC contains the complete virtual address.
|
|
|
|
If we leave space+offset separate, we'll get ITLB misses to an
|
|
|
|
incomplete virtual address. This also means that we must separate
|
2023-07-14 14:23:51 +03:00
|
|
|
out current cpu privilege from the low bits of IAOQ_F. */
|
2017-10-22 08:53:35 +03:00
|
|
|
#ifdef CONFIG_USER_ONLY
|
2018-03-24 12:15:03 +03:00
|
|
|
*pc = env->iaoq_f & -4;
|
|
|
|
*cs_base = env->iaoq_b & -4;
|
2021-12-27 18:01:26 +03:00
|
|
|
flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus;
|
2017-10-22 08:53:35 +03:00
|
|
|
#else
|
2023-11-02 01:17:04 +03:00
|
|
|
/* ??? E, T, H, L, B bits need to be here, when implemented. */
|
|
|
|
flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P);
|
2017-10-22 08:53:35 +03:00
|
|
|
flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT;
|
|
|
|
|
2023-09-17 02:52:51 +03:00
|
|
|
*pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0),
|
|
|
|
env->iaoq_f & -4);
|
2017-10-22 08:53:35 +03:00
|
|
|
*cs_base = env->iasq_f;
|
|
|
|
|
|
|
|
/* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero
|
|
|
|
low 32-bits of CS_BASE. This will succeed for all direct branches,
|
|
|
|
which is the primary case we care about -- using goto_tb within a page.
|
|
|
|
Failure is indicated by a zero difference. */
|
|
|
|
if (env->iasq_f == env->iasq_b) {
|
2023-10-18 07:11:19 +03:00
|
|
|
target_long diff = env->iaoq_b - env->iaoq_f;
|
|
|
|
if (diff == (int32_t)diff) {
|
2017-10-22 08:53:35 +03:00
|
|
|
*cs_base |= (uint32_t)diff;
|
|
|
|
}
|
|
|
|
}
|
2017-11-06 23:10:33 +03:00
|
|
|
if ((env->sr[4] == env->sr[5])
|
|
|
|
& (env->sr[4] == env->sr[6])
|
|
|
|
& (env->sr[4] == env->sr[7])) {
|
|
|
|
flags |= TB_FLAG_SR_SAME;
|
|
|
|
}
|
2017-10-22 08:53:35 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
*pflags = flags;
|
2016-12-15 22:26:14 +03:00
|
|
|
}
|
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong cpu_hppa_get_psw(CPUHPPAState *env);
|
|
|
|
void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong);
|
2016-12-15 22:26:14 +03:00
|
|
|
void cpu_hppa_loaded_fr0(CPUHPPAState *env);
|
|
|
|
|
2019-03-11 22:16:00 +03:00
|
|
|
#ifdef CONFIG_USER_ONLY
|
|
|
|
static inline void cpu_hppa_change_prot_id(CPUHPPAState *env) { }
|
|
|
|
#else
|
|
|
|
void cpu_hppa_change_prot_id(CPUHPPAState *env);
|
|
|
|
#endif
|
|
|
|
|
2020-03-16 20:21:41 +03:00
|
|
|
int hppa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
|
2016-12-15 22:26:14 +03:00
|
|
|
int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
2019-04-17 22:18:02 +03:00
|
|
|
void hppa_cpu_dump_state(CPUState *cs, FILE *f, int);
|
2021-09-15 02:39:34 +03:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
2023-10-27 10:24:30 +03:00
|
|
|
void hppa_ptlbe(CPUHPPAState *env);
|
2022-12-06 18:20:51 +03:00
|
|
|
hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr);
|
2024-01-12 00:50:11 +03:00
|
|
|
void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled);
|
2019-04-02 11:30:10 +03:00
|
|
|
bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
|
|
|
MMUAccessType access_type, int mmu_idx,
|
|
|
|
bool probe, uintptr_t retaddr);
|
2021-09-11 19:54:19 +03:00
|
|
|
void hppa_cpu_do_interrupt(CPUState *cpu);
|
|
|
|
bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req);
|
2017-10-27 11:17:12 +03:00
|
|
|
int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx,
|
2023-09-13 11:55:59 +03:00
|
|
|
int type, hwaddr *pphys, int *pprot,
|
2023-10-27 08:13:12 +03:00
|
|
|
HPPATLBEntry **tlb_entry);
|
2017-12-29 04:36:45 +03:00
|
|
|
extern const MemoryRegionOps hppa_io_eir_ops;
|
2019-08-12 08:23:44 +03:00
|
|
|
extern const VMStateDescription vmstate_hppa_cpu;
|
2017-12-29 04:50:14 +03:00
|
|
|
void hppa_cpu_alarm_timer(void *);
|
2017-12-15 23:37:26 +03:00
|
|
|
int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr);
|
2017-10-27 11:17:12 +03:00
|
|
|
#endif
|
2022-04-20 16:26:02 +03:00
|
|
|
G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra);
|
2016-12-15 22:26:14 +03:00
|
|
|
|
2023-09-18 04:38:59 +03:00
|
|
|
#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU
|
|
|
|
|
2016-12-15 22:26:14 +03:00
|
|
|
#endif /* HPPA_CPU_H */
|