Aurelien Jarno wrote: > Hi, > > The patch below makes a few improvement to the code translation, and fixes > a small bug: > > - The check for the bit ERL in CP0 Status register implies that the CPU > is in kernel mode, so there is no need to further check for user mode.
Applied. > - Checking for the bit UM in CP0 Status register is not enough to detect > the user mode, the patch below changes that to a check for > MIPS_HFLAG_UM in hflags. Applied. > - Currently checking if CP0 is accessible, ie either the CPU is in kernel > mode or the bit CU0 in CP0 Status register enabled, is done in the > translated code. The patch below moves the check for user mode at > translation time to improve a bit the execution time. It also saves a > call to save_cpu_state() if the CPU is in kernel mode. A few CP0 > instructions then needs to explicitely save the cpu state, as they > are modifying hflags. This part breaks my standard Linux boot test. In general the idea is sound, though. Thiemo