mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-06 12:37:54 +02:00
75 lines
3.5 KiB
XML
75 lines
3.5 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
|
<style>
|
|
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
|
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
|
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
|
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
|
.dim{font:20px 'Courier New',monospace;fill:#888}
|
|
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
|
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
|
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
|
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
|
.badge{stroke:#00ff41;rx:14}
|
|
</style>
|
|
<rect class="bg" width="1200" height="800"/>
|
|
|
|
<!-- Title -->
|
|
<text x="600" y="52" text-anchor="middle" class="title">GDB: Static Variable</text>
|
|
<text x="600" y="88" text-anchor="middle" class="dim">Finding static_fav_num in RAM</text>
|
|
|
|
<!-- Literal Pool -->
|
|
<rect x="40" y="110" width="1120" height="200" rx="8" class="pnl"/>
|
|
<text x="600" y="148" text-anchor="middle" class="sub">Literal Pool Lookup</text>
|
|
|
|
<rect x="60" y="170" width="700" height="48" rx="4" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1"/>
|
|
<text x="80" y="200" class="cyn">ldr r4, [pc, #44]</text>
|
|
<text x="400" y="200" class="dim">@ 0x10000290</text>
|
|
|
|
<text x="60" y="248" class="txt">Examine literal pool:</text>
|
|
<rect x="60" y="258" width="700" height="30" rx="4" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1"/>
|
|
<text x="80" y="282" class="grn">x/1wx 0x10000290 = 0x200005A8</text>
|
|
|
|
<text x="790" y="248" class="amb">r4 now holds the</text>
|
|
<text x="790" y="278" class="amb">RAM address of</text>
|
|
<text x="790" y="298" class="grn">static_fav_num!</text>
|
|
|
|
<!-- Examining the Variable -->
|
|
<rect x="40" y="330" width="540" height="220" rx="8" class="pnl"/>
|
|
<text x="310" y="368" text-anchor="middle" class="sub">Read Value</text>
|
|
|
|
<rect x="60" y="390" width="500" height="40" rx="4" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1"/>
|
|
<text x="80" y="418" class="grn">x/1db 0x200005a8 = 42</text>
|
|
|
|
<text x="60" y="458" class="dim">After one loop iteration:</text>
|
|
<rect x="60" y="468" width="500" height="40" rx="4" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1"/>
|
|
<text x="80" y="496" class="amb">x/1db 0x200005a8 = 43</text>
|
|
|
|
<text x="60" y="536" class="dim">It incremented! Persists in RAM.</text>
|
|
|
|
<!-- Disasm Gotcha -->
|
|
<rect x="620" y="330" width="540" height="220" rx="8" class="pnl"/>
|
|
<text x="890" y="368" text-anchor="middle" class="sub">Disasm Gotcha</text>
|
|
|
|
<text x="640" y="408" class="txt">x/i 0x10000290 shows:</text>
|
|
|
|
<rect x="640" y="425" width="500" height="40" rx="4" fill="#0a0a0f" stroke="#ff0040" stroke-width="1"/>
|
|
<text x="660" y="453" class="red">lsls r0, r5, #22</text>
|
|
|
|
<text x="640" y="493" class="dim">GDB decodes DATA as code!</text>
|
|
<text x="640" y="518" class="dim">Bytes A8 05 00 20 = 0x200005A8</text>
|
|
<text x="640" y="538" class="dim">Use x/wx not x/i for data</text>
|
|
|
|
<!-- GPIO Register -->
|
|
<rect x="40" y="570" width="1120" height="210" rx="8" class="pnl"/>
|
|
<text x="600" y="608" text-anchor="middle" class="sub">GPIO Input Register</text>
|
|
|
|
<text x="60" y="648" class="txt">Read button state in GDB:</text>
|
|
|
|
<rect x="60" y="668" width="700" height="40" rx="4" fill="#0a0a0f" stroke="#1a1a2e" stroke-width="1"/>
|
|
<text x="80" y="696" class="grn">p/x (*(uint*)0xd0000004 >> 15) & 1</text>
|
|
|
|
<text x="60" y="738" class="cyn">Returns 1:</text>
|
|
<text x="260" y="738" class="dim">not pressed (pull-up)</text>
|
|
<text x="60" y="758" class="amb">Returns 0:</text>
|
|
<text x="260" y="758" class="dim">button pressed</text>
|
|
</svg> |