MOS Source Code
Loading...
Searching...
No Matches
stdio_kernel_ext.c File Reference
#include "mos/assert.h"
#include "mos/misc/kallsyms.h"
#include "mos/platform/platform.h"
#include "mos/tasks/process.h"
#include "mos/tasks/task_types.h"
#include "mos/tasks/thread.h"
#include <mos/types.h>
#include <mos_stdio.h>
+ Include dependency graph for stdio_kernel_ext.c:

Go to the source code of this file.

Macros

#define current   (**pformat)
 
#define peek_next   (*(*pformat + 1))
 
#define shift_next   ((void) ((*pformat)++))
 
#define unshift_next   ((void) ((*pformat)--))
 
#define wrap_print(...)
 
#define wrap_printed(x)
 
#define null_check()
 

Functions

static size_t do_print_vmflags (char *buf, size_t size, vm_flags flags)
 
size_t vsnprintf_do_pointer_kernel (char *buf, size_t *size, const char **pformat, ptr_t ptr)
 Kernel's extension to vsnprintf, 'p' format specifier.
 

Macro Definition Documentation

◆ current

#define current   (**pformat)

◆ peek_next

#define peek_next   (*(*pformat + 1))

◆ shift_next

#define shift_next   ((void) ((*pformat)++))

◆ unshift_next

#define unshift_next   ((void) ((*pformat)--))

◆ wrap_print

#define wrap_print ( ...)
Value:
wrap_printed(snprintf(buf, *size, __VA_ARGS__))
int snprintf(char *__restrict str, size_t size, const char *__restrict format,...)
Definition mos_stdio.c:16
size_t size
Definition slab.c:30
#define wrap_printed(x)

Referenced by vsnprintf_do_pointer_kernel().

◆ wrap_printed

#define wrap_printed ( x)
Value:
do \
{ \
const size_t _printed = x; \
buf += _printed, ret += _printed; \
} while (0)

Referenced by vsnprintf_do_pointer_kernel().

◆ null_check

#define null_check ( )
Value:
do \
{ \
if (unlikely(ptr == 0)) \
{ \
wrap_print("(null)"); \
goto done; \
} \
} while (0)
#define unlikely(x)
Definition mos_global.h:40

Referenced by vsnprintf_do_pointer_kernel().

Function Documentation

◆ do_print_vmflags()

static size_t do_print_vmflags ( char * buf,
size_t size,
vm_flags flags )
static

Definition at line 13 of file stdio_kernel_ext.c.

Referenced by vsnprintf_do_pointer_kernel().

+ Here is the call graph for this function:

◆ vsnprintf_do_pointer_kernel()

size_t vsnprintf_do_pointer_kernel ( char * buf,
size_t * size,
const char ** pformat,
ptr_t ptr )

Kernel's extension to vsnprintf, 'p' format specifier.

Supported extensions are listed below:

'ps' prints a kernel symbol name, with offset if applicable. e.g. "do_fork (+0x123)" 'pt' prints a thread_t object. e.g.: "[p123:my_process]" 'pp' prints a process_t object. e.g.: "[t123:my_thread]" 'pvf' prints vm_flags_t flag, only the r/w/x bits are printed for general purpose. e.g.: "rwx" / "r--" / "rw-" / "--x" 'pvm' prints a vmap_t object. e.g.: "{ 0x123000-0x123fff, rwx, on_fault=0x12345678 }" 'pio' prints an io_t object. e.g.: "{ 'file.txt', offset=0x12345678 }"

Returns
true if the format specifier is handled, false otherwise, the caller should fallback to the default implementation. (i.e. p)

Definition at line 41 of file stdio_kernel_ext.c.

Referenced by vsnprintf().

+ Here is the call graph for this function: