mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
Kernel: Push ARCH specific ifdef's down into RegisterState functions
The non CPU specific code of the kernel shouldn't need to deal with architecture specific registers, and should instead deal with an abstract view of the machine. This allows us to remove a variety of architecture specific ifdefs and helps keep the code slightly more portable. We do this by exposing the abstract representation of instruction pointer, stack pointer, base pointer, return register, etc on the RegisterState struct.
This commit is contained in:
parent
ff8429a749
commit
1cffecbe8d
9 changed files with 119 additions and 97 deletions
|
@ -108,6 +108,24 @@ struct ThreadRegisters {
|
|||
FlatPtr rflags;
|
||||
#endif
|
||||
FlatPtr cr3;
|
||||
|
||||
FlatPtr ip() const
|
||||
{
|
||||
#if ARCH(I386)
|
||||
return eip;
|
||||
#else
|
||||
return rip;
|
||||
#endif
|
||||
}
|
||||
|
||||
FlatPtr sp() const
|
||||
{
|
||||
#if ARCH(I386)
|
||||
return esp;
|
||||
#else
|
||||
return rsp;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class Thread
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue