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.
52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
/* See the end of this file for copyright and license terms. */
|
|
|
|
#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;
|
|
|
|
/*
|
|
* This file is part of GayBSD.
|
|
* Copyright (c) 2021 fef <owo@fef.moe>.
|
|
*
|
|
* GayBSD is nonviolent software: you may only use, redistribute, and/or
|
|
* modify it under the terms of the Cooperative Nonviolent Public License
|
|
* (CNPL) as found in the LICENSE file in the source code root directory
|
|
* or at <https://git.pixie.town/thufie/npl-builder>; either version 7
|
|
* of the license, or (at your option) any later version.
|
|
*
|
|
* GayBSD comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
* permitted by applicable law. See the CNPL for details.
|
|
*/
|