MonkOS  v0.1
A simple 64-bit operating system (x86_64)
dump.c File Reference

Debugging memory and CPU state dump routines. More...

#include <libc/stdio.h>
#include <kernel/debug/dump.h>

Go to the source code of this file.

Macros

#define B(F)   ((rflags & F) ? 1 : 0)
 

Functions

int dump_registers (char *buf, size_t bufsize, const registers_t *regs)
 Dump the contents of a CPU registers structure to a string buffer. More...
 
int dump_cpuflags (char *buf, size_t bufsize, uint64_t rflags)
 Dump the contents of the CPU flags register. More...
 
int dump_memory (char *buf, size_t bufsize, const void *mem, size_t memsize, enum dumpstyle style)
 Dump the contents of memory. More...
 

Variables

static const char digit [] = "0123456789abcdef"
 

Detailed Description

Debugging memory and CPU state dump routines.

Definition in file dump.c.

Macro Definition Documentation

#define B (   F)    ((rflags & F) ? 1 : 0)

Referenced by dump_cpuflags().

Function Documentation

int dump_registers ( char *  buf,
size_t  bufsize,
const registers_t regs 
)

Dump the contents of a CPU registers structure to a string buffer.

Parameters
[in]bufPointer to the character buffer to hold the resulting null-terminated string.
[in]bufsizeSize of the buffer used to hold the string.
[in]regsPointer to a CPU registers structure.
Returns
The number of characters that would have been written to the buffer if n had been sufficiently large.

Definition at line 16 of file dump.c.

Referenced by dump_context().

int dump_cpuflags ( char *  buf,
size_t  bufsize,
uint64_t  rflags 
)

Dump the contents of the CPU flags register.

Parameters
[in]bufPointer to the character buffer to hold the resulting null-terminated string.
[in]bufsizeSize of the buffer used to hold the string.
[in]rflagsThe 64-bit rflags register value.
Returns
The number of characters that would have been written to the buffer if n had been sufficiently large.

Definition at line 33 of file dump.c.

Referenced by dump_context().

int dump_memory ( char *  buf,
size_t  bufsize,
const void *  mem,
size_t  memsize,
enum dumpstyle  style 
)

Dump the contents of memory.

Parameters
[in]bufPointer to the character buffer to hold the resulting null-terminated string.
[in]bufsizeSize of the buffer used to hold the string.
[in]memPointer to the first byte of memory to dump.
[in]memsizeNumber of memory bytes to dump.
[in]styleThe output style used for the memory dump.
Returns
The number of characters that would have been written to the buffer if n had been sufficiently large.

Definition at line 50 of file dump.c.

Referenced by dump_context().

Variable Documentation

const char digit[] = "0123456789abcdef"
static

Definition at line 13 of file dump.c.

Referenced by dump_memory().