2 ; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
7 LOCAL &maxmem &systbl &memsize
9 &memsize=0x20000000 ; default to 512MB
11 gosub FindSystemTable &memsize
16 print "found system table at &systbl"
17 gosub FindDebugInfo &systbl
21 print "ERROR: system table not found, check memory size"
26 LOCAL &TopOfRam &offset
29 print "FindSystemTable"
30 print "top of mem is &TopOfRam$"
34 ; align to highest 4MB boundary
35 &offset=&offset&0xFFC00000
37 ; start at top and look on 4MB boundaries for system table ptr structure
41 if Data.Long(a:&offset)==0x20494249
43 ; high signature match
44 if Data.Long(a:&offset+4)==0x54535953
47 if Data.Long(a:&offset+0x0c)==0
49 ; less than top of ram?
50 if Data.Long(a:&offset+8)<&TopOfRam
52 return Data.Long(a:&offset+8)
62 &offset=&offset-0x400000
69 LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
75 &CfgTableEntries=Data.Long(a:&SystemTable+0x40)
76 &ConfigTable=Data.Long(a:&SystemTable+0x44)
78 print "config table is at &ConfigTable (&CfgTableEntries entries)"
80 ; now search for debug info entry with guid 49152E77-1ADA-4764-B7A2-7AFEFED95E8B
81 ; 0x49152E77 0x47641ADA 0xFE7AA2B7 0x8B5ED9FE
83 while &i<&CfgTableEntries
85 &offset=&ConfigTable+(&i*0x14)
86 if Data.Long(a:&offset)==0x49152E77
88 if Data.Long(a:&offset+4)==0x47641ADA
90 if Data.Long(a:&offset+8)==0xFE7AA2B7
92 if Data.Long(a:&offset+0xc)==0x8B5ED9FE
94 &dbghdr=Data.Long(a:&offset+0x10)
95 &dbgentries=Data.Long(a:&dbghdr+4)
96 &dbgptr=Data.Long(a:&dbghdr+8)
107 print "no debug entries found"
111 print "debug table at &dbgptr (&dbgentries entries)"
118 &dbginfo=Data.Long(a:&dbgptr+(&i*4))
121 if Data.Long(a:&dbginfo)==1 ; normal debug info type
123 &loadedimg=Data.Long(a:&dbginfo+4)
124 do EfiProcessPeImage Data.Long(a:&loadedimg+0x20)