Page 1 of 1
..
Posted: Fri Oct 04, 2013 10:33 pm
by Bender
..
Re: What you happen if my Kernel size is greater than 24K?
Posted: Fri Oct 04, 2013 10:47 pm
by Nessphoro
Nothing.
Why such an arbitrary number?
Re: What you happen if my Kernel size is greater than 24K?
Posted: Fri Oct 04, 2013 10:50 pm
by Bender
Because I have heard that in Real Mode in a 64K Memory Segment :
Disk Buffer - 8K
Kernel - 24K
Other Stuff - 32K
So I thought that if my Kernel is more than 24K, there would be a problem.......
Re: What you happen if my Kernel size is greater than 24K?
Posted: Fri Oct 04, 2013 10:55 pm
by Nessphoro
8K? Thats a pretty massive bootsector.
Honestly, though, it all depends on how you utilize the memory.
If you're doing it in assembly then you have all the power. However, if you were using a compiler then you might have some problems.
But nothing stops you from having different segments for CS, DS, SS and etc.
Re: What you happen if my Kernel size is greater than 24K?
Posted: Fri Oct 04, 2013 10:59 pm
by Bender
ooops!
8K is not the bootsector but the disk buffer...
And I have avoided the use of segment registers...
(I am sorry if this is irritating)
Re: What you happen if my Kernel size is greater than 24K?
Posted: Fri Oct 04, 2013 11:51 pm
by bluemoon
sid123 wrote:I have heard...
To enter the great mystery world of OS development, you gotta read the manual and specifications, and performance tests, but not blindly trust anything you heard.
Your calculation assume a so-call tiny memory model, where the compiler assume everything lies within the same segment. However, real model itself has better flexibility, you can adjust the segment register to access roughly 1M of memory (address FFFF:FFFF and read 4 bytes there, to be exact)
Re: What you happen if my Kernel size is greater than 24K?
Posted: Sat Oct 05, 2013 1:07 am
by linguofreak
sid123 wrote:ooops!
8K is not the bootsector but the disk buffer...
And I have avoided the use of segment registers...
(I am sorry if this is irritating)
If you're limiting yourself to a single segment, there could be any number of reasons that you're not seeing any problem.
You may not have allocated things like you think you have, so that your kernel has more room than you think.
You may actually have a problem that hasn't become visible yet: Your kernel may be being loaded with the tail end of it sticking into your "other stuff" space, and then it may be that that tail end is being overwritten by "other stuff", but the functions at the end of the kernel aren't used often, so it's not crashing yet, even though it's already damaged.
If the only thing in the "other stuff" space so far is your stack, it is quite likely that you simply aren't using enough space on the stack yet to start impinging on your kernel.
If you're writing this in C rather than assembly, it may be that you think you're just using one segment but your compiler is actually doing something else.
In general though, there's no need to limit yourself to a single segment (except for a challenge), there's little or no reason to limit yourself to real mode, and just because you're limiting yourself to 64k doesn't mean you have to split it 8/24/32.