[ARM-assembly]-ARM交叉编译器下编译的各个镜像的反汇编文件分析
生活随笔
收集整理的這篇文章主要介紹了
[ARM-assembly]-ARM交叉编译器下编译的各个镜像的反汇编文件分析
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
文章目錄
- 1、preloader的dump文件
- 2、ATF的dump文件
- (1)、section段
- (2)、符號表 symbol table
- (3)、匯編代碼段 disassembly
- (4)、常量區(qū)
- 3、lk的dump文件
- 4、linux kernel的dump文件
1、preloader的dump文件
vim preloader.dump
preloader_xxx.elf: file format elf32-littlearmDisassembly of section .start:00201000 <bldr_args_addr>:201000: 00000000 .word 0x0000000000201004 <_start>:201004: ea000005 b 201020 <resethandler>00201008 <bss1_start>:201008: 00102000 .word 0x001020000020100c <bss1_end>:20100c: 0010cd78 .word 0x0010cd78 00201010 <bss2_start>:201010: 00267000 .word 0x0026700000201014 <bss2_end>:201014: 00274144 .word 0x0027414400201018 <stack>:201018: 00200000 .word 0x002000000020101c <stacksz>:20101c: 00243144 .word 0x0024314400201020 <resethandler>:201020: e59f6124 ldr r6, [pc, #292] ; 20114c <apmcu_disable_smp+0x10>201024: e5864000 str r4, [r6]201028: e3a00000 mov r0, #020102c: e3a01000 mov r1, #0201030: e3a02000 mov r2, #0201034: e3a03000 mov r3, #0201038: e3a04000 mov r4, #020103c: e3a05000 mov r5, #0201040: e3a06000 mov r6, #0201044: e3a07000 mov r7, #0201048: e3a08000 mov r8, #020104c: e3a09000 mov r9, #0201050: e3a0a000 mov sl, #0201054: e3a0b000 mov fp, #0201058: e3a0c000 mov ip, #020105c: e3a0d000 mov sp, #0201060: e3a0e000 mov lr, #0201064: e10f0000 mrs r0, CPSR201068: e3c0001f bic r0, r0, #3120106c: e38000d3 orr r0, r0, #211 ; 0xd3201070: e129f000 msr CPSR_fc, r0201074: e10f0000 mrs r0, CPSR201078: e3a010c0 mov r1, #192 ; 0xc020107c: e1800001 orr r0, r0, r1201080: e12ff000 msr CPSR_fsxc, r0201084: ee11cf10 mrc 15, 0, ip, cr1, cr0, {0}201088: e38cca01 orr ip, ip, #4096 ; 0x100020108c: e3ccc004 bic ip, ip, #4201090: ee01cf10 mcr 15, 0, ip, cr1, cr0, {0}00201094 <clear_bss1>:201094: e51f0094 ldr r0, [pc, #-148] ; 201008 <bss1_start>201098: e51f1094 ldr r1, [pc, #-148] ; 20100c <bss1_end>20109c: e3a02000 mov r2, #02010a0: e1500001 cmp r0, r12010a4: 0a000003 beq 2010b8 <clear_bss2>2、ATF的dump文件
cat bl31.elf
(1)、section段
architecture: aarch64, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x000000004ce01000Program Header:LOAD off 0x0000000000000000 vaddr 0x000000004ce00000 paddr 0x000000004ce00000 align 2**16filesz 0x0000000000021138 memsz 0x0000000000041000 flags rwxSTACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw- private flags = 0:Sections: Idx Name Size VMA LMA File off Algn0 ro 0001f000 000000004ce01000 000000004ce01000 00001000 2**11CONTENTS, ALLOC, LOAD, CODE1 .data 00000d18 000000004ce20000 000000004ce20000 00020000 2**3CONTENTS, ALLOC, LOAD, DATA2 .got 00000400 000000004ce20d18 000000004ce20d18 00020d18 2**3CONTENTS, ALLOC, LOAD, DATA3 .got.plt 00000018 000000004ce21118 000000004ce21118 00021118 2**3CONTENTS, ALLOC, LOAD, DATA4 mtk_noncache_dram 00000008 000000004ce21130 000000004ce21130 00021130 2**3CONTENTS, ALLOC, LOAD, DATA5 stacks 00004000 000000004ce21140 000000004ce21140 00021138 2**6ALLOC6 .bss 000071c0 000000004ce25140 000000004ce25140 00021138 2**6ALLOC7 xlat_table 00014000 000000004ce2d000 000000004ce2d000 00021138 2**12ALLOC8 .debug_info 00051d39 0000000000000000 0000000000000000 00021138 2**0CONTENTS, READONLY, DEBUGGING9 .debug_abbrev 0000fd08 0000000000000000 0000000000000000 00072e71 2**0CONTENTS, READONLY, DEBUGGING10 .debug_aranges 00004360 0000000000000000 0000000000000000 00082b80 2**4CONTENTS, READONLY, DEBUGGING11 .debug_line 00013c85 0000000000000000 0000000000000000 00086ee0 2**0CONTENTS, READONLY, DEBUGGING12 .debug_str 0000deb4 0000000000000000 0000000000000000 0009ab65 2**0CONTENTS, READONLY, DEBUGGING13 .comment 00000027 0000000000000000 0000000000000000 000a8a19 2**0CONTENTS, READONLY14 .debug_loc 0004cd65 0000000000000000 0000000000000000 000a8a40 2**0CONTENTS, READONLY, DEBUGGING15 .debug_ranges 00006d70 0000000000000000 0000000000000000 000f57b0 2**4CONTENTS, READONLY, DEBUGGING16 .debug_frame 00008090 0000000000000000 0000000000000000 000fc520 2**3CONTENTS, READONLY, DEBUGGING(2)、符號表 symbol table
SYMBOL TABLE: 000000004ce01000 l d ro 0000000000000000 ro 000000004ce20000 l d .data 0000000000000000 .data 000000004ce20d18 l d .got 0000000000000000 .got 000000004ce21118 l d .got.plt 0000000000000000 .got.plt 000000004ce21130 l d mtk_noncache_dram 0000000000000000 mtk_noncache_dram 000000004ce21140 l d stacks 0000000000000000 stacks 000000004ce25140 l d .bss 0000000000000000 .bss 000000004ce2d000 l d xlat_table 0000000000000000 xlat_table 0000000000000000 l d .debug_info 0000000000000000 .debug_info 0000000000000000 l d .debug_abbrev 0000000000000000 .debug_abbrev 0000000000000000 l d .debug_aranges 0000000000000000 .debug_aranges 0000000000000000 l d .debug_line 0000000000000000 .debug_line 0000000000000000 l d .debug_str 0000000000000000 .debug_str 0000000000000000 l d .comment 0000000000000000 .comment 0000000000000000 l d .debug_loc 0000000000000000 .debug_loc 0000000000000000 l d .debug_ranges 0000000000000000 .debug_ranges 0000000000000000 l d .debug_frame 0000000000000000 .debug_frame 0000000000000000 l df *ABS* 0000000000000000 /work/hehezhou/code/x683_2/out_vnd/target/product/x683_h694/trustzone/ATF_OBJ/debug/bl31/bl31_entrypoint.o 0000000000000000 l df *ABS* 0000000000000000 mtk_sip_svc.c 000000004ce18f90 l O ro 000000000000001c __func__.3449 000000004ce19148 l O ro 0000000000000015 __func__.3542 000000004ce1e768 l O ro 0000000000000020 __svc_desc_mediatek_sip_svc 0000000000000000 l df *ABS* 0000000000000000 bl31_fiq_handler.c 0000000000000000 l df *ABS* 0000000000000000 fiq_smp_call.c 0000000000000000 l df *ABS* 0000000000000000 mtk_aee_debug.c 000000004ce19270 l O ro 000000000000000d __func__.3164 000000004ce19518 l O ro 000000000000001d __func__.3128 0000000000000000 l df *ABS* 0000000000000000 log.c 000000004ce02324 l F ro 000000000000003c mt_crash_log_write 000000004ce25140 l O .bss 0000000000000004 mt_log_secure_os_pos 000000004ce25144 l O .bss 0000000000000004 mt_log_buf_start 000000004ce25148 l O .bss 0000000000000004 atf_buf_lock ........(3)、匯編代碼段 disassembly
Disassembly of section ro:000000004ce01000 <bl31_entrypoint>:4ce01000: aa0003f4 mov x20, x04ce01004: aa0103f5 mov x21, x14ce01008: aa0203f6 mov x22, x24ce0100c: aa0303f7 mov x23, x34ce01010: 100eff80 adr x0, 4ce1f000 <sync_exception_sp_el0>4ce01014: d51ec000 msr vbar_el3, x04ce01018: d5033fdf isb4ce0101c: 9400554d bl 4ce16550 <reset_handler>4ce01020: d2820141 mov x1, #0x100a // #41064ce01024: d53e1000 mrs x0, sctlr_el34ce01028: aa010000 orr x0, x0, x14ce0102c: d51e1000 msr sctlr_el3, x04ce01030: d5033fdf isb4ce01034: 9400553d bl 4ce16528 <init_cpu_data_ptr>4ce01038: d2804700 mov x0, #0x238 // #5684ce0103c: d51e1100 msr scr_el3, x04ce01040: d2900000 mov x0, #0x8000 // #327684ce01044: f2a00020 movk x0, #0x1, lsl #164ce01048: d51e1320 msr mdcr_el3, x04ce0104c: d50344ff msr daifclr, #0x44ce01050: d2800000 mov x0, #0x0 // #04ce01054: d51e1140 msr cptr_el3, x04ce01058: 58000340 ldr x0, 4ce010c0 <bl31_entrypoint+0xc0>4ce0105c: 58000361 ldr x1, 4ce010c8 <bl31_entrypoint+0xc8>4ce01060: cb000021 sub x1, x1, x04ce01064: 940056cc bl 4ce16b94 <inv_dcache_range>4ce01068: 58000340 ldr x0, 4ce010d0 <bl31_entrypoint+0xd0>.......4ce18edc: 1400000b b 4ce18f08 <SB_HalWaitDescCompletion+0xf0>4ce18ee0: b94e02a0 ldr w0, [x21,#3584]4ce18ee4: aa1503e0 mov x0, x214ce18ee8: 9400000d bl 4ce18f1c <SB_HalClearInterruptBit>4ce18eec: aa1403e0 mov x0, x204ce18ef0: aa1303e1 mov x1, x194ce18ef4: 52800102 mov w2, #0x8 // #84ce18ef8: 52800063 mov w3, #0x3 // #34ce18efc: d2800004 mov x4, #0x0 // #04ce18f00: 97fffee8 bl 4ce18aa0 <SaSi_PalDmaUnmap>4ce18f04: 52800000 mov w0, #0x0 // #04ce18f08: 910003bf mov sp, x294ce18f0c: a94153f3 ldp x19, x20, [sp,#16]4ce18f10: f94013f5 ldr x21, [sp,#32]4ce18f14: a8c57bfd ldp x29, x30, [sp],#804ce18f18: d65f03c0 ret(4)、常量區(qū)
000000004ce18f1c <SB_HalClearInterruptBit>:4ce18f1c: 52800081 mov w1, #0x4 // #44ce18f20: b90a0801 str w1, [x0,#2568]4ce18f24: d65f03c0 ret000000004ce18f28 <SB_HalWaitInterrupt>:4ce18f28: aa0003e1 mov x1, x04ce18f2c: b94a0020 ldr w0, [x1,#2560]4ce18f30: 34ffffe0 cbz w0, 4ce18f2c <SB_HalWaitInterrupt+0x4>4ce18f34: d65f03c0 ret000000004ce18f38 <version_string>:4ce18f38: 362e3176 62656428 3a296775 6c612d74 v1.6(debug):t-al4ce18f48: 722d7370 61656c65 712d6573 706d2e30 ps-release-q0.mp4ce18f58: 39562d31 3730312e 2d39322d 39393867 1-V9.107-29-g8994ce18f68: 61343930 00000031 094a1...000000004ce18f70 <build_message>:4ce18f70: 6c697542 203a2074 353a3731 36313a32 Built : 17:52:164ce18f80: 6553202c 35312070 32303220 00000030 , Sep 15 2020.........000000004ce1e0ca <newline>:4ce1e0ca: 000a .short 0x000a000000004ce1e0cc <spacer>:4ce1e0cc: 3009093a .word 0x3009093a4ce1e0d0: 0078 .short 0x0078000000004ce1e0d2 <print_spacer>:4ce1e0d2: 3d20 .short 0x3d204ce1e0d4: 78300909 .word 0x78300909...000000004ce1e0d9 <gp_regs>:4ce1e0d9: 78 .byte 0x784ce1e0da: 0030 .short 0x00304ce1e0dc: 78003178 .word 0x780031784ce1e0e0: 33780032 .word 0x337800324ce1e0e4: 00347800 .word 0x003478004ce1e0e8: 78003578 .word 0x780035784ce1e0ec: 37780036 .word 0x377800364ce1e0f0: 00387800 .word 0x003878004ce1e0f4: 78003978 .word 0x780039784ce1e0f8: 78003031 .word 0x780030314ce1e0fc: 78003131 .word 0x780031314ce1e100: 78003231 .word 0x780032314ce1e104: 78003331 .word 0x780033314ce1e108: 78003431 .word 0x780034314ce1e10c: 78003531 .word 0x780035314ce1e110: 78003631 .word 0x780036314ce1e114: 78003731 .word 0x780037314ce1e118: 78003831 .word 0x780038314ce1e11c: 78003931 .word 0x780039314ce1e120: 78003032 .word 0x780030324ce1e124: 78003132 .word 0x780031324ce1e128: 78003232 .word 0x780032324ce1e12c: 78003332 .word 0x780033324ce1e130: 78003432 .word 0x780034324ce1e134: 78003532 .word 0x780035324ce1e138: 78003632 .word 0x780036324ce1e13c: 78003732 .word 0x780037324ce1e140: 78003832 .word 0x780038324ce1e144: 00003932 .word 0x00003932......3、lk的dump文件
vim lk.dump
lk: file format elf32-littlearmDisassembly of section .text.boot:4c400000 <_start>: 4c400000: ea000007 b 4c400024 <reset> 4c400004: ea00771a b 4c41dc74 <arm_undefined> 4c400008: ea007720 b 4c41dc90 <arm_syscall> 4c40000c: ea007726 b 4c41dcac <arm_prefetch_abort> 4c400010: ea00772c b 4c41dcc8 <arm_data_abort> 4c400014: ea007732 b 4c41dce4 <arm_reserved> 4c400018: ea007732 b 4c41dce8 <arm_irq> 4c40001c: ea007749 b 4c41dd48 <arm_fiq>4c400020 <BOOT_ARGUMENT_LOCATION>: 4c400020: 00000000 .word 0x000000004c400024 <reset>: 4c400024: e59f6044 ldr r6, [pc, #68] ; 4c400070 <reset+0x4c> 4c400028: e5864000 str r4, [r6] 4c40002c: ee110f10 mrc 15, 0, r0, cr1, cr0, {0} 4c400030: e3c00a0b bic r0, r0, #45056 ; 0xb000 4c400034: e3c00005 bic r0, r0, #5 4c400038: e3800002 orr r0, r0, #2 4c40003c: ee010f10 mcr 15, 0, r0, cr1, cr0, {0} 4c400040: e1a0000f mov r0, pc 4c400044: e2400048 sub r0, r0, #72 ; 0x48 4c400048: e59f1024 ldr r1, [pc, #36] ; 4c400074 <reset+0x50> 4c40004c: e1500001 cmp r0, r1 4c400050: 0a00000a beq 4c400080 <reset+0x5c> 4c400054: e59f201c ldr r2, [pc, #28] ; 4c400078 <reset+0x54> 4c400058: e4903004 ldr r3, [r0], #4 4c40005c: e4813004 str r3, [r1], #4 4c400060: e1510002 cmp r1, r2 4c400064: 1afffffb bne 4c400058 <reset+0x34> 4c400068: e59f000c ldr r0, [pc, #12] ; 4c40007c <reset+0x58> 4c40006c: e12fff10 bx r0 4c400070: 4c400020 .word 0x4c400020 4c400074: 4c400000 .word 0x4c400000 4c400078: 4c4f3bb8 .word 0x4c4f3bb8 4c40007c: 4c400080 .word 0x4c400080 4c400080: e10f0000 mrs r0, CPSR 4c400084: e3c0001f bic r0, r0, #31 4c400088: e59f2088 ldr r2, [pc, #136] ; 4c400118 <reset+0xf4> 4c40008c: e3801012 orr r1, r0, #18 4c400090: e121f001 msr CPSR_c, r1 4c400094: e59fd080 ldr sp, [pc, #128] ; 4c40011c <reset+0xf8> 4c400098: e3801011 orr r1, r0, #17 4c40009c: e121f001 msr CPSR_c, r1 4c4000a0: e1a0d002 mov sp, r2 4c4000a4: e3801017 orr r1, r0, #23 4c4000a8: e121f001 msr CPSR_c, r1 4c4000ac: e1a0d002 mov sp, r2 4c4000b0: e380101b orr r1, r0, #27 4c4000b4: e121f001 msr CPSR_c, r1 4c4000b8: e1a0d002 mov sp, r2 4c4000bc: e380101f orr r1, r0, #31 4c4000c0: e121f001 msr CPSR_c, r1 4c4000c4: e1a0d002 mov sp, r2 4c4000c8: e3801013 orr r1, r0, #19 4c4000cc: e121f001 msr CPSR_c, r1 4c4000d0: e1a0d002 mov sp, r2 4c4000d4: e59f0044 ldr r0, [pc, #68] ; 4c400120 <reset+0xfc> 4c4000d8: e59f1044 ldr r1, [pc, #68] ; 4c400124 <reset+0x100> 4c4000dc: e59f2044 ldr r2, [pc, #68] ; 4c400128 <reset+0x104> 4c4000e0: e1500001 cmp r0, r1 4c4000e4: 0a000003 beq 4c4000f8 <reset+0xd4> 4c4000e8: e1510002 cmp r1, r2 4c4000ec: b4903004 ldrlt r3, [r0], #4 4c4000f0: b4813004 strlt r3, [r1], #4 4c4000f4: bafffffb blt 4c4000e8 <reset+0xc4> 4c4000f8: e59f002c ldr r0, [pc, #44] ; 4c40012c <reset+0x108> 4c4000fc: e59f102c ldr r1, [pc, #44] ; 4c400130 <reset+0x10c> 4c400100: e3a02000 mov r2, #0 4c400104: e1500001 cmp r0, r1 4c400108: b4802004 strlt r2, [r0], #4 4c40010c: bafffffc blt 4c400104 <reset+0xe0> 4c400110: fa0085d1 blx 4c42185c <kmain> 4c400114: eafffffe b 4c400114 <reset+0xf0> 4c400118: 4c4f6000 .word 0x4c4f6000 4c40011c: 4c4f7500 .word 0x4c4f7500 4c400120: 4c4a3b6c .word 0x4c4a3b6c 4c400124: 4c4a3b6c .word 0x4c4a3b6c 4c400128: 4c4f3bb8 .word 0x4c4f3bb8 4c40012c: 4c4f3bb8 .word 0x4c4f3bb8 4c400130: 4c5a6094 .word 0x4c5a6094Disassembly of section .text:4c400138 <target_early_init>: 4c400138: 4770 bx lr 4c40013a: bf00 nop4c40013c <target_init>: 4c40013c: 4770 bx lr 4c40013e: bf00 nop4c400140 <board_machtype>: 4c400140: f641 2070 movw r0, #6768 ; 0x1a70 4c400144: 4770 bx lr 4c400146: bf00 nop4c400148 <target_fastboot_init>: 4c400148: 4770 bx lr 4c40014a: bf00 nop4c40014c <LOGO_GetCustomIF>: 4c40014c: b510 push {r4, lr} 4c40014e: 2100 movs r1, #0 4c400150: 4c03 ldr r4, [pc, #12] ; (4c400160 <LOGO_GetCustomIF+0x14>)4、linux kernel的dump文件
vim kernel.dump
vmlinux: file format elf64-littleaarch64Disassembly of section .head.text:ffffff8008080000 <_text>: ffffff8008080000: 144d0000 b ffffff80093c0000 <__init_begin> ffffff8008080004: 00000000 .word 0x00000000 ffffff8008080008: 00080000 .word 0x00080000 ffffff800808000c: 00000000 .word 0x00000000 ffffff8008080010: 02268000 .word 0x02268000 ffffff8008080014: 00000000 .word 0x00000000 ffffff8008080018: 0000000a .word 0x0000000a... ffffff8008080038: 644d5241 .word 0x644d5241 ffffff800808003c: 00000000 .word 0x00000000Disassembly of section .text:ffffff8008080800 <do_undefinstr>: ffffff8008080800: d10143ff sub sp, sp, #0x50 ffffff8008080804: f9000bf7 str x23, [sp,#16] ffffff8008080808: a90257f6 stp x22, x21, [sp,#32] ffffff800808080c: a9034ff4 stp x20, x19, [sp,#48] ffffff8008080810: a9047bfd stp x29, x30, [sp,#64] ffffff8008080814: 910103fd add x29, sp, #0x40 ffffff8008080818: b000c2e8 adrp x8, ffffff80098dd000 <nf_conntrack_locks+0x9c0> ffffff800808081c: f9454508 ldr x8, [x8,#2696] ffffff8008080820: aa0003f3 mov x19, x0 ffffff8008080824: f90007e8 str x8, [sp,#8] ffffff8008080828: 94001161 bl ffffff8008084dac <aarch32_break_handler> ffffff800808082c: 34001ea0 cbz w0, ffffff8008080c00 <do_undefinstr+0x400> ffffff8008080830: a9502675 ldp x21, x9, [x19,#256] ffffff8008080834: f2400d3f tst x9, #0xf ffffff8008080838: 540004e0 b.eq ffffff80080808d4 <do_undefinstr+0xd4> ffffff800808083c: 910013e0 add x0, sp, #0x4 ffffff8008080840: 321e03e2 orr w2, wzr, #0x4 ffffff8008080844: aa1503e1 mov x1, x21 ffffff8008080848: 9405fff3 bl ffffff8008200814 <__probe_kernel_read> ffffff800808084c: b5001cc0 cbnz x0, ffffff8008080be4 <do_undefinstr+0x3e4> ffffff8008080850: b94007f4 ldr w20, [sp,#4] ffffff8008080854: 9000da20 adrp x0, ffffff8009bc4000 <reset_devices> ffffff8008080858: 9103a000 add x0, x0, #0xe8 ffffff800808085c: 943a2fc9 bl ffffff8008f0c780 <_raw_spin_lock_irqsave> ffffff8008080860: 9000c368 adrp x8, ffffff80098ec000 <init_sighand+0x78> ffffff8008080864: 912c6108 add x8, x8, #0xb18 ffffff8008080868: f9400109 ldr x9, [x8] ffffff800808086c: aa0003e1 mov x1, x0 ffffff8008080870: eb08013f cmp x9, x8 ffffff8008080874: 540008a0 b.eq ffffff8008080988 <do_undefinstr+0x188> ffffff8008080878: aa1f03f5 mov x21, xzr ffffff800808087c: 29422d2a ldp w10, w11, [x9,#16] ffffff8008080880: 0a14014a and w10, w10, w20 ffffff8008080884: 6b0b015f cmp w10, w11總結(jié)
以上是生活随笔為你收集整理的[ARM-assembly]-ARM交叉编译器下编译的各个镜像的反汇编文件分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [mmu/cache]-ARM MMU的
- 下一篇: [ATF]-ATF的代码学习篇-一篇就够