#!/usr/bin/env python3 # # Copyright (c) 2017 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 import argparse import sys import struct import os import elftools from distutils.version import LooseVersion from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection if LooseVersion(elftools.__version__) < LooseVersion('0.24'): sys.stderr.write("pyelftools is out of date, need version 0.24 or later\n") sys.exit(1) def debug(text): if not args.verbose: return sys.stdout.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") def error(text): sys.stderr.write(os.path.basename(sys.argv[0]) + ": " + text + "\n") sys.exit(1) gdt_pd_fmt = "> 16) & 0xFF base_hi = (base >> 24) & 0xFF limit_lo = limit & 0xFFFF limit_hi = (limit >> 16) & 0xF return (base_lo, base_mid, base_hi, limit_lo, limit_hi) gdt_ent_fmt = "