freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

geekos操作系統(tǒng)的研究與實(shí)現(xiàn)操作系統(tǒng)課程設(shè)計(jì)(編輯修改稿)

2024-07-21 06:16 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 入準(zhǔn)備運(yùn)行隊(duì)列*/ process = Start_User_Thread(userContext, false)。 if (process != 0) { //不是核心級(jí)進(jìn)程(即為用戶(hù)級(jí)進(jìn)程) KASSERT(processrefCount == 2)。/* 返回核心進(jìn)程的指針 */ *pThread = process。 rc = processpid。//記錄當(dāng)前進(jìn)程的ID } else//超出內(nèi)存 project2\include\geekos rc = ENOMEM。 return rc。fail: //如果新進(jìn)程創(chuàng)建失敗則注銷(xiāo)User_Context對(duì)象 if (exeFileData != 0) Free(exeFileData)。//釋放內(nèi)存 if (userContext != 0) Destroy_User_Context(userContext)。//銷(xiāo)毀進(jìn)程對(duì)象 return rc。}//切換至用戶(hù)上下文void Switch_To_User_Context(struct Kernel_Thread* kthread, struct Interrupt_State* state){ //TODO(Switch to a new user address space, if necessary)。 static struct User_Context* s_currentUserContext。 /* last user context used */ //extern int userDebug。 struct User_Context* userContext = kthreaduserContext。//指向User_Conetxt的指針,并初始化為準(zhǔn)備切換的進(jìn)程 KASSERT(!Interrupts_Enabled())。 if (userContext == 0) { //userContext為0表示此進(jìn)程為核心態(tài)進(jìn)程就不用切換地址空間 return。 } if (userContext != s_currentUserContext) { ulong_t esp0。 //if (userDebug) Print(A[%p]\n, kthread)。 Switch_To_Address_Space(userContext)。//為用戶(hù)態(tài)進(jìn)程時(shí)則切換地址空間 esp0 = ((ulong_t) kthreadstackPage) + PAGE_SIZE。 //if (userDebug) // Print(S[%lx]\n, esp0)。/* 新進(jìn)程的核心棧. */ Set_Kernel_Stack_Pointer(esp0)。//設(shè)置內(nèi)核堆棧指針/* New user context is active */ s_currentUserContext = userContext。 }} ================== ====================copy project1 =================== ===================//需在此文件各函數(shù)前增加一個(gè)函數(shù),此函數(shù)的功能是按給定的大小創(chuàng)建一個(gè)用戶(hù)級(jí)進(jìn)程上下文,具體實(shí)現(xiàn)如下://函數(shù)功能:按給定的大小創(chuàng)建一個(gè)用戶(hù)級(jí)進(jìn)程上下文static struct User_Context* Create_User_Context(ulong_t size){ struct User_Context * UserContext。 size = Round_Up_To_Page(size)。 UserContext = (struct User_Context *)Malloc(sizeof(struct User_Context))。 //為用戶(hù)態(tài)進(jìn)程 if (UserContext != 0) UserContextmemory = Malloc(size)。 //為核心態(tài)進(jìn)程 else goto fail。 //內(nèi)存為空 if (0 == UserContextmemory) goto fail。 memset(UserContextmemory, 39。\039。, size)。 UserContextsize = size。 //以下為用戶(hù)態(tài)進(jìn)程創(chuàng)建LDT(段描述符表) //新建一個(gè)LDT描述符 UserContextldtDescriptor = Allocate_Segment_Descriptor()。 if (0 == UserContextldtDescriptor) goto fail。 //初始化段描述符 Init_LDT_Descriptor(UserContextldtDescriptor, UserContextldt, NUM_USER_LDT_ENTRIES)。 //新建一個(gè)LDT選擇子 UserContextldtSelector = Selector(KERNEL_PRIVILEGE, true, Get_Descriptor_Index(UserContextldtDescriptor))。 //新建一個(gè)文本段描述符 Init_Code_Segment_Descriptor( amp。UserContextldt[0], (ulong_t) UserContextmemory, size / PAGE_SIZE, USER_PRIVILEGE )。 //新建一個(gè)數(shù)據(jù)段 Init_Data_Segment_Descriptor( amp。UserContextldt[1], (ulong_t) UserContextmemory, size / PAGE_SIZE, USER_PRIVILEGE )。 //新建數(shù)據(jù)段和文本段選擇子 UserContextcsSelector = Selector(USER_PRIVILEGE, false, 0)。 UserContextdsSelector = Selector(USER_PRIVILEGE, false, 1)。 //將引用數(shù)清0 UserContextrefCount = 0。 return UserContext。fail: if (UserContext != 0){ if (UserContextmemory != 0){ Free(UserContextmemory)。 } Free(UserContext)。 } return 0。}//摧毀用戶(hù)上下文void Destroy_User_Context(struct User_Context* userContext){ //TODO(Destroy a User_Context)。// KASSERT(userContextrefCount == 0)。/* Free the context39。s LDT descriptor */// Free_Segment_Descriptor(userContextldtDescriptor)。/* Free the context39。s memory */// Disable_Interrupts()。// Free(userContextmemory)。// Free(userContext)。// Enable_Interrupts()。 //釋放占用的LDT Free_Segment_Descriptor(userContextldtDescriptor)。 userContextldtDescriptor=0。 //釋放內(nèi)存空間 Free(userContextmemory)。 userContextmemory=0。 //釋放userContext本身占用的內(nèi)存 Free(userContext)。 userContext=0。}int Load_User_Program(char *exeFileData, ulong_t exeFileLength,struct Exe_Format *exeFormat, const char *mand, struct User_Context **pUserContext){ //TODO(Load a user executable into a user memory space using segmentation)。 int i。 ulong_t maxva = 0。//要分配的最大內(nèi)存空間 unsigned numArgs。//進(jìn)程數(shù)目 ulong_t argBlockSize。//參數(shù)塊的大小 ulong_t size, argBlockAddr。//參數(shù)塊地址 struct User_Context *userContext = 0。 //計(jì)算用戶(hù)態(tài)進(jìn)程所需的最大內(nèi)存空間 for (i = 0。 i exeFormatnumSegments。 ++i) { // struct Exe_Segment *segment = amp。exeFormatsegmentList[i]。 ulong_t topva = segmentstartAddress + segmentsizeInMemory。 /* FIXME: range check */ if (topva maxva) maxva = topva。 } Get_Argument_Block_Size(mand, amp。numArgs, amp。argBlockSize)。//獲取參數(shù)塊信息 size = Round_Up_To_Page(maxva) + DEFAULT_USER_STACK_SIZE。//用戶(hù)進(jìn)程大小=參數(shù)塊總大小 + 進(jìn)程堆棧大小(8192) argBlockAddr = size。 size += argBlockSize。 userContext = Create_User_Context(size)。//按相應(yīng)大小創(chuàng)建一個(gè)進(jìn)程 if (userContext == 0)//如果為核心態(tài)進(jìn)程
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1