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

Implementation of C++ runtime support functions. More...

#include <runtime/cplusplus.h>
#include <common/logger.h>

Go to the source code of this file.

Functions

void __cxa_pure_virtual ()
 Called when a virtual function is called on an object with no implementation.
 
void __stack_chk_fail (void)
 Called when stack smashing is detectedf.
 
void call_constructors ()
 Calls all global constructors.
 

Variables

void * __dso_handle
 Define static constructors (DSO = Dynamic Shared Object)
 
constructor start_ctors
 Pointer to the start of the constructors section.
 
constructor end_ctors
 Pointer to the end of the constructors section.
 

Detailed Description

Implementation of C++ runtime support functions.

Date
30th March 2025
Author
Max Tyson

Definition in file cplusplus.cpp.

Function Documentation

◆ __cxa_pure_virtual()

void __cxa_pure_virtual ( )

Called when a virtual function is called on an object with no implementation.

Definition at line 21 of file cplusplus.cpp.

21 {
22 ASSERT(false, "Pure virtual function call failed");
23}
#define ASSERT(condition, format,...)
If the specified condition is not met then the kernel will crash with the specified message.
Definition logger.h:100

References ASSERT.

◆ __stack_chk_fail()

void __stack_chk_fail ( void  )

Called when stack smashing is detectedf.

Definition at line 28 of file cplusplus.cpp.

29{
30 ASSERT(false, "Stack Smashed");
31}

References MaxOS::runtime::__stack_chk_fail(), and ASSERT.

◆ call_constructors()

void call_constructors ( )

Calls all global constructors.

Calls the C++ static constructors.

Definition at line 39 of file cplusplus.cpp.

39 {
40 // Loop through and initialise all the global constructorsu
41 for (constructor* i = &start_ctors; i != &end_ctors; i++)
42 (*i)();
43}
constructor start_ctors
Pointer to the start of the constructors section.
Definition cplusplus.cpp:33
constructor end_ctors
Pointer to the end of the constructors section.
Definition cplusplus.cpp:34

References end_ctors, and start_ctors.

Referenced by kernel_main().

Variable Documentation

◆ __dso_handle

void* __dso_handle

Define static constructors (DSO = Dynamic Shared Object)

Definition at line 16 of file cplusplus.cpp.

◆ end_ctors

constructor end_ctors

Pointer to the end of the constructors section.

Definition at line 34 of file cplusplus.cpp.

Referenced by call_constructors().

◆ start_ctors

constructor start_ctors

Pointer to the start of the constructors section.

Definition at line 33 of file cplusplus.cpp.

Referenced by call_constructors().