|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
0 O4 O/ c5 H$ ~& R - //% A5 l4 F+ [! j, g* N6 `$ D
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed3 X* J1 S& U& Q" I! t3 y
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
+ s) A0 N. d6 n2 r: c - // All other return values for SetJump are undefined.
- `6 l- A0 d. O, j- M6 |- M$ O - //% P% }- b7 S. v' m$ c: c0 A& t
- if (Status == EFI_SUCCESS) {0 o9 a# O+ r! y: X
- & O# d# H& M' D! ~$ K8 ^
- //* E; T; W- Q( q
- // Call the image's entry point
3 k* v3 J1 a* }! K. o - //" n5 y, R* l, C( Z6 v6 a. q
- Image->Started = TRUE;& F5 z& p) ^8 Q0 d/ K' c& ?
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
7 w- B7 J- x* G3 H3 T5 R0 Z
, {6 Z2 h( t+ _0 ^- //3 J: [2 {# P& u( ~+ T; I, M
- // Add some debug information if the image returned with error.
3 u' e( a& L4 H' ^ - // This make the user aware and check if the driver image have already released : h5 T: m9 Y( f Z+ @9 c) b
- // all the resource in this situation. ' z# A1 V* c) o6 Y3 i. n5 J
- //8 A7 Y: p- U1 y0 j
- DEBUG_CODE (
8 N% P$ g$ x7 x* [: E - if (EFI_ERROR (Image->Status)) {# D* o$ l! K! y% t0 ~- C9 i
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));+ j1 `( Z. i8 G8 q/ l
- }
& F- Y; [8 e: q0 J - )5 k. ~# ?6 P% q: [) X6 I
- ( m2 M- y3 J& G0 ]0 z
- //
! ^: P' G% [( i - // If the image returns, exit it through Exit()
4 h8 n7 h& O( `# c - //0 @; C) C* G& y# I
- CoreExit (ImageHandle, Image->Status, 0, NULL);6 N! t( n% A4 w" S: J, _
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
- @$ t* V' Z: h9 K2 J$ V% r既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?7 T1 Y+ v% G6 \/ M
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
) i& _* P% A/ a/ A! I, ~4 T& g z2 h3 L3 B |/ A8 n4 U; q* E( x
我感觉有点多此一举了...不解 |
|