How is this supposed to work? How to allow the program to access the data?
I cannot give away generel linear selectors to PL#3, perhaps I should create a new one for each block
Adrian.
malloc() in pmode
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:malloc() in pmode
giving each block a separate segment will not work with traditionnal C programming
- because people assume malloc to return a void* and they also assume sizeof(void*) == sizeof(int).
- because you only have 8192 selectors and that you're likely to have more blocks than this ...
I would rather promote the use of segments for some "special things" like shared memory areas, mapped files, etc.
Of course in a perfect world, the compiler would do that for you, but the world isn't perfect
- because people assume malloc to return a void* and they also assume sizeof(void*) == sizeof(int).
- because you only have 8192 selectors and that you're likely to have more blocks than this ...
I would rather promote the use of segments for some "special things" like shared memory areas, mapped files, etc.
Of course in a perfect world, the compiler would do that for you, but the world isn't perfect
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:malloc() in pmode
you usually have one big segment for the data & heap and chunks you got with malloc have no "buffer-overflow" protections (i.e. *(malloc(10)+10)='0' will not necessarily raise an exception, except if the allocated block is next to the latest allocated page.
That's a pity, but from that point of view, Intel Architecture didn't manage what it promised.
Now, maybe with some FARPTR tricks, you could protect some very important buffers, but that's all.
If you need more info on malloc algorithm, i suggest you read the tutorials about memory management (from Tim Robinson's page or Bona Fide Development, i think?
That's a pity, but from that point of view, Intel Architecture didn't manage what it promised.
Now, maybe with some FARPTR tricks, you could protect some very important buffers, but that's all.
If you need more info on malloc algorithm, i suggest you read the tutorials about memory management (from Tim Robinson's page or Bona Fide Development, i think?
Re:malloc() in pmode
I didn't find the algorithm for my malloc function to hard to implement and its not that compilcated either. It still doesn't fulyl work at the moment as i have to set up the page fault interupt but i think the malloc function will work alright when it actually has memory behind it.
Peter
Peter