utility.hh (6378:4a2ff62c3b4f) utility.hh (6383:31c067ae3331)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 52 unchanged lines hidden (view full) ---

61
62bool isNan(void *val_ptr, int size);
63bool isQnan(void *val_ptr, int size);
64bool isSnan(void *val_ptr, int size);
65
66static inline bool
67inUserMode(ThreadContext *tc)
68{
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * Copyright (c) 2007 MIPS Technologies, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 52 unchanged lines hidden (view full) ---

61
62bool isNan(void *val_ptr, int size);
63bool isQnan(void *val_ptr, int size);
64bool isSnan(void *val_ptr, int size);
65
66static inline bool
67inUserMode(ThreadContext *tc)
68{
69 MiscReg Stat = tc->readMiscReg(MipsISA::Status);
70 MiscReg Dbg = tc->readMiscReg(MipsISA::Debug);
69 MiscReg Stat = tc->readMiscReg(MISCREG_STATUS);
70 MiscReg Dbg = tc->readMiscReg(MISCREG_DEBUG);
71
72 if ((Stat & 0x10000006) == 0 && // EXL, ERL or CU0 set, CP0 accessible
73 (Dbg & 0x40000000) == 0 && // DM bit set, CP0 accessible
74 (Stat & 0x00000018) != 0) { // KSU = 0, kernel mode is base mode
75 // Unable to use Status_CU0, etc directly, using bitfields & masks
76 return true;
77 } else {
78 return false;

--- 55 unchanged lines hidden ---
71
72 if ((Stat & 0x10000006) == 0 && // EXL, ERL or CU0 set, CP0 accessible
73 (Dbg & 0x40000000) == 0 && // DM bit set, CP0 accessible
74 (Stat & 0x00000018) != 0) { // KSU = 0, kernel mode is base mode
75 // Unable to use Status_CU0, etc directly, using bitfields & masks
76 return true;
77 } else {
78 return false;

--- 55 unchanged lines hidden ---