A method, system, and program key-controlled object-based memory
protection are provided. A processing unit includes an authority check
for controlling access by the processing unit to pages of memory
according to whether a hardware protection key set currently loaded in an
authority mask register allows access to the pages. In particular, each
page of memory is assigned a page key number that indexes into the
hardware protection key set. The currently loaded hardware protection key
set specifies those page key numbers that are currently accessible to the
processing unit for the execution context. Each hardware key within the
hardware protection key set may be associated with a particular data
object or group of data objects. Thus, effectively, the currently loaded
hardware protection key set identifies which data objects or groups of
data objects are currently accessible. Software keys are assigned to data
objects and dynamically mapped to hardware protection key sets, such that
when a module is called, the software keys assigned to that module are
mapped to the hardware protection key set to be loaded for controlling
current access to memory.