1 |
<html><head><title>GXemul documentation: Technical details</title> |
<html><head><title>Gavare's eXperimental Emulator: Technical details</title> |
2 |
<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>Technical details</b> |
<font color="#000000" size="6"><b>Technical details</b> |
9 |
</font></td></tr></table></td></tr></table><p> |
</font></td></tr></table></td></tr></table><p> |
10 |
|
|
11 |
<!-- |
<!-- |
12 |
|
|
13 |
$Id: technical.html,v 1.53 2005/06/27 17:31:50 debug Exp $ |
$Id: technical.html,v 1.62 2005/08/16 05:15:24 debug Exp $ |
14 |
|
|
15 |
Copyright (C) 2004-2005 Anders Gavare. All rights reserved. |
Copyright (C) 2004-2005 Anders Gavare. All rights reserved. |
16 |
|
|
40 |
--> |
--> |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
<a href="./">Back to the index</a> |
<a href="./">Back to the index</a> |
45 |
|
|
46 |
<p><br> |
<p><br> |
53 |
<li><a href="#speed">Speed and emulation modes</a> |
<li><a href="#speed">Speed and emulation modes</a> |
54 |
<li><a href="#net">Networking</a> |
<li><a href="#net">Networking</a> |
55 |
<li><a href="#devices">Emulation of hardware devices</a> |
<li><a href="#devices">Emulation of hardware devices</a> |
|
<li><a href="#regtest">Regression tests</a> |
|
56 |
</ul> |
</ul> |
57 |
|
|
58 |
|
|
94 |
different kinds of emulation, so these might change in the future.) |
different kinds of emulation, so these might change in the future.) |
95 |
|
|
96 |
<ul> |
<ul> |
97 |
<li><b>MIPS</b><br> |
<li><b>MIPS:</b><br> |
98 |
There are two emulation modes. The most important one is an |
There are two emulation modes. The most important one is an |
99 |
implementation of a <i>dynamic binary translator</i>. |
implementation of a <i>dynamic binary translator</i>. |
100 |
(Compared to real binary translators, though, GXemul's bintrans |
(Compared to real binary translators, though, GXemul's bintrans |
105 |
works. It can be forcefully used by using the <tt>-B</tt> command |
works. It can be forcefully used by using the <tt>-B</tt> command |
106 |
line option.) |
line option.) |
107 |
<p> |
<p> |
108 |
<li><b>ARM</b><br> |
<li><b>All other modes:</b><br> |
109 |
This mode does not really work yet, but will use |
These are under development, using a new dynamic translation |
110 |
dynamic translation, but not binary translation. Stay tuned. :-) |
system. This system does not use host-specific backends. |
111 |
<p> |
Speed is slower than real binary translation, but faster than |
112 |
<li><b>URISC</b><br> |
traditional interpretation, and with some tricks it will hopefully |
113 |
Simple interpretation, one instruction at a time. There is probably |
still give reasonable speed. These modes don't really work yet, |
114 |
no other way to emulate URISC, because it relies too heavily |
and are not enabled by default in the stable release. |
|
on self-modifying code. |
|
|
<p> |
|
|
<li><b>POWER/PowerPC</b><br> |
|
|
This emulation mode is very much unfinished, but still enabled by |
|
|
default. So far it uses plain interpretation, where an instruction |
|
|
is read from emulated memory, and interpreted one at a time. |
|
|
Slow. Not very interesting. |
|
|
<p> |
|
|
<li><b>x86</b><br> |
|
|
Although too unstable and non-working to be enabled by default, |
|
|
there is some code for emulating x86 machines. It simply reads |
|
|
one instruction at a time from emulated memory, and executes it. |
|
|
This is as slow as it gets. Not very interesting. |
|
115 |
</ul> |
</ul> |
116 |
|
|
117 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
|
|
|
122 |
<p><br> |
<p><br> |
123 |
<a name="net"></a> |
<a name="net"></a> |
124 |
<h3>Networking</h3> |
<h3>Networking</h3> |
329 |
<a name="devices"></a> |
<a name="devices"></a> |
330 |
<h3>Emulation of hardware devices</h3> |
<h3>Emulation of hardware devices</h3> |
331 |
|
|
332 |
Each file in the <tt>device/</tt> directory is responsible for one |
Each file in the <tt>src/device/</tt> directory is responsible for one |
333 |
hardware device. These are used from <tt>src/machine.c</tt>, when |
hardware device. These are used from <tt>src/machine.c</tt>, when |
334 |
initializing which hardware a particular machine model will be using, or |
initializing which hardware a particular machine model will be using, or |
335 |
when adding devices to a machine using the <tt>device()</tt> command in |
when adding devices to a machine using the <tt>device()</tt> command in |
460 |
|
|
461 |
|
|
462 |
|
|
|
<p><br> |
|
|
<a name="regtest"></a> |
|
|
<h3>Regression tests</h3> |
|
|
|
|
|
In order to make sure that the emulator actually works like it is supposed |
|
|
to, it must be tested. For this purpose, there is a simple regression |
|
|
testing framework in the <tt>tests/</tt> directory. |
|
|
|
|
|
<p> |
|
|
<i>NOTE: The regression testing framework is basically just a skeleton so far. |
|
|
Regression tests are very good to have. However, the fact that complete |
|
|
operating systems can run in the emulator indicate that the emulation is |
|
|
probably not too incorrect. This makes it less of a priority to write |
|
|
regression tests.</i> |
|
|
|
|
|
<p> |
|
|
To run all the regression tests, type <tt>make regtest</tt>. Each assembly |
|
|
language file matching the pattern <tt>test_*.S</tt> will be compiled and |
|
|
linked into a 64-bit MIPS ELF (using a gcc cross compiler), and run in the |
|
|
emulator. If everything goes well, you should see something like this: |
|
|
|
|
|
<pre> |
|
|
$ make regtest |
|
|
cd tests; make run_tests; cd .. |
|
|
gcc33 -Wall -fomit-frame-pointer -fmove-all-movables -fpeephole -O2 |
|
|
-mcpu=ev5 -I/usr/X11R6/include -lm -L/usr/X11R6/lib -lX11 do_tests.c |
|
|
-o do_tests |
|
|
do_tests.c: In function `main': |
|
|
do_tests.c:173: warning: unused variable `s' |
|
|
/var/tmp//ccFOupvD.o: In function `do_tests': |
|
|
/var/tmp//ccFOupvD.o(.text+0x3a8): warning: tmpnam() possibly used |
|
|
unsafely; consider using mkstemp() |
|
|
mips64-unknown-elf-gcc -g -O3 -fno-builtin -fschedule-insns -mips64 |
|
|
-mabi=64 test_common.c -c -o test_common.o |
|
|
./do_tests "mips64-unknown-elf-gcc -g -O3 -fno-builtin -fschedule-insns |
|
|
-mips64 -mabi=64" "mips64-unknown-elf-as -mabi=64 -mips64" |
|
|
"mips64-unknown-elf-ld -Ttext 0xa800000000030000 -e main |
|
|
--oformat=elf64-bigmips" "../gxemul" |
|
|
|
|
|
Starting tests: |
|
|
test_addu.S (-a) |
|
|
test_addu.S (-a -b) |
|
|
test_clo_clz.S (-a) |
|
|
test_clo_clz.S (-a -b) |
|
|
.. |
|
|
test_unaligned.S (-a) |
|
|
test_unaligned.S (-a -b) |
|
|
|
|
|
Done. (12 tests done) |
|
|
PASS: 12 |
|
|
FAIL: 0 |
|
|
|
|
|
---------------- |
|
|
|
|
|
All tests OK |
|
|
|
|
|
---------------- |
|
|
</pre> |
|
|
|
|
|
<p> |
|
|
Each test writes output to stdout, and there is a <tt>test_*.good</tt> for |
|
|
each <tt>.S</tt> file which contains the wanted output. If the actual |
|
|
output matches the <tt>.good</tt> file, then the test passes, otherwise it |
|
|
fails. |
|
|
|
|
|
<p> |
|
|
Read <tt>tests/README</tt> for more information. |
|
|
|
|
|
|
|
|
|
|
463 |
|
|
464 |
</body> |
</body> |
465 |
</html> |
</html> |