Class AnnotatedEmuSyscallUseropLibrary<T>

Type Parameters:
T - the type of data processed by the library, typically byte[]
All Implemented Interfaces:
EmuSyscallLibrary<T>, PcodeUseropLibrary<T>
Direct Known Subclasses:
AbstractEmuUnixSyscallUseropLibrary

public abstract class AnnotatedEmuSyscallUseropLibrary<T> extends AnnotatedPcodeUseropLibrary<T> implements EmuSyscallLibrary<T>
A syscall library wherein Java methods are exported via a special annotated

This library is both a system call and a sleigh userop library. To export a system call, it must also be exported as a sleigh userop. This is more conventional, as the system call dispatcher does not require it, however, this library uses a wrapping technique that does require it. In general, exporting system calls as userops will make developers and users lives easier. To avoid naming collisions, system calls can be exported with customized names.

  • Field Details

  • Constructor Details

    • AnnotatedEmuSyscallUseropLibrary

      public AnnotatedEmuSyscallUseropLibrary(PcodeMachine<T> machine, Program program)
      Construct a new library including the "emu_syscall" userop

      Note that the final library must export the system call entry point. Often, this is the "syscall" userop. That userop must read the system call number, pass it as an argument to "emu_syscall," and store the result according to the ABI of the target platform.

      Parameters:
      machine - the machine using this library
      program - a program from which to derive syscall configuration, conventions, etc.
  • Method Details

    • getAdditionalArchives

      protected Collection<DataTypeManager> getAdditionalArchives()
    • disposeAdditionalArchives

      protected void disposeAdditionalArchives()
    • newStructuredPart

      protected AnnotatedEmuSyscallUseropLibrary<T>.StructuredPart newStructuredPart()
      Create the structured-sleigh part of this library
      Returns:
      the structured part
    • newBoundSyscall

      protected UseropEmuSyscallDefinition<T> newBoundSyscall(long number, PcodeUseropLibrary.PcodeUseropDefinition<T> opdef, PrototypeModel convention)
      Export a userop as a system call
      Parameters:
      number - the syscall number
      opdef - the userop
      convention - the syscall calling convention for the emulated platform
      Returns:
      the syscall definition
    • mapAndBindSyscalls

      protected void mapAndBindSyscalls(Class<?> cls)
    • mapAndBindSyscalls

      protected void mapAndBindSyscalls()
    • getSyscalls

      Description copied from interface: EmuSyscallLibrary
      Get the map of syscalls by number

      Note this method will be invoked for every interpreted syscall, so it should be a simple accessor. Any computations needed to create the map should be done ahead of time.

      Specified by:
      getSyscalls in interface EmuSyscallLibrary<T>
      Returns:
      the system call map