/[gxemul]/trunk/doc/misc.html
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/doc/misc.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Mon Oct 8 16:21:17 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/html
File size: 21062 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1480 2007/02/19 01:34:42 debug Exp $
20061029	Changing usleep(1) calls in the debugger to usleep(10000)
20061107	Adding a new disk image option (-d o...) which sets the ISO9660
		filesystem base offset; also making some other hacks to allow
		NetBSD/dreamcast and homebrew demos/games to boot directly
		from a filesystem image.
		Moving Dreamcast-specific stuff in the documentation to its
		own page (dreamcast.html).
		Adding a border to the Dreamcast PVR framebuffer.
20061108	Adding a -T command line option (again?), for halting the
		emulator on unimplemented memory accesses.
20061109	Continuing on various SH4 and Dreamcast related things.
		The emulator should now halt on more unimplemented device
		accesses, instead of just printing a warning, forcing me to
		actually implement missing stuff :)
20061111	Continuing on SH4 and Dreamcast stuff.
		Adding a bogus Landisk (SH4) machine mode.
20061112	Implementing some parts of the Dreamcast GDROM device. With
		some ugly hacks, NetBSD can (barely) mount an ISO image.
20061113	NetBSD/dreamcast now starts booting from the Live CD image,
		but crashes randomly quite early on in the boot process.
20061122	Beginning on a skeleton interrupt.h and interrupt.c for the
		new interrupt subsystem.
20061124	Continuing on the new interrupt system; taking the first steps
		to attempt to connect CPUs (SuperH and MIPS) and devices
		(dev_cons and SH4 timer interrupts) to it. Many things will
		probably break from now on.
20061125	Converting dev_ns16550, dev_8253 to the new interrupt system.
		Attempting to begin to convert the ISA bus.
20061130	Incorporating a patch from Brian Foley for the configure
		script, which checks for X11 libs in /usr/X11R6/lib64 (which
		is used on some Linux systems).
20061227	Adding a note in the man page about booting from Dreamcast
		CDROM images (i.e. that no external kernel is needed).
20061229	Continuing on the interrupt system rewrite: beginning to
		convert more devices, adding abort() calls for legacy interrupt
		system calls so that everything now _has_ to be rewritten!
		Almost all machine modes are now completely broken.
20061230	More progress on removing old interrupt code, mostly related
		to the ISA bus + devices, the LCA bus (on AlphaBook1), and
		the Footbridge bus (for CATS). And some minor PCI stuff.
		Connecting the ARM cpu to the new interrupt system.
		The CATS, NetWinder, and QEMU_MIPS machine modes now work with
		the new interrupt system :)
20061231	Connecting PowerPC CPUs to the new interrupt system.
		Making PReP machines (IBM 6050) work again.
		Beginning to convert the GT PCI controller (for e.g. Malta
		and Cobalt emulation). Some things work, but not everything.
		Updating Copyright notices for 2007.
20070101	Converting dev_kn02 from legacy style to devinit; the 3max
		machine mode now works with the new interrupt system :-]
20070105	Beginning to convert the SGI O2 machine to the new interrupt
		system; finally converting O2 (IP32) devices to devinit, etc.
20070106	Continuing on the interrupt system redesign/rewrite; KN01
		(PMAX), KN230, and Dreamcast ASIC interrupts should work again,
		moving out stuff from machine.h and devices.h into the
		corresponding devices, beginning the rewrite of i80321
		interrupts, etc.
20070107	Beginning on the rewrite of Eagle interrupt stuff (PReP, etc).
20070117	Beginning the rewrite of Algor (V3) interrupts (finally
		changing dev_v3 into devinit style).
20070118	Removing the "bus" registry concept from machine.h, because
		it was practically meaningless.
		Continuing on the rewrite of Algor V3 ISA interrupts.
20070121	More work on Algor interrupts; they are now working again,
		well enough to run NetBSD/algor. :-)
20070122	Converting VR41xx (HPCmips) interrupts. NetBSD/hpcmips
		can be installed using the new interrupt system :-)
