{"id":24975266,"url":"https://github.com/glolichen/lios","last_synced_at":"2025-04-11T12:06:30.830Z","repository":{"id":242362084,"uuid":"808875724","full_name":"glolichen/lios","owner":"glolichen","description":"Questionably written operating system","archived":false,"fork":false,"pushed_at":"2025-03-18T23:00:28.000Z","size":14157,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T08:22:33.289Z","etag":null,"topics":["c","kernel","os","osdev"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glolichen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-01T03:33:55.000Z","updated_at":"2025-03-18T23:00:32.000Z","dependencies_parsed_at":"2024-06-02T14:58:44.523Z","dependency_job_id":"3f9941c3-7bc1-471d-b319-8be1eba7fb0f","html_url":"https://github.com/glolichen/lios","commit_stats":null,"previous_names":["glolichen/os","glolichen/lios"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glolichen%2Flios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glolichen%2Flios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glolichen%2Flios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glolichen%2Flios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glolichen","download_url":"https://codeload.github.com/glolichen/lios/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248396277,"owners_count":21096913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","kernel","os","osdev"],"created_at":"2025-02-03T20:55:18.979Z","updated_at":"2025-04-11T12:06:30.820Z","avatar_url":"https://github.com/glolichen.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LiOS\n\nAn experimental x86_64 operating system written from scratch in C.\n\n## Currently Implemented\n\n * Bootstrapping to long mode\n * Interrupts (only keyboard implemented)\n * Printing to VGA graphical mode and serial\n * Minimum viable memory manager/allocator\n   * Uses paging (obviously)\n   * Linked list based page frame and virtual address allocator\n   * Kernel heap allocator (using linked lists and bitmap)\n * Supports UEFI and runs on real hardware\n * Basic file system functionality:\n   * reading and writing from NVMe SSD volume\n   * Only FAT32 file system\n   * Can read and create new files, but not write data\n * Basic ELF/program loading functionality\n\n## To Do\n\nGoals:\n 1. Load ELF programs (probably no shared objects, no C library, but need to create a basic syscall ABI)\n 2. Processes\n 3. Userspace shell program\n\nBackburner:\n * Find a way to not read the entire FAT when doing anything with one file\n * Virtual address allocator can only use 1 4KiB page, which is only 128 linked list nodes. So if the memory gets too fragmented the allocator will completely break.\n * Implement writing to a file, beyond simply creating new files\n\n## Memory Layout\n\nSort of based on Linux, with other self-imposed janks as well.\n * 0xFFFFFFFF80000000-0xFFFFFFFFFFFFFFFF (highest 2GiB) is directly mapped to the first 2GiB of physical memory. Paging structures, and also DMA structures sometime in the future, are stored here. Used for `kmalloc`\n * 0xFFFFF00000000000-0xFFFFFFFF80000000 are used for other pieces of kernel memory. Used for `vmalloc`. Page frames used by `vmalloc` come from physical memory above the 2GiB mark. User page frames also come from there.\n * 0xFFFF800000000000-??? reserved for VGA frame buffer virtual address.\n * 0xFFFF900000000000-??? are used to temporarily map PCI device configuration spaces when looking for NVMe drives, and is then used to map the NVMe device for future use.\n * Lower-half virtual memory for user processes.\n\n## Sources\n\n * [OSTEP book](https://pages.cs.wisc.edu/~remzi/OSTEP/)\n * [Intel](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html) and [AMD](https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/40332.pdf) manuals\n * [QEMU docs](https://www.qemu.org/docs/master/index.html)\n * [Multiboot2 specification](https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html)\n * [OSDev Wiki](https://wiki.osdev.org)\n * [ACPI specification](https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/index.html)\n * [UEFI specification](https://uefi.org/specs/UEFI/2.10_A/index.html)\n * [NVMe specifications](https://nvmexpress.org/specifications/)\n   * NVM Express Base, revision 2.1\n   * NVM Command Set, revision 1.1\n   * NVMe over PCIe, revision 1.1\n * [Microsoft FAT32 specification](https://academy.cba.mit.edu/classes/networking_communications/SD/FAT.pdf)\n * [ELF specification](https://www.cs.cmu.edu/afs/cs/academic/class/15213-f00/docs/elf.pdf)\n * [ELF on Wikipedia](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format)\n\nwrite bootable usb: `sudo dd if=iso/os.iso of=/dev/sda`\ncreate qemu drive: `qemu-img create -f raw disk.img [size]` and create GPT with `cfdisk disk.img`\n\n## Dependencies\n\nLiOS depends on GNU-EFI for parsing EFI information. Clone [https://git.code.sf.net/p/gnu-efi/code](https://git.code.sf.net/p/gnu-efi/code) to the base directory and to the folder `gnu-efi`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglolichen%2Flios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglolichen%2Flios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglolichen%2Flios/lists"}