|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
9 m9 V" {1 W+ R6 N - //' u% X! S% D4 d; Q) X7 n% e) G
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
4 @1 M( _1 u$ H2 l3 a. z/ G6 M2 W - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
' q2 }' E4 [: L" w9 o6 R& W+ }- x; ^* U& m - // All other return values for SetJump are undefined.
$ D% z6 b* f" b1 @ - //% }6 e: J9 E9 J6 x, S, U
- if (Status == EFI_SUCCESS) {
9 J8 ?" T, E k; [8 @
) n+ _' I% Y" J4 ~ h$ I- //1 D ]* |& A0 ~1 J
- // Call the image's entry point8 d) I; p6 \2 u8 d; V [" s
- //
1 `' d. C) o5 U - Image->Started = TRUE; }: i5 s) {0 o$ M2 i
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
& S. Z! z( D5 @3 l% j; ?2 C - ( G0 ^& \7 a$ `# ]6 h) R1 ^/ L, R
- //
$ G+ w1 U) s5 l- s, {0 J - // Add some debug information if the image returned with error.
1 S5 y/ W% M+ T. W' `! d2 N. U% P, g; q5 N) J - // This make the user aware and check if the driver image have already released
: u/ r, _7 x. D+ N: @" A2 V - // all the resource in this situation.
) V' O$ K% _7 t" k+ Z - //2 Z: ]+ c; b7 `
- DEBUG_CODE (
# Y& F& r* Q" U2 m9 S - if (EFI_ERROR (Image->Status)) {
# c0 D- q# F2 B; Y - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
, O3 T4 U# Z/ b5 J" [2 R5 ] - }+ P+ q- J! d* b+ f7 H, e
- )
* |9 a/ i0 M4 F' l! J8 p0 ` -
2 D! w7 L2 G3 }2 D - //
; ~+ Y5 U( n) D7 s - // If the image returns, exit it through Exit(), W2 Y# g* D4 ? k
- //0 a- u( D' U; W3 e
- CoreExit (ImageHandle, Image->Status, 0, NULL);
( {* t/ { F3 X/ `9 F; \ - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
# b. s1 k$ t3 P( ~# R7 _. ?3 y既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
# v( s! L4 w/ L而且目前来看driver只会返回Status而已,根据这个就可以做处理了.# `( ^3 n' x) J. S9 X8 u% Z6 }3 U
; i- K# p0 a" s, J" E8 _( q
我感觉有点多此一举了...不解 |
|