Address

From Ukikipedia
Jump to navigation Jump to search
See 'Memory Address' on Wikipedia

An address is a number that refers to a specific location in memory. There are 3 main types of addresses in SM64: virtual addresses, physical addresses, and segmented addresses.

Virtual addresses

Virtual addresses are addresses that the N64 can dereference directly. The virtual addressing scheme of the N64's VR4300 CPU looks like this:

Virtual addressing scheme of the VR4300 processor in kernel mode
Name Range (inclusive) Info
kuseg 0x00000000-0x7FFFFFFF TLB mapped
kseg0 0x80000000-0x9FFFFFFF Not TLB mapped; cached
kseg1 0xA0000000-0xBFFFFFFF Not TLB mapped; not cached
ksseg 0xC0000000-0xDFFFFFFF TLB mapped
kseg3 0xE0000000-0xFFFFFFFF TLB mapped

Note that this is the addressing scheme of the CPU when in kernel mode, which the N64 is always meant to run in.

kseg0 and kseg1 are mapped directly onto physical address space; for example, the addresses 0x94A73CF0 and 0xB4A73CF0 would both map to the physical address 0x04A73CF0. In effect, the only difference between kseg0 and kseg1 is that kseg1 isn't cached; this is reflected in the fact that kseg1 addresses are used for hardware register reads and other things that the cache might interfere with.

The TLB mapped sections use the TLB to dynamically map virtual addresses to kseg0/kseg1 addresses.

Physical addresses

Physical addresses run from 0x00000000 to 0x1FFFFFFF. The details of the N64's physical memory mapping can be found here.

Segmented addresses

Main page: Segment

Segmented addresses are addresses used to reference segmented data. They consist of the 1-byte segment number, which can range from 0x01 to 0x1F (inclusive), and the 3-byte segment offset. Unlike the TLB, SM64's segmentation system is not a feature of the N64 but is implemented in software.