Skip to contentSkip to conversation

Add more devices for MIPS system emulation

PATCH In review Thiemo Seufer 2 participants 8 messages Feb 21, 2006 – Mar 11, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add more devices for MIPS system emulation

Hello All,

this adds to the MIPS system emulation:
- Harddisk emulation, including MSDOS partition labels.
- RTC support.
- (Untested) Audio, PC Keyboard, and PS/2 suport.

Thiemo

Makefile.target +5 -2
diff -urpN qemu-work/Makefile.target qemu/Makefile.target
@@ -333,8 +333,11 @@ VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o a
 DEFINES += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_ARCH), mips)
-VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
-#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
+VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
+VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o mips_r4k.o
+VL_OBJS+= mixeng.o
+#VL_OBJS+= #fdc.o
+DEFINES += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sparc)
 ifeq ($(TARGET_ARCH), sparc64)
hw/mips_r4k.c +75 -1

150 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Thiemo Seufer

Hello All,

this adds to the MIPS system emulation:
- Harddisk emulation, including MSDOS partition labels.

Why do you need the bootsector bits? IIUC this was an x86 specific hack to make the x86 bios load the kernel passed with -kernel.
The MIPS emulation jumps directly to the loaded kernel, so this should not be necessary.

Paul

#2 lore raw
Quoted 10 lines · Paul Brook
Quoted 4 lines · Thiemo Seufer

Hello All,

this adds to the MIPS system emulation:
- Harddisk emulation, including MSDOS partition labels.

Why do you need the bootsector bits? IIUC this was an x86 specific hack to make the x86 bios load the kernel passed with -kernel.
The MIPS emulation jumps directly to the loaded kernel, so this should not be necessary.

That's the current state since there is no real mips firmware, but Qemu should also be able to boot from an image. E.g. Linux/MIPS on DECstations uses MSDOS disklabels.

Thiemo

#3 lore raw
Quoted 7 lines · Thiemo Seufer
Quoted 6 lines · Paul Brook
Quoted 4 lines · Thiemo Seufer

Hello All,

this adds to the MIPS system emulation:
- Harddisk emulation, including MSDOS partition labels.

Quoted 8 lines
Quoted 4 lines

Why do you need the bootsector bits? IIUC this was an x86 specific hack to make the x86 bios load the kernel passed with -kernel. The MIPS emulation jumps directly to the loaded kernel, so this should not be necessary.

That's the current state since there is no real mips firmware, but Qemu should also be able to boot from an image. E.g. Linux/MIPS on DECstations uses MSDOS disklabels.

I don't see how providing a fake an x86 boot sector would help this. Presumably the DECstation firmware just knows how to load an image from disk.

Paul

#4 lore raw
Quoted 13 lines · Paul Brook
Quoted 12 lines · Thiemo Seufer
Quoted 10 lines · Paul Brook
Quoted 4 lines · Thiemo Seufer

Hello All,

this adds to the MIPS system emulation:
- Harddisk emulation, including MSDOS partition labels.

Why do you need the bootsector bits? IIUC this was an x86 specific hack to make the x86 bios load the kernel passed with -kernel. The MIPS emulation jumps directly to the loaded kernel, so this should not be necessary.

Quoted 6 lines
Quoted 3 lines

That's the current state since there is no real mips firmware, but Qemu should also be able to boot from an image. E.g. Linux/MIPS on DECstations uses MSDOS disklabels.

I don't see how providing a fake an x86 boot sector would help this. Presumably the DECstation firmware just knows how to load an image from disk.

It loads a block sector list from the bootsector which points to the second stage bootloader.

Thiemo

#5 lore raw
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

That's the current state since there is no real mips firmware, but Qemu should also be able to boot from an image. E.g. Linux/MIPS on DECstations uses MSDOS disklabels.

I don't see how providing a fake an x86 boot sector would help this. Presumably the DECstation firmware just knows how to load an image from disk.

It loads a block sector list from the bootsector which points to the second stage bootloader.

The existing linux.bin definitely won't do what you want then.

In any case until the MIPS emulation can emulate a DECstation and we have a corresponding BIOS that we can distribute, your patch just breaks diskless MIPS emulation for no apparent benefit.

Paul

#6 lore raw
Quoted 8 lines · Paul Brook
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

That's the current state since there is no real mips firmware, but Qemu should also be able to boot from an image. E.g. Linux/MIPS on DECstations uses MSDOS disklabels.

I don't see how providing a fake an x86 boot sector would help this. Presumably the DECstation firmware just knows how to load an image from disk.

Quoted 8 lines
Quoted 2 lines

It loads a block sector list from the bootsector which points to the second stage bootloader.

The existing linux.bin definitely won't do what you want then.

In any case until the MIPS emulation can emulate a DECstation and we have a corresponding BIOS that we can distribute, your patch just breaks diskless MIPS emulation for no apparent benefit.

I updated the patch to allow for that again, and added an ELF loader on top to avoid hardcoded kernel load addresses/entry points. This is also useful for stand-alone programs. The ramdisk and command line addresses are still hardcoded.

Thiemo

Makefile.target +5 -2
Index: qemu-work/Makefile.target
===================================================================
@@ -333,8 +333,11 @@
 DEFINES += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_ARCH), mips)
-VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
-#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
+VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
+VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o mips_r4k.o
+VL_OBJS+= mixeng.o
+#VL_OBJS+= #fdc.o
+DEFINES += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sparc)
 ifeq ($(TARGET_ARCH), sparc64)
hw/mips_r4k.c +197 -38

311 lines not on this page · raw message

#7 lore raw
Quoted 4 lines

I updated the patch to allow for that again, and added an ELF loader on top to avoid hardcoded kernel load addresses/entry points. This is also useful for stand-alone programs. The ramdisk and command line addresses are still hardcoded.

Except now you can't load raw kernel images.

I'm still not convinced the boot sector hacks can do anything useful How exactly are you using these? You say the DECstation bios uses offsets stored in the boot sector to locate the second stage bootloader, but:
a) We aren't using a DECstation bios. I'm guessing we're not emulating DECstation hardware, so it wouldn't work even if we did have one.
b) You haven't modified the boot sector to provide those offsets.
c) You're only replacing the boot sector itself. Even if you did insert the correct offsets they'd still be pointing to random bits of user data, not the kernel you want to boot.

Paul