public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Faking a memory map?
@ 2003-02-12  0:21 David Frascone
  2003-02-13 18:14 ` Jeremy Jackson
  0 siblings, 1 reply; 2+ messages in thread
From: David Frascone @ 2003-02-12  0:21 UTC (permalink / raw)
  To: linux-kernel

I'm trying to get an existing SDK (userland) for a PCI hardware device
to work across a different propriatary bit-banged interface.

The original device driver just mmaped the PCI registers / address
space into userland.  (talk about lazy ;)

Anyway, the hardware I'm working with is *not* on the PCI bus, and
therefore not memory-mappable.  So, I'm stuck with a complex driver
design (compared to the original), and rewriting the entire bottom of
the SDK.

So, I thought:  Is there a way to cheat?  Would it be possible for me
to *fake* the SDK out by memory mapping some RAM, and then reading /
writing to the ram after bit-banging the device.

I looked into it some, but I couldn't figure out how to get notified
when the region was read/written to (only when the page changed).  So,
is it possible to do the (admitedly ugly) hack I'm attempting?

Thanks in advance,

-Dave

-- 
David Frascone

          What garlic is to salad, insanity is to art.

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

* Re: Faking a memory map?
  2003-02-12  0:21 Faking a memory map? David Frascone
@ 2003-02-13 18:14 ` Jeremy Jackson
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Jackson @ 2003-02-13 18:14 UTC (permalink / raw)
  To: David Frascone; +Cc: linux-kernel

On Tue, 2003-02-11 at 19:21, David Frascone wrote:
> I'm trying to get an existing SDK (userland) for a PCI hardware device
> to work across a different propriatary bit-banged interface.
> 
> The original device driver just mmaped the PCI registers / address
> space into userland.  (talk about lazy ;)
> 
> Anyway, the hardware I'm working with is *not* on the PCI bus, and
> therefore not memory-mappable.  So, I'm stuck with a complex driver
> design (compared to the original), and rewriting the entire bottom of
> the SDK.
> 
> So, I thought:  Is there a way to cheat?  Would it be possible for me
> to *fake* the SDK out by memory mapping some RAM, and then reading /
> writing to the ram after bit-banging the device.
> 
> I looked into it some, but I couldn't figure out how to get notified
> when the region was read/written to (only when the page changed).  So,
> is it possible to do the (admitedly ugly) hack I'm attempting?

I think you would have to use mprotect(,,PROT_NONE), set the region to
disallow read/write, and then each SEGV would have to be decoded, and
the trap told to continue as though the access did take place.

Take a look at the mprotect man page for an example, and then sigaction
arount the siginfo_t area.  in siginfo_t.si_addr it gives the address
that faulted.
> 
> Thanks in advance,
> 
> -Dave
-- 
Jeremy Jackson <jerj@coplanar.net>


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

end of thread, other threads:[~2003-02-13 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-12  0:21 Faking a memory map? David Frascone
2003-02-13 18:14 ` Jeremy Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox