serenity/Kernel/Arch/TrapFrame.h
kleines Filmröllchen 398d271a46 Kernel: Share Processor class (and others) across architectures
About half of the Processor code is common across architectures, so
let's share it with a templated base class. Also, other code that can be
shared in some ways, like FPUState and TrapFrame functions, is adjusted
here. Functions which cannot be shared trivially (without internal
refactoring) are left alone for now.
2023-10-03 16:08:29 -06:00

32 lines
1,000 B
C++

/*
* Copyright (c) 2022, Gunnar Beutner <gbeutner@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Platform.h>
// FIXME: There's only a minor difference between x86 and Aarch64/RISC-V trap frames; the prev_irq member.
// This seems to be unnecessary (see FIXME in Processor::enter_trap),
// so investigate whether we need it and either:
// (1) Remove the member and corresponding code from x86
// (2) Implement prev_irq in the assembly stubs of Aarch64 and RISC-V
// and then use the same TrapFrame on all architectures.
#if ARCH(X86_64)
# include <Kernel/Arch/x86_64/TrapFrame.h>
#elif ARCH(AARCH64)
# include <Kernel/Arch/aarch64/TrapFrame.h>
#else
# error "Unknown architecture"
#endif
namespace Kernel {
extern "C" void enter_trap_no_irq(TrapFrame* trap) __attribute__((used));
extern "C" void enter_trap(TrapFrame*) __attribute__((used));
extern "C" void exit_trap(TrapFrame*) __attribute__((used));
}