MOS Source Code
Loading...
Searching...
No Matches
panic.h File Reference
#include "mos/platform/platform_defs.h"
#include "mos/syslog/printk.h"
#include <mos/types.h>
#include <stdarg.h>
+ Include dependency graph for panic.h:
+ 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)
 
 __BEGIN_DECLS (3, 4) void mos_kwarn(const char *func
 
u32 const char void try_handle_kernel_panics (ptr_t ip)
 
void try_handle_kernel_panics_at (const panic_point_t *point)
 

Variables

u32 line
 
u32 const char * fmt
 

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:125

Definition at line 30 of file panic.h.

◆ MOS_PANIC_HOOK_FEAT

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

Definition at line 32 of file panic.h.

◆ MOS_PANIC_HOOK

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

Definition at line 33 of file panic.h.

◆ 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")
u32 line
Definition panic.h:40
#define MOS_PLATFORM_PANIC_POINT_ASM

Definition at line 47 of file panic.h.

◆ 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__, .line = __LINE__, .func = __func__ }; \
try_handle_kernel_panics_at(&point); \
} while (0)

Definition at line 63 of file panic.h.

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.h.

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 36 of file panic.c.

Referenced by mos_test_engine_run_tests().

◆ kwarn_handler_remove()

void kwarn_handler_remove ( void )

Definition at line 42 of file panic.c.

Referenced by mos_test_engine_run_tests().

◆ __BEGIN_DECLS()

__BEGIN_DECLS ( 3 ,
4  ) const

◆ try_handle_kernel_panics()

u32 const char void try_handle_kernel_panics ( ptr_t ip)

Definition at line 67 of file panic.c.

Referenced by riscv64_trap_handler(), and x86_handle_exception().

+ Here is the call graph for this function:

◆ try_handle_kernel_panics_at()

void try_handle_kernel_panics_at ( const panic_point_t * point)

Definition at line 78 of file panic.c.

Referenced by try_handle_kernel_panics().

+ Here is the call graph for this function:

Variable Documentation

◆ line

u32 line

Definition at line 40 of file panic.h.

◆ fmt

u32 const char* fmt

Definition at line 40 of file panic.h.