00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <linux/sched.h>
00012 #include <linux/smp.h>
00013 #include <cebdef.h>
00014 #include <cpudef.h>
00015 #include <ipldef.h>
00016 #include <ssdef.h>
00017 #include <system_data_cells.h>
00018 #include <misc_routines.h>
00019 #include <sch_routines.h>
00020 #include <ipl.h>
00021 #include <internals.h>
00022 #include <queue.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 int exe_wait(unsigned int efn, unsigned int mask, int waitallflag, void * dummy) {
00036 #ifdef __x86_64__
00037 __asm__ __volatile__ ("movq %%rsp,%0; ":"=r" (dummy) );
00038 dummy+=0x20;
00039 #endif
00040 struct _pcb * p=ctl_gl_pcb;
00041 int efncluster=(efn&224)>>5;
00042 unsigned long * clusteraddr;
00043 struct _wqh * wq;
00044
00045 setipl(IPL__ASTDEL);
00046
00047 if (efn>127)
00048 return SS__ILLEFC;
00049
00050 clusteraddr=getefc(p,efn);
00051 p->pcb_b_wefc=efncluster;
00052
00053 if (efncluster>1 && !clusteraddr)
00054 return SS__UNASEFC;
00055
00056
00057 vmslock(&SPIN_SCHED,IPL__SCHED);
00058
00059 #if 0
00060 if (efncluster==0 || efncluster==1) goto notcommon;
00061
00062 printk("in a wait non impl routine %x %x %x %x\n",efn,mask,clusteraddr,efncluster);
00063 return;
00064 notcommon:
00065 #endif
00066
00067
00068 if (efncluster<2) {
00069 wq=sch_gq_lefwq;
00070
00071 } else {
00072 unsigned long * l=getefcp(p,efn);
00073 wq=&((struct _ceb *)(*l))->ceb_l_wqfl;
00074 }
00075
00076
00077 if (!waitallflag && (mask & *clusteraddr)) {
00078 out:
00079
00080 vmsunlock(&SPIN_SCHED,-1);
00081 {}
00082 #if 0
00083 void * dummy = &efn;
00084 char ** pc = dummy+0x38;
00085 (*pc)+=7;
00086 #endif
00087 return SS__NORMAL;
00088 }
00089
00090
00091 if (waitallflag && ((mask & *clusteraddr) == mask))
00092 goto out;
00093
00094
00095
00096 if (waitallflag && ((mask & *clusteraddr))) {
00097 mask &= ~(*clusteraddr);
00098 }
00099
00100
00101 if (waitallflag)
00102 p->pcb_l_sts|=PCB$M_WALL;
00103 p->pcb_l_efwm=~mask;
00104
00105
00106 #if 0
00107 insque(p,&wq->wqh_l_wqfl);
00108 #endif
00109
00110 fixup_hib_pc(dummy);
00111
00112 sch_wait(p,wq);
00113
00114 return SS__NORMAL;
00115 }
00116
00117 int exe_waitfr(unsigned int efn) {
00118 return exe_wait(efn,1<<(efn&31),0,&efn);
00119 }
00120
00121 int exe_wflor(unsigned int efn, unsigned int mask) {
00122 return exe_wait(efn,mask,0,&efn);
00123 }
00124
00125 int exe_wfland(unsigned int efn, unsigned int mask) {
00126 return exe_wait(efn,mask,1,&efn);
00127 }
00128