|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
2 d8 s6 f# n g1 w$ g3 o4 V1 H n - //
5 o, u# R# V, a - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed7 T+ ~( n) `- E2 i0 a
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
$ H$ i1 Y4 f8 v6 \8 _& `( a: u - // All other return values for SetJump are undefined.
; d! i6 K1 H1 }& c - //5 ?/ }6 ~! _2 l+ b2 ^
- if (Status == EFI_SUCCESS) { S4 U a- ?/ W9 c. o
- ( u: T; b1 w/ E
- //
9 m6 }! [' U' N6 B - // Call the image's entry point( n& ]" C% j' J* `* k9 S, _0 _
- //
* m' I* ~( _5 \) R' z, D9 I - Image->Started = TRUE;
! z+ Z) H; T9 f4 F% L - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);& ]2 P; e# B) e0 Y& i- G6 d
- " _: I0 `! r9 O
- //
* W4 w* {+ v8 F+ H - // Add some debug information if the image returned with error. ) c0 V& I( U) f3 d. J* d) G# I
- // This make the user aware and check if the driver image have already released o8 Y( K1 U5 D" `
- // all the resource in this situation. F: \# K# e0 L7 T' |8 l
- //) g& ^6 ]8 z; N$ {* R
- DEBUG_CODE (4 {& y6 T# H0 x7 _% H5 A* s) }
- if (EFI_ERROR (Image->Status)) {
7 b; e3 L- b, P$ R4 u6 m' y - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));, Q* J) x9 N+ R& S4 L1 Y2 e h: W* }
- }& D+ ^# ~* S$ r' r1 R
- )
/ z g ` f4 z1 `3 v7 u -
: y2 |' l. o2 U6 ` - //# T+ I$ ?2 |, o0 ~ k& |3 @
- // If the image returns, exit it through Exit()" J( c* g/ M V3 ^
- //: A6 n6 ~6 O+ x, B* r( B
- CoreExit (ImageHandle, Image->Status, 0, NULL);
& m6 }) o7 r9 T+ @, s% X1 u" m - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
: b* z& K) ]2 k/ I: m+ b既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
- M. w. t t n. [. G( K: r) f而且目前来看driver只会返回Status而已,根据这个就可以做处理了.9 Z8 A. r% p& P' O; l3 Q
) r" |" V: [6 J. f( _. G. V7 T. X我感觉有点多此一举了...不解 |
|