Interface PcodeUseropLibrary<T>

Type Parameters:
T - the type of values accepted by the p-code userops.
All Known Subinterfaces:
EmuSyscallLibrary<T>
All Known Implementing Classes:
AbstractEmuLinuxSyscallUseropLibrary, AbstractEmuUnixSyscallUseropLibrary, AdaptedEmulator.AdaptedPcodeUseropLibrary, AnnotatedEmuSyscallUseropLibrary, AnnotatedPcodeUseropLibrary, ComposedPcodeUseropLibrary, DefaultPcodeThread.PcodeEmulationLibrary, EmuLinuxAmd64SyscallUseropLibrary, EmuLinuxX86SyscallUseropLibrary, PcodeExpression.ValueCapturingPcodeUseropLibrary, PcodeUseropLibrary.EmptyPcodeUseropLibrary

public interface PcodeUseropLibrary<T>
A "library" of p-code userops available to a p-code executor

The library can provide definitions of p-code userops already declared by the executor's language as well as completely new userops accessible to Sleigh/p-code later compiled for the executor. The recommended way to implement a library is to extend AnnotatedPcodeUseropLibrary.

  • Field Details

    • NIL

      static final PcodeUseropLibrary<?> NIL
      The empty userop library.

      Executors cannot accept null libraries. Instead, give it this empty library. To satisfy Java's type checker, you may use nil() instead.

  • Method Details

    • getOperandType

      static Type getOperandType(Class<?> cls)
      Get the type T for the given class

      If the class does not implement PcodeUseropLibrary, this returns null. If it does, but no arguments are given (i.e., it implements the raw type), this return Object.

      Parameters:
      cls - the class
      Returns:
      the type, or null
    • nil

      static <T> PcodeUseropLibrary<T> nil()
      The empty userop library, cast to match parameter types.
      Type Parameters:
      T - the type required by the executor
      Returns:
      the empty userop library
    • getUserops

      Get all the userops defined in this library, keyed by (symbol) name.
      Returns:
      the map of names to defined userops
    • compose

      default PcodeUseropLibrary<T> compose(PcodeUseropLibrary<T> lib)
      Compose this and the given library into a new library.
      Parameters:
      lib - the other library
      Returns:
      a new library having all userops defined between the two
    • getSymbols

      default Map<Integer,ghidra.pcodeCPort.slghsymbol.UserOpSymbol> getSymbols(SleighLanguage language)
      Get named symbols defined by this library that are not already declared in the language
      Parameters:
      language - the language whose existing symbols to consider
      Returns:
      a map of new userop indices to extra userop symbols