coresrv.h

Go to the documentation of this file.
00001 /*
00002 ** coresrv.h for lseos in lseos-core/kernel/core
00003 ** 
00004 ** Copyright(c)2004 IONIS group, Vianney Rancurel - Paris
00005 ** Login   <vianney@epita.fr>
00006 ** 
00007 ** Started on  Fri Jan 23 12:07:04 2004 Vianney Rancurel
00008 ** Last update Mon Dec  6 11:22:16 2004 Vianney Rancurel
00009 */
00010 #ifndef __LSEOS_CORESRV_H__
00011 #define __LSEOS_CORESRV_H__     1
00012 #include <core.h>
00013 
00014 /*
00015  * per cpu statistics
00016  */
00017 typedef struct  s_corestats     
00018 {
00019   u_int64_t     syscalls;       
00020   u_int64_t     runops;         
00021   u_int64_t     asreleops;      
00022   u_int64_t     tcbreleops;     
00023   u_int64_t     zombieops;      
00024   u_int64_t     propagops;      
00025   u_int64_t     pgtblops;       
00026   u_int64_t     totalrecs;
00027   u_int64_t     nrecblocks;
00028 }               t_corestats;
00029 
00033 typedef struct                  s_block
00034 {
00035 #define BLOCK_MAGIC 0xdead1eaf
00036   u_int32_t                     magic;
00037   struct s_block                *next;
00038 }                               t_block;
00039 
00040 struct s_rec;
00041 LIST_HEAD(s_rec_list, s_rec);
00042 typedef struct s_rec_list   t_rec_list;
00043 
00044 typedef struct                  s_rec   /* memory record                */
00045 {
00046   t_area                        area;   /* MUST BE FIRST!               */
00047 
00048 #define REC_MAGIC 0xdeadbeef            
00049   u_int32_t                     magic;
00050 
00051   LIST_ENTRY(s_rec)             list;   /* for free_list                */
00052 
00053   /*
00054    * specific data
00055    */
00056   asid_t                        holder; /* asid of holder address space*/
00057   u_int32_t                     mode;   /* software mode                */     
00058   u_int32_t                     modeopts;/* mode options                */
00059 
00060   union
00061   {
00062     struct
00063     {
00064       u_int32_t                 flags;  /* pgdir/pgtbl hardware flags   */
00065       u_int32_t                 uflags; /* user provided (wanted) flags */
00066       paddr_t                   pa;     /* physical addr in the case of 
00067                                            a virtual mapping */
00068       vaddr_t                   agg_va; /* the reference address of the
00069                                            aggregate or -1 if none */
00070     } user;
00071 
00072     struct
00073     {
00074       uid_t                     uid;    /* owner of the area            */
00075       gid_t                     gid;    /* group of the area            */
00076       u_int32_t                 agg_pa; /* the physical address of the
00077                                            aggregate or -1 if none */
00078       int                       agg_nb_pgs;
00079       int                       restype;
00080 #define RESTYPE_UNDEF   0
00081 #define RESTYPE_ASID    1
00082 #define RESTYPE_PID     2
00083 #define RESTYPE_BLOCK   3
00084 #define RESTYPE_PT      4
00085       resid_t                   resid;  /* in the case of a system page */
00086       int                       refcnt;
00087     } phys;
00088 
00089     struct
00090     {
00091       int                       restype;
00092       resid_t                   resid;  /* in the case of a system page */
00093       int                       refcnt;
00094       paddr_t                   pa;
00095       int                       nb_pgs;
00096     } kern;
00097     
00098   } u;
00099 
00100 }                               t_rec;
00101 
00102 /* special gdt values */
00103 #define XX_FREE 0
00104 #define XX_RSV  1
00105 #define XX_USED 2
00106 
00107 /* hash funcs */
00108 #define ASID_HSIZE      1021LL
00109 #define PID_HSIZE       1021LL
00110 /*
00111  * for this to work we must cast to u_int64_t
00112  */
00113 #define ASIDHASH(Asid)  ((u_int32_t)(((u_int64_t)(Asid)) % ASID_HSIZE))
00114 #define PIDHASH(Pid)    ((u_int32_t)(((u_int64_t)(Pid)) % PID_HSIZE))
00115 
00116 #ifdef __KERNEL__
00117 typedef void            (*t_sys_fn)(struct s_tcb_full *caller);
00118 
00119 typedef struct          s_runq
00120 {
00121   struct s_tcb_runq     tcbq;           
00122   struct s_tcb_full     *tcbp;          
00123   struct s_as_runq      asq;            
00124   struct s_as_full      *asp;           
00125 }                       t_runq; 
00126 
00127 typedef struct          s_memdef_data
00128 {
00129   int                   nocond;
00130   u_int32_t             opts;
00131   struct s_tcb_full     *caller;
00132   asid_t                holder;
00133   struct s_memdef       *memdefp;
00134   int                   nb_memdefs;
00135   int                   nb_found;
00136   int                   again;
00137   int                   err;
00138   int                   space;
00139 }                       t_memdef_data;
00140 #endif
00141 
00142 typedef struct          s_is_vmapped_data
00143 {
00144   t_area_set            *area_set;
00145   t_area                pseudo1;
00146 }                       t_is_vmapped_data;
00147 
00148 /* PROTO coresrv.c */
00149 #ifdef __KERNEL__
00150 /* coresrv.c */
00151 void coresrv_init(void);
00152 int copy_from(asid_t from_asid, paddr_t from_pgdir, void *from_addr, void *to_addr, size_t len);
00153 int copy_to(asid_t to_asid, paddr_t to_pgdir, void *from_addr, void *to_addr, size_t len);
00154 int copy_from_str(paddr_t from_pgdir, asid_t from_asid, char *from_str, char *to_str, size_t max_len);
00155 int ascopy_i(struct s_as_full *from_as, void *from_addr, struct s_as_full *to_as, void *to_addr, int len, int *err, int *suberr);
00156 void sys_ascopy(struct s_tcb_full *caller);
00157 void sys_copy(struct s_tcb_full *caller);
00158 void sys_reboot(struct s_tcb_full *caller);
00159 void sys_dwrite(struct s_tcb_full *caller);
00160 void sys_dump(struct s_tcb_full *caller);
00161 void sanity_check(char *s);
00162 void sys_check(struct s_tcb_full *caller);
00163 void sys_assert(struct s_tcb_full *caller);
00164 void do_coresrv_syscall(void);
00165 void coresrv_syscall(void);
00166 #endif /* __KERNEL__ */
00167 #endif

Generated on Wed May 24 23:04:16 2006 for LSE/OS by  doxygen 1.4.6