|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);. C% J: \# F: `- F
- //2 Q, u; C& w5 t C
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed+ Q- \: m4 f1 b9 U# b! g& x
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump+ f3 R2 R9 {. c
- // All other return values for SetJump are undefined.# {' S) S% h, U* ?. p. K
- //
( l" Y5 c" h% W. }/ Q) u; p7 }9 l - if (Status == EFI_SUCCESS) {. K( W# I1 F1 t9 x) H
, k8 |9 z M( j; f7 ]7 G9 [+ L1 i) A- // Z+ O* K! O. M/ z- }6 L
- // Call the image's entry point
. m3 E0 a& ^, B1 J4 _% c9 R - //
7 E' n6 ~2 _% I, w& g; ^ - Image->Started = TRUE;1 Y+ E( r/ ?2 T
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
8 q7 N& Y7 z# R, k4 S$ S - 2 [9 E, ^; z" K9 X: A( ^
- //
0 Y' }6 B. x! }7 C& z# P+ K. o - // Add some debug information if the image returned with error.
& T' K5 v* [5 N9 T( A/ }$ W - // This make the user aware and check if the driver image have already released
, W( y/ Z1 W& z# B - // all the resource in this situation. & x( t. @3 o1 b1 y& L
- //) K. @; B% k; u! | h/ {# _# H- S
- DEBUG_CODE (
% S6 E& e; Q3 ^2 k: e' b4 c - if (EFI_ERROR (Image->Status)) {
$ }. u6 J! H) u- j- g7 e" C# C4 J - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));1 {: a6 \8 A8 q2 R
- }
( K ^% I6 H9 {/ j - )
6 i6 E/ G# e/ T9 ]4 [ - + C. H1 u2 ?+ U6 _% n
- //
; r- V3 f0 T, X5 k - // If the image returns, exit it through Exit()+ e" y* R! {/ k+ D
- //0 `* J* S/ r; L
- CoreExit (ImageHandle, Image->Status, 0, NULL);
. ?# i; {8 d4 i( H. j% ~ - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态/ S0 I% G- P% [* r4 z6 f
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
" ?0 l5 G* t+ K( B( l: X而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
- Q ?* A8 O, \" I% ]
) d% Z+ @) {8 o) u$ F我感觉有点多此一举了...不解 |
|