VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/EmbeddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm@ 85805

Last change on this file since 85805 was 85718, checked in by vboxsync, 5 years ago

Devices/EFI: Merge edk-stable202005 and make it build, bugref:4643

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