+ Ricardo > > > I recently noticed in UEFI spec v2.7, section 2.3.4, Calling > > > Conventions for X64, that “All selectors set to be flat with virtual > > > = physical address. If the UEFI OS loader or OS used > > > SetVirtualAddressMap() to relocate the runtime services in a virtual > > > address space, then this condition does not have to be met. My > > > understanding of it is as shown below. Please correct me if it’s wrong. > > > > > > 1. It’s not mandatory for the OS to call SetVirtualAddressMap() > > > > > > 2. If it’s not called, the OS can still use EFI Runtime Services in > > > physical mode (i.e. PA == VA). > > > > > > > > > > > > For x86_64, I did a quick test with qemu and OVMF. I have commented > > > out call to SetVirtualAddressMap() from kernel and noticed that > > > everything works fine i.e. efi variables have the normal > > > functionality and I ran LUV (Linux UEFI Validation). Not calling > > > SetVirtualAddressMap() doesn’t break anything because on x86 we have > > > 1:1 mappings. So, could someone please let me know why we might > > > still need > > to call SetVirtualAddressMap()? > > > > > > > You are right, and the same applies to arm64. However, Apple Mac EFI > > is known not to tolerate PA==VA at runtime, Some doubts again, When SetVirtualAddressMap() isn't called, how does Apple Mac EFI realize that the system is in runtime mode and how does it realize that it should now start using VA instead of PA? Extending it further, if SetVirtualAddressMap() isn't called, any platform firmware shouldn't be aware that the system is in runtime mode.. right? Or does the firmware behavior change on call to ExitBootServices()? AFAIK, ExitBootServices() means that boot services are no longer needed by OS/bootloader and hence firmware can terminate them. Does it also mean that the system is in runtime mode..? (I don't think so, as, I didn't find it in UEFI spec). Also, could you please enlighten me on, Why calling SetVirtualAddressMap() is optional, why not make it mandatory? > > and there may be other x86 > > firmware implementations that don't work correctly in this case, since > > they are only tested with MS Windows, which also calls > SetVirtualAddressMap(). Regards, Sai ��.n��������+%������w��{.n�����{����*jg��������ݢj����G�������j:+v���w�m������w�������h�����٥