TSC backed timekeeping, 64-bit integer printing
[tpg/acess2.git] / Kernel / include / acess.h
index 861fd30..95acb31 100644 (file)
@@ -22,14 +22,24 @@ typedef Uint        tGID;
 typedef Sint64 tTimestamp;
 typedef struct sShortSpinlock  tShortSpinlock;
 typedef struct sMutex  tMutex;
+typedef struct sSemaphore      tSemaphore;
 
 struct sMutex {
        tShortSpinlock  Protector;      //!< Protector for the lock strucure
+       const char      *Name;  //!< Human-readable name
        struct sThread  *volatile Owner;        //!< Owner of the lock (set upon getting the lock)
        struct sThread  *Waiting;       //!< Waiting threads
        struct sThread  *LastWaiting;   //!< Waiting threads
 };
 
+struct sSemaphore {
+       tShortSpinlock  Protector;      //!< Protector for the lock strucure
+       const char      *Name;  //!< Human-readable name
+       volatile int    Value;  //!< Current mutex value
+       struct sThread  *Waiting;       //!< Waiting threads
+       struct sThread  *LastWaiting;   //!< Waiting threads
+};
+
 // --- Helper Macros ---
 /**
  * \name Helper Macros
@@ -123,16 +133,16 @@ extern void       Log_Debug(char *Ident, char *Message, ...);
  * \{
  */
 extern void    Debug_KernelPanic(void);        //!< Initiate a kernel panic
-extern void    Panic(char *Msg, ...);  //!< Print a panic message (initiates a kernel panic)
-extern void    Warning(char *Msg, ...);        //!< Print a warning message
-extern void    LogF(char *Fmt, ...);   //!< Print a log message without a trailing newline
-extern void    Log(char *Fmt, ...);    //!< Print a log message
-extern void    Debug(char *Fmt, ...);  //!< Print a debug message (doesn't go to KTerm)
-extern void    LogV(char *Fmt, va_list Args);  //!< va_list Log message
-extern void    Debug_Enter(char *FuncName, char *ArgTypes, ...);
-extern void    Debug_Log(char *FuncName, char *Fmt, ...);
-extern void    Debug_Leave(char *FuncName, char RetType, ...);
-extern void    Debug_HexDump(char *Header, void *Data, Uint Length);
+extern void    Panic(const char *Msg, ...);    //!< Print a panic message (initiates a kernel panic)
+extern void    Warning(const char *Msg, ...);  //!< Print a warning message
+extern void    LogF(const char *Fmt, ...);     //!< Print a log message without a trailing newline
+extern void    Log(const char *Fmt, ...);      //!< Print a log message
+extern void    Debug(const char *Fmt, ...);    //!< Print a debug message (doesn't go to KTerm)
+extern void    LogV(const char *Fmt, va_list Args);    //!< va_list Log message
+extern void    Debug_Enter(const char *FuncName, const char *ArgTypes, ...);
+extern void    Debug_Log(const char *FuncName, const char *Fmt, ...);
+extern void    Debug_Leave(const char *FuncName, char RetType, ...);
+extern void    Debug_HexDump(const char *Header, const void *Data, Uint Length);
 #define UNIMPLEMENTED()        Warning("'%s' unimplemented", __func__)
 #if DEBUG
 # define ENTER(_types...)      Debug_Enter((char*)__func__, _types)
@@ -336,7 +346,7 @@ extern char **str_split(const char *__str, char __ch);
 extern char    *strchr(const char *__s, int __c);
 extern int     strpos(const char *Str, char Ch);
 extern int     strpos8(const char *str, Uint32 search);
-extern void    itoa(char *buf, Uint num, int base, int minLength, char pad);
+extern void    itoa(char *buf, Uint64 num, int base, int minLength, char pad);
 extern int     atoi(const char *string);
 extern int     ReadUTF8(Uint8 *str, Uint32 *Val);
 extern int     WriteUTF8(Uint8 *str, Uint32 Val);

UCC git Repository :: git.ucc.asn.au