Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ lcov*.info
!/coroutine/**/*.S

# /enc/trans/
/enc/trans/*.c
# /enc/trans/*.c
/enc/trans/*.def
/enc/trans/*.exp
/enc/trans/*.lib
Expand Down
13 changes: 11 additions & 2 deletions coroutine/ucontext/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,17 @@ static inline void coroutine_initialize(
context->state.uc_link = NULL;

makecontext(&context->state, (void(*)(void))coroutine_trampoline, 2, (void*)start, (void*)context);
context->state.uc_mcontext.mc_capregs.cp_ca[0] = (__uintcap_t) start;
context->state.uc_mcontext.mc_capregs.cp_ca[1] = (__uintcap_t) context;
#if defined(__CHERI_PURE_CAPABILITY__)
#if defined(__riscv)
context->state.uc_mcontext.mc_capregs.cp_ca[0] = (__uintcap_t) start;
context->state.uc_mcontext.mc_capregs.cp_ca[1] = (__uintcap_t) context;
#elif defined(__aarch64__)
context->state.uc_mcontext.mc_capregs.cap_x[0] = (__uintcap_t) start;
context->state.uc_mcontext.mc_capregs.cap_x[1] = (__uintcap_t) context;
#else
#error "Unsupported CHERI architecture for coroutine arguments"
#endif
#endif
}

static inline struct coroutine_context * coroutine_transfer(struct coroutine_context * current, struct coroutine_context * target)
Expand Down
17 changes: 17 additions & 0 deletions enc/trans/transdb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**********************************************************************

enc/trans/transdb.c -

Copyright (C) 2008 Yukihiro Matsumoto

**********************************************************************/

#include "ruby.h"

void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);

void
Init_transdb(void)
{
#include "transdb.h"
}
6 changes: 3 additions & 3 deletions internal/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
# define USE_MODULAR_GC 0
#endif

#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
#if defined(__CHERI_PURE_CAPABILITY__) && defined(__GNUC__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mov\t%0, csp" : "=C" (*(p)))
#elif defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
#elif defined(__i386) && defined(__GNUC__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
Expand All @@ -32,8 +34,6 @@
#define SET_MACHINE_STACK_END(p) __asm__ volatile("mr %0, r1" : "=r" (*(p)))
#elif defined(__aarch64__) && defined(__GNUC__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mov\t%0, sp" : "=r" (*(p)))
#elif defined(__CHERI_PURE_CAPABILITY__)
#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("cmove\t%0, csp" : "=C" (*(p)))
#else
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
Expand Down