Sample 64-bit Kernel
Posted: Tue Aug 30, 2016 9:27 pm
This is a test kernel I wrote for an AMD64 3000+ around year 2007 in an MSI K8MM-V motherboard with 2 Gigabytes of RAM and an AGP NVidia graphics card with 512 Megabytes of RAM.
This is a 64-bit kernel, so it could be useful to show how to set it up.
It boots from Real Mode boot code to 32-bit mode.
From there, it enables paging, PAE and a 64-bit code selector to enter Long Mode.
I have learned several things since then, like implementing portable assembly code, starting my kernels/OSes from DOS and trying to go back, invoking my own programs from a console of my own OS from a floppy...; so I plan to add those features to a minimal driver-like kernel core module that I will have to rewrite for 16/32/64-bit.
Meanwhile, here is the source code I wrote as a sample to enter 64-bit mode around years 2007-2009 at the same time of a more capable but equally tiny 32-bit kernel and other projects to handle several file formats. I hope it serves as a simple and good enough example on writing a 64-bit kernel that is portable despite being written in assembly.
http://archive.org/download/amd64_devel ... -10-06.zip
This is a 64-bit kernel, so it could be useful to show how to set it up.
It boots from Real Mode boot code to 32-bit mode.
From there, it enables paging, PAE and a 64-bit code selector to enter Long Mode.
I have learned several things since then, like implementing portable assembly code, starting my kernels/OSes from DOS and trying to go back, invoking my own programs from a console of my own OS from a floppy...; so I plan to add those features to a minimal driver-like kernel core module that I will have to rewrite for 16/32/64-bit.
Meanwhile, here is the source code I wrote as a sample to enter 64-bit mode around years 2007-2009 at the same time of a more capable but equally tiny 32-bit kernel and other projects to handle several file formats. I hope it serves as a simple and good enough example on writing a 64-bit kernel that is portable despite being written in assembly.
http://archive.org/download/amd64_devel ... -10-06.zip