|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
8 L! B i+ P5 |3 q) C. \6 J - //4 K2 e5 O. ~2 C
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed, q# ?/ @. t0 |4 U- t4 E; }2 b
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump! t0 l. P" k7 K) h) E) L" V- q9 @
- // All other return values for SetJump are undefined.
6 e: E) ~. o, Q& v - // I! K, o1 a+ w; H
- if (Status == EFI_SUCCESS) {
4 L$ v% Z* i6 r1 E6 c J( G - 2 G5 S/ N- i9 H
- /// M- n( R. Q9 s0 m/ ]/ d
- // Call the image's entry point
$ A7 [5 f; ] c' Z- S: o1 { - //
3 D; F1 b. C; V5 S1 O - Image->Started = TRUE;/ @% S, O$ _3 P' r) v I
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);7 f% {9 i7 \0 a: ~ ?
% r8 S6 {/ Y9 r6 M7 |# U ?! k- //
, B4 X' Y2 g( Q& ^( s# } - // Add some debug information if the image returned with error. - b2 G, W" L' K4 h
- // This make the user aware and check if the driver image have already released
9 p: T8 E c9 ^; | - // all the resource in this situation.
0 \9 u* A- l5 z% J: L - //6 G8 N; j# @2 T% F; g' g3 ?! A
- DEBUG_CODE (( W& y4 J. F6 U- ~* x S% b* V! d# s
- if (EFI_ERROR (Image->Status)) {4 r' y- \5 g; |* z0 i0 z) X
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));' l4 b7 T& j, U: D
- }
5 W4 P& b2 b v6 O8 S, j8 B- |6 h4 j5 | - )( L3 b8 R: B$ M) U
- : e- x* L/ R! M5 E+ ?
- //( P0 Q8 z2 u* c/ W1 i
- // If the image returns, exit it through Exit()' `: w9 x; v: r% M0 G3 E5 d3 Y$ V
- //3 T/ z4 S* r) I# ^* K' {
- CoreExit (ImageHandle, Image->Status, 0, NULL);
8 D/ E. b! C! N4 Y% A - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态7 [4 H+ R1 H0 z, y; u2 d- D
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
" `8 [4 M6 o( k& x# M8 B而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
* P1 |* `% Z- D2 h7 l
1 L5 I/ _! `: Z5 ?我感觉有点多此一举了...不解 |
|