summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2023-02-23 00:00:37 +0100
committerIdan Horowitz <idan.horowitz@gmail.com>2023-04-06 21:19:58 +0300
commit200e91cd7f1ec5453799a2720d4dc114a59cc289 (patch)
tree2ab616e5a5835572fcda8726398b9f1c534c3f61
parent7440112cd9b680111176582bc8b05db2b3ce4c45 (diff)
downloadserenity-200e91cd7f1ec5453799a2720d4dc114a59cc289.zip
Kernel+LibC: Modify aarch64's __mcontext to store registers in an array
This commit also removes the unnecessary ifdefs from sys/arch/aarch64/regs.h. Contributed by konrad, thanks for that.
-rw-r--r--Kernel/Arch/aarch64/mcontext.h32
-rw-r--r--Userland/Libraries/LibC/sys/arch/aarch64/regs.h28
2 files changed, 3 insertions, 57 deletions
diff --git a/Kernel/Arch/aarch64/mcontext.h b/Kernel/Arch/aarch64/mcontext.h
index f1019404ff..316631f504 100644
--- a/Kernel/Arch/aarch64/mcontext.h
+++ b/Kernel/Arch/aarch64/mcontext.h
@@ -13,37 +13,7 @@ extern "C" {
#endif
struct __attribute__((packed)) __mcontext {
- uint64_t r0;
- uint64_t r1;
- uint64_t r2;
- uint64_t r3;
- uint64_t r4;
- uint64_t r5;
- uint64_t r6;
- uint64_t r7;
- uint64_t r8;
- uint64_t r9;
- uint64_t r10;
- uint64_t r11;
- uint64_t r12;
- uint64_t r13;
- uint64_t r14;
- uint64_t r15;
- uint64_t r16;
- uint64_t r17;
- uint64_t r18;
- uint64_t r19;
- uint64_t r20;
- uint64_t r21;
- uint64_t r22;
- uint64_t r23;
- uint64_t r24;
- uint64_t r25;
- uint64_t r26;
- uint64_t r27;
- uint64_t r28;
- uint64_t r29;
- uint64_t r30;
+ uint64_t x[31];
uint64_t sp;
uint64_t pc;
};
diff --git a/Userland/Libraries/LibC/sys/arch/aarch64/regs.h b/Userland/Libraries/LibC/sys/arch/aarch64/regs.h
index 1e25a4eff4..24aa2eb40a 100644
--- a/Userland/Libraries/LibC/sys/arch/aarch64/regs.h
+++ b/Userland/Libraries/LibC/sys/arch/aarch64/regs.h
@@ -21,46 +21,22 @@ struct [[gnu::packed]] PtraceRegisters : public __mcontext {
# if defined(__cplusplus) && defined(__cpp_concepts)
FlatPtr ip() const
{
-# if ARCH(X86_64)
- return rip;
-# elif ARCH(AARCH64)
return pc;
-# else
-# error Unknown architecture
-# endif
}
void set_ip(FlatPtr ip)
{
-# if ARCH(X86_64)
- rip = ip;
-# elif ARCH(AARCH64)
pc = ip;
-# else
-# error Unknown architecture
-# endif
}
FlatPtr bp() const
{
-# if ARCH(X86_64)
- return rbp;
-# elif ARCH(AARCH64)
- return r29;
-# else
-# error Unknown architecture
-# endif
+ return x[29];
}
void set_bp(FlatPtr bp)
{
-# if ARCH(X86_64)
- rbp = bp;
-# elif ARCH(AARCH64)
- r29 = bp;
-# else
-# error Unknown architecture
-# endif
+ x[29] = bp;
}
# endif
};