[Linux-Xtensa] Running linux in xtensa simulator (Follow the source Luke. xt-gdb is your friend :)

Mahavir Prasad er.mahavir at gmail.com
Fri Dec 9 05:54:15 PST 2011

Skipped content of type multipart/alternative-------------- next part --------------
mahavir at mahavir-desktop:~/Desktop/lahaina/git_checkout/lah_build/build-iss$ xt-gdb arch/xtensa/boot/Image.elf 
GNU gdb 6.8 Xtensa Tools 9.0.1
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=xtensa-elf"...
(xt-gdb) source .xt-gdbinit_without_turbo 
"Using MMU, assumne V2 MMU Mappings
""add-symbol-file vmlinux 0xd0003000
"add symbol table from file "vmlinux" at
	.text_addr = 0xd0003000
"target sim --memlimit=128
"Connected to the simulator.
Breakpoint 1 at 0x104: file /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/boot/boot-elf/bootstrap.S, line 93.
"Starting Simulation
"Breakpoint 2 at 0x0: file /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/boot/boot-elf/bootstrap.S, line 44.
Breakpoint 3 at 0xd0003003: file /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/kernel/head.S, line 66.
Breakpoint 4 at 0xd000303a: file /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/kernel/head.S, line 190.
".xt-gdbinit: Done
"(xt-gdb) run
Starting program: /home/mahavir/Desktop/lahaina/git_checkout/lah_build/build-iss/arch/xtensa/boot/Image.elf 
Starting the ISS simulator.
warning: Connection timed out to ISS. Retrying...
Switching to remote protocol
Remote debugging using localhost:64963

^C^CInterrupted while waiting for the program.
Give up (and stop debugging it)? (y or n) y
(xt-gdb) run
Starting program: /home/mahavir/Desktop/lahaina/git_checkout/lah_build/build-iss/arch/xtensa/boot/Image.elf 
Starting the ISS simulator.
warning: Connection timed out to ISS. Retrying...
Switching to remote protocol
Remote debugging using localhost:62954

