Coder Social home page Coder Social logo

senior-project's Introduction

This is the repository containing my work on Senior Project at Cal Poly.

Project Information

Author: J. Ethan Adams ([email protected], [email protected])

Project Advisor: Dr. John Bellardo (http://users.csc.calpoly.edu/~bellardo/index.php)


Project Background

This project is a fork of my csc454 project where I developed much of the basic functionality of a simple x86_64 Operating System. Work for senior project will pick up where I left off in this class (to see a description of my previous work, see https://github.com/jadams41/Senior-Project/blob/master/archived/CPE454_README.md)


Project Scope and Overview

The goal of this to develop a custom, functional x86_64 unix-like Operating System.

Project Objectives

  1. OS includes robust implementation of all functionality outlined in the project for csc454.
  2. Fully implemented and functional networking stack (capable of communicating across layer-3 networks via TCP/IP).
  3. OS can be built for physical hardware targets. All implemented OS features will be supported and verifiably functional for each supported hardware target.

NOTE: more objectives will likely be added once Objective 2 has been accomplished.

Current Functionality

  1. Kernel Boot Procedure (assembly):
    1. Create stack and store in esp register
    2. Test for Multiboot-compliant bootloader and store Multiboot Information Structure pointer
    3. Check for CPUID and Long Mode availability
    4. Create initial page tables and enable paging
    5. Enter Long Mode
    6. Call kmain with stored multiboot information
  2. Initailize VGA buffer and basic VGA output capability
  3. Initialize PS/2 driver to handle keyboard input
  4. Enable Interrupts
    1. Initialize Programmable Interrupt Controller and enable cascading between master and slave PICs. Mask all interrupts.
    2. Initialize idt and load with lidt.
    3. Initialize ist(most interrupts use the general interrupt stack while GPF, DF, PF, and Syscalls are given unique interrupt stacks).
    4. Unmask and install ISRs for PS/2, Serial, DF, ATA, GPF, PF, and Syscall interrupts.
  5. Configure Serial Communication Driver (connected to host machine for debugging purposes). All following kernel output will be printed to VGA buffer and sent to host.
  6. Process Multiboot tags and extract relevant information (memory map and elf sybmol tags).
  7. Create new 4 level page table and initialize set up virtual memory (and dynamic memory allocation).
    1. Kernel Heap is initalized.
    2. Allocated virtual memory is paged "on demand" (no physical page used for an allocated virtual page until memory is accessed and page fault is raised).
  8. Probe for ATA devices and initialize if found.
    1. Probe for filesystems on each found device and represent each as "Virtual Filesystem".
  9. Probe for PCI devices and initialize if found.
    1. Currently only focused on initializing rtl8139 NIC
  10. Initialize found Network Interface Controller.
  11. Process and modify relevant information stored in PCI configuration space.
Demos of Current Functionality:
Receiving Network traffic

Receiving and Parsing ARP packets

TODO: Add demo of this functionality

Received ARP Packet Handling Functionality

TODO: Add demo of this functionality


Project Planning

Milestones

Milestone 0: Set up Senior Project and Document Project Scope

  1. Take care of administrative tasks for setting up Senior Project
    • Create project proposal documenting scope and objectives.
    • Procure project advisor.
    • Submit Pre-Enrollment Proposal to officially enroll in Senior Project I.
  2. Set up Project
    • Create GitHub Repository for Documenting project information
    • Populate project's README with initial information regarding project background, scope & objectives, and tentative timeline of critical work.

Milestone 1: Necessary Maintenance and Preparations for New Development

  1. Revise previous work.
    • Review all of previous work - make sure functionality and limitations are understood and documented.
    • Fix identified erroneous/limited implementation.
  2. Create a more robust and stable development environment.
    • Review and document functionality of current build system (make).
    • Migrate build of project (operating system) to use bazel. Ignoring this for now
    • Document how to build and run project with new build system.
    • Research, implement, and document project testing strategy.
    • Explore possibility of migrating project from C to C++.
  3. Complete all cpe454 functionality milestones
    • Review and document initial project's accomplishment of milestones.
    • Fix all partially implemented functionality milestones.
    • Implement remaining non-attempted milestones.

Milestone 2: Implementation of Network Stack

  1. Develop Peripheral Component Interconnect (PCI) driver (Needed to discover, configure, and interact with Network Interface Card)
    • Research and document relevant PCI functionality and control.
      • Implement basic PCI driver (capable of reading from and writing to PCI configuration space).
      • Implement pci_probe (discovery and handling of all devices connected to PCI bus):
        • Detect all devices connected to the PCI bus.
        • Develop super structure to represent PCI device (PCIDevice) with child structures to handle different types of PCI devices. Access to PCI control should be handled through function pointers set in super PCIDevice structure.
        • Integrate functionality: discover all connected devices, store relevant information in PCIDevices, return list of discovered PCIDevices.
  2. Implement Network Interface Card (NIC) driver
    • Research and document different NIC models.
      • Choose initial NIC to develop driver for and document rationale.
      • Implement primitive driver functionality:
        • NIC initalization (utilizing pci control in PCIDevice struct returned from pci_probe)
        • Basic implementation of asynchronous NIC control (transmitting and receiving packets).
        • Enable NIC's interrupts and install ISRs which use asynchronous NIC control functionality.
      • Test basic NIC functionality (transmit and receive ethernet frames):
        • Research and document strategies for networking between qemu VM's and host machine.
        • TEST: Guest receives ethernet frame from host VM:
          • Verify that interrupt fires after frame is sent from host -> VM
          • Verify that frame's header information and data can be properly extracted in VM.
        • TEST: Guest VM sends ethernet frame to host:
          • Verify that ethernet frame sent from guest is received on the host VM.
          • Verify that frame's header information and data are consistent (when received on host).
  3. Build Network Stack
    • Link Layer:
      • Ethernet
        • Discover and store interface's MAC Address
        • Receive and parse Ethernet frames (test with arping verify with wireshark running on bridge interface)
        • Create and send Ethernet frames (test by sending broadcast frame, verify packet validity with wireshark)
      • ARP: Address Resolution Protocol
        • Create ARP infrastructure
          • Structs for representing/extracting info/creating ARP packets
          • Create primitive ARP table for keeping track of received ARP traffic
        • Test ARP Infrastructure
          • Receive and correctly parse ARP traffic (test with arping -I <bridge_iface> -b <ip_on_bridge_subnet> and verify with wireshark running on bridge interface connected to os)
        • Send test ARP traffic (both ARP_REQUEST and ARP_REPLY)
          • Verify that sent packets valid (by running wireshark on bridge interface connected to the os).
          • ARP_REQUEST the bridge interface's IP address and make sure ARP_REPLY is received from bridge interface.
        • Flush out desired kernel ARP functionality:
          • Update arp_table when received ARP traffic contains new/updated ipv4->mac_addr mapping.
          • Handle all received ARP traffic automatically:
          • Upon receiving ARP_REQUEST for os's (mock) ipv4, create and send correct ARP_REPLY with our information. Verify by:
            1. arping for os's mock ip
            2. ensuring that the os receives/handles the ARP_REQUEST and creates+sends ARP_REPLY back.
            3. Seeing the reply is received by arping
            4. Checking host's arp table (using arp) and checking for entry: os_mock_ip -> os_mac_addr
    • Internet Layer
      • IPv4: Internet Protocol Version 4
        • Create Internet Protocol infrastructure:
          • Create more robust network device infrastructure and data structures (like Linux's net_device) for configuring/representing/storing IP information.
          • Structs+Functions for representing/parsing/creating IP packets.
        • Send and receive/parse mock IP traffic (maybe use ICMP or UDP "traffic" for this).
        • Figure out what kernel data structures are needed for IP layer
      • ICMP: Internet Control Message Protocol
        • Create ICMP infrastructure:
          • OS recognizes and handles ICMP packets (probably only need control messages associated with ping).
          • OS can send relevant ICMP requests (probably only need to support control messages associated with ping).
        • Flush out desired kernel ICMP functionality:
          • OS automatically handles all incoming ICMP traffic
            • OS extracts and uses relevant information from received ICMP traffic upon arrival.
            • OS automatically replies appropriately to all received ICMP requests (that are supported).
          • "Userspace" accessible ping functionality (can probably be done in a kernel thread):
            • As similar as possible to running ping on linux command line
            • Outputs same way as linux ping utility (to make testing/validating easier).
    • Transport Layer
      • UDP: Universal Datagram Protocol
      • TCP: Transmission Control Protocol
    • Application Layer
      • DHCP: Dynamic Host Configuration Protocol
        • NOTE: rush to get here ASAP (build only what is needed in order to get DHCP DISCOVER->REQUEST functionality working in order to support dynamic IP addressineg of the OS).
      • HTTP: HyperText Transmission Protocol
        • NOTE: Final objective for Milestone 3

Potential Future Milestones

  1. Implement better graphics support.
  2. Improve process control capabilities.
  3. Implement disk-encryption support.

senior-project's People

Contributors

jadams41 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.