From 74eaee0fcc7390d4290b41a2a92ee34346e2f7c2 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 11 Oct 2023 14:43:50 +0200 Subject: teachos: restructure file layout --- source/include/memory/asm_pointer.hpp | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 source/include/memory/asm_pointer.hpp (limited to 'source/include') diff --git a/source/include/memory/asm_pointer.hpp b/source/include/memory/asm_pointer.hpp new file mode 100644 index 0000000..ec7141e --- /dev/null +++ b/source/include/memory/asm_pointer.hpp @@ -0,0 +1,43 @@ +#ifndef TEACHOS_BOOT_ASM_POINTER_HPP +#define TEACHOS_BOOT_ASM_POINTER_HPP + +namespace teachos::boot +{ + + template + struct asm_pointer + { + constexpr asm_pointer(Type & pointer) + : m_pointer{&pointer} + { + } + + auto constexpr operator->() -> Type * { return m_pointer; } + auto constexpr operator->() const -> Type const * { return m_pointer; } + auto constexpr operator*() -> Type & { return *m_pointer; } + auto constexpr operator*() const -> Type const & { return *m_pointer; } + + private: + Type * m_pointer; + }; + + template + struct asm_pointer + { + constexpr asm_pointer(Type const & pointer) + : m_pointer{&pointer} + { + } + + auto constexpr operator->() -> Type const * { return m_pointer; } + auto constexpr operator->() const -> Type const * { return m_pointer; } + auto constexpr operator*() -> Type const & { return *m_pointer; } + auto constexpr operator*() const -> Type const & { return *m_pointer; } + + private: + Type const * m_pointer; + }; + +} // namespace teachos::boot + +#endif \ No newline at end of file -- cgit v1.2.3