]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
plat/common/arm: Add `auxsp` getter/setter for `struct lcpu`
authorSergiu Moga <sergiu@unikraft.io>
Wed, 1 Nov 2023 06:53:56 +0000 (08:53 +0200)
committerSergiu Moga <sergiu@unikraft.io>
Sat, 25 Nov 2023 11:06:57 +0000 (13:06 +0200)
Implement basic getter/setter methods for the `auxsp` field that
exists in `struct lcpu`.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
include/uk/plat/lcpu.h
plat/common/arm/lcpu.c

index 594b3efb574575ce8186a9e207cbe246ea924666..a57c246b3c1ac21935a5cc8338b6b82385cb1c50 100644 (file)
@@ -118,6 +118,16 @@ __lcpuidx ukplat_lcpu_idx(void);
  */
 __lcpuid ukplat_lcpu_id(void);
 
+/**
+ * Returns the auxiliary stack pointer of the current logical CPU
+ */
+__uptr ukplat_lcpu_get_auxsp(void);
+
+/**
+ * Sets the auxiliary stack pointer of the current logical cpu
+ */
+void ukplat_lcpu_set_auxsp(__uptr auxsp);
+
 #ifdef CONFIG_HAVE_SMP
 
 struct ukplat_lcpu_func {
@@ -231,9 +241,12 @@ int ukplat_lcpu_run(const __lcpuidx lcpuidx[], unsigned int *num,
 int ukplat_lcpu_wakeup(const __lcpuidx lcpuidx[], unsigned int *num);
 
 #else /* CONFIG_HAVE_SMP */
-#define ukplat_lcpu_count()    (1)
+#define ukplat_lcpu_count()            (1)
 #if !CONFIG_PLAT_KVM
-#define ukplat_lcpu_idx()      (0)
+#define ukplat_lcpu_idx()              (0)
+#define ukplat_lcpu_idx()              (0)
+#define ukplat_lcpu_set_auxsp(...)
+#define ukplat_lcpu_get_auxsp()
 #endif /* !CONFIG_PLAT_KVM */
 #endif /* CONFIG_HAVE_SMP */
 
index 654a2ea47d1c26bc3ffc7a2f8c6bb0a2ad83e414..4b458df8dd0eb7e81860ad716995cbf84738d97f 100644 (file)
@@ -135,6 +135,20 @@ struct lcpu *lcpu_get_current(void)
        return this_lcpu;
 }
 
+__uptr ukplat_lcpu_get_auxsp(void)
+{
+       UK_ASSERT(IS_LCPU_PTR(lcpu_get_current()));
+
+       return lcpu_get_current()->auxsp;
+}
+
+void ukplat_lcpu_set_auxsp(__uptr auxsp)
+{
+       UK_ASSERT(IS_LCPU_PTR(lcpu_get_current()));
+
+       lcpu_get_current()->auxsp = auxsp;
+}
+
 #ifdef CONFIG_HAVE_SMP
 #ifdef CONFIG_UKPLAT_ACPI
 static __paddr_t lcpu_start_paddr;