1 |
<html> |
<html><head><title>Gavare's eXperimental Emulator: Introduction</title> |
2 |
<head><title>GXemul documentation: Introduction</title> |
<meta name="robots" content="noarchive,nofollow,noindex"></head> |
|
<meta name="robots" content="noarchive,nofollow,noindex"> |
|
|
</head> |
|
3 |
<body bgcolor="#f8f8f8" text="#000000" link="#4040f0" vlink="#404040" alink="#ff0000"> |
<body bgcolor="#f8f8f8" text="#000000" link="#4040f0" vlink="#404040" alink="#ff0000"> |
4 |
<table border=0 width=100% bgcolor="#d0d0d0"><tr> |
<table border=0 width=100% bgcolor="#d0d0d0"><tr> |
5 |
<td width=100% align=center valign=center><table border=0 width=100%><tr> |
<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"> |
<td align="left" valign=center bgcolor="#d0efff"><font color="#6060e0" size="6"> |
7 |
<b>GXemul documentation:</b></font> |
<b>Gavare's eXperimental Emulator: </b></font> |
8 |
<font color="#000000" size="6"><b>Introduction</b> |
<font color="#000000" size="6"><b>Introduction</b> |
9 |
</font></td></tr></table></td></tr></table><p> |
</font></td></tr></table></td></tr></table><p> |
10 |
|
|
11 |
<!-- |
<!-- |
12 |
|
|
13 |
$Id: intro.html,v 1.53 2005/06/26 08:42:26 debug Exp $ |
$Id: intro.html,v 1.61 2005/08/16 05:15:24 debug Exp $ |
14 |
|
|
15 |
Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
16 |
|
|
65 |
<h3>Overview:</h3> |
<h3>Overview:</h3> |
66 |
|
|
67 |
GXemul is an experimental instruction-level machine emulator. It can be |
GXemul is an experimental instruction-level machine emulator. It can be |
68 |
used to run binary code for (among others) MIPS-based machines, regardless |
used to run binary code for MIPS-based machines, regardless of host |
69 |
of host platform. Several emulation modes are available. For some modes, |
platform. Several emulation modes are available. For some modes, |
70 |
processors and surrounding hardware components are emulated well enough to |
processors and surrounding hardware components are emulated well enough to |
71 |
let unmodified operating systems run as if they were running on a real |
let unmodified operating systems run as if they were running on a real |
72 |
machine. |
machine. |
73 |
|
|
74 |
|
<p>(Non-MIPS emulation modes are also under development, but so far none |
75 |
|
of those modes has reached the completeness required to run unmodified |
76 |
|
operating systems.) |
77 |
|
|
78 |
<p>Devices and CPUs are not simulated with 100% accuracy. They are only |
<p>Devices and CPUs are not simulated with 100% accuracy. They are only |
79 |
``faked'' well enough to make operating systems (e.g. NetBSD) run without |
``faked'' well enough to make operating systems (e.g. NetBSD) run without |
80 |
complaining too much. Still, the emulator could be of interest for |
complaining too much. Still, the emulator could be of interest for |
83 |
|
|
84 |
<p>The emulator is written in C, does not depend on external libraries |
<p>The emulator is written in C, does not depend on external libraries |
85 |
(except X11, but that is optional), and should compile and run on most |
(except X11, but that is optional), and should compile and run on most |
86 |
Unix-like systems. If it doesn't, then that is a bug. (You do not need any |
Unix-like systems. If it doesn't, then that is a bug. |
|
MIPS compiler toolchain to build or use GXemul. If you need to compile |
|
|
MIPS binaries from sources, then of course you need such a toolchain, but |
|
|
that is completely separate from GXemul.) |
|
87 |
|
|
88 |
<p>The emulator contains code which tries to emulate the workings of CPUs |
<p>The emulator contains code which tries to emulate the workings of CPUs |
89 |
and surrounding hardware found in real machines, but it does not contain |
and surrounding hardware found in real machines, but it does not contain |
118 |
four freedoms associated with Free software, <a |
four freedoms associated with Free software, <a |
119 |
href="http://www.gnu.org/philosophy/free-sw.html">http://www.gnu.org/philosophy/free-sw.html</a>.) |
href="http://www.gnu.org/philosophy/free-sw.html">http://www.gnu.org/philosophy/free-sw.html</a>.) |
120 |
|
|
121 |
<p> |
<p>The code I have written is released under a 3-clause BSD-style license |
122 |
The code I have written is released under a 3-clause BSD-style license |
(or "revised BSD-style" if one wants to use <a |
123 |
(or "revised BSD-style" if one wants to use |
href="http://www.gnu.org/philosophy/bsd.html">GNU jargon</a>). Apart from |
124 |
<a href="http://www.gnu.org/philosophy/bsd.html">GNU jargon</a>). |
the code I have written, some files are copied from other sources such as |
125 |
Apart from the code I have written, some files are copied from other sources |
NetBSD, for example header files containing symbolic names of bitfields in |
126 |
such as NetBSD, for example header files containing symbolic names of |
device registers. They are also covered by similar licenses, but with some |
127 |
bitfields in device registers. They are also covered by similar licenses, |
additional clauses. The main point, however, is that the licenses require |
128 |
but with some additional clauses. If you plan to redistribute GXemul |
that the original Copyright and license terms are included when you make a |
129 |
(for example as a binary package), or reuse code from GXemul, |
copy or modification. |
130 |
then you should check those files for their license terms. |
|
131 |
|
<p>If you plan to redistribute GXemul <i>without</i> supplying the source |
132 |
|
code, then you need to comply with each individual source file some other |
133 |
|
way, for example by writing additional documentation containing copyright |
134 |
|
notes. I have not done this, since I do not plan on making distributions |
135 |
|
without source code. You need to check all individual files for details. |
136 |
|
The "easiest way out" if you plan to redistribute code from GXemul is, of |
137 |
|
course, to let it remain open source and simply supply the source code. |
138 |
|
|
139 |
|
<p>(If a stable release of GXemul is packaged into binary form, and it is |
140 |
|
obvious which version of GXemul was used to build the package, then it can |
141 |
|
be argued that the source code is available, just not in that specific |
142 |
|
package. Common sense should be used in this case, and not pedanticism.) |
143 |
|
|
144 |
|
|
|
<p> |
|
|
(The licenses usually require that the original Copyright and license |
|
|
terms are included when you make a copy or modification. The "easiest way |
|
|
out" if you plan to redistribute code from GXemul is to simply supply |
|
|
the source code. You should however check individual files for details.) |
|
145 |
|
|
146 |
|
|
147 |
|
|
157 |
$ <b>make</b> |
$ <b>make</b> |
158 |
</pre> |
</pre> |
159 |
|
|
160 |
<p> |
<p>This should work on most Unix-like systems. If it doesn't, then |
|
This should work on most Unix-like systems. If it doesn't, then |
|
161 |
mail me a bug report. |
mail me a bug report. |
162 |
|
|
163 |
<p> |
<p>The emulator's performance is highly dependent on both runtime settings |
|
(Note for Windows users: there is a possibility that some releases |
|
|
and/or snapshots will also work with Cygwin, but I can't promise that.) |
|
|
|
|
|
<p> |
|
|
The emulator's performance is highly dependent on both runtime settings |
|
164 |
and on compiler settings, so you might want to experiment with different |
and on compiler settings, so you might want to experiment with different |
165 |
CC and CFLAGS environment variable values. For example, on a modern PC, |
CC and CFLAGS environment variable values. For example, on a modern PC, |
166 |
you could try the following: |
you could try the following: |
167 |
<p> |
<p><pre> |
168 |
<pre> |
$ <b>CFLAGS="-mcpu=pentium4 -O3" ./configure</b> |
169 |
$ <b>CFLAGS="-mcpu=pentium4 -O3" ./configure</b> |
$ <b>make</b> |
|
$ <b>make</b> |
|
170 |
</pre> |
</pre> |
171 |
|
|
|
<p> |
|
|
Run <b><tt>./configure --help</tt></b> to get a list of configure options. (The |
|
|
possible options differ between different releases and snapshots.) |
|
172 |
|
|
173 |
|
|
174 |
|
|
227 |
CPUs are also emulated, and are hopefully almost as stable as the R4000 |
CPUs are also emulated, and are hopefully almost as stable as the R4000 |
228 |
emulation. |
emulation. |
229 |
|
|
230 |
<p> |
<p>I have written an experimental dynamic binary translation subsystem. |
|
I have written an experimental dynamic binary translation subsystem. |
|
231 |
This gives higher total performance than interpreting one instruction at a |
This gives higher total performance than interpreting one instruction at a |
232 |
time and executing it. (If you wish to enable bintrans, add <b>-b</b> to |
time and executing it. (If you wish to disable bintrans, add <b>-B</b> to |
233 |
the command line, but keep in mind that it is still experimental.) |
the command line.) |
|
|
|
|
|
|
|
<h4>URISC:</h4> |
|
|
|
|
|
I have implemented an <a href="http://en.wikipedia.org/wiki/URISC">URISC</a> |
|
|
emulation mode, just for fun. The only instruction available in an URISC |
|
|
machine is "reverse subtract and skip on borrow". (It is probably not |
|
|
worth trying to do bintrans with URISC, because any reasonable URISC |
|
|
program relies on self-modifying code, which is bad for bintrans |
|
|
performance.) |
|
234 |
|
|
235 |
|
|
236 |
<h4>Other CPU types:</h4> |
<h4>Other CPU types:</h4> |
253 |
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 |
254 |
emulator. |
emulator. |
255 |
|
|
256 |
<p> |
<p>Caches are by default not emulated. In some cases, the existance of |
257 |
Caches are by default not emulated. In some cases, the existance of caches |
caches is "faked" to let operating systems think that they are there. |
258 |
is "faked" to let operating systems think that they are there. (There is |
(There is some old code for R2000/R3000 caches, but it has probably |
259 |
some old code for R2000/R3000 caches, but it has probably suffered from |
suffered from bitrot by now.) |
260 |
bitrot by now.) |
|
261 |
|
<p>The emulator is <i>not</i> timing-accurate. It can be run in a |
262 |
<p> |
"deterministic" mode, <tt><b>-D</b></tt>. The meaning of deterministic is |
263 |
The emulator is <i>not</i> timing-accurate. It can be run in a |
simply that running two emulations with the same settings will result in |
264 |
"deterministic" mode, <tt><b>-D</b></tt>. The meaning of deterministic is |
identical runs. Obviously, this requires that no user interaction is |
265 |
simply that running two emulations with the same settings will result in |
taking place, and that clock speeds are fixed with the <tt><b>-I</b></tt> |
266 |
identical runs. Obviously, this requires that no user interaction is |
option. (Deterministic in this case does <i>not</i> mean that the |
267 |
taking place, and that clock speeds are fixed with the <tt><b>-I</b></tt> |
emulation will be identical to some actual real-world machine.) |
|
option. (Deterministic in this case does <i>not</i> mean that the emulation |
|
|
will be identical to some actual real-world machine.) |
|
268 |
|
|
269 |
|
|
270 |
|
|
314 |
<li>a console I/O device (putchar() and getchar()...) |
<li>a console I/O device (putchar() and getchar()...) |
315 |
<li>an inter-processor communication device, for SMP experiments |
<li>an inter-processor communication device, for SMP experiments |
316 |
<li>a very simple linear framebuffer device (for graphics output) |
<li>a very simple linear framebuffer device (for graphics output) |
317 |
|
<li>a simple SCSI disk controller |
318 |
|
<li>a simple ethernet controller |
319 |
</ul> |
</ul> |
320 |
|
|
321 |
<p>This mode is useful if you wish to run experimental code, but do not |
<p>This mode is useful if you wish to run experimental code, but do not |