TEMU  3.0
The Terma Emulator
CodePatterns.h
Go to the documentation of this file.
1 //===-------------------------------------------------------*- TableGen -*-===//
2 //
3 // TEMU: The Terma Emulator
4 // (c) Terma 2022
5 // Authors: Mattias Holm <maho(at)terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef TEMU_CODE_PATTERNS_H
10 #define TEMU_CODE_PATTERNS_H
11 #include "temu-c/Support/Objsys.h"
12 #include <stdint.h>
13 
14 // NOTICE: EXPERIMENTAL API
15 // This API is in early form and is seen as experimental.
16 // You are recommended to not use it at this point in time.
17 // The API is used internally, however, in practice only IDLE detection
18 // is working at this point in time.
19 
20 typedef enum {
27 
28 typedef struct {
29  uint32_t Instruction;
30  uint32_t Mask;
32 
72 typedef struct {
73  uint64_t PhysicalAddress;
75  temu_PatternAction Action;
77 
80  void (*Callback)(void *, void *);
81  void *CallbackData;
82  int SkipLength;
83  unsigned PatternLength;
84  const temu_CodePatternEntry *Pattern; // Pattern to match
86 
87 typedef struct {
88  void (*installPattern)(void *obj, temu_CodePattern *pattern);
90 #define TEMU_CODE_PATTERN_IFACE_TYPE "temu::CodePatternIface"
92 
93 #endif // !TEMU_CODE_PATTERNS_H
unsigned PatternLength
Number of pattern entries.
Definition: CodePatterns.h:83
uint32_t Instruction
Instruction value.
Definition: CodePatterns.h:29
Invalid action, do not use! Internal API use only.
Definition: CodePatterns.h:25
Call function and skip the matched instructions (currently not supported)
Definition: CodePatterns.h:24
Definition: CodePatterns.h:72
Definition: CodePatterns.h:87
void * CallbackData
Data passed in second parameter to callback (currently ignored)
Definition: CodePatterns.h:81
int SkipLength
Number of instructions to skip (in case of tePA_Skip and tePA_CallAndSkip)
Definition: CodePatterns.h:82
Definition: CodePatterns.h:28
Enter idle when running pattern.
Definition: CodePatterns.h:21
TEMU_IFACE_REFERENCE_TYPE(temu_CodePattern)
const temu_CodePatternEntry * Pattern
Definition: CodePatterns.h:84
Skip over code pattern (currently not supported)
Definition: CodePatterns.h:22
uint64_t PhysicalAddress
Physical address matched in the decoder (currently ignored)
Definition: CodePatterns.h:73
temu_PatternAction
Definition: CodePatterns.h:20
Call function but run code after function returns (currently not supported)
Definition: CodePatterns.h:23
uint64_t PhysicalAddressMask
Definition: CodePatterns.h:74
uint32_t Mask
Instruction mask (use to ignore register numbers etc)
Definition: CodePatterns.h:30