|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
a2 \1 c/ g+ }7 z7 E9 ~+ ^ - //' s$ d( Z% K# z& J& y: b4 G
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed d9 n0 S& @0 t6 R6 X9 Q$ U: b" x
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump9 |# l0 H5 {4 y% X
- // All other return values for SetJump are undefined.* a/ Q* i2 ]# t9 L- g
- //
. [1 F! c6 V! _! F; N - if (Status == EFI_SUCCESS) {+ i9 z+ r6 m$ j: H2 `4 Y
- % C5 t; z; t: p1 m
- //1 H; \, k! ~) U; e/ m
- // Call the image's entry point
6 K1 s( c: t; v! S - //
7 g, G8 w- _* a$ ?* k - Image->Started = TRUE;9 G; r% ~1 M% D$ v) H7 m
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
. }: a. l# a/ [0 Z$ _9 M6 W
, l, D. _6 Q4 [- //
" l) D0 w& [9 y4 W" Q - // Add some debug information if the image returned with error.
& t& J' X1 S( I" ^6 a - // This make the user aware and check if the driver image have already released
' Z9 m) f$ r8 k - // all the resource in this situation.
, A# F8 o! {. @; L8 c' s - //
5 R5 f4 V- v8 R! p! m7 f - DEBUG_CODE (
- i: C8 J2 I3 w4 m# w) z P - if (EFI_ERROR (Image->Status)) {' `9 R- p3 h3 a# b
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));) [0 w& n$ y( B9 l& J" C
- }
p5 y x# a2 R* l - )
1 w: X% {# I$ j0 E1 V' E -
: _9 M) N9 ]% \1 g5 I- F - /// y! _4 G. q" b Y ~9 R6 h5 p
- // If the image returns, exit it through Exit()1 i$ o; k' N( K" |
- //; |1 i$ S0 j/ h( O+ R
- CoreExit (ImageHandle, Image->Status, 0, NULL);% h, E0 B/ ]/ n* ~4 J0 M, q2 _ Y
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态. i$ Y H: G( ?1 |" `5 C. g ~
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?* C% Y% I1 p) I$ B% b6 ~- }
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
9 v8 h$ f' \- N% O$ W- ?- S5 S" {# E
我感觉有点多此一举了...不解 |
|