VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/EmbeddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm

Last change on this file was 105670, checked in by vboxsync, 9 months ago

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.7 KB
Line 
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 LOCAL &imgstart &filehdrstart &debugdirentryrva &debugtype &debugrva &dwarfsig &baseofcode &baseofdata &elfbase &elfpath &pathoffset
9 ENTRY &imgstart
10
11 &imgstart=&imgstart
12 print "PE32 image found at &imgstart"
13
14 ; offset from dos hdr to PE file hdr (i.e. 'PE\0\0' signature)
15 &filehdrstart=&imgstart+Data.Long(c:&imgstart+0x3C)
16
17 ; offset to debug dir in PE hdrs
18 &debugdirentryrva=Data.Long(c:&imgstart+0xf10)
19 if &debugdirentryrva==0
20 (
21 print "no debug dir for image at &imgstart"
22 enddo
23 )
24
25 &debugtype=Data.Long(c:&imgstart+&debugdirentryrva+0xc)
26 if (&debugtype!=0xdf)&&(&debugtype!=0x02)
27 (
28 print "debug type is not dwarf for image at &imgstart, it's &debugtype"
29 enddo
30 )
31
32 &debugrva=Data.Long(c:&imgstart+&debugdirentryrva+0x14)
33 &dwarfsig=Data.Long(c:&imgstart+&debugrva)
34
35 if &dwarfsig==0x66727764
36 (
37 &pathoffset=0xc
38 )
39 else
40 (
41 if &dwarfsig==0x3031424E
42 (
43 &pathoffset=0x10
44 )
45 else
46 (
47 print "debug signature not found for image at &imgstart, its &dwarfsig"
48 enddo
49 )
50 )
51
52 &elfpath=Data.String(c:&imgstart+&debugrva+&pathoffset)
53
54 &baseofcode=&imgstart+Data.Long(c:&filehdrstart+0x28)
55 &baseofdata=&imgstart+Data.Long(c:&filehdrstart+0x2c)
56
57 if (&baseofcode<&baseofdata)&&(&baseofcode!=0)
58 (
59 &elfbase=&baseofcode;
60 )
61 else
62 (
63 &elfbase=&baseofdata;
64 )
65
66 print "found path &elfpath with address &elfbase"
67 ON ERROR GOSUB
68 return
69 data.load.elf &elfpath &elfbase /NOCODE /NOCLEAR
70 ON error
71
72enddo
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette