Neotron-Compute/Neotron-OS

Run applications in User mode?

Closed this issue · 1 comments

The ARMv6-M architecture has the (optional) concept of a Unprivileged Mode, as distinct from a Privileged Mode. This is always included in ARMv7-M systems, and is included in the Cortex-M0+ used in the Raspberry Pi RP2040.

Unprivileged Mode cannot perform some operations:

  • It has limited access to system registers using the MSR and MRS instructions, and cannot use the CPS instruction to mask interrupts.
  • It cannot access the system timer, NVIC, or system control block.
  • It can have access to memory or peripherals restricted.

Should we have a BIOS API for starting an application in Unprivileged Mode? If we did, I believe it would make it easier to recover from a bad application (Privileged Mode has its own stack that the application could not damage). It would, however, make it harder to do tricks like hooking the scan-line interrupt to perform certain video effects (like mid-frame palette shifting).

I thought about this and at this time, I'm thinking that it's better to start applications in Privileged mode.

  1. That's what you get in MS-DOS or CP/M or on a 6502 system.
  2. The point of the system is simplicity and openness. artificially restricting what applications can do goes against that.