Custom kernel mode interrupt functions

Is it possible to have a function written by a user copied into kernel
address space by a driver. For example, when the driver gets a certain
dispatch call, it takes the address supplied in the structure received,
and copies into a preallocated location in kernel space the size that is
specified. It would then stop the device, disconnecting all interrupts,
and then restart the device connecting the interrupts to this function
which was copied from user space?
I currently have a system of user mode interrupts which use apc, and a
sleeping user mode thread, and I am hoping to speed this up by just
copying a structured function straight into the driver’s memory.

Nachum Kanovsky
xxxxx@mangodsp.com
(02) 5328706 ext 229


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”. It
won’t necessarily be EASY… consider the issue of relocating the code, run
time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

But would it not be easier to use a kernel dll, with specific loader and
initialization routines? Thus, if in IOCTL_RED you call the loader function
for RED.DLL and for IOCTL_GREEN you call the loader function for GREEN.DLL.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Peter Viscarola [mailto:xxxxx@osr.com]
Sent: Wednesday, September 12, 2001 11:21 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”. It
won’t necessarily be EASY… consider the issue of relocating the code, run
time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Is there anywhere that I could look to get me started on how to do this,
such as how to relocate code, etc…
Perhaps just a few key function calls, or pointer redirection examples
for use in this type of thing would help.
Thanx,
Nachum

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Wednesday, September 12, 2001 8:21 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”.
It won’t necessarily be EASY… consider the issue of relocating the
code, run time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@yahoo.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Can I load a dll from within my device driver? And even if I can, It
would then require that the interrupt routine couldn’t change between
runnings device uses. The driver is for a Pci Dsp based card, that will
only send interrupts to the host during a host initiated session, so if
I want to change the interrupt function between host sessions, I would
still need to ‘relocate’ code into kernel memory for this.
Anyway, what are the advantages and disadvantages besides this for using
a dll versus attempting to import code?
Nachum

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary Little
Sent: Wednesday, September 12, 2001 8:59 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

But would it not be easier to use a kernel dll, with specific loader and
initialization routines? Thus, if in IOCTL_RED you call the loader
function for RED.DLL and for IOCTL_GREEN you call the loader function
for GREEN.DLL.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Peter Viscarola [mailto:xxxxx@osr.com]
Sent: Wednesday, September 12, 2001 11:21 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”.
It won’t necessarily be EASY… consider the issue of relocating the
code, run time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@broadstor.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@yahoo.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Nachum,

You don’t want to relocate code. You want to write self-relocating code. You
can do it if you don’t use absolute labels in your routines - everything is
referenced through offset plus some register - or if you encapsulate your
whole routine in its own segment, in which case your code always runs from
the same offset. You may have to do some _asm() magic here and there, but I
believe this is the safest way of doing it!

Alberto.

-----Original Message-----
From: Nachum Kanovsky [mailto:xxxxx@yahoo.com]
Sent: Wednesday, September 12, 2001 5:30 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Is there anywhere that I could look to get me started on how to do this,
such as how to relocate code, etc…
Perhaps just a few key function calls, or pointer redirection examples
for use in this type of thing would help.
Thanx,
Nachum

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Wednesday, September 12, 2001 8:21 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”.
It won’t necessarily be EASY… consider the issue of relocating the
code, run time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@yahoo.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

What if you register a default ISR which then calls the appropriate dll?

Pete

Peter Scott
xxxxx@KernelDrivers.com
http://www.KernelDrivers.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Nachum Kanovsky
Sent: Wednesday, September 12, 2001 3:33 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Can I load a dll from within my device driver? And even if I can, It
would then require that the interrupt routine couldn’t change between
runnings device uses. The driver is for a Pci Dsp based card, that will
only send interrupts to the host during a host initiated session, so if
I want to change the interrupt function between host sessions, I would
still need to ‘relocate’ code into kernel memory for this.
Anyway, what are the advantages and disadvantages besides this for using
a dll versus attempting to import code?
Nachum

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary Little
Sent: Wednesday, September 12, 2001 8:59 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

But would it not be easier to use a kernel dll, with specific loader and
initialization routines? Thus, if in IOCTL_RED you call the loader
function for RED.DLL and for IOCTL_GREEN you call the loader function
for GREEN.DLL.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Peter Viscarola [mailto:xxxxx@osr.com]
Sent: Wednesday, September 12, 2001 11:21 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”.
It won’t necessarily be EASY… consider the issue of relocating the
code, run time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@broadstor.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@yahoo.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com


You are currently subscribed to ntdev as: xxxxx@home.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Sure you can. If you look at a SCSIPORT/Miniport stack you will see that
ScsiPort itself is a dll that does not exist in memory until the first
miniport calls ScsiPortInitialize. You may need to define a do nothing
DriverEntry that returns STATUS_SUCCESS, but you can load a DLL from a
kernel mode driver given that you have linked with the DLL’s import lib.

You define a jump table and reference all functions or storage thru that
jump table. When the dll’s initialize function is called, it builds that
jump table and returns it to you. What then, do you need to relocate? You
could even have multiple jump tables for different loaded dells.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Nachum Kanovsky [mailto:xxxxx@yahoo.com]
Sent: Wednesday, September 12, 2001 2:33 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Can I load a dll from within my device driver? And even if I can, It
would then require that the interrupt routine couldn’t change between
runnings device uses. The driver is for a Pci Dsp based card, that will
only send interrupts to the host during a host initiated session, so if
I want to change the interrupt function between host sessions, I would
still need to ‘relocate’ code into kernel memory for this.
Anyway, what are the advantages and disadvantages besides this for using
a dll versus attempting to import code?
Nachum

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gary Little
Sent: Wednesday, September 12, 2001 8:59 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

But would it not be easier to use a kernel dll, with specific loader and
initialization routines? Thus, if in IOCTL_RED you call the loader
function for RED.DLL and for IOCTL_GREEN you call the loader function
for GREEN.DLL.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@broadstor.com

-----Original Message-----
From: Peter Viscarola [mailto:xxxxx@osr.com]
Sent: Wednesday, September 12, 2001 11:21 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Custom kernel mode interrupt functions

Custom kernel mode interrupt functions> “Nachum Kanovsky”
wrote in message news:xxxxx@ntdev…
> Is it possible to have a function written by a user copied into kernel
address space by a driver?

Sure. It depends on precisely the type of code that you wanna “load”.
It won’t necessarily be EASY… consider the issue of relocating the
code, run time functions that might be called, etc.

But COULD you do it? Absolutely…

Peter
OSR


You are currently subscribed to ntdev as: xxxxx@broadstor.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@yahoo.com To
unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com