You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
925 B
C
38 lines
925 B
C
/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
|
|
|
|
#pragma once
|
|
|
|
#ifndef _ARCH_SCHED_H_
|
|
#error "This file is not meant to be included directly, use <arch/sched.h>"
|
|
#endif
|
|
|
|
/**
|
|
* @brief In-kernel context save for the x86_64.
|
|
* This precise structure layout is hardcoded in assembly, so don't forget to
|
|
* update `arch/x86/sys/amd64/switch.S` when changing it.
|
|
*/
|
|
struct amd64_context {
|
|
/*
|
|
* the register itself is %rsp, but it points to the %rip that was
|
|
* pushed by the function calling `arch_switch_to()` as a result of
|
|
* the CALL instruction
|
|
*/
|
|
union {
|
|
u64 rsp;
|
|
u64 *rip;
|
|
};
|
|
u64 rbx;
|
|
u64 rbp;
|
|
u64 r12;
|
|
u64 r13;
|
|
u64 r14;
|
|
u64 r15;
|
|
} __packed;
|
|
|
|
/**
|
|
* @brief Arch dependent Task Control Block (amd64 version).
|
|
* This is what's required for in-kernel task switching.
|
|
* Treat as a completely opaque type outside of the `arch/x86` directory.
|
|
*/
|
|
typedef struct amd64_context tcb_t;
|