MOS Source Code
Loading...
Searching...
No Matches
platform.c
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
4
5#include "mos/misc/panic.h"
6#include "mos/syslog/printk.h"
7
8#include <mos/mos_global.h>
9#include <mos/types.h>
10
11#define __weak__ [[gnu::weak]]
12
13__weak__ [[noreturn]] void platform_ap_entry(u64 arg)
14{
15 MOS_UNUSED(arg);
16 mos_panic("platform_ap_entry not implemented");
17}
18
19// Platform Machine APIs
20__weak__ [[noreturn]] void platform_shutdown(void)
21{
22 mos_panic("platform_shutdown not implemented");
23}
24
26{
27 MOS_UNUSED(regs);
28 pr_emerg("platform_dump_regs() not implemented");
29}
30
32{
33 MOS_UNUSED(regs);
34 pr_emerg("platform_dump_stack() not implemented");
35}
36
38{
39 pr_emerg("platform_dump_current_stack() not implemented");
40}
41
43{
44 MOS_UNUSED(thread);
45 pr_emerg("platform_dump_thread_kernel_stack() not implemented");
46}
47
48// Platform Timer/Clock APIs
50{
51 MOS_UNUSED(val);
52 pr_emerg("platform_get_time() not implemented");
53}
54
55// Platform CPU APIs
56__weak__ [[noreturn]] void platform_halt_cpu(void)
57{
58 pr_emerg("platform_halt_cpu() not implemented");
59 while (1)
60 ;
61}
62
64{
65 MOS_UNUSED(vaddr);
66 pr_emerg("platform_invalidate_tlb() not implemented");
67}
68
70{
71 return 0;
72}
73
75{
76 pr_emerg("platform_cpu_idle() not implemented");
77}
78
80{
81 return 0;
82}
83
85{
86 return nullptr;
87}
88
89// Platform Interrupt APIs, default implementation does nothing
91{
92 pr_emerg("platform_interrupt_enable() not implemented");
93}
94
96{
97 pr_emerg("platform_interrupt_disable() not implemented");
98}
99
100// Platform-Specific syscall APIs, does nothing by default
101__weak__ u64 platform_arch_syscall(u64 syscall, u64 arg1, u64 arg2, u64 arg3, u64 arg4)
102{
103 MOS_UNUSED(syscall);
104 MOS_UNUSED(arg1);
105 MOS_UNUSED(arg2);
106 MOS_UNUSED(arg3);
107 MOS_UNUSED(arg4);
108 pr_emerg("platform_arch_syscall() not implemented");
109 return 0;
110}
111
112// Platform-Specific IPI (Inter-Processor Interrupt) APIs
114{
115 MOS_UNUSED(target_cpu);
116 MOS_UNUSED(type);
117 pr_emerg("platform_ipi_send() not implemented");
118}
119
120// Signal Handler APIs, panic if not implemented
121
122__weak__ [[noreturn]] void platform_jump_to_signal_handler(const platform_regs_t *regs, const sigreturn_data_t *sigreturn_data, const sigaction_t *sa)
123{
124 MOS_UNUSED(regs);
125 MOS_UNUSED(sigreturn_data);
126 MOS_UNUSED(sa);
127 mos_panic("platform_jump_to_signal_handler() not implemented");
128}
129
131{
132 MOS_UNUSED(sp);
133 mos_panic("platform_restore_from_signal_handler() not implemented");
134}
135
137{
138 MOS_UNUSED(regs);
139 MOS_UNUSED(syscall_nr);
140 mos_panic("platform_syscall_setup_restart_context() not implemented");
141}
142
144{
145 MOS_UNUSED(regs);
146 MOS_UNUSED(result);
147 mos_panic("platform_syscall_store_retval() not implemented");
148}
ipi_type_t
The type of IPI to send.
Definition ipi.h:12
#define MOS_UNUSED(x)
Definition mos_global.h:64
#define mos_panic(fmt,...)
Definition panic.h:55
void platform_interrupt_disable(void)
Definition platform.c:95
u32 platform_current_cpu_id(void)
Definition platform.c:69
void platform_dump_regs(platform_regs_t *regs)
Definition platform.c:25
u64 platform_arch_syscall(u64 syscall, u64 arg1, u64 arg2, u64 arg3, u64 arg4)
Definition platform.c:101
void platform_interrupt_enable(void)
Definition platform.c:90
#define __weak__
Definition platform.c:11
void platform_syscall_setup_restart_context(platform_regs_t *regs, reg_t syscall_nr)
Definition platform.c:136
void platform_restore_from_signal_handler(void *sp)
Definition platform.c:130
void platform_dump_thread_kernel_stack(const thread_t *thread)
Definition platform.c:42
void platform_shutdown(void)
Definition platform.c:20
void platform_jump_to_signal_handler(const platform_regs_t *regs, const sigreturn_data_t *sigreturn_data, const sigaction_t *sa)
Definition platform.c:122
void platform_ap_entry(u64 arg)
Definition platform.c:13
u64 platform_get_timestamp(void)
Definition platform.c:79
void platform_invalidate_tlb(ptr_t vaddr)
Definition platform.c:63
void platform_ipi_send(u8 target_cpu, ipi_type_t type)
Definition platform.c:113
datetime_str_t * platform_get_datetime_str(void)
Definition platform.c:84
void platform_syscall_store_retval(platform_regs_t *regs, reg_t result)
Definition platform.c:143
void platform_cpu_idle(void)
Definition platform.c:74
void platform_get_time(timeval_t *val)
Definition platform.c:49
void platform_halt_cpu(void)
Definition platform.c:56
void platform_dump_stack(platform_regs_t *regs)
Definition platform.c:31
void platform_dump_current_stack()
Definition platform.c:37
char datetime_str_t[32]
Definition platform.h:184
#define pr_emerg(fmt,...)
Definition printk.h:39
uintn reg_t
Definition types.h:51
unsigned int u32
Definition types.h:21
unsigned long ptr_t
Definition types.h:25
unsigned long long u64
Definition types.h:23
unsigned char u8
Definition types.h:19