Each Virtual address in the TLB entry (entryhi) has a pair of physical address: the entrylo0 (the even entry) and entrylo1 (the odd entry).
To add a new TLB:
1) get a new entry in the table for your virtual address (read_c0_index())
2) set the virtual address (write_c0_entryhi())
3) set the physical address even and odd entry (write_c0_entrylo0(), write_c0_entrylo1())
4) once the registers are all set, flush the entry (tlb_write_indexed())
Each entry has to be unique.
The hazard barrier instruction must be used to ensure that the processor state doesn't change during the creation of the new entry in the TLB (mtc0_tlbw_hazard()).
Which part you don't
Which part you don't understand?
Each Virtual address in the TLB entry (entryhi) has a pair of physical address: the entrylo0 (the even entry) and entrylo1 (the odd entry).
To add a new TLB:
1) get a new entry in the table for your virtual address (read_c0_index())
2) set the virtual address (write_c0_entryhi())
3) set the physical address even and odd entry (write_c0_entrylo0(), write_c0_entrylo1())
4) once the registers are all set, flush the entry (tlb_write_indexed())
Each entry has to be unique.
The hazard barrier instruction must be used to ensure that the processor state doesn't change during the creation of the new entry in the TLB (mtc0_tlbw_hazard()).
Hope this will help,
-Mathieu