Skip to content

Commit b8d6ac9

Browse files
committed
bsd-user/elfload.c: Don't use ldl() or ldq_raw()
Use get_user_u64() and get_user_ual() instead of the ldl() and ldq_raw() functions. [Note that this change is not compile tested as it is actually in dead code -- none of the bsd-user configurations are PPC.] Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Alex Bennée <[email protected]> Message-id: [email protected]
1 parent 2ccf97e commit b8d6ac9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bsd-user/elfload.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
351351

352352
_regs->gpr[1] = infop->start_stack;
353353
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
354-
entry = ldq_raw(infop->entry) + infop->load_addr;
355-
toc = ldq_raw(infop->entry + 8) + infop->load_addr;
354+
get_user_u64(entry, infop->entry);
355+
entry += infop->load_addr;
356+
get_user_u64(toc, infop->entry + 8);
357+
toc += infop->load_addr;
356358
_regs->gpr[2] = toc;
357359
infop->entry = entry;
358360
#endif
@@ -365,8 +367,9 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
365367
get_user_ual(_regs->gpr[3], pos);
366368
pos += sizeof(abi_ulong);
367369
_regs->gpr[4] = pos;
368-
for (tmp = 1; tmp != 0; pos += sizeof(abi_ulong))
369-
tmp = ldl(pos);
370+
for (tmp = 1; tmp != 0; pos += sizeof(abi_ulong)) {
371+
get_user_ual(tmp, pos);
372+
}
370373
_regs->gpr[5] = pos;
371374
}
372375

0 commit comments

Comments
 (0)