summaryrefslogtreecommitdiff
path: root/kernel/old/include/klib.h
blob: c1d270ca15af91d7a389f37c9572824c91f98402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
** @file    klib.h
**
** @author  Warren R. Carithers
**
** Additional support functions for the kernel.
*/

#ifndef KLIB_H_
#define KLIB_H_

#include <common.h>

#ifndef ASM_SRC

#include <x86/ops.h>

/**
** Name:    put_char_or_code( ch )
**
** Description: Prints a character on the console, unless it
** is a non-printing character, in which case its hex code
** is printed
**
** @param ch    The character to be printed
*/
void put_char_or_code( int ch );

/**
** Name:    backtrace
**
** Perform a simple stack backtrace. Could be augmented to use the
** symbol table to print function/variable names, etc., if so desired.
**
** @param ebp   Initial EBP to use
** @param args  Number of function argument values to print
*/
void backtrace( uint32_t *ebp, uint_t args );

/**
** Name:	kpanic
**
** Kernel-level panic routine
**
** usage:  kpanic( msg )
**
** Prefix routine for panic() - can be expanded to do other things
** (e.g., printing a stack traceback)
**
** @param msg[in]  String containing a relevant message to be printed,
**                 or NULL
*/
void kpanic( const char *msg );

#endif  /* !ASM_SRC */

#endif