On Aug 17, 2012, at 2:49 PM, Melwyn DSouza wrote:

> Experts:
> 
> 1. Is there a way to requested an allocation of memory where i can specify 
> the start address?
> AllocateReservedZeroPool (g_reqsz);
> gives me the requested size. I also want to specify that it give me start 
> address
> 
> like
> VirtualAlloc((LPVOID) req_addr, g_reqsz, _MEM_LARGE_PAGES | MEM_RESERVE | 
> MEM_COMMIT, PAGE_EXECUTE_READWRITE);
> 
> I want to request a particular address for the allocated memory.

In general not a good idea, but possible. 

> How to achieve this?
> 

gBS->AllocatePages (AllocateAddress, EfiBootServicesData , 1, &Memory);

See 6.2 Serivces - Boot Services -> Memory Allocation Services in UEFI 2.3.1 
for more details. 


> 2. If i allocate using
> AllocateReservedZeroPool 

Also in general not a good idea per UEFI spec.
Note: UEFI Applications, UEFI Drivers, and UEFI OS Loaders must not allocate 
memory of type EfiReservedMemoryType

Use EfiBootServicesData, unless there is a good reason not to. AKA 
AllocateZeroPool(). 

> in the RootApp at BSP and then 
> Can i access this memory location from a AP thread, like moving data from the 
> allocated memory to a CPU register in the AP thread function?
> Allocation is done before the starting the AP. But i want to access this 
> allocated memory in the AP thread function.
> 

EFI is always virtual address == physical address so all processors share the 
same view of memory all the time.  

The AP is not a thread it is just a CPU that is not (can never be) running EFI. 
It is dangerous to think of the AP as a thread, as it is really just a blob of 
hardware that can access memory and perform calculations. You send the AP work 
via MpServices protocol and data comes back in a memory buffer. Nothing else 
you could do is MP safe. The insidious thing about MpServices is in 99% of the 
cases the AP worker function is compiled into the EFI Application/Driver that 
is calling MpServices so it is really easy to do something that is not MP Safe 
and not notice until you get some random crash. 

So good luck!

Thanks,

Andrew 

> thanks,
> Melwyn.
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to