RISCOS.com

www.riscos.com Technical Support:
Programmer's Reference Manual

 

Filing system locking and resets


Introduction and Overview

The FSLock module (added in RISC OS 3.5) provides protection against inadvertent or malicious changing of the CMOS RAM and hard disc contents. To do this it intercepts the calls that update the contents of the hard disc and CMOS RAM, and returns an error instead.

The Reset behaviour has been further changed in two ways. Firstly, it has been simplified both to reduce the confusing range of options that were available in earlier versions of RISC OS and to ensure a reset always really starts the machine afresh. Secondly, a link can be set on the machine's circuit board to prevent resetting the CMOS RAM by a Delete power-on or similar combination.

Technical Details

Changes to power-on and reset

Hardware CMOS protection

Earlier versions of RISC OS allowed users to reset some or all of CMOS RAM by holding down various keys whilst the machine was powered on. However, any resultant accidental or deliberate alteration of CMOS RAM could be a nuisance in some environments. To counteract this, RISC OS 3.5 has added support for a CMOS protection connector inside the machine.

With the connector in the protected position, the CMOS RAM cannot be cleared as a part of a power-on or reset sequence, no matter what keys are held down. With it in the unprotected position, CMOS RAM clearing works just as in earlier versions of RISC OS.

New reset behaviour

The power-on and reset combinations for RISC OS 3.5 have been changed to rationalise a previously confusing set of options.

Under earlier versions of RISC OS a reset had many variations depending on whether it was a power-on reset, ordinary reset or break style reset, whether *FX200,2 had been done before the reset, and so on. To most users this degree of flexibility was never useful simply because it was so complex.

Under RISC OS 3.5 the hardware generates the same type of reset at power-on and when the reset button is pressed. Both are now effectively hard resets; the previous concept of hard and soft resets is no more. In both cases RISC OS 3.5 goes through the full sequence of reset operations. It:

  • Performs a self test
  • Clears RAM
  • Checks the keyboard for CMOS RAM clearing
  • Initialises the OS.

You can still use the Break key as part of a reset combination (see below). This performs a partial reset that omits the self test and CMOS RAM clearing.

The following scheme is now used.

Key combination Function
Power-on Normal reset, use boot options
Ctrl-break Partial reset (no self-test or CMOS RAM reset),
use boot options
Reset Normal reset, use boot options

The following modifiers can be used in conjunction with the above resets to change the boot behaviour:

Modifier Function
Shift Reverse action of configured boot option
* (on keypad) Use boot options, but boot to command line
instead of the configured language

For backward compatibility, pressing Shift-Break causes the same action as Shift-Ctrl-Break.

The following modifiers can be used to reset some or all of CMOS RAM, provided the CMOS protection connector is in the unprotected position:

Modifier Function
Delete Reset CMOS RAM
R Partially reset CMOS RAM
Copy As Delete, but configures separate sync
T As R, but configures separate sync
0 to 9 (on keypad) Configures monitor type
. (on keypad) Configure auto monitor type, sync and mode

The FSLock Module

The FSLock module protects the CMOS RAM and hard disc against unwanted modification. It does so by intercepting any SWIs that alter the hard disc contents or CMOS RAM, and returning an error instead.

FSLock cannot protect all discs on all filing systems; it can only protect drives 4 - 7 on any one filing system. By default, the Configure application sets FSLock to protect the ADFS hard discs 4-7.

Of course, a machine which allows no hard disc updates is not very useful, so two areas of a protected disc have been left unprotected:

  • $.Public can be used for general file storage; it cannot be created while the computer is in a locked state.
  • $.!Boot.Resources.!Scrap.ScrapDir is writable to allow Scrap transfers of files between applications.
Lock states

FSLock operates in three states:

Fully unlocked

A fully unlocked machine has no password allocated to it, and can have its hard discs or configuration modified. This state persists over any sort of reset, and is the default selected after the CMOS RAM has been successfully cleared.

Partially unlocked

A partially unlocked machine has a password allocated to it, but can still have its hard discs and configuration modified. If reset the machine reverts to being locked.

Locked

A locked machine has a password allocated to it, and cannot have its hard discs or configuration modified. The machine stays in this state if it is reset.

Lock status

