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.

35 lines
930 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/page.h>"
#endif
/**
* @brief In-kernel context save for the x86.
* This precise structure layout is hardcoded in assembly, so don't forget to
* update `arch/x86/sys/i386/switch.S` if you need to change it.
*/
struct x86_context {
/**
* The register itself is %esp, which points to the %eip that was pushed
* by the function calling `arch_switch_to()` as per the x86 SysV ABI
*/
union {
register_t esp;
register_t *eip;
};
register_t esi;
register_t edi;
register_t ebx;
register_t ebp;
} __packed;
/**
* @brief Arch dependent Task Control Block (i386 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 i386_context tcb_t;