Discussion:
Questions about user memory mapping
(too old to reply)
Ben Rogers
2005-04-02 04:04:25 UTC
Permalink
From what I understand, using paging each user context has its own 2GB
worth of virtual memory, and you allocate pagable pages for the text and
data sections as needed. And then copy those sections into the
allocated pages. What I am a little unclear on is the use or Malloc and
memset, and the memory field in a user context. What effect do Malloc
and memset have now that we are using paging? Also, what does the
memory field get set to? or do we even need it any more? My first guess
would be that memory points to the virtual address 0x80000000 and has
size 2GB, which leads me to ask, as far as the user context is concerned
can we think as though it has 2gb of memory, with this range, and what
we do in paging will take care of the rest?

Thanks,
Ben
Iulian Neamtiu
2005-04-04 19:43:40 UTC
Permalink
Post by Ben Rogers
From what I understand, using paging each user context has its own 2GB
worth of virtual memory, and you allocate pagable pages for the text and
data sections as needed. And then copy those sections into the
allocated pages. What I am a little unclear on is the use or Malloc and
memset, and the memory field in a user context. What effect do Malloc
and memset have now that we are using paging?
Malloc gives you unswappable memory from the kernel heap.
Alloc_Pageable_Page () gives you swappable memory.

Look in mem.c::Init_Mem() at lines Add_Page_Range(..). You'll see that
available pages added via Add_Page_Range(..) don't overlap with the
kernel heap initialized with Init_Heap(...).

Also, what does the
Post by Ben Rogers
memory field get set to? or do we even need it any more? My first guess
would be that memory points to the virtual address 0x80000000 and has
size 2GB, which leads me to ask, as far as the user context is concerned
can we think as though it has 2gb of memory, with this range, and what
we do in paging will take care of the rest?
That's correct, userContext->memory should be 0x80000000.

Iulian

Loading...