Skip to content

Commit 2716d59

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: pt_regs: remove stale big-endian layout
For historical reasons the layout of struct pt_regs depends on the configured endianness, with the order of the 'syscallno' and 'unused2' fields varying dependent upon whether __AARCH64EB__ is defined. We no longer depend on the order of these two fields and can remove the ifdeffery. The current conditional layout was introduced in commit: 35d0e6f ("arm64: syscallno is secretly an int, make it official") At the time, this was necessary so that the entry assembly could use a single STP instruction to save the pt_regs::{orig_x0,syscallno} fields, without logic that was conditional on the endianness of the kernel: | el0_svc_naked: | stp x0, xscno, [sp, #S_ORIG_X0] // save the original x0 and syscall number This logic was converted to C in commit: f37099b ("arm64: convert syscall trace logic to C") Since that commit, we no longer manipulate pt_regs::orig_x0 from assembly, and only manipulate pt_regs::syscallno as a 32-bit quantity early in the kernel_entry assembly: | /* Not in a syscall by default (el0_svc overwrites for real syscall) */ | .if \el == 0 | mov w21, #NO_SYSCALL | str w21, [sp, #S_SYSCALLNO] | .endif Given the above, there's no longer a need for the layout of pt_regs::{syscallno,unused2} to depend on the endianness of the kernel. This patch removes the ifdeffery and places 'syscallno' before 'unused2' regardless of the endianess of the kernel. At the same time, 'unused2' is renamed to 'unused', as it is the only unused field within pt_regs. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Reviewed-by: Mark Brown <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Reviewed-by: Puranjay Mohan <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Kalesh Singh <[email protected]> Cc: Madhavan T. Venkataraman <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent c87df9c commit 2716d59

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/arm64/include/asm/ptrace.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,9 @@ struct pt_regs {
162162
};
163163
};
164164
u64 orig_x0;
165-
#ifdef __AARCH64EB__
166-
u32 unused2;
167165
s32 syscallno;
168-
#else
169-
s32 syscallno;
170-
u32 unused2;
171-
#endif
166+
u32 unused;
167+
172168
u64 sdei_ttbr1;
173169
/* Only valid when ARM64_HAS_GIC_PRIO_MASKING is enabled. */
174170
u64 pmr_save;

0 commit comments

Comments
 (0)