|
|
EDK_20080905(各家IBV的应该类似),文件Image.c,在CoreStartImage(),如下一段中:- Status = gEfiPeiTransferControl->SetJump (gEfiPeiTransferControl, Image->JumpContext);
2 s# m; P0 k+ z E - //
, P8 R' k! d/ R4 S1 Y - // The SetJump returns EFI_SUCCESS when LongJump Buffer has been armed
8 P. G5 p; e! q% H' g - // SetJump returns EFI_WARN_RETURN_FROM_LONG_JUMP as a result of the LongJump
' n9 L* B# e, Y. E - // All other return values for SetJump are undefined.% ]4 p% E" R$ o
- //
6 u! _9 z p1 w G- j - if (Status == EFI_SUCCESS) {
' {" ?( g1 U! p) I - . C# r$ C5 A" y: M( a2 a
- //( G# a! P, c/ Z3 j% d
- // Call the image's entry point
% O- E/ Y5 i* y! p, P4 Q# E - //5 l. O0 d9 [' \' `* N
- Image->Started = TRUE;: }! B, ]3 `& }6 p( T3 w8 ]
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);8 s% Z' x% N' t& U) y
7 M7 s) J( n. z I0 @ v/ k$ Q: H- // G7 P# I. O; Q9 q1 x4 O
- // Add some debug information if the image returned with error.
' h: N2 ^ j9 Q" _ - // This make the user aware and check if the driver image have already released
8 _ [- j/ i- T' ? - // all the resource in this situation. 9 r$ d" k1 E3 Z K3 ?+ n z
- //7 o, N* {) _0 ?( G" V( O
- DEBUG_CODE (( L+ }, g/ W; ?# p# q
- if (EFI_ERROR (Image->Status)) {
3 J1 D& P [& Z - DEBUG ((EFI_D_ERROR, "Error: Image at %08X start failed: %x\n", Image->Info.ImageBase, Image->Status));
7 J/ |+ R: u! j5 r/ F4 [ F - }
! v; c3 c& s" T8 q3 o5 ^7 v1 f - )& j* `' P2 X- V8 u9 O. h$ G
-
8 B. t+ w$ Y: W0 s7 R - //# V( t/ L4 x, i" ^' o- h) l
- // If the image returns, exit it through Exit()
" h I0 N6 i+ Z# S5 [ j - //
! V! o/ L( z% z) [: f - CoreExit (ImageHandle, Image->Status, 0, NULL);
3 s6 v" O/ g. D% S- T) A - }
复制代码 调用DXE driver前,为什么要用SetJump保存CPU的信息,driver返回后,再用CoreExit--LongJump恢复到SetJump时的状态8 B E( d. S. j2 O# n
既然driver可以返回,为什么非要这样恢复到调用前的状态呢?难道在调用driver的过程CPU的状态可能会被破坏吗?
`& h9 J2 J0 t2 x% X D# `而且目前来看driver只会返回Status而已,根据这个就可以做处理了.
6 d& ~' F( b0 ] o% W8 B# {' M7 g0 Y o- P+ O3 r9 l
我感觉有点多此一举了...不解 |
|