代码拉取完成,页面将自动刷新
//------------------------------------------------
//--- 010 Editor v13.0.1 Binary Template
//
// File: d1-flash
// Authors: Mingrui Ma
// Version: 0.0.0
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
RequiresVersion( 12 );
/**** STRUCTURES ****/
struct EgonHead;
typedef struct {
uint32 jump_instruction <format=hex, comment="address of jump_instruction">;
uint64 magic <format=hex>;
uint32 checksum <format=hex, comment="checksum">;
uint32 total_length <format=hex>;
uint32 _head_size;
uint32 fel_script_address;
uint32 fel_uenv_length;
uint32 dt_name_offset;
uint32 dram_size;
uint32 boot_media;
uint32 string_pool[13];
} EgonHead;
/**** PARSING CODE ****/
LittleEndian();
EgonHead head <bgcolor=cLtPurple>;
local uint64 correct_magic = 0x3054422E4E4F4765;
if (correct_magic != head.magic) {
Warning("wrong magic!");
}
local uint32 tmp_check_num = 0;
local uint64 i;
for(i = 10h; i<FileSize(); i+=4){
tmp_check_num += ReadUInt(i);
}
tmp_check_num += ReadUInt(0);
tmp_check_num += ReadUInt(4);
tmp_check_num += ReadUInt(8);
tmp_check_num += 0x5F0A6C39; // stamp number
if (tmp_check_num != ReadUInt(0xC)) {
Warning("Wrong check_num!");
}
local uint32 opcode = head.jump_instruction & 0x7f;
// 0x6f JAL opcode
if (opcode == 0x6f)
{
local uint32 imm1912 = (head.jump_instruction >> 12) & 0xff;
local uint32 imm11 = (head.jump_instruction >> 20) & 0x01;
local uint32 imm101 = (head.jump_instruction >> 21) & 0x3ff;
local uint32 imm20 = (head.jump_instruction >> 31) & 0x01;
local uint32 offset = (imm20 << 20) + (imm1912 << 12) + (imm11 << 11) + (imm101 << 1);
local quad off = FTell();
if(offset < FileSize() && head.total_length <= FileSize()) {
FSeek(offset);
ubyte code[head.total_length - offset] <comment="code",bgcolor=cLtGreen>;
} else {
Warning("code appears to either overlap with header, exist after the end of the file or overlap with the end of the file!");
}
FSeek(off);
}
local uint16 c_ins = head.jump_instruction & 0xffff;
local uint16 c_op = c_ins & 0x3;
local uint16 c_funct3 = c_ins >> 13;
if (c_op == 0x1 && c_funct3 == 0x5) {
local uint16 imm11 = (c_ins >> 12) & 0x1;
local uint16 imm4 = (c_ins >> 11) & 0x1;
local uint16 imm98 = (c_ins >> 9) & 0x3;
local uint16 imm10 = (c_ins >> 8) & 0x1;
local uint16 imm6 = (c_ins >> 7) & 0x1;
local uint16 imm7 = (c_ins >> 6) & 0x1;
local uint16 imm31 = (c_ins >> 3) & 0x7;
local uint16 imm5 = (c_ins >> 2) & 0x1;
local uint16 offset = (imm11 << 11) | (imm4 << 4) | (imm98 << 8) | (imm10 << 10) | (imm6 << 6)| (imm7 << 7)| (imm31 << 1) | (imm5 << 5);
local quad off = FTell();
if(offset < FileSize() && head.total_length <= FileSize()) {
FSeek(offset);
ubyte code[head.total_length - offset] <comment="code",bgcolor=cLtGreen>;
} else {
Warning("code appears to either overlap with header, exist after the end of the file or overlap with the end of the file!");
}
FSeek(off);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。