Author: quozl Date: Fri Apr 12 05:43:39 2013 New Revision: 3641 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3641
Log: disklabel - fix no access to primary partition if extended partition is empty, workaround is to set the primary partition bootable, cause in the partition finder which when recursing reused the same buffer for the extended partition, destroying the in-memory copy of the primary parition; fix is to use a separate buffer in the recursion. Reported by Vladimir Serbinenko.
Modified: ofw/disklabel/common.fth ofw/disklabel/methods.fth ofw/fs/fatfs/partition.fth
Modified: ofw/disklabel/common.fth ============================================================================== --- ofw/disklabel/common.fth Fri Apr 12 04:38:21 2013 (r3640) +++ ofw/disklabel/common.fth Fri Apr 12 05:43:39 2013 (r3641) @@ -19,6 +19,9 @@
0 instance value sector-offset
+: sector-alloc ( -- ) /sector alloc-mem to sector-buf ; +: sector-free ( -- ) sector-buf /sector free-mem ; + \ For ISO-9660 CD-ROMs, ISO-9660 flash or hard drives, and GPT : read-hw-sector ( sector# -- ) sector-offset + /sector um* " seek" $call-parent abort" Seek failed"
Modified: ofw/disklabel/methods.fth ============================================================================== --- ofw/disklabel/methods.fth Fri Apr 12 04:38:21 2013 (r3640) +++ ofw/disklabel/methods.fth Fri Apr 12 05:43:39 2013 (r3641) @@ -233,7 +233,7 @@
: try-open ( -- ) " block-size" $call-parent to /sector - /sector alloc-mem to sector-buf + sector-alloc parse-partition ( ) select-partition ( )
@@ -248,7 +248,7 @@ \ flags around, we just abort when a fatal error occurs. The "catch" \ intercepts the abort and returns the appropriate flag value. : open ( -- okay? ) ['] try-open catch 0= ; -: close ( -- ) sector-buf if sector-buf /sector free-mem then ; +: close ( -- ) sector-buf if sector-free then ; : size ( -- d ) size-low size-high ; : load ( adr -- len ) \ This load method is used only for type 41 (IBM "PREP") partitions
Modified: ofw/fs/fatfs/partition.fth ============================================================================== --- ofw/fs/fatfs/partition.fth Fri Apr 12 04:38:21 2013 (r3640) +++ ofw/fs/fatfs/partition.fth Fri Apr 12 05:43:39 2013 (r3641) @@ -90,7 +90,10 @@ dup 5 = over h# f = or if \ extended partition ( ... n,s,b,t ) 2drop nip ( ... s ) extended-offset dup 0= if over to extended-offset then - + dup read-sector recurse drop ( ... ) + + dup ( ... es ) + sector-buf >r sector-alloc ( ... es ) + read-sector recurse drop ( ... ) + sector-free r> to sector-buf ( ... ) else \ Ordinary partition ( ... n,s,b,t ) suitable? if ( ... n,s,b,t ) to partition-type drop ( ... n,s )
openfirmware@openfirmware.info