|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
H ~; `" Y% }3 @* h - //( F$ @# V3 c! B" L( l4 b. x# i/ W1 A
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed7 z; \2 Q: U' C% [
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
; N( g# c+ i1 I# B. c - // All other return values for SetJump are undefined.0 p7 x; l- W) E
- //. K7 V0 B% @5 X! R1 e* l
- if (Status == EFI_SUCCESS) {! H6 W7 `7 Q( R4 }# R; X2 i
- 0 w: r! D5 V1 l6 t
- //
: g& t& \( ~, h0 R: B - // Call the image's entry point5 y% W' x3 U/ g( w
- //
1 R' R. s, ~9 y; i - Image->Started = TRUE;$ o. }' ]% Z- F* M2 d
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);9 U( y9 T! @* r0 ]3 ^
- ( x* d0 Z1 n O, G
- //) l& a$ ]. _6 ]# y
- // Add some debug information if the image returned with error. & h* ]7 h' j9 m7 L! M6 V. t
- // This make the user aware and check if the driver image have already released 2 t$ _7 j7 f8 O& j( B
- // all the resource in this situation. 1 l' @. _" f6 y! A0 ?! T, h9 ~, A! D
- //4 }' ~; R* f* c7 h. ]4 h" e
- DEBUG_CODE (
) W2 i: g3 P* B' _5 p+ i, W - if (EFI_ERROR (Image->Status)) {
( x: I2 R2 K2 W u4 ~1 \ - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
) Q2 j* N& @2 J1 P; E - }
8 v( r: k$ }$ r: W5 B1 W" ] - )
4 a' M) W/ C1 m- M - , u" B; ]6 n% u7 q% D* m n# c
- //# G, C! h5 Q4 c1 `/ g
- // If the image returns, exit it through Exit(): {8 }& J3 f; A/ F1 p$ \9 u7 ^
- //
: ~" g; }& N2 J& ]" z. B- i0 g - CoreExit (ImageHandle, Image->Status, 0, NULL);
J' I. l( r) U+ ^ - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
/ W b5 Q: v% D4 m+ ?0 p; z# Q3 c既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
, Z( o! p5 l6 T, Z+ \7 s9 R1 h而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
& U. i# r0 X+ J7 j9 V! t; X% h5 ]9 {0 }+ A
我感觉有点多此一举了...不解 |
|