Stack class is an abstraction of architecture's stack.
More...
#include "distortos/internal/scheduler/Stack.hpp"
Stack class is an abstraction of architecture's stack.
◆ StorageUniquePointer
unique_ptr (with deleter) to storage
◆ Stack() [1/2]
Stack's constructor.
Storage's address and size are adjusted to suit architecture's alignment requirements.
- Parameters
-
[in] | storageUniquePointer | is a rvalue reference to StorageUniquePointer with storage for stack (size bytes long) and appropriate deleter |
[in] | size | is the size of stack's storage, bytes |
◆ Stack() [2/2]
distortos::internal::Stack::Stack |
( |
void * |
storage, |
|
|
size_t |
size |
|
) |
| |
Stack's constructor.
This function adopts existing valid architecture-specific stack in provided storage. No adjustments are done, no stack frame is created and stack pointer register's value is not calculated.
This is meant to adopt main()'s stack.
- Parameters
-
[in] | storage | is a pointer to stack's storage |
[in] | size | is the size of stack's storage, bytes |
◆ ~Stack()
distortos::internal::Stack::~Stack |
( |
| ) |
|
◆ checkStackGuard()
bool distortos::internal::Stack::checkStackGuard |
( |
| ) |
const |
- Returns
- true if "stack guard" contains unmodified sentinel values, false if stack overflowed into "stack guard"
◆ checkStackPointer()
bool distortos::internal::Stack::checkStackPointer |
( |
const void *const |
stackPointer | ) |
const |
|
inline |
Checks whether stack pointer value is within range of this stack.
- Note
- The "stack guard" area is not a valid range for stack pointer.
- Parameters
-
[in] | stackPointer | is the value of stack pointer that will be checked |
- Returns
- true if stackPointer is within range of this stack, false otherwise
◆ getHighWaterMark()
size_t distortos::internal::Stack::getHighWaterMark |
( |
| ) |
const |
- Returns
- stack's "high water mark" (max usage), excluding "stack guard", bytes
◆ getSize()
size_t distortos::internal::Stack::getSize |
( |
| ) |
const |
|
inline |
- Returns
- adjusted size of stack's storage, excluding "stack guard", bytes
◆ getStackPointer()
void* distortos::internal::Stack::getStackPointer |
( |
| ) |
const |
|
inline |
Gets current value of stack pointer.
- Returns
- current value of stack pointer
◆ initialize()
int distortos::internal::Stack::initialize |
( |
RunnableThread & |
runnableThread | ) |
|
Fills the stack with stack sentinel, initializes its contents and stack pointer value.
- Parameters
-
[in] | runnableThread | is a reference to RunnableThread object that is being run |
- Returns
- 0 on success, error code otherwise:
◆ setStackPointer()
void distortos::internal::Stack::setStackPointer |
( |
void *const |
stackPointer | ) |
|
|
inline |
Sets value of stack pointer.
- Parameters
-
[in] | stackPointer | is the new value of stack pointer |
◆ adjustedSize_
const size_t distortos::internal::Stack::adjustedSize_ |
|
private |
adjusted size of stack's storage
◆ adjustedStorage_
void* const distortos::internal::Stack::adjustedStorage_ |
|
private |
adjusted address of stack's storage
◆ stackPointer_
void* distortos::internal::Stack::stackPointer_ |
|
private |
current value of stack pointer register
◆ storageUniquePointer_
The documentation for this class was generated from the following files: