Skip to content
/ jarm Public
forked from SolraBizna/jarm

ARMv7a emulator written in Java, and an OpenComputers mod that uses it

License

Notifications You must be signed in to change notification settings

feherneoh/jarm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the source code for the JARM emulator, and several related packages. Project files are not included.

JARM Emulator

This is a Java-based ARMv7-A emulator. It currently supports most ARM instructions, including VFPv4 floating point. In the future, it will support exceptions, virtual memory, and every ARM and Thumb instruction.

To embed the emulator into your own project, you need only the classes in the src/name/bizna/jarm directory. I'm no Java expert, but you can probably link against the simulator JAR.

OC-ARM Architecture

This is an Architecture module for OpenComputers that uses JARM as its core. It is a sync-safe architecture.

To build the Minecraft mod, you require the following directories:

  • src/name/bizna/jarm
    The emulator core.
  • src/name/bizna/ocarm
    The OpenComputers architecture module, and the Minecraft mod that enables it.

Provide your own Forge source, etc. Should build against Minecraft 1.7 and 1.8, but is only tested against 1.7.

OC-ARM Simulator

This is a program that provides a simulation of a simple OC-ARM computer. It facilitates development and debugging of ROM modules and software for the OC-ARM Architecture.

To build the simulator, you require the following directories:

  • src/name/bizna/jarm
    The emulator core.
  • src/name/bizna/ocarmsim
    The simulator application, and the fake OC-ARM scaffold.
  • src/net/minecraft/nbt
    Stub of a bit of Minecraft API, to make the section of OpenComputers API we use work.

You must also build against the OpenComputers API.

JarmTool

This is a program that allows you to write simple command-line applications against an improbable ARMv7-A machine. It is intended to ease cross-compilation where platform-specific source files are generated by programs which are built with the same build system as the final program. (NetHack, for example.)

Usage: java -jar JarmTool.jar path/to/program.elf [arguments]

To build JarmTool, you require the following directories:

  • src/name/bizna/jarm
    The emulator core.
  • src/name/bizna/jarmtool
    JarmTool sources.

Memory Map

  • 0x00000000 through ...
    Where the program is loaded. The memory is as large as is necessary to load the program, up to 1GiB. (This means that you must explicitly include the heap in your .bss section.)
  • 0x40000000 through ...
    A "ROM" which contains the argc and argv values the program should use in its main() function.

IO (and other operations)

  • LDC p3, cr15, <...>
    Read a null-terminated string from the given address, print an error message, and exit with a non-zero exit status. This is deliberately compatible with OC-ARM, and is primarily intended for compact exception handlers.
  • MCR p7, #0, <rX>, cr15, cr15 Exit the program. rX contains the desired exit status; 0 = success, non-zero = failure
  • CDP p7, <call>, cr0, cr0, cr0, #0 Perform a UNIX(ish) system call. Set Z and place an errno code into r3 if the call failed, clear Z if the call succeeded. (Either way, place the proper return value into r0, exactly like a normal function call.) These instructions are deliberately designed to make it easy to write JarmTool tools with newlib. List of calls:
    • 0: fstat (fills in only a few fields with meaningful data)
    • 1: open
    • 2: read
    • 3: write
    • 4: close
    • 5: gettimeofday
    • 6: isatty (returns 1 for the default stdin/stdout/stderr, 0 for all file descriptors returned by open)
    • 7: lseek
    • 8: unlink

About

ARMv7a emulator written in Java, and an OpenComputers mod that uses it

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 86.1%
  • Python 7.1%
  • Assembly 5.0%
  • Lua 1.5%
  • Other 0.3%