|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
4 n, }" h2 |8 k o4 [9 H! _0 M - // ]6 B: v) S9 O9 ^9 V9 {
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
5 p/ Z. [6 J% b6 A - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
. p% P+ J5 z% d - // All other return values for SetJump are undefined.
, O! t# K2 i: U+ ? - //
f) T5 r5 d. T5 j - if (Status == EFI_SUCCESS) {7 |, {' m! U. d
- ) G' H1 x! N' m; k
- //
' A9 T7 J( b, H- I D - // Call the image's entry point
) H% |( O% J B; B7 ?" W4 Q& o - //
- {1 x) u, f7 @7 o - Image->Started = TRUE;) J) J1 q- a1 @
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);9 @, o. ~) X0 v; V9 x* B/ Q
4 \2 [9 a, h9 E' b* D" N- //4 K; _% c- i0 D1 J
- // Add some debug information if the image returned with error. 2 R$ k" j6 e) `3 R9 `2 W" I6 \3 T
- // This make the user aware and check if the driver image have already released
. q5 c5 I$ M. w! e' m - // all the resource in this situation. ) l; f+ a8 R- N' Z+ b3 ]
- //
' q I: F# z- J - DEBUG_CODE (8 v" b& Q/ ?. h+ k
- if (EFI_ERROR (Image->Status)) {
/ u6 z; f5 z: R9 P - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
6 N( h6 q# R j0 S6 C - }" ~( }, ?; |. H
- )1 }3 k& M% ~7 x( ?: B* C
-
* Q) x! M) U: j4 j - //4 d U" d' s+ H) P: X( W; k
- // If the image returns, exit it through Exit()
! s+ T0 r- q+ Y: q- m. l$ M - //1 J Y [! o5 G* g% v
- CoreExit (ImageHandle, Image->Status, 0, NULL);
( Q; C7 G5 s, u1 C+ X8 s1 o - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态! g/ H; ^* ~6 r3 V0 i# G
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
! j1 T/ J1 Q4 k( d7 a而且目前来看driver只会返回Status而已,根据这个就可以做处理了.. g4 L4 U: w G5 m! y! C
% v% @4 U' B0 \1 i我感觉有点多此一举了...不解 |
|