| 981 | } |
| 982 | #ifdef CPU_CNMIPS |
| 983 | else if (cop == 2) { |
| 984 | addr = trapframe->pc; |
| 985 | if ((td->td_md.md_flags & MDTD_COP2USED) && |
| 986 | (td->td_md.md_cop2owner == COP2_OWNER_KERNEL)) { |
| 987 | if (td->td_md.md_cop2) |
| 988 | octeon_cop2_save(td->td_md.md_cop2); |
| 989 | else |
| 990 | panic("COP2 was used in kernel mode but md_cop2 is NULL"); |
| 991 | } |
| 992 | |
| 993 | if (td->td_md.md_ucop2 == NULL) { |
| 994 | td->td_md.md_ucop2 = octeon_cop2_alloc_ctx(); |
| 995 | if (td->td_md.md_ucop2 == NULL) |
| 996 | panic("Failed to allocate userland COP2 context"); |
| 997 | memset(td->td_md.md_ucop2, 0, sizeof(*td->td_md.md_ucop2)); |
| 998 | } |
| 999 | |
| 1000 | octeon_cop2_restore(td->td_md.md_ucop2); |
| 1001 | |
| 1002 | td->td_frame->sr |= MIPS_SR_COP_2_BIT; |
| 1003 | td->td_md.md_flags |= MDTD_COP2USED; |
| 1004 | td->td_md.md_cop2owner = COP2_OWNER_USERLAND; |
| 1005 | goto out; |
| 1006 | } |
| 1007 | #endif |
| 1008 | else { |
| 1009 | log_illegal_instruction("COPn_UNUSABLE", trapframe); |
nothing calls this directly
no test coverage detected