I'd recommend reading UEFI 2.4 sections about the boot and runtime services 
mentioned in this post...

On Jul 24, 2013, at 9:49 AM, "stanley.ganyezu" <stanley.gany...@gmail.com> 
wrote:

> Hi Laszlo,
>  In SetVirtualAddressMap, is CPU running at virtual mode or physical mode?

Physical mode. The OS can only call runtime services in virtual mode after 
SetVirtualAddressMap() succeeds. 

>  How do OS construct VirtualMap?

ExitBootServices() is used by the OS loader (or OS) to terminate EFI services 
and take over the machine (IDT, page tables, etc.). A valid MapKey must be 
passed into ExitBootServices() to succeed, so that the OS has a correct view of 
the memory map. 

> Based on EFI memory map? Or OS add some
> changes?

The EFI Memory map, returned from GetMemoryMap() prior to call to 
ExitBootServices(). The firmware fills in all the fields except for 
VirtualStart.

typedef struct {
  UINT32                                        Type; 
  EFI_PHYSICAL_ADDRESS  PhysicalStart; 
  EFI_VIRTUAL_ADDRESS   VirtualStart; 
  UINT64                                        NumberOfPages; 
  UINT64                                        Attribute;
} EFI_MEMORY_DESCRIPTOR;

When the OS calls SetVirtualAddressMap() it passes in the EFI Memory map with 
the VirtualStart virtual address filled in. 

The contract is the virtual addresses requested by firmware must be mapped by 
the kernel anytime an EFI Runtime Services call is being made. How the mapping 
is done is OS specific. 

Thanks,

Andrew Fish

> 
> Thanks
> 
> 
> 
> Best wishes,
> Stanley
> 
> 
> -----邮件原件-----
> 发件人: Laszlo Ersek [mailto:ler...@redhat.com] 
> 发送时间: 2013年7月25日 0:25
> 收件人: Kinney, Michael D
> 抄送: edk2-devel@lists.sourceforge.net
> 主题: Re: [edk2] runtime service address translation
> 
> On 07/24/13 18:15, Kinney, Michael D wrote:
> 
>> [...] SetVirtualAddressMap() can not break up
>> the memory map entries into smaller entries. [...]
> 
> Thank you both for the answers!
> Laszlo
> 
> ----------------------------------------------------------------------------
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> 
> 
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to