summaryrefslogtreecommitdiff
path: root/Kernel/Arch/aarch64/Processor.h
blob: ed2e6bfdd863b3918624c9e1174ece9c87be7c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
 * Copyright (c) 2018-2021, James Mintram <me@jamesrm.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Array.h>
#include <AK/Concepts.h>
#include <AK/Function.h>
#include <AK/Types.h>

#include <Kernel/Arch/ProcessorSpecificDataID.h>

class VirtualAddress;

namespace Kernel {

namespace Memory {
class PageDirectory;
};

class Thread;

// FIXME This needs to go behind some sort of platform abstraction
//       it is used between Thread and Processor.
struct [[gnu::aligned(16)]] FPUState
{
    u8 buffer[512];
};

class Processor {
public:
    void set_specific(ProcessorSpecificDataID /*specific_id*/, void* /*ptr*/)
    {
        VERIFY_NOT_REACHED();
    }
    template<typename T>
    T* get_specific()
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    ALWAYS_INLINE static void pause()
    {
        VERIFY_NOT_REACHED();
    }
    ALWAYS_INLINE static void wait_check()
    {
        VERIFY_NOT_REACHED();
    }

    ALWAYS_INLINE u8 physical_address_bit_width() const
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    ALWAYS_INLINE u8 virtual_address_bit_width() const
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    ALWAYS_INLINE static bool is_initialized()
    {
        return false;
    }

    ALWAYS_INLINE static void flush_tlb_local(VirtualAddress&, size_t&)
    {
        VERIFY_NOT_REACHED();
    }

    ALWAYS_INLINE static void flush_tlb(Memory::PageDirectory const*, VirtualAddress const&, size_t)
    {
        VERIFY_NOT_REACHED();
    }

    ALWAYS_INLINE static u32 current_id()
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    // FIXME: Actually return the current thread once aarch64 supports threading.
    ALWAYS_INLINE static Thread* current_thread()
    {
        return nullptr;
    }

    ALWAYS_INLINE bool has_nx() const
    {
        return true;
    }

    ALWAYS_INLINE bool has_pat() const
    {
        return false;
    }

    ALWAYS_INLINE static FlatPtr current_in_irq()
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    ALWAYS_INLINE static u64 read_cpu_counter()
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    ALWAYS_INLINE static void enter_critical() { VERIFY_NOT_REACHED(); }
    ALWAYS_INLINE static void leave_critical() { VERIFY_NOT_REACHED(); }
    ALWAYS_INLINE static u32 in_critical()
    {
        VERIFY_NOT_REACHED();
        return 0;
    }

    // FIXME: Actually return the idle thread once aarch64 supports threading.
    ALWAYS_INLINE static Thread* idle_thread()
    {
        return nullptr;
    }

    ALWAYS_INLINE static Processor& current() { VERIFY_NOT_REACHED(); }

    static void deferred_call_queue(Function<void()> /* callback */)
    {
        VERIFY_NOT_REACHED();
    }

    [[noreturn]] static void halt()
    {
        for (;;) { }
    }
};

}