summaryrefslogtreecommitdiff
path: root/include/klib.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-03-25 17:36:52 -0400
committerFreya Murphy <freya@freyacat.org>2025-03-25 17:38:22 -0400
commit6af21e6a4f2251e71353562d5df7f376fdffc270 (patch)
treede20c7afc9878422c81e34f30c6b010075e9e69a /include/klib.h
downloadcomus-6af21e6a4f2251e71353562d5df7f376fdffc270.tar.gz
comus-6af21e6a4f2251e71353562d5df7f376fdffc270.tar.bz2
comus-6af21e6a4f2251e71353562d5df7f376fdffc270.zip
initial checkout from wrc
Diffstat (limited to 'include/klib.h')
-rw-r--r--include/klib.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/klib.h b/include/klib.h
new file mode 100644
index 0000000..c1d270c
--- /dev/null
+++ b/include/klib.h
@@ -0,0 +1,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