Class AnnotatedEmuSyscallUseropLibrary<T>
- Type Parameters:
T
- the type of data processed by the library, typicallybyte[]
- All Implemented Interfaces:
EmuSyscallLibrary<T>
,PcodeUseropLibrary<T>
- Direct Known Subclasses:
AbstractEmuUnixSyscallUseropLibrary
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
An annotation to export a method as a system call in the library.protected class
Nested classes/interfaces inherited from class ghidra.pcode.exec.AnnotatedPcodeUseropLibrary
AnnotatedPcodeUseropLibrary.AnnotatedPcodeUseropDefinition<T>, AnnotatedPcodeUseropLibrary.FixedArgsAnnotatedPcodeUseropDefinition<T>, AnnotatedPcodeUseropLibrary.OpExecutor, AnnotatedPcodeUseropLibrary.OpLibrary, AnnotatedPcodeUseropLibrary.OpOutput, AnnotatedPcodeUseropLibrary.OpState, AnnotatedPcodeUseropLibrary.PcodeUserop, AnnotatedPcodeUseropLibrary.VariadicAnnotatedPcodeUseropDefinition<T>
Nested classes/interfaces inherited from interface ghidra.pcode.emu.sys.EmuSyscallLibrary
EmuSyscallLibrary.EmuSyscallDefinition<T>, EmuSyscallLibrary.SyscallPcodeUseropDefinition<T>
Nested classes/interfaces inherited from interface ghidra.pcode.exec.PcodeUseropLibrary
PcodeUseropLibrary.EmptyPcodeUseropLibrary, PcodeUseropLibrary.PcodeUseropDefinition<T>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Collection
<DataTypeManager> protected final CompilerSpec
protected final DataType
protected final PcodeMachine
<T> protected final Program
static final String
protected final Map
<Long, EmuSyscallLibrary.EmuSyscallDefinition<T>> Fields inherited from class ghidra.pcode.exec.AnnotatedPcodeUseropLibrary
ops
Fields inherited from interface ghidra.pcode.emu.sys.EmuSyscallLibrary
SYSCALL_CONVENTION_NAME
Fields inherited from interface ghidra.pcode.exec.PcodeUseropLibrary
NIL
-
Constructor Summary
ConstructorDescriptionAnnotatedEmuSyscallUseropLibrary
(PcodeMachine<T> machine, Program program) Construct a new library including the "syscall" userop -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected Collection
<DataTypeManager> Get the map of syscalls by numberIn case this is not anAnnotatedEmuSyscallUseropLibrary
orAnnotatedPcodeUseropLibrary
, get the definition of the "syscall" userop for inclusion in thePcodeUseropLibrary
.protected void
protected void
mapAndBindSyscalls
(Class<?> cls) newBoundSyscall
(PcodeUseropLibrary.PcodeUseropDefinition<T> opdef, PrototypeModel convention) Export a userop as a system callprotected AnnotatedEmuSyscallUseropLibrary<T>.StructuredPart
Create the structured-sleigh part of this libraryMethods inherited from class ghidra.pcode.exec.AnnotatedPcodeUseropLibrary
getMethodLookup, getOperandType, getUserops
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.pcode.emu.sys.EmuSyscallLibrary
handleError, readSyscallNumber, syscall
Methods inherited from interface ghidra.pcode.exec.PcodeUseropLibrary
compose, getSymbols, getUserops
-
Field Details
-
SYSCALL_SPACE_NAME
- See Also:
-
CACHE_BY_CLASS
-
machine
-
cSpec
-
program
-
dtMachineWord
-
syscallMap
-
additionalArchives
-
-
Constructor Details
-
AnnotatedEmuSyscallUseropLibrary
Construct a new library including the "syscall" userop- Parameters:
machine
- the machine using this libraryprogram
- a program from which to derive syscall configuration, conventions, etc.
-
-
Method Details
-
getAdditionalArchives
-
disposeAdditionalArchives
protected void disposeAdditionalArchives() -
newStructuredPart
Create the structured-sleigh part of this library- Returns:
- the structured part
-
newBoundSyscall
public UseropEmuSyscallDefinition<T> newBoundSyscall(PcodeUseropLibrary.PcodeUseropDefinition<T> opdef, PrototypeModel convention) Export a userop as a system call- Parameters:
opdef
- the userop- Returns:
- the syscall definition
-
mapAndBindSyscalls
-
mapAndBindSyscalls
protected void mapAndBindSyscalls() -
getSyscallUserop
Description copied from interface:EmuSyscallLibrary
In case this is not anAnnotatedEmuSyscallUseropLibrary
orAnnotatedPcodeUseropLibrary
, get the definition of the "syscall" userop for inclusion in thePcodeUseropLibrary
.Implementors may wish to override this to use a pre-constructed definition. That definition can be easily constructed using
EmuSyscallLibrary.SyscallPcodeUseropDefinition
.- Specified by:
getSyscallUserop
in interfaceEmuSyscallLibrary<T>
- Returns:
- the syscall userop definition
-
getSyscalls
Description copied from interface:EmuSyscallLibrary
Get the map of syscalls by numberNote this method will be invoked for every emulated 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 interfaceEmuSyscallLibrary<T>
- Returns:
- the system call map
-