libcommunism
Userspace cooperative threading library
|
Architecture specific methods for working with cothreads on 64 bit ARM machines. More...
#include <Common.h>
Public Member Functions | |
Aarch64 (const Entry &entry, const size_t stackSize=0) | |
Aarch64 (const Entry &entry, std::span< uintptr_t > stack) | |
Aarch64 (std::span< uintptr_t > stack) | |
~Aarch64 () | |
void | switchTo (CothreadImpl *from) override |
Public Member Functions inherited from libcommunism::CothreadImpl | |
CothreadImpl (const Cothread::Entry &entry, const size_t stackSize=0) | |
CothreadImpl (const Cothread::Entry &entry, std::span< uintptr_t > stack) | |
CothreadImpl (std::span< uintptr_t > stack) | |
virtual | ~CothreadImpl ()=default |
virtual size_t | getStackSize () const |
virtual void * | getStack () const |
Static Public Attributes | |
static constexpr const size_t | kContextSaveAreaSize {0x100} |
static constexpr const size_t | kMainStackSize {(kContextSaveAreaSize * 2) / sizeof(uintptr_t)} |
static constexpr const size_t | kStackAlignment {64} |
static constexpr const size_t | kDefaultStackSize {0x80000} |
Friends | |
CothreadImpl * | libcommunism::AllocKernelThreadWrapper () |
Additional Inherited Members | |
Public Types inherited from libcommunism::CothreadImpl | |
using | Entry = Cothread::Entry |
Protected Attributes inherited from libcommunism::CothreadImpl | |
std::span< uintptr_t > | stack |
Stack used by this cothread, if any. More... | |
Architecture specific methods for working with cothreads on 64 bit ARM machines.
Aarch64::Aarch64 | ( | const Entry & | entry, |
const size_t | stackSize = 0 |
||
) |
Allocate a cothread with a private stack.
entry | Method to execute on entry to this cothread |
stackSize | Size of the stack to be allocated, in bytes. it should be a multiple of the machine word size, or specify zero to use the platform default. |
std::runtime_error | If the memory for the cothread could not be allocated. |
std::runtime_error | If the provided stack size is invalid |
Definition at line 33 of file Common.cpp.
Aarch64::Aarch64 | ( | const Entry & | entry, |
std::span< uintptr_t > | _stack | ||
) |
Allocates a cothread with an already provided stack.
entry | Method to execute on entry to this cothread |
stack | Buffer to use as the stack of the cothread |
std::runtime_error | If the provided stack is invalid |
Definition at line 58 of file Common.cpp.
Aarch64::Aarch64 | ( | std::span< uintptr_t > | stack | ) |
Allocate a cothread placeholder for a kernel thread. This uses a preallocated "stack" to store the kernel thread's context at the time we switched to the cothread.
Definition at line 67 of file Common.cpp.
Aarch64::~Aarch64 | ( | ) |
Release the stack if we allocated it.
Definition at line 74 of file Common.cpp.
|
overridevirtual |
Performs a context switch to the provided cothread.
The state of the caller is stored on the stack of the currently active thread.
Implements libcommunism::CothreadImpl.
Definition at line 85 of file Common.cpp.
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |