Size limits for kld's?

2000-08-13 Thread Isaac Waldron

I'm working on getting plex86 (formerly FreeMWare) to run under FreeBSD,
which requires writing a device driver.  I wrote up a simple kld to
handle this, and a minimal version works perfectly.  The problem I'm
having crops up when I add in all the other functionality that needs to
be included.  The new module is much larger than the original, and
kldstat reports its size as 13000, whereas the older one was around 2500
or so.

Unfortunately, while the open and close functions I wrote are called
correctly, the ioctl function is never called.  A call to ioctl(filehdl,
PLEX86_IOCTL, int) returns an error, and a perror("ioctl") prints
"ioctl: Bad Address."  I know that the ioctl number is correct, and it
was defined with the proper _IO* macro.  The file handle also opens just
fine, as the printf's in my open function are executed and show on the
console.  AFAIK, that error would be caused by an EFAULT being returned
somewhere in the chain.

What I'm asking is, what would cause some of the functions referenced by
my driver's cdevsw to not be able to be called?  Are there size limits
on functions in a kld?  Or a limit on the total size of a kld?

Isaac Waldron
waldroni at lr dot net




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Best way to lock malloc'd memory in kernel

2000-07-28 Thread Isaac Waldron

I'm writing a device driver for plex86 (the FreeMWare virtual machine
software), and have a buffer that needs to be non-pageable.  It was malloc'd
with the malloc(size, type, flags) kernel malloc function.  What's the best
way to make this memory unpageable?

Thanks in advance,
Isaac Waldron
waldroni at lr dot net



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Best way to lock malloc'd memory in kernel

2000-07-28 Thread Isaac Waldron


  I'm writing a device driver for plex86 (the FreeMWare virtual machine
  software), and have a buffer that needs to be non-pageable.  It was
malloc'd
  with the malloc(size, type, flags) kernel malloc function.  What's the
best
  way to make this memory unpageable?

 No kernel memory is pageable so it doesn't matter :)


Thanks!  I didn't realize that, I suppose I should have RTFM'ed a bit more
before asking, but I just kind of assumed (we all know what that does) that
memory malloc'd in kernel mode was pageable.  I guess I should ask whether
that holds true for kernel modules as well, because that's what I'm actually
writing.

Thanks again,
Isaac Waldron
waldroni at lr dot net



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Writing device drivers (ioctl issue)

2000-07-26 Thread Isaac Waldron

I started working on a port of FreeMWare/plex86 (www.plex86.org) to FreeBSD
yesterday, and have run into a small problem.  The basic idea is that I need
to write a kernel module that implements some ioctls for a new psuedo-device
that will eventually reside at /dev/plex86.

The issue I'm running into is with the function I'm writing to handle the
ioctls for the device.  For one of the ioctls, the code needs to get some
data from the file descriptor that was passed to the original call to
ioctl(2).  This is easily accomplished in linux, because the file descriptor
is passed as the second argument to the device_ioctl function.

Is there an easy way to get at the same data (the file descriptor passed to
ioctl(2) by the calling program, in a kernel-style "struct file *", not the
standard "struct FILE *") in FreeBSD?  Or will it be neccesary to change the
ioctl structure slightly and therefore need to change some of the higher
level functions in plex?

Thanks in advance,
Isaac Waldron
waldroni at lr dot net



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message