00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <linux/config.h>
00012 #include <linux/linkage.h>
00013 #include <far_pointers.h>
00014 #include <linux/sched.h>
00015 #include <ssdef.h>
00016 #include <cpbdef.h>
00017 #include <ipldef.h>
00018 #include <statedef.h>
00019 #include <internals.h>
00020 #include <prvdef.h>
00021 #include <sch_routines.h>
00022 #include <exe_routines.h>
00023 #include <capdef.h>
00024 #include <starlet.h>
00025
00026
00027
00028
00029
00030
00031
00032 asmlinkage int exe_process_affinity (unsigned int *pidadr, void *prcnam, struct _generic_64 *select_mask, struct _generic_64 *modify_mask, struct _generic_64 *prev_mask, struct _generic_64 *flags,...) {
00033 struct _pcb * retpcb;
00034 unsigned long ipid, epid;
00035 int sts;
00036 sts=exe_nampid(current,pidadr,prcnam,&retpcb,&ipid,&epid);
00037 if ((sts & 1) == 0)
00038 return sts;
00039 struct _pcb * pcb;
00040 pcb = retpcb;
00041 int aff;
00042 int priv = ctl_gl_pcb->pcb$l_priv;
00043
00044 if (pcb != ctl_gl_pcb && (select_mask || modify_mask) && (priv & PRV$M_ALTPRI) == 0)
00045 return SS__NOPRIV;
00046 if ((select_mask || modify_mask)) {
00047 int prev = pcb->pcb_l_affinity;
00048 int mask;
00049 mask = *(int*)select_mask & ~(*(int*)modify_mask);
00050 sch_clear_affinity(pcb, mask, flags, 0 );
00051 mask = *(int*)select_mask & (*(int*)modify_mask);
00052
00053 sch_set_affinity(pcb, mask, flags, 0 );
00054 if (prev_mask)
00055 *(int*)prev_mask = prev;
00056 } else {
00057 if (prev_mask)
00058 *(int*)prev_mask = pcb->pcb_l_affinity;
00059 }
00060 vmsunlock(&SPIN_SCHED,IPL__ASTDEL);
00061 return SS__NORMAL;
00062 }
00063
00064
00065
00066
00067
00068
00069 asmlinkage int exe_set_implicit_affinity (unsigned int *pidadr, void *prcnam, struct _generic_64 *state, int cpu_id, struct _generic_64 *prev_mask) {
00070 int flag = 0;
00071 if (state)
00072 flag = *(int*)state;
00073 struct _pcb * retpcb;
00074 unsigned long ipid, epid;
00075 int sts;
00076 sts=exe_nampid(current,pidadr,prcnam,&retpcb,&ipid,&epid);
00077 if ((sts & 1) == 0)
00078 return sts;
00079 struct _pcb * pcb;
00080 pcb = retpcb;
00081 int priv = ctl_gl_pcb->pcb$l_priv;
00082 if (flag && (priv & PRV_M_ALTPRI) == 0)
00083 return SS__NOPRIV;
00084 if ((priv & PRV_M_ALTPRI) == 0)
00085 return SS__NOPRIV;
00086 if (flag & CAP_M_IMPLICIT_DEFAULT_ONLY) {
00087 if (prev_mask)
00088 *(int*)prev_mask = sch_gl_default_process_cap;
00089 sch_gl_default_process_cap = state;
00090 }
00091
00092 if (flag & CAP_M_IMPLICIT_AFFINITY_SET) {
00093 if (prev_mask)
00094 *(int*)prev_mask = pcb->pcb_l_capability;
00095 sch_acquire_affinity(pcb, 0, cpu_id);
00096 }
00097
00098 if (flag & CAP_M_IMPLICIT_AFFINITY_CLEAR) {
00099 if (prev_mask)
00100 *(int*)prev_mask = pcb->pcb_l_capability;
00101 sch_release_affinity(pcb);
00102 }
00103 vmsunlock(&SPIN_SCHED,IPL__ASTDEL);
00104 return SS__NORMAL;
00105 }
00106
00107 asmlinkage int exe_process_affinity_wrap (struct struct_args * s) {
00108 return exe_process_affinity (s->s1, s->s2, s->s3, s->s4, s->s5, s->s6);
00109 }
00110
00111