Re: [PATCH v13 17/18] unwind_user/sframe/x86: Enable sframe unwinding on x86

Jens Remus
2026-04-20T12:36:24Z

On 1/27/2026 4:05 PM, Jens Remus wrote:

> diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwind_user.h

> @@ -15,6 +15,40 @@ static inline int unwind_user_word_size(struct pt_regs *regs)
> return user_64bit_mode(regs) ? 8 : 4;
> }
>
> +static inline int unwind_user_get_reg(unsigned long *val, unsigned int regnum)
> +{
> +#ifdef CONFIG_X86_64
> + const struct pt_regs *regs = task_pt_regs(current);
> +
> + switch (regnum) {
> + /* DWARF register numbers 0..15 */
> + case 0: *val = regs->ax; break;
> + case 1: *val = regs->dx; break;
> + case 2: *val = regs->cx; break;
> + case 3: *val = regs->bx; break;
> + case 4: *val = regs->si; break;
> + case 5: *val = regs->di; break;
> + case 6: *val = regs->bp; break;
> + case 7: *val = regs->sp; break;
> + case 8: *val = regs->r8; break;
> + case 9: *val = regs->r9; break;
> + case 10: *val = regs->r10; break;
> + case 11: *val = regs->r11; break;
> + case 12: *val = regs->r12; break;
> + case 13: *val = regs->r13; break;
> + case 14: *val = regs->r14; break;
> + case 15: *val = regs->r15; break;
> + default:
> + return -EINVAL;
> + }
> + return 0;
> +#else /* !CONFIG_X86_64 */
> + return -EINVAL;
> +#endif /* !CONFIG_X86_64 */
> +

Nit: Superfluous empty line.

> +}
> +#define unwind_user_get_reg unwind_user_get_reg
> +
> #endif /* CONFIG_UNWIND_USER */
>
> #ifdef CONFIG_HAVE_UNWIND_USER_FP
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/