Loading [MathJax]/extensions/tex2jax.js
CS350 COS
COS
All Data Structures Files Functions Variables Typedefs Macros
critical.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <sys/kassert.h>
#include <sys/kdebug.h>
#include <sys/kconfig.h>
#include <sys/mp.h>
#include <sys/spinlock.h>
#include <machine/amd64.h>
#include <machine/amd64op.h>
Include dependency graph for critical.c:

Go to the source code of this file.

Functions

void Critical_Init ()
 
void Critical_Enter ()
 
void Critical_Exit ()
 
uint32_t Critical_Level ()
 
static void Debug_Critical (int argc, const char *argv[])
 
 REGISTER_DBGCMD (critical, "Critical Enter/Exit Stats", Debug_Critical)
 

Variables

uint32_t lockLevel [MAX_CPUS]
 

Function Documentation

◆ Critical_Enter()

void Critical_Enter ( )

Definition at line 28 of file critical.c.

29{
31 lockLevel[CPU()]++;
32}
static INLINE void disable_interrupts()
Definition: amd64op.h:14
uint32_t lockLevel[MAX_CPUS]
Definition: critical.c:14
#define CPU
Definition: mp.h:7
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Critical_Exit()

void Critical_Exit ( )

Definition at line 35 of file critical.c.

36{
37 lockLevel[CPU()]--;
38 if (lockLevel[CPU()] == 0)
39 {
41 }
42}
static INLINE void enable_interrupts()
Definition: amd64op.h:9
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Critical_Init()

void Critical_Init ( )

Definition at line 17 of file critical.c.

18{
19 int c;
20
21 for (c = 0; c < MAX_CPUS; c++)
22 {
23 lockLevel[c] = 0;
24 }
25}
#define MAX_CPUS
Definition: kconfig.h:8
Here is the caller graph for this function:

◆ Critical_Level()

uint32_t Critical_Level ( )

Definition at line 45 of file critical.c.

46{
47 return lockLevel[CPU()];
48}
Here is the caller graph for this function:

◆ Debug_Critical()

static void Debug_Critical ( int  argc,
const char *  argv[] 
)
static

Definition at line 51 of file critical.c.

52{
53 int c;
54
55 for (c = 0; c < MAX_CPUS; c++) {
56 kprintf("CPU%d: %u\n", c, lockLevel[c]);
57 }
58}
int kprintf(const char *fmt,...)
Definition: printf.c:210
Here is the call graph for this function:

◆ REGISTER_DBGCMD()

REGISTER_DBGCMD ( critical  ,
"Critical Enter/Exit Stats"  ,
Debug_Critical   
)

Variable Documentation

◆ lockLevel

uint32_t lockLevel[MAX_CPUS]

Definition at line 14 of file critical.c.