Circuitry and methods for implementing capabilities using narrow registers
Systems, methods, and apparatuses for implementing capabilities using narrow registers are described. In certain examples, a hardware processor core comprises a capability management circuit to check a capability for a memory access request, the capability comprising an address field, a validity field, and a bounds field that is to indicate a lower bound and an upper bound of an address space to which the capability authorizes access; a decoder circuit to decode a single instruction into a decoded single instruction, the single instruction comprising fields to indicate a memory address that stores the capability and a single destination register, and an opcode to indicate that an execution circuit is to load a first proper subset of the capability from the memory address into the single destination register and load a second proper subset of the capability from the memory address into an implicit second destination register; and the execution circuit to execute the decoded single instruction according to the opcode.
1 . An apparatus comprising:
a decoder circuit to decode a single instruction into a decoded single instruction, the single instruction comprising fields to indicate a memory address that stores a capability comprising an address field, a validity field, and a bounds field that is to indicate a lower bound and an upper bound of an address space to which the capability authorizes access, a single destination register, and an opcode to indicate that an execution circuit is to load a first proper subset of the address field and the bounds field of the capability from the memory address into the single destination register, load a second proper subset of the address field and the bounds field of the capability from the memory address into an implicit second destination register, and load a value of the validity field from the memory address into an implicit third destination register;
the execution circuit to execute the decoded single instruction according to the opcode; and
a capability management circuit to check the capability in the single destination register and the implicit second destination register for a memory access request.
2 . The apparatus of claim 1 , wherein the value of the validity field is loaded into a first proper subset of the implicit third destination register;
the decoder circuit is to decode a second single instruction into a decoded second single instruction, the second single instruction comprising fields to indicate a second memory address that stores a second capability and a fourth single destination register, and an opcode to indicate that the execution circuit is to load a first proper subset of an address field and a bounds field of the second capability from the second memory address into the fourth single destination register, a second proper subset of the address field and the bounds field of the second capability from the second memory address into an implicit fifth destination register, and a value of the validity field from the second memory address into a second proper subset of the implicit third destination register; and
the execution circuit to execute the decoded second single instruction according to its opcode.
3 . The apparatus of claim 1 , wherein the capability management circuit is to clear a value of the validity field loaded into the implicit third destination register in response to detection of a write to either of the single destination register and the implicit second destination register by a non-capability instruction.
4 . The apparatus of claim 1 , wherein the capability comprises a permission field that is to indicate how the capability is permitted to be used.
5 . The apparatus of claim 1 , wherein the capability comprises an object type field that is to indicate an object type of the capability.
6 . The apparatus of claim 1 , wherein the opcode is to indicate that the execution circuit is to lock a memory comprising the memory address until the loads of both the first proper subset of the capability from the memory address into the single destination register, and the second proper subset of the capability from the memory address into the implicit second destination register are complete.
7 . The apparatus of claim 1 , wherein:
the decoder circuit is to decode a second single instruction into a decoded second single instruction, the second single instruction comprising fields to indicate a second memory address to store a second capability and a single source register, and an opcode to indicate that the execution circuit is to store a first proper subset of an address field and a bounds field of the second capability from the single source register to the second memory address and a second proper subset of the address field and the bounds field of the second capability from an implicit second source register to the second memory address; and
the execution circuit to execute the decoded second single instruction according to its opcode.
8 . A method comprising:
decoding, by a decoder circuit of a processor core, a single instruction into a decoded single instruction, the single instruction comprising fields to indicate a memory address that stores a capability comprising an address field, a validity field, and a bounds field that is to indicate a lower bound and an upper bound of an address space to which the capability authorizes access, a single destination register, and an opcode to indicate that an execution circuit of the processor core is to load a first proper subset of the address field and the bounds field of the capability from the memory address into the single destination register and load a second proper subset of the address field and the bounds field of the capability from the memory address into an implicit second destination register;
executing, by the execution circuit, the decoded single instruction according to the opcode;
checking, by a capability management circuit of the processor core, the capability in the single destination register and the implicit second destination register for a memory access request;
decoding, by the decoder circuit, a second single instruction into a decoded second single instruction, the second single instruction comprising fields to indicate a second memory address to store a second capability and a single source register, and an opcode to indicate that the execution circuit is to store a first proper subset of an address field and a bounds field of the second capability from the single source register to the second memory address and a second proper subset of the address field and the bounds field of the second capability from an implicit second source register to the second memory address; and
executing, by the execution circuit, the decoded second single instruction according to its opcode.
9 . The method of claim 8 , wherein the opcode is to further indicate that the execution circuit is to load a value of the validity field from the memory address into an implicit third destination register.
10 . The method of claim 9 , wherein the value of the validity field is loaded into a first proper subset of the implicit third destination register, and further comprising:
decoding, by the decoder circuit, a second single instruction into a decoded second single instruction, the second single instruction comprising fields to indicate a second memory address that stores a second capability and a fourth single destination register, and an opcode to indicate that the execution circuit is to load a first proper subset of an address field and a bounds field of the second capability from the second memory address into the fourth single destination register, a second proper subset of the address field and the bounds field of the second capability from the second memory address into an implicit fifth destination register, and a value of the validity field from the second memory address into a second proper subset of the implicit third destination register; and
executing, by the execution circuit, the decoded second single instruction according to its opcode.
11 . The method of claim 9 , further comprising clearing, by the capability management circuit, a value of the validity field loaded into the implicit third destination register in response to detecting a write to either of the single destination register and the implicit second destination register by a non-capability instruction.
12 . The method of claim 8 , wherein the capability comprises a permission field that is to indicate how the capability is permitted to be used.
13 . The method of claim 8 , wherein the capability comprises an object type field that is to indicate an object type of the capability.
14 . The method of claim 8 , wherein the opcode is to indicate that the execution circuit is to lock a memory comprising the memory address until the loads of both the first proper subset of the capability from the memory address into the single destination register, and the second proper subset of the capability from the memory address into the implicit second destination register are complete.
15 . A non-transitory machine readable medium that stores code that when executed by a machine causes the machine to perform a method comprising:
decoding, by a decoder circuit of a processor core, a single instruction into a decoded single instruction, the single instruction comprising fields to indicate a memory address that stores a capability comprising an address field, a validity field, and a bounds field that is to indicate a lower bound and an upper bound of an address space to which the capability authorizes access, a single destination register, and an opcode to indicate that an execution circuit of the processor core is to load a first proper subset of the address field and the bounds field of the capability from the memory address into the single destination register, load a second proper subset of the address field and the bounds field of the capability from the memory address into an implicit second destination register, and load a value of the validity field from the memory address into an implicit third destination register;
executing, by the execution circuit, the decoded single instruction according to the opcode; and
checking, by a capability management circuit of the processor core, the capability in the single destination register and the implicit second destination register for a memory access request.
16 . The non-transitory machine readable medium of claim 15 , wherein the value of the validity field is loaded into a first proper subset of the implicit third destination register, and the method further comprises:
decoding, by the decoder circuit, a second single instruction into a decoded second single instruction, the second single instruction comprising fields to indicate a second memory address that stores a second capability and a fourth single destination register, and an opcode to indicate that the execution circuit is to load a first proper subset of an address field and a bounds field of the second capability from the second memory address into the fourth single destination register, a second proper subset of the address field and the bounds field of the second capability from the second memory address into an implicit fifth destination register, and a value of the validity field from the second memory address into a second proper subset of the implicit third destination register; and
executing, by the execution circuit, the decoded second single instruction according to its opcode.
17 . The non-transitory machine readable medium of claim 15 , wherein the method further comprises clearing, by the capability management circuit, a value of the validity field loaded into the implicit third destination register in response to detecting a write to either of the single destination register and the implicit second destination register by a non-capability instruction.
18 . The non-transitory machine readable medium of claim 15 , wherein the capability comprises a permission field that is to indicate how the capability is permitted to be used.
19 . The non-transitory machine readable medium of claim 15 , wherein the capability comprises an object type field that is to indicate an object type of the capability.
20 . The non-transitory machine readable medium of claim 15 , wherein the opcode is to indicate that the execution circuit is to lock a memory comprising the memory address until the loads of both the first proper subset of the capability from the memory address into the single destination register, and the second proper subset of the capability from the memory address into the implicit second destination register are complete.
21 . The non-transitory machine readable medium of claim 15 , wherein the method further comprises:
decoding, by the decoder circuit, a second single instruction into a decoded second single instruction, the second single instruction comprising fields to indicate a second memory address to store a second capability and a single source register, and an opcode to indicate that the execution circuit is to store a first proper subset of an address field and a bounds field of the second capability from the single source register to the second memory address and a second proper subset of the address field and the bounds field of the second capability from an implicit second source register to the second memory address; and
executing, by the execution circuit, the decoded second single instruction according to its opcode.