1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-09-13 19:47:59 +00:00

Kernel: Move ThreadRegisters into arch-specific directory

These are architecture-specific anyway, so they belong in the Arch
directory. This commit also adds ThreadRegisters::set_initial_state to
factor out the logic in Thread.cpp.
This commit is contained in:
Timon Kruiper 2022-12-27 14:04:07 +01:00 committed by Andrew Kaster
parent 0d2dffb95b
commit a3cbaa3449
6 changed files with 133 additions and 75 deletions

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2022, Timon Kruiper <timonkruiper@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <Kernel/Memory/AddressSpace.h>
namespace Kernel {
struct ThreadRegisters {
u64 x[31];
u64 elr_el1;
u64 sp_el0;
FlatPtr ip() const { return elr_el1; }
void set_ip(FlatPtr value) { elr_el1 = value; }
void set_sp(FlatPtr value) { sp_el0 = value; }
void set_initial_state(bool, Memory::AddressSpace&, FlatPtr kernel_stack_top)
{
set_sp(kernel_stack_top);
}
};
}