亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? addrspace.cc

?? linux的例子,就是下載后到自己的機子上去運行
?? CC
字號:
// addrspace.cc //	Routines to manage address spaces (executing user programs).////	In order to run a user program, you must:////	1. link with the -N -T 0 option //	2. run coff2noff to convert the object file to Nachos format//		(Nachos object code format is essentially just a simpler//		version of the UNIX executable object code format)//	3. load the NOFF file into the Nachos file system//		(if you haven't implemented the file system yet, you//		don't need to do this last step)//// Copyright (c) 1992-1993 The Regents of the University of California.// All rights reserved.  See copyright.h for copyright notice and limitation // of liability and disclaimer of warranty provisions.#include "copyright.h"#include "system.h"#include "addrspace.h"#include "noff.h"#ifdef HOST_SPARC#include <strings.h>#endifint  fileoffset;//----------------------------------------------------------------------// SwapHeader// 	Do little endian to big endian conversion on the bytes in the //	object file header, in case the file was generated on a little//	endian machine, and we're now running on a big endian machine.//----------------------------------------------------------------------static void SwapHeader (NoffHeader *noffH){	noffH->noffMagic = WordToHost(noffH->noffMagic);	noffH->code.size = WordToHost(noffH->code.size);	noffH->code.virtualAddr = WordToHost(noffH->code.virtualAddr);	noffH->code.inFileAddr = WordToHost(noffH->code.inFileAddr);	noffH->initData.size = WordToHost(noffH->initData.size);	noffH->initData.virtualAddr = WordToHost(noffH->initData.virtualAddr);	noffH->initData.inFileAddr = WordToHost(noffH->initData.inFileAddr);	noffH->uninitData.size = WordToHost(noffH->uninitData.size);	noffH->uninitData.virtualAddr = WordToHost(noffH->uninitData.virtualAddr);	noffH->uninitData.inFileAddr = WordToHost(noffH->uninitData.inFileAddr);}//----------------------------------------------------------------------// AddrSpace::AddrSpace// 	Create an address space to run a user program.//	Load the program from a file "executable", and set everything//	up so that we can start executing user instructions.////	Assumes that the object code file is in NOFF format.////	First, set up the translation from program memory to physical //	memory.  For now, this is really simple (1:1), since we are//	only uniprogramming, and we have a single unsegmented page table////	"executable" is the file containing the object code to load into memory//----------------------------------------------------------------------AddrSpace::AddrSpace(){	mm = new MemoryManager();	spaceid = 0;}voidAddrSpace::AssignMem(OpenFile *executable){    NoffHeader noffH;    unsigned int  size;    int count1,count2,restSize1,restSize2;    executable->ReadAt((char *)&noffH, sizeof(noffH), 0);    if ((noffH.noffMagic != NOFFMAGIC) && 		(WordToHost(noffH.noffMagic) == NOFFMAGIC))    	SwapHeader(&noffH);    ASSERT(noffH.noffMagic == NOFFMAGIC);// how big is address space?    size = noffH.code.size + noffH.initData.size + noffH.uninitData.size 			+ UserStackSize;	// we need to increase the size						// to leave room for the stack    numPages = divRoundUp(size, PageSize);    size = numPages * PageSize;    ASSERT(numPages <= NumPhysPages);		// check we're not trying						// to run anything too big --						// at least until we have						// virtual memory    DEBUG('a', "Initializing address space, num pages %d, size %d\n", 					numPages, size);// first, set up the translation     pageTable = new TranslationEntry[numPages];     if((mm->Assign(numPages,pageTable))==false){	printf("Memory Limit\n");	interrupt->Halt();	return;    }// then, copy in the code and data segments into memory    if (noffH.code.size > 0) {        DEBUG('a', "Initializing code segment, at 0x%x, size %d\n", 			noffH.code.virtualAddr, noffH.code.size);	count1=divRoundUp(noffH.code.size,PageSize);	restSize1 = noffH.code.size%PageSize;	for(int i=0;i<count1;i++){		if((i == count1-1) && restSize1!=0)		{			executable->ReadAt(&(machine->mainMemory[(pageTable[i].physicalPage)*PageSize]),restSize1,noffH.code.inFileAddr+i*PageSize);				}		else			executable->ReadAt(&(machine->mainMemory[(pageTable[i].physicalPage)*PageSize]),PageSize,noffH.code.inFileAddr+i*PageSize);	}	//printf("count1=%d   PageSize=%d  noffH.code.size=%d  noffH.code.virtualAddr=%d\n",count1,PageSize,noffH.code.size,noffH.code.virtualAddr);//        executable->ReadAt(&(machine->mainMemory[noffH.code.virtualAddr]),noffH.code.size, noffH.code.inFileAddr);    }    if (noffH.initData.size > 0) {        DEBUG('a', "Initializing data segment, at 0x%x, size %d\n", 			noffH.initData.virtualAddr, noffH.initData.size);	int restSize=0;	if(restSize1!=0){		restSize = PageSize-restSize1;		fileoffset=pageTable[count1-1].physicalPage*PageSize+restSize1;		executable->ReadAt(&(machine->mainMemory[pageTable[count1-1].physicalPage*PageSize+restSize1]),restSize,noffH.initData.inFileAddr);	}	else		fileoffset=count1*PageSize;	count2=divRoundUp(noffH.initData.size-restSize,PageSize);	restSize2 = (noffH.initData.size-restSize) % PageSize;	for(int i=0;i<count2;i++){		if((i == count2-1) && restSize2!=0)			executable->ReadAt(&(machine->mainMemory[pageTable[i].physicalPage*PageSize]),restSize2,noffH.initData.inFileAddr+i*PageSize+restSize);		else 			executable->ReadAt(&(machine->mainMemory[pageTable[i].physicalPage*PageSize]),PageSize,noffH.initData.inFileAddr+i*PageSize+restSize);	}	//printf("count2=%d   PageSize=%d  noffH.initData.size=%d  noffH.initData.virtualAddr=%d \n",count2,PageSize,noffH.initData.size,noffH.initData.virtualAddr);//        executable->ReadAt(&(machine->mainMemory[noffH.initData.virtualAddr]),noffH.initData.size, noffH.initData.inFileAddr);    }}voidAddrSpace::Reclaim() {	mm->Release(numPages,pageTable);}void AddrSpace::setSpaceid(int id) {	spaceid = id;}int AddrSpace::getSpaceid() {	return spaceid;}	//----------------------------------------------------------------------// AddrSpace::~AddrSpace// 	Dealloate an address space.  Nothing for now!//----------------------------------------------------------------------AddrSpace::~AddrSpace(){   delete mm;}//----------------------------------------------------------------------// AddrSpace::InitRegisters// 	Set the initial values for the user-level register set.//// 	We write these directly into the "machine" registers, so//	that we can immediately jump to user code.  Note that these//	will be saved/restored into the currentThread->userRegisters//	when this thread is context switched out.//----------------------------------------------------------------------voidAddrSpace::InitRegisters(){    int i;    for (i = 0; i < NumTotalRegs; i++)	machine->WriteRegister(i, 0);    // Initial program counter -- must be location of "Start"    machine->WriteRegister(PCReg, 0);	    // Need to also tell MIPS where next instruction is, because    // of branch delay possibility    machine->WriteRegister(NextPCReg, 4);   // Set the stack register to the end of the address space, where we   // allocated the stack; but subtract off a bit, to make sure we don't   // accidentally reference off the end!    machine->WriteRegister(StackReg, numPages * PageSize - 16);    DEBUG('a', "Initializing stack register to %d\n", numPages * PageSize - 16);}//----------------------------------------------------------------------// AddrSpace::SaveState// 	On a context switch, save any machine state, specific//	to this address space, that needs saving.////	For now, nothing!//----------------------------------------------------------------------void AddrSpace::SaveState() {}//----------------------------------------------------------------------// AddrSpace::RestoreState// 	On a context switch, restore the machine state so that//	this address space can run.////      For now, tell the machine where to find the page table.//----------------------------------------------------------------------void AddrSpace::RestoreState() {    machine->pageTable = pageTable;    machine->pageTableSize = numPages;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线观看一区| 欧美一级一区二区| 午夜av一区二区| 久久久久成人黄色影片| 欧美体内she精高潮| 国产精品中文字幕日韩精品| 国产精品国产三级国产有无不卡 | 欧美美女喷水视频| 国产69精品久久久久777| 日韩综合一区二区| 中文字幕精品在线不卡| 欧美成人精品福利| 欧美男生操女生| 色综合久久久久久久| 国产成人精品亚洲午夜麻豆| 奇米精品一区二区三区在线观看 | 精品免费99久久| 91国在线观看| 成人aaaa免费全部观看| 韩国精品免费视频| 乱中年女人伦av一区二区| 亚洲一区二区三区四区中文字幕| 国产欧美日韩视频一区二区| 日韩一区二区在线看| 在线观看不卡视频| 一本在线高清不卡dvd| 成人sese在线| 国产精品一区二区在线看| 麻豆精品新av中文字幕| 丝袜亚洲另类丝袜在线| 亚洲成人动漫一区| 夜夜精品浪潮av一区二区三区| 最新热久久免费视频| 国产精品欧美久久久久无广告| 久久免费精品国产久精品久久久久| 欧美一区二区三区在线看| 欧美日韩国产首页在线观看| 91免费版在线看| 91一区在线观看| 成人97人人超碰人人99| 成人av第一页| 91麻豆免费看| 日本高清视频一区二区| 91一区二区三区在线观看| 99国产精品视频免费观看| 国产一区二区三区国产| 久久99最新地址| 国产一区二区三区在线观看精品 | 久久久噜噜噜久久中文字幕色伊伊| 91精品国产综合久久精品| 欧美精品黑人性xxxx| 欧美巨大另类极品videosbest | 婷婷丁香久久五月婷婷| 视频一区二区国产| 免费精品视频最新在线| 在线观看日韩国产| 亚洲综合一区在线| 亚洲精品国产a| 日韩一区日韩二区| 亚洲人成影院在线观看| 一区二区三区电影在线播| 亚洲成av人影院在线观看网| 日韩电影在线一区二区三区| 激情综合网激情| 成人动漫视频在线| 色哟哟一区二区| 69久久99精品久久久久婷婷| 精品三级av在线| 国产精品九色蝌蚪自拍| 亚洲成人你懂的| 亚洲地区一二三色| 狠狠狠色丁香婷婷综合久久五月| 国产高清不卡二三区| 91在线无精精品入口| 欧美日韩国产精品成人| 欧美成人精精品一区二区频| 久久女同精品一区二区| 亚洲嫩草精品久久| 日本成人在线网站| 成人午夜碰碰视频| 色播五月激情综合网| 日韩欧美在线综合网| 国产精品乱人伦一区二区| 亚洲va欧美va天堂v国产综合| 韩国女主播成人在线观看| av综合在线播放| 日韩欧美一区二区在线视频| 国产精品免费视频观看| 日本强好片久久久久久aaa| 高清不卡一二三区| 欧美伦理影视网| 亚洲国产激情av| 日本午夜一区二区| 92精品国产成人观看免费| 91精品欧美福利在线观看| 中文字幕在线一区免费| 美腿丝袜亚洲色图| 在线观看国产日韩| 欧美激情自拍偷拍| 日韩国产欧美一区二区三区| 成人免费毛片高清视频| 日韩欧美区一区二| 亚洲综合一二三区| 成人av一区二区三区| 欧美日韩国产精品自在自线| 国产人成一区二区三区影院| 亚洲电影中文字幕在线观看| 国产成人av一区二区三区在线观看| 欧美中文字幕一区二区三区| 久久综合狠狠综合久久综合88| 尤物av一区二区| 成人爱爱电影网址| www激情久久| 蜜臀av国产精品久久久久| 色老综合老女人久久久| 国产欧美一区二区精品久导航 | 久久久国际精品| 日本伊人精品一区二区三区观看方式| 91亚洲永久精品| 国产日韩v精品一区二区| 黑人巨大精品欧美一区| 日韩色视频在线观看| 丝袜亚洲另类欧美| 在线观看日产精品| 夜夜精品视频一区二区| 91视频免费观看| 国产精品天干天干在线综合| 寂寞少妇一区二区三区| 精品精品国产高清a毛片牛牛| 日本女人一区二区三区| 91精品久久久久久久91蜜桃 | 亚洲美女一区二区三区| 国产91精品精华液一区二区三区| 日韩精品在线一区| 乱中年女人伦av一区二区| 日韩视频免费观看高清完整版| 日韩国产精品久久久久久亚洲| 欧美视频一区二区三区在线观看| 一片黄亚洲嫩模| 欧美日韩你懂的| 亚洲成人1区2区| 7777精品伊人久久久大香线蕉经典版下载| 亚洲一区在线观看免费| 欧美三区在线观看| 亚洲综合丝袜美腿| 欧美日韩久久久久久| 天天综合网 天天综合色| 欧美另类变人与禽xxxxx| 午夜精品福利一区二区三区蜜桃| 欧美日韩一二三区| 日韩av一区二区三区四区| 欧美一级午夜免费电影| 国内欧美视频一区二区| 久久综合久久99| 国产成人免费视频网站高清观看视频| 国产人成一区二区三区影院| av在线不卡电影| 亚洲精品菠萝久久久久久久| 色婷婷久久久久swag精品 | 日韩成人免费看| 精品国产一区二区在线观看| 国产精品18久久久久| 中文字幕一区二区三区蜜月| 欧美中文字幕一区二区三区亚洲| 免费黄网站欧美| 日本一区二区三区电影| 日本精品视频一区二区三区| 日韩av在线免费观看不卡| 久久嫩草精品久久久精品一| 99久久99精品久久久久久| 亚洲v日本v欧美v久久精品| 欧美精品一区二区三区四区| 9l国产精品久久久久麻豆| 亚洲高清免费在线| 久久久五月婷婷| 色偷偷成人一区二区三区91| 欧美aaaaa成人免费观看视频| 国产亚洲欧美色| 91麻豆免费视频| 久久97超碰国产精品超碰| 国产精品久久毛片av大全日韩| 欧美丝袜自拍制服另类| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲激情网站免费观看| 精品国产电影一区二区| 91视频国产观看| 美日韩黄色大片| 亚洲卡通动漫在线| 亚洲精品一区在线观看| 色欧美日韩亚洲| 精品一区二区成人精品| 亚洲视频免费看| 欧美电影免费观看高清完整版在| 91小宝寻花一区二区三区| 久久精品噜噜噜成人av农村| 一区二区三区免费网站| 国产欧美一区二区精品性色超碰| 欧美日韩中文一区| 91色视频在线| 激情综合色播五月|