> alex.buell@tahallah.demon.co.uk said:
> > Do you find that the Linux device driver interfaces a lot cleaner than
> > the NT device driver interfaces? I'm genuinely curious to know.
>
> No comparison. NT is positively hideous. It is amazing how amateurish
> the NT kernel mode interface is. However, for your viewing pleasure, I
> include a driver for our ISE board in order to demonstrate my reasoning.
> The source supports Linux and NT, so you can see side-by-side the Linux
> and NT version of the same thing. Judge for yourself. It is possible that
> I need educating. (Please!)
>
> Note that the NT version may not be perfect. It is extremely difficult to
> get memory that a process and a device can share under NT, my hack may only
> work on NT/intel, not NT/alpha. NT/Intel support has been well tested
> by now, but my alpha has become too important to me to actually run the
> NT system I have installed.
>
> Linux/Intel and Linux/alpha are fairly bullet-proof.
>
> NT needs UDI much more then Linux does:-)
>
> Here it is: <ftp://ftp.picturel.com/pub/source/ucr/driver.tgz>
Interesting reading.
Just a nit. Your driver does not seem to do verify_area() before the
memcpy_*fs in the 2.0 case (and does not check the return value in 2.1). Not
doing verify_area in 2.0 is a security hole - the user can read/write
kernel addresses.
The renaming from memcpy*fs to *user was not done to make a bad joke at the
programmer, it was done to catch the semantic change during compile time @)
In os-linux.h you should do instead:
#if LINUX_VERSION_CODE < 0x020100
static inline int copy_to_user(void *dst, void *src, int len)
{
int err;
err = verify_area(VERIFY_WRITE,dst,len);
if (!err) memcpy_tofs(dst,src,len);
return 0;
}
static inline int copy_from_user(void *dst, void *src, int len)
{
int err;
err = verify_area(VERIFY_READ,src,len);
if (!err) memcpy_fromfs(dst,src,len);
return 0;
}
#else
# include <asm/uaccess.h>
#endif
and check the return value from copy_from/to_user in the higher level
functions.
-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/