{"id":18055990,"url":"https://github.com/grahamedgecombe/arc","last_synced_at":"2025-04-11T02:06:39.261Z","repository":{"id":7604444,"uuid":"8962209","full_name":"grahamedgecombe/arc","owner":"grahamedgecombe","description":"A toy x86-64 kernel.","archived":false,"fork":false,"pushed_at":"2015-05-17T09:13:44.000Z","size":1161,"stargazers_count":52,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-11T02:04:49.667Z","etag":null,"topics":["c","kernel"],"latest_commit_sha":null,"homepage":"http://grahamedgecombe.com/projects/arc","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grahamedgecombe.png","metadata":{"files":{"readme":"README.markdown","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}},"created_at":"2013-03-22T22:29:29.000Z","updated_at":"2024-11-06T11:54:27.000Z","dependencies_parsed_at":"2022-07-31T15:18:55.818Z","dependency_job_id":null,"html_url":"https://github.com/grahamedgecombe/arc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamedgecombe%2Farc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamedgecombe%2Farc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamedgecombe%2Farc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grahamedgecombe%2Farc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grahamedgecombe","download_url":"https://codeload.github.com/grahamedgecombe/arc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328168,"owners_count":21085261,"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"],"created_at":"2024-10-31T01:13:09.592Z","updated_at":"2025-04-11T02:06:39.245Z","avatar_url":"https://github.com/grahamedgecombe.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Arc\n===\n\nIntroduction\n------------\n\nArc is a simple toy operating system for modern PCs with amd64 processors.\nIt is written mostly in C11, with small amounts of Intel-style assembly where\nrequired. It can be loaded by any [Multiboot 2][multiboot]-compliant boot\nloader, such as [GNU GRUB][grub].\n\nScreenshot\n----------\n\n![Arc running the 'hello' program][screenshot]\n\nFeatures\n--------\n\nThe current feature set, at a high level, is roughly:\n\n  * Symmetric multiprocessing (i.e. multiple processors/cores)\n  * Paging (and TLB shootdown)\n  * Physical memory allocation (several zones for DMA addressing limitations)\n  * Virtual memory allocation (in user- and kernel-space)\n  * Interrupt handling (dual 8259 PICs or local APIC)\n  * Interrupt routing (with I/O APIC and ACPI tables)\n  * Timing (8253/8254 PIT or local APIC)\n  * Processes (loaded as ELF64 Multiboot modules) and threads\n  * Scheduling (round-robin, preemptive)\n  * System calls (with `SYSCALL`/`SYSRET`)\n  * Fine-grained locking with spinlocks\n\nMy current short-term goals are:\n\n  * Inter-process communication\n  * Some useful system calls (e.g. memory allocation, spawning threads, etc.)\n  * Better scheduling algorithm (e.g. MLFQ)\n\nand after that, who knows?\n\nI've also got a cryptic `TODO` list (and some comments spread about the code)\nwith shorter-term bugs and ideas.\n\nBuilding\n--------\n\nThe following software is required to build Arc:\n\n  * [GCC][gcc] or [Clang][clang]\n  * [GNU Binutils][binutils]\n  * [NASM][nasm] or [YASM][yasm]\n  * [GNU Make][make]\n\nGCC and Binutils must be [cross-compiled][cross] for the `x86_64-pc-elf` target.\n\nWhen the required software is installed, simply use the `make` command to build\nthe operating system.\n\nTesting\n-------\n\nThe easiest way to test Arc is with the [QEMU][qemu], [Bochs][bochs] or\n[VirtualBox][vbox] emulators. Simply type `./run/qemu.sh`, `./run/bochs.sh` or\n`./run/virtualbox.sh` to launch QEMU, Bochs or VirtualBox respectively.\n\nTo use these scripts you must create a [GNU GRUB][grub] disk image. Due to the\nlicenses used by Arc and GRUB (ISC and GPL respectively) I do not believe that\nthis image can be distributed with the Arc code.\n\n### Generating `disk.img.xz`\n\nTo create this image you will need to install a recent version of GRUB 2, e.g.\nfrom your Linux distribution's package manager. You could also compile and\ninstall the code yourself but that is beyond the scope of this guide.\n\nFirst you should create an empty image file and set up a loop device for it:\n\n    dd if=/dev/zero of=disk.img bs=512 count=32130\n    sudo losetup /dev/loop0 disk.img\n\nThen run fdisk:\n\n    sudo fdisk /dev/loop0\n\nAt the fdisk prompt, first type \"o\" to create a new partition table. Then type\n\"n\" to create a new partition. Type \"p\" to set it as the primary partition and\nthen type \"1\" to make it the first. The first sector should be set to 2048, this\nis probably already the default. Leave all the other settings as the default\nby simply hitting the return key. Finally use \"w\" to save the changes.\n\nNow set up a loop device for the partition:\n\n    sudo losetup -o 1048576 /dev/loop1 /dev/loop0\n\nFormat this partition as ext2 and mount it to a temporary location:\n\n    sudo mke2fs /dev/loop1\n    mkdir temp\n    sudo mount /dev/loop1 temp\n\nInstall GRUB to the partition:\n\n    sudo grub-install --target=i386-pc --root-directory=temp \\\n      --disk-module=biosdisk --modules=\"part_msdos ext2\" /dev/loop0\n\nNewer versions of GRUB require the following invocation instead:\n\n    sudo grub-install --target=i386-pc --boot-directory=temp/boot \\\n      --modules=\"biosdisk part_msdos ext2\" /dev/loop0\n\nFinally unmount the partition, remove the loop devices and remove the temporary\nmount point:\n\n    sudo umount temp\n    sudo losetup -d /dev/loop1\n    sudo losetup -d /dev/loop0\n    rmdir temp\n\nThe template is compressed using XZ to save space (most of it is full of\nzeroes), to compress it run the following command:\n\n    xz -9 disk.img\n\nThe should create a `disk.img.xz` file. Put this in the `run` folder of the\nArc distribution. The `run/{qemu,bochs,virtualbox}.sh` scripts should now work\nassuming you have the correct software installed and Arc was compiled\ncorrectly.\n\nIf you mess up the disk image somehow, just delete `disk.img`. The scripts will\nautomatically create a new disk image from `disk.img.xz`.\n\nFrom time to time it may be a good idea to run `run/fsck.sh`, which mounts the\ndisk image and runs `e2fsck` on it, to avoid complaints in the host kernel's log\nafter the requisite number of mounts have passed.\n\n### Old versions of GRUB\n\nGRUB up to and including version 1.99 has a bug where it load parts of a 64-bit\nELF file as if it were a 32-bit ELF file. Thomas Haller submitted a\n[patch to fix this bug][grub-fix] to the GRUB mailing list. If you use one of\nthe affected versions of GRUB, you'll either need to upgrade to version 2.00 or\nabove, or apply the patch.\n\nLicense\n-------\n\nArc is available under the terms of the [ISC license][isc], which is\nsimilar to the 2-clause BSD license. See the `LICENSE` file for the copyright\ninformation and licensing terms.\n\nArc uses [Doug Lea][dl]'s [memory allocator][dlmalloc] which has been released\ninto the public domain using the [CC0][cc0] license. See the `LICENSE.dlmalloc`\nfile for the CC0 text. The CC0 licensing terms only apply to the\n`kernel/dlmalloc.h` and `kernel/dlmalloc.c` files.\n\nFinally, whilst not related to licensing, it is worth mentioning the\n[OSDev.org wiki][osdev]. It provides a good overview before you jump into the\nvarious manuals and specifications.\n\n[multiboot]: http://download.savannah.gnu.org/releases/grub/phcoder/multiboot.pdf\n[clang]: http://clang.llvm.org/\n[gcc]: http://gcc.gnu.org/\n[binutils]: http://gnu.org/software/binutils/\n[nasm]: http://nasm.us/\n[yasm]: http://yasm.tortall.net/\n[make]: http://gnu.org/software/make/\n[cross]: http://wiki.osdev.org/GCC_Cross-Compiler\n[qemu]: http://qemu.org/\n[bochs]: http://bochs.sourceforge.net/\n[isc]: https://www.isc.org/downloads/software-support-policy/isc-license/\n[grub]: http://gnu.org/software/grub/\n[grub-fix]: http://lists.gnu.org/archive/html/bug-grub/2011-09/msg00026.html\n[vbox]: http://virtualbox.org/\n[dl]: http://g.oswego.edu/\n[dlmalloc]: http://g.oswego.edu/dl/html/malloc.html\n[cc0]: http://creativecommons.org/publicdomain/zero/1.0/\n[screenshot]: https://raw.github.com/grahamedgecombe/arc/master/doc/screenshot.png\n[osdev]: http://osdev.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrahamedgecombe%2Farc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrahamedgecombe%2Farc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrahamedgecombe%2Farc/lists"}