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#pragma once
13
14#include <stdint.h>
15#include <sel4/sel4.h>
16#include <sel4/faults.h>
17
18#define EXCEPT_IPC_SYS_MR_IP EXCEPT_IPC_SYS_MR_EIP
19
20static inline void sel4utils_set_instruction_pointer(seL4_UserContext *regs, seL4_Word value)
21{
22    regs->eip = value;
23}
24
25static inline seL4_Word sel4utils_get_instruction_pointer(seL4_UserContext regs)
26{
27    return regs.eip;
28}
29
30static inline seL4_Word sel4utils_get_sp(seL4_UserContext regs)
31{
32    return regs.esp;
33}
34
35static inline void sel4utils_set_stack_pointer(seL4_UserContext *regs, seL4_Word value)
36{
37    regs->esp = value;
38}
39