Commit Graph

145 Commits

Author SHA1 Message Date
Justin C. Miller
870ca1db45 Allow debug option to be communicated at boot 2019-03-11 03:04:57 -07:00
Justin C. Miller
74a5c301f8 Add guid_device_path GUIDs 2019-03-10 23:35:23 -07:00
Justin C. Miller
194527e0fe Fix address-marking bugs
* Non-blocksize-aligned regions could fail to be found. Have the
  bootloader load them aligned.
* Consolidating used frame blocks in the bootstrap means these would
  have been impossible to free as address space
* mark_permanent wasn't actually removing blocks from the free list
2019-03-03 01:42:32 -08:00
Justin C. Miller
8cdc39fdee Switch page_manager to use frame_allocator.
Removed the frame allocation logic from page_manager and replaced it
with using an instance of frame_allocator instead. This had several
major ripple effects:

- memory_initalize() had to change to support this new world
  - Where to map used blocks is now passed as a flag, since blocks don't
    track their virtual address anymore
  - Instead of the complicated "find N contiguous pages that can be
    mapped in with one page table", we now just have the bootloader give
    us some (currently 64) pages to use both for tables and scratch
    space.
  - frame_allocator initialization was split into two steps to allow
    mapping used blocks before std::move()ing them over
2019-02-28 00:37:00 -08:00
Justin C. Miller
863e5bda15 Turning console into a class 2019-02-04 00:48:18 -08:00
Justin C. Miller
579f6f64e6 First step of moving bootloader to C++ 2019-02-03 01:38:12 -08:00
Justin C. Miller
38a1197d9e Removing old waf build scripts and vendored libcxx 2019-02-02 21:39:19 -08:00
Justin C. Miller
bc01a37452 Ninja-based buildsystem now building a running kernel! 2019-02-02 21:35:39 -08:00
Justin C. Miller
1758ee4215 Initial ramdisk support
- Create initrd library to support definitions and loading
- Allow tools compiled for the host machine to be built by wscript
- Create makerd tool to build initrd from manifest
- Move screenfont to initrd, so don't load framebuffer initially
2018-09-05 22:45:30 -07:00
Justin C. Miller
d5b8902d8f Moving the rest (except ACPI tables) to high mem
Also the debug messaging to verify it.
2018-09-03 15:15:19 -07:00
Justin C. Miller
799fbbdd10 _Actually_ move the kernel to the last TiB.
More work on process page tables, including only mapping the last 2 pml4
entries (the highest 1TiB of the address space, ie, kernel space) into a
new table.

Includes the work of actually moving the kernel there, which I had
apparently done in name only previously. Oops.
2018-09-01 14:54:12 -07:00
Justin C. Miller
ff0019841f Fix message in loader 2018-05-15 21:28:46 -07:00
Justin C. Miller
87e7c5f00a Updating wscripts to use custom tasks 2018-05-09 10:21:21 -07:00
Justin C. Miller
9128bfc5f1 Switch to clang and improve cpprt 2018-05-09 01:17:18 -07:00
Justin C. Miller
949c9c0b8c Remove boot elf loader debug spam 2018-05-06 23:01:03 -07:00
Justin C. Miller
cce892e92f Load ELF file by sections to get addresses right 2018-05-06 22:03:44 -07:00
Justin C. Miller
bc6a42735c Bring Intel/HP efi source into project, remove gnu-efi 2018-05-05 14:13:38 -07:00
Justin C. Miller
b2f2a9c721 Set chipset to q35 2018-05-05 11:26:59 -07:00
Justin C. Miller
0c553b3406 Switch to waf build system, first attempt 2018-05-04 23:50:48 -07:00
Justin C. Miller
14f51436d7 Load ELF file with bootloader instead of flat binary 2018-04-28 02:12:08 -07:00
Justin C. Miller
7e462319c9 Fix inconsistenly-named frame_buffer_size 2018-04-24 09:50:07 -07:00
Justin C. Miller
eb13f1f4fb Fix missing return 2018-04-24 08:54:38 -07:00
Justin C. Miller
1de73de2e3 Move page table allocation to top 256GiB.
I forgot to account for tracking page table physical addresses, so
this is a bit of an overhaul. Major changes:
- Refactor bootstrap code into more functions and:
  - Only allocate 32 pages of scratch space
  - Remap remaining space into top 256GiB, the "page table space"
