⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 type.h

📁 一个简单的操作系统minix的核心代码
💻 H
字号:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				include/minix/type.h	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03100	#ifndef _TYPE_H
03101	#define _TYPE_H
03102	#ifndef _MINIX_TYPE_H
03103	#define _MINIX_TYPE_H
03104	
03105	/* Type definitions. */
03106	typedef unsigned int vir_clicks; /* virtual  addresses and lengths in clicks */
03107	typedef unsigned long phys_bytes;/* physical addresses and lengths in bytes */
03108	typedef unsigned int phys_clicks;/* physical addresses and lengths in clicks */
03109	
03110	#if (CHIP == INTEL)
03111	typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */
03112	#endif
03113	
03114	#if (CHIP == M68000)
03115	typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
03116	#endif
03117	
03118	#if (CHIP == SPARC)
03119	typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
03120	#endif
03121	
03122	/* Types relating to messages. */
03123	#define M1                 1
03124	#define M3                 3
03125	#define M4                 4
03126	#define M3_STRING         14
03127	
03128	typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
03129	typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
03130	typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
03131	typedef struct {long m4l1, m4l2, m4l3, m4l4, m4l5;} mess_4;
03132	typedef struct {char m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;
03133	typedef struct {int m6i1, m6i2, m6i3; long m6l1; sighandler_t m6f1;} mess_6;
03134	
03135	typedef struct {
03136	  int m_source;                 /* who sent the message */
03137	  int m_type;                   /* what kind of message is it */
03138	  union {
03139	        mess_1 m_m1;
03140	        mess_2 m_m2;
03141	        mess_3 m_m3;
03142	        mess_4 m_m4;
03143	        mess_5 m_m5;
03144	        mess_6 m_m6;
03145	  } m_u;
03146	} message;
03147	
03148	/* The following defines provide names for useful members. */
03149	#define m1_i1  m_u.m_m1.m1i1
03150	#define m1_i2  m_u.m_m1.m1i2
03151	#define m1_i3  m_u.m_m1.m1i3
03152	#define m1_p1  m_u.m_m1.m1p1
03153	#define m1_p2  m_u.m_m1.m1p2
03154	#define m1_p3  m_u.m_m1.m1p3
03155	
03156	#define m2_i1  m_u.m_m2.m2i1
03157	#define m2_i2  m_u.m_m2.m2i2
03158	#define m2_i3  m_u.m_m2.m2i3
03159	#define m2_l1  m_u.m_m2.m2l1
03160	#define m2_l2  m_u.m_m2.m2l2
03161	#define m2_p1  m_u.m_m2.m2p1
03162	
03163	#define m3_i1  m_u.m_m3.m3i1
03164	#define m3_i2  m_u.m_m3.m3i2
03165	#define m3_p1  m_u.m_m3.m3p1
03166	#define m3_ca1 m_u.m_m3.m3ca1
03167	
03168	#define m4_l1  m_u.m_m4.m4l1
03169	#define m4_l2  m_u.m_m4.m4l2
03170	#define m4_l3  m_u.m_m4.m4l3
03171	#define m4_l4  m_u.m_m4.m4l4
03172	#define m4_l5  m_u.m_m4.m4l5
03173	
03174	#define m5_c1  m_u.m_m5.m5c1
03175	#define m5_c2  m_u.m_m5.m5c2
03176	#define m5_i1  m_u.m_m5.m5i1
03177	#define m5_i2  m_u.m_m5.m5i2
03178	#define m5_l1  m_u.m_m5.m5l1
03179	#define m5_l2  m_u.m_m5.m5l2
03180	#define m5_l3  m_u.m_m5.m5l3
03181	
03182	#define m6_i1  m_u.m_m6.m6i1
03183	#define m6_i2  m_u.m_m6.m6i2
03184	#define m6_i3  m_u.m_m6.m6i3
03185	#define m6_l1  m_u.m_m6.m6l1
03186	#define m6_f1  m_u.m_m6.m6f1
03187	
03188	struct mem_map {
03189	  vir_clicks mem_vir;           /* virtual address */
03190	  phys_clicks mem_phys;         /* physical address */
03191	  vir_clicks mem_len;           /* length */
03192	};
03193	
03194	struct iorequest_s {
03195	  long io_position;             /* position in device file (really off_t) */
03196	  char *io_buf;                 /* buffer in user space */
03197	  int io_nbytes;                /* size of request */
03198	  unsigned short io_request;    /* read, write (optionally) */
03199	};
03200	#endif /* _TYPE_H */
03201	
03202	typedef struct {
03203	  vir_bytes iov_addr;           /* address of an I/O buffer */
03204	  vir_bytes iov_size;           /* sizeof an I/O buffer */
03205	} iovec_t;
03206	
03207	typedef struct {
03208	  vir_bytes cpv_src;            /* src address of data */
03209	  vir_bytes cpv_dst;            /* dst address of data */
03210	  vir_bytes cpv_size;           /* size of data */
03211	} cpvec_t;
03212	
03213	/* MM passes the address of a structure of this type to KERNEL when
03214	 * do_sendsig() is invoked as part of the signal catching mechanism.
03215	 * The structure contain all the information that KERNEL needs to build
03216	 * the signal stack.
03217	 */
03218	struct sigmsg {
03219	  int sm_signo;                 /* signal number being caught */
03220	  unsigned long sm_mask;        /* mask to restore when handler returns */
03221	  vir_bytes sm_sighandler;      /* address of handler */
03222	  vir_bytes sm_sigreturn;       /* address of _sigreturn in C library */
03223	  vir_bytes sm_stkptr;          /* user stack pointer */
03224	};
03225	
03226	#define MESS_SIZE (sizeof(message))     /* might need usizeof from fs here */
03227	#define NIL_MESS ((message *) 0)
03228	
03229	struct psinfo {         /* information for the ps(1) program */
03230	  u16_t nr_tasks, nr_procs;     /* NR_TASKS and NR_PROCS constants. */
03231	  vir_bytes proc, mproc, fproc; /* addresses of the main process tables. */
03232	};
03233	
03234	#endif /* _MINIX_TYPE_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -