From d3ed32b989b9be65805290c931739096786b39ce Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 31 Dec 2009 15:30:50 -0500 Subject: MIPS: Create an artificial control register to hold the thread pointer. In Linux, the set_thread_area system call stores the address of the thread local storage area into a field of the current thread_info structure. Later, to access that value, the program uses the rdhwr instruction to read a "hardware register" with index 29. The 64 bit MIPS manual, volume II, says that index 29 is reserved for a future ABI extension and should cause a "Reserved Instruction Exception". In Linux (and potentially other ISAs) that exception is trapped and emulated to return the value stored by set_thread_area as if that were actually stored by a physical register. The tp_value address (as named in the Linux kernel) is ironically stored as a control register so that it goes with a particular ThreadContext. Syscall emulation will use that to emulate storing to the OS's thread info structure, and rdhwr will emulate faulting and returning that value from software by returning the value itself, as if it was in hardware. In other words, we fake faking the register in SE mode. In an FS mode implementation it should work as specified in the manual. --- src/arch/mips/registers.hh | 1 + 1 file changed, 1 insertion(+) (limited to 'src/arch/mips/registers.hh') diff --git a/src/arch/mips/registers.hh b/src/arch/mips/registers.hh index fdb04b131..5cf76634d 100644 --- a/src/arch/mips/registers.hh +++ b/src/arch/mips/registers.hh @@ -275,6 +275,7 @@ enum MiscRegIndex{ MISCREG_DESAVE = 248, //Bank 31: 248-256 MISCREG_LLFLAG = 257, + MISCREG_TP_VALUE, MISCREG_NUMREGS }; -- cgit v1.2.3