aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fbos/compiler.h7
-rw-r--r--include/fbos/sbi.h29
2 files changed, 25 insertions, 11 deletions
diff --git a/include/fbos/compiler.h b/include/fbos/compiler.h
index 5e61ebd..35091c0 100644
--- a/include/fbos/compiler.h
+++ b/include/fbos/compiler.h
@@ -24,6 +24,13 @@ typedef unsigned long size_t;
typedef unsigned long uint64_t;
typedef unsigned long uintptr_t;
+/*
+ * NULL
+ */
+
+#define NULL (void *)0
+#define nullptr NULL
+
// Helpful macro when prototyping.
#define __unused(x) (void)x
diff --git a/include/fbos/sbi.h b/include/fbos/sbi.h
index a6b893d..2575415 100644
--- a/include/fbos/sbi.h
+++ b/include/fbos/sbi.h
@@ -1,31 +1,38 @@
#ifndef __FBOS_SBI_H_
#define __FBOS_SBI_H_
-// TODO
-/* SBI_SUCCESS 0 Completed successfully */
-/* SBI_ERR_FAILED -1 Failed */
-/* SBI_ERR_NOT_SUPPORTED -2 Not supported */
-/* SBI_ERR_INVALID_PARAM -3 Invalid parameter(s) */
-/* SBI_ERR_DENIED -4 Denied or not allowed */
-/* SBI_ERR_INVALID_ADDRESS -5 Invalid address(s) */
-/* SBI_ERR_ALREADY_AVAILABLE -6 Already available */
-/* SBI_ERR_ALREADY_STARTED -7 Already started */
-/* SBI_ERR_ALREADY_STOPPED -8 Already stopped */
-/* SBI_ERR_NO_SHMEM -9 Shared memory not available */
+// Possible values for `sbi_ret.error` as defined in the SBI Specification 2.0.
+enum sbi_ret_error {
+ SBI_SUCCESS = 0, // Completed successfully
+ SBI_ERR_FAILED = -1, // Failed
+ SBI_ERR_NOT_SUPPORTED = -2, // Not supported
+ SBI_ERR_INVALID_PARAM = -3, // Invalid parameter(s)
+ SBI_ERR_DENIED = -4, // Denied or not allowed
+ SBI_ERR_INVALID_ADDRESS = -5, // Invalid address(s)
+ SBI_ERR_ALREADY_AVAILABLE = -6, // Already available
+ SBI_ERR_ALREADY_STARTED = -7, // Already started
+ SBI_ERR_ALREADY_STOPPED = -8, // Already stopped
+ SBI_ERR_NO_SHMEM = -9, // Shared memory not available
+};
+// SBI extensions supported by this kernel.
enum sbi_ext {
DBCN_EXT = 0x4442434E,
};
+// Function IDs for the Debug Console Extension "DBCN".
enum dbcn_actions {
DBCN_WRITE = 0x00,
};
+// Return value for any SBI ecall.
struct sbi_ret {
long error;
long value;
};
+// Perform an SBI ecall. Never call this directly, use any of the macros as
+// defined below.
extern struct sbi_ret __sbi_ecall(unsigned long arg0, unsigned long arg1, unsigned long arg2,
unsigned long arg3, unsigned long arg4, unsigned long arg5,
int fid, int ext);