satp

Supervisor Address Translation and Protection

Controls the translation mode in (H)S-mode and U-mode, and holds the current ASID and page table base pointer.

Attributes

CSR Address

0x180

Defining extension

  • S, version >= 0

Length

64-bit

Privilege Mode

S

Format

satp format
Figure 1. satp format

Field Summary

Name Location Type Reset Value

MODE

63:60

RW-R

UNDEFINED_LEGAL

ASID

59:44

RW-R

UNDEFINED_LEGAL

PPN

43:0

RW-R

UNDEFINED_LEGAL

Fields

MODE

Location

satp[63:60]

Description

Translation Mode

Controls the current translation mode according to the table below.

Value

Name

Description +

0

Bare

No translation → virtual address == physical address

8

Sv39

39-bit virtual address translation

9

Sv48

48-bit virtual address translation

Any other value shall be ignored on a write.

Type

RW-R

Read-Write Restricted

Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, and the field retains its prior state.

Reset value

UNDEFINED_LEGAL

Software write

This field has special behavior when written by software (e.g., through csrrw).

When software tries to write csr_value, the field will be written with the return value of the function below.

if (csr_value.MODE == 0) {
  if (csr_value.ASID == 0 && csr_value.PPN == 0) {
    if (CSR[satp].MODE != 0) {
      VmaOrderType order_type;
      order_type.global = true;
      order_pgtbl_writes_before_vmafence(order_type);
      invalidate_translations(order_type);
      order_pgtbl_reads_after_vmafence(order_type);
    }
    return csr_value.MODE;
  } else {
    return UNDEFINED_LEGAL_DETERMINISTIC;
  }
}

ASID

Location

satp[59:44]

Description

Address Space ID

Type

RW-R

Read-Write Restricted

Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, and the field retains its prior state.

Reset value

UNDEFINED_LEGAL

Software write

This field has special behavior when written by software (e.g., through csrrw).

When software tries to write csr_value, the field will be written with the return value of the function below.

if (csr_value.MODE == 0) {
  if (csr_value.ASID == 0 && csr_value.PPN == 0) {
    return csr_value.ASID;
  } else {
    return UNDEFINED_LEGAL_DETERMINISTIC;
  }
} else {
  XReg shamt = 16;
  XReg all_ones = (0xffff);
  XReg largest_allowed_asid = 0xffff;
  if (csr_value.ASID == all_ones) {
    return largest_allowed_asid;
  } else if (csr_value.ASID > largest_allowed_asid) {
    return UNDEFINED_LEGAL_DETERMINISTIC;
  } else {
    return csr_value.ASID;
  }
}

PPN

Location

satp[43:0]

Description

Physical Page Number

The physical address of the active root page table is PPN << 12.

Can only hold values that correspond to a valid page table base, which will be implementation-dependent.

Type

RW-R

Read-Write Restricted

Field is writable by software. Only certain values are legal. Writing an illegal value into the field is ignored, and the field retains its prior state.

Reset value

UNDEFINED_LEGAL

Software write

This field has special behavior when written by software (e.g., through csrrw).

When software tries to write csr_value, the field will be written with the return value of the function below.

if (csr_value.MODE == 0) {
  if (csr_value.ASID == 0 && csr_value.PPN == 0) {
    return csr_value.PPN;
  } else {
    return UNDEFINED_LEGAL_DETERMINISTIC;
  }
} else {
  return csr_value.PPN;
}