summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-02-01 12:48:55 -0500
committerFreya Murphy <freya@freyacat.org>2024-02-01 12:49:44 -0500
commit192a4ccd6bbc2239f047f782a05e888990011e51 (patch)
tree2b3d8a194d3dd33a5d344b4ec6376dbdfdb3eb0c /include
parentundo bad decisions (diff)
downloadcorn-192a4ccd6bbc2239f047f782a05e888990011e51.tar.gz
corn-192a4ccd6bbc2239f047f782a05e888990011e51.tar.bz2
corn-192a4ccd6bbc2239f047f782a05e888990011e51.zip
acpi, fix mboot memory map, fix kalloc, fix virtalloc node allocator, add kprintf, other changes
Diffstat (limited to 'include')
-rw-r--r--include/lib.h52
-rw-r--r--include/serial.h2
-rw-r--r--include/shim.h6
3 files changed, 52 insertions, 8 deletions
diff --git a/include/lib.h b/include/lib.h
index 1b6d1f4..3be1f8b 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -1,5 +1,6 @@
#pragma once
+#include <stdarg.h>
#include <stddef.h>
/**
@@ -109,7 +110,7 @@ long long int atoll(const char* s);
/**
* Converts a integer to asci inside a string with a given radix (base).
- * @param n - the number to conver
+ * @param n - the number to conver
* @param buffer - the string buffer
* @param radix - the base to convert
*/
@@ -117,15 +118,23 @@ char *itoa(int n, char *buffer, int radix);
/**
* Converts a long to asci inside a string with a given radix (base).
- * @param n - the number to conver
+ * @param n - the number to conver
* @param buffer - the string buffer
* @param radix - the base to convert
*/
char *ltoa(long int n, char *buffer, int radix);
/**
+ * Converts a long long to asci inside a string with a given radix (base).
+ * @param n - the number to conver
+ * @param buffer - the string buffer
+ * @param radix - the base to convert
+ */
+char *lltoa(long long int n, char *buffer, int radix);
+
+/**
* Converts a unsigned integer to asci inside a string with a given radix (base).
- * @param n - the number to conver
+ * @param n - the number to conver
* @param buffer - the string buffer
* @param radix - the base to convert
*/
@@ -133,13 +142,21 @@ char *utoa(unsigned int n, char *buffer, int radix);
/**
* Converts a unsigned long to asci inside a string with a given radix (base).
- * @param n - the number to conver
+ * @param n - the number to conver
* @param buffer - the string buffer
* @param radix - the base to convert
*/
char *ultoa(unsigned long int n, char *buffer, int radix);
/**
+ * Converts a unsigned long long to asci inside a string with a given radix (base).
+ * @param n - the number to conver
+ * @param buffer - the string buffer
+ * @param radix - the base to convert
+ */
+char *ulltoa(unsigned long long int n, char *buffer, int radix);
+
+/**
* Converts the string in str to an int value based on the given base.
* The endptr is updated to where the string was no longer valid.
* @param str - the string buffer
@@ -168,3 +185,30 @@ long int strtol(const char *str, char **endptr, int base);
* @returns 0 on error or success, error if endptr is still equal to str
*/
long long int strtoll(const char *str, char **endptr, int base);
+
+/**
+ * Prints out a char
+ * @param c - the char
+ */
+void kputc(char c);
+
+/**
+ * Prints out a null terminated string
+ * @param s - the string
+ */
+void kputs(const char *s);
+
+/**
+ * Prints out a formatted string
+ * @param format - the format string
+ * @param ... - variable args for the format
+ */
+void kvprintf(const char *format, va_list args);
+
+/**
+ * Prints out a formatted string
+ * @param format - the format string
+ * @param ... - variable args for the format
+ */
+__attribute__((format(printf, 1, 2)))
+void kprintf(const char *format, ...);
diff --git a/include/serial.h b/include/serial.h
index a7da91c..7587d74 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -5,4 +5,4 @@
int serial_init(void);
uint8_t serial_in(void);
void serial_out(uint8_t ch);
-void serial_out_str(char *str);
+void serial_out_str(const char *str);
diff --git a/include/shim.h b/include/shim.h
index dc8c19c..7178a0f 100644
--- a/include/shim.h
+++ b/include/shim.h
@@ -2,7 +2,8 @@
#include <memory.h>
-#define CMDLINE_MAX 32
+#define CMDLINE_MAX 32
+#define MMAP_MAX_ENTRY 64
struct memory_segment {
uint64_t addr;
@@ -12,8 +13,7 @@ struct memory_segment {
struct memory_map {
uint32_t entry_count;
- uint32_t entry_length;
- struct memory_segment *entries;
+ struct memory_segment entries[MMAP_MAX_ENTRY];
};
struct boot_info {