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

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

?? translate.cpp

?? LINUX 下NACHOS 系統的頁面調度算法的實現
?? CPP
字號:
// translate.cc //      Routines to translate virtual addresses to physical addresses.//      Software sets up a table of legal translations.  We look up//      in the table on every memory reference to find the true physical//      memory location.//// Two types of translation are supported here.////      Linear page table -- the virtual page # is used as an index//      into the table, to find the physical page #.////      Translation lookaside buffer -- associative lookup in the table//      to find an entry with the same virtual page #.  If found,//      this entry is used for the translation.//      If not, it traps to software with an exception. ////      In practice, the TLB is much smaller than the amount of physical//      memory (16 entries is common on a machine that has 1000's of//      pages).  Thus, there must also be a backup translation scheme//      (such as page tables), but the hardware doesn't need to know//      anything at all about that.////      Note that the contents of the TLB are specific to an address space.//      If the address space changes, so does the contents of the TLB!//// DO NOT CHANGE -- part of the machine emulation//// 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 "machine.h"#include "addrspace.h"#include "system.h"// Routines for converting Words and Short Words to and from the// simulated machine's format of little endian.  These end up// being NOPs when the host machine is also little endian (DEC and Intel).unsigned intWordToHost(unsigned int word) {#ifdef HOST_IS_BIG_ENDIAN         register unsigned long result;         result = (word >> 24) & 0x000000ff;         result |= (word >> 8) & 0x0000ff00;         result |= (word << 8) & 0x00ff0000;         result |= (word << 24) & 0xff000000;         return result;#else          return word;#endif /* HOST_IS_BIG_ENDIAN */}unsigned shortShortToHost(unsigned short shortword) {#ifdef HOST_IS_BIG_ENDIAN         register unsigned short result;         result = (shortword << 8) & 0xff00;         result |= (shortword >> 8) & 0x00ff;         return result;#else          return shortword;#endif /* HOST_IS_BIG_ENDIAN */}unsigned intWordToMachine(unsigned int word) { return WordToHost(word); }unsigned shortShortToMachine(unsigned short shortword) { return ShortToHost(shortword); }//----------------------------------------------------------------------// Machine::ReadMem//      Read "size" (1, 2, or 4) bytes of virtual memory at "addr" into //      the location pointed to by "value".////      Returns FALSE if the translation step from virtual to physical memory//      failed.////      "addr" -- the virtual address to read from//      "size" -- the number of bytes to read (1, 2, or 4)//      "value" -- the place to write the result//----------------------------------------------------------------------boolMachine::ReadMem(int addr, int size, int *value){    int data;    ExceptionType exception;    int physicalAddress;        DEBUG('a', "Reading VA 0x%x, size %d\n", addr, size);    exception = Translate(addr, &physicalAddress, size, FALSE);    if (exception != NoException) {        machine->RaiseException(exception, addr);        return FALSE;    }    switch (size) {      case 1:        data = machine->mainMemory[physicalAddress];        *value = data;        break;              case 2:        data = *(unsigned short *) &machine->mainMemory[physicalAddress];        *value = ShortToHost(data);        break;              case 4:        data = *(unsigned int *) &machine->mainMemory[physicalAddress];        *value = WordToHost(data);        break;      default: ASSERT(FALSE);    }        DEBUG('a', "\tvalue read = %8.8x\n", *value);    return (TRUE);}//----------------------------------------------------------------------// Machine::WriteMem//      Write "size" (1, 2, or 4) bytes of the contents of "value" into//      virtual memory at location "addr".////      Returns FALSE if the translation step from virtual to physical memory//      failed.////      "addr" -- the virtual address to write to//      "size" -- the number of bytes to be written (1, 2, or 4)//      "value" -- the data to be written//----------------------------------------------------------------------boolMachine::WriteMem(int addr, int size, int value){    ExceptionType exception;    int physicalAddress;         DEBUG('a', "Writing VA 0x%x, size %d, value 0x%x\n", addr, size, value);    exception = Translate(addr, &physicalAddress, size, TRUE);    if (exception != NoException) {        machine->RaiseException(exception, addr);        return FALSE;    }    switch (size) {      case 1:        machine->mainMemory[physicalAddress] = (unsigned char) (value & 0xff);        break;      case 2:        *(unsigned short *) &machine->mainMemory[physicalAddress]                = ShortToMachine((unsigned short) (value & 0xffff));        break;            case 4:        *(unsigned int *) &machine->mainMemory[physicalAddress]                = WordToMachine((unsigned int) value);        break;              default: ASSERT(FALSE);    }        return TRUE;}//----------------------------------------------------------------------// Machine::Translate//      Translate a virtual address into a physical address, using //      either a page table or a TLB.  Check for alignment and all sorts //      of other errors, and if everything is ok, set the use/dirty bits in //      the translation table entry, and store the translated physical //      address in "physAddr".  If there was an error, returns the type//      of the exception.////      "virtAddr" -- the virtual address to translate//      "physAddr" -- the place to store the physical address//      "size" -- the amount of memory being read or written//      "writing" -- if TRUE, check the "read-only" bit in the TLB//----------------------------------------------------------------------ExceptionTypeMachine::Translate(int virtAddr, int* physAddr, int size, bool writing){    int i;    unsigned int vpn, offset;    TranslationEntry *entry;    unsigned int pageFrame;    DEBUG('a', "\tTranslate 0x%x, %s: ", virtAddr, writing ? "write" : "read");// check for alignment errors    if (((size == 4) && (virtAddr & 0x3)) || ((size == 2) && (virtAddr & 0x1))){        DEBUG('a', "alignment problem at %d, size %d!\n", virtAddr, size);        return AddressErrorException;    }        // we must have either a TLB or a page table, but not both!    ASSERT(tlb == NULL || pageTable == NULL);       ASSERT(tlb != NULL || pageTable != NULL);   // calculate the virtual page number, and offset within the page,// from the virtual address    vpn = (unsigned) virtAddr / PageSize;    offset = (unsigned) virtAddr % PageSize;        if (tlb == NULL) {          // => page table => vpn is index into table        if (vpn >= pageTableSize) {            DEBUG('a', "virtual page # %d (addr %d) too large for page table size %d!\n",                         vpn,virtAddr, pageTableSize);            return AddressErrorException;        } else if (!pageTable[vpn].valid) {            DEBUG('a', "virtual page # %d (addr %d) not valid (page fault!)\n",                         vpn, virtAddr);            return PageFaultException;        }        entry = &pageTable[vpn];    } else {        for (entry = NULL, i = 0; i < TLBSize; i++)            if (tlb[i].valid && (tlb[i].virtualPage == vpn)) {                entry = &tlb[i];                        // FOUND!                break;            }        if (entry == NULL) {                            // not found            DEBUG('a', "*** no valid TLB entry found for this virtual page!\n");            return PageFaultException;          // really, this is a TLB fault,                                                // the page may be in memory,                                                // but not in the TLB        }    }    if (entry->readOnly && writing) {   // trying to write to a read-only page        DEBUG('a', "%d mapped read-only at %d in TLB!\n", virtAddr, i);        return ReadOnlyException;    }    pageFrame = entry->physicalPage;    // if the pageFrame is too big, there is something really wrong!     // An invalid translation was loaded into the page table or TLB.     if (pageFrame >= NumPhysPages) {         DEBUG('a', "*** frame %d > %d!\n", pageFrame, NumPhysPages);        return BusErrorException;    }    entry->use = TRUE;          // set the use, dirty bits    if (writing)        entry->dirty = TRUE;    *physAddr = pageFrame * PageSize + offset;    ASSERT((*physAddr >= 0) && ((*physAddr + size) <= MemorySize));    DEBUG('a', "phys addr = 0x%x\n", *physAddr);    /* ******************************************************************* */    /*                                                                     */    /* CHANGES FOR MP3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */    entry->timeStamp = stats->totalTicks;    if(extraVerbose)            printf("(ref:%d,%d)%c", pageFrame, entry->timeStamp,                ( ++formatCount % 5 == 0 ? '\n' : ','));    /*                                                                     */    /*                                                                     */    /* ******************************************************************* */    return NoException;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三区在线观看| 久久综合色鬼综合色| 色婷婷久久99综合精品jk白丝| 东方欧美亚洲色图在线| 国产**成人网毛片九色| 国产99久久久国产精品| av一区二区不卡| 91丨九色丨蝌蚪丨老版| 欧美午夜电影网| 欧美精品在线一区二区三区| 欧美一级在线视频| 欧美精品一区二区三区蜜桃视频| 精品电影一区二区| 国产精品久久久爽爽爽麻豆色哟哟 | 日韩综合小视频| 秋霞成人午夜伦在线观看| 精品一区二区免费视频| 东方aⅴ免费观看久久av| 99久久er热在这里只有精品66| 色素色在线综合| 一区精品在线播放| 一区二区三区精品视频| 午夜成人免费电影| 精品一区免费av| 大美女一区二区三区| 99久久伊人网影院| 欧美日韩日日摸| 欧美一区二区在线视频| 久久精品夜色噜噜亚洲aⅴ| 国产精品不卡一区二区三区| 亚洲国产精品久久人人爱蜜臀| 老司机免费视频一区二区三区| 国产精品一级片| 91麻豆.com| 欧美一区二区三区公司| 国产精品情趣视频| 香蕉久久一区二区不卡无毒影院| 另类小说一区二区三区| 99久久精品免费| 日韩亚洲欧美综合| 亚洲欧洲精品一区二区三区不卡 | 99re热视频精品| 欧美自拍丝袜亚洲| 久久久久久久久久看片| 亚洲激情av在线| 国内精品伊人久久久久av一坑| 91丨九色porny丨蝌蚪| 日韩欧美国产麻豆| 亚洲精品久久久蜜桃| 久久精品99国产国产精| 91国产免费观看| 精品国产成人在线影院| 亚洲国产一区二区三区青草影视| 精品一区二区国语对白| 在线免费精品视频| 国产网红主播福利一区二区| 亚洲午夜在线视频| 国产91色综合久久免费分享| 欧美视频自拍偷拍| 国产精品美女一区二区在线观看| 日韩高清不卡一区二区三区| 91网上在线视频| 久久久久久久综合狠狠综合| 午夜精品123| 一本色道久久加勒比精品| 久久久久国色av免费看影院| 日韩电影在线观看电影| 91行情网站电视在线观看高清版| 久久午夜羞羞影院免费观看| 丝袜脚交一区二区| 国产欧美一区二区在线观看| 美女在线一区二区| 欧美性色aⅴ视频一区日韩精品| 国产视频在线观看一区二区三区| 日韩高清不卡一区二区| 欧美性猛片xxxx免费看久爱| 国产精品美女久久久久久2018| 国产一区二区三区免费观看| 欧美美女一区二区在线观看| 一区二区三区四区激情| 成人激情小说网站| 欧美国产禁国产网站cc| 国产一区二区三区不卡在线观看| 欧美一级欧美三级| 日韩国产欧美在线观看| 欧美乱妇23p| 亚洲一区成人在线| 色999日韩国产欧美一区二区| 1000部国产精品成人观看| 粉嫩久久99精品久久久久久夜| 精品少妇一区二区三区视频免付费 | 成人精品一区二区三区四区 | 亚洲曰韩产成在线| 91在线国产福利| 国产精品卡一卡二| 成人激情小说乱人伦| 欧美极品少妇xxxxⅹ高跟鞋 | 在线观看视频欧美| 一区二区三区高清| 91福利在线看| 亚洲视频免费看| 97se亚洲国产综合在线| 亚洲视频狠狠干| 国产清纯白嫩初高生在线观看91| 国产另类ts人妖一区二区| 久久亚洲一级片| 国产成人综合精品三级| 国产嫩草影院久久久久| www.欧美色图| 一区二区三区高清| 欧美日韩高清不卡| 男人的j进女人的j一区| 欧美大片在线观看一区| 国产成人免费在线视频| 亚洲欧洲日韩在线| 欧美性感一区二区三区| 天天亚洲美女在线视频| 精品国产污污免费网站入口| 国产成人免费在线| 亚洲视频在线一区观看| 欧美三级电影在线观看| 日韩电影在线一区二区| 久久婷婷国产综合精品青草| 大桥未久av一区二区三区中文| 欧美一级夜夜爽| 国产在线视频一区二区| 国产亚洲一区二区三区四区| 成人毛片视频在线观看| 亚洲最色的网站| 在线电影欧美成精品| 国产精品1024久久| 亚洲精品福利视频网站| 欧美一区二区三区四区高清| 国产一区日韩二区欧美三区| 自拍偷拍欧美精品| 777奇米四色成人影色区| 国产福利一区二区三区视频在线| 亚洲另类在线视频| 日韩欧美一区在线| 成人h动漫精品| 亚洲电影你懂得| 久久亚洲精品小早川怜子| 一本色道亚洲精品aⅴ| 免费人成精品欧美精品| 国产日韩精品久久久| 欧美日韩一区在线| 国产高清亚洲一区| 午夜精品一区在线观看| 日本一区二区三区国色天香 | 国产999精品久久| 亚洲自拍偷拍欧美| 久久久综合激的五月天| 欧美亚洲精品一区| 国产91精品一区二区麻豆网站| 亚洲一二三区不卡| 亚洲国产精品av| 日韩一级欧美一级| 色美美综合视频| 国产又粗又猛又爽又黄91精品| 一区二区三区丝袜| 日本一区免费视频| 日韩美女主播在线视频一区二区三区| 99国产精品99久久久久久| 蜜桃精品视频在线观看| 成人免费av网站| 麻豆成人91精品二区三区| 一区二区三区色| 国产精品少妇自拍| 久久综合狠狠综合久久综合88| 欧美日韩在线综合| 99久久久国产精品免费蜜臀| 韩国一区二区三区| 免费成人在线影院| 亚洲国产精品欧美一二99| 国产精品精品国产色婷婷| 久久久亚洲精品一区二区三区| 欧美日韩国产一级| 色乱码一区二区三区88| 国产91精品入口| 精品中文字幕一区二区小辣椒| 亚洲高清免费观看高清完整版在线观看| 国产精品免费网站在线观看| www国产成人| 91精品国产高清一区二区三区| 日本丶国产丶欧美色综合| 大白屁股一区二区视频| 国产一区二区女| 国产一区免费电影| 精品制服美女久久| 麻豆精品在线播放| 视频在线观看一区二区三区| 亚洲综合一二三区| 亚洲精品第1页| 亚洲欧美偷拍三级| 国产精品区一区二区三区| 欧美韩日一区二区三区四区| 国产欧美视频在线观看| 国产日韩三级在线| 国产拍欧美日韩视频二区| 国产无人区一区二区三区|