build.bat can create the image if missing, split the shell into native, posix and win32, clean up the build by moving executables into directories, the bootloader is no longer responsible to resolve drivers, fix ResolvePath, every process gets a copy of a module (dll), the child always inherits the cwd, fix function exports in posix, add unlink and exit to posix, add path translator to win32, first bugcheck.

This commit is contained in:
maksw committed 2026-05-13 09:24:16 +02:00
1 parent 0c7f461c6d
commit f80e66ecde
38 files changed
+1620 -462

No files matched your search

+5 -12
View File
@@ -1,20 +1,13 @@
// posix_fd.c - file descriptor table
#include "posix.h"
#include "posix_fd.h"
// yeah
#ifdef errno
#undef errno
#endif
#include <syscall.h>
int errno = 0;
static FD_ENTRY gFdTable[FD_TABLE_PIDS][FD_MAX];
// Syscall stub declarations (from syscall.dll)
extern uint32_t SysGetCurrentPid(void);
void PosixFdInit(void) {
__declspec(dllexport) void PosixFdInit(void) {
uint32_t pid = SysGetCurrentPid();
uint32_t slot = pid % FD_TABLE_PIDS;
@@ -28,7 +21,7 @@ void PosixFdInit(void) {
gFdTable[slot][2] = (FD_ENTRY){ FD_CONSOLE_W, 0, true };
}
int FdAlloc(uint32_t pid, FD_TYPE type, uint32_t khandle) {
__declspec(dllexport) int FdAlloc(uint32_t pid, FD_TYPE type, uint32_t khandle) {
uint32_t slot = pid % FD_TABLE_PIDS;
for (int fd = 3; fd < FD_MAX; fd++) {
if (!gFdTable[slot][fd].Used) {
@@ -40,7 +33,7 @@ int FdAlloc(uint32_t pid, FD_TYPE type, uint32_t khandle) {
return -1;
}
FD_ENTRY* FdGet(uint32_t pid, int fd) {
__declspec(dllexport) FD_ENTRY* FdGet(uint32_t pid, int fd) {
if (fd < 0 || fd >= FD_MAX) { errno = EBADF; return (FD_ENTRY*)0; }
uint32_t slot = pid % FD_TABLE_PIDS;
FD_ENTRY* e = &gFdTable[slot][fd];
@@ -48,7 +41,7 @@ FD_ENTRY* FdGet(uint32_t pid, int fd) {
return e;
}
void FdFree(uint32_t pid, int fd) {
__declspec(dllexport) void FdFree(uint32_t pid, int fd) {
if (fd < 0 || fd >= FD_MAX) return;
uint32_t slot = pid % FD_TABLE_PIDS;
gFdTable[slot][fd] = (FD_ENTRY){ FD_FREE, 0, false };