From d70ab1deda3fb40ae90e0a356890aed22efc6d2a Mon Sep 17 00:00:00 2001 From: "balhau@balhau.net" Date: Sun, 26 Dec 2021 13:07:01 +0000 Subject: [PATCH] Missing files --- src/cpu/clock.hpp | 18 ++++++++++++ src/cpu/x86/clock.hpp | 8 +++++ src/platform/types.hpp | 67 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 src/cpu/clock.hpp create mode 100644 src/cpu/x86/clock.hpp create mode 100644 src/platform/types.hpp diff --git a/src/cpu/clock.hpp b/src/cpu/clock.hpp new file mode 100644 index 0000000..8f6e562 --- /dev/null +++ b/src/cpu/clock.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include "../platform/types.hpp" + +namespace cpu +{ + /** + * @brief Clock interface. This class will be filled with pure virtual functions + * that should be implemented by cpu specific code + * + * + */ + class Clock + { + public: + virtual ULong getTimestamp() = 0; + }; +}; \ No newline at end of file diff --git a/src/cpu/x86/clock.hpp b/src/cpu/x86/clock.hpp new file mode 100644 index 0000000..c2fcec9 --- /dev/null +++ b/src/cpu/x86/clock.hpp @@ -0,0 +1,8 @@ +#pragma once + +#include "../clock.hpp" + +namespace cpu +{ + +} \ No newline at end of file diff --git a/src/platform/types.hpp b/src/platform/types.hpp new file mode 100644 index 0000000..4d8ca14 --- /dev/null +++ b/src/platform/types.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "../platform/platform.hpp" +/* + * Types for x86 architectures + */ +#ifdef ARCH_X86 + // Signed type alias + typedef int Int; + typedef long Long; + typedef char Char; + typedef short Short; + + typedef union + { + struct + { + Int value : 31; + Int signal : 1; + } int_with_msb; + Int signed_int; + } SignedInt; + + typedef union + { + struct + { + Long value : 63; + Int signal : 1; + } long_with_msb; + } SignedLong; + + // IEEE floating point alias + typedef float Float; + typedef double Double; + + // Unsigned type alias + typedef unsigned char UChar; + typedef unsigned short UShort; + typedef unsigned int UInt; + typedef unsigned long int ULong; + + // SSE DataTypes + #define CHAR_LEN_128 16 + #define CHAR_LEN_256 32 + + #define INT_LEN_64 2 + #define INT_LEN_128 4 + #define INT_LEN_256 8 + #define INT_LEN_512 16 + + #define LONG_LEN_64 1 + #define LONG_LEN_128 2 + #define LONG_LEN_256 4 + #define LONG_LEN_512 8 + + // Masks + #define MASK_32 0xFFFFFFFF + #define MASK_16 0xFFFF + #define MASK_8 0xFF + + // Shifts + #define SHIFT_32 32 + #define SHIFT_16 16 + #define SHIFT_8 8 +#endif +