00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <linux/linkage.h>
00014 #include <system_data_cells.h>
00015 #include <ssdef.h>
00016 #include <pridef.h>
00017 #include <cpudef.h>
00018 #include <acbdef.h>
00019 #include <evtdef.h>
00020 #include <statedef.h>
00021 #include <queue.h>
00022 #include <ipldef.h>
00023 #include <ipl.h>
00024 #include <exe_routines.h>
00025 #include <sch_routines.h>
00026 #include <misc_routines.h>
00027 #include <smp_routines.h>
00028 #include <starlet.h>
00029 #include <linux/sched.h>
00030 #include <linux/smp.h>
00031 #include <linux/slab.h>
00032 #include <internals.h>
00033
00034 #undef ASTDEBUG
00035 #define ASTDEBUG
00036
00037 #undef MYDEB_AST
00038 #define MYDEB_AST
00039
00040 extern int mydebug5;
00041
00042 void sch_newlvl(struct _pcb *p);
00043
00044
00045
00046
00047
00048 static int checkq(struct _acb * head) {
00049 struct _acb * tmp = head->acb_l_astqfl;
00050 signed char tmpmode1, tmpmode2;
00051
00052 while (tmp!=head && tmp->acb_l_astqfl!=head) {
00053 struct _acb * next = tmp->acb_l_astqfl;
00054 tmpmode1 = tmp->acb_b_rmod & 0x93;
00055 tmpmode2 = next->acb_b_rmod & 0x93;
00056 if (tmpmode1>tmpmode2)
00057 panic("acb %x %x %x %x\n", tmp, next, tmpmode1, tmpmode2);
00058 tmp = next;
00059 }
00060
00061 }
00062
00063 #ifdef MYDEB_AST
00064 long qast[32*1024];
00065 long qastc[32] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
00066 #endif
00067
00068
00069
00070
00071
00072
00073
00074
00075 int sch_qast(unsigned long pid, int priclass, struct _acb * a) {
00076 int savipl;
00077 #ifdef MYDEB_AST
00078 {
00079 int pid2=pid&31;
00080 qast[1024*pid2+qastc[pid2]]=a;
00081 qastc[pid2]++;
00082 qast[1024*pid2+qastc[pid2]]=a->acb_l_ast;
00083 qastc[pid2]++;
00084 long addr = &pid;
00085 addr-=4;
00086 qast[1024*pid2+qastc[pid2]]=*(long*)addr;
00087 qastc[pid2]++;
00088 qast[1024*pid2+qastc[pid2]]=a->acb_l_kast;
00089 qastc[pid2]++;
00090 if (qastc[pid2]>1000)
00091 qastc[pid2]=0;
00092 }
00093 #endif
00094 int status=SS__NORMAL;
00095 int kernelmode;
00096
00097 savipl=getipl();
00098 setipl(IPL__SYNCH);
00099 vmslock(&SPIN_SCHED,-1);
00100
00101 struct _pcb * p=exe_ipid_to_pcb(pid);
00102 if (!p) {
00103
00104 vmsunlock(&SPIN_SCHED,-1);
00105 setipl(savipl);
00106 return SS__NONEXPR;
00107 }
00108 #ifdef ASTDEBUG
00109 checkq(&p->pcb_l_astqfl);
00110 #endif
00111 struct _acb * tmp = p->pcb_l_astqbl;
00112
00113
00114 if (!aqempty(&p->pcb_l_astqfl)) {
00115 signed char mode = a->acb_b_rmod & 0x93;
00116 struct _acb * head = &p->pcb_l_astqfl;
00117 tmp = head->acb_l_astqfl;
00118 signed char tmpmode = tmp->acb_b_rmod & 0x93;;
00119
00120 while (tmp!=head && mode>=tmpmode) {
00121 tmp=tmp->acb_l_astqfl;
00122 tmpmode = tmp->acb_b_rmod & 0x93;
00123 }
00124 tmp = tmp->acb_l_astqbl;
00125 }
00126
00127 insque(a,tmp);
00128 #ifdef ASTDEBUG
00129 checkq(&p->pcb_l_astqfl);
00130 #endif
00131
00132
00133
00134
00135 if ((a->acb_b_rmod & ACB$M_KAST)==0)
00136 kernelmode=a->acb_b_rmod & 3;
00137 else
00138 kernelmode=0;
00139 p->phd_b_astlvl=kernelmode;
00140
00141
00142
00143 if (p->pcb_w_state!=SCH$C_CUR)
00144 sch_rse(p, priclass, EVT$_AST);
00145 else {
00146
00147
00148 struct _cpu * cpu=smp_gl_cpu_data[smp_processor_id()];
00149 struct _pcb * curp=ctl_gl_pcb;
00150 if (p==cpu->cpu_l_curpcb)
00151 p->pr_astlvl=p->phd_b_astlvl;
00152 else
00153 #if 0
00154 smp_send_work(CPU_M_UPDASTSR, p->pcb$l_cpu_id);
00155 #else
00156 p->pr_astlvl = p->phd_b_astlvl = 0;
00157
00158
00159 #endif
00160 }
00161
00162
00163 vmsunlock(&SPIN_SCHED,-1);
00164 setipl(savipl);
00165 return status;
00166 }
00167
00168 printast(struct _acb * acb) {
00169 printk("acb %x %x %x %x %x\n",acb,acb->acb_l_pid,acb->acb$l_ast,acb->acb$l_astprm,acb->acb$l_kast);
00170 }
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 #ifdef __i386__
00200 int exe_astdel_old() {
00201 struct _acb * acb;
00202 __asm__ ( "movl 0x0(%%esp),%%eax\n\t" :"=a" (acb) );
00203 if(acb->acb_l_ast) acb->acb$l_ast(acb->acb$l_astprm);
00204 sys_clrast();
00205 __asm__ __volatile__(
00206 "addl _0x4,%esp\n\t"
00207 "iret\n\t"
00208 );
00209 }
00210
00211 int exe_astdel_wrap(struct _pcb * p, struct _acb * acb) {
00212 __asm__ __volatile__(
00213 "movl 0x8(%esp),%ebx\n\t"
00214 "movl %esp,%esi\n\t"
00215 "addl _0xac,%esi\n\t"
00216 "movl 0xc(%esi),%edx\n\t"
00217 "addl _-0x18,%edx\n\t"
00218 "movl %esp,%edi\n\t"
00219 "addl _-0x14,%edi\n\t"
00220 "\n\t"
00221 #if 0
00222 "movl 0x10(%ebx),%ecx\n\t"
00223 "movl %ecx,0x0(%edi)\n\t"
00224 #else
00225 "movl _exe$astdel,0x0(%edi)\n\t"
00226 #endif
00227 "movl 0x4(%esi),%ecx\n\t"
00228 "movl %ecx,0x4(%edi)\n\t"
00229 "movl 0x8(%esi),%ecx\n\t"
00230 "movl %ecx,0x8(%edi)\n\t"
00231 "movl %edx,0xc(%edi)\n\t"
00232 "movl 0x10(%esi),%ecx\n\t"
00233 "movl %ecx,0x10(%edi)\n\t"
00234 "\n\t"
00235 #if 0
00236 "movl 0x14(%ebx),%ecx\n\t"
00237 "movl %ecx,0x0(%edx)\n\t"
00238 #else
00239 "movl %ebx,0x0(%edx)\n\t"
00240 #endif
00241 "movl 0x0(%esp),%ecx\n\t"
00242 "movl %ecx,0x4(%edx)\n\t"
00243 "movl _0x0,0x8(%edx)\n\t"
00244 "mov %cs,0x8(%edx)\n\t"
00245 "movl 0x8(%esi),%ecx\n\t"
00246 "movl %ecx,0xc(%edx)\n\t"
00247 "movl %edi,0x10(%edx)\n\t"
00248 "movl _0x0,0x14(%edx)\n\t"
00249 "mov %ss,0x14(%edx)\n\t"
00250 "\n\t"
00251 "addl _-0x14,%esp\n\t"
00252 "iret\n\t"
00253 #if 0
00254 "movl 0x20(%esp),%ebx\n\t"
00255 "movl 0x10(%ebx),%edx\n\t"
00256 "movl 0x14(%ebx),%ebx\n\t"
00257 "pushl %ebx\n\t"
00258 "call *%edx\n\t"
00259 "popl %ebx\n\t"
00260 #endif
00261 );
00262 }
00263
00264 int exe_astdel_wrap2(struct _pcb * p, struct _acb * acb) {
00265 __asm__ __volatile__(
00266 "pushl %ebp\n\t"
00267 "pushl %ebx\n\t"
00268 "pushl %ecx\n\t"
00269 "pushl %edx\n\t"
00270 "pushl %edi\n\t"
00271 "pushl %esi\n\t"
00272 "pushl 0x20(%esp)\n\t"
00273 "pushl 0x20(%esp)\n\t"
00274 "call exe_astdel_wrap2\n\t"
00275 "popl %esi\n\t"
00276 "popl %esi\n\t"
00277 "popl %esi\n\t"
00278 "popl %edi\n\t"
00279 "popl %edx\n\t"
00280 "popl %ecx\n\t"
00281 "popl %ebx\n\t"
00282 "popl %ebp\n\t"
00283 );
00284 }
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311 int exe_astdel() {
00312 #if 0
00313 long (*ast)();
00314 long astprm;
00315 __asm__ ( "movl 0x0(%%esp),%%eax\n\t" :"=a" (acb) );
00316 if(ast) ast(astprm);
00317 sys_clrast();
00318 #endif
00319 __asm__ __volatile__(
00320 "pushfl\n\t"
00321 "pushl %eax\n\t"
00322 "pushl %ebp\n\t"
00323 "pushl %ebx\n\t"
00324 "pushl %ecx\n\t"
00325 "pushl %edx\n\t"
00326 "pushl %edi\n\t"
00327 "pushl %esi\n\t"
00328 "pushl 0x24(%esp)\n\t"
00329 "call *0x24(%esp)\n\t"
00330 "addl _0x4,%esp\n\t"
00331 "call sys_clrast\n\t"
00332 "movl 0x1c(%esp),%esi\n\t"
00333 "movl %esi,0x20(%esp)\n\t"
00334 "movl %esi,0x24(%esp)\n\t"
00335 "popl %esi\n\t"
00336 "popl %edi\n\t"
00337 "popl %edx\n\t"
00338 "popl %ecx\n\t"
00339 "popl %ebx\n\t"
00340 "popl %ebp\n\t"
00341 "popl %eax\n\t"
00342 "popfl\n\t"
00343 "popfl\n\t"
00344 "popfl\n\t"
00345 );
00346 }
00347
00348 int exe_astdel_prep2(long stack, long ast, long astprm) {
00349 __asm__ __volatile__(
00350 #if 0
00351 "movl %esp,%esi\n\t"
00352 "addl _0xb8,%esi\n\t"
00353 #else
00354 "movl 0x4(%esp),%esi\n\t"
00355 "addl _0x6c,%esi\n\t"
00356 #endif
00357 "back_here2:\n\t"
00358 "cmpl _0x10,0x4(%esi)\n\t"
00359 "je from_kernel_mode\n\t"
00360 "cmpl _0x23,0x4(%esi)\n\t"
00361 "je back_here\n\t"
00362 "jmp panic\n\t"
00363 "back_here:\n\t"
00364 "movl 0xc(%esi),%edx\n\t"
00365 "addl _-0xc,%edx\n\t"
00366 "movl %esi,%edi\n\t"
00367 "\n\t"
00368 "movl 0x8(%esp),%ecx\n\t"
00369 "movl %ecx,0x0(%edx)\n\t"
00370 "movl 0xc(%esp),%ecx\n\t"
00371 "movl %ecx,0x4(%edx)\n\t"
00372 "movl 0x0(%esi),%ecx\n\t"
00373 "movl %ecx,0x8(%edx)\n\t"
00374 "\n\t"
00375 "movl _exe$astdel,0x0(%edi)\n\t"
00376 "movl %edx,0xc(%edi)\n\t"
00377 "ret\n\t"
00378 "\n\t"
00379 "from_kernel_mode:\n\t"
00380 "addl _0x48,%esi\n\t"
00381 "cmpl _0x23,0x4(%esi)\n\t"
00382 "je back_here2\n\t"
00383 "cmpl _0x10,0x4(%esi)\n\t"
00384 "je back_here2\n\t"
00385 "subl _0x48,%esi\n\t"
00386 "addl _0x54,%esi\n\t"
00387 "cmpl _0x23,0x4(%esi)\n\t"
00388 "je back_here2\n\t"
00389 "cmpl _0x10,0x4(%esi)\n\t"
00390 "je back_here2\n\t"
00391 "subl _0x54,%esi\n\t"
00392 "addl _0x6c,%esi\n\t"
00393 "jmp back_here2\n\t"
00394 "ret\n\t"
00395 );
00396 }
00397
00398 long cstab[4] = { __KERNEL_CS, __EXECUTIVE_CS, __SUPERVISOR_CS, __USER_CS };
00399 long sstab[4] = { __KERNEL_CS | 8, __EXECUTIVE_CS | 8, __SUPERVISOR_CS | 8, __USER_CS | 8 };
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409 int exe_astdel_prep2_new(long stack, long ast, long astprm, long cs, long ss) {
00410 __asm__ __volatile__(
00411 "pushfl\n\t"
00412 "popl %edi\n\t"
00413 "andl _0x200, %edi \n\t"
00414 "je 1f\n\t"
00415 "call panic\n\t"
00416 "1:\n\t"
00417 "movl %esp,%edi\n\t"
00418 "addl _-0x14,%edi\n\t"
00419 "movl 0x4(%esp),%edx\n\t"
00420 "addl _-0x8,%edx\n\t"
00421 "\n\t"
00422 "movl _exe$astdel,0x0(%edi)\n\t"
00423 "movl 0x10(%esp),%ecx\n\t"
00424 "movl %ecx,0x4(%edi)\n\t"
00425 "pushfl\n\t"
00426 "popl %ecx\n\t"
00427 "orl _0x200,%ecx\n\t"
00428 "movl %ecx,0x8(%edi)\n\t"
00429 "movl %edx,0xc(%edi)\n\t"
00430 "movl 0x14(%esp),%ecx\n\t"
00431 "movl %ecx,0x10(%edi)\n\t"
00432 "\n\t"
00433 "movl 0x8(%esp),%ecx\n\t"
00434 "movl %ecx,0x0(%edx)\n\t"
00435 "movl 0xc(%esp),%ecx\n\t"
00436 "movl %ecx,0x4(%edx)\n\t"
00437 #if 0
00438 "movl %esp,0x8(%edx)\n\t"
00439 "movl 0x0(%esi),%ecx\n\t"
00440 "movl %ecx,0x8(%edx)\n\t"
00441 #endif
00442 "\n\t"
00443 "addl _-0x14, %esp\n\t"
00444
00445 "call myrei\n\t"
00446 "pushfl\n\t"
00447 "popl %edi\n\t"
00448 "andl _0x200, %edi \n\t"
00449 "je 1f\n\t"
00450 "call panic\n\t"
00451 "1:\n\t"
00452 #if 1
00453 "movl ctl_gl_pcb, %edi ;\n\t" \
00454 "movl 0x7a0(%edi), %edx ;\n\t" \
00455 "shl _0x8, %edx;\n\t" \
00456 "addl _init_tss, %edx\n\t"
00457 "addl _0x4, %edx\n\t"
00458 "movl %esp, (%edx)\n\t"
00459 "addl _0x14, (%edx)\n\t"
00460 #endif
00461 "movl 0x28(%esp),%ecx\n\t"
00462 "movl %ecx, %ds\n\t"
00463 "movl %ecx, %es\n\t"
00464 "iret\n\t"
00465 );
00466 }
00467
00468 int exe_astdel_prep(long a, long b, long c) {
00469 __asm__ __volatile__(
00470 "pushl %ebp\n\t"
00471 "pushl %ebx\n\t"
00472 "pushl %ecx\n\t"
00473 "pushl %edx\n\t"
00474 "pushl %edi\n\t"
00475 "pushl %esi\n\t"
00476 "pushl 0x24(%esp)\n\t"
00477 "pushl 0x24(%esp)\n\t"
00478 "pushl 0x24(%esp)\n\t"
00479 #if 1
00480 "call exe_astdel_prep2\n\t"
00481 #else
00482 "call exe_astdel_prep2_new\n\t"
00483 #endif
00484 "popl %esi\n\t"
00485 "popl %esi\n\t"
00486 "popl %esi\n\t"
00487 "popl %esi\n\t"
00488 "popl %edi\n\t"
00489 "popl %edx\n\t"
00490 "popl %ecx\n\t"
00491 "popl %ebx\n\t"
00492 "popl %ebp\n\t"
00493 );
00494 }
00495 #endif
00496
00497
00498
00499
00500
00501
00502
00503 #ifdef __x86_64__
00504 int __attribute__ ((section (".vsyscall_4"))) exe_astdel() {
00505 __asm__ __volatile__(
00506 "pushfq\n\t"
00507 "pushq %rax\n\t"
00508 "pushq %rbx\n\t"
00509 "pushq %rcx\n\t"
00510 "pushq %rdx\n\t"
00511 "pushq %rbp\n\t"
00512 "pushq %rdi\n\t"
00513 "pushq %rsi\n\t"
00514 "pushq %r8\n\t"
00515 "pushq %r9\n\t"
00516 "pushq %r10\n\t"
00517 "pushq %r11\n\t"
00518 "pushq %r12\n\t"
00519 "pushq %r13\n\t"
00520 "pushq %r14\n\t"
00521 "pushq %r15\n\t"
00522 "callq * %rax\n\t"
00523 #if 0
00524 "callq sys_clrast\n\t"
00525 #else
00526 "movq _0x28, %rax\n\t"
00527 "int _0x81\n\t"
00528 #endif
00529 #if 0
00530 "movl 0x1c(%esp),%esi\n\t"
00531 "movl %esi,0x20(%esp)\n\t"
00532 "movl %esi,0x24(%esp)\n\t"
00533 #endif
00534 "popq %r15\n\t"
00535 "popq %r14\n\t"
00536 "popq %r13\n\t"
00537 "popq %r12\n\t"
00538 "popq %r11\n\t"
00539 "popq %r10\n\t"
00540 "popq %r9\n\t"
00541 "popq %r8\n\t"
00542 "popq %rsi\n\t"
00543 "popq %rdi\n\t"
00544 "popq %rbp\n\t"
00545 "popq %rdx\n\t"
00546 "popq %rcx\n\t"
00547 "popq %rbx\n\t"
00548 "popq %rax\n\t"
00549 "popfq\n\t"
00550 "popfq\n\t"
00551 "popfq\n\t"
00552 );
00553 }
00554
00555 long cstab[4] = { __KERNEL_CS, __EXECUTIVE_CS, __SUPERVISOR_CS, __USER_CS };
00556 long sstab[4] = { __KERNEL_DS, __EXECUTIVE_DS , __SUPERVISOR_DS , __USER_DS };
00557
00558 int exe_astdel_prep2_new(long stack, long ast, long astprm, long dummy, long cs, long ss) {
00559
00560 __asm__ __volatile__(
00561 "movq %rsi,%rbp\n\t"
00562 "movq %rdx,%rbx\n\t"
00563 "movq %rdi,%rdx\n\t"
00564 "movq %rsp,%rdi\n\t"
00565 "addq _-0x28,%rdi\n\t"
00566 #if 0
00567 "addq _-0x10,%rdx\n\t"
00568 #endif
00569 "\n\t"
00570 "movq _exe$astdel,0x0(%rdi)\n\t"
00571 "movq %r8,0x8(%rdi)\n\t"
00572 "pushfq\n\t"
00573 "popq %rcx\n\t"
00574 "orq _0x200,%rcx\n\t"
00575 "movq %rcx,0x10(%rdi)\n\t"
00576 "movq %rdx,0x18(%rdi)\n\t"
00577 "movq %r9,0x20(%rdi)\n\t"
00578 "\n\t"
00579 #if 0
00580 "movq 0x10(%rsp),%rcx\n\t"
00581 "movq %rcx,0x0(%rdx)\n\t"
00582 "movq 0x18(%rsp),%rcx\n\t"
00583 "movq %rcx,0x8(%rdx)\n\t"
00584 #endif
00585 #if 0
00586 "movq %rsp,0x10(%rdx)\n\t"
00587 "movq 0x0(%rsi),%rcx\n\t"
00588 "movq %rcx,0x10(%rdx)\n\t"
00589 #endif
00590 "\n\t"
00591 "addq _-0x28, %rsp\n\t"
00592
00593 "callq myrei\n\t"
00594 #if 1
00595 "movq 0x7ffff000, %rdi\n\t"
00596 "movq 2744(%rdi), %rdx\n\t"
00597 "shl _0x8, %rdx\n\t"
00598 "addq _init_tss, %rdx\n\t"
00599 "addq _0x4, %rdx\n\t"
00600 "movq %rsp, (%rdx)\n\t"
00601 "addq _0x28, (%rdx)\n\t"
00602 #if 1
00603 "movq %rsp, %gs:0\n\t"
00604 "addq _0x28, %gs:0\n\t"
00605 #endif
00606 #endif
00607 "movq %rbp, %rax\n\t"
00608 "movq %rbx, %rdi\n\t"
00609 "cli\n\t"
00610 "swapgs\n\t"
00611 "iretq\n\t"
00612 );
00613 }
00614 #endif
00615
00616 int astdeb=0;
00617 #ifdef ASTDEBUG
00618 int lastast=0;
00619 int lastastprm=0;
00620 int lastacb=0;
00621 int myacbi=0;
00622 long myacbs[1024];
00623 #endif
00624
00625
00626
00627
00628
00629 asmlinkage void sch_astdel(int dummy) {
00630 struct _cpu * cpu=smp_gl_cpu_data[smp_processor_id()];
00631 struct _pcb * p=ctl_gl_pcb;
00632 struct _acb * acb;
00633
00634
00635 #ifdef __x86_64__
00636 if (intr_blocked(IPL__ASTDEL))
00637 return;
00638 regtrap(REG_INTR, IPL__ASTDEL);
00639 #endif
00640
00641 #ifdef ASTDEBUG
00642 myacbs[myacbi++]=ctl_gl_pcb;
00643 myacbs[myacbi++]=0x77777777;
00644 myacbs[myacbi++]=ctl_gl_pcb->pcb$l_astqbl;
00645 #if 0
00646 myacbs[myacbi++]=((struct _irp *)ctl_gl_pcb->pcb$l_astqfl)->irp$w_empty;
00647 #endif
00648 myacbs[myacbi++]=ctl_gl_pcb->pcb$b_astact;
00649 #endif
00650 more:
00651
00652 setipl(IPL__SYNCH);
00653 vmslock(&SPIN_SCHED,-1);
00654 #ifdef ASTDEBUG
00655 checkq(&p->pcb_l_astqfl);
00656 #endif
00657
00658
00659
00660
00661
00662
00663
00664 if (aqempty(&p->pcb_l_astqfl)) {
00665 vmsunlock(&SPIN_SCHED,-1);
00666 sch_newlvl(p);
00667 return;
00668 }
00669
00670
00671
00672
00673
00674 acb=remque(p->pcb_l_astqfl,0);
00675 #ifdef ASTDEBUG
00676 myacbs[myacbi++]=acb;
00677 myacbs[myacbi++]=acb->acb_l_ast;
00678 myacbs[myacbi++]=acb->acb_l_astprm;
00679 myacbs[myacbi++]=acb->acb_b_rmod | (ctl$gl_pcb->pcb$b_astact << 16);
00680 #if 0
00681 if (acb->acb_b_rmod&3)
00682 printk("A %x %x\n",acb,acb->acb_b_rmod);
00683 #endif
00684 if (myacbi>1000)
00685 myacbi=0;
00686 lastacb=acb;
00687 lastast=acb->acb_l_ast;
00688 lastastprm=acb->acb_l_astprm;
00689 #endif
00690
00691 #ifdef __i386__
00692 if (0 && astdeb ) printast(acb);
00693
00694 #endif
00695
00696
00697
00698
00699 if (acb->acb_b_rmod & ACB$M_KAST) {
00700 acb->acb_b_rmod&=~ACB$M_KAST;
00701
00702 vmsunlock(&SPIN_SCHED,-1);
00703
00704 setipl(IPL__ASTDEL);
00705
00706 #ifdef __i386__
00707 if (((unsigned long)acb->acb_l_kast<0x80000000)||((unsigned long)acb->acb$l_kast>0xb0000000)) {
00708 int i;
00709 printk("kast %x\n",acb->acb_l_kast);
00710 for(i=0;i<2000000000;i++) ;
00711 }
00712 #endif
00713 #ifdef __i386__
00714 if (0 && astdeb)
00715 printk(" a %x ",acb->acb_l_kast);
00716 if (0 && astdeb)
00717 printk(" a %x",*(unsigned long*)acb->acb_l_kast);
00718 #endif
00719 #ifdef __i386__
00720
00721 #endif
00722
00723 acb->acb_l_kast(acb);
00724 #ifdef __i386__
00725
00726 #endif
00727
00728
00729
00730 goto more;
00731 }
00732
00733
00734
00735
00736 if ((current->pslstk[current->pslindex-1]&3)<(acb->acb_b_rmod&3)) goto out;
00737
00738
00739 if (!test_bit(acb->acb_b_rmod&3,&p->pcb$b_asten)) goto out;
00740
00741
00742
00743 if (test_and_set_bit(acb->acb_b_rmod&3,&p->pcb$b_astact)) {
00744
00745 out:
00746 #ifdef ASTDEBUG
00747 myacbs[myacbi++]=0xff000000 | ((current->pslstk[current->pslindex-1]&3)<<16) | (ctl_gl_pcb->pcb$b_asten << 8) | (ctl$gl_pcb->pcb$b_astact );
00748 myacbs[myacbi++]=acb;
00749 myacbs[myacbi++]=acb->acb_l_ast;
00750 myacbs[myacbi++]=acb->acb_l_astprm;
00751 #endif
00752 insque(acb,&p->pcb_l_astqfl);
00753 p->phd_b_astlvl=p->pr_astlvl=(acb->acb$b_rmod & 3) + 1;
00754 vmsunlock(&SPIN_SCHED,-1);
00755 return;
00756 }
00757
00758
00759
00760
00761 p->phd_b_astlvl=p->pr_astlvl=(acb->acb$b_rmod & 3) + 1;
00762
00763 vmsunlock(&SPIN_SCHED,-1);
00764 setipl(IPL__ASTDEL);
00765 if (((unsigned long)acb->acb_l_ast<0x80000000)&&((unsigned long)acb->acb$l_ast>0xb0000000)) {
00766 int i;
00767 printk("kast %x\n",acb->acb_l_ast);
00768 for(i=0;i<2000000000;i++) ;
00769 }
00770 #ifdef __i386__
00771 if (0 && astdeb)
00772 printk(" a %x",acb->acb_l_ast);
00773 if (0 && astdeb)
00774 printk(" a %x",*(unsigned long*)acb->acb_l_ast);
00775 #endif
00776 #ifdef __i386__
00777
00778 #endif
00779
00780 if (acb->acb_b_rmod&ACB$M_PKAST) {
00781 acb->acb_b_rmod&=~ACB$M_PKAST;
00782 if (acb->acb_b_rmod&3)
00783 printk("error: pkast not kernel mode\n");
00784 if(acb->acb_l_kast) acb->acb$l_kast(acb->acb$l_astprm);
00785 }
00786 #ifdef __arch_um__
00787 if (((unsigned long)acb->acb_l_ast<0x80000000)) {
00788
00789
00790 } else {
00791 if(acb->acb_l_ast) acb->acb$l_ast(acb->acb$l_astprm);
00792 }
00793 #else
00794 long (*ast)() = acb->acb_l_ast;
00795 long astprm = acb->acb_l_astprm;
00796 int rmod = acb->acb_b_rmod;
00797
00798 if ((acb->acb_b_rmod&(ACB$M_NODELETE|ACB$M_PKAST))==0) kfree(acb);
00799 if (rmod&3) {
00800 #ifdef __i386__
00801
00802 user_spaceable_addr(exe_astdel);
00803 user_spaceable_addr(&dummy);
00804 #endif
00805 #if 0
00806 int sts = exe_astdel_prep(&dummy,ast,astprm);
00807 #else
00808
00809 #ifdef __i386__
00810 int sts = exe_astdel_prep2_new(p->ipr_sp[rmod&3],ast,astprm,cstab[rmod&3],sstab[rmod&3]);
00811 #else
00812 int sts = exe_astdel_prep2_new(p->ipr_sp[rmod&3],ast,astprm,0,cstab[rmod&3],sstab[rmod&3]);
00813 #endif
00814 #endif
00815 } else {
00816
00817 setipl(0);
00818
00819 if(ast) ast(astprm);
00820
00821
00822
00823 test_and_clear_bit(rmod&3, &p->pcb_b_astact);
00824
00825 sch_newlvl(p);
00826 }
00827 #endif
00828 #ifdef __i386__
00829
00830 #endif
00831 }
00832
00833
00834
00835
00836
00837
00838 void sch_newlvl(struct _pcb *p) {
00839 int newlvl;
00840 int oldipl=getipl();
00841
00842 setipl(IPL__SYNCH);
00843 vmslock(&SPIN_SCHED,-1);
00844
00845 if (aqempty(p->pcb_l_astqfl))
00846 newlvl=4;
00847 else {
00848 if(p->pcb_l_astqfl->acb$b_rmod & ACB$M_KAST)
00849 newlvl=0;
00850 else
00851 newlvl=p->pcb_l_astqfl->acb$b_rmod & 3;
00852 }
00853
00854 p->phd_b_astlvl=newlvl;
00855 p->pr_astlvl=newlvl;
00856 vmsunlock(&SPIN_SCHED,-1);
00857 setipl(oldipl);
00858 }
00859
00860
00861