Page 1 of 1

Darned confusing memory allocator

Posted: Tue May 10, 2005 6:19 pm
by Crazed123
OK, it turns out my kernel is actually crashing when it tries to fill in its page bitmaps and superpage bitmaps. The function AllocateSuperPage seems to be where the crash is coming from, but it might be AllocatePage. I want pages of 4KB and superpages of 4MB, so I'd just like a bit of help with the numbers and any other glaring flaws you can spot.

Thank you so much! I will sacrifice a Word File in your honor if you help! The attachment memory.txt is really memorymanager.pas, but it won't allow attaching pas files and says the name is already taken. Whatever.

Re:Darned confusing memory allocator

Posted: Wed May 11, 2005 9:04 am
by Kemp
I know I'm not being helpful, so sorry in advance. Just a quick note that it's nice to see some Pascal/Delphi code on here amidst the sea of asm and C :) Delphi is my preferred language for general app development.

Re:Darned confusing memory allocator

Posted: Wed May 11, 2005 9:48 am
by Pype.Clicker

Code: Select all

pUpperMem: Pointer = Pointer($10000);
shouldn't that be $100000 instead of $10000 ?

I also fear when seeing pMemMap uninitialized ...

btw: "I will sacrifice a Word File in your honor if you help!"

<UglyRedDragon>
I have no need for useless Word Files ... I will not accept less than msword.exe or kernel32.dll
</UglyRedDragon>

Re:Darned confusing memory allocator

Posted: Fri May 13, 2005 7:56 am
by Poseidon
Kemp wrote: I know I'm not being helpful, so sorry in advance. Just a quick note that it's nice to see some Pascal/Delphi code on here amidst the sea of asm and C :) Delphi is my preferred language for general app development.
hehe.. I think it looks quite ugly ;D but that's just me :)

Re:Darned confusing memory allocator

Posted: Fri May 13, 2005 11:21 am
by Kemp
Yeah, it tends to look more cluttered and bulky than something like C (mainly due to using begin and end rather than { and }) and I prefer the look of C code aesthetically (sp?), but I've been programming with Delphi a long time and old habits are hard to break, especially old habits with visual IDEs :D

Re:Darned confusing memory allocator

Posted: Fri May 13, 2005 12:22 pm
by Candy
Kemp wrote: Yeah, it tends to look more cluttered and bulky than something like C (mainly due to using begin and end rather than { and }) and I prefer the look of C code aesthetically (sp?), but I've been programming with Delphi a long time and old habits are hard to break, especially old habits with visual IDEs :D
I myself see three things very wrong with pascal and derivates:

1. The useless overhead. Begin is not more instructive after a 5 minute story than {. It's just longer. You have to define some form of program thing which is not used outside of the pascal world, you use very weird parameter passing logic which breaks anything but windows (since it was designed by people just as braindead).
2. Confusing. If I know it correctly, you terminate each command with a semicolon, except for the last which you must not terminate except with end, except when it's the last of all when you must terminate it with a period. A study quoted in the compiler design book (dragon book) indicates that 60% of errors in pascal is through semicolons and periods.
3. As far as my own acquaintance with pascal is that it was attemptedly forced upon me by a bunch of arrogant 9-year olds who considered themselves better than basic programmers because they used pascal, and who in the end ended up going for something very unrelated to informatics since I still outperformed them even in basic.

Re:Darned confusing memory allocator

Posted: Fri May 13, 2005 12:59 pm
by Crazed123
Pype.Clicker wrote:

Code: Select all

pUpperMem: Pointer = Pointer($10000);
shouldn't that be $100000 instead of $10000 ?

I also fear when seeing pMemMap uninitialized ...

btw: "I will sacrifice a Word File in your honor if you help!"

<UglyRedDragon>
I have no need for useless Word Files ... I will not accept less than msword.exe or kernel32.dll
</UglyRedDragon>
Changed. But actually I do initialize pMemMap in a function outside of that unit.

Re:Darned confusing memory allocator

Posted: Fri May 13, 2005 1:44 pm
by Kemp
Candy wrote: I myself see three things very wrong with pascal and derivates:

1. The useless overhead. Begin is not more instructive after a 5 minute story than {. It's just longer. You have to define some form of program thing which is not used outside of the pascal world, you use very weird parameter passing logic which breaks anything but windows (since it was designed by people just as braindead).
2. Confusing. If I know it correctly, you terminate each command with a semicolon, except for the last which you must not terminate except with end, except when it's the last of all when you must terminate it with a period. A study quoted in the compiler design book (dragon book) indicates that 60% of errors in pascal is through semicolons and periods.
3. As far as my own acquaintance with pascal is that it was attemptedly forced upon me by a bunch of arrogant 9-year olds who considered themselves better than basic programmers because they used pascal, and who in the end ended up going for something very unrelated to informatics since I still outperformed them even in basic.
1. I agree with your comment on begin and end, I would much prefer the { and } option. As for parameter passing, it makes sense to me that they're passed in the order they're written, that's the method my OS is using as no system calls require a variable number of parameters (that being the main advantage of the C/normal method).

2. I'd imagine a lot of mistakes are due to the semicolons, but it's not as hard as you made it sound :P You terminate each line with a semicolon, the last 'end' right at the end of the file has a period, that just marks the end of the code to be looked at by the compiler. You can put stuff after that one that you don't want the compiler to see.

3. That doesn't sound a nice experience, though kudos for the ownership of them :)

So all in all, I agree with some things, don't agree with others, that's life ;D

Re:Darned confusing memory allocator

Posted: Fri May 13, 2005 2:25 pm
by Candy
Kemp wrote: 1. I agree with your comment on begin and end, I would much prefer the { and } option. As for parameter passing, it makes sense to me that they're passed in the order they're written, that's the method my OS is using as no system calls require a variable number of parameters (that being the main advantage of the C/normal method).
The "makes sense" doesn't apply to me. Things that others found natural haven't usually found their way in my head, instead leaving place for open-minded thinking about some things. So, I don't assume the order of passing, I want to know which is best and use that. Since there's one advantage to one of them with no real disadvantage (new people need to learn it first, but then again, they were learning a new language anyway), I like the inverse order better.
2. I'd imagine a lot of mistakes are due to the semicolons, but it's not as hard as you made it sound :P You terminate each line with a semicolon, the last 'end' right at the end of the file has a period, that just marks the end of the code to be looked at by the compiler. You can put stuff after that one that you don't want the compiler to see.
Well, the 60% is a statistic. As with all statistics, you can make them show anything you want, you can even make one statistic prove its own opposite (note, advanced statisticity required for that). The quote is from a book on compiler design (supposed to exaggerate bad designs so you get the point), the research was done on people in their first year with pascal and presumably during the first few weeks. When I learn the language anew, I'm bound to make those mistakes. When I know it for a few weeks, I know the rules and I don't break them (much). Don't pay much attention to it. My point was also written to exaggerate it as much as possible, which will easily convince any manager-type person or lazy-person while anybody with a decent grain of intelligence should be able to look right through it. It's just a ruleset for pascal defined in the language of C rules. In pascal, you wouldn't call the semicolon a terminator but a separator, and when it's a separator, it's damn logic you don't put one at the end. The period would be a program terminator or sth, whereas in C you'd see it as a subscription operator for structs and have no clue what to do with it.
3. That doesn't sound a nice experience, though kudos for the ownership of them :)

So all in all, I agree with some things, don't agree with others, that's life ;D
More or less, yes. My main point on pascal is, it's a nice language, there will certainly be people that use it and use it good, and I will probably never be one of them.


Back to topic, ladies & gentlemen.