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 GNU General Public License version 2. Note that NO WARRANTY is provided.
8 * See "LICENSE_GPLv2.txt" for details.
9 *
10 * @TAG(DATA61_GPL)
11 */
12
13#ifndef __MODE_KERNEL_VSPACE_H
14#define __MODE_KERNEL_VSPACE_H
15
16#include <arch/kernel/vspace.h>
17
18struct lookupPDPTSlot_ret {
19    exception_t status;
20    pdpte_t     *pdptSlot;
21};
22typedef struct lookupPDPTSlot_ret lookupPDPTSlot_ret_t;
23
24static inline pte_t
25x86_make_device_pte(paddr_t phys)
26{
27    return pte_new(
28               0,      /* xd */
29               phys,   /* page_base_address    */
30               1,      /* global               */
31               0,      /* pat                  */
32               0,      /* dirty                */
33               0,      /* accessed             */
34               1,      /* cache_disabled       */
35               1,      /* write_through        */
36               0,      /* super_user           */
37               1,      /* read_write           */
38               1       /* present              */
39           );
40}
41
42static inline pte_t
43x86_make_empty_pte(void)
44{
45    return pte_new(
46               0,      /* xd */
47               0,      /* page_base_address    */
48               0,      /* global               */
49               0,      /* pat                  */
50               0,      /* dirty                */
51               0,      /* accessed             */
52               0,      /* cache_disabled       */
53               0,      /* write_through        */
54               0,      /* super_user           */
55               0,      /* read_write           */
56               0       /* present              */
57           );
58}
59
60static inline CONST pml4e_t
61x86_make_empty_root_mapping(void)
62{
63    return pml4e_new(
64               0,                  /* xd               */
65               0,                  /* pdpt_base_addr   */
66               0,                  /* accessed         */
67               0,                  /* cache_disabled   */
68               0,                  /* write through    */
69               0,                  /* super user       */
70               0,                  /* read_write       */
71               0                   /* present          */
72           );
73}
74
75#endif /* __MODE_KERNEL_VSPACE_H */
76