From 66c875209a9b85fd80875f44a3ae5b92548639ba Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 3 Mar 2019 13:18:58 +0100 Subject: Fix Hintergrund extraction The script added a bogus/empty page at offset 0x600, since only three instead of four entries of the first page table were skipped. To make sure offsets are correct, add the first page (not stored on Hintergrund) to the output as well. FILE dataspace conversion can skip this page with `--skip 1`. --- extractHintergrund.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'extractHintergrund.py') diff --git a/extractHintergrund.py b/extractHintergrund.py index 8f178a0..5795d8d 100755 --- a/extractHintergrund.py +++ b/extractHintergrund.py @@ -44,6 +44,7 @@ anchor = Struct( Const(b"\xff"*4), ) * "System anchor block" +assert pagesize//blockref.sizeof() == 128 blockTable = Array(pagesize//blockref.sizeof(), blockref) # XXX: skip const @@ -212,6 +213,10 @@ if __name__ == '__main__': with open (f'{taskid:04d}_{dsid:04d}.ds', 'wb') as outfd: os.ftruncate (outfd.fileno(), 0) + # the first page of a dataspace is used by the OS + # and not stored to the Hintergrund + outfd.seek (pagesize) + # get the first three pages for ref in d.blocks: copyblock (ref.value, fd, outfd) @@ -219,7 +224,7 @@ if __name__ == '__main__': # indirect block refs (level 4a) assert len (d.blockTables) == 2 # first four entries of first table are empty and must not be written! - copyBlockTable (d.blockTables[0].value, fd, outfd, 3) + copyBlockTable (d.blockTables[0].value, fd, outfd, 4) copyBlockTable (d.blockTables[1].value, fd, outfd) # segment tables (level 4b) -- cgit v1.2.3