Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • y2-rhymansaib/pintos_student
1 result
Select Git revision
Show changes
Commits on Source (618)
This is a variant of the Pintos Operating System for use as part of Operating Systems module at the University of the West of England (UWE). This is a variant of the Pintos Operating System for use as part of Operating Systems module at the University of the West of England (UWE).
start the project
Pintos, including its documentation, is subject to the following Pintos, including its documentation, is subject to the following
license: license:
Copyright (C) 2004, 2005, 2006 Board of Trustees, Leland Stanford Copyright (C) 2004, 2005, 2006 Board of Trustees, Leland Stanford
Jr. University. All rights reserved. Jr. University. All rights reserved.
......
...@@ -40,7 +40,7 @@ endif ...@@ -40,7 +40,7 @@ endif
# Compiler and assembler invocation. # Compiler and assembler invocation.
DEFINES = DEFINES =
WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers
CFLAGS = -g -msoft-float -O -DBEN_MODS -std=gnu99 CFLAGS = -g -msoft-float -O
CPPFLAGS = -nostdinc -I$(SRCDIR) -I$(SRCDIR)/lib CPPFLAGS = -nostdinc -I$(SRCDIR) -I$(SRCDIR)/lib
ASFLAGS = -Wa,--gstabs ASFLAGS = -Wa,--gstabs
LDFLAGS = LDFLAGS =
......
...@@ -40,4 +40,5 @@ bool intq_full (const struct intq *); ...@@ -40,4 +40,5 @@ bool intq_full (const struct intq *);
uint8_t intq_getc (struct intq *); uint8_t intq_getc (struct intq *);
void intq_putc (struct intq *, uint8_t); void intq_putc (struct intq *, uint8_t);
#endif /* devices/intq.h */ #endif /* devices/intq.h */
...@@ -92,8 +92,13 @@ timer_sleep (int64_t ticks) ...@@ -92,8 +92,13 @@ timer_sleep (int64_t ticks)
int64_t start = timer_ticks (); int64_t start = timer_ticks ();
ASSERT (intr_get_level () == INTR_ON); ASSERT (intr_get_level () == INTR_ON);
while (timer_elapsed (start) < ticks) enum intr_level old_level = intr_disable ();
thread_yield ();
// sleep the thread for `ticks` seconds,
// until the tick becomes [start + ticks]
thread_sleep_until (start + ticks);
intr_set_level (old_level);
} }
/* Sleeps for approximately MS milliseconds. Interrupts must be /* Sleeps for approximately MS milliseconds. Interrupts must be
...@@ -165,13 +170,13 @@ timer_print_stats (void) ...@@ -165,13 +170,13 @@ timer_print_stats (void)
{ {
printf ("Timer: %"PRId64" ticks\n", timer_ticks ()); printf ("Timer: %"PRId64" ticks\n", timer_ticks ());
} }
/* Timer interrupt handler. */ /* Timer interrupt handler. */
static void static void
timer_interrupt (struct intr_frame *args UNUSED) timer_interrupt (struct intr_frame *args UNUSED)
{ {
ticks++; ticks++;
thread_tick (); thread_tick ( timer_ticks() );
} }
/* Returns true if LOOPS iterations waits for more than one timer /* Returns true if LOOPS iterations waits for more than one timer
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "threads/interrupt.h" #include "threads/interrupt.h"
#include "threads/vaddr.h" #include "threads/vaddr.h"
/* VGA text screen support. See [FREEVGA] for more information. */ /* VGA text screen support. See [FREEVGA] for more information. */
/* Number of columns and rows on the text display. */ /* Number of columns and rows on the text display. */
......
cat
cmp
cp
echo
halt
hex-dump
ls
mcat
mcp
mkdir
pwd
rm
shell
bubsort
insult
lineup
matmult
recursor
*.d
SRCDIR = .. SRCDIR = ..
# Test programs to compile, and a list of sources for each.
# To add a new test, put its name on the PROGS list
# and then add a name_SRC line that lists its source files.
PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \ PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \
bubsort insult lineup matmult recursor my bubsort insult lineup matmult recursor
# Should work from project 2 onward.
cat_SRC = cat.c cat_SRC = cat.c
cmp_SRC = cmp.c cmp_SRC = cmp.c
cp_SRC = cp.c cp_SRC = cp.c
...@@ -18,15 +14,10 @@ lineup_SRC = lineup.c ...@@ -18,15 +14,10 @@ lineup_SRC = lineup.c
ls_SRC = ls.c ls_SRC = ls.c
recursor_SRC = recursor.c recursor_SRC = recursor.c
rm_SRC = rm.c rm_SRC = rm.c
my_SRC = my.c
# Should work in project 3; also in project 4 if VM is included.
bubsort_SRC = bubsort.c bubsort_SRC = bubsort.c
matmult_SRC = matmult.c matmult_SRC = matmult.c
mcat_SRC = mcat.c mcat_SRC = mcat.c
mcp_SRC = mcp.c mcp_SRC = mcp.c
# Should work in project 4.
mkdir_SRC = mkdir.c mkdir_SRC = mkdir.c
pwd_SRC = pwd.c pwd_SRC = pwd.c
shell_SRC = shell.c shell_SRC = shell.c
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int i,j; int i;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
printf ("%s ", argv[i]); printf ("%s ", argv[i]);
......
#include <syscall.h>
#include <stdio.h>
int main(void) {
int fd = 0; // Assume file descriptor 0 represents stdin
unsigned position = tell(fd);
printf("Current position of file pointer for fd %d: %u\n", fd, position);
return 0;
}
/* Insult.c
This is a version of the famous CS 107 random sentence
generator. I wrote a program that reads a grammar definition
file and writes a C file containing that grammar as hard code
static C strings. Thus the majority of the code below in
machine generated and totally unreadable. The arrays created
are specially designed to make generating the sentences as
easy as possible.
Originally by Greg Hutchins, March 1998.
Modified by Ben Pfaff for Pintos, Sept 2004. */
char *start[] = char *start[] =
{ "You", "1", "5", ".", "May", "13", ".", "With", "the", "19", "of", "18", { "You", "1", "5", ".", "May", "13", ".", "With", "the", "19", "of", "18",
",", "may", "13", "." ",", "may", "13", "."
...@@ -310,10 +299,6 @@ main (int argc, char *argv[]) ...@@ -310,10 +299,6 @@ main (int argc, char *argv[])
if (++i >= argc) if (++i >= argc)
usage (-1, "Missing value for -f"); usage (-1, "Missing value for -f");
/* Because files have fixed length in the basic Pintos
file system, the 0 argument means that this option
will not be useful until project 4 is
implemented. */
create (argv[i], 0); create (argv[i], 0);
handle = open (argv[i]); handle = open (argv[i]);
if (handle < 0) if (handle < 0)
......