1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

Userland+Tests: Add initial riscv64 support

This commit is contained in:
Sönke Holz 2023-09-18 12:56:39 +02:00 committed by Andrew Kaster
parent c6b2a07326
commit 6824d2a788
23 changed files with 262 additions and 34 deletions

View file

@ -416,8 +416,8 @@ public:
// For 32-bit system the pointer fully fits so we can just return it directly.
static_assert(sizeof(void*) == sizeof(u32));
return static_cast<FlatPtr>(encoded & 0xffff'ffff);
#elif ARCH(X86_64)
// For x86_64 the top 16 bits should be sign extending the "real" top bit (47th).
#elif ARCH(X86_64) || ARCH(RISCV64)
// For x86_64 and riscv64 the top 16 bits should be sign extending the "real" top bit (47th).
// So first shift the top 16 bits away then using the right shift it sign extends the top 16 bits.
return static_cast<FlatPtr>((static_cast<i64>(encoded << 16)) >> 16);
#elif ARCH(AARCH64)