[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 02/21] target/loongarch: Add core definition
From: |
Richard Henderson |
Subject: |
Re: [PATCH v4 02/21] target/loongarch: Add core definition |
Date: |
Sat, 4 Sep 2021 11:44:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
On 9/2/21 2:40 PM, Song Gao wrote:
+#define FCSR0_M1 0x1f /* FCSR1 mask, Enables */
+#define FCSR0_M2 0x1f1f0000 /* FCSR2 mask, Cause and Flags */
+#define FCSR0_M3 0x300 /* FCSR3 mask, Round Mode */
+#define FCSR0_RM 8 /* Round Mode bit num on fcsr0 */
+#define GET_FP_CAUSE(reg) (((reg) >> 24) & 0x1f)
+#define GET_FP_ENABLE(reg) (reg & 0x1f)
+#define GET_FP_FLAGS(reg) (((reg) >> 16) & 0x1f)
+#define SET_FP_CAUSE(reg, v) do { (reg) = ((reg) & ~(0x1f << 24)) | \
+ ((v & 0x1f) << 24); \
+ } while (0)
+#define SET_FP_ENABLE(reg, v) do { (reg) = ((reg) & ~(0x1f) | (v & 0x1f); \
+ } while (0)
+#define SET_FP_FLAGS(reg, v) do { (reg) = ((reg) & ~(0x1f << 16)) | \
+ ((v & 0x1f) << 16); \
+ } while (0)
+#define UPDATE_FP_FLAGS(reg, v) do { (reg) |= ((v & 0x1f) << 16); } while (0)
Better to use "hw/registerfields.h":
FIELD(FCSR, ENABLES, 0, 5)
FIELD(FCSR, RM, 8, 2)
FIELD(FCSR, FLAGS, 16, 5)
FIELD(FCSR, CAUSE, 24, 5)
Then e.g.
#define GET_FP_CAUSE(REG) FIELD_EX32(REG, FCSR, CAUSE)
#define SET_FP_CAUSE(REG, V) FIELD_DP32(REG, FCSR, CAUSE, V)
#define UPDATE_FP_FLAGS(REG, V) \
do {
(REG) |= FIELD_DP32(0, FCSR, FLAGS, V);
} while (0)
+static inline void cpu_get_tb_cpu_state(CPULoongArchState *env,
+ target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *pc = env->pc;
+ *cs_base = 0;
+}
Missing *flags = 0.
r~
- Re: [PATCH v4 04/21] target/loongarch: Add fixed point arithmetic instruction translation, (continued)
- [PATCH v4 08/21] target/loongarch: Add fixed point atomic instruction translation, Song Gao, 2021/09/02
- [PATCH v4 11/21] target/loongarch: Add floating point comparison instruction translation, Song Gao, 2021/09/02
- [PATCH v4 13/21] target/loongarch: Add floating point move instruction translation, Song Gao, 2021/09/02
- [PATCH v4 02/21] target/loongarch: Add core definition, Song Gao, 2021/09/02
- Re: [PATCH v4 02/21] target/loongarch: Add core definition,
Richard Henderson <=
- [PATCH v4 03/21] target/loongarch: Add main translation routines, Song Gao, 2021/09/02
- [PATCH v4 07/21] target/loongarch: Add fixed point load/store instruction translation, Song Gao, 2021/09/02
- [PATCH v4 06/21] target/loongarch: Add fixed point bit instruction translation, Song Gao, 2021/09/02
- [PATCH v4 09/21] target/loongarch: Add fixed point extra instruction translation, Song Gao, 2021/09/02
- [PATCH v4 10/21] target/loongarch: Add floating point arithmetic instruction translation, Song Gao, 2021/09/02