MOS Source Code
Loading...
Searching...
No Matches
riscv64_platform_api.cpp File Reference
#include "mos/assert.hpp"
#include "mos/platform/platform.hpp"
#include "mos/riscv64/cpu/cpu.hpp"
#include "mos/tasks/signal.hpp"
#include "mos/tasks/task_types.hpp"
#include <mos/platform_syscall.h>
#include <mos_stdlib.hpp>
+ Include dependency graph for riscv64_platform_api.cpp:

Go to the source code of this file.

Macros

#define FLEN   64
 
#define f_op(reg, val)
 
#define f_op(reg, val)
 

Typedefs

typedef void(* switch_func_t) ()
 

Functions

void riscv64_do_context_switch (ptr_t *old_stack, ptr_t new_stack, switch_func_t switcher, bool *lock)
 
void riscv64_normal_switch_impl ()
 
static void riscv64_start_user_thread ()
 
static void riscv64_start_kernel_thread ()
 
void platform_shutdown ()
 
u32 platform_current_cpu_id ()
 
void platform_cpu_idle ()
 
void platform_dump_regs (platform_regs_t *regs)
 
platform_regs_tplatform_thread_regs (const Thread *thread)
 
static void thread_setup_common (Thread *thread)
 
void platform_context_setup_main_thread (Thread *thread, ptr_t entry, ptr_t sp, int argc, ptr_t argv, ptr_t envp)
 
void platform_context_setup_child_thread (Thread *thread, thread_entry_t entry, void *arg)
 
void platform_context_clone (const Thread *from, Thread *to)
 
void platform_context_cleanup (Thread *thread)
 
void platform_interrupt_disable ()
 
void platform_interrupt_enable ()
 
void platform_switch_mm (const MMContext *new_mm)
 
static void do_save_fp_context (Thread *thread)
 
void do_restore_fp_context (Thread *thread)
 
void platform_switch_to_thread (Thread *current, Thread *new_thread, switch_flags_t switch_flags)
 
void platform_return_to_userspace (platform_regs_t *regs)
 
u64 platform_arch_syscall (u64 syscall, u64 arg1, u64 arg2, u64 arg3, u64 arg4)
 
void platform_ipi_send (u8 target_cpu, ipi_type_t type)
 
void platform_dump_stack (platform_regs_t *regs)
 
void platform_syscall_setup_restart_context (platform_regs_t *regs, reg_t syscall_nr)
 
void platform_syscall_store_retval (platform_regs_t *regs, reg_t result)
 
void platform_jump_to_signal_handler (const platform_regs_t *regs, const sigreturn_data_t *sigreturn_data, const sigaction_t *sa)
 
void platform_restore_from_signal_handler (void *sp)
 

Macro Definition Documentation

◆ FLEN

#define FLEN   64

Definition at line 142 of file riscv64_platform_api.cpp.

◆ f_op [1/2]

