All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Kiichi Kameda <k-kameda@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] SH4 port
Date: Mon, 02 Oct 2006 16:43:48 +0200	[thread overview]
Message-ID: <452125A4.4010705@domain.hid> (raw)
In-Reply-To: <003101c6e6f6$1fa52de0$1501a8c0@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]

Kiichi Kameda wrote:
>> [ksrc/arch/sh/switch.c]
>>
>> void rthal_switch_to(xnarchtcb_t *prev, xnarchtcb_t *next)
>> {
>> ...
>>         /*
>>          * Restore the kernel mode register
>>          *      k7 (r7_bank1)
>>          */
>>  if(next->user_task) {
>>
>>             asm volatile("ldc       %0, r5_bank"
>>                      : /* no output */
>>                      : "r" (next->user_task->thread_info));
>>  }
>>
>> Is there a particular reason why comment and reality diverge regarding
>> the thread_info register? Could this cause your troubles?
>>
> 
> I'm sorry, the comment is wrong.
> The code that uses r7_bank  results in overwriting "current".

What code is it?

> To avoid this,  I changed  from r7_bank to r5_bank for Xenomai context
> switch .

Wouldn't it be better to avoid that overwriting in the first place
instead of escaping from it? You may not be safe from code running on
behalf of a Xenomai user-space thread that assumes current is still in
r7_bank.

> Also, I added to the Linux context switch code  so that thread_info is set
> in r5_bank register  as well as in r7_bank regsiter.
> r5_bank register is referenced in the page fault handling code.

The handling code of Xenomai or Linux?

The goal must be that the environment for a shadowed Xenomai thread
looks (almost) like that of a normal Linux thread. If there is Xenomai
code that messes this up on SH4, this has to be fixed. Patching Linux
Linux outside the I-pipe context indicates that something is wrong with
the design. This is what I can say from my distant POV without knowing
the specific issues of SH4.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-10-02 14:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-03 13:21 [Xenomai-help] SH4 port Kiichi Kameda
2006-10-02 13:30 ` Jan Kiszka
2006-10-03 14:13   ` Kiichi Kameda
2006-10-02 14:43     ` Jan Kiszka [this message]
2006-10-03 15:18       ` Kiichi Kameda
2006-10-02 15:44         ` Jan Kiszka
  -- strict thread matches above, loose matches on Subject: below --
2006-09-30 13:10 Kiichi Kameda
2006-09-29 13:20 ` Jan Kiszka
2006-10-02  8:40   ` Jan Kiszka

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=452125A4.4010705@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=k-kameda@domain.hid \
    --cc=xenomai@xenomai.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.