summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm
diff options
context:
space:
mode:
authorRebecca Cran <rebecca@os.amperecomputing.com>2024-01-29 11:59:16 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-02-27 17:17:38 +0000
commite59a40b92ce92f17e3d8d99917868c5678d408b7 (patch)
treeb2d0fdd21fe2335025ea16476e283a81dac2c782 /EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm
parentaceb3490a2a350b128156fd4e36e53fc19739e4e (diff)
downloadedk2-e59a40b92ce92f17e3d8d99917868c5678d408b7.tar.gz
EmbeddedPkg/Scripts/LauterbachT32: Fix EfiLoadDxe.cmm
There have been many changes since EfiLoadDxe.cmm was last updated in 2011. The EFI_SYSTEM_TABLE can no longer be found by scanning memory on 4KB boundaries, so require users pass in its address instead. Update various offsets so that the debug information can be found and loaded with a recent version of TRACE32. Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Diffstat (limited to 'EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm')
-rw-r--r--EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm77
1 files changed, 11 insertions, 66 deletions
diff --git a/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm b/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm
index 1605a9b478..06d307e12d 100644
--- a/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm
+++ b/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm
@@ -1,79 +1,22 @@
;
+; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.<BR>
; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.<BR>
;
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
- LOCAL &maxmem &systbl &memsize
-
- &memsize=0x20000000 ; default to 512MB
-
- gosub FindSystemTable &memsize
- ENTRY &systbl
-
- if &systbl!=0
- (
- print "found system table at &systbl"
- gosub FindDebugInfo &systbl
- )
- else
- (
- print "ERROR: system table not found, check memory size"
- )
- enddo
-
-FindSystemTable:
- LOCAL &TopOfRam &offset
- ENTRY &TopOfRam
-
- print "FindSystemTable"
- print "top of mem is &TopOfRam$"
-
- &offset=&TopOfRam
-
- ; align to highest 4MB boundary
- &offset=&offset&0xFFC00000
-
- ; start at top and look on 4MB boundaries for system table ptr structure
- while &offset>0
- (
- ; low signature match
- if Data.Long(a:&offset)==0x20494249
- (
- ; high signature match
- if Data.Long(a:&offset+4)==0x54535953
- (
- ; less than 4GB?
- if Data.Long(a:&offset+0x0c)==0
- (
- ; less than top of ram?
- if Data.Long(a:&offset+8)<&TopOfRam
- (
- return Data.Long(a:&offset+8)
- )
- )
- )
- )
-
- if &offset<0x400000
- (
- return 0
- )
- &offset=&offset-0x400000
- )
-
- return 0
+ PARAMETERS &systbl
+ gosub FindDebugInfo &systbl
+ enddo
FindDebugInfo:
LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &dbgentries &dbgptr &dbginfo &loadedimg
ENTRY &SystemTable
- print "FindDebugInfo"
-
&dbgentries=0
- &CfgTableEntries=Data.Long(a:&SystemTable+0x40)
- &ConfigTable=Data.Long(a:&SystemTable+0x44)
+ &CfgTableEntries=Data.Long(a:&SystemTable+0x68)
+ &ConfigTable=Data.Long(a:&SystemTable+0x70)
print "config table is at &ConfigTable (&CfgTableEntries entries)"
@@ -82,7 +25,7 @@ FindDebugInfo:
&i=0
while &i<&CfgTableEntries
(
- &offset=&ConfigTable+(&i*0x14)
+ &offset=&ConfigTable+(&i*0x18)
if Data.Long(a:&offset)==0x49152E77
(
if Data.Long(a:&offset+4)==0x47641ADA
@@ -120,8 +63,10 @@ FindDebugInfo:
(
if Data.Long(a:&dbginfo)==1 ; normal debug info type
(
- &loadedimg=Data.Long(a:&dbginfo+4)
- do EfiProcessPeImage Data.Long(a:&loadedimg+0x20)
+ &loadedimg=Data.Long(a:&dbginfo+8)
+ &imagebaseptr=&loadedimg+0x40
+ &imagebase=Data.Long(a:&imagebaseptr)
+ do ~~~~/EfiProcessPeImage.cmm "&imagebase"
)
)
&i=&i+1