提交 5f42ad4b 编写于 作者: G GoLancer

framework: add comment for croutien stack layout

上级 183a7837
......@@ -20,6 +20,23 @@ namespace apollo {
namespace cyber {
namespace croutine {
// The stack layout looks as follows:
//
// +------------------+
// | Reserved |
// +------------------+
// | Return Address | f1
// +------------------+
// | RDI | arg
// +------------------+
// | R12 |
// +------------------+
// | R13 |
// +------------------+
// | ... |
// +------------------+
// ctx->sp => | RBP |
// +------------------+
void MakeContext(const func &f1, const void *arg, RoutineContext *ctx) {
ctx->sp = ctx->stack + STACK_SIZE - 2 * sizeof(void *) - REGISTERS_SIZE;
std::memset(ctx->sp, 0, REGISTERS_SIZE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册