Stephane Eranian 2005-12-06 08:21:36 -05:00 committed by Vincent Batts
parent cb533a5de5
commit 6a4d7e49dc
29 changed files with 523 additions and 1389 deletions

View file

@ -37,6 +37,8 @@
#include "private.h"
#include "setjmp.h"
#define LD_NAME L"gzip_ia64"
#define memzero(s, n) Memset((VOID *)(s), 0, (n))
#define memcpy(a,b,n) Memcpy((VOID *)(a),(b),(n))
@ -68,6 +70,7 @@ typedef struct segment {
#define CHUNK_FL_VALID 0x1
#define CHUNK_FL_LOAD 0x2
#define CHUNK_FL_X 0x4
#define CHUNK_CAN_LOAD(n) chunks[(n)].flags |= CHUNK_FL_LOAD
#define CHUNK_NO_LOAD(n) chunks[(n)].flags &= ~CHUNK_FL_LOAD
@ -391,6 +394,9 @@ first_block (const char *buf, long blocksize)
continue;
}
if (bswap32(phdrs[i].p_flags) & PF_X)
chunks[i].flags |= CHUNK_FL_X;
CHUNK_CAN_LOAD(i); /* mark no load chunk */
VERB_PRT(3,
@ -433,7 +439,7 @@ first_block (const char *buf, long blocksize)
if (alloc_kmem((void *)low_addr, pages) == -1) {
VOID *new_addr;
ERR_PRT((L"%s : AllocatePages(%d, 0x%lx) for kernel failed\n", LD_NAME, pages, low_addr));
VERB_PRT(1, (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"));
@ -458,7 +464,7 @@ first_block (const char *buf, long blocksize)
/* unsigned arithmetic */
load_offset = (UINTN) (new_addr - ROUNDDOWN((UINTN) low_addr,256*MB));
ERR_PRT((L"low_addr=0x%lx new_addr=0x%lx offset=0x%lx", low_addr, new_addr, load_offset));
VERB_PRT(1, (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
@ -566,6 +572,8 @@ tail:
if (cnt > outcnt) cnt = outcnt;
Memcpy(dst, src, cnt);
if (cp->flags & CHUNK_FL_X)
flush_dcache (dst, cnt);
file_offset += cnt;
outcnt -= cnt;