blob: 032783b6098e0c4ea64bfb1db1f7481aa8da2fd5 [file] [log] [blame]
Kevin O'Connor2fda7cb2008-07-05 20:41:53 -04001#!/usr/bin/env python
2# Script to check a bios image and report info on it.
3#
4# Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
5#
6# This file may be distributed under the terms of the GNU GPLv3 license.
7
8import sys
9
10def main():
11 # Read in symbols (that are valid)
12 syms = {}
13 for line in sys.stdin.readlines():
14 try:
15 addr, type, sym = line.split()
16 syms[sym] = int(addr, 16)
17 except:
18 pass
19
Kevin O'Connor9bcc5272008-07-05 21:08:56 -040020 c16s = syms['code16_start']
21 c32s = syms['_code32_code16_start']
22 if c16s != c32s:
23 print "Error! 16bit code moved during linking (0x%x vs 0x%x)" % (
24 c32s, c16s)
Kevin O'Connor2fda7cb2008-07-05 20:41:53 -040025 sys.exit(1)
26
27 size16 = syms['code16_end'] - syms['code16_start']
28 size32 = syms['code32_end'] - syms['code32_start']
29 sizefree = syms['freespace1_end'] - syms['freespace1_start']
30 print "16bit C-code size: %d" % size16
31 print "32bit C-code size: %d" % size32
32 print "Total C-code size: %d" % (size16+size32)
33 print "Free C-code space: %d" % sizefree
34
35if __name__ == '__main__':
36 main()