IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
igros::platform::Platform Class Referencefinal

Platform desciption structure. More...

#include <platform/platform.hpp>

Public Member Functions

constexpr Platform () noexcept=default
 Default c-tor.
constexpr Platform (const char *const name, const init_t initFunc, const finalize_t finalizeFunc, const shutdown_t shutdownFunc, const reboot_t rebootFunc, const suspend_t suspendFunc, const wakeup_t wakeupFunc) noexcept
 C-tor.
auto name () const noexcept -> const char *
 Get platform name.
void initialize () const noexcept
 Initialize platform.
void finalize () const noexcept
 Finalize platform.
void shutdown () const noexcept
 Shutdown platform.
void reboot () const noexcept
 Reboot platform.
void suspend () const noexcept
 Suspend platform.
void wakeup () const noexcept
 Wakeup platform.

Static Public Member Functions

static constexpr auto kernelStart () noexcept -> const igros_byte_t *
 Get kernel start address.
static constexpr auto kernelEnd () noexcept -> const igros_byte_t *
 Get kernel end address.
static auto kernelSize () noexcept -> igros_usize_t
 Get kernel size.
static constexpr auto textStart () noexcept -> const igros_byte_t *
 Get kernel code start (code: [textStart, rodataStart)).
static constexpr auto rodataStart () noexcept -> const igros_byte_t *
 Get kernel read-only data start (read-only data: [rodataStart, dataStart)).
static constexpr auto dataStart () noexcept -> const igros_byte_t *
 Get kernel writable data start (data and bss: [dataStart, kernelEnd)).
static constexpr auto stackGuard () noexcept -> const igros_byte_t *
 Get boot stack guard page (one page right below boot stack, never mapped).
static auto kernelOffset () noexcept -> igros_usize_t
 Get kernel virtual memory offset (kernel virtual address = physical address + offset).
static constexpr auto isI386 () noexcept -> bool
 Check if i386.
static constexpr auto isX86_64 () noexcept -> bool
 Check if x86_64.
static constexpr auto isARM32 () noexcept -> bool
 Check if arm32.
static constexpr auto isARM64 () noexcept -> bool
 Check if arm64.
static constexpr auto isAVR () noexcept -> bool
 Check if avr.
static auto current () noexcept -> const Platform &
 Get kernel current platform (implemented in corresponding platform file).

Private Types

enum class  ARCH_NAME : igros_dword_t {
  UNKNOWN = 0x00000000_u32 , I386 = 0x00000001_u32 , X86_64 = 0x00000002_u32 , ARM = 0x00000004_u32 ,
  ARM64 = 0x00000008_u32 , AVR = 0x00000010_u32
}
 Platform name ID. More...
using init_t = std::add_pointer_t<void()>
 Platform init function pointer type.
using finalize_t = std::add_pointer_t<void()>
 Platform finalize function pointer type.
using shutdown_t = std::add_pointer_t<void()>
 Platform shutdown function pointer type.
using reboot_t = std::add_pointer_t<void()>
 Platform reboot function pointer type.
using suspend_t = std::add_pointer_t<void()>
 Platform suspend function pointer type.
using wakeup_t = std::add_pointer_t<void()>
 Platform wakeup function pointer type.

Private Attributes

const char *const mName {nullptr}
 Platform name.
init_t mInit {nullptr}
 Init function.
finalize_t mFinalize {nullptr}
 Finalize function.
shutdown_t mShutdown {nullptr}
 Shutdown function.
reboot_t mReboot {nullptr}
 Reboot function.
suspend_t mSuspend {nullptr}
 Suspend platform.
wakeup_t mWakeup {nullptr}
 Wakeup platform.

Static Private Attributes

static constexpr auto PLATFORM_NAME {ARCH_NAME::X86_64}
 x86_64 platform

Detailed Description

Platform desciption structure.

Definition at line 42 of file platform.hpp.

Member Typedef Documentation

◆ finalize_t

using igros::platform::Platform::finalize_t = std::add_pointer_t<void()>
private

Platform finalize function pointer type.

