|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
: |; Z6 z4 D; E1 Z - //
g) C- d7 Y7 }' Z3 I - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed T, Y8 \' [* T0 x# D* ]
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump6 J7 [: O) m& B
- // All other return values for SetJump are undefined.
4 n+ ^, _9 K6 u& M: ^7 Z, {; t - //
; S7 X9 Q4 }+ q! s7 H* _ - if (Status == EFI_SUCCESS) {
. ]7 B, R: t ?6 w8 D
- T% a) o: }% d; `) Q) v9 q- //
' Y* L4 R! [6 X' x) j) q$ t# X8 g - // Call the image's entry point: H" } P3 F5 [3 n, c4 H: `
- //: A$ k6 o# ~5 n7 O: S
- Image->Started = TRUE;4 E2 J+ \* ]0 A5 h- a
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
: w- V3 K# N( `4 q9 I
6 H0 @6 z$ u' s' m( |- //' N8 T. n3 Z {& g( W
- // Add some debug information if the image returned with error.
! }# N0 `$ d9 p8 ~ - // This make the user aware and check if the driver image have already released
! r: L2 ^, A, d- D9 o0 U o% `* k - // all the resource in this situation. " x: K$ o4 _: u2 b
- //
m) E' ]4 ]$ ^ - DEBUG_CODE (
+ W/ `- F1 |* |. ^ - if (EFI_ERROR (Image->Status)) {5 [4 l# l" C. O! N- ~6 a$ @) K
- DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
$ \ Q- j4 P8 b9 x - }) P# J, g- t6 c' L
- )
. K% U3 O& Q7 g( ?$ c* v -
1 t6 w9 v& B- p! [% K6 N, Q - //
3 Y, \0 H0 R! }% @, j' ` - // If the image returns, exit it through Exit()! ~ i% T8 S: h) N6 m9 @$ L/ x" H
- //
- t; l' |1 o* r! m5 n6 p' }; h% A3 L - CoreExit (ImageHandle, Image->Status, 0, NULL);- S9 o/ S) d, l
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态; ?: a* B y, m3 V( y
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
: ^* L2 W, _# k5 C+ h9 s而且目前来看driver只会返回Status而已,根据这个就可以做处理了.0 h' n8 a3 ?, I' k. {
5 r2 d. V1 c! s; N& _9 r3 y
我感觉有点多此一举了...不解 |
|