|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
9 @0 z/ f+ s/ u, t - //
1 }+ _; F; u/ d- X - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed. R, i" \% j. [* B2 i K- \
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump( p% N. ~2 p4 t4 J& g
- // All other return values for SetJump are undefined.4 M: V" p) `% A/ w4 M8 S
- //
) P$ Z0 o1 H& [' J* R - if (Status == EFI_SUCCESS) {, P# @6 n+ t) R* U5 u
- D. |9 q4 U& ~- v
- //; ?) Z# u. Y5 g% o( A
- // Call the image's entry point
& _" G. [# s: g, P6 X% Q+ d* W - //
# y( c3 Q& ^) O n - Image->Started = TRUE;: v1 G9 Y" k7 d+ M/ \2 w
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);# P- N' Y$ Z$ l# j
- 5 d u. q( E6 V
- //6 L E5 V _2 I6 Z) y5 |
- // Add some debug information if the image returned with error. 7 ?5 D& b* n/ A3 g1 Y. r" }5 q4 x
- // This make the user aware and check if the driver image have already released
1 ^! r( [1 |7 j - // all the resource in this situation. . H+ u/ Z8 Y( d, K8 v# |
- //* a4 o: [0 g3 g$ `3 l- g* L
- DEBUG_CODE (
, L+ b1 R5 H) @1 c0 } - if (EFI_ERROR (Image->Status)) {
1 m5 M( F/ v: i: A - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));) a8 R: h3 H- _4 ?& ^ q
- }
: T- z: {4 N# M! {) L' M - )+ e% ^5 e# Q# O! X3 n/ f
-
! B: ], R1 E5 k* `6 X( {2 ^( _; _, t - //
( @2 W5 ^- z, j$ G4 E! }6 ^ - // If the image returns, exit it through Exit(), p6 p# @) M& y/ a0 e
- //
2 a8 @6 ~3 T+ u5 T, [/ a; u5 h - CoreExit (ImageHandle, Image->Status, 0, NULL);- A8 h1 ]$ s9 A9 X. F
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
0 M9 s/ C- x3 ~7 `! M既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
" m, c5 [7 C6 s. _8 j, x而且目前来看driver只会返回Status而已,根据这个就可以做处理了.2 d3 V. [0 O2 B- a" A3 P/ F; ?
7 L9 O9 N- S" _/ j我感觉有点多此一举了...不解 |
|