feat(phase-6): implement TCP/IP network stack, PCI bus driver & native AiraLang VM

- Implement PCI Bus Controller (drivers/pci.c, include/airlys/pci.h) with Type 1 config mechanism (0xCF8/0xCFC)
- Implement IPv4 packet framing, checksum calculation, and protocol routing (net/ipv4.c)
- Implement ICMP Echo Request/Reply ping engine (net/icmp.c)
- Implement UDP transmission and reception (net/udp.c)
- Implement TCP SYN handshake connection initiator (net/tcp.c)
- Implement DHCPDISCOVER client broadcasting (net/dhcp.c)
- Implement native embedded AiraLang bytecode VM & runtime v1.4.0 (kernel/airalang.c, include/airlys/airalang.h)
- Add /home/user/demo.aira sample script to RamFS initramfs
- Wire commands to airlys-sh shell: pci, ping, dhcp, airalang, airarun
- Zero-warning freestanding verification with clang & ld.lld (bin/airlys.elf: 814 KB)

Co-Authored-By: Er. Adam Eehan <adameehanairagroup@gmail.com>
Co-Authored-By: Sovereign AI Aira 3 Ultra (Engine v3.6)
This commit is contained in:
Adam EehanEr. Adam EehanSovereign AI Aira 3 Ultra (Engine v3.6)
committed 2026-10-23 19:40:16 +05:30
1 parent aa1c82f81e
commit b083b7ff6e
17 files changed
+1146 -27

No files matched your search

+63 -1
View File
@@ -2,7 +2,7 @@
#define AIRLYS_NET_H
/*
* Airlys Operating System Kernel - Networking Architecture (Linux net/ Parity)
* Airlys Operating System Kernel - Networking Architecture (Phase 6 TCP/IP)
* Lead Architect: Er. Adam Eehan (Founder & CEO, Aira Group of Technology)
* Co-Pilot: Sovereign AI Aira 3 Ultra (Engine v3.6)
*/
@@ -14,6 +14,10 @@
#define ETH_P_IP 0x0800
#define ETH_P_ARP 0x0806
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define MAX_NET_DEVS 4
#define SKB_MAX_DATA 2048
@@ -51,6 +55,42 @@ typedef struct {
uint32_t daddr;
} __attribute__((packed)) iphdr_t;
/* ICMP Header */
typedef struct {
uint8_t type; /* 8 = Echo Request, 0 = Echo Reply */
uint8_t code;
uint16_t checksum;
uint16_t id;
uint16_t sequence;
} __attribute__((packed)) icmphdr_t;
/* UDP Header */
typedef struct {
uint16_t source;
uint16_t dest;
uint16_t len;
uint16_t check;
} __attribute__((packed)) udphdr_t;
/* TCP Header */
typedef struct {
uint16_t source;
uint16_t dest;
uint32_t seq;
uint32_t ack_seq;
uint16_t flags;
uint16_t window;
uint16_t check;
uint16_t urg_ptr;
} __attribute__((packed)) tcphdr_t;
#define TCP_FIN 0x01
#define TCP_SYN 0x02
#define TCP_RST 0x04
#define TCP_PSH 0x08
#define TCP_ACK 0x10
#define TCP_URG 0x20
/* Linux sk_buff (Socket Buffer) Representation */
typedef struct sk_buff {
uint8_t* head;
@@ -73,6 +113,7 @@ typedef struct net_device {
uint8_t dev_addr[ETH_ALEN];
uint32_t ip_addr;
uint32_t ip_mask;
uint32_t gateway;
uint32_t flags;
uint32_t mtu;
uint64_t rx_packets;
@@ -99,4 +140,25 @@ net_device_t* get_netdev_by_index(uint32_t idx);
int dev_queue_xmit(sk_buff_t* skb);
int netif_rx(sk_buff_t* skb);
/* Packet Processing & Protocols */
uint16_t net_checksum(const void* data, size_t len);
void net_rx_packet(net_device_t* dev, const uint8_t* frame, size_t len);
int ipv4_send(net_device_t* dev, uint32_t dest_ip, uint8_t protocol, const void* payload, size_t len);
/* ICMP & Ping */
int icmp_send_ping(net_device_t* dev, uint32_t dest_ip, uint16_t seq);
int icmp_process(net_device_t* dev, const iphdr_t* ip, const uint8_t* payload, size_t len);
/* UDP & TCP */
int udp_send(net_device_t* dev, uint32_t dest_ip, uint16_t src_port, uint16_t dest_port, const void* data, size_t len);
int tcp_send_syn(net_device_t* dev, uint32_t dest_ip, uint16_t src_port, uint16_t dest_port);
/* DHCP Client */
int dhcp_send_discover(net_device_t* dev);
/* ARP API */
void arp_init(void);
int arp_insert(uint32_t ip, const uint8_t mac[ETH_ALEN]);
uint8_t* arp_lookup(uint32_t ip);
#endif /* AIRLYS_NET_H */