10 |
|
|
11 |
<!-- |
<!-- |
12 |
|
|
13 |
$Id: misc.html,v 1.62 2006/02/18 13:15:21 debug Exp $ |
$Id: misc.html,v 1.67 2007/03/24 06:39:29 debug Exp $ |
14 |
|
|
15 |
Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
Copyright (C) 2003-2007 Anders Gavare. All rights reserved. |
16 |
|
|
17 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
18 |
modification, are permitted provided that the following conditions are met: |
modification, are permitted provided that the following conditions are met: |
47 |
|
|
48 |
<p> |
<p> |
49 |
<ul> |
<ul> |
|
<li><a href="#networking">Networking</a> |
|
50 |
<li><a href="#devel">Writing operating system code, or |
<li><a href="#devel">Writing operating system code, or |
51 |
developing firmware, using GXemul</a> |
developing firmware, using GXemul</a> |
52 |
<li><a href="#compilercontruct">Using GXemul in compiler contruction courses</a> |
<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> |
<li><a href="#disk">How to start the emulator with a disk image</a> |
54 |
|
<li><a href="#tape_images">How to start the emulator with tape images</a> |
55 |
|
<li><a href="#disk_overlays">How to use disk image overlays</a> |
56 |
<li><a href="#filexfer">Transfering files to/from the guest OS</a> |
<li><a href="#filexfer">Transfering files to/from the guest OS</a> |
57 |
<li><a href="#largeimages">How to extract large gzipped disk images</a> |
<li><a href="#largeimages">How to extract large gzipped disk images</a> |
58 |
<li><a href="#userland">Running userland binaries</a> |
<li><a href="#userland">Running userland binaries</a> |
65 |
|
|
66 |
|
|
67 |
|
|
|
<p><br> |
|
|
<a name="networking"></a> |
|
|
<h3>Networking:</h3> |
|
|
|
|
|
It is possible to let the guest OS running inside the emulator get access to |
|
|
the Internet. If you are interested in the technical details, and the |
|
|
reasons why networking is implemented in the emulator the way it currently |
|
|
is implemented, you might want to read the <a href="technical.html#net"> |
|
|
networking section in the technical documentation</a>. |
|
|
|
|
|
<p><font color="#ff0000">This is still experimental, hackish, and |
|
|
rather buggy. With NetBSD running as guest operating system, it mostly |
|
|
works.</font> |
|
|
|
|
|
<p>When only one machine is being emulated, the following default values |
|
|
apply:<pre> |
|
|
IPv4 address: 10.0.0.1 |
|
|
Netmask: 255.0.0.0 |
|
|
Gateway / default route: 10.0.0.254 |
|
|
Nameserver: 10.0.0.254 |
|
|
</pre> |
|
|
|
|
|
<p>The emulated machine must of course have a NIC which is emulated |
|
|
correctly. At the moment, the following NICs should work: |
|
|
<ul> |
|
|
<li><tt><b>ether</b></tt>, the "fake" experimental ethernet device |
|
|
(documented <a href="experiments.html#expdevices_ether">here</a>) |
|
|
<li><tt><b>le</b></tt>, Turbochannel Lance Ethernet, as used in |
|
|
DECstation 5000/200 ("3max") |
|
|
<li><tt><b>mec</b></tt>, the SGI O2's ethernet controller |
|
|
<li><tt><b>dec21143</b></tt>, Digital's 21143 NIC (known as <tt>dc</tt> |
|
|
in OpenBSD, or <tt>tlp</tt> in NetBSD) |
|
|
</ul> |
|
|
|
|
|
<p>The emulator acts as a NAT-like gateway/firewall; to the outside world |
|
|
it will seem like it is the host's OS that connects to other machines on |
|
|
the internet, not the guest OS. |
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
|
69 |
|
|
70 |
<p><br> |
<p><br> |
105 |
<li>CPU details in GXemul are usually wrong. If your code depends |
<li>CPU details in GXemul are usually wrong. If your code depends |
106 |
on, say, R10000 or MIPS64 specifics, chances are that GXemul will |
on, say, R10000 or MIPS64 specifics, chances are that GXemul will |
107 |
not be sufficient. One example is different revisions of ISAs; |
not be sufficient. One example is different revisions of ISAs; |
108 |
64-bit MIPS instructions which should trigger an exception on a |
some instructions which should trigger an exception on a |
109 |
real 32-bit MIPS processor usually execute anyway in GXemul. Another |
real MIPS processor usually execute anyway in GXemul. Another |
110 |
example is if userland code tries to access kernel memory; in some |
example is if userland code tries to access kernel memory; in some |
111 |
cases there is protection against this, but not in all cases (to get |
cases there is protection against this, but not in all cases (to get |
112 |
higher performance). |
higher performance). |
135 |
|
|
136 |
<ul> |
<ul> |
137 |
<li><b>(+)</b> Your compiler needs to output real assembly |
<li><b>(+)</b> Your compiler needs to output real assembly |
138 |
language code, which the assembler (eg gas, the GNU assembler) can |
language code, which the assembler (e.g. gas, the GNU assembler) can |
139 |
then compile into object format, and then you need to link this |
then compile into object format, and then you need to link this |
140 |
into an executable image. This is much closer to how things work |
into an executable image. This is much closer to how things work |
141 |
in real life than running assembly language listings in a simulator |
in real life than running assembly language listings in a simulator |
142 |
(eg SPIM). |
(e.g. SPIM). |
143 |
<p> |
<p> |
144 |
<li><b>(-)</b> GXemul does not simulate out-of-order |
<li><b>(-)</b> GXemul does not simulate out-of-order |
145 |
execution, penalties related to instruction scheduling, or |
execution, penalties related to instruction scheduling, or |
199 |
</pre> |
</pre> |
200 |
It is probably possible to use harddisks as well this way, but I would not |
It is probably possible to use harddisks as well this way, but I would not |
201 |
recommend it. |
recommend it. |
202 |
<p> |
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
<p><br> |
209 |
|
<a name="tape_images"></a> |
210 |
|
<h3>How to start the emulator with tape images:</h3> |
211 |
|
|
212 |
Using emulated tape drives is a bit more complicated than disks, because a |
Using emulated tape drives is a bit more complicated than disks, because a |
213 |
tape can be made up of several "files" with space in between. The solution |
tape can be made up of several "files" with space in between. The solution |
214 |
I have choosen is to have one file in the host's file system space for each |
I have choosen is to have one file in the host's file system space for each |
258 |
on the command line. By changing what the symbolic name points to, |
on the command line. By changing what the symbolic name points to, |
259 |
you can "switch tapes" without quiting and restarting the emulator. |
you can "switch tapes" without quiting and restarting the emulator. |
260 |
|
|
261 |
|
<p> |
262 |
|
<font color="#ff0000">Note: Tape support is most likely very buggy, |
263 |
|
because it has not been tested much, and has probably also suffered |
264 |
|
from bit-rot by now.</font> |
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
<p><br> |
272 |
|
<a name="disk_overlays"></a> |
273 |
|
<h3>How to use disk image overlays:</h3> |
274 |
|
|
275 |
|
This is most likely best understood by an example: |
276 |
|
|
277 |
|
<p><ul> |
278 |
|
<li>Install e.g. <a href="guestoses.html#netbsdcatsinstall">NetBSD/cats</a>. |
279 |
|
You will end up with a disk image called |
280 |
|
<tt>nbsd_cats.img</tt>. |
281 |
|
<p> |
282 |
|
<li>Running the following command will boot straight from the disk |
283 |
|
image, with no overlay images:<pre> |
284 |
|
<b>gxemul -XEcats -d nbsd_cats.img netbsd.aout-GENERIC.gz</b> |
285 |
|
|
286 |
|
</pre> |
287 |
|
<li>You may now create an overlay file, a corresponding map file, |
288 |
|
and start the emulator with the overlay image connected to |
289 |
|
the same (explicit) ID as the base disk image:<pre> |
290 |
|
<b>touch overlay.img overlay.img.map |
291 |
|
gxemul -XEcats -d 0:nbsd_cats.img -d V0:overlay.img netbsd.aout-GENERIC.gz</b> |
292 |
|
|
293 |
|
</pre> |
294 |
|
<li>Any changes to the filesystem you perform when using the overlay |
295 |
|
will only be written to that overlay. For example, to perform |
296 |
|
a "roll back", you can do the following:<pre> |
297 |
|
<b>rm -f overlay.img overlay.img.map |
298 |
|
touch overlay.img overlay.img.map</b> |
299 |
|
|
300 |
|
</pre> |
301 |
|
and then simply start the emulator again, with the newly created |
302 |
|
overlay image. |
303 |
|
</ul> |
304 |
|
|
305 |
|
<p>It is also possible to add multiple overlays. In that case, writes |
306 |
|
always go the the <i>last</i> added overlay. |
307 |
|
|
308 |
|
<p>GXemul uses Unix' way of supporting files with "holes", |
309 |
|
so even if <tt>ls -l overlay.img</tt> says that the overlay is several |
310 |
|
gigabytes large, <tt>du overlay.img</tt> should reveal that only the |
311 |
|
blocks that have actually been written to have been stored in the |
312 |
|
overlay, e.g.:<pre> |
313 |
|
<b>$ ls -l |
314 |
|
.. |
315 |
|
-rw-r--r-- 1 debug wheel 3072319488 Mar 24 11:59 nbsd_cats.img |
316 |
|
-rw-r--r-- 1 debug wheel 2465354 Mar 24 11:44 netbsd.aout-GENERIC.gz |
317 |
|
-rw-r--r-- 1 debug wheel 2930841600 Mar 24 14:02 overlay.img |
318 |
|
-rw-r--r-- 1 debug wheel 715538 Mar 24 14:02 overlay.img.map |
319 |
|
$ du overlay.img |
320 |
|
864 overlay.img |
321 |
|
</b> |
322 |
|
</pre> |
323 |
|
|
324 |
|
<p>The .map file is simply a raw bitmap telling which blocks of the |
325 |
|
overlay file that are in use. |
326 |
|
|
327 |
|
|
328 |
|
|
332 |
<a name="filexfer"></a> |
<a name="filexfer"></a> |
333 |
<h3>Transfering files to/from the guest OS:</h3> |
<h3>Transfering files to/from the guest OS:</h3> |
334 |
|
|
335 |
If the emulated machine supports networking (see |
If the emulated machine supports networking (see <a |
336 |
<a href="#networking">above</a>), then transfering files via FTP is |
href="networking.html#intro">this section</a> for more info), then |
337 |
probably easiest. |
transfering files via FTP is probably easiest. |
338 |
|
|
339 |
<p>There is another way of transfering files which works for any kind of |
<p>There is another way of transfering files which works for any kind of |
340 |
emulated machine which supports disks (either SCSI or IDE). Any file can |
emulated machine which supports disks (either SCSI or IDE). Any file can |
416 |
<a name="userland"></a> |
<a name="userland"></a> |
417 |
<h3>Running userland binaries:</h3> |
<h3>Running userland binaries:</h3> |
418 |
|
|
419 |
<font color="#ff0000">Note: This does not really work yet.</font> |
<font color="#ff0000">Note: This feature does not really work yet. |
420 |
|
It is currently disabled in stable release builds of the emulator.</font> |
421 |
|
|
422 |
<p>There is some skeleton code for running userland programs as well. This |
<p>There is some skeleton code for running userland programs as well. This |
423 |
will not emulate any particular machine, but instead try to translate |
will not emulate any particular machine, but instead try to translate |