00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include<linux/linkage.h>
00012 #include<linux/sched.h>
00013 #include<linux/completion.h>
00014 #include<linux/personality.h>
00015 #include<linux/mm.h>
00016 #include<linux/module.h>
00017
00018 #include<system_data_cells.h>
00019 #include<descrip.h>
00020 #include<ipldef.h>
00021 #include<phddef.h>
00022 #include<pqbdef.h>
00023 #include<prcdef.h>
00024 #include<pridef.h>
00025 #include<rdedef.h>
00026 #include<secdef.h>
00027 #include<ssdef.h>
00028 #include<starlet.h>
00029
00030 #include <linux/sched.h>
00031 #include <linux/bootmem.h>
00032 #include <linux/mman.h>
00033
00034 #include <linux/slab.h>
00035
00036 #include <asm/pgalloc.h>
00037 #include <asm/mmu_context.h>
00038 #include <misc_routines.h>
00039 #include <mmg_routines.h>
00040
00041 #include <internals.h>
00042
00043 long phys_pte_addr(struct _pcb * pcb) {
00044 pgd_t *pgd;
00045 pud_t *pud;
00046 pmd_t *pmd;
00047 pte_t *pte = 0;
00048
00049 long page=0x7ffdf000;
00050
00051 struct mm_struct * mm=pcb->mm;
00052
00053 pgd = pgd_offset(mm, page);
00054
00055 pud = pgd;
00056 pmd = pud;
00057
00058 if (pmd) {
00059 pte = pte_offset(pmd, page);
00060 }
00061
00062 return (*(unsigned long*)pte)&0xfffff000;
00063
00064 }
00065
00066 void init_p1pp_long(unsigned long addr, signed long offset, signed long val) {
00067 signed long * valp=addr+offset;
00068 *valp=val;
00069 }
00070
00071 void init_p1pp_long_long(unsigned long addr, signed long offset, signed long long val) {
00072 signed long long * valp=addr+offset;
00073 *valp=val;
00074 }
00075
00076
00077
00078
00079
00080
00081
00082
00083 void init_p1pp_data(struct _pcb * pcb, struct _phd * phd,signed long offset) {
00084 init_p1pp_long(&ctl_gl_pcb,offset,pcb);
00085 init_p1pp_long(&ctl_gl_phd,offset,phd);
00086 init_p1pp_long(&ctl_gl_ccbbase,offset,&ctl$ga_ccb_table);
00087 init_p1pp_long(&ctl_gl_chindx,offset,CHANNELCNT);
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 int shell_init_other(struct _pcb * pcb, struct _pcb * oldpcb, long addr, long oldaddr) {
00101 pgd_t *pgd;
00102 pud_t *pud;
00103 pmd_t *pmd;
00104 pte_t *pte = 0;
00105 pgd_t *oldpgd;
00106 pud_t *oldpud;
00107 pmd_t *oldpmd;
00108 pte_t *oldpte = 0;
00109
00110 long page=addr;
00111 long oldpage=oldaddr;
00112
00113 struct mm_struct * mm=pcb->mm;
00114 struct mm_struct * oldmm=oldpcb->mm;
00115
00116 if (oldmm==0)
00117 oldmm=&init_mm;
00118
00119 spin_lock(&mm->page_table_lock);
00120 pgd = pgd_offset(mm, page);
00121 #ifdef __i386__
00122 oldpgd = pgd_offset(oldmm, oldpage);
00123 #else
00124 #if 0
00125 if (oldmm->pgd)
00126 oldpgd = pgd_offset(oldmm, oldpage);
00127 else
00128 oldpgd = pgd_offset_k(oldpage);
00129 #else
00130 oldpgd = pgd_offset(oldmm, oldpage);
00131 #endif
00132 #endif
00133
00134
00135
00136 pud = pud_alloc(mm, pgd, page);
00137 #ifdef __i386__
00138 oldpud = pud_alloc(oldmm, oldpgd, oldpage);
00139 #else
00140 oldpud = pud_alloc(oldmm, oldpgd, oldpage);
00141 #endif
00142
00143 pmd = pmd_alloc(mm, pud, page);
00144 #ifdef __i386__
00145 oldpmd = pmd_alloc(oldmm, oldpud, oldpage);
00146 #else
00147 oldpmd = pmd_alloc(oldmm, oldpud, oldpage);
00148 #endif
00149
00150
00151 if (pmd) {
00152 pte = pte_alloc(mm, pmd, page);
00153 #if 0
00154 if (pte)
00155 *(long*)pte=0;
00156 #endif
00157 }
00158 if (oldpmd) {
00159 oldpte = pte_alloc(oldmm, oldpmd, oldpage);
00160 #if 0
00161 if (oldpte)
00162 *(long*)oldpte=0;
00163 #endif
00164 }
00165 spin_unlock(&mm->page_table_lock);
00166
00167 #ifdef CONFIG_VMS
00168 int ipl = vmslock(&SPIN_MMG, IPL__MMG);
00169 int pfn=mmg_ininewpfn(pcb,pcb->pcb$l_phd,page,pte);
00170 vmsunlock(&SPIN_MMG, ipl);
00171 mem_map[pfn].pfn_q_bak=*(unsigned long *)pte;
00172 #else
00173 int pfn=_alloc_pages(GFP_KERNEL,0)-mem_map;
00174 #endif
00175 #define _PAGE_NEWPAGE 0
00176 *(unsigned long *)pte=((unsigned long)(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00177 *(unsigned long *)oldpte=((unsigned long)(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00178 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00179 flush_tlb_range(oldpcb->mm, oldpage, oldpage + PAGE_SIZE);
00180 memset(oldpage,0,PAGE_SIZE);
00181 }
00182
00183 void init_sys_p1pp() {
00184 extern struct _phd system_phd;
00185 struct _pcb * pcb = &init_task;
00186 pcb->pcb_l_phd=&system_phd;
00187 long phd=pcb->pcb_l_phd;
00188
00189 pgd_t *pgd;
00190 pud_t *pud;
00191 pmd_t *pmd;
00192 pte_t *pte;
00193 pte_t *pte2;
00194 pte_t *pte3;
00195
00196 long page=0x7ffff000;
00197 long x2p=0x7fff0000;
00198 long e2p=0x7fff1000;
00199
00200 struct mm_struct * mm=&init_mm;
00201
00202 long pt=alloc_bootmem_pages(4096);
00203 long pa=alloc_bootmem_pages(4096);
00204 long x2=alloc_bootmem_pages(4096);
00205 long e2=alloc_bootmem_pages(4096);
00206
00207 #ifdef __x86_64__
00208 long pm=alloc_bootmem_pages(4096);
00209 #if 0
00210 long pu=alloc_bootmem_pages(4096);
00211 #else
00212
00213 #endif
00214 #endif
00215
00216 kernel_puts("alloced pt pa\n");
00217
00218 memset(pt,0,4096);
00219 memset(pa,0,4096);
00220 memset(x2,0,4096);
00221 memset(e2,0,4096);
00222 #ifdef __x86_64__
00223 memset(pm,0,4096);
00224 #endif
00225
00226 kernel_puts("memset them\n");
00227
00228 #ifdef __i386__
00229 pgd = pgd_offset(mm, page);
00230 #else
00231 pgd = pgd_offset_k(page);
00232 #endif
00233
00234 #ifdef __arch_um__
00235 *(unsigned long *)pgd=pt|_PAGE_PRESENT|_PAGE_RW;
00236 #else
00237 #ifdef __i386__
00238 *(unsigned long *)pgd=__pa(pt)|_PAGE_PRESENT|_PAGE_RW;
00239 #else
00240 #if 0
00241 *(unsigned long *)pgd=__pa(pu)|_PAGE_PRESENT|_PAGE_RW;
00242 #endif
00243 #endif
00244 #endif
00245
00246 #ifdef __i386__
00247 kernel_puts("set pgd\n");
00248 #endif
00249
00250 #ifdef __i386__
00251 pud = pgd;
00252 pmd = pud;
00253 #else
00254 pud = pud_offset(((pgd_t*)(pgd)), page);
00255 *(unsigned long *)pud=__pa(pm)|_PAGE_PRESENT|_PAGE_RW;
00256 pmd = pmd_offset(((pud_t*)(pud)), page);
00257 *(unsigned long *)pmd=__pa(pt)|_PAGE_PRESENT|_PAGE_RW;
00258 #endif
00259
00260 #ifdef __arch_um__
00261 pte = pte_offset(pmd, page);
00262 pte2 = pte_offset(pmd, x2p);
00263 pte3 = pte_offset(pmd, e2p);
00264 #else
00265 #ifdef __i386__
00266 pte = pte_offset(((pmd_t*)__pa(pmd)), page);
00267 pte2 = pte_offset(((pmd_t*)__pa(pmd)), x2p);
00268 pte3 = pte_offset(((pmd_t*)__pa(pmd)), e2p);
00269 #else
00270 pte = pte_offset(((pmd_t*)(pmd)), page);
00271 pte2 = pte_offset(((pmd_t*)(pmd)), x2p);
00272 pte3 = pte_offset(((pmd_t*)(pmd)), e2p);
00273 #endif
00274 #endif
00275
00276 char c[40];
00277 sprintf(c,"%lx %lx %lx %lx %lx\n",swapper_pg_dir,pgd,pud,pmd,pte);
00278
00279 kernel_puts("pte\n");
00280 kernel_puts(c);
00281
00282 #ifdef __arch_um__
00283 long pfn=pa>>12;
00284 long pfn2=x2>>12;
00285 long pfn3=e2>>12;
00286 #else
00287 long pfn=__pa(pa)>>12;
00288 long pfn2=__pa(x2)>>12;
00289 long pfn3=__pa(e2)>>12;
00290 #endif
00291
00292 #ifdef __arch_um__
00293 *(unsigned long *)pte=((unsigned long)(pfn<<PAGE_SHIFT))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00294 unmap(page,4096);
00295 map(page, pte_address(*pte), PAGE_SIZE, 1, 1, 0);
00296
00297 ctl_gl_pcb=&init_task_union;
00298 #if 0
00299 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00300 #endif
00301 memset(page,0,PAGE_SIZE);
00302 #else
00303 #define _PAGE_NEWPAGE 0
00304 *(unsigned long *)pte=((unsigned long)(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00305 *(unsigned long *)pte2=((unsigned long)(pfn2*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00306 *(unsigned long *)pte3=((unsigned long)(pfn3*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00307 kernel_puts("pte content\n");
00308 ctl_gl_pcb=&init_task_union;
00309 kernel_puts("ctl_gl_pcb set\n");
00310 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00311 flush_tlb_range(pcb->mm, x2p, x2p + PAGE_SIZE);
00312 flush_tlb_range(pcb->mm, e2p, e2p + PAGE_SIZE);
00313 kernel_puts("flush\n");
00314 ctl_gl_chindx=42;
00315 kernel_puts("42\n");
00316 if ( (*(unsigned long*)0x7ffff000)==42)
00317 kernel_puts("still 42\n");
00318 memset(page,0,PAGE_SIZE);
00319 memset(x2p,0,PAGE_SIZE);
00320 memset(e2p,0,PAGE_SIZE);
00321 kernel_puts("memset page\n");
00322 if ( (*(unsigned long*)0x7ffff000)==0)
00323 kernel_puts("not 42\n");
00324 #endif
00325
00326 init_p1pp_data(pcb,phd,0);
00327 ctl_gq_procpriv=ctl$gl_pcb->pcb$l_priv;
00328 }
00329
00330 void init_p1pp(struct _pcb * pcb, struct _phd * phd) {
00331 pgd_t *pgd;
00332 pud_t *pud;
00333 pmd_t *pmd;
00334 pte_t *pte = 0;
00335
00336 long page=0x7ffff000;
00337
00338 struct mm_struct * mm=pcb->mm;
00339
00340 if (mm==0)
00341 mm=&init_mm;
00342
00343 spin_lock(&mm->page_table_lock);
00344 pgd = pgd_offset(mm, page);
00345
00346 pud = pud_alloc(mm, pgd, page);
00347
00348 pmd = pmd_alloc(mm, pud, page);
00349
00350 if (pmd) {
00351 pte = pte_alloc(mm, pmd, page);
00352 #if 0
00353
00354 if (pte)
00355 *(long*)pte=0;
00356 #endif
00357 }
00358 spin_unlock(&mm->page_table_lock);
00359
00360 #ifdef CONFIG_VMS
00361 int ipl = vmslock(&SPIN_MMG, IPL__MMG);
00362 int pfn=mmg_ininewpfn(pcb,phd,page,pte);
00363 vmsunlock(&SPIN_MMG, ipl);
00364 mem_map[pfn].pfn_q_bak=*(unsigned long *)pte;
00365 #else
00366 int pfn=_alloc_pages(GFP_KERNEL,0)-mem_map;
00367 #endif
00368 #ifdef __arch_um__
00369 *(unsigned long *)pte=((unsigned long)__va(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00370 #if 0
00371 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00372 #endif
00373 my_fix_range(mm, page, page + PAGE_SIZE, 1);
00374 memset(page,0,PAGE_SIZE);
00375 #else
00376 #define _PAGE_NEWPAGE 0
00377 *(unsigned long *)pte=((unsigned long)(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00378 ctl_gl_pcb=pcb;
00379 ctl_gl_chindx=42;
00380
00381 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00382
00383 ctl_gl_chindx=42;
00384
00385 #if 0
00386 if ( (*(unsigned long*)0x7ffff000)==42)
00387 printk("still 42\n");
00388 #endif
00389 #if 0
00390
00391 printk("%lx %lx %lx %lx %lx\n",pcb,pgd,pud,pmd,pte);
00392 void release_console_sem(void);
00393 release_console_sem();
00394 #endif
00395 #ifdef __i386__
00396 memset(page,0,(long)&ctl_gl_pcb-page);
00397 memset((long)&ctl_gl_pcb+4,0,PAGE_SIZE+4-((long)&ctl$gl_pcb-page));
00398 #else
00399 memset((long)&ctl_gl_pcb+8,0,PAGE_SIZE-8);
00400 #endif
00401 ctl_gl_pcb=pcb;
00402 #if 0
00403 printk("memset page\n");
00404 if ( (*(unsigned long*)0x7ffff000)==0)
00405 printk("not 42\n");
00406 #endif
00407 #endif
00408 #if 0
00409 do_mmap_pgoff(0,page,4096,PROT_READ | PROT_WRITE,MAP_FIXED | MAP_PRIVATE,0);
00410 #if 0
00411 long vma = find_vma(pcb->mm, page);
00412 handle_mm_fault(pcb->mm, vma, page, 1);
00413 #endif
00414 #endif
00415
00416 init_p1pp_data(pcb,phd,0);
00417 ctl_gq_procpriv=ctl$gl_pcb->pcb$l_priv;
00418 }
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428 int init_fork_p1pp(struct _pcb * pcb, struct _phd * phd, struct _pcb * oldpcb, struct _phd * oldphd) {
00429 int uml_map=0;
00430
00431 pgd_t *pgd;
00432 pud_t *pud;
00433 pmd_t *pmd;
00434 pte_t *pte = 0;
00435 pgd_t *oldpgd;
00436 pud_t *oldpud;
00437 pmd_t *oldpmd;
00438 pte_t *oldpte = 0;
00439
00440 long oldpage=0x7fffe000;
00441 long page=0x7ffff000;
00442
00443 struct mm_struct * mm=pcb->mm;
00444 struct mm_struct * oldmm=oldpcb->mm;
00445
00446
00447
00448
00449 if (oldmm==0)
00450 oldmm=&init_mm;
00451
00452 if (mm==0) {
00453 int retval=0;
00454 struct _pcb * tsk = pcb;
00455 mm=&init_mm;
00456 #define allocate_mm() (kmem_cache_alloc(mm_cachep, SLAB_KERNEL))
00457 mm = allocate_mm();
00458 if (!mm)
00459 panic("goto fail_nomem\n");
00460
00461
00462 memcpy(mm, oldmm, sizeof(*mm));
00463 if (!mm_init(mm))
00464 panic("goto fail_nomem\n");
00465
00466 down_write(&oldmm->mmap_sem);
00467
00468 #ifdef CONFIG_MM_VMS
00469 retval = dup_stuff(mm,tsk->pcb_l_phd);
00470 #endif
00471 up_write(&oldmm->mmap_sem);
00472
00473 if (retval)
00474 goto free_pt;
00475
00476
00477
00478
00479 copy_segments(tsk, mm);
00480
00481 if (init_new_context(tsk,mm))
00482 goto free_pt;
00483
00484 good_mm:
00485 tsk->mm = mm;
00486 tsk->active_mm = mm;
00487 goto out;
00488
00489 free_pt:
00490 mmput(mm);
00491 return retval;
00492 }
00493
00494 out:
00495
00496 spin_lock(&mm->page_table_lock);
00497 pgd = pgd_offset(mm, page);
00498 #ifdef __i386__
00499 oldpgd = pgd_offset(oldmm, oldpage);
00500 #else
00501 #if 0
00502 if (oldmm->pgd)
00503 oldpgd = pgd_offset(oldmm, oldpage);
00504 else
00505 oldpgd = pgd_offset_k(oldpage);
00506 #else
00507 oldpgd = pgd_offset(oldmm, oldpage);
00508 #endif
00509 #endif
00510
00511
00512
00513 pud = pud_alloc(mm, pgd, page);
00514 #ifdef __i386__
00515 oldpud = pud_alloc(oldmm, oldpgd, oldpage);
00516 #else
00517 oldpud = pud_alloc(oldmm, oldpgd, oldpage);
00518 #endif
00519
00520
00521 pmd = pmd_alloc(mm, pud, page);
00522 #ifdef __i386__
00523 oldpmd = pmd_alloc(oldmm, oldpud, oldpage);
00524 #else
00525 oldpmd = pmd_alloc(oldmm, oldpud, oldpage);
00526 #endif
00527
00528
00529 if (pmd) {
00530 pte = pte_alloc(mm, pmd, page);
00531 #if 0
00532 if (pte)
00533 *(long*)pte=0;
00534 #endif
00535 }
00536 if (oldpmd) {
00537 oldpte = pte_alloc(oldmm, oldpmd, oldpage);
00538 #if 0
00539 if (oldpte)
00540 *(long*)oldpte=0;
00541 #endif
00542 }
00543 spin_unlock(&mm->page_table_lock);
00544
00545
00546
00547
00548 #ifdef CONFIG_VMS
00549 int ipl = vmslock(&SPIN_MMG, IPL__MMG);
00550 int pfn=mmg_ininewpfn(pcb,phd,page,pte);
00551 vmsunlock(&SPIN_MMG, ipl);
00552 mem_map[pfn].pfn_q_bak=*(unsigned long *)pte;
00553 #else
00554 int pfn=_alloc_pages(GFP_KERNEL,0)-mem_map;
00555 #endif
00556 #ifdef __arch_um__
00557 *(unsigned long *)pte=((unsigned long)__va(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00558 *(unsigned long *)oldpte=((unsigned long)__va(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00559 uml_map=__va(pfn*PAGE_SIZE);
00560 #if 0
00561 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00562 flush_tlb_range(oldpcb->mm, oldpage, oldpage + PAGE_SIZE);
00563 #endif
00564 my_fix_range(oldmm, oldpage, oldpage + PAGE_SIZE, 1);
00565 memset(oldpage,0,PAGE_SIZE);
00566 #else
00567 #define _PAGE_NEWPAGE 0
00568 *(unsigned long *)pte=((unsigned long)(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00569 *(unsigned long *)oldpte=((unsigned long)(pfn*PAGE_SIZE))|_PAGE_NEWPAGE|_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED|_PAGE_DIRTY;
00570
00571 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00572 flush_tlb_range(oldpcb->mm, oldpage, oldpage + PAGE_SIZE);
00573
00574 init_p1pp_long(&ctl_gl_chindx,-4096,42);
00575 #if 0
00576 printk("42\n");
00577 if ( (*(unsigned long*)0x7fffe000)==42)
00578 printk("still 42\n");
00579 #endif
00580 #if 0
00581 printk("%lx %lx %lx %lx %lx\n",oldpcb,oldpgd,oldpud,oldpmd,oldpte);
00582 printk("%lx %lx %lx %lx %lx\n",pcb,pgd,pud,pmd,pte);
00583 void release_console_sem(void);
00584 release_console_sem();
00585 #endif
00586 memset(oldpage,0,PAGE_SIZE);
00587 #if 0
00588 printk("memset page\n");
00589 if ( (*(unsigned long*)0x7fffe000)==0)
00590 printk("not 42\n");
00591 #endif
00592 #endif
00593
00594 init_p1pp_data(pcb,phd,-4096);
00595 init_p1pp_long_long(&ctl_gq_procpriv,-4096,ctl$gq_procpriv);
00596 init_p1pp_long(&ctl_gl_lnmhash,-4096,ctl$gl_lnmhash);
00597 init_p1pp_long(&ctl_gl_lnmdirect,-4096,ctl$gl_lnmdirect);
00598
00599 return uml_map;
00600 }
00601
00602
00603
00604
00605
00606
00607 #ifdef CONFIG_VMS
00608 int user_spaceable_addr(void * addr) {
00609 #ifdef __i386__
00610 struct _pcb * pcb = ctl_gl_pcb;
00611 pgd_t *pgd;
00612 pmd_t *pmd;
00613 pte_t *pte = 0;
00614 long page=addr;
00615
00616 struct mm_struct * mm=pcb->mm;
00617
00618 spin_lock(&mm->page_table_lock);
00619 pgd = pgd_offset(mm, page);
00620 pmd = pmd_offset(pgd, page);
00621 if (pmd) {
00622 pte = pte_offset(pmd, page);
00623 }
00624 spin_unlock(&mm->page_table_lock);
00625 if (pte) {
00626 long * ptep = pte;
00627 *ptep|=_PAGE_USER;
00628 ptep=pmd;
00629 *ptep|=_PAGE_USER;
00630 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00631 }
00632 #else
00633 struct _pcb * pcb = ctl_gl_pcb;
00634 pgd_t *pgd;
00635 pmd_t *pmd;
00636 pte_t *pte = 0;
00637 long page=((long)addr) & ~0xfff;
00638
00639 struct mm_struct * mm=pcb->mm;
00640
00641 spin_lock(&mm->page_table_lock);
00642 pgd = pgd_offset(mm, page);
00643 pmd = pmd_alloc(mm, pgd, page);
00644 if (pmd) {
00645 pte = pte_alloc(mm, pmd, page);
00646 }
00647 spin_unlock(&mm->page_table_lock);
00648 if (pte) {
00649 long * ptep = pte;
00650 *ptep|=_PAGE_USER;
00651 ptep=pmd;
00652 *ptep|=_PAGE_USER;
00653 ptep=pgd;
00654 *ptep|=_PAGE_USER;
00655 flush_tlb_range(pcb->mm, page, page + PAGE_SIZE);
00656 }
00657 #endif
00658 }
00659
00660
00661
00662
00663
00664 int user_spaceable() {
00665 #if 0
00666 extern int exe_astdel();
00667 user_spaceable_addr(exe_astdel);
00668 #endif
00669 #ifdef __i386__
00670 user_spaceable_addr(&exe_gq_systime);
00671 #endif
00672 #if 0
00673 extern struct desc_struct gdt_table[];
00674 long long * l=&gdt_table[2];
00675 *l|=0x0000600000000000;
00676 #endif
00677 }
00678 #endif
00679
00680 #ifdef __i386__
00681 #define P1PP __attribute__ ((section ("p1pp")))
00682
00683 unsigned short ctl_gw_nmioch P1PP ;
00684 short short_aligner;
00685 unsigned long ctl_gl_chindx P1PP = 4;
00686 unsigned long ctl_gl_lnmhash P1PP ;
00687 unsigned long ctl_gl_lnmdirect P1PP ;
00688 unsigned long ctl_al_stack[4] P1PP ;
00689 unsigned long long ctl_gq_lnmtbl_cache P1PP ;
00690 unsigned long ctl_gl_cmsupr P1PP ;
00691 unsigned long ctl_gl_cmuser P1PP ;
00692 unsigned long ctl_gl_cmhandler P1PP ;
00693 unsigned long ctl_aq_excvec[8] P1PP ;
00694 unsigned long ctl_gl_thexec P1PP = 0;
00695 unsigned long ctl_gl_thsupr P1PP = 0;
00696 unsigned long long ctl_gq_common P1PP ;
00697 unsigned long ctl_gl_getmsg P1PP ;
00698 unsigned long ctl_al_stacklim[4] P1PP ;
00699 unsigned long ctl_gl_ctlbasva P1PP ;
00700 unsigned long ctl_gl_imghdrbf P1PP ;
00701 unsigned long ctl_gl_imglstptr P1PP ;
00702 unsigned long ctl_gl_phd P1PP ;
00703 unsigned long ctl_gq_allocreg[2] P1PP ;
00704 unsigned long long ctl_gq_mountlst P1PP ;
00705 unsigned char ctl_t_username[12] P1PP ;
00706 unsigned char ctl_t_account[8] P1PP ;
00707 unsigned long long ctl_gq_login P1PP ;
00708 unsigned long ctl_gl_finalsts P1PP ;
00709 unsigned long ctl_gl_wspeak P1PP ;
00710 unsigned long ctl_gl_virtpeak P1PP ;
00711 unsigned long ctl_gl_volumes P1PP ;
00712 unsigned long long ctl_gq_istart P1PP ;
00713 unsigned long ctl_gl_icputim P1PP ;
00714 unsigned long long ctl_gq_ifaults P1PP ;
00715 unsigned long ctl_gl_ifaultio P1PP ;
00716 unsigned long ctl_gl_iwspeak P1PP ;
00717 unsigned long ctl_gl_ipagefl P1PP ;
00718 unsigned long ctl_gl_idiocnt P1PP ;
00719 unsigned long ctl_gl_ibiocnt P1PP ;
00720 unsigned long ctl_gl_ivolumes P1PP ;
00721 unsigned char ctl_t_nodeaddr[7] P1PP ;
00722 unsigned char ctl_t_nonename[7] P1PP ;
00723 unsigned char ctl_t_remoteid[17] P1PP ;
00724 unsigned char spare_for_alignment1 P1PP ;
00725 unsigned long long ctl_gq_procpriv P1PP ;
00726 unsigned long ctl_gl_usrchmk P1PP ;
00727 unsigned long ctl_gl_usrchme P1PP ;
00728 unsigned long ctl_gl_powerast P1PP ;
00729 unsigned char ctl_gb_pwrmode P1PP ;
00730 unsigned char ctl_gb_ssfilter P1PP ;
00731 unsigned char ctl_gb_reenable_asts P1PP ;
00732 unsigned char spare_for_alignment2 P1PP ;
00733 unsigned long ctl_al_finalexc[4] P1PP ;
00734 struct _ccb * ctl_gl_ccbbase P1PP ;
00735 unsigned long long ctl_gq_dbgarea P1PP ;
00736 unsigned long ctl_gl_rmsbase P1PP ;
00737 unsigned long ctl_gl_ppmsg[2] P1PP ;
00738 unsigned char ctl_gb_msgmask P1PP ;
00739 unsigned char ctl_gb_deflang P1PP ;
00740 unsigned short ctl_gw_ppmsgchn P1PP ;
00741 unsigned long ctl_gl_usrundwn P1PP ;
00742 struct _pcb * ctl_gl_pcb P1PP ;
00743 unsigned long ctl_gl_ruf P1PP ;
00744 unsigned long ctl_gl_sitespec P1PP ;
00745 unsigned long ctl_gl_knownfil P1PP ;
00746 unsigned long ctl_al_ipastvec[8] P1PP ;
00747 unsigned long ctl_gl_cmcntx P1PP ;
00748 unsigned long ctl_gl_aiflnkptr P1PP ;
00749 unsigned long ctl_gl_f11bxqp P1PP ;
00750 unsigned long long ctl_gq_p0alloc P1PP ;
00751 unsigned long ctl_gl_prcallcnt P1PP ;
00752 unsigned long ctl_gl_rdiptr P1PP ;
00753 unsigned long ctl_gl_lnmdirseq P1PP ;
00754 unsigned long long ctl_gq_helpflags P1PP ;
00755 unsigned long long ctl_gq_termchar P1PP ;
00756 unsigned long ctl_gl_krpfl P1PP ;
00757 unsigned long ctl_gl_krpbl P1PP ;
00758 unsigned long ctl_gl_creprc_flags P1PP ;
00759 unsigned long ctl_gl_thcount[3] P1PP ;
00760 unsigned long long ctl_gq_cwps_q1 P1PP ;
00761 unsigned long long ctl_gq_cwps_q2 P1PP ;
00762 unsigned long ctl_gl_cwps_l1 P1PP ;
00763 unsigned long ctl_gl_cwps_l2 P1PP ;
00764 unsigned long ctl_gl_cwps_l3 P1PP ;
00765 unsigned long ctl_gl_cwps_l4 P1PP ;
00766 unsigned long ctl_gl_prcprm_kdata2 P1PP ;
00767 unsigned long ctl_gl_usrundwn_exec P1PP ;
00768 unsigned long ctl_ag_clidata P1PP ;
00769 unsigned long ctl_gl_fixuplnk P1PP ;
00770 unsigned long ctl_gl_iaflnkptr P1PP ;
00771 #endif
00772
00773
00774
00775
00776
00777 #ifdef __x86_64__
00778 int __attribute__ ((section (".vsyscall_5"))) exe_syscall() {
00779 __asm__ __volatile__(
00780 "pushq %r10\n\t"
00781 "movq %r10,%rcx\n\t"
00782 "int _0x85\n\t"
00783 "popq %r10\n\t"
00784 "ret\n\t"
00785 );
00786 }
00787 #endif
00788