Permalink
Browse files

updated for pintos2

  • Loading branch information...
1 parent 179218f commit ccd52cd16ad1ba87d0bcf47aaa0fb3b8317ebed5 @Frankencelery Frankencelery committed Oct 19, 2012
Showing 437 changed files with 14,842 additions and 340 deletions.
View
@@ -11,12 +11,12 @@ VPATH = $(SRCDIR)
X86 = i.86\|pentium.*\|[pk][56]\|nexgen\|viac3\|6x86\|athlon.*\|i86pc
X86_64 = x86_64
ifneq (0, $(shell expr `uname -m` : '$(X86)'))
- CC = gcc
+ CC = sse-gcc
LD = ld
OBJCOPY = objcopy
else
ifneq (0, $(shell expr `uname -m` : '$(X86_64)'))
- CC = gcc -m32
+ CC = sse-gcc -m32
LD = ld -melf_i386
OBJCOPY = objcopy
else
View
@@ -29,14 +29,6 @@ static bool too_many_loops (unsigned loops);
static void busy_wait (int64_t loops);
static void real_time_sleep (int64_t num, int32_t denom);
static void real_time_delay (int64_t num, int32_t denom);
-static struct list thread_list;
-
-static bool compare_threads_by_wakeup_time(const struct list_elem *a_, const struct list_elem *b_, void *aux UNUSED)
-{
- const struct thread *a = list_entry(a_, struct thread, timer_list_elem);
- const struct thread *b = list_entry(b_, struct thread, timer_list_elem);
- return a->wakeup_time < b->wakeup_time;
-}
/* Sets up the timer to interrupt TIMER_FREQ times per second,
and registers the corresponding interrupt. */
@@ -45,7 +37,6 @@ timer_init (void)
{
pit_configure_channel (0, 2, TIMER_FREQ);
intr_register_ext (0x20, timer_interrupt, "8254 Timer");
- list_init(&thread_list);
}
/* Calibrates loops_per_tick, used to implement brief delays. */
@@ -99,12 +90,10 @@ void
timer_sleep (int64_t ticks)
{
int64_t start = timer_ticks ();
- struct thread *t = thread_current();
- t->wakeup_time = ticks + start;
- intr_disable();
- list_insert_ordered(&thread_list, &t->timer_list_elem, compare_threads_by_wakeup_time,NULL);
- intr_enable();
- sema_down(&t->sema_wakeup);
+
+ ASSERT (intr_get_level () == INTR_ON);
+ while (timer_elapsed (start) < ticks)
+ thread_yield ();
}
/* Sleeps for approximately MS milliseconds. Interrupts must be
@@ -183,16 +172,6 @@ timer_interrupt (struct intr_frame *args UNUSED)
{
ticks++;
thread_tick ();
- //printf("Interupting\n");
- //Check to see if first element in list is ready to start
- while (!list_empty(&thread_list))
- {
- struct thread *head = list_entry(list_front(&thread_list),struct thread, timer_list_elem);
- if (ticks < head->wakeup_time) break;
- sema_up(&head->sema_wakeup);
- //thread_yield();
- list_pop_front(&thread_list);
- }
}
/* Returns true if LOOPS iterations waits for more than one timer
@@ -256,8 +235,6 @@ real_time_sleep (int64_t num, int32_t denom)
}
}
-
-
/* Busy-wait for approximately NUM/DENOM seconds. */
static void
real_time_delay (int64_t num, int32_t denom)
View
@@ -1,9 +1,9 @@
#ifndef DEVICES_TIMER_H
#define DEVICES_TIMER_H
-#include <stdbool.h>
+
#include <round.h>
#include <stdint.h>
-#include <list.h>
+
/* Number of timer interrupts per second. */
#define TIMER_FREQ 100
@@ -26,5 +26,4 @@ void timer_ndelay (int64_t nanoseconds);
void timer_print_stats (void);
-
#endif /* devices/timer.h */
No changes.
Oops, something went wrong.

0 comments on commit ccd52cd

Please sign in to comment.