linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Memory Access Problem
@ 2001-05-15  6:36 Rich.Liu
  2001-05-15  9:40 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Rich.Liu @ 2001-05-15  6:36 UTC (permalink / raw)
  To: linux-kernel

I have a problem in kernel 2.4.4

I use readw to access memory below 1MB , report "Segmentation fault"
and stall in memory

simple code below (this will get paraller port)
==
int init_module(void){
	unsigned int   *BIOS_Data=(unsigned int *)0x400;
	u32 test;
                test = readw(BIOS_Data);

	 printk(KERN_CRIT  "0x400:%x\n",test);
}
==
but those can work in kernel 2.2.19 , no problem .

can anyone help me ?
--
Richliu                                                       


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

* Re: Memory Access Problem
  2001-05-15  6:36 Memory Access Problem Rich.Liu
@ 2001-05-15  9:40 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2001-05-15  9:40 UTC (permalink / raw)
  To: Rich.Liu; +Cc: linux-kernel

> I use readw to access memory below 1MB , report "Segmentation fault"
> and stall in memory
> 
> simple code below (this will get paraller port)
> ==
> int init_module(void){
> 	unsigned int   *BIOS_Data=(unsigned int *)0x400;
> 	u32 test;
>                 test = readw(BIOS_Data);
> 
> 	 printk(KERN_CRIT  "0x400:%x\n",test);
> }
> ==
> but those can work in kernel 2.2.19 , no problem .
> 
> can anyone help me ?

2.2 had back compatibility support for old drivers that did this 2.4 does
not.

	readb() is for bus accesses after mapping with ioremap
	isa_readb() is a quick form for ISA bus which is always mapped

For main memory you want to use
	phys_to_virt()

to get the virtual mapping of the page. That will work for the BIOS page but
not for arbitary higher pages which may not even be mapped.




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

end of thread, other threads:[~2001-05-15  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15  6:36 Memory Access Problem Rich.Liu
2001-05-15  9:40 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).