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.

54 lines
1.5 KiB
C

/* See the end of this file for copyright and license terms. */
#pragma once
#define _ARCH_SCHED_H_
#include <arch/page.h>
#define KERN_STACK_PAGES 2
#define KERN_STACK_SHIFT (PAGE_SHIFT + KERN_STACK_PAGES - 1)
#define KERN_STACK_SIZE (1 << KERN_STACK_SHIFT)
#ifndef _ASM_SOURCE
#include <gay/cdefs.h>
#include <gay/types.h>
#ifdef __x86_64__
#include <amd64/sched.h>
#else
#include <i386/sched.h>
#endif
/**
* @brief Arch dependent Task Control Block (x86 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 x86_context tcb_t;
/**
* @brief Arch dependent low level task switch routine (x86 version).
* `new` must not be equal to `old` or the whole thing probably blows up.
*
* @param new TCB of the new task we are switching to
* @param old TCB of the old task we are switching from
*/
extern void arch_switch_to(tcb_t *new, tcb_t *old);
#endif /* not _ASM_SOURCE */
/*
* 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.
*/