diff --git a/core/AspectConfig.hpp b/core/AspectConfig.hpp deleted file mode 100644 index d7bb5e9e..00000000 --- a/core/AspectConfig.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __ASPECT_CONFIG_HPP__ - #define __ASPECT_CONFIG_HPP__ - -// The following configuration macros to disable (0) / enable (1) the various -// event sources, fault injection sinks, and miscellaneous other features. - -// Event sources -#define CONFIG_EVENT_CPULOOP 0 -#define CONFIG_EVENT_MEMREAD 0 -#define CONFIG_EVENT_MEMWRITE 0 -#define CONFIG_EVENT_GUESTSYS 0 -#define CONFIG_EVENT_INTERRUPT 0 -#define CONFIG_EVENT_TRAP 0 -#define CONFIG_EVENT_JUMP 0 - -// Save/restore functionality -#define CONFIG_SR_RESTORE 0 -#define CONFIG_SR_SAVE 0 -#define CONFIG_SR_REBOOT 0 - -// Miscellaneous -#define CONFIG_STFU 0 -#define CONFIG_SUPPRESS_INTERRUPTS 0 -#define CONFIG_DISABLE_KEYB_INTERRUPTS 0 - -// Fault injection -#define CONFIG_FI_MEM_ACCESS_BITFLIP 0 - - -#endif /* __ASPECT_CONFIG_HPP__ */ diff --git a/core/SAL/bochs/CPULoop.ah b/core/SAL/bochs/CPULoop.ah index ec3c3c63..da4ce209 100644 --- a/core/SAL/bochs/CPULoop.ah +++ b/core/SAL/bochs/CPULoop.ah @@ -1,9 +1,9 @@ #ifndef __CPU_LOOP_AH__ #define __CPU_LOOP_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_EVENT_CPULOOP == 1 +#ifdef CONFIG_EVENT_CPULOOP #include "../../../bochs/bochs.h" // for "BX_CPU_C" #include "../../../bochs/cpu/cpu.h" // for "bxInstruction_c" diff --git a/core/SAL/bochs/GuestSysCom.ah b/core/SAL/bochs/GuestSysCom.ah index f6a2efd9..4a9db0f1 100644 --- a/core/SAL/bochs/GuestSysCom.ah +++ b/core/SAL/bochs/GuestSysCom.ah @@ -1,9 +1,9 @@ #ifndef __GUESTSYS_COM_AH__ #define __GUESTSYS_COM_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_EVENT_GUESTSYS == 1 +#ifdef CONFIG_EVENT_GUESTSYS #include "../../../bochs/bochs.h" #include "../../../bochs/cpu/cpu.h" diff --git a/core/SAL/bochs/Interrupt.ah b/core/SAL/bochs/Interrupt.ah index 7c0f08de..578c3d21 100644 --- a/core/SAL/bochs/Interrupt.ah +++ b/core/SAL/bochs/Interrupt.ah @@ -1,9 +1,9 @@ #ifndef __INTERRUPT_AH__ #define __INTERRUPT_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_EVENT_INTERRUPT == 1 +#ifdef CONFIG_EVENT_INTERRUPT #include "../../../bochs/bochs.h" #include "../../../bochs/cpu/cpu.h" diff --git a/core/SAL/bochs/Interrupt_suppression.ah b/core/SAL/bochs/Interrupt_suppression.ah index 2912a343..0b293c17 100644 --- a/core/SAL/bochs/Interrupt_suppression.ah +++ b/core/SAL/bochs/Interrupt_suppression.ah @@ -1,9 +1,9 @@ #ifndef __INTERRUPT_SUPPRESSION_AH__ #define __INTERRUPT_SUPPRESSION_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_SUPPRESS_INTERRUPTS == 1 +#ifdef CONFIG_SUPPRESS_INTERRUPTS #include "../../../bochs/bochs.h" #include "../../../bochs/cpu/cpu.h" diff --git a/core/SAL/bochs/Jump.ah b/core/SAL/bochs/Jump.ah index 8c40074a..a9703d6c 100644 --- a/core/SAL/bochs/Jump.ah +++ b/core/SAL/bochs/Jump.ah @@ -1,9 +1,9 @@ #ifndef __JUMP_AH__ #define __JUMP_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_EVENT_JUMP == 1 +#ifdef CONFIG_EVENT_JUMP #include #include diff --git a/core/SAL/bochs/JumpToPreviousCtx.ah b/core/SAL/bochs/JumpToPreviousCtx.ah index 5029c602..ac985c88 100644 --- a/core/SAL/bochs/JumpToPreviousCtx.ah +++ b/core/SAL/bochs/JumpToPreviousCtx.ah @@ -1,10 +1,10 @@ #ifndef __JUMP_TO_PREVIOUS_CTX_AH__ #define __JUMP_TO_PREVIOUS_CTX_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" #if 0 -// #if CONFIG_SR_RESTORE == 1 || CONFIG_SR_REBOOT == 1 +// #if defined(CONFIG_SR_RESTORE) || defined(CONFIG_SR_REBOOT) #include "bochs.h" #include "../SALInst.hpp" @@ -28,6 +28,6 @@ aspect jumpToPreviousCtx } }; -#endif // CONFIG_SR_RESTORE == 1 || CONFIG_SR_REBOOT +#endif // CONFIG_SR_RESTORE || CONFIG_SR_REBOOT #endif // __JUMP_TO_PREVIOUS_CTX_AH__ diff --git a/core/SAL/bochs/MemAccessBitFlip.ah b/core/SAL/bochs/MemAccessBitFlip.ah index a6841b5d..9bdbb7b8 100644 --- a/core/SAL/bochs/MemAccessBitFlip.ah +++ b/core/SAL/bochs/MemAccessBitFlip.ah @@ -1,9 +1,9 @@ #ifndef __MEM_ACCESS_BIT_FLIP_AH__ #define __MEM_ACCESS_BIT_FLIP_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_FI_MEM_ACCESS_BITFLIP == 1 +#ifdef CONFIG_FI_MEM_ACCESS_BITFLIP #include #include diff --git a/core/SAL/bochs/MemEvents.ah b/core/SAL/bochs/MemEvents.ah index 99992071..96983e56 100644 --- a/core/SAL/bochs/MemEvents.ah +++ b/core/SAL/bochs/MemEvents.ah @@ -2,9 +2,9 @@ #define __MEM_EVENTS_AH__ #include -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_EVENT_MEMREAD == 1 || CONFIG_EVENT_MEMWRITE == 1 +#if defined(CONFIG_EVENT_MEMREAD) || defined(CONFIG_EVENT_MEMWRITE) #include "../../../bochs/bochs.h" #include "../../../bochs/cpu/cpu.h" @@ -57,7 +57,7 @@ aspect MemEvents // // Event source: "memory write access" // -#if CONFIG_EVENT_MEMWRITE == 1 +#ifdef CONFIG_EVENT_MEMWRITE advice execution (write_methods()) : after () { sal::simulator.onMemoryAccessEvent( *(tjp->arg<1>()), sizeof(*(tjp->arg<2>())), true, @@ -103,7 +103,7 @@ aspect MemEvents // // Event source: "memory read access" // -#if CONFIG_EVENT_MEMREAD == 1 +#ifdef CONFIG_EVENT_MEMREAD advice execution (read_methods()) : before () { sal::simulator.onMemoryAccessEvent( *(tjp->arg<1>()), sizeof(*(tjp->result())), false, @@ -119,14 +119,14 @@ aspect MemEvents advice execution (read_methods_RMW()) : before () { rmw_address = *(tjp->arg<1>()); -#if CONFIG_EVENT_MEMREAD == 1 +#ifdef CONFIG_EVENT_MEMREAD sal::simulator.onMemoryAccessEvent( *(tjp->arg<1>()), sizeof(*(tjp->result())), false, getCPU(tjp->that())->prev_rip); #endif } -#if CONFIG_EVENT_MEMREAD == 1 +#ifdef CONFIG_EVENT_MEMREAD advice execution (read_methods_system()) : before () { // We don't do anything here for now: This type of memory // access is used when the hardware itself needs to access diff --git a/core/SAL/bochs/Trap.ah b/core/SAL/bochs/Trap.ah index ad2cda39..ff020d7d 100644 --- a/core/SAL/bochs/Trap.ah +++ b/core/SAL/bochs/Trap.ah @@ -1,9 +1,9 @@ #ifndef __TRAP_AH__ #define __TRAP_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_EVENT_TRAP == 1 +#ifdef CONFIG_EVENT_TRAP #include "../../../bochs/bochs.h" #include "../../../bochs/cpu/cpu.h" diff --git a/core/SAL/bochs/disable_keyboard_interrupt.ah b/core/SAL/bochs/disable_keyboard_interrupt.ah index 3640de07..ececcda9 100644 --- a/core/SAL/bochs/disable_keyboard_interrupt.ah +++ b/core/SAL/bochs/disable_keyboard_interrupt.ah @@ -1,9 +1,9 @@ #ifndef __DISABLE_KEYBOARD_INTERRUPT_AH__ #define __DISABLE_KEYBOARD_INTERRUPT_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_DISABLE_KEYB_INTERRUPTS +#ifdef CONFIG_DISABLE_KEYB_INTERRUPTS #include "../../../bochs/iodev/keyboard.h" diff --git a/core/SAL/bochs/reboot.ah b/core/SAL/bochs/reboot.ah index ade78023..f7e96bff 100644 --- a/core/SAL/bochs/reboot.ah +++ b/core/SAL/bochs/reboot.ah @@ -1,10 +1,10 @@ #ifndef __REBOOT_AH__ #define __REBOOT_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" #include "../SALInst.hpp" -#if CONFIG_SR_REBOOT == 1 +#ifdef CONFIG_SR_REBOOT #include "bochs.h" diff --git a/core/SAL/bochs/restore.ah b/core/SAL/bochs/restore.ah index 5120bdbb..b43f0853 100644 --- a/core/SAL/bochs/restore.ah +++ b/core/SAL/bochs/restore.ah @@ -2,10 +2,10 @@ #define __RESTORE_AH__ #include -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" #include "../SALInst.hpp" -#if CONFIG_SR_RESTORE == 1 +#ifdef CONFIG_SR_RESTORE #include "bochs.h" diff --git a/core/SAL/bochs/save.ah b/core/SAL/bochs/save.ah index 11f3130a..fdf2eba2 100644 --- a/core/SAL/bochs/save.ah +++ b/core/SAL/bochs/save.ah @@ -1,9 +1,9 @@ #ifndef __SAVE_AH__ #define __SAVE_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_SR_SAVE == 1 +#ifdef CONFIG_SR_SAVE #include "bochs.h" #include "../SALInst.hpp" diff --git a/core/SAL/bochs/stfu.ah b/core/SAL/bochs/stfu.ah index 222c9102..9d8acba6 100644 --- a/core/SAL/bochs/stfu.ah +++ b/core/SAL/bochs/stfu.ah @@ -1,9 +1,9 @@ #ifndef __NONVERBOSE_AH__ #define __NONVERBOSE_AH__ -#include "../../AspectConfig.hpp" +#include "config/AspectConfig.hpp" -#if CONFIG_STFU == 1 +#ifdef CONFIG_STFU #include "bochs.h" diff --git a/core/config/AspectConfig.hpp.in b/core/config/AspectConfig.hpp.in new file mode 100644 index 00000000..6df9d0a8 --- /dev/null +++ b/core/config/AspectConfig.hpp.in @@ -0,0 +1,30 @@ +#ifndef __ASPECT_CONFIG_HPP__ + #define __ASPECT_CONFIG_HPP__ + +// #define / #undef the following configuration macros to enable/disable the +// various event sources, fault injection sinks, and miscellaneous other +// features. + +// Event sources +#cmakedefine CONFIG_EVENT_CPULOOP +#cmakedefine CONFIG_EVENT_MEMREAD +#cmakedefine CONFIG_EVENT_MEMWRITE +#cmakedefine CONFIG_EVENT_GUESTSYS +#cmakedefine CONFIG_EVENT_INTERRUPT +#cmakedefine CONFIG_EVENT_TRAP +#cmakedefine CONFIG_EVENT_JUMP + +// Save/restore functionality +#cmakedefine CONFIG_SR_RESTORE +#cmakedefine CONFIG_SR_SAVE +#cmakedefine CONFIG_SR_REBOOT + +// Miscellaneous +#cmakedefine CONFIG_STFU +#cmakedefine CONFIG_SUPPRESS_INTERRUPTS +#cmakedefine CONFIG_DISABLE_KEYB_INTERRUPTS + +// Fault injection +#cmakedefine CONFIG_FI_MEM_ACCESS_BITFLIP + +#endif /* __ASPECT_CONFIG_HPP__ */ diff --git a/core/config/CMakeLists.txt b/core/config/CMakeLists.txt index 5042b376..2106bb16 100644 --- a/core/config/CMakeLists.txt +++ b/core/config/CMakeLists.txt @@ -1,3 +1,21 @@ #### Configuration file emitting BUILD_OVP/BOCHS defines #### configure_file(${CMAKE_CURRENT_SOURCE_DIR}/variant_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/variant_config.h) + +OPTION(CONFIG_EVENT_CPULOOP "Event source: Breakpoints" OFF) +OPTION(CONFIG_EVENT_MEMREAD "Event source: Memory reads" OFF) +OPTION(CONFIG_EVENT_MEMWRITE "Event source: Memory writes" OFF) +OPTION(CONFIG_EVENT_GUESTSYS "Event source: Outbound guest-system communication" OFF) +OPTION(CONFIG_EVENT_INTERRUPT "Event source: Interrupts" OFF) +OPTION(CONFIG_EVENT_TRAP "Event source: Traps" OFF) +OPTION(CONFIG_EVENT_JUMP "Event source: Branch instructions" OFF) +OPTION(CONFIG_SR_RESTORE "Target backend: State restore" OFF) +OPTION(CONFIG_SR_SAVE "Target backend: State saving" OFF) +OPTION(CONFIG_SR_REBOOT "Target backend: Reboot" OFF) +OPTION(CONFIG_STFU "Misc: Reduced verbosity" OFF) +OPTION(CONFIG_SUPPRESS_INTERRUPTS "Target backend: Suppress interrupts" OFF) +OPTION(CONFIG_DISABLE_KEYB_INTERRUPTS "Target backend: Suppress keyboard interrupts" OFF) +OPTION(CONFIG_FI_MEM_ACCESS_BITFLIP "deprecated something" OFF) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/AspectConfig.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/AspectConfig.hpp) diff --git a/core/experiments/FaultCoverageExperiment/experiment.hpp b/core/experiments/FaultCoverageExperiment/experiment.hpp index 2d1c5e85..38d4dac9 100644 --- a/core/experiments/FaultCoverageExperiment/experiment.hpp +++ b/core/experiments/FaultCoverageExperiment/experiment.hpp @@ -4,7 +4,7 @@ #include #include -#include "AspectConfig.hpp" +#include "config/AspectConfig.hpp" #include "controller/ExperimentFlow.hpp" #define INST_ADDR_FUNC_START 0x4ae6 @@ -12,8 +12,8 @@ /* // Check if aspect dependencies are satisfied: -#if CONFIG_EVENT_CPULOOP != 1 || CONFIG_EVENT_TRAP != 1 || \ - CONFIG_SR_RESTORE != 1 || CONFIG_SR_SAVE != 1 +#if !defined(CONFIG_EVENT_CPULOOP) || !defined(CONFIG_EVENT_TRAP) || \ + !defined(CONFIG_SR_RESTORE) || !defined(CONFIG_SR_SAVE) #error At least one of the following aspect-dependencies are not satisfied: \ cpu loop, traps, save/restore. Enable aspects first (see AspectConfig.hpp)! #endif diff --git a/core/experiments/attic/JumpAndRunExperiment/JumpAndRunExperiment.hpp b/core/experiments/attic/JumpAndRunExperiment/JumpAndRunExperiment.hpp index ca1bc1bd..15f95297 100644 --- a/core/experiments/attic/JumpAndRunExperiment/JumpAndRunExperiment.hpp +++ b/core/experiments/attic/JumpAndRunExperiment/JumpAndRunExperiment.hpp @@ -9,10 +9,10 @@ #include "../controller/ExperimentFlow.hpp" #include "../SAL/SALInst.hpp" #include "../SAL/bochs/BochsRegister.hpp" -#include "../AspectConfig.hpp" +#include "config/AspectConfig.hpp" // Check if aspect dependencies are satisfied: -#if CONFIG_EVENT_CPULOOP != 1 || CONFIG_EVENT_JUMP != 1 +#if !defined(CONFIG_EVENT_CPULOOP) || !defined(CONFIG_EVENT_JUMP) #error Breakpoint- and jump-events needed! Enable aspects first (see AspectConfig.hpp)! #endif diff --git a/core/experiments/attic/MemWriteExperiment.hpp b/core/experiments/attic/MemWriteExperiment.hpp index 08d84de6..6d1d145d 100644 --- a/core/experiments/attic/MemWriteExperiment.hpp +++ b/core/experiments/attic/MemWriteExperiment.hpp @@ -8,10 +8,10 @@ #include "../controller/ExperimentFlow.hpp" #include "../SAL/SALInst.hpp" -#include "../AspectConfig.hpp" +#include "config/AspectConfig.hpp" // Check aspect dependencies: -#if CONFIG_EVENT_CPULOOP != 1 || CONFIG_EVENT_MEMACCESS != 1 || CONFIG_SR_SAVE != 1 || CONFIG_FI_MEM_ACCESS_BITFLIP != 1 +#if !defined(CONFIG_EVENT_CPULOOP) || !defined(CONFIG_EVENT_MEMACCESS) || !defined(CONFIG_SR_SAVE) || !defined(CONFIG_FI_MEM_ACCESS_BITFLIP) #error Event dependecies not satisfied! Enabled needed aspects in AspectConfig.hpp! #endif diff --git a/core/experiments/attic/SingleSteppingExperiment.hpp b/core/experiments/attic/SingleSteppingExperiment.hpp index a6a0a54b..885ac388 100644 --- a/core/experiments/attic/SingleSteppingExperiment.hpp +++ b/core/experiments/attic/SingleSteppingExperiment.hpp @@ -8,11 +8,11 @@ #include "../controller/ExperimentFlow.hpp" #include "../SAL/SALInst.hpp" -#include "../AspectConfig.hpp" +#include "config/AspectConfig.hpp" #include "../SAL/bochs/BochsRegister.hpp" // Check if aspect dependency is satisfied: -#if CONFIG_EVENT_CPULOOP != 1 +#ifndef CONFIG_EVENT_CPULOOP #error Breakpoint-events needed! Enable aspect first (see AspectConfig.hpp)! #endif diff --git a/doc/todo.txt b/doc/todo.txt index eb1844dc..37de5e4b 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -97,14 +97,7 @@ Buildsystem: brauchbaren Konfigurationswerkzeug mit Ausdrucksmöglichkeiten für Merkmalmodelle, Abhängigkeiten, Mehrfachauswahl etc. (kconfig?) * Bochs / OVP sind Alternativen, nicht beide anschaltbar (?) - - EXP*-options nur einmal in config/, nicht in drei verschiedenen Dateien - (config/CMakelists.txt, config/experiments.hpp.in, - experiments/CMakeLists.txt) - * Hinzufügen eines neuen Experiments konkreter dokumentieren (howto-build.txt?) - - AspectConfig.hpp in cmake-config einbinden (genauso behandeln wie experiments.hpp!) - -> generierte Datei landet in Buildtree, wird nicht mehr eingecheckt - - variant_config.h in cmake-config einbinden (genauso behandeln wie experiments.hpp!) - -> generierte Datei landet in Buildtree, wird nicht mehr eingecheckt + - Hinzufügen eines neuen Experiments konkreter dokumentieren (howto-build.txt?) Dokumentation: - Änderungen im Klassendiagramm nachziehen (hsc) @@ -156,6 +149,13 @@ Dokumentation: -> siehe fail/experiments/coolchecksum/experiment.cc FIXME am Ende -> Lösung: Löschliste - ggf. zusammen mit Datenstruktur-Implementierungsdetails-TODO (s.u.) angehen + - AspectConfig.hpp in cmake-config einbinden (genauso behandeln wie experiments.hpp!) + -> generierte Datei landet in Buildtree, wird nicht mehr eingecheckt + - variant_config.h in cmake-config einbinden (genauso behandeln wie experiments.hpp!) + -> generierte Datei landet in Buildtree, wird nicht mehr eingecheckt + - EXP*-options nur einmal in config/, nicht in drei verschiedenen Dateien + (config/CMakelists.txt, config/experiments.hpp.in, + experiments/CMakeLists.txt) ================================== Theorie TODO