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>Gavare's eXperimental Emulator:</b></font><br> |
<b>GXemul:</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.100 2006/11/04 06:40:20 debug Exp $ |
$Id: intro.html,v 1.125 2007/06/30 14:02:02 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: |
52 |
<li><a href="#build">How to compile/build the emulator</a> |
<li><a href="#build">How to compile/build the emulator</a> |
53 |
<li><a href="#run">How to run the emulator</a> |
<li><a href="#run">How to run the emulator</a> |
54 |
<li><a href="#cpus">Which processor architectures does GXemul emulate?</a> |
<li><a href="#cpus">Which processor architectures does GXemul emulate?</a> |
55 |
<li><a href="#hosts">Which host architectures are supported?</a> |
<li><a href="#hosts">Which host architectures/platforms are supported?</a> |
|
<li><a href="#translation">What kind of translation does GXemul use?</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 |
</ul> |
</ul> |
67 |
<a name="overview"></a> |
<a name="overview"></a> |
68 |
<h3>Overview:</h3> |
<h3>Overview:</h3> |
69 |
|
|
70 |
GXemul is an experimental instruction-level machine emulator. Several |
GXemul is a framework for full-system computer architecture emulation. |
71 |
emulation modes are available. In some modes, processors and surrounding |
Several processor architectures and machine types have been implemented. |
72 |
hardware components are emulated well enough to let unmodified operating |
It is working well enough to allow <a href="#emulmodes">unmodified |
73 |
systems (e.g. NetBSD) run as if they were running on a real machine. |
"guest" operating systems to run inside the emulator</a>, as if they were |
74 |
|
running on real hardware. |
75 |
|
|
76 |
|
<p>The emulator emulates (networks of) real machines. The machines may |
77 |
|
consist of <a |
78 |
|
href="http://en.wikipedia.org/wiki/ARM_architecture">ARM</a>, <a |
79 |
|
href="http://en.wikipedia.org/wiki/MIPS_architecture">MIPS</a>, <a |
80 |
|
href="http://en.wikipedia.org/wiki/Powerpc">PowerPC</a>, and <a |
81 |
|
href="http://en.wikipedia.org/wiki/SuperH">SuperH</a> processors, and |
82 |
|
various surrounding hardware components such as framebuffers, busses, |
83 |
|
interrupt controllers, ethernet controllers, disk controllers, and serial |
84 |
|
port controllers. |
85 |
|
|
86 |
|
<p>GXemul, including the dynamic translation system, is implemented in |
87 |
|
portable |
88 |
|
<a href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a>, |
89 |
|
which means that the emulator will run on practically any 64-bit or 32-bit |
90 |
|
<a href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> systems, |
91 |
|
with few or no modifications. |
92 |
|
|
93 |
<p>Devices and processors are not simulated with 100% accuracy. They are |
<p>Devices and processors are not simulated with 100% accuracy. They are |
94 |
only ``faked'' well enough to allow guest operating systems to run without |
only "faked" well enough to allow guest operating systems to run without |
95 |
complaining too much. Still, the emulator could be of interest for |
complaining too much. Still, the emulator could be of interest for |
96 |
academic research and experiments, such as when learning how to write |
academic research and experiments, such as when learning how to write |
97 |
operating system code. |
operating system code. |
98 |
|
|
|
<p>The emulator is written in C, does not depend on third-party libraries, |
|
|
and should compile and run on most 64-bit and 32-bit Unix-like systems. |
|
|
|
|
99 |
<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 |
100 |
and surrounding hardware found in real machines, but it does not contain |
and surrounding hardware found in real machines, but it does not contain |
101 |
any ROM code. You will need some form of program (in binary form) to run |
any ROM code. You will need some form of program (in binary form) to run |
102 |
in the emulator. For many emulation modes, PROM calls are handled by the |
in the emulator. For some emulation modes, PROM calls are handled by the |
103 |
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. |
104 |
|
|
105 |
<p>You can use pre-compiled kernels (for example NetBSD kernels, or |
<p>You can use pre-compiled kernels (for example <a href="http://www.netbsd.org/">NetBSD</a> |
106 |
Linux), or other programs that are in binary format, and in some cases |
kernels, or Linux), or other programs that are in binary format, and in some cases |
107 |
even actual ROM images. A couple of different file formats are supported |
even actual ROM images. A couple of different file formats are supported: |
108 |
(ELF, a.out, ECOFF, SREC, and raw binaries). |
<a href="http://en.wikipedia.org/wiki/Executable_and_Linkable_Format">ELF</a>, |
109 |
|
<a href="http://en.wikipedia.org/wiki/A.out">a.out</a>, |
110 |
|
<a href="http://en.wikipedia.org/wiki/COFF">COFF</a>/<a href="http://en.wikipedia.org/wiki/ECOFF">ECOFF</a>, |
111 |
|
<a href="http://en.wikipedia.org/wiki/SREC_%28file_format%29">SREC</a>, and raw binaries. |
112 |
|
|
113 |
<p>If you do not have a kernel as a separate file, but you have a bootable |
<p>If you do not have a kernel as a separate file, but you have a bootable |
114 |
disk image, then it is sometimes possible to boot directly from that |
disk image, then it is sometimes possible to boot directly from that |
115 |
image. (This works for example with DECstation emulation, or when booting |
image. This works for example with DECstation emulation, <a href="dreamcast.html">Dreamcast |
116 |
from ISO9660 CDROM images.) |
emulation</a>, or when booting from generic <a href="http://en.wikipedia.org/wiki/ISO9660">ISO9660</a> |
117 |
|
CDROM images if the kernel is included in the image as a plain file. |
118 |
|
|
119 |
<p>Thanks to (in no specific order) Joachim Buss, Olivier Houchard, Juli |
<p>Thanks to (in no specific order) Joachim Buss, Olivier Houchard, Juli |
120 |
Mallett, Juan Romero Pardines, Alec Voropay, Göran Weinholt, Alexander |
Mallett, Juan Romero Pardines, Carl van Schaik, Miod Vallat, Alec Voropay, |
121 |
Yurchenko, and everyone else who has provided me with feedback. |
Göran Weinholt, Alexander Yurchenko, and everyone else who has provided me |
122 |
|
with feedback. |
123 |
|
|
124 |
|
|
125 |
|
|
153 |
notes. I have not done this, since I do not plan on making distributions |
notes. I have not done this, since I do not plan on making distributions |
154 |
without source code. You need to check all individual files for details. |
without source code. You need to check all individual files for details. |
155 |
The "easiest way out" if you plan to redistribute code from GXemul is, of |
The "easiest way out" if you plan to redistribute code from GXemul is, of |
156 |
course, to let it remain open source and simply supply the source code. |
course, to let it remain Free Software and simply include the source code. |
157 |
|
|
158 |
<p>In case you want to reuse parts of GXemul, but you need to do that |
<p>In case you want to reuse parts of GXemul, but you need to do that |
159 |
under a different license (e.g. the GPL), then contact me and I might |
under a different license (e.g. the |
160 |
re-license/dual-license files on a case-by-case basis. |
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>), then contact me and |
161 |
|
I can probably re-license/dual-license files on a case-by-case basis. |
162 |
|
|
163 |
|
|
164 |
|
|
178 |
specific libraries to build, however, if you build on a system which does |
specific libraries to build, however, if you build on a system which does |
179 |
not have X11 libraries installed, some functionality will be lost. |
not have X11 libraries installed, some functionality will be lost. |
180 |
|
|
181 |
<p>The emulator's performance is highly dependent on both runtime settings |
<p>The emulator's performance is highly dependent on both runtime settings |
182 |
and on compiler settings, so you might want to experiment with different |
and on compiler settings, so you might want to experiment with using |
183 |
CC and CFLAGS environment variable values. For example, on an AMD Athlon |
different <tt>CC</tt> and <tt>CFLAGS</tt> environment variable values when |
184 |
host, you might want to try setting <tt>CFLAGS</tt> to <tt>-march=athlon</tt> |
running the <tt>configure</tt> script. |
185 |
before running <tt>configure</tt>. |
|
186 |
|
<p>On some platforms, it is possible that building GXemul will fail |
187 |
|
because of too high optimization. When using GCC (the GNU compiler), |
188 |
|
<tt>-O3</tt> is the default optimization level. This works fine on e.g. |
189 |
|
amd64 and i386 systems, but on some more uncommon platforms, <tt>-O3</tt> |
190 |
|
might trigger internal bugs in GCC itself. If this happens, try setting |
191 |
|
<tt>CFLAGS</tt> to <tt>-O2</tt> before running <tt>./configure</tt>, and |
192 |
|
try again, |
193 |
|
|
194 |
|
<p>Note that there is no <tt>make install</tt> functionality; package |
195 |
|
maintainers for individual operating systems solve this for their |
196 |
|
corresponding OSes. |
197 |
|
|
198 |
|
|
199 |
|
|
210 |
<b><tt>-h</tt></b> or <b><tt>-H</tt></b> command line options) will |
<b><tt>-h</tt></b> or <b><tt>-H</tt></b> command line options) will |
211 |
display a help message. |
display a help message. |
212 |
|
|
213 |
<p> |
<p>To get some ideas about what is possible to run in the emulator, please |
|
To get some ideas about what is possible to run in the emulator, please |
|
214 |
read the section about <a href="guestoses.html">installing "guest" |
read the section about <a href="guestoses.html">installing "guest" |
215 |
operating systems</a>. If you are interested in using the emulator to |
operating systems</a>. The most straight forward guest operating to |
216 |
develop code on your own, then you should also read the section about |
install is NetBSD/pmax; the instructions provided <a |
217 |
<a href="experiments.html#hello">Hello World</a>. |
href="guestoses.html#netbsdpmaxinstall">here</a> should let you install |
218 |
|
NetBSD/pmax in a way very similar to how it is done on a real DECstation. |
219 |
|
|
220 |
|
<p>If you are interested in using the emulator to develop code on your |
221 |
|
own, then you should also read the section about <a |
222 |
|
href="experiments.html#hello">Hello World</a>. |
223 |
|
|
224 |
<p> |
<p>To exit the emulator, type CTRL-C to enter the |
|
To exit the emulator, type CTRL-C to enter the |
|
225 |
single-step debugger, and then type <tt><b>quit</b></tt>. |
single-step debugger, and then type <tt><b>quit</b></tt>. |
226 |
|
|
227 |
<p> |
<p>If you are starting an emulation by entering settings directly on the |
228 |
If you are starting an emulation by entering settings directly on the |
command line, and you are not using the <tt><b>-x</b></tt> option, then |
229 |
command line, and you are not using the <tt><b>-x</b></tt> option, then all |
all terminal input and output will go to the main controlling terminal. |
|
terminal input and output will go to the main controlling terminal. |
|
230 |
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 |
231 |
the running (emulated) program, you may use CTRL-B. |
the running (emulated) program, you may use CTRL-B. (This should be a |
232 |
(This should be a reasonable compromise to allow the emulator to be usable |
reasonable compromise to allow the emulator to be usable even on systems |
233 |
even on systems without X Windows.) |
without X Windows.) |
234 |
|
|
235 |
<p> |
<p>There is no way to send an actual CTRL-B to the emulated program, when |
236 |
There is no way to send an actual CTRL-B to the emulated program, when |
typing in the main controlling terminal window. The solution is to either |
237 |
typing in the main controlling terminal window. The solution is to either |
use <a href="configfiles.html">configuration files</a>, or use |
|
use <a href="configfiles.html">configuration files</a>, or use |
|
238 |
<tt><b>-x</b></tt>. Both these solutions cause new xterms to be opened for |
<tt><b>-x</b></tt>. Both these solutions cause new xterms to be opened for |
239 |
each emulated serial port that is written to. CTRL-B and CTRL-C both have |
each emulated serial port that is written to. CTRL-B and CTRL-C both have |
240 |
their original meaning in those xterm windows. |
their original meaning in those xterm windows. |
248 |
<h3>Which processor architectures does GXemul emulate?</h3> |
<h3>Which processor architectures does GXemul emulate?</h3> |
249 |
|
|
250 |
The architectures that are emulated well enough to let at least one |
The architectures that are emulated well enough to let at least one |
251 |
guest operating system run (per architecture) are ARM, MIPS, PowerPC, |
guest operating system run (per architecture) are |
252 |
and SuperH. |
<a href="http://en.wikipedia.org/wiki/ARM_architecture">ARM</a>, |
253 |
|
<a href="http://en.wikipedia.org/wiki/MIPS_architecture">MIPS</a>, |
254 |
|
<a href="http://en.wikipedia.org/wiki/Powerpc">PowerPC</a>, and |
255 |
|
<a href="http://en.wikipedia.org/wiki/SuperH">SuperH</a>. |
256 |
|
|
257 |
|
<p>Please read the sections about <a href="#emulmodes">emulation |
258 |
|
modes</a> and <a href="guestoses.html">guest operating |
259 |
|
systems</a> for more information about the machines and operating systems, |
260 |
|
respectively, that can be considered "working" in the emulator. |
261 |
|
|
262 |
|
<p>(There is some code in GXemul for emulation of other architectures, but |
263 |
|
they are not stable or complete enough to be listed among the "working" |
264 |
|
architectures.) |
265 |
|
|
266 |
|
|
267 |
|
|
270 |
|
|
271 |
<p><br> |
<p><br> |
272 |
<a name="hosts"></a> |
<a name="hosts"></a> |
273 |
<h3>Which host architectures are supported?</h3> |
<h3>Which host architectures/platforms are supported?</h3> |
274 |
|
|
275 |
GXemul should compile and run on any modern host architecture (64-bit or |
GXemul should compile and run on any modern host architecture (64-bit or |
276 |
32-bit word-length). |
32-bit word-length). I generally test it on |
277 |
|
<a href="http://www.freebsd.org/platforms/amd64.html">FreeBSD/amd64</a> 6.x, |
278 |
|
<a href="http://www.freebsd.org/platforms/alpha.html">FreeBSD/alpha</a> 4.x, |
279 |
|
sometimes also on Linux (various platforms), and every |
280 |
|
now and then also on <a href="http://www.netbsd.org/">NetBSD</a> or |
281 |
|
<a href="http://www.openbsd.org/">OpenBSD</a> inside the emulator itself |
282 |
|
(various platforms). |
283 |
|
|
284 |
|
<p>Note 1: The <a href="translation.html">dynamic translation</a> engine |
285 |
|
does <i>not</i> require backends for native code generation to be written |
286 |
|
for each individual host architecture; the intermediate representation |
287 |
|
that the dyntrans system uses can be executed on any host architecture. |
288 |
|
|
289 |
|
<p>Note 2: Although GXemul may build and run on non-Unix-like platforms, |
290 |
|
such as <a href="http://www.cygwin.com/">Cygwin</a>, Unix-like systems are |
291 |
|
the primary platform. Some functionality may be lost when running on Cygwin. |
292 |
|
|
|
<p>(The dynamic translation engine translates into an intermediate |
|
|
representation, but not currently into native code. This means that there |
|
|
is no need for per-host architecture backend code.) |
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
|
|
<p><br> |
|
|
<a name="translation"></a> |
|
|
<h3>What kind of translation does GXemul use?</h3> |
|
|
|
|
|
<b>Static vs. dynamic:</b> |
|
|
|
|
|
<p>In order to support guest operating systems, which can overwrite old |
|
|
code pages in memory with new code, it is necessary to translate code |
|
|
dynamically. It is not possible to do a "one-pass" (static) translation. |
|
|
Self-modifying code and Just-in-Time compilers running inside |
|
|
the emulator are other things that would not work with a static |
|
|
translator. GXemul is a dynamic translator. However, it does not |
|
|
necessarily translate into native code, like many other emulators. |
|
|
|
|
|
<p><b>"Runnable" Intermediate Representation:</b> |
|
|
|
|
|
<p>Dynamic translators usually translate from the emulated architecture |
|
|
(e.g. MIPS) into a kind of <i>intermediate representation</i> (IR), and then |
|
|
to native code (e.g. AMD64 or x86 code). Since one of my main goals for |
|
|
GXemul is to keep everything as portable as possible, I have tried to make |
|
|
sure that the IR is something which can be executed regardless of whether |
|
|
the final step (translation from IR to native code) has been implemented |
|
|
or not. |
|
|
|
|
|
<p>The IR in GXemul consists of arrays of pointers to functions, and a few |
|
|
arguments which are passed along to those functions. The functions are |
|
|
implemented in either manually hand-coded C, or automatically generated C. |
|
|
In any case, this is all statically linked into the GXemul binary at link |
|
|
time. |
|
|
|
|
|
<p>Here is a simplified diagram of how these arrays work. |
|
|
|
|
|
<p><center><img src="simplified_dyntrans.png"></center> |
|
|
|
|
|
<p>There is one instruction call slot for every possible program counter |
|
|
location. In the MIPS case, instruction words are 32 bits in length, |
|
|
and pages are (usually) 4 KB large, resulting in 1024 instruction call |
|
|
slots. After the last of these instruction calls, there is an additional |
|
|
call to a special "end of page" function (which doesn't count as an executed |
|
|
instruction). This function switches to the first instruction |
|
|
on the next virtual page (which might cause exceptions, etc). |
|
|
|
|
|
<p>The complexity of individual instructions vary. A simple example of |
|
|
what an instruction can look like is the MIPS <tt>addiu</tt> instruction: |
|
|
<pre> |
|
|
X(addiu) |
|
|
{ |
|
|
reg(ic->arg[1]) = (int32_t) |
|
|
((int32_t)reg(ic->arg[0]) + (int32_t)ic->arg[2]); |
|
|
} |
|
|
</pre> |
|
|
|
|
|
<p>It stores the result of a 32-bit addition of the register at arg[0] |
|
|
with the immediate value arg[2] (treating both as signed 32-bit |
|
|
integers) into register arg[1]. If the emulated CPU is a 64-bit CPU, |
|
|
then this will store a correctly sign-extended value into arg[1]. |
|
|
If it is a 32-bit CPU, then only the lowest 32 bits will be stored, |
|
|
and the high part ignored. <tt>X(addiu)</tt> is expanded to |
|
|
<tt>mips_instr_addiu</tt> in the 64-bit case, and <tt>mips32_instr_addiu</tt> |
|
|
in the 32-bit case. Both are compiled into the GXemul executable; no code |
|
|
is created during run-time. |
|
|
|
|
|
<p>Here are examples of what the <tt>addiu</tt> instruction actually |
|
|
looks like when it is compiled, on various host architectures: |
|
|
|
|
|
<p><center><table border="0"> |
|
|
<tr><td><b>GCC 4.0.1 on Alpha:</b></td> |
|
|
<td width="35"></td><td></td> |
|
|
<tr> |
|
|
<td valign="top"> |
|
|
<pre>mips_instr_addiu: |
|
|
ldq t1,8(a1) |
|
|
ldq t2,24(a1) |
|
|
ldq t3,16(a1) |
|
|
ldq t0,0(t1) |
|
|
addl t0,t2,t0 |
|
|
stq t0,0(t3) |
|
|
ret</pre> |
|
|
</td> |
|
|
<td></td> |
|
|
<td valign="top"> |
|
|
<pre>mips32_instr_addiu: |
|
|
ldq t2,8(a1) |
|
|
ldq t0,24(a1) |
|
|
ldq t3,16(a1) |
|
|
ldl t1,0(t2) |
|
|
addq t0,t1,t0 |
|
|
stl t0,0(t3) |
|
|
ret</pre> |
|
|
</td> |
|
|
</tr> |
|
|
|
|
|
<tr><td><b><br>GCC 3.4.4 on AMD64:</b></td> |
|
|
<tr> |
|
|
<td valign="top"> |
|
|
<pre>mips_instr_addiu: |
|
|
mov 0x8(%rsi),%rdx |
|
|
mov 0x18(%rsi),%rax |
|
|
mov 0x10(%rsi),%rcx |
|
|
add (%rdx),%eax |
|
|
cltq |
|
|
mov %rax,(%rcx) |
|
|
retq</pre> |
|
|
</td> |
|
|
<td></td> |
|
|
<td valign="top"> |
|
|
<pre>mips32_instr_addiu: |
|
|
mov 0x8(%rsi),%rcx |
|
|
mov 0x10(%rsi),%rdx |
|
|
mov (%rcx),%eax |
|
|
add 0x18(%rsi),%eax |
|
|
mov %eax,(%rdx) |
|
|
retq</pre> |
|
|
</td> |
|
|
</tr> |
|
|
|
|
|
<tr><td><b><br>GCC 4.0.1 on i386:</b></td> |
|
|
<tr> |
|
|
<td valign="top"> |
|
|
<pre>mips_instr_addiu: |
|
|
mov 0x8(%esp),%eax |
|
|
mov 0x8(%eax),%ecx |
|
|
mov 0x4(%eax),%edx |
|
|
mov 0xc(%eax),%eax |
|
|
add (%edx),%eax |
|
|
mov %eax,(%ecx) |
|
|
cltd |
|
|
mov %edx,0x4(%ecx) |
|
|
ret</pre> |
|
|
</td> |
|
|
<td></td> |
|
|
<td valign="top"> |
|
|
<pre>mips32_instr_addiu: |
|
|
mov 0x8(%esp),%eax |
|
|
mov 0x8(%eax),%ecx |
|
|
mov 0x4(%eax),%edx |
|
|
mov 0xc(%eax),%eax |
|
|
add (%edx),%eax |
|
|
mov %eax,(%ecx) |
|
|
ret</pre> |
|
|
</td> |
|
|
</tr> |
|
|
</table></center> |
|
|
|
|
|
<p>On 64-bit hosts, there is not much difference, but on 32-bit hosts (and |
|
|
to some extent on AMD64), the difference is enough to make it worthwhile. |
|
|
|
|
|
|
|
|
<p><b>Performance:</b> |
|
|
|
|
|
<p>The performance of using this kind of runnable IR is obviously lower |
|
|
than what can be achieved by emulators using native code generation, but |
|
|
can be significantly higher than using a naive fetch-decode-execute |
|
|
interpretation loop. In my opinion, using a runnable IR is an interesting |
|
|
compromise. |
|
|
|
|
|
<p>The overhead per emulated instruction is usually around or below |
|
|
approximately 10 host instructions. This is very much dependent on your |
|
|
host architecture and what compiler and compiler switches you are using. |
|
|
Added to this instruction count is (of course) also the C code used to |
|
|
implement each specific instruction. |
|
|
|
|
|
<p><b>Instruction Combinations:</b> |
|
|
|
|
|
<p>Short, common instruction sequences can sometimes be replaced by a |
|
|
"compound" instruction. An example could be a compare instruction followed |
|
|
by a conditional branch instruction. The advantages of instruction |
|
|
combinations are that |
|
|
<ul> |
|
|
<li>the amortized overhead per instruction is slightly reduced, and |
|
|
<p> |
|
|
<li>the host's compiler can make a good job at optimizing the common |
|
|
instruction sequence. |
|
|
</ul> |
|
|
|
|
|
<p>The special cases where instruction combinations give the most gain |
|
|
are in the cores of string/memory manipulation functions such as |
|
|
<tt>memset()</tt> or <tt>strlen()</tt>. The core loop can then (at least |
|
|
to some extent) be replaced by a native call to the equivalent function. |
|
|
|
|
|
<p>The implementations of compound instructions still keep track of the |
|
|
number of executed instructions, etc. When single-stepping, these |
|
|
translations are invalidated, and replaced by normal instruction calls |
|
|
(one per emulated instruction). |
|
|
|
|
|
<p><b>Native Code Back-ends: (not in this release)</b> |
|
|
|
|
|
<p>In theory, it will be possible to implement native code generation |
|
|
(similar to what is used in high-performance emulators such as QEMU), |
|
|
as long as that generated code abides to the C ABI on the host, but |
|
|
for now I wanted to make sure that GXemul works without such native |
|
|
code back-ends. For this reason, since release 0.4.0, GXemul is |
|
|
completely free of native code back-ends. |
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
|
299 |
|
|
300 |
<p><br> |
<p><br> |
354 |
<li><b>Acer Pica-61</b> (<a href="guestoses.html#netbsdarcinstall">NetBSD/arc</a>) |
<li><b>Acer Pica-61</b> (<a href="guestoses.html#netbsdarcinstall">NetBSD/arc</a>) |
355 |
<li><b>NEC MobilePro 770, 780, 800, 880</b> (<a href="guestoses.html#netbsdhpcmipsinstall">NetBSD/hpcmips</a>) |
<li><b>NEC MobilePro 770, 780, 800, 880</b> (<a href="guestoses.html#netbsdhpcmipsinstall">NetBSD/hpcmips</a>) |
356 |
<li><b>Cobalt</b> (<a href="guestoses.html#netbsdcobaltinstall">NetBSD/cobalt</a>) |
<li><b>Cobalt</b> (<a href="guestoses.html#netbsdcobaltinstall">NetBSD/cobalt</a>) |
357 |
<li><b>Malta</b> (<a href="guestoses.html#netbsdevbmipsinstall">NetBSD/evbmips</a>) |
<li><b>Malta</b> (<a href="guestoses.html#netbsdevbmipsinstall">NetBSD/evbmips</a>, Linux/Malta <font color="#0000e0">(<super>*1</super>)</font>) |
358 |
<li><b>Algorithmics P5064</b> (<a href="guestoses.html#netbsdalgorinstall">NetBSD/algor</a>) |
<li><b>Algorithmics P5064</b> (<a href="guestoses.html#netbsdalgorinstall">NetBSD/algor</a>) |
359 |
<li><b>SGI O2 (aka IP32)</b> <font color="#0000e0">(<super>*1</super>)</font> |
<li><b>SGI O2 (aka IP32)</b> <font color="#0000e0">(<super>*2</super>)</font> |
360 |
(<a href="guestoses.html#netbsdsgimips">NetBSD/sgi</a>) |
(<a href="guestoses.html#netbsdsgimips">NetBSD/sgi</a>) |
361 |
</ul> |
</ul> |
362 |
<p> |
<p> |
363 |
<li><b><u>PowerPC</u></b> |
<li><b><u>PowerPC</u></b> |
364 |
<ul> |
<ul> |
365 |
<li><b>IBM 6050/6070 (PReP, PowerPC Reference Platform)</b> (<a href="guestoses.html#netbsdprepinstall">NetBSD/prep</a>) |
<li><b>IBM 6050/6070 (PReP, PowerPC Reference Platform)</b> (<a href="guestoses.html#netbsdprepinstall">NetBSD/prep</a>) |
366 |
|
<li><b>MacPPC (generic "G4" Macintosh)</b> (<a href="guestoses.html#netbsdmacppcinstall">NetBSD/macppc</a>) |
367 |
|
<li><b>Artesyn PM/PPC</b> <font color="#0000e0">(<super>*2</super>)</font> |
368 |
|
(<a href="guestoses.html#netbsdpmppc">NetBSD/pmppc</a>) |
369 |
</ul> |
</ul> |
370 |
<p> |
<p> |
371 |
<li><b><u>SuperH</u></b> |
<li><b><u>SuperH</u></b> |
372 |
<ul> |
<ul> |
373 |
<li><b>Sega Dreamcast</b> |
<li><b>Sega Dreamcast</b> (<a href="dreamcast.html#netbsd_generic_md">NetBSD/dreamcast</a>, <a href="dreamcast.html#linux_live_cd">Linux/dreamcast</a>) |
374 |
<font color="#0000e0">(<super>*2</super>)</font> |
<li><b>Landisk I-O DATA USL-5P</b> (<a href="guestoses.html#openbsdlandiskinstall">OpenBSD/landisk</a>) |
|
(<a href="guestoses.html#netbsddreamcast">NetBSD/dreamcast</a>) |
|
375 |
</ul> |
</ul> |
376 |
</ul> |
</ul> |
377 |
|
|
378 |
<p> |
<p> |
379 |
<small><font color="#0000e0">(<super>*1</super>)</font> = |
<small><font color="#0000e0">(<super>*1</super>)</font> = |
380 |
Enough for root-on-nfs, but not for disk boot.</small> |
Linux/Malta may be run as a guest OS, however I have not yet found any stable |
381 |
|
URL to pre-compiled Linux/Malta kernels. Thus, Linux/Malta emulation is not |
382 |
|
tested for every release of the emulator; sometimes it works, sometimes |
383 |
|
it doesn't.</small> |
384 |
|
|
385 |
<br><small><font color="#0000e0">(<super>*2</super>)</font> = |
<br><small><font color="#0000e0">(<super>*2</super>)</font> = |
386 |
Only enough to reach ramdisk userland; no root-on-nfs yet.</small> |
The emulation is enough for root-on-nfs, but no disk controller (SCSI nor |
387 |
|
IDE) is emulated yet for this machine type.</small> |
388 |
|
|
389 |
|
<p>Note that of all of the machines above, none of them is emulated to |
390 |
|
100%. The most complete emulation mode is probably the DECstation |
391 |
|
5000/200. Things that will most likely <b>not</b> work include running |
392 |
|
raw PROM images for most machines, SGI IRIX, MacOS X or Darwin, Windows |
393 |
|
NT, or Dreamcast games. |
394 |
|
|
395 |
<p>There is code in GXemul for emulation of many other machine types; the |
<p>There is code in GXemul for emulation of several other machine types; the |
396 |
degree to which these work range from almost being able to run a complete |
degree to which these work range from almost being able to run a complete |
397 |
OS, to almost completely unsupported (perhaps just enough support to |
OS, to almost completely unsupported, perhaps just enough support to |
398 |
output a few boot messages via serial console). |
output a few boot messages via serial console. (See the end of |
399 |
|
<a href="guestoses.html#generalnotes">this section</a> on the Guest OSes |
400 |
|
page for some examples, but remember that these do not necessarily work.) |
401 |
|
|
402 |
<p>In addition to emulating real machines, there is also a "test-machine". |
<p>In addition to emulating real machines, there is also a "test-machine". |
403 |
A test-machine consists of one or more CPUs and a few experimental devices |
A test-machine consists of one or more CPUs and a few experimental devices |
410 |
<li>a very simple linear framebuffer device (for graphics output) |
<li>a very simple linear framebuffer device (for graphics output) |
411 |
<li>a simple disk controller |
<li>a simple disk controller |
412 |
<li>a simple ethernet controller |
<li>a simple ethernet controller |
413 |
|
<li>a simple interrupt controller |
414 |
<li>a real-time clock device |
<li>a real-time clock device |
415 |
</ul> |
</ul> |
416 |
|
|