summaryrefslogtreecommitdiff
path: root/bootstrap/stage1/include
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/stage1/include')
-rw-r--r--bootstrap/stage1/include/alloc.h28
-rw-r--r--bootstrap/stage1/include/bprintf.h28
-rw-r--r--bootstrap/stage1/include/tty.h38
3 files changed, 94 insertions, 0 deletions
diff --git a/bootstrap/stage1/include/alloc.h b/bootstrap/stage1/include/alloc.h
new file mode 100644
index 0000000..088b389
--- /dev/null
+++ b/bootstrap/stage1/include/alloc.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+ *
+ * This file is part of BoxOS, a free and open-source Unix-like operating
+ * system.
+ *
+ * BoxOS is free software; you can redistribute it and/or modify under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * BoxOS; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef BOOTSTRAP_ALLOC_H
+#define BOOTSTRAP_ALLOC_H
+
+#include <stddef.h>
+
+void* balloc(size_t len);
+void bfree(void *ptr);
+
+#endif
diff --git a/bootstrap/stage1/include/bprintf.h b/bootstrap/stage1/include/bprintf.h
new file mode 100644
index 0000000..d67d518
--- /dev/null
+++ b/bootstrap/stage1/include/bprintf.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+ *
+ * This file is part of BoxOS, a free and open-source Unix-like operating
+ * system.
+ *
+ * BoxOS is free software; you can redistribute it and/or modify under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * BoxOS; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef BPRINTF_H
+#define BPRINTF_H
+
+#include <stdarg.h>
+
+int vbprintf(const char *fmt, va_list args);
+int bprintf(const char *fmt, ...);
+
+#endif
diff --git a/bootstrap/stage1/include/tty.h b/bootstrap/stage1/include/tty.h
new file mode 100644
index 0000000..af0d8f9
--- /dev/null
+++ b/bootstrap/stage1/include/tty.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+ *
+ * This file is part of BoxOS, a free and open-source Unix-like operating
+ * system.
+ *
+ * BoxOS is free software; you can redistribute it and/or modify under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * BoxOS; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef BOOTSTRAP_TTY_H
+#define BOOTSTRAP_TTY_H
+
+#include <stdint.h>
+
+void tty_putchar(char c);
+char tty_getchar(void);
+
+static inline void tty_write(const char *data, size_t size) {
+ for (size_t i = 0; i < size; i++)
+ tty_putchar(data[i]);
+}
+
+static inline void tty_read(char *data, size_t size) {
+ for (size_t i = 0; i < size; i++)
+ data[i] = tty_getchar();
+}
+
+#endif