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

cpu_lock.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef cpu_lock_h
00004 #define cpu_lock_h
00005 
00006 #include "types.h"
00007 
00008 //
00009 // INTERFACE definition follows 
00010 //
00011 
00012 
00022 class Cpu_lock
00023 {
00024 public:
00026   typedef Mword Status;
00027 
00029   inline Cpu_lock();
00030 
00035   Status test() const;
00036 
00042   void lock();
00043 
00047   void clear();
00048 
00054   Status test_and_set();
00055 
00060   void set(Status state);
00061 
00062 private:
00064   Cpu_lock (const Cpu_lock&);
00065 
00066 };
00067 
00072 extern Cpu_lock cpu_lock;
00073 
00074 //
00075 // IMPLEMENTATION includes follow (for use by inline functions)
00076 //
00077 
00085 #include "processor.h"
00086 
00087 //
00088 // IMPLEMENTATION of inline functions (and needed classes)
00089 //
00090 
00091 
00092 
00093 
00094 //NEEDS [Cpu_lock::lock, Cpu_lock::test]
00095 inline Cpu_lock::Status Cpu_lock::test_and_set()
00096 {
00097   Status ret = test();
00098   lock();
00099   return ret;
00100 }
00101 
00102 
00103 
00104 //NEEDS [Cpu_lock::lock, Cpu_lock::clear]
00105 inline void Cpu_lock::set(Cpu_lock::Status state)
00106 {
00107   if (state)
00108     lock();
00109   else
00110     clear();
00111 }
00112 
00113 
00114 
00115 inline Cpu_lock::Cpu_lock()
00116 {}
00117 
00118 
00119 
00120 inline void Cpu_lock::lock()
00121 {
00122   Proc::cli();
00123 }
00124 
00125 
00126 
00127 inline void
00128 Cpu_lock::clear()
00129 {
00130   Proc::sti();
00131 }
00132 
00133 
00134 
00135 inline Cpu_lock::Status Cpu_lock::test() const
00136 {
00137   return ! Proc::interrupts();
00138 }
00139 
00140 #endif // cpu_lock_h

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