Hi All, I am prototyping the proposal made in ECR #1390 (MM in Standalone mode etc) on the Juno and FVP ARM development platforms. The prototype mainly has a module of type SMM_CORE that contains:
a. The MM Foundation code in Standalone mode. Lets call the entry point of this module SmmMain(). b. Libraries that a) depends upon. I am able to build this module as a PE/COFF executable. Lets call it SmmCore.efi. An SMM_CORE module is usually dispatched during DXE. In my use case, I want to dispatch it from ARM Trusted firmware. To do this I need to build this module so that: 1. It is an XIP image that can be copied by ARM Trusted Firmware from Flash to volatile memory 2. ARM TF is able to pass control to SmmMain() without requiring understand a file format like PE/COFF or ELF. Ideally, it should just be enough to pass control to the first address of the image. 3. It should be possble to include standalone SMM drivers in this image in the future that the MM Foundation can dispatch. Being a complete newbie, the closest existing solution that I could see is the mechanism that is used build and run FD images for the Juno and FVP ARM development platforms. AFAIU, the BL33_AP_UEFI.fd has a branch instruction at its lowest address that jumps to the _ModuleEntryPoint() of the SEC module. The SEC module (ArmPlatformPkg/PrePi/PeiMPCore.inf) is pulled into the FVMAIN_COMPACT as a Terse executable in a file of type EFI_FV_FILETYPE_SECURITY_CORE.. So, I wrote a SmmCore.fdf similar to ArmVExpress-FVP-AArch64.fdf that pulls in SmmCore.inf into FV.FVMAIN_COMPACT by tweaking [Rule.Common.SEC] to [Rule.Common.SMM_CORE]. This pulls in the SmmCore.efi as a SEC File in the firmware volume. This hackery creates a SmmCore.fd where the first instruction is a branch. Just like the BL33_AP_UEFI.fd, ARM TF should be able to load and run this file as described in 2. above. However, I see that the branch is not to SmmMain(). Instead it is to the _ModuleEntryPoint() from a DriverEntryPoint library that the SmmCore.inf depends upon. On closer inspection, I see that the SmmCore.efi was build with _ModuleEntryPoint() passed as the parameter the Linker's "-e" and "-u" flags. I tried adding a build option to SmmCore.dsc to change the entry point as follows: *_*_*_DLINK_FLAGS = --entry SmmMain This appends the correct "-e" option to the linker flags but the branch is still not to SmmMain(). Having run out of ideas that are within the bounds of the EDK2 build system, I would like to know: a. Is this the right approach to fulfill the requirements in at least 1) & 2) above? b. Is it actually possible to make the hack above work? If so, then what am I missing? Any help in this matter will be greatly appreciated. Please let me know if you need any clarifications. thanks a lot, Achin IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel