File elilo-3.8-cvs20080127.diff of Package elilo

diff -ur elilo-3.8/Make.defaults elilo/Make.defaults
--- elilo-3.8/Make.defaults	2007-07-20 21:47:25.000000000 +0200
+++ elilo/Make.defaults	2008-01-12 00:53:33.000000000 +0100
@@ -68,7 +68,7 @@
 
 OPTIMFLAGS = -O2 
 DEBUGFLAGS = -Wall
-CFLAGS     = $(OPTIMFLAGS) -fpic -fshort-wchar $(DEBUGFLAGS)
+CFLAGS     = $(OPTIMFLAGS) -fno-strict-aliasing -fpic -fshort-wchar $(DEBUGFLAGS)
 LDFLAGS	   = -nostdlib -znocombreloc
 INSTALL	   = install
 
diff -ur elilo-3.8/alternate.c elilo/alternate.c
--- elilo-3.8/alternate.c	2007-07-20 21:47:26.000000000 +0200
+++ elilo/alternate.c	2008-01-12 00:53:33.000000000 +0100
@@ -56,7 +56,7 @@
  *	  Please note that no fatal error is reported by this function
  */
 INTN
-alternate_kernel(CHAR16 *buffer, INTN size)
+alternate_kernel(CHAR16 *buffer, UINTN size)
 {
 	EFI_STATUS status;
 	INTN ret = -1;
diff -ur elilo-3.8/choosers/simple.c elilo/choosers/simple.c
--- elilo-3.8/choosers/simple.c	2007-07-20 21:47:26.000000000 +0200
+++ elilo/choosers/simple.c	2008-01-12 00:53:33.000000000 +0100
@@ -220,7 +220,7 @@
 {
 	fops_fd_t fd;
 	EFI_STATUS status;
-	INTN len, i;
+	UINTN len, i;
 	CHAR16 *filename;
 	CHAR8 buf[256];
 
diff -ur elilo-3.8/choosers/textmenu.c elilo/choosers/textmenu.c
--- elilo-3.8/choosers/textmenu.c	2007-07-20 21:47:26.000000000 +0200
+++ elilo/choosers/textmenu.c	2008-01-12 00:53:33.000000000 +0100
@@ -186,12 +186,12 @@
 }
 
 static INTN
-read_message_file(INTN msg, INT8 *buf, INTN max)
+read_message_file(INTN msg, UINT8 *buf, UINTN max)
 {
 	CHAR16 *filename;
 	fops_fd_t message_fd;
 	EFI_STATUS status;
-	INTN len = max;
+	UINTN len = max;
 
 	if (msg > 10) return 0;
 
diff -ur elilo-3.8/elilo.h elilo/elilo.h
--- elilo-3.8/elilo.h	2005-12-01 22:42:59.000000000 +0100
+++ elilo/elilo.h	2008-01-12 00:53:33.000000000 +0100
@@ -183,7 +183,7 @@
 extern INTN load_file(CHAR16 *, memdesc_t *);
 
 /* from alternate.c */
-extern INTN alternate_kernel(CHAR16 *, INTN);
+extern INTN alternate_kernel(CHAR16 *, UINTN);
 
 /* from bootparams.c */
 extern VOID *create_boot_params (CHAR16 *, memdesc_t *, memdesc_t *, UINTN *);
diff -ur elilo-3.8/ia32/gzip.c elilo/ia32/gzip.c
--- elilo-3.8/ia32/gzip.c	2005-12-01 22:42:59.000000000 +0100
+++ elilo/ia32/gzip.c	2008-01-13 01:12:19.000000000 +0100
@@ -153,7 +153,7 @@
 int
 fill_inbuf(void)
 {
-	INTN expected, nread;
+	UINTN expected, nread;
 	EFI_STATUS status;
 
 	expected = nread = INBUFSIZE;
@@ -277,7 +277,7 @@
  * the relevant header information.
  */
 int
-first_block (const char *buf, long blocksize)
+first_block (const unsigned char *buf, long blocksize)
 {
 	Elf32_Ehdr *elf;
 	Elf32_Phdr *phdrs;
@@ -430,7 +430,7 @@
 	static const CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
 	static UINTN heli_count;
 	struct segment *cp;
-	char	*src, *dst;
+	unsigned char	*src, *dst;
 	long	cnt;
 
 	if (!outcnt) return;
@@ -468,7 +468,7 @@
 		file_offset += skip;
 		outcnt      -= skip;
 	}
-	dst = (char *)cp->addr + (file_offset - cp->offset);
+	dst = (unsigned char *)cp->addr + (file_offset - cp->offset);
 	cnt = cp->offset + cp->size - file_offset;
 	if (cnt > outcnt) 
 		cnt = outcnt;
@@ -482,7 +482,7 @@
 	/* See if we are at the end of this chunk */
 	if (file_offset == cp->offset + cp->size) {
 		if (cp->bss_sz) {
-			dst = (char *)cp->addr + cp->size;
+			dst = (unsigned char *)cp->addr + cp->size;
 			Memset(dst, 0, cp->bss_sz);
 		}
 		nextchunk();
diff -ur elilo-3.8/ia32/system.c elilo/ia32/system.c
--- elilo-3.8/ia32/system.c	2008-01-03 22:48:03.000000000 +0100
+++ elilo/ia32/system.c	2008-01-14 00:31:57.000000000 +0100
@@ -163,10 +163,11 @@
         EFI_GUID GopProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
         EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop_interface;
         EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Gop_info;
-        EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE   *Gop_mode;
-        EFI_HANDLE *Gop_handle;
+        EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE   *Gop_mode = NULL;
+        EFI_HANDLE *Gop_handle = NULL;
         EFI_STATUS efi_status;
-        UINTN size, size1;
+        UINTN size = 0;
+        UINTN size1;
         UINT8 i;
 
 	efi_status = uefi_call_wrapper(
@@ -204,7 +205,7 @@
 				3,
 				*Gop_handle,
 				&GopProtocol,
-				&Gop_interface);
+				(VOID **) &Gop_interface);
 
 		if (EFI_ERROR(efi_status)) {
 			continue;
diff -ur elilo-3.8/ia64/fpswa.c elilo/ia64/fpswa.c
--- elilo-3.8/ia64/fpswa.c	2003-08-19 18:46:09.000000000 +0200
+++ elilo/ia64/fpswa.c	2008-01-12 00:53:33.000000000 +0100
@@ -132,7 +132,7 @@
 #endif
 	};
 	UINTN j, count = sizeof(fpswa_filenames)/sizeof(CHAR16 *);
-	INTN cookie;
+	UINTN cookie;
 	CHAR16 devname[FILENAME_MAXLEN];
 	
 	if (fpswa_file) {
diff -ur elilo-3.8/ia64/gzip.c elilo/ia64/gzip.c
--- elilo-3.8/ia64/gzip.c	2005-12-01 22:42:59.000000000 +0100
+++ elilo/ia64/gzip.c	2008-01-12 00:53:33.000000000 +0100
@@ -161,7 +161,7 @@
 int
 fill_inbuf(void)
 {
-	INTN expected, nread;
+	UINTN expected, nread;
 	EFI_STATUS status;
 
 	expected = nread = INBUFSIZE;
@@ -309,7 +309,7 @@
  * the relevant header information.
  */
 int
-first_block (const char *buf, long blocksize)
+first_block (const unsigned char *buf, long blocksize)
 {
 	Elf64_Ehdr *elf;
 	Elf64_Phdr *phdrs;
@@ -439,7 +439,7 @@
 	if (alloc_kmem((void *)low_addr, pages) == -1) {
 		VOID *new_addr;
 
-		VERB_PRT(1, (L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
+		VERB_PRT(1, Print(L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
 
 		if (ia64_can_relocate() == 0) {
 			ERR_PRT((L"relocation is disabled, cannot load kernel"));
@@ -464,7 +464,7 @@
 		/* unsigned arithmetic */
                 load_offset = (UINTN) (new_addr - ROUNDDOWN((UINTN) low_addr,256*MB));
 
-		VERB_PRT(1, (L"low_addr=0x%lx new_addr=0x%lx offset=0x%lx", low_addr, new_addr, load_offset));
+		VERB_PRT(1, Print(L"low_addr=0x%lx new_addr=0x%lx offset=0x%lx", low_addr, new_addr, load_offset));
 
 		/*
 		 * correct various addresses for non-zero load_offset
@@ -526,7 +526,7 @@
 	static const CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
 	static UINTN heli_count;
 	struct segment *cp;
-	char	*src, *dst;
+	unsigned char	*src, *dst;
 	long	cnt;
 
 	if (!outcnt) return;
@@ -565,7 +565,7 @@
 		file_offset += skip;
 		outcnt      -= skip;
 	}
-	dst = (char *)cp->addr + (file_offset - cp->offset);
+	dst = (unsigned char *)cp->addr + (file_offset - cp->offset);
 
 	cnt = cp->offset + cp->size - file_offset;
 
@@ -582,7 +582,7 @@
 	/* See if we are at the end of this chunk */
 	if (file_offset == cp->offset + cp->size) {
 		if (cp->bss_sz) {
-			dst = (char *)cp->addr + cp->size;
+			dst = (unsigned char *)cp->addr + cp->size;
 			Memset(dst, 0, cp->bss_sz);
 		}
 		nextchunk();
diff -ur elilo-3.8/ia64/longjmp.S elilo/ia64/longjmp.S
--- elilo-3.8/ia64/longjmp.S	2002-01-13 17:00:08.000000000 +0100
+++ elilo/ia64/longjmp.S	2008-01-27 01:42:24.000000000 +0100
@@ -159,4 +159,4 @@
 	invala			// virt. -> phys. regnum mapping may change
 	mov pr=r24,-1
 	br.ret.dptk.few rp
-	.endp __longjmp
+	.endp longjmp
diff -ur elilo-3.8/ia64/plain_loader.c elilo/ia64/plain_loader.c
--- elilo-3.8/ia64/plain_loader.c	2005-09-16 18:25:52.000000000 +0200
+++ elilo/ia64/plain_loader.c	2008-01-12 00:53:33.000000000 +0100
@@ -288,7 +288,7 @@
 	if (alloc_kmem(low_addr, pages) == -1) {
 		VOID *new_addr;
 
-		VERB_PRT(1, (L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
+		VERB_PRT(1, Print(L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
 
 		if (ia64_can_relocate() == 0) {
 			ERR_PRT((L"relocation is disabled, cannot load kernel"));
diff -ur elilo-3.8/ia64/setjmp.S elilo/ia64/setjmp.S
--- elilo-3.8/ia64/setjmp.S	2005-05-10 01:22:04.000000000 +0200
+++ elilo/ia64/setjmp.S	2008-01-27 01:42:24.000000000 +0100
@@ -81,6 +81,7 @@
 	.proc __sigsetjmp
 __sigsetjmp:
 	//.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
+	.body
 	alloc loc1=ar.pfs,2,2,2,0
 	mov r16=ar.unat
 	;;
@@ -89,6 +90,7 @@
 	add r3=8,in0
 	;;
 	st8.spill.nta [r2]=sp,16	// r12 (sp)
+	;;
 	st8.spill.nta [r3]=gp,16	// r1 (gp)
 	;;
 	st8.nta [r2]=r16,16		// save caller's unat
@@ -96,13 +98,13 @@
 	add r8=0xa0,in0
 	;;
 	st8.spill.nta [r2]=r4,16	// r4
+	;;
 	st8.spill.nta [r3]=r5,16	// r5
 	add r9=0xb0,in0
 	;;
 	stf.spill.nta [r8]=f2,32
 	stf.spill.nta [r9]=f3,32
 	mov loc0=rp
-	.body
 	;;
 	stf.spill.nta [r8]=f4,32
 	stf.spill.nta [r9]=f5,32
@@ -139,6 +141,7 @@
 	stf.spill.nta [r9]=f31
 
 	st8.spill.nta [r2]=r6,16	// r6
+	;;
 	st8.spill.nta [r3]=r7,16	// r7
 	;;
 	mov r23=ar.bsp
diff -ur elilo-3.8/ia64/sysdeps.h elilo/ia64/sysdeps.h
--- elilo-3.8/ia64/sysdeps.h	2005-12-01 22:42:59.000000000 +0100
+++ elilo/ia64/sysdeps.h	2008-01-12 00:53:34.000000000 +0100
@@ -86,7 +86,7 @@
         asm volatile ("mov r28=%1; br.sptk.few %0" :: "b"(kentry),"r"(bp));
 }
 
-static inline const UINT64
+static inline UINT64
 __ia64_swab64 (UINT64 x)
 {
 	UINT64 result;
@@ -95,13 +95,13 @@
 	return result;
 }
 
-static inline const UINT32
+static inline UINT32
 __ia64_swab32 (UINT32 x)
 {
 	return __ia64_swab64(x) >> 32;
 }
 
-static inline const UINT16
+static inline UINT16
 __ia64_swab16(UINT16 x)
 {
 	return __ia64_swab64(x) >> 48;
diff -ur elilo-3.8/inflate.c elilo/inflate.c
--- elilo-3.8/inflate.c	2005-12-01 22:42:59.000000000 +0100
+++ elilo/inflate.c	2008-01-15 02:03:19.000000000 +0100
@@ -1094,10 +1094,10 @@
 	    error("Input has invalid flags\n");
 	    return -1;
     }
-    (ulg)get_byte();	/* Get timestamp */
-    ((ulg)get_byte()) << 8;
-    ((ulg)get_byte()) << 16;
-    ((ulg)get_byte()) << 24;
+    (void)get_byte();	/* Get timestamp - 4 bytes */
+    (void)get_byte();
+    (void)get_byte();
+    (void)get_byte();
 
     (void)get_byte();  /* Ignore extra flags for the moment */
     (void)get_byte();  /* Ignore OS type for the moment */
diff -ur elilo-3.8/util.c elilo/util.c
--- elilo-3.8/util.c	2007-07-20 21:47:26.000000000 +0200
+++ elilo/util.c	2008-01-12 00:53:33.000000000 +0100
@@ -248,7 +248,7 @@
 INTN
 read_file(UINTN fd, UINTN total_size, CHAR8 *buffer)
 {
-	INTN size, j=0;
+	UINTN size, j=0;
 	EFI_STATUS status;
 	CHAR16 helicopter[4] = { L'|' , L'/' , L'-' , L'\\' };
 	INTN ret = ELILO_LOAD_SUCCESS;
diff -ur elilo-3.8/x86_64/gzip.c elilo/x86_64/gzip.c
--- elilo-3.8/x86_64/gzip.c	2007-07-20 21:47:27.000000000 +0200
+++ elilo/x86_64/gzip.c	2008-01-15 02:03:19.000000000 +0100
@@ -156,7 +156,7 @@
 int
 fill_inbuf(void)
 {
-	INTN expected, nread;
+	UINTN expected, nread;
 	EFI_STATUS status;
 
 	expected = nread = INBUFSIZE;
@@ -280,7 +280,7 @@
  * the relevant header information.
  */
 int
-first_block (const char *buf, long blocksize)
+first_block (const unsigned char *buf, long blocksize)
 {
 	Elf64_Ehdr *elf;
 	Elf64_Phdr *phdrs;
@@ -433,7 +433,7 @@
 	static const CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
 	static UINTN heli_count;
 	struct segment *cp;
-	char	*src, *dst;
+	unsigned char	*src, *dst;
 	long	cnt;
 
 	if (!outcnt) return;
@@ -471,7 +471,7 @@
 		file_offset += skip;
 		outcnt      -= skip;
 	}
-	dst = (char *)cp->addr + (file_offset - cp->offset);
+	dst = (unsigned char *)cp->addr + (file_offset - cp->offset);
 	cnt = cp->offset + cp->size - file_offset;
 	if (cnt > outcnt) 
 		cnt = outcnt;
@@ -485,7 +485,7 @@
 	/* See if we are at the end of this chunk */
 	if (file_offset == cp->offset + cp->size) {
 		if (cp->bss_sz) {
-			dst = (char *)cp->addr + cp->size;
+			dst = (unsigned char *)cp->addr + cp->size;
 			Memset(dst, 0, cp->bss_sz);
 		}
 		nextchunk();
diff -ur elilo-3.8/x86_64/sysdeps.h elilo/x86_64/sysdeps.h
--- elilo-3.8/x86_64/sysdeps.h	2007-12-19 23:52:22.000000000 +0100
+++ elilo/x86_64/sysdeps.h	2008-01-15 02:03:19.000000000 +0100
@@ -370,8 +370,8 @@
 		UINT32	kernel_entry;
 		UINT16	kernel_cs;
 	} jumpvector;
-	UINTN	njump;
 	VOID 	*jump_start;
+	uint64_t temp;
 
 	/*
 	 * Disable interrupts.
@@ -383,7 +383,8 @@
 	 */
 
 	if (bp->s.initrd_start) {
-		MEMCPY(INITRD_START, bp->s.initrd_start, bp->s.initrd_size);
+		temp =  bp->s.initrd_start;
+		MEMCPY(INITRD_START, temp , bp->s.initrd_size);
 		bp->s.initrd_start = INITRD_START;
 	}
 	/*
@@ -434,14 +435,15 @@
 
 	/*
 	 * Jump to kernel entry point.
+	 *
+	 * Cast is to tell gcc that we know we're going from
+	 * 64-bit ptr to 32-bit integer.
 	 */
-	jumpvector.kernel_entry=kentry;
+	jumpvector.kernel_entry=(UINT32)((UINT64)kentry);
 	jumpvector.kernel_cs=0x10;
-	njump = &jumpvector;
 	jump_start = (VOID *)&jumpvector;
 	//asm volatile ( "mov %0, %%rcx" : : "m" (&jumpvector) );
 	asm volatile ( "mov %0, %%rcx" : : "m" (jump_start) );
-	//asm volatile ( "mov %0, %%rcx" : : "m" (njump) );
 	asm volatile ( "ljmp *(%%rcx)" : :);
 	/* Never come back to here. */
 }
diff -ur elilo-3.8/x86_64/system.c elilo/x86_64/system.c
--- elilo-3.8/x86_64/system.c	2008-01-03 22:48:03.000000000 +0100
+++ elilo/x86_64/system.c	2008-01-15 02:03:19.000000000 +0100
@@ -160,7 +160,7 @@
 	mmap_desc_t md;
 
 	ZeroMem(&md, sizeof md);
-	md.md = (VOID *)bp->s.efi_mem_map;
+	md.md = (VOID *)(UINT64)bp->s.efi_mem_map;
 	free_memmap(&md);
 }
 
@@ -189,10 +189,11 @@
         EFI_GUID GopProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
         EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop_interface;
         EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Gop_info;
-        EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE   *Gop_mode;
-        EFI_HANDLE *Gop_handle;
+        EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE   *Gop_mode = NULL;
+        EFI_HANDLE *Gop_handle = NULL;
         EFI_STATUS efi_status;
-        UINTN size, size1;
+        UINTN size = 0;
+        UINTN size1;
         UINT8 i;
 
 	efi_status = uefi_call_wrapper(
@@ -554,7 +555,7 @@
 
 	if (initrd->start_addr && initrd->pgcnt) {
 		/* %%TBD - This will probably have to be changed. */
-		bp->s.initrd_start = (UINT32)initrd->start_addr;
+		bp->s.initrd_start = (UINT32)(UINT64)initrd->start_addr;
 		bp->s.initrd_size = (UINT32)(initrd->size);
 		/*
 		 * This is the RAMdisk root device for RedHat 2.2.x
@@ -598,7 +599,7 @@
 	/*
 	 * Kernel entry point.
 	 */
-	bp->s.kernel_start = (UINT32)kernel_start;
+	bp->s.kernel_start = (UINT32)(UINT64)kernel_start;
 
 	/*
 	 * When changing stuff in the parameter structure compare
openSUSE Build Service is sponsored by