#define f_op ( reg,
val )
Value:
__asm__ volatile("fld " #reg ", %0" : : "m"(thread->platform_options.f[val]))

Referenced by do_restore_fp_context(), and do_save_fp_context().

◆ f_op [2/2]

#define f_op ( reg,
val )
Value:
__asm__ volatile("fsd " #reg ", %0" : : "m"(thread->platform_options.f[val]))

Typedef Documentation

◆ switch_func_t

typedef void(* switch_func_t) ()

Definition at line 13 of file riscv64_platform_api.cpp.

Function Documentation

◆ riscv64_do_context_switch()

void riscv64_do_context_switch ( ptr_t * old_stack,
ptr_t new_stack,
switch_func_t switcher,
bool * lock )

◆ riscv64_normal_switch_impl()

void riscv64_normal_switch_impl ( )

◆ riscv64_start_user_thread()

static void riscv64_start_user_thread ( )
static

Definition at line 17 of file riscv64_platform_api.cpp.

Referenced by platform_switch_to_thread().

+ Here is the call graph for this function:

◆ riscv64_start_kernel_thread()

static void riscv64_start_kernel_thread ( )
static

Definition at line 24 of file riscv64_platform_api.cpp.

Referenced by platform_switch_to_thread().

+ Here is the call graph for this function:

◆ platform_shutdown()

void platform_shutdown ( void )

Definition at line 33 of file riscv64_platform_api.cpp.

Referenced by power_shutdown().

+ Here is the call graph for this function:

◆ platform_current_cpu_id()

u32 platform_current_cpu_id ( void )

Definition at line 40 of file riscv64_platform_api.cpp.

Referenced by do_syslog(), enter_scheduler(), and platform_ap_entry().

◆ platform_cpu_idle()

void platform_cpu_idle ( void )

Definition at line 45 of file riscv64_platform_api.cpp.

Referenced by idle_task(), and platform_shutdown().

◆ platform_dump_regs()

void platform_dump_regs ( platform_regs_t * regs)

◆ platform_thread_regs()

◆ thread_setup_common()

static void thread_setup_common ( Thread * thread)
static

◆ platform_context_setup_main_thread()

void platform_context_setup_main_thread ( Thread * thread,
ptr_t entry,
ptr_t sp,
int argc,
ptr_t argv,
ptr_t envp )

Definition at line 74 of file riscv64_platform_api.cpp.

Referenced by elf_do_fill_process().

+ Here is the call graph for this function:

◆ platform_context_setup_child_thread()

void platform_context_setup_child_thread ( Thread * thread,
thread_entry_t entry,
void * arg )

Definition at line 85 of file riscv64_platform_api.cpp.

Referenced by create_thread(), and kthread_create_no_sched().

+ Here is the call graph for this function:

◆ platform_context_clone()

void platform_context_clone ( const Thread * from,
Thread * to )

Definition at line 105 of file riscv64_platform_api.cpp.

Referenced by process_do_fork().

+ Here is the call graph for this function:

◆ platform_context_cleanup()

void platform_context_cleanup ( Thread * thread)

Definition at line 118 of file riscv64_platform_api.cpp.

Referenced by process_do_execveat(), and thread_destroy().

◆ platform_interrupt_disable()

void platform_interrupt_disable ( void )

Definition at line 124 of file riscv64_platform_api.cpp.

Referenced by try_handle_kernel_panics_at().

◆ platform_interrupt_enable()

void platform_interrupt_enable ( void )

Definition at line 130 of file riscv64_platform_api.cpp.

Referenced by idle_task().

◆ platform_switch_mm()

void platform_switch_mm ( const MMContext * new_mm)

◆ do_save_fp_context()

static void do_save_fp_context ( Thread * thread)
static

Definition at line 144 of file riscv64_platform_api.cpp.

Referenced by platform_switch_to_thread().

◆ do_restore_fp_context()

void do_restore_fp_context ( Thread * thread)

Definition at line 186 of file riscv64_platform_api.cpp.

Referenced by platform_switch_to_thread().

◆ platform_switch_to_thread()

void platform_switch_to_thread ( Thread * current,
Thread * new_thread,
switch_flags_t switch_flags )

Definition at line 227 of file riscv64_platform_api.cpp.

Referenced by reschedule().

+ Here is the call graph for this function:

◆ platform_return_to_userspace()

void platform_return_to_userspace ( platform_regs_t * regs)

◆ platform_arch_syscall()

u64 platform_arch_syscall ( u64 syscall,
u64 arg1,
u64 arg2,
u64 arg3,
u64 arg4 )

Definition at line 264 of file riscv64_platform_api.cpp.

Referenced by arch_syscall().

+ Here is the call graph for this function:

◆ platform_ipi_send()

void platform_ipi_send ( u8 target_cpu,
ipi_type_t type )

Definition at line 282 of file riscv64_platform_api.cpp.

◆ platform_dump_stack()

void platform_dump_stack ( platform_regs_t * regs)

◆ platform_syscall_setup_restart_context()

void platform_syscall_setup_restart_context ( platform_regs_t * regs,
reg_t syscall_nr )

Definition at line 302 of file riscv64_platform_api.cpp.

Referenced by signal_exit_to_user_prepare_syscall().

◆ platform_syscall_store_retval()

void platform_syscall_store_retval ( platform_regs_t * regs,
reg_t result )

Definition at line 308 of file riscv64_platform_api.cpp.

Referenced by signal_exit_to_user_prepare_syscall().

◆ platform_jump_to_signal_handler()

void platform_jump_to_signal_handler ( const platform_regs_t * regs,
const sigreturn_data_t * sigreturn_data,
const sigaction_t * sa )

Definition at line 313 of file riscv64_platform_api.cpp.

Referenced by do_signal_exit_to_user_prepare().

+ Here is the call graph for this function:

◆ platform_restore_from_signal_handler()

void platform_restore_from_signal_handler ( void * sp)

Definition at line 330 of file riscv64_platform_api.cpp.

Referenced by MOS_STATIC_ASSERT().

+ Here is the call graph for this function: