On Sun, Jan 26, 2025 at 12:02:47AM +0100, Ivan Kokshaysky wrote:
> >  Erm, that's a good starting point but offsets for the individual register 
> > slots need to be updated as well for `do_page_fault' and `do_entUnaUser' 
> > to get at the correct ones for those that are at negative indices from the 
> > `regs' pointer supplied, i.e. $9 at 8($sp), $10 at 16($sp), etc., and with 
> > 0($sp) now unoccupied.  Sorry to get it through unclear after all.
> 
> Ah, thanks a lot! Should've noticed that myself, but I've booted with the
> last patch and it didn't crash on me, so I thought the deed is done...
> 
> I'll fix that tomorrow.

Fixed in C, I guess it's easier to review.

Ivan.

diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index a9a38c80c4a7..035086e19d64 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -649,7 +649,7 @@ s_reg_to_mem (unsigned long s_reg)
 static int unauser_reg_offsets[32] = {
        R(r0), R(r1), R(r2), R(r3), R(r4), R(r5), R(r6), R(r7), R(r8),
        /* r9 ... r15 are stored in front of regs.  */
-       -56, -48, -40, -32, -24, -16, -8,
+       -64, -56, -48, -40, -32, -24, -16,
        R(r16), R(r17), R(r18),
        R(r19), R(r20), R(r21), R(r22), R(r23), R(r24), R(r25), R(r26),
        R(r27), R(r28), R(gp),
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index 8c9850437e67..a9816bbc9f34 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct *next_mm)
 
 /* Macro for exception fixup code to access integer registers.  */
 #define dpf_reg(r)                                                     \
-       (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 :  \
-                                (r) <= 18 ? (r)+10 : (r)-10])
+       (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 :  \
+                                (r) <= 18 ? (r)+11 : (r)-10])
 
 asmlinkage void
 do_page_fault(unsigned long address, unsigned long mmcsr,

Reply via email to