Definition at line 76 of file platform.hpp.

◆ init_t

using igros::platform::Platform::init_t = std::add_pointer_t<void()>
private

Platform init function pointer type.

Definition at line 74 of file platform.hpp.

◆ reboot_t

using igros::platform::Platform::reboot_t = std::add_pointer_t<void()>
private

Platform reboot function pointer type.

Definition at line 81 of file platform.hpp.

◆ shutdown_t

using igros::platform::Platform::shutdown_t = std::add_pointer_t<void()>
private

Platform shutdown function pointer type.

Definition at line 79 of file platform.hpp.

◆ suspend_t

using igros::platform::Platform::suspend_t = std::add_pointer_t<void()>
private

Platform suspend function pointer type.

Definition at line 84 of file platform.hpp.

◆ wakeup_t

using igros::platform::Platform::wakeup_t = std::add_pointer_t<void()>
private

Platform wakeup function pointer type.

Definition at line 86 of file platform.hpp.

Member Enumeration Documentation

◆ ARCH_NAME

Platform name ID.

Definition at line 45 of file platform.hpp.

Constructor & Destructor Documentation

◆ Platform()

igros::platform::Platform::Platform ( const char *const name,
const init_t initFunc,
const finalize_t finalizeFunc,
const shutdown_t shutdownFunc,
const reboot_t rebootFunc,
const suspend_t suspendFunc,
const wakeup_t wakeupFunc )
constexprnoexcept

C-tor.

Parameters
namePlatform name
initFuncInitialization function
finalizeFuncFinalization function
shutdownFuncShutdown function
rebootFuncReboot function
suspendFuncSuspend function
wakeupFuncWakeup function

Definition at line 200 of file platform.hpp.

Member Function Documentation

◆ current()

auto igros::platform::Platform::current ( ) ->constPlatform &
staticnodiscardnoexcept

Get kernel current platform (implemented in corresponding platform file).

Returns
Platform the kernel runs on

Definition at line 145 of file platform-x86.cpp.

◆ dataStart()

auto igros::platform::Platform::dataStart ( ) ->constigros_byte_t *
staticnodiscardconstexprnoexcept

Get kernel writable data start (data and bss: [dataStart, kernelEnd)).

Get kernel writable data start.

Returns
Kernel writable data start address

Definition at line 332 of file platform.hpp.

◆ finalize()

void igros::platform::Platform::finalize ( ) const
inlinenoexcept

Finalize platform.

Definition at line 238 of file platform.hpp.

◆ initialize()

void igros::platform::Platform::initialize ( ) const
inlinenoexcept

Initialize platform.

Definition at line 227 of file platform.hpp.

◆ isARM32()

auto igros::platform::Platform::isARM32 ( ) ->bool
staticnodiscardconstexprnoexcept

Check if arm32.

Returns
true if kernel is built for ARM32

Definition at line 368 of file platform.hpp.

◆ isARM64()

auto igros::platform::Platform::isARM64 ( ) ->bool
staticnodiscardconstexprnoexcept

Check if arm64.

Returns
true if kernel is built for ARM64

Definition at line 375 of file platform.hpp.

◆ isAVR()

auto igros::platform::Platform::isAVR ( ) ->bool
staticnodiscardconstexprnoexcept

Check if avr.

Returns
true if kernel is built for AVR

Definition at line 382 of file platform.hpp.

◆ isI386()

auto igros::platform::Platform::isI386 ( ) ->bool
staticnodiscardconstexprnoexcept

Check if i386.

Returns
true if kernel is built for i386

Definition at line 354 of file platform.hpp.

◆ isX86_64()

auto igros::platform::Platform::isX86_64 ( ) ->bool
staticnodiscardconstexprnoexcept

Check if x86_64.

Returns
true if kernel is built for x86_64

Definition at line 361 of file platform.hpp.

◆ kernelEnd()

auto igros::platform::Platform::kernelEnd ( ) ->constigros_byte_t *
staticnodiscardconstexprnoexcept

Get kernel end address.

Returns
Kernel end address

