aboutsummaryrefslogtreecommitdiffstats
path: root/roms/openbios/arch/sparc64/context.h
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/openbios/arch/sparc64/context.h
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/openbios/arch/sparc64/context.h')
-rw-r--r--roms/openbios/arch/sparc64/context.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/roms/openbios/arch/sparc64/context.h b/roms/openbios/arch/sparc64/context.h
new file mode 100644
index 000000000..eb189fbee
--- /dev/null
+++ b/roms/openbios/arch/sparc64/context.h
@@ -0,0 +1,36 @@
+#ifndef SPARC64_CONTEXT_H
+#define SPARC64_CONTEXT_H
+
+#define STACK_BIAS 2047
+
+struct context {
+ /* General registers */
+ uint64_t regs[154];
+ uint64_t pc;
+ uint64_t npc;
+#define REG_O0 14
+#define REG_SP 20
+#define SP_LOC(ctx) (&(ctx)->regs[REG_SP])
+ uint64_t tba;
+ uint64_t _pad;
+ uint64_t tregs[16];
+ /* Flags */
+ /* Optional stack contents */
+ uint64_t return_addr;
+ uint64_t param[0];
+};
+
+/* Create a new context in the given stack */
+struct context *
+init_context(uint8_t *stack, uint64_t stack_size, int num_param);
+
+/* Switch context */
+struct context *switch_to(struct context *);
+
+/* Holds physical address of boot context */
+extern unsigned long __boot_ctx;
+
+/* This can always be safely used to refer to the boot context */
+#define boot_ctx ((struct context *) phys_to_virt(__boot_ctx))
+
+#endif /* SPARC64_CONTEXT_H */