frno7 / linux

Linux 2.2, 2.6, 3.x, 4.x and 5.x kernels for the PlayStation 2.
Other
84 stars 5 forks source link

Install final length of TLB refill handler rather than 256 bytes #6

Open frno7 opened 5 years ago

frno7 commented 5 years ago

The R5900 TLB refill handler is limited to 128 bytes, corresponding to 32 instructions. Commit eaccf2f32090df98f70b47edf07d15a82792e428 is a provisional fix. Commit 8ff93271c3507155222567cc66e137234d419e78 verifies that the R5900 TLB refill handler does not overflow.

Installing a 256 byte TLB refill handler for the R5900 at address 0x80000000 overwrites the performance counter (see #26) handler at address 0x80000080, according to the TX79 manual, p. 5-7:

Table 5-2. Exception Vectors for Level 1 exceptions

Exceptions Vector Address
BEV = 0 BEV = 1
TLB Refill (EXL = 0)0x8000 00000xBFC0 0200
TLB Refill (EXL = 1)0x8000 01800xBFC0 0380
Interrupt 0x8000 02000xBFC0 0400
Others 0x8000 01800xBFC0 0380

Table 5-3. Exception Vectors for Level 2 exceptions

Exceptions Vector Address
DEV = 0 DEV = 1
Reset, NMI 0xBFC0 00000xBFC0 0000
Performance Counter 0x8000 00800xBFC0 0280
Debug, SIO 0x8000 01000xBFC0 0300
frno7 commented 5 years ago

A patch was posted to the mailing list for Linux on MIPS. The proposal is to fold it into #1.