Package ghidra.pcode.emu.sys

# Class UseropEmuSyscallDefinition<T>

java.lang.Object
ghidra.pcode.emu.sys.UseropEmuSyscallDefinition<T>

Type Parameters:
  `T` - the type of values processed by the library

All Implemented Interfaces:
  `EmuSyscallLibrary.EmuSyscallDefinition<T>`

public class UseropEmuSyscallDefinition<T> extends Object implements EmuSyscallLibrary.EmuSyscallDefinition<T>
A system call that is defined by delegating to a p-code userop

This is essentially a wrapper of the p-code userop. Knowing the number of inputs to the userop and by applying the calling conventions of the platform, the wrapper aliases each parameter's storage to its respective parameter of the userop. The userop's output is also aliased to the system call's return storage, again as defined by the platform's conventions.

See Also:
  - `AnnotatedEmuSyscallUseropLibrary`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final List<Varnode>`
  `inVars`
  `protected final PcodeUseropLibrary.PcodeUseropDefinition<T>`
  `opdef`
  `protected final Varnode`
  `outVar`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UseropEmuSyscallDefinition(PcodeUseropLibrary.PcodeUseropDefinition<T> opdef, Program program, PrototypeModel convention, DataType dtMachineWord)`
  Construct a syscall definition

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Varnode`
  `getSingleVnStorage(VariableStorage vs)`
  Assert variable storage is a single varnode, and get that varnode
  `void`
  `invoke(PcodeExecutor<T> executor, PcodeUseropLibrary<T> library)`
  Invoke the system call
  `protected static DataType`
  `requirePointerDataType(Program program)`
  Obtain the program's "pointer" data type, throwing an exception if absent

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### opdef

    protected final PcodeUseropLibrary.PcodeUseropDefinition<T> opdef

  - ### inVars

    protected final List<Varnode> inVars

  - ### outVar

    protected final Varnode outVar

- ## Constructor Details

  - ### UseropEmuSyscallDefinition

    public UseropEmuSyscallDefinition(PcodeUseropLibrary.PcodeUseropDefinition<T> opdef, Program program, PrototypeModel convention, DataType dtMachineWord)
    Construct a syscall definition
    Parameters:
      `opdef` - the wrapped userop definition
      `program` - the program, used for storage computation
      `convention` - the "syscall" calling convention
      `dtMachineWord` - the "pointer" data type
    See Also:
      - `AnnotatedEmuSyscallUseropLibrary`

- ## Method Details

  - ### requirePointerDataType

    protected static DataType requirePointerDataType(Program program)
    Obtain the program's "pointer" data type, throwing an exception if absent
    Parameters:
      `program` - the program
    Returns:
      the "pointer" data type

  - ### getSingleVnStorage

    protected Varnode getSingleVnStorage(VariableStorage vs)
    Assert variable storage is a single varnode, and get that varnode
    Parameters:
      `vs` - the storage
    Returns:
      the single varnode

  - ### invoke

    public void invoke(PcodeExecutor<T> executor, PcodeUseropLibrary<T> library)
    Description copied from interface: `EmuSyscallLibrary.EmuSyscallDefinition`
    Invoke the system call
    Specified by:
      `invoke` in interface `EmuSyscallLibrary.EmuSyscallDefinition<T>`
    Parameters:
      `executor` - the executor for the system/thread invoking the call
      `library` - the complete sleigh userop library for the system