[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 5/8] plat/*: Set current thread on IRQ stack


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Tue, 23 Apr 2019 13:41:41 +0300
  • Cc: felipe.huici@xxxxxxxxx, Florian.Schmidt@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, yuri.volchkov@xxxxxxxxx, sharan.santhanam@xxxxxxxxx
  • Delivery-date: Tue, 23 Apr 2019 10:42:03 +0000
  • Ironport-phdr: 9a23:3rPhoBz27O/P/DjXCy+O+j09IxM/srCxBDY+r6Qd0usWLfad9pjvdHbS+e9qxAeQG9mCsrQY26GM6uigATVGvc/Z9ihaMdRlbFwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfQV6Kf7oFYHMks+5y/69+4HJYwVPmTGxfa5+IA+5oAnMq8Uam4RvJ6U+xhfXv3dDZuBayX91KV6JkBvw+9u88IR//yhMvv4q6tJNX7j9c6kkV7JTES4oM3oy5M3ltBnDSRWA634BWWgIkRRGHhbI4gjiUpj+riX1uOx92DKHPcLtVrA7RS6i76ZwRxD2jioMKiM0/3vWisx0i6JbvQ6hqhliyIPafI2ZKPxzdb7bcNgHR2ROQ9xRWjRBDI2icoUBAekPM+FaoInzvFYCsQeyCBOwCO711jNEmnn71rA63eQ7FgHG2RQtEswJsHTPsNX1NaESWv2zwqnV1TXDcu5d1DDh54jPaRAhvfCMXbRqfcrV1EkvDx7Fg06Mpoz+JT+VzvkNvHOB4+p6UuKikmgqoBxyrDi33sogl4bEip8Pxl3H9Sh12pg5KcO6RUJhb9OoCIZcui6HO4dsQc4vQ3tktDg0x7AIo5K3YScHxIohyhXCcfKIaZKI7QjmVOuJJDd4g29qd6ynihap9Eig1vX8Vs6p0FZWtiZFksfDtnQK1xHL9MiHT+Fy/kal2TqVyw/T8ftIIVgplaXAMZIh2LkwmoISsUTFACD2hF37gLKZe0k54OSl6OTqbq/4qpOCNYJ4kA/zPrwrmsOlAOQ4NgYOX3Kc+eS5zLDs4Ur5QK5Wjv03lKnVqpTaJdkDpq6kGAJazp0j5wynDze7y9sUh2MHLFVddBKdk4fpI03OIOz/DfqnhlSskTFrx/HBPr36G5nCM2bMkKn/crZ58ENczAszzctD55JPEL0AL+z8WknruNzfFB85PBS+w/z7B9VlyoMeRWWPD7eZPqPWtl+I/OMvLPOKZIMPpTjyN/gl5/vvjXAkhV8QZq+p0oULZ3C8BPtpOF+VbmTxgt0ZC2cFohI+TPD2iF2FSTNTaWi9X6Y95jEjFo2qF4fDRp2sgLOd3Se2BZtWaX5aBVCIC3jnbJ+IVOkRaCiKOM9ujiQEVaS9S48mzRyurw/6xKB9LuXO/C0Ur4nj28Jz5+3PlRE97zp0AN6Y02yWSWF7gH8HRzss069ku0By1EqD27Big/NEDdxT++9JUgAiOJ7Hzux6DtfyWgTbcteKVVapXNOmADAvQdIr2NIOZVhyFMmmjh/ZxCWmGaEal6GTDpwu7q3cx2TxJ9p6y3ve1KghkkMmQspVOW24ga5/8xTcB47Kk0WeiaanbqIc0zDR+2eH12WBp1tUXxBtUfaNYXdKY0rQrNPio0/PUbKqIbAmKRdaj96PLO1NcNK6o09BQaLIP8/CYmT5v3qoGF7czbSXcIvsPWEAxDj1A1NCix0Zu2yBY1ttThy9qn7TWWQ9XWnkZFnhpLFz
  • Ironport-sdr: uAavzh5khsl8j+HUY8qjaTuHzPILW1F7oivb3B4vMlbNVoe8ynfj7NUi9XL6Bsu2GfXGAA/7t1 nbtWud99ezRg==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

Current thread address is saved on the top of the current thread stack.
This patch extends this behavior for the interrupt stack in order to
access the current thread address from interrupt context as well.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 include/uk/plat/memory.h | 6 ++++++
 plat/kvm/memory.c        | 5 +++++
 plat/linuxu/memory.c     | 5 +++++
 plat/xen/memory.c        | 7 +++++++
 4 files changed, 23 insertions(+)

diff --git a/include/uk/plat/memory.h b/include/uk/plat/memory.h
index 60e52e6d..b739caa8 100644
--- a/include/uk/plat/memory.h
+++ b/include/uk/plat/memory.h
@@ -92,6 +92,12 @@ int ukplat_memallocator_set(struct uk_alloc *a);
  */
 struct uk_alloc *ukplat_memallocator_get(void);
 
+/**
+ * Sets the current thread address on top of kernel stack
+ * @param thread_addr Current thread address
+ */
+void ukplat_stack_set_current_thread(void *thread_addr);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/plat/kvm/memory.c b/plat/kvm/memory.c
index e45b88c5..df624e88 100644
--- a/plat/kvm/memory.c
+++ b/plat/kvm/memory.c
@@ -157,3 +157,8 @@ int _ukplat_mem_mappings_init(void)
 {
        return 0;
 }
+
+void ukplat_stack_set_current_thread(void *thread_addr)
+{
+       *((unsigned long *) _libkvmplat_stack_top) = (unsigned long) 
thread_addr;
+}
diff --git a/plat/linuxu/memory.c b/plat/linuxu/memory.c
index 35d0d95c..8bfb645d 100644
--- a/plat/linuxu/memory.c
+++ b/plat/linuxu/memory.c
@@ -74,3 +74,8 @@ int _ukplat_mem_mappings_init(void)
 {
        return 0;
 }
+
+void ukplat_stack_set_current_thread(void *thread_addr __unused)
+{
+       /* For now, signals use the current process stack */
+}
diff --git a/plat/xen/memory.c b/plat/xen/memory.c
index cb1c3552..8f170dd3 100644
--- a/plat/xen/memory.c
+++ b/plat/xen/memory.c
@@ -148,3 +148,10 @@ int _ukplat_mem_mappings_init(void)
 #endif
        return 0;
 }
+
+void ukplat_stack_set_current_thread(void *thread_addr)
+{
+       /* TODO revisit for HVM */
+       extern char irqstack[];
+       *((unsigned long *) irqstack) = (unsigned long) thread_addr;
+}
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.