|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);- w5 H8 [' @& f. J0 z3 l0 p
- //
4 k5 R) W' X, X* m; p3 ?/ t - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed1 b7 Y& N6 n2 Q. A% v n5 r
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump2 \: @( b. g) N0 G" W) E5 K
- // All other return values for SetJump are undefined.
1 m& l/ c8 }9 Q) m, t) s - //
( u: {* e. k7 m0 ~ - if (Status == EFI_SUCCESS) {
. F3 B6 g4 j5 k0 X0 b+ q6 C - $ W g4 E5 D% _3 P+ s" a
- //1 o/ o" A$ K6 m$ S' H' ~
- // Call the image's entry point+ d% M& N4 E8 u8 M; U6 ?
- //
+ k3 e+ ^ E9 U. A - Image->Started = TRUE;
* K# Q9 C0 K" B2 T4 s6 a k& H% t - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
. S' ~! i, j8 v* y9 ~" n0 f
, G3 [& ?0 M" x3 `- Y" L1 q# ^- //
. S) ~5 ~/ H& ^; G7 l - // Add some debug information if the image returned with error. 7 _ P! S3 Z7 I2 @
- // This make the user aware and check if the driver image have already released
2 O7 r" A4 o( n0 Q* [0 P! \& | - // all the resource in this situation. 4 o- W/ |) q, U' H# A! k
- /// i- b4 I/ Z2 ]' `8 l6 l/ z
- DEBUG_CODE (
& E0 Y. z: x# s9 F- f - if (EFI_ERROR (Image->Status)) {
" K I! a V. Q - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
( d o6 @- Z; k) {: \8 x - }+ t- \! C. p2 j. C/ s+ j
- )
* B) F7 D4 ~) [ -
' E" n t! A0 f. I% | - //5 I0 x3 N" Z6 e1 g @
- // If the image returns, exit it through Exit()
0 U, d% Y4 A0 e# W+ [ - //; t- Y+ l. {8 c( ]- Z
- CoreExit (ImageHandle, Image->Status, 0, NULL);1 {6 e- ^# V3 Z- r4 _4 k
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
9 A; S4 M3 g ^$ y+ J$ e5 Z2 u5 M既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?: P) s7 V$ b7 P( ?+ O9 N
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
/ Z3 [8 m. Q4 J
3 f" |2 h8 s4 g0 C: X, C& n( g: Y我感觉有点多此一举了...不解 |
|