* [Qemu-devel] MIPS exception number limits?
@ 2012-11-22 19:33 陳韋任 (Wei-Ren Chen)
2012-11-27 5:25 ` Johnson, Eric
0 siblings, 1 reply; 5+ messages in thread
From: 陳韋任 (Wei-Ren Chen) @ 2012-11-22 19:33 UTC (permalink / raw)
To: qemu-devel
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
--
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] MIPS exception number limits?
2012-11-22 19:33 [Qemu-devel] MIPS exception number limits? 陳韋任 (Wei-Ren Chen)
@ 2012-11-27 5:25 ` Johnson, Eric
2012-11-27 21:18 ` Richard Henderson
0 siblings, 1 reply; 5+ messages in thread
From: Johnson, Eric @ 2012-11-27 5:25 UTC (permalink / raw)
To: 陳韋任 (Wei-Ren Chen), qemu-devel@nongnu.org
> -----Original Message-----
> From: qemu-devel-bounces+ericj=mips.com@nongnu.org [mailto:qemu-devel-
> bounces+ericj=mips.com@nongnu.org] On Behalf Of ??? (Wei-Ren Chen)
> Sent: Thursday, November 22, 2012 11:34 AM
> To: qemu-devel@nongnu.org
> Subject: [Qemu-devel] 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
>
> --
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] MIPS exception number limits?
2012-11-27 5:25 ` Johnson, Eric
@ 2012-11-27 21:18 ` Richard Henderson
2012-11-27 22:03 ` Peter Maydell
2012-11-27 22:23 ` Johnson, Eric
0 siblings, 2 replies; 5+ messages in thread
From: Richard Henderson @ 2012-11-27 21:18 UTC (permalink / raw)
To: Johnson, Eric
Cc: qemu-devel@nongnu.org,
"陳韋任 (Wei-Ren Chen)"
On 11/26/2012 09:25 PM, Johnson, Eric wrote:
> 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~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] MIPS exception number limits?
2012-11-27 21:18 ` Richard Henderson
@ 2012-11-27 22:03 ` Peter Maydell
2012-11-27 22:23 ` Johnson, Eric
1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2012-11-27 22:03 UTC (permalink / raw)
To: Richard Henderson
Cc: Johnson, Eric, "陳韋任 (Wei-Ren Chen)",
qemu-devel@nongnu.org
On 27 November 2012 21:18, Richard Henderson <rth@twiddle.net> wrote:
> On 11/26/2012 09:25 PM, Johnson, Eric wrote:
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] MIPS exception number limits?
2012-11-27 21:18 ` Richard Henderson
2012-11-27 22:03 ` Peter Maydell
@ 2012-11-27 22:23 ` Johnson, Eric
1 sibling, 0 replies; 5+ messages in thread
From: Johnson, Eric @ 2012-11-27 22:23 UTC (permalink / raw)
To: Richard Henderson
Cc: qemu-devel@nongnu.org,
"陳韋任 (Wei-Ren Chen)"
> -----Original Message-----
> From: Richard Henderson [mailto:rth7680@gmail.com] On Behalf Of Richard
> Henderson
> Sent: Tuesday, November 27, 2012 1:19 PM
> To: Johnson, Eric
> Cc: "陳韋任 (Wei-Ren Chen)"; qemu-devel@nongnu.org
> Subject: Re: [Qemu-devel] MIPS exception number limits?
>
> On 11/26/2012 09:25 PM, Johnson, Eric wrote:
> > 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~
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-27 22:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22 19:33 [Qemu-devel] MIPS exception number limits? 陳韋任 (Wei-Ren Chen)
2012-11-27 5:25 ` Johnson, Eric
2012-11-27 21:18 ` Richard Henderson
2012-11-27 22:03 ` Peter Maydell
2012-11-27 22:23 ` Johnson, Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).