add directory kernel
This commit is contained in:
64
kernel/0.95/linux-0.95/include/linux/config.h
Normal file
64
kernel/0.95/linux-0.95/include/linux/config.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
/*
|
||||
* Define this if you want the math-emulation code: if this is undefined,
|
||||
* the kernel will be smaller, but you'll get FPU exceptions if you don't
|
||||
* have a 387 and are trying to use math.
|
||||
*/
|
||||
|
||||
#define KERNEL_MATH_EMULATION
|
||||
|
||||
|
||||
/*
|
||||
* Defines for what uname() should return
|
||||
*/
|
||||
#define UTS_SYSNAME "Linux"
|
||||
#define UTS_NODENAME "(none)" /* set by sethostname() */
|
||||
#define UTS_RELEASE "0" /* patchlevel */
|
||||
#define UTS_VERSION "0.12"
|
||||
#define UTS_MACHINE "i386" /* hardware type */
|
||||
|
||||
/* Don't touch these, unless you really know what your doing. */
|
||||
#define DEF_INITSEG 0x9000
|
||||
#define DEF_SYSSEG 0x1000
|
||||
#define DEF_SETUPSEG 0x9020
|
||||
#define DEF_SYSSIZE 0x4000
|
||||
|
||||
/*
|
||||
* The root-device is no longer hard-coded. You can change the default
|
||||
* root-device by changing the line ROOT_DEV = XXX in boot/bootsect.s
|
||||
*/
|
||||
|
||||
/*
|
||||
* The keyboard is now defined in kernel/chr_dev/keyboard.S
|
||||
*/
|
||||
|
||||
/*
|
||||
* Normally, Linux can get the drive parameters from the BIOS at
|
||||
* startup, but if this for some unfathomable reason fails, you'd
|
||||
* be left stranded. For this case, you can define HD_TYPE, which
|
||||
* contains all necessary info on your harddisk.
|
||||
*
|
||||
* The HD_TYPE macro should look like this:
|
||||
*
|
||||
* #define HD_TYPE { head, sect, cyl, wpcom, lzone, ctl}
|
||||
*
|
||||
* In case of two harddisks, the info should be sepatated by
|
||||
* commas:
|
||||
*
|
||||
* #define HD_TYPE { h,s,c,wpcom,lz,ctl },{ h,s,c,wpcom,lz,ctl }
|
||||
*/
|
||||
/*
|
||||
This is an example, two drives, first is type 2, second is type 3:
|
||||
|
||||
#define HD_TYPE { 4,17,615,300,615,8 }, { 6,17,615,300,615,0 }
|
||||
|
||||
NOTE: ctl is 0 for all drives with heads<=8, and ctl=8 for drives
|
||||
with more than 8 heads.
|
||||
|
||||
If you want the BIOS to tell what kind of drive you have, just
|
||||
leave HD_TYPE undefined. This is the normal thing to do.
|
||||
*/
|
||||
|
||||
#endif
|
||||
71
kernel/0.95/linux-0.95/include/linux/fdreg.h
Normal file
71
kernel/0.95/linux-0.95/include/linux/fdreg.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This file contains some defines for the floppy disk controller.
|
||||
* Various sources. Mostly "IBM Microcomputers: A Programmers
|
||||
* Handbook", Sanches and Canton.
|
||||
*/
|
||||
#ifndef _FDREG_H
|
||||
#define _FDREG_H
|
||||
|
||||
extern int ticks_to_floppy_on(unsigned int nr);
|
||||
extern void floppy_on(unsigned int nr);
|
||||
extern void floppy_off(unsigned int nr);
|
||||
extern void floppy_select(unsigned int nr);
|
||||
extern void floppy_deselect(unsigned int nr);
|
||||
|
||||
/* Fd controller regs. S&C, about page 340 */
|
||||
#define FD_STATUS 0x3f4
|
||||
#define FD_DATA 0x3f5
|
||||
#define FD_DOR 0x3f2 /* Digital Output Register */
|
||||
#define FD_DIR 0x3f7 /* Digital Input Register (read) */
|
||||
#define FD_DCR 0x3f7 /* Diskette Control Register (write)*/
|
||||
|
||||
/* Bits of main status register */
|
||||
#define STATUS_BUSYMASK 0x0F /* drive busy mask */
|
||||
#define STATUS_BUSY 0x10 /* FDC busy */
|
||||
#define STATUS_DMA 0x20 /* 0- DMA mode */
|
||||
#define STATUS_DIR 0x40 /* 0- cpu->fdc */
|
||||
#define STATUS_READY 0x80 /* Data reg ready */
|
||||
|
||||
/* Bits of FD_ST0 */
|
||||
#define ST0_DS 0x03 /* drive select mask */
|
||||
#define ST0_HA 0x04 /* Head (Address) */
|
||||
#define ST0_NR 0x08 /* Not Ready */
|
||||
#define ST0_ECE 0x10 /* Equipment chech error */
|
||||
#define ST0_SE 0x20 /* Seek end */
|
||||
#define ST0_INTR 0xC0 /* Interrupt code mask */
|
||||
|
||||
/* Bits of FD_ST1 */
|
||||
#define ST1_MAM 0x01 /* Missing Address Mark */
|
||||
#define ST1_WP 0x02 /* Write Protect */
|
||||
#define ST1_ND 0x04 /* No Data - unreadable */
|
||||
#define ST1_OR 0x10 /* OverRun */
|
||||
#define ST1_CRC 0x20 /* CRC error in data or addr */
|
||||
#define ST1_EOC 0x80 /* End Of Cylinder */
|
||||
|
||||
/* Bits of FD_ST2 */
|
||||
#define ST2_MAM 0x01 /* Missing Addess Mark (again) */
|
||||
#define ST2_BC 0x02 /* Bad Cylinder */
|
||||
#define ST2_SNS 0x04 /* Scan Not Satisfied */
|
||||
#define ST2_SEH 0x08 /* Scan Equal Hit */
|
||||
#define ST2_WC 0x10 /* Wrong Cylinder */
|
||||
#define ST2_CRC 0x20 /* CRC error in data field */
|
||||
#define ST2_CM 0x40 /* Control Mark = deleted */
|
||||
|
||||
/* Bits of FD_ST3 */
|
||||
#define ST3_HA 0x04 /* Head (Address) */
|
||||
#define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */
|
||||
#define ST3_WP 0x40 /* Write Protect */
|
||||
|
||||
/* Values for FD_COMMAND */
|
||||
#define FD_RECALIBRATE 0x07 /* move to track 0 */
|
||||
#define FD_SEEK 0x0F /* seek track */
|
||||
#define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */
|
||||
#define FD_WRITE 0xC5 /* write with MT, MFM */
|
||||
#define FD_SENSEI 0x08 /* Sense Interrupt Status */
|
||||
#define FD_SPECIFY 0x03 /* specify HUT etc */
|
||||
|
||||
/* DMA commands */
|
||||
#define DMA_READ 0x46
|
||||
#define DMA_WRITE 0x4A
|
||||
|
||||
#endif
|
||||
209
kernel/0.95/linux-0.95/include/linux/fs.h
Normal file
209
kernel/0.95/linux-0.95/include/linux/fs.h
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* This file has definitions for some important file table
|
||||
* structures etc.
|
||||
*/
|
||||
|
||||
#ifndef _FS_H
|
||||
#define _FS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* devices are as follows: (same as minix, so we can use the minix
|
||||
* file system. These are major numbers.)
|
||||
*
|
||||
* 0 - unused (nodev)
|
||||
* 1 - /dev/mem
|
||||
* 2 - /dev/fd
|
||||
* 3 - /dev/hd
|
||||
* 4 - /dev/ttyx
|
||||
* 5 - /dev/tty
|
||||
* 6 - /dev/lp
|
||||
* 7 - unnamed pipes
|
||||
*/
|
||||
|
||||
#define IS_SEEKABLE(x) ((x)>=1 && (x)<=3)
|
||||
|
||||
#define MAY_EXEC 1
|
||||
#define MAY_WRITE 2
|
||||
#define MAY_READ 4
|
||||
|
||||
#define READ 0
|
||||
#define WRITE 1
|
||||
#define READA 2 /* read-ahead - don't pause */
|
||||
#define WRITEA 3 /* "write-ahead" - silly, but somewhat useful */
|
||||
|
||||
void buffer_init(long buffer_end);
|
||||
|
||||
#define MAJOR(a) (((unsigned)(a))>>8)
|
||||
#define MINOR(a) ((a)&0xff)
|
||||
|
||||
#define NR_OPEN 20
|
||||
#define NR_INODE 128
|
||||
#define NR_FILE 64
|
||||
#define NR_SUPER 8
|
||||
#define NR_HASH 307
|
||||
#define NR_BUFFERS nr_buffers
|
||||
#define BLOCK_SIZE 1024
|
||||
#define BLOCK_SIZE_BITS 10
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
#define PIPE_READ_WAIT(inode) ((inode).i_wait)
|
||||
#define PIPE_WRITE_WAIT(inode) ((inode).i_wait2)
|
||||
#define PIPE_HEAD(inode) ((inode).i_data[0])
|
||||
#define PIPE_TAIL(inode) ((inode).i_data[1])
|
||||
#define PIPE_SIZE(inode) ((PIPE_HEAD(inode)-PIPE_TAIL(inode))&(PAGE_SIZE-1))
|
||||
#define PIPE_EMPTY(inode) (PIPE_HEAD(inode)==PIPE_TAIL(inode))
|
||||
#define PIPE_FULL(inode) (PIPE_SIZE(inode)==(PAGE_SIZE-1))
|
||||
|
||||
#define NIL_FILP ((struct file *)0)
|
||||
#define SEL_IN 1
|
||||
#define SEL_OUT 2
|
||||
#define SEL_EX 4
|
||||
|
||||
typedef char buffer_block[BLOCK_SIZE];
|
||||
|
||||
struct buffer_head {
|
||||
char * b_data; /* pointer to data block (1024 bytes) */
|
||||
unsigned long b_blocknr; /* block number */
|
||||
unsigned short b_dev; /* device (0 = free) */
|
||||
unsigned char b_uptodate;
|
||||
unsigned char b_dirt; /* 0-clean,1-dirty */
|
||||
unsigned char b_count; /* users using this block */
|
||||
unsigned char b_lock; /* 0 - ok, 1 -locked */
|
||||
struct task_struct * b_wait;
|
||||
struct buffer_head * b_prev;
|
||||
struct buffer_head * b_next;
|
||||
struct buffer_head * b_prev_free;
|
||||
struct buffer_head * b_next_free;
|
||||
};
|
||||
|
||||
struct inode {
|
||||
dev_t i_dev;
|
||||
ino_t i_ino;
|
||||
umode_t i_mode;
|
||||
nlink_t i_nlink;
|
||||
uid_t i_uid;
|
||||
gid_t i_gid;
|
||||
dev_t i_rdev;
|
||||
off_t i_size;
|
||||
time_t i_atime;
|
||||
time_t i_mtime;
|
||||
time_t i_ctime;
|
||||
unsigned long i_data[16];
|
||||
struct inode_operations * i_op;
|
||||
struct super_block * i_sb;
|
||||
struct task_struct * i_wait;
|
||||
struct task_struct * i_wait2; /* for pipes */
|
||||
unsigned short i_count;
|
||||
unsigned char i_lock;
|
||||
unsigned char i_dirt;
|
||||
unsigned char i_pipe;
|
||||
unsigned char i_mount;
|
||||
unsigned char i_seek;
|
||||
unsigned char i_update;
|
||||
};
|
||||
|
||||
struct file {
|
||||
unsigned short f_mode;
|
||||
unsigned short f_flags;
|
||||
unsigned short f_count;
|
||||
struct inode * f_inode;
|
||||
struct file_operations * f_op;
|
||||
off_t f_pos;
|
||||
};
|
||||
|
||||
struct super_block {
|
||||
unsigned short s_ninodes;
|
||||
unsigned short s_nzones;
|
||||
unsigned short s_imap_blocks;
|
||||
unsigned short s_zmap_blocks;
|
||||
unsigned short s_firstdatazone;
|
||||
unsigned short s_log_zone_size;
|
||||
unsigned long s_max_size;
|
||||
unsigned short s_magic;
|
||||
/* These are only in memory */
|
||||
struct buffer_head * s_imap[8];
|
||||
struct buffer_head * s_zmap[8];
|
||||
unsigned short s_dev;
|
||||
struct inode * s_covered;
|
||||
struct inode * s_mounted;
|
||||
unsigned long s_time;
|
||||
struct task_struct * s_wait;
|
||||
unsigned char s_lock;
|
||||
unsigned char s_rd_only;
|
||||
unsigned char s_dirt;
|
||||
};
|
||||
|
||||
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 *, char *, int);
|
||||
};
|
||||
|
||||
struct inode_operations {
|
||||
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 (*readlink) (struct inode *,char *,int);
|
||||
int (*open) (struct inode *, struct file *);
|
||||
void (*release) (struct inode *, struct file *);
|
||||
struct inode * (*follow_link) (struct inode *, struct inode *);
|
||||
};
|
||||
|
||||
extern struct inode inode_table[NR_INODE];
|
||||
extern struct file file_table[NR_FILE];
|
||||
extern struct super_block super_block[NR_SUPER];
|
||||
extern struct buffer_head * start_buffer;
|
||||
extern int nr_buffers;
|
||||
|
||||
extern void check_disk_change(int dev);
|
||||
extern int floppy_change(unsigned int nr);
|
||||
extern int ticks_to_floppy_on(unsigned int dev);
|
||||
extern void floppy_on(unsigned int dev);
|
||||
extern void floppy_off(unsigned int dev);
|
||||
extern void truncate(struct inode * inode);
|
||||
extern void sync_inodes(void);
|
||||
extern void wait_on(struct inode * inode);
|
||||
extern int bmap(struct inode * inode,int block);
|
||||
extern struct inode * namei(const char * pathname);
|
||||
extern struct inode * lnamei(const char * pathname);
|
||||
extern int open_namei(const char * pathname, int flag, int mode,
|
||||
struct inode ** res_inode);
|
||||
extern void iput(struct inode * inode);
|
||||
extern struct inode * iget(int dev,int nr);
|
||||
extern struct inode * get_empty_inode(void);
|
||||
extern struct inode * get_pipe_inode(void);
|
||||
extern struct buffer_head * get_hash_table(int dev, int block);
|
||||
extern struct buffer_head * getblk(int dev, int block);
|
||||
extern void ll_rw_block(int rw, struct buffer_head * bh);
|
||||
extern void ll_rw_page(int rw, int dev, int nr, char * buffer);
|
||||
extern void ll_rw_swap_file(int rw, int dev, unsigned int *b, int nb, char *buffer);
|
||||
extern void brelse(struct buffer_head * buf);
|
||||
extern struct buffer_head * bread(int dev,int block);
|
||||
extern void bread_page(unsigned long addr,int dev,int b[4]);
|
||||
extern struct buffer_head * breada(int dev,int block,...);
|
||||
extern int sync_dev(int dev);
|
||||
extern struct super_block * get_super(int dev);
|
||||
extern int ROOT_DEV;
|
||||
|
||||
extern void mount_root(void);
|
||||
|
||||
extern int minix_file_read(struct inode *, struct file *, char *, int);
|
||||
extern int pipe_read(struct inode *, struct file *, char *, int);
|
||||
extern int char_read(struct inode *, struct file *, char *, int);
|
||||
extern int block_read(struct inode *, struct file *, char *, int);
|
||||
|
||||
extern int minix_file_write(struct inode *, struct file *, char *, int);
|
||||
extern int pipe_write(struct inode *, struct file *, char *, int);
|
||||
extern int char_write(struct inode *, struct file *, char *, int);
|
||||
extern int block_write(struct inode *, struct file *, char *, int);
|
||||
|
||||
#endif
|
||||
67
kernel/0.95/linux-0.95/include/linux/hdreg.h
Normal file
67
kernel/0.95/linux-0.95/include/linux/hdreg.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This file contains some defines for the AT-hd-controller.
|
||||
* Various sources. Check out some definitions (see comments with
|
||||
* a ques).
|
||||
*/
|
||||
#ifndef _HDREG_H
|
||||
#define _HDREG_H
|
||||
|
||||
/* Hd controller regs. Ref: IBM AT Bios-listing */
|
||||
#define HD_DATA 0x1f0 /* _CTL when writing */
|
||||
#define HD_ERROR 0x1f1 /* see err-bits */
|
||||
#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
|
||||
#define HD_SECTOR 0x1f3 /* starting sector */
|
||||
#define HD_LCYL 0x1f4 /* starting cylinder */
|
||||
#define HD_HCYL 0x1f5 /* high byte of starting cyl */
|
||||
#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
|
||||
#define HD_STATUS 0x1f7 /* see status-bits */
|
||||
#define HD_PRECOMP HD_ERROR /* same io address, read=error, write=precomp */
|
||||
#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
|
||||
|
||||
#define HD_CMD 0x3f6
|
||||
|
||||
/* Bits of HD_STATUS */
|
||||
#define ERR_STAT 0x01
|
||||
#define INDEX_STAT 0x02
|
||||
#define ECC_STAT 0x04 /* Corrected error */
|
||||
#define DRQ_STAT 0x08
|
||||
#define SEEK_STAT 0x10
|
||||
#define WRERR_STAT 0x20
|
||||
#define READY_STAT 0x40
|
||||
#define BUSY_STAT 0x80
|
||||
|
||||
/* Values for HD_COMMAND */
|
||||
#define WIN_RESTORE 0x10
|
||||
#define WIN_READ 0x20
|
||||
#define WIN_WRITE 0x30
|
||||
#define WIN_VERIFY 0x40
|
||||
#define WIN_FORMAT 0x50
|
||||
#define WIN_INIT 0x60
|
||||
#define WIN_SEEK 0x70
|
||||
#define WIN_DIAGNOSE 0x90
|
||||
#define WIN_SPECIFY 0x91
|
||||
|
||||
/* Bits for HD_ERROR */
|
||||
#define MARK_ERR 0x01 /* Bad address mark ? */
|
||||
#define TRK0_ERR 0x02 /* couldn't find track 0 */
|
||||
#define ABRT_ERR 0x04 /* ? */
|
||||
#define ID_ERR 0x10 /* ? */
|
||||
#define ECC_ERR 0x40 /* ? */
|
||||
#define BBD_ERR 0x80 /* ? */
|
||||
|
||||
#define EXTENDED_PARTITION 5
|
||||
|
||||
struct partition {
|
||||
unsigned char boot_ind; /* 0x80 - active */
|
||||
unsigned char head; /* starting head */
|
||||
unsigned char sector; /* starting sector */
|
||||
unsigned char cyl; /* starting cylinder */
|
||||
unsigned char sys_ind; /* What partition type */
|
||||
unsigned char end_head; /* end head */
|
||||
unsigned char end_sector; /* end sector */
|
||||
unsigned char end_cyl; /* end cylinder */
|
||||
unsigned int start_sect; /* starting sector counting from 0 */
|
||||
unsigned int nr_sects; /* nr of sectors in partition */
|
||||
};
|
||||
|
||||
#endif
|
||||
20
kernel/0.95/linux-0.95/include/linux/head.h
Normal file
20
kernel/0.95/linux-0.95/include/linux/head.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef _HEAD_H
|
||||
#define _HEAD_H
|
||||
|
||||
typedef struct desc_struct {
|
||||
unsigned long a,b;
|
||||
} desc_table[256];
|
||||
|
||||
extern unsigned long pg_dir[1024];
|
||||
extern desc_table idt,gdt;
|
||||
|
||||
#define GDT_NUL 0
|
||||
#define GDT_CODE 1
|
||||
#define GDT_DATA 2
|
||||
#define GDT_TMP 3
|
||||
|
||||
#define LDT_NUL 0
|
||||
#define LDT_CODE 1
|
||||
#define LDT_DATA 2
|
||||
|
||||
#endif
|
||||
24
kernel/0.95/linux-0.95/include/linux/kernel.h
Normal file
24
kernel/0.95/linux-0.95/include/linux/kernel.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 'kernel.h' contains some often-used function prototypes etc
|
||||
*/
|
||||
void verify_area(void * addr,int count);
|
||||
volatile void panic(const char * str);
|
||||
volatile void do_exit(long error_code);
|
||||
int printf(const char * fmt, ...);
|
||||
int printk(const char * fmt, ...);
|
||||
void console_print(const char * str);
|
||||
int tty_write(unsigned ch,char * buf,int count);
|
||||
void * malloc(unsigned int size);
|
||||
void free_s(void * obj, int size);
|
||||
|
||||
#define free(x) free_s((x), 0)
|
||||
|
||||
/*
|
||||
* This is defined as a macro, but at some point this might become a
|
||||
* real subroutine that sets a flag if it returns true (to do
|
||||
* BSD-style accounting where the process is flagged if it uses root
|
||||
* privs). The implication of this is that you should do normal
|
||||
* permissions checks first, and check suser() last.
|
||||
*/
|
||||
#define suser() (current->euid == 0)
|
||||
|
||||
186
kernel/0.95/linux-0.95/include/linux/math_emu.h
Normal file
186
kernel/0.95/linux-0.95/include/linux/math_emu.h
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* linux/include/linux/math_emu.h
|
||||
*
|
||||
* (C) 1991 Linus Torvalds
|
||||
*/
|
||||
#ifndef _LINUX_MATH_EMU_H
|
||||
#define _LINUX_MATH_EMU_H
|
||||
|
||||
#include <linux/sched.h>
|
||||
|
||||
struct info {
|
||||
long ___orig_eip;
|
||||
long ___ret_from_system_call;
|
||||
long ___ebx;
|
||||
long ___ecx;
|
||||
long ___edx;
|
||||
long ___esi;
|
||||
long ___edi;
|
||||
long ___ebp;
|
||||
long ___eax;
|
||||
long ___ds;
|
||||
long ___es;
|
||||
long ___fs;
|
||||
long ___gs;
|
||||
long ___orig_eax;
|
||||
long ___eip;
|
||||
long ___cs;
|
||||
long ___eflags;
|
||||
long ___esp;
|
||||
long ___ss;
|
||||
};
|
||||
|
||||
#define EAX (info->___eax)
|
||||
#define EBX (info->___ebx)
|
||||
#define ECX (info->___ecx)
|
||||
#define EDX (info->___edx)
|
||||
#define ESI (info->___esi)
|
||||
#define EDI (info->___edi)
|
||||
#define EBP (info->___ebp)
|
||||
#define ESP (info->___esp)
|
||||
#define EIP (info->___eip)
|
||||
#define ORIG_EIP (info->___orig_eip)
|
||||
#define EFLAGS (info->___eflags)
|
||||
#define DS (*(unsigned short *) &(info->___ds))
|
||||
#define ES (*(unsigned short *) &(info->___es))
|
||||
#define FS (*(unsigned short *) &(info->___fs))
|
||||
#define CS (*(unsigned short *) &(info->___cs))
|
||||
#define SS (*(unsigned short *) &(info->___ss))
|
||||
|
||||
void __math_abort(struct info *, unsigned int);
|
||||
|
||||
#define math_abort(x,y) \
|
||||
(((volatile void (*)(struct info *,unsigned int)) __math_abort)((x),(y)))
|
||||
|
||||
/*
|
||||
* Gcc forces this stupid alignment problem: I want to use only two longs
|
||||
* for the temporary real 64-bit mantissa, but then gcc aligns out the
|
||||
* structure to 12 bytes which breaks things in math_emulate.c. Shit. I
|
||||
* want some kind of "no-alignt" pragma or something.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
long a,b;
|
||||
short exponent;
|
||||
} temp_real;
|
||||
|
||||
typedef struct {
|
||||
short m0,m1,m2,m3;
|
||||
short exponent;
|
||||
} temp_real_unaligned;
|
||||
|
||||
#define real_to_real(a,b) \
|
||||
((*(long long *) (b) = *(long long *) (a)),((b)->exponent = (a)->exponent))
|
||||
|
||||
typedef struct {
|
||||
long a,b;
|
||||
} long_real;
|
||||
|
||||
typedef long short_real;
|
||||
|
||||
typedef struct {
|
||||
long a,b;
|
||||
short sign;
|
||||
} temp_int;
|
||||
|
||||
struct swd {
|
||||
int ie:1;
|
||||
int de:1;
|
||||
int ze:1;
|
||||
int oe:1;
|
||||
int ue:1;
|
||||
int pe:1;
|
||||
int sf:1;
|
||||
int ir:1;
|
||||
int c0:1;
|
||||
int c1:1;
|
||||
int c2:1;
|
||||
int top:3;
|
||||
int c3:1;
|
||||
int b:1;
|
||||
};
|
||||
|
||||
#define I387 (current->tss.i387)
|
||||
#define SWD (*(struct swd *) &I387.swd)
|
||||
#define ROUNDING ((I387.cwd >> 10) & 3)
|
||||
#define PRECISION ((I387.cwd >> 8) & 3)
|
||||
|
||||
#define BITS24 0
|
||||
#define BITS53 2
|
||||
#define BITS64 3
|
||||
|
||||
#define ROUND_NEAREST 0
|
||||
#define ROUND_DOWN 1
|
||||
#define ROUND_UP 2
|
||||
#define ROUND_0 3
|
||||
|
||||
#define CONSTZ (temp_real_unaligned) {0x0000,0x0000,0x0000,0x0000,0x0000}
|
||||
#define CONST1 (temp_real_unaligned) {0x0000,0x0000,0x0000,0x8000,0x3FFF}
|
||||
#define CONSTPI (temp_real_unaligned) {0xC235,0x2168,0xDAA2,0xC90F,0x4000}
|
||||
#define CONSTLN2 (temp_real_unaligned) {0x79AC,0xD1CF,0x17F7,0xB172,0x3FFE}
|
||||
#define CONSTLG2 (temp_real_unaligned) {0xF799,0xFBCF,0x9A84,0x9A20,0x3FFD}
|
||||
#define CONSTL2E (temp_real_unaligned) {0xF0BC,0x5C17,0x3B29,0xB8AA,0x3FFF}
|
||||
#define CONSTL2T (temp_real_unaligned) {0x8AFE,0xCD1B,0x784B,0xD49A,0x4000}
|
||||
|
||||
#define set_IE() (I387.swd |= 1)
|
||||
#define set_DE() (I387.swd |= 2)
|
||||
#define set_ZE() (I387.swd |= 4)
|
||||
#define set_OE() (I387.swd |= 8)
|
||||
#define set_UE() (I387.swd |= 16)
|
||||
#define set_PE() (I387.swd |= 32)
|
||||
|
||||
#define set_C0() (I387.swd |= 0x0100)
|
||||
#define set_C1() (I387.swd |= 0x0200)
|
||||
#define set_C2() (I387.swd |= 0x0400)
|
||||
#define set_C3() (I387.swd |= 0x4000)
|
||||
|
||||
/* ea.c */
|
||||
|
||||
char * ea(struct info * __info, unsigned short __code);
|
||||
|
||||
/* convert.c */
|
||||
|
||||
void frndint(const temp_real * __a, temp_real * __b);
|
||||
void short_to_temp(const short_real * __a, temp_real * __b);
|
||||
void long_to_temp(const long_real * __a, temp_real * __b);
|
||||
void temp_to_short(const temp_real * __a, short_real * __b);
|
||||
void temp_to_long(const temp_real * __a, long_real * __b);
|
||||
void real_to_int(const temp_real * __a, temp_int * __b);
|
||||
void int_to_real(const temp_int * __a, temp_real * __b);
|
||||
|
||||
/* get_put.c */
|
||||
|
||||
void get_short_real(temp_real *, struct info *, unsigned short);
|
||||
void get_long_real(temp_real *, struct info *, unsigned short);
|
||||
void get_temp_real(temp_real *, struct info *, unsigned short);
|
||||
void get_short_int(temp_real *, struct info *, unsigned short);
|
||||
void get_long_int(temp_real *, struct info *, unsigned short);
|
||||
void get_longlong_int(temp_real *, struct info *, unsigned short);
|
||||
void get_BCD(temp_real *, struct info *, unsigned short);
|
||||
void put_short_real(const temp_real *, struct info *, unsigned short);
|
||||
void put_long_real(const temp_real *, struct info *, unsigned short);
|
||||
void put_temp_real(const temp_real *, struct info *, unsigned short);
|
||||
void put_short_int(const temp_real *, struct info *, unsigned short);
|
||||
void put_long_int(const temp_real *, struct info *, unsigned short);
|
||||
void put_longlong_int(const temp_real *, struct info *, unsigned short);
|
||||
void put_BCD(const temp_real *, struct info *, unsigned short);
|
||||
|
||||
/* add.c */
|
||||
|
||||
void fadd(const temp_real *, const temp_real *, temp_real *);
|
||||
|
||||
/* mul.c */
|
||||
|
||||
void fmul(const temp_real *, const temp_real *, temp_real *);
|
||||
|
||||
/* div.c */
|
||||
|
||||
void fdiv(const temp_real *, const temp_real *, temp_real *);
|
||||
|
||||
/* compare.c */
|
||||
|
||||
void fcom(const temp_real *, const temp_real *);
|
||||
void fucom(const temp_real *, const temp_real *);
|
||||
void ftst(const temp_real *);
|
||||
|
||||
#endif
|
||||
78
kernel/0.95/linux-0.95/include/linux/minix_fs.h
Normal file
78
kernel/0.95/linux-0.95/include/linux/minix_fs.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* The minix filesystem constants/structures
|
||||
*/
|
||||
|
||||
#ifndef _MINIX_FS_H
|
||||
#define _MINIX_FS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MINIX_NAME_LEN 14
|
||||
#define MINIX_ROOT_INO 1
|
||||
|
||||
#define MINIX_I_MAP_SLOTS 8
|
||||
#define MINIX_Z_MAP_SLOTS 8
|
||||
#define MINIX_SUPER_MAGIC 0x137F
|
||||
|
||||
#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
|
||||
#define MINIX_DIR_ENTRIES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_dir_entry)))
|
||||
|
||||
struct minix_inode {
|
||||
unsigned short i_mode;
|
||||
unsigned short i_uid;
|
||||
unsigned long i_size;
|
||||
unsigned long i_time;
|
||||
unsigned char i_gid;
|
||||
unsigned char i_nlinks;
|
||||
unsigned short i_zone[9];
|
||||
};
|
||||
|
||||
struct minix_super_block {
|
||||
unsigned short s_ninodes;
|
||||
unsigned short s_nzones;
|
||||
unsigned short s_imap_blocks;
|
||||
unsigned short s_zmap_blocks;
|
||||
unsigned short s_firstdatazone;
|
||||
unsigned short s_log_zone_size;
|
||||
unsigned long s_max_size;
|
||||
unsigned short s_magic;
|
||||
};
|
||||
|
||||
struct minix_dir_entry {
|
||||
unsigned short inode;
|
||||
char name[MINIX_NAME_LEN];
|
||||
};
|
||||
|
||||
extern int minix_open(struct inode * inode, struct file * filp);
|
||||
extern void minix_release(struct inode * inode, struct file * filp);
|
||||
extern struct inode * minix_follow_link(struct inode * dir, struct inode * inode);
|
||||
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);
|
||||
extern int minix_readlink(struct inode * inode, char * buffer, int buflen);
|
||||
extern struct inode * minix_new_inode(int dev);
|
||||
extern void minix_free_inode(struct inode * inode);
|
||||
extern int minix_new_block(int dev);
|
||||
extern int minix_free_block(int dev, int block);
|
||||
|
||||
extern int minix_create_block(struct inode * inode, int block);
|
||||
extern int minix_bmap(struct inode * inode,int block);
|
||||
|
||||
extern int minix_lseek(struct inode * inode, struct file * filp, off_t offset, int origin);
|
||||
extern int minix_read(struct inode * inode, struct file * filp, char * buf, int count);
|
||||
extern int minix_write(struct inode * inode, struct file * filp, char * buf, int count);
|
||||
|
||||
extern struct inode_operations minix_inode_operations;
|
||||
extern struct file_operations minix_file_operations;
|
||||
|
||||
#endif
|
||||
51
kernel/0.95/linux-0.95/include/linux/mm.h
Normal file
51
kernel/0.95/linux-0.95/include/linux/mm.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef _MM_H
|
||||
#define _MM_H
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <signal.h>
|
||||
|
||||
extern unsigned int swap_device;
|
||||
extern struct inode * swap_file;
|
||||
|
||||
extern void rw_swap_page(int rw, unsigned int nr, char * buf);
|
||||
|
||||
#define read_swap_page(nr,buf) \
|
||||
rw_swap_page(READ,(nr),(buf))
|
||||
#define write_swap_page(nr,buf) \
|
||||
rw_swap_page(WRITE,(nr),(buf))
|
||||
|
||||
extern unsigned long get_free_page(void);
|
||||
extern unsigned long put_dirty_page(unsigned long page,unsigned long address);
|
||||
extern void free_page(unsigned long addr);
|
||||
void swap_free(int page_nr);
|
||||
void swap_in(unsigned long *table_ptr);
|
||||
|
||||
extern inline volatile void oom(void)
|
||||
{
|
||||
printk("out of memory\n\r");
|
||||
do_exit(SIGSEGV);
|
||||
}
|
||||
|
||||
#define invalidate() \
|
||||
__asm__("movl %%eax,%%cr3"::"a" (0))
|
||||
|
||||
/* these are not to be changed without changing head.s etc */
|
||||
#define LOW_MEM 0x100000
|
||||
extern unsigned long HIGH_MEMORY;
|
||||
#define PAGING_MEMORY (15*1024*1024)
|
||||
#define PAGING_PAGES (PAGING_MEMORY>>12)
|
||||
#define MAP_NR(addr) (((addr)-LOW_MEM)>>12)
|
||||
#define USED 100
|
||||
|
||||
extern unsigned char mem_map [ PAGING_PAGES ];
|
||||
|
||||
#define PAGE_DIRTY 0x40
|
||||
#define PAGE_ACCESSED 0x20
|
||||
#define PAGE_USER 0x04
|
||||
#define PAGE_RW 0x02
|
||||
#define PAGE_PRESENT 0x01
|
||||
|
||||
#endif
|
||||
295
kernel/0.95/linux-0.95/include/linux/sched.h
Normal file
295
kernel/0.95/linux-0.95/include/linux/sched.h
Normal file
@@ -0,0 +1,295 @@
|
||||
#ifndef _SCHED_H
|
||||
#define _SCHED_H
|
||||
|
||||
#define HZ 100
|
||||
|
||||
#define NR_TASKS 64
|
||||
#define TASK_SIZE 0x04000000
|
||||
#define LIBRARY_SIZE 0x00400000
|
||||
|
||||
#if (TASK_SIZE & 0x3fffff)
|
||||
#error "TASK_SIZE must be multiple of 4M"
|
||||
#endif
|
||||
|
||||
#if (LIBRARY_SIZE & 0x3fffff)
|
||||
#error "LIBRARY_SIZE must be a multiple of 4M"
|
||||
#endif
|
||||
|
||||
#if (LIBRARY_SIZE >= (TASK_SIZE/2))
|
||||
#error "LIBRARY_SIZE too damn big!"
|
||||
#endif
|
||||
|
||||
#if (((TASK_SIZE>>16)*NR_TASKS) != 0x10000)
|
||||
#error "TASK_SIZE*NR_TASKS must be 4GB"
|
||||
#endif
|
||||
|
||||
#define LIBRARY_OFFSET (TASK_SIZE - LIBRARY_SIZE)
|
||||
|
||||
#define CT_TO_SECS(x) ((x) / HZ)
|
||||
#define CT_TO_USECS(x) (((x) % HZ) * 1000000/HZ)
|
||||
|
||||
#define FIRST_TASK task[0]
|
||||
#define LAST_TASK task[NR_TASKS-1]
|
||||
|
||||
#include <linux/head.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <signal.h>
|
||||
|
||||
#if (NR_OPEN > 32)
|
||||
#error "Currently the close-on-exec-flags and select masks are in one long, max 32 files/proc"
|
||||
#endif
|
||||
|
||||
#define TASK_RUNNING 0
|
||||
#define TASK_INTERRUPTIBLE 1
|
||||
#define TASK_UNINTERRUPTIBLE 2
|
||||
#define TASK_ZOMBIE 3
|
||||
#define TASK_STOPPED 4
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
extern int copy_page_tables(unsigned long from, unsigned long to, long size);
|
||||
extern int free_page_tables(unsigned long from, unsigned long size);
|
||||
|
||||
extern void sched_init(void);
|
||||
extern void schedule(void);
|
||||
extern void trap_init(void);
|
||||
extern void panic(const char * str);
|
||||
extern int tty_write(unsigned minor,char * buf,int count);
|
||||
|
||||
typedef int (*fn_ptr)();
|
||||
|
||||
struct i387_struct {
|
||||
long cwd;
|
||||
long swd;
|
||||
long twd;
|
||||
long fip;
|
||||
long fcs;
|
||||
long foo;
|
||||
long fos;
|
||||
long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */
|
||||
};
|
||||
|
||||
struct tss_struct {
|
||||
long back_link; /* 16 high bits zero */
|
||||
long esp0;
|
||||
long ss0; /* 16 high bits zero */
|
||||
long esp1;
|
||||
long ss1; /* 16 high bits zero */
|
||||
long esp2;
|
||||
long ss2; /* 16 high bits zero */
|
||||
long cr3;
|
||||
long eip;
|
||||
long eflags;
|
||||
long eax,ecx,edx,ebx;
|
||||
long esp;
|
||||
long ebp;
|
||||
long esi;
|
||||
long edi;
|
||||
long es; /* 16 high bits zero */
|
||||
long cs; /* 16 high bits zero */
|
||||
long ss; /* 16 high bits zero */
|
||||
long ds; /* 16 high bits zero */
|
||||
long fs; /* 16 high bits zero */
|
||||
long gs; /* 16 high bits zero */
|
||||
long ldt; /* 16 high bits zero */
|
||||
long trace_bitmap; /* bits: trace 0, bitmap 16-31 */
|
||||
struct i387_struct i387;
|
||||
};
|
||||
|
||||
struct task_struct {
|
||||
/* these are hardcoded - don't touch */
|
||||
long state; /* -1 unrunnable, 0 runnable, >0 stopped */
|
||||
long counter;
|
||||
long priority;
|
||||
long signal;
|
||||
struct sigaction sigaction[32];
|
||||
long blocked; /* bitmap of masked signals */
|
||||
/* various fields */
|
||||
int exit_code;
|
||||
unsigned long start_code,end_code,end_data,brk,start_stack;
|
||||
long pid,pgrp,session,leader;
|
||||
int groups[NGROUPS];
|
||||
/*
|
||||
* pointers to parent process, youngest child, younger sibling,
|
||||
* older sibling, respectively. (p->father can be replaced with
|
||||
* p->p_pptr->pid)
|
||||
*/
|
||||
struct task_struct *p_pptr, *p_cptr, *p_ysptr, *p_osptr;
|
||||
unsigned short uid,euid,suid;
|
||||
unsigned short gid,egid,sgid;
|
||||
unsigned long timeout,alarm;
|
||||
long utime,stime,cutime,cstime,start_time;
|
||||
struct rlimit rlim[RLIM_NLIMITS];
|
||||
unsigned int flags; /* per process flags, defined below */
|
||||
unsigned short used_math;
|
||||
/* file system info */
|
||||
int link_count;
|
||||
int tty; /* -1 if no tty, so it must be signed */
|
||||
unsigned short umask;
|
||||
struct inode * pwd;
|
||||
struct inode * root;
|
||||
struct inode * executable;
|
||||
struct inode * library;
|
||||
unsigned long close_on_exec;
|
||||
struct file * filp[NR_OPEN];
|
||||
/* ldt for this task 0 - zero 1 - cs 2 - ds&ss */
|
||||
struct desc_struct ldt[3];
|
||||
/* tss for this task */
|
||||
struct tss_struct tss;
|
||||
};
|
||||
|
||||
/*
|
||||
* Per process flags
|
||||
*/
|
||||
#define PF_ALIGNWARN 0x00000001 /* Print alignment warning msgs */
|
||||
/* Not implemented yet, only for 486*/
|
||||
#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called. */
|
||||
#define PF_VM86 0x00000020 /* set if process can execute a vm86 */
|
||||
/* task. */
|
||||
/* not impelmented. */
|
||||
|
||||
/*
|
||||
* INIT_TASK is used to set up the first task table, touch at
|
||||
* your own risk!. Base=0, limit=0x9ffff (=640kB)
|
||||
*/
|
||||
#define INIT_TASK \
|
||||
/* state etc */ { 0,15,15, \
|
||||
/* signals */ 0,{{},},0, \
|
||||
/* ec,brk... */ 0,0,0,0,0,0, \
|
||||
/* pid etc.. */ 0,0,0,0, \
|
||||
/* suppl grps*/ {NOGROUP,}, \
|
||||
/* proc links*/ &init_task.task,0,0,0, \
|
||||
/* uid etc */ 0,0,0,0,0,0, \
|
||||
/* timeout */ 0,0,0,0,0,0,0, \
|
||||
/* rlimits */ { {0x7fffffff, 0x7fffffff}, {0x7fffffff, 0x7fffffff}, \
|
||||
{0x7fffffff, 0x7fffffff}, {0x7fffffff, 0x7fffffff}, \
|
||||
{0x7fffffff, 0x7fffffff}, {0x7fffffff, 0x7fffffff}}, \
|
||||
/* flags */ 0, \
|
||||
/* math */ 0, \
|
||||
/* fs info */ 0,-1,0022,NULL,NULL,NULL,NULL,0, \
|
||||
/* filp */ {NULL,}, \
|
||||
{ \
|
||||
{0,0}, \
|
||||
/* ldt */ {0x9f,0xc0fa00}, \
|
||||
{0x9f,0xc0f200}, \
|
||||
}, \
|
||||
/*tss*/ {0,PAGE_SIZE+(long)&init_task,0x10,0,0,0,0,(long)&pg_dir,\
|
||||
0,0,0,0,0,0,0,0, \
|
||||
0,0,0x17,0x17,0x17,0x17,0x17,0x17, \
|
||||
_LDT(0),0x80000000, \
|
||||
{} \
|
||||
}, \
|
||||
}
|
||||
|
||||
extern struct task_struct *task[NR_TASKS];
|
||||
extern struct task_struct *last_task_used_math;
|
||||
extern struct task_struct *current;
|
||||
extern unsigned long volatile jiffies;
|
||||
extern unsigned long startup_time;
|
||||
extern int jiffies_offset;
|
||||
|
||||
#define CURRENT_TIME (startup_time+(jiffies+jiffies_offset)/HZ)
|
||||
|
||||
extern void add_timer(long jiffies, void (*fn)(void));
|
||||
extern void sleep_on(struct task_struct ** p);
|
||||
extern void interruptible_sleep_on(struct task_struct ** p);
|
||||
extern void wake_up(struct task_struct ** p);
|
||||
extern int in_group_p(gid_t grp);
|
||||
|
||||
/*
|
||||
* Entry into gdt where to find first TSS. 0-nul, 1-cs, 2-ds, 3-syscall
|
||||
* 4-TSS0, 5-LDT0, 6-TSS1 etc ...
|
||||
*/
|
||||
#define FIRST_TSS_ENTRY 4
|
||||
#define FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1)
|
||||
#define _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))
|
||||
#define _LDT(n) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))
|
||||
#define ltr(n) __asm__("ltr %%ax"::"a" (_TSS(n)))
|
||||
#define lldt(n) __asm__("lldt %%ax"::"a" (_LDT(n)))
|
||||
#define str(n) \
|
||||
__asm__("str %%ax\n\t" \
|
||||
"subl %2,%%eax\n\t" \
|
||||
"shrl $4,%%eax" \
|
||||
:"=a" (n) \
|
||||
:"0" (0),"i" (FIRST_TSS_ENTRY<<3))
|
||||
/*
|
||||
* switch_to(n) should switch tasks to task nr n, first
|
||||
* checking that n isn't the current task, in which case it does nothing.
|
||||
* This also clears the TS-flag if the task we switched to has used
|
||||
* tha math co-processor latest.
|
||||
*/
|
||||
#define switch_to(n) {\
|
||||
struct {long a,b;} __tmp; \
|
||||
__asm__("cmpl %%ecx,_current\n\t" \
|
||||
"je 1f\n\t" \
|
||||
"movw %%dx,%1\n\t" \
|
||||
"xchgl %%ecx,_current\n\t" \
|
||||
"ljmp %0\n\t" \
|
||||
"cmpl %%ecx,_last_task_used_math\n\t" \
|
||||
"jne 1f\n\t" \
|
||||
"clts\n" \
|
||||
"1:" \
|
||||
::"m" (*&__tmp.a),"m" (*&__tmp.b), \
|
||||
"d" (_TSS(n)),"c" ((long) task[n]) \
|
||||
:"cx"); \
|
||||
}
|
||||
|
||||
#define PAGE_ALIGN(n) (((n)+0xfff)&0xfffff000)
|
||||
|
||||
#define _set_base(addr,base) \
|
||||
__asm__("movw %%dx,%0\n\t" \
|
||||
"rorl $16,%%edx\n\t" \
|
||||
"movb %%dl,%1\n\t" \
|
||||
"movb %%dh,%2" \
|
||||
::"m" (*((addr)+2)), \
|
||||
"m" (*((addr)+4)), \
|
||||
"m" (*((addr)+7)), \
|
||||
"d" (base) \
|
||||
:"dx")
|
||||
|
||||
#define _set_limit(addr,limit) \
|
||||
__asm__("movw %%dx,%0\n\t" \
|
||||
"rorl $16,%%edx\n\t" \
|
||||
"movb %1,%%dh\n\t" \
|
||||
"andb $0xf0,%%dh\n\t" \
|
||||
"orb %%dh,%%dl\n\t" \
|
||||
"movb %%dl,%1" \
|
||||
::"m" (*(addr)), \
|
||||
"m" (*((addr)+6)), \
|
||||
"d" (limit) \
|
||||
:"dx")
|
||||
|
||||
#define set_base(ldt,base) _set_base( ((char *)&(ldt)) , base )
|
||||
#define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )
|
||||
|
||||
static unsigned long inline _get_base(char * addr)
|
||||
{
|
||||
unsigned long __base;
|
||||
__asm__("movb %3,%%dh\n\t"
|
||||
"movb %2,%%dl\n\t"
|
||||
"shll $16,%%edx\n\t"
|
||||
"movw %1,%%dx"
|
||||
:"=&d" (__base)
|
||||
:"m" (*((addr)+2)),
|
||||
"m" (*((addr)+4)),
|
||||
"m" (*((addr)+7)));
|
||||
return __base;
|
||||
}
|
||||
|
||||
#define get_base(ldt) _get_base( ((char *)&(ldt)) )
|
||||
|
||||
static unsigned long inline get_limit(unsigned long segment)
|
||||
{
|
||||
unsigned long __limit;
|
||||
__asm__("lsll %1,%0"
|
||||
:"=r" (__limit):"r" (segment));
|
||||
return __limit+1;
|
||||
}
|
||||
|
||||
#endif
|
||||
113
kernel/0.95/linux-0.95/include/linux/sys.h
Normal file
113
kernel/0.95/linux-0.95/include/linux/sys.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Why isn't this a .c file? Enquiring minds....
|
||||
*/
|
||||
|
||||
extern int sys_setup();
|
||||
extern int sys_exit();
|
||||
extern int sys_fork();
|
||||
extern int sys_read();
|
||||
extern int sys_write();
|
||||
extern int sys_open();
|
||||
extern int sys_close();
|
||||
extern int sys_waitpid();
|
||||
extern int sys_creat();
|
||||
extern int sys_link();
|
||||
extern int sys_unlink();
|
||||
extern int sys_execve();
|
||||
extern int sys_chdir();
|
||||
extern int sys_time();
|
||||
extern int sys_mknod();
|
||||
extern int sys_chmod();
|
||||
extern int sys_chown();
|
||||
extern int sys_break();
|
||||
extern int sys_stat();
|
||||
extern int sys_lseek();
|
||||
extern int sys_getpid();
|
||||
extern int sys_mount();
|
||||
extern int sys_umount();
|
||||
extern int sys_setuid();
|
||||
extern int sys_getuid();
|
||||
extern int sys_stime();
|
||||
extern int sys_ptrace();
|
||||
extern int sys_alarm();
|
||||
extern int sys_fstat();
|
||||
extern int sys_pause();
|
||||
extern int sys_utime();
|
||||
extern int sys_stty();
|
||||
extern int sys_gtty();
|
||||
extern int sys_access();
|
||||
extern int sys_nice();
|
||||
extern int sys_ftime();
|
||||
extern int sys_sync();
|
||||
extern int sys_kill();
|
||||
extern int sys_rename();
|
||||
extern int sys_mkdir();
|
||||
extern int sys_rmdir();
|
||||
extern int sys_dup();
|
||||
extern int sys_pipe();
|
||||
extern int sys_times();
|
||||
extern int sys_prof();
|
||||
extern int sys_brk();
|
||||
extern int sys_setgid();
|
||||
extern int sys_getgid();
|
||||
extern int sys_signal();
|
||||
extern int sys_geteuid();
|
||||
extern int sys_getegid();
|
||||
extern int sys_acct();
|
||||
extern int sys_phys();
|
||||
extern int sys_lock();
|
||||
extern int sys_ioctl();
|
||||
extern int sys_fcntl();
|
||||
extern int sys_mpx();
|
||||
extern int sys_setpgid();
|
||||
extern int sys_ulimit();
|
||||
extern int sys_uname();
|
||||
extern int sys_umask();
|
||||
extern int sys_chroot();
|
||||
extern int sys_ustat();
|
||||
extern int sys_dup2();
|
||||
extern int sys_getppid();
|
||||
extern int sys_getpgrp();
|
||||
extern int sys_setsid();
|
||||
extern int sys_sigaction();
|
||||
extern int sys_sgetmask();
|
||||
extern int sys_ssetmask();
|
||||
extern int sys_setreuid();
|
||||
extern int sys_setregid();
|
||||
extern int sys_sigpending();
|
||||
extern int sys_sigsuspend();
|
||||
extern int sys_sethostname();
|
||||
extern int sys_setrlimit();
|
||||
extern int sys_getrlimit();
|
||||
extern int sys_getrusage();
|
||||
extern int sys_gettimeofday();
|
||||
extern int sys_settimeofday();
|
||||
extern int sys_getgroups();
|
||||
extern int sys_setgroups();
|
||||
extern int sys_select();
|
||||
extern int sys_symlink();
|
||||
extern int sys_lstat();
|
||||
extern int sys_readlink();
|
||||
extern int sys_uselib();
|
||||
extern int sys_swapon();
|
||||
extern int sys_reboot();
|
||||
|
||||
fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read,
|
||||
sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link,
|
||||
sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod,
|
||||
sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount,
|
||||
sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm,
|
||||
sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access,
|
||||
sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir,
|
||||
sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid,
|
||||
sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys,
|
||||
sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit,
|
||||
sys_uname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid,
|
||||
sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask,
|
||||
sys_setreuid,sys_setregid, sys_sigsuspend, sys_sigpending, sys_sethostname,
|
||||
sys_setrlimit, sys_getrlimit, sys_getrusage, sys_gettimeofday,
|
||||
sys_settimeofday, sys_getgroups, sys_setgroups, sys_select, sys_symlink,
|
||||
sys_lstat, sys_readlink, sys_uselib, sys_swapon, sys_reboot };
|
||||
|
||||
/* So we don't have to do any more manual updating.... */
|
||||
int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr);
|
||||
44
kernel/0.95/linux-0.95/include/linux/timer.h
Normal file
44
kernel/0.95/linux-0.95/include/linux/timer.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef _TIMER_H
|
||||
#define _TIMER_H
|
||||
|
||||
/*
|
||||
* DON'T CHANGE THESE!! Most of them are hardcoded into some assembly language
|
||||
* as well as being defined here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The timers are:
|
||||
*
|
||||
* BLANK_TIMER console screen-saver timer
|
||||
*
|
||||
* BEEP_TIMER console beep timer
|
||||
*
|
||||
* SERx_TIMER serial incoming characters timer
|
||||
*
|
||||
* SERx_TIMEOUT timeout for serial writes
|
||||
*
|
||||
* HD_TIMER harddisk timer
|
||||
*
|
||||
* FLOPPY_TIMER floppy disk timer (not used right now)
|
||||
*/
|
||||
|
||||
#define BLANK_TIMER 0
|
||||
#define BEEP_TIMER 1
|
||||
#define SER1_TIMER 2
|
||||
#define SER2_TIMER 3
|
||||
|
||||
#define SER1_TIMEOUT 8
|
||||
#define SER2_TIMEOUT 9
|
||||
|
||||
#define HD_TIMER 16
|
||||
#define FLOPPY_TIMER 17
|
||||
|
||||
struct timer_struct {
|
||||
unsigned long expires;
|
||||
void (*fn)(void);
|
||||
};
|
||||
|
||||
extern unsigned long timer_active;
|
||||
extern struct timer_struct timer_table[32];
|
||||
|
||||
#endif
|
||||
103
kernel/0.95/linux-0.95/include/linux/tty.h
Normal file
103
kernel/0.95/linux-0.95/include/linux/tty.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 'tty.h' defines some structures used by tty_io.c and some defines.
|
||||
*
|
||||
* NOTE! Don't touch this without checking that nothing in rs_io.s or
|
||||
* con_io.s breaks. Some constants are hardwired into the system (mainly
|
||||
* offsets into 'tty_queue'
|
||||
*/
|
||||
|
||||
#ifndef _TTY_H
|
||||
#define _TTY_H
|
||||
|
||||
#define MAX_CONSOLES 8
|
||||
#define NR_SERIALS 2
|
||||
#define NR_PTYS 4
|
||||
|
||||
extern int NR_CONSOLES;
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
#define TTY_BUF_SIZE 1024
|
||||
|
||||
struct tty_queue {
|
||||
unsigned long data;
|
||||
unsigned long head;
|
||||
unsigned long tail;
|
||||
struct task_struct * proc_list;
|
||||
char buf[TTY_BUF_SIZE];
|
||||
};
|
||||
|
||||
#define IS_A_CONSOLE(min) (((min) & 0xC0) == 0x00)
|
||||
#define IS_A_SERIAL(min) (((min) & 0xC0) == 0x40)
|
||||
#define IS_A_PTY(min) ((min) & 0x80)
|
||||
#define IS_A_PTY_MASTER(min) (((min) & 0xC0) == 0x80)
|
||||
#define IS_A_PTY_SLAVE(min) (((min) & 0xC0) == 0xC0)
|
||||
#define PTY_OTHER(min) ((min) ^ 0x40)
|
||||
|
||||
#define INC(a) ((a) = ((a)+1) & (TTY_BUF_SIZE-1))
|
||||
#define DEC(a) ((a) = ((a)-1) & (TTY_BUF_SIZE-1))
|
||||
#define EMPTY(a) ((a)->head == (a)->tail)
|
||||
#define LEFT(a) (((a)->tail-(a)->head-1)&(TTY_BUF_SIZE-1))
|
||||
#define LAST(a) ((a)->buf[(TTY_BUF_SIZE-1)&((a)->head-1)])
|
||||
#define FULL(a) (!LEFT(a))
|
||||
#define CHARS(a) (((a)->head-(a)->tail)&(TTY_BUF_SIZE-1))
|
||||
#define GETCH(queue,c) \
|
||||
(void)({c=(queue)->buf[(queue)->tail];INC((queue)->tail);})
|
||||
#define PUTCH(c,queue) \
|
||||
(void)({(queue)->buf[(queue)->head]=(c);INC((queue)->head);})
|
||||
|
||||
#define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
|
||||
#define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
|
||||
#define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
|
||||
#define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
|
||||
#define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
|
||||
#define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
|
||||
#define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
|
||||
#define SUSPEND_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
|
||||
|
||||
struct tty_struct {
|
||||
struct termios termios;
|
||||
int pgrp;
|
||||
int session;
|
||||
int stopped;
|
||||
struct winsize winsize;
|
||||
void (*write)(struct tty_struct * tty);
|
||||
struct tty_queue *read_q;
|
||||
struct tty_queue *write_q;
|
||||
struct tty_queue *secondary;
|
||||
};
|
||||
|
||||
extern struct tty_struct tty_table[];
|
||||
extern int fg_console;
|
||||
extern unsigned long video_num_columns;
|
||||
extern unsigned long video_num_lines;
|
||||
|
||||
|
||||
#define TTY_TABLE(nr) \
|
||||
(tty_table + ((nr) ? (((nr) < 64)? (nr)-1:(nr)) : fg_console))
|
||||
|
||||
/* intr=^C quit=^| erase=del kill=^U
|
||||
eof=^D vtime=\0 vmin=\1 sxtc=\0
|
||||
start=^Q stop=^S susp=^Z eol=\0
|
||||
reprint=^R discard=^U werase=^W lnext=^V
|
||||
eol2=\0
|
||||
*/
|
||||
#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
|
||||
|
||||
void rs_init(void);
|
||||
void con_init(void);
|
||||
void tty_init(void);
|
||||
|
||||
int tty_read(unsigned c, char * buf, int n, unsigned short flags);
|
||||
int tty_write(unsigned c, char * buf, int n);
|
||||
|
||||
void con_write(struct tty_struct * tty);
|
||||
void rs_write(struct tty_struct * tty);
|
||||
void mpty_write(struct tty_struct * tty);
|
||||
void spty_write(struct tty_struct * tty);
|
||||
|
||||
void copy_to_cooked(struct tty_struct * tty);
|
||||
|
||||
void update_screen(int new_console);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user