diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-12-12 14:36:02 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-12-14 13:56:44 -0800 |
commit | e2ab9215d792d07cfb725de290f416e331b87627 (patch) | |
tree | 7fbf2b3f921ef78b277f5d89c1a9a14960a49edc /gpxe/src/util/zbin.c | |
parent | 36390f9712ac56be1dce7a635322bd96e15620c1 (diff) | |
download | syslinux-kkpxe.tar.gz |
gPXE: update to the "kkpxe" branchkkpxe
Update gPXE to the "kkpxe" branch, an experimental branch of the gPXE
tree which should let us eliminate the gpxelinux-specific hacks.
Specifically, this corresponds to checkin
0963c883a9402bd5846e687a100e196f7e8a2ef7 of
git://git.etherboot.org/scm/people/mcb30/gpxe.git.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'gpxe/src/util/zbin.c')
-rw-r--r-- | gpxe/src/util/zbin.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gpxe/src/util/zbin.c b/gpxe/src/util/zbin.c index b24f401e..c1082b31 100644 --- a/gpxe/src/util/zbin.c +++ b/gpxe/src/util/zbin.c @@ -6,6 +6,8 @@ #include "nrv2b.c" FILE *infile, *outfile; +#define DEBUG 0 + struct input_file { void *buf; size_t len; @@ -151,6 +153,11 @@ static int process_zinfo_copy ( struct input_file *input, return -1; } + if ( DEBUG ) { + fprintf ( stderr, "COPY [%#zx,%#zx) to [%#zx,%#zx)\n", offset, ( offset + len ), + output->len, ( output->len + len ) ); + } + memcpy ( ( output->buf + output->len ), ( input->buf + offset ), len ); output->len += len; @@ -184,6 +191,11 @@ static int process_zinfo_pack ( struct input_file *input, return -1; } + if ( DEBUG ) { + fprintf ( stderr, "PACK [%#zx,%#zx) to [%#zx,%#zx)\n", offset, ( offset + len ), + output->len, ( output->len + packed_len ) ); + } + output->len += packed_len; if ( output->len > output->max_len ) { fprintf ( stderr, "Output buffer overrun on pack\n" ); @@ -200,6 +212,8 @@ static int process_zinfo_subtract ( struct input_file *input, size_t offset = subtract->offset; void *target; long delta; + unsigned long old; + unsigned long new; if ( ( offset + datasize ) > output->len ) { fprintf ( stderr, "Subtract at %#zx outside output buffer\n", @@ -214,21 +228,34 @@ static int process_zinfo_subtract ( struct input_file *input, switch ( datasize ) { case 1: { uint8_t *byte = target; + old = *byte; *byte += delta; + new = *byte; break; } case 2: { uint16_t *word = target; + old = *word; *word += delta; + new = *word; break; } case 4: { uint32_t *dword = target; + old = *dword; *dword += delta; + new = *dword; break; } default: fprintf ( stderr, "Unsupported subtract datasize %d\n", datasize ); return -1; } + + if ( DEBUG ) { + fprintf ( stderr, "SUBx [%#zx,%#zx) (%#lx+(%#lx/%#lx)-(%#lx/%#lx)) = %#lx\n", + offset, ( offset + datasize ), old, output->len, subtract->divisor, + input->len, subtract->divisor, new ); + } + return 0; } |