GXemul: Introduction

Back to the index.



Overview:

GXemul is a framework for full-system computer architecture emulation. Several processor architectures and machine types have been implemented. It is working well enough to allow unmodified "guest" operating systems to run inside the emulator, as if they were running on real hardware.

The emulator tries to emulate real machines. The machines may consist of ARM, MIPS, Motorola 88K, PowerPC, and SuperH processors, and various surrounding hardware components such as framebuffers, busses, interrupt controllers, ethernet controllers, disk controllers, and serial port controllers.

Thanks to (in no specific order) Joachim Buss, Olivier Houchard, Juli Mallett, Juan Romero Pardines, Carl van Schaik, Jason Thorpe, Miod Vallat, Alec Voropay, Göran Weinholt, Alexander Yurchenko, and everyone else who has provided feedback.


How to compile/build the emulator:

For a standard build, uncompress the .tar.gz distribution file, and run

	$ ./configure
	$ make

This should work on most Unix-like systems, with few or no modifications to the source code. The basic requirement is a reasonably modern C compiler (C99).

GXemul does not require any additional third-party libraries to build. However, the following optional libraries or third-party software give additional functionality:

The emulator's performance is dependent on both runtime settings and on compiler settings, so you might want to experiment with using different CC, CFLAGS, and LDFLAGS environment variable values when running the configure script.

During development of the emulator: configure --debug may be used to enable some debugging aids and turn off optimizations. If you often recompile the whole tree (make clean_all, followed by configure and make again), then using ccache is recommended.

Running make install will install GXemul into /usr/local, or wherever the configure script detects that user software is installed on your system (may be overridden by setting the PREFIX environment variable before running configure).

The dynamic translation engine does not require backends for native code generation to be written for each individual host architecture; the intermediate representation that the dyntrans system uses can be executed on any host architecture.

Most of the development is done on FreeBSD/amd64 using clang and/or GNU C, but every now and then the code is built on Linux, or on NetBSD or OpenBSD inside GXemul itself. Although it is possible that GXemul may build and run on non-Unix-like platforms, such as Cygwin inside Windows, Unix-like systems are the primary platform. Some functionality may be lost or not work as expected when running on Cygwin.


How to run the emulator:

Running gxemul without arguments, or with the -h command line option, will display a short or long help message, respectively.

The most straight forward complete guest operating system to install is NetBSD/pmax; the instructions provided here should let you install NetBSD/pmax in a way very similar to how it is done on a real DECstation.

If you want to inspect or debug arbitrary binaries, you should read the section about debugging.

If you are interested in developing code on your own from scratch to run in the emulator, then you should also read the section about Hello World.

To exit the emulator, type CTRL-C to show the single-step debugger prompt (if it is not already displayed), and then type quit:

	...
	GXemul> quit

If you are starting an emulation by entering settings directly on the command line, all terminal input and output will go to the main controlling terminal. CTRL-C is used to break into the debugger, so in order to send an actual CTRL-C to the running (emulated) program, type CTRL-B. (This should be a reasonable compromise to allow the emulator to be usable even on systems without X Windows.)

There is no way to send CTRL-B to the emulated program, when typing in the main controlling terminal window. However, by using the -x command line option, separate terminal windows will be launched for each serial I/O port being written to. (This also happens when you use configuration files with more than one machine specified.) CTRL-B and CTRL-C both have their original meaning in those xterm windows.


Which CPUs and machines does GXemul emulate?

This list contains some of the emulation modes in GXemul, and the guest operating systems that have been verified to work in those modes. Some operating systems or other pieces of software or firmware that are not really working yet are also included, listed with a small RED font.

There is code in GXemul for emulation of some other machine types too, but most of those are just dummy skeletons that do not really do anything, apart from being a starting point for testing and development.


Is GXemul Free software?

Yes. the GXemul source code is released under a Free license. The code in GXemul is Copyrighted software, it is not public domain. (If this is confusing to you, you might want to read up on the definitions of the four freedoms associated with Free software, http://www.gnu.org/philosophy/free-sw.html.)

The main part of the code is released under a 3-clause BSD-style license, or "revised BSD-style" if one wants to use GNU jargon. Apart from the main code, some files are copied from other sources such as NetBSD, for example header files containing symbolic names of bitfields in device registers. They are also covered by similar licenses, but with some additional clauses. The main point, however, is that the licenses require that the original Copyright and license terms are included when you distribute a copy, modified or not, even if it is in binary form.

If you plan to redistribute GXemul without supplying the source code, then you need to comply with each individual source file some other way, for example by writing additional documentation containing Copyright notes. This has not been done in the official GXemul distribution, since it is in source code form and already includes the Copyright messages. You need to check all individual files for details. The "easiest way out" if you plan to redistribute code from GXemul is, of course, to let it remain Free Software and simply include the source code.