add ntfs.sys standalone driver target, change default usb vhd layout formatting to ntfs, implement Fat32CreateDir for directory creation support in the fat32 file system driver, add a dedicated HAL serial output endpoint for COM1 writes in hal_serial.c and subscribe serial to HAL text streams, introduce waitable kernel timers with KeTimerCreate, KeTimerSet, and KeTimerCancel alongside spinlock-protected global timer list initialization and scheduler tick tracking, implement SyscallWriteFileAsync system call for asynchronous non-blocking file writes, refactor NetSocketConnect and NetSocketSendTo to use generic SYS_SOCKET_ADDRESS_K structures instead of being hardcoded to IPv4, update gethostbyname and DNS name resolution to support IPv6 parsing via ResolveNameFamily, update tcpserve.exe with -4 and -6 command-line flags to accept and display IPv6 addresses, append size and version headers to all kernel telemetry and statistics structures including SYS_PMM_STATS, SYS_CPU_STATS, and SYS_SCHEDULER_STATS, update winmm timeGetTime to look up high-resolution hardware frequencies via SysGetTickFrequency, integrate 14 native smoke test applications.

This commit is contained in:
maksw committed 2026-06-26 15:18:48 +02:00
1 parent 2c4a68a75f
commit ed3d065abd
156 files changed
+10509 -2643

No files matched your search

