2 ; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
4 ; This program and the accompanying materials
5 ; are licensed and made available under the terms and conditions of the BSD License
6 ; which accompanies this distribution. The full text of the license may be found at
7 ; http://opensource.org/licenses/bsd-license.php
9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 LOCAL &maxmem &systbl &memsize
15 &memsize=0x20000000 ; default to 512MB
17 gosub FindSystemTable &memsize
22 print "found system table at &systbl"
23 gosub FindDebugInfo &systbl
27 print "ERROR: system table not found, check memory size"
32 LOCAL &TopOfRam &offset
35 print "FindSystemTable"
36 print "top of mem is &TopOfRam$"
40 ; align to highest 4MB boundary
41 &offset=&offset&0xFFC00000
43 ; start at top and look on 4MB boundaries for system table ptr structure
47 if Data.Long(a:&offset)==0x20494249
49 ; high signature match
50 if Data.Long(a:&offset+4)==0x54535953
53 if Data.Long(a:&offset+0x0c)==0
55 ; less than top of ram?
56 if Data.Long(a:&offset+8)<&TopOfRam
58 return Data.Long(a:&offset+8)
68 &offset=&offset-0x400000
75 LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
81 &CfgTableEntries=Data.Long(a:&SystemTable+0x40)
82 &ConfigTable=Data.Long(a:&SystemTable+0x44)
84 print "config table is at &ConfigTable (&CfgTableEntries entries)"
86 ; now search for debug info entry with guid 49152E77-1ADA-4764-B7A2-7AFEFED95E8B
87 ; 0x49152E77 0x47641ADA 0xFE7AA2B7 0x8B5ED9FE
89 while &i<&CfgTableEntries
91 &offset=&ConfigTable+(&i*0x14)
92 if Data.Long(a:&offset)==0x49152E77
94 if Data.Long(a:&offset+4)==0x47641ADA
96 if Data.Long(a:&offset+8)==0xFE7AA2B7
98 if Data.Long(a:&offset+0xc)==0x8B5ED9FE
100 &dbghdr=Data.Long(a:&offset+0x10)
101 &dbgentries=Data.Long(a:&dbghdr+4)
102 &dbgptr=Data.Long(a:&dbghdr+8)
113 print "no debug entries found"
117 print "debug table at &dbgptr (&dbgentries entries)"
124 &dbginfo=Data.Long(a:&dbgptr+(&i*4))
127 if Data.Long(a:&dbginfo)==1 ; normal debug info type
129 &loadedimg=Data.Long(a:&dbginfo+4)
130 do EfiProcessPeImage Data.Long(a:&loadedimg+0x20)