init commit

This commit is contained in:
2025-04-13 21:48:15 +03:00
commit 23255e9121
192 changed files with 12200 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#include <unistd.h>
typedef struct segment
{
unsigned int base;
unsigned int size;
} segment;
// 8-ми сегментная
unsigned int
VirtIntoPhys(segment *segTable, unsigned int VirtAdr)
{
unsigned int SegNum = VirtAdr >> 29;
unsigned int offset = (VirtAdr << 3) >> 3;
if (offset > segTable[SegNum].size) {
_exit(25);
}
return segTable[SegNum].base + offset;
}