- Use the page table space to directly offset-map page table pages
  from their physical addresses, to avoid tracking overhead.
- Refactor page_block list functions into static functions to better
  handle null/empty lists
2018-04-22 21:52:59 -07:00
Justin C. Miller
e8866abc7a Bootstrap in-kernel memory management 2018-04-20 02:15:56 -07:00
Justin C. Miller
3b560c063a Move kernel to higher half.
Return to having the bootloader re-map the kernel into the higher
half before jumping into the kernel entrypoint, so we don't have
to juggle pointers inside the kernel.
2018-04-19 01:37:34 -07:00
Justin C. Miller
712df97dfc Add a better boot message with version 2018-04-12 09:17:59 -07:00
Justin C. Miller
7f805fae1a Fix only allocating one page for log 2018-04-11 10:14:13 -07:00
Justin C. Miller
067ff3af89 fix tab/spaces 2018-04-10 01:03:52 -07:00
Justin C. Miller
77cc1fe757 Move main module to c++ 2018-04-08 12:44:09 -07:00
Justin C. Miller
4577c2d10c Add the beginning of support for kernel graphics to bootloader.
* Load a font file off disk to pass to kernel
* Expose a framebuffer to the kernel
* Currently the kernel just paints the screen red
2018-04-01 22:48:46 -07:00
Justin C. Miller
23365b39c7 Move all guid instances into .rodata in our own list. 2018-04-01 17:06:49 -07:00
Justin C. Miller
913fb202eb Clean up lots of debug output I no longer use. 2018-04-01 15:41:32 -07:00
Justin C. Miller
967018c3ac Fix con_printf not returing anything. 2018-04-01 15:37:26 -07:00
Justin C. Miller
165ed28cd3 Reduce dependency on efi library functions 2018-03-31 17:32:10 -07:00
Justin C. Miller
cc01f9d260 Actually pass data pages to kernel 2018-03-27 14:50:28 -07:00
Justin C. Miller
fd32af4905 Make memory functions operate on structure type 2018-03-27 14:47:21 -07:00
Justin C. Miller
2b9a0ca15e Create a kernel data area for passing information 2018-03-27 14:46:53 -07:00
Justin C. Miller
fd5780610b Format using clang-format 2018-03-25 14:06:25 -07:00
Justin C. Miller
64a6d88e5c Truly enable virtual memory.
Map is still identity-mapped. I think we need to sort and/or clean up
the map before using a higher half address. In-kernel vga output not
working yet, but do_the_set_registers() is getting called.
2018-03-25 13:51:32 -07:00
Justin C. Miller
e19c7cee50 Give kernel image a header.
Kernel image now has a header with version, magic number, and a
pointer to its actual entrypoint. Entry point is now _start in
boot.s, and we now generate versions.s in the build tree for the
version macros.
2018-03-24 18:34:44 -07:00
Justin C. Miller
d438392ed5 Formatting fixes and removed commented code only. 2018-03-23 09:04:51 -07:00
Justin C. Miller
cdef82f06f Virtualizing memory after exiting boot services 2018-03-22 19:16:44 -07:00
Justin C. Miller
47ebdc7f41 Prematurely jumping into kernel_main 2018-03-19 17:04:35 -07:00
Justin C. Miller
72e143b93c Bootloader loading kernel, not yet jumping to it 2018-03-18 18:07:19 -07:00
Justin C. Miller
d02e1d97d9 Splitting out UEFI bootloader code from kernel
Now the bootloader should be responsible for all initial setup,
loading the kernel, and then handing off to the kernel with
proper data in place.
2017-07-26 01:41:46 -07:00