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
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceAn annotation to export a method as a system call in the library.protected classNested 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
FieldsModifier and TypeFieldDescriptionprotected final Collection<DataTypeManager> protected final CompilerSpecprotected final DataTypeprotected final PcodeMachine<T> protected final Programstatic final Stringprotected final Map<Long, EmuSyscallLibrary.EmuSyscallDefinition<T>> Fields inherited from class ghidra.pcode.exec.AnnotatedPcodeUseropLibrary
opsFields inherited from interface ghidra.pcode.emu.sys.EmuSyscallLibrary
SYSCALL_CONVENTION_NAMEFields inherited from interface ghidra.pcode.exec.PcodeUseropLibrary
NIL -
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedEmuSyscallUseropLibrary(PcodeMachine<T> machine, Program program) Construct a new library including the "syscall" userop -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected Collection<DataTypeManager> Get the map of syscalls by numberIn case this is not anAnnotatedEmuSyscallUseropLibraryorAnnotatedPcodeUseropLibrary, get the definition of the "syscall" userop for inclusion in thePcodeUseropLibrary.protected voidprotected voidmapAndBindSyscalls(Class<?> cls) newBoundSyscall(PcodeUseropLibrary.PcodeUseropDefinition<T> opdef, PrototypeModel convention) Export a userop as a system callprotected AnnotatedEmuSyscallUseropLibrary<T>.StructuredPartCreate the structured-sleigh part of this libraryMethods inherited from class ghidra.pcode.exec.AnnotatedPcodeUseropLibrary
getMethodLookup, getOperandType, getUseropsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.pcode.emu.sys.EmuSyscallLibrary
handleError, readSyscallNumber, syscallMethods 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:EmuSyscallLibraryIn case this is not anAnnotatedEmuSyscallUseropLibraryorAnnotatedPcodeUseropLibrary, 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:
getSyscallUseropin interfaceEmuSyscallLibrary<T>- Returns:
- the syscall userop definition
-
getSyscalls
Description copied from interface:EmuSyscallLibraryGet 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:
getSyscallsin interfaceEmuSyscallLibrary<T>- Returns:
- the system call map
-