00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include<linux/linkage.h>
00012 #include<linux/sched.h>
00013 #include <linux/vmalloc.h>
00014 #include <linux/file.h>
00015 #include <system_data_cells.h>
00016 #include<descrip.h>
00017 #include<gsddef.h>
00018 #include<ipldef.h>
00019 #include<ipl.h>
00020 #include<phddef.h>
00021 #include<rdedef.h>
00022 #include<secdef.h>
00023 #include<seciddef.h>
00024 #include<starlet.h>
00025 #include<va_rangedef.h>
00026 #include<vmspte.h>
00027 #include<wsldef.h>
00028 #include <exe_routines.h>
00029 #include <misc_routines.h>
00030 #include <mmg_routines.h>
00031 #include <queue.h>
00032 #include <linux/slab.h>
00033
00034 asmlinkage int exe_crmpsc_wrap(struct struct_crmpsc * s) {
00035 #ifdef CONFIG_VMS
00036 int ret;
00037 #if 0
00038 int chan=s->chan;
00039 struct file * file=0;
00040 struct _fcb * fcb = 0;
00041 if (chan) {
00042 file=fget(chan);
00043 fcb=e2_search_fcb(file->f_dentry->d_inode);
00044 }
00045 #endif
00046 ret=exe_crmpsc(s->inadr,s->retadr,s->acmode,s->flags,s->gsdnam,s->ident,s->relpag,s->chan,s->pagcnt,s->vbn,s->prot,s->pfc);
00047 #if 0
00048 if (file) fput(file);
00049 #endif
00050 return ret;
00051 #endif
00052 }
00053
00054 asmlinkage int exe_mgblsc_wrap(struct struct_mgblsc * s) {
00055 return exe_mgblsc(s->inadr,s->retadr,s->acmode,s->flags,s->gsdnam,s->ident,s->relpag);}
00056
00057 asmlinkage int exe_mgblsc(struct _va_range *inadr, struct _va_range *retadr, unsigned int acmode, unsigned int flags, void *gsdnam, struct _secid *ident, unsigned int relpag) {
00058 struct dsc_descriptor * dsc = gsdnam;
00059 char * name;
00060 struct _secdef * sec, * pstl;
00061 unsigned long long return_ident;
00062 char * return_gsnam = 0;
00063 struct _gsd * gsd;
00064 unsigned long prot_pte=0x400;
00065 void * first=inadr->va_range_ps_start_va;
00066 void * last=inadr->va_range_ps_end_va;
00067
00068 mmg_vfysecflg();
00069
00070
00071 mmg_gsdscn(gsdnam,ident,flags,return_gsnam,&return_ident,&gsd);
00072
00073 pstl=((struct _phd *)mmg_gl_sysphd)->phd$l_pst_base_offset;
00074 sec=&pstl[gsd->gsd_l_gstx];
00075
00076 (*(struct _mypte *)&prot_pte).pte_v_gptx=sec->sec$l_vpx;
00077
00078 mmg_fast_create_gptx(current, 0, first, last, (last-first)>>PAGE_SHIFT, prot_pte);
00079 }
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 asmlinkage int exe_crmpsc(struct _va_range *inadr, struct _va_range *retadr, unsigned int acmode, unsigned int flags, void *gsdnam, unsigned long long * ident, unsigned int relpag, unsigned long chan, unsigned int pagcnt, unsigned int vbn, unsigned int prot,unsigned int pfc) {
00091
00092
00093
00094
00095 struct _secdef *sec, *pstl;
00096 void * first=inadr->va_range_ps_start_va;
00097 void * last=inadr->va_range_ps_end_va;
00098 struct _pcb * p=ctl_gl_pcb;
00099 unsigned long prot_pte;
00100 struct _rde * rde;
00101 int savipl=getipl();
00102
00103
00104 mmg_vfysecflg();
00105
00106
00107
00108
00109
00110
00111 setipl(IPL__ASTDEL);
00112
00113 mmg_dalcstxscn();
00114
00115
00116
00117
00118 if ((flags & SEC_M_GBL)==0) {
00119
00120
00121 prot_pte=p->pcb_l_phd->phd$l_pst_free<<PAGE_SHIFT;
00122 prot_pte |= 0xc00;
00123 pstl=p->pcb_l_phd->phd$l_pst_base_offset;
00124 sec=&pstl[p->pcb_l_phd->phd$l_pst_free++];
00125
00126 sec->sec_l_flags=flags;
00127
00128 sec->sec_l_vbn=vbn;
00129
00130
00131 sec->sec_l_unit_cnt=pagcnt;
00132 sec->sec_l_vpx=first;
00133
00134 sec->sec_l_ccb=chan;
00135 struct _ccb * ccb = &ctl_ga_ccb_table[chan];
00136
00137 sec->sec_l_window = ccb->ccb$l_wind;
00138
00139
00140
00141
00142 mmg_fast_create(p, 0, first, last, (last-first)>>PAGE_SHIFT, prot_pte);
00143
00144 setipl(savipl);
00145
00146 } else {
00147 int i;
00148 struct dsc_descriptor * dsc = gsdnam;
00149 char * name;
00150 unsigned long long return_ident;
00151 char * return_gsnam = 0;
00152 struct _gsd * gsd;
00153 struct _mypte gpte;
00154
00155
00156 prot_pte=((struct _phd *)mmg_gl_sysphd)->phd$l_pst_free<<PAGE_SHIFT;
00157 prot_pte |= 0x400;
00158 pstl=((struct _phd *)mmg_gl_sysphd)->phd$l_pst_base_offset;
00159 sec=&pstl[((struct _phd *)mmg_gl_sysphd)->phd$l_pst_free++];
00160
00161 sec->sec_l_flags=flags;
00162
00163 sec->sec_l_vbn=vbn;
00164
00165
00166 sec->sec_l_unit_cnt=pagcnt;
00167 sec->sec_l_vpx=mmg$gq_free_gpt;
00168
00169 sec->sec_l_window=chan;
00170
00171
00172
00173
00174
00175 mmg_gsdscn(gsdnam,ident,flags,return_gsnam,&return_ident,&gsd);
00176 if (gsd) {
00177 return exe_mgblsc(inadr,retadr,acmode,flags,gsdnam,ident,relpag);
00178 }
00179 gsd=kmalloc(sizeof(struct _gsd),GFP_KERNEL);
00180 memset(gsd,0,sizeof(struct _gsd));
00181 name=kmalloc(dsc->dsc_w_length,GFP_KERNEL);
00182 memcpy(name,dsc->dsc_a_pointer,dsc->dsc$w_length);
00183 gsd->gsd_l_basepfn=name;
00184 gsd->gsd_l_ident=ident;
00185 gsd->gsd_l_flags=flags;
00186 gsd->gsd_l_pcbuic=current->pcb$l_uic;
00187 gsd->gsd_l_gstx=(((struct _phd *)mmg$gl_sysphd)->phd$l_pst_free)-1;
00188 if (flags&SEC_M_SYSGBL) {
00189 insque(gsd,&exe_gl_gsdsysfl);
00190 } else {
00191 insque(gsd,&exe_gl_gsdgrpfl);
00192 }
00193 sec->sec_l_gsd=gsd;
00194 if (chan) {
00195 gpte.pte_l_all=0;
00196 gpte.pte_v_typ1=1;
00197 gpte.pte_v_typ0=1;
00198 gpte.pte_v_stx=gsd->gsd$l_gstx;
00199 gpte.pte_v_global=1;
00200
00201 } else {
00202 gpte.pte_l_all=0;
00203 gpte.pte_v_typ1=0;
00204 gpte.pte_v_typ0=0;
00205 gpte.pte_v_pfn=0;
00206 gpte.pte_v_global=1;
00207 gpte.pte_v_gblwrt=1;
00208 }
00209 for (i=mmg_gq_free_gpt;i<mmg$gq_free_gpt+((last-first)>>PAGE_SHIFT); i++) {
00210 ((unsigned long *)mmg_gq_gpt_base)[i]=*(unsigned long *)&gpte;
00211 }
00212 ((unsigned long *)mmg_gq_gpt_base)[i]=0;
00213 mmg_gq_free_gpt+=1+((last-first)>>PAGE_SHIFT);
00214 return exe_mgblsc(inadr,retadr,acmode,flags,gsdnam,ident,relpag);
00215 }
00216
00217 }
00218