MIPS exception number limits?
Hi all,
Wondering why MIPS limits exception number less then 0x100,
you can see such example in function do_raise_exception_err (target-mips/op_helper.c). See below,
static inline void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
...
{
...
#if 1
if (exception < 0x100)
qemu_log("%s: %d %d\n", __func__, exception, error_code);#endif
...
}
Anyone can help confirm this, stated in what spec? Also, do we
need "#if 1 .. #endif"? Thanks for help. =]
Regards,
chenwj
Signature · 5 lines
Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
Quoted 32 lines
-----Original Message-----
From: [email protected] [mailto:qemu-devel- [email protected]] On Behalf Of ??? (Wei-Ren Chen)
Sent: Thursday, November 22, 2012 11:34 AM
To: [email protected]
Subject: [Qemu-devel] MIPS exception number limits?Hi all,
Wondering why MIPS limits exception number less then
0x100,
you can see such example in functiondo_raise_exception_err(target-mips/op_helper.c). See below,static inline void
QEMU_NORETURNdo_raise_exception_err(CPUMIPSState *env,...{
...#if 1 if (exception < 0x100) qemu_log("%s: %d %d\n", __func__, exception, error_code);#endif
...
}Anyone can help confirm this, stated in what spec? Also, do we
need "#if 1 .. #endif"? Thanks for help. =]Regards,
chenwj
Quoted 6 lines
--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj
The 0x100 is an arbitrary value known to be larger than the maximum possible CP0.Cause.ExcCode value.
From target-mips/cpu.h:
/* Dummy exception for conditional stores. */
#define EXCP_SC 0x100
From target-mips/translate.c:
gen_helper_0e0i(raise_exception, EXCP_SC); \
It can be seen the only use of EXCP_SC is for the macro OP_ST_ATOMIC when CONFIG_USER_ONLY is defined.
So basically the SC and SCD instructions for user-mode QEMU are implemented with a "dummy" exception. Since it is not a real exception, it is not reported in the QEMU log file as an exception.
-Eric
Quoted 1 line · Eric
So basically the SC and SCD instructions for user-mode QEMU are implemented with a "dummy" exception. Since it is not a real exception, it is not reported in the QEMU log file as an exception.
I'm not certain that's a helpful distinction to make when it comes to debugging qemu.
r~
Quoted 4 lines · Richard Henderson
Quoted 1 line · Eric
So basically the SC and SCD instructions for user-mode QEMU are implemented with a "dummy" exception. Since it is not a real exception, it is not reported in the QEMU log file as an exception.
I'm not certain that's a helpful distinction to make when it comes to debugging qemu.
And if it is, using a symbolic constant in the comparison here might help point out what we're doing.
This is all bikeshedding over a fairly minor bit of code though.
-- PMM
Quoted 10 lines
-----Original Message-----
From: Richard Henderson [mailto:[email protected]] On Behalf Of Richard Henderson
Sent: Tuesday, November 27, 2012 1:19 PM
To: Johnson, Eric
Cc: "陳韋任 (Wei-Ren Chen)"; [email protected]
Subject: Re: [Qemu-devel] MIPS exception number limits?Quoted 1 line · Eric
So basically the SC and SCD instructions for user-mode QEMU are
Quoted 8 lines
implemented with a "dummy" exception. Since it is not a real exception, it is not reported in the QEMU log file as an exception.
I'm not certain that's a helpful distinction to make when it comes to debugging qemu.
r~
It may not be a helpful distinction.
The under 0x100 check has been there since 2005 which is long before I looked at any QEMU code. I was describing the code as it exists based on deductions from looking at the code. I should have made that clear that my summary.
My first draft of a response I described the steps I did (I.E. vim op_helper.c, grep EXCP *.h, gitk op_helper.c, grep EXCP_SC *, vim translate.c) to get to the conclusions I made. When I read it seemed like it might be interpreted as condescending which was not my intent.
In the original reply I also meant to say "removing the '#if 1' is fine with me."
/If/ the under 0x100 check remains, I would advocate using EXCP_SC instead of a magic constant.
-Eric