1/*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#pragma once
8
9#include <arch/kernel/vspace.h>
10
11struct lookupPDPTSlot_ret {
12    exception_t status;
13    pdpte_t     *pdptSlot;
14};
15typedef struct lookupPDPTSlot_ret lookupPDPTSlot_ret_t;
16
17static inline pte_t x86_make_device_pte(paddr_t phys)
18{
19    return pte_new(
20               0,      /* xd */
21               phys,   /* page_base_address    */
22               1,      /* global               */
23               0,      /* pat                  */
24               0,      /* dirty                */
25               0,      /* accessed             */
26               1,      /* cache_disabled       */
27               1,      /* write_through        */
28               0,      /* super_user           */
29               1,      /* read_write           */
30               1       /* present              */
31           );
32}
33
34static inline pte_t x86_make_empty_pte(void)
35{
36    return pte_new(
37               0,      /* xd */
38               0,      /* page_base_address    */
39               0,      /* global               */
40               0,      /* pat                  */
41               0,      /* dirty                */
42               0,      /* accessed             */
43               0,      /* cache_disabled       */
44               0,      /* write_through        */
45               0,      /* super_user           */
46               0,      /* read_write           */
47               0       /* present              */
48           );
49}
50
51static inline CONST pml4e_t x86_make_empty_root_mapping(void)
52{
53    return pml4e_new(
54               0,                  /* xd               */
55               0,                  /* pdpt_base_addr   */
56               0,                  /* accessed         */
57               0,                  /* cache_disabled   */
58               0,                  /* write through    */
59               0,                  /* super user       */
60               0,                  /* read_write       */
61               0                   /* present          */
62           );
63}
64
65