CE.NET: Allocation of linear address space 
Author Message
 CE.NET: Allocation of linear address space

Hi

How can a linear address space of at least 32MB (up to 48MB) be allocated
using Win CE.NET ?

Thanks
Juergen



Sun, 04 Jul 2004 23:38:21 GMT  
 CE.NET: Allocation of linear address space
Look into the CreateFileMapping function on MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceo...
tm/cerefCreateFileMapping.asp).  This might work for you.

Jeff

--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
reserved.


Quote:
> Hi

> How can a linear address space of at least 32MB (up to 48MB) be allocated
> using Win CE.NET ?

> Thanks
> Juergen



Mon, 05 Jul 2004 01:44:03 GMT  
 CE.NET: Allocation of linear address space
Up to now ( up to CE.net ) was impossible to allocate map file more than 32
M ( it's not in 32 M slot as page stated , so why the limit ? ) but is it
now changed in CE.NET ?
TIA
Arkady



Quote:
> Look into the CreateFileMapping function on MSDN

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceo...
Quote:
> tm/cerefCreateFileMapping.asp).  This might work for you.

> Jeff

> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
> reserved.



> > Hi

> > How can a linear address space of at least 32MB (up to 48MB) be
allocated
> > using Win CE.NET ?

> > Thanks
> > Juergen



Mon, 05 Jul 2004 17:15:07 GMT  
 CE.NET: Allocation of linear address space
CreateFileMapping, as well as VirtualAlloc might be one possibility to do
it.
But: Is it really linear address space ??

I found the new CE.NET memory management function AllocPhysMem in the
meanwhile. The documentation mentions that this function allocates
physically contiguously memory. So, this seems to be what I was looking for.

Just some more questions concerning this new CE.net function:
What is the difference between AllocPhysMem and VirtualAlloc ?
Why was it necessary to "invent" this new function ?
When to use what function ?

Thanks
Juergen



Quote:
> Look into the CreateFileMapping function on MSDN

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceo...
Quote:
> tm/cerefCreateFileMapping.asp).  This might work for you.

> Jeff

> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
> reserved.



> > Hi

> > How can a linear address space of at least 32MB (up to 48MB) be
allocated
> > using Win CE.NET ?

> > Thanks
> > Juergen



Mon, 05 Jul 2004 21:07:42 GMT  
 CE.NET: Allocation of linear address space
Windows CE sets up the processor to use virtual addresses for all its work.
It isn't your concern particularly whether the physical memory addresses are
actually contiguous; all that matters is that the OS has mapped those
addresses to contiguous virtual addresses.  Which it does, for
CreateFileMapping.

The only situation in which you need contiguous PHYSICAL memory is if you
intend to do DMA, where another hardware component is going to take charge
of the bus and do its own transfer.  In that situation, it needs to know the
physical memory addresses.

The difference between AllocPhysMem and VirtualAlloc is then that
AllocPhysMem allocates physical memory as addressed at hardware level, but
VirtualAlloc allocates page-size blocks of virtual memory, which could be
physically located anywhere, and not necessarily contiguously, and sets up
the page address translation tables correctly for this purpose.

Note also that if you're performing lots of small allocations, you should
use the HeapAlloc() functions, the LocalAlloc() functions, or the C/C++
runtime functions such as malloc or 'operator new'.  VirtualAlloc is useful
for creating a bigger, page-size scratchpad.

Remember that Windows CE doesn't do any paging.  You'll only be able to
allocate that 32Mb-48Mb block if the device has at least 64Mb of memory AND
if the user hasn't already used too much object store.

HTH,

--
Mike Dimmick


Quote:
> CreateFileMapping, as well as VirtualAlloc might be one possibility to do
> it.
> But: Is it really linear address space ??

> I found the new CE.NET memory management function AllocPhysMem in the
> meanwhile. The documentation mentions that this function allocates
> physically contiguously memory. So, this seems to be what I was looking
for.

> Just some more questions concerning this new CE.net function:
> What is the difference between AllocPhysMem and VirtualAlloc ?
> Why was it necessary to "invent" this new function ?
> When to use what function ?

> Thanks
> Juergen



> > Look into the CreateFileMapping function on MSDN

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceo...

- Show quoted text -

Quote:
> > tm/cerefCreateFileMapping.asp).  This might work for you.

> > Jeff

> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > You assume all risk for your use. ? 2002 Microsoft Corporation. All
rights
> > reserved.



> > > Hi

> > > How can a linear address space of at least 32MB (up to 48MB) be
> allocated
> > > using Win CE.NET ?

> > > Thanks
> > > Juergen



Mon, 05 Jul 2004 23:34:26 GMT  
 CE.NET: Allocation of linear address space
Depends on what you call linear space. VirtualAlloc() allocates a section of Virtual memory as the name implies - the
memory will come from varoius areas (discontiguous) physical memory. Also note that allocations greater then 2M with
MEM_RESERVE and PAGE_NOACCESS will allocate from the same space as memory mapped files (eg. outside of the processes 32M
space)

The new AllocPhysMem() allocates contiguous physical memory. If you are allocating for DMA purposes you should use
HalAllocateCommonBuffer() instead to ensure it is properly locked for DMA usage.

--
Steve Maillet - [Microsoft Windows Embedded MVP]
Entelechy Software Consulting
smaillet 'AT' EntelechyConsulting 'DOT' com
http://www.EntelechyConsulting.com

Quote:

> CreateFileMapping, as well as VirtualAlloc might be one possibility to do
> it.
> But: Is it really linear address space ??

> I found the new CE.NET memory management function AllocPhysMem in the
> meanwhile. The documentation mentions that this function allocates
> physically contiguously memory. So, this seems to be what I was looking for.

> Just some more questions concerning this new CE.net function:
> What is the difference between AllocPhysMem and VirtualAlloc ?
> Why was it necessary to "invent" this new function ?
> When to use what function ?

> Thanks
> Juergen



> > Look into the CreateFileMapping function on MSDN

> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceo...
> > tm/cerefCreateFileMapping.asp).  This might work for you.

> > Jeff

> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
> > reserved.



> > > Hi

> > > How can a linear address space of at least 32MB (up to 48MB) be
> allocated
> > > using Win CE.NET ?

> > > Thanks
> > > Juergen



Thu, 08 Jul 2004 00:11:09 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Addressing linear memory

2. Linear Addressing

3. Please help (640x480 and linear addressing)

4. XMS Linear Addresses

5. SQL Server CE 2.0, EVC++4, and CE.NET

6. CE 3.0 application in CE.NET platform

7. ADOCE and SQL CE on NetPad 5000 (Ce.net)

8. SQL Server CE, CE.NET and eVC++ 4

9. Help! CE 3.0 vs CE .NET newbie questions

10. CE.NET and VS.NET

11. any resource for CE.net on the net ?

12. Allocation space for a char**

 

 
Powered by phpBB® Forum Software