|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
* `; l# b, j- O& G - //" Z5 |+ ?+ [9 Y6 P) a" l+ B
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
% P* d8 L+ {8 [% g6 a# T7 K1 Y - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
. C5 g1 v, p5 a6 y/ w - // All other return values for SetJump are undefined.
1 Q% ?: J: W9 s2 v6 e+ S3 D - //( }6 j' v& F) |; b: b b# G
- if (Status == EFI_SUCCESS) {
# N: i+ i+ D0 E% }
I8 x" A/ h8 F6 S- //
/ B! z/ k) N% R( o - // Call the image's entry point2 I3 p0 q( g+ f$ @$ f$ w
- //' t/ ?4 A% c, z( _
- Image->Started = TRUE;
1 r& P' i6 \& g7 X$ i) y- i8 { - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);* H6 _4 l5 ^7 H# G( K, J: V) ]8 V
/ h) e( j; C4 d0 @+ F4 E- //
+ _5 @1 u% i9 x; c, p - // Add some debug information if the image returned with error. % z* h( Z5 `) h, z) U3 u
- // This make the user aware and check if the driver image have already released % z0 `7 N; x6 W) l5 d
- // all the resource in this situation. 7 @+ c* F2 k7 n* |( \3 s
- //2 _1 h) Q6 J" Y7 i" j& t0 d) a
- DEBUG_CODE (* \* ^( W7 p6 g- V, u
- if (EFI_ERROR (Image->Status)) {
/ f; l9 y: [& h& [1 D - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
3 L3 m3 s1 \- c; G1 w- u5 T - }% ] C" ^$ B! p$ B: e% P
- )
# F1 ~, k1 ]1 ? -
5 i% l* \& h" o+ I2 X - //) L; g/ h" }# h
- // If the image returns, exit it through Exit()3 F1 n8 A7 w2 |; b
- //% S# h1 o7 I* T# A/ Y/ x, {
- CoreExit (ImageHandle, Image->Status, 0, NULL);! m- N- R6 U* h& _3 L: `5 b$ O0 v
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
8 {6 r, B; T3 n# d: F既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
% X7 z( @) h, {. J# n4 m' S7 x- k& X3 X而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
2 h+ ^( u# Z. f" q( Z2 i# o8 p9 O1 u, e" M! M% ]$ P
我感觉有点多此一举了...不解 |
|