After unsuccessful tries to make Harald's linux-mips-2.1.131 working, I
need a help from the mailing list, especially from someone who knows
what was changed between 2.1.121 and 2.1.131 kernels. The patch has 6MB
size and I'll take a looong time to trace it. So, before I'll actually
deep in the patch, I'd like to hear some suggestions.
The problem I have is that 'make' dies with error 'wait: Bad address"
after Ctrl+Z is pressed. (The test is to compile something, e.g. gdb
from sources.) Children of make (e.g. gcc) die too. The problem affects
other utilities, e.g. man, but doesn't affect small tests I wrote. The
kernel log contains '<process name>: Exception at ...'. Futher
investigation showed that getrusage is called with bad user address.
I had to apply the patch which is attached here. Without this patch,
user process will never leave the kernel mode. (Harald, with the patch
the kernel should be 'more stable').
diff -u linux-2.1.131/arch/mips/kernel/process.c:220.127.116.11
--- linux-2.1.131/arch/mips/kernel/process.c:18.104.22.168 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 = sp;
current->tss.current_ds = USER_DS;
diff -u linux-2.1.131/arch/mips/kernel/scall_o32.S:22.214.171.124
--- linux-2.1.131/arch/mips/kernel/scall_o32.S:126.96.36.199 Mon Jan 11 16:08:21 1999
+++ linux-2.1.131/arch/mips/kernel/scall_o32.S Mon Jan 25 16:37:12 1999
@@ -12,6 +12,7 @@
/* This duplicates the definition from <linux/sched.h> */
@@ -69,7 +70,7 @@
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