MOS Source Code
Loading...
Searching...
No Matches
platform_defs.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include <mos/types.h>
6
7#define MOS_PLATFORM_PAGING_LEVELS 4
8
9#define MOS_PLATFORM_HAS_FDT 1
10
11#define PML2_HUGE_CAPABLE 1
12#define PML3_HUGE_CAPABLE 1
13#define PML4_HUGE_CAPABLE 1
14
15#define PML1_SHIFT 12
16#define PML2_SHIFT 21
17#define PML3_SHIFT 30
18#define PML4_SHIFT 39
19
20#define PML1_MASK 0x1FFULL
21#define PML2_MASK 0x1FFULL
22#define PML3_MASK 0x1FFULL
23#define PML4_MASK 0x1FFULL
24
25#define PML1_ENTRIES 512
26#define PML2_ENTRIES 512
27#define PML3_ENTRIES 512
28#define PML4_ENTRIES 512
29
30#define MOS_USER_END_VADDR 0x00007FFFFFFFFFFF
31#define MOS_KERNEL_START_VADDR 0xFFFF800000000000
32
33#define MOS_ELF_PLATFORM EM_RISCV
34
35#define MOS_PLATFORM_PANIC_INSTR "unimp"
36
37// clang-format off
38#define MOS_PLATFORM_PANIC_POINT_ASM \
39 ".quad 1b\n\t" \
40 ".quad %0\n\t" \
41 ".quad %1\n\t" \
42 ".quad %2\n\t"
43// clang-format on
44
45#define MOS_PLATFORM_DEBUG_MODULES(X) \
46 X(riscv64_startup) \
47
48
49#define MOS_PLATFORM_MEMORY_BARRIER() __asm__ __volatile__("fence.i" ::: "memory")
50
51typedef struct _platform_process_options
52{
55
56typedef struct _platform_thread_options
57{
58 reg64_t f[32]; // f0-f31
59 reg32_t fcsr; // fcsr
61
62typedef struct _platform_cpuinfo
63{
66
67typedef struct _platform_arch_info
68{
69 void *fdt;
struct _platform_thread_options platform_thread_options_t
Definition platform.h:142
struct _platform_process_options platform_process_options_t
Definition platform.h:141
void * fdt
pointer to the device tree
unsigned int u32
Definition types.h:21
u32 reg32_t
Definition types.h:53
u64 reg64_t
Definition types.h:54
unsigned long ptr_t
Definition types.h:25