summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-04-26 16:38:17 -0400
committerTest_User <hax@andrewyu.org>2023-04-26 16:38:17 -0400
commite0b769ffe69c690bcfa93c53e90340dfc2f77b65 (patch)
treed62dd6e5819cafffdb1e9d48a0335c21623996af
parent868e583b8d8c7dbeb8478202ea38b7de3f64e151 (diff)
downloadspecification-e0b769ffe69c690bcfa93c53e90340dfc2f77b65.tar.gz
specification-e0b769ffe69c690bcfa93c53e90340dfc2f77b65.zip
Put task-related instructions into instructions/, get rid of the term "process" where "task" was meant
-rw-r--r--cpu/exceptions/execution.txt2
-rw-r--r--cpu/instructions/execution_control/irett.txt16
-rw-r--r--cpu/instructions/execution_control/tcall.txt16
-rw-r--r--cpu/instructions/execution_control/tret.txt13
-rw-r--r--cpu/instructions/execution_control/tswitch.txt16
-rw-r--r--cpu/task_switching/execution.txt22
-rw-r--r--cpu/task_switching/tdt.txt4
7 files changed, 75 insertions, 14 deletions
diff --git a/cpu/exceptions/execution.txt b/cpu/exceptions/execution.txt
index 17ca927..89f393f 100644
--- a/cpu/exceptions/execution.txt
+++ b/cpu/exceptions/execution.txt
@@ -15,7 +15,7 @@ For a double exception:
OIPDE is set to the IP from the previous code running
PR is set to all 1s
- Segmentation is ignored for the double exception handler, flat addressing is used with no protection
+ All protection is ignored for the double exception handler, and flat addressing is used
If any exceptions occur during execution of the double exception handler:
If this is not the only core active on the system:
diff --git a/cpu/instructions/execution_control/irett.txt b/cpu/instructions/execution_control/irett.txt
new file mode 100644
index 0000000..0ee81f0
--- /dev/null
+++ b/cpu/instructions/execution_control/irett.txt
@@ -0,0 +1,16 @@
+Number of parameters: 2
+
+Usage:
+ irett <task index> <id>
+
+Effect:
+ See ../../task_switching/execution.txt
+
+Exceptions:
+ `Invalid operation` if not in an exception/interrupt handler
+
+ `Illegal instruction` if used with any other task-related instruction in the same queue
+ Not triggered if conditional and only one was selected to be run
+
+Flags:
+ Zero if id does not match the task at the index or the task at index is not marked as valid
diff --git a/cpu/instructions/execution_control/tcall.txt b/cpu/instructions/execution_control/tcall.txt
new file mode 100644
index 0000000..4e0087f
--- /dev/null
+++ b/cpu/instructions/execution_control/tcall.txt
@@ -0,0 +1,16 @@
+Number of parameters: 2
+
+Usage:
+ tcall <task index> <id>
+
+Effect:
+ See ../../task_switching/execution.txt
+
+Exceptions:
+ `Invalid operation` if not the original task
+
+ `Illegal instruction` if used with any other task-related instruction in the same queue
+ Not triggered if conditional and only one was selected to be run
+
+Flags:
+ Zero if id does not match the task at the index or the task at index is not marked as valid
diff --git a/cpu/instructions/execution_control/tret.txt b/cpu/instructions/execution_control/tret.txt
new file mode 100644
index 0000000..7b2cd9d
--- /dev/null
+++ b/cpu/instructions/execution_control/tret.txt
@@ -0,0 +1,13 @@
+Number of parameters: 0
+
+Usage:
+ tret
+
+Effect:
+ See ../../task_switching/execution.txt
+
+Exceptions:
+ `Invalid operation` if not the original task
+
+ `Illegal instruction` if used with any other task-related instruction in the same queue
+ Not triggered if conditional and only one was selected to be run
diff --git a/cpu/instructions/execution_control/tswitch.txt b/cpu/instructions/execution_control/tswitch.txt
new file mode 100644
index 0000000..82aeefd
--- /dev/null
+++ b/cpu/instructions/execution_control/tswitch.txt
@@ -0,0 +1,16 @@
+Number of parameters: 2
+
+Usage:
+ tswitch <task index> <id>
+
+Effect:
+ See ../../task_switching/execution.txt
+
+Exceptions:
+ `Invalid operation` if not the original task
+
+ `Illegal instruction` if used with any other task-related instruction in the same queue
+ Not triggered if conditional and only one was selected to be run
+
+Flags:
+ Zero if id does not match the task at the index or the task at index is not marked as valid
diff --git a/cpu/task_switching/execution.txt b/cpu/task_switching/execution.txt
index 78f587c..54bb1fe 100644
--- a/cpu/task_switching/execution.txt
+++ b/cpu/task_switching/execution.txt
@@ -4,8 +4,8 @@ All task switches will occur after the current instructions in the queue have fi
TODO: mark current CPU executing it
-Call process:
- Only allowed to be used by the original process
+Call task:
+ Only allowed to be used by the original task
Triggers `invalid operation` exception otherwise
Custom ID must match between the tdt at the index and the one specified by the instruction, and the target must be marked as valid
@@ -14,7 +14,7 @@ Call process:
One segment may be passed to the callee, used by the callee with all segment bits set
Caller may call with all segment bits set to not pass a segment
- Current process id in the tdt will be set to the id of the callee
+ Current task id in the tdt will be set to the id of the callee
Current segments will be saved to the tdt, and those of the callee will be loaded
PR as specified in the callee's tdt for the callable segment will be loaded, and current PR is saved to the tdt
IP of next instruction is saved to tdt
@@ -22,22 +22,22 @@ Call process:
Jumps to <callee's callable segment>, offset 0
-Return process:
+Return task:
Only allowed to be used by the callee
Triggers `invalid operation` exception otherwise
Segments will be loaded from the tdt
- Process id in the tdt is set to the original process's id
+ Task id in the tdt is set to the original task's id
Stack pointers are loaded from the tdt
PR is loaded from the tdt
IP is loaded from the tdt
-Switch process:
- Only allowed to be used by the original process
+Switch task:
+ Only allowed to be used by the original task
Triggers `invalid operation` exception otherwise
- Only allowed to switch to a process that is not currently active
+ Only allowed to switch to a task that is not currently active
Sets the `zero` flag and skips execution of this instruction otherwise
Custom ID must match between the tdt at the index and the one specified by the instruction, and the target must be marked as valid
@@ -47,11 +47,11 @@ Switch process:
Loads all registers from the target's tdt index
-Switch process and exit exception/interrupt handler:
+Switch task and exit exception/interrupt handler:
Only allowed to be used while in an exception/interrupt handler
Triggers `invalid operation` exception otherwise
- Only allowed to switch to a process that is not currently active
+ Only allowed to switch to a task that is not currently active
Sets the `zero` flag and skips execution of this instruction otherwise
Custom ID must match between the tdt at the index and the one specified by the instruction, and the target must be marked as valid
@@ -59,7 +59,7 @@ Switch process and exit exception/interrupt handler:
All registers are saved to the current tdt and loaded from the target's tdt index
IP and PR are saved as if all exception/interrupt handlers returned
- This saving step will be skipped if the entry for the current process is not flagged as valid
+ This saving step will be skipped if the entry for the current task is not flagged as valid
Allows more interrupts to be processed
diff --git a/cpu/task_switching/tdt.txt b/cpu/task_switching/tdt.txt
index d7c7858..8480791 100644
--- a/cpu/task_switching/tdt.txt
+++ b/cpu/task_switching/tdt.txt
@@ -8,11 +8,11 @@ Each entry uses the following format:
+-----------------------------------+----------------------------------------------+
| upper 1/2: number of segments | lower 1/2: pointer to segments |
+-----------------------------------+----------------------------------------------+
- | upper 1/2: callable segment index | lower 1/2: current process being executed as |
+ | upper 1/2: callable segment index | lower 1/2: current task being executed as |
+-----------------------------------+----------------------------------------------+
| PR to be used when called |
+----------------------------------------------------------------------------------+
- | reserved for specifying where it's being executed |
+ | reserved for specifying where it's being executed (TODO) |
+-----------------------------------+---------------------+------------------------+
| upper 1/2: custom id | n bits below: flags | remaining: unused |
+-----------------------------------+---------------------+------------------------+