|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
5 x4 I3 E2 a" D# E+ N - //$ v/ N, \4 ^, C3 r
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed2 ~- n# i) i" Z0 d, z
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
) `4 G# ^8 G& [$ v1 q - // All other return values for SetJump are undefined.
/ q2 d/ Q( L. F6 f V- R$ E - //
0 \9 T' x& a" Y4 ]6 u4 G - if (Status == EFI_SUCCESS) {
" j+ T- b& w& f# C* U- I6 v - 6 D0 V8 @) Y8 j! L
- //" C( s5 \ J C
- // Call the image's entry point
. P3 ?) b# W" h - //
7 g% T: @$ H9 O" M - Image->Started = TRUE;
7 {$ Z; y" Z6 \8 ^- j - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);3 c( Y/ k+ A. u
- " o" o+ c% E1 L- @
- //" `& O! P+ R- `/ Z$ V3 c4 F+ p
- // Add some debug information if the image returned with error.
+ {) M' _$ _! ] x6 H" u$ V) D - // This make the user aware and check if the driver image have already released $ d# B) X3 l3 A8 \; H8 ~
- // all the resource in this situation. - U$ ^+ H: c$ M( s! a6 W
- //
& G8 ?/ }+ v1 ^, ^" a" X - DEBUG_CODE (
! O' t6 K/ c- ]! Q; _ - if (EFI_ERROR (Image->Status)) {8 Q8 }$ [: U0 D8 H0 v4 Z
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status)); } x# X% w: D% _: Z, Q$ P
- }) I' b% D$ K5 G+ z6 @
- ): |! I' A1 e% A! x4 T9 D1 p
- , c; T M( j/ @
- //) X: V7 ~" ]3 ~! A2 b' `. m
- // If the image returns, exit it through Exit()
: q4 v$ h7 y2 k! x - //
7 S# H. r T4 y! p - CoreExit (ImageHandle, Image->Status, 0, NULL); ` a' C; I5 g2 M. l
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
8 ]4 O: h6 W, V既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?: u2 I% c& J7 l6 i
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
! d7 S$ U4 E6 [! z" m! ~! f, @, g2 ]" e0 x) ?5 n* u3 N
我感觉有点多此一举了...不解 |
|