Skip to contentSkip to conversation

MIPS: UART access w/o -kernel option

Qemu-devel Alexander Voropay 1 participant 2 messages May 3, 2006 – May 9, 2006

lore
Share & tools
lore
#0 lore raw

Hi!

I'm still trying to run a MIPS mmon as a BIOS :)

I've found one strange issue : when it runs at the
KSEG0 region (0x80008000) with -kernel option it works fine. When I'm trying to run it in the MIPS BIOS region (0xbfc00000) it can't output anything to the UART and Qemu segfaults on the any keypress (not my program, but whole Qemu !)

Seems, UART is unmapped w/o -kernel option or something similar.
There was no such issue in the previous CVS (a week ago).

The "mmon-qemu" sourcecode and binaries are there:
http://www.nwpi.ru/~alec/mips/mmon-qemu-0.5.tgz

From the KSEG0 (run as kernel) :
=================
[alec@ilias mmon-qemu-0.5]$ ../qemu/bin/qemu-system-mipsel -nographic -kernel mmon.elf (qemu) Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal error, but for better emulation accuracy either use a 2.6 host Linux kernel or type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.
mips_r4k_init: load BIOS '/home/alec/mips/qemu/share/qemu/mips_bios.bin' size 131072
qemu: Warning, could not load MIPS bios '/home/alec/mips/qemu/share/qemu/mips_bios.bin'

mmon: VR4300 mini-monitor, Copyright 1996, 2003 Eric Smith <[email protected]>

Quoted 1 line

?

Commands:

db <addr1> [<addr2>]       dump bytes from addr1 to addr2
dh <addr1> [<addr2>]       dump half-words (16 bits)
dw <addr1> [<addr2>]       dump words (32 bits)
sb <addr> <data>...        store byte
sh <addr> <data>...        store half-word (16 bits)
sw <addr> <data>...        store word (32 bits)
swl <addr> <data>          store word left
swr <addr> <data>          store word right
fb <addr1> <addr2> <data>  fill bytes of memory range
fh <addr1> <addr2> <data>  fill half-words
fw <addr1> <addr2> <data>  fill words
l                          load S-records
g [<addr>]                 go (start execution at address)
h                          help (show this command list)
Quoted 1 line

db bfc00000

BFC00000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
BFC00010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
BFC00020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
BFC00030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==========================

From the KSEG1 (i'm using a stub file "reset" )
==========================
[alec@ilias mmon-qemu-0.5]$ ../qemu/bin/qemu-system-mipsel -nographic -L . reset (qemu) Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal error, but for better emulation accuracy either use a 2.6 host Linux kernel or type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.
mips_r4k_init: load BIOS './mips_bios.bin' size 131072
Segmentation fault (core dumped)

[alec@ilias mmon-qemu-0.5]$ gdb -c core.15214
GNU gdb Red Hat Linux (6.1post-1.20040607.62rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu".
Core was generated by `../qemu/bin/qemu-system-mipsel -nographic -L'. Program terminated with signal 11, Segmentation fault.
#0 0x00000000 in ?? ()
(gdb) bt

#0  0x00000000 in ?? ()
#1  0x0804b4c7 in ?? ()
#2  0x00000000 in ?? ()

==========================

--
-=AV=-

#1 lore raw
Quoted 7 lines · Alexander Voropay

I'm still trying to run a MIPS mmon as a BIOS :)

I've found one strange issue : when it runs at the KSEG0 region (0x80008000) with -kernel option it works fine. When I'm trying to run it in the MIPS BIOS region (0xbfc00000) it can't output anything to the UART and Qemu segfaults on the any keypress (not my program, but whole Qemu !)

I've found this bug : hw/mips_r4k.c:mips_r4k_init()

Qemu/MIPS does not initialize an ISA memory region when issued without -kernel option. (I've added some debug output).

Whith -kernel:
cpu_register_physical_memory: start=00000000, size=08000000, offset=00000000 cpu_register_physical_memory: start=14000000, size=00010000, offset=00000050 cpu_register_physical_memory: start=100A0000, size=00020000, offset=00000060 cpu_register_physical_memory: start=E0000000, size=00400000, offset=08000000

Without -kernel:
cpu_register_physical_memory: start=00000000, size=08000000, offset=00000000 cpu_register_physical_memory: start=1FC00000, size=00020000, offset=08400010 Segmentation fault

Could someone correct this ? The ISA region and devices initialization should be performed *before* any fileload.

P.S. The MIPS initial state (PC=0xbfc00000) is defined twice in the qemu: ./target-mips/translate.c:cpu_mips_init():1766 and
./hw/mips_r4k.c:mips_r4k_init()

Seems, this is a bug too.

--
-=AV=-