Definition at line 302 of file platform.hpp.

◆ kernelOffset()

auto igros::platform::Platform::kernelOffset ( ) ->igros_usize_t
inlinestaticnodiscardnoexcept

Get kernel virtual memory offset (kernel virtual address = physical address + offset).

Get kernel virtual memory offset.

Returns
Kernel virtual memory offset

Definition at line 346 of file platform.hpp.

◆ kernelSize()

auto igros::platform::Platform::kernelSize ( ) ->igros_usize_t
inlinestaticnodiscardnoexcept

Get kernel size.

Returns
Kernel size in bytes

Definition at line 309 of file platform.hpp.

◆ kernelStart()

auto igros::platform::Platform::kernelStart ( ) ->constigros_byte_t *
staticnodiscardconstexprnoexcept

Get kernel start address.

Returns
Kernel start address

Definition at line 295 of file platform.hpp.

◆ name()

auto igros::platform::Platform::name ( ) const->constchar *
inlinenodiscardnoexcept

Get platform name.

Returns
Platform name

Definition at line 220 of file platform.hpp.

◆ reboot()

void igros::platform::Platform::reboot ( ) const
inlinenoexcept

Reboot platform.

Definition at line 260 of file platform.hpp.

◆ rodataStart()

auto igros::platform::Platform::rodataStart ( ) ->constigros_byte_t *
staticnodiscardconstexprnoexcept

Get kernel read-only data start (read-only data: [rodataStart, dataStart)).

Get kernel read-only data start.

Returns
Kernel read-only data start address

Definition at line 325 of file platform.hpp.

◆ shutdown()

void igros::platform::Platform::shutdown ( ) const
inlinenoexcept

Shutdown platform.

Definition at line 249 of file platform.hpp.

◆ stackGuard()

auto igros::platform::Platform::stackGuard ( ) ->constigros_byte_t *
staticnodiscardconstexprnoexcept

Get boot stack guard page (one page right below boot stack, never mapped).

Get boot stack guard page.

Returns
Boot stack guard page address

Definition at line 339 of file platform.hpp.

◆ suspend()

void igros::platform::Platform::suspend ( ) const
inlinenoexcept

Suspend platform.

Definition at line 271 of file platform.hpp.

◆ textStart()

auto igros::platform::Platform::textStart ( ) ->constigros_byte_t *
staticnodiscardconstexprnoexcept

Get kernel code start (code: [textStart, rodataStart)).

Get kernel code start.

Returns
Kernel code start address

Definition at line 318 of file platform.hpp.

◆ wakeup()

void igros::platform::Platform::wakeup ( ) const
inlinenoexcept

Wakeup platform.

Definition at line 282 of file platform.hpp.

Member Data Documentation

◆ mFinalize

finalize_t igros::platform::Platform::mFinalize {nullptr}
private

Finalize function.

Definition at line 92 of file platform.hpp.

◆ mInit

init_t igros::platform::Platform::mInit {nullptr}
private

Init function.

Definition at line 91 of file platform.hpp.

◆ mName

const char* const igros::platform::Platform::mName {nullptr}
private

Platform name.

Definition at line 89 of file platform.hpp.

◆ mReboot

reboot_t igros::platform::Platform::mReboot {nullptr}
private

Reboot function.

Definition at line 95 of file platform.hpp.

◆ mShutdown

shutdown_t igros::platform::Platform::mShutdown {nullptr}
private

Shutdown function.

Definition at line 94 of file platform.hpp.

◆ mSuspend

suspend_t igros::platform::Platform::mSuspend {nullptr}
private

Suspend platform.

Definition at line 97 of file platform.hpp.

◆ mWakeup

wakeup_t igros::platform::Platform::mWakeup {nullptr}
private

Wakeup platform.

Definition at line 98 of file platform.hpp.

◆ PLATFORM_NAME

auto igros::platform::Platform::PLATFORM_NAME {ARCH_NAME::X86_64}
staticconstexprprivate

x86_64 platform

Definition at line 63 of file platform.hpp.


The documentation for this class was generated from the following files: