All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lanttor <lanttor.guo@freescale.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: linux-m68k@vger.kernel.org,
	uClinux development list <uclinux-dev@uclinux.org>
Subject: Re: Interrupt issue on m68k platform and some fix
Date: Thu, 02 Jul 2009 16:58:51 +0800	[thread overview]
Message-ID: <4A4C76CB.4000208@freescale.com> (raw)
In-Reply-To: <m3hbxvtruk.fsf@hase.home>

>
> No, it isn't.  It is equivalent to
> *(long *)((char *)&current_thread_info()->preempt_count + 1) += 1
> which is of course completely bogus.
Sorry, I think I paste the redundant character for the codes (no '*'
char at front or end of addql and subql instruction)
I paste it again:

ENTRY(inthandler)
SAVE_ALL_INT
GET_CURRENT(%d0)
addql #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
/* put exception # in d0 */
movel %sp@(PT_VECTOR),%d0
swap %d0 /* extract bits 25:18 */
lsrl #2,%d0
andl #0x0ff,%d0

movel %sp,%sp@-
movel %d0,%sp@- /* put vector # on stack */
auto_irqhandler_fixup = . + 2
jbsr process_int /* process the IRQ */
addql #8,%sp /* pop parameters off stack */
ret_from_interrupt:

subql #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
jeq ret_from_last_interrupt
2: RESTORE_ALL

ALIGN
ret_from_last_interrupt:
moveb %sp@(PT_SR),%d0
andl #(~ALLOWINT>>8)&0xff,%d0
jne 2b

/* check if we need to do software interrupts */
tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING
jeq .Lret_from_exception
pea ret_from_exception
jra do_softirq

For code "addql #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)",
My understanding is that
%curptr@(TASK_INFO+TINFO_PREEMPT) is the address of
current_thread_info()->preempt_count, and
%curptr@(TASK_INFO+TINFO_PREEMPT+1) point to the second byte of
preempt_count field (preempt_count field is 4 bytes).

So this code sets value 1 to the second byte of preempt_count field.

HARDIRQ_OFFSET equals (1 << HARDIRQ_SHIT) , and HARDIRQ_SHIFT value is
16, so I think this code equals
current_thread_info()->preempt_count += HARDIRQ_OFFSET

Am I wrong?

Regards,
Lanttor




------------------------------------------------------------------------
*From:* Andreas Schwab <schwab@linux-m68k.org>
*Sent:* 07/02/2009 4:24:35 PM +0800
*To:* Lanttor <lanttor.guo@freescale.com>
*CC:* linux-m68k@vger.kernel.org, uClinux development list
<uclinux-dev@uclinux.org>
*Subject:* Interrupt issue on m68k platform and some fix

> Lanttor <lanttor.guo@freescale.com> writes:
>
>   
>> My understanding of "*addql   #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)*"
>> is that its meaning is equal to
>> "current_thread_info()->preempt_count += HARDIRQ_OFFSET",
>>     
>
> No, it isn't.  It is equivalent to
> *(long *)((char *)&current_thread_info()->preempt_count + 1) += 1
> which is of course completely bogus.
>
> Andreas.
>
>   

  reply	other threads:[~2009-07-02  8:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-02  4:07 Interrupt issue on m68k platform and some fix Lanttor
2009-07-02  8:24 ` Andreas Schwab
2009-07-02  8:58   ` Lanttor [this message]
2009-07-02  9:05     ` Andreas Schwab
2009-07-02 10:06       ` Lanttor
2009-07-02 20:25       ` Roman Hodek
2009-07-03  3:18         ` Lanttor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A4C76CB.4000208@freescale.com \
    --to=lanttor.guo@freescale.com \
    --cc=linux-m68k@vger.kernel.org \
    --cc=schwab@linux-m68k.org \
    --cc=uclinux-dev@uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.