Subject: Re: how to write codes to access memory start at address 0xF1000000
To: John F. Woods <>
From: Bill Studenmund <>
List: current-users
Date: 09/03/1997 18:11:12
On Wed, 3 Sep 1997, John F. Woods wrote:

> > > I am doing embedded system programming on Netbsd 
> > > I need to access data on a shared memory which start at 0xF1000000. 
> > > How to write codes to have the data on the shared memory accessed? 
> > > In other words, how to make an array start at address 0xF100000? I want
> > > to declare an array  containing all the adresses to which I can access
> > > those data pointed. Any ideas?
> > This should be standard C. :-)
> Aaaaargh!  It's statements like this that make me wish I was a postal worker.
> > Basically you want to have a variable be a pointer to the array at
> > 0xF100000. I.E. you have some data structure (maybe a struct, maybe not)
> > which matches the data format you expect at 0xF100000. You have a variable
> > which is a pointer to such a structure. You set the pointer to 0xF100000
> > (with a type cast in there probably). You then de-reference the pointer.
> Given that this person is doing embedded programming on NetBSD, and not
> embedded programming without an operating system, I assume that he wants
> to address some kind of shared memory at 0xF1000000 in some address space
> OTHER than user virtual address space, which is what a USER PROCESS
> containing

[snip a lot of details on how to set up memory mappings]

> There's a lot of details left out, and maybe some errors added, but I think
> this is enough to provide a start (and a hint of what kernel modules to start
> reading ("Use the Source, Luke!")), and I don't have time to research a
> complete answer.  It is, at least, more correct than just "stick 0xF1000000
> in a pointer variable and off you go".  (Off into the weeds, more like it.)

You're right that I left all that out (mainly as I don't know how to do
it). But I DID mention that I assumed that the memory block was already
mapped, and that it'd be better to base things off of the address returned
by the mapping and not an absolute address.

Or I tried to.

I think the original question was vague. I replied more to what was asked
(or what I thought was asked), and you replied more what was needed.

Basically in terms of what I said, region ends up being a pointer whose
value should be shoved into the pointer to the struct.

Take care,