Skip to content

Commit

Permalink
[RISCV64] Define HAVE_MACHINE_CONTEXT, provide mcontext_t accessors f…
Browse files Browse the repository at this point in the history
…or CPU(RISCV64)

https://bugs.webkit.org/show_bug.cgi?id=234718

Patch by Zan Dobersek <zdobersek@igalia.com> on 2021-12-28
Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

Define HAVE_MACHINE_CONTEXT for RISCV64. In the MachineContext.h
header, CPU(RISCV64)-specific accessors into the mcontext_t struct
are also provided.

* runtime/MachineContext.h:
(JSC::MachineContext::stackPointerImpl):
(JSC::MachineContext::framePointerImpl):
(JSC::MachineContext::instructionPointerImpl):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::llintInstructionPointer):

Source/WTF:

* wtf/PlatformHave.h: Define HAVE_MACHINE_CONTEXT for CPU(RISCV64).


Canonical link: https://commits.webkit.org/245599@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
commit-queue@webkit.org committed Dec 28, 2021
1 parent 64d9d3d commit 6c2615d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,21 @@
2021-12-28 Zan Dobersek <zdobersek@igalia.com>

[RISCV64] Define HAVE_MACHINE_CONTEXT, provide mcontext_t accessors for CPU(RISCV64)
https://bugs.webkit.org/show_bug.cgi?id=234718

Reviewed by Yusuke Suzuki.

Define HAVE_MACHINE_CONTEXT for RISCV64. In the MachineContext.h
header, CPU(RISCV64)-specific accessors into the mcontext_t struct
are also provided.

* runtime/MachineContext.h:
(JSC::MachineContext::stackPointerImpl):
(JSC::MachineContext::framePointerImpl):
(JSC::MachineContext::instructionPointerImpl):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::llintInstructionPointer):

2021-12-27 Yusuke Suzuki <ysuzuki@apple.com>

Consider merging Wasm::FunctionCodeBlock and Wasm::LLIntCallee
Expand Down
10 changes: 10 additions & 0 deletions Source/JavaScriptCore/runtime/MachineContext.h
Expand Up @@ -207,6 +207,8 @@ static inline void*& stackPointerImpl(mcontext_t& machineContext)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.sp);
#elif CPU(MIPS)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[29]);
#elif CPU(RISCV64)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[REG_SP]);
#else
#error Unknown Architecture
#endif
Expand Down Expand Up @@ -359,6 +361,8 @@ static inline void*& framePointerImpl(mcontext_t& machineContext)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.regs[29]);
#elif CPU(MIPS)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[30]);
#elif CPU(RISCV64)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[REG_S0]);
#else
#error Unknown Architecture
#endif
Expand Down Expand Up @@ -510,6 +514,8 @@ static inline void*& instructionPointerImpl(mcontext_t& machineContext)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.pc);
#elif CPU(MIPS)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.pc);
#elif CPU(RISCV64)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[REG_PC]);
#else
#error Unknown Architecture
#endif
Expand Down Expand Up @@ -668,6 +674,8 @@ inline void*& argumentPointer<1>(mcontext_t& machineContext)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.regs[1]);
#elif CPU(MIPS)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[5]);
#elif CPU(RISCV64)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[REG_A0 + 1]);
#else
#error Unknown Architecture
#endif
Expand Down Expand Up @@ -785,6 +793,8 @@ inline void*& llintInstructionPointer(mcontext_t& machineContext)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.regs[4]);
#elif CPU(MIPS)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[12]);
#elif CPU(RISCV64)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.__gregs[14]);
#else
#error Unknown Architecture
#endif
Expand Down
9 changes: 9 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,12 @@
2021-12-28 Zan Dobersek <zdobersek@igalia.com>

[RISCV64] Define HAVE_MACHINE_CONTEXT, provide mcontext_t accessors for CPU(RISCV64)
https://bugs.webkit.org/show_bug.cgi?id=234718

Reviewed by Yusuke Suzuki.

* wtf/PlatformHave.h: Define HAVE_MACHINE_CONTEXT for CPU(RISCV64).

2021-12-23 Sam Weinig <weinig@apple.com>

Gradient color interpolation incorrect for colors with alpha (need to interpolate premultiplied colors)
Expand Down
2 changes: 1 addition & 1 deletion Source/WTF/wtf/PlatformHave.h
Expand Up @@ -222,7 +222,7 @@
#define HAVE_HOSTED_CORE_ANIMATION 1
#endif

#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
#define HAVE_MACHINE_CONTEXT 1
#endif

Expand Down

0 comments on commit 6c2615d

Please sign in to comment.