|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
7 _3 z. {6 _9 ^) c1 N! j0 g - //! Z o5 l& Y( A; `2 @: d% {4 Z# g
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
7 ?5 P$ g7 O3 `8 M/ y' G: K - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
* f' J& L2 Q' \. k4 `, w, Z6 b) k7 x$ C - // All other return values for SetJump are undefined.
6 r" w$ L* T) c9 l8 O( x6 B- S) l - //
2 m H5 }9 }1 g) T8 r - if (Status == EFI_SUCCESS) {
& K) s% K% y" Q: e- w/ o1 b/ t5 |6 Y
& @7 U3 H- q# }- //* x/ H% g2 x; |) _
- // Call the image's entry point& a! v" B/ s& x! e3 g
- //, G; W# T% C6 W" @4 O" r
- Image->Started = TRUE;
) J, T6 w0 b) l4 l; }7 H - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
, E. } V1 Z$ ^+ P) L" d
. v* ?& u+ J/ T' w; ?) S1 Y0 D2 E- //0 M) J/ _) S; R; D0 u
- // Add some debug information if the image returned with error. v$ B. |2 K+ ?# w+ o% q
- // This make the user aware and check if the driver image have already released
9 \% K. |+ r+ j9 V6 r! n( N4 g - // all the resource in this situation. & a* x) T, a; `; G9 _% V
- /// K& b; d J9 Q7 Q2 o0 ~
- DEBUG_CODE (' N6 j& L1 B4 n* ?% a" n) @
- if (EFI_ERROR (Image->Status)) {( }# u" c* q: [" |5 }7 X4 O
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
) [3 G3 w J: T1 N - }9 Y1 q+ H+ J7 Y3 |: i7 G
- )
$ q3 n: g `5 ^" Z# N" ?& K- N -
. [4 U1 I0 N5 s7 a+ D8 b. | - //$ _( y+ Z6 l/ Z3 Y7 V
- // If the image returns, exit it through Exit()1 k. Z- P- U% m* E6 \
- //
/ W% ~# n2 n+ }5 u' c* \ - CoreExit (ImageHandle, Image->Status, 0, NULL);3 A: R" {" |3 ^, |' B0 C' b
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态3 _! m3 p9 ?( `! f: X
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
' q. i1 n, U) h而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
4 i' ?6 x0 u: I2 E: O# T a( ~3 ~% z v e9 v7 y1 J/ }
我感觉有点多此一举了...不解 |
|