+62 -34
View File
@@ -69,6 +69,38 @@ static void format_ipv4(char* dst, size_t cap, const uint8_t ip[4]) {
append_u8(dst, cap, &off, ip[3]);
}
static void append_hex16(char* dst, size_t cap, size_t* off, uint16_t value) {
static const char hex[] = "0123456789abcdef";
int started = 0;
for (int shift = 12; shift >= 0; shift -= 4) {
unsigned nibble = (value >> shift) & 0xfu;
if (nibble || started || shift == 0) {
append_char(dst, cap, off, hex[nibble]);
started = 1;
}
}
}
// Implements the format ipv6 operation.
static void format_ipv6(char* dst, size_t cap, const uint8_t ip[16]) {
size_t off = 0;
if (!dst || cap == 0) return;
dst[0] = 0;
for (int i = 0; i < 8; ++i) {
uint16_t word = ((uint16_t)ip[i * 2] << 8) | ip[i * 2 + 1];
append_hex16(dst, cap, &off, word);
if (i != 7) append_char(dst, cap, &off, ':');
}
}
// Implements the format socket address operation.
static void format_socket_address(char* dst, size_t cap, const SYS_SOCKET_ADDRESS* address) {
if (!address || address->Family == SYS_AF_INET)
format_ipv4(dst, cap, address ? address->Address : (const uint8_t*)"\0\0\0\0");
else
format_ipv6(dst, cap, address->Address);
}
// Parses u8.
static bool parse_u8(const char** p, uint8_t* out) {
const char* s = *p;
@@ -121,36 +153,39 @@ static void usage(void) {
}
// Implements the resolve host operation.
static uint32_t resolve_host(const char* host, uint8_t ip[4]) {
if (parse_ipv4(host, ip))
return SYS_STATUS_SUCCESS;
static uint32_t resolve_host(const char* host, SYS_SOCKET_ADDRESS* address) {
uint8_t ip[4];
if (parse_ipv4(host, ip)) {
memset(address, 0, sizeof(*address));
address->Size = sizeof(*address);
address->Family = SYS_AF_INET;
memcpy(address->Address, ip, 4);
return STATUS_SUCCESS;
}
SYS_SOCKET_ADDRESS_IPV4 resolved;
size_t resolvedSize = sizeof(resolved);
size_t resolvedSize = sizeof(*address);
SYS_RESOLVE_HOST_REQUEST req;
memset(&resolved, 0, sizeof(resolved));
memset(address, 0, sizeof(*address));
memset(&req, 0, sizeof(req));
req.Name = SysSvFromCstr(host);
req.Family = SYS_AF_INET;
req.AddressOut = &resolved;
req.Family = SYS_AF_INET6;
req.AddressOut = address;
req.AddressSizeInOut = &resolvedSize;
uint32_t st = SysResolveHost(&req);
if (st != SYS_STATUS_SUCCESS)
return st;
if (resolved.Family != SYS_AF_INET)
return SYS_STATUS_NOT_FOUND;
if (st == STATUS_SUCCESS)
return STATUS_SUCCESS;
ip[0] = resolved.Address[0];
ip[1] = resolved.Address[1];
ip[2] = resolved.Address[2];
ip[3] = resolved.Address[3];
return SYS_STATUS_SUCCESS;
resolvedSize = sizeof(*address);
memset(address, 0, sizeof(*address));
req.Family = SYS_AF_INET;
st = SysResolveHost(&req);
return st;
}
// Runs the requested operation.
int main(void) {
uint8_t ip[4] = {10, 0, 2, 2};
SYS_SOCKET_ADDRESS addr;
char host[256];
char path[128];
strcpy(host, "10.0.2.2");
@@ -188,15 +223,15 @@ int main(void) {
}
}
uint32_t st = resolve_host(host, ip);
if (st != SYS_STATUS_SUCCESS) {
uint32_t st = resolve_host(host, &addr);
if (st != STATUS_SUCCESS) {
print("httpget: resolve failed "); print_u64(st); print(" for "); print(host); print("\n");
usage();
SysExitProcess(1);
}
char ipText[16];
format_ipv4(ipText, sizeof(ipText), ip);
char ipText[64];
format_socket_address(ipText, sizeof(ipText), &addr);
print("httpget: GET http://");
print(host);
@@ -206,23 +241,16 @@ int main(void) {
print(")\n");
uint32_t sock = 0;
st = SysCreateSocket(SYS_AF_INET, SYS_SOCK_STREAM, SYS_IPPROTO_TCP, &sock);
if (st != SYS_STATUS_SUCCESS) {
st = SysCreateSocket(addr.Family, SYS_SOCK_STREAM, SYS_IPPROTO_TCP, &sock);
if (st != STATUS_SUCCESS) {
print("httpget: SysCreateSocket failed "); print_u64(st); print("\n");
SysExitProcess(1);
}
SYS_SOCKET_ADDRESS_IPV4 addr;
memset(&addr, 0, sizeof(addr));
addr.Family = SYS_AF_INET;
addr.Port = 80;
addr.Address[0] = ip[0];
addr.Address[1] = ip[1];
addr.Address[2] = ip[2];
addr.Address[3] = ip[3];
st = SysConnectSocket(sock, &addr, sizeof(addr));
if (st != SYS_STATUS_SUCCESS) {
if (st != STATUS_SUCCESS) {
print("httpget: SysConnectSocket failed "); print_u64(st); print("\n");
SysCloseHandle(sock);
SysExitProcess(1);
@@ -241,7 +269,7 @@ int main(void) {
while (totalSent < off) {
size_t sent = 0;
st = SysSendSocket(sock, request + totalSent, off - totalSent, 0, &sent);
if (st != SYS_STATUS_SUCCESS || sent == 0) {
if (st != STATUS_SUCCESS || sent == 0) {
print("httpget: SysSendSocket failed "); print_u64(st); print(" sent="); print_u64(sent); print("\n");
SysCloseHandle(sock);
SysExitProcess(1);
@@ -254,7 +282,7 @@ int main(void) {
for (;;) {
size_t got = 0;
st = SysRecvSocket(sock, buf, sizeof(buf) - 1, 0, &got);
if (st != SYS_STATUS_SUCCESS) {
if (st != STATUS_SUCCESS) {
print("\nhttpget: SysRecvSocket failed "); print_u64(st); print(" after "); print_u64(total); print(" bytes\n");
SysCloseHandle(sock);
SysExitProcess(1);