|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);& K |8 N/ E+ E+ o/ s- M& Y
- //
0 j) Q) J* A/ `% Q, Q3 I; a: M2 D# O k - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed/ T! G% F, n7 E) H& } P
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
2 f ]; B# E: o; ^5 x - // All other return values for SetJump are undefined.0 S, b9 o. Z( @2 H5 y, S/ S
- //. ?; C0 E9 i% f& y0 m0 l- w
- if (Status == EFI_SUCCESS) {. _ K3 a( f: f+ C8 i
- , g) j/ i( b& D4 K8 o
- //
, Z& [7 P2 p' f- I' J- }1 X - // Call the image's entry point
1 R% |; s$ u3 h* U1 A' l - //1 v# C' T" l' ?, L( q% m
- Image->Started = TRUE;
8 i2 e7 V+ ~- p, @! j6 l5 w - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
, _5 K* o; R( b7 o2 r - 7 Y+ |# t& J/ g+ ]2 g8 x7 P% b
- //1 L2 Q# m: C3 |( m* {+ [5 B0 `
- // Add some debug information if the image returned with error.
$ {- ^4 z& E0 K }( Z - // This make the user aware and check if the driver image have already released $ }4 O& o4 e1 k4 H/ k2 d
- // all the resource in this situation. 1 _* B6 ^" r8 Y
- //
+ y' L- n& T- ^: h4 M( K Y - DEBUG_CODE (
& b9 }) j) X# z) i. L - if (EFI_ERROR (Image->Status)) {! ?3 A, Z3 k- e+ C" k
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
T1 [ R7 I& R* r' H - }- ~' g3 G7 v, K! U2 }
- ), D9 Q! ]: [' o, ^2 [/ w _$ J
- - j6 O G/ V: t
- //
7 Q$ A# x2 `* j& z8 m& v; N - // If the image returns, exit it through Exit(): s7 g# S% S* E6 S, [
- //. n" U2 p; [# O- B8 q' Z
- CoreExit (ImageHandle, Image->Status, 0, NULL);
1 A+ I% `& u+ Q p; e3 ]6 q - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态7 O9 g3 m$ G8 q
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?; t. M0 { C+ h) X) g M) }
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
) ^' O& _: M* v( N) t {3 q6 d$ V( Q
+ T0 Z( c W1 o8 g n% V我感觉有点多此一举了...不解 |
|