JP2020086872A - Debug system, bios, information processor, and debug method - Google Patents
Debug system, bios, information processor, and debug method Download PDFInfo
- Publication number
- JP2020086872A JP2020086872A JP2018219672A JP2018219672A JP2020086872A JP 2020086872 A JP2020086872 A JP 2020086872A JP 2018219672 A JP2018219672 A JP 2018219672A JP 2018219672 A JP2018219672 A JP 2018219672A JP 2020086872 A JP2020086872 A JP 2020086872A
- Authority
- JP
- Japan
- Prior art keywords
- exception
- bios
- debug
- function
- smm
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 claims description 22
- 238000012545 processing Methods 0.000 claims description 19
- 238000001514 detection method Methods 0.000 claims description 13
- 238000011084 recovery Methods 0.000 claims description 9
- 239000013598 vector Substances 0.000 claims description 9
- 238000011156 evaluation Methods 0.000 claims description 8
- 230000010365 information processing Effects 0.000 claims description 6
- 230000006870 function Effects 0.000 description 157
- 230000015654 memory Effects 0.000 description 30
- 230000008569 process Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 3
- 238000003745 diagnosis Methods 0.000 description 3
- 230000002452 interceptive effect Effects 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001502 supplementing effect Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本発明は、デバッグシステム、BIOS、情報処理装置及びデバッグ方法に関する。 The present invention relates to a debug system, a BIOS, an information processing device and a debug method.
Xeon(登録商標)プロセッサ等を搭載したサーバにおいては、システムマネジメントモード(SMM:System Management Mode)と非SMMのモード変更を繰り返しながら、初期化が行われる。システムマネジメント割り込み(SMI:System Management Interrupt)は、最高の優先度を持ったハードウェア割り込みである。SMMはSMIを契機として移入するモードであり、プロセッサは、SMIが発行されると動作モードをSMMへ遷移させる。SMMは、オペレーティングシステム(OS)を含むユーザからはアクセスできない独立した環境である。SMMでの動作中のみアクセスすることができるメモリ空間(SMM protected memory)が設定されており、SMMでの動作中にプロセッサがSMM protected memory以外のコードを参照すると、例外割り込みが発生するセキュリティが設けられている(特許文献1)。 In a server equipped with a Xeon (registered trademark) processor or the like, initialization is performed by repeatedly changing the system management mode (SMM: System Management Mode) and the non-SMM mode. A system management interrupt (SMI) is a hardware interrupt with the highest priority. The SMM is a mode in which the SMI is used as a trigger for the transfer, and the processor changes the operation mode to the SMM when the SMI is issued. The SMM is an independent environment that cannot be accessed by users including the operating system (OS). A memory space (SMM protected memory) that can be accessed only while operating in SMM is set, and when the processor references a code other than SMM protected memory while operating in SMM, security is provided to cause an exception interrupt. (Patent Document 1).
一般的なソフトウェアデバッグ手法は、非SMMを前提としており、SMM protected memoryへのアクセスができない。一般的なOSやアプケーションのデバッグを行う場合には、SMM protected memoryを使用しないプログラムを対象とするデバッグであるため、SMM protected memoryへのアクセスができなくても特に不都合はない。しかしながら、BIOS(Basic Input/Output System)のデバッグを行う場合、SMM protected memoryもデバッグ対象となる場合がある。例えば、BIOSの場合、非SMMで動作するプログラム(非SMMプログラム)とSMMで動作するプログラム(SMMプログラム)が連携して処理を行うことがある。この場合、非SMMプログラムが期待外の動作をした場合でも、その原因はSMMプログラムにある場合がある。従って、BIOSで期待外の動作が発生した場合、原因を明らかにするためにはSMMプログラムと非SMMプログラムの両方がデバッグできる必要がある。 The general software debugging method is based on the non-SMM and cannot access the SMM protected memory. When debugging a general OS or application, since the debugging is intended for a program that does not use the SMM protected memory, there is no particular inconvenience even if the SMM protected memory cannot be accessed. However, when the BIOS (Basic Input/Output System) is debugged, the SMM protected memory may be the debug target. For example, in the case of BIOS, a program that operates in non-SMM (non-SMM program) and a program that operates in SMM (SMM program) may cooperate to perform processing. In this case, even if the non-SMM program performs an unexpected operation, the cause may be the SMM program. Therefore, when an unexpected operation occurs in the BIOS, it is necessary to debug both the SMM program and the non-SMM program in order to clarify the cause.
一般にBIOSファームウェアの開発においては、JTAG(Joint Test Action Group)規格の外部装置(デバッガ)をJTAGポート接続し、デバッグを行う。JTAGポートは、開発評価用の目的に使用され、セキュリティ上の配慮により、出荷時の基盤では削除されることが多い。つまり、出荷後に問題が起きてもJTAG規格のデバッガによるデバッグを行うことができない。 Generally, in the development of BIOS firmware, an external device (debugger) of JTAG (Joint Test Action Group) standard is connected to the JTAG port for debugging. The JTAG port is used for the purpose of development evaluation, and is often deleted from the base at the time of shipment due to security considerations. In other words, even if a problem occurs after shipping, it cannot be debugged by the JTAG standard debugger.
特許文献1には、SMMおよび非SMMの両方において読み出し可能で、SMMにおいてのみ書き換えが可能とされる保護すべきシステムデータに対して、読み出し専用領域に記憶し、非SMMコードの実行中に前記読み出し専用領域へアクセスさせることを可能とする方法が開示されている。
In
サーバ上で稼働するOSやアプリケーションが、BIOSによって提供されるサービスを呼び出して使用するような場合、BIOSのプログラムを原因とする障害が発生し得る。JTAG規格のデバッガが使用できない状況であってもSMM protected memoryを使用して動作するプログラムのデバッグを行うことができる方法が求められている。 When an OS or application running on the server calls and uses a service provided by the BIOS, a failure due to the BIOS program may occur. There is a demand for a method capable of debugging a program that operates by using the SMM protected memory even when the JTAG standard debugger cannot be used.
そこでこの発明は、上述の課題を解決するデバッグシステム、BIOS、情報処理装置及びデバッグ方法を提供することを目的としている。 Therefore, an object of the present invention is to provide a debug system, a BIOS, an information processing device, and a debug method that solve the above-mentioned problems.
本発明の一態様によれば、デバッグシステムは、BIOS(Basic Input/Output System)で発生する例外を検出する例外検出部と、前記例外検出部が例外を検出するとSMI(System Management Interrupt)を発行するSMI発行部と、SMM(System Management Mode)でデバッグ機能を実行するデバッグ機能部と、を備える。 According to one aspect of the present invention, a debug system issues an exception detection unit that detects an exception that occurs in a BIOS (Basic Input/Output System) and an SMI (System Management Interrupt) when the exception detection unit detects an exception. And a debug function unit that executes a debug function in SMM (System Management Mode).
また、本発明の一態様によれば、BIOSは、BIOSで発生する例外を検出する例外検出部と、前記例外検出部が例外を検出するとSMIを発行するSMI発行部と、SMMでデバッグ機能を実行するデバッグ機能部と、を非SMMレイヤに備える。 Further, according to one aspect of the present invention, the BIOS has an exception detection unit that detects an exception that occurs in the BIOS, an SMI issuing unit that issues an SMI when the exception detection unit detects an exception, and a debug function by the SMM. A debug function unit to be executed is provided in the non-SMM layer.
また、本発明の他の一態様によれば、情報処理装置は、SMMでの動作が可能なプロセッサと、上記のBIOSと、を備える。 According to another aspect of the present invention, an information processing device includes a processor capable of operating in SMM and the BIOS described above.
また、本発明の他の一態様によれば、デバッグ方法は、BIOSで発生する例外を検出するステップと、前記例外を検出するとSMIを発行させるステップと、前記SMI発行により遷移したSMMでデバッグ機能を実行するステップと、を有する。 Further, according to another aspect of the present invention, a debugging method includes a step of detecting an exception that occurs in a BIOS, a step of issuing an SMI when the exception is detected, and a debug function using an SMM transitioned by the SMI issue. And a step of performing.
本発明によれば、SMM protected memoryにアクセスして動作するプログラムのデバッグを行うことができる。 According to the present invention, a program that operates by accessing the SMM protected memory can be debugged.
以下、本発明の各実施形態におけるデバッグシステムについて、図面を参照して説明する。
(システム構成)
図1は、本発明の各実施形態によるデバッグシステムの一例を示す図である。
デバッグシステム1は、OS10とBIOS20とを含む。OS10とBIOS20はソフトウェアである。デバッグシステム1は、サーバ等のコンピュータに実装され、コンピュータが備えるCPU(Central Processing Unit)等のプロセッサによって実行される。
Hereinafter, a debug system according to each embodiment of the present invention will be described with reference to the drawings.
(System configuration)
FIG. 1 is a diagram showing an example of a debug system according to each embodiment of the present invention.
The
OS10は、IDT(Interrupt Descriptor Table)110と、OS例外割り込みハンドリング機能120と、OS初期完了通知機能130とを備える。
IDT110は、例外割り込みベクタと例外割り込みハンドラを設定するテーブルである。IDT110には、0除算割り込み、breakpoint割り込み、ページフォルトなどの各種例外に対して、それぞれの例外が発生したときに呼び出される例外割り込みハンドラのメモリアドレスが登録されている。
OS例外割り込みハンドリング機能120は、IDT110に定義された例外が発生した時に実行されるハンドラである。OS10は、例外が発生すると、IDT110を参照して、例外に応じたOS例外割り込みハンドリング機能120を呼び出す。IDT110とOS例外割り込みハンドリング機能120は、一般的なOSの機能である。
The
The IDT 110 is a table that sets an exception interrupt vector and an exception interrupt handler. In the IDT 110, memory addresses of exception interrupt handlers that are called when respective exceptions occur are registered for various exceptions such as division by 0 interrupt, breakpoint interrupt, and page fault.
The OS exception
OS初期完了通知機能130は、IDT110の初期化が完了したことをBIOS20に通知する。一般的なOSは、この機能を備えていない。サーバ等のブートフローでは、IDT110の初期化完了後にACPI(Advanced Configuration and Power Interface)の初期化が開始される。OS初期完了通知機能130は、例えば、ACPIの初期化開始の契機である「\_SB._INI」の実行を契機として動作するように実装することができる。または、OS初期完了通知機能130を、IDT110の初期化完了を検出してBIOS20にその旨を通知するデーモン・サービスアプリケーションとして実装し、自動実行させるようにしてもよい。
The OS initial
BIOS20は、非SMMレイヤ30と、SMMレイヤ40とを備える。非SMMレイヤ30は、非SMMでの動作時に実行され、SMMレイヤ40は、SMM動作時に実行される。
非SMMレイヤ30は、SMI発行機能310と、Debug/Release切り替え機能320と、BIOS例外割り込みハンドリング機能330と、IDT書き換え機能340と、アサーションハンドリング機能350と、を備える。
The
The
SMI発行機能310は、SMIを発行する。上記のようにSMIはSMMへ移入するための割り込みである。本実施形態では、SMIの発行を、後述するSMMレイヤ40のデバッグ機能410を呼び出すために用いる。
Debug/Release切り替え機能320は、現在の動作モードを、詳細解析モード(debug)と出荷モード(release)との何れかに切り替える機能である。この機能は、例えば、何れかの動作モードを設定した設定ファイルをOS上に格納し、その設定に従って動作モードを切り替えるようにしてもよい。あるいは、何れかの動作モードを、UEFI(Unified Extensible Firmware Interface)に関する環境変数であるUEFI変数として設定して不揮発な媒体に格納し、その設定を読み込んで動作モードを切り替えるようにしてもよい。また、Debug/Release切り替え機能320は、設定ファイル等に基づいて、現在の動作モードを判断することができる。
The SMI issuing
The Debug/
BIOS例外割り込みハンドリング機能330は、例外割り込みの発生時にBIOSの例外割り込みか、OSの例外割り込みかを判断し、OS例外割り込みハンドリング機能120、または、SMI発行機能310を呼び出す。次に図2、図3を用いて説明するように、BIOS例外割り込みハンドリング機能330は、例外割り込みハンドラのように振る舞う。
IDT書き換え機能340は、IDT110を書き換え、BIOS例外割り込みハンドリング機能330を動作可能にする。一つの実装形態では、IDT書き換え機能340は、初期化後のIDT110に登録された所定の例外(例えば、PageFaut例外など)について、それらの例外に対応する割り込み番号(割り込みベクタ)と、BIOS例外割り込みハンドリング機能330を呼び出すためのメモリアドレスとを対応付けて登録する。つまり、IDT書き換え機能340は、それらの書き換えられた例外が発生すると、BIOS例外割り込みハンドリング機能330が呼び出されるような設定にIDT110を書き換える。
アサーションハンドリング機能350は、アサーション発生時にSMI発行機能310を呼び出す機能である。この機能については、後に図5を用いて説明する。
The BIOS exception interrupt handling
The
The
SMMレイヤ40は、デバッグ機能410を備える。
デバッグ機能410は、BIOSのデバッグを行うための機能である。デバッグ機能410は、一般的なBIOSが備える機能である。デバッグ機能410には、例えば、レジスタダンプ、メモリダンプ、対話型デバッグ機能などが存在する。
The
The
<第一実施形態>
(BIOS例外割り込みハンドリング機能)
次に第一実施形態におけるデバッグ機能の呼び出し処理について説明する。まず、図2を用いてBIOS例外割り込みハンドリング機能330について説明する。
図2は、本発明の第一実施形態によるBIOS例外割り込みのハンドリングについて説明する図である。
BIOS例外割り込みハンドリング機能330は、何らかの例外が発生し呼び出しを受けると、発生した例外の割り込みベクタに基づいて、発生した割り込みがPageFault割り込みかどうかを判定する(ステップS200)。PageFault割り込みの場合(ステップS200;Yes)、BIOS例外割り込みハンドリング機能330は、OS例外割り込みハンドリング機能120を呼び出す(ステップS210)。具体的には、BIOS例外割り込みハンドリング機能330は、PageFault割り込み用の割り込みハンドラの呼び出しを行う。ここで、PageFault割り込みとは、プログラムが物理メモリマップされていない仮想アドレス空間上のページにアクセスしたときにハードウェアが発生する例外割り込みである。PageFault割り込みは、プログラムのエラーではないためBIOSのデバッグ機能を呼び出さない。また、BIOS例外割り込みハンドリング機能330は、IDT書き換え機能340による書き換え前のIDT110に登録されていた例外割り込みベクタと例外割り込みハンドラの呼び出しアドレスの対応テーブルを内部に保持しており、この対応テーブルに基づいて、例外に応じたOS例外割り込みハンドリング機能120の呼び出しを行う。
<First embodiment>
(BIOS exception interrupt handling function)
Next, the calling process of the debug function in the first embodiment will be described. First, the BIOS exception interrupt handling
FIG. 2 is a diagram illustrating handling of a BIOS exception interrupt according to the first embodiment of the present invention.
When an exception occurs and the call is received, the BIOS exception interrupt handling
PageFault割り込みではない場合(ステップS200;No)、BIOS例外割り込みハンドリング機能330は、例外が発生したメモリアドレスがBIOSのエリア外かどうかを判定する(ステップS220)。x86アーキテクチャ等の一般的なCPUにおいては、例外割り込み発生時に、例外割り込み発生時の命令アドレス、例外割り込み要因がCPUのレジスタに格納される。BIOS例外割り込みハンドリング機能330は、この例外割り込み発生時の命令アドレスがBIOSのエリア(コード領域)どうかを確認することで、BIOSのエリアで例外割り込みが発生したかを判定することができる。また、BIOSのコード領域については、BIOSが生成したUEFI Memory Mapを参照することにより判断することができる。
When it is not the Page Fault interrupt (step S200; No), the BIOS exception interrupt handling
BIOSのエリア外の場合(ステップS220;Yes)、BIOS例外割り込みハンドリング機能330は、例外に応じたOS例外割り込みハンドリング機能120を呼び出す(ステップS230)。
BIOSのエリア内の場合(ステップS220;No)、BIOS例外割り込みハンドリング機能330は、SMI発行機能310を呼び出す(ステップS240)。
このようにBIOS例外割り込みハンドリング機能330を呼び出し可能な状態とすることにより、BIOSのコード領域で例外が発生した場合に、SMI発行により、SMMへ移入することができる。次に図3を用いて、BIOS例外割り込みハンドリング機能330を呼び出し可能な状態にするための処理の一例について説明する。
If it is outside the BIOS area (step S220; Yes), the BIOS exception interrupt handling
If it is within the BIOS area (step S220; No), the BIOS exception interrupt handling
By making the BIOS exception interrupt handling
(BIOS例外割り込みハンドリング機能の初期化)
図3は、本発明の第一実施形態によるOS起動時の初期化処理の一例を示すフローチャートである。
図3を用いてOS10の起動時にBIOS例外割り込みハンドリング機能330を呼び出し可能とするようにIDT110に登録する処理(初期化)について説明する。
まず、OS10は、OS例外割り込みハンドリング機能120を初期化する(ステップS310)。例えば、OS10は、各種の例外が発生した時に割り込みハンドラを呼び出せるように、各種ハンドラを実行可能な状態にする。
次にOS10は、IDT110を初期化する(ステップS320)。例えば、OS10は、各種の例外割り込みベクタと対応する例外割り込みハンドラをIDT110に登録する。
次にOS10は、OS初期化完了通知機能130を実行する。OS初期化完了通知機能130は、IDT110の初期化完了をBIOS20へ通知する(ステップS330)。
IDT110の初期化完了通知を受信したBIOS20は、Debug/Release切り替え機能320により、現在の動作モードを確認する(ステップS340)。現在の動作モードがRelease(出荷モード)の場合、本初期化処理を終了する。
現在の動作モードがDebug(詳細解析モード)の場合、BIOS20は、IDT書き換え機能340を呼び出す(ステップS350)。IDT書き換え機能340は、BIOS例外割り込みハンドリング機能330を呼び出せるようにIDT110へ登録を行う。例えば、IDT書き換え機能340は、初期化後のIDT110に対して、所定の割り込みベクタとBIOS例外割り込みハンドリング機能330のアドレスとを対応付けて登録する。これにより、所定の割り込みベクタが示す例外が発生したときにBIOS例外割り込みハンドリング機能330が呼び出し可能となる。図2を用いて説明したようにBIOS例外割り込みハンドリング機能330は、例外割り込みベクタに基づいて、例外の発生エリアがBIOSのコード領域でなければ、例外に応じたOS例外割り込みハンドリング機能120を呼び出し、例外の発生エリアがBIOSのコード領域であれば、SMI発行機能310を呼び出す。
(Initialize the BIOS exception interrupt handling function)
FIG. 3 is a flowchart showing an example of initialization processing at OS startup according to the first embodiment of the present invention.
A process (initialization) for registering in the
First, the
Next, the
Next, the
Upon receiving the initialization completion notification of the
When the current operation mode is Debug (detailed analysis mode), the
(デバッガ呼び出し処理)
次に図4を用いて、SMI発行機能310が呼び出されたときにBIOSのデバッガを呼び出す処理について説明する。
図4は、本発明の第一実施形態によるBIOSのデバッガの呼び出し処理の一例を示すフローチャートである。
図3で説明した処理によりIDT110にBIOS例外割り込みハンドリング機能330が登録され、例外が発生し、図2で説明した処理によりSMI発行機能310が呼び出されたとする。
まず、SMI発行機能310は、所定のデバッグ要求情報をBIOSが確保したメモリ領域に格納する(ステップS410)。次にSMI発行機能310は、SMIを発行する(ステップS420)。例えば、PCH(Platform Controller Hub)を備えたチップを搭載している場合、PCHのAdvanced Power Management Control PortのIOアドレスに所定の値を書くことでSMIを発行することができる。
(Debugger call processing)
Next, a process of calling the BIOS debugger when the
FIG. 4 is a flowchart showing an example of calling processing of the BIOS debugger according to the first embodiment of the present invention.
It is assumed that the BIOS exception interrupt handling
First, the
SMIが発行されると、プロセッサの動作はSMMに遷移する。SMMレイヤ40は、SMI割り込み発生時の情報(コンテキスト)をメモリ上(SMM protected memory)に保存する(ステップS430)。このとき、ステップS410で格納されたデバッグ要求情報もメモリへ保存される。次にSMMレイヤ40は、メモリを参照し、デバッグ要求情報が格納されているかどうかを判断する(ステップS440)。
デバッグ要求情報が格納されている場合(ステップS440;Yes)、SMMレイヤ40は、デバッグ機能410を実行する(ステップS450)。デバッグ機能410は、レジスタダンプ、メモリダンプを実施する。これにより、詳細解析モードで稼働するシステムでOSやアプリケーションが、BIOSによって提供されるサービスを利用しているときに障害が発生した場合、SMMへ移入しデバッガを起動することができる。これにより、BIOSのコード領域(SMMプログラム、非SMMプログラムを含む)で発生した障害情報を採取することができる。
When the SMI is issued, the operation of the processor transits to SMM. The
When the debug request information is stored (step S440; Yes), the
ステップS450の実行後、あるいはステップS440でデバッグ要求無し、と判断された場合、プロセッサは、ステップS430で格納した情報を参照し、SMI割り込み時の状態に復旧し(ステップS460)、SMM終了コマンドを発行する(ステップS470)。 After executing step S450 or when it is determined in step S440 that there is no debug request, the processor refers to the information stored in step S430, restores the state at the SMI interrupt time (step S460), and issues the SMM end command. Issue (step S470).
本実施形態によれば、外部装置を必要とせずにBIOSで生じた例外のデバッグを行うことができる。特にSMM protected memoryにアクセスして動作するSMMプログラムのデバッグを行うことができる。 According to this embodiment, it is possible to debug an exception that has occurred in the BIOS without requiring an external device. In particular, the SMM protected memory can be accessed to debug an operating SMM program.
<第二実施形態>
第一実施形態では、詳細解析モード時にBIOS例外割り込みを補足してSMI発行を行うことにより、BIOSのデバッグ機能を呼び出す方法を説明した。第二実施形態では、非SMMプログラムにアサーション(assertion)を記載して、アサーションの診断結果に基づいてSMI発行を行う。アサーションとは、プログラムの処理や条件の成立を表明するための手法や機能のことである。本実施形態では、非SMMプログラムのコードにおける診断を行う部分に以下の記載を挿入する。
ASSERT(expression)
アサーションハンドリング機能350は、診断の結果(評価式expressionの値)に応じてSMI発行機能310を呼び出す機能を備える。図5を用いて、アサーションハンドリング機能350について説明する。
図5は、本発明の第二実施形態によるアサーションハンドリング機能を説明する図である。
アサーションが記載された非SMMプログラムが実行され、ASSERT(expression)を実行しているとする。アサーションハンドリング機能350は、アサーションの評価式expressionの値を判断する(ステップS510)。expressionの値がTRUEではない場合、アサーションハンドリング機能350は、SMI発行機能310を呼び出す(ステップS520)。SMI発行機能310を呼び出した後の処理は、図4で説明したものと同様である。つまり、SMI発行により、SMMへ移入し、デバッグ機能410を実行することができる。
<Second embodiment>
In the first embodiment, the method of calling the debug function of the BIOS by supplementing the BIOS exception interrupt and issuing the SMI in the detailed analysis mode has been described. In the second embodiment, an assertion is described in the non-SMM program, and the SMI issuance is performed based on the diagnosis result of the assertion. Assertions are methods and functions for expressing the processing of programs and the establishment of conditions. In the present embodiment, the following description is inserted in the part of the code of the non-SMM program that performs the diagnosis.
ASSERT (expression)
The
FIG. 5 is a diagram illustrating an assertion handling function according to the second embodiment of the present invention.
It is assumed that the non-SMM program in which the assertion is described is executed and ASSERT (expression) is executed. The
非SMM30レイヤ30が、アサーションハンドリング機能350を備えることにより、例えば、非SMMプログラムからSMMプログラムを呼び出す箇所などにアサーションを記載することで、SMM protected memoryを含むBIOSのコード領域で発生した障害情報を採取することができる。また、第二実施形態のデバッガ呼び出し方法は、出荷モードにも適用することができる。
By providing the
さらに、アサーションチェックを拡張することにより、解析性と可用性を向上することが可能である。図6を用いて、拡張されたアサーションに用いるパラメータを説明する。
図6は、本発明の第二実施形態によるアサーションに用いるパラメータの一例を示す図である。
例えば、非SMMプログラムの診断を行う部分に以下の拡張されたアサーションの記載を行う。
ASSERT_EX(expression,debug_policy,debug_interactive,output_data,recovery)
上記引数のうちexpressionには評価式を設定する。また、debug_policyには、出荷モード時の動作を設定する。例えば、出荷モード時にデバッグを実施するか(release_mode_debug)、リカバリのみを実施するか(release_mode_recovery_only)、何もしないか(release_mode_none)を設定する。debug_interactiveには、対話型デバッグを行うか否かを設定する。output_dataには、解析に必要なデータを設定する。recoveryには、継続運用を行うか(recovery_mode_need)、OSダンプを行うか(recovery_mode_dump)、何もしないか(recovery_mode_none)を設定する。なお、継続運用を行う設定の場合には、リカバリ処理の内容(アサーション要因を解決するための式)を設定することができる(recovery_expression)。
Furthermore, by extending the assertion check, it is possible to improve the parseability and availability. The parameters used for the extended assertion will be described with reference to FIG.
FIG. 6 is a diagram showing an example of parameters used for an assertion according to the second embodiment of the present invention.
For example, the following expanded assertion is described in the part that diagnoses the non-SMM program.
ASSERT_EX(expression, debug_policy, debug_interactive, output_data, recovery)
An evaluation expression is set in expression among the above arguments. Further, the operation in the shipping mode is set in the debug_policy. For example, it is set whether to perform debugging in the shipping mode (release_mode_debug), only recovery (release_mode_recovery_only), or nothing (release_mode_none). In debug_interactive, whether to perform interactive debugging is set. Data required for analysis is set in output_data. For recovery, whether continuous operation is performed (recovery_mode_need), OS dump is performed (recovery_mode_dump), or nothing is performed (recovery_mode_none) is set. In addition, in the case of setting to perform continuous operation, the content of the recovery process (expression for solving the assertion factor) can be set (recovery_expression).
(デバッガ呼び出し処理)
次に図7、図8を用いて、拡張されたアサーション(ASSERT_EX)を用いたデバッガ呼び出し処理についてより具体的に説明する。
図7、図8は、それぞれ、本発明の第二実施形態によるBIOSのデバッガの呼び出し処理の一例を示す第1のフローチャート、第2のフローチャートである。
拡張されたアサーションが記載された非SMMプログラムが実行されているとする。アサーションハンドリング機能350は、アサーションの記載箇所ごとに以下の処理を実行する。
まず、アサーションハンドリング機能350は、ASSERT_EXの評価式expressionの値がTRUEか判断する(ステップS710)。expressionの値がTRUEの場合(ステップS710;Yes)、本フローチャートの処理を終了する。expressionの値がFALSEの場合(ステップS710;No)、デバッグ処理が開始される。例えば、expressionに(val==1)と記載した場合、valが1以外であれば、expressionの値がFALSEとなるので、アサーションハンドリング機能350が、以下の処理を開始する。
(Debugger call processing)
Next, the debugger calling process using the expanded assertion (ASSERT_EX) will be described more specifically with reference to FIGS. 7 and 8.
7 and 8 are a first flowchart and a second flowchart, respectively, showing an example of the calling process of the BIOS debugger according to the second embodiment of the present invention.
It is assumed that the non-SMM program in which the expanded assertion is described is being executed. The
First, the
まず、アサーションハンドリング機能350は、Debug/Release切り替え機能320を用いて、現在の動作モードを取得する(ステップS720)。アサーションハンドリング機能350は、現在の動作モードがReleaseかつASSERT_EXのdebug_policyがrelease_mode_noneであるかどうかを判断する(ステップS730)。この条件を満たす場合(ステップS730;Yes)、本フローチャートの処理を終了する。条件を満たさない場合(ステップS730;No)、アサーションハンドリング機能350は、SMI発行機能310を呼び出す(ステップS740)。すると、図4を用いて説明したように、SMI発行機能310は、デバッグ要求情報をメモリに格納し、SMIを発行する。SMIが発行されると、プロセッサの動作はSMMに遷移する。
First, the
SMMレイヤ40は、SMI割り込み発生時の情報(コンテキスト)をメモリ上(SMM protected memory)に保存する(ステップS750)。このとき、SMI発行機能310が格納したデバッグ要求情報もメモリへ保存される。次にSMMレイヤ40は、メモリを参照し、デバッグ要求情報が格納されているかどうかを判断する(ステップS760)。デバッグ要求情報が格納されていない場合(ステップS760;No)、ステップS860以降の処理を行う(後述)。
The
デバッグ要求情報が格納されている場合(ステップS760;Yes)、SMMレイヤ40は、デバッグ機能410を実行する。デバッグ機能410は、ステップS720でDebug/Release切り替え機能320により取得した現在の動作モードの情報を取得する(ステップS770)。デバッグ機能410は、現在の動作モードがDebugかつASSERT_EXのdebug_interactiveにtrueが設定されているかどうかを判断する(ステップS780)。この条件を満たす場合(ステップS780;Yes)、デバッグ機能410は、対話型デバッグ機能を実行する(ステップS790)。これにより、ユーザは、対話型でデバッグを行うことができる。
When the debug request information is stored (step S760; Yes), the
条件を満たさない場合(ステップS780;No)、デバッグ機能410は、現在の動作モードがReleaseかつASSERT_EXのrelease_mode_recovery_onlyにfalseが設定されているかどうかを判断する(ステップS800)。この条件を満たす場合(ステップS800;Yes)、デバッグ機能410は、ASSERT_EXのoutput_dataで指定された情報を表示する(ステップS810)。例えば、デバッグに必要な値として変数val_a、val_b、val_cがoutput_dataに(val_a;val_b;val_c)のように設定されている場合、プログラム実行時のval_a、val_b、val_cの値が表示される。
ステップS810の実行後、又はステップS800の判断がNoの場合、次にデバッグ機能410は、ASSERT_EXのrecoveryにrecovery_mode_needが設定されているかどうかを判断する(ステップS820)。この条件を満たす場合、デバッグ機能410は、recovery_expressionで指定されたリカバリ処理を実施する(ステップS830)。例えば、recovery_expressionに(val_a=2;)と設定されている場合、ステップS830では、val_a=2が実行される。
When the condition is not satisfied (step S780; No), the
After execution of step S810 or when the determination in step S800 is No, the
条件を満たさない場合(ステップS820;No)、デバッグ機能410は、ASSERT_EXのrecoveryにrecovery_mode_dumpが設定されているかどうかを判断する(ステップS840)。この条件を満たす場合、デバッグ機能410は、OSダンプ割り込みを実行する(ステップS850)。一般に、OSダンプ割り込みには、NMI(Non-Maskable Interrupt)が使用される。なお、NMIは一般的なPCHの機能を使うことで発行可能である。
When the condition is not satisfied (step S820; No), the
ステップS790、ステップS830、ステップS850の何れかの実行後、又はステップS760かステップS840の判断がNoの場合、SMMレイヤ40は、ステップS750で格納した情報を参照し、SMI割り込み時の状態に復旧し(ステップS860)、SMM終了コマンドを発行する(ステップS870)。
After executing any of step S790, step S830, and step S850, or when the determination of step S760 or step S840 is No, the
本実施形態によれば、出荷モードにおいても、BIOSのコード領域(SMMプログラム、非SMMプログラムを含む)で発生した障害情報を採取することができる。さらに拡張されたアサーション(ASSERT_EX)を使用した場合には、詳細な動作指定とリカバリ処理を設定することができるので、解析性と可用性を両立させることが可能である。特に出荷モードにおいてシステムの通常運用を継続しつつ、問題解析に必要なデータを採取することができる。 According to this embodiment, even in the shipping mode, it is possible to collect the failure information generated in the BIOS code area (including the SMM program and the non-SMM program). When the further expanded assertion (ASSERT_EX) is used, detailed operation designation and recovery processing can be set, so that it is possible to achieve both analyticity and availability. In particular, in the shipping mode, it is possible to collect data necessary for problem analysis while continuing normal operation of the system.
<他の実施形態>
なお、図1では、第一実施形態と第二実施形態の両方の機能を備えたデバッグシステム1の構成例を示したが、第一実施形態の機能のみを実装した構成とすることが可能である。具体的には、一つの実施形態では、図9に示すようにデバッグシステム1Aを構成することが可能である。デバッグシステム1Aにおいて、OS10は、IDT110と、OS例外割り込みハンドリング機能120と、OS初期完了通知機能130とを備える。BIOS20において、非SMMレイヤ30は、SMI発行機能310と、Debug/Release切り替え機能320と、BIOS例外割り込みハンドリング機能330と、IDT書き換え機能340とを備え、SMMレイヤ40はデバッグ機能410を備える。
<Other Embodiments>
Although FIG. 1 shows a configuration example of the
また、第二実施形態の機能のみを実装した図10に示すデバッグシステム1Bの構成とすることが可能である。デバッグシステム1BではBIOS20において、非SMMレイヤ30は、SMI発行機能310と、Debug/Release切り替え機能320と、アサーションハンドリング機能350とを備え、SMMレイヤ40は、デバッグ機能410を備える。
Further, it is possible to configure the
図11は、本発明の各実施形態によるデバッグシステムの最小構成を示す図である。
図11に示すようにデバッグシステム50は、少なくとも例外検出部501と、SMI発行部502と、デバッグ機能部503を備える。
例外検出部501は、BIOSのコード領域で発生する例外を検出する。例外検出部501は、上記実施形態のBIOS例外割り込みハンドリング機能330、アサーションハンドリング機能350に対応する。
SMI発行部502は、例外検出部501が例外を検出するとSMIを発行する。SMI発行部502は、SMI発行機能310に対応する。
デバッグ機能部503は、SMMでデバッグ機能を実行する。デバッグ機能部503は、デバッグ機能410に対応する。
一つの実施形態では、デバッグシステム50は、上記実施形態のBIOS20の非SMMレイヤ30に実装される。
FIG. 11 is a diagram showing the minimum configuration of the debug system according to each embodiment of the present invention.
As shown in FIG. 11, the
The
The
The
In one embodiment, the
図12は、本発明の各実施形態におけるデバッグシステムを搭載した情報処理装置のハードウェア構成の一例を示す図である。
コンピュータ900は、CPU901、主記憶装置902、補助記憶装置903、入出力インタフェース904、通信インタフェース905を備える。
CPU901は、SMMでの動作が可能なプロセッサである。CPU901は、例えば、インテル社のIntel64およびIA−32アーキテクチャのCPUである。上述のOS10、BIOS20は、プログラムの形式で補助記憶装置903に格納されている。そして、CPU901は、プログラムを補助記憶装置903から読み出して主記憶装置902に展開し、当該プログラムに従って上記処理を実行する。また、CPU901は、プログラムに従って、記憶領域を主記憶装置902に確保する。
FIG. 12 is a diagram showing an example of a hardware configuration of an information processing apparatus equipped with a debug system according to each embodiment of the present invention.
The
The
なお、少なくとも1つの実施形態において、補助記憶装置903は、例えば、マザーボード上のROMであって、BIOS20は、このROMに記憶されている。また、他の1つの実施形態において、補助記憶装置903は、一時的でない有形の媒体の一例である。一時的でない有形の媒体の他の例としては、入出力インタフェース904を介して接続される磁気ディスク、光磁気ディスク、CD−ROM、DVD−ROM、半導体メモリ等が挙げられる。また、このプログラムが通信回線によってコンピュータ900に配信される場合、配信を受けたコンピュータ900が当該プログラムを主記憶装置902に展開し、上記処理を実行しても良い。また、当該プログラムは、前述した機能の一部を実現するためのものであっても良い。さらに、当該プログラムは、前述した機能を補助記憶装置903に既に記憶されている他のプログラムとの組み合わせで実現するもの、いわゆる差分ファイル(差分プログラム)であっても良い。また、補助記憶装置903は、CPU901を備える演算装置とは別体として構成されていてもよい。
Note that in at least one embodiment, the
その他、本発明の趣旨を逸脱しない範囲で、上記した実施の形態における構成要素を周知の構成要素に置き換えることは適宜可能である。また、この発明の技術範囲は上記の実施形態に限られるものではなく、本発明の趣旨を逸脱しない範囲において種々の変更を加えることが可能である。
UEFI Memory Mapは、BIOSに割り当てられたアドレス領域の範囲の一例である。
In addition, it is possible to appropriately replace the components in the above-described embodiments with known components without departing from the spirit of the present invention. Further, the technical scope of the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the spirit of the present invention.
The UEFI Memory Map is an example of the range of the address area assigned to the BIOS.
1、1A、1B、50・・・デバッグシステム
10・・・OS
110・・・IDT
120・・・OS例外割り込みハンドリング機能
130・・・OS初期化完了通知機能
20・・・BIOS
30・・・非SMMレイヤ
310・・・SMI発行機能
320・・・Debug/Release切り替え機能
330・・・BIOS例外割り込みハンドリング機能
340・・・IDT書き換え機能
350・・・アサーションハンドリング機能
40・・・SMMレイヤ
410・・・デバッグ機能
501・・・例外検出部
502・・・SMI発行部
503・・・デバッグ機能部
900・・・コンピュータ
901・・・CPU
902・・・主記憶装置
903・・・補助記憶装置
904・・・入出力インタフェース
905・・・通信インタフェース
1, 1A, 1B, 50...
110... IDT
120...OS exception interrupt handling
30...
902...
Claims (10)
前記例外検出部が例外を検出するとSMI(System Management Interrupt)を発行するSMI発行部と、
SMM(System Management Mode)でデバッグ機能を実行するデバッグ機能部と、
を備えるデバッグシステム。 An exception detection unit that detects exceptions that occur in BIOS (Basic Input/Output System),
An SMI issuing unit that issues an SMI (System Management Interrupt) when the exception detecting unit detects an exception;
A debug function unit that executes a debug function in SMM (System Management Mode),
Debug system with.
請求項1に記載のデバッグシステム。 The exception detection unit detects the occurrence of the exception based on a function of detecting an exception interrupt included in the operating system, and based on the detected address of the occurrence place of the exception and the range of the address area assigned to the BIOS. , Detect exception in BIOS,
The debug system according to claim 1.
IDTに所定の例外割り込みベクタに対応付けて登録される割り込みハンドラである、
請求項1または請求項2に記載のデバッグシステム。 The exception detection unit,
An interrupt handler registered in the IDT in association with a predetermined exception interrupt vector,
The debug system according to claim 1 or 2.
請求項1から請求項3の何れか1項に記載のデバッグシステム。 The exception detection unit detects the occurrence of an exception in the BIOS based on the value of the assertion evaluation expression described in the BIOS program.
The debug system according to any one of claims 1 to 3.
請求項4に記載のデバッグシステム。 In the assertion, in addition to the evaluation expression, settings relating to execution of a debugger when the value of the evaluation expression is not True can be set.
The debug system according to claim 4.
請求項5に記載のデバッグシステム。 In the setting related to the execution of the debugger, it is possible to set whether to start the debugger during normal operation of the system,
The debug system according to claim 5.
請求項5または請求項6に記載のデバッグシステム。 The assertion can further set recovery processing for the program.
The debug system according to claim 5 or 6.
BIOSで発生する例外を検出する例外検出部と、
前記例外検出部が例外を検出するとSMIを発行するSMI発行部と、
SMMでデバッグ機能を実行するデバッグ機能部と、
を備えるBIOS。 An exception detection unit that detects an exception that occurs in the BIOS in the non-SMM layer,
An SMI issuing unit that issues an SMI when the exception detecting unit detects an exception;
A debug function unit that executes the debug function in SMM,
BIOS with.
請求項8に記載のBIOSと、
を備える情報処理装置。 A processor capable of operating in SMM,
BIOS according to claim 8,
An information processing apparatus including.
前記例外を検出するとSMIを発行させるステップと、
前記SMI発行により遷移したSMMでデバッグ機能を実行するステップと、
を有するデバッグ方法。 Detecting an exception that occurs in the BIOS,
Issuing an SMI when the exception is detected,
Executing a debug function in the SMM transitioned by issuing the SMI;
A debugging method having.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018219672A JP6996748B2 (en) | 2018-11-22 | 2018-11-22 | Debug system, BIOS, information processing device and debugging method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018219672A JP6996748B2 (en) | 2018-11-22 | 2018-11-22 | Debug system, BIOS, information processing device and debugging method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2020086872A true JP2020086872A (en) | 2020-06-04 |
JP6996748B2 JP6996748B2 (en) | 2022-01-17 |
Family
ID=70909984
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2018219672A Active JP6996748B2 (en) | 2018-11-22 | 2018-11-22 | Debug system, BIOS, information processing device and debugging method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6996748B2 (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1529241A (en) * | 2003-10-08 | 2004-09-15 | 威盛电子股份有限公司 | Debugging device and method thereof |
US20050229160A1 (en) * | 2004-03-18 | 2005-10-13 | Rothman Michael A | Method and system to provide debugging of a computer system from firmware |
CN102455956A (en) * | 2010-10-21 | 2012-05-16 | 英业达股份有限公司 | Method for displaying picture in interrupt management mode |
CN103257922A (en) * | 2013-04-16 | 2013-08-21 | 合肥联宝信息技术有限公司 | Method for quickly testing reliability of BIOS (basic input output system) and OS (operating system) interface codes |
US9298524B2 (en) * | 2013-03-22 | 2016-03-29 | Insyde Software Corp. | Virtual baseboard management controller |
US10127137B2 (en) * | 2015-06-03 | 2018-11-13 | Fengwei Zhang | Methods and systems for increased debugging transparency |
-
2018
- 2018-11-22 JP JP2018219672A patent/JP6996748B2/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1529241A (en) * | 2003-10-08 | 2004-09-15 | 威盛电子股份有限公司 | Debugging device and method thereof |
US20050229160A1 (en) * | 2004-03-18 | 2005-10-13 | Rothman Michael A | Method and system to provide debugging of a computer system from firmware |
CN102455956A (en) * | 2010-10-21 | 2012-05-16 | 英业达股份有限公司 | Method for displaying picture in interrupt management mode |
US9298524B2 (en) * | 2013-03-22 | 2016-03-29 | Insyde Software Corp. | Virtual baseboard management controller |
CN103257922A (en) * | 2013-04-16 | 2013-08-21 | 合肥联宝信息技术有限公司 | Method for quickly testing reliability of BIOS (basic input output system) and OS (operating system) interface codes |
US10127137B2 (en) * | 2015-06-03 | 2018-11-13 | Fengwei Zhang | Methods and systems for increased debugging transparency |
Non-Patent Citations (1)
Title |
---|
ZHANG, F. ET AL.: "Using Hardware Features for Increased Debugging Transparency", PROCEEDINGS OF 2015 IEEE SYMPOSIUM ON SECURITY AND PRIVACY, JPN6021035726, 17 May 2015 (2015-05-17), pages 55 - 69, XP033177709, ISSN: 0004592930, DOI: 10.1109/SP.2015.11 * |
Also Published As
Publication number | Publication date |
---|---|
JP6996748B2 (en) | 2022-01-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5905904B2 (en) | Controlling debug exception generation | |
US10139876B2 (en) | Efficient reboot of an operating system executed in a virtual machine | |
US10318737B2 (en) | Secure booting of virtualization managers | |
JP6124994B2 (en) | Method and system for restoring from legacy OS environment to Unified Extensible Firmware Interface (UEFI) pre-boot environment, and computer program | |
US11169819B2 (en) | Information handling system (IHS) and method to proactively restore firmware components to a computer readable storage device of an IHS | |
US10127068B2 (en) | Performance variability reduction using an opportunistic hypervisor | |
US7356735B2 (en) | Providing support for single stepping a virtual machine in a virtual machine environment | |
US20050216895A1 (en) | Method and apparatus for remote debugging of kernel and application software | |
US20050246453A1 (en) | Providing direct access to hardware from a virtual environment | |
US10909247B2 (en) | Computing device having two trusted platform modules | |
US8595552B2 (en) | Reset method and monitoring apparatus | |
Fattori et al. | Dynamic and transparent analysis of commodity production systems | |
US20070011507A1 (en) | System and method for remote system support | |
CN103430158B (en) | Use Execution Single Step to Diagnose Coding | |
US7363544B2 (en) | Program debug method and apparatus | |
KR20150102090A (en) | Mechanism to support reliability, availability, and serviceability (ras) flows in a peer monitor | |
US20100153786A1 (en) | Processor, multiprocessor, and debugging method | |
JP5609242B2 (en) | Information processing apparatus and memory dump collection method | |
TWI470434B (en) | Method executing in computer system, computer system, and processor | |
US8639919B2 (en) | Tracer configuration and enablement by reset microcode | |
US10586048B2 (en) | Efficient reboot of an operating system | |
CN116225765A (en) | Method for executing instruction in virtual machine and virtual machine monitor | |
US20060075274A1 (en) | Method and apparatus for enabling run-time recovery of a failed platform | |
US20160292108A1 (en) | Information processing device, control program for information processing device, and control method for information processing device | |
US11550664B2 (en) | Early boot event logging system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20200306 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20210608 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20210713 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20210914 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20211101 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20211116 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20211209 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6996748 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |