MOS Source Code
|
Go to the source code of this file.
Macros | |
#define | MOS_STATIC_ASSERT _Static_assert |
#define | __BEGIN_DECLS |
#define | __END_DECLS |
#define | __aligned(x) |
#define | __malloc __attribute__((__malloc__)) |
#define | __packed __attribute__((__packed__)) |
#define | __printf(a, b) |
#define | __pure __attribute__((__pure__)) |
#define | __section(S) |
#define | __maybe_unused __attribute__((__unused__)) |
#define | __used __attribute__((__used__)) |
#define | __nodiscard __attribute__((__warn_unused_result__)) |
#define | should_inline __maybe_unused static inline |
#define | likely(x) |
#define | unlikely(x) |
#define | __types_compatible(a, b) |
#define | do_container_of(ptr, type, member) |
#define | container_of(ptr, type, member) |
#define | cast_to(value, valtype, desttype) |
#define | is_aligned(ptr, alignment) |
#define | GET_BIT(x, n) |
#define | MASK_BITS(value, width) |
#define | SET_BITS(bit, width, value) |
#define | MOS_STRINGIFY2(x) |
#define | MOS_STRINGIFY(x) |
#define | MOS_UNUSED(x) |
#define | MOS_CONCAT_INNER(a, b) |
#define | MOS_CONCAT(a, b) |
#define | MOS_WARNING_PUSH MOS_PRAGMA(diagnostic push) |
#define | MOS_WARNING_POP MOS_PRAGMA(diagnostic pop) |
#define | MOS_WARNING_DISABLE(text) |
#define | ALIGN_UP(addr, size) |
#define | ALIGN_DOWN(addr, size) |
#define | ALIGN_UP_TO_PAGE(addr) |
#define | ALIGN_DOWN_TO_PAGE(addr) |
#define | MOS_IN_RANGE(addr, start, end) |
#define | MOS_FOURCC(a, b, c, d) |
#define | MOS_ARRAY_SIZE(x) |
#define | MOS_MAX_VADDR ((ptr_t) ~0) |
#define | READ_ONCE(x) |
#define | KB * 1024 |
#define | MB * 1024 KB |
#define | GB * (u64) 1024 MB |
#define | TB * (u64) 1024 GB |
#define | statement_expr(type, ...) |
#define | __NO_OP(...) |
#define | BIT(x) |
#define | MOSAPI extern |
#define | MOS_CONFIG(feat) |
#define | MOS_DEBUG_FEATURE(feat) |
#define | once() |
Returns true for the first call, false for all subsequent calls. | |
#define | MOS_PUT_IN_SECTION(_section, _struct, _var, ...) |
#define | IS_ERR_VALUE(x) |
#define | MOS_STUB_IMPL(...) |
#define | MOS_ENUM_OPERATORS(_enum) |
Functions | |
__attribute__ ((__warn_unused_result__)) __attribute__((__unused__)) static inlinevoid *ERR_PTR(long error) | |
__attribute__ ((__deprecated__("reconsider if a NULL check is really required"))) __attribute__((__warn_unused_result__)) __attribute__((__unused__)) static inlinebool IS_ERR_OR_NULL(const void *ptr) | |
#define MOS_STATIC_ASSERT _Static_assert |
Definition at line 14 of file mos_global.h.
#define __BEGIN_DECLS |
Definition at line 22 of file mos_global.h.
#define __END_DECLS |
Definition at line 23 of file mos_global.h.
#define __aligned | ( | x | ) |
Definition at line 27 of file mos_global.h.
#define __malloc __attribute__((__malloc__)) |
Definition at line 28 of file mos_global.h.
#define __packed __attribute__((__packed__)) |
Definition at line 29 of file mos_global.h.
Referenced by ioapic_init(), ioapic_read_redirection_entry(), and ioapic_write_redirection_entry().
#define __printf | ( | a, | |
b ) |
Definition at line 30 of file mos_global.h.
#define __pure __attribute__((__pure__)) |
Definition at line 31 of file mos_global.h.
#define __section | ( | S | ) |
Definition at line 32 of file mos_global.h.
#define __maybe_unused __attribute__((__unused__)) |
Definition at line 33 of file mos_global.h.
#define __used __attribute__((__used__)) |
Definition at line 34 of file mos_global.h.
#define __nodiscard __attribute__((__warn_unused_result__)) |
Definition at line 35 of file mos_global.h.
#define should_inline __maybe_unused static inline |
Definition at line 37 of file mos_global.h.
#define likely | ( | x | ) |
Definition at line 39 of file mos_global.h.
Referenced by enter_scheduler(), mm_replace_page_locked(), process_allocate(), reschedule(), slab_alloc(), and userfs_ensure_connected().
#define unlikely | ( | x | ) |
Definition at line 40 of file mos_global.h.
Referenced by __attribute__(), buddy_alloc_n_exact(), cmdline_string_truthiness(), cpio_i_iterate_dir(), cpio_mount(), cpio_read_metadata(), dentry_lookup_child(), dentry_resolve_lastseg(), dentry_resolve_to_parent(), do_invoke_setup(), fork(), format_size(), futex_wake(), initrd_read(), io_init(), io_mmap(), io_mmap_perm_check(), io_munmap(), io_pread(), io_read(), io_ref(), io_seek(), io_unref(), io_write(), ipc_read_as_msg(), ipc_write_as_msg(), lvprintk(), madt_parse_table(), mm_clone_vmap_locked(), mm_map_user_pages(), mm_replace_page_locked(), mos_start_kernel(), munmap(), parse_printf_flags(), printf_cs(), printf_diouxX(), process_allocate(), process_detach_fd(), process_do_execveat(), process_do_fork(), process_exit(), process_new(), rpc_simple_callv(), slab_allocate_mem(), stack_grow(), stack_pop(), stack_push(), sysfs_register_file(), try_handle_kernel_panics_at(), userfs_ensure_connected(), vfs_list_dir(), vfs_mount(), x86_dump_stack_at(), x86_interrupt_entry(), and zero_page().
#define __types_compatible | ( | a, | |
b ) |
Definition at line 42 of file mos_global.h.
#define do_container_of | ( | ptr, | |
type, | |||
member ) |
Definition at line 43 of file mos_global.h.
#define container_of | ( | ptr, | |
type, | |||
member ) |
Definition at line 50 of file mos_global.h.
Referenced by acpi_sysfs_mmap(), console_io_read(), console_io_write(), CPIO_INODE(), dentry_from_fd(), do_iterate_sdts(), ipc_accept(), ipc_client_io_close(), ipc_client_io_read(), ipc_client_io_write(), ipc_control_io_close(), ipc_server_io_close(), ipc_server_io_read(), ipc_server_io_write(), madt_parse_table(), naive_sched_add_thread(), naive_sched_init(), naive_sched_remove_thread(), naive_sched_select_next(), pipeio_io_close(), pipeio_io_read(), pipeio_io_write(), riscv64_uart_setup(), serial_console_clear(), serial_console_get_color(), serial_console_irq_handler(), serial_console_set_color(), serial_console_setup(), serial_console_write(), sysfs_iops_create(), sysfs_iops_iterate_dir(), sysfs_iops_lookup(), vfs_fault_handler(), vfs_fstatat(), vfs_fsync(), vfs_io_ops_close(), vfs_io_ops_close_dir(), vfs_io_ops_getname(), vfs_io_ops_mmap(), vfs_io_ops_munmap(), vfs_io_ops_read(), vfs_io_ops_seek(), vfs_io_ops_write(), and vfs_list_dir().
#define cast_to | ( | value, | |
valtype, | |||
desttype ) |
Definition at line 53 of file mos_global.h.
Referenced by platform_pml1e_get_flags(), platform_pml1e_get_pfn(), platform_pml1e_get_present(), platform_pml1e_get_present(), platform_pml1e_set_flags(), platform_pml1e_set_flags(), platform_pml1e_set_pfn(), platform_pml1e_set_pfn(), platform_pml2e_get_flags(), platform_pml2e_get_huge_pfn(), platform_pml2e_get_pml1(), platform_pml2e_get_pml1(), platform_pml2e_get_present(), platform_pml2e_get_present(), platform_pml2e_is_huge(), platform_pml2e_set_flags(), platform_pml2e_set_flags(), platform_pml2e_set_huge(), platform_pml2e_set_pml1(), platform_pml2e_set_pml1(), platform_pml3e_get_flags(), platform_pml3e_get_huge_pfn(), platform_pml3e_get_pml2(), platform_pml3e_get_pml2(), platform_pml3e_get_present(), platform_pml3e_get_present(), platform_pml3e_is_huge(), platform_pml3e_set_flags(), platform_pml3e_set_flags(), platform_pml3e_set_huge(), platform_pml3e_set_pml2(), platform_pml3e_set_pml2(), platform_pml4e_get_flags(), platform_pml4e_get_pml3(), platform_pml4e_get_pml3(), platform_pml4e_get_present(), platform_pml4e_get_present(), platform_pml4e_set_flags(), platform_pml4e_set_flags(), platform_pml4e_set_pml3(), and platform_pml4e_set_pml3().
#define is_aligned | ( | ptr, | |
alignment ) |
Definition at line 55 of file mos_global.h.
Referenced by __ubsan_handle_type_mismatch(), platform_dump_stack(), slab_free(), and slab_realloc().
#define GET_BIT | ( | x, | |
n ) |
Definition at line 57 of file mos_global.h.
#define MASK_BITS | ( | value, | |
width ) |
Definition at line 58 of file mos_global.h.
Referenced by gdt_set_entry().
#define SET_BITS | ( | bit, | |
width, | |||
value ) |
Definition at line 59 of file mos_global.h.
Referenced by lapic_interrupt_full().
#define MOS_STRINGIFY2 | ( | x | ) |
Definition at line 61 of file mos_global.h.
#define MOS_STRINGIFY | ( | x | ) |
Definition at line 62 of file mos_global.h.
#define MOS_UNUSED | ( | x | ) |
Definition at line 64 of file mos_global.h.
Referenced by __cxa_atexit(), _process_do_print(), _thread_do_print(), acpi_sysfs_munmap(), cmdline_dynamic_array_insert(), cow_zod_fault_handler(), create_idle_task(), dispatch_syscall(), dmabuf_free(), elf_determine_loadbias(), elf_do_fill_process(), get_ansi_color(), idle_task(), invalid_page_fault(), io_pselect(), ipc_dump_name_waitlist(), ipc_sysfs_create_server(), ipc_sysfs_list_ipcs(), ipc_sysfs_lookup_ipc(), mmstat_sysfs_phyframe_stat_store(), mmstat_sysfs_store_pid(), mos_test_engine_run_tests(), mutex_release(), operator delete(), operator delete[](), platform_ap_entry(), platform_arch_syscall(), platform_context_cleanup(), platform_dump_regs(), platform_dump_stack(), platform_dump_thread_kernel_stack(), platform_get_time(), platform_invalidate_tlb(), platform_ipi_send(), platform_jump_to_signal_handler(), platform_pml2e_set_pml1(), platform_pml2e_set_pml1(), platform_pml3e_set_pml2(), platform_pml3e_set_pml2(), platform_pml4e_set_pml3(), platform_pml4e_set_pml3(), platform_restore_from_signal_handler(), platform_syscall_setup_restart_context(), platform_syscall_store_retval(), pml1e_do_copy_callback(), pml1e_do_flag_callback(), pml1e_do_map_callback(), pml1e_do_mask_callback(), pml1e_do_unmap_callback(), pml2e_do_copy_callback(), pml2e_do_flag_callback(), pml2e_do_map_callback(), pml2e_do_unmap_callback(), pml3_entry(), pml3e_do_copy_callback(), pml3e_do_flag_callback(), pml3e_do_map_callback(), pml3e_do_unmap_callback(), pml4_entry(), pml4e_do_copy_callback(), pml4e_do_flag_callback(), pml4e_do_map_callback(), pml4e_do_unmap_callback(), pml5_entry(), pml5e_is_present(), process_do_execveat(), reschedule(), rtc_irq_handler(), sbi_console_clear(), sbi_console_get_color(), sbi_console_set_color(), sbi_console_write(), serial_console_irq_handler(), simple_flush_page_discard_data(), simple_page_write_begin(), simple_page_write_end(), stat_receiver(), sys_mem_mmap(), sys_mem_munmap(), sysfs_fops_mmap(), sysfs_fops_open(), test_foreach_function(), test_foreach_stop_at_quux(), thread_wait_for_tid(), timer_do_wakeup(), tmpfs_fill_cache(), tmpfs_i_hardlink(), tmpfs_i_rename(), tmpfs_i_rmdir(), tmpfs_i_unlink(), userfs_fop_open(), userfs_iop_hardlink(), userfs_iop_mkdir(), userfs_iop_mknode(), userfs_iop_rename(), userfs_iop_rmdir(), userfs_iop_symlink(), userfs_manager_server_exec(), vfs_do_open_dentry(), vfs_flusher_entry(), vfs_generic_inode_drop(), vfs_ipc_file_read(), vfs_ipc_file_write(), vfs_open_ipc(), vfs_simple_write_begin(), vfs_verify_permissions(), x86_keyboard_handler(), and x86_pit_timer_handler().
#define MOS_CONCAT_INNER | ( | a, | |
b ) |
Definition at line 66 of file mos_global.h.
#define MOS_CONCAT | ( | a, | |
b ) |
Definition at line 67 of file mos_global.h.
#define MOS_WARNING_PUSH MOS_PRAGMA(diagnostic push) |
Definition at line 69 of file mos_global.h.
Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().
#define MOS_WARNING_POP MOS_PRAGMA(diagnostic pop) |
Definition at line 70 of file mos_global.h.
Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().
#define MOS_WARNING_DISABLE | ( | text | ) |
Definition at line 71 of file mos_global.h.
Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().
#define ALIGN_UP | ( | addr, | |
size ) |
Definition at line 73 of file mos_global.h.
Referenced by cpio_i_iterate_dir(), elf_setup_main_thread(), platform_startup_setup_kernel_mm(), slab_allocate_mem(), and x86_setup_direct_map().
#define ALIGN_DOWN | ( | addr, | |
size ) |
Definition at line 74 of file mos_global.h.
#define ALIGN_UP_TO_PAGE | ( | addr | ) |
Definition at line 75 of file mos_global.h.
Referenced by acpi_sysfs_mmap(), dmabuf_share(), dmabuf_unshare(), elf_map_segment(), ipc_connect_to_server(), limine_entry(), mmap_anonymous(), mmap_file(), mos_start_kernel(), munmap(), pagetable_do_dump(), pipe_create(), pmm_init(), register_sysfs_acpi_node(), register_sysfs_acpi_rsdp(), slab_alloc(), slab_realloc(), thread_new(), vfs_fsync(), and vm_protect().
#define ALIGN_DOWN_TO_PAGE | ( | addr | ) |
Definition at line 76 of file mos_global.h.
Referenced by elf_map_segment(), mm_do_get_flags(), mm_do_get_pfn(), mm_do_get_present(), mm_replace_page_locked(), munmap(), slab_free(), slab_realloc(), and vfs_fault_handler().
#define MOS_IN_RANGE | ( | addr, | |
start, | |||
end ) |
Definition at line 78 of file mos_global.h.
Referenced by elf_do_fill_process(), mm_handle_fault(), and x86_handle_exception().
#define MOS_FOURCC | ( | a, | |
b, | |||
c, | |||
d ) |
Definition at line 80 of file mos_global.h.
#define MOS_ARRAY_SIZE | ( | x | ) |
Definition at line 81 of file mos_global.h.
Referenced by break_the_order(), buddy_alloc_n_exact(), buddy_dump_all(), buddy_init(), format_size(), slab_for(), slab_init(), try_merge(), userfs_manager_server_exec(), and x86_cpu_setup_xsave_area().
#define MOS_MAX_VADDR ((ptr_t) ~0) |
Definition at line 83 of file mos_global.h.
#define READ_ONCE | ( | x | ) |
Definition at line 85 of file mos_global.h.
Referenced by riscv64_serial_read_register().
#define KB * 1024 |
Definition at line 88 of file mos_global.h.
Referenced by invalid_page_fault(), limine_entry(), and x86_dump_stack_at().
#define MB * 1024 KB |
Definition at line 89 of file mos_global.h.
Referenced by __mos_test_wrapped_test_kmalloc_large(), add_to_memmap(), and x86_setup_direct_map().
Definition at line 90 of file mos_global.h.
Referenced by platform_startup_setup_kernel_mm(), and x86_setup_direct_map().
Definition at line 91 of file mos_global.h.
#define statement_expr | ( | type, | |
... ) |
Definition at line 92 of file mos_global.h.
Referenced by dentry_resolve_to_parent(), pipeio_io_close(), platform_switch_to_thread(), and reschedule().
#define __NO_OP | ( | ... | ) |
Definition at line 95 of file mos_global.h.
#define BIT | ( | x | ) |
Definition at line 97 of file mos_global.h.
Referenced by lapic_wait_sent(), riscv64_trap_handler(), x86_cpu_initialise_caps(), and x86_cpu_setup_xsave_area().
#define MOSAPI extern |
Definition at line 102 of file mos_global.h.
#define MOS_CONFIG | ( | feat | ) |
Definition at line 107 of file mos_global.h.
#define MOS_DEBUG_FEATURE | ( | feat | ) |
Definition at line 109 of file mos_global.h.
#define once | ( | ) |
Returns true for the first call, false for all subsequent calls.
Definition at line 114 of file mos_global.h.
Referenced by lapic_enable(), print_to_console(), and try_handle_kernel_panics_at().
#define MOS_PUT_IN_SECTION | ( | _section, | |
_struct, | |||
_var, | |||
... ) |
Definition at line 125 of file mos_global.h.
#define IS_ERR_VALUE | ( | x | ) |
Definition at line 126 of file mos_global.h.
Referenced by __attribute__(), dmabuf_alloc(), dmabuf_share(), do_flush_and_drop_cached_page(), io_readv(), ksyscall_enter(), mos_start_kernel(), rpc_client_create(), rpc_server_create(), rpc_server_destroy(), rpc_server_exec(), vfs_io_ops_read(), vfs_io_ops_write(), and vfs_ipc_file_read().
#define MOS_STUB_IMPL | ( | ... | ) |
Definition at line 153 of file mos_global.h.
#define MOS_ENUM_OPERATORS | ( | _enum | ) |
Definition at line 173 of file mos_global.h.
__attribute__ | ( | (__warn_unused_result__) | ) |
Definition at line 128 of file mos_global.h.
__attribute__ | ( | (__deprecated__("reconsider if a NULL check is really required")) | ) | const |
Definition at line 148 of file mos_global.h.