1 #ifndef ARCH_AMD64_COMMON_H
2 #define ARCH_AMD64_COMMON_H
29 Amd64(
const Entry &entry,
const size_t stackSize = 0);
44 static void ValidateStackSize(
const size_t size);
55 static void* AllocStack(
const size_t bytes);
64 static void DeallocStack(
void*
stack);
69 static void CothreadReturned();
76 static void DereferenceCallInfo(CallInfo *info);
85 static void Prepare(
Amd64 *thread,
const Entry &entry);
107 static void JumpToEntry();
113 static void EntryReturnedStub();
157 static thread_local std::array<uintptr_t, kMainStackSize> gMainStack;
161 bool ownsStack{
false};
164 void *stackTop{
nullptr};
std::function< void()> Entry
Type alias for an entry point of a cothread.
Architecture specific methods for working with cothreads on amd64 based systems.
static const size_t kNumSavedRegisters
Amd64(std::span< uintptr_t > stack)
static constexpr const size_t kMainStackSize
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.
CothreadImpl * AllocKernelThreadWrapper()
Abstract interface for a platform implementation of cothreads.
std::span< uintptr_t > stack
Stack used by this cothread, if any.