1 |
<html> |
<html> |
2 |
<head><title>GXemul documentation: Introduction</title> |
<head><title>GXemul documentation: Introduction</title> |
3 |
|
<meta name="robots" content="noarchive,nofollow,noindex"> |
4 |
</head> |
</head> |
5 |
<body bgcolor="#f8f8f8" text="#000000" link="#4040f0" vlink="#404040" alink="#ff0000"> |
<body bgcolor="#f8f8f8" text="#000000" link="#4040f0" vlink="#404040" alink="#ff0000"> |
6 |
<table border=0 width=100% bgcolor="#d0d0d0"><tr> |
<table border=0 width=100% bgcolor="#d0d0d0"><tr> |
9 |
<b>GXemul documentation:</b></font> |
<b>GXemul documentation:</b></font> |
10 |
<font color="#000000" size="6"><b>Introduction</b> |
<font color="#000000" size="6"><b>Introduction</b> |
11 |
</font></td></tr></table></td></tr></table><p> |
</font></td></tr></table></td></tr></table><p> |
|
<!-- The first 10 lines are cut away by the homepage updating script. --> |
|
|
|
|
12 |
|
|
13 |
<!-- |
<!-- |
14 |
|
|
15 |
$Id: intro.html,v 1.40 2005/04/27 15:22:17 debug Exp $ |
$Id: intro.html,v 1.53 2005/06/26 08:42:26 debug Exp $ |
16 |
|
|
17 |
Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
18 |
|
|
51 |
<li><a href="#overview">Overview</a> |
<li><a href="#overview">Overview</a> |
52 |
<li><a href="#free">Is GXemul Free software?</a> |
<li><a href="#free">Is GXemul Free software?</a> |
53 |
<li><a href="#build">How to compile/build the emulator</a> |
<li><a href="#build">How to compile/build the emulator</a> |
54 |
|
<li><a href="#run">How to run the emulator</a> |
55 |
<li><a href="#cpus">Which CPU types does GXemul emulate?</a> |
<li><a href="#cpus">Which CPU types does GXemul emulate?</a> |
56 |
<li><a href="#accuracy">Emulation accuracy</a> |
<li><a href="#accuracy">Emulation accuracy</a> |
57 |
<li><a href="#emulmodes">Which machines does GXemul emulate?</a> |
<li><a href="#emulmodes">Which machines does GXemul emulate?</a> |
58 |
<li><a href="#guestos">Which guest OSes are possible to run?</a> |
<li><a href="#guestos">Which guest OSes are possible to run in GXemul?</a> |
59 |
</ul> |
</ul> |
60 |
|
|
61 |
|
|
66 |
<a name="overview"></a> |
<a name="overview"></a> |
67 |
<h3>Overview:</h3> |
<h3>Overview:</h3> |
68 |
|
|
69 |
GXemul is a machine emulator, which can be used to experiment with |
GXemul is an experimental instruction-level machine emulator. It can be |
70 |
binary code for (among others) MIPS-based machines. Several emulation |
used to run binary code for (among others) MIPS-based machines, regardless |
71 |
modes are available. For some emulation modes, processors and surrounding |
of host platform. Several emulation modes are available. For some modes, |
72 |
hardware components are emulated well enough to let unmodified operating |
processors and surrounding hardware components are emulated well enough to |
73 |
systems run as if they were running on a real machine. |
let unmodified operating systems run as if they were running on a real |
74 |
|
machine. |
75 |
<p> |
|
76 |
It is important to keep in mind that devices and CPUs are not simulated |
<p>Devices and CPUs are not simulated with 100% accuracy. They are only |
77 |
with 100% accuracy. They are only "faked" well enough to make operating |
``faked'' well enough to make operating systems (e.g. NetBSD) run without |
78 |
systems (eg NetBSD) run. Still, the emulator could be of interest for |
complaining too much. Still, the emulator could be of interest for |
79 |
academic research and experiments, such as when learning how to write |
academic research and experiments, such as when learning how to write |
80 |
operating system code. |
operating system code. |
81 |
|
|
82 |
<p> |
<p>The emulator is written in C, does not depend on external libraries |
83 |
The emulator is written in C, does not depend on external libraries (except |
(except X11, but that is optional), and should compile and run on most |
84 |
X11, but that is optional), and should compile and run on most Unix-like |
Unix-like systems. If it doesn't, then that is a bug. (You do not need any |
85 |
systems. If it doesn't, then that is a bug. |
MIPS compiler toolchain to build or use GXemul. If you need to compile |
86 |
(You do not need any MIPS compiler toolchain to build or use GXemul. |
MIPS binaries from sources, then of course you need such a toolchain, but |
87 |
If you need to compile MIPS binaries from sources, then of course you need |
that is completely separate from GXemul.) |
88 |
such a toolchain, but that is completely separate from GXemul. There |
|
89 |
is a <a href="technical.html#regtest">regression testing</a> framework, |
<p>The emulator contains code which tries to emulate the workings of CPUs |
90 |
which requires that a GNU CC for mips64-unknown-elf or similar is available. |
and surrounding hardware found in real machines, but it does not contain |
91 |
For simply building and using the emulator, it is not required.) |
any ROM code. You will need some form of program (in binary form) to run |
92 |
|
in the emulator. For many emulation modes, PROM calls are handled by the |
|
<p> |
|
|
The emulator contains code which tries to emulate the workings of CPUs and |
|
|
surrounding hardware found in real machines, but it does not contain any |
|
|
ROM code. You will need some form of program (in binary form) to run in |
|
|
the emulator. For many emulation modes, PROM calls are handled by the |
|
93 |
emulator itself, so you do not need to use any ROM image at all. |
emulator itself, so you do not need to use any ROM image at all. |
94 |
|
|
95 |
<p> |
<p>You can use pre-compiled kernels (for example NetBSD kernels, or |
96 |
You can use pre-compiled kernels (for example NetBSD kernels, or Linux), |
Linux), or other programs that are in binary format, and in some cases |
97 |
or other programs that are in binary format, and in some cases even actual |
even actual ROM images. A couple of different file formats are supported |
98 |
ROM images. A couple of different file formats are supported (ELF, a.out, |
(ELF, a.out, ECOFF, SREC, and raw binaries). |
99 |
ECOFF, SREC, raw binaries). |
|
100 |
|
<p>If you do not have a kernel as a separate file, but you have a bootable |
101 |
|
disk image, then it is sometimes possible to boot directly from that |
102 |
|
image. (This works for example with DECstation emulation, or when booting |
103 |
|
from ISO9660 CDROM images.) |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
113 |
<a name="free"></a> |
<a name="free"></a> |
114 |
<h3>Is GXemul Free software?</h3> |
<h3>Is GXemul Free software?</h3> |
115 |
|
|
116 |
Yes. I have released GXemul under a Free license. |
Yes. I have released GXemul under a Free license. The code in GXemul is |
117 |
(For a definitions of the four freedoms associated with Free software, |
Copyrighted software, it is <i>not</i> public domain. (If this is |
118 |
please read <a href="http://www.gnu.org/philosophy/free-sw.html"> |
confusing to you, you might want to read up on the definitions of the |
119 |
http://www.gnu.org/philosophy/free-sw.html</a>.) |
four freedoms associated with Free software, <a |
120 |
|
href="http://www.gnu.org/philosophy/free-sw.html">http://www.gnu.org/philosophy/free-sw.html</a>.) |
|
<p> |
|
|
The code in GXemul is Copyrighted software, it is <i>not</i> public |
|
|
domain or anything like that. |
|
121 |
|
|
122 |
<p> |
<p> |
123 |
The code I have written is released under a 3-clause BSD-style license |
The code I have written is released under a 3-clause BSD-style license |
170 |
</pre> |
</pre> |
171 |
|
|
172 |
<p> |
<p> |
173 |
Run <b>./configure --help</b> to get a list of configure options. (The |
Run <b><tt>./configure --help</tt></b> to get a list of configure options. (The |
174 |
possible options differ between different releases and snapshots.) |
possible options differ between different releases and snapshots.) |
175 |
|
|
176 |
<p> |
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
<p><br> |
182 |
|
<a name="run"></a> |
183 |
|
<h3>How to run the emulator:</h3> |
184 |
|
|
185 |
Once you have built GXemul, running it should be rather straight-forward. |
Once you have built GXemul, running it should be rather straight-forward. |
186 |
|
Running <tt><b>gxemul</b></tt> without arguments (or with the |
187 |
|
<b><tt>-h</tt></b> or <b><tt>-H</tt></b> command line options) will |
188 |
|
display a help message. |
189 |
|
|
190 |
|
<p> |
191 |
|
To get some ideas about what is possible to run in the emulator, please |
192 |
|
read the section about <a href="guestoses.html">installing "guest" |
193 |
|
operating systems</a>. If you are interested in using the emulator to |
194 |
|
develop code on your own, then you should also read the section about |
195 |
|
<a href="experiments.html#hello">Hello World</a>. |
196 |
|
|
197 |
|
<p> |
198 |
To exit the emulator, type CTRL-C to enter the |
To exit the emulator, type CTRL-C to enter the |
199 |
single-step debugger, and then type <b>quit</b>. |
single-step debugger, and then type <tt><b>quit</b></tt>. |
200 |
|
|
201 |
<p> |
<p> |
202 |
If you are starting an emulation by entering settings directly on the |
If you are starting an emulation by entering settings directly on the |
203 |
command line, and you are not using the <b>-x</b> option, then all |
command line, and you are not using the <tt><b>-x</b></tt> option, then all |
204 |
terminal input and output will go to the main controlling terminal. |
terminal input and output will go to the main controlling terminal. |
205 |
CTRL-C is used to break into the debugger, so in order to send CTRL-C to |
CTRL-C is used to break into the debugger, so in order to send CTRL-C to |
206 |
the running (emulated) program, you may use CTRL-B. |
the running (emulated) program, you may use CTRL-B. |
207 |
|
(This should be a reasonable compromise to allow the emulator to be usable |
208 |
|
even on systems without X Windows.) |
209 |
|
|
210 |
<p> |
<p> |
211 |
(This is an ugly hack; there is no way to send an actual CTRL-B to the |
There is no way to send an actual CTRL-B to the emulated program, when |
212 |
emulated program, when typing in the main controlling terminal window. |
typing in the main controlling terminal window. The solution is to either |
213 |
The solution is to either use configuration files, or use <b>-x</b>. Both |
use <a href="configfiles.html">configuration files</a>, or use |
214 |
these solutions cause new xterms to be opened for each emulated serial |
<tt><b>-x</b></tt>. Both these solutions cause new xterms to be opened for |
215 |
port. CTRL-B and CTRL-C both have their original meaning in those |
each emulated serial port that is written to. CTRL-B and CTRL-C both have |
216 |
xterm windows.) |
their original meaning in those xterm windows. |
|
|
|
217 |
|
|
218 |
|
|
219 |
|
|
225 |
|
|
226 |
<h4>MIPS:</h4> |
<h4>MIPS:</h4> |
227 |
|
|
228 |
Emulation of R4000, which is a 64-bit CPU, was my initial goal. Right |
Emulation of R4000, which is a 64-bit CPU, was my initial goal. |
229 |
now, R2000/R3000-like CPUs are also emulated (32-bit), and emulation of |
R2000/R3000-like CPUs (32-bit), R1x000, and generic MIPS32/MIPS64-style |
230 |
R1x000 (at least the parts that are similar to R4000) is beginning to work |
CPUs are also emulated, and are hopefully almost as stable as the R4000 |
231 |
as expected. Code targeted for MIPS32 and MIPS64 also often work. |
emulation. |
232 |
|
|
233 |
<p> |
<p> |
234 |
I have written an experimental dynamic binary translation subsystem. |
I have written an experimental dynamic binary translation subsystem. |
237 |
the command line, but keep in mind that it is still experimental.) |
the command line, but keep in mind that it is still experimental.) |
238 |
|
|
239 |
|
|
|
|
|
240 |
<h4>URISC:</h4> |
<h4>URISC:</h4> |
241 |
|
|
242 |
I have implemented an <a href="http://en.wikipedia.org/wiki/URISC">URISC</a> |
I have implemented an <a href="http://en.wikipedia.org/wiki/URISC">URISC</a> |
247 |
performance.) |
performance.) |
248 |
|
|
249 |
|
|
|
|
|
|
|
|
250 |
<h4>Other CPU types:</h4> |
<h4>Other CPU types:</h4> |
251 |
|
|
252 |
There is some code for 64-bit (and 32-bit) POWER/PowerPC emulation too, |
Some other CPU architectures can also be partially emulated. These are not |
253 |
but it only works for "Hello World" and similarly trivial programs. (There |
working well enough yet to run guest operating systems. |
254 |
are some other CPU modes too, but they are working even less.) |
|
255 |
|
|
256 |
|
|
257 |
|
|
261 |
<a name="accuracy"></a> |
<a name="accuracy"></a> |
262 |
<h3>Emulation accuracy:</h3> |
<h3>Emulation accuracy:</h3> |
263 |
|
|
264 |
GXemul is an instruction-level simulator; things that would happen in |
GXemul is an instruction-level emulator; things that would happen in |
265 |
several steps within a real CPU are not taken into account (eg. pipe-line |
several steps within a real CPU are not taken into account (eg. pipe-line |
266 |
stages or out-of-order execution). Still, instruction-level accuracy seems |
stalls or out-of-order execution). Still, instruction-level accuracy seems |
267 |
to be enough to be able to run complete guest operating systems inside the |
to be enough to be able to run complete guest operating systems inside the |
268 |
emulator. |
emulator. |
269 |
|
|
270 |
|
<p> |
271 |
|
Caches are by default not emulated. In some cases, the existance of caches |
272 |
|
is "faked" to let operating systems think that they are there. (There is |
273 |
|
some old code for R2000/R3000 caches, but it has probably suffered from |
274 |
|
bitrot by now.) |
275 |
|
|
276 |
|
<p> |
277 |
|
The emulator is <i>not</i> timing-accurate. It can be run in a |
278 |
|
"deterministic" mode, <tt><b>-D</b></tt>. The meaning of deterministic is |
279 |
|
simply that running two emulations with the same settings will result in |
280 |
|
identical runs. Obviously, this requires that no user interaction is |
281 |
|
taking place, and that clock speeds are fixed with the <tt><b>-I</b></tt> |
282 |
|
option. (Deterministic in this case does <i>not</i> mean that the emulation |
283 |
|
will be identical to some actual real-world machine.) |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
307 |
<p> |
<p> |
308 |
<li><b>Cobalt</b> |
<li><b>Cobalt</b> |
309 |
<br>Serial controller and PCI IDE. |
<br>Serial controller and PCI IDE. |
310 |
|
<p> |
311 |
|
<li><b>Malta (evbmips)</b> |
312 |
|
<br>Serial controller and PCI IDE. |
313 |
|
<p> |
314 |
|
<li><b>SGI O2 ("IP32")</b> |
315 |
|
<br>Serial controller and ethernet. <small>(Enough for |
316 |
|
root-on-nfs, but not for disk boot.)</small> |
317 |
</ul> |
</ul> |
318 |
|
|
319 |
<p> |
<p>There is code in GXemul for emulation of many other machine types; the |
320 |
There is code in GXemul for emulation of many other machine types; |
degree to which these work range from almost being able to run a complete |
321 |
the degree to which these work range from "almost" being able to run |
OS, to almost completely unsupported (perhaps just enough support to |
322 |
a complete OS, to almost completely unsupported (perhaps just enough |
output a few boot messages via serial console). |
323 |
support to output a few boot messages via serial console). |
|
324 |
|
<p>In addition to emulating real machines, there is also a "test-machine". |
325 |
<p> |
A test-machine consists of one or more CPUs and a few experimental devices |
326 |
In addition to emulating real machines, there is also a "test-machine". |
such as: |
|
A test-machine consists of one or more CPUs and a few experimental |
|
|
devices such as: |
|
327 |
|
|
328 |
<p> |
<p> |
329 |
<ul> |
<ul> |
332 |
<li>a very simple linear framebuffer device (for graphics output) |
<li>a very simple linear framebuffer device (for graphics output) |
333 |
</ul> |
</ul> |
334 |
|
|
335 |
<p> |
<p>This mode is useful if you wish to run experimental code, but do not |
|
This mode is useful if you wish to run experimental code, but do not |
|
336 |
wish to target any specific real-world machine type, for example for |
wish to target any specific real-world machine type, for example for |
337 |
educational purposes. |
educational purposes. |
338 |
|
|
339 |
<p> |
<p>You can read more about these experimental devices <a |
340 |
You can read more about these experimental devices |
href="experiments.html#expdevices">here</a>. |
|
<a href="experiments.html#expdevices">here</a>. |
|
341 |
|
|
342 |
|
|
343 |
|
|
347 |
|
|
348 |
<p><br> |
<p><br> |
349 |
<a name="guestos"></a> |
<a name="guestos"></a> |
350 |
<h3>Which guest OSes are possible to run?</h3> |
<h3>Which guest OSes are possible to run in GXemul?</h3> |
351 |
|
|
352 |
This table lists the guest OSes that run well enough to be considered |
This table lists the guest OSes that run well enough to be considered |
353 |
working in the emulator. They can boot from a harddisk image and be |
working in the emulator. They can boot from a harddisk image and be |
357 |
<center><table border="0"> |
<center><table border="0"> |
358 |
<tr> |
<tr> |
359 |
<td width="10"></td> |
<td width="10"></td> |
360 |
<td align="center"><a href="netbsd-pmax-20040630.png"><img src="netbsd-pmax-20040630_small.png"></a></td> |
<td align="center"><a href="20050317-example.png"><img src="20050317-example_small.png"></a></td> |
361 |
<td width="15"></td> |
<td width="15"></td> |
362 |
<td><a href="http://www.netbsd.org/Ports/pmax/">NetBSD/pmax</a> |
<td><a href="http://www.netbsd.org/Ports/pmax/">NetBSD/pmax</a> |
363 |
<br>DECstation 5000/200</td> |
<br>DECstation 5000/200</td> |
428 |
<br>Cobalt</td> |
<br>Cobalt</td> |
429 |
</tr> |
</tr> |
430 |
|
|
431 |
|
<tr><td height="10"></td></tr> |
432 |
|
|
433 |
|
<tr> |
434 |
|
<td></td> |
435 |
|
<td align="center"><a href="20050626-netbsd-sgimips-netboot.png"><img src="20050626-netbsd-sgimips-netboot_small.png"></a></td> |
436 |
|
<td></td> |
437 |
|
<td><a href="http://www.netbsd.org/Ports/sgimips/">NetBSD/sgimips</a> |
438 |
|
<br>SGI O2 ("IP32")</td> |
439 |
|
<td></td> |
440 |
|
<td align="center"><a href="20050622-netbsd-evbmips-malta.png"><img src="20050622-netbsd-evbmips-malta_small.png"></a></td> |
441 |
|
<td></td> |
442 |
|
<td><a href="http://www.netbsd.org/Ports/evbmips/">NetBSD/evbmips</a> |
443 |
|
<br>5Kc (and 4Kc) Malta<br>evaluation boards</td> |
444 |
|
<td></td> |
445 |
|
</tr> |
446 |
|
|
447 |
</table></center> |
</table></center> |
448 |
|
|
449 |
|
|