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

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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Wed, 29 May 2019 07:56:29 +0300
  • Cc: Florian.Schmidt@xxxxxxxxx
  • Delivery-date: Wed, 29 May 2019 04:56:52 +0000
  • Ironport-phdr: 9a23:rtASKBGhl02mzgq06T6LlZ1GYnF86YWxBRYc798ds5kLTJ7zpc6wAkXT6L1XgUPTWs2DsrQY0rOQ6vq+Ejxfqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5vIBmssAndqMgbjYRhJ6sz1xDEvmZGd+NKyG1yOFmdhQz85sC+/J5i9yRfpfcs/NNeXKv5Yqo1U6VWACwpPG4p6sLrswLDTRaU6XsHTmoWiBtIDBPb4xz8Q5z8rzH1tut52CmdIM32UbU5Uims4qt3VBPljjoMOjgk+2/Vl8NwlrpWrhK/qRJizYDaY4abO/hwfq7GYd8WWXBMUtpLWiBdHo+xaZYEAeobPeZfqonwv0UDrRylBQmwBePvzCJDiHnr3a0izuQqDAbL0xAnH9IVrHTUrdP1OL0WUeCo1KnI0C7OYO9N2Tvn8IjIbwsureuWXbJ3aMfcz1QkGQDdjliItIDoMC6Z2v4OvmWb9eZsS/yjhmw9pwx/ujSj28ghhpTTio8Wyl3I7zt1zYg7KNGiVUJ2bsCoHZ1NvC+ALYR2WNktQ2RwtSY/zb0JpIC0cTARyJQi2x7fc/uHc5WU4h77VOaePzN4hHV9dbKhgha960mgyunmWsaoy1ZGtDJFksTXuXwXzRzT7dCLSvp7/ki/xTaCzx3f5+5ZLUwulqfWK4QtzqAumpcRq0jOEDf6mEDsg6+XckUk9PKo6+PiYrj+upCcMJR0ih3/MqQogMC/Bfk4MhATX2WA5eu8z6fv/VXkQLpRlPE2iK7ZvIjAJcsHvq65HxNV0oE75ha6Djem1tUYnX4cLF5cZR2IkZbpNE/KIP3jCfe/gk+skCtwx/zcMbzuHJPNImLEkLf7crZ381RcxxYrzdBD+5JUDakMLvL3Wk/2rtzYDwU2Mwquz+j6FNp91oYeWWOSDa+FK67St0GH6f4rI+aWf4AZoijyK+V2r8Lp2Ho4n14aZuyl0IUabFi8H+96OAOJbHyqhc0OQkkQuQ9rZ+vxlFyEGRpOf2v6C6k7/S06DsSiEJ/ebou2xqSc1mGhGcsFNSh9FlmQHCKwJM2/UPAWZXfKLw==
  • Ironport-sdr: 2POKCfM2K6vx24ij3zAhhYVW+o5aX7dk/P/zviQuVHU7WlHrppQZz4PFQ6ETDPmJ4CJ5pKVFOE qZGnDXEAXjDw==
  • 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        | 6 ++++++
 plat/linuxu/memory.c     | 5 +++++
 plat/xen/memory.c        | 7 +++++++
 4 files changed, 24 insertions(+)

diff --git a/include/uk/plat/memory.h b/include/uk/plat/memory.h
index 1bb15685..4c4e4dc4 100644
--- a/include/uk/plat/memory.h
+++ b/include/uk/plat/memory.h
@@ -158,6 +158,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 7f2fb46a..e96bad2c 100644
--- a/plat/kvm/memory.c
+++ b/plat/kvm/memory.c
@@ -178,3 +178,9 @@ int _ukplat_mem_mappings_init(void)
 {
        return 0;
 }
+
+void ukplat_stack_set_current_thread(void *thread_addr)
+{
+       *((unsigned long *) _libkvmplat_cfg.bstack.end) =
+               (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®.