-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from hangpark/develop
Release proj.2
- Loading branch information
Showing
41 changed files
with
2,168 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
bochs/ | ||
build/ | ||
examples/ | ||
*.output | ||
*.txt | ||
*.swp | ||
*.o | ||
*.d | ||
*.txt | ||
!src/tests/**/*.txt | ||
src/examples/**/* | ||
src/examples/**/*.a | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
sudo: required | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
|
||
language: c | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
- docker pull hangpark/pintos-dev-env-kaist | ||
|
||
script: | ||
- docker run -v $TRAVIS_BUILD_DIR:/pintos hangpark/pintos-dev-env-kaist /bin/bash -c "cd /pintos/src/$TARGET_DIRECTORY && make grade" > /dev/null && cat src/$TARGET_DIRECTORY/build/grade |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
# PintOS Project of CS330 in KAIST | ||
|
||
[![Build Status](https://travis-ci.com/hangpark/pintos.svg?token=gQa4om5Q1o59ZGsZT1Tf&branch=develop)](https://travis-ci.com/hangpark/pintos) | ||
|
||
Repository for PintOS implementation project of CS330 in KAIST. | ||
|
||
To contribute, read [CONTRIBUTING.md](CONTRIBUTING.md). | ||
|
||
## Contributors | ||
## Requirements | ||
|
||
This OS is run in the specific environment below: | ||
|
||
- Ubuntu 8.04 (Hardy Heron) | ||
- GCC 3.4 | ||
- Bochs 2.2.6 | ||
- QEMU 0.15.0 | ||
|
||
You can use Bochs or QEMU for emulate PintOS. | ||
|
||
## Build | ||
|
||
- Hang Park <hangpark@kaist.ac.kr> | ||
- Lament <semin0706@naver.com> | ||
Docker image for an environment satisfies above requirements is provided at [hangpark/pintos-dev-env-kaist](https://hub.docker.com/r/hangpark/pintos-dev-env-kaist/). Use below commands to build (or check, grade) the PintOS. | ||
```bash | ||
$ git clone https://github.com/hangpark/pintos.git | ||
$ sudo docker pull hangpark/pintos-dev-env-kaist | ||
$ sudo docker run -t -d --name pintos -v pintos:/pintos hangpark/pintos-dev-env-kaist | ||
$ sudo docker exec -i -t pintos bash -c "cd src/<dir> && make [check|grade]" | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 \ | ||
bubsort insult lineup matmult recursor | ||
|
||
# Should work from project 2 onward. | ||
cat_SRC = cat.c | ||
cmp_SRC = cmp.c | ||
cp_SRC = cp.c | ||
echo_SRC = echo.c | ||
halt_SRC = halt.c | ||
hex-dump_SRC = hex-dump.c | ||
insult_SRC = insult.c | ||
lineup_SRC = lineup.c | ||
ls_SRC = ls.c | ||
recursor_SRC = recursor.c | ||
rm_SRC = rm.c | ||
|
||
# Should work in project 3; also in project 4 if VM is included. | ||
bubsort_SRC = bubsort.c | ||
matmult_SRC = matmult.c | ||
mcat_SRC = mcat.c | ||
mcp_SRC = mcp.c | ||
|
||
# Should work in project 4. | ||
mkdir_SRC = mkdir.c | ||
pwd_SRC = pwd.c | ||
shell_SRC = shell.c | ||
|
||
include $(SRCDIR)/Make.config | ||
include $(SRCDIR)/Makefile.userprog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* 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 <stdio.h> | ||
|
||
/* Size of array to sort. */ | ||
#define SORT_SIZE 128 | ||
|
||
int | ||
main (void) | ||
{ | ||
/* Array to sort. Static to reduce stack usage. */ | ||
static int array[SORT_SIZE]; | ||
|
||
int i, j, tmp; | ||
|
||
/* First initialize the array in descending order. */ | ||
for (i = 0; i < SORT_SIZE; i++) | ||
array[i] = SORT_SIZE - i - 1; | ||
|
||
/* Then sort in ascending order. */ | ||
for (i = 0; i < SORT_SIZE - 1; i++) | ||
for (j = 0; j < SORT_SIZE - 1 - i; j++) | ||
if (array[j] > array[j + 1]) | ||
{ | ||
tmp = array[j]; | ||
array[j] = array[j + 1]; | ||
array[j + 1] = tmp; | ||
} | ||
|
||
printf ("sort exiting with code %d\n", array[0]); | ||
return array[0]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* cat.c | ||
Prints files specified on command line to the console. */ | ||
|
||
#include <stdio.h> | ||
#include <syscall.h> | ||
|
||
int | ||
main (int argc, char *argv[]) | ||
{ | ||
bool success = true; | ||
int i; | ||
|
||
for (i = 1; i < argc; i++) | ||
{ | ||
int fd = open (argv[i]); | ||
if (fd < 0) | ||
{ | ||
printf ("%s: open failed\n", argv[i]); | ||
success = false; | ||
continue; | ||
} | ||
for (;;) | ||
{ | ||
char buffer[1024]; | ||
int bytes_read = read (fd, buffer, sizeof buffer); | ||
if (bytes_read == 0) | ||
break; | ||
write (STDOUT_FILENO, buffer, bytes_read); | ||
} | ||
close (fd); | ||
} | ||
return success ? EXIT_SUCCESS : EXIT_FAILURE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* cat.c | ||
Compares two files. */ | ||
|
||
#include <stdio.h> | ||
#include <syscall.h> | ||
|
||
int | ||
main (int argc, char *argv[]) | ||
{ | ||
int fd[2]; | ||
|
||
if (argc != 3) | ||
{ | ||
printf ("usage: cmp A B\n"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Open files. */ | ||
fd[0] = open (argv[1]); | ||
if (fd[0] < 0) | ||
{ | ||
printf ("%s: open failed\n", argv[1]); | ||
return EXIT_FAILURE; | ||
} | ||
fd[1] = open (argv[2]); | ||
if (fd[1] < 0) | ||
{ | ||
printf ("%s: open failed\n", argv[1]); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Compare data. */ | ||
for (;;) | ||
{ | ||
int pos; | ||
char buffer[2][1024]; | ||
int bytes_read[2]; | ||
int min_read; | ||
int i; | ||
|
||
pos = tell (fd[0]); | ||
bytes_read[0] = read (fd[0], buffer[0], sizeof buffer[0]); | ||
bytes_read[1] = read (fd[1], buffer[1], sizeof buffer[1]); | ||
min_read = bytes_read[0] < bytes_read[1] ? bytes_read[0] : bytes_read[1]; | ||
if (min_read == 0) | ||
break; | ||
|
||
for (i = 0; i < min_read; i++) | ||
if (buffer[0][i] != buffer[1][i]) | ||
{ | ||
printf ("Byte %d is %02hhx ('%c') in %s but %02hhx ('%c') in %s\n", | ||
pos + i, | ||
buffer[0][i], buffer[0][i], argv[1], | ||
buffer[1][i], buffer[1][i], argv[2]); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (min_read < bytes_read[1]) | ||
printf ("%s is shorter than %s\n", argv[1], argv[2]); | ||
else if (min_read < bytes_read[0]) | ||
printf ("%s is shorter than %s\n", argv[2], argv[1]); | ||
} | ||
|
||
printf ("%s and %s are identical\n", argv[1], argv[2]); | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* cat.c | ||
Copies one file to another. */ | ||
|
||
#include <stdio.h> | ||
#include <syscall.h> | ||
|
||
int | ||
main (int argc, char *argv[]) | ||
{ | ||
int in_fd, out_fd; | ||
|
||
if (argc != 3) | ||
{ | ||
printf ("usage: cp OLD NEW\n"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Open input file. */ | ||
in_fd = open (argv[1]); | ||
if (in_fd < 0) | ||
{ | ||
printf ("%s: open failed\n", argv[1]); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Create and open output file. */ | ||
if (!create (argv[2], filesize (in_fd))) | ||
{ | ||
printf ("%s: create failed\n", argv[2]); | ||
return EXIT_FAILURE; | ||
} | ||
out_fd = open (argv[2]); | ||
if (out_fd < 0) | ||
{ | ||
printf ("%s: open failed\n", argv[2]); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
/* Copy data. */ | ||
for (;;) | ||
{ | ||
char buffer[1024]; | ||
int bytes_read = read (in_fd, buffer, sizeof buffer); | ||
if (bytes_read == 0) | ||
break; | ||
if (write (out_fd, buffer, bytes_read) != bytes_read) | ||
{ | ||
printf ("%s: write failed\n", argv[2]); | ||
return EXIT_FAILURE; | ||
} | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdio.h> | ||
#include <syscall.h> | ||
|
||
int | ||
main (int argc, char **argv) | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < argc; i++) | ||
printf ("%s ", argv[i]); | ||
printf ("\n"); | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* halt.c | ||
Simple program to test whether running a user program works. | ||
Just invokes a system call that shuts down the OS. */ | ||
|
||
#include <syscall.h> | ||
|
||
int | ||
main (void) | ||
{ | ||
halt (); | ||
/* not reached */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* hex-dump.c | ||
Prints files specified on command line to the console in hex. */ | ||
|
||
#include <stdio.h> | ||
#include <syscall.h> | ||
|
||
int | ||
main (int argc, char *argv[]) | ||
{ | ||
bool success = true; | ||
int i; | ||
|
||
for (i = 1; i < argc; i++) | ||
{ | ||
int fd = open (argv[i]); | ||
if (fd < 0) | ||
{ | ||
printf ("%s: open failed\n", argv[i]); | ||
success = false; | ||
continue; | ||
} | ||
for (;;) | ||
{ | ||
char buffer[1024]; | ||
int pos = tell (fd); | ||
int bytes_read = read (fd, buffer, sizeof buffer); | ||
if (bytes_read == 0) | ||
break; | ||
hex_dump (pos, buffer, bytes_read, true); | ||
} | ||
close (fd); | ||
} | ||
return success ? EXIT_SUCCESS : EXIT_FAILURE; | ||
} |
Oops, something went wrong.