j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: 2007-10-16 22:59:36 +0200 (Tue, 16 Oct 2007) New Revision: 171
Modified: openbios-devel/modules/deblocker.c openbios-devel/modules/disk-label.c openbios-devel/modules/sun-parts.c Log: Fix 8 byte alignment problems
Modified: openbios-devel/modules/deblocker.c =================================================================== --- openbios-devel/modules/deblocker.c 2007-09-29 11:33:31 UTC (rev 170) +++ openbios-devel/modules/deblocker.c 2007-10-16 20:59:36 UTC (rev 171) @@ -20,7 +20,7 @@ #include "modules.h"
typedef struct { - ducell mark; + ucell mark_hi, mark_lo; xt_t read_xt; xt_t write_xt;
@@ -79,7 +79,8 @@ /* -1 means seek to EOF (at least in our implementation) */ if( (dcell)mark == -1 ) RET(-1); - di->mark = mark; + di->mark_hi = pos_hi; + di->mark_lo = pos_lo; /* 0,1 == success, -1 == error */ PUSH(0); @@ -89,7 +90,8 @@ static void deblk_tell( deblk_info_t *di ) { - DPUSH( di->mark ); + PUSH( di->mark_lo ); + PUSH( di->mark_hi ); }
@@ -110,9 +112,10 @@ static void split( deblk_info_t *di, char *data, int len, work_t w[3] ) { + ducell mark = ((ducell)di->mark_hi << BITS) | di->mark_lo; memset( w, 0, sizeof(work_t[3]) );
- w[0].offs = di->mark % di->blksize; + w[0].offs = mark % di->blksize; w[0].blk_buf = di->buf; w[0].data = data; if( w[0].offs ) { @@ -141,13 +144,14 @@ char *dest = (char*)POP(); int last=0, retlen=0; work_t w[3]; + ducell mark = ((ducell)di->mark_hi << BITS) | di->mark_lo;
/* printk("read: %x %x\n", (int)dest, len ); */ if( !xt ) return -1;
- blk = di->mark / di->blksize; + blk = mark / di->blksize; split( di, dest, len, w );
for( i=0; !last && i<3; i++ ) { @@ -174,8 +178,11 @@ retlen += w[i].len; blk += n; } - if( retlen > 0 ) - di->mark += retlen; + if( retlen > 0 ) { + mark += retlen; + di->mark_hi = mark >> BITS; + di->mark_lo = mark & (ucell) -1; + } return retlen; }
Modified: openbios-devel/modules/disk-label.c =================================================================== --- openbios-devel/modules/disk-label.c 2007-09-29 11:33:31 UTC (rev 170) +++ openbios-devel/modules/disk-label.c 2007-10-16 20:59:36 UTC (rev 171) @@ -22,8 +22,8 @@ typedef struct { int fd; - ducell offs; - ducell size; + ucell offs_hi, offs_lo; + ucell size_hi, size_lo; int type; /* partition type or -1 */
ihandle_t part_ih; @@ -94,8 +94,10 @@ if( !(xt=find_ih_method("get-info", di->part_ih)) ) goto out; call_package( xt , di->part_ih ); - di->size = DPOP(); - di->offs = DPOP(); + di->size_hi = POP(); + di->size_lo = POP(); + di->offs_hi = POP(); + di->offs_lo = POP(); di->type = POP(); }
@@ -139,12 +141,14 @@ { llong pos = DPOP(); int ret; + ducell offs = ((ducell)di->offs_hi << BITS) | di->offs_lo; + ducell size = ((ducell)di->size_hi << BITS) | di->size_lo;
if( pos != -1 ) - pos += di->offs; - else if( di->size ) { + pos += offs; + else if( size ) { /* printk("Seek EOF\n"); */ - pos = di->offs + di->size; + pos = offs + size; } else { /* let parent handle the EOF seek. */ } @@ -159,8 +163,9 @@ dlabel_tell( dlabel_info_t *di ) { llong pos = tell( di->fd ); + ducell offs = ((ducell)di->offs_hi << BITS) | di->offs_lo; if( pos != -1 ) - pos -= di->offs; + pos -= offs;
DPUSH( pos ); } @@ -179,7 +184,8 @@ dlabel_offset( dlabel_info_t *di ) { ullong rel = DPOP(); - rel += di->offs; + ducell offs = ((ducell)di->offs_hi << BITS) | di->offs_lo; + rel += offs; DPUSH( rel ); }
Modified: openbios-devel/modules/sun-parts.c =================================================================== --- openbios-devel/modules/sun-parts.c 2007-09-29 11:33:31 UTC (rev 170) +++ openbios-devel/modules/sun-parts.c 2007-10-16 20:59:36 UTC (rev 171) @@ -25,8 +25,8 @@ #endif
typedef struct { - ullong offs; - ullong size; + ucell offs_hi, offs_lo; + ucell size_hi, size_lo; int type; } sunparts_info_t;
@@ -95,6 +95,7 @@ unsigned char buf[512]; struct sun_disklabel *p; unsigned int i, bs; + ducell offs, size;
DPRINTF("sunparts_open '%s'\n", str );
@@ -136,12 +137,16 @@ parnum = 0;
DPRINTF("Selected partition %d\n", parnum); - di->offs = (llong)__be32_to_cpu(p->partitions[parnum].start_cylinder) * + offs = (llong)__be32_to_cpu(p->partitions[parnum].start_cylinder) * __be16_to_cpu(p->ntrks) * __be16_to_cpu(p->nsect) * bs;
- di->size = (llong)__be32_to_cpu(p->partitions[parnum].num_sectors) * bs; + di->offs_hi = offs >> BITS; + di->offs_lo = offs & (ucell) -1; + size = (llong)__be32_to_cpu(p->partitions[parnum].num_sectors) * bs; + di->size_hi = size >> BITS; + di->size_lo = size & (ucell) -1; di->type = __be32_to_cpu(p->infos[parnum].id); - DPRINTF("Found Sun partition table, offs %d size %d\n", (int)di->offs, (int)di->size); + DPRINTF("Found Sun partition table, offs %lld size %lld\n", offs, size);
RET( -1 ); } @@ -161,8 +166,10 @@ { DPRINTF("Sun get_info\n"); PUSH( di->type ); - DPUSH( di->offs ); - DPUSH( di->size ); + PUSH( di->offs_lo ); + PUSH( di->offs_hi ); + PUSH( di->size_lo ); + PUSH( di->size_hi ); }
static void