I have images that boot under qemu-system-sh4 at:

  http://landley.net/aboriginal/bin/system-image-sh4.tar.bz2

But in order to get them to work with current kernels, I have to apply the attached sh4.patch to qemu.

What I did with earlier kernels was apply the attached linux-fixsh4-2.patch but more recent kernels added another access to the same register somewhere and the proper fix is for qemu to ignore it (it's a NOP) rather than exiting the emulator.

Rob
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index b328643..81d374a 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -248,11 +248,9 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs,
                     s->flags &= ~SH_SERIAL_FLAG_RDF;
             }
             break;
-#if 0
         case 0x18:
             ret = s->fcr;
             break;
-#endif
         case 0x1c:
             ret = s->rx_cnt;
             break;
This is "the wrong fix".  The correct fix is to qemu (take out the "#ifdef 0"
around the 0x18 case in hw/sh_serial.c line 250 or so, or just don't
abort() on unknown register reads), and I pinged the qemu
mailing list about that, but this works with existing qemu releases.

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 1bd9163..fa043f1 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1879,7 +1879,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	sci_init_pins(port, termios->c_cflag);
 
-	reg = sci_getreg(port, SCFCR);
+	reg = sci_getreg(port, 0x30);
 	if (reg->size) {
 		unsigned short ctrl = serial_port_in(port, SCFCR);
 

Reply via email to