{"id":21956178,"url":"https://github.com/marwan475/twistedos","last_synced_at":"2025-03-22T19:18:15.928Z","repository":{"id":260065181,"uuid":"878745785","full_name":"marwan475/TwistedOS","owner":"marwan475","description":"32 bit OS with a rtl8139 network card driver","archived":false,"fork":false,"pushed_at":"2025-01-21T06:55:55.000Z","size":121,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T07:29:15.106Z","etag":null,"topics":["2stagebootloader","bootloader","driver","interrupt-handler","memory-management","network","osdev","rtl8139","usermode","virtualmemory"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marwan475.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-26T02:15:50.000Z","updated_at":"2025-01-21T06:55:59.000Z","dependencies_parsed_at":"2024-11-30T02:31:46.544Z","dependency_job_id":null,"html_url":"https://github.com/marwan475/TwistedOS","commit_stats":null,"previous_names":["marwan475/twistedos"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan475%2FTwistedOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan475%2FTwistedOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan475%2FTwistedOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan475%2FTwistedOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marwan475","download_url":"https://codeload.github.com/marwan475/TwistedOS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245007240,"owners_count":20546144,"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":["2stagebootloader","bootloader","driver","interrupt-handler","memory-management","network","osdev","rtl8139","usermode","virtualmemory"],"created_at":"2024-11-29T08:30:06.875Z","updated_at":"2025-03-22T19:18:15.903Z","avatar_url":"https://github.com/marwan475.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TwistedOS\r\n\r\nx86 32 bit OS from scratch\r\n\r\n## Design\r\n\r\n#### 2 stage boot loader\r\n- stage 1 loads the FAT 12 table then loads in stage 2 of the bootloader\r\n- stage 2 loads the entire kernel from the FAT 12 file system at above 1mb of memory\r\n  - Initializes GDT\r\n  - Switches to 32 bit mode\r\n  - Jumps execution to kernel code\r\n- 2 stages are used due to the 512 byte limit of the inital bootloader and the 1mb limit on 20bit addressing (16 bit + A gate)\r\n\r\n#### Kernel\r\n- installs TSS to allow for interupt handling in user mode\r\n- Set up IDT for interrupt handling\r\n- Initalizes IDT with ISRs\r\n- remaps the PIC to allow for interrupts\r\n- Sets up keyboard driver\r\n- enables interrupts\r\n- Initalizes physical memory manager\r\n  - bit map that manges the workable memory range using blocks of 4096 (size of pages)\r\n- Initalizes virtual memory\r\n  - sets up page table dir and page tables\r\n  - identiy maps first 16mb of memory\r\n  - allocates space for pages using physical memory manager\r\n- Initializes network card driver for rtl8139\r\n  - card sends interrupt any time a packet is recv or sent\r\n- ethernet layer\r\n  - checks if packet is an ARP request or IPv4\r\n- Console support\r\n  - console printing support for output and debugging\r\n  - user is able to enter commands\r\n  - user can enumerate PCI devices\r\n  - user can clear screen\r\n\r\n## Resources\r\n\r\nhttps://www.ctyme.com/intr/rb-0106.htm \r\nhttps://www.ctyme.com/intr/rb-0607.htm // interrupt codes\r\nhttps://www.eit.lth.se/fileadmin/eit/courses/eitn50/Literature/fat12_description.pdf // FAT12\r\nhttps://wiki.osdev.org/Rolling_Your_Own_Bootloader\r\nhttps://wiki.osdev.org/Creating_an_Operating_System\r\nhttps://www.sqlpassion.at/archive/2022/03/03/reading-files-from-a-fat12-partition/\r\nhttps://www.calculator.net/hex-calculator.html?number1=7E00\u0026c2op=%2B\u0026number2=2800\u0026calctype=op\u0026x=Calculate\r\nhttps://wiki.osdev.org/Memory_Map_(x86)\r\nhttp://www.brokenthorn.com/Resources/OSDev18.html\r\nhttps://www.rapidtables.com/convert/number/hex-to-binary.html?x=D\r\nhttps://wiki.osdev.org/PCI\r\nhttps://wiki.osdev.org/RTL8139\r\nhttp://realtek.info/pdf/rtl8139cp.pdf\r\nhttps://ics.uci.edu/~harris/ics216/pci/PCI_22.pdf\r\nhttps://github.com/dreamportdev/Osdev-Notes/tree/master/06_Userspace\r\nhttps://en.wikipedia.org/wiki/Ethernet_frame\r\nhttps://en.wikipedia.org/wiki/Address_Resolution_Protocol\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwan475%2Ftwistedos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarwan475%2Ftwistedos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwan475%2Ftwistedos/lists"}