Re: [RFC v2] MIPS: R5900: Workaround exception NOP execution bug (FLX05)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Maciej,

>  If you can't access /proc/kcore with GDB locally, for whatever reason, 
> then `dd' it (or a part of it); to a regular file and copy it to another 
> machine. Use cross-GDB if necessary.  With 16 MiB of RAM available only 
> it can be getting really tight; the kernel itself takes half of it too I 
> suppose.

Both a (complete) remote copy of kcore, and one shared via v9fs, yield
"Cannot access memory at address 0x80000000" with a cross-GDB, unfortunately:

> > One can get a little further by sharing /proc using v9fs to obtain:
> > 
> > 	# mipsel-linux-gdb -q -c /mnt/kcore
> > 	[New process 1]
> > 	Core was generated by `ramdisk_size=16384 crtmode=pal1 video=ps2fb:pal,640x480-32 rd_start=0x8063c000'.
> > 	#0  0x00000000 in ?? ()
> > 	(gdb) set architecture mips:5900
> > 	The target architecture is assumed to be mips:5900
> > 	(gdb) x /32i 0x80000000
> > 	   0x80000000:	Cannot access memory at address 0x80000000

By examining the read operations for /proc/kcore, it seems GDB reaches this
"cannot access" conclusion from the ELF headers.

>  You need to use bus (physical) rather than virtual addresses with 
> /dev/mem, so:
> 
> # xxd -s 0 -l 256 /dev/mem
> 
> or suchlike.

Ah, the value of the physical address was a misunderstanding on my part. The
convoluted combination of mipsel-linux-objcopy and mipsel-linux-objdump gets
the disassembly done without GDB, as shown below. :D

It looks very similar to yours, with additional NOPs and SYNCs required for
the R5900:

	# ssh ps2 head -c 128 /dev/mem >kcore &&
	    mipsel-linux-objcopy -I binary -O elf32-little kcore kcore.elf &&
	    mipsel-linux-objdump -D -m mips:5900 kcore.elf
	kcore.elf:     file format elf32-little
	Disassembly of section .data:
	00000000 <_binary_kcore_start>:
		...
	   8:	3c1b8061 	lui	k1,0x8061
	   c:	0000040f 	sync.p
	  10:	401a4000 	mfc0	k0,c0_badvaddr
	  14:	8f7b2c60 	lw	k1,11360(k1)
	  18:	001ad582 	srl	k0,k0,0x16
	  1c:	001ad080 	sll	k0,k0,0x2
	  20:	037ad821 	addu	k1,k1,k0
	  24:	0000040f 	sync.p
	  28:	401a2000 	mfc0	k0,c0_context
	  2c:	8f7b0000 	lw	k1,0(k1)
	  30:	001ad042 	srl	k0,k0,0x1
	  34:	335a0ff8 	andi	k0,k0,0xff8
	  38:	037ad821 	addu	k1,k1,k0
	  3c:	8f7a0000 	lw	k0,0(k1)
	  40:	8f7b0004 	lw	k1,4(k1)
	  44:	001ad142 	srl	k0,k0,0x5
	  48:	409a1000 	mtc0	k0,c0_entrylo0
	  4c:	0000040f 	sync.p
	  50:	001bd942 	srl	k1,k1,0x5
	  54:	409b1800 	mtc0	k1,c0_entrylo1
	  58:	0000040f 	sync.p
	  5c:	42000006 	tlbwr
	  60:	0000040f 	sync.p
	  64:	42000018 	eret
		...

Fredrik


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux