|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
& c( U# \ t: @% r - //
% O+ P0 J( [+ o' I+ R2 o; h0 s$ r - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
: J9 h. m1 M2 |$ `; d6 n8 e - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
+ {+ x( [2 f- n+ y* I/ d# P - // All other return values for SetJump are undefined." j: B4 r: E" `/ T0 E5 e/ k% `, b
- /// ^' T( A' h0 F9 ~+ C4 E1 [' B
- if (Status == EFI_SUCCESS) {
5 e& o# P4 [1 `; }/ w9 D8 V' { - % n* O, T! J, ]* } [
- //! z0 a# k: _) L3 a
- // Call the image's entry point" v4 ?) r7 N7 ]/ ?5 x
- //
& m4 T8 C9 X% K( Q8 H - Image->Started = TRUE;
! P7 K; X6 Z; Q! z7 S* T2 Z - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
' l( p: I0 ?; _7 s - ' ]: L- Q, S. W( u# b2 u: I' k
- //
# H. ~( T# I- E H: k% S2 e( [ - // Add some debug information if the image returned with error. 2 f0 h5 P6 k5 R, A6 ~
- // This make the user aware and check if the driver image have already released
' D6 v5 k# K" s9 l6 b; z - // all the resource in this situation.
9 }" m( }9 @' r/ z. F, W6 W" u: D - //
- g8 Y1 W( s* v8 c4 w( K' r" |% M - DEBUG_CODE (
( X& \. f) Y. G4 r# t' t; d( I2 n - if (EFI_ERROR (Image->Status)) {
E- a, \5 L" V4 n - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
+ r' P! T! c' O' U1 _% x* v3 z0 p - }
* y3 `; M; { ^! D$ e - )/ L" N8 |9 |8 X& G/ P& s
-
, x# L- a8 l) k0 H - //1 Q7 ~' e( l) }0 t
- // If the image returns, exit it through Exit()
+ `# I- H# i5 L9 q - //$ I4 \4 o- C4 r$ [8 S+ z
- CoreExit (ImageHandle, Image->Status, 0, NULL);6 q& N; ~; {& Y2 I8 o. F. O
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态# Q u! q6 w) t; w
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?1 k2 i9 V) S/ m* s/ a; G: W
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
2 Z# }) A( s: o: x4 i8 K2 P8 n( I `
. E5 w/ H7 u( J我感觉有点多此一举了...不解 |
|