From: Ben Pfaff Date: Fri, 7 Nov 2008 05:55:33 +0000 (-0800) Subject: Rename schedule_tail() to thread_schedule_tail(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3554cdb2c4b28bca448ca2e819bb272cbfcd6fa;p=pintos-anon Rename schedule_tail() to thread_schedule_tail(). This makes its name fit the convention that the file name is used as a prefix for global symbol names. Found by Godmar with his process-linker-map.pl script. --- diff --git a/doc/reference.texi b/doc/reference.texi index 924fd78..bfa0760 100644 --- a/doc/reference.texi +++ b/doc/reference.texi @@ -501,7 +501,7 @@ CPU's current stack pointer in the current @struct{thread}'s @code{stack} member, restores the new thread's @code{stack} into the CPU's stack pointer, restores registers from the stack, and returns. -The rest of the scheduler is implemented in @func{schedule_tail}. It +The rest of the scheduler is implemented in @func{thread_schedule_tail}. It marks the new thread as running. If the thread we just switched from is in the dying state, then it also frees the page that contained the dying thread's @struct{thread} and stack. These couldn't be freed @@ -530,8 +530,8 @@ pointer,@footnote{This is because @func{switch_threads} takes arguments on the stack and the 80@var{x}86 SVR4 calling convention requires the caller, not the called function, to remove them when the call is complete. See @bibref{SysV-i386} chapter 3 for details.} -calls @func{schedule_tail} (this special case is why -@func{schedule_tail} is separate from @func{schedule}), and returns. +calls @func{thread_schedule_tail} (this special case is why +@func{thread_schedule_tail} is separate from @func{schedule}), and returns. We fill in its stack frame so that it returns into @func{kernel_thread}, a function in @file{threads/thread.c}. diff --git a/solutions/p2.patch b/solutions/p2.patch index c6d9a42..88f7cb7 100644 --- a/solutions/p2.patch +++ b/solutions/p2.patch @@ -24,7 +24,7 @@ diff -u src/threads/thread.c~ src/threads/thread.c + /* Remove thread from all threads list, set our status to dying, and schedule another process. That process will destroy us - when it call schedule_tail(). */ + when it calls thread_schedule_tail(). */ intr_disable (); list_remove (&thread_current()->allelem); thread_current ()->status = THREAD_DYING; diff --git a/src/lib/kernel/console.c b/src/lib/kernel/console.c index 0d031b5..844b184 100644 --- a/src/lib/kernel/console.c +++ b/src/lib/kernel/console.c @@ -37,17 +37,17 @@ static bool use_console_lock; lock_console() vprintf() - printf() - palloc() tries to grab the lock again + printf() - palloc() tries to grab the lock again palloc_free() - schedule_tail() - another thread dying as we switch threads + thread_schedule_tail() - another thread dying as we switch threads schedule() thread_yield() - intr_handler() - timer interrupt + intr_handler() - timer interrupt intr_set_level() serial_putc() putchar_have_lock() putbuf() - sys_write() - one process writing to the console + sys_write() - one process writing to the console syscall_handler() intr_handler() diff --git a/src/threads/switch.S b/src/threads/switch.S index 244249e..feca86c 100644 --- a/src/threads/switch.S +++ b/src/threads/switch.S @@ -54,10 +54,10 @@ switch_entry: # Discard switch_threads() arguments. addl $8, %esp - # Call schedule_tail(prev). + # Call thread_schedule_tail(prev). pushl %eax -.globl schedule_tail - call schedule_tail +.globl thread_schedule_tail + call thread_schedule_tail addl $4, %esp # Start thread proper. diff --git a/src/threads/thread.c b/src/threads/thread.c index 2532463..955ccdc 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -68,7 +68,7 @@ static void init_thread (struct thread *, const char *name, int priority); static bool is_thread (struct thread *) UNUSED; static void *alloc_frame (struct thread *, size_t size); static void schedule (void); -void schedule_tail (struct thread *prev); +void thread_schedule_tail (struct thread *prev); static tid_t allocate_tid (void); /* Initializes the threading system by transforming the code @@ -296,7 +296,7 @@ thread_exit (void) /* Remove thread from all threads list, set our status to dying, and schedule another process. That process will destroy us - when it call schedule_tail(). */ + when it calls thread_schedule_tail(). */ intr_disable (); list_remove (&thread_current()->allelem); thread_current ()->status = THREAD_DYING; @@ -516,7 +516,7 @@ next_thread_to_run (void) After this function and its caller returns, the thread switch is complete. */ void -schedule_tail (struct thread *prev) +thread_schedule_tail (struct thread *prev) { struct thread *cur = running_thread (); @@ -550,8 +550,8 @@ schedule_tail (struct thread *prev) running to some other state. This function finds another thread to run and switches to it. - It's not safe to call printf() until schedule_tail() has - completed. */ + It's not safe to call printf() until thread_schedule_tail() + has completed. */ static void schedule (void) { @@ -565,7 +565,7 @@ schedule (void) if (cur != next) prev = switch_threads (cur, next); - schedule_tail (prev); + thread_schedule_tail (prev); } /* Returns a tid to use for a new thread. */ diff --git a/src/userprog/tss.c b/src/userprog/tss.c index 709dd3a..f8ed9a9 100644 --- a/src/userprog/tss.c +++ b/src/userprog/tss.c @@ -42,7 +42,7 @@ not in use, so we can always use that. Thus, when the scheduler switches threads, it also changes the TSS's stack pointer to point to the new thread's kernel stack. - (The call is in schedule_tail() in thread.c.) + (The call is in thread_schedule_tail() in thread.c.) See [IA32-v3a] 6.2.1 "Task-State Segment (TSS)" for a description of the TSS. See [IA32-v3a] 5.12.1 "Exception- or