Re: Figuring out physical memory regions from a kernel module

From: Vivek Goyal
Date: Thu Dec 09 2004 - 01:01:56 EST


How about reading /proc/iomem with some user space utility, parse it and
pass it to your module as parameters during insmod.

On Wed, 2004-12-08 at 23:14, Hanson, Jonathan M wrote:
> Is there a reliable way to tell from a kernel module (currently
> written for 2.4 but will need to work under 2.6 in the future) which
> regions of physical memory are actually available for the kernel and
> processes to use? For example, the following command tells me the
> regions of physical memory that are available to use:
>
> cat /proc/iomem | grep 'System RAM'
>
> This yields something like the following on my x86 system:
>
> 00000000-0009ffff : System RAM
> 00100000-1ffd5857 : System RAM
>
> I need to be able to determine these regions from within a kernel
> module. The e820 data structures configured at kernel boot-time are not
> exported so I can't see them from a kernel module, otherwise they would
> be perfect. For my purposes, I'm operating under the assumption that all
> physical memory can be mapped by the kernel (under 896 MB of physical
> memory). Can anyone recommend a way to get to this data? I would greatly
> appreciate it.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>

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