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

[Minios-devel] [UNIKRAFT PATCH v3 2/2] plat: Register eh_frame and eh_frame_hdr in memory.h



Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 plat/common/include/sections.h | 32 +++++++++++++++++++-----------
 plat/kvm/memory.c              | 36 +++++++++++++++++++++++++++-------
 plat/xen/memory.c              | 32 ++++++++++++++++++++++++------
 3 files changed, 76 insertions(+), 24 deletions(-)

diff --git a/plat/common/include/sections.h b/plat/common/include/sections.h
index ecb36072..1052cfc7 100644
--- a/plat/common/include/sections.h
+++ b/plat/common/include/sections.h
@@ -48,6 +48,12 @@ extern char _dtb[];
 /* [_text, _etext]: contains .text.* sections */
 extern char _text[], _etext[];
 
+/* [__eh_frame_start, __eh_frame_end]: contains .eh_frame section */
+extern char __eh_frame_start, __eh_frame_end;
+
+/* [__eh_frame_hdr_start, __eh_frame_hdr_end]: contains .eh_frame_hdr section 
*/
+extern char __eh_frame_hdr_start, __eh_frame_hdr_end;
+
 /* [_rodata, _erodata]: contains .rodata.* sections */
 extern char _rodata[], _erodata[];
 
@@ -65,17 +71,21 @@ extern char _end[];
 
 #define __uk_image_symbol(addr)    ((unsigned long)(addr))
 
-#define __DTB          __uk_image_symbol(_dtb)
-#define __TEXT         __uk_image_symbol(_text)
-#define __ETEXT                __uk_image_symbol(_etext)
-#define __RODATA       __uk_image_symbol(_rodata)
-#define __ERODATA      __uk_image_symbol(_erodata)
-#define __DATA         __uk_image_symbol(_data)
-#define __EDATA                __uk_image_symbol(_edata)
-#define __CTORS                __uk_image_symbol(_ctors)
-#define __ECTORS       __uk_image_symbol(_ectors)
-#define __BSS_START    __uk_image_symbol(__bss_start)
-#define __END          __uk_image_symbol(_end)
+#define __DTB                   __uk_image_symbol(_dtb)
+#define __TEXT                  __uk_image_symbol(_text)
+#define __ETEXT                 __uk_image_symbol(_etext)
+#define __EH_FRAME_START        __uk_image_symbol(__eh_frame_start)
+#define __EH_FRAME_END          __uk_image_symbol(__eh_frame_end)
+#define __EH_FRAME_HDR_START    __uk_image_symbol(__eh_frame_hdr_start)
+#define __EH_FRAME_HDR_END      __uk_image_symbol(__eh_frame_hdr_end)
+#define __RODATA                __uk_image_symbol(_rodata)
+#define __ERODATA               __uk_image_symbol(_erodata)
+#define __DATA                  __uk_image_symbol(_data)
+#define __EDATA                 __uk_image_symbol(_edata)
+#define __CTORS                 __uk_image_symbol(_ctors)
+#define __ECTORS                __uk_image_symbol(_ectors)
+#define __BSS_START             __uk_image_symbol(__bss_start)
+#define __END                   __uk_image_symbol(_end)
 
 #endif /*__ASSEMBLY__*/
 
diff --git a/plat/kvm/memory.c b/plat/kvm/memory.c
index a7b4d5ef..e45b88c5 100644
--- a/plat/kvm/memory.c
+++ b/plat/kvm/memory.c
@@ -33,7 +33,7 @@ extern void *_libkvmplat_mem_end;
 
 int ukplat_memregion_count(void)
 {
-       return 7;
+       return 9;
 }
 
 int ukplat_memregion_get(int i, struct ukplat_memregion_desc *m)
@@ -53,7 +53,29 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
 #endif
                ret = 0;
                break;
-       case 1: /* rodata */
+       case 1: /* eh_frame */
+               m->base  = (void *) __EH_FRAME_START;
+               m->len   = (size_t) __EH_FRAME_END
+                               - (size_t) __EH_FRAME_START;
+               m->flags = (UKPLAT_MEMRF_RESERVED
+                           | UKPLAT_MEMRF_READABLE);
+               ret = 0;
+#if CONFIG_UKPLAT_MEMRNAME
+               m->name  = "eh_frame";
+#endif
+               break;
+       case 2: /* eh_frame_hdr */
+               m->base  = (void *) __EH_FRAME_HDR_START;
+               m->len   = (size_t) __EH_FRAME_HDR_END
+                          - (size_t) __EH_FRAME_HDR_START;
+               m->flags = (UKPLAT_MEMRF_RESERVED
+                           | UKPLAT_MEMRF_READABLE);
+               ret = 0;
+#if CONFIG_UKPLAT_MEMRNAME
+               m->name  = "eh_frame_hdr";
+#endif
+               break;
+       case 3: /* rodata */
                m->base  = (void *) __RODATA;
                m->len   = (size_t) __ERODATA - (size_t) __RODATA;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -63,7 +85,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
 #endif
                ret = 0;
                break;
