1 | ;
|
---|
2 | ; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
|
---|
3 | ; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
|
---|
4 | ;
|
---|
5 | ; SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 | ;
|
---|
7 |
|
---|
8 | PARAMETERS &systbl
|
---|
9 |
|
---|
10 | gosub FindDebugInfo &systbl
|
---|
11 | enddo
|
---|
12 |
|
---|
13 | FindDebugInfo:
|
---|
14 | LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
|
---|
15 | ENTRY &SystemTable
|
---|
16 |
|
---|
17 | &dbgentries=0
|
---|
18 | &CfgTableEntries=Data.Long(a:&SystemTable+0x68)
|
---|
19 | &ConfigTable=Data.Long(a:&SystemTable+0x70)
|
---|
20 |
|
---|
21 | print "config table is at &ConfigTable (&CfgTableEntries entries)"
|
---|
22 |
|
---|
23 | ; now search for debug info entry with guid 49152E77-1ADA-4764-B7A2-7AFEFED95E8B
|
---|
24 | ; 0x49152E77 0x47641ADA 0xFE7AA2B7 0x8B5ED9FE
|
---|
25 | &i=0
|
---|
26 | while &i<&CfgTableEntries
|
---|
27 | (
|
---|
28 | &offset=&ConfigTable+(&i*0x18)
|
---|
29 | if Data.Long(a:&offset)==0x49152E77
|
---|
30 | (
|
---|
31 | if Data.Long(a:&offset+4)==0x47641ADA
|
---|
32 | (
|
---|
33 | if Data.Long(a:&offset+8)==0xFE7AA2B7
|
---|
34 | (
|
---|
35 | if Data.Long(a:&offset+0xc)==0x8B5ED9FE
|
---|
36 | (
|
---|
37 | &dbghdr=Data.Long(a:&offset+0x10)
|
---|
38 | &dbgentries=Data.Long(a:&dbghdr+4)
|
---|
39 | &dbgptr=Data.Long(a:&dbghdr+8)
|
---|
40 | )
|
---|
41 | )
|
---|
42 | )
|
---|
43 | )
|
---|
44 |
|
---|
45 | &i=&i+1
|
---|
46 | )
|
---|
47 |
|
---|
48 | if &dbgentries==0
|
---|
49 | (
|
---|
50 | print "no debug entries found"
|
---|
51 | return
|
---|
52 | )
|
---|
53 |
|
---|
54 | print "debug table at &dbgptr (&dbgentries entries)"
|
---|
55 |
|
---|
56 | symbol.reset
|
---|
57 |
|
---|
58 | &i=0
|
---|
59 | while &i<&dbgentries
|
---|
60 | (
|
---|
61 | &dbginfo=Data.Long(a:&dbgptr+(&i*4))
|
---|
62 | if &dbginfo!=0
|
---|
63 | (
|
---|
64 | if Data.Long(a:&dbginfo)==1 ; normal debug info type
|
---|
65 | (
|
---|
66 | &loadedimg=Data.Long(a:&dbginfo+8)
|
---|
67 | &imagebaseptr=&loadedimg+0x40
|
---|
68 | &imagebase=Data.Long(a:&imagebaseptr)
|
---|
69 | do ~~~~/EfiProcessPeImage.cmm "&imagebase"
|
---|
70 | )
|
---|
71 | )
|
---|
72 | &i=&i+1
|
---|
73 | )
|
---|
74 | return
|
---|