aboutsummaryrefslogtreecommitdiffstats
path: root/src/threads
diff options
context:
space:
mode:
authorklaar36 <klas.arvidsson@liu.se>2016-05-03 23:55:07 +0200
committerklaar36 <klas.arvidsson@liu.se>2016-05-04 03:31:46 +0200
commita2a9484bee39f2cac6253f4d6ae3234f71107f5b (patch)
treec8fa378baa26ad66ed4911d7c990c78929d187f1 /src/threads
parent1413ca739e80172a3f11b0888f2f27f47b2ed056 (diff)
downloadpintos-rs-a2a9484bee39f2cac6253f4d6ae3234f71107f5b.tar.gz
timer frequency as parameter
Diffstat (limited to 'src/threads')
-rw-r--r--src/threads/init.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/threads/init.c b/src/threads/init.c
index e4df408..6633d2c 100644
--- a/src/threads/init.c
+++ b/src/threads/init.c
@@ -48,15 +48,20 @@ static bool format_filesys;
/* -q: Power off after kernel tasks complete? */
bool power_off_when_done = false;
-/* -Q: Force power off by klaar@ida... */
+
+/* Options by klaar@ida */
+
+/* -Q: Force power off */
bool force_off_when_done = false;
-/* -tcf: Simulate failure in thread_create klaar@ida... */
+/* -F: Set timer frequency */
+static uint16_t init_timer_freq = 1000;
+/* -tcf: Simulate failure in thread_create */
int thread_create_limit = 0; /* infinite */
static bool prevent_reqursive_off = false;
static void hard_power_off (void) NO_RETURN;
-
+
static void ram_init (void);
static void paging_init (void);
@@ -105,7 +110,7 @@ main (void)
/* Initialize interrupt handlers. */
intr_init ();
- timer_init ();
+ timer_init (init_timer_freq);
kbd_init ();
input_init ();
#ifdef USERPROG
@@ -248,6 +253,8 @@ parse_options (char **argv)
power_off_when_done = true;
else if (!strcmp (name, "-Q")) // klaar@ida
power_off_when_done = force_off_when_done = true;
+ else if (!strcmp (name, "-F")) // klaar@ida
+ init_timer_freq = atoi (value);
#ifdef FILESYS
else if (!strcmp (name, "-f"))
format_filesys = true;