Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] Unaligned trap handler - comments appreciated
@ 2001-06-18  7:01 Randolph Chung
  2001-06-23  6:54 ` Randolph Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Randolph Chung @ 2001-06-18  7:01 UTC (permalink / raw)
  To: parisc-linux

I just checked in an arch/parisc/kernel/unaligned.c file into palinux
cvs.

It's my (not-yet-successful) attempt at putting together an unaligned
memory access handler for palinux.

Since I'm not really familiar with how this is "supposed" to be done, I
would really appreciate if folks more in the know can review the code
and let me know if i'm on the right track, or if i'm smoking something
funny :-)

I haven't checked in the (simple, obvious) hook in traps.c that calls
the unaligned handler since it isn't working yet.

thanks for your patience :)
randolph
-- 
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [parisc-linux] Unaligned trap handler - comments appreciated
  2001-06-18  7:01 [parisc-linux] Unaligned trap handler - comments appreciated Randolph Chung
@ 2001-06-23  6:54 ` Randolph Chung
  2001-06-23 12:31   ` Helge Deller
  0 siblings, 1 reply; 3+ messages in thread
From: Randolph Chung @ 2001-06-23  6:54 UTC (permalink / raw)
  To: parisc-linux

In reference to a message from Randolph Chung, dated Jun 18:
> I just checked in an arch/parisc/kernel/unaligned.c file into palinux
> cvs.

I've updated traps.c to call the unaligned handler now. Many thanks to
jsm for his help and advice.

I've only tested this for parisc64, would appreciate if someone can test
to make sure it works on a narrow kernel as well. My test case looks
something like this:


#include <stdio.h>

struct data_t {
        unsigned long a;
        unsigned long b;
};

int main(int argc, char **argv)
{
        struct data_t data;
        unsigned char *t;
        unsigned long l;
        int i;

        data.a = 0x12345678;
        data.b = 0x87654321;

        t = (unsigned char *)(&data)+1;
        l = *((unsigned long *)t);
        printf("l = 0x%08lx\n\n\n", l);

        printf("expected result is: 0x");
        for (i = 0; i < sizeof(unsigned long); i++)
                printf("%x", *(t+i));
        printf("\n");

        printf("testing store...\n");
        *((unsigned long *)t) = 0x13572468;

        l = *((unsigned long *)t);
        printf("l = 0x%08lx\n", l);

        return 0;
}

randolph
-- 
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [parisc-linux] Unaligned trap handler - comments appreciated
  2001-06-23  6:54 ` Randolph Chung
@ 2001-06-23 12:31   ` Helge Deller
  0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2001-06-23 12:31 UTC (permalink / raw)
  To: Randolph Chung, parisc-linux

Hi Randolph,

I've tested your changes on a 32bit kernel:

c3000:~/unaligned# uname -a
Linux c3000 2.4.0-pa37 #1 Sam Jun 23 11:42:43 CEST 2001 parisc unknown
c3000:~/unaligned# gcc unaligned.c
c3000:~/unaligned# ./a.out
Bus error

In the syslog:
Jun 23 14:26:36 c3000 kernel: a.out(3225): unaligned access to 0xbff00649 at 
ip=0x000104fb

Greetings,
Helge

On Saturday 23 June 2001 08:54, Randolph Chung wrote:
> In reference to a message from Randolph Chung, dated Jun 18:
> > I just checked in an arch/parisc/kernel/unaligned.c file into palinux
> > cvs.
>
> I've updated traps.c to call the unaligned handler now. Many thanks to
> jsm for his help and advice.
>
> I've only tested this for parisc64, would appreciate if someone can test
> to make sure it works on a narrow kernel as well. My test case looks
> something like this:
>
>
> #include <stdio.h>
>
> struct data_t {
>         unsigned long a;
>         unsigned long b;
> };
>
> int main(int argc, char **argv)
> {
>         struct data_t data;
>         unsigned char *t;
>         unsigned long l;
>         int i;
>
>         data.a = 0x12345678;
>         data.b = 0x87654321;
>
>         t = (unsigned char *)(&data)+1;
>         l = *((unsigned long *)t);
>         printf("l = 0x%08lx\n\n\n", l);
>
>         printf("expected result is: 0x");
>         for (i = 0; i < sizeof(unsigned long); i++)
>                 printf("%x", *(t+i));
>         printf("\n");
>
>         printf("testing store...\n");
>         *((unsigned long *)t) = 0x13572468;
>
>         l = *((unsigned long *)t);
>         printf("l = 0x%08lx\n", l);
>
>         return 0;
> }
>
> randolph

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-06-23 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-18  7:01 [parisc-linux] Unaligned trap handler - comments appreciated Randolph Chung
2001-06-23  6:54 ` Randolph Chung
2001-06-23 12:31   ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox