This repository has been archived on 2026-07-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2025-04-13 21:48:15 +03:00

22 lines
406 B
C
Executable File

#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;
}