Article View: gnu.gcc.bug
Article #5923Re: asm(): Gcc used clobbered regs for i/o operands
From: Michael Hohmuth
Date: Wed, 29 Jan 1997 00:00
Date: Wed, 29 Jan 1997 00:00
13743 lines
199197 bytes
199197 bytes
This is an update to my Jan 17 bug report.
On Jan 17, I (Michael Hohmuth) wrote:
> I have a problem with Gcc's inline assmbler facility (gcc-2.7.2.1,
> i486-linux). [...]
> As you see, the compiler has allocated registers %eax and %ebx for
> input/output even though we've explicitly specified these registers as
> scratch registers.
(I had an offline discussion with Richard Kenner in which I tried to
persuade him that this behaviour contradicts the documentation. I
heaven't heard back from him yet, however.)
> - The bug only seems to occur for the example included below when
> compiling without "-O". However, we've also experienced this bug
> with other (more complicated) sources when compiling with "-O".
Meanwhile, I found a workaround for the non "-O" compilation problem.
However, the (more complicated) problem which occurs even with "-O"
persists.
In this message, I will first explain why compiling with "-O" works
around the problem for the simple test program I posted in my first
message. Then, I will show a complex example in which compiling with
"-O" still doesn't respect the scratch registers specified in an asm()
statement. I believe the two examples trigger different bugs in Gcc.
I believe the behaviour I demonstrated in my first message is
triggered by the obey_regdecls variable in Gcc's toplev.c. This
variable is set when compiling without optimization (which is why it
can be cured by compiling with "-O"). It causes Gcc to omit the
register conflict checking (global_alloc()). The implementors seem to
have been thinking that conflicts cannot happen when not optimizing.
This assumption is violated when using inline assembler statements;
that's why I think it's a bug to rely on it.
OK, now for the more complex example which triggers the second bug.
Here, we compile an (already preprocessed) file process.i with
optimization. It contains the following statement:
read_time(unsigned long *time)
{
__asm__ volatile (".byte 0x0f, 0x31" /* Pentium: rdtsc */
: "=a" (*time)
:
: "edx"
);
};
...
if (me->tss.ex_page)
read_time(&me->tss.ex_page->m.dispatch_stop);
This invocation of read_time() is compiled into the following
assembler code:
addl $12,%esp
movl -76(%ebp),%edx
movl 540(%edx),%edx
movl %edx,-96(%ebp)
testl %edx,%edx
je .L1233
#APP
.byte 0x0f, 0x31
#NO_APP
movl %eax,28(%edx)
.L1233:
As you can see, the compiler uses %edx as an index register even
though it has been specified as a scratch register.
I believe the bug must be somewhere in the global register allocation
or reloading pass. This is suggested by the RTL dumps before and
after these passes. The dump of this spot before these passes ("-dl")
looks like this:
(insn/i 68 67 69 (parallel[
(set (mem:SI (plus:SI (reg:SI 32)
(const_int 28)))
(asm_operands/v (".byte 0x0f, 0x31") ("=a") 0[ ]
[ ] ("../include/perform.h") 55))
(clobber (reg:QI 1 %dl))
] ) -1 (nil)
(expr_list:REG_DEAD (reg:SI 32)
(expr_list:REG_UNUSED (reg:QI 1 %dl)
(nil))))
The hard register is clearly marked as being clobbered. However,
after these passes, the RTL (dumped with "-dg") looks like:
(insn/i:HI 68 67 465 (parallel[
(set (reg:SI 0 %eax)
(asm_operands/v (".byte 0x0f, 0x31") ("=a") 0[ ]
[ ] ("../include/perform.h") 55))
(clobber (reg:QI 1 %dl))
] ) -1 (nil)
(expr_list:REG_DEAD (mem:SI (plus:SI (reg:SI 6 %ebp)
(const_int -96)))
(expr_list:REG_UNUSED (reg:QI 1 %dl)
(nil))))
(insn 465 68 69 (set (mem:SI (plus:SI (reg:SI 1 %edx)
(const_int 28)))
(reg:SI 0 %eax)) 50 {movsi+1} (nil)
(nil))
The compiler wants to keep the value of %edx across insn 68 even
though that insn is declared to destroy %edx.
I'll append the full source code of process.i below (licensed under
the GPL ;).
It has been compiled with the following command:
/usr/lib/gcc-lib/i486-linux/2.7.2.1/cc1 process.i -quiet -dumpbase \
process.c -da -m486 -g -O2 -Wall -Wstrict-prototypes -version \
-fno-strength-reduce -o process.s
Some more details (equivalent to my previous bug report):
- System is Debian GNU/Linux 1.2. "uname -a" yields:
Linux os 2.0.27 #2 Sun Dec 15 16:29:14 MET 1996 i686
Debian configures the compiler sources using "./configure
--prefix=/usr i486-linux".
- "gcc -v" yields:
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.1/specs
gcc version 2.7.2.1
Michael
--
Email: hohmuth@inf.tu-dresden.de
WWW: http://www.inf.tu-dresden.de/~mh1/
process.i follows:
------------------------------------------------------------------------------
# 1 "process.c"
# 1 "/home/jw5/src/port/linux-current/../l4/lib/libl4sys/include/l4/types.h" 1
typedef unsigned char byte_t;
typedef unsigned short int word_t;
typedef unsigned int dword_t;
typedef long long cpu_time_t;
typedef struct {
dword_t low, high;
} l4_low_high_t;
typedef struct {
unsigned version_low:10;
unsigned lthread:7;
unsigned task:11;
unsigned version_high:4;
unsigned site:17;
unsigned chief:11;
unsigned nest:4;
} l4_threadid_struct_t;
typedef union {
l4_low_high_t lh;
l4_threadid_struct_t id;
} l4_threadid_t;
typedef l4_threadid_t l4_taskid_t;
typedef struct {
unsigned intr:8;
unsigned char zero[7];
} l4_intrid_struct_t;
typedef union {
l4_low_high_t lh;
l4_intrid_struct_t id;
} l4_intrid_t;
typedef struct {
unsigned grant:1;
unsigned write:1;
unsigned size:6;
unsigned zero:4;
unsigned page:20;
} l4_fpage_struct_t;
typedef union {
dword_t fpage;
l4_fpage_struct_t fp;
} l4_fpage_t;
typedef struct {
dword_t snd_base;
l4_fpage_t fpage;
} l4_snd_fpage_t;
typedef struct {
unsigned msg_deceited:1;
unsigned fpage_received:1;
unsigned msg_redirected:1;
unsigned src_inside:1;
unsigned snd_error:1;
unsigned error_code:3;
unsigned strings:5;
unsigned dwords:19;
} l4_msgdope_struct_t;
typedef union {
dword_t msgdope;
l4_msgdope_struct_t md;
} l4_msgdope_t;
typedef struct {
dword_t snd_size;
dword_t snd_str;
dword_t rcv_size;
dword_t rcv_str;
} l4_strdope_t;
typedef struct {
unsigned rcv_exp:4;
unsigned snd_exp:4;
unsigned snd_pfault:4;
unsigned rcv_pfault:4;
unsigned snd_man:8;
unsigned rcv_man:8;
} l4_timeout_struct_t;
typedef union {
dword_t timeout;
l4_timeout_struct_t to;
} l4_timeout_t;
typedef struct {
unsigned prio:8;
unsigned small:8;
unsigned zero:4;
unsigned time_exp:4;
unsigned time_man:8;
} l4_sched_param_struct_t;
typedef union {
dword_t sched_param;
l4_sched_param_struct_t sp;
} l4_sched_param_t;
static inline int l4_is_nil_id(l4_threadid_t id)
{
return id.lh.low == 0;
}
static inline int l4_is_invalid_id(l4_threadid_t id)
{
return id.lh.low == 0xffffffff;
}
static inline l4_fpage_t l4_fpage(unsigned long address, unsigned int size,
unsigned char write, unsigned char grant)
{
return ((l4_fpage_t){fp:{grant, write, size, 0,
(address & (~((0x1000) - 1)) ) >> 12 }});
}
static inline l4_threadid_t
get_taskid(l4_threadid_t t)
{
t.id.lthread = 0;
return t;
}
static inline int
thread_equal(l4_threadid_t t1,l4_threadid_t t2)
{
if((t1.lh.low != t2.lh.low) || (t1.lh.high != t2.lh.high))
return 0;
return 1;
}
static inline int
task_equal(l4_threadid_t t1,l4_threadid_t t2)
{
if ( ((t1.lh.low & 0xfffe03ff ) == (t2.lh.low & 0xfffe03ff )) &&
(t1.lh.high == t2.lh.high) )
return 1;
else
return 0;
}
# 12 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ptrace.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/ptrace.h" 1
struct pt_regs {
long ebx;
long ecx;
long edx;
long esi;
long edi;
long ebp;
long eax;
long orig_eax;
long eip;
unsigned short cs, __csu;
long eflags;
long esp;
};
extern void show_regs(struct pt_regs *);
# 24 "/home/jw5/src/port/linux-current/include/linux/ptrace.h" 2
# 14 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/kernel.h" 1
# 1 "/home/hohmuth/src/gcc-2.7.2.1/include/stdarg.h" 1 3
typedef void *__gnuc_va_list;
void va_end (__gnuc_va_list);
# 137 "/home/hohmuth/src/gcc-2.7.2.1/include/stdarg.h" 3
typedef __gnuc_va_list va_list;
# 10 "/home/jw5/src/port/linux-current/include/linux/kernel.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/linkage.h" 1
# 27 "/home/jw5/src/port/linux-current/include/linux/linkage.h"
# 37 "/home/jw5/src/port/linux-current/include/linux/linkage.h"
# 57 "/home/jw5/src/port/linux-current/include/linux/linkage.h"
# 11 "/home/jw5/src/port/linux-current/include/linux/kernel.h" 2
extern void math_error(void);
void panic(const char * fmt, ...)
__attribute__ ((noreturn, format (printf, 1, 2)));
void do_exit(long error_code)
__attribute__((noreturn)) ;
extern unsigned long simple_strtoul(const char *,char **,unsigned int);
extern int sprintf(char * buf, const char * fmt, ...);
extern int vsprintf(char *buf, const char *, va_list);
extern int session_of_pgrp(int pgrp);
extern int kill_proc(int pid, int sig, int priv);
extern int kill_pg(int pgrp, int sig, int priv);
extern int kill_sl(int sess, int sig, int priv);
int printk(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2)));
struct sysinfo {
long uptime;
unsigned long loads[3];
unsigned long totalram;
unsigned long freeram;
unsigned long sharedram;
unsigned long bufferram;
unsigned long totalswap;
unsigned long freeswap;
unsigned short procs;
char _f[22];
};
# 15 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/sched.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/param.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/param.h" 1
# 7 "/home/jw5/src/port/linux-current/include/asm/param.h" 2
# 14 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
extern unsigned long event;
# 1 "/home/jw5/src/port/linux-current/include/linux/binfmts.h" 1
struct linux_binprm{
char buf[128];
unsigned long page[32 ];
unsigned long p;
int sh_bang;
struct inode * inode;
int e_uid, e_gid;
int argc, envc;
char * filename;
unsigned long loader, exec;
int dont_iput;
};
struct linux_binfmt {
struct linux_binfmt * next;
long *use_count;
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
int (*load_shlib)(int fd);
int (*core_dump)(long signr, struct pt_regs * regs);
};
extern int register_binfmt(struct linux_binfmt *);
extern int unregister_binfmt(struct linux_binfmt *);
extern int read_exec(struct inode *inode, unsigned long offset,
char * addr, unsigned long count, int to_kmem);
extern int open_inode(struct inode * inode, int mode);
extern int init_elf_binfmt(void);
extern int init_aout_binfmt(void);
extern int init_script_binfmt(void);
extern int init_java_binfmt(void);
extern int prepare_binprm(struct linux_binprm *);
extern void remove_arg_zero(struct linux_binprm *);
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
extern void flush_old_exec(struct linux_binprm * bprm);
extern unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm);
extern unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
unsigned long p, int from_kmem);
# 18 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/personality.h" 1
typedef void (*lcall7_func)(struct pt_regs *);
struct exec_domain {
const char *name;
lcall7_func handler;
unsigned char pers_low, pers_high;
unsigned long * signal_map;
unsigned long * signal_invmap;
long *use_count;
struct exec_domain *next;
};
extern struct exec_domain default_exec_domain;
extern struct exec_domain *lookup_exec_domain(unsigned long personality);
extern int register_exec_domain(struct exec_domain *it);
extern int unregister_exec_domain(struct exec_domain *it);
int sys_personality(unsigned long personality);
# 19 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/tasks.h" 1
# 20 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/system.h" 1
struct __xchg_dummy { unsigned long a[100]; };
static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
{
switch (size) {
case 1:
__asm__("xchgb %b0,%1"
:"=&q" (x), "=m" (* ((struct __xchg_dummy *)( ptr )) )
:"0" (x), "m" (* ((struct __xchg_dummy *)( ptr )) ));
break;
case 2:
__asm__("xchgw %w0,%1"
:"=&r" (x), "=m" (* ((struct __xchg_dummy *)( ptr )) )
:"0" (x), "m" (* ((struct __xchg_dummy *)( ptr )) ));
break;
case 4:
__asm__("xchgl %0,%1"
:"=&r" (x), "=m" (* ((struct __xchg_dummy *)( ptr )) )
:"0" (x), "m" (* ((struct __xchg_dummy *)( ptr )) ));
break;
}
return x;
}
extern void __new_cli(void);
extern void __new_sti(void);
extern void __new_save_flags(unsigned long *flags);
extern void __new_restore_flags(unsigned long flags);
# 70 "/home/jw5/src/port/linux-current/include/asm/system.h"
# 125 "/home/jw5/src/port/linux-current/include/asm/system.h"
# 23 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/semaphore.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/semaphore.h" 1
struct semaphore {
int count;
int waiting;
struct wait_queue * wait;
};
void down_failed(void );
void up_wakeup(void );
extern void __down(struct semaphore * sem);
extern void __up(struct semaphore * sem);
extern inline void down(struct semaphore * sem)
{
__asm__ __volatile__(
"# atomic down operation\n"
"1:\n\t"
"movl $1b,%%eax\n\t"
"decl %0\n\t"
"js " "down_failed"
:
:"m" (sem->count), "c" (sem)
:"ax","dx","memory");
}
extern inline void up(struct semaphore * sem)
{
__asm__ __volatile__(
"# atomic up operation\n\t"
"movl $1f,%%eax\n\t"
"incl %0\n\t"
"jle " "up_wakeup"
"\n1:"
:
:"m" (sem->count), "c" (sem)
:"ax", "dx", "memory");
}
# 7 "/home/jw5/src/port/linux-current/include/asm/semaphore.h" 2
# 24 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/page.h" 1
typedef struct { unsigned long pte; } pte_t;
typedef struct { unsigned long pmd; } pmd_t;
typedef struct { unsigned long pgd; } pgd_t;
typedef struct { unsigned long pgprot; } pgprot_t;
# 53 "/home/jw5/src/port/linux-current/include/asm/page.h"
# 25 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/smp.h" 1
# 42 "/home/jw5/src/port/linux-current/include/linux/smp.h"
# 27 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/tty.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/fs.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/config.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/autoconf.h" 1
# 4 "/home/jw5/src/port/linux-current/include/linux/config.h" 2
# 9 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/limits.h" 1
# 11 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/wait.h" 1
struct wait_queue {
struct task_struct * task;
struct wait_queue * next;
};
static inline void init_waitqueue(struct wait_queue **q)
{
*q = ((struct wait_queue *)(( q )-1)) ;
}
static inline int waitqueue_active(struct wait_queue **q)
{
struct wait_queue *head = *q;
return head && head != ((struct wait_queue *)(( q )-1)) ;
}
struct select_table_entry {
struct wait_queue wait;
struct wait_queue ** wait_address;
};
typedef struct select_table_struct {
int nr;
struct select_table_entry * entry;
} select_table;
# 12 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/types.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/posix_types.h" 1
typedef struct fd_set {
unsigned long fds_bits [(1024 / (8 * sizeof(unsigned long)) ) ];
} __kernel_fd_set;
# 1 "/home/jw5/src/port/linux-current/include/asm/posix_types.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/posix_types.h" 1
typedef unsigned short __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned short __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef unsigned short __kernel_uid_t;
typedef unsigned short __kernel_gid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_clock_t;
typedef int __kernel_daddr_t;
typedef char * __kernel_caddr_t;
typedef long long __kernel_loff_t;
typedef struct {
int val[2];
} __kernel_fsid_t;
# 7 "/home/jw5/src/port/linux-current/include/asm/posix_types.h" 2
# 48 "/home/jw5/src/port/linux-current/include/linux/posix_types.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/types.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/types.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/types.h" 1
typedef unsigned short umode_t;
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
typedef signed char s8;
typedef unsigned char u8;
typedef signed short s16;
typedef unsigned short u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
# 7 "/home/jw5/src/port/linux-current/include/asm/types.h" 2
# 5 "/home/jw5/src/port/linux-current/include/linux/types.h" 2
typedef __kernel_fd_set fd_set;
typedef __kernel_dev_t dev_t;
typedef __kernel_ino_t ino_t;
typedef __kernel_mode_t mode_t;
typedef __kernel_nlink_t nlink_t;
typedef __kernel_off_t off_t;
typedef __kernel_pid_t pid_t;
typedef __kernel_uid_t uid_t;
typedef __kernel_gid_t gid_t;
typedef __kernel_daddr_t daddr_t;
typedef __kernel_loff_t loff_t;
typedef __kernel_size_t size_t;
typedef __kernel_ssize_t ssize_t;
typedef __kernel_ptrdiff_t ptrdiff_t;
typedef __kernel_time_t time_t;
typedef __kernel_clock_t clock_t;
typedef __kernel_caddr_t caddr_t;
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;
struct ustat {
__kernel_daddr_t f_tfree;
__kernel_ino_t f_tinode;
char f_fname[6];
char f_fpack[6];
};
# 13 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/vfs.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/statfs.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/statfs.h" 1
typedef __kernel_fsid_t fsid_t;
struct statfs {
long f_type;
long f_bsize;
long f_blocks;
long f_bfree;
long f_bavail;
long f_files;
long f_ffree;
__kernel_fsid_t f_fsid;
long f_namelen;
long f_spare[6];
};
# 7 "/home/jw5/src/port/linux-current/include/asm/statfs.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/vfs.h" 2
# 14 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/net.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/socket.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/socket.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/socket.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/sockios.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/sockios.h" 1
# 7 "/home/jw5/src/port/linux-current/include/asm/sockios.h" 2
# 4 "/home/jw5/src/port/linux-current/include/asm-i386/socket.h" 2
# 7 "/home/jw5/src/port/linux-current/include/asm/socket.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/socket.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/sockios.h" 1
# 5 "/home/jw5/src/port/linux-current/include/linux/socket.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/uio.h" 1
struct iovec
{
void *iov_base;
int iov_len;
};
# 6 "/home/jw5/src/port/linux-current/include/linux/socket.h" 2
struct sockaddr
{
unsigned short sa_family;
char sa_data[14];
};
struct linger {
int l_onoff;
int l_linger;
};
struct msghdr
{
void * msg_name;
int msg_namelen;
struct iovec * msg_iov;
int msg_iovlen;
void * msg_control;
int msg_controllen;
int msg_flags;
};
extern void memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
extern void memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen);
extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr);
# 23 "/home/jw5/src/port/linux-current/include/linux/net.h" 2
typedef enum {
SS_FREE = 0,
SS_UNCONNECTED,
SS_CONNECTING,
SS_CONNECTED,
SS_DISCONNECTING
} socket_state;
struct socket {
short type;
socket_state state;
long flags;
struct proto_ops *ops;
void *data;
struct socket *conn;
struct socket *iconn;
struct socket *next;
struct wait_queue **wait;
struct inode *inode;
struct fasync_struct *fasync_list;
struct file *file;
};
struct proto_ops {
int family;
int (*create) (struct socket *sock, int protocol);
int (*dup) (struct socket *newsock, struct socket *oldsock);
int (*release) (struct socket *sock, struct socket *peer);
int (*bind) (struct socket *sock, struct sockaddr *umyaddr,
int sockaddr_len);
int (*connect) (struct socket *sock, struct sockaddr *uservaddr,
int sockaddr_len, int flags);
int (*socketpair) (struct socket *sock1, struct socket *sock2);
int (*accept) (struct socket *sock, struct socket *newsock,
int flags);
int (*getname) (struct socket *sock, struct sockaddr *uaddr,
int *usockaddr_len, int peer);
int (*select) (struct socket *sock, int sel_type,
select_table *wait);
int (*ioctl) (struct socket *sock, unsigned int cmd,
unsigned long arg);
int (*listen) (struct socket *sock, int len);
int (*shutdown) (struct socket *sock, int flags);
int (*setsockopt) (struct socket *sock, int level, int optname,
char *optval, int optlen);
int (*getsockopt) (struct socket *sock, int level, int optname,
char *optval, int *optlen);
int (*fcntl) (struct socket *sock, unsigned int cmd,
unsigned long arg);
int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, int nonblock, int flags);
int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int nonblock, int flags, int *addr_len);
};
struct net_proto {
const char *name;
void (*init_func)(struct net_proto *);
};
extern int sock_wake_async(struct socket *sock, int how);
extern int sock_register(int family, struct proto_ops *ops);
extern int sock_unregister(int family);
extern struct socket *sock_alloc(void);
extern void sock_release(struct socket *sock);
# 15 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/kdev_t.h" 1
typedef unsigned short kdev_t;
extern char * kdevname(kdev_t);
static inline unsigned int kdev_t_to_nr(kdev_t dev) {
return ((( dev ) >> 8 ) <<8) | (( dev ) & ((1<< 8 ) - 1) ) ;
}
static inline kdev_t to_kdev_t(int dev)
{
int major, minor;
major = (dev >> 8);
minor = (dev & 0xff);
return ((( major ) << 8 ) | ( minor )) ;
}
# 113 "/home/jw5/src/port/linux-current/include/linux/kdev_t.h"
# 16 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ioctl.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/ioctl.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/ioctl.h" 1
# 7 "/home/jw5/src/port/linux-current/include/asm/ioctl.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/ioctl.h" 2
# 17 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
extern int max_inodes, nr_inodes;
extern int max_files, nr_files;
# 1 "/home/jw5/src/port/linux-current/include/asm/bitops.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/bitops.h" 1
struct __dummy { unsigned long a[100]; };
extern __inline__ int set_bit(int nr, void * addr)
{
int oldbit;
__asm__ __volatile__(""
"btsl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"=m" ((*(struct __dummy *) addr) )
:"ir" (nr));
return oldbit;
}
extern __inline__ int clear_bit(int nr, void * addr)
{
int oldbit;
__asm__ __volatile__(""
"btrl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"=m" ((*(struct __dummy *) addr) )
:"ir" (nr));
return oldbit;
}
extern __inline__ int change_bit(int nr, void * addr)
{
int oldbit;
__asm__ __volatile__(""
"btcl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"=m" ((*(struct __dummy *) addr) )
:"ir" (nr));
return oldbit;
}
extern __inline__ int test_bit(int nr, const void * addr)
{
return ((1UL << (nr & 31)) & (((const unsigned int *) addr)[nr >> 5])) != 0;
}
extern __inline__ int find_first_zero_bit(void * addr, unsigned size)
{
int res;
if (!size)
return 0;
__asm__("cld\n\t"
"movl $-1,%%eax\n\t"
"xorl %%edx,%%edx\n\t"
"repe; scasl\n\t"
"je 1f\n\t"
"xorl -4(%%edi),%%eax\n\t"
"subl $4,%%edi\n\t"
"bsfl %%eax,%%edx\n"
"1:\tsubl %%ebx,%%edi\n\t"
"shll $3,%%edi\n\t"
"addl %%edi,%%edx"
:"=d" (res)
:"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
:"ax", "cx", "di");
return res;
}
extern __inline__ int find_next_zero_bit (void * addr, int size, int offset)
{
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
int set = 0, bit = offset & 31, res;
if (bit) {
__asm__("bsfl %1,%0\n\t"
"jne 1f\n\t"
"movl $32, %0\n"
"1:"
: "=r" (set)
: "r" (~(*p >> bit)));
if (set < (32 - bit))
return set + offset;
set = 32 - bit;
p++;
}
res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr));
return (offset + set + res);
}
extern __inline__ unsigned long ffz(unsigned long word)
{
__asm__("bsfl %1,%0"
:"=r" (word)
:"r" (~word));
return word;
}
# 7 "/home/jw5/src/port/linux-current/include/asm/bitops.h" 2
# 124 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
extern void buffer_init(void);
extern unsigned long inode_init(unsigned long start, unsigned long end);
extern unsigned long file_table_init(unsigned long start, unsigned long end);
extern unsigned long name_cache_init(unsigned long start, unsigned long end);
typedef char buffer_block[1024 ];
struct buffer_head {
unsigned long b_blocknr;
kdev_t b_dev;
kdev_t b_rdev;
unsigned long b_rsector;
struct buffer_head * b_next;
struct buffer_head * b_this_page;
unsigned long b_state;
struct buffer_head * b_next_free;
unsigned int b_count;
unsigned long b_size;
char * b_data;
unsigned int b_list;
unsigned long b_flushtime;
unsigned long b_lru_time;
struct wait_queue * b_wait;
struct buffer_head * b_prev;
struct buffer_head * b_prev_free;
struct buffer_head * b_reqnext;
};
static inline int buffer_uptodate(struct buffer_head * bh)
{
return test_bit(0 , &bh->b_state);
}
static inline int buffer_dirty(struct buffer_head * bh)
{
return test_bit(1 , &bh->b_state);
}
static inline int buffer_locked(struct buffer_head * bh)
{
return test_bit(2 , &bh->b_state);
}
static inline int buffer_req(struct buffer_head * bh)
{
return test_bit(3 , &bh->b_state);
}
static inline int buffer_touched(struct buffer_head * bh)
{
return test_bit(4 , &bh->b_state);
}
static inline int buffer_has_aged(struct buffer_head * bh)
{
return test_bit(5 , &bh->b_state);
}
static inline int buffer_protected(struct buffer_head * bh)
{
return test_bit(6 , &bh->b_state);
}
# 1 "/home/jw5/src/port/linux-current/include/linux/pipe_fs_i.h" 1
struct pipe_inode_info {
struct wait_queue * wait;
char * base;
unsigned int start;
unsigned int len;
unsigned int lock;
unsigned int rd_openers;
unsigned int wr_openers;
unsigned int readers;
unsigned int writers;
};
# 218 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/minix_fs_i.h" 1
struct minix_inode_info {
union {
__u16 i1_data[16];
__u32 i2_data[16];
} u;
};
# 219 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ext_fs_i.h" 1
struct ext_inode_info {
unsigned long i_data[16];
};
# 220 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ext2_fs_i.h" 1
struct ext2_inode_info {
__u32 i_data[15];
__u32 i_flags;
__u32 i_faddr;
__u8 i_frag_no;
__u8 i_frag_size;
__u16 i_osync;
__u32 i_file_acl;
__u32 i_dir_acl;
__u32 i_dtime;
__u32 i_version;
__u32 i_block_group;
__u32 i_next_alloc_block;
__u32 i_next_alloc_goal;
__u32 i_prealloc_block;
__u32 i_prealloc_count;
int i_new_inode:1;
};
# 221 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/hpfs_fs_i.h" 1
struct hpfs_inode_info {
ino_t i_parent_dir;
unsigned i_dno;
unsigned i_dpos;
unsigned i_dsubdno;
unsigned i_file_sec;
unsigned i_disk_sec;
unsigned i_n_secs;
unsigned i_conv : 2;
};
# 222 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/msdos_fs_i.h" 1
struct msdos_inode_info {
struct pipe_inode_info reserved;
int i_start;
int i_attrs;
int i_busy;
struct inode *i_depend;
struct inode *i_old;
struct inode *i_linked;
struct inode *i_oldlink;
int i_binary;
};
# 223 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/umsdos_fs_i.h" 1
struct dir_locking_info {
struct wait_queue *p;
short int looking;
short int creating;
long pid;
};
struct umsdos_inode_info {
union {
struct msdos_inode_info msdos_info;
struct pipe_inode_info pipe_info;
struct dir_locking_info dir_info;
}u;
unsigned long i_dir_owner;
unsigned long i_emd_owner;
off_t pos;
unsigned long i_emd_dir;
};
# 224 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/iso_fs_i.h" 1
struct iso_inode_info {
unsigned int i_first_extent;
unsigned int i_backlink;
unsigned char i_file_format;
};
# 225 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/nfs_fs_i.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/nfs.h" 1
enum rpc_auth_flavor {
RPC_AUTH_NULL = 0,
RPC_AUTH_UNIX = 1,
RPC_AUTH_SHORT = 2
};
enum rpc_msg_type {
RPC_CALL = 0,
RPC_REPLY = 1
};
enum rpc_reply_stat {
RPC_MSG_ACCEPTED = 0,
RPC_MSG_DENIED = 1
};
enum rpc_accept_stat {
RPC_SUCCESS = 0,
RPC_PROG_UNAVAIL = 1,
RPC_PROG_MISMATCH = 2,
RPC_PROC_UNAVAIL = 3,
RPC_GARBAGE_ARGS = 4
};
enum rpc_reject_stat {
RPC_MISMATCH = 0,
RPC_AUTH_ERROR = 1
};
enum rpc_auth_stat {
RPC_AUTH_BADCRED = 1,
RPC_AUTH_REJECTEDCRED = 2,
RPC_AUTH_BADVERF = 3,
RPC_AUTH_REJECTEDVERF = 4,
RPC_AUTH_TOOWEAK = 5
};
enum nfs_stat {
NFS_OK = 0,
NFSERR_PERM = 1,
NFSERR_NOENT = 2,
NFSERR_IO = 5,
NFSERR_NXIO = 6,
NFSERR_EAGAIN = 11,
NFSERR_ACCES = 13,
NFSERR_EXIST = 17,
NFSERR_NODEV = 19,
NFSERR_NOTDIR = 20,
NFSERR_ISDIR = 21,
NFSERR_INVAL = 22,
NFSERR_FBIG = 27,
NFSERR_NOSPC = 28,
NFSERR_ROFS = 30,
NFSERR_NAMETOOLONG = 63,
NFSERR_NOTEMPTY = 66,
NFSERR_DQUOT = 69,
NFSERR_STALE = 70,
NFSERR_WFLUSH = 99
};
enum nfs_ftype {
NFNON = 0,
NFREG = 1,
NFDIR = 2,
NFBLK = 3,
NFCHR = 4,
NFLNK = 5,
NFSOCK = 6,
NFBAD = 7,
NFFIFO = 8
};
struct nfs_fh {
char data[32 ];
};
struct nfs_time {
u_int seconds;
u_int useconds;
};
struct nfs_fattr {
enum nfs_ftype type;
u_int mode;
u_int nlink;
u_int uid;
u_int gid;
u_int size;
u_int blocksize;
u_int rdev;
u_int blocks;
u_int fsid;
u_int fileid;
struct nfs_time atime;
struct nfs_time mtime;
struct nfs_time ctime;
};
struct nfs_sattr {
u_int mode;
u_int uid;
u_int gid;
u_int size;
struct nfs_time atime;
struct nfs_time mtime;
};
struct nfs_entry {
u_int fileid;
char *name;
int cookie;
int eof;
};
struct nfs_fsinfo {
u_int tsize;
u_int bsize;
u_int blocks;
u_int bfree;
u_int bavail;
};
# 4 "/home/jw5/src/port/linux-current/include/linux/nfs_fs_i.h" 2
struct nfs_inode_info {
struct pipe_inode_info pipeinfo;
struct nfs_fh fhandle;
unsigned long read_cache_jiffies;
unsigned long read_cache_mtime;
struct inode *silly_rename_dir;
unsigned long attrtimeo;
};
# 226 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/xia_fs_i.h" 1
struct xiafs_inode_info {
unsigned long i_zone[8];
unsigned long i_ind_zone;
unsigned long i_dind_zone;
};
# 227 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/sysv_fs_i.h" 1
struct sysv_inode_info {
unsigned long i_data[10+1+1+1];
};
# 228 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/affs_fs_i.h" 1
struct affs_inode_info {
__u32 i_protect;
__s32 i_parent;
__s32 i_original;
__s32 i_ext[12 ];
__s32 i_data[8 ];
int i_lastblock;
short i_max_ext;
short i_pa_cnt;
short i_pa_next;
short i_pa_last;
short i_zone;
unsigned char i_hlink;
unsigned char i_pad;
};
# 229 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ufs_fs_i.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/ufs_fs.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/time.h" 1
struct timespec {
long tv_sec;
long tv_nsec;
};
struct timeval {
int tv_sec;
int tv_usec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
void do_gettimeofday(struct timeval *tv);
void do_settimeofday(struct timeval *tv);
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
# 18 "/home/jw5/src/port/linux-current/include/linux/ufs_fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/stat.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/stat.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/stat.h" 1
struct old_stat {
unsigned short st_dev;
unsigned short st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned short st_rdev;
unsigned long st_size;
unsigned long st_atime;
unsigned long st_mtime;
unsigned long st_ctime;
};
struct new_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned short st_rdev;
unsigned short __pad2;
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime;
unsigned long __unused1;
unsigned long st_mtime;
unsigned long __unused2;
unsigned long st_ctime;
unsigned long __unused3;
unsigned long __unused4;
unsigned long __unused5;
};
# 7 "/home/jw5/src/port/linux-current/include/asm/stat.h" 2
# 6 "/home/jw5/src/port/linux-current/include/linux/stat.h" 2
# 19 "/home/jw5/src/port/linux-current/include/linux/ufs_fs.h" 2
struct ufs_direct {
__u32 d_ino;
__u16 d_reclen;
__u16 d_namlen;
char d_name[255 + 1];
};
struct ufs_csum {
__u32 cs_ndir;
__u32 cs_nbfree;
__u32 cs_nifree;
__u32 cs_nffree;
};
typedef struct _ufsquad {
__u32 val[2];
} ufsquad;
struct ufs_superblock {
__u32 fs_link;
__u32 fs_rlink;
__u32 fs_sblkno;
__u32 fs_cblkno;
__u32 fs_iblkno;
__u32 fs_dblkno;
__u32 fs_cgoffset;
__u32 fs_cgmask;
time_t fs_time;
__u32 fs_size;
__u32 fs_dsize;
__u32 fs_ncg;
__u32 fs_bsize;
__u32 fs_fsize;
__u32 fs_frag;
__u32 fs_minfree;
__u32 fs_rotdelay;
__u32 fs_rps;
__u32 fs_bmask;
__u32 fs_fmask;
__u32 fs_bshift;
__u32 fs_fshift;
__u32 fs_maxcontig;
__u32 fs_maxbpg;
__u32 fs_fragshift;
__u32 fs_fsbtodb;
__u32 fs_sbsize;
__u32 fs_csmask;
__u32 fs_csshift;
__u32 fs_nindir;
__u32 fs_inopb;
__u32 fs_nspf;
__u32 fs_optim;
__u32 fs_XXX1;
__u32 fs_interleave;
__u32 fs_trackskew;
__u32 fs_id[2];
__u32 fs_csaddr;
__u32 fs_cssize;
__u32 fs_cgsize;
__u32 fs_ntrak;
__u32 fs_nsect;
__u32 fs_spc;
__u32 fs_ncyl;
__u32 fs_cpg;
__u32 fs_ipg;
__u32 fs_fpg;
struct ufs_csum fs_cstotal;
__u8 fs_fmod;
__u8 fs_clean;
__u8 fs_ronly;
__u8 fs_flags;
__u8 fs_fsmnt[512 ];
__u32 fs_cgrotor;
struct ufs_csum * fs_csp[32 ];
__u32 fs_cpc;
__u16 fs_opostbl[16][8];
__s32 fs_sparecon[55];
__s32 fs_state;
ufsquad fs_qbmask;
ufsquad fs_qfmask;
__s32 fs_postblformat;
__s32 fs_nrpos;
__s32 fs_postbloff;
__s32 fs_rotbloff;
__s32 fs_magic;
__u8 fs_space[1];
};
struct ufs_inode {
__u16 ui_mode;
__u16 ui_nlink;
__u16 ui_suid;
__u16 ui_sgid;
ufsquad ui_size;
struct timeval ui_atime;
struct timeval ui_mtime;
struct timeval ui_ctime;
__u32 ui_db[12 ];
__u32 ui_ib[3 ];
__u32 ui_flags;
__u32 ui_blocks;
__u32 ui_gen;
__u32 ui_shadow;
__u32 ui_uid;
__u32 ui_gid;
__u32 ui_oeftflag;
};
extern int init_ufs_fs(void);
# 16 "/home/jw5/src/port/linux-current/include/linux/ufs_fs_i.h" 2
struct ufs_inode_info {
__u64 ui_size;
__u32 ui_flags;
__u32 ui_gen;
__u32 ui_shadow;
__u32 ui_uid;
__u32 ui_gid;
__u32 ui_oeftflag;
__u32 ui_db[12 ];
__u32 ui_ib[3 ];
};
# 230 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
struct iattr {
unsigned int ia_valid;
umode_t ia_mode;
uid_t ia_uid;
gid_t ia_gid;
off_t ia_size;
time_t ia_atime;
time_t ia_mtime;
time_t ia_ctime;
};
# 1 "/home/jw5/src/port/linux-current/include/linux/quota.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/errno.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/errno.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/errno.h" 1
# 7 "/home/jw5/src/port/linux-current/include/asm/errno.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/errno.h" 2
# 42 "/home/jw5/src/port/linux-current/include/linux/quota.h" 2
struct dqblk {
__u32 dqb_bhardlimit;
__u32 dqb_bsoftlimit;
__u32 dqb_curblocks;
__u32 dqb_ihardlimit;
__u32 dqb_isoftlimit;
__u32 dqb_curinodes;
time_t dqb_btime;
time_t dqb_itime;
};
struct dqstats {
__u32 lookups;
__u32 drops;
__u32 reads;
__u32 writes;
__u32 cache_hits;
__u32 pages_allocated;
__u32 allocated_dquots;
__u32 free_dquots;
__u32 syncs;
};
# 1 "/home/jw5/src/port/linux-current/include/linux/mount.h" 1
struct vfsmount
{
kdev_t mnt_dev;
char *mnt_devname;
char *mnt_dirname;
unsigned int mnt_flags;
struct semaphore mnt_sem;
struct super_block *mnt_sb;
struct file *mnt_quotas[2 ];
time_t mnt_iexp[2 ];
time_t mnt_bexp[2 ];
struct vfsmount *mnt_next;
};
struct vfsmount *lookup_vfsmnt(kdev_t dev);
# 151 "/home/jw5/src/port/linux-current/include/linux/quota.h" 2
struct dquot {
unsigned int dq_id;
short dq_type;
kdev_t dq_dev;
short dq_flags;
short dq_count;
struct vfsmount *dq_mnt;
struct dqblk dq_dqb;
struct wait_queue *dq_wait;
struct dquot *dq_prev;
struct dquot *dq_next;
struct dquot *dq_hash_prev;
struct dquot *dq_hash_next;
};
extern void dquot_initialize(struct inode *inode, short type);
extern void dquot_drop(struct inode *inode);
extern int dquot_alloc_block(const struct inode *inode, unsigned long number);
extern int dquot_alloc_inode(const struct inode *inode, unsigned long number);
extern void dquot_free_block(const struct inode *inode, unsigned long number);
extern void dquot_free_inode(const struct inode *inode, unsigned long number);
extern int dquot_transfer(struct inode *inode, struct iattr *iattr, char direction);
extern void invalidate_dquots(kdev_t dev, short type);
extern int quota_off(kdev_t dev, short type);
extern int sync_dquots(kdev_t dev, short type);
# 218 "/home/jw5/src/port/linux-current/include/linux/quota.h"
# 267 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
struct inode {
kdev_t i_dev;
unsigned long i_ino;
umode_t i_mode;
nlink_t i_nlink;
uid_t i_uid;
gid_t i_gid;
kdev_t i_rdev;
off_t i_size;
time_t i_atime;
time_t i_mtime;
time_t i_ctime;
unsigned long i_blksize;
unsigned long i_blocks;
unsigned long i_version;
unsigned long i_nrpages;
struct semaphore i_sem;
struct inode_operations *i_op;
struct super_block *i_sb;
struct wait_queue *i_wait;
struct file_lock *i_flock;
struct vm_area_struct *i_mmap;
struct page *i_pages;
struct dquot *i_dquot[2 ];
struct inode *i_next, *i_prev;
struct inode *i_hash_next, *i_hash_prev;
struct inode *i_bound_to, *i_bound_by;
struct inode *i_mount;
unsigned short i_count;
unsigned short i_flags;
unsigned char i_lock;
unsigned char i_dirt;
unsigned char i_pipe;
unsigned char i_sock;
unsigned char i_seek;
unsigned char i_update;
unsigned short i_writecount;
union {
struct pipe_inode_info pipe_i;
struct minix_inode_info minix_i;
struct ext_inode_info ext_i;
struct ext2_inode_info ext2_i;
struct hpfs_inode_info hpfs_i;
struct msdos_inode_info msdos_i;
struct umsdos_inode_info umsdos_i;
struct iso_inode_info isofs_i;
struct nfs_inode_info nfs_i;
struct xiafs_inode_info xiafs_i;
struct sysv_inode_info sysv_i;
struct affs_inode_info affs_i;
struct ufs_inode_info ufs_i;
struct socket socket_i;
void * generic_ip;
} u;
};
struct file {
mode_t f_mode;
loff_t f_pos;
unsigned short f_flags;
unsigned short f_count;
unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
struct file *f_next, *f_prev;
int f_owner;
struct inode * f_inode;
struct file_operations * f_op;
unsigned long f_version;
void *private_data;
};
struct file_lock {
struct file_lock *fl_next;
struct file_lock *fl_nextlink;
struct file_lock *fl_prevlink;
struct file_lock *fl_block;
struct task_struct *fl_owner;
struct wait_queue *fl_wait;
struct file *fl_file;
char fl_flags;
char fl_type;
off_t fl_start;
off_t fl_end;
};
# 1 "/home/jw5/src/port/linux-current/include/linux/fcntl.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/fcntl.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/fcntl.h" 1
struct flock {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
# 7 "/home/jw5/src/port/linux-current/include/asm/fcntl.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/fcntl.h" 2
# 353 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
extern int fcntl_getlk(unsigned int fd, struct flock *l);
extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l);
extern void locks_remove_locks(struct task_struct *task, struct file *filp);
extern int locks_mandatory_locked(struct inode *inode);
extern int locks_mandatory_area(int read_write, struct inode *inode,
struct file *filp, unsigned int offset,
unsigned int count);
extern inline int locks_verify_locked(struct inode *inode)
{
return (0);
}
extern inline int locks_verify_area(int read_write, struct inode *inode,
struct file *filp, unsigned int offset,
unsigned int count)
{
return (0);
}
struct fasync_struct {
int magic;
struct fasync_struct *fa_next;
struct file *fa_file;
};
extern int fasync_helper(struct inode *, struct file *, int, struct fasync_struct **);
# 1 "/home/jw5/src/port/linux-current/include/linux/minix_fs_sb.h" 1
struct minix_sb_info {
unsigned long s_ninodes;
unsigned long s_nzones;
unsigned long s_imap_blocks;
unsigned long s_zmap_blocks;
unsigned long s_firstdatazone;
unsigned long s_log_zone_size;
unsigned long s_max_size;
struct buffer_head * s_imap[8];
struct buffer_head * s_zmap[64];
unsigned long s_dirsize;
unsigned long s_namelen;
struct buffer_head * s_sbh;
struct minix_super_block * s_ms;
unsigned short s_mount_state;
unsigned short s_version;
};
# 405 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ext_fs_sb.h" 1
struct ext_sb_info {
unsigned long s_ninodes;
unsigned long s_nzones;
unsigned long s_firstdatazone;
unsigned long s_log_zone_size;
unsigned long s_max_size;
unsigned long s_firstfreeblocknumber;
unsigned long s_freeblockscount;
struct buffer_head * s_firstfreeblock;
unsigned long s_firstfreeinodenumber;
unsigned long s_freeinodescount;
struct buffer_head * s_firstfreeinodeblock;
};
# 406 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ext2_fs_sb.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/ext2_fs.h" 1
struct ext2_acl_header
{
__u32 aclh_size;
__u32 aclh_file_count;
__u32 aclh_acle_count;
__u32 aclh_first_acle;
};
struct ext2_acl_entry
{
__u32 acle_size;
__u16 acle_perms;
__u16 acle_type;
__u16 acle_tag;
__u16 acle_pad1;
__u32 acle_next;
};
struct ext2_group_desc
{
__u32 bg_block_bitmap;
__u32 bg_inode_bitmap;
__u32 bg_inode_table;
__u16 bg_free_blocks_count;
__u16 bg_free_inodes_count;
__u16 bg_used_dirs_count;
__u16 bg_pad;
__u32 bg_reserved[3];
};
struct ext2_inode {
__u16 i_mode;
__u16 i_uid;
__u32 i_size;
__u32 i_atime;
__u32 i_ctime;
__u32 i_mtime;
__u32 i_dtime;
__u16 i_gid;
__u16 i_links_count;
__u32 i_blocks;
__u32 i_flags;
union {
struct {
__u32 l_i_reserved1;
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
struct {
__u32 m_i_reserved1;
} masix1;
} osd1;
__u32 i_block[(((12 + 1) + 1) + 1) ];
__u32 i_version;
__u32 i_file_acl;
__u32 i_dir_acl;
__u32 i_faddr;
union {
struct {
__u8 l_i_frag;
__u8 l_i_fsize;
__u16 i_pad1;
__u32 l_i_reserved2[2];
} linux2;
struct {
__u8 h_i_frag;
__u8 h_i_fsize;
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
struct {
__u8 m_i_frag;
__u8 m_i_fsize;
__u16 m_pad1;
__u32 m_i_reserved2[2];
} masix2;
} osd2;
};
struct ext2_super_block {
__u32 s_inodes_count;
__u32 s_blocks_count;
__u32 s_r_blocks_count;
__u32 s_free_blocks_count;
__u32 s_free_inodes_count;
__u32 s_first_data_block;
__u32 s_log_block_size;
__s32 s_log_frag_size;
__u32 s_blocks_per_group;
__u32 s_frags_per_group;
__u32 s_inodes_per_group;
__u32 s_mtime;
__u32 s_wtime;
__u16 s_mnt_count;
__s16 s_max_mnt_count;
__u16 s_magic;
__u16 s_state;
__u16 s_errors;
__u16 s_minor_rev_level;
__u32 s_lastcheck;
__u32 s_checkinterval;
__u32 s_creator_os;
__u32 s_rev_level;
__u16 s_def_resuid;
__u16 s_def_resgid;
__u32 s_first_ino;
__u16 s_inode_size;
__u16 s_block_group_nr;
__u32 s_feature_compat;
__u32 s_feature_incompat;
__u32 s_feature_ro_compat;
__u32 s_reserved[230];
};
struct ext2_dir_entry {
__u32 inode;
__u16 rec_len;
__u16 name_len;
char name[255 ];
};
extern int ext2_permission (struct inode *, int);
extern int ext2_new_block (const struct inode *, unsigned long,
__u32 *, __u32 *, int *);
extern void ext2_free_blocks (const struct inode *, unsigned long,
unsigned long);
extern unsigned long ext2_count_free_blocks (struct super_block *);
extern void ext2_check_blocks_bitmap (struct super_block *);
extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
extern int ext2_check_dir_entry (const char *, struct inode *,
struct ext2_dir_entry *, struct buffer_head *,
unsigned long);
extern int ext2_read (struct inode *, struct file *, char *, int);
extern int ext2_write (struct inode *, struct file *, char *, int);
extern int ext2_sync_file (struct inode *, struct file *);
extern struct inode * ext2_new_inode (const struct inode *, int, int *);
extern void ext2_free_inode (struct inode *);
extern unsigned long ext2_count_free_inodes (struct super_block *);
extern void ext2_check_inodes_bitmap (struct super_block *);
extern int ext2_bmap (struct inode *, int);
extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *);
extern struct buffer_head * ext2_bread (struct inode *, int, int, int *);
extern int ext2_getcluster (struct inode * inode, long block);
extern void ext2_read_inode (struct inode *);
extern void ext2_write_inode (struct inode *);
extern void ext2_put_inode (struct inode *);
extern int ext2_sync_inode (struct inode *);
extern void ext2_discard_prealloc (struct inode *);
extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
extern void ext2_release (struct inode *, struct file *);
extern int ext2_lookup (struct inode *,const char *, int, struct inode **);
extern int ext2_create (struct inode *,const char *, int, int,
struct inode **);
extern int ext2_mkdir (struct inode *, const char *, int, int);
extern int ext2_rmdir (struct inode *, const char *, int);
extern int ext2_unlink (struct inode *, const char *, int);
extern int ext2_symlink (struct inode *, const char *, int, const char *);
extern int ext2_link (struct inode *, struct inode *, const char *, int);
extern int ext2_mknod (struct inode *, const char *, int, int, int);
extern int ext2_rename (struct inode *, const char *, int,
struct inode *, const char *, int, int);
extern void ext2_error (struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4)));
extern void ext2_panic (struct super_block *, const char *,
const char *, ...)
__attribute__ ((noreturn, format (printf, 3, 4)));
extern void ext2_warning (struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4)));
extern void ext2_put_super (struct super_block *);
extern void ext2_write_super (struct super_block *);
extern int ext2_remount (struct super_block *, int *, char *);
extern struct super_block * ext2_read_super (struct super_block *,void *,int);
extern int init_ext2_fs(void);
extern void ext2_statfs (struct super_block *, struct statfs *, int);
extern void ext2_truncate (struct inode *);
extern struct inode_operations ext2_dir_inode_operations;
extern struct inode_operations ext2_file_inode_operations;
extern struct inode_operations ext2_symlink_inode_operations;
# 19 "/home/jw5/src/port/linux-current/include/linux/ext2_fs_sb.h" 2
struct ext2_sb_info {
unsigned long s_frag_size;
unsigned long s_frags_per_block;
unsigned long s_inodes_per_block;
unsigned long s_frags_per_group;
unsigned long s_blocks_per_group;
unsigned long s_inodes_per_group;
unsigned long s_itb_per_group;
unsigned long s_db_per_group;
unsigned long s_desc_per_block;
unsigned long s_groups_count;
struct buffer_head * s_sbh;
struct ext2_super_block * s_es;
struct buffer_head ** s_group_desc;
unsigned short s_loaded_inode_bitmaps;
unsigned short s_loaded_block_bitmaps;
unsigned long s_inode_bitmap_number[8 ];
struct buffer_head * s_inode_bitmap[8 ];
unsigned long s_block_bitmap_number[8 ];
struct buffer_head * s_block_bitmap[8 ];
int s_rename_lock;
struct wait_queue * s_rename_wait;
unsigned long s_mount_opt;
unsigned short s_resuid;
unsigned short s_resgid;
unsigned short s_mount_state;
unsigned short s_pad;
int s_addr_per_block_bits;
int s_desc_per_block_bits;
int s_inode_size;
int s_first_ino;
};
# 407 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/hpfs_fs_sb.h" 1
struct hpfs_sb_info {
ino_t sb_root;
unsigned sb_fs_size;
unsigned sb_bitmaps;
unsigned sb_dirband_size;
unsigned sb_dmap;
unsigned sb_n_free;
unsigned sb_n_free_dnodes;
uid_t sb_uid;
gid_t sb_gid;
umode_t sb_mode;
unsigned sb_lowercase : 1;
unsigned sb_conv : 2;
};
# 408 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/msdos_fs_sb.h" 1
struct fat_mount_options {
uid_t fs_uid;
gid_t fs_gid;
unsigned short fs_umask;
unsigned char name_check;
unsigned char conversion;
unsigned quiet:1,
showexec:1,
sys_immutable:1,
dotsOK:1,
isvfat:1,
unicode_xlate:1,
posixfs:1,
numtail:1;
};
struct msdos_sb_info {
unsigned short cluster_size;
unsigned char fats,fat_bits;
unsigned short fat_start,fat_length;
unsigned short dir_start,dir_entries;
unsigned short data_start;
unsigned long clusters;
struct wait_queue *fat_wait;
int fat_lock;
int prev_free;
int free_clusters;
struct fat_mount_options options;
};
# 409 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/iso_fs_sb.h" 1
struct isofs_sb_info {
unsigned long s_ninodes;
unsigned long s_nzones;
unsigned long s_firstdatazone;
unsigned long s_log_zone_size;
unsigned long s_max_size;
unsigned char s_high_sierra;
unsigned char s_mapping;
unsigned char s_conversion;
unsigned char s_rock;
unsigned char s_name_check;
unsigned char s_cruft;
unsigned char s_unhide;
unsigned char s_nosuid;
unsigned char s_nodev;
mode_t s_mode;
gid_t s_gid;
uid_t s_uid;
};
# 410 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/nfs_fs_sb.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/rpcsock.h" 1
struct rpc_timeout {
unsigned long to_initval,
to_maxval,
to_increment;
int to_retries;
char to_exponential;
};
struct rpc_ioreq {
struct rpc_wait * rq_slot;
struct sockaddr * rq_addr;
int rq_alen;
struct iovec rq_svec[16 ];
unsigned int rq_snr;
unsigned long rq_slen;
struct iovec rq_rvec[16 ];
unsigned int rq_rnr;
unsigned long rq_rlen;
};
struct rpc_wait;
typedef void (*rpc_callback_fn_t)(int, struct rpc_wait *, void *);
struct rpc_wait {
struct rpc_sock * w_sock;
struct rpc_wait * w_prev;
struct rpc_wait * w_next;
struct rpc_ioreq * w_req;
int w_result;
struct wait_queue * w_wait;
rpc_callback_fn_t w_handler;
void * w_cdata;
char w_queued;
char w_gotit;
__u32 w_xid;
};
struct rpc_sock {
struct file * file;
struct socket * sock;
struct sock * inet;
struct rpc_wait waiting[32 ];
unsigned long cong;
unsigned long cwnd;
struct rpc_wait * pending;
struct rpc_wait * free;
struct wait_queue * backlog;
struct wait_queue * shutwait;
int shutdown;
};
int rpc_call(struct rpc_sock *, struct rpc_ioreq *,
struct rpc_timeout *);
int rpc_reserve(struct rpc_sock *, struct rpc_ioreq *, int);
void rpc_release(struct rpc_sock *, struct rpc_ioreq *);
int rpc_transmit(struct rpc_sock *, struct rpc_ioreq *);
int rpc_doio(struct rpc_sock *, struct rpc_ioreq *,
struct rpc_timeout *, int);
struct rpc_sock * rpc_makesock(struct file *);
int rpc_closesock(struct rpc_sock *);
# 4 "/home/jw5/src/port/linux-current/include/linux/nfs_fs_sb.h" 2
struct nfs_server {
struct file *file;
struct rpc_sock *rsock;
struct sockaddr toaddr ;
int lock;
struct wait_queue *wait;
int flags;
int rsize;
int wsize;
int timeo;
int retrans;
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
char hostname[256];
};
struct nfs_sb_info {
struct nfs_server s_server;
struct nfs_fh s_root;
};
# 411 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/xia_fs_sb.h" 1
struct xiafs_sb_info {
u_long s_nzones;
u_long s_ninodes;
u_long s_ndatazones;
u_long s_imap_zones;
u_long s_zmap_zones;
u_long s_firstdatazone;
u_long s_zone_shift;
u_long s_max_size;
struct buffer_head * s_imap_buf[8 ];
struct buffer_head * s_zmap_buf[32 ];
int s_imap_iznr[8 ];
int s_zmap_zznr[32 ];
u_char s_imap_cached;
u_char s_zmap_cached;
};
# 412 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/sysv_fs_sb.h" 1
struct sysv_sb_info {
int s_type;
unsigned int s_block_size;
unsigned int s_block_size_1;
unsigned int s_block_size_bits;
unsigned int s_block_size_ratio;
unsigned int s_block_size_ratio_bits;
char s_convert;
char s_kludge_symlinks;
char s_truncate;
nlink_t s_link_max;
unsigned int s_inodes_per_block;
unsigned int s_inodes_per_block_1;
unsigned int s_inodes_per_block_bits;
unsigned int s_ind_per_block;
unsigned int s_ind_per_block_1;
unsigned int s_ind_per_block_bits;
unsigned int s_ind_per_block_2;
unsigned int s_ind_per_block_2_1;
unsigned int s_ind_per_block_2_bits;
unsigned int s_ind_per_block_3;
unsigned int s_ind_per_block_block_size_1;
unsigned int s_ind_per_block_block_size_bits;
unsigned int s_ind_per_block_2_block_size_1;
unsigned int s_ind_per_block_2_block_size_bits;
unsigned int s_ind0_size;
unsigned int s_ind1_size;
unsigned int s_ind2_size;
unsigned int s_toobig_block;
unsigned int s_block_base;
unsigned short s_fic_size;
unsigned short s_flc_size;
struct buffer_head *s_bh1;
struct buffer_head *s_bh2;
char * s_sbd1;
char * s_sbd2;
unsigned short *s_sb_fic_count;
unsigned short *s_sb_fic_inodes;
unsigned short *s_sb_total_free_inodes;
unsigned short *s_sb_flc_count;
unsigned long *s_sb_flc_blocks;
unsigned long *s_sb_total_free_blocks;
unsigned long *s_sb_time;
unsigned long *s_sb_state;
unsigned long s_firstinodezone;
unsigned long s_firstdatazone;
unsigned long s_ninodes;
unsigned long s_ndatazones;
unsigned long s_nzones;
};
# 413 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/affs_fs_sb.h" 1
struct affs_bm_info {
struct buffer_head *bm_bh;
int bm_firstblk;
int bm_key;
int bm_count;
};
struct affs_alloc_zone {
short az_size;
short az_count;
int az_free;
};
struct affs_zone {
unsigned long z_ino;
struct affs_bm_info *z_bm;
int z_start;
int z_end;
int z_az_no;
unsigned long z_lru_time;
};
struct affs_sb_info {
int s_partition_size;
int s_root_block;
int s_hashsize;
unsigned long s_flags;
short s_uid;
short s_gid;
umode_t s_mode;
int s_reserved;
struct buffer_head *s_root_bh;
struct affs_bm_info *s_bitmap;
int s_bm_count;
int s_nextzone;
int s_num_az;
struct affs_zone *s_zones;
struct affs_alloc_zone *s_alloc;
char *s_zonemap;
char *s_prefix;
int s_prefix_len;
char s_volume[32];
};
# 414 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/ufs_fs_sb.h" 1
struct ufs_sb_info {
struct ufs_superblock * s_raw_sb;
__u32 s_flags;
__u32 s_ncg;
__u32 s_ipg;
__u32 s_fpg;
__u32 s_fsize;
__u32 s_bsize;
__u32 s_iblkno;
__u32 s_dblkno;
__u32 s_cgoffset;
__u32 s_cgmask;
__u32 s_inopb;
__u32 s_fsfrag;
};
# 415 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
struct super_block {
kdev_t s_dev;
unsigned long s_blocksize;
unsigned char s_blocksize_bits;
unsigned char s_lock;
unsigned char s_rd_only;
unsigned char s_dirt;
struct file_system_type *s_type;
struct super_operations *s_op;
struct dquot_operations *dq_op;
unsigned long s_flags;
unsigned long s_magic;
unsigned long s_time;
struct inode * s_covered;
struct inode * s_mounted;
struct wait_queue * s_wait;
union {
struct minix_sb_info minix_sb;
struct ext_sb_info ext_sb;
struct ext2_sb_info ext2_sb;
struct hpfs_sb_info hpfs_sb;
struct msdos_sb_info msdos_sb;
struct isofs_sb_info isofs_sb;
struct nfs_sb_info nfs_sb;
struct xiafs_sb_info xiafs_sb;
struct sysv_sb_info sysv_sb;
struct affs_sb_info affs_sb;
struct ufs_sb_info ufs_sb;
void *generic_sbp;
} u;
};
typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t);
struct file_operations {
int (*lseek) (struct inode *, struct file *, off_t, int);
int (*read) (struct inode *, struct file *, char *, int);
int (*write) (struct inode *, struct file *, const char *, int);
int (*readdir) (struct inode *, struct file *, void *, filldir_t);
int (*select) (struct inode *, struct file *, int, select_table *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
int (*mmap) (struct inode *, struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
void (*release) (struct inode *, struct file *);
int (*fsync) (struct inode *, struct file *);
int (*fasync) (struct inode *, struct file *, int);
int (*check_media_change) (kdev_t dev);
int (*revalidate) (kdev_t dev);
};
struct inode_operations {
struct file_operations * default_file_ops;
int (*create) (struct inode *,const char *,int,int,struct inode **);
int (*lookup) (struct inode *,const char *,int,struct inode **);
int (*link) (struct inode *,struct inode *,const char *,int);
int (*unlink) (struct inode *,const char *,int);
int (*symlink) (struct inode *,const char *,int,const char *);
int (*mkdir) (struct inode *,const char *,int,int);
int (*rmdir) (struct inode *,const char *,int);
int (*mknod) (struct inode *,const char *,int,int,int);
int (*rename) (struct inode *,const char *,int,struct inode *,const char *,int, int);
int (*readlink) (struct inode *,char *,int);
int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **);
int (*readpage) (struct inode *, struct page *);
int (*writepage) (struct inode *, struct page *);
int (*bmap) (struct inode *,int);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int);
int (*smap) (struct inode *,int);
};
struct super_operations {
void (*read_inode) (struct inode *);
int (*notify_change) (struct inode *, struct iattr *);
void (*write_inode) (struct inode *);
void (*put_inode) (struct inode *);
void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *);
void (*statfs) (struct super_block *, struct statfs *, int);
int (*remount_fs) (struct super_block *, int *, char *);
};
struct dquot_operations {
void (*initialize) (struct inode *, short);
void (*drop) (struct inode *);
int (*alloc_block) (const struct inode *, unsigned long);
int (*alloc_inode) (const struct inode *, unsigned long);
void (*free_block) (const struct inode *, unsigned long);
void (*free_inode) (const struct inode *, unsigned long);
int (*transfer) (struct inode *, struct iattr *, char);
};
struct file_system_type {
struct super_block *(*read_super) (struct super_block *, void *, int);
const char *name;
int requires_dev;
struct file_system_type * next;
};
extern int register_filesystem(struct file_system_type *);
extern int unregister_filesystem(struct file_system_type *);
int sys_open(const char *, int, int);
int sys_close(unsigned int);
extern void kill_fasync(struct fasync_struct *fa, int sig);
extern int getname(const char * filename, char **result);
extern void putname(char * name);
extern int do_truncate(struct inode *, unsigned long);
extern int register_blkdev(unsigned int, const char *, struct file_operations *);
extern int unregister_blkdev(unsigned int major, const char * name);
extern int blkdev_open(struct inode * inode, struct file * filp);
extern void blkdev_release (struct inode * inode);
extern struct file_operations def_blk_fops;
extern struct inode_operations blkdev_inode_operations;
extern int register_chrdev(unsigned int, const char *, struct file_operations *);
extern int unregister_chrdev(unsigned int major, const char * name);
extern int chrdev_open(struct inode * inode, struct file * filp);
extern struct file_operations def_chr_fops;
extern struct inode_operations chrdev_inode_operations;
extern void init_fifo(struct inode * inode);
extern struct inode_operations fifo_inode_operations;
extern struct file_operations connecting_fifo_fops;
extern struct file_operations read_fifo_fops;
extern struct file_operations write_fifo_fops;
extern struct file_operations rdwr_fifo_fops;
extern struct file_operations read_pipe_fops;
extern struct file_operations write_pipe_fops;
extern struct file_operations rdwr_pipe_fops;
extern struct file_system_type *get_fs_type(const char *name);
extern int fs_may_mount(kdev_t dev);
extern int fs_may_umount(kdev_t dev, struct inode * mount_root);
extern int fs_may_remount_ro(kdev_t dev);
extern struct file *first_file;
extern struct super_block super_blocks[64 ];
extern void refile_buffer(struct buffer_head * buf);
extern void set_writetime(struct buffer_head * buf, int flag);
extern void refill_freelist(int size);
extern int try_to_free_buffer(struct buffer_head*, struct buffer_head**, int);
extern int nr_buffers;
extern int buffermem;
extern int nr_buffer_heads;
void mark_buffer_uptodate(struct buffer_head * bh, int on);
extern inline void mark_buffer_clean(struct buffer_head * bh)
{
if (clear_bit(1 , &bh->b_state)) {
if (bh->b_list == 4 )
refile_buffer(bh);
}
}
extern inline void mark_buffer_dirty(struct buffer_head * bh, int flag)
{
if (!set_bit(1 , &bh->b_state)) {
set_writetime(bh, flag);
if (bh->b_list != 4 )
refile_buffer(bh);
}
}
extern int check_disk_change(kdev_t dev);
extern void invalidate_inodes(kdev_t dev);
extern void invalidate_inode_pages(struct inode *);
extern void invalidate_buffers(kdev_t dev);
extern int floppy_is_wp(int minor);
extern void sync_inodes(kdev_t dev);
extern void sync_dev(kdev_t dev);
extern int fsync_dev(kdev_t dev);
extern void sync_supers(kdev_t dev);
extern int bmap(struct inode * inode,int block);
extern int notify_change(struct inode *, struct iattr *);
extern int namei(const char * pathname, struct inode ** res_inode);
extern int lnamei(const char * pathname, struct inode ** res_inode);
extern int permission(struct inode * inode,int mask);
extern int get_write_access(struct inode *inode);
extern void put_write_access(struct inode *inode);
extern int open_namei(const char * pathname, int flag, int mode,
struct inode ** res_inode, struct inode * base);
extern int do_mknod(const char * filename, int mode, dev_t dev);
extern int do_pipe(int *);
extern void iput(struct inode * inode);
extern struct inode * __iget(struct super_block * sb,int nr,int crsmnt);
extern struct inode * get_empty_inode(void);
extern void insert_inode_hash(struct inode *);
extern void clear_inode(struct inode *);
extern struct inode * get_pipe_inode(void);
extern int get_unused_fd(void);
extern void put_unused_fd(int);
extern struct file * get_empty_filp(void);
extern int close_fp(struct file *filp);
extern struct buffer_head * get_hash_table(kdev_t dev, int block, int size);
extern struct buffer_head * getblk(kdev_t dev, int block, int size);
extern void ll_rw_block(int rw, int nr, struct buffer_head * bh[]);
extern void ll_rw_page(int rw, kdev_t dev, unsigned long nr, char * buffer);
extern void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buffer);
extern int is_read_only(kdev_t dev);
extern void __brelse(struct buffer_head *buf);
extern inline void brelse(struct buffer_head *buf)
{
if (buf)
__brelse(buf);
}
extern void __bforget(struct buffer_head *buf);
extern inline void bforget(struct buffer_head *buf)
{
if (buf)
__bforget(buf);
}
extern void set_blocksize(kdev_t dev, int size);
extern struct buffer_head * bread(kdev_t dev, int block, int size);
extern struct buffer_head * breada(kdev_t dev,int block, int size,
unsigned int pos, unsigned int filesize);
extern int generic_readpage(struct inode *, struct page *);
extern int generic_file_read(struct inode *, struct file *, char *, int);
extern int generic_file_mmap(struct inode *, struct file *, struct vm_area_struct *);
extern int brw_page(int, struct page *, kdev_t, int [], int, int);
extern void put_super(kdev_t dev);
unsigned long generate_cluster(kdev_t dev, int b[], int size);
extern kdev_t ROOT_DEV;
extern void show_buffers(void);
extern void mount_root(void);
extern int char_read(struct inode *, struct file *, char *, int);
extern int block_read(struct inode *, struct file *, char *, int);
extern int read_ahead[];
extern int char_write(struct inode *, struct file *, const char *, int);
extern int block_write(struct inode *, struct file *, const char *, int);
extern int block_fsync(struct inode *, struct file *);
extern int file_fsync(struct inode *, struct file *);
extern void dcache_add(struct inode *, const char *, int, unsigned long);
extern int dcache_lookup(struct inode *, const char *, int, unsigned long *);
extern int inode_change_ok(struct inode *, struct iattr *);
extern void inode_setattr(struct inode *, struct iattr *);
extern inline struct inode * iget(struct super_block * sb,int nr)
{
return __iget(sb, nr, 1);
}
# 1 "/home/jw5/src/port/linux-current/include/linux/minix_fs.h" 1
struct minix_inode {
__u16 i_mode;
__u16 i_uid;
__u32 i_size;
__u32 i_time;
__u8 i_gid;
__u8 i_nlinks;
__u16 i_zone[9];
};
struct minix2_inode {
__u16 i_mode;
__u16 i_nlinks;
__u16 i_uid;
__u16 i_gid;
__u32 i_size;
__u32 i_atime;
__u32 i_mtime;
__u32 i_ctime;
__u32 i_zone[10];
};
struct minix_super_block {
__u16 s_ninodes;
__u16 s_nzones;
__u16 s_imap_blocks;
__u16 s_zmap_blocks;
__u16 s_firstdatazone;
__u16 s_log_zone_size;
__u32 s_max_size;
__u16 s_magic;
__u16 s_state;
__u32 s_zones;
};
struct minix_dir_entry {
__u16 inode;
char name[0];
};
extern int minix_lookup(struct inode * dir,const char * name, int len,
struct inode ** result);
extern int minix_create(struct inode * dir,const char * name, int len, int mode,
struct inode ** result);
extern int minix_mkdir(struct inode * dir, const char * name, int len, int mode);
extern int minix_rmdir(struct inode * dir, const char * name, int len);
extern int minix_unlink(struct inode * dir, const char * name, int len);
extern int minix_symlink(struct inode * inode, const char * name, int len,
const char * symname);
extern int minix_link(struct inode * oldinode, struct inode * dir, const char * name, int len);
extern int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rdev);
extern int minix_rename(struct inode * old_dir, const char * old_name, int old_len,
struct inode * new_dir, const char * new_name, int new_len, int must_be_dir);
extern struct inode * minix_new_inode(const struct inode * dir);
extern void minix_free_inode(struct inode * inode);
extern unsigned long minix_count_free_inodes(struct super_block *sb);
extern int minix_new_block(struct super_block * sb);
extern void minix_free_block(struct super_block * sb, int block);
extern unsigned long minix_count_free_blocks(struct super_block *sb);
extern int minix_bmap(struct inode *,int);
extern struct buffer_head * minix_getblk(struct inode *, int, int);
extern struct buffer_head * minix_bread(struct inode *, int, int);
extern void minix_truncate(struct inode *);
extern void minix_put_super(struct super_block *);
extern struct super_block *minix_read_super(struct super_block *,void *,int);
extern int init_minix_fs(void);
extern void minix_write_super(struct super_block *);
extern int minix_remount (struct super_block * sb, int * flags, char * data);
extern void minix_read_inode(struct inode *);
extern void minix_write_inode(struct inode *);
extern void minix_put_inode(struct inode *);
extern void minix_statfs(struct super_block *, struct statfs *, int);
extern int minix_sync_inode(struct inode *);
extern int minix_sync_file(struct inode *, struct file *);
extern struct inode_operations minix_file_inode_operations;
extern struct inode_operations minix_dir_inode_operations;
extern struct inode_operations minix_symlink_inode_operations;
# 694 "/home/jw5/src/port/linux-current/include/linux/fs.h" 2
# 19 "/home/jw5/src/port/linux-current/include/linux/tty.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/termios.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/termios.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/termios.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/termbits.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/termbits.h" 1
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_line;
cc_t c_cc[19 ];
};
# 7 "/home/jw5/src/port/linux-current/include/asm/termbits.h" 2
# 4 "/home/jw5/src/port/linux-current/include/asm-i386/termios.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/ioctls.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/ioctls.h" 1
# 7 "/home/jw5/src/port/linux-current/include/asm/ioctls.h" 2
# 5 "/home/jw5/src/port/linux-current/include/asm-i386/termios.h" 2
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
struct termio {
unsigned short c_iflag;
unsigned short c_oflag;
unsigned short c_cflag;
unsigned short c_lflag;
unsigned char c_line;
unsigned char c_cc[8 ];
};
# 1 "/home/jw5/src/port/linux-current/include/linux/string.h" 1
extern char * ___strtok;
extern char * strcpy(char *,const char *);
extern char * strncpy(char *,const char *, __kernel_size_t);
extern char * strcat(char *, const char *);
extern char * strncat(char *, const char *, __kernel_size_t);
extern char * strchr(const char *,int);
extern char * strrchr(const char *,int);
extern char * strpbrk(const char *,const char *);
extern char * strtok(char *,const char *);
extern char * strstr(const char *,const char *);
extern __kernel_size_t strlen(const char *);
extern __kernel_size_t strnlen(const char *,__kernel_size_t);
extern __kernel_size_t strspn(const char *,const char *);
extern int strcmp(const char *,const char *);
extern int strncmp(const char *,const char *,__kernel_size_t);
extern void * memset(void *,int,__kernel_size_t);
extern void * memcpy(void *,const void *,__kernel_size_t);
extern void * memmove(void *,const void *,__kernel_size_t);
extern void * memscan(void *,int,__kernel_size_t);
extern int memcmp(const void *,const void *,__kernel_size_t);
# 1 "/home/jw5/src/port/linux-current/include/asm/string.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/string.h" 1
extern inline char * strcpy(char * dest,const char *src)
{
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
:
:"S" (src),"D" (dest):"si","di","ax","memory");
return dest;
}
extern inline char * strncpy(char * dest,const char *src,size_t count)
{
__asm__ __volatile__(
"cld\n"
"1:\tdecl %2\n\t"
"js 2f\n\t"
"lodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"rep\n\t"
"stosb\n"
"2:"
:
:"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory");
return dest;
}
extern inline char * strcat(char * dest,const char * src)
{
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
:
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx");
return dest;
}
extern inline char * strncat(char * dest,const char * src,size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n\t"
"movl %4,%3\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n"
"2:\txorl %2,%2\n\t"
"stosb"
:
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
:"si","di","ax","cx","memory");
return dest;
}
extern inline int strcmp(const char * cs,const char * ct)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"scasb\n\t"
"jne 2f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"jmp 3f\n"
"2:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%eax\n"
"3:"
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
return __res;
}
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
"scasb\n\t"
"jne 3f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n"
"2:\txorl %%eax,%%eax\n\t"
"jmp 4f\n"
"3:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%al\n"
"4:"
:"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx");
return __res;
}
extern inline char * strchr(const char * s, int c)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
"je 2f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"movl $1,%1\n"
"2:\tmovl %1,%0\n\t"
"decl %0"
:"=a" (__res):"S" (s),"0" (c):"si");
return __res;
}
extern inline char * strrchr(const char * s, int c)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
"jne 2f\n\t"
"leal -1(%%esi),%0\n"
"2:\ttestb %%al,%%al\n\t"
"jne 1b"
:"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
return __res;
}
extern inline size_t strspn(const char * cs, const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"je 1b\n"
"2:\tdecl %0"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res-cs;
}
extern inline size_t strcspn(const char * cs, const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 1b\n"
"2:\tdecl %0"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res-cs;
}
extern inline char * strpbrk(const char * cs,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 1b\n\t"
"decl %0\n\t"
"jmp 3f\n"
"2:\txorl %0,%0\n"
"3:"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res;
}
extern inline char * strstr(const char * cs,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t" "movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tmovl %4,%%edi\n\t"
"movl %%esi,%%eax\n\t"
"movl %%edx,%%ecx\n\t"
"repe\n\t"
"cmpsb\n\t"
"je 2f\n\t"
"xchgl %%eax,%%esi\n\t"
"incl %%esi\n\t"
"cmpb $0,-1(%%eax)\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"2:"
:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
:"cx","dx","di","si");
return __res;
}
extern inline size_t strlen(const char * s)
{
register int __res;
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"notl %0\n\t"
"decl %0"
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di");
return __res;
}
extern inline char * strtok(char * s,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"testl %1,%1\n\t"
"jne 1f\n\t"
"testl %0,%0\n\t"
"je 8f\n\t"
"movl %0,%1\n"
"1:\txorl %0,%0\n\t"
"movl $-1,%%ecx\n\t"
"xorl %%eax,%%eax\n\t"
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"je 7f\n\t"
"movl %%ecx,%%edx\n"
"2:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 7f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"je 2b\n\t"
"decl %1\n\t"
"cmpb $0,(%1)\n\t"
"je 7f\n\t"
"movl %1,%0\n"
"3:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 5f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 3b\n\t"
"decl %1\n\t"
"cmpb $0,(%1)\n\t"
"je 5f\n\t"
"movb $0,(%1)\n\t"
"incl %1\n\t"
"jmp 6f\n"
"5:\txorl %1,%1\n"
"6:\tcmpb $0,(%0)\n\t"
"jne 7f\n\t"
"xorl %0,%0\n"
"7:\ttestl %0,%0\n\t"
"jne 8f\n\t"
"movl %0,%1\n"
"8:"
:"=b" (__res),"=S" (___strtok)
:"0" (___strtok),"1" (s),"g" (ct)
:"ax","cx","dx","di","memory");
return __res;
}
extern inline void * __memcpy(void * to, const void * from, size_t n)
{
__asm__ __volatile__(
"cld\n\t"
"rep ; movsl\n\t"
"testb $2,%b1\n\t"
"je 1f\n\t"
"movsw\n"
"1:\ttestb $1,%b1\n\t"
"je 2f\n\t"
"movsb\n"
"2:"
:
:"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from)
: "cx","di","si","memory");
return (to);
}
extern inline void * __constant_memcpy(void * to, const void * from, size_t n)
{
switch (n) {
case 0:
return to;
case 1:
*(unsigned char *)to = *(const unsigned char *)from;
return to;
case 2:
*(unsigned short *)to = *(const unsigned short *)from;
return to;
case 3:
*(unsigned short *)to = *(const unsigned short *)from;
*(2+(unsigned char *)to) = *(2+(const unsigned char *)from);
return to;
case 4:
*(unsigned long *)to = *(const unsigned long *)from;
return to;
case 8:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
return to;
case 12:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
return to;
case 16:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
return to;
case 20:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
*(4+(unsigned long *)to) = *(4+(const unsigned long *)from);
return to;
}
switch (n % 4) {
case 0: __asm__("cld\n\t" "rep ; movsl" "" : : "c" (n/4),"D" ((long) to),"S" ((long) from) : "cx","di","si","memory"); ; return to;
case 1: __asm__("cld\n\t" "rep ; movsl" "\n\tmovsb" : : "c" (n/4),"D" ((long) to),"S" ((long) from) : "cx","di","si","memory"); ; return to;
case 2: __asm__("cld\n\t" "rep ; movsl" "\n\tmovsw" : : "c" (n/4),"D" ((long) to),"S" ((long) from) : "cx","di","si","memory"); ; return to;
case 3: __asm__("cld\n\t" "rep ; movsl" "\n\tmovsw\n\tmovsb" : : "c" (n/4),"D" ((long) to),"S" ((long) from) : "cx","di","si","memory"); ; return to;
}
}
extern inline void * memmove(void * dest,const void * src, size_t n)
{
if (dest<src)
__asm__ __volatile__(
"cld\n\t"
"rep\n\t"
"movsb"
:
:"c" (n),"S" (src),"D" (dest)
:"cx","si","di");
else
__asm__ __volatile__(
"std\n\t"
"rep\n\t"
"movsb\n\t"
"cld"
:
:"c" (n),
"S" (n-1+(const char *)src),
"D" (n-1+(char *)dest)
:"cx","si","di","memory");
return dest;
}
extern inline void * memchr(const void * cs,int c,size_t count)
{
register void * __res;
if (!count)
return ((void *) 0) ;
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"je 1f\n\t"
"movl $1,%0\n"
"1:\tdecl %0"
:"=D" (__res):"a" (c),"D" (cs),"c" (count)
:"cx");
return __res;
}
extern inline void * __memset_generic(void * s, char c,size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"rep\n\t"
"stosb"
:
:"a" (c),"D" (s),"c" (count)
:"cx","di","memory");
return s;
}
extern inline void * __constant_c_memset(void * s, unsigned long c, size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"rep ; stosl\n\t"
"testb $2,%b1\n\t"
"je 1f\n\t"
"stosw\n"
"1:\ttestb $1,%b1\n\t"
"je 2f\n\t"
"stosb\n"
"2:"
:
:"a" (c), "q" (count), "c" (count/4), "D" ((long) s)
:"cx","di","memory");
return (s);
}
extern inline size_t strnlen(const char * s, size_t count)
{
register int __res;
__asm__ __volatile__(
"movl %1,%0\n\t"
"jmp 2f\n"
"1:\tcmpb $0,(%0)\n\t"
"je 3f\n\t"
"incl %0\n"
"2:\tdecl %2\n\t"
"cmpl $-1,%2\n\t"
"jne 1b\n"
"3:\tsubl %1,%0"
:"=a" (__res):"c" (s),"d" (count));
return __res;
}
extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
{
switch (count) {
case 0:
return s;
case 1:
*(unsigned char *)s = pattern;
return s;
case 2:
*(unsigned short *)s = pattern;
return s;
case 3:
*(unsigned short *)s = pattern;
*(2+(unsigned char *)s) = pattern;
return s;
case 4:
*(unsigned long *)s = pattern;
return s;
}
switch (count % 4) {
case 0: __asm__("cld\n\t" "rep ; stosl" "" : : "a" (pattern),"c" (count/4),"D" ((long) s) : "cx","di","memory") ; return s;
case 1: __asm__("cld\n\t" "rep ; stosl" "\n\tstosb" : : "a" (pattern),"c" (count/4),"D" ((long) s) : "cx","di","memory") ; return s;
case 2: __asm__("cld\n\t" "rep ; stosl" "\n\tstosw" : : "a" (pattern),"c" (count/4),"D" ((long) s) : "cx","di","memory") ; return s;
case 3: __asm__("cld\n\t" "rep ; stosl" "\n\tstosw\n\tstosb" : : "a" (pattern),"c" (count/4),"D" ((long) s) : "cx","di","memory") ; return s;
}
}
extern inline void * memscan(void * addr, int c, size_t size)
{
if (!size)
return addr;
__asm__("cld
repnz; scasb
jnz 1f
dec %%edi
1: "
: "=D" (addr), "=c" (size)
: "0" (addr), "1" (size), "a" (c));
return addr;
}
# 7 "/home/jw5/src/port/linux-current/include/asm/string.h" 2
# 39 "/home/jw5/src/port/linux-current/include/linux/string.h" 2
# 58 "/home/jw5/src/port/linux-current/include/asm-i386/termios.h" 2
extern inline void trans_from_termio(struct termio * termio,
struct termios * termios)
{
(*(unsigned short *)(& termios->c_iflag ) = ( termio->c_iflag )) ;
(*(unsigned short *)(& termios->c_oflag ) = ( termio->c_oflag )) ;
(*(unsigned short *)(& termios->c_cflag ) = ( termio->c_cflag )) ;
(*(unsigned short *)(& termios->c_lflag ) = ( termio->c_lflag )) ;
(__builtin_constant_p( 8 ) ? __constant_memcpy(( termios->c_cc ),( termio->c_cc ),( 8 )) : __memcpy(( termios->c_cc ),( termio->c_cc ),( 8 ))) ;
}
extern inline void trans_to_termio(struct termios * termios,
struct termio * termio)
{
termio->c_iflag = termios->c_iflag;
termio->c_oflag = termios->c_oflag;
termio->c_cflag = termios->c_cflag;
termio->c_lflag = termios->c_lflag;
termio->c_line = termios->c_line;
(__builtin_constant_p( 8 ) ? __constant_memcpy(( termio->c_cc ),( termios->c_cc ),( 8 )) : __memcpy(( termio->c_cc ),( termios->c_cc ),( 8 ))) ;
}
# 7 "/home/jw5/src/port/linux-current/include/asm/termios.h" 2
# 5 "/home/jw5/src/port/linux-current/include/linux/termios.h" 2
# 20 "/home/jw5/src/port/linux-current/include/linux/tty.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/tqueue.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/system.h" 1
# 92 "/home/jw5/src/port/linux-current/include/asm/system.h"
# 125 "/home/jw5/src/port/linux-current/include/asm/system.h"
# 17 "/home/jw5/src/port/linux-current/include/linux/tqueue.h" 2
struct tq_struct {
struct tq_struct *next;
int sync;
void (*routine)(void *);
void *data;
};
typedef struct tq_struct * task_queue;
extern task_queue tq_timer, tq_immediate, tq_scheduler, tq_disk;
extern __inline__ void queue_task_irq(struct tq_struct *bh_pointer,
task_queue *bh_list)
{
if (!set_bit(0,&bh_pointer->sync)) {
bh_pointer->next = *bh_list;
*bh_list = bh_pointer;
}
}
extern __inline__ void queue_task_irq_off(struct tq_struct *bh_pointer,
task_queue *bh_list)
{
if (!(bh_pointer->sync & 1)) {
bh_pointer->sync = 1;
bh_pointer->next = *bh_list;
*bh_list = bh_pointer;
}
}
extern __inline__ void queue_task(struct tq_struct *bh_pointer,
task_queue *bh_list)
{
if (!set_bit(0,&bh_pointer->sync)) {
unsigned long flags;
__new_save_flags((unsigned long *) & flags ) ;
do { __new_cli(); __asm__ __volatile__ ("" : : :"memory") ; } while (0) ;
bh_pointer->next = *bh_list;
*bh_list = bh_pointer;
do { __asm__ __volatile__ ("" : : :"memory") ; __new_restore_flags( flags ); __asm__ __volatile__ ("" : : :"memory") ; } while (0) ;
}
}
extern __inline__ void run_task_queue(task_queue *list)
{
struct tq_struct *p;
p = ((__typeof__(*( list )))__xchg((unsigned long)( ((void *) 0) ),( list ),sizeof(*( list )))) ;
while (p) {
void *arg;
void (*f) (void *);
struct tq_struct *save_p;
arg = p -> data;
f = p -> routine;
save_p = p;
p = p -> next;
save_p -> sync = 0;
(*f)(arg);
}
}
# 21 "/home/jw5/src/port/linux-current/include/linux/tty.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/tty_driver.h" 1
struct tty_driver {
int magic;
const char *name;
int name_base;
short major;
short minor_start;
short num;
short type;
short subtype;
struct termios init_termios;
int flags;
int *refcount;
struct tty_driver *other;
struct tty_struct **table;
struct termios **termios;
struct termios **termios_locked;
int (*open)(struct tty_struct * tty, struct file * filp);
void (*close)(struct tty_struct * tty, struct file * filp);
int (*write)(struct tty_struct * tty, int from_user,
const unsigned char *buf, int count);
void (*put_char)(struct tty_struct *tty, unsigned char ch);
void (*flush_chars)(struct tty_struct *tty);
int (*write_room)(struct tty_struct *tty);
int (*chars_in_buffer)(struct tty_struct *tty);
int (*ioctl)(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg);
void (*set_termios)(struct tty_struct *tty, struct termios * old);
void (*throttle)(struct tty_struct * tty);
void (*unthrottle)(struct tty_struct * tty);
void (*stop)(struct tty_struct *tty);
void (*start)(struct tty_struct *tty);
void (*hangup)(struct tty_struct *tty);
void (*flush_buffer)(struct tty_struct *tty);
void (*set_ldisc)(struct tty_struct *tty);
struct tty_driver *next;
struct tty_driver *prev;
};
# 22 "/home/jw5/src/port/linux-current/include/linux/tty.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/tty_ldisc.h" 1
struct tty_ldisc {
int magic;
int num;
int flags;
int (*open)(struct tty_struct *);
void (*close)(struct tty_struct *);
void (*flush_buffer)(struct tty_struct *tty);
int (*chars_in_buffer)(struct tty_struct *tty);
int (*read)(struct tty_struct * tty, struct file * file,
unsigned char * buf, unsigned int nr);
int (*write)(struct tty_struct * tty, struct file * file,
const unsigned char * buf, unsigned int nr);
int (*ioctl)(struct tty_struct * tty, struct file * file,
unsigned int cmd, unsigned long arg);
void (*set_termios)(struct tty_struct *tty, struct termios * old);
int (*select)(struct tty_struct * tty, struct inode * inode,
struct file * file, int sel_type,
struct select_table_struct *wait);
void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
char *fp, int count);
int (*receive_room)(struct tty_struct *);
void (*write_wakeup)(struct tty_struct *);
};
# 23 "/home/jw5/src/port/linux-current/include/linux/tty.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/system.h" 1
# 92 "/home/jw5/src/port/linux-current/include/asm/system.h"
# 125 "/home/jw5/src/port/linux-current/include/asm/system.h"
# 25 "/home/jw5/src/port/linux-current/include/linux/tty.h" 2
struct screen_info {
unsigned char orig_x;
unsigned char orig_y;
unsigned char unused1[2];
unsigned short orig_video_page;
unsigned char orig_video_mode;
unsigned char orig_video_cols;
unsigned short unused2;
unsigned short orig_video_ega_bx;
unsigned short unused3;
unsigned char orig_video_lines;
unsigned char orig_video_isVGA;
unsigned short orig_video_points;
};
extern struct screen_info screen_info;
struct tty_flip_buffer {
struct tq_struct tqueue;
unsigned char char_buf[2* 512 ];
char flag_buf[2* 512 ];
char *char_buf_ptr;
unsigned char *flag_buf_ptr;
int count;
int buf_num;
};
struct tty_struct {
int magic;
struct tty_driver driver;
struct tty_ldisc ldisc;
struct termios *termios, *termios_locked;
int pgrp;
int session;
kdev_t device;
unsigned long flags;
int count;
struct winsize winsize;
unsigned char stopped:1, hw_stopped:1, packet:1;
unsigned char ctrl_status;
struct tty_struct *link;
struct fasync_struct *fasync;
struct tty_flip_buffer flip;
int max_flip_cnt;
struct wait_queue *write_wait;
struct wait_queue *read_wait;
void *disc_data;
void *driver_data;
unsigned int column;
unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
unsigned char closing:1;
unsigned short minimum_to_wake;
unsigned overrun_time;
int num_overrun;
unsigned long process_char_map[256/(8*sizeof(unsigned long))];
char *read_buf;
int read_head;
int read_tail;
int read_cnt;
unsigned long read_flags[4096 /(8*sizeof(unsigned long))];
int canon_data;
unsigned long canon_head;
unsigned int canon_column;
};
extern void tty_write_flush(struct tty_struct *);
extern struct termios tty_std_termios;
extern struct tty_struct * redirect;
extern struct tty_ldisc ldiscs[];
extern int fg_console, last_console, want_console;
extern int kmsg_redirect;
extern struct wait_queue * keypress_wait;
extern unsigned long con_init(unsigned long);
extern int rs_init(void);
extern int lp_init(void);
extern int pty_init(void);
extern int tty_init(void);
extern int pcxe_init(void);
extern int vcs_init(void);
extern int cy_init(void);
extern int stl_init(void);
extern int stli_init(void);
extern int riscom8_init(void);
extern int baycom_init(void);
extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
const char *routine);
extern char *_tty_name(struct tty_struct *tty, char *buf);
extern char *tty_name(struct tty_struct *tty);
extern void tty_wait_until_sent(struct tty_struct * tty, int timeout);
extern int tty_check_change(struct tty_struct * tty);
extern void stop_tty(struct tty_struct * tty);
extern void start_tty(struct tty_struct * tty);
extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
int buflen);
extern void tty_write_message(struct tty_struct *tty, char *msg);
extern int is_orphaned_pgrp(int pgrp);
extern int is_ignored(int sig);
extern int tty_signal(int sig, struct tty_struct *tty);
extern void tty_hangup(struct tty_struct * tty);
extern void tty_vhangup(struct tty_struct * tty);
extern void tty_unhangup(struct file *filp);
extern int tty_hung_up_p(struct file * filp);
extern void do_SAK(struct tty_struct *tty);
extern void disassociate_ctty(int priv);
extern struct tty_ldisc tty_ldisc_N_TTY;
extern int n_tty_ioctl(struct tty_struct * tty, struct file * file,
unsigned int cmd, unsigned long arg);
extern int rs_open(struct tty_struct * tty, struct file * filp);
extern int pty_open(struct tty_struct * tty, struct file * filp);
extern int pcxe_open(struct tty_struct *tty, struct file *filp);
extern int con_open(struct tty_struct * tty, struct file * filp);
extern void update_screen(int new_console);
extern void console_print(const char *);
extern int vt_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg);
# 28 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/sem.h" 1
# 1 "/home/jw5/src/port/linux-current/include/linux/ipc.h" 1
typedef int key_t;
struct ipc_perm
{
key_t key;
ushort uid;
ushort gid;
ushort cuid;
ushort cgid;
ushort mode;
ushort seq;
};
struct ipc_kludge {
struct msgbuf *msgp;
long msgtyp;
};
# 3 "/home/jw5/src/port/linux-current/include/linux/sem.h" 2
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
struct sem *sem_base;
struct sem_queue *sem_pending;
struct sem_queue **sem_pending_last;
struct sem_undo *undo;
ushort sem_nsems;
};
struct sembuf {
ushort sem_num;
short sem_op;
short sem_flg;
};
union semun {
int val;
struct semid_ds *buf;
ushort *array;
struct seminfo *__buf;
void *__pad;
};
struct seminfo {
int semmap;
int semmni;
int semmns;
int semmnu;
int semmsl;
int semopm;
int semume;
int semusz;
int semvmx;
int semaem;
};
struct sem {
short semval;
short sempid;
};
struct sem_queue {
struct sem_queue * next;
struct sem_queue ** prev;
struct wait_queue * sleeper;
struct sem_undo * undo;
int pid;
int status;
struct semid_ds * sma;
struct sembuf * sops;
int nsops;
};
struct sem_undo {
struct sem_undo * proc_next;
struct sem_undo * id_next;
int semid;
short * semadj;
};
int sys_semget (key_t key, int nsems, int semflg);
int sys_semop (int semid, struct sembuf *sops, unsigned nsops);
int sys_semctl (int semid, int semnum, int cmd, union semun arg);
# 29 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
extern unsigned long avenrun[];
extern int nr_running, nr_tasks;
extern int last_pid;
# 1 "/home/jw5/src/port/linux-current/include/linux/head.h" 1
typedef struct desc_struct {
unsigned long a,b;
} desc_table[256];
extern desc_table idt,gdt;
# 74 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/signal.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/signal.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/signal.h" 1
typedef unsigned long sigset_t;
typedef void (*__sighandler_t)(int);
struct sigaction {
__sighandler_t sa_handler;
sigset_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
};
# 1 "/home/jw5/src/port/linux-current/include/asm/sigcontext.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/sigcontext.h" 1
struct _fpreg {
unsigned short significand[4];
unsigned short exponent;
};
struct _fpstate {
unsigned long cw,
sw,
tag,
ipoff,
cssel,
dataoff,
datasel;
struct _fpreg _st[8];
unsigned long status;
};
struct sigcontext_struct {
unsigned short gs, __gsh;
unsigned short fs, __fsh;
unsigned short es, __esh;
unsigned short ds, __dsh;
unsigned long edi;
unsigned long esi;
unsigned long ebp;
unsigned long esp;
unsigned long ebx;
unsigned long edx;
unsigned long ecx;
unsigned long eax;
unsigned long trapno;
unsigned long err;
unsigned long eip;
unsigned short cs, __csh;
unsigned long eflags;
unsigned long esp_at_signal;
unsigned short ss, __ssh;
struct _fpstate * fpstate;
unsigned long oldmask;
unsigned long cr2;
};
# 7 "/home/jw5/src/port/linux-current/include/asm/sigcontext.h" 2
# 94 "/home/jw5/src/port/linux-current/include/asm-i386/signal.h" 2
# 7 "/home/jw5/src/port/linux-current/include/asm/signal.h" 2
# 4 "/home/jw5/src/port/linux-current/include/linux/signal.h" 2
# 76 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/param.h" 1
# 78 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/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 rlimit {
long rlim_cur;
long rlim_max;
};
# 1 "/home/jw5/src/port/linux-current/include/asm/resource.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/resource.h" 1
# 36 "/home/jw5/src/port/linux-current/include/asm-i386/resource.h"
# 7 "/home/jw5/src/port/linux-current/include/asm/resource.h" 2
# 58 "/home/jw5/src/port/linux-current/include/linux/resource.h" 2
# 79 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/timer.h" 1
struct timer_struct {
unsigned long expires;
void (*fn)(void);
};
extern unsigned long timer_active;
extern struct timer_struct timer_table[32];
struct timer_list {
struct timer_list *next;
struct timer_list *prev;
unsigned long expires;
unsigned long data;
void (*function)(unsigned long);
};
extern void add_timer(struct timer_list * timer);
extern int del_timer(struct timer_list * timer);
extern void it_real_fn(unsigned long);
extern inline void init_timer(struct timer_list * timer)
{
timer->next = ((void *) 0) ;
timer->prev = ((void *) 0) ;
}
# 81 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/processor.h" 1
# 1 "/home/jw5/src/port/linux-current/../l4/lib/libl4sys/include/l4/syscalls.h" 1
# 1 "/home/jw5/src/port/linux-current/../l4/lib/libl4sys/include/l4/kdebug.h" 1
static inline void ko(char c)
{
asm(
"int $3 \n\t"
"cmpb %0,%%al \n\t"
:
: "i" (c)
);
}
static inline void outchar(char c);
static inline void outstring(char *text);
static inline void outhex32(int number);
static inline void outhex20(int number);
static inline void outhex16(int number);
static inline void outchar(char c)
{
asm(
"int $3 \n\t"
"cmpb $0,%%al \n\t"
:
: "a" (c)
);
}
static inline void outstring(char *text)
{
asm(
"int $3 \n\t"
"cmpb $2,%%al \n\t"
:
: "a" (text)
);
}
static inline void outhex32(int number)
{
asm(
"int $3 \n\t"
"cmpb $5,%%al \n\t"
:
: "a" (number)
);
}
static inline void outhex20(int number)
{
asm(
"int $3 \n\t"
"cmpb $6,%%al \n\t"
:
: "a" (number)
);
}
static inline void outhex16(int number)
{
asm(
"int $3 \n\t"
"cmpb $7, %%al \n\t"
:
: "a" (number)
);
}
# 9 "/home/jw5/src/port/linux-current/../l4/lib/libl4sys/include/l4/syscalls.h" 2
static inline void
l4_fpage_unmap(l4_fpage_t fpage, dword_t map_mask);
static inline volatile l4_threadid_t
l4_myself(void);
static inline int
l4_nchief(l4_threadid_t destination, l4_threadid_t *next_chief);
static inline void
l4_thread_ex_regs(l4_threadid_t destination, dword_t eip, dword_t esp,
l4_threadid_t *preempter, l4_threadid_t *pager,
dword_t *old_eflags, dword_t *old_eip, dword_t *old_esp);
static inline void
l4_thread_switch(l4_threadid_t destination);
static inline volatile cpu_time_t
l4_thread_schedule(l4_threadid_t dest, l4_sched_param_t param,
l4_threadid_t *ext_preempter, l4_threadid_t *partner,
l4_sched_param_t *old_param);
static inline l4_taskid_t
l4_task_new(l4_taskid_t destination, dword_t mcp_or_new_chief,
dword_t esp, dword_t eip, l4_threadid_t pager);
static inline void
l4_fpage_unmap(l4_fpage_t fpage, dword_t map_mask)
{
__asm__
__volatile__(
"pushl %%ebp \n\t"
"int $0x32 \n\t"
"popl %%ebp \n\t"
:
:
"a" (fpage),
"c" (map_mask)
:
"ebx", "edx", "edi", "esi", "eax", "ecx"
);
};
static inline volatile l4_threadid_t
l4_myself(void)
{
l4_threadid_t temp_id;
__asm__(
"pushl %%ebp \n\t"
"int $0x31 \n\t"
"popl %%ebp \n\t"
:
"=S" (temp_id.lh.low),
"=D" (temp_id.lh.high)
:
"0" (0)
:
"eax", "ebx", "ecx", "edx"
);
return temp_id;
}
static inline int
l4_nchief(l4_threadid_t destination, l4_threadid_t *next_chief)
{
int type;
__asm__(
"pushl %%ebp \n\t"
"int $0x31 \n\t"
"popl %%ebp \n\t"
:
"=S" (next_chief->lh.low),
"=D" (next_chief->lh.high),
"=a" (type)
:
"0" (destination.lh.low),
"1" (destination.lh.high)
:
"ebx", "ecx", "edx"
);
return type;
}
static inline void
l4_thread_ex_regs(l4_threadid_t destination, dword_t eip, dword_t esp,
l4_threadid_t *preempter, l4_threadid_t *pager,
dword_t *old_eflags, dword_t *old_eip, dword_t *old_esp)
{
__asm__(
"pushl %%ebp \n\t"
"pushl %%ebx \n\t"
"movl 4(%%esi), %%edi \n\t"
"movl (%%esi), %%esi \n\t"
"movl 4(%%ebx), %%ebp \n\t"
"movl (%%ebx), %%ebx \n\t"
"int $0x35 \n\t"
"xchgl (%%esp), %%ebx \n\t"
"movl %%ebp, 4(%%ebx) \n\t"
"popl %%ebp \n\t"
"movl %%ebp, (%%ebx) \n\t"
"popl %%ebp \n\t"
:
"=a" (*old_eflags),
"=c" (*old_esp),
"=d" (*old_eip),
"=S" (pager->lh.low),
"=D" (pager->lh.high)
:
"b" (preempter),
"0" (destination.id.lthread),
"1" (esp),
"2" (eip),
"3" (pager)
:
"ebx"
);
}
static inline void
l4_thread_switch(l4_threadid_t destination)
{
__asm__
__volatile__(
"pushl %%ebp \n\t"
"int $0x33 \n\t"
"popl %%ebp \n\t"
:
:
"S" (destination.lh.low)
:
"eax", "ebx", "ecx", "edx", "edi", "esi"
);
}
static inline volatile cpu_time_t
l4_thread_schedule(l4_threadid_t dest, l4_sched_param_t param,
l4_threadid_t *ext_preempter, l4_threadid_t *partner,
l4_sched_param_t *old_param)
{
cpu_time_t temp;
__asm__
__volatile__(
"pushl %%ebp \n\t"
"pushl %%ebx \n\t"
"movl 4(%%ebx), %%ebp \n\t"
"movl (%%ebx), %%ebx \n\t"
"int $0x34 \n\t"
"xchgl (%%esp), %%ebx \n\t"
"movl %%ebp, 4(%%ebx) \n\t"
"popl %%ebp \n\t"
"movl %%ebp, (%%ebx) \n\t"
"popl %%ebp \n\t"
:
"=a" (*old_param),
"=c" (((l4_low_high_t *)&temp)->low),
"=d" (((l4_low_high_t *)&temp)->high),
"=S" (partner->lh.low),
"=D" (partner->lh.high)
:
"b" (ext_preempter),
"0" (param),
"3" (dest.lh.low),
"4" (dest.lh.high)
:
"ebx"
);
return temp;
}
static inline l4_taskid_t
l4_task_new(l4_taskid_t destination, dword_t mcp_or_new_chief,
dword_t esp, dword_t eip, l4_threadid_t pager)
{
l4_taskid_t temp_id;
__asm__
__volatile__(
"pushl %%ebp \n\t"
"movl 4(%%ebx), %%ebp \n\t"
"movl (%%ebx), %%ebx \n\t"
"int $0x36 \n\t"
"popl %%ebp \n\t"
:
"=S" (temp_id.lh.low),
"=D" (temp_id.lh.high)
:
"b" (&pager),
"a" (mcp_or_new_chief),
"c" (esp),
"d" (eip),
"0" (destination.lh.low),
"1" (destination.lh.high)
:
"eax", "ebx", "ecx", "edx"
);
return temp_id;
}
# 7 "/home/jw5/src/port/linux-current/include/asm/processor.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/../../arch/l4-i386/include/locktypes.h" 1
typedef unsigned int simple_lock_t;
# 9 "/home/jw5/src/port/linux-current/include/asm/processor.h" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/../../arch/l4-i386/include/config.h" 1
# 10 "/home/jw5/src/port/linux-current/include/asm/processor.h" 2
extern int EISA_bus;
extern int fdiv_bug;
extern char x86;
extern char hard_math;
extern char x86_vendor_id[13];
extern char x86_model;
extern char x86_mask;
extern int x86_capability;
struct exclusive_page_tag;
struct thread_struct {
struct wait_queue **wait_queue;
struct exclusive_page_tag *ex_page;
l4_threadid_t user_thread_id;
simple_lock_t under_kernel_control;
pgd_t *page_dir;
unsigned long fs;
unsigned long kernel_sp;
unsigned long flags;
unsigned long page_fault_addr;
};
void start_thread(struct pt_regs * regs, unsigned long eip, unsigned long esp);
static inline unsigned long thread_saved_pc(struct thread_struct *t)
{
return 0;
}
# 83 "/home/jw5/src/port/linux-current/include/linux/sched.h" 2
struct sched_param {
int sched_priority;
};
extern void sched_init(void);
extern void show_state(void);
extern void trap_init(void);
void schedule(void);
struct files_struct {
int count;
fd_set close_on_exec;
fd_set open_fds;
struct file * fd[256 ];
};
struct fs_struct {
int count;
unsigned short umask;
struct inode * root, * pwd;
};
struct mm_struct {
int count;
pgd_t * pgd;
unsigned long context;
unsigned long start_code, end_code, start_data, end_data;
unsigned long start_brk, brk, start_stack, start_mmap;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long rss, total_vm, locked_vm;
unsigned long def_flags;
struct vm_area_struct * mmap;
struct vm_area_struct * mmap_avl;
struct semaphore mmap_sem;
};
# 166 "/home/jw5/src/port/linux-current/include/linux/sched.h"
struct signal_struct {
int count;
struct sigaction action[32];
};
struct task_struct {
volatile long state;
long counter;
long priority;
unsigned long signal;
unsigned long blocked;
unsigned long flags;
int errno;
long debugreg[8];
struct exec_domain *exec_domain;
struct linux_binfmt *binfmt;
struct task_struct *next_task, *prev_task;
struct task_struct *next_run, *prev_run;
unsigned long saved_kernel_stack;
unsigned long kernel_stack_page;
int exit_code, exit_signal;
unsigned long personality;
int dumpable:1;
int did_exec:1;
int pid;
int pgrp;
int tty_old_pgrp;
int session;
int leader;
int groups[32 ];
struct task_struct *p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr;
struct wait_queue *wait_chldexit;
unsigned short uid,euid,suid,fsuid;
unsigned short gid,egid,sgid,fsgid;
unsigned long timeout, policy, rt_priority;
unsigned long it_real_value, it_prof_value, it_virt_value;
unsigned long it_real_incr, it_prof_incr, it_virt_incr;
struct timer_list real_timer;
long utime, stime, cutime, cstime, start_time;
unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
int swappable:1;
unsigned long swap_address;
unsigned long old_maj_flt;
unsigned long dec_flt;
unsigned long swap_cnt;
struct rlimit rlim[10 ];
unsigned short used_math;
char comm[16];
int link_count;
struct tty_struct *tty;
struct sem_undo *semundo;
struct sem_queue *semsleeping;
struct desc_struct *ldt;
struct thread_struct tss;
struct fs_struct *fs;
struct files_struct *files;
struct mm_struct *mm;
struct signal_struct *sig;
};
# 315 "/home/jw5/src/port/linux-current/include/linux/sched.h"
extern struct mm_struct init_mm;
extern struct task_struct init_task;
extern struct task_struct *task[512 ];
extern struct task_struct *last_task_used_math;
extern struct task_struct *current_set[1 ];
extern unsigned long volatile jiffies;
extern unsigned long itimer_ticks;
extern unsigned long itimer_next;
extern struct timeval xtime;
extern int need_resched;
extern void do_timer(struct pt_regs *);
extern unsigned int * prof_buffer;
extern unsigned long prof_len;
extern unsigned long prof_shift;
extern int securelevel;
extern void sleep_on(struct wait_queue ** p);
extern void interruptible_sleep_on(struct wait_queue ** p);
extern void wake_up(struct wait_queue ** p);
extern void wake_up_interruptible(struct wait_queue ** p);
extern void wake_up_process(struct task_struct * tsk);
extern void notify_parent(struct task_struct * tsk);
extern void force_sig(unsigned long sig,struct task_struct * p);
extern int send_sig(unsigned long sig,struct task_struct * p,int priv);
extern int in_group_p(gid_t grp);
extern int request_irq(unsigned int irq,
void (*handler)(int, void *, struct pt_regs *),
unsigned long flags,
const char *device,
void *dev_id);
extern void free_irq(unsigned int irq, void *dev_id);
extern inline int suser(void)
{
if ((current_set[0 ]) ->euid == 0) {
(current_set[0 ]) ->flags |= 0x00000100 ;
return 1;
}
return 0;
}
extern void copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *);
extern void flush_thread(void);
extern void exit_thread(void);
extern void exit_mm(struct task_struct *);
extern void exit_fs(struct task_struct *);
extern void exit_files(struct task_struct *);
extern void exit_sighand(struct task_struct *);
extern void release_thread(struct task_struct *);
extern int do_execve(char *, char **, char **, struct pt_regs *);
extern int do_fork(unsigned long, unsigned long, struct pt_regs *);
extern inline struct file *file_from_fd(const unsigned int fd)
{
if (fd >= 256 )
return ((void *) 0) ;
return (current_set[0 ]) ->files->fd[fd];
}
extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
struct wait_queue *head = *p;
struct wait_queue *next = ((struct wait_queue *)(( p )-1)) ;
if (head)
next = head;
*p = wait;
wait->next = next;
}
extern inline void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
unsigned long flags;
__new_save_flags((unsigned long *) & flags ) ;
do { __new_cli(); __asm__ __volatile__ ("" : : :"memory") ; } while (0) ;
(current_set[0 ]) ->tss.wait_queue = p;
__add_wait_queue(p, wait);
do { __asm__ __volatile__ ("" : : :"memory") ; __new_restore_flags( flags ); __asm__ __volatile__ ("" : : :"memory") ; } while (0) ;
}
extern inline void __remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
struct wait_queue * next = wait->next;
struct wait_queue * head = next;
for (;;) {
struct wait_queue * nextlist = head->next;
if (nextlist == wait)
break;
head = nextlist;
}
head->next = next;
}
extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
unsigned long flags;
__new_save_flags((unsigned long *) & flags ) ;
do { __new_cli(); __asm__ __volatile__ ("" : : :"memory") ; } while (0) ;
(current_set[0 ]) ->tss.wait_queue = 0;
__remove_wait_queue(p, wait);
do { __asm__ __volatile__ ("" : : :"memory") ; __new_restore_flags( flags ); __asm__ __volatile__ ("" : : :"memory") ; } while (0) ;
}
extern inline void select_wait(struct wait_queue ** wait_address, select_table * p)
{
struct select_table_entry * entry;
if (!p || !wait_address)
return;
if (p->nr >= (4096 / sizeof (struct select_table_entry)) )
return;
entry = p->entry + p->nr;
entry->wait_address = wait_address;
entry->wait.task = (current_set[0 ]) ;
entry->wait.next = ((void *) 0) ;
add_wait_queue(wait_address,&entry->wait);
p->nr++;
}
# 492 "/home/jw5/src/port/linux-current/include/linux/sched.h"
# 505 "/home/jw5/src/port/linux-current/include/linux/sched.h"
# 16 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/mm.h" 1
extern unsigned long high_memory;
# 1 "/home/jw5/src/port/linux-current/include/asm/atomic.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/atomic.h" 1
typedef int atomic_t;
static __inline__ void atomic_add(atomic_t i, atomic_t *v)
{
__asm__ __volatile__(
"" "addl %1,%0"
:"=m" ((*(struct { int a[100]; } *) v ) )
:"ir" (i), "m" ((*(struct { int a[100]; } *) v ) ));
}
static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
{
__asm__ __volatile__(
"" "subl %1,%0"
:"=m" ((*(struct { int a[100]; } *) v ) )
:"ir" (i), "m" ((*(struct { int a[100]; } *) v ) ));
}
static __inline__ void atomic_inc(atomic_t *v)
{
__asm__ __volatile__(
"" "incl %0"
:"=m" ((*(struct { int a[100]; } *) v ) )
:"m" ((*(struct { int a[100]; } *) v ) ));
}
static __inline__ void atomic_dec(atomic_t *v)
{
__asm__ __volatile__(
"" "decl %0"
:"=m" ((*(struct { int a[100]; } *) v ) )
:"m" ((*(struct { int a[100]; } *) v ) ));
}
static __inline__ int atomic_dec_and_test(atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
"" "decl %0; sete %1"
:"=m" ((*(struct { int a[100]; } *) v ) ), "=qm" (c)
:"m" ((*(struct { int a[100]; } *) v ) ));
return c != 0;
}
# 7 "/home/jw5/src/port/linux-current/include/asm/atomic.h" 2
# 15 "/home/jw5/src/port/linux-current/include/linux/mm.h" 2
extern int verify_area(int, const void *, unsigned long);
struct vm_area_struct {
struct mm_struct * vm_mm;
unsigned long vm_start;
unsigned long vm_end;
pgprot_t vm_page_prot;
unsigned short vm_flags;
short vm_avl_height;
struct vm_area_struct * vm_avl_left;
struct vm_area_struct * vm_avl_right;
struct vm_area_struct * vm_next;
struct vm_area_struct * vm_next_share;
struct vm_area_struct * vm_prev_share;
struct vm_operations_struct * vm_ops;
unsigned long vm_offset;
struct inode * vm_inode;
unsigned long vm_pte;
};
extern pgprot_t protection_map[16];
struct vm_operations_struct {
void (*open)(struct vm_area_struct * area);
void (*close)(struct vm_area_struct * area);
void (*unmap)(struct vm_area_struct *area, unsigned long, size_t);
void (*protect)(struct vm_area_struct *area, unsigned long, size_t, unsigned int newprot);
int (*sync)(struct vm_area_struct *area, unsigned long, size_t, unsigned int flags);
void (*advise)(struct vm_area_struct *area, unsigned long, size_t, unsigned int advise);
unsigned long (*nopage)(struct vm_area_struct * area, unsigned long address, int write_access);
unsigned long (*wppage)(struct vm_area_struct * area, unsigned long address,
unsigned long page);
int (*swapout)(struct vm_area_struct *, unsigned long, pte_t *);
pte_t (*swapin)(struct vm_area_struct *, unsigned long, unsigned long);
};
typedef struct page {
struct page *next;
struct page *prev;
struct inode *inode;
unsigned long offset;
struct page *next_hash;
atomic_t count;
unsigned flags;
unsigned dirty:16,
age:8;
struct wait_queue *wait;
struct page *prev_hash;
struct buffer_head * buffers;
unsigned long swap_unlock_entry;
unsigned long map_nr;
} mem_map_t;
extern mem_map_t * mem_map;
extern unsigned long __get_free_pages(int priority, unsigned long gfporder, int dma);
extern inline unsigned long get_free_page(int priority)
{
unsigned long page;
page = __get_free_pages(( priority ),0,0) ;
if (page)
(__builtin_constant_p( 0 ) ? (__builtin_constant_p( ( (1UL << 12 ) ) ) ? __constant_c_and_count_memset(( ( (void *) page ) ),( (0x01010101UL*(unsigned char) 0 ) ),( ( (1UL << 12 ) ) )) : __constant_c_memset(( ( (void *) page ) ),( (0x01010101UL*(unsigned char) 0 ) ),( ( (1UL << 12 ) ) ))) : (__builtin_constant_p( ( (1UL << 12 ) ) ) ? __memset_generic(( ( ( (void *) page ) ) ),( ( ( 0 ) ) ),( ( ( (1UL << 12 ) ) ) )) : __memset_generic(( ( (void *) page ) ),( ( 0 ) ),( ( (1UL << 12 ) ) ))) ) ;
return page;
}
extern void free_pages(unsigned long addr, unsigned long order);
extern void __free_page(struct page *);
extern void show_free_areas(void);
extern unsigned long put_dirty_page(struct task_struct * tsk,unsigned long page,
unsigned long address);
extern void free_page_tables(struct mm_struct * mm);
extern void clear_page_tables(struct task_struct * tsk);
extern int new_page_tables(struct task_struct * tsk);
extern int copy_page_tables(struct task_struct * to);
extern int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size);
extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma);
extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot);
extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot);
extern void vmtruncate(struct inode * inode, unsigned long offset);
extern void handle_mm_fault(struct vm_area_struct *vma, unsigned long address, int write_access);
extern void do_wp_page(struct task_struct * tsk, struct vm_area_struct * vma, unsigned long address, int write_access);
extern void do_no_page(struct task_struct * tsk, struct vm_area_struct * vma, unsigned long address, int write_access);
extern unsigned long paging_init(unsigned long start_mem, unsigned long end_mem);
extern void mem_init(unsigned long start_mem, unsigned long end_mem);
extern void show_mem(void);
extern void oom(struct task_struct * tsk);
extern void si_meminfo(struct sysinfo * val);
extern void * vmalloc(unsigned long size);
extern void * vremap(unsigned long offset, unsigned long size);
extern void vfree(void * addr);
extern int vread(char *buf, char *addr, int count);
extern unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long off);
extern void merge_segments(struct mm_struct *, unsigned long, unsigned long);
extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
extern void remove_shared_vm_struct(struct vm_area_struct *);
extern void build_mmap_avl(struct mm_struct *);
extern void exit_mmap(struct mm_struct *);
extern int do_munmap(unsigned long, size_t);
extern unsigned long get_unmapped_area(unsigned long, unsigned long);
extern unsigned long page_unuse(unsigned long);
extern int shrink_mmap(int, int);
extern void truncate_inode_pages(struct inode *, unsigned long);
static inline int expand_stack(struct vm_area_struct * vma, unsigned long address)
{
unsigned long grow;
address &= (~((1UL << 12 ) -1)) ;
if (vma->vm_end - address
> (unsigned long) (current_set[0 ]) ->rlim[3 ].rlim_cur)
return - 12 ;
grow = vma->vm_start - address;
vma->vm_start = address;
vma->vm_offset -= grow;
vma->vm_mm->total_vm += grow >> 12 ;
if (vma->vm_flags & 0x2000 )
vma->vm_mm->locked_vm += grow >> 12 ;
return 0;
}
static inline struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr)
{
struct vm_area_struct * result = ((void *) 0) ;
if (mm) {
struct vm_area_struct * tree = mm->mmap_avl;
for (;;) {
if (tree == (struct vm_area_struct *) ((void *) 0) )
break;
if (tree->vm_end > addr) {
result = tree;
if (tree->vm_start <= addr)
break;
tree = tree->vm_avl_left;
} else
tree = tree->vm_avl_right;
}
}
return result;
}
static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * mm, unsigned long start_addr, unsigned long end_addr)
{
struct vm_area_struct * vma;
vma = find_vma(mm,start_addr);
if (vma && end_addr <= vma->vm_start)
vma = ((void *) 0) ;
return vma;
}
# 17 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/a.out.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/a.out.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/a.out.h" 1
struct exec
{
unsigned long a_info;
unsigned a_text;
unsigned a_data;
unsigned a_bss;
unsigned a_syms;
unsigned a_entry;
unsigned a_trsize;
unsigned a_drsize;
};
# 7 "/home/jw5/src/port/linux-current/include/asm/a.out.h" 2
# 8 "/home/jw5/src/port/linux-current/include/linux/a.out.h" 2
enum machine_type {
M_OLDSUN2 = 0,
M_68010 = 1,
M_68020 = 2,
M_SPARC = 3,
M_386 = 100,
M_MIPS1 = 151,
M_MIPS2 = 152,
};
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx;
} n_un;
unsigned char n_type;
char n_other;
short n_desc;
unsigned long n_value;
};
struct relocation_info
{
int r_address;
unsigned int r_symbolnum:24;
unsigned int r_pcrel:1;
unsigned int r_length:2;
unsigned int r_extern:1;
unsigned int r_pad:4;
};
# 18 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/user.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/user.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/user.h" 1
struct user_i387_struct {
long cwd;
long swd;
long twd;
long fip;
long fcs;
long foo;
long fos;
long st_space[20];
};
struct user{
struct pt_regs regs;
int u_fpvalid;
struct user_i387_struct i387;
unsigned long int u_tsize;
unsigned long int u_dsize;
unsigned long int u_ssize;
unsigned long start_code;
unsigned long start_stack;
long int signal;
int reserved;
struct pt_regs * u_ar0;
struct user_i387_struct* u_fpstate;
unsigned long magic;
char u_comm[32];
int u_debugreg[8];
};
# 7 "/home/jw5/src/port/linux-current/include/asm/user.h" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/user.h" 2
# 19 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/segment.h" 1
extern unsigned long __pdir;
extern pgd_t swapper_pg_dir[1024];
void
put_user_byte_slow_path(unsigned char val, unsigned long address);
unsigned char
get_user_byte_slow_path(unsigned long address);
void
put_user_word_slow_path(unsigned short val, unsigned long address);
unsigned short
get_user_word_slow_path(unsigned long address);
void
put_user_long_slow_path(unsigned long val, unsigned long address);
unsigned long
get_user_long_slow_path(unsigned long address);
void
memcpy_tofs(void * to, const void * from, unsigned long n);
void
memcpy_fromfs(void * to, const void * from, unsigned long n);
# 85 "/home/jw5/src/port/linux-current/include/asm/segment.h"
# 106 "/home/jw5/src/port/linux-current/include/asm/segment.h"
# 135 "/home/jw5/src/port/linux-current/include/asm/segment.h"
# 158 "/home/jw5/src/port/linux-current/include/asm/segment.h"
# 201 "/home/jw5/src/port/linux-current/include/asm/segment.h"
void put_user_byte_pf(unsigned char val, char * address, pte_t pte); void put_user_byte (unsigned char val, char * address); unsigned char get_user_byte_pf( char * address); unsigned char get_user_byte ( char * address);
void put_user_word_pf(unsigned short val, short * address, pte_t pte); void put_user_word (unsigned short val, short * address); unsigned short get_user_word_pf( short * address); unsigned short get_user_word ( short * address);
void put_user_long_pf(unsigned long val, long * address, pte_t pte); void put_user_long (unsigned long val, long * address); unsigned long get_user_long_pf( long * address); unsigned long get_user_long ( long * address);
extern int bad_user_access_length(void);
static inline void __put_user(unsigned long val, void * addr, int size)
{
switch (size) {
case 1:
put_user_byte((unsigned char)val,
(unsigned char *)addr);
break;
case 2:
put_user_word((unsigned short)val,
(unsigned short *)addr);
break;
case 4:
put_user_long((unsigned long)val,
(unsigned long *)addr);
break;
default:
bad_user_access_length();
}
}
static inline unsigned long __get_user(const void * y, int size)
{
switch (size) {
case 1:
return get_user_byte((unsigned char *)y);
case 2:
return get_user_word((unsigned short *)y);
case 4:
return get_user_long((unsigned long *)y);
default:
return bad_user_access_length();
}
}
static inline unsigned short get_fs(void)
{
return (current_set[0 ]) ->tss.fs >> 16;
}
static inline unsigned short get_ds(void)
{
return 0 ;
}
void set_fs(unsigned short val);
# 20 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/io.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/io.h" 1
extern inline unsigned long virt_to_phys(volatile void * address)
{
return (unsigned long) address;
}
extern inline void * phys_to_virt(unsigned long address)
{
return (void *) address;
}
extern inline unsigned char __inb (unsigned short port) { unsigned char _v; __asm__ __volatile__ ("in" "b" " %" "w" "1,%" "" "0" : "=a" (_v) : "d" (port) ); return _v; } extern inline unsigned char __inbc (unsigned short port) { unsigned char _v; __asm__ __volatile__ ("in" "b" " %" "" "1,%" "" "0" : "=a" (_v) : "id" (port) ); return _v; } extern inline unsigned char __inb_p (unsigned short port) { unsigned char _v; __asm__ __volatile__ ("in" "b" " %" "w" "1,%" "" "0" : "=a" (_v) : "d" (port) ); __asm__ __volatile__("outb %al,$0x80") ; return _v; } extern inline unsigned char __inbc_p (unsigned short port) { unsigned char _v; __asm__ __volatile__ ("in" "b" " %" "" "1,%" "" "0" : "=a" (_v) : "id" (port) ); __asm__ __volatile__("outb %al,$0x80") ; return _v; }
extern inline unsigned short __inw (unsigned short port) { unsigned short _v; __asm__ __volatile__ ("in" "w" " %" "w" "1,%" "" "0" : "=a" (_v) : "d" (port) ); return _v; } extern inline unsigned short __inwc (unsigned short port) { unsigned short _v; __asm__ __volatile__ ("in" "w" " %" "" "1,%" "" "0" : "=a" (_v) : "id" (port) ); return _v; } extern inline unsigned short __inw_p (unsigned short port) { unsigned short _v; __asm__ __volatile__ ("in" "w" " %" "w" "1,%" "" "0" : "=a" (_v) : "d" (port) ); __asm__ __volatile__("outb %al,$0x80") ; return _v; } extern inline unsigned short __inwc_p (unsigned short port) { unsigned short _v; __asm__ __volatile__ ("in" "w" " %" "" "1,%" "" "0" : "=a" (_v) : "id" (port) ); __asm__ __volatile__("outb %al,$0x80") ; return _v; }
extern inline unsigned int __inl (unsigned short port) { unsigned int _v; __asm__ __volatile__ ("in" "l" " %" "w" "1,%" "" "0" : "=a" (_v) : "d" (port) ); return _v; } extern inline unsigned int __inlc (unsigned short port) { unsigned int _v; __asm__ __volatile__ ("in" "l" " %" "" "1,%" "" "0" : "=a" (_v) : "id" (port) ); return _v; } extern inline unsigned int __inl_p (unsigned short port) { unsigned int _v; __asm__ __volatile__ ("in" "l" " %" "w" "1,%" "" "0" : "=a" (_v) : "d" (port) ); __asm__ __volatile__("outb %al,$0x80") ; return _v; } extern inline unsigned int __inlc_p (unsigned short port) { unsigned int _v; __asm__ __volatile__ ("in" "l" " %" "" "1,%" "" "0" : "=a" (_v) : "id" (port) ); __asm__ __volatile__("outb %al,$0x80") ; return _v; }
extern inline void __outb (unsigned char value, unsigned short port) { __asm__ __volatile__ ("out" "b" " %" "b" "0,%" "w" "1" : : "a" (value), "d" (port)); } extern inline void __outbc (unsigned char value, unsigned short port) { __asm__ __volatile__ ("out" "b" " %" "b" "0,%" "" "1" : : "a" (value), "id" (port)); } extern inline void __outb_p (unsigned char value, unsigned short port) { __asm__ __volatile__ ("out" "b" " %" "b" "0,%" "w" "1" : : "a" (value), "d" (port)); __asm__ __volatile__("outb %al,$0x80") ; } extern inline void __outbc_p (unsigned char value, unsigned short port) { __asm__ __volatile__ ("out" "b" " %" "b" "0,%" "" "1" : : "a" (value), "id" (port)); __asm__ __volatile__("outb %al,$0x80") ; }
extern inline void __outw (unsigned short value, unsigned short port) { __asm__ __volatile__ ("out" "w" " %" "w" "0,%" "w" "1" : : "a" (value), "d" (port)); } extern inline void __outwc (unsigned short value, unsigned short port) { __asm__ __volatile__ ("out" "w" " %" "w" "0,%" "" "1" : : "a" (value), "id" (port)); } extern inline void __outw_p (unsigned short value, unsigned short port) { __asm__ __volatile__ ("out" "w" " %" "w" "0,%" "w" "1" : : "a" (value), "d" (port)); __asm__ __volatile__("outb %al,$0x80") ; } extern inline void __outwc_p (unsigned short value, unsigned short port) { __asm__ __volatile__ ("out" "w" " %" "w" "0,%" "" "1" : : "a" (value), "id" (port)); __asm__ __volatile__("outb %al,$0x80") ; }
extern inline void __outl (unsigned int value, unsigned short port) { __asm__ __volatile__ ("out" "l" " %" "0,%" "w" "1" : : "a" (value), "d" (port)); } extern inline void __outlc (unsigned int value, unsigned short port) { __asm__ __volatile__ ("out" "l" " %" "0,%" "" "1" : : "a" (value), "id" (port)); } extern inline void __outl_p (unsigned int value, unsigned short port) { __asm__ __volatile__ ("out" "l" " %" "0,%" "w" "1" : : "a" (value), "d" (port)); __asm__ __volatile__("outb %al,$0x80") ; } extern inline void __outlc_p (unsigned int value, unsigned short port) { __asm__ __volatile__ ("out" "l" " %" "0,%" "" "1" : : "a" (value), "id" (port)); __asm__ __volatile__("outb %al,$0x80") ; }
extern inline void insb (unsigned short port, void * addr, unsigned long count) { __asm__ __volatile__ ("cld ; rep ; ins" "b" : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
extern inline void insw (unsigned short port, void * addr, unsigned long count) { __asm__ __volatile__ ("cld ; rep ; ins" "w" : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
extern inline void insl (unsigned short port, void * addr, unsigned long count) { __asm__ __volatile__ ("cld ; rep ; ins" "l" : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
extern inline void outsb (unsigned short port, const void * addr, unsigned long count) { __asm__ __volatile__ ("cld ; rep ; outs" "b" : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
extern inline void outsw (unsigned short port, const void * addr, unsigned long count) { __asm__ __volatile__ ("cld ; rep ; outs" "w" : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
extern inline void outsl (unsigned short port, const void * addr, unsigned long count) { __asm__ __volatile__ ("cld ; rep ; outs" "l" : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
# 7 "/home/jw5/src/port/linux-current/include/asm/io.h" 2
# 21 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/asm/system.h" 1
# 92 "/home/jw5/src/port/linux-current/include/asm/system.h"
static inline void switch_to(struct task_struct *prev,
struct task_struct *next)
{
(current_set[0 ]) = next;
__pdir = (unsigned long)
((get_fs() == 0 ) ? swapper_pg_dir : next->tss.page_dir);
__asm__ __volatile__
("pushl %%ebp
pushl $1f
movl %%esp, (%0)
movl (%1), %%esp
ret
1: popl %%ebp"
:
: "r" (& prev->tss.kernel_sp), "r" (& next->tss.kernel_sp)
: "memory", "eax", "ebx", "ecx", "edx", "esi", "edi"
);
}
# 22 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/../l4/lib/libl4sys/include/l4/ipc.h" 1
typedef struct {
l4_threadid_t dest, true_src;
} l4_ipc_deceit_ids_t;
static inline int
l4_i386_ipc_call(l4_threadid_t dest,
const void *snd_msg, dword_t snd_dword0, dword_t snd_dword1,
void *rcv_msg, dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result);
static inline int
l4_i386_ipc_reply_and_wait(l4_threadid_t dest,
const void *snd_msg,
dword_t snd_dword0, dword_t snd_dword1,
l4_threadid_t *src,
void *rcv_msg, dword_t *rcv_dword0,
dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result);
static inline int
l4_i386_ipc_reply_deceiting_and_wait(const l4_ipc_deceit_ids_t ids,
const void *snd_msg,
dword_t snd_dword0, dword_t snd_dword1,
l4_threadid_t *src,
void *rcv_msg,
dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout,
l4_msgdope_t *result);
static inline int
l4_i386_ipc_send(l4_threadid_t dest,
const void *snd_msg, dword_t snd_dword0, dword_t snd_dword1,
l4_timeout_t timeout, l4_msgdope_t *result);
static inline int
l4_i386_ipc_send_deceiting(l4_ipc_deceit_ids_t ids,
const void *snd_msg,
dword_t snd_dword0, dword_t snd_dword1,
l4_timeout_t timeout, l4_msgdope_t *result);
static inline int
l4_i386_ipc_wait(l4_threadid_t *src,
void *rcv_msg, dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result);
static inline int
l4_i386_ipc_receive(l4_threadid_t src,
void *rcv_msg, dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result);
extern inline int l4_ipc_fpage_received(l4_msgdope_t msgdope);
extern inline int l4_ipc_is_fpage_granted(l4_fpage_t fp);
extern inline int l4_ipc_is_fpage_writable(l4_fpage_t fp);
extern inline int l4_ipc_fpage_received(l4_msgdope_t msgdope)
{
return msgdope.md.fpage_received != 0;
}
extern inline int l4_ipc_is_fpage_granted(l4_fpage_t fp)
{
return fp.fp.grant != 0;
}
extern inline int l4_ipc_is_fpage_writable(l4_fpage_t fp)
{
return fp.fp.write != 0;
}
static inline int
l4_i386_ipc_call(l4_threadid_t dest,
const void *snd_msg, dword_t snd_dword0, dword_t snd_dword1,
void *rcv_msg, dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result)
{
asm(
"pushl %%ebp \n\t"
"movl %%edi, %%ebp \n\t"
"movl 4(%%esi), %%edi \n\t"
"movl (%%esi), %%esi \n\t"
"int $0x30 \n\t"
"popl %%ebp \n\t"
:
"=a" (*result),
"=d" (*rcv_dword0),
"=b" (*rcv_dword1)
:
"c" (timeout),
"D" (((int)rcv_msg) & (~1 )),
"S" (&dest),
"0" (((int)snd_msg) & (~1 )),
"1" (snd_dword0),
"2" (snd_dword1)
:
"esi", "edi", "ecx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
}
static inline int
l4_i386_ipc_reply_and_wait(l4_threadid_t dest,
const void *snd_msg,
dword_t snd_dword0, dword_t snd_dword1,
l4_threadid_t *src,
void *rcv_msg, dword_t *rcv_dword0,
dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result)
{
struct {
l4_threadid_t *dest;
l4_threadid_t *src;
} addresses = { &dest, src };
asm(
"pushl %%ebp \n\t"
"pushl %%esi \n\t"
"movl (%%esi), %%esi \n\t"
"movl %%edi, %%ebp \n\t"
"movl 4(%%esi), %%edi \n\t"
"movl (%%esi), %%esi \n\t"
"int $0x30 \n\t"
"popl %%ebp \n\t"
"movl 4(%%ebp), %%ebp \n\t"
"movl %%esi, (%%ebp) \n\t"
"movl %%edi, 4(%%ebp)\n\t"
"popl %%ebp \n\t"
:
"=a" (*result),
"=d" (*rcv_dword0),
"=b" (*rcv_dword1)
:
"c" (timeout),
"D" (((int)rcv_msg) | 1 ),
"S" (&addresses),
"0" (((int)snd_msg) & (~1 )),
"1" (snd_dword0),
"2" (snd_dword1)
:
"esi", "edi", "ecx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
}
static inline int
l4_i386_ipc_reply_deceiting_and_wait(l4_ipc_deceit_ids_t ids,
const void *snd_msg,
dword_t snd_dword0, dword_t snd_dword1,
l4_threadid_t *src,
void *rcv_msg,
dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout,
l4_msgdope_t *result)
{
struct {
l4_ipc_deceit_ids_t *ids;
l4_threadid_t *src;
} addresses = { &ids, src };
asm(
"pushl %%ebp \n\t"
"pushl %%esi \n\t"
"movl (%%esi), %%esi \n\t"
"movl %%edi, %%ebp \n\t"
"pushl 12(%%esi) \n\t"
"pushl 8(%%esi) \n\t"
"movl 4(%%esi), %%edi \n\t"
"movl (%%esi), %%esi \n\t"
"int $0x30 \n\t"
"addl $8, %%esp \n\t"
"popl %%ebp \n\t"
"movl 4(%%ebp), %%ebp \n\t"
"movl %%esi, (%%ebp) \n\t"
"movl %%edi, 4(%%ebp)\n\t"
"popl %%ebp \n\t"
:
"=a" (*result),
"=d" (*rcv_dword0),
"=b" (*rcv_dword1)
:
"S" (&addresses),
"c" (timeout),
"D" (((int)rcv_msg) | 1 ),
"0" (((int)snd_msg) & (~1 )),
"1" (snd_dword0),
"2" (snd_dword1)
:
"esi", "edi", "ecx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
}
static inline int
l4_i386_ipc_send(l4_threadid_t dest,
const void *snd_msg, dword_t snd_dword0, dword_t snd_dword1,
l4_timeout_t timeout, l4_msgdope_t *result)
{
asm(
"pushl %%ebp \n\t"
"movl %6 ,%%ebp \n\t"
"int $0x30 \n\t"
"popl %%ebp \n\t"
:
"=a" (*result)
:
"d" (snd_dword0),
"c" (timeout),
"b" (snd_dword1),
"D" (dest.lh.high),
"S" (dest.lh.low),
"i" ((-1) ),
"0" (((int)snd_msg) & (~1 ))
:
"esi", "edi", "ebx", "ecx", "edx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
};
static inline int
l4_i386_ipc_send_deceiting(l4_ipc_deceit_ids_t ids,
const void *snd_msg,
dword_t snd_dword0, dword_t snd_dword1,
l4_timeout_t timeout, l4_msgdope_t *result)
{
asm(
"pushl %%ebp \n\t"
"pushl 4(%%esi) \n\t"
"pushl (%%esi) \n\t"
"movl (%%edi), %%esi \n\t"
"movl 4(%%edi), %%edi \n\t"
"movl %6 ,%%ebp \n\t"
"int $0x30 \n\t"
"addl $8, %%esp \n\t"
"popl %%ebp \n\t"
:
"=a" (*result)
:
"d" (snd_dword0),
"c" (timeout),
"b" (snd_dword1),
"D" (&ids.dest),
"S" (&ids.true_src),
"i" ((-1) ),
"0" (((int)snd_msg) & (~1 ))
:
"esi", "edi", "ebx", "ecx", "edx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
};
static inline int
l4_i386_ipc_wait(l4_threadid_t *src,
void *rcv_msg, dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result)
{
asm(
"pushl %%ebp \n\t"
"movl %%ebx,%%ebp \n\t"
"int $0x30 \n\t"
"popl %%ebp \n\t"
:
"=a" (*result),
"=d" (*rcv_dword0),
"=b" (*rcv_dword1),
"=D" (src->lh.high),
"=S" (src->lh.low)
:
"c" (timeout),
"0" ((-1) ),
"2" (((int)rcv_msg) | 1 )
:
"ecx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
}
static inline int
l4_i386_ipc_receive(l4_threadid_t src,
void *rcv_msg, dword_t *rcv_dword0, dword_t *rcv_dword1,
l4_timeout_t timeout, l4_msgdope_t *result)
{
asm(
"pushl %%ebp \n\t"
"movl %%ebx,%%ebp \n\t"
"int $0x30 \n\t"
"popl %%ebp \n\t"
:
"=a" (*result),
"=d" (*rcv_dword0),
"=b" (*rcv_dword1)
:
"c" (timeout),
"D" (src.lh.high),
"S" (src.lh.low),
"0" ((-1) ),
"2" (((int)rcv_msg) & (~1 ))
:
"esi", "edi", "ecx"
, "memory"
);
return ((( *result ).msgdope) & 0xF0 ) ;
}
# 24 "process.c" 2
# 1 "../include/task.h" 1
int root_task_execute(int (*subroutine)(int arg), int arg);
void start_root_task_execute_thread(void);
void start_special_init_task(dword_t eip, dword_t esp);
pid_t create_special_user_task(int (*fn)(void *), void * arg,
unsigned long flags);
extern l4_threadid_t template_id;
extern l4_threadid_t kernel_thread_id;
int task_no_alloc(void);
int task_no_free(int n);
extern struct task_struct *task_to_proc[2048];
typedef struct {
unsigned int_handler_low: 16;
unsigned selector: 16;
unsigned reserved: 5;
unsigned trapgate: 8;
unsigned privilege: 2;
unsigned present: 1;
unsigned int_handler_high: 16;
} idt_entry_t;
typedef idt_entry_t l4_idt_t[(0x14) ];
typedef void (*int_handler_t)(void);
typedef struct
{
unsigned short int size __attribute__((packed));
unsigned long address __attribute__((packed));
} idt_descr_t;
typedef struct
{
int edi, esi;
int ebp;
int dummy_esp;
int ebx, edx, ecx, eax;
int number;
int error, eip, cs, eflags;
int stack_top;
} exception_frame_t;
static inline l4_threadid_t
get_l4_id_from_stack(void)
{
unsigned esp;
l4_threadid_t id;
asm("movl %%esp, %0\n\t" : "=r" (esp) : );
id = *(l4_threadid_t *)((esp & (~((1UL << 12 ) -1)) )
+ (1UL << 12 ) - sizeof(l4_threadid_t));
return id;
}
static inline void
put_l4_id_to_stack(unsigned esp, l4_threadid_t id)
{
*(l4_threadid_t *)
((esp & (~((1UL << 12 ) -1)) ) + (1UL << 12 ) - sizeof(l4_threadid_t)) = id;
}
extern int_handler_t default_int_handler_array[(0x14) ];
void set_default_idt(void);
void set_idt(idt_entry_t *idt, int_handler_t *int_handler, int num);
void def_int_handler(exception_frame_t frame);
void def_int_entry0(void);
void def_int_entry1(void);
void def_int_entry2(void);
void def_int_entry3(void);
void def_int_entry4(void);
void def_int_entry5(void);
void def_int_entry6(void);
void def_int_entry7(void);
void def_int_entry8(void);
void def_int_entry9(void);
void def_int_entry10(void);
void def_int_entry11(void);
void def_int_entry12(void);
void def_int_entry13(void);
void def_int_entry14(void);
void def_int_entry15(void);
void def_int_entry16(void);
void def_int_entry17(void);
void def_int_entry18(void);
void def_int_entry19(void);
# 25 "process.c" 2
# 1 "../include/user.h" 1
void def_int_handler(exception_frame_t frame);
void entry0(void);
void entry1(void);
void entry2(void);
void entry3(void);
void entry4(void);
void entry5(void);
void entry6(void);
void entry7(void);
void entry8(void);
void entry9(void);
void entry10(void);
void entry11(void);
void entry12(void);
void entry13(void);
void entry14(void);
void entry15(void);
void entry16(void);
void entry17(void);
void entry18(void);
void entry19(void);
void restore_regs(void);
void do_nothing_loop(void);
void _user_task_init (void);
void activate_process(void);
void create_user_thread(void);
void handle_signals(void);
extern long _emulib_text_start , _emulib_text_end ;
# 26 "process.c" 2
# 1 "../include/exclpage.h" 1
# 1 "../include/config.h" 1
# 60 "../include/config.h"
# 8 "../include/exclpage.h" 2
# 1 "../include/locktypes.h" 1
# 14 "../include/exclpage.h" 2
struct measure {
unsigned long syscall_start, syscall_stop;
unsigned long emulib_start, emulib_stop;
unsigned long linux_server_start, linux_server_stop;
unsigned long dispatch_start, dispatch_stop;
};
struct exclusive_page_tag {
struct measure m;
l4_threadid_t kernel_id;
l4_threadid_t user_id;
struct pt_regs regs;
int exception_number;
unsigned int error_code;
simple_lock_t emu_local_lock;
int sigs_handled;
l4_idt_t user_idt;
idt_descr_t user_idt_descr;
char usignal_stack[(512) ];
char uemulib_stack[(512) ];
};
# 27 "process.c" 2
# 1 "../include/assert.h" 1
# 28 "process.c" 2
# 1 "../include/l4_memory.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm/pgtable.h" 1
# 148 "/home/jw5/src/port/linux-current/include/asm/pgtable.h"
extern unsigned long pg0[1024];
extern unsigned long empty_zero_page[1024];
extern pte_t __bad_page(void);
extern pte_t * __bad_pagetable(void);
static inline void SET_PAGE_DIR(struct task_struct *tsk, pgd_t *pgdir)
{
tsk->tss.page_dir = pgdir;
if (tsk == (current_set[0 ]) && get_fs() == ((short) ((0x20000000UL) >> 16)) )
{
__pdir = (unsigned long) pgdir;
}
}
extern inline int pte_none(pte_t pte) { return ! (( pte ).pte) ; }
extern inline int pte_present(pte_t pte) { return (( pte ).pte) & 0x001 ; }
extern inline int pmd_none(pmd_t pmd) { return ! (( pmd ).pmd) ; }
extern inline int pmd_bad(pmd_t pmd) { return ((( pmd ).pmd) & ~(~((1UL << 12 ) -1)) ) != (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) || (( pmd ).pmd) > high_memory; }
extern inline int pmd_present(pmd_t pmd) { return (( pmd ).pmd) & 0x001 ; }
extern inline void pmd_clear(pmd_t * pmdp) { (( *pmdp ).pmd) = 0; }
extern inline int pgd_none(pgd_t pgd) { return 0; }
extern inline int pgd_bad(pgd_t pgd) { return 0; }
extern inline int pgd_present(pgd_t pgd) { return 1; }
extern inline void pgd_clear(pgd_t * pgdp) { }
extern inline int pte_read(pte_t pte) { return (( pte ).pte) & 0x004 ; }
extern inline int pte_write(pte_t pte) { return (( pte ).pte) & 0x002 ; }
extern inline int pte_exec(pte_t pte) { return (( pte ).pte) & 0x004 ; }
extern inline int pte_dirty(pte_t pte) { return (( pte ).pte) & 0x040 ; }
extern inline int pte_young(pte_t pte) { return (( pte ).pte) & 0x020 ; }
extern inline pte_t pte_wrprotect(pte_t pte) { (( pte ).pte) &= ~0x002 ; return pte; }
extern inline pte_t pte_rdprotect(pte_t pte) { (( pte ).pte) &= ~0x004 ; return pte; }
extern inline pte_t pte_exprotect(pte_t pte) { (( pte ).pte) &= ~0x004 ; return pte; }
extern inline pte_t pte_mkclean(pte_t pte) { (( pte ).pte) &= ~0x040 ; return pte; }
extern inline pte_t pte_mkold(pte_t pte) { (( pte ).pte) &= ~0x020 ; return pte; }
extern inline pte_t pte_mkwrite(pte_t pte) { (( pte ).pte) |= 0x002 ; return pte; }
extern inline pte_t pte_mkread(pte_t pte) { (( pte ).pte) |= 0x004 ; return pte; }
extern inline pte_t pte_mkexec(pte_t pte) { (( pte ).pte) |= 0x004 ; return pte; }
extern inline pte_t pte_mkdirty(pte_t pte) { (( pte ).pte) |= 0x040 ; return pte; }
extern inline pte_t pte_mkyoung(pte_t pte) { (( pte ).pte) |= 0x020 ; return pte; }
extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot)
{ pte_t pte; (( pte ).pte) = page | (( pgprot ).pgprot) ; return pte; }
extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{ (( pte ).pte) = ((( pte ).pte) & ((~((1UL << 12 ) -1)) | 0x020 | 0x040 ) ) | (( newprot ).pgprot) ; return pte; }
extern inline unsigned long pte_page(pte_t pte)
{ return (( pte ).pte) & (~((1UL << 12 ) -1)) ; }
extern inline unsigned long pmd_page(pmd_t pmd)
{ return (( pmd ).pmd) & (~((1UL << 12 ) -1)) ; }
extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
{
return mm->pgd + (address >> 22 );
}
extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
{
return (pmd_t *) dir;
}
extern inline pte_t * pte_offset(pmd_t * dir, unsigned long address)
{
return (pte_t *) pmd_page(*dir) + ((address >> 12 ) & (1024 - 1));
}
extern inline void pte_free_kernel(pte_t * pte)
{
free_pages(( (unsigned long) pte ),0) ;
}
extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address)
{
address = (address >> 12 ) & (1024 - 1);
if (pmd_none(*pmd)) {
pte_t * page = (pte_t *) get_free_page(0x03 );
if (pmd_none(*pmd)) {
if (page) {
(( *pmd ).pmd) = (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) | (unsigned long) page;
return page + address;
}
(( *pmd ).pmd) = (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) | (unsigned long) __bad_pagetable() ;
return ((void *) 0) ;
}
free_pages(( (unsigned long) page ),0) ;
}
if (pmd_bad(*pmd)) {
printk("Bad pmd in pte_alloc: %08lx\n", (( *pmd ).pmd) );
(( *pmd ).pmd) = (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) | (unsigned long) __bad_pagetable() ;
return ((void *) 0) ;
}
return (pte_t *) pmd_page(*pmd) + address;
}
extern inline void pmd_free_kernel(pmd_t * pmd)
{
(( *pmd ).pmd) = 0;
}
extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address)
{
return (pmd_t *) pgd;
}
extern inline void pte_free(pte_t * pte)
{
free_pages(( (unsigned long) pte ),0) ;
}
extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address)
{
address = (address >> 12 ) & (1024 - 1);
if (pmd_none(*pmd)) {
pte_t * page = (pte_t *) get_free_page(0x03 );
if (pmd_none(*pmd)) {
if (page) {
(( *pmd ).pmd) = (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) | (unsigned long) page;
return page + address;
}
(( *pmd ).pmd) = (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) | (unsigned long) __bad_pagetable() ;
return ((void *) 0) ;
}
free_pages(( (unsigned long) page ),0) ;
}
if (pmd_bad(*pmd)) {
printk("Bad pmd in pte_alloc: %08lx\n", (( *pmd ).pmd) );
(( *pmd ).pmd) = (0x001 | 0x002 | 0x004 | 0x020 | 0x040 ) | (unsigned long) __bad_pagetable() ;
return ((void *) 0) ;
}
return (pte_t *) pmd_page(*pmd) + address;
}
extern inline void pmd_free(pmd_t * pmd)
{
(( *pmd ).pmd) = 0;
}
extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address)
{
return (pmd_t *) pgd;
}
extern inline void pgd_free(pgd_t * pgd)
{
free_pages(( (unsigned long) pgd ),0) ;
}
extern inline pgd_t * pgd_alloc(void)
{
return (pgd_t *) get_free_page(0x03 );
}
extern pgd_t swapper_pg_dir[1024];
extern inline void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
{
}
void set_pte(pte_t *pteptr, pte_t pteval);
void pte_clear(pte_t *ptep);
void vm_set_pte(pte_t *pteptr, pte_t pteval, unsigned long vm_address);
void vm_pte_clear(pte_t *ptep, unsigned long vm_address);
# 5 "../include/l4_memory.h" 2
# 1 "/home/jw5/src/port/linux-current/../l4/lib/libl4sys/include/l4/kernel.h" 1
typedef struct
{
dword_t magic;
dword_t version;
byte_t offset_version_strings;
byte_t reserved[7 + 5 * 16];
l4_low_high_t main_memory;
l4_low_high_t reserved0, reserved1;
l4_low_high_t semi_reserved;
l4_low_high_t dedicated[4];
dword_t clock;
} l4_kernel_info_t;
# 6 "../include/l4_memory.h" 2
extern l4_kernel_info_t *l4_kernel_info;
extern unsigned long root_pager_low_memory_start, root_pager_memory_start,
root_pager_memory_end;
extern l4_threadid_t root_pager_id, root_preempter_id;
extern char emu_lib_text[(1UL << 12 ) ];
int
request_page_from_sigma0(unsigned long address, unsigned long vm_offset);
int
request_mem_area_from_sigma0(dword_t fault_address, dword_t pte_val);
int
setup_kernel_info_page(void);
void
new_paging_init(unsigned long start_mem, unsigned long *end_mem_p,
unsigned long *start_mem_p);
void
start_root_pager(void);
void
root_pager(void);
void
kernel_pager(void);
int
handle_pagefault(void **msg, dword_t *fault_address, dword_t *faulting_eip);
int
l4_do_page_fault(unsigned long address, unsigned long error_code);
void
request_physical_page_from_root(unsigned long physical_page,
unsigned long access, unsigned long vm_page);
void
request_zero_page_from_root(void);
extern inline int
adapter_page(unsigned long addr)
{
return (addr > 0x80000000U);
}
extern inline void
request_page_writeable(unsigned long address, pte_t pte)
{
if (l4_do_page_fault(address,
((0) | (2) |
(pte_present(pte) ? (1) : (0) )))
)
panic("do_page_fault return after bad kernel write access");
}
extern inline void
request_page_readable(unsigned long address)
{
if (l4_do_page_fault(address,
(0) | (0) | (0) ))
panic("do_page_fault return after bad kernel read access");
}
# 29 "process.c" 2
# 1 "../include/lock.h" 1
# 1 "../include/locktypes.h" 1
# 13 "../include/lock.h" 2
static inline int
simple_try_lock(simple_lock_t *lock)
{
int tmp;
__asm__ __volatile__ ("xchg %1, (%2)\n\t"
: "=r" (tmp)
: "0" (1), "r" (lock)
: "memory"
);
return (tmp == 0);
}
static inline void
simple_unlock(simple_lock_t *lock)
{
*lock = 0;
}
static inline int
simple_lock_locked(simple_lock_t * lock)
{
return (*lock==0) ? 0 : 1 ;
}
static inline void
simple_lock_solid(register simple_lock_t *p)
{
while (simple_lock_locked(p) || !simple_try_lock(p))
l4_thread_switch(((l4_threadid_t){lh:{0,0}}) );
}
static inline void
simple_lock(simple_lock_t * lock)
{
if(!simple_try_lock(lock))
simple_lock_solid(lock);
}
# 30 "process.c" 2
# 1 "../include/linuxipc.h" 1
int
dispatch_message_from_emulib(dword_t *P1, dword_t *P2, void **msgdope);
# 31 "process.c" 2
# 1 "../include/debug.h" 1
char * get_signal_name(unsigned);
char * get_syscall_name(unsigned int);
int stack_fill(char * stack_top, char * stack_bottom);
int stack_used(char * stack_top, char * stack_bottom);
extern int herc_printf(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
# 32 "process.c" 2
# 1 "../include/perform.h" 1
static inline void
reset_event_counter(void)
{
asm volatile("xor %%eax, %%eax\n"
"movl $0x12, %%ecx\n"
".byte 0x0f, 0x30\n"
"movl $0x13, %%ecx\n"
".byte 0x0f, 0x30\n"
: : : "cx", "ax"
);
};
static inline void
read_event_counter(int *counter0, int *counter1)
{
asm volatile("pushl %%edx\n"
".byte 0x0f, 0x30\n"
"movl $0x12, %%ecx\n"
".byte 0x0f, 0x32\n"
"movl %%eax, %%ebx\n"
"movl $0x13, %%ecx\n"
".byte 0x0f, 0x32\n"
"popl %%edx\n"
: "=b" (*counter0), "=a" (*counter1)
: "1" (0), "c" (0x11)
);
}
static inline void
select_event(int event0, int event1)
{
asm volatile(".byte 0x0f, 0x30\n"
:
:
"a" (event0 + (event1 << 16)),
"d" (0),
"c" (0x11)
);
};
extern inline void
read_time(unsigned long *time)
{
__asm__ volatile (".byte 0x0f, 0x31"
: "=a" (*time)
:
: "edx"
);
};
# 33 "process.c" 2
# 1 "/home/jw5/src/port/linux-current/include/linux/unistd.h" 1
extern int errno;
# 1 "/home/jw5/src/port/linux-current/include/asm/unistd.h" 1
# 1 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h" 1
# 186 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 199 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 212 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 226 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 240 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 255 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 321 "/home/jw5/src/port/linux-current/include/asm-i386/unistd.h"
# 14 "/home/jw5/src/port/linux-current/include/asm/unistd.h" 2
# 49 "/home/jw5/src/port/linux-current/include/asm/unistd.h"
# 60 "/home/jw5/src/port/linux-current/include/asm/unistd.h"
# 72 "/home/jw5/src/port/linux-current/include/asm/unistd.h"
# 84 "/home/jw5/src/port/linux-current/include/asm/unistd.h"
static inline int idle (void) { long __SC__idle (void) asm("sys_" "idle"); long __res = __SC__idle (); if (__res >= 0) return ( int ) __res; errno = -__res; return -1; }
static inline int setup (void) { long __SC__setup (void) asm("sys_" "setup"); long __res = __SC__setup (); if (__res >= 0) return ( int ) __res; errno = -__res; return -1; }
static inline int sync (void) { long __SC__sync (void) asm("sys_" "sync"); long __res = __SC__sync (); if (__res >= 0) return ( int ) __res; errno = -__res; return -1; }
static inline pid_t setsid (void) { long __SC__setsid (void) asm("sys_" "setsid"); long __res = __SC__setsid (); if (__res >= 0) return ( pid_t ) __res; errno = -__res; return -1; }
static inline int write ( int fd , const char * buf , off_t count ) { long __SC__write ( int fd , const char * buf , off_t count ) asm("sys_" "write"); long __res = __SC__write ( fd , buf , count ); if (__res>=0) return ( int ) __res; errno=-__res; return -1; }
static inline int dup ( int fd ) { long __SC__dup ( int fd ) asm("sys_" "dup"); long __res = __SC__dup ( fd ); if (__res >= 0) return ( int ) __res; errno = -__res; return -1; }
static inline int open ( const char * file , int flag , int mode ) { long __SC__open ( const char * file , int flag , int mode ) asm("sys_" "open"); long __res = __SC__open ( file , flag , mode ); if (__res>=0) return ( int ) __res; errno=-__res; return -1; }
static inline int close ( int fd ) { long __SC__close ( int fd ) asm("sys_" "close"); long __res = __SC__close ( fd ); if (__res >= 0) return ( int ) __res; errno = -__res; return -1; }
static inline pid_t waitpid ( pid_t pid , int * wait_stat , int options ) { long __SC__waitpid ( pid_t pid , int * wait_stat , int options ) asm("sys_" "waitpid"); long __res = __SC__waitpid ( pid , wait_stat , options ); if (__res>=0) return ( pid_t ) __res; errno=-__res; return -1; }
int execve(char * file, char ** argv, char ** envp);
static inline void _exit(int exitcode)
{
void __SC__exit(int exitcode) asm("sys_" "exit");
__SC__exit(exitcode);
}
static inline pid_t wait(int * wait_stat)
{
return waitpid(-1,wait_stat,0);
}
static inline pid_t kernel_thread(int (*fn)(void *), void * arg,
unsigned long flags)
{
pid_t pid;
__asm__ __volatile__
(
"pushl $0 \n\t"
"pushfl \n\t"
"pushl $0 \n\t"
"pushl $1f \n\t"
"pushl %%eax \n\t"
"pushl %%eax \n\t"
"pushl %%ebp \n\t"
"pushl %%edi \n\t"
"pushl %%esi \n\t"
"pushl %%edx \n\t"
"pushl $0 \n\t"
"pushl %%ebx \n\t"
"call " "internal_sys_clone" "\n\t"
"jmp 0f \n"
"1: pushl %3 \n\t"
"call *%2 \n\t"
"movl $0,(%%esp) \n\t"
"call " "sys_exit" "\n"
"0: leal 48(%%esp), %%esp \n\t"
: "=a" (pid)
: "0" (120 ), "r" (fn), "r" (arg),
"b" (flags | 0x00000100 )
: "ecx", "edx"
);
return pid;
}
# 9 "/home/jw5/src/port/linux-current/include/linux/unistd.h" 2
# 36 "process.c" 2
static dword_t msg_d1, msg_d2;
static void *msg_desc;
int idle_sleeping = 0;
int sys_idle(void)
{
l4_threadid_t sender_thread_id;
l4_msgdope_t result;
int e;
struct task_struct *me = (current_set[0 ]) ;
struct task_struct *active;
for (;;)
{
__asm__ __volatile__ ("cli": : :"memory") ;
if (need_resched)
{
__asm__ __volatile__ ("sti": : :"memory") ;
;
schedule();
continue;
}
idle_sleeping = 1;
e = l4_i386_ipc_wait(&sender_thread_id, 0 ,
&msg_d1, &msg_d2,
( (l4_timeout_t) {to: { 0 , 1 , 0 , 0 , 0 , 0 } } ) , &result);
idle_sleeping = 0;
__asm__ __volatile__ ("sti": : :"memory") ;
if (e)
{
printk("sys_idle: ipc wait error: id=%x, result=%x\n",
me->tss.user_thread_id.lh.low, result.msgdope);
continue;
}
if (need_resched
&& (sender_thread_id.id.task == kernel_thread_id.id.task))
{
l4_i386_ipc_send(sender_thread_id,
0, 0, 0,
( (l4_timeout_t) {to: { 0 , 1 , 0 , 0 , 0 , 0 } } ) ,
&result);
continue;
}
if (!(active = task_to_proc[sender_thread_id.id.task]))
{
printk("empty slot for task %x\n", sender_thread_id.id.task);
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "empty slot" "\"\n\t" "1: \n\t" ) ;
}
if (active->tss.under_kernel_control)
{
printk("sys_idle: ignoring msg from %s (pid %d): "
"already in kernel\n",
active->comm, active->pid);
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "unexpected syscall" "\"\n\t" "1: \n\t" ) ;
continue;
}
switch_to(me, active);
}
}
void dsched(void)
{
l4_threadid_t sender_thread_id;
l4_threadid_t client_thread_id;
l4_msgdope_t result;
int e;
struct task_struct *me = (current_set[0 ]) ;
struct task_struct *active;
client_thread_id = me->tss.user_thread_id;
client_thread_id.id.lthread = (0) ;
for (;;)
{
for (;;)
{
if (me->tss.ex_page)
read_time(&me->tss.ex_page->m.dispatch_start);
e = dispatch_message_from_emulib(&msg_d1, &msg_d2, &msg_desc);
if (me->tss.ex_page)
read_time(&me->tss.ex_page->m.dispatch_stop);
if (e < 0)
{
break;
}
__asm__ __volatile__ ("cli": : :"memory") ;
if (need_resched)
{
__asm__ __volatile__ ("sti": : :"memory") ;
e = l4_i386_ipc_send(client_thread_id, msg_desc,
msg_d1, msg_d2,
( (l4_timeout_t) {to: { 0 , 1 , 0 , 0 , 0 , 0 } } ) , &result);
if (e)
{
printk("dsched: ipc send error: id=%x, result=%x\n",
me->tss.user_thread_id.lh.low, result.msgdope);
}
break;
}
idle_sleeping = 1;
e = l4_i386_ipc_reply_and_wait(client_thread_id, msg_desc,
msg_d1, msg_d2,
&sender_thread_id, 0 ,
&msg_d1, &msg_d2,
( (l4_timeout_t) {to: { 0 , 1 , 0 , 0 , 0 , 0 } } ) , &result);
idle_sleeping = 0;
__asm__ __volatile__ ("sti": : :"memory") ;
if (e)
{
printk("dsched: ipc reply&wait error: id=%x, result=%x\n",
me->tss.user_thread_id.lh.low, result.msgdope);
break;
}
if (need_resched
&& (sender_thread_id.id.task == kernel_thread_id.id.task))
{
l4_i386_ipc_send(sender_thread_id,
0, 0, 0,
( (l4_timeout_t) {to: { 0 , 1 , 0 , 0 , 0 , 0 } } ) ,
&result);
break;
}
if (!(active = task_to_proc[sender_thread_id.id.task]))
{
printk("empty slot for task %x\n", sender_thread_id.id.task);
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "empty slot" "\"\n\t" "1: \n\t" ) ;
}
if (active == (current_set[0 ]) )
continue;
if (active->tss.under_kernel_control)
{
printk("dsched: ignoring msg from %s (pid %d): "
"already in kernel\n",
active->comm, active->pid);
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "unexpected syscall" "\"\n\t" "1: \n\t" ) ;
break;
}
switch_to(me, active);
}
;
schedule();
}
}
static inline void kb_wait(void)
{
int i;
for (i=0; i<0x10000; i++)
if ((((__builtin_constant_p(( 0x64 )) && ( 0x64 ) < 256) ? __inbc_p( 0x64 ) : __inb_p( 0x64 )) & 0x02) == 0)
break;
}
void hard_reset_now(void)
{
int i, j;
do { __asm__ __volatile__ ("" : : :"memory") ; __new_sti(); } while (0) ;
pg0[0] = 7;
request_zero_page_from_root();
*((unsigned short *)0x472) = 0x1234;
for (;;) {
for (i=0; i<100; i++) {
kb_wait();
for(j = 0; j < 100000 ; j++)
;
((__builtin_constant_p(( 0x64 )) && ( 0x64 ) < 256) ? __outbc(( 0xfe ),( 0x64 )) : __outb(( 0xfe ),( 0x64 ))) ;
}
}
}
void show_regs(struct pt_regs * regs)
{
printk("\n");
if (! regs)
{
printk("Can't print regs from interrupt handler: &pt_regs == 0!");
return;
}
printk("EIP: %08lx", regs->eip);
printk(" ESP: %08lx", regs->esp);
printk(" EFLAGS: %08lx\n",regs->eflags);
printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
regs->eax,regs->ebx,regs->ecx,regs->edx);
printk("ESI: %08lx EDI: %08lx EBP: %08lx\n",
regs->esi, regs->edi, regs->ebp);
}
extern int l4_task_version;
static int get_new_taskno(l4_taskid_t *task)
{
int n = task_no_alloc();
if (n < 0)
return n;
*task = template_id;
task->id.lthread = 0;
task->id.task = n;
task->id.version_low = l4_task_version;
return 0;
}
static int task_delete(int task_i)
{
l4_taskid_t *task = (l4_taskid_t *) task_i;
l4_task_new(*task, root_pager_id.lh.low, 0, 0, ((l4_threadid_t){lh:{0,0}}) );
return 0;
}
void exit_thread(void)
{
if (! thread_equal((current_set[0 ]) ->tss.user_thread_id, ((l4_threadid_t){lh:{0,0}}) ))
{
l4_taskid_t task;
task = get_taskid((current_set[0 ]) ->tss.user_thread_id);
if (root_task_execute(task_delete, (int) &task)
< 0)
{
panic("exit_thread: root_task_execute(task_delete) failed");
}
task_no_free(task.id.task);
task_to_proc[task.id.task] = 0;
}
free_pages(( (unsigned long) (current_set[0 ]) ->tss.ex_page ),0) ;
}
void release_thread(struct task_struct *dead_task)
{
unsigned int ustack;
if ((ustack = stack_used((char*)dead_task->kernel_stack_page+ (1UL << 12 ) ,
(char*)dead_task->kernel_stack_page))
> (1UL << 12 ) - 0x100)
printk("release_thread: thread %s(%d) used"
" %d bytes stack maximum at %lx\n",
dead_task->comm, dead_task->pid,
ustack,
dead_task->kernel_stack_page+ (1UL << 12 ) );
if (0xdeadbeef != *(unsigned long *)dead_task->kernel_stack_page)
{
printk("<1>" "release_thread: %s kernel stack corruption"
" at %lx. Aiee\n", dead_task->comm,
dead_task->kernel_stack_page);
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "release stack size check" "\"\n\t" "1: \n\t" ) ;
}
}
static void
kernel_thread_init(struct task_struct *p, unsigned long clone_flags)
{
# 489 "process.c"
if (p != (current_set[0 ]) )
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "i'm not current" "\"\n\t" "1: \n\t" ) ;
if (p->tss.page_dir == swapper_pg_dir)
{
struct pt_regs *pt_regsp = &p->tss.ex_page->regs;
asm volatile
(
"pushl %%eax \n\t"
"pushl %%ecx \n\t"
"pushl %%edx \n\t"
"movl " "24" "(%%ebx)," "%%" "eax" "\n\t"
"movl " "4" "(%%ebx)," "%%" "ecx" "\n\t"
"movl " "8" "(%%ebx)," "%%" "edx" "\n\t"
"movl " "12" "(%%ebx)," "%%" "esi" "\n\t"
"movl " "16" "(%%ebx)," "%%" "edi" "\n\t"
"movl " "20" "(%%ebx)," "%%" "ebp" "\n\t"
"popl %%ebx \n\t"
"popfl \n\t"
"ret \n\t"
:
:
"b" (pt_regsp),
"a" (pt_regsp->eip),
"c" (pt_regsp->eflags),
"d" (pt_regsp->ebx)
);
panic("kernel_thread_init: return after jump to new control flow");
}
else
{
dsched();
}
}
static int
task_pair_create_user(int t_i)
{
l4_taskid_t task;
unsigned long *sp;
struct thread_struct *t = (struct thread_struct *) t_i;
sp = (unsigned long *)((((((((((((0xA0000000UL) ) + 8*4) +8+8) + 48 ) +4) +4) +4) +4) + (8* (0x14) ) ) + 8 + (512) ) );
t->under_kernel_control = 0;
t->ex_page->emu_local_lock = 1;
t->ex_page->sigs_handled = 1;
task = l4_task_new(t->user_thread_id, 0, (dword_t) sp,
(dword_t) _user_task_init , kernel_thread_id);
if (thread_equal(task.id, ((l4_threadid_t){lh:{0,0}}) ))
{
printk("task_pair_create_user: Failed to create user task\n");
task_no_free(t->user_thread_id.id.task);
return - 16 ;
}
return 0;
}
static int
task_pair_create(struct task_struct *p,
unsigned long clone_flags)
{
struct thread_struct *t = &p->tss;
l4_taskid_t server_id;
int code;
unsigned long *sp;
stack_fill((char *) (p->kernel_stack_page + (1UL << 12 ) ),
(char *) p->kernel_stack_page);
if (t->page_dir != swapper_pg_dir)
{
if (get_new_taskno(&t->user_thread_id) < 0)
{
task_no_free(server_id.id.task);
printk("task_pair_create: No task no left for user\n");
return - 16 ;
}
}
else
{
t->user_thread_id = ((l4_threadid_t){lh:{0,0}}) ;
}
t->ex_page->kernel_id = get_l4_id_from_stack();
t->ex_page->user_id = t->user_thread_id.id;
sp = (unsigned long *) (p->kernel_stack_page + (1UL << 12 ) );
sp -= sizeof(l4_threadid_t) / sizeof(*sp);
put_l4_id_to_stack((unsigned)sp, get_l4_id_from_stack());
*(--sp) = clone_flags;
*(--sp) = (unsigned long) p;
*(--sp) = 0;
*(--sp) = (unsigned long) kernel_thread_init;
t->kernel_sp = (unsigned long) sp;
if (t->page_dir == swapper_pg_dir)
{
t->under_kernel_control = 1;
return 0;
}
if ((code = root_task_execute(task_pair_create_user, (int) t)) < 0)
{
return code;
}
task_to_proc[t->user_thread_id.id.task]
= p;
return 0;
}
void copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
struct task_struct * p, struct pt_regs * regs)
{
struct pt_regs * childregs;
p->tss.ex_page = (struct exclusive_page_tag *) get_free_page(0x03 );
if (! p->tss.ex_page)
{
panic("copy_thread: can't alloc ex_page");
}
if (! ( p->kernel_stack_page )) panic("assertion (%s) failed in " "function " __PRETTY_FUNCTION__ " in " "process.c" ":" "process.c" " at line %d\n", "p->kernel_stack_page" , 691); ;
*(p->tss.ex_page) = (struct exclusive_page_tag){ {0, 0, 0, 0, 0, 0} , ((l4_threadid_t){lh:{0,0}}) , ((l4_threadid_t){lh:{0,0}}) , { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1b, 0, 0x200, 0} , 0, 0, 0, 0, {{0,0},}, {0,0}, {"SIGNALSTACK"}, {"EMUSTACK" }}; ;
childregs = & p->tss.ex_page->regs;
*childregs = *regs;
childregs->eax = 0;
childregs->esp = esp;
childregs->eflags |= 0x200;
p->tss.fs = (current_set[0 ]) ->tss.fs;
if (task_pair_create(p, clone_flags)
< 0)
{
panic("root_task_execute(task_pair_create) failed");
}
}
void flush_thread(void)
{
l4_taskid_t task = get_taskid((current_set[0 ]) ->tss.user_thread_id);
if ((! thread_equal(task, ((l4_threadid_t){lh:{0,0}}) ))
&& root_task_execute(task_delete, (int) &task) < 0)
{
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "flush_thread: delete failed" "\"\n\t" "1: \n\t" ) ;
}
}
void start_thread(struct pt_regs * regs, unsigned long eip,
unsigned long esp)
{
struct thread_struct *t = & (current_set[0 ]) ->tss;
regs->eip = eip;
regs->esp = esp;
if ((! thread_equal((current_set[0 ]) ->tss.user_thread_id, ((l4_threadid_t){lh:{0,0}}) ))
&& root_task_execute(task_pair_create_user, (int) t) < 0)
{
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "flush thread failed" "\"\n\t" "1: \n\t" ) ;
}
}
int dump_fpu (struct user_i387_struct *foo)
{
return 0;
}
void dump_thread(struct pt_regs * regs, struct user * dump)
{
int i;
dump->magic = 0421 ;
dump->start_code = 0;
dump->start_stack = regs->esp & ~((1UL << 12 ) - 1);
dump->u_tsize = ((unsigned long) (current_set[0 ]) ->mm->end_code)
>> 12 ;
dump->u_dsize = ((unsigned long) ((current_set[0 ]) ->mm->brk + ((1UL << 12 ) -1)))
>> 12 ;
dump->u_dsize -= dump->u_tsize;
dump->u_ssize = 0;
for (i = 0; i < 8; i++)
dump->u_debugreg[i] = 0;
if (dump->start_stack < (0xA0000000UL) )
dump->u_ssize = ((unsigned long) ((0xA0000000UL) - dump->start_stack))
>> 12 ;
dump->regs = *regs;
dump->u_fpvalid = dump_fpu (&dump->i387);
}
int sys_fork(void)
{
struct pt_regs *regs = & (current_set[0 ]) ->tss.ex_page->regs;
return do_fork(17 , regs->esp, regs);
}
int internal_sys_clone(struct pt_regs regs)
{
unsigned long clone_flags;
unsigned long newsp;
clone_flags = regs.ebx;
newsp = regs.ecx;
if (!newsp)
newsp = regs.esp;
return do_fork(clone_flags, newsp, ®s);
}
int sys_clone(unsigned long clone_flags, unsigned long newsp)
{
struct pt_regs *regs = & (current_set[0 ]) ->tss.ex_page->regs;
if (!newsp)
newsp = regs->esp;
return do_fork(clone_flags, newsp, regs);
}
int sys_execve(char *name, char **argv, char **envp)
{
int error;
char * filename;
error = getname(name, &filename);
if (error)
return error;
error = do_execve(filename, argv, envp, & (current_set[0 ]) ->tss.ex_page->regs);
putname(filename);
return error;
}
int execve(char * file, char ** argv, char ** envp)
{
int error;
if (! ( thread_equal((current_set[0 ]) ->tss.user_thread_id, ((l4_threadid_t){lh:{0,0}}) ) )) panic("assertion (%s) failed in " "function " __PRETTY_FUNCTION__ " in " "process.c" ":" "process.c" " at line %d\n", "thread_equal(current->tss.user_thread_id, L4_NIL_ID)" , 872); ;
(current_set[0 ]) ->tss.ex_page->regs = (struct pt_regs) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1b, 0, 0x200, 0} ;
if (get_new_taskno(& (current_set[0 ]) ->tss.user_thread_id) < 0)
{
printk("execve: No task no left for user\n");
errno = - 16 ;
return -1;
}
if (! ( get_fs() == 0 )) panic("assertion (%s) failed in " "function " __PRETTY_FUNCTION__ " in " "process.c" ":" "process.c" " at line %d\n", "get_fs() == KERNEL_DS" , 891); ;
set_fs(((short) ((0x20000000UL) >> 16)) );
error = do_execve(file, argv, envp, & (current_set[0 ]) ->tss.ex_page->regs);
if (error)
{
task_no_free((current_set[0 ]) ->tss.user_thread_id.id.task);
set_fs(0 );
(current_set[0 ]) ->tss.user_thread_id = ((l4_threadid_t){lh:{0,0}}) ;
errno = -error;
return -1;
}
task_to_proc[(current_set[0 ]) ->tss.user_thread_id.id.task] = (current_set[0 ]) ;
schedule();
dsched();
asm( "int $3 \n\t" "jmp 1f \n\t" ".ascii \"" "not reached" "\"\n\t" "1: \n\t" ) ;
return 0;
}
Technical Details
Message-ID:
<199701291743.SAA19079@os.inf.tu-dresden.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,8b26892fc18378a4,start X-Google-Attributes: gid113d02,public From: hohmuth@inf.tu-dresden.de (Michael Hohmuth) Subject: Re: asm(): Gcc used clobbered regs for i/o operands Date: 1997/01/29 Message-ID: <199701291743.SAA19079@os.inf.tu-dresden.de> X-Deja-AN: 213021659 sender: bug-gcc-request@prep.ai.mit.edu content-type: text/plain; charset=US-ASCII organization: Dept. of Computer Science, TU Dresden, Germany x-gateway: relay1.UU.NET from bug-gcc to gnu.gcc.bug; Wed, 29 Jan 1997 12:47:45 EST mime-version: 1.0 newsgroups: gnu.gcc.bug x-mailer: ELM [version 2.4ME+ PL28 (25)]