|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
% {# X6 Q1 |3 t# ]+ N - //2 z: x& W: W: w9 G& ?! [
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed9 q! r: P5 i3 R, G% W9 p2 [
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
# X6 u( W% O. e, z1 L - // All other return values for SetJump are undefined.
4 Y; i6 h, T* c - //4 _( B! N c+ ]' O% g
- if (Status == EFI_SUCCESS) {
3 u0 F, M9 D% F, l4 x7 h6 S; @ - 3 j- b- c* v/ f6 D3 Z7 x1 g4 k/ l
- //
3 \" V3 @1 X( H: t - // Call the image's entry point
' B' v' H$ V* G- X D; Q6 m - //
0 V, K T* e& d5 J7 L - Image->Started = TRUE;
# T' J0 e' M7 d. d0 t9 d) ]1 H4 ^0 y4 a- n - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);8 s0 q& M" X+ ^( W: B6 \
7 _+ M4 r& F! ?, y' {( i' B$ f- // j7 i* Z2 C1 `2 X/ J; C. r& `
- // Add some debug information if the image returned with error.
. {* F( k7 S) c1 Y) `% P - // This make the user aware and check if the driver image have already released ( l: ~5 u0 @. k3 ^8 ?
- // all the resource in this situation. 7 Y: Z1 ^+ B3 K7 F# K/ C
- //9 Y4 C, T- u) g
- DEBUG_CODE (
$ m( C/ r* [, @4 ^% R' U& k* H- D: m - if (EFI_ERROR (Image->Status)) {
' i+ a3 F7 N6 H2 `5 [6 Y( }3 R! X! T - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
6 C- A4 v6 j0 d) ~, c# _0 k6 D: Q - }
! p3 B, M& A6 Z* h# [% L - )) J! s% I" a0 W) Y D/ ^3 W, r
-
* R |7 ]9 E! {! F - //
8 s/ O; i/ J' H - // If the image returns, exit it through Exit()5 P% x9 b& `. B9 I1 |, M8 D
- //# P! m" z, {" g) w( Z& Y
- CoreExit (ImageHandle, Image->Status, 0, NULL);
O8 E" P* |3 j - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态6 V8 r! h7 }( [5 _3 ?) z; `
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?5 s0 G" C0 P6 A" w4 x" O/ ~4 Y3 z
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
% p3 n# Q. `' L" {0 m0 ^' W ]& x3 ~8 @/ A3 h9 w8 E
我感觉有点多此一举了...不解 |
|