19 thread_local std::array<uintptr_t, Amd64::kMainStackSize> Amd64::gMainStack;
39 buf = AllocStack(allocSize);
42 this->
stack = {
reinterpret_cast<uintptr_t *
>(buf), allocSize /
sizeof(uintptr_t)};
43 this->ownsStack =
true;
57 ValidateStackSize(_stack.size() *
sizeof(uintptr_t));
66 DeallocStack(this->
stack.data());
76 Switch(
static_cast<Amd64 *
>(from),
this);
82 void Amd64::CothreadReturned() {
91 void Amd64::DereferenceCallInfo(CallInfo *info) {
105 return new Amd64(Amd64::gMainStack);
static Cothread * Current()
Architecture specific methods for working with cothreads on amd64 based systems.
Amd64(const Entry &entry, const size_t stackSize=0)
static constexpr const size_t kStackAlignment
void switchTo(CothreadImpl *from) override
static constexpr const size_t kDefaultStackSize
Implementation details (including architecture/platform specific code) for the library.
std::function< void(libcommunism::Cothread *)> gReturnHandler
Main namespace for the libcommunism library.
CothreadImpl * AllocKernelThreadWrapper()
Abstract interface for a platform implementation of cothreads.
std::span< uintptr_t > stack
Stack used by this cothread, if any.