Re:Problem with determining kernel_size
Posted: Wed Apr 28, 2004 4:44 am
To determine X.
When the osloader loads the kernel, it searches for the directory, inode or whatever for it's entry.
This holds the kernel size in bytes. Round up to the nearest sector boundary and and there is X - your kernel size!
Store safely and use as needed.
The size can then be divided by the sector size used on the disk to tell you how many sectors need to be loaded.
As mentioned in my previous message, the kernel size might not fall on a 4k boundary, so the size should be rounded up to the nearest 4k before using in a paged memory system.
If you're worried about wasted space, it shouldn't be too much and a little can be a good thing. Having data immmediatley after kernal code can cause caching 'freaks'. The processor thinks it's running self-modifried code and performance goes nasty downlike.
When the osloader loads the kernel, it searches for the directory, inode or whatever for it's entry.
This holds the kernel size in bytes. Round up to the nearest sector boundary and and there is X - your kernel size!
Store safely and use as needed.
The size can then be divided by the sector size used on the disk to tell you how many sectors need to be loaded.
As mentioned in my previous message, the kernel size might not fall on a 4k boundary, so the size should be rounded up to the nearest 4k before using in a paged memory system.
If you're worried about wasted space, it shouldn't be too much and a little can be a good thing. Having data immmediatley after kernal code can cause caching 'freaks'. The processor thinks it's running self-modifried code and performance goes nasty downlike.