Crate morpheus_network

Source
Expand description

MorpheusX Network Stack

ASM-first bare-metal HTTP client for bootloader environments. Designed for post-ExitBootServices execution with no firmware dependencies.

§Architecture (ASM-First)

┌─────────────────────────────────────────────────────────────┐
│                    HTTP Client                              │
│            NativeHttpClient (bare metal TCP/IP)             │
└─────────────────────────────────────────────────────────────┘
                             │
                             ▼
┌─────────────────────────────────────────────────────────────┐
│              NetInterface (smoltcp TCP/IP stack)            │
│  DHCP | TCP sockets | IP routing | ARP                      │
└─────────────────────────────────────────────────────────────┘
                             │
                             ▼
┌─────────────────────────────────────────────────────────────┐
│              NetworkDevice trait                            │
│  Abstraction over hardware: transmit, receive, mac_address │
└─────────────────────────────────────────────────────────────┘
                             │
                             ▼
┌─────────────────────────────────────────────────────────────┐
│              VirtioNetDriver (ASM-backed)                   │
│  Uses hand-written assembly for all hardware access         │
│  - MMIO with explicit barriers                              │
│  - Virtqueue descriptor ring management                     │
│  - Fire-and-forget TX, poll-based RX                        │
└─────────────────────────────────────────────────────────────┘
                             │
                             ▼
┌─────────────────────────────────────────────────────────────┐
│              ASM Layer (network/asm/)                       │
│  Core: TSC, barriers, MMIO, PIO, cache                      │
│  VirtIO: init, queue, TX, RX, notify                        │
└─────────────────────────────────────────────────────────────┘

§Usage (Post-ExitBootServices)

use morpheus_network::{VirtioNetDriver, VirtioConfig, NetworkDriver};
use morpheus_network::boot::BootHandoff;
use morpheus_network::mainloop::bare_metal_main;

// After ExitBootServices, with BootHandoff from pre-EBS setup:
let result = unsafe { bare_metal_main(handoff, config) };

Re-exports§

Modules§

  • Post-EBS Global Allocator
  • ASM bindings module - Thin wrappers over standalone assembly functions.
  • Boot integration module.
  • HTTP client implementation.
  • Network device abstraction for smoltcp integration.
  • DMA buffer management module.
  • Driver abstraction module.
  • Network error types
  • HTTP message handling
  • Main loop module.
  • PCI enumeration and capability access module.
  • smoltcp integration layer.
  • State machine module.
  • Time and timing module.
  • Data transfer handling.
  • Shared data types module.
  • URL parsing and manipulation

Functions§

  • Write a single byte to COM1 serial port (non-blocking with bounded wait)
  • Log debug stage to serial - format: [NET:XX] message
  • Write a string to COM1 serial port
  • Write a u32 as decimal to serial