fix(baremetal,net): fix bare-metal boot freezes and implement real internet stack

- Zero user PML4 and allocated page tables in VMM to prevent dirty RAM crash on real hardware
- Probe UART existence and add timeout to prevent infinite freeze on motherboards without COM1
- Clamp SMP AP boot to MAX_CPUS to prevent GDT/TSS corruption on multi-core CPUs
- Add kernel early framebuffer console (FbConsole) with 8x16 font for direct HDMI/DP screen output
- Configure Limine resolution and dynamic 4K draw buffers in gui_server to fix 1080p black screen
- Implement RFC 793 TCP pseudo-header checksum and full TCP 3-way handshake
- Implement DHCP client (UDP 67/68) and DNS client (UDP 53)
- Add dns, dhcp commands to shell and update web browser with live URL loading
This commit is contained in:
RarDog
2026-09-03 10:40:23 +03:00
parent ca75e961f9
commit de772a2de0
12 changed files with 863 additions and 174 deletions
+22 -1
View File
@@ -69,6 +69,22 @@ typedef struct {
uint16_t urgent_ptr;
} tcp_hdr_t;
typedef struct {
uint16_t src_port;
uint16_t dst_port;
uint16_t length;
uint16_t checksum;
} udp_hdr_t;
typedef struct {
uint16_t id;
uint16_t flags;
uint16_t qdcount;
uint16_t ancount;
uint16_t nscount;
uint16_t arcount;
} dns_hdr_t;
#define TCP_FLAG_FIN 0x01
#define TCP_FLAG_SYN 0x02
#define TCP_FLAG_RST 0x04
@@ -82,6 +98,7 @@ typedef struct {
uint32_t ip;
uint32_t netmask;
uint32_t gateway;
uint32_t dns_server;
uint8_t mac[6];
} net_config_t;
@@ -90,10 +107,14 @@ extern net_config_t g_net_cfg;
// Net API
void net_init(void);
uint16_t net_checksum(const void *buf, size_t len);
uint16_t net_tcp_checksum(uint32_t src_ip, uint32_t dst_ip, const tcp_hdr_t *tcp, size_t tcp_len);
int net_send_arp_request(uint32_t target_ip);
int net_send_icmp_ping(uint32_t target_ip, uint16_t seq);
int net_poll_icmp_reply(uint32_t *from_ip, uint16_t *seq);
int net_http_get(uint32_t target_ip, uint16_t port, const char *path, char *out_body, size_t max_body_len);
int net_dns_resolve(const char *domain, uint32_t *out_ip);
int net_dhcp_discover(void);
int net_http_get(uint32_t target_ip, uint16_t port, const char *path, const char *host_header, char *out_body, size_t max_body_len);
int net_http_get_url(const char *url, char *out_body, size_t max_body_len);
uint32_t parse_ip(const char *str);
void format_ip(uint32_t ip, char *buf);