|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
* Z. c: }' w* @2 C0 S - //; @ D2 S; F2 p2 C: H
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed% u- e' q: R0 G; H
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump. @$ Z, M# R+ f
- // All other return values for SetJump are undefined.: a" o( j- U" k$ V: A
- //
; s4 }; a1 t& N& U# m! F) A% v! n - if (Status == EFI_SUCCESS) {% K u( K S/ I8 u O
- * u5 P2 |7 V2 X8 V1 v
- //
8 s% I! e) I+ r8 D. e - // Call the image's entry point# W+ h0 H. E$ G0 g! K$ H
- //
3 g; k& l. F/ m - Image->Started = TRUE;* _. D5 D# e+ N4 X) H- i- L
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
+ ?1 ?' U0 _3 ]' g* ~# v, K
3 Q% y& B& z5 P5 X: d- //
# L% h) I+ i) V2 v+ K# C) O - // Add some debug information if the image returned with error.
P& w' E7 e" K J$ _, d* ~& A - // This make the user aware and check if the driver image have already released - d) m7 e. Q4 W, [% A* c8 v i% \
- // all the resource in this situation.
/ _3 Q4 P* L5 G r+ A j - //+ Y5 }0 P' e, Y" V, O$ c/ U
- DEBUG_CODE (' w7 P9 s6 w- k4 m+ l
- if (EFI_ERROR (Image->Status)) {
6 Q# R1 k+ X7 R7 }$ @$ { - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));2 _7 ^# s8 U; f! U) \! \
- }
/ o2 R' r& j3 q8 ?# @ - )# z: P; s9 E4 T4 R9 T- d9 L
- T7 e) ]* U; X: g
- //: M' Q" T. i. w0 C* m
- // If the image returns, exit it through Exit(). P6 X3 R/ P% _% x
- //
* J$ A/ f7 J: s3 i& r - CoreExit (ImageHandle, Image->Status, 0, NULL);* u; V( R' ^) ], M6 @7 c) b }
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
9 i& X/ P! L/ u; N! ?既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?. n2 M" o1 x2 ~
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
. j% U5 \& g5 M* `
, C0 I, O& o& r0 a我感觉有点多此一举了...不解 |
|