mirror of
https://github.com/chipsec/chipsec
synced 2026-06-08 13:31:00 +00:00
0654edca19
Revision 1.2.0 -------------- This version includes the following new or updated modules: #. Merged common.secureboot.keys module into common.secureboot.variables module #. Updated tools.secureboot.te module to be able to test PE/TE issue on Linux or UEFI shell #. Updated tools.smm.smm_ptr module This version includes the following updates: #. Added the *controls* abstraction. Modules are encouraged to use ``get_control`` and ``set_control`` when interacting with platform registers. This permits greater flexibility in case the register that controls a given feature or configuration changes between platform generations. The controls are defined in the platform XML file. At this time, only a small number of controls are defined. We plan to move existing modules over to this new mechanism. #. Added XML Schema for the XML configuration files #. Support for reading, writing, and listing UEFI variables from the UEFI Shell environment has been added. #. Added support for decompression while SPI flash parsing via ``decode`` or ``uefi decode`` commands in Linux #. Added basic ACPI table parsing to HAL (RSDP, RSDT/XSDT, APIC, DMAR) #. Added UEFI tables searching and parsing to HAL (EFI system table, runtime services table, boot services table, DXE services table, EFI configuration table) #. Added DIMM Serial Presence Detect (SPD) ROM dumping and parsing to HAL #. Added ``uefi s3bootscript`` command parsing the S3 boot script to chipsec_util.py #. Added virtual-to-physical address translation function to Linux/EFI/Windows helpers #. Added support of server platforms (Haswell server and Ivy Town) to chipset.py This version has the following known issues: #. Decompression of images in SPI flash parsing is not available in UEFI shell. #. When calling alloc_phys_mem, the argument to set maximum physical address (max_pa) for allocation is ignored on linux. A message will be printed in dmesg if the allocation is above the max_pa that is passed in, but the call will return anyway. #. UEFI Shell environment does not support ``cpuid`` or ``get_thread_count``. There are functions that simply warn that they are not supported. #. Size of PCIEXBAR (MMCFG) is calculated incorrectly
109 lines
3.5 KiB
Python
109 lines
3.5 KiB
Python
#!/usr/local/bin/python
|
|
#CHIPSEC: Platform Security Assessment Framework
|
|
#Copyright (c) 2010-2015, Intel Corporation
|
|
#
|
|
#This program is free software; you can redistribute it and/or
|
|
#modify it under the terms of the GNU General Public License
|
|
#as published by the Free Software Foundation; Version 2.
|
|
#
|
|
#This program is distributed in the hope that it will be useful,
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
#GNU General Public License for more details.
|
|
#
|
|
#You should have received a copy of the GNU General Public License
|
|
#along with this program; if not, write to the Free Software
|
|
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
#Contact information:
|
|
#chipsec@intel.com
|
|
#
|
|
|
|
|
|
|
|
__version__ = '1.0'
|
|
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
import chipsec_util
|
|
|
|
from chipsec.logger import *
|
|
from chipsec.file import *
|
|
|
|
from chipsec.hal.interrupts import Interrupts
|
|
|
|
# ###################################################################
|
|
#
|
|
# CPU Interrupts
|
|
#
|
|
# ###################################################################
|
|
def smi(argv):
|
|
"""
|
|
>>> chipsec_util smi <thread_id> <SMI_code> <SMI_data> [RAX] [RBX] [RCX] [RDX] [RSI] [RDI]
|
|
|
|
Examples:
|
|
|
|
>>> chipsec_util smi 0x0 0xDE 0x0
|
|
>>> chipsec_util smi 0x0 0xDE 0x0 0xAAAAAAAAAAAAAAAA ..
|
|
"""
|
|
try:
|
|
interrupts = Interrupts( chipsec_util._cs )
|
|
except RuntimeError, msg:
|
|
print msg
|
|
return
|
|
|
|
SMI_code_port_value = 0xF
|
|
SMI_data_port_value = 0x0
|
|
if (2 == len(argv)):
|
|
print smi.__doc__
|
|
elif (4 < len(argv)):
|
|
thread_id = int(argv[2],16)
|
|
SMI_code_port_value = int(argv[3],16)
|
|
SMI_data_port_value = int(argv[4],16)
|
|
logger().log( "[CHIPSEC] Sending SW SMI (code: 0x%02X, data: 0x%02X).." % (SMI_code_port_value, SMI_data_port_value) )
|
|
if (5 == len(argv)):
|
|
interrupts.send_SMI_APMC( SMI_code_port_value, SMI_data_port_value )
|
|
elif (11 == len(argv)):
|
|
_rax = int(argv[5],16)
|
|
_rbx = int(argv[6],16)
|
|
_rcx = int(argv[7],16)
|
|
_rdx = int(argv[8],16)
|
|
_rsi = int(argv[9],16)
|
|
_rdi = int(argv[10],16)
|
|
logger().log( " RAX: 0x%016X (AX will be overwridden with values of SW SMI ports B2/B3)" % _rax )
|
|
logger().log( " RBX: 0x%016X" % _rbx )
|
|
logger().log( " RCX: 0x%016X" % _rcx )
|
|
logger().log( " RDX: 0x%016X (DX will be overwridden with 0x00B2)" % _rdx )
|
|
logger().log( " RSI: 0x%016X" % _rsi )
|
|
logger().log( " RDI: 0x%016X" % _rdi )
|
|
interrupts.send_SW_SMI( thread_id, SMI_code_port_value, SMI_data_port_value, _rax, _rbx, _rcx, _rdx, _rsi, _rdi )
|
|
else: print smi.__doc__
|
|
else: print smi.__doc__
|
|
|
|
|
|
def nmi(argv):
|
|
"""
|
|
>>> chipsec_util nmi
|
|
|
|
Examples:
|
|
|
|
>>> chipsec_util nmi
|
|
"""
|
|
if 2 < len(argv):
|
|
print nmi.__doc__
|
|
|
|
try:
|
|
interrupts = Interrupts( chipsec_util._cs )
|
|
except RuntimeError, msg:
|
|
print msg
|
|
return
|
|
|
|
logger().log( "[CHIPSEC] Sending NMI#.." )
|
|
interrupts.send_NMI()
|
|
|
|
|
|
chipsec_util.commands['nmi'] = {'func' : nmi, 'start_driver' : True, 'help' : nmi.__doc__ }
|
|
chipsec_util.commands['smi'] = {'func' : smi, 'start_driver' : True, 'help' : smi.__doc__ }
|