![]() |
MOS Source Code
|
#include "mos/interrupt/ipi.hpp"
#include "mos/misc/cmdline.hpp"
#include "mos/mm/mm_types.hpp"
#include "mos/mm/paging/pml_types.hpp"
#include "mos/mm/physical/pmm.hpp"
#include "mos/platform/platform_defs.hpp"
#include "mos/types.hpp"
#include <mos/lib/structures/list.hpp>
#include <mos/lib/sync/spinlock.hpp>
#include <mos/mm/mm_types.h>
#include <mos/mos_global.h>
#include <mos/shared_ptr.hpp>
#include <mos/tasks/signal_types.h>
Go to the source code of this file.
Classes | |
struct | MMContext |
struct | cpu_t |
struct | timeval_t |
struct | mos_platform_info_t |
struct | mos_platform_info_t::cpu |
Macros | |
#define | PER_CPU_DECLARE(type, name) |
#define | PER_CPU_VAR_INIT { .percpu_value = { 0 } } |
#define | per_cpu(var) |
#define | current_cpu per_cpu(platform_info->cpu) |
#define | current_thread (current_cpu->thread) |
#define | current_process (current_thread->owner) |
#define | current_mm (current_cpu->mm_context) |
#define | MOS_KERNEL_PFN(vaddr) |
#define | platform_alias(name) |
Typedefs | |
typedef void(* | irq_handler) (u32 irq) |
typedef struct _platform_process_options | platform_process_options_t |
typedef struct _platform_thread_options | platform_thread_options_t |
typedef char | datetime_str_t[32] |
typedef struct _sigreturn_data | sigreturn_data_t |
Variables | |
MMContext | mos_kernel_mm |
mos_platform_info_t *const | platform_info |
const char | __MOS_KERNEL_CODE_START [] |
const char | __MOS_KERNEL_CODE_END [] |
const char | __MOS_KERNEL_RODATA_START [] |
const char | __MOS_KERNEL_RODATA_END [] |
const char | __MOS_KERNEL_RW_START [] |
const char | __MOS_KERNEL_RW_END [] |
const char | __MOS_KERNEL_END [] |
#define PER_CPU_DECLARE | ( | type, | |
name ) |
#define PER_CPU_VAR_INIT { .percpu_value = { 0 } } |
Definition at line 27 of file platform.hpp.
#define per_cpu | ( | var | ) |
Definition at line 28 of file platform.hpp.
Referenced by platform_get_datetime_str(), platform_switch_to_thread(), x86_cpu_initialise_caps(), x86_init_percpu_gdt(), and x86_init_percpu_tss().
#define current_cpu per_cpu(platform_info->cpu) |
Definition at line 32 of file platform.hpp.
Referenced by elf_setup_main_thread(), handle_kernel_panic(), mm_dump_current_pagetable(), mm_switch_context(), platform_ap_entry(), platform_arch_syscall(), platform_startup_late(), platform_switch_to_thread(), reschedule(), riscv64_trap_handler(), x86_dump_stack_at(), and x86_interrupt_entry().
#define current_thread (current_cpu->thread) |
Definition at line 33 of file platform.hpp.
Referenced by blocked_reschedule(), dentry_from_fd(), do_signal_exit_to_user_prepare(), do_syslog(), dump_process(), enter_scheduler(), futex_wait(), get_tid(), invalid_page_fault(), io_poll(), ksyscall_enter(), kthread_entry(), mm_dump_current_pagetable(), mm_handle_fault(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), naive_sched_select_next(), pipe_write(), platform_arch_syscall(), platform_arch_syscall(), platform_context_setup_child_thread(), platform_restore_from_signal_handler(), platform_return_to_userspace(), platform_setup_signal_handler_regs(), process_do_execveat(), process_do_fork(), process_exit(), process_sysfs_thread_stat(), reschedule(), reschedule_for_waitlist(), riscv64_start_kernel_thread(), riscv64_start_user_thread(), riscv64_trap_handler(), signal_do_ignore(), signal_do_terminate(), signal_exit_to_user_prepare(), signal_exit_to_user_prepare(), signal_get_next_pending(), signal_has_pending(), signal_on_returned(), signal_send_to_thread(), thread_destroy(), timer_msleep(), waitlist_append(), waitlist_remove_me(), x86_handle_exception(), x86_interrupt_entry(), x86_pit_timer_handler(), x86_start_kernel_thread(), and x86_start_user_thread().
#define current_process (current_thread->owner) |
Definition at line 34 of file platform.hpp.
Referenced by create_thread(), current_stdio(), dentry_from_fd(), do_signal_exit_to_user_prepare(), dump_process(), exit(), fd_manipulate(), fork(), futex_get_key(), get_parent_pid(), get_pid(), invalid_page_fault(), io_close(), io_dup(), io_dup2(), io_pread(), io_read(), io_readv(), io_seek(), io_tell(), io_write(), ipc_accept(), ipc_connect(), ipc_create(), memfd_create(), mm_dump_current_pagetable(), mmap_file(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), munmap(), platform_arch_syscall(), platform_context_setup_child_thread(), process_destroy(), process_do_execveat(), process_sysfs_process_stat(), process_wait_for_pid(), riscv64_trap_handler(), signal_do_coredump(), signal_do_terminate(), signal_exit_to_user_prepare(), signal_exit_to_user_prepare(), thread_get(), thread_wait_for_tid(), vfs_chdirat(), vfs_fstatat(), and vfs_ipc_file_read().
#define current_mm (current_cpu->mm_context) |
Definition at line 35 of file platform.hpp.
Referenced by dmabuf_allocate(), dmabuf_free(), mm_handle_fault(), mmap_anonymous(), mmap_file(), MOS_STATIC_ASSERT(), platform_context_setup_child_thread(), process_destroy(), and process_sysfs_vmap_stat().
#define MOS_KERNEL_PFN | ( | vaddr | ) |
Definition at line 121 of file platform.hpp.
Referenced by setup_sane_environment().
#define platform_alias | ( | name | ) |
Definition at line 136 of file platform.hpp.
Definition at line 37 of file platform.hpp.
typedef struct _platform_process_options platform_process_options_t |
Definition at line 125 of file platform.hpp.
typedef struct _platform_thread_options platform_thread_options_t |
Definition at line 126 of file platform.hpp.
typedef char datetime_str_t[32] |
Definition at line 167 of file platform.hpp.
typedef struct _sigreturn_data sigreturn_data_t |
Definition at line 245 of file platform.hpp.
enum thread_state_t |
Definition at line 42 of file platform.hpp.
Enumerator | |
---|---|
SWITCH_REGULAR | |
SWITCH_TO_NEW_USER_THREAD | |
SWITCH_TO_NEW_KERNEL_THREAD |
Definition at line 52 of file platform.hpp.
MOS_ENUM_FLAGS | ( | ContextSwitchBehavior | , |
ContextSwitchBehaviorFlags | ) |
Definition at line 130 of file kmain.cpp.
Referenced by limine_entry().
Definition at line 7 of file ap.cpp.
Referenced by ap_entry().
void platform_startup_early | ( | ) |
Definition at line 68 of file riscv64_platform.cpp.
Referenced by setup_sane_environment().
void platform_startup_setup_kernel_mm | ( | ) |
Definition at line 81 of file riscv64_platform.cpp.
Referenced by setup_sane_environment().
void platform_startup_late | ( | ) |
Definition at line 106 of file riscv64_platform.cpp.
Referenced by mos_start_kernel().
Definition at line 44 of file riscv64_platform_api.cpp.
Referenced by power_shutdown().
void platform_dump_regs | ( | const platform_regs_t * | regs | ) |
Definition at line 61 of file riscv64_platform_api.cpp.
Referenced by handle_kernel_panic(), invalid_page_fault(), x86_handle_exception(), and x86_handle_nmi().
void platform_dump_stack | ( | const platform_regs_t * | regs | ) |
Definition at line 301 of file riscv64_platform_api.cpp.
Referenced by handle_kernel_panic(), invalid_page_fault(), and x86_handle_exception().
void platform_dump_current_stack | ( | ) |
Definition at line 376 of file riscv64_platform_api.cpp.
Referenced by handle_kernel_panic(), and x86_handle_exception().
Definition at line 359 of file riscv64_platform_api.cpp.
Referenced by clock_gettimeofday(), and platform_get_datetime_str().
Definition at line 369 of file riscv64_platform_api.cpp.
Referenced by clock_gettimeofday().
Definition at line 66 of file mm.cpp.
Referenced by handle_kernel_panic(), mos_test_engine_run_tests(), and platform_ap_entry().
Definition at line 73 of file mm.cpp.
Referenced by pml1e_do_flag_callback(), pml1e_do_map_callback(), pml1e_do_mask_callback(), and pml1e_do_unmap_callback().
Definition at line 51 of file riscv64_platform_api.cpp.
Referenced by do_syslog(), enter_scheduler(), and platform_ap_entry().
Definition at line 56 of file riscv64_platform_api.cpp.
Referenced by idle_task(), and platform_shutdown().
Definition at line 354 of file riscv64_platform_api.cpp.
Referenced by do_syslog(), and SyslogStreamWriter::SyslogStreamWriter().
datetime_str_t * platform_get_datetime_str | ( | void | ) |
Definition at line 67 of file x86_platform_api.cpp.
Referenced by do_print_syslog().
Definition at line 142 of file riscv64_platform_api.cpp.
Referenced by idle_task().
Definition at line 136 of file riscv64_platform_api.cpp.
Referenced by handle_kernel_panic(), and platform_shutdown().
Definition at line 79 of file mm.cpp.
Referenced by pagetable_iter_next(), pagetable_iterator_start_current_range(), pml1e_do_copy_callback(), pml1e_do_unmap_callback(), and pml1e_get_pfn().
Definition at line 84 of file mm.cpp.
Referenced by pml1e_do_map_callback().
Definition at line 91 of file mm.cpp.
Referenced by pagetable_iter_next(), pagetable_iterator_start_current_range(), pml1e_do_copy_callback(), pml1e_do_flag_callback(), pml1e_do_mask_callback(), pml1e_do_unmap_callback(), and pml1e_is_present().
Definition at line 96 of file mm.cpp.
Referenced by pml1e_do_flag_callback(), pml1e_do_map_callback(), and pml1e_do_mask_callback().
VMFlags platform_pml1e_get_flags | ( | const pml1e_t * | pml1e | ) |
Definition at line 102 of file mm.cpp.
Referenced by mm_do_get_flags(), pagetable_iter_next(), pagetable_iterator_start_current_range(), and pml1e_do_mask_callback().
platform_regs_t * platform_thread_regs | ( | Thread * | thread | ) |
Definition at line 74 of file riscv64_platform_api.cpp.
Referenced by platform_arch_syscall(), platform_arch_syscall(), platform_context_clone(), platform_context_setup_child_thread(), platform_context_setup_main_thread(), riscv64_start_kernel_thread(), riscv64_start_user_thread(), x86_setup_thread_common(), x86_start_kernel_thread(), and x86_start_user_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 85 of file riscv64_platform_api.cpp.
Referenced by elf_do_fill_process().
void platform_context_setup_child_thread | ( | Thread * | thread, |
thread_entry_t | entry, | ||
void * | arg ) |
Definition at line 97 of file riscv64_platform_api.cpp.
Referenced by create_thread(), and kthread_create_no_sched().
Definition at line 117 of file riscv64_platform_api.cpp.
Referenced by process_do_fork().
Definition at line 130 of file riscv64_platform_api.cpp.
Referenced by process_do_execveat(), and thread_destroy().
Definition at line 148 of file riscv64_platform_api.cpp.
Referenced by mm_switch_context(), platform_ap_entry(), and setup_sane_environment().
void platform_switch_to_thread | ( | Thread * | current, |
Thread * | new_thread, | ||
ContextSwitchBehaviorFlags | switch_flags ) |
Definition at line 239 of file riscv64_platform_api.cpp.
Referenced by reschedule().
Definition at line 276 of file riscv64_platform_api.cpp.
Referenced by arch_syscall().
void platform_ipi_send | ( | u8 | target_cpu, |
ipi_type_t | type ) |
ptr< platform_regs_t > platform_setup_signal_handler_regs | ( | const platform_regs_t * | regs, |
const sigreturn_data_t * | sigreturn_data, | ||
const sigaction_t * | sa ) |
Definition at line 325 of file riscv64_platform_api.cpp.
Referenced by do_signal_exit_to_user_prepare().
Definition at line 342 of file riscv64_platform_api.cpp.
Referenced by MOS_STATIC_ASSERT().
void platform_syscall_setup_restart_context | ( | platform_regs_t * | regs, |
reg_t | syscall_nr ) |
Definition at line 314 of file riscv64_platform_api.cpp.
Referenced by signal_exit_to_user_prepare().
void platform_syscall_store_retval | ( | platform_regs_t * | regs, |
reg_t | result ) |
Definition at line 320 of file riscv64_platform_api.cpp.
Referenced by signal_exit_to_user_prepare().
|
extern |
Definition at line 31 of file kmain.cpp.
Referenced by setup_sane_environment().
|
extern |
Definition at line 66 of file riscv64_platform.cpp.
Referenced by add_to_memmap(), cmdline_get_option(), create_idle_task(), initrd_read(), limine_entry(), mm_create_context(), mm_destroy_context(), mm_dump_current_pagetable(), mm_sysfs_init(), mos_cmdline_init(), mos_start_kernel(), platform_ap_entry(), platform_startup_early(), platform_startup_late(), platform_startup_setup_kernel_mm(), pmm_find_reserved_region(), pmm_init(), Process::Process(), setup_sane_environment(), vmap_create(), x86_cpu_initialise_caps(), x86_paging_setup(), and x86_setup_direct_map().
|
extern |
Referenced by setup_sane_environment(), and x86_handle_exception().
const char __MOS_KERNEL_CODE_END[] |
Definition at line 129 of file platform.hpp.
Referenced by setup_sane_environment(), and x86_handle_exception().
|
extern |
Referenced by setup_sane_environment().
const char __MOS_KERNEL_RODATA_END[] |
Definition at line 130 of file platform.hpp.
Referenced by setup_sane_environment().
|
extern |
Referenced by setup_sane_environment().
const char __MOS_KERNEL_RW_END[] |
Definition at line 131 of file platform.hpp.
Referenced by setup_sane_environment().
|
extern |