Handout
This commit is contained in:
		
							
								
								
									
										30
									
								
								interrupt/guard.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								interrupt/guard.cc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
#include "guard.h"
 | 
			
		||||
 | 
			
		||||
#include "../arch/core.h"
 | 
			
		||||
#include "../debug/output.h"
 | 
			
		||||
#include "../object/bbuffer.h"
 | 
			
		||||
#include "../sync/ticketlock.h"
 | 
			
		||||
#include "epilogues.h"
 | 
			
		||||
 | 
			
		||||
#define FOR_CURRENT_CORE [Core::getID()]
 | 
			
		||||
 | 
			
		||||
//! \brief The protected data for the epilogue level
 | 
			
		||||
static Vault global_vault;
 | 
			
		||||
 | 
			
		||||
// lists of pending epilogues
 | 
			
		||||
static BBuffer<Epilogue, 32> epilogue_queue[Core::MAX] = {};
 | 
			
		||||
// Big Kernel Lock (BKL) for the epilogue level
 | 
			
		||||
constinit Ticketlock global_lock;
 | 
			
		||||
constinit bool epi_flag[Core::MAX] = {false};
 | 
			
		||||
 | 
			
		||||
Vault::Vault() {}
 | 
			
		||||
 | 
			
		||||
Guarded::~Guarded() { Guard::leave(); }
 | 
			
		||||
 | 
			
		||||
Guarded Guard::enter() { while (true); }
 | 
			
		||||
 | 
			
		||||
void Guard::leave() {}
 | 
			
		||||
 | 
			
		||||
void Guard::relay(Epilogue handler) { (void)handler; }
 | 
			
		||||
 | 
			
		||||
const Vault &Guard::unsafeConstAccess() { return global_vault; }
 | 
			
		||||
		Reference in New Issue
	
	Block a user