Subject: Re: Do LKMs work *at*all* on powerpc platforms?
To: Bill Studenmund <wrstuden@zembu.com>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: port-macppc
Date: 08/13/2000 15:44:45
--mP3DRpeJDSE+ciuQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Mon, Aug 07, 2000 at 02:33:26PM -0700, Bill Studenmund wrote:
> The original proposal was to add something along the lines of
> __attribute__ ((long-call)) to the prototypes of functions outside the lkm
> so that the lkm's calls used a long-style jump or branch rather than a
> short one. As we open up all of the functions in the kernel to LKM's, that
> means that ALL of the prototypes need to have this __attribute__
> ((long-call)) added. Only when we're compiling an lkm. :-)
>
> I think adding something like -mlong-call and __attribute__ ((short-call))
> would be the most efficient thing. :-)
While that sounds good, I don't think it will work, because simply
adding __attribute__ ((long-call)) to the appropriate functions
doesn't work all the time.
I went with a suggestion from the middle of last week, and added
header files for the misc module to add __attribute__ ((longcall)) to
the end of each prototype that was outside of the lkm's source (a
kernel printf(), memcpy() from string.h, and a few lkm...() functions
from sys/lkm.h). While some of the relocation problems went away, they
did not *all* go away. Specifically, the references to memcpy() (or,
seemingly, anything else in string.h--I tried strcpy() and a few
others) ignore the __attribute__.
Here's an attempted make load from the original, unmodified source (in
/usr/share/lkm/misc/module):
achemar:misc/module# make load
modload -o miscmod -emiscmod combined.o
combined.o: In function `miscmod_handle':
combined.o(.text+0x4c): relocation truncated to fit: R_PPC_REL24 lkmexists
combined.o(.text+0x100): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o(.text+0x12c): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o(.text+0x148): relocation truncated to fit: R_PPC_REL24 printf
combined.o(.text+0x158): relocation truncated to fit: R_PPC_REL24 printf
combined.o(.text+0x168): relocation truncated to fit: R_PPC_REL24 printf
combined.o(.text+0x178): relocation truncated to fit: R_PPC_REL24 printf
combined.o(.text+0x1b4): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o: In function `miscmod':
combined.o(.text+0x2cc): relocation truncated to fit: R_PPC_REL24 lkm_nofunc
combined.o(.text+0x2fc): relocation truncated to fit: R_PPC_REL24 lkmdispatch
combined.o: In function `misccall':
combined.o(.text+0x350): relocation truncated to fit: R_PPC_REL24 printf
combined.o(.text+0x360): relocation truncated to fit: R_PPC_REL24 printf
combined.o(.text+0x370): relocation truncated to fit: R_PPC_REL24 printf
modload: can't link `combined.o' creating `miscmod' bound to 0xe9212000
*** Error code 1
Stop.
Here's an attempted make load from my modified source:
achemar:misc/module# make load
modload -o miscmod -emiscmod combined.o
combined.o: In function `miscmod_handle':
combined.o(.text+0x114): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o(.text+0x140): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o(.text+0x1f8): relocation truncated to fit: R_PPC_REL24 memcpy
modload: can't link `combined.o' creating `miscmod' bound to 0xe9212000
*** Error code 1
Stop.
Judging by the preprocessor output (attachment 2 to this email) from the
compilation of miscmod.c (which contains the offending miscmod_handle
function), my modified prototype for memcpy() *should* be active, since
it is included after the one from string.h and not overridden by
anything later in the file before use of the function.
(I did cc -E -D_LKM -D_KERNEL -I/sys -c miscmod.c > miscmod.pre to
produce this file.)
Judging by the assembly output (attachment 3), it is definitely not.
Though I don't talk PPC assembly so good, the calls to the lkm funcs
and to printf are *drastically* different from the calls to memcpy
in the assembly.
(I did cc -S -D_LKM -D_KERNEL -I/sys -c miscmod.c to produce this
file.)
What's going on here? Why is the change to the prototype not having
effect? Does memcpy() simply ignore __attribute__s? If so, how? Is
this actually cc's (therefore gcc/egcs's) fault?
In my opinion, this is a problem that should be fixed by individual
LKM authors *not* by adding massive #ifdef's to every kernel function.
That approach horrendously complicates the system source for the
pleasure of a minority in number of ports and number of users. I think
it is a moot point whether LKM makefiles use -mlong-call in their
calls to cc and LKM authors use (the currently non-existant in our
shipping cc) __attribute__ ((shortcall)), or LKM authors simply
rewrite the prototypes of the kernel functions they choose to use
adding __attribute__ ((longcall)). Either way, the LKM author needs to
be aware of the issue and do something about it, and it's not that
hard (and seems more clear, to me) to add a header file with this
information in it (heck, could even include a comment!).
Hiding the -mlong-call (which doesn't work in the cc we're currently
using right now, remember) withing -D_LKM somehow will just lead to
people forgetting it's even necessary to do __attribute__
((shortcall)) (which they can't anyhow with the cc we've got), and
make their code inexplicably slow.
What I would like to see before any of this is really considered,
though, is for __attribute__ ((longcall)) to actually have some kind
of effect. (I suppose the argument could be made that __attribute__
((shortcall)) on your own function prototypes beats rewriting kernel
prototypes, but if string.h functions ignore the longcall attribute,
who's to say they'll pay attention to -mlong-call?)
As an example to David Gatwood (at least, I think it was you that
asked this question, David), LKMs need to have access to all the
kernel functions because they may be rewriting functionality of the
kernel (in preparation for a kernel modification, perhaps). In my
case, this means changing the UVM structure such that the RAM of
another computer in a cluster can be used as backing store in place
of disk. I need access to considerably more than printf(), memcpy(),
and extraneous other functions (specifically, I want to rewrite
uvm_page(), pgo_get(), and related functions from sys/uvm).
The reason I would rather not just do this by recompiling the kernel
is that the process of loading an LKM, finding it's broken, and
rebooting the machine from the currently installed kernel without
having to go to the console (my machines are in a locked room in the
basement) to load an alternate kernel, then just repairing the LKM
code, recompiling, and reloading is *much* faster than waiting for a
kernel build every time I make a small change, only to find that I
have to trudge down to the console to load another kernel, make some
changes, and wait another fifteen minutes to half an hour while the
kernel recompiles.
~ g r @ eclipsed.net
PS, newhall@cs.swarthmore.edu is Tia Newhall, the professor at
Swarthmore College working with me on the project for which I wanted
LKMs to begin with. hinojosa@cs.swarthmore.edu is Rafael Hinojosa,
another student here working with me. They've been trying to help me
fix this LKM problem, but are not subscribed to port-macppc. Including
them in replies would be nice.
--mP3DRpeJDSE+ciuQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="miscmod.pre"
# 1 "miscmod.c"
# 1 "/sys/sys/param.h" 1
# 1 "/sys/sys/null.h" 1
# 84 "/sys/sys/param.h" 2
# 1 "/sys/sys/inttypes.h" 1
# 1 "/usr/include/machine/int_types.h" 1 3
# 1 "/usr/include/powerpc/int_types.h" 1 3
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short int __int16_t;
typedef unsigned short int __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long int __int64_t;
typedef unsigned long long int __uint64_t;
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
# 3 "/usr/include/machine/int_types.h" 2 3
# 46 "/sys/sys/inttypes.h" 2
# 1 "/usr/include/machine/types.h" 1 3
# 1 "/usr/include/powerpc/types.h" 1 3
# 1 "/sys/sys/cdefs.h" 1
# 1 "/usr/include/machine/cdefs.h" 1 3
# 1 "/usr/include/powerpc/cdefs.h" 1 3
# 3 "/usr/include/machine/cdefs.h" 2 3
# 63 "/sys/sys/cdefs.h" 2
# 1 "/sys/sys/cdefs_elf.h" 1
# 78 "/sys/sys/cdefs_elf.h"
# 65 "/sys/sys/cdefs.h" 2
# 129 "/sys/sys/cdefs.h"
# 187 "/sys/sys/cdefs.h"
# 37 "/usr/include/powerpc/types.h" 2 3
typedef struct label_t {
int val[40];
} label_t;
typedef unsigned long vm_offset_t;
typedef unsigned long vm_size_t;
typedef vm_offset_t paddr_t;
typedef vm_size_t psize_t;
typedef vm_offset_t vaddr_t;
typedef vm_size_t vsize_t;
typedef signed char int8_t;
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
typedef long long int64_t;
typedef unsigned long long u_int64_t;
typedef int32_t register_t;
# 3 "/usr/include/machine/types.h" 2 3
# 47 "/sys/sys/inttypes.h" 2
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
typedef __intptr_t intptr_t;
typedef __uintptr_t uintptr_t;
# 87 "/sys/sys/param.h" 2
# 1 "/sys/sys/types.h" 1
# 1 "/usr/include/machine/types.h" 1 3
# 47 "/sys/sys/types.h" 2
# 1 "/usr/include/machine/ansi.h" 1 3
# 1 "/usr/include/powerpc/ansi.h" 1 3
typedef struct {
char __gpr, __fpr, __pad[2];
char *__stack, *__base;
} __va_list;
# 3 "/usr/include/machine/ansi.h" 2 3
# 49 "/sys/sys/types.h" 2
# 1 "/usr/include/machine/endian.h" 1 3
# 1 "/sys/sys/endian.h" 1
# 1 "/usr/include/machine/endian_machdep.h" 1 3
# 1 "/usr/include/powerpc/endian_machdep.h" 1 3
# 3 "/usr/include/machine/endian_machdep.h" 2 3
# 49 "/sys/sys/endian.h" 2
# 1 "/sys/sys/types.h" 1
# 258 "/sys/sys/types.h"
# 80 "/sys/sys/endian.h" 2
typedef u_int32_t in_addr_t;
typedef u_int16_t in_port_t;
in_addr_t htonl (in_addr_t) __attribute__((__const__));
in_port_t htons (in_port_t) __attribute__((__const__));
in_addr_t ntohl (in_addr_t) __attribute__((__const__));
in_port_t ntohs (in_port_t) __attribute__((__const__));
# 1 "/usr/include/machine/bswap.h" 1 3
# 1 "/usr/include/powerpc/bswap.h" 1 3
# 1 "/sys/sys/bswap.h" 1
# 1 "/sys/sys/types.h" 1
# 258 "/sys/sys/types.h"
# 14 "/sys/sys/bswap.h" 2
u_int16_t bswap16 (u_int16_t) ;
u_int32_t bswap32 (u_int32_t) ;
u_int64_t bswap64 (u_int64_t) ;
# 6 "/usr/include/powerpc/bswap.h" 2 3
# 3 "/usr/include/machine/bswap.h" 2 3
# 118 "/sys/sys/endian.h" 2
# 152 "/sys/sys/endian.h"
# 3 "/usr/include/machine/endian.h" 2 3
# 50 "/sys/sys/types.h" 2
# 1 "/sys/sys/ansi.h" 1
# 1 "/usr/include/machine/int_types.h" 1 3
# 42 "/sys/sys/ansi.h" 2
typedef __uint32_t __mode_t;
typedef __int64_t __off_t;
typedef __uint8_t __sa_family_t;
typedef unsigned int __socklen_t;
# 52 "/sys/sys/types.h" 2
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned char unchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef u_long cpuid_t;
typedef u_int64_t u_quad_t;
typedef int64_t quad_t;
typedef quad_t * qaddr_t;
typedef quad_t longlong_t;
typedef u_quad_t u_longlong_t;
typedef int64_t blkcnt_t;
typedef u_int32_t blksize_t;
typedef char * caddr_t;
typedef int32_t daddr_t;
typedef u_int32_t dev_t;
typedef u_int32_t fixpt_t;
typedef u_int32_t gid_t;
typedef u_int32_t id_t;
typedef u_int32_t ino_t;
typedef long key_t;
typedef __mode_t mode_t;
typedef u_int32_t nlink_t;
typedef __off_t off_t;
typedef int32_t pid_t;
typedef quad_t rlim_t;
typedef int32_t segsz_t;
typedef int32_t swblk_t;
typedef u_int32_t uid_t;
typedef int32_t dtime_t;
union __semun {
int val;
struct semid_ds *buf;
unsigned short *array;
};
typedef unsigned long clock_t;
typedef unsigned int size_t;
typedef int ssize_t;
typedef long time_t;
typedef int clockid_t;
typedef int timer_t;
typedef int suseconds_t;
typedef unsigned int useconds_t;
typedef int32_t __fd_mask;
typedef struct fd_set {
__fd_mask fds_bits[((( 256 ) + (( (sizeof(__fd_mask) * 8 ) ) - 1)) / ( (sizeof(__fd_mask) * 8 ) )) ];
} fd_set;
struct proc;
struct pgrp;
struct ucred;
struct rusage;
struct file;
struct buf;
struct tty;
struct uio;
# 88 "/sys/sys/param.h" 2
# 1 "/sys/sys/syslimits.h" 1
# 1 "/sys/sys/featuretest.h" 1
# 41 "/sys/sys/syslimits.h" 2
# 98 "/sys/sys/param.h" 2
# 1 "/sys/sys/errno.h" 1
# 121 "/sys/sys/param.h" 2
# 1 "/sys/sys/time.h" 1
struct timeval {
long tv_sec;
long tv_usec;
};
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
# 94 "/sys/sys/time.h"
# 103 "/sys/sys/time.h"
# 120 "/sys/sys/time.h"
# 129 "/sys/sys/time.h"
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
struct clockinfo {
int hz;
int tick;
int tickadj;
int stathz;
int profhz;
};
int itimerfix (struct timeval *tv) ;
int itimerdecr (struct itimerval *itp, int usec) ;
void microtime (struct timeval *tv) ;
int settime (struct timeval *) ;
int ratecheck (struct timeval *, const struct timeval *) ;
int ppsratecheck (struct timeval *, int *, int) ;
# 190 "/sys/sys/time.h"
# 122 "/sys/sys/param.h" 2
# 1 "/sys/sys/resource.h" 1
struct rusage {
struct timeval ru_utime;
struct timeval ru_stime;
long ru_maxrss;
long ru_ixrss;
long ru_idrss;
long ru_isrss;
long ru_minflt;
long ru_majflt;
long ru_nswap;
long ru_inblock;
long ru_oublock;
long ru_msgsnd;
long ru_msgrcv;
long ru_nsignals;
long ru_nvcsw;
long ru_nivcsw;
};
struct orlimit {
int32_t rlim_cur;
int32_t rlim_max;
};
struct rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
struct loadavg {
fixpt_t ldavg[3];
long fscale;
};
extern struct loadavg averunnable;
struct pcred;
int dosetrlimit (struct proc *, struct pcred *, int, struct rlimit *) ;
int donice (struct proc *, struct proc *, int) ;
# 138 "/sys/sys/resource.h"
# 123 "/sys/sys/param.h" 2
# 1 "/sys/sys/ucred.h" 1
struct ucred {
u_short cr_ref;
uid_t cr_uid;
gid_t cr_gid;
short cr_ngroups;
gid_t cr_groups[16 ];
};
struct ucred *crcopy (struct ucred *cr) ;
struct ucred *crdup (struct ucred *cr) ;
void crfree (struct ucred *cr) ;
struct ucred *crget (void) ;
int suser (struct ucred *cred, u_short *acflag) ;
# 124 "/sys/sys/param.h" 2
# 1 "/sys/sys/uio.h" 1
struct iovec {
void *iov_base;
size_t iov_len;
};
enum uio_rw { UIO_READ, UIO_WRITE };
enum uio_seg {
UIO_USERSPACE,
UIO_SYSSPACE
};
struct uio {
struct iovec *uio_iov;
int uio_iovcnt;
__off_t uio_offset;
size_t uio_resid;
enum uio_seg uio_segflg;
enum uio_rw uio_rw;
struct proc *uio_procp;
};
# 89 "/sys/sys/uio.h"
int ureadc (int c, struct uio *) ;
# 125 "/sys/sys/param.h" 2
# 1 "/sys/sys/signal.h" 1
typedef unsigned int sigset13_t;
struct sigaction13 {
void (*sa_handler)
(int) ;
sigset13_t sa_mask;
int sa_flags;
};
typedef struct {
u_int32_t __bits[4];
} sigset_t;
struct sigaction {
void (*sa_handler)
(int) ;
sigset_t sa_mask;
int sa_flags;
};
typedef void (*sig_t) (int) ;
struct sigaltstack13 {
char *ss_sp;
int ss_size;
int ss_flags;
};
typedef struct
sigaltstack
{
void *ss_sp;
size_t ss_size;
int ss_flags;
} stack_t;
struct sigvec {
void (*sv_handler)
(int) ;
int sv_mask;
int sv_flags;
};
struct sigstack {
void *ss_sp;
int ss_onstack;
};
# 1 "/usr/include/machine/signal.h" 1 3
# 1 "/usr/include/powerpc/signal.h" 1 3
typedef int sig_atomic_t;
# 1 "/usr/include/machine/frame.h" 1 3
# 1 "/usr/include/powerpc/frame.h" 1 3
# 1 "/usr/include/machine/types.h" 1 3
# 36 "/usr/include/powerpc/frame.h" 2 3
struct trapframe {
register_t fixreg[32];
register_t lr;
int cr;
int xer;
register_t ctr;
register_t srr0;
register_t srr1;
register_t dar;
int dsisr;
int exc;
};
struct switchframe {
register_t sp;
int fill;
int user_sr;
int cr;
register_t fixreg2;
register_t fixreg[19];
};
struct clockframe {
register_t srr1;
register_t srr0;
int pri;
int depth;
};
struct callframe {
register_t sp;
register_t lr;
register_t r30;
register_t r31;
};
# 3 "/usr/include/machine/frame.h" 2 3
# 40 "/usr/include/powerpc/signal.h" 2 3
struct sigcontext13 {
int sc_onstack;
int sc_mask;
struct trapframe sc_frame;
};
struct sigcontext {
int sc_onstack;
int __sc_mask13;
struct trapframe sc_frame;
sigset_t sc_mask;
};
struct sigframe {
int sf_signum;
int sf_code;
struct sigcontext sf_sc;
};
# 3 "/usr/include/machine/signal.h" 2 3
# 286 "/sys/sys/signal.h" 2
# 296 "/sys/sys/signal.h"
void (*signal (int, void (*) (int) ) ) (int) ;
# 139 "/sys/sys/param.h" 2
# 1 "/usr/include/machine/param.h" 1 3
# 1 "/usr/include/machine/cpu.h" 1 3
# 1 "/usr/include/machine/frame.h" 1 3
# 41 "/usr/include/machine/cpu.h" 2 3
# 1 "/usr/include/machine/psl.h" 1 3
# 1 "/usr/include/powerpc/psl.h" 1 3
# 3 "/usr/include/machine/psl.h" 2 3
# 42 "/usr/include/machine/cpu.h" 2 3
# 1 "/usr/include/machine/intr.h" 1 3
struct intrhand {
int (*ih_fun) (void *) ;
void *ih_arg;
u_long ih_count;
struct intrhand *ih_next;
int ih_level;
int ih_irq;
};
void setsoftclock (void) ;
void clearsoftclock (void) ;
int splsoftclock (void) ;
void setsoftnet (void) ;
void clearsoftnet (void) ;
int splsoftnet (void) ;
void do_pending_int (void) ;
static __inline int splraise (int) ;
static __inline int spllower (int) ;
static __inline void splx (int) ;
static __inline void softintr (int) ;
extern volatile int cpl, ipending, astpending, tickspending;
extern int imask[];
static __inline int
splraise(ncpl)
int ncpl;
{
int ocpl;
__asm__ volatile("sync; eieio\n");
ocpl = cpl;
cpl = ocpl | ncpl;
__asm__ volatile("sync; eieio\n");
return (ocpl);
}
static __inline void
splx(ncpl)
int ncpl;
{
__asm__ volatile("sync; eieio\n");
cpl = ncpl;
if (ipending & ~ncpl)
do_pending_int();
__asm__ volatile("sync; eieio\n");
}
static __inline int
spllower(ncpl)
int ncpl;
{
int ocpl;
__asm__ volatile("sync; eieio\n");
ocpl = cpl;
cpl = ncpl;
if (ipending & ~ncpl)
do_pending_int();
__asm__ volatile("sync; eieio\n");
return (ocpl);
}
static __inline void
softintr(ipl)
int ipl;
{
int msrsave;
__asm__ volatile("mfmsr %0" : "=r"(msrsave));
__asm__ volatile("mtmsr %0" :: "r"(msrsave & ~0x00008000 ));
ipending |= 1 << ipl;
__asm__ volatile("mtmsr %0" :: "r"(msrsave));
}
extern long intrcnt[];
# 43 "/usr/include/machine/cpu.h" 2 3
# 1 "/sys/sys/sched.h" 1
struct slpque {
struct proc *sq_head;
struct proc **sq_tailp;
};
struct prochd {
struct proc *ph_link;
struct proc *ph_rlink;
};
struct schedstate_percpu {
struct timeval spc_runtime;
volatile int spc_flags;
u_int spc_schedticks;
u_int64_t spc_cp_time[5 ];
u_char spc_curpriority;
};
int schedhz;
extern struct prochd sched_qs[];
extern struct slpque sched_slpque[];
extern volatile u_int32_t sched_whichqs;
struct proc;
void schedclock (struct proc *p) ;
# 46 "/usr/include/machine/cpu.h" 2 3
struct cpu_info {
struct schedstate_percpu ci_schedstate;
struct proc *ci_curproc;
struct pcb *ci_curpcb;
struct pmap *ci_curpm;
struct proc *ci_fpuproc;
struct pcb *ci_idle_pcb;
int ci_cpuid;
};
# 81 "/usr/include/machine/cpu.h" 3
extern struct cpu_info cpu_info_store;
extern void delay (unsigned) ;
extern volatile int want_resched;
extern volatile int astpending;
extern char bootpath[];
# 1 "/usr/include/powerpc/cpu.h" 1 3
extern void __syncicache (void *, int) ;
# 115 "/usr/include/machine/cpu.h" 2 3
# 36 "/usr/include/machine/param.h" 2 3
# 142 "/sys/sys/param.h" 2
# 1 "/usr/include/machine/limits.h" 1 3
# 1 "/usr/include/powerpc/limits.h" 1 3
# 3 "/usr/include/machine/limits.h" 2 3
# 143 "/sys/sys/param.h" 2
# 39 "miscmod.c" 2
# 1 "/sys/sys/ioctl.h" 1
# 1 "/sys/sys/ttycom.h" 1
# 1 "/sys/sys/ioccom.h" 1
# 46 "/sys/sys/ttycom.h" 2
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
# 46 "/sys/sys/ioctl.h" 2
struct ttysize {
unsigned short ts_lines;
unsigned short ts_cols;
unsigned short ts_xxx;
unsigned short ts_yyy;
};
# 1 "/sys/sys/dkio.h" 1
# 64 "/sys/sys/ioctl.h" 2
# 1 "/sys/sys/filio.h" 1
# 65 "/sys/sys/ioctl.h" 2
# 1 "/sys/sys/sockio.h" 1
# 66 "/sys/sys/ioctl.h" 2
# 40 "miscmod.c" 2
# 1 "/sys/sys/systm.h" 1
# 1 "/usr/include/machine/endian.h" 1 3
# 78 "/sys/sys/systm.h" 2
struct clockframe;
struct device;
struct proc;
struct timeval;
struct tty;
struct uio;
struct vnode;
extern int securelevel;
extern const char *panicstr;
extern int doing_shutdown;
extern const char copyright[];
extern char cpu_model[];
extern char machine[];
extern char machine_arch[];
extern const char osrelease[];
extern const char ostype[];
extern const char version[];
extern int autonicetime;
extern int autoniceval;
extern int nblkdev;
extern int nchrdev;
extern int selwait;
extern int maxmem;
extern int physmem;
extern dev_t dumpdev;
extern long dumplo;
extern int dumpsize;
extern const char *dumpspec;
extern dev_t rootdev;
extern struct vnode *rootvp;
extern struct device *root_device;
extern const char *rootspec;
extern dev_t swapdev;
extern struct vnode *swapdev_vp;
typedef int sy_call_t (struct proc *, void *, register_t *) ;
extern struct sysent {
short sy_narg;
short sy_argsize;
sy_call_t *sy_call;
} sysent[];
extern int nsysent;
extern int boothowto;
extern void (*v_putc) (int) ;
extern void _insque (void *, void *) ;
extern void _remque (void *) ;
int nullop (void *) ;
int enodev (void) ;
int enosys (void) ;
int enoioctl (void) ;
int enxio (void) ;
int eopnotsupp (void) ;
int lkmenodev (void) ;
int seltrue (dev_t dev, int events, struct proc *p) ;
void *hashinit (int count, int type, int flags, u_long *hashmask) ;
void hashdone (void *hashtbl, int type) ;
int sys_nosys (struct proc *, void *, register_t *) ;
void printf (const char *, ...)
__attribute__((__format__(__printf__,1,2)));
int sprintf (char *buf, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
int snprintf (char *buf, size_t, const char *, ...)
__attribute__((__format__(__printf__,3,4)));
void vprintf (const char *, __va_list ) ;
int vsprintf (char *buf, const char *, __va_list ) ;
int vsnprintf (char *buf, size_t, const char *, __va_list ) ;
void panic (const char *, ...)
__attribute__((__noreturn__,__format__(__printf__,1,2)));
void uprintf (const char *, ...)
__attribute__((__format__(__printf__,1,2)));
void ttyprintf (struct tty *, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
char *bitmask_snprintf (u_quad_t, const char *, char *, size_t) ;
int humanize_number (char *, size_t, u_int64_t, const char *, int) ;
int format_bytes (char *, size_t, u_int64_t) ;
void tablefull (const char *, const char *) ;
int kcopy (const void *, void *, size_t) ;
int copystr (const void *, void *, size_t, size_t *) ;
int copyinstr (const void *, void *, size_t, size_t *) ;
int copyoutstr (const void *, void *, size_t, size_t *) ;
int copyin (const void *, void *, size_t) ;
int copyout (const void *, void *, size_t) ;
int subyte (void *, int) ;
int suibyte (void *, int) ;
int susword (void *, short) ;
int suisword (void *, short) ;
int suswintr (void *, short) ;
int suword (void *, long) ;
int suiword (void *, long) ;
int fubyte (const void *) ;
int fuibyte (const void *) ;
int fusword (const void *) ;
int fuisword (const void *) ;
int fuswintr (const void *) ;
long fuword (const void *) ;
long fuiword (const void *) ;
int hzto (struct timeval *tv) ;
void realitexpire (void *) ;
void hardclock (struct clockframe *frame) ;
void softclock (void) ;
void statclock (struct clockframe *frame) ;
void initclocks (void) ;
void inittodr (time_t) ;
void resettodr (void) ;
void cpu_initclocks (void) ;
void startprofclock (struct proc *) ;
void stopprofclock (struct proc *) ;
void setstatclockrate (int hzrate) ;
void *shutdownhook_establish (void (*)(void *), void *) ;
void shutdownhook_disestablish (void *) ;
void doshutdownhooks (void) ;
void *powerhook_establish (void (*)(int, void *), void *) ;
void powerhook_disestablish (void *) ;
void dopowerhooks (int) ;
void *mountroothook_establish (void (*)(struct device *),
struct device *) ;
void mountroothook_disestablish (void *) ;
void mountroothook_destroy (void) ;
void domountroothook (void) ;
void *exechook_establish (void (*)(struct proc *, void *), void *) ;
void exechook_disestablish (void *) ;
void doexechooks (struct proc *) ;
int uiomove (void *, int, struct uio *) ;
caddr_t allocsys (caddr_t, caddr_t (*)(caddr_t)) ;
int setjmp (label_t *) ;
void longjmp (label_t *) ;
void consinit (void) ;
void cpu_startup (void) ;
void cpu_configure (void) ;
void cpu_rootconf (void) ;
void cpu_dumpconf (void) ;
# 1 "/sys/lib/libkern/libkern.h" 1
static __inline int imax (int, int) __attribute__ ((unused));
static __inline int imin (int, int) __attribute__ ((unused));
static __inline u_int max (u_int, u_int) __attribute__ ((unused));
static __inline u_int min (u_int, u_int) __attribute__ ((unused));
static __inline long lmax (long, long) __attribute__ ((unused));
static __inline long lmin (long, long) __attribute__ ((unused));
static __inline u_long ulmax (u_long, u_long) __attribute__ ((unused));
static __inline u_long ulmin (u_long, u_long) __attribute__ ((unused));
static __inline int abs (int) __attribute__ ((unused));
static __inline int
imax(a, b)
int a, b;
{
return (a > b ? a : b);
}
static __inline int
imin(a, b)
int a, b;
{
return (a < b ? a : b);
}
static __inline long
lmax(a, b)
long a, b;
{
return (a > b ? a : b);
}
static __inline long
lmin(a, b)
long a, b;
{
return (a < b ? a : b);
}
static __inline u_int
max(a, b)
u_int a, b;
{
return (a > b ? a : b);
}
static __inline u_int
min(a, b)
u_int a, b;
{
return (a < b ? a : b);
}
static __inline u_long
ulmax(a, b)
u_long a, b;
{
return (a > b ? a : b);
}
static __inline u_long
ulmin(a, b)
u_long a, b;
{
return (a < b ? a : b);
}
static __inline int
abs(j)
int j;
{
return(j < 0 ? -j : j);
}
# 138 "/sys/lib/libkern/libkern.h"
# 150 "/sys/lib/libkern/libkern.h"
void __assert (const char *, const char *, int, const char *)
__attribute__((__noreturn__));
int bcmp (const void *, const void *, size_t) ;
void bzero (void *, size_t) ;
int ffs (int) ;
u_int32_t
inet_addr (const char *) ;
char *intoa (u_int32_t) ;
void *memchr (const void *, int, size_t) ;
int memcmp (const void *, const void *, size_t) ;
void *memcpy (void *, const void *, size_t) ;
void *memmove (void *, const void *, size_t) ;
void *memset (void *, int, size_t) ;
int pmatch (const char *, const char *, const char **) ;
u_long random (void) ;
int scanc (u_int, const u_char *, const u_char *, int) ;
int skpc (int, size_t, u_char *) ;
char *strcat (char *, const char *) ;
char *strchr (const char *, int) ;
int strcmp (const char *, const char *) ;
char *strcpy (char *, const char *) ;
size_t strlen (const char *) ;
int strncasecmp (const char *, const char *, size_t) ;
int strncmp (const char *, const char *, size_t) ;
char *strncpy (char *, const char *, size_t) ;
char *strrchr (const char *, int) ;
u_long strtoul (const char *, char **, int) ;
# 312 "/sys/sys/systm.h" 2
# 41 "miscmod.c" 2
# 1 "/sys/sys/conf.h" 1
struct buf;
struct proc;
struct tty;
struct uio;
struct vnode;
struct bdevsw {
int (*d_open) (dev_t dev, int oflags, int devtype,
struct proc *p) ;
int (*d_close) (dev_t dev, int fflag, int devtype,
struct proc *p) ;
void (*d_strategy) (struct buf *bp) ;
int (*d_ioctl) (dev_t dev, u_long cmd, caddr_t data,
int fflag, struct proc *p) ;
int (*d_dump) (dev_t dev, daddr_t blkno, caddr_t va,
size_t size) ;
int (*d_psize) (dev_t dev) ;
int d_type;
};
extern struct bdevsw bdevsw[];
struct cdevsw {
int (*d_open) (dev_t dev, int oflags, int devtype,
struct proc *p) ;
int (*d_close) (dev_t dev, int fflag, int devtype,
struct proc *) ;
int (*d_read) (dev_t dev, struct uio *uio, int ioflag) ;
int (*d_write) (dev_t dev, struct uio *uio, int ioflag) ;
int (*d_ioctl) (dev_t dev, u_long cmd, caddr_t data,
int fflag, struct proc *p) ;
void (*d_stop) (struct tty *tp, int rw) ;
struct tty *
(*d_tty) (dev_t dev) ;
int (*d_poll) (dev_t dev, int events, struct proc *p) ;
paddr_t (*d_mmap) (dev_t, __off_t , int) ;
int d_type;
};
extern struct cdevsw cdevsw[];
extern const char devopn[], devio[], devwait[], devin[], devout[];
extern const char devioc[], devcls[];
struct linesw {
int (*l_open) (dev_t dev, struct tty *tp) ;
int (*l_close) (struct tty *tp, int flags) ;
int (*l_read) (struct tty *tp, struct uio *uio,
int flag) ;
int (*l_write) (struct tty *tp, struct uio *uio,
int flag) ;
int (*l_ioctl) (struct tty *tp, u_long cmd, caddr_t data,
int flag, struct proc *p) ;
int (*l_rint) (int c, struct tty *tp) ;
int (*l_start) (struct tty *tp) ;
int (*l_modem) (struct tty *tp, int flag) ;
};
extern struct linesw linesw[];
struct swdevt {
dev_t sw_dev;
int sw_flags;
int sw_nblks;
struct vnode *sw_vp;
};
extern struct swdevt swdevt[];
dev_t chrtoblk (dev_t) ;
int iskmemdev (dev_t) ;
int iszerodev (dev_t) ;
int cnopen (dev_t, int, int, struct proc *) ; int cnclose (dev_t, int, int, struct proc *) ; int cnread (dev_t, struct uio *, int) ; int cnwrite (dev_t, struct uio *, int) ; int cnioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void cnstop (struct tty *, int) ; struct tty * cntty (dev_t) ; int cnpoll (dev_t, int, struct proc *) ; paddr_t cnmmap (dev_t, __off_t , int) ;
int cttyopen (dev_t, int, int, struct proc *) ; int cttyclose (dev_t, int, int, struct proc *) ; int cttyread (dev_t, struct uio *, int) ; int cttywrite (dev_t, struct uio *, int) ; int cttyioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void cttystop (struct tty *, int) ; struct tty * cttytty (dev_t) ; int cttypoll (dev_t, int, struct proc *) ; paddr_t cttymmap (dev_t, __off_t , int) ;
int ptcopen (dev_t, int, int, struct proc *) ; int ptcclose (dev_t, int, int, struct proc *) ; int ptcread (dev_t, struct uio *, int) ; int ptcwrite (dev_t, struct uio *, int) ; int ptyioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void ptcstop (struct tty *, int) ; struct tty * ptytty (dev_t) ; int ptcpoll (dev_t, int, struct proc *) ; paddr_t ptcmmap (dev_t, __off_t , int) ;
int ptsopen (dev_t, int, int, struct proc *) ; int ptsclose (dev_t, int, int, struct proc *) ; int ptsread (dev_t, struct uio *, int) ; int ptswrite (dev_t, struct uio *, int) ; int ptyioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void ptsstop (struct tty *, int) ; struct tty * ptytty (dev_t) ; int ptspoll (dev_t, int, struct proc *) ; paddr_t ptsmmap (dev_t, __off_t , int) ;
int ccdopen (dev_t, int, int, struct proc *) ; int ccdclose (dev_t, int, int, struct proc *) ; void ccdstrategy (struct buf *) ; int ccdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int ccddump (dev_t, daddr_t, caddr_t, size_t) ; int ccdsize (dev_t) ;
int ccdopen (dev_t, int, int, struct proc *) ; int ccdclose (dev_t, int, int, struct proc *) ; int ccdread (dev_t, struct uio *, int) ; int ccdwrite (dev_t, struct uio *, int) ; int ccdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void ccdstop (struct tty *, int) ; struct tty * ccdtty (dev_t) ; int ccdpoll (dev_t, int, struct proc *) ; paddr_t ccdmmap (dev_t, __off_t , int) ;
int mdopen (dev_t, int, int, struct proc *) ; int mdclose (dev_t, int, int, struct proc *) ; void mdstrategy (struct buf *) ; int mdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int mddump (dev_t, daddr_t, caddr_t, size_t) ; int mdsize (dev_t) ;
int mdopen (dev_t, int, int, struct proc *) ; int mdclose (dev_t, int, int, struct proc *) ; int mdread (dev_t, struct uio *, int) ; int mdwrite (dev_t, struct uio *, int) ; int mdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void mdstop (struct tty *, int) ; struct tty * mdtty (dev_t) ; int mdpoll (dev_t, int, struct proc *) ; paddr_t mdmmap (dev_t, __off_t , int) ;
int raidopen (dev_t, int, int, struct proc *) ; int raidclose (dev_t, int, int, struct proc *) ; void raidstrategy (struct buf *) ; int raidioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int raiddump (dev_t, daddr_t, caddr_t, size_t) ; int raidsize (dev_t) ;
int raidopen (dev_t, int, int, struct proc *) ; int raidclose (dev_t, int, int, struct proc *) ; int raidread (dev_t, struct uio *, int) ; int raidwrite (dev_t, struct uio *, int) ; int raidioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void raidstop (struct tty *, int) ; struct tty * raidtty (dev_t) ; int raidpoll (dev_t, int, struct proc *) ; paddr_t raidmmap (dev_t, __off_t , int) ;
int vndopen (dev_t, int, int, struct proc *) ; int vndclose (dev_t, int, int, struct proc *) ; void vndstrategy (struct buf *) ; int vndioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int vnddump (dev_t, daddr_t, caddr_t, size_t) ; int vndsize (dev_t) ;
int vndopen (dev_t, int, int, struct proc *) ; int vndclose (dev_t, int, int, struct proc *) ; int vndread (dev_t, struct uio *, int) ; int vndwrite (dev_t, struct uio *, int) ; int vndioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void vndstop (struct tty *, int) ; struct tty * vndtty (dev_t) ; int vndpoll (dev_t, int, struct proc *) ; paddr_t vndmmap (dev_t, __off_t , int) ;
int cdopen (dev_t, int, int, struct proc *) ; int cdclose (dev_t, int, int, struct proc *) ; void cdstrategy (struct buf *) ; int cdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int cddump (dev_t, daddr_t, caddr_t, size_t) ; int cdsize (dev_t) ;
int cdopen (dev_t, int, int, struct proc *) ; int cdclose (dev_t, int, int, struct proc *) ; int cdread (dev_t, struct uio *, int) ; int cdwrite (dev_t, struct uio *, int) ; int cdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void cdstop (struct tty *, int) ; struct tty * cdtty (dev_t) ; int cdpoll (dev_t, int, struct proc *) ; paddr_t cdmmap (dev_t, __off_t , int) ;
int chopen (dev_t, int, int, struct proc *) ; int chclose (dev_t, int, int, struct proc *) ; int chread (dev_t, struct uio *, int) ; int chwrite (dev_t, struct uio *, int) ; int chioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void chstop (struct tty *, int) ; struct tty * chtty (dev_t) ; int chpoll (dev_t, int, struct proc *) ; paddr_t chmmap (dev_t, __off_t , int) ;
int sdopen (dev_t, int, int, struct proc *) ; int sdclose (dev_t, int, int, struct proc *) ; void sdstrategy (struct buf *) ; int sdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int sddump (dev_t, daddr_t, caddr_t, size_t) ; int sdsize (dev_t) ;
int sdopen (dev_t, int, int, struct proc *) ; int sdclose (dev_t, int, int, struct proc *) ; int sdread (dev_t, struct uio *, int) ; int sdwrite (dev_t, struct uio *, int) ; int sdioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void sdstop (struct tty *, int) ; struct tty * sdtty (dev_t) ; int sdpoll (dev_t, int, struct proc *) ; paddr_t sdmmap (dev_t, __off_t , int) ;
int seopen (dev_t, int, int, struct proc *) ; int seclose (dev_t, int, int, struct proc *) ; int seioctl (dev_t, u_long, caddr_t, int, struct proc *) ;
int stopen (dev_t, int, int, struct proc *) ; int stclose (dev_t, int, int, struct proc *) ; void ststrategy (struct buf *) ; int stioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int stdump (dev_t, daddr_t, caddr_t, size_t) ; int stsize (dev_t) ;
int stopen (dev_t, int, int, struct proc *) ; int stclose (dev_t, int, int, struct proc *) ; int stread (dev_t, struct uio *, int) ; int stwrite (dev_t, struct uio *, int) ; int stioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void ststop (struct tty *, int) ; struct tty * sttty (dev_t) ; int stpoll (dev_t, int, struct proc *) ; paddr_t stmmap (dev_t, __off_t , int) ;
int ssopen (dev_t, int, int, struct proc *) ; int ssclose (dev_t, int, int, struct proc *) ; void ssstrategy (struct buf *) ; int ssioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int ssdump (dev_t, daddr_t, caddr_t, size_t) ; int sssize (dev_t) ;
int ssopen (dev_t, int, int, struct proc *) ; int ssclose (dev_t, int, int, struct proc *) ; int ssread (dev_t, struct uio *, int) ; int sswrite (dev_t, struct uio *, int) ; int ssioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void ssstop (struct tty *, int) ; struct tty * sstty (dev_t) ; int sspoll (dev_t, int, struct proc *) ; paddr_t ssmmap (dev_t, __off_t , int) ;
int ukopen (dev_t, int, int, struct proc *) ; int ukclose (dev_t, int, int, struct proc *) ; void ukstrategy (struct buf *) ; int ukioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int ukdump (dev_t, daddr_t, caddr_t, size_t) ; int uksize (dev_t) ;
int ukopen (dev_t, int, int, struct proc *) ; int ukclose (dev_t, int, int, struct proc *) ; int ukread (dev_t, struct uio *, int) ; int ukwrite (dev_t, struct uio *, int) ; int ukioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void ukstop (struct tty *, int) ; struct tty * uktty (dev_t) ; int ukpoll (dev_t, int, struct proc *) ; paddr_t ukmmap (dev_t, __off_t , int) ;
int caopen (dev_t, int, int, struct proc *) ; int caclose (dev_t, int, int, struct proc *) ; void castrategy (struct buf *) ; int caioctl (dev_t, u_long, caddr_t, int, struct proc *) ; int cadump (dev_t, daddr_t, caddr_t, size_t) ; int casize (dev_t) ;
int caopen (dev_t, int, int, struct proc *) ; int caclose (dev_t, int, int, struct proc *) ; int caread (dev_t, struct uio *, int) ; int cawrite (dev_t, struct uio *, int) ; int caioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void castop (struct tty *, int) ; struct tty * catty (dev_t) ; int capoll (dev_t, int, struct proc *) ; paddr_t cammap (dev_t, __off_t , int) ;
int bktropen (dev_t, int, int, struct proc *) ; int bktrclose (dev_t, int, int, struct proc *) ; int bktrread (dev_t, struct uio *, int) ; int bktrwrite (dev_t, struct uio *, int) ; int bktrioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void bktrstop (struct tty *, int) ; struct tty * bktrtty (dev_t) ; int bktrpoll (dev_t, int, struct proc *) ; paddr_t bktrmmap (dev_t, __off_t , int) ;
int bpfopen (dev_t, int, int, struct proc *) ; int bpfclose (dev_t, int, int, struct proc *) ; int bpfread (dev_t, struct uio *, int) ; int bpfwrite (dev_t, struct uio *, int) ; int bpfioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void bpfstop (struct tty *, int) ; struct tty * bpftty (dev_t) ; int bpfpoll (dev_t, int, struct proc *) ; paddr_t bpfmmap (dev_t, __off_t , int) ;
int iplopen (dev_t, int, int, struct proc *) ; int iplclose (dev_t, int, int, struct proc *) ; int iplread (dev_t, struct uio *, int) ; int iplwrite (dev_t, struct uio *, int) ; int iplioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void iplstop (struct tty *, int) ; struct tty * ipltty (dev_t) ; int iplpoll (dev_t, int, struct proc *) ; paddr_t iplmmap (dev_t, __off_t , int) ;
int svr4_netopen (dev_t, int, int, struct proc *) ; int svr4_netclose (dev_t, int, int, struct proc *) ; int svr4_netread (dev_t, struct uio *, int) ; int svr4_netwrite (dev_t, struct uio *, int) ; int svr4_netioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void svr4_netstop (struct tty *, int) ; struct tty * svr4_nettty (dev_t) ; int svr4_netpoll (dev_t, int, struct proc *) ; paddr_t svr4_netmmap (dev_t, __off_t , int) ;
int tunopen (dev_t, int, int, struct proc *) ; int tunclose (dev_t, int, int, struct proc *) ; int tunread (dev_t, struct uio *, int) ; int tunwrite (dev_t, struct uio *, int) ; int tunioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void tunstop (struct tty *, int) ; struct tty * tuntty (dev_t) ; int tunpoll (dev_t, int, struct proc *) ; paddr_t tunmmap (dev_t, __off_t , int) ;
int audioopen (dev_t, int, int, struct proc *) ; int audioclose (dev_t, int, int, struct proc *) ; int audioread (dev_t, struct uio *, int) ; int audiowrite (dev_t, struct uio *, int) ; int audioioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void audiostop (struct tty *, int) ; struct tty * audiotty (dev_t) ; int audiopoll (dev_t, int, struct proc *) ; paddr_t audiommap (dev_t, __off_t , int) ;
int midiopen (dev_t, int, int, struct proc *) ; int midiclose (dev_t, int, int, struct proc *) ; int midiread (dev_t, struct uio *, int) ; int midiwrite (dev_t, struct uio *, int) ; int midiioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void midistop (struct tty *, int) ; struct tty * miditty (dev_t) ; int midipoll (dev_t, int, struct proc *) ; paddr_t midimmap (dev_t, __off_t , int) ;
int sequenceropen (dev_t, int, int, struct proc *) ; int sequencerclose (dev_t, int, int, struct proc *) ; int sequencerread (dev_t, struct uio *, int) ; int sequencerwrite (dev_t, struct uio *, int) ; int sequencerioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void sequencerstop (struct tty *, int) ; struct tty * sequencertty (dev_t) ; int sequencerpoll (dev_t, int, struct proc *) ; paddr_t sequencermmap (dev_t, __off_t , int) ;
int filedescopen (dev_t, int, int, struct proc *) ; int filedescclose (dev_t, int, int, struct proc *) ; int filedescread (dev_t, struct uio *, int) ; int filedescwrite (dev_t, struct uio *, int) ; int filedescioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void filedescstop (struct tty *, int) ; struct tty * filedesctty (dev_t) ; int filedescpoll (dev_t, int, struct proc *) ; paddr_t filedescmmap (dev_t, __off_t , int) ;
int lkmopen (dev_t, int, int, struct proc *) ; int lkmclose (dev_t, int, int, struct proc *) ; int lkmread (dev_t, struct uio *, int) ; int lkmwrite (dev_t, struct uio *, int) ; int lkmioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void lkmstop (struct tty *, int) ; struct tty * lkmtty (dev_t) ; int lkmpoll (dev_t, int, struct proc *) ; paddr_t lkmmmap (dev_t, __off_t , int) ;
int logopen (dev_t, int, int, struct proc *) ; int logclose (dev_t, int, int, struct proc *) ; int logread (dev_t, struct uio *, int) ; int logwrite (dev_t, struct uio *, int) ; int logioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void logstop (struct tty *, int) ; struct tty * logtty (dev_t) ; int logpoll (dev_t, int, struct proc *) ; paddr_t logmmap (dev_t, __off_t , int) ;
int rndopen (dev_t, int, int, struct proc *) ; int rndclose (dev_t, int, int, struct proc *) ; int rndread (dev_t, struct uio *, int) ; int rndwrite (dev_t, struct uio *, int) ; int rndioctl (dev_t, u_long, caddr_t, int, struct proc *) ; void rndstop (struct tty *, int) ; struct tty * rndtty (dev_t) ; int rndpoll (dev_t, int, struct proc *) ; paddr_t rndmmap (dev_t, __off_t , int) ;
struct devnametobdevmaj {
const char *d_name;
int d_maj;
};
extern struct devnametobdevmaj dev_name2blk[];
struct device;
void setroot (struct device *, int) ;
void swapconf (void) ;
# 42 "miscmod.c" 2
# 1 "/sys/sys/mount.h" 1
# 1 "/sys/sys/queue.h" 1
# 210 "/sys/sys/queue.h"
# 306 "/sys/sys/queue.h"
# 323 "/sys/sys/queue.h"
# 397 "/sys/sys/queue.h"
# 407 "/sys/sys/queue.h"
# 417 "/sys/sys/queue.h"
# 427 "/sys/sys/queue.h"
# 440 "/sys/sys/queue.h"
# 47 "/sys/sys/mount.h" 2
# 1 "/sys/sys/lock.h" 1
# 1 "/usr/include/machine/lock.h" 1 3
# 1 "/usr/include/powerpc/lock.h" 1 3
typedef volatile int __cpu_simple_lock_t;
static __inline void
__cpu_simple_lock_init(__cpu_simple_lock_t *alp)
{
*alp = 0 ;
__asm volatile ("sync");
}
static __inline void
__cpu_simple_lock(__cpu_simple_lock_t *alp)
{
int old;
__asm volatile (" \n1: lwarx %0,0,%1 \n cmpwi %0,%2 \n beq+ 3f \n2: lwzx %0,0,%1 \n cmpwi %0,%2 \n beq+ 1b \n b 2b \n3: stwcx. %3,0,%1 \n bne- 1b \n isync \n \n"
# 76 "/usr/include/powerpc/lock.h" 3
: "=&r"(old)
: "r"(alp), "I"(0 ), "r"(1 )
: "memory");
}
static __inline int
__cpu_simple_lock_try(__cpu_simple_lock_t *alp)
{
int old, dummy;
__asm volatile (" \n1: lwarx %0,0,%1 \n cmpwi %0,%2 \n bne 2f \n stwcx. %3,0,%1 \n bne- 1b \n2: stwcx. %3,0,%4 \n isync \n \n"
# 96 "/usr/include/powerpc/lock.h" 3
: "=&r"(old)
: "r"(alp), "I"(0 ), "r"(1 ),
"r"(&dummy)
: "memory");
return (old == 0 );
}
static __inline void
__cpu_simple_unlock(__cpu_simple_lock_t *alp)
{
__asm volatile ("sync");
*alp = 0 ;
}
# 4 "/usr/include/machine/lock.h" 2 3
# 91 "/sys/sys/lock.h" 2
struct simplelock {
__cpu_simple_lock_t lock_data;
};
typedef struct simplelock simple_lock_data_t;
typedef struct simplelock *simple_lock_t;
typedef struct lock lock_data_t;
typedef struct lock *lock_t;
struct lock {
struct simplelock lk_interlock;
u_int lk_flags;
int lk_sharecount;
short lk_exclusivecount;
short lk_recurselevel;
int lk_waitcount;
const char *lk_wmesg;
union {
struct {
pid_t lk_sleep_lockholder;
int lk_sleep_prio;
int lk_sleep_timo;
} lk_un_sleep;
struct {
cpuid_t lk_spin_cpu;
} lk_un_spin;
} lk_un;
};
struct proc;
void lockinit(struct lock *, int prio, const char *wmesg, int timo,
int flags);
int lockmgr(volatile struct lock *, u_int flags, struct simplelock *);
int lockstatus(struct lock *);
void lockmgr_printinfo(volatile struct lock *);
# 310 "/sys/sys/lock.h"
# 48 "/sys/sys/mount.h" 2
typedef struct { int32_t val[2]; } fsid_t;
struct fid {
u_short fid_len;
u_short fid_reserved;
char fid_data[16 ];
};
struct statfs {
short f_type;
u_short f_oflags;
long f_bsize;
long f_iosize;
long f_blocks;
long f_bfree;
long f_bavail;
long f_files;
long f_ffree;
fsid_t f_fsid;
uid_t f_owner;
long f_flags;
long f_syncwrites;
long f_asyncwrites;
long f_spare[1];
char f_fstypename[16 ];
char f_mntonname[90 ];
char f_mntfromname[90 ];
};
struct vnodelst { struct vnode *lh_first; } ;
struct mount {
struct { struct mount *cqe_next; struct mount *cqe_prev; } mnt_list;
struct vfsops *mnt_op;
struct vnode *mnt_vnodecovered;
struct vnode *mnt_syncer;
struct vnodelst mnt_vnodelist;
struct lock mnt_lock;
int mnt_flag;
int mnt_maxsymlinklen;
struct statfs mnt_stat;
qaddr_t mnt_data;
int mnt_wcnt;
struct proc *mnt_unmounter;
};
# 257 "/sys/sys/mount.h"
# 288 "/sys/sys/mount.h"
struct nameidata;
struct mbuf;
struct vnodeopv_desc;
struct vfsops {
const char *vfs_name;
int (*vfs_mount) (struct mount *mp, const char *path,
void *data, struct nameidata *ndp,
struct proc *p) ;
int (*vfs_start) (struct mount *mp, int flags,
struct proc *p) ;
int (*vfs_unmount) (struct mount *mp, int mntflags,
struct proc *p) ;
int (*vfs_root) (struct mount *mp, struct vnode **vpp) ;
int (*vfs_quotactl) (struct mount *mp, int cmds, uid_t uid,
caddr_t arg, struct proc *p) ;
int (*vfs_statfs) (struct mount *mp, struct statfs *sbp,
struct proc *p) ;
int (*vfs_sync) (struct mount *mp, int waitfor,
struct ucred *cred, struct proc *p) ;
int (*vfs_vget) (struct mount *mp, ino_t ino,
struct vnode **vpp) ;
int (*vfs_fhtovp) (struct mount *mp, struct fid *fhp,
struct vnode **vpp) ;
int (*vfs_vptofh) (struct vnode *vp, struct fid *fhp) ;
void (*vfs_init) (void) ;
void (*vfs_done) (void) ;
int (*vfs_sysctl) (int *, u_int, void *, size_t *, void *,
size_t, struct proc *) ;
int (*vfs_mountroot) (void) ;
int (*vfs_checkexp) (struct mount *mp, struct mbuf *nam,
int *extflagsp, struct ucred **credanonp) ;
struct vnodeopv_desc **vfs_opv_descs;
int vfs_refcount;
struct { struct vfsops *le_next; struct vfsops **le_prev; } vfs_list;
};
struct fhandle {
fsid_t fh_fsid;
struct fid fh_fid;
};
typedef struct fhandle fhandle_t;
# 1 "/sys/net/radix.h" 1
struct radix_node {
struct radix_mask *rn_mklist;
struct radix_node *rn_p;
short rn_b;
char rn_bmask;
u_char rn_flags;
union {
struct {
caddr_t rn_Key;
caddr_t rn_Mask;
struct radix_node *rn_Dupedkey;
} rn_leaf;
struct {
int rn_Off;
struct radix_node *rn_L;
struct radix_node *rn_R;
} rn_node;
} rn_u;
};
extern struct radix_mask {
short rm_b;
char rm_unused;
u_char rm_flags;
struct radix_mask *rm_mklist;
union {
caddr_t rmu_mask;
struct radix_node *rmu_leaf;
} rm_rmu;
int rm_refs;
} *rn_mkfreelist;
struct radix_node_head {
struct radix_node *rnh_treetop;
int rnh_addrsize;
int rnh_pktsize;
struct radix_node *(*rnh_addaddr)
(void *v, void *mask,
struct radix_node_head *head, struct radix_node nodes[]) ;
struct radix_node *(*rnh_addpkt)
(void *v, void *mask,
struct radix_node_head *head, struct radix_node nodes[]) ;
struct radix_node *(*rnh_deladdr)
(void *v, void *mask, struct radix_node_head *head) ;
struct radix_node *(*rnh_delpkt)
(void *v, void *mask, struct radix_node_head *head) ;
struct radix_node *(*rnh_matchaddr)
(void *v, struct radix_node_head *head) ;
struct radix_node *(*rnh_lookup)
(void *v, void *mask, struct radix_node_head *head) ;
struct radix_node *(*rnh_matchpkt)
(void *v, struct radix_node_head *head) ;
int (*rnh_walktree)
(struct radix_node_head *,
int (*)(struct radix_node *, void *), void *) ;
struct radix_node rnh_nodes[3];
};
void rn_init (void) ;
int rn_inithead (void **, int) ;
int rn_refines (void *, void *) ;
int rn_walktree (struct radix_node_head *,
int (*)(struct radix_node *, void *), void *) ;
struct radix_node
*rn_addmask (void *, int, int) ,
*rn_addroute (void *, void *, struct radix_node_head *,
struct radix_node [2]) ,
*rn_delete (void *, void *, struct radix_node_head *) ,
*rn_insert (void *, struct radix_node_head *, int *,
struct radix_node [2]) ,
*rn_lookup (void *, void *, struct radix_node_head *) ,
*rn_match (void *, struct radix_node_head *) ,
*rn_newpair (void *, int, struct radix_node[2]) ,
*rn_search (void *, struct radix_node *) ,
*rn_search_m (void *, struct radix_node *, void *) ;
# 363 "/sys/sys/mount.h" 2
# 1 "/sys/sys/socket.h" 1
typedef __sa_family_t sa_family_t;
typedef __socklen_t socklen_t;
struct linger {
int l_onoff;
int l_linger;
};
struct sockaddr {
u_char sa_len;
__sa_family_t sa_family;
char sa_data[14];
};
struct sockproto {
u_short sp_family;
u_short sp_protocol;
};
struct sockaddr_storage {
u_char ss_len;
__sa_family_t ss_family;
char __ss_pad1[((sizeof(int64_t)) - sizeof(u_char) * 2) ];
int64_t __ss_align;
char __ss_pad2[(128 - sizeof(u_char) * 2 - ((sizeof(int64_t)) - sizeof(u_char) * 2) - (sizeof(int64_t)) ) ];
};
struct sockcred {
uid_t sc_uid;
uid_t sc_euid;
gid_t sc_gid;
gid_t sc_egid;
int sc_ngroups;
gid_t sc_groups[1];
};
# 338 "/sys/sys/socket.h"
struct msghdr {
void *msg_name;
__socklen_t msg_namelen;
struct iovec *msg_iov;
int msg_iovlen;
void *msg_control;
__socklen_t msg_controllen;
int msg_flags;
};
struct cmsghdr {
__socklen_t cmsg_len;
int cmsg_level;
int cmsg_type;
};
struct osockaddr {
u_short sa_family;
char sa_data[14];
};
struct omsghdr {
caddr_t msg_name;
int msg_namelen;
struct iovec *msg_iov;
int msg_iovlen;
caddr_t msg_accrights;
int msg_accrightslen;
};
int __cmsg_alignbytes (void) ;
# 502 "/sys/sys/socket.h"
# 364 "/sys/sys/mount.h" 2
struct netcred {
struct radix_node netc_rnodes[2];
int netc_exflags;
struct ucred netc_anon;
};
struct netexport {
struct netcred ne_defexported;
struct radix_node_head *ne_rtable[31 +1];
};
struct export_args {
int ex_flags;
uid_t ex_root;
struct ucred ex_anon;
struct sockaddr *ex_addr;
int ex_addrlen;
struct sockaddr *ex_mask;
int ex_masklen;
char *ex_indexfile;
};
struct nfs_public {
int np_valid;
fhandle_t np_handle;
struct mount *np_mount;
char *np_index;
};
struct mount *vfs_getvfs (fsid_t *) ;
int vfs_export
(struct mount *, struct netexport *, struct export_args *) ;
struct netcred *vfs_export_lookup
(struct mount *, struct netexport *, struct mbuf *) ;
int vfs_setpublicfs
(struct mount *, struct netexport *, struct export_args *) ;
int vfs_lock (struct mount *) ;
int vfs_mountedon (struct vnode *) ;
int vfs_mountroot (void) ;
void vfs_shutdown (void) ;
void vfs_unlock (struct mount *) ;
void vfs_unmountall (struct proc *) ;
int vfs_busy (struct mount *, int, struct simplelock *) ;
int vfs_rootmountalloc (char *, char *, struct mount **) ;
void vfs_unbusy (struct mount *) ;
int vfs_attach (struct vfsops *) ;
int vfs_detach (struct vfsops *) ;
struct vfsops *vfs_getopsbyname (const char *) ;
int vfs_sysctl (int *, u_int, void *, size_t *, void *, size_t,
struct proc *) ;
extern struct mntlist { struct mount *cqh_first; struct mount *cqh_last; } mountlist;
extern struct vfsops *vfssw[];
extern int nvfssw;
extern struct nfs_public nfs_pub;
extern struct simplelock mountlist_slock;
extern struct simplelock spechash_slock;
long makefstype (const char *) ;
int dounmount (struct mount *, int, struct proc *) ;
void vfsinit (void) ;
void vfs_opv_init (struct vnodeopv_desc **) ;
void vfs_opv_free (struct vnodeopv_desc **) ;
struct vfs_list_head { struct vfsops *lh_first; } ;
extern struct vfs_list_head vfs_list;
# 472 "/sys/sys/mount.h"
# 43 "miscmod.c" 2
# 1 "/sys/sys/exec.h" 1
struct ps_strings {
char **ps_argvstr;
int ps_nargvstr;
char **ps_envstr;
int ps_nenvstr;
};
struct proc;
struct exec_package;
typedef int (*exec_makecmds_fcn) (struct proc *, struct exec_package *) ;
struct execsw {
u_int es_hdrsz;
exec_makecmds_fcn es_check;
};
struct exec_vmcmd_set {
u_int evs_cnt;
u_int evs_used;
struct exec_vmcmd *evs_cmds;
};
struct exec_package {
const char *ep_name;
void *ep_hdr;
u_int ep_hdrlen;
u_int ep_hdrvalid;
struct nameidata *ep_ndp;
struct exec_vmcmd_set ep_vmcmds;
struct vnode *ep_vp;
struct vattr *ep_vap;
u_long ep_taddr;
u_long ep_tsize;
u_long ep_daddr;
u_long ep_dsize;
u_long ep_maxsaddr;
u_long ep_minsaddr;
u_long ep_ssize;
u_long ep_entry;
u_int ep_flags;
char **ep_fa;
int ep_fd;
struct emul *ep_emul;
void *ep_emul_arg;
};
struct exec_vmcmd {
int (*ev_proc) (struct proc *p, struct exec_vmcmd *cmd) ;
u_long ev_len;
u_long ev_addr;
struct vnode *ev_vp;
u_long ev_offset;
u_int ev_prot;
int ev_flags;
};
void kill_vmcmd (struct exec_vmcmd **) ;
int exec_makecmds (struct proc *, struct exec_package *) ;
int exec_runcmds (struct proc *, struct exec_package *) ;
void vmcmdset_extend (struct exec_vmcmd_set *) ;
void kill_vmcmds (struct exec_vmcmd_set *evsp) ;
int vmcmd_map_pagedvn (struct proc *, struct exec_vmcmd *) ;
int vmcmd_map_readvn (struct proc *, struct exec_vmcmd *) ;
int vmcmd_readvn (struct proc *, struct exec_vmcmd *) ;
int vmcmd_map_zero (struct proc *, struct exec_vmcmd *) ;
void *copyargs (struct exec_package *, struct ps_strings *,
void *, void *) ;
void setregs (struct proc *, struct exec_package *,
u_long) ;
int check_exec (struct proc *, struct exec_package *) ;
# 184 "/sys/sys/exec.h"
# 201 "/sys/sys/exec.h"
extern struct execsw execsw[];
extern int nexecs;
extern int exec_maxhdrsz;
# 1 "/sys/sys/exec_aout.h" 1
struct exec {
u_long a_midmag;
u_long a_text;
u_long a_data;
u_long a_bss;
u_long a_syms;
u_long a_entry;
u_long a_trsize;
u_long a_drsize;
};
# 1 "/usr/include/machine/aout_machdep.h" 1 3
# 1 "/usr/include/powerpc/aout_machdep.h" 1 3
# 1 "/usr/include/machine/reloc.h" 1 3
# 1 "/usr/include/powerpc/reloc.h" 1 3
enum reloc_type {
RELOC_NONE,
RELOC_32,
RELOC_24,
RELOC_16,
RELOC_16_LO,
RELOC_16_HI,
RELOC_16_HA,
RELOC_14,
RELOC_14_TAKEN,
RELOC_14_NTAKEN,
RELOC_REL24,
RELOC_REL14,
RELOC_REL14_TAKEN,
RELOC_REL14_NTAKEN,
RELOC_GOT16,
RELOC_GOT16_LO,
RELOC_GOT16_HI,
RELOC_GOT16_HA,
RELOC_PLT24,
RELOC_COPY,
RELOC_GLOB_DAT,
RELOC_JMP_SLOT,
RELOC_RELATIVE,
RELOC_LOCAL24PC,
RELOC_U32,
RELOC_U16,
RELOC_REL32,
RELOC_PLT32,
RELOC_PLTREL32,
RELOC_PLT16_LO,
RELOC_PLT16_HI,
RELOC_PLT16_HA,
RELOC_SDAREL,
RELOC_MAX
};
# 3 "/usr/include/machine/reloc.h" 2 3
# 36 "/usr/include/powerpc/aout_machdep.h" 2 3
struct relocation_info_ppc {
int r_address;
unsigned int r_symbolnum : 24,
r_extern : 1,
: 1;
enum reloc_type r_type : 6;
long r_addend;
};
# 3 "/usr/include/machine/aout_machdep.h" 2 3
# 178 "/sys/sys/exec_aout.h" 2
int exec_aout_makecmds (struct proc *, struct exec_package *) ;
int exec_aout_prep_zmagic (struct proc *, struct exec_package *) ;
int exec_aout_prep_nmagic (struct proc *, struct exec_package *) ;
int exec_aout_prep_omagic (struct proc *, struct exec_package *) ;
int exec_aout_setup_stack (struct proc *, struct exec_package *) ;
int exec_aout_prep_oldzmagic (struct proc *, struct exec_package *) ;
int exec_aout_prep_oldnmagic (struct proc *, struct exec_package *) ;
int exec_aout_prep_oldomagic (struct proc *, struct exec_package *) ;
int cpu_exec_aout_makecmds (struct proc *, struct exec_package *) ;
# 219 "/sys/sys/exec.h" 2
# 44 "miscmod.c" 2
# 1 "/sys/sys/lkm.h" 1
typedef enum loadmod {
LM_SYSCALL,
LM_VFS,
LM_DEV,
LM_STRMOD,
LM_EXEC,
LM_MISC
} MODTYPE;
struct lkm_syscall {
MODTYPE lkm_type;
int lkm_ver;
const char *lkm_name;
u_long lkm_offset;
struct sysent *lkm_sysent;
struct sysent lkm_oldent;
};
struct lkm_vfs {
MODTYPE lkm_type;
int lkm_ver;
const char *lkm_name;
u_long lkm_offset;
struct vfsops *lkm_vfsops;
};
typedef enum devtype {
LM_DT_BLOCK,
LM_DT_CHAR
} DEVTYPE;
struct lkm_dev {
MODTYPE lkm_type;
int lkm_ver;
const char *lkm_name;
u_long lkm_offset;
DEVTYPE lkm_devtype;
union {
void *anon;
struct bdevsw *bdev;
struct cdevsw *cdev;
} lkm_dev;
union {
struct bdevsw bdev;
struct cdevsw cdev;
} lkm_olddev;
};
struct lkm_strmod {
MODTYPE lkm_type;
int lkm_ver;
const char *lkm_name;
u_long lkm_offset;
};
struct lkm_exec {
MODTYPE lkm_type;
int lkm_ver;
const char *lkm_name;
u_long lkm_offset;
struct execsw *lkm_exec;
struct execsw lkm_oldexec;
};
struct lkm_misc {
MODTYPE lkm_type;
int lkm_ver;
char *lkm_name;
u_long lkm_offset;
};
struct lkm_any {
MODTYPE lkm_type;
int lkm_ver;
char *lkm_name;
u_long lkm_offset;
};
union lkm_generic {
struct lkm_any *lkm_any;
struct lkm_syscall *lkm_syscall;
struct lkm_vfs *lkm_vfs;
struct lkm_dev *lkm_dev;
struct lkm_strmod *lkm_strmod;
struct lkm_exec *lkm_exec;
struct lkm_misc *lkm_misc;
};
struct lkm_table {
int type;
u_long size;
u_long offset;
u_long area;
char used;
int ver;
int refcnt;
int depcnt;
int id;
int (*entry) (struct lkm_table *, int, int) ;
union lkm_generic private;
u_long syms;
u_long sym_size;
u_long sym_offset;
u_long sym_symsize;
};
# 233 "/sys/sys/lkm.h"
extern int lkm_nofunc (struct lkm_table *lkmtp, int cmd) ;
extern int lkmexists (struct lkm_table *) ;
extern int lkmdispatch (struct lkm_table *, int) ;
# 285 "/sys/sys/lkm.h"
struct lmc_resrv {
u_long size;
char *name;
int slot;
u_long addr;
u_long xxx_unused1;
u_long sym_size;
u_long xxx_unused2;
u_long sym_symsize;
u_long sym_addr;
};
struct lmc_oresrv {
u_long size;
char *name;
int slot;
u_long addr;
};
struct lmc_loadbuf {
int cnt;
char *data;
};
struct lmc_load {
caddr_t address;
int status;
int id;
};
struct lmc_unload {
int id;
char *name;
int status;
};
struct lmc_stat {
int id;
char name[32 ];
u_long offset;
MODTYPE type;
u_long area;
u_long size;
u_long private;
int ver;
};
# 45 "miscmod.c" 2
# 1 "/sys/sys/file.h" 1
# 1 "/sys/sys/fcntl.h" 1
struct flock {
__off_t l_start;
__off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
};
# 272 "/sys/sys/fcntl.h"
# 41 "/sys/sys/file.h" 2
# 1 "/sys/sys/unistd.h" 1
# 42 "/sys/sys/file.h" 2
struct proc;
struct uio;
struct iovec;
struct file {
struct { struct file *le_next; struct file **le_prev; } f_list;
int f_flag;
short f_type;
short f_count;
short f_msgcount;
short f_pad0;
struct ucred *f_cred;
struct fileops {
int (*fo_read) (struct file *fp, __off_t *offset,
struct uio *uio,
struct ucred *cred, int flags) ;
int (*fo_write) (struct file *fp, __off_t *offset,
struct uio *uio,
struct ucred *cred, int flags) ;
int (*fo_ioctl) (struct file *fp, u_long com,
caddr_t data, struct proc *p) ;
int (*fo_fcntl) (struct file *fp, u_int com,
caddr_t data, struct proc *p) ;
int (*fo_poll) (struct file *fp, int events,
struct proc *p) ;
int (*fo_close) (struct file *fp, struct proc *p) ;
} *f_ops;
__off_t f_offset;
caddr_t f_data;
int f_iflags;
int f_usecount;
};
# 114 "/sys/sys/file.h"
struct filelist { struct file *lh_first; } ;
extern struct filelist filehead;
extern int maxfiles;
extern int nfiles;
extern struct fileops vnops;
int dofileread (struct proc *, int, struct file *, void *, size_t,
__off_t *, int, register_t *) ;
int dofilewrite (struct proc *, int, struct file *, const void *,
size_t, __off_t *, int, register_t *) ;
int dofilereadv (struct proc *, int, struct file *,
const struct iovec *, int, __off_t *, int, register_t *) ;
int dofilewritev (struct proc *, int, struct file *,
const struct iovec *, int, __off_t *, int, register_t *) ;
void finit (void) ;
# 46 "miscmod.c" 2
# 1 "/sys/sys/syscall.h" 1
# 48 "miscmod.c" 2
# 1 "miscmod.h" 1
void *memcpy (void *, const void *, size_t) __attribute__((longcall)) ;
void printf (const char *, ...)
__attribute__((__format__(__printf__,1,2))) __attribute__((longcall)) ;
extern int lkm_nofunc (struct lkm_table *lkmtp, int cmd) __attribute__((longcall)) ;
extern int lkmexists (struct lkm_table *) __attribute__((longcall)) ;
extern int lkmdispatch (struct lkm_table *, int) __attribute__((longcall)) ;
# 50 "miscmod.c" 2
extern int misccall();
static struct sysent newent = {
0, 0, misccall
};
static struct sysent oldent;
static struct lkm_misc _module = { LM_MISC, 1 , "miscmod" };
static int
miscmod_handle( lkmtp, cmd)
struct lkm_table *lkmtp;
int cmd;
{
int i;
struct lkm_misc *args = lkmtp->private.lkm_misc;
int err = 0;
extern int sys_lkmnosys (struct proc *, void *, register_t *) ;
switch( cmd) {
case 1 :
if( lkmexists( lkmtp))
return( 17 );
for (i = 0; i < 306 ; i++)
if (sysent[i].sy_call == sys_lkmnosys)
break;
if (i == 306 ) {
err = 23 ;
break;
}
memcpy( &oldent , &sysent[ i] , sizeof( struct sysent) ) ;
memcpy( &sysent[ i] , &newent , sizeof( struct sysent) ) ;
args->lkm_offset = i;
printf( "\nSample Loaded miscellaneous module (system call)\n");
printf( "Copyright (c) 1993\n");
printf( "Terrence R. Lambert\n");
printf( "All rights reserved\n");
break;
case 2 :
i = args->lkm_offset;
memcpy( &sysent[ i] , &oldent , sizeof( struct sysent) ) ;
break;
default:
err = 22 ;
break;
}
return( err);
}
miscmod( lkmtp, cmd, ver)
struct lkm_table *lkmtp;
int cmd;
int ver;
{
if ( ver != 1 ) return 22 ; switch ( cmd ) { int error; case 1 : lkmtp ->private.lkm_any = (struct lkm_any *)&_module; if ((error = miscmod_handle ( lkmtp , cmd )) != 0) return error; break; case 2 : if ((error = miscmod_handle ( lkmtp , cmd )) != 0) return error; break; case 3 : if ((error = lkm_nofunc ( lkmtp , cmd )) != 0) return error; break; } return lkmdispatch( lkmtp , cmd );
}
--mP3DRpeJDSE+ciuQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="miscmod.s"
.file "miscmod.c"
gcc2_compiled.:
.section ".sdata","aw"
.align 2
.type newent,@object
.size newent,8
newent:
.short 0
.short 0
.long misccall
.section ".data"
.align 2
.type _module,@object
.size _module,16
_module:
.long 5
.long 1
.long .LC0
.space 4
.section ".rodata"
.align 2
.LC0:
.string "miscmod"
.align 2
.LC1:
.string "\nSample Loaded miscellaneous module (system call)\n"
.align 2
.LC2:
.string "Copyright (c) 1993\n"
.align 2
.LC3:
.string "Terrence R. Lambert\n"
.align 2
.LC4:
.string "All rights reserved\n"
.section ".text"
.align 2
.type miscmod_handle,@function
miscmod_handle:
stwu 1,-64(1)
mflr 0
stw 29,52(1)
stw 30,56(1)
stw 31,60(1)
stw 0,68(1)
mr 31,1
stw 3,8(31)
stw 4,12(31)
lwz 9,8(31)
lwz 0,40(9)
stw 0,20(31)
li 0,0
stw 0,24(31)
lwz 0,12(31)
cmpwi 0,0,1
bc 12,2,.L31
cmpwi 0,0,2
bc 12,2,.L39
b .L40
.L31:
lwz 3,8(31)
addis 9,0,lkmexists@ha
addi 29,9,lkmexists@l
mtlr 29
blrl
mr 0,3
cmpwi 0,0,0
bc 12,2,.L32
li 3,17
b .L29
.L32:
nop
li 0,0
stw 0,16(31)
.L33:
lwz 0,16(31)
cmpwi 0,0,305
bc 4,1,.L36
b .L34
.L36:
addis 9,0,sysent@ha
lwz 0,16(31)
mr 11,0
slwi 0,11,3
addi 9,9,sysent@l
addi 11,9,4
lwzx 0,11,0
addis 11,0,sys_lkmnosys@ha
addi 9,11,sys_lkmnosys@l
cmpw 0,0,9
bc 4,2,.L35
b .L34
.L37:
.L35:
lwz 9,16(31)
addi 0,9,1
stw 0,16(31)
b .L33
.L34:
lwz 0,16(31)
cmpwi 0,0,306
bc 4,2,.L38
li 0,23
stw 0,24(31)
b .L30
.L38:
lwz 0,16(31)
mr 9,0
slwi 0,9,3
addis 11,0,sysent@ha
addi 9,11,sysent@l
add 0,0,9
addis 9,0,oldent@ha
addi 3,9,oldent@l
mr 4,0
li 5,8
bl memcpy
lwz 0,16(31)
mr 9,0
slwi 0,9,3
addis 11,0,sysent@ha
addi 9,11,sysent@l
add 0,0,9
mr 3,0
addis 9,0,newent@ha
addi 4,9,newent@l
li 5,8
bl memcpy
lwz 9,20(31)
lwz 0,16(31)
stw 0,12(9)
addis 9,0,.LC1@ha
addi 3,9,.LC1@l
addis 9,0,printf@ha
addi 29,9,printf@l
mtlr 29
crxor 6,6,6
blrl
addis 9,0,.LC2@ha
addi 3,9,.LC2@l
addis 9,0,printf@ha
addi 29,9,printf@l
mtlr 29
crxor 6,6,6
blrl
addis 9,0,.LC3@ha
addi 3,9,.LC3@l
addis 9,0,printf@ha
addi 29,9,printf@l
mtlr 29
crxor 6,6,6
blrl
addis 9,0,.LC4@ha
addi 3,9,.LC4@l
addis 9,0,printf@ha
addi 29,9,printf@l
mtlr 29
crxor 6,6,6
blrl
b .L30
.L39:
lwz 9,20(31)
lwz 0,12(9)
stw 0,16(31)
lwz 0,16(31)
mr 9,0
slwi 0,9,3
addis 11,0,sysent@ha
addi 9,11,sysent@l
add 0,0,9
mr 3,0
addis 9,0,oldent@ha
addi 4,9,oldent@l
li 5,8
bl memcpy
b .L30
.L40:
li 0,22
stw 0,24(31)
b .L30
.L30:
lwz 0,24(31)
mr 3,0
b .L29
.L29:
lwz 11,0(1)
lwz 0,4(11)
mtlr 0
lwz 29,-12(11)
lwz 30,-8(11)
lwz 31,-4(11)
mr 1,11
blr
.Lfe1:
.size miscmod_handle,.Lfe1-miscmod_handle
.align 2
.globl miscmod
.type miscmod,@function
miscmod:
stwu 1,-48(1)
mflr 0
stw 29,36(1)
stw 30,40(1)
stw 31,44(1)
stw 0,52(1)
mr 31,1
stw 3,8(31)
stw 4,12(31)
stw 5,16(31)
lwz 0,16(31)
cmpwi 0,0,1
bc 12,2,.L43
li 3,22
b .L42
.L43:
lwz 0,12(31)
cmpwi 0,0,2
bc 12,2,.L47
cmpwi 0,0,2
bc 12,1,.L53
cmpwi 0,0,1
bc 12,2,.L45
b .L44
.L53:
cmpwi 0,0,3
bc 12,2,.L49
b .L44
.L45:
lwz 9,8(31)
addis 11,0,_module@ha
addi 0,11,_module@l
stw 0,40(9)
lwz 3,8(31)
lwz 4,12(31)
crxor 6,6,6
bl miscmod_handle
mr 0,3
stw 0,20(31)
lwz 0,20(31)
cmpwi 0,0,0
bc 12,2,.L46
lwz 0,20(31)
mr 3,0
b .L42
.L46:
b .L44
.L47:
lwz 3,8(31)
lwz 4,12(31)
crxor 6,6,6
bl miscmod_handle
mr 0,3
stw 0,20(31)
lwz 0,20(31)
cmpwi 0,0,0
bc 12,2,.L48
lwz 0,20(31)
mr 3,0
b .L42
.L48:
b .L44
.L49:
lwz 3,8(31)
lwz 4,12(31)
addis 9,0,lkm_nofunc@ha
addi 29,9,lkm_nofunc@l
mtlr 29
blrl
mr 0,3
stw 0,20(31)
lwz 0,20(31)
cmpwi 0,0,0
bc 12,2,.L50
lwz 0,20(31)
mr 3,0
b .L42
.L50:
b .L44
.L52:
.L44:
lwz 3,8(31)
lwz 4,12(31)
addis 9,0,lkmdispatch@ha
addi 29,9,lkmdispatch@l
mtlr 29
blrl
mr 0,3
mr 3,0
b .L42
.L42:
lwz 11,0(1)
lwz 0,4(11)
mtlr 0
lwz 29,-12(11)
lwz 30,-8(11)
lwz 31,-4(11)
mr 1,11
blr
.Lfe2:
.size miscmod,.Lfe2-miscmod
.comm schedhz,4,4
.section ".sdata","aw"
.align 2
oldent:
.space 8
.size oldent,8
.ident "GCC: (GNU) egcs-2.91.66 19990314 (egcs-1.1.2 release)"
--mP3DRpeJDSE+ciuQ--