|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
1 n9 n. E5 y4 a# J/ b - //# D, c0 w7 e# H3 w9 {* ?0 n: J
- // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed/ l8 h" v( p* \" w* q
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump5 P# Q2 c% ^! s" k ]- w
- // All other return values for SetJump are undefined.' F9 q% E* }/ I' q
- //
) M# _: i0 O& b n# [& l0 L5 e - if (Status == EFI_SUCCESS) {
$ }7 G( C% l* G. \3 ~, J - ! o/ H; V, v; c
- //2 n8 W: l: Y2 j2 ?
- // Call the image's entry point
! h8 f# H, d6 r" |0 @- h* e - //
; U& m2 F- H5 ] - Image->Started = TRUE;
$ B* L8 R+ }0 [. p) f - Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);0 [% e$ x2 X, B8 @( L) c. G
- + Q& v% v) ?1 S H1 m
- //+ z9 t; i4 F) s$ Z9 J: I
- // Add some debug information if the image returned with error.
9 h; V' _- H; @- k, Q; Y g4 H - // This make the user aware and check if the driver image have already released
, k* T/ s: B* G! d* q6 p! k, M - // all the resource in this situation.
) {0 P" x! X9 y3 ?6 m. L! n3 \* T - //* o0 ^3 B3 N; J9 d6 q5 h
- DEBUG_CODE (
( t& G* |4 q5 K9 h( F V - if (EFI_ERROR (Image->Status)) {
2 V8 u2 r7 X, o5 ^0 L - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));9 _# q( ?7 @6 A; r5 Q4 H
- }$ V" E+ q& E* e' L& h3 p) r* K
- )
; I( \5 O8 n2 Z: @0 p$ ^ - 8 s2 i2 m8 ?/ t
- //$ R$ k5 n1 x; u0 k/ N
- // If the image returns, exit it through Exit()5 Y2 W a% ]+ g' c, y) A# h$ O
- //
1 b+ c% u4 G, a' h - CoreExit (ImageHandle, Image->Status, 0, NULL);: o6 `; q5 {4 B% a8 Z
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态$ V3 g. `" o# Z0 {; i# r
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?7 w- u4 I2 ~$ }
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
/ E; V% \% X# P: v, |* \7 m$ c p0 m6 L. y6 q# G! M- j
我感觉有点多此一举了...不解 |
|