Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

globals.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef globals_h
00004 #define globals_h
00005 
00006 #include <cassert>              // panic()
00007 
00008 #include "mem_layout.h"
00009 #include "types.h"
00010 
00011 //
00012 // INTERFACE definition follows 
00013 //
00014 
00015 
00016 class Context;
00017 class Space;
00018 class Task;
00019 class Thread;
00020 class Timeout;
00021 
00022 extern Task *sigma0_task;
00023 extern Space *sigma0_space;
00024 extern Thread *sigma0_thread;
00025 extern Timeout *timeslice_timeout;
00026 extern bool running;
00027 extern unsigned boot_stack;
00028 
00029 /* the check macro is like assert(), but it evaluates its argument
00030    even if NDEBUG is defined */
00031 #ifndef check
00032 #ifdef NDEBUG
00033 # define check(expression) ((void)(expression))
00034 #else /* ! NDEBUG */
00035 # define check(expression) \
00036          ((void)((expression) ? 0 : \
00037                 (panic(__FILE__":%u: failed check `"#expression"'", \
00038                         __LINE__), 0)))
00039 #endif /* ! NDEBUG */
00040 #endif /* check */
00041 
00042 // nil_thread and kernel_thread might have different values on a SMP system
00043 static Thread * const nil_thread    = 
00044   reinterpret_cast<Thread*>(Mem_layout::Tcbs);
00045 static Thread * const kernel_thread = 
00046   reinterpret_cast<Thread*>(Mem_layout::Tcbs);
00047 
00048 inline Context *context_of(const void *ptr);
00049 
00050 inline Context *current();
00051 
00052 //
00053 // IMPLEMENTATION includes follow (for use by inline functions)
00054 //
00055 
00056 
00057 #include "config.h"
00058 
00059 //
00060 // IMPLEMENTATION of inline functions (and needed classes)
00061 //
00062 
00063 
00064 
00065 
00066 inline Context *context_of(const void *ptr)
00067 {
00068   return reinterpret_cast<Context *>
00069     (reinterpret_cast<unsigned long>(ptr) & ~(Config::thread_block_size - 1));
00070 }
00071 
00072 
00073 
00074 inline Context *current()
00075 {
00076   void* esp;
00077   __asm__ __volatile__ 
00078     ("movl %%esp, %0" : "=q" (esp));
00079 
00080   return context_of (esp);
00081 }
00082 
00083 #endif // globals_h

Generated on Mon Sep 26 14:20:10 2005 for Fiasco by  doxygen 1.4.2