Messages in this thread | | | Date | Thu, 11 Nov 1999 14:32:15 -0500 (EST) | From | "Richard B. Johnson" <> | Subject | Re: 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/
| |