1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - tools - makerom.TWL 3 File: format_rom.h 4 5 Copyright 2007-2008 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Date:: 2009-02-25#$ 14 $Rev: 10080 $ 15 $Author: yosizaki $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef FORMAT_ROM_H_ 19 #define FORMAT_ROM_H_ 20 21 #include <twl/os/common/format_rom_certificate.h> 22 23 24 #define ROMHEADER_CORP_ID "NINTENDO " 25 #define TITLE_NAME_MAX 12 26 #define GAME_CODE_MAX 4 27 #define MAKER_CODE_MAX 2 28 29 #define DIGEST_SIZE_SHA1 20 30 #define AES_BLOCK_SIZE 16 31 32 #define SECURE_AREA_START 0x00004000 33 #define SECURE_AREA_END 0x00008000 34 #define SECURE_AREA_SIZE (SECURE_AREA_END - SECURE_AREA_START) 35 36 // for out_romheader.c size check 37 #define BOOTABLE_SIZE_ARM9 0x0027c000 // 2.5M - 16K (0x02004000 to 0x02280000) 38 #define BOOTABLE_SIZE_ARM7 0x00040000 // 256K (0x02380000 to 0x023c0000) // NITRO-IPL load size restriction 39 #define BOOTABLE_SIZE_ARM9_LTD 0x00280000 // 2.5M (0x02400000 to 0x02680000) 40 #define BOOTABLE_SIZE_ARM7_LTD 0x000fc000 // 1M - 16K (0x02e80000 to 0x02f80000 or 0x02f00000 to 0x02ffc000) 41 42 #define SIZE_OF_SIGN 136 43 #define NITROCODE_LE 0x2106c0de 44 #define NITROCODE_BE 0xdec00621 45 #define TWLCODE_LE 0x6314c0de 46 #define TWLCODE_BE 0xdec01463 47 #define NINTENDO_LOGO_DATA_LENGTH 0x9c 48 49 // use PlatformCode 50 #define PLATFORM_CODE_FLAG_NTR 0x00 // * Because the platform_code value of the existing NTR-ROM header is "0," it is a desperate attempt 51 #define PLATFORM_CODE_FLAG_NOT_NTR 0x01 52 #define PLATFORM_CODE_FLAG_TWL 0x02 53 #define PLATFORM_CODE_FLAG_NTR_MASK 0x01 54 55 #define PLATFORM_CODE_NTR ( PLATFORM_CODE_FLAG_NTR ) 56 #define PLATFORM_CODE_TWL_HYBLID ( PLATFORM_CODE_FLAG_NTR | PLATFORM_CODE_FLAG_TWL ) 57 #define PLATFORM_CODE_TWL_LIMITED ( PLATFORM_CODE_FLAG_NOT_NTR | PLATFORM_CODE_FLAG_TWL ) 58 59 // use TitleID_Hi 60 #define TITLE_ID_HI_APP_TYPE_SHIFT 0 61 #define TITLE_ID_HI_NOT_LAUNCH_FLAG_SHIFT 1 62 #define TITLE_ID_HI_MEDIA_CODE_SHIFT 2 63 #define TITLE_ID_HI_DATA_ONLY_FLAG_SHIFT 3 64 #define TITLE_ID_HI_SECURE_FLAG_SHIFT 4 65 #define TITLE_ID_HI_PUBLISHER_CODE_SHIFT 16 66 67 #define TITLE_ID_HI_APP_TYPE_MASK ( 0x0001 << TITLE_ID_HI_APP_TYPE_SHIFT ) 68 #define TITLE_ID_HI_NOT_LAUNCH_FLAG_MASK ( 0x0001 << TITLE_ID_HI_NOT_LAUNCH_FLAG_SHIFT ) 69 #define TITLE_ID_HI_MEDIA_MASK ( 0x0001 << TITLE_ID_HI_MEDIA_CODE_SHIFT ) 70 #define TITLE_ID_HI_DATA_ONLY_FLAG_MASK ( 0x0001 << TITLE_ID_HI_DATA_ONLY_FLAG_SHIFT ) 71 #define TITLE_ID_HI_SECURE_FLAG_MASK ( 0x0001 << TITLE_ID_HI_SECURE_FLAG_SHIFT ) 72 #define TITLE_ID_HI_PUBLISHER_CODE_MASK ( 0xffff << TITLE_ID_HI_PUBLISHER_CODE_SHIFT ) 73 74 // use TitleID 75 #define TITLE_ID_HI_SHIFT_OFFSET 32 76 #define TITLE_ID_APP_TYPE_SHIFT ( TITLE_ID_HI_SHIFT_OFFSET + TITLE_ID_HI_APP_TYPE_SHIFT ) 77 #define TITLE_ID_NOT_LAUNCH_FLAG_SHIFT ( TITLE_ID_HI_SHIFT_OFFSET + TITLE_ID_HI_NOT_LAUNCH_FLAG_SHIFT ) 78 #define TITLE_ID_MEDIA_CODE_SHIFT ( TITLE_ID_HI_SHIFT_OFFSET + TITLE_ID_HI_MEDIA_CODE_SHIFT ) 79 #define TITLE_ID_DATA_ONLY_FLAG_SHIFT ( TITLE_ID_HI_SHIFT_OFFSET + TITLE_ID_HI_DATA_ONLY_FLAG_SHIFT ) 80 #define TITLE_ID_SECURE_FLAG_SHIFT ( TITLE_ID_HI_SHIFT_OFFSET + TITLE_ID_HI_SECURE_FLAG_SHIFT ) 81 #define TITLE_ID_PUBLISHER_CODE_SHIFT ( TITLE_ID_HI_SHIFT_OFFSET + TITLE_ID_HI_PUBLISHER_CODE_SHIFT ) 82 83 #define TITLE_ID_APP_TYPE_MASK ( 0x0001ULL << TITLE_ID_APP_TYPE_SHIFT ) 84 #define TITLE_ID_NOT_LAUNCH_FLAG_MASK ( 0x0001ULL << TITLE_ID_NOT_LAUNCH_FLAG_SHIFT ) 85 #define TITLE_ID_MEDIA_MASK ( 0x0001ULL << TITLE_ID_MEDIA_CODE_SHIFT ) 86 #define TITLE_ID_DATA_ONLY_FLAG_MASK ( 0x0001ULL << TITLE_ID_DATA_ONLY_FLAG_SHIFT ) 87 #define TITLE_ID_SECURE_FLAG_MASK ( 0x0001ULL << TITLE_ID_SECURE_FLAG_SHIFT ) 88 #define TITLE_ID_PUBLISHER_CODE_MASK ( 0xffffULL << TITLE_ID_PUBLISHER_CODE_SHIFT ) 89 90 #define PARENTAL_CONTROL_INFO_SIZE 0x10 91 92 93 /*===========================================================================* 94 * ROM FORMAT 95 *===========================================================================*/ 96 97 // ROM access control info 98 typedef struct RomAccessControl { 99 u32 common_client_key :1; // Launcher deliver common client Key 100 u32 hw_aes_slot_B :1; // Launcher deliver HW AES slot B setting for ES 101 u32 hw_aes_slot_C :1; // Launcher deliver HW AES slot C setting for NAM 102 u32 sd_card_access :1; // SD card access control 103 u32 nand_access :1; // NAND access control 104 u32 game_card_on :1; // Game card power is turned ON by the NAND application (Normal Mode) 105 u32 shared2_file :1; // Shared file in "nand:/shared2" 106 u32 hw_aes_slot_B_SignJPEGForLauncher :1; // Launcher deliver HW AES slot B setting for Sign JPEG for Launcher 107 u32 game_card_nitro_mode :1; // Access the game card NTR-compatible region by the NAND application 108 u32 hw_aes_slot_A_SSLClientCert :1; // Launcher deliver HW AES slot A setting for SSL Client Certificate 109 u32 hw_aes_slot_B_SignJPEGForUser :1; // Launcher deliver HW AES slot B setting for Sign JPEG for User 110 u32 photo_access_read :1; // "photo:" Archive read-access control 111 u32 photo_access_write :1; // "photo:" Archive write-access control 112 u32: 18; 113 u32 common_client_key_for_debugger_sysmenu :1; // Launcher deliver common client Key 114 }RomAccessControl; 115 116 // ROM expansion flags 117 typedef struct RomExpansionFlags { 118 u8 codec_mode:1; // 0:NTR mode, 1:TWL mode // Undeveloped 119 u8 agree_EULA:1; // 1: Necessary to agree EULA 120 u8 availableSubBannerFile:1; // 1: Available SubBannerFile 121 u8 WiFiConnectionIcon :1; // 1: Display Wi-Fi Connection on Launcher 122 u8 DSWirelessIcon :1; // 1: Display DSWirelessIcon on Launcher 123 u8 rsv_d5:1; 124 u8 enable_nitro_whitelist_signature :1; // 1: NITRO white list signature enable flag 125 u8 developer_encrypt:1; // 1: If the development version security is applied: "1" "0" with the product version (*This is valid after TwlSDK UIG_branch/RC2) 126 }RomExpansionFlags; 127 128 //--------------------------------------------------------------------------- 129 // Section A ROM HEADER 130 //--------------------------------------------------------------------------- 131 132 typedef struct ROM_Header_Short 133 { 134 //========================================================== 135 // 136 // NTR/TWL common 137 // 138 //========================================================== 139 140 // 141 // 0x000 System Reserved 142 // 143 char title_name[TITLE_NAME_MAX]; // Soft title name 144 char game_code[GAME_CODE_MAX]; // Game code 145 char maker_code[MAKER_CODE_MAX]; // Maker code 146 char platform_code; // Platform code bit0: not support NTR, bit1: support TWL ( NTR_only=0x00, NTR/TWL=0x03, TWL_only=0x02 ) 147 u8 rom_type; // ROM type 148 u8 rom_size; // ROM size (rom_sizes-th power of 2 Mbit: ex. When 128 Mbits, rom_size = 7) 149 150 u8 reserved_A[7]; // System Reserved A ( Set ALL 0 ) 151 152 u8 enable_signature:1; // Enable ROM Header signature 153 u8 enable_aes:1; // Enable AES encryption 154 u8 developer_encrypt_old:1; // If the development version security is applied: "1" "0" with the product version (*This is valid up to TwlSDK RC.) 155 u8 disable_debug:1; // Debug prohibited flag 156 u8: 4; 157 158 u8 permit_landing_normal_jump:1; // Allow to be called by normal jump in an application jump (for TWL Application Jump) 159 u8 permit_landing_tmp_jump:1; // Allow to be called by TMP jump in an application jump (for TWL Application Jump) 160 // * The NTR demo version only has a DS Download Play signature so this plug-in must be stored in a region of 0x160 bytes of the NTR-ROM header 161 u8: 4; 162 u8 for_korea:1; // For Korea 163 u8 for_china:1; // For China 164 165 u8 rom_version; // ROM version 166 167 u8 comp_arm9_boot_area:1; // Compress ARM9 boot area 168 u8 comp_arm7_boot_area:1; // Compress ARM7 boot area 169 u8 inspect_card:1; // Show inspect card 170 u8 disable_clear_memory_pad:1; // For Debugger 171 u8 enable_twl_rom_cache_read:1; // Enable TWL ROM cacheRead command 172 u8 :1; // Reserved 173 u8 warning_no_spec_rom_speed:1;// Warning not to specify ROM speed 174 u8 disable_detect_pull_out:1; // 175 176 // 177 // 0x020 for Static modules (Section:B) 178 // 179 // ARM9 180 u32 main_rom_offset; // ROM offset 181 void *main_entry_address; // Entry point 182 void *main_ram_address; // RAM address 183 u32 main_size; // Module size 184 185 // ARM7 186 u32 sub_rom_offset; // ROM offset 187 void *sub_entry_address; // Entry point 188 void *sub_ram_address; // RAM address 189 u32 sub_size; // Module size 190 191 // 192 // 0x040 for File Name Table[FNT] (Section:C) 193 // 194 struct ROM_FNT *fnt_offset; // ROM offset 195 u32 fnt_size; // Table size 196 197 // 198 // 0x048 for File Allocation Table[FAT] (Section:E) 199 // 200 struct ROM_FAT *fat_offset; // ROM offset 201 u32 fat_size; // Table size 202 203 // 204 // 0x050 for Overlay Tables[OVT] (Section:D) 205 // 206 // ARM9 207 struct ROM_OVT *main_ovt_offset; // ROM offset 208 u32 main_ovt_size; // Table size 209 210 // ARM7 211 struct ROM_OVT *sub_ovt_offset; // ROM offset 212 u32 sub_ovt_size; // Table size 213 214 // 0x060 for ROM control parameter (Section:F) 215 u32 game_cmd_param; // Game command parameter 216 u32 secure_cmd_param; // Secure command parameter 217 218 u32 banner_offset; // Banner ROM offset 219 220 u16 secure_area_crc16; // Secure area CRC-16 221 u16 secure_cmd_latency; // Secure command latency ((param+2)*256 system cycles) 222 223 // Since NITRO-SDK 2.0PR4 224 void *main_autoload_done; // ARM9 autoload done callback address (debug purpose) 225 void *sub_autoload_done; // ARM7 autoload done callback address (debug purpose) 226 227 u8 ctrl_reserved_B[8]; // Ctrl Reserved B (Set 0) 228 229 // Since NITRO-SDK 2.0PR6 230 u32 rom_valid_size; // ROM Original Size 231 u32 rom_header_size; // ROM Header size 232 u32 main_module_param_offset; // Offset for table of ARM9 module parameters 233 u32 sub_module_param_offset; // Offset for table of ARM7 module parameters 234 235 // 0x090 - 0x0C0 System Reserved 236 u16 twl_card_normal_area_rom_offset; // Not yet developed 237 u16 twl_card_keytable_area_rom_offset; // Not yet developed 238 u16 nand_card_dl_area_rom_offset; // Not yet developed 239 u16 nand_card_bk_area_rom_offset; // Not yet developed 240 u8 nand_card_flag; // Not yet developed 241 u8 reserved_B[39]; 242 243 // 0x0C0 for Nintendo logo data 244 u8 nintendo_logo[ NINTENDO_LOGO_DATA_LENGTH ]; // Nintendo logo data 245 u16 nintendo_logo_crc16; // CRC-16 246 247 // 0x15E ROM header CRC-16 248 u16 header_crc16; // ROM header CRC-16 249 250 // 0x160 - 0x180 Debugger Reserved 251 u8 reserved_C[32]; // Debugger Reserved (Set ALL 0) 252 253 //========================================================== 254 // 255 // TWL only 256 // 257 //========================================================== 258 259 // 0x180 - 0x190 TWL-WRAM A/B/C ARM9 configuration data 260 u32 main_wram_config_data[8]; // Under development 261 262 // 0x1A0 - 0x1B0 TWL-WRAM A/B/C ARM7 configuration data 263 u32 sub_wram_config_data[4]; // Under development 264 265 // 0x1B0 - Card Region bitmap 266 u32 card_region_bitmap; 267 268 // 0x1B4 - AccessControl 269 RomAccessControl access_control; 270 /* Caution: The address of 0x01b4 is hard coded in fatfs_command.c. 271 Do not change the offset of this member. */ 272 273 // 0x1B8 - ARM7-SCFG 274 u32 arm7_scfg_ext; // SCFG-EXT 275 276 // padding(3byte) 277 u8 reserved_ltd_A2[ 3 ]; 278 279 // 0x1BF - TWL expansion flags 280 RomExpansionFlags exFlags; 281 282 // 0x1C0 for EX Static modules 283 // 284 // ARM9 285 u32 main_ltd_rom_offset; // ROM offset // not yet developed 286 u8 reserved_ltd_B[ 4 ]; 287 void *main_ltd_ram_address; // RAM address // Not yet developed // 288 u32 main_ltd_size; // Module size // Not yet developed // 289 290 // ARM7 291 u32 sub_ltd_rom_offset; // ROM offset // Not yet developed 292 void *sub_mount_info_ram_address; // ARM7 MountInfo RAM address. 293 void *sub_ltd_ram_address; // RAM address // Not yet developed // 294 u32 sub_ltd_size; // Module size // Not yet developed // 295 /* Caution: Addresses between 0x01c0 and 0x01e0 are hard coded in os_reset.c, crt0.HYB.c, and crt0.LTD.c. 296 Do not change the offset of these eight members. */ 297 298 // 0x01E0 - 0x01E8 for NITRO digest area offset & size 299 u32 nitro_digest_area_rom_offset; 300 u32 nitro_digest_area_size; 301 302 // 0x01E8 - 0x01F0 for TWL digest area offset & size 303 u32 twl_digest_area_rom_offset; 304 u32 twl_digest_area_size; 305 306 // 0x01F0 - 0x01F8 for FS digest table1 offset & size 307 u32 digest1_table_offset; 308 u32 digest1_table_size; 309 310 // 0x01F8 - 0x0200 for FS digest table2 offset & size 311 u32 digest2_table_offset; 312 u32 digest2_table_size; 313 314 // 0x0200 - 0x0208 for FS digest config parameters 315 u32 digest1_block_size; 316 u32 digest2_covered_digest1_num; 317 318 // 0x0208 - 0x020C for TWL banner size. 319 u32 banner_size; 320 321 // 0x020C - 0x020E for shared2 files size 322 u8 shared2_file0_size; // shared2 file [0] 323 u8 shared2_file1_size; // shared2 file [1] 324 /* Caution: The addresses between 0x020C-0x020D are hard coded in fatfs_command.c. 325 Do not change the offset of this member. */ 326 327 // 0x020E For the version of EULA agreed 328 u8 agree_EULA_version; 329 330 // 0x020F TWL Administration flags 331 u8 unnecessary_rating_display:1; // Enable this flag when rating display is not necessary (for administration, not used in the launcher) 332 u8: 7; 333 334 // 0x0210 - 0x0214 for TWL rom valid size 335 u32 twl_rom_valid_size; // ROM Original Size 336 337 // 0x0214 - 0x0218 for shared2 files size 338 u8 shared2_file2_size; // shared2 file [2] 339 u8 shared2_file3_size; // shared2 file [3] 340 u8 shared2_file4_size; // shared2 file [4] 341 u8 shared2_file5_size; // shared2 file [5] 342 /* Caution: The addresses between 0x0214 - 0x0217 are hard coded in fatfs_command.c. 343 Do not change the offset of this member. */ 344 345 // 0x0218 - 0x0220 for TWL ltd module param offset 346 u32 main_ltd_module_param_offset; // Offset for table of ARM9 ltd module parameters 347 u32 sub_ltd_module_param_offset; // Offset for table of ARM7 ltd module parameters 348 349 // 0x0220 - 0x0230 for AES target offset & size 350 u32 aes_target_rom_offset; 351 u32 aes_target_size; 352 u32 aes_target2_rom_offset; // Reserved 353 u32 aes_target2_size; // Reserved 354 355 // 0x0230 - 0x0238 for TitleID 356 union { 357 u64 titleID; 358 struct { 359 u8 titleID_Lo[ 4 ]; 360 u32 titleID_Hi; 361 }; 362 }; 363 /* Caution: 0x0234 is hard coded in os_reset.c/crt0.HYB.c/crt0.LTD.c/fatfs_command.c 364 Do not change the offset of titleID_Hi. */ 365 366 // 0x0238 - 0x0240 for Public & Private Save Data Size 367 u32 public_save_data_size; 368 u32 private_save_data_size; 369 370 // 0x0240 - 0x02f0 reserved. 371 u8 reserved_ltd_F[ 0x2f0 - 0x240 ]; 372 373 // 0x02f0 - 0x0300 Parental Controls Rating Info 374 u8 parental_control_rating_info[ PARENTAL_CONTROL_INFO_SIZE ]; 375 376 // 0x0300 - 0x03b4 Rom Segment Digest 377 u8 main_static_digest[ DIGEST_SIZE_SHA1 ]; 378 u8 sub_static_digest[ DIGEST_SIZE_SHA1 ]; 379 u8 digest2_table_digest[ DIGEST_SIZE_SHA1 ]; 380 u8 banner_digest[ DIGEST_SIZE_SHA1 ]; 381 u8 main_ltd_static_digest[ DIGEST_SIZE_SHA1 ]; 382 u8 sub_ltd_static_digest[ DIGEST_SIZE_SHA1 ]; 383 u8 nitro_whitelist_phase1_digest[ DIGEST_SIZE_SHA1 ]; 384 u8 nitro_whitelist_phase2_diegst[ DIGEST_SIZE_SHA1 ]; 385 u8 main_static_without_secure_digest[ DIGEST_SIZE_SHA1 ]; 386 } 387 ROM_Header_Short; 388 389 390 typedef struct 391 { 392 struct ROM_Header_Short s; 393 394 //// 395 //// EXTRA SYSTEM REGION 396 //// 397 398 // 399 // 0x0378 - 0x0e00 System Reserved 400 // 401 u8 reserved_D[4 * 1024 - sizeof(ROM_Header_Short) - sizeof(RomCertificate) - RSA_KEY_LENGTH ]; // Reserved D 402 403 // 404 // 0x0e00 - 0x0f80 ROM Certificate 405 // 406 RomCertificate certificate; 407 408 // 409 // 0x0f80 - 0x1000 ROM Header Signature 410 // 411 u8 signature[ RSA_KEY_LENGTH ]; // The state where RSA encryption is applied to SignatureData formatted in the PKCS#1_v1.5 format 412 413 // 414 // 0x01000 - 0x04000 System Reserved 415 // 416 u8 reserved_E[12 * 1024]; // Reserved E 417 418 } 419 ROM_Header; // 16KB 420 421 422 423 // Data in the signature (ROM_Header.signature) 424 typedef struct SignatureData 425 { 426 u8 digest[ DIGEST_SIZE_SHA1 ]; 427 }SignatureData; 428 429 430 431 //--------------------------------------------------------------------------- 432 // Section C FNT: FILE NAME TABLE 433 // - DIRECTORY TABLE 434 // - ENTRY TABLE 435 //--------------------------------------------------------------------------- 436 437 typedef struct ROM_FNTDir 438 { 439 u32 entry_start; // Offset for entry 440 u16 entry_file_id; // File ID for 1st file 441 u16 parent_id; // Parent directory ID 442 443 } 444 ROM_FNTDir; 445 446 447 /* P-SEUDO CODE for YOUR INFO. 448 typedef struct ROM_FNTStrFile 449 { 450 u8 entry_type :1; // 0 if file entry 451 u8 entry_name_length:7; // Length of filename (0-127) 452 char entry_name[length]; // Filename (surpress '\0') 453 454 } ROM_FNTStrFile; 455 456 457 typedef struct ROM_FNTStrDir 458 { 459 u8 entry_type :1; // 1 if directory entry 460 u8 entry_name_length:7; // Length of directory name (0-127) 461 char entry_name[length]; // Directory name (suppress '\0') 462 u8 dir_id_L; // Low byte of directory ID 463 u8 dir_id_H; // High byte of directory ID 464 } ROM_FNTStrDir; 465 */ 466 467 //--------------------------------------------------------------------------- 468 // Section D OVT: OVERLAY TABLE 469 //--------------------------------------------------------------------------- 470 471 typedef struct ROM_OVT 472 { 473 void *id; // Overlay ID 474 void *ram_address; // RAM address 475 u32 ram_size; // RAM size 476 u32 bss_size; // BSS size 477 void *sinit_init; // Static initializer start 478 void *sinit_init_end; // Static initializer end 479 u32 file_id; // File ID in FAT 480 u32 compressed:24; // Size after overlay compression 481 u32 flag:8; // Overlay information flag 482 483 } 484 ROM_OVT; 485 486 487 //--------------------------------------------------------------------------- 488 // Section E FAT: FILE ALLOCATION TABLE 489 //--------------------------------------------------------------------------- 490 491 typedef struct ROM_FilePtr 492 { 493 u32 offset; // Offset 494 495 } 496 ROM_FilePtr; 497 498 499 typedef struct ROM_FAT 500 { 501 ROM_FilePtr top; // File region start 502 ROM_FilePtr bottom; // End 503 504 } 505 ROM_FAT; 506 507 508 //--------------------------------------------------------------------------- 509 // Section F LT: ROM LATENCY 510 //--------------------------------------------------------------------------- 511 512 typedef enum 513 { 514 ONETROM = 0, 515 MROM 516 } 517 tRomSpeedType; 518 519 typedef struct ROM_LT 520 { 521 u32 game_latency; 522 u32 secure_hw_latency; 523 u16 secure_sw_latency; 524 u16 padding; 525 526 } 527 ROM_LT; 528 529 530 //--------------------------------------------------------------------------- 531 // Section X ONT: OVERLAY NAME TABLE (not included in ROM) generated by LD 532 // - OverlayDefs 533 //--------------------------------------------------------------------------- 534 535 typedef struct ROM_ONTHeader 536 { 537 void *static_ram_address; // Static module ram_address 538 void *static_entry_address; // Entry address 539 u32 static_size; // Size 540 void *static_autoload_done; // Autoload done callback address 541 542 } 543 ROM_ONTHeader; 544 545 typedef struct ROM_ONT 546 { 547 ROM_ONTHeader header; 548 char file_list[1]; 549 char padding[3]; 550 551 } 552 ROM_ONT; 553 554 //--------------------------------------------------------------------------- 555 // Section Y MDP: Module params 556 //--------------------------------------------------------------------------- 557 typedef struct tModuleParam 558 { 559 void *autoload_list; 560 void *autoload_list_end; 561 void *autoload_start; 562 void *static_bss_start; 563 void *static_bss_end; 564 void *compressed_static_end; // Indicates one element ahead for tCompFooter 565 u32 version; 566 u32 nitro_magic_be; 567 u32 nitro_magic_le; 568 569 } 570 tModuleParam; 571 572 typedef struct tLtdModuleParam 573 { 574 void *autoload_list; 575 void *autoload_list_end; 576 void *autoload_start; 577 void *compressed_static_end; // Indicates one element ahead for tCompFooter 578 u32 twl_magic_be; 579 u32 twl_magic_le; 580 } 581 tLtdModuleParam; 582 583 584 typedef struct 585 { 586 u32 bufferTop:24; 587 u32 compressBottom:8; 588 u32 originalBottom; 589 } 590 tCompFooter; 591 592 typedef struct // Taken from comp static/component.h 593 { 594 u32 magicNumber; // Identifier == MAGICNUMBER_FOOTER 595 int staticParamsOffset; // Offset to StaticParams 596 int digestParamsOffset; // Offset to SDK_DIGEST_TABLE 597 int ltdStaticParamsOffset; // Offset to LtdStaticParams 598 } 599 StaticFooter; 600 601 #endif //FORMAT_ROM_H_ 602