future reference:
* s23liang: Scheduler bug (minor, reversing some orders), no kernel stack
or context.
* bliu: Scheduler needs more priorities (currently has four). User stacks
live in the kernel stack.
* chfoo: Saving registers before and after SWI. No true kernel stack
(uses brittle bad method). Too few priorities, linear search as well.
* f2fun: Provided little to no documentation at all. There was a single
page. No program output.
* j3you: Saving registers in the wrong place as well (before / after
SWI).
* x4xi: Uses a very brittle kernel data structure methodology. Not
terrible, but not good either.
* aitskovich: Only supports 5 tasks. Task memory inside task descriptors
in the kernel.
* ck2hung: No working context switch.
* J346zhang: Not saving temporary registers etc. Could run out of TIDs.
Linear scheduling (4 priorities).
The most serious issue was with ck2hungâs group, which had no working
context switch. There was a bit of ignoring my post / not reading
documentation (one group is losing unnecessary marks because they simply
didnât include the user program output or explain anything). Another group,
chfooâs, was dumping and loading all registers to the stack in user space,
before and after the SWI call, for seemingly no reason at all.
There were also some unusual bad choices this term (they seem to spread
organically), in addition to the usual types. In particular:
* Linear search scheduling, or having only 3-4 priorities available to
the kernel.
* User stacks that live on the kernel stack.
* Not giving the kernel its own context. Several groups seemed to eschew
memory division entirely and just say âthere is a struct that lives at
a static place, we will always pull items from here and never restore
the kernel stack pointer properlyâ. These same groups also decided that
restoring the kernelâs link register would be onerous and decided to
simply branch to a handler function on kerenter.
* Saving registers in the wrong locations, or not saving registers at all
(r0-r9ish were completely ignored by one particular group).
.
What should happen?
It is impossible to predict when hardware interrupts occur ( = where the PC is)
For the interrupted task,
For the kernel,
Two Link Registers
Base address: 0x80810080
Three registers:
| Offset | Function | R/W | Bits | Comments |
| 0x0 | Timer3Load | R/W | 32: <Load/Reload Value> | |
| 0x4 | Timer3Value | R | 32:<Current value> | Set when Load is written, even when counting |
| 0x8 | Timer3Control | R/W | 3:xxx<CLKSEL>xx<MODE><ENABLE> | <CLKSEL>: 0, 2KHz clock; 1, 508KHz <MODE>: 1, count continuously; 0, count once <ENABLE>: Clock turned on |
| 0xc | Timer3Clear | W | 32: | Writing anything clears the interrupt |
The actual device is the ARM PL190
The logic in this design is completely asynchronous, so it functions when the CPU clock is turned off.
All input signals are
Base addresses
0x800B00000x800C0000VIC powers up with
Initialization
On an interrupt
For debugging
| Register Name | Offset | R/W | Description |
| VICxIRQStatus | 0x00 | RO | One bit for each interrupt source
1 if interrupt is asserted and enabled |
| VICxFIQStatus | 0x04 | RO | As above for FIQ |
| VICxRawIntr | 0x08 | RO | As above but not masked |
| VICxIntSelect | 0x0c | R/W | 0: IRQ, 1: FIQ |
| VICxIntEnable | 0x10 | R/W | 0: Masked, 1: Enabled |
| VICxIntEnClear | 0x14 | WO | Clears bits in VICxIntEnable |
| VICxSoftInt | 0x18 | R/W | Asserts interrupt from software |
| VICxSoftIntClear | 0x1c | WO | Clears interrupt from software |
| VICxProtection | 0x20 | R/W | Bit 0 enables protection from user mode access |
| VICxVectAddr | 0x30 | R/W | Enables priority hardware
See documentation. |
Difference from Software Interrupts
You are now ready to process the interrupt in the kernel
Return to: