T-EMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Machine.h
Go to the documentation of this file.
1 //===------------------------------------------------------------*- C++ -*-===//
2 //
3 // T-EMU: The Terma Emulator
4 // (c) Terma 2015
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef TEMU_MACHINE_H
10 #define TEMU_MACHINE_H
11 
12 #include "temu-c/Support/Cpu.h"
13 #include "temu-c/Support/Events.h"
14 #include "temu-c/Support/Objsys.h"
15 #include "temu-c/Target/Cpu.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* Standard machine interface
22  */
23 typedef struct temu_MachineIface {
24  // Send reset to all processors in the machine
25  void (*reset)(void *Obj, int ResetType);
26  // Run the machine for the given time
27  temu_CpuExitReason (*run)(void *Obj, uint64_t NanoSecs);
28 
29  // Step the given process a number of steps.
30  temu_CpuExitReason (*step)(void *Obj, int CpuId, uint64_t Steps);
31  temu_CpuIfaceRef (*getCurrentCpu)(void *Obj);
32  temu_CpuIfaceRef (*getCpu)(void *Obj, unsigned Idx);
33  int64_t (*getTime)(void *Machine);
34 
35  // Return the current CPU number
36  unsigned (*getCurrentCpuId)(void *Obj);
37 
38  // Async stop must be async safe, it can be used to tell the
39  // emulator to stop in an async safe way, e.g. from a signal
40  // handler.
41  void (*asyncStop)(void *Obj);
42 
44 
45 TEMU_IFACE_REFERENCE_TYPE(temu_Machine);
46 
47 // All machines must implement this VTable interface. These are used
48 // to speedup certain operations on machine objects.
49 // Typically you would call:
50 // temu_setVTable(Cls, &MachineVT);
51 // temu_qualifyAsMachine(Cls);
52 // In your machine implementation.
53 typedef struct {
57 
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* ! TEMU_DEVICE_H */
unsigned(* getCurrentCpuId)(void *Obj)
Definition: Machine.h:36
temu_CpuExitReason
Definition: Cpu.h:35
temu_CpuExitReason(* step)(void *Obj, int CpuId, uint64_t Steps)
Definition: Machine.h:30
TEMU_IFACE_REFERENCE_TYPE(temu_Machine)
void(* asyncStop)(void *Obj)
Definition: Machine.h:41
temu_MachineIface * Machine
Definition: Machine.h:54
temu_CpuExitReason(* run)(void *Obj, uint64_t NanoSecs)
Definition: Machine.h:27
void(* reset)(void *Obj, int ResetType)
Definition: Machine.h:25
temu_CpuIfaceRef(* getCpu)(void *Obj, unsigned Idx)
Definition: Machine.h:32
int64_t(* getTime)(void *Machine)
Definition: Machine.h:33
struct temu_MachineIface temu_MachineIface
temu_CpuIfaceRef(* getCurrentCpu)(void *Obj)
Definition: Machine.h:31
temu_EventIface * Event
Definition: Machine.h:55