From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:AmigaOS Hunk executable" |
|---|
| claim | "A load file starts with HUNK_HEADER (0x3F3): resident library name list (zero-terminated, obsolete), table size, first hunk, last hunk, then one size longword per hunk from first to last; sizes are in longwords in the low 30 bits, bits 31-30 give memory type (01 chip, 10 fast, 11 an extra flags longword follows) and bit 29 is advisory." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:AmigaOS Hunk executable" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "HunkHeader" |
|---|
| size_min | "0x14" |
|---|
| endianness | "big" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "id" |
|---|
| note | "0x000003F3" |
|---|
|
| offset | "0x4" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "resident_name_len" |
|---|
| note | "0 = no resident library names (otherwise len longs of name follow, repeated until 0)" |
|---|
|
| offset | "0x8" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "table_size" |
|---|
| note | "number of hunks the loader allocates" |
|---|
|
| offset | "0xC" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "first_hunk" |
|---|
| note | "0 for a normal executable" |
|---|
|
| offset | "0x10" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "last_hunk" |
|---|
| note | "table_size-1 for a non-overlay executable" |
|---|
|
| offset | "0x14" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "hunk_size[last-first+1]" |
|---|
| note | "(size_in_longs & 0x3FFFFFFF) | memflags<<30; flag 11 adds a longword" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "amiga_read_load: resident libs (first long != 0) abort, max_hunk_number = long 1, root hunk number must be 0, last must be table size-1 else 'Overlay loadfiles are not supported', then per hunk: HUNK_ATTRIBUTE chip -> MEMF_CHIP, fast -> MEMF_FAST, follows -> another longword; size = HUNK_VALUE << 2" |
|---|
| repo | "AmigaPorts/binutils-gdb" |
|---|
| commit | "e9ab8a4a62fc6fc6b486ff77040cafe00229c847" |
|---|
| path | "bfd/amigaos.c" |
|---|
| lines | "1033-1096" |
|---|
|
| type | "source" |
|---|
| detail | "HUNK_ATTRIBUTE(id) = id >> 30; HUNK_ATTR_CHIP 1, FAST 2, FOLLOWS 3; HUNKB_ADVISORY 29, HUNKB_CHIP 30, HUNKB_FAST 31" |
|---|
| repo | "AmigaPorts/binutils-gdb" |
|---|
| commit | "e9ab8a4a62fc6fc6b486ff77040cafe00229c847" |
|---|
| path | "bfd/libamiga.h" |
|---|
| lines | "57-64, 240-245" |
|---|
|
| type | "source" |
|---|
| detail | "HunkHeaderBlock.parse reads reslib names until a zero length, then table_size, first_hunk, last_hunk and (last-first+1) sizes masked with 0x3FFFFFFF" |
|---|
| repo | "cnvogelg/amitools" |
|---|
| commit | "3b57f2052ee76c28bbc5e4256227f62dca7b1c9f" |
|---|
| path | "amitools/binfmt/hunk/HunkBlockFile.py" |
|---|
| lines | "100-127" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "HUNK_HEADER" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T01:58:04.123Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T08:44:12.186Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read bfd/amigaos.c amiga_read_load at the cited commit (lines 1030-1100): resident-lib long must be 0, then table size, first hunk must be 0, last must be table size-1, then per hunk a size long with HUNK_ATTRIBUTE chip/fast/follows(extra long) and size<<2. Matches. Note size_min 0x14 is the fixed part; with at least one hunk the minimum is 0x18." |
|---|
|
|
|---|