mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-04 15:09:40 +00:00
Kernel+Userland: Remove dependency on i386-specific registers
This commit is contained in:
parent
445b5e1e94
commit
85b453c2e4
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
|
||||
#include <Kernel/Arch/CPU.h>
|
||||
#include <Kernel/Arch/x86/ASM_wrapper.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/OwnPtr.h>
|
||||
#include <Kernel/Arch/RegisterState.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ index 0000000..034252a
|
|||
+#include "regset.h"
|
||||
+#include "target.h"
|
||||
+
|
||||
+#include <sys/arch/i386/regs.h>
|
||||
+#include <sys/arch/regs.h>
|
||||
+#include <sys/ptrace.h>
|
||||
+
|
||||
+#include "i386-tdep.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <AK/Platform.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Try.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <LibDebug/ProcessInspector.h>
|
||||
#include <LibGUI/ListView.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace Debug {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <LibGUI/ToolbarContainer.h>
|
||||
#include <LibGUI/TreeView.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibX86/Instruction.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace Debug {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/TreeView.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
|
|
@ -6,118 +6,41 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Platform.h>
|
||||
|
||||
#define RREGISTER(num) \
|
||||
union { \
|
||||
u64 r##num; \
|
||||
struct { \
|
||||
u32 _unused##num; \
|
||||
union { \
|
||||
u32 r##num##d; \
|
||||
struct { \
|
||||
u16 __unused##num; \
|
||||
union { \
|
||||
u16 r##num##w; \
|
||||
struct { \
|
||||
u8 ___unused##num; \
|
||||
u8 r##num##b; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
#if defined(__cplusplus) && defined(__cpp_concepts)
|
||||
# include <AK/Types.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <Kernel/Arch/mcontext.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct [[gnu::packed]] PtraceRegisters : public __mcontext {
|
||||
#if defined(__cplusplus) && defined(__cpp_concepts)
|
||||
FlatPtr ip() const
|
||||
{
|
||||
return rip;
|
||||
}
|
||||
|
||||
#define GPREGISTER(letter) \
|
||||
union { \
|
||||
u64 r##letter##x; \
|
||||
struct \
|
||||
{ \
|
||||
u32 _unused##letter; \
|
||||
union { \
|
||||
u32 e##letter##x; \
|
||||
struct \
|
||||
{ \
|
||||
u16 __unused##letter; \
|
||||
union { \
|
||||
u16 letter##x; \
|
||||
struct { \
|
||||
u8 letter##h; \
|
||||
u8 letter##l; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
void set_ip(FlatPtr ip)
|
||||
{
|
||||
rip = ip;
|
||||
}
|
||||
|
||||
#define SPREGISTER(name) \
|
||||
union { \
|
||||
u64 r##name; \
|
||||
struct \
|
||||
{ \
|
||||
u32 _unused##name; \
|
||||
union { \
|
||||
u32 e##name; \
|
||||
struct \
|
||||
{ \
|
||||
u16 __unused##name; \
|
||||
union { \
|
||||
u16 name; \
|
||||
struct { \
|
||||
u8 ___unused##name; \
|
||||
u8 name##l; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
}; \
|
||||
FlatPtr bp() const
|
||||
{
|
||||
return rbp;
|
||||
}
|
||||
|
||||
struct [[gnu::packed]] PtraceRegisters {
|
||||
GPREGISTER(a);
|
||||
GPREGISTER(b);
|
||||
GPREGISTER(c);
|
||||
GPREGISTER(d);
|
||||
|
||||
SPREGISTER(sp);
|
||||
SPREGISTER(bp);
|
||||
SPREGISTER(si);
|
||||
SPREGISTER(di);
|
||||
SPREGISTER(ip); // technically there is no ipl, but what ever
|
||||
|
||||
RREGISTER(8);
|
||||
RREGISTER(9);
|
||||
RREGISTER(10);
|
||||
RREGISTER(11);
|
||||
RREGISTER(12);
|
||||
RREGISTER(13);
|
||||
RREGISTER(14);
|
||||
RREGISTER(15);
|
||||
// flags
|
||||
union {
|
||||
u64 rflags;
|
||||
struct {
|
||||
u32 _;
|
||||
union {
|
||||
u32 eflags;
|
||||
struct {
|
||||
u16 __;
|
||||
u16 flags;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// These may not be used, unless we go back into compatibility mode
|
||||
u32 cs;
|
||||
u32 ss;
|
||||
u32 ds;
|
||||
u32 es;
|
||||
u32 fs;
|
||||
u32 gs;
|
||||
|
||||
// FIXME: Add FPU registers and Flags
|
||||
// FIXME: Add Ymm Xmm etc.
|
||||
void set_bp(FlatPtr bp)
|
||||
{
|
||||
rbp = bp;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
typedef struct __mcontext PthreadRegisters;
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <LibDebug/Dwarf/DwarfInfo.h>
|
||||
#include <LibDebug/Dwarf/LineProgram.h>
|
||||
#include <LibELF/Image.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace Debug {
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibDebug/DebugInfo.h>
|
||||
#include <LibDebug/ProcessInspector.h>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <sys/arch/i386/regs.h>
|
||||
#include <sys/arch/regs.h>
|
||||
|
||||
namespace Debug::Dwarf::Expression {
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "LoadedLibrary.h"
|
||||
#include <AK/Types.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
|
||||
namespace Debug {
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <AK/DeprecatedString.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/API/SyscallString.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/SyscallString.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
#include <LibC/sys/arch/regs.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
|
|
Loading…
Reference in a new issue