20070123	Making the testmips mode work with the new interrupt system.
20070127	Beginning to convert DEC5800 devices to devinit, and to the
		new interrupt system.
		Converting Playstation 2 devices to devinit, and converting
		the interrupt system. Also fixing a severe bug: the interrupt
		mask register on Playstation 2 is bitwise _toggled_ on writes.
20070128	Removing the dummy NetGear machine mode and the 8250 device
		(which was only used by the NetGear machine).
		Beginning to convert the MacPPC GC (Grand Central) interrupt
		controller to the new interrupt system.
		Converting Jazz interrupts (PICA61 etc.) to the new interrupt
		system. NetBSD/arc can be installed again :-)
		Fixing the JAZZ timer (hardcoding it at 100 Hz, works with
		NetBSD and it is better than a completely dummy timer as it
		was before).
		Converting dev_mp to the new interrupt system, although I
		haven't had time to actually test it yet.
		Completely removing src/machines/interrupts.c, cpu_interrupt
		and cpu_interrupt_ack in src/cpu.c, and
		src/include/machine_interrupts.h! Adding fatal error messages
		+ abort() in the few places that are left to fix.
		Converting dev_z8530 to the new interrupt system.
		FINALLY removing the md_int struct completely from the
		machine struct.
		SH4 fixes (adding a PADDR invalidation in the ITLB replacement
		code in memory_sh.c); the NetBSD/dreamcast LiveCD now runs
		all the way to the login prompt, and can be interacted with :-)
		Converting the CPC700 controller (PCI and interrupt controller
		for PM/PPC) to the new interrupt system.
20070129	Fixing MACE ISA interrupts (SGI IP32 emulation). Both NetBSD/
		sgimips' and OpenBSD/sgi's ramdisk kernels can now be
		interacted with again.
20070130	Moving out the MIPS multi_lw and _sw instruction combinations
		so that they are auto-generated at compile time instead.
20070131	Adding detection of amd64/x86_64 hosts in the configure script,
		for doing initial experiments (again :-) with native code
		generation.
		Adding a -k command line option to set the size of the dyntrans
		cache, and a -B command line option to disable native code
		generation, even if GXemul was compiled with support for
		native code generation for the specific host CPU architecture.
20070201	Experimenting with a skeleton for native code generation.
		Changing the default behaviour, so that native code generation
		is now disabled by default, and has to be enabled by using
		-b on the command line.
20070202	Continuing the native code generation experiments.
		Making PCI interrupts work for Footbridge again.
20070203	More native code generation experiments.
		Removing most of the native code generation experimental code,
		it does not make sense to include any quick hacks like this.
		Minor cleanup/removal of some more legacy MIPS interrupt code.
20070204	Making i80321 interrupts work again (for NetBSD/evbarm etc.),
		and fixing the timer at 100 Hz.
20070206	Experimenting with removing the wdc interrupt slowness hack.
20070207	Lowering the number of dyntrans TLB entries for MIPS from
		192 to 128, resulting in a minor speed improvement.
		Minor optimization to the code invalidation routine in
		cpu_dyntrans.c.
20070208	Increasing (experimentally) the nr of dyntrans instructions per
		loop from 60 to 120.
20070210	Commenting out (experimentally) the dyntrans_device_danger
		detection in memory_rw.c.
		Changing the testmips and baremips machines to use a revision 2
		MIPS64 CPU by default, instead of revision 1.
		Removing the dummy i960, IA64, x86, AVR32, and HP PA-RISC
		files, the PC bios emulation, and the Olivetti M700 (ARC) and
		db64360 emulation modes.
20070211	Adding an "mp" demo to the demos directory, which tests the
		SMP functionality of the testmips machine.
		Fixing PReP interrupts some more. NetBSD/prep now boots again.
20070216	Adding a "nop workaround" for booting Mach/PMAX to the
		documentation; thanks to Artur Bujdoso for the values.
		Converting more of the MacPPC interrupt stuff to the new
		system.
		Beginning to convert BeBox interrupts to the new system.
		PPC603e should NOT have the PPC_NO_DEC flag! Removing it.
		Correcting BeBox clock speed (it was set to 100 in the NetBSD
		bootinfo block, but should be 33000000/4), allowing NetBSD
		to start without using the (incorrect) PPC_NO_DEC hack.
20070217	Implementing (slow) AltiVec vector loads and stores, allowing
		NetBSD/macppc to finally boot using the GENERIC kernel :-)
		Updating the documentation with install instructions for
		NetBSD/macppc.
20070218-19	Regression testing for the release.

==============  RELEASE 0.4.4  ==============


1 <html><head><title>Gavare's eXperimental Emulator:&nbsp;&nbsp;&nbsp;Miscellaneous</title>
2 <meta name="robots" content="noarchive,nofollow,noindex"></head>
3 <body bgcolor="#f8f8f8" text="#000000" link="#4040f0" vlink="#404040" alink="#ff0000">
4 <table border=0 width=100% bgcolor="#d0d0d0"><tr>
5 <td width=100% align=center valign=center><table border=0 width=100%><tr>
6 <td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6">
7 <b>Gavare's eXperimental Emulator:</b></font><br>
8 <font color="#000000" size="6"><b>Miscellaneous</b>
9 </font></td></tr></table></td></tr></table><p>
10
11 <!--
12
13 $Id: misc.html,v 1.66 2006/12/30 13:30:51 debug Exp $
14
15 Copyright (C) 2003-2007 Anders Gavare. All rights reserved.
16
17 Redistribution and use in source and binary forms, with or without
18 modification, are permitted provided that the following conditions are met:
19
20 1. Redistributions of source code must retain the above copyright
21 notice, this list of conditions and the following disclaimer.
22 2. Redistributions in binary form must reproduce the above copyright
23 notice, this list of conditions and the following disclaimer in the
24 documentation and/or other materials provided with the distribution.
25 3. The name of the author may not be used to endorse or promote products
26 derived from this software without specific prior written permission.
27
28 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
29 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
32 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 SUCH DAMAGE.
39
40 -->
41
42
43 <a href="./">Back to the index</a>
44
45 <p><br>
46 <h2>Miscellaneous</h2>
47
48 <p>
49 <ul>
50 <li><a href="#devel">Writing operating system code, or
51 developing firmware, using GXemul</a>
52 <li><a href="#compilercontruct">Using GXemul in compiler contruction courses</a>
53 <li><a href="#disk">How to start the emulator with a disk image</a>
54 <li><a href="#filexfer">Transfering files to/from the guest OS</a>
55 <li><a href="#largeimages">How to extract large gzipped disk images</a>
56 <li><a href="#userland">Running userland binaries</a>
57 <li><a href="#promdump">Using a PROM dump from a real machine</a>
58 </ul>
59
60
61
62
63
64
65
66
67
68 <p><br>
69 <a name="devel"></a>
70 <h3>Writing operating system code, or developing firmware, using GXemul:</h3>
71
72 Is this a good idea? The answer is yes and no, depending on the level of
73 detail you need in your simulations. If you are developing an operating
74 system or operating system kernel of your own, then the emulator can be a
75 complement to testing on real hardware.
76
77 <p>Important things to keep in mind:
78
79 <ul>
80 <li>Porting code to a specific machine mode, e.g. a Silicon Graphics
81 machine, using GXemul, will not "magically" cause the code to
82 work on a real machine. Sometimes code works in GXemul which doesn't
83 work on real hardware, sometimes it's the other way around.
84
85 <p>
86 <li>GXemul contains bugs, and many things are not yet implemented.
87
88 <p>
89 <li><b>Very important!</b> I have only implemented devices in GXemul
90 to the degree that NetBSD, OpenBSD, Linux, etc don't complain too much.
91 <p>
92 If you are developing a driver for a device which is emulated by
93 GXemul, and your driver does not seem to be working, then the
94 probability of a bug in GXemul's implementation of the device is
95 very much higher than that of a bug in your driver.
96 <p>
97 The device implementations in GXemul are based on the assumption
98 that the emulated OS is already developed and bug-free. They are
99 not primarily intended to be used for development of new device
100 driver code in operating systems, so if you do that, then be
101 prepared for bugs and inconsitencies.
102 <p>
103 <li>CPU details in GXemul are usually wrong. If your code depends
104 on, say, R10000 or MIPS64 specifics, chances are that GXemul will
105 not be sufficient. One example is different revisions of ISAs;
106 some instructions which should trigger an exception on a
107 real MIPS processor usually execute anyway in GXemul. Another
108 example is if userland code tries to access kernel memory; in some
109 cases there is protection against this, but not in all cases (to get
110 higher performance).
111 <p>
112 <li>Caches. There is no cache emulation in GXemul right now. Caches
113 for R2000/R3000 are faked well enough to run NetBSD, Ultrix, etc
114 in the DECstation emulation mode, but other than that, cache
115 operations are treated as nops.
116 </ul>
117
118 <p>The bottom line is that GXemul can be useful as yet another way to test
119 your code during development, but it should not be fully relied on.
120
121
122
123
124
125
126 <p><br>
127 <a name="compilercontruct"></a>
128 <h3>Using GXemul in compiler contruction courses:</h3>
129
130 If you are learning how to write a compiler, and wish to target a
131 realistic target platform, then MIPS or ARM (as emulated by GXemul)
132 might be suitable choices.
133
134 <ul>
135 <li><b>(+)</b>&nbsp;&nbsp;Your compiler needs to output real assembly
136 language code, which the assembler (e.g. gas, the GNU assembler) can
137 then compile into object format, and then you need to link this
138 into an executable image. This is much closer to how things work
139 in real life than running assembly language listings in a simulator
140 (e.g. SPIM).
141 <p>
142 <li><b>(-)</b>&nbsp;&nbsp;GXemul does not simulate out-of-order
143 execution, penalties related to instruction scheduling, or
144 load-delays, so it cannot be used to create optimizing compilers
145 that take advantage of such processor features. GXemul keeps
146 track of the number of instructions executed, but that's it.
147 </ul>
148
149
150
151
152
153
154 <p><br>
155 <a name="disk"></a>
156 <h3>How to start the emulator with a disk image:</h3>
157
158 Add <i>-d [prefixes:]diskimagefilename</i> to the command line, where prefixes
159 are one or more single-character options. Run <b>gxemul -h</b>
160 to get a list of possible options.
161
162 <p>
163 Here are some examples. If you want to run a NetBSD/pmax kernel on an
164 emulated DECstation machine, you would use a command line such as this:
165 <pre>
166 $ <b>gxemul -e 3max -d pmax_diskimage.fs netbsd-pmax-INSTALL</b>
167 </pre>
168
169 <p>NOTE: For some emulation modes, such as the DECstation mode, you do
170 <i>not</i> actually have to specify the name of the kernel, if the disk
171 image is bootable!
172
173 <p>It is possible to have more than one disk. For each -d argument, a disk
174 image is added; the first will be SCSI target 0, the second will be target 1, and so on,
175 unless you specify explicitly which ID number the devices should have.
176 <pre>
177 $ <b>gxemul -e 3max -d disk0.raw -d disk1.raw -d 5:disk2.raw netbsd-pmax-INSTALL</b>
178 </pre>
179 Note: In the example above, disk2.raw will get scsi id 5.
180
181 <p>If a filename has a 'c' prefix, or ends with ".iso", then it is assumed to be
182 a CDROM device (this can be overridden with a 'd' prefix, to force a read/write disk).
183 For example, the following command would start the emulator with two
184 CDROM images, and one harddisk image:
185 <pre>
186 $ <b>gxemul -e 3max -d image.iso -d disk0.img -d c:second_cdrom.img netbsd-pmax-INSTALL</b>
187 </pre>
188 Usually, the device with the lowest id becomes the boot device. To override
189 this, add a 'b' prefix to one of the devices:
190 <pre>
191 $ <b>gxemul -e 3max -d rootdisk.img -d bc:install-cd.iso name_of_kernel</b>
192 </pre>
193 If you have a physical CD-ROM drive on the host machine, say /dev/cd0c, you can
194 use it as a CD-ROM directly accessible from within the emulator:
195 <pre>
196 $ <b>gxemul -e 3max -d rootdisk.img -d bc:/dev/cd0c name_of_kernel</b>
197 </pre>
198 It is probably possible to use harddisks as well this way, but I would not
199 recommend it.
200 <p>
201 Using emulated tape drives is a bit more complicated than disks, because a
202 tape can be made up of several "files" with space in between. The solution
203 I have choosen is to have one file in the host's file system space for each
204 tape file. The prefix for using tapes is 't', and the filename given is
205 for the <i>first</i> file on that tape (number zero, implicitly). For
206 files following file nr 0, a dot and the filenumber is appended to the
207 filename.
208 <p>
209 As an example, starting the emulator with
210 <pre>
211 <b>-d t4:mytape.img</b>
212 </pre>
213 will cause SCSI id 4 to be a tape device, using the following file number
214 to name translation scheme:
215 <p>
216 <center>
217 <table border="0">
218 <tr>
219 <td><b>File number:</b></td>
220 <td><b>File name in the host's filesystem:</b></td>
221 </tr>
222 <tr>
223 <td align="center">0</td>
224 <td align="left">mytape.img</td>
225 </tr>
226 <tr>
227 <td align="center">1</td>
228 <td align="left">mytape.img.1</td>
229 </tr>
230 <tr>
231 <td align="center">2</td>
232 <td align="left">mytape.img.2</td>
233 </tr>
234 <tr>
235 <td align="center">..</td>
236 <td align="left">..</td>
237 </tr>
238 </table>
239 </center>
240 <p>
241 If you already have a number of tape files, which should be placed on the
242 same emulated tape, then you might not want to rename all those files.
243 Use symbolic links instead (ln -s).
244 <p>
245 There is another advantage to using symbolic links for tape filenames:
246 every time a tape is rewound, it is reopened using the filename given
247 on the command line. By changing what the symbolic name points to,
248 you can "switch tapes" without quiting and restarting the emulator.
249
250
251
252
253
254
255 <p><br>
256 <a name="filexfer"></a>
257 <h3>Transfering files to/from the guest OS:</h3>
258
259 If the emulated machine supports networking (see <a
260 href="networking.html#intro">this section</a> for more info), then
261 transfering files via FTP is probably easiest.
262
263 <p>There is another way of transfering files which works for any kind of
264 emulated machine which supports disks (either SCSI or IDE). Any file can
265 be supplied as a disk image. For example, consider the following:<pre>
266 $ <b>gxemul -XEcats -d nbsd_cats.img -d archive.tar.gz netbsd-GENERIC</b>
267 </pre>
268 This will start NetBSD/cats with <tt>nbsd_cats.img</tt> as IDE master on
269 controller 0 (wd0), and <tt>archive.tar.gz</tt> as IDE slave on controller
270 0 (wd1). From inside NetBSD, it is now possible to extract the files using
271 the following command:<pre>
272 (inside emulated NetBSD/cats)
273 # <b>tar zxvf /dev/wd1c</b>
274 </pre>
275 Don't worry if NetBSD complains about lack of disklabel; it doesn't
276 matter. On some machines, NetBSD uses <tt>wd1d</tt> instead of
277 <tt>wd1c</tt> for the entire disk.
278 There is also a minor problem: reading the end of the disk image. If you
279 experience problems untaring archives like this, then pad out the archive
280 first with some zeroes.
281
282 <p>Transfering files <i>out</i> from the emulated operating system to the
283 host can be done the same way. First, prepare an empty archive file:<pre>
284 $ <b>dd if=/dev/zero of=newarchive.tar bs=1024 count=1 seek=10000</b>
285 </pre>This example created a 10 MB empty file. Then, start the emulator
286 like this:<pre>
287 $ <b>gxemul -XEcats -d nbsd_cats.img -d archive.tar netbsd-GENERIC</b>
288 </pre>
289 and transfer files by creating an archive directly onto the disk image:<pre>
290 (inside emulated NetBSD/cats)
291 # <b>tar cvf /dev/wd1c filenames</b>
292 </pre>
293 where filenames are the files or directories to transfer.
294
295
296
297
298
299 <p><br>
300 <a name="largeimages"></a>
301 <h3>How to extract large gzipped disk images:</h3>
302
303 Unix filesystems usually support large files with "holes". Holes are
304 zero-filled blocks that don't actually exist on disk. This is very
305 practical for emulated disk images, as it is possible to create a very
306 large disk image without using up much space at all.
307
308 <p>
309 Using gzip and gunzip on disk images can be <i>very</i> slow, as these
310 files can be multiple gigabytes large, but this is usually necessary for
311 transfering disk images over the internet. If you receive a gzipped disk
312 image, say disk.img.gz, and run a naive
313 <p>
314 <pre>
315 $ <b>gunzip disk.img.gz</b>
316 </pre>
317 <p>
318 on it, you will not end up with an optimized file unless
319 gunzip supports that. (In my experiments, it doesn't.) In plain English,
320 if you type <b>ls -l</b> and the filesize is 9 GB, it will actually occupy
321 9 GB of disk space! This is often unacceptable.
322 <p>
323 Using a simple tool which only writes blocks that are non-zero, a lot of
324 space can be saved. Compile the program cp_removeblocks in the
325 experiments/ directory, and type:
326 <p>
327 <pre>
328 $ <b>gunzip -c disk.img.gz | cp_removeblocks /dev/stdin disk.img</b>
329 </pre>
330
331 <p>
332 This will give you a disk.img which looks like it is 9 GB, and works like
333 the real file, but the holes are not written out to the disk. (You can see
334 this by running for example <b>du disk.img</b> to see the physical block
335 count.)
336
337
338
339 <p><br>
340 <a name="userland"></a>
341 <h3>Running userland binaries:</h3>
342
343 <font color="#ff0000">Note: This feature does not really work yet.
344 It is currently disabled in stable release builds of the emulator.</font>
345
346 <p>There is some skeleton code for running userland programs as well. This
347 will not emulate any particular machine, but instead try to translate
348 syscalls from e.g. NetBSD/pmax into the host's OS' syscalls. Right now,
349 this is just a proof-of-concept, to show that it could work; there's lots
350 of work left to do to make it actually run useful programs.
351
352 <p>
353
354 <ul>
355 <li><b>NetBSD/pmax:</b>
356 <br>
357 Running /bin/hostname or /bin/date and similarly trivial
358 programs from the NetBSD/pmax distribution works:<pre>
359 $ <b>gxemul -q -u netbsd/pmax pmax_bin_hostname</b>
360 tab.csbnet.se
361 $ <b>gxemul -q -u netbsd/pmax pmax_bin_date</b>
362 Sun Jan 25 02:26:14 GMT 2004
363 $ <b>gxemul -q -u netbsd/pmax pmax_bin_sleep</b>
364 usage: pmax_bin_sleep seconds
365 $ <b>gxemul -q -u netbsd/pmax pmax_bin_sleep 5</b>
366 $ <b>gxemul -q -u netbsd/pmax pmax_bin_sync</b>
367 </pre>
368
369 <p>
370 <li><b>Ultrix:</b>
371 <br>
372 At least /bin/date and /bin/hostname work:<pre>
373 $ <b>gxemul -q -u ultrix ultrix4_bin_date</b>
374 UNIMPLEMENTED ultrix syscall 54
375 UNIMPLEMENTED ultrix syscall 62
376 Mon Feb 9 12:50:59 WET 2004
377 $ <b>gxemul -q -u ultrix ultrix4_bin_hostname</b>
378 tab.csbnet.se
379 </pre>
380
381 <!--
382 <p>
383 <li><b>NetBSD/powerpc:</b>
384 <br>
385 /bin/sync from NetBSD/macppc works, but probably not much else.<pre>
386 $ <b>gxemul -v -u netbsd/powerpc netbsd-1.6.2-macppc-bin-sync</b>
387 ...
388 [ sync() ]
389 [ exit(0) ]
390 cpu_run_deinit(): All CPUs halted.
391
392 </pre>
393
394 <p>
395 <li><b>Linux/PPC64:</b>
396 <br>
397 The <a href="http://www-106.ibm.com/developerworks/library/l-ppc/#h13">64-bit Hello World assembly language example</a>
398 on IBM's developerWorks pages runs:<pre>
399 $ <b>ppc64-unknown-linux-as hello-ppc64.s -o hello-ppc64.o</b>
400 $ <b>ppc64-unknown-linux-ld hello-ppc64.o -o hello-ppc64</b>
401 $ <b>gxemul -q -u linux/ppc64 hello-ppc64</b>
402 Hello, world!
403
404 </pre>
405 -->
406
407 </ul>
408
409
410
411
412
413 <p><br>
414 <a name="promdump"></a>
415 <h3>Using a PROM dump from a real machine:</h3>
416
417 Raw PROM images from real machines can, in a few cases, be used in
418 the emulator. ROM code is usually much more sensitive to correctness
419 of the emulator than operating system kernels or userland programs
420 are, so don't expect any PROM image to just magically work.
421
422
423 <p>
424 <h4>Dumping the PROM on a DECstation 5000/125:</h4>
425 The image first needs to be extracted from the machine. There are
426 several ways to do this.
427 <ul>
428 <li>Use hardware to read the PROM chip(s) directly. Not easy if you
429 don't have such a hardware reader.
430 <li>Copy the PROM memory range into a file, from a running
431 operating system. You need a running OS, and it must
432 have access to the PROM memory range. NetBSD, for example,
433 doesn't allow that from userland.
434 <li>Hook up a serial console and dump using the PROM's own dump
435 command.
436 </ul>
437 <p>
438 The easiest way is to hook up a serial console. The terminal must be
439 able to capture output to a file.
440 <p>
441 These are approximately the commands that I used:
442 <pre>
443 >><b>cnfg</b> <i>Show machine configuration</i>
444
445 >><b>printenv</b> <i>Show environment variables</i>
446
447 >><b>setenv more 0</b> <i>This turns off the More messages</i>
448
449 >><b>e -x 0xbfc00000:0xbfffffff</b> <i>Dump the PROM data</i>
450 </pre>
451 <p>
452 Remember that DECstations are little endian, so if the dump data
453 looks like this:
454 <pre>
455 bfc00000: 0x0bf0007e
456 </pre>
457 then the bytes in memory are actually 0x7e, 0x00, 0xf0, and 0x0b.
458 <p>
459 At 9600 bps, about 10KB can be dumped per minute, so it takes a while.
460 Once enough of the PROM has been dumped, you can press CTRL-C to break out.
461 Then, restore the more environment variable:
462 <pre>
463 >><b>setenv more 24</b>
464 </pre>
465 <p>
466 Now, convert the data you just saved (little-endian words -> bytes),
467 and store in a file. Let's call this file DECstation5000_125_promdump.bin.
468 <pre>
469 $ <b>decprom_dump_txt_to_bin DECstation5000_125_promdump.txt DECstation5000_125_promdump.bin</b>
470 </pre>
471 This binary image can now be used in the emulator:
472 <pre>
473 $ <b>gxemul -e 3min -Q -M128 -q 0xbfc00000:DECstation5000_125_promdump.bin</b>
474
475 KN02-BA V5.7e
476 ?TFL: 3/scc/access (1:Ln1 reg-12: actual=0x00 xpctd=0x01) [KN02-BA]
477 ?TFL: 3/scc/io (1:Ln0 tx bfr not empty. status=0X 0) [KN02-BA]
478 ...
479 --More--?TFL: 3/scsi/cntl (CUX, cause= 1000002C)
480 >><b>?</b>
481 ? [cmd]
482 boot [[-z #] [-n] #/path [ARG...]]
483 cat SCRPT
484 cnfg [#]
485 d [-bhw] [-S #] RNG VAL
486 e [-bhwcdoux] [-S #] RNG
487 erl [-c]
488 go [ADR]
489 init [#] [-m] [ARG...]
490 ls [#]
491 passwd [-c] [-s]
492 printenv [EVN]
493 restart
494 script SCRPT
495 setenv EVN STR
496 sh [-belvS] [SCRPT] [ARG..]
497 t [-l] #/STR [ARG..]
498 unsetenv EVN
499 >><b>cnfg</b>
500 3: KN02-BA DEC V5.7e TCF0 (128 MB)
501 (enet: 00-00-00-00-00-00)
502 (SCSI = 7)
503 0: PMAG-BA DEC V5.3a TCF0
504 >><b>printenv</b>
505 boot=
506 testaction=q
507 haltaction=h
508 more=24
509 #=3
510 console=*
511 osconsole=3
512 >>
513 </pre>
514
515 <p><font color="#ff0000">(Note: at the moment, this doesn't work.
516 I must have broken something when fixing something else, but this
517 is what it looked like at the time.)</font>
518
519 <p>During bootup, the PROM complains <i>a lot</i> about hardware failures.
520 That's because the emulator doesn't emulate the hardware well enough yet.
521
522 <p>The command line options used are: <tt>-e 3min</tt> for
523 "DECstation 3min" (5000/1xx), <tt>-Q</tt> to supress the emulator's own PROM
524 call emulation, <tt>-M128</tt> for 128MB RAM (because GXemul doesn't correctly
525 emulate memory detection well enough for the PROM to accept, so it will
526 always believe there is 128MB ram anyway), and <tt>-q</tt> to supress debug messages.
527 The <tt>0xbfc00000</tt> in front of the filename tells GXemul that it is a raw
528 binary file which should be loaded at a specific virtual address.
529
530
531 <p><br>
532 <h4>Dumping the PROM on a SGI O2:</h4>
533
534 The general ideas in this section applies to using ROM images from other
535 machines as well. I have also tried this on an SGI IP32 ("O2"), in addition
536 to the DECstation.
537
538 <p>For the O2, a suitable command to dump the prom memory range is
539 <pre>
540 &gt;&gt; <b>dump -b 0xBFC00000:0xBFC80000</b>
541 </pre>
542 Make sure you capture all the output (via serial console) into a file,
543 and then run <tt>experiments/sgiprom_to_bin</tt> on the captured file.
544
545 <p>
546 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
547 <a href="sgi-o2-real.jpg"><img src="sgi-o2-real_small.jpg"></a>
548 &nbsp;&nbsp;&nbsp;
549 <a href="20050817-sgi-o2-success-7.png"><img src="20050817-sgi-o2-success-7_small.png"></a>
550 &nbsp;&nbsp;&nbsp;
551 <a href="20050817-sgi-o2-success-8.png"><img src="20050817-sgi-o2-success-8_small.png"></a>
552
553 <p>The photo on the left is from the real machine. The other two are
554 screenshots of the PROM running experimentally in GXemul, using <tt>-Y2</tt>
555 framebuffer scaledown.
556
557 <p>Normally during bootup, the IP32 PROM does a Power-On test which makes
558 sure that the caches and other things are working properly. GXemul doesn't
559 emulate all those things well enough for the tests to pass. The
560 experimental screenshots above were taken with cache detection skipped
561 manually.
562
563 <p><font color="#ff0000">
564 In other words: don't expect this to work out-of-the-box with GXemul right
565 now. It might work once I've added correct cache emulation.</font>
566
567 <p>The command line used to start the emulator, once correct cache
568 emulation has been implemented, would be something like <tt>gxemul -XQeo2
569 0xbfc00000:prom.bin</tt>.
570
571 <p>The same caution applies when dealing with SGI PROMs as with
572 DECstation PROMs: GXemul doesn't really emulate the hardware, it only
573 "fakes" devices well enough to fool some things, primarily NetBSD, that
574 it is emulating a real machine. ROM code is usually a <i>lot</i> more
575 picky about the details.
576
577 <p>The graphics used in the O2 is (as far as I know) undocumented. Combining
578 some traces of info from how Linux/O2 draws to the screen with some
579 reverse-engineering of my own, I've implemented enough of the controller to
580 let the PROM draw rectangles and bitmaps, but not much more. The SCSI
581 controller is not implemented yet either.
582
583
584
585
586 </p>
587
588 </body>
589 </html>

  ViewVC Help
Powered by ViewVC 1.1.26