- // copy the entire kernel page table
- pid_t pid = proc->pid;
- void* pt_copy = __dup_pagetable(pid, usedMnt);
-
- vmm_mount_pd(VMS_MOUNT_1, pt_copy); // 将新进程的页表挂载到挂载点#2
-
- // copy the kernel stack
- for (size_t i = KSTACK_START >> 12; i <= KSTACK_TOP >> 12; i++) {
- volatile x86_pte_t* ppte = &PTE_MOUNTED(VMS_MOUNT_1, i);
-
- /*
- This is a fucking nightmare, the TLB caching keep the rewrite to PTE
- from updating. Even the Nightmare Moon the Evil is far less nasty
- than this. It took me hours of debugging to figure this out.
-
- In the name of Celestia our glorious goddess, I will fucking HATE
- the TLB for the rest of my LIFE!
- */
- cpu_invplg(ppte);
-
- x86_pte_t p = *ppte;
- void* ppa = vmm_dup_page(pid, PG_ENTRY_ADDR(p));
- pmm_free_page(pid, PG_ENTRY_ADDR(p));
- *ppte = (p & 0xfff) | (uintptr_t)ppa;
- }
+ return __current->egid;
+}
+
+__DEFINE_LXSYSCALL2(int, getgroups, gid_t*, out_buf, unsigned int, len)
+{
+ struct user_scope* procu;
+ struct ugroup_obj* gobj;
+
+ procu = current_user_scope();
+ gobj = user_groups(procu);