To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3348
3347  |  3349
Subject: 
Re: Modifying the BrickOS source code
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 15 Jul 2003 11:35:10 GMT
Viewed: 
2819 times
  
Mike,

IIRC, mm_start is the beginning of the heap.  When the system or a user
program requests memory (new in C++ or malloc/calloc in C) the memory is
taken from this block (from mm_start to the end of memory)

What might be confusing is how the memory manager detects the end of
memory.  If your memory pointer is currently > mm_start, then you
increment the pointer and it is now < mm_start then you have reached the
end of memory (and wrapped to the beginning)

However, it is worth noting, mm_start is the end of the Kernel code.  So
mm_start is also used to determine if a piece of code is part of the
kernel or a user program.  User programs are located above mm_start
since the kernel will allocate memory for them when they are downloaded
(dll)

Summary:
1) Kernel code is < mm_start
2) Kernel malloc and calloc > mm_start
3) User code is > mm_start (memory allocated by kernel using malloc or
calloc)
4) User malloc and calloc > mm_start
5) Memory Manager detects end of memory when ptr wraps from > mm_start
to < mm_start

Hope that helps.
// Joe


Michael Martelli wrote:

Thanks to all with the help, I finally got my new News setup info (my original
login wasnt working so I had to re-sign up  but it took about 2 weeks to hear
from lugnet, so Charlie posted some stuff for me).

I am looking at mm.c for my project and I see the variable mm_start and see that
it is defined in the mm.h file but I am not 100% sure of what it defines.

Is it:
a) the end location of the memory -- RAM (i.e. Limit + Base registers in an OS
like Windows or Umix)
b) or is it the where the user portion of RAM starts? (like the Base register in
a normal OS)

I am not sure and everytime I look more I think it is the other one, and not the
one I currently think it is

Thanks a lot and hope I do not annoy you by asking these question that may seem
easy but I cannot seem to understand this variable, even after looking over the
BrickOS site.

Mike



Message has 1 Reply:
  Re: Modifying the BrickOS source code
 
(...) Thanks for the description Joe, but in the above paragraph you seem to contradict yourself, you say that mm_start is the end of kernel mode, but alos that user programs are located above mm_start I do not understand that part, did you mean (...) (21 years ago, 15-Jul-03, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: Modifying the BrickOS source code
 
Thanks to all with the help, I finally got my new News setup info (my original login wasnt working so I had to re-sign up but it took about 2 weeks to hear from lugnet, so Charlie posted some stuff for me). I am looking at mm.c for my project and I (...) (21 years ago, 15-Jul-03, to lugnet.robotics.rcx.legos)

12 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR