Difference between revisions of "PDP-11 stacks"
(ker mode only) |
(11/20 had a fixed limit) |
||
Line 1: | Line 1: | ||
− | Almost all [[PDP-11]] models have some form of [[stack]] | + | Almost all [[PDP-11]] models have some form of [[stack]] overflow protection, which causes a [[Central Processing Unit|CPU]] [[trap]] when the stack overflows. The details of the mechanism vary from model to model; unfortunately, the details are often documented poorly, or not at all. |
+ | |||
+ | ==Fixed Limit== | ||
+ | |||
+ | The first PDP-11 CPU, the [[KA11 CPU]] of the [[PDP-11/20]], had a fixed [[address]] limit of 0400; if the stack went below this, a trap occurred after the offending operation ([[instruction]], trap, and probably also [[interrupt]]) was over. The [[KD11-B CPU]] of the [[PDP-11/05]] did the exact same thing. | ||
==Red/Yellow Zones== | ==Red/Yellow Zones== | ||
− | The | + | The most complex stack overflow protection mechanism first appeared in the [[KB11-A CPU]] of the [[PDP-11/45]]. In [[kernel]] mode, it had a 'two-zone' scheme: the 'Yellow Zone' is a 16-[[word]] grace area, in which operations were allowed, but result in a trap after the operation is completed; in the 'Red Zone', all operations are prohibited, and result in an immediate trap. |
When Red Zone violations occur, the [[Stack Pointer]] is set to 4; the previous [[Program Counter|PC]] and [[Processor Status Word|PS]] are then saved in locations 0 and 2 by the resulting trap. (Odd stack addresses, and use of non-existent memory, result in identical handling.) | When Red Zone violations occur, the [[Stack Pointer]] is set to 4; the previous [[Program Counter|PC]] and [[Processor Status Word|PS]] are then saved in locations 0 and 2 by the resulting trap. (Odd stack addresses, and use of non-existent memory, result in identical handling.) | ||
Line 11: | Line 15: | ||
In [[user]] mode, there is a fixed Stack Overflow Boundary at 0400; attempts to write below that address cause an immediate trap. | In [[user]] mode, there is a fixed Stack Overflow Boundary at 0400; attempts to write below that address cause an immediate trap. | ||
− | The [[KB11-B CPU]] of the [[PDP-11/70]] has exact same mechanism. The [[KD11-A CPU]] of the [[PDP-11/40]] has stack limitation as above, but at a fixed address of 0400; a similar Stack Limit Register is an option, the [[KJ11-A Stack Limit Register]]. When present, it functions identically to the other two. | + | The [[KB11-B CPU]] of the [[PDP-11/70]] has exact same mechanism. The [[KD11-A CPU]] of the [[PDP-11/40]] has two-zone stack limitation as above, but at a fixed address of 0400; a similar Stack Limit Register is an option, the [[KJ11-A Stack Limit Register]]. When present, it functions identically to the other two. |
Revision as of 23:35, 17 June 2020
Almost all PDP-11 models have some form of stack overflow protection, which causes a CPU trap when the stack overflows. The details of the mechanism vary from model to model; unfortunately, the details are often documented poorly, or not at all.
Fixed Limit
The first PDP-11 CPU, the KA11 CPU of the PDP-11/20, had a fixed address limit of 0400; if the stack went below this, a trap occurred after the offending operation (instruction, trap, and probably also interrupt) was over. The KD11-B CPU of the PDP-11/05 did the exact same thing.
Red/Yellow Zones
The most complex stack overflow protection mechanism first appeared in the KB11-A CPU of the PDP-11/45. In kernel mode, it had a 'two-zone' scheme: the 'Yellow Zone' is a 16-word grace area, in which operations were allowed, but result in a trap after the operation is completed; in the 'Red Zone', all operations are prohibited, and result in an immediate trap.
When Red Zone violations occur, the Stack Pointer is set to 4; the previous PC and PS are then saved in locations 0 and 2 by the resulting trap. (Odd stack addresses, and use of non-existent memory, result in identical handling.)
The address of the stack limit can be set with the Stack Limit Register register in the CPU. It is a word register (at 0777774), but the bottom byte is unused; it is cleared by a reset (e.g. when starting the CPU). The Red Zone runs up through the address given there plus 0337; the Yellow Zone starts at 0340, and runs up through 0377.
In user mode, there is a fixed Stack Overflow Boundary at 0400; attempts to write below that address cause an immediate trap.
The KB11-B CPU of the PDP-11/70 has exact same mechanism. The KD11-A CPU of the PDP-11/40 has two-zone stack limitation as above, but at a fixed address of 0400; a similar Stack Limit Register is an option, the KJ11-A Stack Limit Register. When present, it functions identically to the other two.
v • d • e PDP-11 Computers and Peripherals |
---|
UNIBUS PDP-11s - PDP-11/20 • PDP-11/15 • PDP-11/35 • PDP-11/40 • PDP-11/45 • PDP-11/50 • PDP-11/55 • PDP-11/70 PDP-11/05 • PDP-11/10 • PDP-11/04 • PDP-11/34 • PDP-11/60 • PDP-11/44 • PDP-11/24 • PDP-11/84 • PDP-11/94 QBUS PDP-11s - PDP-11/03 • PDP-11/23 • PDP-11/23+ • MicroPDP-11/73 • MicroPDP-11/53 • MicroPDP-11/83 • MicroPDP-11/93 QBUS CPUs: LSI-11 • LSI-11/2 • KDF11-A • KDF11-B • KDJ11-A • KDJ11-B • KDJ11-D • KDJ11-E Buses: UNIBUS • UNIBUS map • SPC • MUD • EUB • QBUS • CD interconnect • PMI Also: PDP-11 architecture • PDP-11 Extended Instruction Set • FP11 floating point • PDP-11 Memory Management |
UNIBUS CPUs: KA11 • KC11 • KB11-A • KB11-B • KB11-C • KB11-D • KD11-A • KD11-B • KD11-D • KD11-E • KD11-EA • KD11-K • KD11-Z • KDF11-U
Co-processors: FP11-A • FP11-B • FP11-C • FP11-E • FP11-F • KE44-A • FPF11 Chips: LSI-11 • KEV11-A • KEV11-B • KEV11-C • F-11 • KEF11-A • KTF11-A • T-11 • J-11 • FPJ11 CPU options: KE11-E • KE11-F • KJ11-A • KT11-C • KT11-D • KK11-A • KK11-B • KT24 • KTJ11-B Rare CPU options: KS11 Memory Protection and Relocation option • KT11-B Paging Option • KUV11 Writeable Control Store Front panels: KY11-A • KY11-D • KY11-J • KY11-LA • KY11-LB • KY11-P More on buses: UNIBUS and QBUS termination • Bus Arbitration on the Unibus and QBUS • CTI BUS PDT-11s - PDT-11/110 • PDT-11/130 • PDT-11/150 CTI PDP-11s - PRO-325 • PRO-350 • PRO-380 Other: FIS floating point • PDP-11 Commercial Instruction Set • PDP-11 stacks • PDP-11 family differences |