Loading a 64bit kernel
Posted: Wed Sep 23, 2009 1:31 am
Hi everybody,
I'm trying to write a 64bit (amd64) kernel. I want to switch to long mode by using a loader that is called by GRUB and jumps to the actual kernel loaded by GRUB as a module. In that loader I want to initialize the 64bit mode. Now I've just looked into the AMD64 Architecture Programmers Manual and I've realized that I need to set up paging before switching to long mode. My problem is that I want to keep the loader as small as possible (when I say 'small' I don't mean the size in bytes or so but the number of things I have to implement in the loader and not in the actual kernel) and therefore I'd like to initialize paging in the 64bit kernel and not in the loader. Is there any possibility to use something like a dummy paging structure (unlikely, I know) or a very short and simple implementation I can redefine later?
Thanks.
PS: Sorry if my English is a bit incomprehensible, I'm not a native speaker.
PPS: I hope this question is not too stupid, I just like to keep my code tidy.
I'm trying to write a 64bit (amd64) kernel. I want to switch to long mode by using a loader that is called by GRUB and jumps to the actual kernel loaded by GRUB as a module. In that loader I want to initialize the 64bit mode. Now I've just looked into the AMD64 Architecture Programmers Manual and I've realized that I need to set up paging before switching to long mode. My problem is that I want to keep the loader as small as possible (when I say 'small' I don't mean the size in bytes or so but the number of things I have to implement in the loader and not in the actual kernel) and therefore I'd like to initialize paging in the 64bit kernel and not in the loader. Is there any possibility to use something like a dummy paging structure (unlikely, I know) or a very short and simple implementation I can redefine later?
Thanks.
PS: Sorry if my English is a bit incomprehensible, I'm not a native speaker.
PPS: I hope this question is not too stupid, I just like to keep my code tidy.