TEMU  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, 2016
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/Target/Cpu.h"
14 #include <stdint.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /* Standard machine interface
21  */
22 typedef struct temu_MachineIface {
23  // Send reset to all processors in the machine
24  void (*reset)(void *Obj, int ResetType);
25  // Run the machine for the given time
26  temu_CpuExitReason (*run)(void *Obj, uint64_t NanoSecs);
27 
28  // Step the given process a number of steps.
29  temu_CpuExitReason (*step)(void *Obj, int CpuId, uint64_t Steps);
30  temu_CpuIfaceRef (*getCurrentCpu)(void *Obj);
31  temu_CpuIfaceRef (*getCpu)(void *Obj, unsigned Idx);
32  int64_t (*getTime)(void *Machine);
33 
34  // Return the current CPU number
35  unsigned (*getCurrentCpuId)(void *Obj);
36 
37  // Async stop must be async safe, it can be used to tell the
38  // emulator to stop in an async safe way, e.g. from a signal
39  // handler.
40  void (*asyncStop)(void *Obj);
41 
43 #define TEMU_MACHINE_IFACE_TYPE "MachineIface"
44 TEMU_IFACE_REFERENCE_TYPE(temu_Machine);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif /* ! TEMU_DEVICE_H */
unsigned(* getCurrentCpuId)(void *Obj)
Definition: Machine.h:35
temu_CpuExitReason
Definition: Cpu.h:30
temu_CpuExitReason(* step)(void *Obj, int CpuId, uint64_t Steps)
Definition: Machine.h:29
#define TEMU_IFACE_REFERENCE_TYPE(N)
Definition: Objsys.h:129
void(* asyncStop)(void *Obj)
Definition: Machine.h:40
temu_CpuExitReason(* run)(void *Obj, uint64_t NanoSecs)
Definition: Machine.h:26
void(* reset)(void *Obj, int ResetType)
Definition: Machine.h:24
temu_CpuIfaceRef(* getCpu)(void *Obj, unsigned Idx)
Definition: Machine.h:31
int64_t(* getTime)(void *Machine)
Definition: Machine.h:32
struct temu_MachineIface temu_MachineIface
temu_CpuIfaceRef(* getCurrentCpu)(void *Obj)
Definition: Machine.h:30