Page 1 of 1
Kernel in assembly
Posted: Fri Apr 22, 2016 1:52 am
by Haghiri75
Greetings.
I have experience of writing boot sector in assembly, and also kernel in C.
But for now, I'm curious about writing a kernel in assembly and boot it using GRUB (for x86-based computer).
What shall I read and where shall I start?
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 2:09 am
by iansjack
If you can already do it in C, then just do the same in assembler. As for Grub, just read about the Multiboot standard.
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 2:10 am
by onlyonemac
If you've written a kernel in C, then you should already have a good idea of:
- what design of kernel you like and how this works (e.g. microkernel, monolithic kernel, etc.)
- what functions the kernel needs to perform (e.g. memory management, thread management, etc.)
- what algorithms you use to implement these functions and how these work (e.g. bitmap memory allocator, round-robin scheduler, etc.)
- how to work the various hardware in the computer (e.g. getting keyboard input, writing to disk, enumerating PCI devices, etc.)
In that case, you should get a solid understanding assembler before you try to implement similar ideas to what you used in your C kernel in assembler. It shouldn't be too difficult to do this though once you've got a good understanding of assembler, because you already know what you're trying to do from an operating system development point of view.
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 3:25 am
by Haghiri75
OK, I found a book about writing simple OS a long time ago. It has some information about entering protected mode.
Is that enough?
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 3:52 am
by Octocontrabass
If you use Grub, you don't need to enter protected mode. Grub will do it for you. You should read the Multiboot Specification.
Why do you want to write your kernel in assembly?
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 4:39 am
by Haghiri75
Octocontrabass wrote:If you use Grub, you don't need to enter protected mode. Grub will do it for you. You should read the Multiboot Specification.
Why do you want to write your kernel in assembly?
I think it's more fun to write whole kernel in assembly. Is there any kernel(s) in assembly except MikeOS?
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 5:19 am
by onlyonemac
Haghiri75 wrote:I think it's more fun to write whole kernel in assembly. Is there any kernel(s) in assembly except MikeOS?
MenuetOS
But for someone who "has experience of writing a kernel in C" you're starting to sound a bit ignorant.
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 5:25 am
by BrightLight
My OS is written entirely in assembly language. I don't use GRUB, though. But booting a kernel with GRUB in assembly or C is just the same.
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 5:46 am
by Haghiri75
onlyonemac wrote:Haghiri75 wrote:I think it's more fun to write whole kernel in assembly. Is there any kernel(s) in assembly except MikeOS?
MenuetOS
But for someone who "has experience of writing a kernel in C" you're starting to sound a bit ignorant.
I just wrote a simple "Hello World" kernel in C, because I was curious about that. But now, I want to move that code to assembly, and have more fun and experience and knowledge
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 6:20 am
by Techel
Yeah, writing assembly is fun, but if you plan to expand your project, highlevel languages like C and C++ are more suitable.
Re: Kernel in assembly
Posted: Fri Apr 22, 2016 4:23 pm
by rdos
Haghiri75 wrote:Octocontrabass wrote:If you use Grub, you don't need to enter protected mode. Grub will do it for you. You should read the Multiboot Specification.
Why do you want to write your kernel in assembly?
I think it's more fun to write whole kernel in assembly. Is there any kernel(s) in assembly except MikeOS?
Yes. Most of RDOS is still in assembly. There are a few new drivers in C, but that's mostly for non-time critical things like ACPI, figuring out audio connections and also the code that moves threads between cores.
Re: Kernel in assembly
Posted: Sat Apr 23, 2016 12:05 pm
by osdever
Haghiri75 wrote:Octocontrabass wrote:If you use Grub, you don't need to enter protected mode. Grub will do it for you. You should read the Multiboot Specification.
Why do you want to write your kernel in assembly?
I think it's more fun to write whole kernel in assembly. Is there any kernel(s) in assembly except MikeOS?
ExDOS by omarx024 is written fully on Assembly. Also I know Russian operating syste, names GkukOS.
Re: Kernel in assembly
Posted: Sat Apr 23, 2016 6:14 pm
by CorruptedByCPU
From:
https://github.com/akasei/Cyjon.
Only assembly language, using own Bootloader(Omega) or GRUB (Multiboot v1).
Every label is in English, but comments in Polish.
Look at this:
http://wataha.net/shot/4.png
Re: Kernel in assembly
Posted: Sun Apr 24, 2016 5:31 am
by Nable
catnikita255 wrote:ExDOS by omarx024 is written fully on Assembly. Also I know Russian operating system, names GkukOS.
I'm surprised a bit that nobody has mentioned KolibriOS.