code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
// utility.h // Miscellaneous useful definitions, including debugging routines. // // The debugging routines allow the user to turn on selected // debugging messages, controllable from the command line arguments // passed to Nachos (-d). You are encouraged to add your own // debugging flags. The pre-defined debuggin...
07os405
trunk/nachos/code/threads/utility.h
C
mit
3,031
// main.cc // Bootstrap code to initialize the operating system kernel. // // Allows direct calls into internal operating system functions, // to simplify debugging and testing. In practice, the // bootstrap code would just initialize data structures, // and start a user program to print the login prompt. // // Most...
07os405
trunk/nachos/code/threads/main.cc
C++
mit
6,546
# NOTE: this is a GNU Makefile. You must use "gmake" rather than "make". # # Makefile for the threads assignment. The threads assignment must # be done first! # # Copyright (c) 1992 The Regents of the University of California. # All rights reserved. See copyright.h for copyright notice and limitation # of liabilit...
07os405
trunk/nachos/code/threads/Makefile
Makefile
mit
12,334
// list.cc // // Routines to manage a singly-linked list of "things". // // A "ListElement" is allocated for each item to be put on the // list; it is de-allocated when the item is removed. This means // we don't need to keep a "next" pointer in every object we // want to put on a list. // //...
07os405
trunk/nachos/code/threads/list.cc
C++
mit
8,360
// scheduler.cc // Routines to choose the next thread to run, and to dispatch to // that thread. // // These routines assume that interrupts are already disabled. // If interrupts are disabled, we can assume mutual exclusion // (since we are on a uniprocessor). // // NOTE: We can't use Locks to provide mutual exclus...
07os405
trunk/nachos/code/threads/scheduler.cc
C++
mit
5,115
// synchlist.h // Data structures for synchronized access to a list. // // Implemented by surrounding the List abstraction // with synchronization routines. // // Copyright (c) 1992-1993 The Regents of the University of California. // All rights reserved. See copyright.h for copyright notice and limitation /...
07os405
trunk/nachos/code/threads/synchlist.h
C++
mit
1,844
// synch.cc // Routines for synchronizing threads. Three kinds of // synchronization routines are defined here: semaphores, locks // and condition variables (the implementation of the last two // are left to the reader). // // Any implementation of a synchronization routine needs some // primitive atomic operatio...
07os405
trunk/nachos/code/threads/synch.cc
C++
mit
8,592
// scheduler.h // Data structures for the thread dispatcher and scheduler. // Primarily, the list of threads that are ready to run. // // 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 ...
07os405
trunk/nachos/code/threads/scheduler.h
C++
mit
1,215
/* switch.s * Machine dependent context switch routines. DO NOT MODIFY THESE! * * Context switching is inherently machine dependent, since * the registers to be saved, how to set up an initial * call frame, etc, are all specific to a processor architecture. * * This file currently supports the following a...
07os405
trunk/nachos/code/threads/switch.s
Unix Assembly
mit
9,083
// synchlist.cc // Routines for synchronized access to a list. // // Implemented by surrounding the List abstraction // with synchronization routines. // // Implemented in "monitor"-style -- surround each procedure with a // lock acquire and release pair, using condition signal and wait for // synchronizatio...
07os405
trunk/nachos/code/threads/synchlist.cc
C++
mit
5,357
// list.h // Data structures to manage LISP-like lists. // // As in LISP, a list can contain any type of data structure // as an item on the list: thread control blocks, // pending interrupts, etc. That is why each item is a "void *", // or in other words, a "pointers to anything". // // Copyright (c)...
07os405
trunk/nachos/code/threads/list.h
C++
mit
2,515
// synch.h // Data structures for synchronizing threads. // // Three kinds of synchronization are defined here: semaphores, // locks, and condition variables. The implementation for // semaphores is given; for the latter two, only the procedure // interface is given -- they are to be implemented as part of //...
07os405
trunk/nachos/code/threads/synch.h
C++
mit
6,133
// thread.h // Data structures for managing threads. A thread represents // sequential execution of code within a program. // So the state of a thread includes the program counter, // the processor registers, and the execution stack. // // Note that because we allocate a fixed size stack for each // thread, it is p...
07os405
trunk/nachos/code/threads/thread.h
C++
mit
4,970
/* switch.s * Machine dependent context switch routines. DO NOT MODIFY THESE! * * Context switching is inherently machine dependent, since * the registers to be saved, how to set up an initial * call frame, etc, are all specific to a processor architecture. * * This file currently supports the following a...
07os405
trunk/nachos/code/threads/switch.c
C
mit
9,083
#ifndef __NACHBOOL_H__ #define __NACHBOOL_H__ 1 #define FALSE 0 #define TRUE 1 #endif
07os405
trunk/nachos/code/threads/bool.h
C
mit
91
.text .align 2 .globl ThreadRoot ThreadRoot: pushl %ebp movl %esp,%ebp pushl %edx call *%ecx call *%esi call *%edi movl %ebp,%esp popl %ebp ret .comm _eax_save,4 .globl SWITCH SWITCH: movl %eax,_eax_s...
07os405
trunk/nachos/code/threads/swtch.s
Unix Assembly
mit
1,402
// utility.cc // Debugging routines. Allows users to control whether to // print DEBUG statements, based on a command line argument. // // 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 ...
07os405
trunk/nachos/code/threads/utility.cc
C++
mit
2,117
/* switch.h * Definitions needed for implementing context switching. * * Context switching is inherently machine dependent, since * the registers to be saved, how to set up an initial * call frame, etc, are all specific to a processor architecture. * * This file currently supports the DEC MIPS and SUN SPARC arc...
07os405
trunk/nachos/code/threads/switch.h
C
mit
3,806
/* Copyright (c) 1992-1993 The Regents of the University of California. All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without written agreement is hereby granted, provided that the above copyright notice and the following two ...
07os405
trunk/nachos/code/threads/copyright.h
C
mit
1,229
/* switch.s * Machine dependent context switch routines. DO NOT MODIFY THESE! * * Context switching is inherently machine dependent, since * the registers to be saved, how to set up an initial * call frame, etc, are all specific to a processor architecture. * * This file currently supports the following a...
07os405
trunk/nachos/code/threads/switch-old.s
Unix Assembly
mit
3,808
// system.cc // Nachos initialization and cleanup routines. // // 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" // Thi...
07os405
trunk/nachos/code/threads/system.cc
C++
mit
8,667
// system.h // All global variables used in Nachos are defined here. // // 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. #ifndef SYSTEM_H #define SYSTEM_H #inclu...
07os405
trunk/nachos/code/threads/system.h
C
mit
1,794
// thread.cc // Routines to manage threads. There are four main operations: // // Fork -- create a thread to run a procedure concurrently // with the caller (this is done in two steps -- first // allocate the Thread object, then call Fork on it) // Finish -- called when the forked procedure finishes, to clean up //...
07os405
trunk/nachos/code/threads/thread.cc
C++
mit
11,461
# Copyright (c) 1992 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. MAKE = gmake LPR = lpr all: cd threads; $(MAKE) depend cd threads; $(MAKE) nachos cd userprog; $(MAKE) depend cd us...
07os405
trunk/nachos/code/Makefile
Makefile
mit
1,130
// exception.cc // Entry point into the Nachos kernel from user programs. // There are two kinds of things that can cause control to // transfer back to here from user code: // // syscall -- The user code explicitly requests to call a procedure // in the Nachos kernel. Right now, the only function we support is ...
07os405
trunk/nachos/code/userprog/exception.cc
C++
mit
19,357
// processmanager.h // Defines PCB class -- Data structures to keep necessary information about a process, // Such as PID, parent PID, Thread*, and thread status. // // Defines ProcessManager class -- like memory manager function, return an unused process // id, clear a process id respectively by using a bitmap, store ...
07os405
trunk/nachos/code/userprog/processmanager.h
C++
mit
2,341
# NOTE: this is a GNU Makefile. You must use "gmake" rather than "make". # # Makefile for the virtual memory assignment # Defines set up assuming the virtual memory assignment is done before # the file system assignment. If not, use the "filesys first" # defines below. # # Also, if you want to simplify the tra...
07os405
trunk/nachos/code/userprog/Makefile
Makefile
mit
29,925
/* syscalls.h * Nachos system call interface. These are Nachos kernel operations * that can be invoked from user programs, by trapping to the kernel * via the "syscall" instruction. * * This file is included by user programs and by the Nachos kernel. * * Copyright (c) 1992-1993 The Regents of the University...
07os405
trunk/nachos/code/userprog/syscall.h
C
mit
3,865
// 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 ...
07os405
trunk/nachos/code/userprog/addrspace.cc
C++
mit
13,807
// useropenfile.h // Defines UserOpenFile class contains an index into the global SysOpenFile table and // an integer offset represeting a process's current position in that file. // // Created on: Dec 10, 2009 // Author: qi #ifndef USEROPENFILE_H_ #define USEROPENFILE_H_ class UserOpenFile{ public: int fileInd...
07os405
trunk/nachos/code/userprog/useropenfile.h
C++
mit
469
// SysOpenFile.h // Defines SysOpenFile class that contains a pointer to the file system's OpenFile object // and (char *)fileName for that file and the number of user processes currently accessing // it. Declare an array of SysOpenFile objects for use by all system calls implemented. // // Defines SysOpenFile Manager ...
07os405
trunk/nachos/code/userprog/sysopenfile.h
C++
mit
1,595
// memorymanager.h // Methods defining in Memory Manager that will be used to facilitate contiguous virtual memory. // The amount of memory available to the user space is the same as the amount // of physical memory. // // Memory Manager allocates the first clear page, takes the index of a page // and frees it, and get...
07os405
trunk/nachos/code/userprog/memorymanager.h
C++
mit
1,144
// addrspace.h // Data structures to keep track of executing user programs // (address spaces). // // For now, we don't keep any information about address spaces. // The user level CPU state is saved and restored in the thread // executing the user program (see thread.h). // // Copyright (c) 1992-1993 The Regents of ...
07os405
trunk/nachos/code/userprog/addrspace.h
C++
mit
1,911
// bitmap.c // Routines to manage a bitmap -- an array of bits each of which // can be either on or off. Represented as an array of integers. // // 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 dis...
07os405
trunk/nachos/code/userprog/bitmap.cc
C++
mit
4,569
// sysopenfile.cc // Defines SysOpenFile class that contains a pointer to the file system's OpenFile object // and (char *)fileName for that file and the number of user processes currently accessing // it. Declare an array of SysOpenFile objects for use by all system calls implemented. // // Defines SysOpenFile Manager...
07os405
trunk/nachos/code/userprog/sysopenfile.cc
C++
mit
3,839
// myutilities.cc // Method for compare two buffer. // // Created on: 2009-12-11 // Author: hyper #include "myutilities.h" //---------------------------------------------------------------------- // strcmp // Do little endian to big endian conversion on the bytes in the // object file header, in case the file ...
07os405
trunk/nachos/code/userprog/myutilities.cc
C++
mit
868
// processmanager.cc // Defines PCB class -- Data structures to keep necessary information about a process, // Such as PID, parent PID, Thread*, and thread status. // // Defines ProcessManager class -- like memory manager function, return an unused process // id, clear a process id respectively by using a bitmap, store...
07os405
trunk/nachos/code/userprog/processmanager.cc
C++
mit
5,696
// progtest.cc // Test routines for demonstrating that Nachos can load // a user program and execute it. // // Also, routines for testing the Console hardware device. // // Copyright (c) 1992-1993 The Regents of the University of California. // All rights reserved. See copyright.h for copyright notice and limitatio...
07os405
trunk/nachos/code/userprog/progtest.cc
C++
mit
2,828
.text .align 2 .globl ThreadRoot ThreadRoot: pushl %ebp movl %esp,%ebp pushl %edx call *%ecx call *%esi call *%edi movl %ebp,%esp popl %ebp ret .comm _eax_save,4 .globl SWITCH SWITCH: movl %eax,_eax_s...
07os405
trunk/nachos/code/userprog/swtch.s
Unix Assembly
mit
1,402
// bitmap.h // Data structures defining a bitmap -- an array of bits each of which // can be either on or off. // // Represented as an array of unsigned integers, on which we do // modulo arithmetic to find the bit we are interested in. // // The bitmap can be parameterized with with the number of bits being // manag...
07os405
trunk/nachos/code/userprog/bitmap.h
C++
mit
2,202
/* * useropenfile.cc * * Created on: Dec 10, 2009 * Author: qi */ #include "useropenfile.h"
07os405
trunk/nachos/code/userprog/useropenfile.cc
C++
mit
104
// memorymanager.cc // Routines to manage a memory manager -- that will be used to facilitate // contiguous virtual memory. The amount of memory available to the user // space is the same as the amount of physical memory. // // Memory Manager allocates the first clear page, takes the index of a page // and frees it, an...
07os405
trunk/nachos/code/userprog/memorymanager.cc
C++
mit
1,978
// myutilities.h // Method for compare two buffer . // // Created on: 2009-12-11 // Author: hyper #ifndef MYUTILITIES_H_ #define MYUTILITIES_H_ bool strcmp(char* first,char * second); //compare char first with char second #endif /* MYUTILITIES_H_ */
07os405
trunk/nachos/code/userprog/myutilities.h
C
mit
258
// nettest.cc // Test out message delivery between two "Nachos" machines, // using the Post Office to coordinate delivery. // // Two caveats: // 1. Two copies of Nachos must be running, with machine ID's 0 and 1: // ./nachos -m 0 -o 1 & // ./nachos -m 1 -o 0 & // // 2. You need an implementation of condition var...
07os405
trunk/nachos/code/network/nettest.cc
C++
mit
2,501
# NOTE: this is a GNU Makefile. You must use "gmake" rather than "make". # # Makefile for the network assignment # Defines set up assuming this assignment is done last # If not, use the "bare bones" defines below. # # Copyright (c) 1992 The Regents of the University of California. # All rights reserved. See ...
07os405
trunk/nachos/code/network/Makefile
Makefile
mit
43,341
// post.h // Data structures for providing the abstraction of unreliable, // ordered, fixed-size message delivery to mailboxes on other // (directly connected) machines. Messages can be dropped by // the network, but they are never corrupted. // // The US Post Office delivers mail to the addressed mailbox. // By ...
07os405
trunk/nachos/code/network/post.h
C++
mit
5,371
// post.cc // Routines to deliver incoming network messages to the correct // "address" -- a mailbox, or a holding area for incoming messages. // This module operates just like the US postal service (in other // words, it works, but it's slow, and you can't really be sure if // your mail really got through!). // // N...
07os405
trunk/nachos/code/network/post.cc
C++
mit
11,804
.text .align 2 .globl ThreadRoot ThreadRoot: pushl %ebp movl %esp,%ebp pushl %edx call *%ecx call *%esi call *%edi movl %ebp,%esp popl %ebp ret .comm _eax_save,4 .globl SWITCH SWITCH: movl %eax,_eax_s...
07os405
trunk/nachos/code/network/swtch.s
Unix Assembly
mit
1,402
// directory.cc // Routines to manage a directory of file names. // // The directory is a table of fixed length entries; each // entry represents a single file, and contains the file name, // and the location of the file header on disk. The fixed size // of each directory entry means that we have the restriction // o...
07os405
trunk/nachos/code/filesys/directory.cc
C++
mit
6,247
// filehdr.cc // Routines for managing the disk file header (in UNIX, this // would be called the i-node). // // The file header is used to locate where on disk the // file's data is stored. We implement this as a fixed size // table of pointers -- each entry in the table points to the // disk sector containing tha...
07os405
trunk/nachos/code/filesys/filehdr.cc
C++
mit
5,028
# NOTE: this is a GNU Makefile. You must use "gmake" rather than "make". # # Makefile for the file system assignment # Defines set up assuming multiprogramming and virtual memory done first. # If not, use the "bare bones" defines below. # # Copyright (c) 1992 The Regents of the University of California. # All ...
07os405
trunk/nachos/code/filesys/Makefile
Makefile
mit
37,971
// openfile.h // Data structures for opening, closing, reading and writing to // individual files. The operations supported are similar to // the UNIX ones -- type 'man open' to the UNIX prompt. // // There are two implementations. One is a "STUB" that directly // turns the file operations into the underlying UNIX ...
07os405
trunk/nachos/code/filesys/openfile.h
C++
mit
3,069
// filehdr.h // Data structures for managing a disk file header. // // A file header describes where on disk to find the data in a file, // along with other information about the file (for instance, its // length, owner, etc.) // // Copyright (c) 1992-1993 The Regents of the University of California. // All rights r...
07os405
trunk/nachos/code/filesys/filehdr.h
C++
mit
2,327
// openfile.cc // Routines to manage an open Nachos file. As in UNIX, a // file must be open before we can read or write to it. // Once we're all done, we can close it (in Nachos, by deleting // the OpenFile data structure). // // Also as in UNIX, for convenience, we keep the file header in // memory while the file i...
07os405
trunk/nachos/code/filesys/openfile.cc
C++
mit
6,808
// filesys.cc // Routines to manage the overall operation of the file system. // Implements routines to map from textual file names to files. // // Each file in the file system has: // A file header, stored in a sector on disk // (the size of the file header data structure is arranged // to be precisely the size...
07os405
trunk/nachos/code/filesys/filesys.cc
C++
mit
11,697
// directory.h // Data structures to manage a UNIX-like directory of file names. // // A directory is a table of pairs: <file name, sector #>, // giving the name of each file in the directory, and // where to find its file header (the data structure describing // where to find the file's data blocks) on disk. /...
07os405
trunk/nachos/code/filesys/directory.h
C++
mit
2,878
// synchdisk.h // Data structures to export a synchronous interface to the raw // disk device. // // 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 "cop...
07os405
trunk/nachos/code/filesys/synchdisk.h
C++
mit
1,918
.text .align 2 .globl ThreadRoot ThreadRoot: pushl %ebp movl %esp,%ebp pushl %edx call *%ecx call *%esi call *%edi movl %ebp,%esp popl %ebp ret .comm _eax_save,4 .globl SWITCH SWITCH: movl %eax,_eax_s...
07os405
trunk/nachos/code/filesys/swtch.s
Unix Assembly
mit
1,402
// fstest.cc // Simple test routines for the file system. // // We implement: // Copy -- copy a file from UNIX to Nachos // Print -- cat the contents of a Nachos file // Perftest -- a stress test for the Nachos file system // read and write a really large file in tiny chunks // (won't work on baseline sy...
07os405
trunk/nachos/code/filesys/fstest.cc
C++
mit
5,011
// filesys.h // Data structures to represent the Nachos file system. // // A file system is a set of files stored on disk, organized // into directories. Operations on the file system have to // do with "naming" -- creating, opening, and deleting files, // given a textual file name. Operations on an individual // "o...
07os405
trunk/nachos/code/filesys/filesys.h
C++
mit
3,319
// synchdisk.cc // Routines to synchronously access the disk. The physical disk // is an asynchronous device (disk requests return immediately, and // an interrupt happens later on). This is a layer on top of // the disk providing a synchronous interface (requests wait until // the request completes). // // Use a s...
07os405
trunk/nachos/code/filesys/synchdisk.cc
C++
mit
3,588
// stats.h // Routines for managing statistics about Nachos performance. // // DO NOT CHANGE -- these stats are maintained by 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 a...
07os405
trunk/nachos/code/machine/stats.cc
C++
mit
1,607
// timer.h // Data structures to emulate a hardware timer. // // A hardware timer generates a CPU interrupt every X milliseconds. // This means it can be used for implementing time-slicing, or for // having a thread go to sleep for a specific period of time. // // We emulate a hardware timer by scheduling an interrup...
07os405
trunk/nachos/code/machine/timer.h
C++
mit
1,623
// 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 virt...
07os405
trunk/nachos/code/machine/translate.cc
C++
mit
8,418
// mipssim.cc -- simulate a MIPS R2/3000 processor // // This code has been adapted from Ousterhout's MIPSSIM package. // Byte ordering is little-endian, so we can be compatible with // DEC RISC systems. // // DO NOT CHANGE -- part of the machine emulation // // Copyright (c) 1992-1993 The Regents of the Univer...
07os405
trunk/nachos/code/machine/mipssim.cc
C++
mit
18,089
// console.h // Data structures to simulate the behavior of a terminal // I/O device. A terminal has two parts -- a keyboard input, // and a display output, each of which produces/accepts // characters sequentially. // // The console hardware device is asynchronous. When a character is // written to the device, the...
07os405
trunk/nachos/code/machine/console.h
C++
mit
3,035
// interrupt.h // Data structures to emulate low-level interrupt hardware. // // The hardware provides a routine (SetLevel) to enable or disable // interrupts. // // In order to emulate the hardware, we need to keep track of all // interrupts the hardware devices would cause, and when they // are supposed to occur. ...
07os405
trunk/nachos/code/machine/interrupt.h
C++
mit
5,029
// network.cc // Routines to simulate a network interface, using UNIX sockets // to deliver packets between multiple invocations of nachos. // // 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 copyr...
07os405
trunk/nachos/code/machine/network.cc
C++
mit
4,334
// network.h // Data structures to emulate a physical network connection. // The network provides the abstraction of ordered, unreliable, // fixed-size packet delivery to other machines on the network. // // You may note that the interface to the network is similar to // the console device -- both are full duplex cha...
07os405
trunk/nachos/code/machine/network.h
C++
mit
4,055
// disk.h // Data structures to emulate a physical disk. A physical disk // can accept (one at a time) requests to read/write a disk sector; // when the request is satisfied, the CPU gets an interrupt, and // the next request can be sent to the disk. // // Disk contents are preserved across machine crashes, but if /...
07os405
trunk/nachos/code/machine/disk.h
C++
mit
3,913
// timer.cc // Routines to emulate a hardware timer device. // // A hardware timer generates a CPU interrupt every X milliseconds. // This means it can be used for implementing time-slicing. // // We emulate a hardware timer by scheduling an interrupt to occur // every time stats->totalTicks has in...
07os405
trunk/nachos/code/machine/timer.cc
C++
mit
3,089
// disk.cc // Routines to simulate a physical disk device; reading and writing // to the disk is simulated as reading and writing to a UNIX file. // See disk.h for details about the behavior of disks (and // therefore about the behavior of this simulation). // // Disk operations are asynchronous, so we have to invoke ...
07os405
trunk/nachos/code/machine/disk.cc
C++
mit
9,592
// interrupt.cc // Routines to simulate hardware interrupts. // // The hardware provides a routine (SetLevel) to enable or disable // interrupts. // // In order to emulate the hardware, we need to keep track of all // interrupts the hardware devices would cause, and when they // are supposed to occur. // // This mod...
07os405
trunk/nachos/code/machine/interrupt.cc
C++
mit
12,293
// translate.h // Data structures for managing the translation from // virtual page # -> physical page #, used for managing // physical memory on behalf of user programs. // // The data structures in this file are "dual-use" - they // serve both as a page table entry, and as an entry in // a software-managed translat...
07os405
trunk/nachos/code/machine/translate.h
C++
mit
1,813
// machine.h // Data structures for simulating the execution of user programs // running on top of Nachos. // // User programs are loaded into "mainMemory"; to Nachos, // this looks just like an array of bytes. Of course, the Nachos // kernel is in memory too -- but as in most machines these days, // the kernel is lo...
07os405
trunk/nachos/code/machine/machine.h
C++
mit
8,279
// sysdep.h // System-dependent interface. Nachos uses the routines defined // here, rather than directly calling the UNIX library functions, to // simplify porting between versions of UNIX, and even to // other systems, such as MSDOS and the Macintosh. // // Copyright (c) 1992-1993 The Regents of the University of C...
07os405
trunk/nachos/code/machine/sysdep.h
C
mit
2,529
// console.cc // Routines to simulate a serial port to a console device. // A console has input (a keyboard) and output (a display). // These are each simulated by operations on UNIX files. // The simulated device is asynchronous, // so we have to invoke the interrupt handler (after a simulated // delay), to signal th...
07os405
trunk/nachos/code/machine/console.cc
C++
mit
4,985
// sysdep.cc // Implementation of system-dependent interface. Nachos uses the // routines defined here, rather than directly calling the UNIX library, // to simplify porting between versions of UNIX, and even to // other systems, such as MSDOS. // // On UNIX, almost all of these routines are simple wrappers // for th...
07os405
trunk/nachos/code/machine/sysdep.cc
C++
mit
14,683
// mipssim.h // Internal data structures for simulating the MIPS instruction set. // // 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...
07os405
trunk/nachos/code/machine/mipssim.h
C
mit
6,945
// stats.h // Data structures for gathering statistics about Nachos performance. // // DO NOT CHANGE -- these stats are maintained by 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 l...
07os405
trunk/nachos/code/machine/stats.h
C++
mit
2,423
#include "syscall.h" char temp[2500]; int main() { Write("Test2 is running !!\n",20, ConsoleOutput); Yield(); Exit(0); }
07os405
trunk/nachos/code/test/mix_test2.c
C
mit
131
#include "syscall.h" int main() { SpaceId newProc; OpenFileId output = ConsoleOutput; Write("Before join\n", 11, output); newProc = Exec("../test/hello1"); Join(newProc); Write("After join\n", 11, output); }
07os405
trunk/nachos/code/test/shell.c
C
mit
223
/* test3_2.c */ /* --------- testing system calls : Exit, Exec, Join */ /* --------- size of the program : 11 pages */ #include "syscall.h" int main() { Write( "Test3: This is test 3_2\n", 24, ConsoleOutput ); Yield(); Exit(32); }
07os405
trunk/nachos/code/test/test3_2.c
C
mit
248
# use normal make for this Makefile # # Makefile for building user programs to run on top of Nachos # # Several things to be aware of: # # Nachos assumes that the location of the program startup routine (the # location the kernel jumps to when the program initially starts up) # is at location 0. This means: ...
07os405
trunk/nachos/code/test/Makefile
Makefile
mit
4,652
/* test2.c * Simple program to test whether running a user program works. * * be careful to allocate a big enough stack to hold the automatics! */ #include "syscall.h" void foo(int s) { char buf[60]; Write("in function Foo\n",16,ConsoleOutput); Exec("../test/matmult"); } int main() { Write("In test2...
07os405
trunk/nachos/code/test/test2.c
C
mit
421
/* matmult.c * Test program to do matrix multiplication on large arrays. * * Intended to stress virtual memory system. * * Ideally, we could read the matrices off of the file system, * and store the result back to the file system! */ #include "syscall.h" #define Dim 20 /* sum total of the arrays does...
07os405
trunk/nachos/code/test/matmult.c
C
mit
824
# include <stdio.h> #define NOFFMAGIC 0xbadfad typedef struct segment { int virtualAddr; int inFileAddr; int size; } Segment; typedef struct noffHeader { int noffMagic; Segment code; Segment initData; Segment uninitData; } NoffHeader; int main(int argc, char *argv[]) { FILE *bin; int ins; int ...
07os405
trunk/nachos/code/test/dump_noff.c
C
mit
5,040
#include "syscall.h" void test_function2() { int i=0; OpenFileId OutFid, InFid; Write("# FORKED 2-1 !!\n", 20, ConsoleOutput); Write("# FORKED 2-2 !!\n", 23, ConsoleOutput); /* maintain this function in memory */ for( i=0 ; i < 10 ; ++i ) Yield(); } void test_function3() { Write("# FORKED 3-1...
07os405
trunk/nachos/code/test/mix_test1.c
C
mit
2,155
#include "syscall.h" void f(){ Exec("../test/matmult"); } void main() { Fork(f); }
07os405
trunk/nachos/code/test/fork.c
C
mit
88
#include "syscall.h" int main() { int i ; Write("Test4: First write!\n", 253, ConsoleOutput); for(i=0;i<6;i++) Exec("test4_1"); Exit(4); }
07os405
trunk/nachos/code/test/test4.c
C
mit
170
/* syscalls.h * Nachos system call interface. These are Nachos kernel operations * that can be invoked from user programs, by trapping to the kernel * via the "syscall" instruction. * * This file is included by user programs and by the Nachos kernel. * * Copyright (c) 1992-1993 The Regents of the University...
07os405
trunk/nachos/code/test/syscall.h
C
mit
3,914
/* sort.c * Test program to sort a large number of integers. * * Intention is to stress virtual memory system. * * Ideally, we could read the unsorted array off of the file system, * and store the result back to the file system! */ #include "syscall.h" int A[2048]; /* size of physical memory; with co...
07os405
trunk/nachos/code/test/sort.c
C
mit
784
#include "syscall.h" void test_function1() { Write("# FORKED 1-1 !!\n", 20, ConsoleOutput); /* ensure that TEST1 is loaded before this function finishes */ Yield(); Yield(); Write("# FORKED 1-2 !!\n", 23, ConsoleOutput); Exit(1); } void main() { OpenFileId OutFid, InFid; int ret =335; ...
07os405
trunk/nachos/code/test/test.c
C
mit
756
/* test3.c * Simple program to test whether running a user program works. * * be careful to allocate a big enough stack to hold the automatics! */ #include "syscall.h" void foo(int s) { char buf[60]; Write("in function Foo\n",16,ConsoleOutput); Exec("../test/matmult"); } int main() { Write("In test3...
07os405
trunk/nachos/code/test/test3.c
C
mit
418
#include "syscall.h" void test_function1() { int i=0; char data1[1000]; OpenFileId OutFid, InFid; // Write("# FORKED 5-1 !!\n", 20, ConsoleOutput); /* maintain this function in memory */ for( i=0 ; i < 10 ; ++i ){ Yield(); data1[i*10]=0; } } void test_function2() { int i=0; char data2[1500]; ...
07os405
trunk/nachos/code/test/test5.c
C
mit
969
/* test5_1.c */ /* --------- testing system calls : Exit, Exec, Fork */ /* --------- size of the program : 11 pages */ #include "syscall.h" int main() { Write( "Test5: This is test 5_1\n", 24, ConsoleOutput ); Exit( 0 ); }
07os405
trunk/nachos/code/test/test5_1.c
C
mit
238
/* test2.c */ /* --------- testing console Read and Write */ /* --------- size of the program : 16 pages */ #include "syscall.h" char usr_buffer_0[256]; char usr_buffer_1[256]; int main() { Exec( 1000 ); }
07os405
trunk/nachos/code/test/halt.c
C
mit
212
#include "syscall.h" char temp[1000]; int main() { int i; Write("Test4 is running !!\n",20, ConsoleOutput); for(i=0;i<20;i++) Yield(); Exit(0); }
07os405
trunk/nachos/code/test/test4_1.c
C
mit
158
/* test1.c * Simple program to test whether running a user program works. * * Just do a "syscall" that shuts down the OS. * */ #include "syscall.h" int main() { Write("try to exec matmult.c 1\n",26,ConsoleOutput); Exec("../test/matmult"); Exit(0); }
07os405
trunk/nachos/code/test/test1.c
C
mit
267
/* Copyright (c) 1992-1993 The Regents of the University of California. All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without written agreement is hereby granted, provided that the above copyright notice and the following two ...
07os405
trunk/nachos/code/test/copyright.h
C
mit
1,229