|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
% n' I0 Z a- ~& R; B - //6 o% z7 p7 i- V$ t6 |) t
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed* v7 V, r ?. }
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump; ]) P8 e+ s$ D! y% C8 G) a
- // All other return values for SetJump are undefined.1 v+ e! j, ]+ b P
- //
* M* }3 G- k! b9 b8 ]0 E/ k: t - if (Status == EFI_SUCCESS) {/ v# c f+ r+ ]% Y/ U4 I, I$ |* H
- 7 B- |6 f9 H6 @$ o1 k
- //
6 H% \% _! z( R - // Call the image's entry point. C* } R& w$ N& ]
- //
* D7 ^ @, o" Z" ^- t# W2 B. g+ n - Image->Started = TRUE;. _8 N1 |9 w o9 ?* i4 O
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
0 W; F5 H/ @3 Z
3 n7 D2 R' Q. l* |2 e$ l9 ~8 E! b7 c- //( F! y* r1 k# i) w5 E/ \
- // Add some debug information if the image returned with error. ' O$ e, ]( U# g/ i
- // This make the user aware and check if the driver image have already released 7 H3 H% P) |- c6 Q) D
- // all the resource in this situation. & z# ^. ?) I% V+ K8 g$ V8 i0 U6 V
- //
8 N3 j8 t" Z3 w0 ^) [* ] - DEBUG_CODE (
# ?4 l6 I8 y" e9 g& l8 K - if (EFI_ERROR (Image->Status)) { {, E* N: l8 d6 R( v8 {; V
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));( {7 m! S) p3 \( x9 ?& t* @
- }
: L8 N3 D+ M- G) X: v: p8 a - )
/ g* [ i$ [" B8 `& I( r9 g8 G4 n6 Y -
7 k3 W9 o& d& \5 @ - //
0 z# T) a% ~4 a - // If the image returns, exit it through Exit()
& Y* M3 G% W9 u - //
8 }& z! X3 X7 o5 t% X& n - CoreExit (ImageHandle, Image->Status, 0, NULL);
, H8 u2 r. b6 ~; E1 q( b9 ` - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
( e o& o- h4 k8 E! v9 @( F2 f; d2 I既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?$ j c5 B" J" a0 j* j( s
而且目前来看driver只会返回Status而已,根据这个就可以做处理了." Q% Y3 n- O+ q) ^
8 K4 R- G* E( @0 G F+ n* t
我感觉有点多此一举了...不解 |
|