The lock states are passed to commands using a lock status:

Status Meaning
0 Fully unlocked
1 Partially unlocked
2 Locked
Permitted passwords

The password is case sensitive. The Configure application restricts the password to at least five non-space characters that are acceptable in a writable icon. Although the SWIs will accept any null terminated string, we strongly recommend you stay within the restrictions imposed by the Configure application's interface, otherwise users may find the machine locked with an untypable password.

Changes to existing SWIs

OS_Byte 253

Under RISC OS 3.5 and later this call will always read the last type of reset as a power-on reset (R1 = 1 on exit).

SWI calls


FSLock_Version
(SWI &44780)

Returns information describing the FSLock module

On entry

--

On exit

R0 = version number × 100
R1 = pointer to module's workspace

Interrupts

Interrupt status is not altered
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is re-entrant

Use

This call returns information describing the FSLock module. R0 gives the module's version number, and R1 gives a pointer to the module's workspace.

This call is available from RISC OS 3.5 onwards.

Related SWIs

None

Related vectors

None


FSLock_Status
(SWI &44781)

Returns the current lock status, and the locked filing system's number

On entry

--

On exit

R0 = Lock status
R1 = locked filing system number (undefined if lock status = 0)

Interrupts

Interrupt status is not altered
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

This call returns the current lock status, and the locked filing system's number.

This SWI can only be called by number; not by name.

This call is available from RISC OS 3.5 onwards.

Related SWIs

None

Related vectors

None


FSLock_ChangeStatus
(SWI &44782)

Changes one or more of the lock status, the password and the locked filing system

On entry

R0 = new Lock status
R1 = pointer to current file locking password
R2 = pointer to new file locking password
R3 = new locked filing system number

On exit

R0 - R3 preserved

Interrupts

Interrupts are enabled
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

This call changes one or more of the lock status, the password and the locked filing system. The new lock status must always be passed in R0; other parameters may be required depending on its value, and the current lock status:

Current lock status
0 1 2
New lock status 0 - R1 R1
1 R2, R3 R1, R2, R3 R1
2 R2, R3 - R1, R2, R3

If the old password is needed and not given correctly an error will be returned. If a filing system number is needed then a check will be made for that filing system's existence.

This SWI can only be called by number; not by name.

This call is available from RISC OS 3.5 onwards.

Related SWIs

None

Related vectors

None

* Commands


*FSLock_ChangePassword

Changes the locked filing system and password

Syntax

*FSLock_ChangePassword fs_name [new_password [new_password [old_password]]]

Parameters

fs_name - a filing system name

new_password - new file locking password

old_password - current file locking password

Use

*FSLock_ChangePassword changes the locked filing system and password. If the machine was fully unlocked then the old password need not be given. If any of the passwords aren't given then a prompt appears where the password can be entered without it being seen, since each character typed is displayed on the screen as a hyphen ('-').

This command is available from RISC OS 3.5 onwards.

Example

*FSLock_ChangePassword scsifs
New password: ------
New password again: ------
Old password: --------

Related commands

None


*FSLock_Lock

Locks the computer from the partially unlocked state

Syntax

*FSLock_Lock

Use

*FSLock_Lock locks the machine from the partially unlocked state.

If the machine is fully unlocked or locked then an error message is given.

This command is available from RISC OS 3.5 onwards.

Related commands

None


*FSLock_Status

Displays the machine's current lock state

Syntax

FSLock_Status

Use

*FSLock_Status displays the machine's current lock state.

This command is available from RISC OS 3.5 onwards.

Example

*FSLock_Status
No filing system is currently locked

Related commands

None


*FSLock_Unlock

Unlocks the computer

Syntax

*FSLock_Unlock [-full] [password]

Parameters

password - current file locking password

Use

*FSLock_Unlock unlocks the computer.

If the -full switch is given then the machine will be fully unlocked, otherwise a partial unlock will be done. If the password isn't given then a prompt appears where the password can be entered without it being seen, since each character typed is displayed on the screen as a hyphen ('-').

If the machine is already in the required state (partially or fully unlocked) then an appropriate error will be given.

This command is available from RISC OS 3.5 onwards.

Example

*FSLock_Unlock -full gOL9pGbH

Related commands

None

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015