#include <cdefs.h>
#include <cheri.hh>
#include <compartment.h>

using namespace CHERI;

__cheri_compartment("stack_integrity_thread") void exhaust_trusted_stack(
  __cheri_callback void (*fn)(),
  bool *outLeakedSwitcherCapability);
__cheri_compartment("stack_integrity_thread") void exhaust_thread_stack();
__cheri_compartment("stack_integrity_thread") void set_csp_permissions_on_fault(
  PermissionSet newPermissions);
__cheri_compartment("stack_integrity_thread") void set_csp_permissions_on_call(
  PermissionSet newPermissions,
  __cheri_callback void (*fn)());
__cheri_compartment(
  "stack_integrity_thread") void test_stack_invalid_on_fault();
__cheri_compartment("stack_integrity_thread") void test_stack_invalid_on_call(
  __cheri_callback void (*fn)());

/**
 * Sets what we expect to happen for this test.  Is a fault expected to invoke
 * the handler?  The fault handler will set or clear `*outTestFailed` when a
 * fault is received, depending on whether it was expected.
 */
__cheri_compartment("stack_integrity_thread") void set_expected_behaviour(
  bool *outTestFailed,
  bool  handlerExpected);

bool is_switcher_capability(void *reg)
{
	static constexpr PermissionSet InvalidPermissions{Permission::StoreLocal,
	                                                  Permission::Global};

	if (InvalidPermissions.can_derive_from(Capability{reg}.permissions()))
	{
		return true;
	}

	return false;
}

bool holds_switcher_capability(ErrorState *frame)
{
	for (auto reg : frame->registers)
	{
		if (is_switcher_capability(reg))
		{
			return true;
		}
	}

	return false;
}

__cheri_compartment("stack_integrity_thread")
  __cheriot_minimum_stack(128) int test_stack_requirement();
