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#include <sel4/sel4.h> 16#include <utils/arith.h> 17 18#define ARCH_SYSCALL_INSTRUCTION_SIZE 4 19 20static inline int 21sel4utils_is_read_fault(void) 22{ 23 seL4_Word fsr = seL4_GetMR(seL4_VMFault_FSR); 24 return (fsr & (BIT(6))) == 0; 25} 26 27static inline void 28sel4utils_set_instruction_pointer(seL4_UserContext *regs, seL4_Word value) 29{ 30 regs->pc = value; 31} 32 33static inline seL4_Word 34sel4utils_get_instruction_pointer(seL4_UserContext regs) 35{ 36 return regs.pc; 37} 38 39static inline void 40sel4utils_set_stack_pointer(seL4_UserContext *regs, seL4_Word value) 41{ 42 regs->sp = value; 43} 44 45static inline void 46sel4utils_set_arg0(seL4_UserContext *regs, seL4_Word value) 47{ 48 regs->x0 = value; 49} 50 51static inline seL4_Word 52sel4utils_get_sp(seL4_UserContext regs) 53{ 54 return regs.sp; 55} 56 57