Max OS 0.3
Loading...
Searching...
No Matches
cplusplus.h File Reference

Defines C++ runtime functions and structures needed for linking C++ code in the kernel. More...

#include <cstdint>

Go to the source code of this file.

Classes

struct  MaxOS::runtime::atexit_func_entry_t
 An entry in the list of functions to call at program exit (not used in kernel but needed for linking) More...
 

Typedefs

typedef void(* MaxOS::runtime::constructor) ()
 A pointer to a constructor function.
 
typedef unsigned MaxOS::runtime::uarch_t
 An unsigned architecture specific type.
 

Functions

int MaxOS::runtime::__cxa_atexit (void(*f)(void *), void *objptr, void *dso)
 Register a function to be called at program exit.
 
void MaxOS::runtime::__cxa_finalize (void *f)
 Finalise all global objects by calling their destructors.
 
void MaxOS::runtime::__stack_chk_fail (void)
 Called when a stack buffer overflow is detected.
 

Variables

uintptr_t MaxOS::runtime::__stack_chk_guard = 0x595e9fbd94fda766
 The stack canary value used to detect stack buffer overflows (.
 

Detailed Description

Defines C++ runtime functions and structures needed for linking C++ code in the kernel.

See also
https://wiki.osdev.org/C%2B%2B - code adapted from here
Date
30th March 2025
Author
Max Tyson

Definition in file cplusplus.h.

Typedef Documentation

◆ constructor

typedef void(* MaxOS::runtime::constructor) ()

A pointer to a constructor function.

Definition at line 19 of file cplusplus.h.

◆ uarch_t

typedef unsigned MaxOS::runtime::uarch_t

An unsigned architecture specific type.

Definition at line 20 of file cplusplus.h.

Function Documentation

◆ __cxa_atexit()

int MaxOS::runtime::__cxa_atexit ( void(*)(void *)  f,
void *  objptr,
void *  dso 
)

Register a function to be called at program exit.

Parameters
fThe function to call
objptrThe object pointer to pass to the function
dsoThe DSO handle (not used)
Returns
int 0 on success, non-zero on failure

References MaxOS::runtime::__cxa_atexit().

Referenced by MaxOS::runtime::__cxa_atexit().

◆ __cxa_finalize()

void MaxOS::runtime::__cxa_finalize ( void *  f)

Finalise all global objects by calling their destructors.

Parameters
fThe DSO handle to finalise (nullptr for all)

References MaxOS::runtime::__cxa_finalize().

Referenced by MaxOS::runtime::__cxa_finalize().

Variable Documentation

◆ __stack_chk_guard

uintptr_t MaxOS::runtime::__stack_chk_guard = 0x595e9fbd94fda766

The stack canary value used to detect stack buffer overflows (.

Todo:
make random at runtime)

Definition at line 52 of file cplusplus.h.