|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
9 l" G* \3 R3 e! I' b - //
! _, ~! Q2 F8 e3 P& L - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed3 `( e! `$ ]2 q9 ^
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
" |% G) a P( Z - // All other return values for SetJump are undefined.
5 ?& m$ U' m2 _1 N0 ?: [, C& Q+ m - //
6 \- g3 V0 ?) q - if (Status == EFI_SUCCESS) {
# ~7 p4 W1 w8 m( N! H# A# Q, ~
3 t; [$ O8 ?9 F* {- //
1 E1 K$ g9 w$ |5 B, ` - // Call the image's entry point
7 H" Q9 y) P! l7 q - //
9 c$ c0 h) u; |1 Y* c/ i - Image->Started = TRUE;
* z& K8 T8 w& Y, \. K - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);7 h ^# _0 H% Q r' g1 y" v Z
$ R: f9 p# T4 t) y. e3 p* q- //
% l6 _* j( j( Y3 U& S - // Add some debug information if the image returned with error. 3 v1 G7 ^4 {8 M
- // This make the user aware and check if the driver image have already released
U6 D# _% a3 q% I: J5 W - // all the resource in this situation.
" ]; m7 w' {- P- B$ J7 C0 b; I - //
2 }/ a* r' t- y0 B! ^! r - DEBUG_CODE (
/ k% r, `: l, }! d9 a - if (EFI_ERROR (Image->Status)) {
$ a& k* B! X2 l o$ E - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
* ^& ^$ Z8 a7 X# @ - }1 O+ ?/ o0 y+ m; C( v8 }
- )
, ]+ J2 d) D8 i3 d- c. E# C -
' k* ~$ r6 f6 c; i% n. ~- c8 k& ` - //3 y7 V1 }# i. N% f+ G+ u! Q
- // If the image returns, exit it through Exit()
, J7 l& N% L: F+ l; `5 p - //- m' C H9 \" B& C
- CoreExit (ImageHandle, Image->Status, 0, NULL);, G; s& I0 p) y+ v% `: z
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态" B8 k/ R, d, ?
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?1 n; x& b0 e7 j4 I& H
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
' q* m' A: F, j
- I* p9 ~# m& ^+ Y+ j我感觉有点多此一举了...不解 |
|