|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
+ D$ c; _) W! q. Y: Q - //
& W0 d' ]: s. m9 H1 U* S! a - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
: [7 m- z2 ]$ J5 E: q+ E& o - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
8 a8 P) D% }2 ~/ c9 G - // All other return values for SetJump are undefined.: }' G4 x& q- S5 N! r
- //- i$ ^& T. T0 a
- if (Status == EFI_SUCCESS) {
0 o" W' o" r; F! x& |1 T: `
! J3 l8 |9 L* I8 l5 z, o! w- //+ a$ N& s& E' H, m: G$ i! C
- // Call the image's entry point
$ P0 H4 d8 l! G j7 k, S - //
. j* V4 a7 o' V - Image->Started = TRUE;
/ q7 o. B: w: Z* o# n G- d - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);( J6 n% r/ |) a! D# [3 B. Y7 r G& e
- " b# ?* {9 v: Y$ C* S' W
- //
: l+ \0 q0 Q/ @3 [# c% T% W - // Add some debug information if the image returned with error. " }4 Z; q) }! |& F$ `
- // This make the user aware and check if the driver image have already released
" z* F) q7 R2 Q" d4 c - // all the resource in this situation. ) }& T7 t- f7 r% F
- //2 S6 w$ i2 y& l, N. G
- DEBUG_CODE (
* Z# @% \6 Z4 r" r8 ] - if (EFI_ERROR (Image->Status)) {
8 s; x- k& z9 b* l" T2 D- p* { - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
, q. U& C% C Q% O( D - }
# p# G p4 }' D2 N - )
* A# H: y/ X0 O9 N - ( W: }. H* n0 }& z& g
- //
3 o. @. j {' Z, c - // If the image returns, exit it through Exit()
1 O1 a5 j j5 F5 B( S" Q ^ - //& v) @( h( Z; Y: {; U# z) Y/ E
- CoreExit (ImageHandle, Image->Status, 0, NULL);' ^7 ?+ i+ N6 J" _
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
: a( C/ Q- d1 E; s既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
4 y; c S8 [) n/ x y& h而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
; L3 X, S F' K+ J3 `9 M2 q* W
6 J' d7 }! n3 U) I9 B" g+ S我感觉有点多此一举了...不解 |
|