1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12 13#pragma once 14 15/* This file provides various small API wrappers either for simple convenience, backwards compatibility, 16 or abstracting different kernel versions */ 17 18#include <sel4/sel4.h> 19#include <sel4utils/mcs_api.h> 20 21/* Helper for generating a guard. The guard itself is a bitpacked data structure, but is passed 22 to invocations as a raw word */ 23static inline seL4_Word api_make_guard_word(seL4_Word guard, seL4_Word guard_size) { 24 /* the bitfield generated _new function will assert that our chosen values fit 25 into the datastructure so there is no need for us to do anything beyond 26 blindly pass them in */ 27 return seL4_CNode_CapData_new(guard, guard_size).words[0]; 28} 29 30/* Helper for making an empty guard. Typically a guard matches zeroes and is effectively acting 31 as a skip. This is a convenience wrapper and api_make_guard_word */ 32static inline seL4_Word api_make_guard_skip_word(seL4_Word guard_size) { 33 return api_make_guard_word(0, guard_size); 34} 35