truss: Decode correctly 64bits arguments on 32bits arm.
When decoding 32bits arm syscall, make sure we account for the padding when decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary. MFC After: 1 week PR: 256199
This commit is contained in:
parent
9bab18b861
commit
ebbc3140ca
@ -792,11 +792,14 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp,
|
||||
* decoding arguments.
|
||||
*/
|
||||
static void
|
||||
quad_fixup(struct syscall_decode *sc)
|
||||
quad_fixup(struct procabi *abi, struct syscall_decode *sc)
|
||||
{
|
||||
int offset, prev;
|
||||
u_int i;
|
||||
|
||||
#ifndef __aarch64__
|
||||
(void)abi;
|
||||
#endif
|
||||
offset = 0;
|
||||
prev = -1;
|
||||
for (i = 0; i < sc->nargs; i++) {
|
||||
@ -810,17 +813,20 @@ quad_fixup(struct syscall_decode *sc)
|
||||
switch (sc->args[i].type & ARG_MASK) {
|
||||
case Quad:
|
||||
case QuadHex:
|
||||
#ifdef __powerpc__
|
||||
#if defined(__powerpc__) || defined(__arm__) || defined(__aarch64__)
|
||||
/*
|
||||
* 64-bit arguments on 32-bit powerpc must be
|
||||
* 64-bit arguments on 32-bit powerpc and arm must be
|
||||
* 64-bit aligned. If the current offset is
|
||||
* not aligned, the calling convention inserts
|
||||
* a 32-bit pad argument that should be skipped.
|
||||
*/
|
||||
if (sc->args[i].offset % 2 == 1) {
|
||||
sc->args[i].offset++;
|
||||
offset++;
|
||||
}
|
||||
#ifdef __aarch64__
|
||||
if (abi->pointer_size == sizeof(uint32_t))
|
||||
#endif
|
||||
if (sc->args[i].offset % 2 == 1) {
|
||||
sc->args[i].offset++;
|
||||
offset++;
|
||||
}
|
||||
#endif
|
||||
offset++;
|
||||
default:
|
||||
@ -854,7 +860,7 @@ add_syscall(struct procabi *abi, u_int number, struct syscall *sc)
|
||||
* procabi instead.
|
||||
*/
|
||||
if (abi->pointer_size == 4)
|
||||
quad_fixup(&sc->decode);
|
||||
quad_fixup(abi, &sc->decode);
|
||||
|
||||
if (number < nitems(abi->syscalls)) {
|
||||
assert(abi->syscalls[number] == NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user