SecureCells website repository
Other stuff to be added.
SecureCells replaces traditional page tables for storing virtual memory translations and permissions with a unified PTable-GTable. These tables describe the memory Cells, permissions for each SecDiv to these cells, and hold outstanding permissions between grant and receive.
The unified PTable-GTable layout is shown above. This table contains three sections:
The metadata cell describes the table with four parameters. The implementation assumes a cache line size of 64B, but can be amended for any other cache line size. Two parameters relate to the sizing of the tables, limiting the maximum number of cells and SecDivs accomodated by the table. If either limit is exceeded, the table must be resized to accomodate extra cells and SecDivs.
Each cell has a descriptor in the sorted list at the beginning of the table. The 128-bit descriptor holds the following fields.
The virtual address space size matches Intel’s 4-level paging and RISC-V’s SV-48 mode. The physical address space size matches RISC-V’s 56-bit physical address space. Cells are aligned to 4kiB pages, mapping the 48-bit virtual addresses to 56-bit physical addresses. Larger virtual and physical address spaces can be supported, with correspondingly larger cell descriptors. Compression of cell descriptors (incl. naturally aligned powers-of-2 spaces) are possible, but eschewed in favour of flexibility.
Each PTable entry holds three permissions, corresponding to read, write and execute. Each entry is one byte large, with rwx permissions at bits 1, 2 and 3 respectively. Bits 0, 4-7 are reserved for future use. The reserved bits can be later purposed for tracking dirty and accessed cells, similarly to page table entries.
The table reserves T cache lines1 for each SecDiv’s permissions. Permissions for SecDivs are held in linear order of their SDID. To keep the PTable size manageable, SecDivs must be allocated SDIDs linearly.
Clustering permissions for each SecDiv aims to improve spatial locality for MMU accesses to the PTable. Since the same cache line holds permissions for nearby cells, reading permissions for one cell brings in permissions for nearby cells into the cache.
The PTable starts at offset (64T1 * 162) bytes.
The offset of the permission byte PT(SD_cur, cell_i) is ((64T1 * SD_cur) + i) from the beginning of the PTable.
Each GTable entry is 4bytes, holding a target 29-bit SDID and 3-bit permissions.
The GTable starts at offset ((64T1 * 162) + (64T1 * R)) bytes
The offsest of grant entry GT(SD_cur, cell_i) is 43 * ((64T1 * SD_cur) + i) from the beginning of the GTable