|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);- Q m2 _* g2 A1 S+ x! p
- //
8 I# U1 P7 b0 S- |1 I2 u - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed5 V4 _" M/ D# e4 V. G0 U
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
& g5 v+ X" ~" s% s: [ s6 S0 z - // All other return values for SetJump are undefined.
* G4 B' U4 h. m( c - //$ {5 J. ~6 V5 N
- if (Status == EFI_SUCCESS) {+ k5 \2 V4 ^ d& T
; z$ [6 B+ g( h' z6 a+ \% M/ [- //
" i, ?. ^( K6 |, U3 n6 r" s - // Call the image's entry point
0 ~& B. A3 k7 ^( v# V+ K - //, f" m- _. m6 Y% `3 ~
- Image->Started = TRUE;0 U. E) _2 F- \5 i% g4 ]
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable); O- C9 }( f5 ~( z
C3 T; I# w( n9 q! n3 {- //
1 |' F, R: g) _$ m - // Add some debug information if the image returned with error.
8 P! O1 h6 y2 M4 { - // This make the user aware and check if the driver image have already released
% w8 E8 i# ]3 H/ ? - // all the resource in this situation.
# [ p, D9 P& b, w, q - //
: y% `; [; y" L - DEBUG_CODE (
" D. {- ?2 i+ v. I' P- {) h - if (EFI_ERROR (Image->Status)) {
2 `$ V; n) Z: m! o8 ]. x. P% E) c - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));" x" b$ ^( v3 Y W4 T, P9 e
- }' T- @& @7 H; k5 m3 Z$ y
- )1 d ~/ q1 M% Z3 X
- ' e2 K) w8 X. Z& @8 z
- //
9 h* s4 @( u3 D s+ y - // If the image returns, exit it through Exit()
% d4 b, ~) L: \' I9 g# Z - //( b& k7 r( ] c- |' w" R- w! a) P& A
- CoreExit (ImageHandle, Image->Status, 0, NULL);
$ ]2 j2 w1 ~. u - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
3 O5 A& Y( X0 J" Q( T) O/ w6 ]既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?$ {# z1 \4 a. `7 p5 Q' r
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.& F# K& y2 z1 [7 k+ c+ X
; j. d0 B3 d; R2 n
我感觉有点多此一举了...不解 |
|