managementshim/management.c
//Returns char because then the load does not get optimized away.
Returns char because then the load does not get optimized away.
Returns char because then the load does not get optimized away .
char putPageEntry(Address_t baseAddress, enclave_id_t id) {
  char *basePointer = (char *) baseAddress;
  volatile char x;
  Address_t pageNumber = (baseAddress - DRAM_BASE) / PAGE_SIZE;
  volatile struct page_tag_t *pageTag;
  if(baseAddress < DRAM_BASE) {
    return '0';
  }
  x = *((volatile char *)(PAGE_DIRECTORY_BASE_ADDRESS + (baseAddress % PAGE_SIZE)));
  pageTag = (volatile struct page_tag_t *) (TAGDIRECTORY_BASE + (pageNumber*sizeof(struct page_tag_t)));
  pageTag->owner = id;
  return x;
}
char putPageEntry ( Address_t baseAddress , enclave_id_t id ) { char * basePointer = ( char * ) baseAddress ; volatile char x ; Address_t pageNumber = ( baseAddress - DRAM_BASE ) / PAGE_SIZE ; volatile struct page_tag_t * pageTag ; if ( baseAddress < DRAM_BASE ) { return ' ' ; } x = * ( ( volatile char * ) ( PAGE_DIRECTORY_BASE_ADDRESS + ( baseAddress % PAGE_SIZE ) ) ) ; pageTag = ( volatile struct page_tag_t * ) ( TAGDIRECTORY_BASE + ( pageNumber * sizeof ( struct page_tag_t ) ) ) ; pageTag -> owner = id ; return x ; }
Returns char because then the load does not get optimized away.
Returns char because then the load does not get optimized away .
//This load is to simulate the latency that would be caused to get this tag into the cache. //volatile char x = *basePointer; //This is not allowed if management enclave does not own the page. //At the moment we do not support tagging pages outside of DRAM.