The Artima Developer Community
Sponsored Link

Java Buzz Forum
QEMU: The Open Source Processor Emulator

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
QEMU: The Open Source Processor Emulator Posted: Feb 20, 2006 7:34 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: QEMU: The Open Source Processor Emulator
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

I've been playing with QEMU for 47 days now. QEMU is an processor and system emulator written by Fabrice Bellard and released under the GPL(for binaries)/LGPL(for shared objects) licenses. I installed QEMU 0.8.0 on my AMD64/Fedora Core 4 Linux machine and created several guest images and installed different OSes on them, including several flavors of Linux and Windows.

By far the most challenging and the most fun OS to install and work with is MS Windows 3.1:

QEMU emulates a whole PC system with a Pentium II processor, PCI bus, a CirrusLogic graphics card, SoundBlaster 16 sound card, floppy drive, IDE hard drive, CD-ROM, and an Ethernet card. QEMU also provide the emulated system with a DHCP server and a SMB server.

The QEMU download for Linux is only 2.6MB in size, not as overwhelming as VMWare Server's 207MB total download. The QEMU documentation is extremely clear and helpful. The QEMU Users Forum is also a good source of information. (The MacOSX group is very active.)

To get started with the Windows 3.1 installation, all I have to do is:

[weiqi@gao] $ qemu-img create ms-windows.img 500M
[weiqi@gao] $ qemu -fda /dev/fd0 -boot a ms-windows.img

QEMU will create the hard drive image, and start booting from the floppy drive. From that point on, everything proceeds exactly as if I'm building a new machine, with one exception—QEMU can't detect floppy disk or CD-ROM disk changes. In addition to the physical act, I have to switch to the QEMU console (Ctrl-Alt-2) and issue commands to tell QEMU that the floppy disk has been changed:

QEMU 0.8.0 monitor - type 'help' for more information
(qemu) eject fda
(qemu) change fda /dev/fd0

My choice of MS Windows 3.1 as the guest OS is part pragmatism and part nostalgic. Pragmatic because it's small—MS-DOS 6.22 comes in three floppies, and MS Windows 3.1 in six. Nostalgic because I spent considerable amount of time there and I haven't seen it for a long time.

I'll spare you with the boring details of setting up a Windows 3.1 box except for noting how primitive it was and how compact it was. Both CD-ROM support and TCP/IP networking are add-ons to the OS. But it runs fine on 8MB of memory. Thanks to the internet, I'm able to find all the hardware drivers and a few applications.

I leave you with my CONFIG.SYS and AUTOEXEC.BAT:

C:\>type config.sys
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE NOEMS I=B000-B7FF WIN=B500-B7FF WIN=B200-B4FF
BUFFERS=10,0
FILES=50
DOS=UMB
LASTDRIVE=E
FCBS=16,8
DEVICEHIGH /L:2,12048 =C:\DOS\SETVER.EXE
DOS=HIGH
DEVICEHIGH /L:2,9872 =C:\SB16\DRV\CSP.SYS /UNIT=0 /BLASTER=A:220
STACKS=9,256
DEVICEHIGH /L:2,22896 =C:\CDPRO\VIDE-CDD.SYS /D:MSCD001 /P:1F0,14 /P:170,15 /P:1
E8,12 /P:168,10
SHELL=C:\DOS\COMMAND.COM C:\DOS\  /p
C:\>type autoexec.bat
@ECHO OFF
SET SOUND=C:\SB16
SET BLASTER=A220 I5 D1 H5 P330 T6
SET MIDI=SYNTH:1 MAP:E
C:\SB16\DIAGNOSE /S
C:\SB16\MIXERSET /P /Q
C:\WINDOWS\VGAUTIL\winmode.exe t640=75 t800=60 t1024=60 t1152=70 t1280=87 t1600=
0
LH /L:0;2,45456 /S C:\DOS\SMARTDRV.EXE
LH /L:2,13984 C:\DOS\SHARE.EXE /L:500
C:\DOSIDLE\DOSIDLE.EXE
LH /L:2,27952 C:\DOS\MSCDEX.EXE /D:MSCD001
LH /L:2,6384 C:\DOS\DOSKEY.COM
LH /L:2,9216 C:\CRYNWR\NE2000.COM 0x60 11 0xC100
LH /L:2,4144 C:\CRYNWR\WINPKT.COM 0x60
PROMPT $p$g
PATH C:\DOS;C:\GUPTA;C:\WINDOWS;c:\trumpet;C:\UTILS;C:\WIN31DDK\386\TOOLS;C:\WIN
31DDK\286\TOOLS
SET TEMP=C:\DOS
WIN

Oh, and finally, for the other six people on earth who also are trying to run Windows 3.1 in either QEMU or VMWare, I have solved the CPU usage reduction problem by writing my own VxD. This is a 32-bit virtual device driver that hooks the Windows primary scheduler's idle event and issues the privileged (ring 0) HLT instruction. It's similar to AMNHLT and DOSIDLE. I'm calling it WQGHLT and am making it available here.

This blog entry is composed in part in Netscape 4.08 for Windows 3.1 over Trumpet WinSock 3.0.

Read: QEMU: The Open Source Processor Emulator

Topic: Design Patterns in Java (and EJB) References Previous Topic   Next Topic Topic: [Feb 11, 2006 10:06 PST] 6 Links

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use