flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bzt 09 Nov 2018, 19:05
Hi All,
Not a OS, just a bootloader. I wanted to boot my micro-kernel on different machines and architectures with the simpliest interface possible. Later I made my bootloader available for other OSes as well, and released the source under MIT license. You can give it a try, if you'd like. The UEFI and the RPi versions are written in C, but the BIOS/Multiboot version is entirely coded with FASM only. It consist of two files: - boot.bin (512 bytes): boot record, which works as MBR, VBR and a El Torito "no emulation" CDROM boot record out-of-the-box. Can load bootboot.bin from any filesystem, and supports RAID mirrors. It can be installed on a FAT volume too (does not interfere with the BPB). - bootboot.bin (10k): the stage2 part. Can be loaded by boot.bin, by GRUB as a Multiboot kernel, but also works as a BIOS Expansion ROM (only tested with bochs and qemu, not in real EEPROM). The source code is commented, you can use it for learning purposes (although sometimes you might find interesting things as it took me more than a year to implement all the following features in Assembly with lots of rewrites and bugfixes. The C sources are much cleaner, tbh. Gzip deflate was particularly a bitch to port.) Notable features: - Boots 64 bit kernels only (x86_64 long mode and ARM AArch64) - Sets up virtual memory, mapping the kernel in higher half (at -2M, no protmode/longmode trampoline code or higher-half GDT trickery needed) - Sets up video mode (VESA2.0+, GOP or VC) and maps LFB in higher half (at -64M) - Initializes the serial debug console for your kernel (tested with VirtualBox, qemu and on real hardware. Very useful for debugging) - Designed for micro-kernels, so loads an initrd, assumes kernel executable is inside - Supported initrd formats: cpio (all variants), ustar (POSIX version), James Molloy's initrd format, SFS, and statically linked executables (like the Minix kernel) - Supports Gzip deflate compressed initrd images - GPT aware, can load initrd from a partition or from a file on a FAT16/32 partition, and also from ROM - Kernel can be in ELF64 or in PE32+ format - Environment info (screen dimension, arch independent memory map etc.) is passed in a simple structure at linker specified address - Full documentation available in PDF Suggestions, questions and testing results are welcome, bzt |
|||
![]() |
|
bzt 08 Feb 2019, 10:29
Hi All,
Added co-processor (SSE, Neon) and SMP support. With those, the feature set is now complete. The BOOTBOOT Protocol Specification is now frozen. All cores are running the kernel simultaneously, so you may want to start your kernel with Code: _start: mov eax, 1 cpuid shr ebx, 24 cmp bx, word [bootboot.bspid] jne .ap ; ... things to do on the bootstrap processor .ap: ; ... things to do on an application processor With ARM things are easier as core ids are contiguous (no gaps) and BSP is always core 0: Code: _start: mrs x0, mpidr_el1 and x0, x0, #3 cbnz x0, .ap ; ... things to do on the bootstrap processor .ap: ; ... things to do on an application processor The environment and memory mapping is the same on all cores, except each core has it's own 1k stack. If 1k is not enough for your entire kernel, then you should set up a new stack in your _start() function. Cheers, bzt |
|||
![]() |
|
scippie 08 Feb 2019, 13:31
Sounds impressive! I'll certainly take a look at your code!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.