|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
- `6 L$ ~1 D: V4 R% \- z- W - //
7 f1 L0 i$ A1 p) D; u - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed; [; ~( v5 L. R3 z; L6 m
- // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
% r- p6 j) _5 I4 S. X. B9 X3 s5 i - // All other return values for SetJump are undefined.& s4 G4 ?1 |' E$ i/ m- S. F$ m
- //
4 ^6 r5 M U1 D2 q. | - if (Status == EFI_SUCCESS) {
2 J! \+ m% w0 b% o0 u8 ^& v! ? - : s4 C0 Y3 H5 s* D
- //4 n( b. e2 W/ X) a9 Y% M0 U2 D+ h
- // Call the image's entry point
# P* {6 X# O5 \5 A& l1 z( F) Y - //
& h! O( I# M- L) G1 D - Image->Started = TRUE;4 Z; r% W. a$ R% I) {
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
9 ^9 Y" |# I: `# l' B
( ~3 f, Q0 v" C) X; R; U# N- //
5 Y# O; e6 l* w/ ]$ P - // Add some debug information if the image returned with error.
9 }7 N8 O( S3 U8 k y- [+ N. A - // This make the user aware and check if the driver image have already released
) c* y: f% \' @; z6 k4 N; I - // all the resource in this situation. , U) O+ ~5 Z) @2 {" U) S
- //
+ n* {4 T/ u1 G9 m* L: q) w+ c - DEBUG_CODE (1 _- J- c+ J: s5 e" Z h( r, I
- if (EFI_ERROR (Image->Status)) {
! f+ F# w' @# H% ]# w7 [ - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));; X$ M# v" ~8 ~( Y7 a# U
- }0 ?# A) d. j3 N* U
- ) p/ ~5 Q" }& V" T9 u
- 1 c; `' U+ _. v. W1 g. M
- //7 Q! f1 z5 {7 d i1 X
- // If the image returns, exit it through Exit()
5 Q' W2 k, @. f1 r1 D/ H. ~ - //
* v6 H# | ]! _+ R, r' w- D8 M - CoreExit (ImageHandle, Image->Status, 0, NULL);" F1 R$ c5 v6 y% P6 J$ K3 o
- }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态
- j. g+ N8 V- v: t$ O' V/ M) k既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?; c+ m6 P; O* l) [# G
而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
5 t. [! i7 ^9 T( m6 z/ r% w2 }# E' v- g) C! N# D
我感觉有点多此一举了...不解 |
|