MOS Source Code
Loading...
Searching...
No Matches
panic.hpp File Reference
#include "mos/platform/platform_defs.hpp"
#include "mos/syslog/printk.hpp"
#include <mos/types.h>
#include <stdarg.h>
+ Include dependency graph for panic.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  panic_hook_t
 
struct  panic_point_t
 

Macros

#define MOS_EMIT_PANIC_HOOK(e, f, n)
 
#define MOS_PANIC_HOOK_FEAT(_feat, _f, _n)
 
#define MOS_PANIC_HOOK(_f, _name)
 
#define MOS_MAKE_PANIC_POINT(panic_instruction, file, func, line)
 
#define mos_panic(fmt, ...)
 
#define mos_panic_inline(fmt, ...)
 

Typedefs

typedef void kmsg_handler_t(const char *func, u32 line, const char *fmt, va_list args)
 

Functions

 MOS_STATIC_ASSERT (sizeof(panic_hook_t)==32, "panic_hook_t size mismatch")
 
void kwarn_handler_set (kmsg_handler_t *handler)
 
void kwarn_handler_remove (void)
 
void mos_kwarn (const char *func, u32 line, const char *fmt,...)
 
void try_handle_kernel_panics (ptr_t ip)
 
void handle_kernel_panic (const panic_point_t *point)
 

Macro Definition Documentation

◆ MOS_EMIT_PANIC_HOOK

#define MOS_EMIT_PANIC_HOOK ( e,
f,
n )
Value:
MOS_PUT_IN_SECTION(".mos.panic_hooks", panic_hook_t, f##_hook, { .enabled = e, .hook = f, .name = n })
#define MOS_PUT_IN_SECTION(_section, _struct, _var,...)
Definition mos_global.h:135
#define f(_fmt)
Definition syslog.hpp:160

Definition at line 30 of file panic.hpp.

◆ MOS_PANIC_HOOK_FEAT

#define MOS_PANIC_HOOK_FEAT ( _feat,
_f,
_n )
Value:
#define mos_debug_enabled_ptr(name)
Definition debug.hpp:88
#define MOS_EMIT_PANIC_HOOK(e, f, n)
Definition panic.hpp:30

Definition at line 32 of file panic.hpp.

◆ MOS_PANIC_HOOK

#define MOS_PANIC_HOOK ( _f,
_name )
Value:
#define NULL
Definition pb_syshdr.h:46

Definition at line 33 of file panic.hpp.

◆ MOS_MAKE_PANIC_POINT

#define MOS_MAKE_PANIC_POINT ( panic_instruction,
file,
func,
line )
Value:
__asm__ volatile("1: " panic_instruction "\n\t" \
".pushsection .mos.panic_list,\"aw\"\n\t" MOS_PLATFORM_PANIC_POINT_ASM ".popsection\n\t" \
"\n\t" \
: \
: "i"(file), "i"(func), "i"(line) \
: "memory")
#define MOS_PLATFORM_PANIC_POINT_ASM

Definition at line 43 of file panic.hpp.

◆ mos_panic

◆ mos_panic_inline

#define mos_panic_inline ( fmt,
... )
Value:
do \
{ \
pr_emerg(fmt, ##__VA_ARGS__); \
static const panic_point_t point = { .ip = 0, .file = __FILE__, .func = __func__, .line = __LINE__ }; \
handle_kernel_panic(&point); \
} while (0)

Definition at line 59 of file panic.hpp.

Referenced by mos::__raise_bad_ptrresult_value(), and mos::__raise_null_pointer_exception().

Typedef Documentation

◆ kmsg_handler_t

typedef void kmsg_handler_t(const char *func, u32 line, const char *fmt, va_list args)

Definition at line 11 of file panic.hpp.

Function Documentation

◆ MOS_STATIC_ASSERT()

MOS_STATIC_ASSERT ( sizeof(panic_hook_t) = =32,
"panic_hook_t size mismatch"  )

◆ kwarn_handler_set()

void kwarn_handler_set ( kmsg_handler_t * handler)

Definition at line 37 of file panic.cpp.

Referenced by mos_test_engine_run_tests().

◆ kwarn_handler_remove()

void kwarn_handler_remove ( void )

Definition at line 43 of file panic.cpp.

Referenced by mos_test_engine_run_tests().

◆ mos_kwarn()

void mos_kwarn ( const char * func,
u32 line,
const char * fmt,
... )

Definition at line 164 of file panic.cpp.

◆ try_handle_kernel_panics()

void try_handle_kernel_panics ( ptr_t ip)

Definition at line 68 of file panic.cpp.

Referenced by riscv64_trap_handler(), and x86_handle_exception().

+ Here is the call graph for this function:

◆ handle_kernel_panic()

void handle_kernel_panic ( const panic_point_t * point)

Definition at line 79 of file panic.cpp.

Referenced by try_handle_kernel_panics().

+ Here is the call graph for this function: