2 // Copyright (c) 2008 - 2009, Apple Inc. 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 ENTRY &ram_start &ram_size
15 ;If system is running then stop the execution so we can load symbols.
21 ;Create AREA to display the symbols we are loading.
23 AREA.Create SYMBOL 300. 100.
28 ;Added based on suggestion from Lauterbach support.
33 GOSUB load_symbols &ram_start &ram_size
35 ;Open some windows and enable semihosting.
41 WINPOS 0.0 17.0 72. 13. 0. 0. W000
44 WINPOS 0.0 0.0 110. 55. 13. 1. W001
45 WINTABS 10. 10. 25. 62.
51 System.Option.BigEndian OFF
53 tronchip.set swi on // ARM9/10/11 variant
55 // configure and open semihosting channel
56 winpos 50% 50% 50% 50%
57 term.heapinfo 0 0x20000 0x30000 0x20000
62 WINPOS 115.0 0. 70. 35. 0. 1. W002
65 WINPOS 115.10 45. 48. 9. 0. 0. W003
71 ENTRY &mem_start &mem_size
72 &mem_ptr=&mem_start+&mem_size
75 &mem_ptr=&mem_ptr-0x400000 // 4 MB
76 &word1=Data.LONG(D:&mem_ptr)
77 &word2=Data.LONG(D:&mem_ptr+0x04)
82 &result=Data.LONG(D:&mem_ptr+0x08)
87 WHILE &mem_ptr>&mem_start
93 IF Data.LONG(D:&guid)==0x49152E77
95 IF Data.LONG(D:&guid+0x04)==0x47641ADA
97 IF Data.LONG(D:&guid+0x08)==0xFE7AA2B7
99 IF Data.LONG(D:&guid+0x0C)==0x8B5ED9FE
108 find_debug_info_table_header:
110 &config_table_entries=Data.LONG(D:&system_table+0x40)
111 &config_table_pointer=Data.LONG(D:&system_table+0x44)
112 RPT &config_table_entries
114 GOSUB compare_guid &config_table_pointer
118 &result=Data.LONG(D:&config_table_pointer+0x10)
121 &config_table_pointer=&config_table_pointer+0x14
127 IF Data.BYTE(D:&header+0x00)==0x4D
129 IF Data.BYTE(D:&header+0x01)==0x5A
131 IF Data.BYTE(D:&header+0x80)==0x50
133 IF Data.BYTE(D:&header+0x81)==0x45
147 &more_string=data.string(d:&stringOffset)
149 if (string.len("&more_string")>=128.)
151 &string="&string"+"&more_string"
152 &stringOffset=&stringOffset+string.len("&more_string")
154 //Get remaining file string
155 GOSUB get_file_string &stringOffset
157 &string="&string"+"&more_string"
161 &string="&string"+"&more_string"
167 ENTRY &header &load_address
168 GOSUB valid_pe_header &header
173 &debugOffset=Data.LONG(D:&header+0x0128)
174 &stringOffset=&header+&debugOffset+0x002C
176 GOSUB get_file_string &stringOffset
179 PRINT "&filestring 0x" &load_address
180 TDIAG Data.load.elf &filestring &load_address /nocode /noclear
186 RETURN Data.LONG(D:&header+0x00AC)
189 ENTRY &mem_start &mem_size
190 GOSUB find_system_table &mem_start &mem_size
192 GOSUB find_debug_info_table_header &system_table
193 ENTRY &debug_info_table_header
194 &debug_info_table=Data.LONG(D:&debug_info_table_header+0x08)
195 &debug_info_table_size=Data.LONG(D:&debug_info_table_header+0x04)
197 RPT &debug_info_table_size
199 &debug_image_info=Data.LONG(D:&debug_info_table+&index)
200 IF &debug_image_info==0
202 &loaded_image_protocol=Data.LONG(D:&debug_image_info+0x04);
203 &image_base=Data.LONG(D:&loaded_image_protocol+0x20);
204 GOSUB pe_headersize &image_base
206 &image_load_address=&image_base+&header_size
207 GOSUB load_symbol_file &image_base &image_load_address