Thomas,
> The point at which INIT is supposed to switch over to INIT mode 3...
> it hangs - or appears to hang.
>
> Possibly this is the patch that Gleb has been talking about...
> Can someone post the final patch that came out of that?
>
Attached here is part of the final patch I've sent to Harald. (I removed
the Baget-specific part from the original patch.) The patch fixes two
bugs I and Vladimir encountered in 2.1.131. One bug is that init hangs
while switching to runlevel 3 due to a process doesn't switch to the
user mode correctly. Another one is that a system call with 4 arguments
aren't restarted properly. (The last argument contains garbage.) Ralf
sent a patch for the latter problem in the list, it's supposed to be an
old bug as Ralf said.
I still have problems with 2.1.131, but I am not sure these problems are
related to 2.1.131 only. For example, gdb still aren't built from
sources, gcc gets signal 11, but it might be due to 2.1.131 is bigger
and I just see the fact ram is ended up. (There is still no support for
swapping over network and support for such kind of swapping seems to be
insoluble with current design of the kernel.) Another problem is related
to gdb again. It can't get contents of the CPU registers from the
kernel, namely, float registers and badvaddr. Again, I don't know
whether it's only 2.1.131 problem.
Regards,
Gleb Raiko. Index: linux-2.1.131/arch/mips/kernel/process.c
diff -u linux-2.1.131/arch/mips/kernel/process.c:1.1.1.1
linux-2.1.131/arch/mips/kernel/process.c:1.2
--- linux-2.1.131/arch/mips/kernel/process.c:1.1.1.1 Mon Jan 11 16:08:21 1999
+++ linux-2.1.131/arch/mips/kernel/process.c Mon Jan 25 16:37:12 1999
@@ -40,7 +40,7 @@
void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
{
/* New thread looses kernel privileges. */
- regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|ST0_KSU)) | KU_USER;
+ regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|KU_MASK)) | KU_USER;
regs->cp0_epc = pc;
regs->regs[29] = sp;
current->tss.current_ds = USER_DS;
Index: linux-2.1.131/arch/mips/kernel/scall_o32.S
diff -u linux-2.1.131/arch/mips/kernel/scall_o32.S:1.1.1.1
linux-2.1.131/arch/mips/kernel/scall_o32.S:1.3
--- linux-2.1.131/arch/mips/kernel/scall_o32.S:1.1.1.1 Mon Jan 11 16:08:21 1999
+++ linux-2.1.131/arch/mips/kernel/scall_o32.S Thu Jan 28 16:34:32 1999
@@ -12,6 +12,7 @@
#include <asm/mipsregs.h>
#include <asm/regdef.h>
#include <asm/stackframe.h>
+#include <asm/isadep.h>
#include <asm/unistd.h>
/* This duplicates the definition from <linux/sched.h> */
@@ -46,7 +47,8 @@
subu t0, t3, 5 # 5 or more arguments?
bgez t0, stackargs
-stack_done:
+stack_done:
+ sw a3, PT_R26(sp) # save for syscall restart
lw t0, TASK_FLAGS($28) # syscall tracing enabled?
andi t0, PF_TRACESYS
bnez t0, trace_a_syscall
@@ -69,7 +71,7 @@
bnez t0,o32_handle_bottom_half
9: lw t0,PT_STATUS(sp) # returning to kernel mode?
- andi t1, t0, 0x10
+ andi t1, t0, KU_USER
lw t2, TASK_NEED_RESCHED($28)
beqz t1, o32_return # -> yes
bnez t2, o32_reschedule
Index: linux-2.1.131/arch/mips/kernel/signal.c
diff -u linux-2.1.131/arch/mips/kernel/signal.c:1.1.1.1
linux-2.1.131/arch/mips/kernel/signal.c:1.2
--- linux-2.1.131/arch/mips/kernel/signal.c:1.1.1.1 Mon Jan 11 16:08:21 1999
+++ linux-2.1.131/arch/mips/kernel/signal.c Thu Jan 28 16:34:32 1999
@@ -392,6 +392,7 @@
}
/* fallthrough */
case ERESTARTNOINTR: /* Userland will reload $v0. */
+ regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 8;
}
@@ -525,6 +526,7 @@
if (regs->regs[2] == ERESTARTNOHAND ||
regs->regs[2] == ERESTARTSYS ||
regs->regs[2] == ERESTARTNOINTR) {
+ regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 8;
}
}
|