|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);, G5 f& ?* G7 ]$ E/ ?% m$ o. a
- //6 G5 z( {. @" C- h( r4 V! [
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed0 E! @; T3 e1 [: j7 t6 w" s
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump: U6 m: l. I! e, ~
- // All other return values for SetJump are undefined.+ s- s! ~- u' I/ V5 L. O1 g3 a
- //
: t/ K. _, s" { - if (Status == EFI_SUCCESS) {
- E! V& G/ U2 M4 F
. ?* P, P5 }5 I' b$ a- //7 [9 p" B: q! e6 \0 C4 A, x# s' }
- // Call the image's entry point
9 Y3 T2 Q" a* P: I8 b8 z S8 R - //
4 B& G% H. K0 q4 o1 u! D) c - Image->Started = TRUE;
+ y. y! b$ Q! ^& P - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
. c# Y1 {6 G1 k. J6 H - , N9 w* q: h, j2 p+ E" S4 }% m
- //
( D4 y9 h. M m$ d" r - // Add some debug information if the image returned with error.
" R0 |$ W" D" f8 N - // This make the user aware and check if the driver image have already released
7 G- h- m# _4 t4 O2 F8 }6 a$ I - // all the resource in this situation. % M& j7 H1 `3 Y8 |
- //
& F- p5 |- e) L$ A* Y - DEBUG_CODE (
& O2 q" [2 J3 O$ x, G - if (EFI_ERROR (Image->Status)) {
6 d$ b0 m8 `9 M - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));" H. n" h* z- d* T
- }
$ M& e& w6 J4 ]7 R/ z - )
& [3 ]6 @* r4 C9 w, H - k7 f* \* }" p$ I
- //8 ^ i$ O5 R: s- S* M$ _& @
- // If the image returns, exit it through Exit()2 S8 t& p8 P0 p: D6 W( ?
- //
! M3 Q8 t+ d( V9 r4 |; v - CoreExit (ImageHandle, Image->Status, 0, NULL);
6 ]- q$ o" Y, l5 s0 {5 X* J - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态* B) G) |* [$ Q1 E1 \
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?: ?; \7 k; ?8 Y, i1 C
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
3 L% j- q0 u" J3 R& m0 r a& ^/ I3 v" v# @4 S% z9 o
我感觉有点多此一举了...不解 |
|