Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f2227f5

Browse files
committedOct 17, 2024··
CPUARMState is 16-bytes aligned
1 parent 54d8afa commit f2227f5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎qemu/target/arm/cpu.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,8 @@ ARMCPU *cpu_arm_init(struct uc_struct *uc)
21022102
CPUClass *cc;
21032103
CPUARMState *env;
21042104

2105-
cpu = calloc(1, sizeof(*cpu));
2105+
// cpu->env is 16 bytes aligned
2106+
cpu = aligned_alloc(16, sizeof(*cpu));
21062107
if (cpu == NULL) {
21072108
return NULL;
21082109
}

‎qemu/target/arm/cpu64.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ ARMCPU *cpu_aarch64_init(struct uc_struct *uc)
325325
CPUClass *cc;
326326
CPUARMState *env;
327327

328-
cpu = calloc(1, sizeof(*cpu));
328+
// cpu->env is 16 bytes alignment
329+
cpu = aligned_alloc(16, sizeof(*cpu));
329330
if (cpu == NULL) {
330331
return NULL;
331332
}

0 commit comments

Comments
 (0)
Please sign in to comment.