Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CTSRD-CHERI/cheribsd
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8e36b3f02dedcae8f3a84afec6108637bfce966a
Choose a base ref
..
head repository: CTSRD-CHERI/cheribsd
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a359b7183b51a1c76a10f6109802bea41e82ca74
Choose a head ref
Showing with 12 additions and 19 deletions.
  1. +12 −19 contrib/subrepo-cheri-libunwind/src/CompartmentInfo.hpp
31 changes: 12 additions & 19 deletions contrib/subrepo-cheri-libunwind/src/CompartmentInfo.hpp
Original file line number Diff line number Diff line change
@@ -19,44 +19,37 @@ extern "C" {

struct trusted_frame;

#if defined(_LIBUNWIND_TARGET_AARCH64)
// Must mirror the layout in rtld_c18n_machdep.h
#if defined(_LIBUNWIND_TARGET_AARCH64)
struct compart_state {
void *fp;
void *pc;
void *regs[10]; // c19 to c28
void *sp;
};
#else
# error "LIBUNWIND_CHERI_C18N_SUPPORT is only supported on Morello"
# error "LIBUNWIND_CHERI_C18N_SUPPORT is not supported on this target"
#endif

#pragma weak c18n_is_enabled
bool c18n_is_enabled(void);
bool c18n_is_tramp(ptraddr_t, struct trusted_frame *);
struct trusted_frame *c18n_pop_trusted_stk(struct compart_state *,
struct trusted_frame *);

bool _c18n_is_enabled(void) {
return false;
}
bool _c18n_is_tramp(ptraddr_t, struct trusted_frame *) {
return false;
}
struct trusted_frame *_c18n_pop_trusted_stk(struct compart_state *,
struct trusted_frame *) {
return NULL;
}
#pragma weak c18n_is_tramp
bool c18n_is_tramp(ptraddr_t, struct trusted_frame *);

_LIBUNWIND_WEAK_ALIAS(_c18n_is_enabled, c18n_is_enabled)
_LIBUNWIND_WEAK_ALIAS(_c18n_is_tramp, c18n_is_tramp)
_LIBUNWIND_WEAK_ALIAS(_c18n_pop_trusted_stk, c18n_pop_trusted_stk)
#pragma weak c18n_pop_trusted_stk
struct trusted_frame *
c18n_pop_trusted_stk(struct compart_state *, struct trusted_frame *);
}

template <typename A, typename R>
struct CompartmentInfo {
typedef typename A::pint_t pint_t;

static bool isC18NEnabled() { return c18n_is_enabled(); }
static bool isC18NEnabled() {
// If the weak function is undefined, then c18n is definitely not enabled.
return (&c18n_is_enabled != NULL) && c18n_is_enabled();
}

static bool isC18NTramp(pint_t pc, pint_t tf) {
return c18n_is_tramp(pc, (struct trusted_frame *)tf);