📄 machine.java
字号:
Lib.checkMethod(clsKThread, "fork", new Class[] { }, void.class); Lib.checkMethod(clsKThread, "ready", new Class[] { }, void.class); Lib.checkMethod(clsKThread, "join", new Class[] { }, void.class); Lib.checkField(clsKThread, "schedulingState", clsObject); Lib.checkConstructor(clsCommunicator, new Class[] {}); Lib.checkMethod(clsCommunicator, "speak", new Class[] { int.class }, void.class); Lib.checkMethod(clsCommunicator, "listen", new Class[] { }, int.class); Lib.checkConstructor(clsSemaphore, new Class[] { int.class }); Lib.checkMethod(clsSemaphore, "P", new Class[] { }, void.class); Lib.checkMethod(clsSemaphore, "V", new Class[] { }, void.class); Lib.checkConstructor(clsLock, new Class[] { }); Lib.checkMethod(clsLock, "acquire", new Class[] { }, void.class); Lib.checkMethod(clsLock, "release", new Class[] { }, void.class); Lib.checkMethod(clsLock, "isHeldByCurrentThread", new Class[]{ }, boolean.class); Lib.checkConstructor(clsCondition, new Class[] { clsLock }); Lib.checkConstructor(clsCondition2, new Class[] { clsLock }); Lib.checkMethod(clsCondition, "sleep", new Class[] { }, void.class); Lib.checkMethod(clsCondition, "wake", new Class[] { }, void.class); Lib.checkMethod(clsCondition, "wakeAll", new Class[] { }, void.class); Lib.checkMethod(clsCondition2, "sleep", new Class[] { }, void.class); Lib.checkMethod(clsCondition2, "wake", new Class[] { }, void.class); Lib.checkMethod(clsCondition2, "wakeAll", new Class[] { }, void.class); Lib.checkDerivation(clsRider, clsRiderInterface); Lib.checkConstructor(clsRider, new Class[] { }); Lib.checkMethod(clsRider, "initialize", new Class[] { clsRiderControls, aclsInt }, void.class); Lib.checkDerivation(clsElevatorController, clsElevatorControllerInterface); Lib.checkConstructor(clsElevatorController, new Class[] { }); Lib.checkMethod(clsElevatorController, "initialize", new Class[] { clsElevatorControls }, void.class); } /** * Prevent instantiation. */ private Machine() { } /** * Return the hardware interrupt manager. * * @return the hardware interrupt manager. */ public static Interrupt interrupt() { return interrupt; } /** * Return the hardware timer. * * @return the hardware timer. */ public static Timer timer() { return timer; } /** * Return the hardware elevator bank. * * @return the hardware elevator bank, or <tt>null</tt> if it is not * present. */ public static ElevatorBank bank() { return bank; } /** * Return the MIPS processor. * * @return the MIPS processor, or <tt>null</tt> if it is not present. */ public static Processor processor() { return processor; } /** * Return the hardware console. * * @return the hardware console, or <tt>null</tt> if it is not present. */ public static SerialConsole console() { return console; } /** * Return the stub filesystem. * * @return the stub file system, or <tt>null</tt> if it is not present. */ public static FileSystem stubFileSystem() { return stubFileSystem; } /** * Return the network link. * * @return the network link, or <tt>null</tt> if it is not present. */ public static NetworkLink networkLink() { return networkLink; } /** * Return the autograder. * * @return the autograder. */ public static AutoGrader autoGrader() { return autoGrader; } private static Interrupt interrupt = null; private static Timer timer = null; private static ElevatorBank bank = null; private static Processor processor = null; private static SerialConsole console = null; private static FileSystem stubFileSystem = null; private static NetworkLink networkLink = null; private static AutoGrader autoGrader = null; private static String autoGraderClassName = "nachos.ag.AutoGrader"; /** * Return the name of the shell program that a user-programming kernel * must run. Make sure <tt>UserKernel.run()</tt> <i>always</i> uses this * method to decide which program to run. * * @return the name of the shell program to run. */ public static String getShellProgramName() { if (shellProgramName == null) shellProgramName = Config.getString("Kernel.shellProgram"); Lib.assert(shellProgramName != null); return shellProgramName; } private static String shellProgramName = null; /** * Return the name of the process class that the kernel should use. In * the multi-programming project, returns * <tt>nachos.userprog.UserProcess</tt>. In the VM project, returns * <tt>nachos.vm.VMProcess</tt>. In the networking project, returns * <tt>nachos.network.NetProcess</tt>. * * @return the name of the process class that the kernel should use. * * @see nachos.userprog.UserKernel#run * @see nachos.userprog.UserProcess * @see nachos.vm.VMProcess * @see nachos.network.NetProcess */ public static String getProcessClassName() { if (processClassName == null) processClassName = Config.getString("Kernel.processClassName"); Lib.assert(processClassName != null); return processClassName; } private static String processClassName = null; private static NachosSecurityManager securityManager; private static Privilege privilege; private static String[] args = null; private static Stats stats = new Stats(); private static int numPhysPages = -1; private static long randomSeed = 0; private static File baseDirectory, nachosDirectory, testDirectory; private static String configFileName = "nachos.conf"; private static final String help = "\n" + "Options:\n" + "\n" + "\t-d <debug flags>\n" + "\t\tEnable some debug flags, e.g. -d ti\n" + "\n" + "\t-h\n" + "\t\tPrint this help message.\n" + "\n" + "\t-m <pages>\n" + "\t\tSpecify how many physical pages of memory to simulate.\n" + "\n" + "\t-s <seed>\n" + "\t\tSpecify the seed for the random number generator (seed is a\n" + "\t\tlong).\n" + "\n" + "\t-x <program>\n" + "\t\tSpecify a program that UserKernel.run() should execute,\n" + "\t\tinstead of the value of the configuration variable\n" + "\t\tKernel.shellProgram\n" + "\n" + "\t-z\n" + "\t\tprint the copyright message\n" + "\n" + "\t-- <grader class>\n" + "\t\tSpecify an autograder class to use, instead of\n" + "\t\tnachos.ag.AutoGrader\n" + "\n" + "\t-# <grader arguments>\n" + "\t\tSpecify the argument string to pass to the autograder.\n" + "\n" + "\t-[] <config file>\n" + "\t\tSpecifiy a config file to use, instead of nachos.conf\n" + "" ; private static final String copyright = "\n" + "Copyright 1992-2001 The Regents of the University of California.\n" + "All rights reserved.\n" + "\n" + "Permission to use, copy, modify, and distribute this software and\n" + "its documentation for any purpose, without fee, and without\n" + "written agreement is hereby granted, provided that the above\n" + "copyright notice and the following two paragraphs appear in all\n" + "copies of this software.\n" + "\n" + "IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY\n" + "PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL\n" + "DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS\n" + "DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN\n" + "ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "\n" + "THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY\n" + "WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" + "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE\n" + "SOFTWARE PROVIDED HEREUNDER IS ON AN \"AS IS\" BASIS, AND THE\n" + "UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE\n" + "MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n" ; private static class MachinePrivilege implements Privilege.MachinePrivilege { public void setConsole(SerialConsole console) { Machine.console = console; } } // dummy variables to make javac smarter private static Coff dummy1 = null;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -