Changes since April

Clean up of build directories.
Simplifications to capability model.
This commit is contained in:
Bahadir Balban
2010-06-01 15:08:13 +03:00
parent aef14b55ec
commit 6fa4884a5a
450 changed files with 10449 additions and 7383 deletions

View File

@@ -2,40 +2,39 @@
import elf
# Define section markers for various sections in elf
# Define header markers for various program headers in elf
def elf_loadable_section_info(img):
elffile = elf.ElfFile.from_file(img)
# Sections markers for RW sections
# Markers
rw_sections_start = 0
rw_sections_end = 0
# Section markers for RX and RO section combined
rx_sections_start = 0
rx_sections_end = 0
# Flag encoding used by elf
sh_flag_write = 1 << 0
sh_flag_load = 1 << 1
sh_flag_execute = 1 << 2
PF_X = 1 << 0
PF_W = 1 << 1
PF_R = 1 << 2
for sheader in elffile.sheaders:
x = sheader.ai
loadable_header = 1
# Check for loadable sections
if x.sh_flags.get() & sh_flag_load:
start = x.sh_addr.get()
end = start + x.sh_size.get()
for pheader in elffile.pheaders:
x = pheader.ai
# RW Section
if x.sh_flags.get() & sh_flag_write:
if (rw_sections_start == 0) or (rw_sections_start > start):
rw_sections_start = start
if (rw_sections_end == 0) or (rw_sections_end < end):
rw_sections_end = end
# Check for loadable headers
if x.p_type.get() >> loadable_header == 0:
start = x.p_vaddr.get()
end = start + x.p_memsz.get()
# RX, RO Section
else:
# RW header
if x.p_flags.get() & (~(PF_R | PF_W)) == 0:
if (rw_sections_start == 0) or (rw_sections_start > start):
rw_sections_start = start
if (rw_sections_end == 0) or (rw_sections_end < end):
rw_sections_end = end
# RX header
elif x.p_flags.get() & (~(PF_R | PF_X)) == 0:
if (rx_sections_start == 0) or (rx_sections_start > start):
rx_sections_start = start
if (rx_sections_end == 0) or (rx_sections_end < end):
@@ -43,4 +42,3 @@ def elf_loadable_section_info(img):
return rw_sections_start, rw_sections_end, \
rx_sections_start, rx_sections_end

View File

@@ -21,3 +21,7 @@ def elf_binary_size(img):
paddr_end = x.p_paddr + x.p_memsz
return paddr_end - paddr_start
# Return load address of elf file
def get_elf_load_address(img):
elffile = elf.ElfFile.from_file(img)
return elffile.header.ai.e_entry