-       case 2: /* ctors */
+       case 4: /* ctors */
                m->base  = (void *) __CTORS;
                m->len   = (size_t) __ECTORS - (size_t) __CTORS;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -73,7 +95,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
 #endif
                ret = 0;
                break;
-       case 3: /* data */
+       case 5: /* data */
                m->base  = (void *) __DATA;
                m->len   = (size_t) __EDATA - (size_t) __DATA;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -84,7 +106,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
 #endif
                ret = 0;
                break;
-       case 4: /* bss */
+       case 6: /* bss */
                m->base  = (void *) __BSS_START;
                m->len   = (size_t) __END - (size_t) __BSS_START;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -95,7 +117,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
 #endif
                ret = 0;
                break;
-       case 5: /* heap */
+       case 7: /* heap */
                m->base  = _libkvmplat_heap_start;
                m->len   = (size_t) _libkvmplat_stack_top
                           - (size_t) _libkvmplat_heap_start;
@@ -105,7 +127,7 @@ int ukplat_memregion_get(int i, struct 
ukplat_memregion_desc *m)
 #endif
                ret = 0;
                break;
-       case 6: /* stack */
+       case 8: /* stack */
                m->base  = _libkvmplat_stack_top;
                m->len   = (size_t) _libkvmplat_mem_end
                           - (size_t) _libkvmplat_stack_top;
diff --git a/plat/xen/memory.c b/plat/xen/memory.c
index b63f11bb..4b3e9466 100644
--- a/plat/xen/memory.c
+++ b/plat/xen/memory.c
@@ -47,7 +47,7 @@
 
 int ukplat_memregion_count(void)
 {
-       return (int) _libxenplat_mrd_num + 5;
+       return (int) _libxenplat_mrd_num + 7;
 }
 
 int ukplat_memregion_get(int i, struct ukplat_memregion_desc *m)
@@ -55,7 +55,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
 
        UK_ASSERT(m);
 
-       switch(i) {
+       switch (i) {
        case 0: /* text */
                m->base  = (void *) __TEXT;
                m->len   = (size_t) __ETEXT - (size_t) __TEXT;
@@ -65,7 +65,27 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
                m->name  = "text";
 #endif
                break;
-       case 1: /* ro data */
+       case 1: /* eh_frame */
+               m->base  = (void *) __EH_FRAME_START;
+               m->len   = (size_t) __EH_FRAME_END
+                               - (size_t) __EH_FRAME_START;
+               m->flags = (UKPLAT_MEMRF_RESERVED
+                           | UKPLAT_MEMRF_READABLE);
+#if CONFIG_UKPLAT_MEMRNAME
+               m->name  = "eh_frame";
+#endif
+               break;
+       case 2: /* eh_frame_hdr */
+               m->base  = (void *) __EH_FRAME_HDR_START;
+               m->len   = (size_t) __EH_FRAME_HDR_END
+                               - (size_t) __EH_FRAME_HDR_START;
+               m->flags = (UKPLAT_MEMRF_RESERVED
+                           | UKPLAT_MEMRF_READABLE);
+#if CONFIG_UKPLAT_MEMRNAME
+               m->name  = "eh_frame_hdr";
+#endif
+               break;
+       case 3: /* ro data */
                m->base  = (void *) __RODATA;
                m->len   = (size_t) __ERODATA - (size_t) __RODATA;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -74,7 +94,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
                m->name  = "rodata";
 #endif
                break;
-       case 2: /* ctors */
+       case 4: /* ctors */
                m->base  = (void *) __CTORS;
                m->len   = (size_t) __ECTORS - (size_t) __CTORS;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -83,7 +103,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
                m->name  = "ctors";
 #endif
                break;
-       case 3: /* data */
+       case 5: /* data */
                m->base  = (void *) __DATA;
                m->len   = (size_t) __EDATA - (size_t) __DATA;
                m->flags = (UKPLAT_MEMRF_RESERVED
@@ -93,7 +113,7 @@ int ukplat_memregion_get(int i, struct ukplat_memregion_desc 
*m)
                m->name  = "data";
 #endif
                break;
-       case 4: /* bss */
+       case 6: /* bss */
                m->base  = (void *) __BSS_START;
                m->len   = (size_t) __END - (size_t) __BSS_START;
                m->flags = (UKPLAT_MEMRF_RESERVED
-- 
2.20.1


_______________________________________________
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®.