Rewrite from Scratch

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
User avatar
Jezze
Member
Member
Posts: 395
Joined: Thu Jul 26, 2007 1:53 am
Libera.chat IRC: jfu
Contact:

Re: Rewrite from Scratch

Post by Jezze »

This was very cool! =) Dont worry about the english, I understood it all.

I liked the books you showed at the end. I'm thinking of buying the ARM assembly and Beyond BIOS book since these are the areas in which I lack a lot of knowledge. Would you recommend them?

The OS seems nice, keep up the good work.
Fudge - Simplicity, clarity and speed.
http://github.com/Jezze/fudge/
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Rewrite from Scratch

Post by gravaera »

Yo:
Kevin wrote:
For me, what comes next is attempting to create something that does surpass existing OSs. For this "good enough" isn't even close to adequate. An OS is like a hierarchy of abstractions (e.g. boot code, with kernel/s on top of that, with drivers on top of that, with things like VFS and GUI on top of that, with applications and things on top of that). If one piece is only "good enough" (not even close to adequate) then it's far better to replace it with something that actually is adequate before too much depends on it (or to put it another way; you don't build a sky-scraper on sand). Until I reach the point where I'm unable to think of a way to improve the design of the boot code, I refuse to bother with the kernel.
As you write your kernel only as a hobby, you can choose to do it this way. You'll never get a working OS this way, because there's always something to improve in each layer, but there's no requirement that a hobby project ever creates a final product. So, yes, that may be a fine way for you. It probably doesn't work quite as well if you want to get a result in the forseeable future.
While I always, always try to have the most holistic design that takes as many generalized and specific hardware cases into consideration, it is almost inevitable that I will come back to even "perfectly" designed code and have to make changes, if not do large re-designs iterations.

It is the fact that I am (self-assertion) very strong in kernel design that ensures that when I do need to change something, it can be done quickly, smoothly and efficiently. Both sides of this argument are "correct", from my experience: you don't proceed until you have the most perfect design you can have for the component you need to code, with the information currently available to you; but you will also inevitably have to return to even the most pristinely conceptualized of code to change it as more perfect, and in-depth design takes place in later components.

I stopped "re-writing" long ago. Version control in, halts to progress out.

Thorough research -> perfect design to the extent possible with the information available at the current stage -> move on to next stage -> repeat.

EDIT: Basically, this:
Love4Boobies wrote:A good design would have to be flexible enough to allow for the requirements to change over time.
My approach to design is: The level of perfection of a design is directly related to the scope of the factors, knowledge and requirements it takes into consideration. It is impossible to achieve truly lastingly perfect design. The only thing that is possible is perfection of design within the ambits of the current scope of known and predictable factors.

--Peace out,
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: Rewrite from Scratch

Post by Antti »

Jezze wrote:I'm thinking of buying the ARM assembly and Beyond BIOS book since these are the areas in which I lack a lot of knowledge. Would you recommend them?
Currently, I am not very familiar with the ARM assembly so I cannot say whether that book is the best one. At least it helped me to understand the basics of it. However, I have not written any useful ARM assembly yet.

Beyond BIOS is good but not great. It is not a reference manual but it gives nice background information of the whole UEFI architecture. Nevertheless, with that book and Phoenix wiki*, I was able to write a bootloader and that is all I need from UEFI for now.

*(http://wiki.phoenix.com/wiki/index.php/EFI_SYSTEM_TABLE)

In the video, executing the following code took long time (UEFI booting). VirtualBox CD icon was just blinking. I do not have real hardware.

Code: Select all

/*
 * http://wiki.phoenix.com/wiki/index.php/EFI_BLOCK_IO_PROTOCOL#ReadBlocks.28.29
 *
 * typedef
 * EFI_STATUS
 * (EFIAPI *EFI_BLOCK_READ) (
 *   IN EFI_BLOCK_IO_PROTOCOL *This,
 *   IN UINT32 MediaId,
 *   IN EFI_LBA LBA,
 *   IN UINTN BufferSize,
 *   OUT VOID *Buffer);
 */

	/* Read Blocks */
	movq SystemBufferPointer(%rip), %rax
	xorq %rdx, %rdx
	pushq %rdx /* Alignment */
	pushq %rax /* SystemBuffer */
	pushq %rdx /* Shadow parameters (Microsoft x64 calling convention) */
	pushq %rdx
	pushq %rdx
	pushq %rdx

	movq BlockIoPointer(%rip), %rcx
	movq MediaId(%rip), %rdx
	movq SystemOffset(%rip), %r8
	movq $IMAGE_SIZE, %r9
	callq *EFI_BLOCK_IO_PROTOCOL_ReadBlocks(%rcx)
	cmpq $0x00, %rax
	jne ReadBlocksError
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Rewrite from Scratch

Post by Kevin »

Nice video. Maybe we should have a separate thread for this, like the one for screenshots.

I almost feel like creating a tyndur video now. Except that I don't really know which parts to show (really small OSes have their advantages in that respect...), that I can't do this nice Finnish (?) accent and that even then I probably wouldn't feel like publishing it. ;)
Developer of tyndur - community OS of Lowlevel (German)
Post Reply