[parisc-linux-cvs] fix dp for 64 bit kernel threads in modules

Richard Hirst rhirst@linuxcare.com
Fri, 6 Apr 2001 00:29:51 +0100


For 64 bit kernel, the kernel and each module has it's own dp value.
This fixes things so kernel threads which are in a module get started
with the right dp value, and so that the kernels dp value is restored
when a thread exits.

Re the change to process.c, I don't think that block of code is
actually necessary, as there is a *cregs = *pregs further up the
file, but I added gr[27] to be consistant.

Richard


Index: arch/parisc/kernel/entry.S
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/entry.S,v
retrieving revision 1.79
diff -u -r1.79 entry.S
--- entry.S     2001/04/03 12:18:03     1.79
+++ entry.S     2001/04/05 23:17:34
@@ -504,7 +504,8 @@
        ldo     PT_SZ_ALGN(%r30),%r30
 #ifdef __LP64__
        /* Yo, function pointers in wide mode are little structs... -PB */
-       /* XXX FIXME do we need to honor the fptr's %dp value too? */
+       ldd     24(%r26), %r2
+       STREG   %r2, PT_GR27(%r1)       /* Store childs %dp */
        ldd     16(%r26), %r26
 #endif
        STREG   %r26, PT_GR26(%r1)  /* Store function & argument for child */
@@ -540,11 +541,15 @@
 
        LDREG   TASK_PT_GR26-TASK_SZ_ALGN(%r30), %r1
        LDREG   TASK_PT_GR25-TASK_SZ_ALGN(%r30), %r26
+#ifdef __LP64__
+       LDREG   TASK_PT_GR27-TASK_SZ_ALGN(%r30), %r27
+#endif
        ble     0(%sr7, %r1)
        copy    %r31, %r2
 
 #ifdef __LP64__
        ldo     -16(%r30),%r29          /* Reference param save area */
+       loadgp                          /* Thread could have been in a module */
 #endif
        b       sys_exit
        ldi     0, %r26
Index: arch/parisc/kernel/process.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/process.c,v
retrieving revision 1.34
diff -u -r1.34 process.c
--- process.c   2001/02/23 07:02:01     1.34
+++ process.c   2001/04/05 23:17:34
@@ -251,6 +251,9 @@
                 * Copy function and argument to be called from
                 * ret_from_kernel_thread.
                 */
+#ifdef __LP64__
+               cregs->gr[27] = pregs->gr[27];
+#endif
                cregs->gr[26] = pregs->gr[26];
                cregs->gr[25] = pregs->gr[25];
        } else {