Is there any way to create a constant size kernel image. In NASM, the times directive would do the job but how can this be done in C?
Any help would be outstanding.
Best Regards,
Chandra
creating constant size kernel image
creating constant size kernel image
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: creating constant size kernel image
Code: Select all
const char pad[OVER_9000_CHARS];
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: creating constant size kernel image
You cannot do it in "pure" C, because the compiler has no notion of how big the binary will eventually be. (It being created by the backend, after the compiler has finished.)
So you would have to look at the Linker to do this stunt.
So you would have to look at the Linker to do this stunt.
Every good solution is obvious once you've found it.
Re: creating constant size kernel image
Hi,
The only other thing I can think of is that (for some unknown but justifiable reason) you need to align sections (e.g. so that the ".bss" begins on a page boundary), where you don't actually want a fixed size kernel.
Cheers,
Brendan
It'd help to know why you'd consider wasting (tens, hundreds, thousands, millions) of bytes for the sake of padding. The only reason I can think of is that your boot loader (or your memory management initialisation, or paging initialisation) is broken and will only handle a fixed size kernel, and you couldn't be bothered fixing the real problem.Chandra wrote:Is there any way to create a constant size kernel image. In NASM, the times directive would do the job but how can this be done in C?
Any help would be outstanding.
The only other thing I can think of is that (for some unknown but justifiable reason) you need to align sections (e.g. so that the ".bss" begins on a page boundary), where you don't actually want a fixed size kernel.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: creating constant size kernel image
...which the linker can do that for you just fine (ALIGN ...)Brendan wrote:The only other thing I can think of is that (for some unknown but justifiable reason) you need to align sections (e.g. so that the ".bss" begins on a page boundary), where you don't actually want a fixed size kernel.
Every good solution is obvious once you've found it.
Re: creating constant size kernel image
Unfortunately, you are wrong this time. Please donot expect me to be that kind of person who gives up his work, simply not being able to fix. I don't know how your guess came up. Anyway, the thing is not that major problem has caused me to do so. My Kernel is already 64 Kilobytes long and I have two kernels.Brendan wrote:Hi,
It'd help to know why you'd consider wasting (tens, hundreds, thousands, millions) of bytes for the sake of padding. The only reason I can think of is that your boot loader (or your memory management initialisation, or paging initialisation) is broken and will only handle a fixed size kernel, and you couldn't be bothered fixing the real problem.Chandra wrote:Is there any way to create a constant size kernel image. In NASM, the times directive would do the job but how can this be done in C?
Any help would be outstanding.
The only other thing I can think of is that (for some unknown but justifiable reason) you need to align sections (e.g. so that the ".bss" begins on a page boundary), where you don't actually want a fixed size kernel.
Cheers,
Brendan
The first one is protected mode kernel and the second one is real mode kernel. The real mode kernel is for debugging and remote session only.My bootloader has to load both the kernels in the memory at different locations and I'm encountering problem due to number of sectors read, as the sectors consumed by the protected mode kernel goes on increasing as the development process continues.I am using custom Filesystem (TMFS) with 16 bytes entry which is encountering problems when the secotors of the kernel varies. So I just wondered if I could make the protected mode kernel fixed size(approx, 96 KB) and then continue to work on real mode kernel.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: creating constant size kernel image
So you are working around bugs by making bloatware. And then saying you are not "that kind of person who gives up his work, simply not being able to fix.". Man, you are really late for halloween.I am using custom Filesystem (TMFS) with 16 bytes entry which is encountering problems when the secotors of the kernel varies.
This is exactly what Brendan's question was about - to find out if you are doing weird things that are completely unnecessary and can be solved more effectively. I would have asked the same thing.