20.8 CSERVE and SRM Console Integration

<< Click to Display Table of Contents >>

Navigation:  ASA-EMulatR Reference Guide > Introduction > Architecture Overview > Chapter 20 – Boot Sequence, PAL, and SRM Integration >

20.8 CSERVE and SRM Console Integration

20.8.1 CSERVE Architecture

 

CALL_PAL CSERVE (function 0x09) is the only officially supported I/O interface used by the SRM console prior to OS boot. SRM never performs direct MMIO to serial devices — all console I/O flows through CSERVE. In EmulatR, CSERVE is the contract boundary between PAL firmware logic and the Console/OPA0 device layer.

 

CSERVE rules: only legal in PAL mode, serializes the pipeline, must not speculate, must not fault, must not block indefinitely, must be re-entrant, returns results in integer registers, does not modify FP state, does not raise exceptions. CSERVE does not exit PAL mode — only HW_REI exits PAL. Unknown selectors return R0 = -1. Invalid pointers return R0 = -1. SRM expects robust permissiveness, not strict faulting.

 

Register convention: R16 = CSERVE selector, R17 = argument 0, R18 = argument 1, R19 = argument 2, R0 = return value. Unused registers are preserved.

 


 

20.8.2 CSERVE Selector Table

 

Selector

Mnemonic

Required

Action

0x01

PUTC

Yes

Output single character (R17 low 8 bits) to OPA0. Returns R0 = 1.

0x02

GETC

Yes

Read single character from console. Returns R0 = character (0–255) or -1 if none.

0x03

PUTS

Yes

Output NUL-terminated string from guest memory (R17 = VA). Returns R0 = char count.

0x07

POLL

Yes

Check input availability. Returns R0 = 1 if ready, 0 otherwise. Must not block.

0x0A

GETENV

Yes

Read SRM environment variable (R17 = VA of name). Returns R0 = VA of value or 0.

0x0B

SETENV

Yes

Write SRM environment variable (R17 = name VA, R18 = value VA). Returns R0 = 1.

0x04

GETS

Optional

Read string into buffer. Stub acceptable.

0x05

SETMODE

Optional

Set console mode. No-op acceptable.

0x06

FLUSH

Optional

Flush output. No-op acceptable.

0x0F

VERSION

Optional

Return firmware version string.

 

Minimum required for SRM >>> prompt: PUTC, PUTS, GETC, POLL, GETENV, SETENV. Everything else may safely stub.

 


 

20.8.3 Component Mapping

 

PalService::executeCSERVE() dispatches by selector. ConsoleManager handles device routing. ConsoleOPA0Device provides character I/O. SRMEnvStore provides environment variable persistence. AlphaPipeline enforces serialization.

 

See Also: Chapter 16 – Device Model & DMA (ConsoleOPA0Device).