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.47 2005/06/04 22:47:49 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> |
73 |
systems run as if they were running on a real machine. |
systems run as if they were running on a real machine. |
74 |
|
|
75 |
<p> |
<p> |
76 |
It is important to keep in mind that devices and CPUs are not simulated |
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 (eg 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> |
85 |
systems. If it doesn't, then that is a bug. |
systems. If it doesn't, then that is a bug. |
86 |
(You do not need any MIPS compiler toolchain to build or use GXemul. |
(You do not need any MIPS compiler toolchain to build or use GXemul. |
87 |
If you need to compile MIPS binaries from sources, then of course you need |
If you need to compile MIPS binaries from sources, then of course you need |
88 |
such a toolchain, but that is completely separate from GXemul. There |
such a toolchain, but that is completely separate from GXemul.) |
|
is a <a href="technical.html#regtest">regression testing</a> framework, |
|
|
which requires that a GNU CC for mips64-unknown-elf or similar is available. |
|
|
For simply building and using the emulator, it is not required.) |
|
89 |
|
|
90 |
<p> |
<p> |
91 |
The emulator contains code which tries to emulate the workings of CPUs and |
The emulator contains code which tries to emulate the workings of CPUs and |
98 |
You can use pre-compiled kernels (for example NetBSD kernels, or Linux), |
You can use pre-compiled kernels (for example NetBSD kernels, or Linux), |
99 |
or other programs that are in binary format, and in some cases even actual |
or other programs that are in binary format, and in some cases even actual |
100 |
ROM images. A couple of different file formats are supported (ELF, a.out, |
ROM images. A couple of different file formats are supported (ELF, a.out, |
101 |
ECOFF, SREC, raw binaries). |
ECOFF, SREC, and raw binaries). |
102 |
|
|
103 |
|
<p> |
104 |
|
If you do not have a kernel as a separate file, but you have a bootable |
105 |
|
disk image, then it is sometimes possible to boot directly from that |
106 |
|
image. (This works for example with DECstation emulation, or when booting |
107 |
|
from ISO9660 CDROM images.) |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
115 |
<a name="free"></a> |
<a name="free"></a> |
116 |
<h3>Is GXemul Free software?</h3> |
<h3>Is GXemul Free software?</h3> |
117 |
|
|
118 |
Yes. I have released GXemul under a Free license. |
Yes. I have released GXemul under a Free license. The code in GXemul is |
119 |
(For a definitions of the four freedoms associated with Free software, |
Copyrighted software, it is <i>not</i> public domain. (If this is |
120 |
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 |
121 |
http://www.gnu.org/philosophy/free-sw.html</a>.) |
four freedoms associated with Free software, <a |
122 |
|
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. |
|
123 |
|
|
124 |
<p> |
<p> |
125 |
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 |
172 |
</pre> |
</pre> |
173 |
|
|
174 |
<p> |
<p> |
175 |
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 |
176 |
possible options differ between different releases and snapshots.) |
possible options differ between different releases and snapshots.) |
177 |
|
|
178 |
<p> |
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
<p><br> |
184 |
|
<a name="run"></a> |
185 |
|
<h3>How to run the emulator:</h3> |
186 |
|
|
187 |
Once you have built GXemul, running it should be rather straight-forward. |
Once you have built GXemul, running it should be rather straight-forward. |
188 |
|
Running <tt><b>gxemul</b></tt> without arguments (or with the |
189 |
|
<b><tt>-h</tt></b> or <b><tt>-H</tt></b> command line options) will |
190 |
|
display a help message. |
191 |
|
|
192 |
|
<p> |
193 |
|
To get some ideas about what is possible to run in the emulator, please |
194 |
|
read the section about <a href="guestoses.html">installing "guest" |
195 |
|
operating systems</a>. If you are interested in using the emulator to |
196 |
|
develop code on your own, then you should also read the section about |
197 |
|
<a href="experiments.html#hello">Hello World</a>. |
198 |
|
|
199 |
|
<p> |
200 |
To exit the emulator, type CTRL-C to enter the |
To exit the emulator, type CTRL-C to enter the |
201 |
single-step debugger, and then type <b>quit</b>. |
single-step debugger, and then type <tt><b>quit</b></tt>. |
202 |
|
|
203 |
<p> |
<p> |
204 |
If you are starting an emulation by entering settings directly on the |
If you are starting an emulation by entering settings directly on the |
205 |
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 |
206 |
terminal input and output will go to the main controlling terminal. |
terminal input and output will go to the main controlling terminal. |
207 |
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 |
208 |
the running (emulated) program, you may use CTRL-B. |
the running (emulated) program, you may use CTRL-B. |
209 |
|
(This should be a reasonable compromise to allow the emulator to be usable |
210 |
|
even on systems without X Windows.) |
211 |
|
|
212 |
<p> |
<p> |
213 |
(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 |
214 |
emulated program, when typing in the main controlling terminal window. |
typing in the main controlling terminal window. The solution is to either |
215 |
The solution is to either use configuration files, or use <b>-x</b>. Both |
use <a href="configfiles.html">configuration files</a>, or use |
216 |
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 |
217 |
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 |
218 |
xterm windows.) |
their original meaning in those xterm windows. |
|
|
|
219 |
|
|
220 |
|
|
221 |
|
|
227 |
|
|
228 |
<h4>MIPS:</h4> |
<h4>MIPS:</h4> |
229 |
|
|
230 |
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. |
231 |
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 |
232 |
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 |
233 |
as expected. Code targeted for MIPS32 and MIPS64 also often work. |
emulation. |
234 |
|
|
235 |
<p> |
<p> |
236 |
I have written an experimental dynamic binary translation subsystem. |
I have written an experimental dynamic binary translation subsystem. |
239 |
the command line, but keep in mind that it is still experimental.) |
the command line, but keep in mind that it is still experimental.) |
240 |
|
|
241 |
|
|
|
|
|
242 |
<h4>URISC:</h4> |
<h4>URISC:</h4> |
243 |
|
|
244 |
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> |
249 |
performance.) |
performance.) |
250 |
|
|
251 |
|
|
252 |
|
<h4>POWER/PowerPC</h4> |
253 |
|
|
254 |
|
There is some code for 64-bit (and 32-bit) POWER/PowerPC emulation, enough |
255 |
|
to run "Hello World", but not enough to run complete operating systems. |
256 |
|
This mode isn't really working yet. |
257 |
|
|
258 |
|
|
259 |
<h4>Other CPU types:</h4> |
<h4>Other CPU types:</h4> |
260 |
|
|
261 |
There is some code for 64-bit (and 32-bit) POWER/PowerPC emulation too, |
Some other CPU architectures (such as x86) can also be partially emulated. |
262 |
but it only works for "Hello World" and similarly trivial programs. (There |
These are not enabled by default though, because of their unstable-ness. |
|
are some other CPU modes too, but they are working even less.) |
|
263 |
|
|
264 |
|
|
265 |
|
|
269 |
<a name="accuracy"></a> |
<a name="accuracy"></a> |
270 |
<h3>Emulation accuracy:</h3> |
<h3>Emulation accuracy:</h3> |
271 |
|
|
272 |
GXemul is an instruction-level simulator; things that would happen in |
GXemul is an instruction-level emulator; things that would happen in |
273 |
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 |
274 |
stages or out-of-order execution). Still, instruction-level accuracy seems |
stalls or out-of-order execution). Still, instruction-level accuracy seems |
275 |
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 |
276 |
emulator. |
emulator. |
277 |
|
|
278 |
|
<p> |
279 |
|
Caches are by default not emulated. In some cases, the existance of caches |
280 |
|
is "faked" to let operating systems think that they are there. (There is |
281 |
|
some old code for R2000/R3000 caches, but it has probably suffered from |
282 |
|
bitrot by now.) |
283 |
|
|
284 |
|
<p> |
285 |
|
The emulator is <i>not</i> timing-accurate. It can be run in a |
286 |
|
"deterministic" mode, <tt><b>-D</b></tt>. The meaning of deterministic is |
287 |
|
simply that running two emulations with the same settings will result in |
288 |
|
identical runs. Obviously, this requires that no user interaction is |
289 |
|
taking place, and that clock speeds are fixed with the <tt><b>-I</b></tt> |
290 |
|
option. (Deterministic in this case does <i>not</i> mean that the emulation |
291 |
|
will be identical to some actual real-world machine.) |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
362 |
<center><table border="0"> |
<center><table border="0"> |
363 |
<tr> |
<tr> |
364 |
<td width="10"></td> |
<td width="10"></td> |
365 |
<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> |
366 |
<td width="15"></td> |
<td width="15"></td> |
367 |
<td><a href="http://www.netbsd.org/Ports/pmax/">NetBSD/pmax</a> |
<td><a href="http://www.netbsd.org/Ports/pmax/">NetBSD/pmax</a> |
368 |
<br>DECstation 5000/200</td> |
<br>DECstation 5000/200</td> |