mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
target/loongarch: Add LASX data support
Signed-off-by: Song Gao <gaosong@loongson.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230914022645.1151356-12-gaosong@loongson.cn>
This commit is contained in:
parent
cd1006176b
commit
008a3b1662
9 changed files with 86 additions and 34 deletions
|
@ -8,7 +8,7 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "cpu.h"
|
||||
#include "migration/cpu.h"
|
||||
#include "internals.h"
|
||||
#include "vec.h"
|
||||
|
||||
static const VMStateDescription vmstate_fpu_reg = {
|
||||
.name = "fpu_reg",
|
||||
|
@ -76,6 +76,39 @@ static const VMStateDescription vmstate_lsx = {
|
|||
},
|
||||
};
|
||||
|
||||
static const VMStateDescription vmstate_lasxh_reg = {
|
||||
.name = "lasxh_reg",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT64(UD(2), VReg),
|
||||
VMSTATE_UINT64(UD(3), VReg),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
#define VMSTATE_LASXH_REGS(_field, _state, _start) \
|
||||
VMSTATE_STRUCT_SUB_ARRAY(_field, _state, _start, 32, 0, \
|
||||
vmstate_lasxh_reg, fpr_t)
|
||||
|
||||
static bool lasx_needed(void *opaque)
|
||||
{
|
||||
LoongArchCPU *cpu = opaque;
|
||||
|
||||
return FIELD_EX64(cpu->env.cpucfg[2], CPUCFG2, LASX);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_lasx = {
|
||||
.name = "cpu/lasx",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = lasx_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_LASXH_REGS(env.fpr, LoongArchCPU, 0),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
||||
|
||||
/* TLB state */
|
||||
const VMStateDescription vmstate_tlb = {
|
||||
.name = "cpu/tlb",
|
||||
|
@ -163,6 +196,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
|
|||
.subsections = (const VMStateDescription*[]) {
|
||||
&vmstate_fpu,
|
||||
&vmstate_lsx,
|
||||
&vmstate_lasx,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue