{"id":20637047,"url":"https://github.com/travorlzh/travoros","last_synced_at":"2025-04-15T21:50:27.073Z","repository":{"id":162217310,"uuid":"112884062","full_name":"TravorLZH/TravorOS","owner":"TravorLZH","description":"A simple OS running on Intel x86 architecture | No longer updating","archived":false,"fork":false,"pushed_at":"2018-08-07T09:05:42.000Z","size":513,"stargazers_count":29,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T01:51:37.450Z","etag":null,"topics":["assembly","bootloader","c","i386","kernel","operating-system","os","x86"],"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/TravorLZH.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":"2017-12-02T23:07:08.000Z","updated_at":"2024-08-26T10:35:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e8ad9cd-27c4-441e-886a-bea61a5d7776","html_url":"https://github.com/TravorLZH/TravorOS","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TravorLZH%2FTravorOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TravorLZH%2FTravorOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TravorLZH%2FTravorOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TravorLZH%2FTravorOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TravorLZH","download_url":"https://codeload.github.com/TravorLZH/TravorOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249161104,"owners_count":21222468,"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":["assembly","bootloader","c","i386","kernel","operating-system","os","x86"],"created_at":"2024-11-16T15:12:50.121Z","updated_at":"2025-04-15T21:50:27.065Z","avatar_url":"https://github.com/TravorLZH.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TravorOS - Developing with Simplification\n\n[![Github Release](https://img.shields.io/github/release/TravorLZH/TravorOS.svg)](https://github.com/TravorLZH/TravorOS/releases)\n[![Github License](https://img.shields.io/github/license/TravorLZH/TravorOS.svg)](LICENSE)\n[![Build Status](https://travis-ci.org/TravorLZH/TravorOS.svg?branch=master)](https://travis-ci.org/TravorLZH/TravorOS)\n[![AppVeyor Branch](https://ci.appveyor.com/api/projects/status/github/TravorLZH/TravorOS?svg=true)](https://ci.appveyor.com/project/TravorLZH/travoros)\n[![Coverage Status](https://coveralls.io/repos/github/TravorLZH/TravorOS/badge.svg)](https://coveralls.io/github/TravorLZH/TravorOS)\n\nThis is the first [Operating System](https://en.wikipedia.org/wiki/Operating_System \"Operating System Definition\") I created. It's written in two languages: C language and Assembly.\n\nThis project has been activated since [December 15, 2017](https://github.com/TravorLZH/TravorOS/releases/tag/v0.2-r0)\n\n![screenshot](screenshots/latest.png)\n\n## Table of Contents\n\n* [Work Plan](#work-plan)\n\n* [Bootloader](#bootloader)\n\n\t* [Custom](#bootloader)\n\n\t\t* [Boot Sector](#boot-sector)\n\n\t\t* [Stage 2](#stage-2)\n\n\t* [GRUB](#grub)\n\n* [Kernel](#kernel)\n\n* [Memory Management](#memory-management)\n\n\t* [Page Frame Allocator](#page-frame-allocator)\n\t\n\t* [Dynamic Memory Allocation](#dynamic-memory-allocation)\n\n* [Building System](#building-system)\n\n## Work Plan\n\n- [x] Write text to VGA\n\n- [x] CPU Interrupt (IDT, ISRs, IRQs, etc.)\n\n- [x] Read character from PS/2 Keyboard\n\n- [x] Read string from PS/2 Keyboard\n\n- [x] Virtual Memory (Paging, Frames, etc.)\n\n- [x] Page Frame Allocation and De-allocation\n\n- [x] Dynamic Memory Allocation (liballoc)\n\n- [x] CPU Timer\n\n- [x] Get CPU Information\n\n- [x] Real-Time Clock: So we can know when the movie starts\n\n- [ ] Kernel Stack Trace\n\n- [ ] Multitasking\n\n- [ ] User-mode processes\n\n- [ ] Hard Disk Driver\n\n- [ ] Floppy Disk Driver\n\n- [ ] File System\n\n- [ ] Graphical User Interface\n\n## Bootloader\n\n### Custom\n\nThis OS uses a 2-staged bootloader. In case the second stage is when we entered **Protected Mode** and calls kernel.\n\n#### Boot Sector\n\nThe first 512 bytes of my floppy image contains the Boot Sector which does a lot of stuff that **Protected Mode** cannot do. (e.g. Loading stuff from disk). Then it jumps to the second stage loaded at `0x7E00` (just after the boot sector).\n\n#### Stage 2\n\nThis stage loads the GDT and enters **Protected Mode**, then it copies the kernel loaded by boot sector at `0x1000` to `0x100000` (1 MB). At last jump!\n\n### GRUB\n\nThe size of the kernel is always growing, but I can't always increase the sectors to load. As a solution. I decide to use GRUB. The kernel is stored as an ELF image (`kernel.img`) in a CD which uses `ISO 9660` as its file system. GRUB also supports multiboot, so my Operating System can work together with others (Windows, Linux, etc.).\n\n## Kernel\n\nWe entered protected mode which means we don't have access to BIOS functions. So, this kernel needs to re-implement those functions for controlling the hardware.\n\nNow, I have re-implemented standard devices: screen and keyboard. In the further development. I am going to implement disk driver.\n\n## Memory Management\n\nThis Operating System uses both segmentation and paging to provide memory protection. In my **Global Descriptor Table**, I put 5 segment descriptors:\n\n1. **Null Segment**\n\n1. **Code Segment for kernel**: The segment where my kernel code belongs to\n\n1. **Data Segment for kernel**: The segment where my kernel global variables belong to\n\n1. **Code Segment for user**: Currently not using\n\n1. **Data Segment for user**: Same as 4\n\nI also enable paging. Now I intentionally maped the fourth page in the first page table to `not-present` and `read-only`, so you can generate a **Page Fault** by executing entering `bsod` in my OS's command line.\n\n![bluescreen](screenshots/bsod.png)\n\n### Page Frame Allocator\n\nThis kernel provides a **Page Frame Allocator**, so the memory management will be more convenient and I will be easier to approach multitasking.\n\nAs [JamesM's Tutorial](http://www.jamesmolloy.co.uk/tutorial_html/6.-Paging.html) suggests, I will use a bitset to determine whether a frame is free or not.\n\n```\n           1: Allocated      0: Free\n                 v              v\nframe_bitset: 11110111110101111101111111\n                  ^\n            get_free_frame()\n```\n\n### Dynamic Memory Allocation\n\nI have currently implemented a placement **malloc** without **free** because all variables used by kernel never need to be freed until powers off.\n\n```\nHeap Allocation\n-----------------------------------------------\nAllocated |\nMemory    | Free.......until the end of memory\n          |\n-----------------------------------------------\n```\n\nBecause I am lazy, I port a 3rd party memory allocator called [`liballoc`](https://github.com/blanham/liballoc) which only required few functions in my OS.\n\n## Building System\n\nThis project uses [GNU Make](https://www.gnu.org/software/make \"GNU Make Homepage\") to build. So, the way to build is to type `make`, if any problems occur during the build, type `make dep` before `make`. Open an issue if still stuck.\n\n[![asciicast](https://asciinema.org/a/176920.png)](https://asciinema.org/a/176920)\n\nIf you are not using Linux or WSL (Windows Subsystem for Linux), you will need to [download a cross compiler from here](https://github.com/nativeos/i386-elf-toolchain/releases). Then modify `CC` and `LD` in `config.mk`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftravorlzh%2Ftravoros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftravorlzh%2Ftravoros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftravorlzh%2Ftravoros/lists"}