|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
+ E+ |: q& L `( z) L - //1 h/ g$ {0 a. [! M
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
& G' K' U: m( P0 ~ - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
) q3 e9 e( @: k$ o3 @2 s" N8 d - // All other return values for SetJump are undefined.
4 a6 g, R/ D: e - //8 V$ b& D9 H! {: z3 o
- if (Status == EFI_SUCCESS) {; Q1 N& t. }& \& i' e! h
- 9 C8 _0 y* T, W- l9 v. L7 z
- //: f2 L8 [+ w4 l+ J5 F! h' j$ R _
- // Call the image's entry point2 e+ H' P6 ]2 g3 t# o s2 ? F" ?3 |2 A
- //0 h- Y9 t, } b1 R
- Image->Started = TRUE;
/ u; c9 ^2 u6 O! q7 S' n8 O0 g3 u - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
# g$ E6 }+ C5 S r5 e0 f
& C- P7 }/ m; t5 Z- //* P7 }8 f- n( s& S& m2 A: o6 ?
- // Add some debug information if the image returned with error. 6 ~6 r! I. G" J
- // This make the user aware and check if the driver image have already released
+ L& w8 U+ Q7 M. [& p" o - // all the resource in this situation. 3 \. o# C- W* Y% n
- //( {( x% V* ~0 O0 {. ]1 Y: L
- DEBUG_CODE (1 j; S/ p1 I9 {! I% B
- if (EFI_ERROR (Image->Status)) {+ ?1 `: }1 P7 w8 [7 i0 G, h% ?
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));6 W9 G5 h1 [% v! _
- }
: d6 ~) g2 @, X - )
+ }( g- _& u( ?/ E0 ? - 3 O5 |0 B- g+ A
- //' B, D- O% o" V7 o6 l6 i
- // If the image returns, exit it through Exit()
7 |, @8 I% g; j% u! W- h n - //
# E: x: `8 m% q3 _) ?9 N - CoreExit (ImageHandle, Image->Status, 0, NULL);
5 `4 h9 T; ^7 V6 w4 x - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
7 g: f# h! o6 h: |9 m- d2 F既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?8 L4 b, q3 i9 q. Y( ?$ C3 ?# N
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.7 C' j- T: a; m! `- ]- v) R
! e* P( m5 |% Y/ k6 l" X% Z
我感觉有点多此一举了...不解 |
|