29 void *Aarch64::AllocStack(
const size_t bytes) {
35 throw std::runtime_error(
"posix_memalign() failed");
48 void Aarch64::DeallocStack(
void* stack) {
62 void Aarch64::Prepare(
Aarch64 *thread,
const Entry &entry) {
63 static_assert(offsetof(
Aarch64, stackTop) == COTHREAD_OFF_CONTEXT_TOP,
"cothread stack top is invalid");
66 auto info =
new CallInfo{entry};
67 if(!info)
throw std::runtime_error(
"Failed to allocate call info");
71 const auto stackBottom =
reinterpret_cast<uintptr_t
>(
stack.data()) +
72 (
stack.size() *
sizeof(uintptr_t));
73 auto context =
reinterpret_cast<uintptr_t *
>(
stack.data());
75 context[0] = stackBottom;
77 context[2] =
reinterpret_cast<uintptr_t
>(info);
78 context[12] = stackBottom;
81 thread->stackTop = context;
void Aarch64AapcsEntryStub()
Architecture specific methods for working with cothreads on 64 bit ARM machines.
static constexpr const size_t kStackAlignment
Implementation details (including architecture/platform specific code) for the library.
Main namespace for the libcommunism library.
std::span< uintptr_t > stack
Stack used by this cothread, if any.