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

[tyndur-devel] [PATCH 08/11] lib/loader: kleine fixes im elf-loader



! elf64 nur bauen wenn arch != i386
! elf64 Varablennamen und typecast
* elf32 nur bauen wenn arch != amd64

Signed-off-by: Andreas Freimuth <m.nemo@xxxxxxx>

--HG--
extra : rebase_source : 462d51ca7e73b775382403073decb28328262972
---
 src/lib/bin_loader/elf32.c |    4 ++++
 src/lib/bin_loader/elf64.c |    8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/lib/bin_loader/elf32.c b/src/lib/bin_loader/elf32.c
index 6091aae..ff49df8 100644
--- a/src/lib/bin_loader/elf32.c
+++ b/src/lib/bin_loader/elf32.c
@@ -70,6 +70,9 @@ bool loader_elf32_load_image(pid_t process, vaddr_t image_start,
     size_t image_size)
 {
 
+#if CONFI_ARCH == AMD64
+	return false;
+#else
     Elf32_Ehdr* elf_header = (Elf32_Ehdr*) image_start;
 
     // Nur gueltige ELF-Images laden
@@ -128,6 +131,7 @@ bool loader_elf32_load_image(pid_t process, vaddr_t image_start,
         num_pages * PAGE_SIZE);
 
     return true;
+#endif
 }
 
 
diff --git a/src/lib/bin_loader/elf64.c b/src/lib/bin_loader/elf64.c
index 7bed47d..ef5de5e 100644
--- a/src/lib/bin_loader/elf64.c
+++ b/src/lib/bin_loader/elf64.c
@@ -33,6 +33,8 @@
 #include <elf_common.h>
 #include <elf64.h>
 #include <loader.h>
+
+#include <lost/config.h>
 #define ELF_MAGIC (ELFMAG0 | (ELFMAG1 << 8) | (ELFMAG2 << 16) | (ELFMAG3 << 24))
 
 /**
@@ -68,7 +70,7 @@ bool loader_is_elf64(vaddr_t image_start, size_t image_size)
 bool loader_elf64_load_image(pid_t process, vaddr_t image_start,
     size_t image_size)
 {
-#if CONFIG_ARCH == ARCH_AMD64
+#if CONFIG_ARCH == ARCH_I386
     return false;
 #else
     Elf64_Ehdr* elf_header = (Elf64_Ehdr*) image_start;
@@ -77,7 +79,7 @@ bool loader_elf64_load_image(pid_t process, vaddr_t image_start,
         return false;
     }
     
-    loader_create_thread(process, elf_header->entry);
+    loader_create_thread(process, (vaddr_t) elf_header->e_entry);
     
     // FIXME: Das gibt bei i386 viele warnungen ;-)
     
@@ -105,7 +107,7 @@ bool loader_elf64_load_image(pid_t process, vaddr_t image_start,
 
             // Den geladenen Speicher in den Adressraum des Prozesses
             // verschieben
-            loader_assign_mem(process, program_header->p_vaddr, mem_image,
+            loader_assign_mem(process, (vaddr_t) program_header->p_vaddr, mem_image,
                 page_count * PAGE_SIZE);
         }
     }
-- 
1.7.3.4