2 # Script to check a bios image and report info on it.
4 # Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
6 # This file may be distributed under the terms of the GNU GPLv3 license.
11 # Read in symbols (that are valid)
13 for line in sys.stdin.readlines():
15 addr, type, sym = line.split()
16 syms[sym] = int(addr, 16)
20 c16s = syms['code16_start'] + 0xf0000
21 c32s = syms['final_code16_start']
22 f16s = syms['code16_fixed_start'] + 0xf0000
23 f32s = syms['final_code16_fixed_start']
24 if c16s != c32s or f16s != f32s:
25 print ("Error! 16bit code moved during linking"
26 " (0x%x vs 0x%x, 0x%x vs 0x%x)" % (
27 c32s, c16s, f16s, f32s))
30 size16 = syms['code16_end'] - syms['code16_start']
31 size32 = syms['code32_end'] - syms['code32_start']
32 sizefree = syms['freespace1_end'] - syms['freespace1_start']
33 tablefree = syms['freespace2_end'] - syms['freespace2_start']
34 print "16bit C-code size: %d" % size16
35 print "32bit C-code size: %d" % size32
36 print "Total C-code size: %d" % (size16+size32)
37 print "Free C-code space: %d" % sizefree
38 print "BIOS table space: %d" % tablefree
40 if __name__ == '__main__':