[syslinux:firmware] This patch implements architecture-dependent code in memdisk to support for i386 and x86_64 . The memcpy, memset and memmove routines originated from klibc.

syslinux-bot for chandramouli narayanan mouli at linux.intel.com
Fri Nov 9 09:06:22 PST 2012


Commit-ID:  6dcc24c818de73fcf54e1cae57f560cb5f01f125
Gitweb:     http://www.syslinux.org/commit/6dcc24c818de73fcf54e1cae57f560cb5f01f125
Author:     chandramouli narayanan <mouli at linux.intel.com>
AuthorDate: Mon, 25 Jun 2012 12:47:24 -0700
Committer:  chandramouli narayanan <mouli at linux.intel.com>
CommitDate: Mon, 25 Jun 2012 12:47:24 -0700

This patch implements architecture-dependent code in memdisk to support for i386 and x86_64. The memcpy, memset and memmove routines originated from klibc.

Remanants of the unused old i386-only files, if any, need to be pruned.

---
 {com32/lib => memdisk}/memcpy.c  |    0
 memdisk/memdisk.h                |    3 +++
 {com32/lib => memdisk}/memmove.c |    0
 {com32/lib => memdisk}/memset.c  |    0
 memdisk/setup.c                  |    6 ++++++
 memdisk/start32.S                |    6 ++++++
 6 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/com32/lib/memcpy.c b/memdisk/memcpy.c
similarity index 100%
copy from com32/lib/memcpy.c
copy to memdisk/memcpy.c
diff --git a/memdisk/memdisk.h b/memdisk/memdisk.h
index b6b277a..6da5aff 100644
--- a/memdisk/memdisk.h
+++ b/memdisk/memdisk.h
@@ -24,7 +24,10 @@
 /* We use the com32 interface for calling 16-bit code */
 #include <com32.h>
 
+/* define it only for i386 */
+#if __SIZEOF_POINTER__ == 4
 #define __cdecl __attribute__((cdecl,regparm(0)))
+#endif
 
 void __cdecl intcall(uint8_t, com32sys_t *, com32sys_t *);
 
diff --git a/com32/lib/memmove.c b/memdisk/memmove.c
similarity index 100%
copy from com32/lib/memmove.c
copy to memdisk/memmove.c
diff --git a/com32/lib/memset.c b/memdisk/memset.c
similarity index 100%
copy from com32/lib/memset.c
copy to memdisk/memset.c
diff --git a/memdisk/setup.c b/memdisk/setup.c
index bc79e12..b6093b7 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -671,7 +671,13 @@ static void relocate_rm_code(uint32_t newbase)
     set_seg_base(gdt_base, 0x10, rm_args.rm_base);
     set_seg_base(gdt_base, 0x18, rm_args.rm_base);
 
+#if __SIZEOF_POINTER__ == 4
     asm volatile ("lgdtl %0"::"m" (*(char *)gdt_base));
+#elif __SIZEOF_POINTER__ == 8
+    asm volatile ("lgdt %0"::"m" (*(char *)gdt_base));
+#else
+#error "unsupported architecture"
+#endif
 
     *(uint32_t *) rm_args.rm_pmjmp += delta;
     *(uint16_t *) rm_args.rm_rmjmp += delta >> 4;
diff --git a/memdisk/start32.S b/memdisk/start32.S
index 4fb0537..ecebe68 100644
--- a/memdisk/start32.S
+++ b/memdisk/start32.S
@@ -62,7 +62,13 @@ _start:
 	addl	$8, %edi
 	loop	1b
 
+#if __SIZEOF_POINTER__ == 4
 	lidtl	idt_ptr
+#elif __SIZEOF_POINTER__ == 8
+	lidt	idt_ptr
+#else
+#error "unsupported architecture"
+#endif
 	
 	/* Save arguments, switch stacks */
 	movl	%esp, %eax		/* Pointer to arguments */


More information about the Syslinux-commits mailing list