Re: Wince address space allocation



The address your application receives from the malloc call is a
process specific user-space address within Slot 0 of the Windows CE
5.0 address space.

malloc allocates memory from your process' heap which is created by
the kernel within the RAM memory region specified in the MEMORY
section of CONFIG.BIB and should be located within the cacheable
range.

You do not need to do anything else to allocate cacheable memory for
your application unless that memory needs to reside somewhere specific
within the kernel's virtual address space.

Tom


On Thu, 5 Jun 2008 21:08:00 -0700 (PDT), deepu <pradeepit@xxxxxxxxx>
wrote:

Dear steve,
Thanks for the response. I wanted to allocate a memory location in a
cached adress spcae and lock it in the cache. As I am working in arm9
processor. cache locking is possible.
You mean the whole of the userspace is already cacheable in windows
CE. But the variable adress it returns doesnot match with any of the
adresses mentioned in the virtual map. How can i relate these 2?

Regadrs
Deepu

On Jun 6, 12:43 pm, "Steve Araiza" <sara...@xxxxxxxxxxxxxx> wrote:
but I think that the OEMAddressTable only applies to the kernel process.

In your example, your tempPtr is in cached memory.

The cache is usually only enabled for RAM access, it usually does not make
sense for peripherals. With that in mind, explicitly asking for 0x80000000
(probably RAM) will likely corrupt something if you write to it.

What are you actually trying to do?

steve araiza

"deepu" <pradee...@xxxxxxxxx> wrote in message

news:edd142cb-c806-4e79-8823-b5fb72522b9f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Dear all,
I am working on a ARM9 platform that has WINCE 5 ported onit. I want
to use some cached memory space in user application. The normal malloc
is allocating the address at 0x004ea14c, but when i saw the virtual
address space mapping in OEMAddressTable, it shows that cached memory
space lies between 0x80000000-0x9FFFFFFF. Hence I am trying to use
virtual alloc to allocate some memory from that address space, I am
not able to allocate at that location. When I verify the address
returned by virtualalloc, it remains the same as returned by normal
malloc.
I am not able to understand the difference in here between
1) malloc and virtual alloc, and also
2) cached memory space reserved in kernel space and userspace
memorymap where does it points to.

Or am I missing some thing in here. I am using the virtual alloc as
follows.

unsigned int* tempPtr;
tempPtr = (unsigned int*)VirtualAlloc((LPVOID) 0x80000000, 2468,
MEM_RESERVE, PAGE_READWRITE);

I also tried with other (MEM_RESERVE || MEM_TOP_DOWN).

Can any one please letme know if something is wrong in my approach.

Regards
Deepu- Hide quoted text -

- Show quoted text -
.



Relevant Pages

  • Re: Review: My C FAQ Page
    ... the definition of memory leak is good but the information on ... this is not the most efficient way to allocate the 2-d array. ... You have ROW+1 calls to malloc. ... Allocate ROW pointers. ...
    (comp.lang.c)
  • Re: xmalloc string functions
    ... of mallocwhen you are trying to allocate a structure ... caller that fact like I do when malloc() fails to delever me the ... amount of memory I ask it for. ... doesn't have memory to draw stuff it draws. ...
    (comp.lang.c)
  • Re: style question,itoa
    ... our definitions of "memory limited" differ. ... Sorry, you wrote malloc, not memory allocation. ... able to allocate buffers in some convenient location the callee ... calls which can fail, specifically, malloc, need to be checked. ...
    (comp.unix.programmer)
  • Re: xmalloc string functions
    ... malloc() failures will do as a nice stress test, ... pointer, or an allocation failure - you know, the very thing we're ... Why not follow a policy of try and allocate ... memory, if it fails take some application specific recovery action? ...
    (comp.lang.c)
  • Re: style question,itoa
    ... able to allocate buffers in some convenient location the callee ... dynamically allocate a block of memory and computing this size to use ... call might require allocating a page for the stack. ... " Checking every single malloc in a bigger application for possible ...
    (comp.unix.programmer)

Quantcast