lkml.org 
[lkml]   [1999]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Accessing shared physical memory
On Thu, 11 Nov 1999, Alan Cox wrote:

> > Access from a driver that does:
> >
> > ptr = (short *) ioremap(0xd0000, 0x10000);
> > for(;;)
> > *ptr = 0xdead;
> >
> > Does not ever produce address 0xD... anything on the ISA bus. Therefore,
>
> Well I would guess the compiler optimised the above to
>
> while(1);
>
> You should use writew(). That would have sorted it and made it portable
>

Good guess, but no cigar. I did not know that you had defined 'writew()'
so I made by own. Here is a snippet from a header file with a bunch
of __asm__ stuff.

/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
/*
* This copies one word from one location to another without going
* through the GCC gyrations where it optimizes away what it thinks
* is unnecessary. This is really just "*(short *)dst = *(short *)src".
*/
static void __inline__ copyw(void *dst, void *src)
{
__asm__ __volatile__(
"/* copyw */\n"
"\tmovw (%%ebx), %%bx\n"
"\tmovw %%bx, (%%eax)\n"
: /* No outputs */
: "eax" (dst), "ebx" (src)
: "eax", "ebx", "memory" );
}
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
/*

The memory write is really occurring (somewhere).


Cheers,
Dick Johnson

Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.054 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site