eXpOS Implementation
Introduction¶
This document discusses the mapping of various eXpOS data structures to the XSM machine's disk and memory. The implementation of eXpOS on XSM discussed in the project modularises the code of system calls into smaller module functions. An interface description of the module functions is given here. The document also outlines the useage of kernel stack of user processes.
Disk Organization¶
Block Number | Contents | Number of Blocks |
---|---|---|
0 - 1 | Bootstrap | 2 |
2 | Disk Free List | 1 |
3 - 4 | Inode + User Table | 2 |
5 | Root File | 1 |
6 | Reserved for future use | 1 |
7 - 8 | Init/Login Code | 2 |
9 - 10 | Shell Code | 2 |
11 - 12 | Idle Code | 2 |
13 - 14 | Library | 2 |
15 - 16 | Exception Handler | 2 |
17 - 18 | Timer Interrupt Routine | 2 |
19 - 20 | Disk Controller Interrupt Routine | 2 |
21 - 22 | Console Interrupt Routine | 2 |
23 - 24 | Interrupt 4 Routine: Create, Delete | 2 |
25 - 26 | Interrupt 5 Routine: Seek, Open, Close | 2 |
27 - 28 | Interrupt 6 Routine: Read | 2 |
29 - 30 | Interrupt 7 Routine: Write | 2 |
31 - 32 | Interrupt 8 Routine: Fork | 2 |
33 - 34 | Interrupt 9 Routine: Exec | 2 |
35 - 36 | Interrupt 10 Routine: Exit | 2 |
37 - 38 | Interrupt 11 Routine: Getpid, Getppid, Wait, Signal | 2 |
39 - 40 | Interrupt 12 Routine: Logout | 2 |
41 - 42 | Interrupt 13 Routine: Semget, Semrelease | 2 |
43 - 44 | Interrupt 14 Routine: SemLock, SemUnLock | 2 |
45 - 46 | Interrupt 15 Routine: Shutdown | 2 |
47 - 48 | Interrupt 16 Routine: Newusr, Remusr, Setpwd, Getuname, Getuid | 2 |
49 - 50 | Interrupt 17 Routine: Login | 2 |
51 - 52 | Interrupt 18 Routine: Test0, Test1, Test2, Test3 | 2 |
53 - 54 | Module 0: Resource Manager | 2 |
55 - 56 | Module 1: Process Manager | 2 |
57 - 58 | Module 2: Memory Manager | 2 |
59 - 60 | Module 3: File Manager | 2 |
61 - 62 | Module 4: Device Manager | 2 |
63 - 64 | Module 5: Context Switch Module (Scheduler Module) | 2 |
65 - 66 | Module 6: Pager Module | 2 |
67 - 68 | Module 7: Boot Module | 2 |
69 - 255 | User Blocks | 187 |
256 - 511 | Swap Area | 256 |
512 - 513 | Secondary Bootstrap | 2 |
514 - 515 | Interrupt 19 Routine: Test4, Test5, Test6, Test8 | 2 |
516 - 517 | Module 8: Access Control Module | 2 |
518 - 519 | Module 9: TestA (Unused) | 2 |
520 - 521 | Module 10: TestB (Unused) | 2 |
522 - 523 | Module 11: TestC (Unused) | 2 |
524 - 527 | Unallocated | 4 |
The Inode table occupies the first 960 words (60 entries each of size 16 words) in the disk blocks 3 and 4. User table occupies the next 32 words (16 entries each of size 2 words) and the last 32 words are reserved for future use.
The Root File occupies the first 480 words of the 5th block and the last 32 words are unallocated.
These disk blocks are available only on eXpOS running on NEXSM (a two-core extension of XSM) machine.
Memory Organization¶
The Memory layout of the XSM machine is as follows :
Page Number | Contents | Word Address | Number of Words |
---|---|---|---|
0 | ROM Code | 0 - 511 | 512 |
1 | Page for loading the BOOT block (OS Startup Code) | 512 - 1023 | 512 |
2 - 3 | Exception Handler | 1024 - 2047 | 1024 |
4 - 5 | Timer Interrupt Routine | 2048 - 3071 | 1024 |
6 - 7 | Disk Controller Interrupt Routine | 3072 - 4095 | 1024 |
8 - 9 | Console Interrupt Routine | 4096 - 5119 | 1024 |
10 - 11 | Interrupt 4 Routine: Create, Delete | 5120 - 6143 | 1024 |
12 - 13 | Interrupt 5 Routine: Seek, Open, Close | 6144 - 7167 | 1024 |
14 - 15 | Interrupt 6 Routine: Read | 7168 - 8191 | 1024 |
16 - 17 | Interrupt 7 Routine: Write | 8192 - 9215 | 1024 |
18 - 19 | Interrupt 8 Routine: Fork | 9216 - 10239 | 1024 |
20 - 21 | Interrupt 9 Routine: Exec | 10240 - 11263 | 1024 |
22 - 23 | Interrupt 10 Routine: Exit | 11264 - 12287 | 1024 |
24 - 25 | Interrupt 11 Routine: Getpid, Getppid, Wait, Signal | 12288 - 13311 | 1024 |
26 - 27 | Interrupt 12 Routine: Logout | 13312 - 14335 | 1024 |
28 - 29 | Interrupt 13 Routine: Semget, Semrelease | 14336 - 15359 | 1024 |
30 - 31 | Interrupt 14 Routine: SemLock, SemUnLock | 15360 - 16383 | 1024 |
32 - 33 | Interrupt 15 Routine: Shutdown | 16384 - 17407 | 1024 |
34 - 35 | Interrupt 16 Routine: Newusr, Remusr, Setpwd, Getuname, Getuid | 17408 - 18431 | 1024 |
36 - 37 | Interrupt 17 Routine: Login | 18432 - 19455 | 1024 |
38 - 39 | Interrupt 18 Routine: Test0, Test1, Test2, Test3 | 19456 - 20479 | 1024 |
40 - 41 | Module 0: Resource Manager | 20480 - 21503 | 1024 |
42 - 43 | Module 1: Process Manager | 21504 - 22527 | 1024 |
44 - 45 | Module 2: Memory Manager | 22528 - 23551 | 1024 |
46 - 47 | Module 3: File Manager | 23552 - 24575 | 1024 |
48 - 49 | Module 4: Device Manager | 24576 - 25599 | 1024 |
50 - 51 | Module 5: Context Switch Module (Scheduler Module) | 25600 - 26623 | 1024 |
52 - 53 | Module 6: Pager Module | 26624 - 27647 | 1024 |
54 - 55 | Module 7: Boot Module | 27648 - 28671 | 1024 |
56 | Process Table | 28672 - 28927 | 256 |
Open File Table | 28928 - 29055 | 128 | |
Semaphore Table | 29056 - 29183 | 128 | |
57 | Memory Free List | 29184 - 29311 | 128 |
File Status Table | 29312 - 29551 | 240 | |
Disk Status Table | 29552 - 29559 | 8 | |
System Status Table | 29560 - 29567 | 8 | |
Terminal Status Table | 29568 - 29575 | 8 | |
Access Lock Table * | 29576 - 29583 | 8 | |
Unallocated | 29584 - 29695 | 112 | |
58 | Page tables | 29696 - 30015 | 320 |
Buffer Table | 30016 - 30031 | 16 | |
Disk Map Table | 30032 - 30191 | 160 | |
Unallocated | 30192 - 30207 | 16 | |
59 - 60 | Memory copy of Inode Table | 30208 - 31167 | 960 |
Memory copy of User Table | 31168 - 31199 | 32 | |
Unallocated | 31200 - 31231 | 32 | |
61 | Memory copy of Disk Free List | 31232 - 31743 | 512 |
62 | Memory copy of Root File | 31744 - 32223 | 480 |
Unallocated | 32224 - 32255 | 32 | |
63 - 64 | Expos Library | 32256 - 33279 | 1024 |
65 - 66 | INIT/Login Program | 33280 - 34303 | 1024 |
67 - 68 | Shell Program | 34304 - 35327 | 1024 |
69 - 70 | Idle Program | 35328 - 36351 | 1024 |
71 - 74 | Buffer (disk cache) | 36352 - 38399 | 2048 |
75 | Reserved for future use (Exam!) | 38400 - 38911 | 512 |
76 - 127 | User Programs | 38912 - 65535 | 26624 |
128 - 129 | Page for loading the Secondary BOOT Block * | 65536 - 66559 | 1024 |
130 - 131 | Interrupt 19 Routine: Test4, Test5, Test6, Test7 * | 66560 - 67583 | 1024 |
132 - 133 | Module 8: Access Control Module * | 67584 - 68607 | 1024 |
134 - 135 | Module 9: TestA (Unused) * | 68608 - 69631 | 1024 |
136 - 137 | Module 10: TestB (Unused) * | 69632 - 70655 | 1024 |
138 - 139 | Module 11: TestC (Unused) * | 70656 - 71679 | 1024 |
140 - 143 | Reserved for future use * | 71680 - 73727 | 2048 |
* These memory pages are available only on eXpOS running on NEXSM (a two-core extension of XSM) machine.
Note
Constants can be found here