Breakpoint 2, ?? () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/boot/boot-elf/bootstrap.S:44
44		_j _SetupMMU
Current language:  auto; currently asm
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:87
87		movi	a3, 0x15		/* non-MX -- always RCW */
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:89
89		wsr	a3, ATOMCTL
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:178
178		movi	a1, 0		// Set $sp to NULL to minimize gdb confusion trying to walk up the stack
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:180
180		_call0	1f		// get PC in a PIC manner (don't rely on literal constants)
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:186
186	1:	movi	a2, 0x10000000
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:187
187		movi	a3, 0x18000000
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:188
188		add	a2, a2, a0	// a2 = 0x10000000 + original_pc
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:189
189		bltu	a2, a3, 1f	// is PC >= 0xF0000000, or PC < 0x08000000 ?
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:200
200		movi	a2, 0x40000006	// 512MB region at vaddr 0x40000000, way 6
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:201
201		idtlb	a2		// kick it out...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:202
202		iitlb	a2
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:203
203		isync
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:211
211		srli	a3, a0, 27		// get 128MB area containing PC ...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:212
212		slli	a3, a3, 27		// ...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:213
213		addi	a3, a3, CA_BYPASS	// bypass-cache access R/W Executable
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:214
214		addi	a7, a2, -1		// 128MB region at vaddr 0x40000000, way 5
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:215
215		wdtlb	a3, a7			// setup mapping...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:216
216		witlb	a3, a7			// ...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:217
217		isync				// ...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:226
226		slli	a4, a0, 5	// clear upper 5 bits of PC (get 128MB relative offset)
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:227
227		srli	a4, a4, 5	// ...
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:228
228		addi	a5, a2, -6	// a5 = 0x40000000
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:229
229		add	a4, a4, a5	// address of above "j 2f" in 128MB page at vaddr 0x40000000
(xt-gdb) n
_SetupMMU () at /home/mahavir/Desktop/lahaina/git_checkout/lah_build/linux/arch/xtensa/include/asm/initialize_mmu.h:230
230		jx	a4		// Note: jumps to 0x46000043; xt-gdb switches to remapped text section
(xt-gdb) n
0x4000004c in ?? ()
(xt-gdb) n
Cannot find bounds of current function
(xt-gdb) n
Cannot find bounds of current function
(xt-gdb) info all-registers 
pc             0x4000004c	0x4000004c
ar0            0x4c	0x4c
ar1            0x0	0x0
ar2            0x40000006	0x40000006
ar3            0x3	0x3
ar4            0x4000004c	0x4000004c
ar5            0x40000000	0x40000000
ar6            0x0	0x0
ar7            0x40000005	0x40000005
ar8            0x0	0x0
ar9            0x0	0x0
ar10           0x0	0x0
ar11           0x0	0x0
ar12           0x0	0x0
ar13           0x0	0x0
ar14           0x0	0x0
ar15           0x0	0x0
ar16           0x0	0x0
ar17           0x0	0x0
ar18           0x0	0x0
ar19           0x0	0x0
ar20           0x0	0x0
ar21           0x0	0x0
ar22           0x0	0x0
ar23           0x0	0x0
ar24           0x0	0x0
ar25           0x0	0x0
ar26           0x0	0x0
ar27           0x0	0x0
ar28           0x0	0x0
ar29           0x0	0x0
ar30           0x0	0x0
ar31           0x0	0x0
lbeg           0x0	0x0
lend           0x0	0x0
lcount         0x0	0x0
sar            0x0	0x0
windowbase     0x0	0x0
windowstart    0x1	0x1
sr176          0xc1a3dffe	0xc1a3dffe
sr208          0x14431885	0x14431885
ps             0x1f	0x1f
threadptr      0x0	0x0
scompare1      0x0	0x0
acclo          0x0	0x0
acchi          0x0	0x0
m0             0x0	0x0
m1             0x0	0x0
m2             0x0	0x0
m3             0x0	0x0
expstate       0x0	0x0
ptevaddr       0x0	0x0
mmid           0x0	0x0
rasid          0x4030200	0x4030200
itlbcfg        0x0	0x0
dtlbcfg        0x0	0x0
ibreakenable   0x0	0x0
atomctl        0x15	0x15
ddr            0x0	0x0
ibreaka0       0x0	0x0
ibreaka1       0x0	0x0
dbreaka0       0x0	0x0
dbreaka1       0x0	0x0
dbreakc0       0x0	0x0
dbreakc1       0x0	0x0
epc1           0x0	0x0
epc2           0x0	0x0
epc3           0x0	0x0
epc4           0x0	0x0
epc5           0x0	0x0
epc6           0x0	0x0
epc7           0x0	0x0
depc           0x0	0x0
eps2           0x0	0x0
eps3           0x0	0x0
eps4           0x0	0x0
eps5           0x0	0x0
eps6           0x0	0x0
eps7           0x0	0x0
excsave1       0x0	0x0
excsave2       0x0	0x0
excsave3       0x0	0x0
excsave4       0x0	0x0
excsave5       0x0	0x0
excsave6       0x0	0x0
excsave7       0x0	0x0
cpenable       0xff	0xff
interrupt      0x0	0x0
intset         0x0	0x0
intclear       0x0	0x0
intenable      0x0	0x0
vecbase        0x2000	0x2000
exccause       0x0	0x0
debugcause     0x0	0x0
ccount         0xec	0xec
prid           0x0	0x0
icount         0x0	0x0
icountlevel    0x0	0x0
excvaddr       0x0	0x0
ccompare0      0x0	0x0
ccompare1      0x0	0x0
ccompare2      0x0	0x0
misc0          0x0	0x0
misc1          0x0	0x0
a0             0x4c	0x4c
a1             0x0	0x0
a2             0x40000006	0x40000006
a3             0x3	0x3
a4             0x4000004c	0x4000004c
a5             0x40000000	0x40000000
a6             0x0	0x0
a7             0x40000005	0x40000005
a8             0x0	0x0
a9             0x0	0x0
a10            0x0	0x0
a11            0x0	0x0
a12            0x0	0x0
a13            0x0	0x0
a14            0x0	0x0
a15            0x0	0x0
psintlevel     0xf	0xf
psum           0x0	0x0
pswoe          0x0	0x0
psring         0x0	0x0
psexcm         0x1	0x1
pscallinc      0x0	0x0
psowb          0x0	0x0
acc            0x0	0x0
dbnum          0x0	0x0
asid3          0x4	0x4
asid2          0x3	0x3
asid1          0x2	0x2
instpgszid6    0x0	0x0
instpgszid5    0x0	0x0
instpgszid4    0x0	0x0
datapgszid6    0x0	0x0
datapgszid5    0x0	0x0
datapgszid4    0x0	0x0
ptbase         0x0	0x0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot_config_iss
Type: application/octet-stream
Size: 18398 bytes
Desc: not available
Url : http://lists.linux-xtensa.org/pipermail/linux-xtensa/attachments/20111209/98f89954/dot_config_iss-0001.obj

More information about the linux-xtensa mailing list