Hi all,
I guess I have found the buglet which prevented the 2.1.99 kernel from executing
executables from the ramdisk. The patch is so simple that everybody should be
able
to apply it:
In include/asm-mips/current.h add a 'nop; \' after 'lw reg, %lo(kernelsp)(reg);
\' so
that _GET_CURRENT looks like:
===
#define _GET_CURRENT(reg) \
lui reg, %hi(kernelsp); \
.set push; \
.set noreorder; \
lw reg, %lo(kernelsp)(reg); \
nop; \
.set pop; \
ori reg, 8191; \
xori reg, 8191
===
I have tested this patch with two different ramdisk images, one containg the
'program' endless as /bin/sh, which is simply and endless loop
> .text
>
> .globl __start
>
> __start:
> 1: b 1b
and the output is (with debugging output in fault.c enabled):
[snip]
> Ramdisk driver initialized : 16 ramdisks of 4096K size
> RAMDISK: Compressed image found at block 0
> VFS: Mounted root (ext2 filesystem).
> Freeing unused kernel memory: 28k freed
> Warning: unable to open an initial console.
> do_page_fault[sh:1:7fffffb4:1:8007e950]
> do_page_fault[sh:1:100100c0:1:800ddb94]
> do_page_fault[sh:1:100100c0:1:800ddb94]
> do_page_fault[sh:1:004000b0:0:004000b0]
> do_page_fault[sh:1:004000b0:0:004000b0]
and then silence.
The other one contains violate.S as /bin/sh:
> .text
>
> .globl __start
> __start:
> .set noat
>
> lui $1,0x8000
> lw $1,0($1)
and the output is:
> [snip]
> Ramdisk driver initialized : 16 ramdisks of 4096K size
> RAMDISK: Compressed image found at block 0
> VFS: Mounted root (ext2 filesystem).
> Freeing unused kernel memory: 28k freed
> Warning: unable to open an initial console.
> do_page_fault[sh:1:7fffffb4:1:8007e950]
> do_page_fault[sh:1:100100c0:1:800ddb94]
> do_page_fault[sh:1:100100c0:1:800ddb94]
> do_page_fault[sh:1:004000b0:0:004000b0]
> do_page_fault[sh:1:004000b0:0:004000b0]
> do_page_fault[sh:1:00000000:0:00000000]
> Unable to handle kernel paging request at virtual address 00000000, epc ==
> 00008
> Oops: 0000
> $0 : 00000000 401a4000 00000000 00000007 800dfc8c 800f6760 800f6788 00000000
> $8 : 00002010 00000010 00000000 80051560 00000000 800e2222 004000c8 00000001
> $16: 00000003 800f6788 800dfc8c 800f6760 00000003 00000000 ffffffff 00010000
> $24: 00000003 00000000 801ae000 7fffff90 00000000 80038558
> epc : 00000000
> Status: 00002000
> Cause : 00000008
Both 'programs' behave like expected and as far as I am concerned, things are
looking quite promising :-). We're just a few footsteps away from a single user
shell, I hope.
Keep hacking.
---
Regards,
Harald
|