void omp_init_lock(omp_lock_t *lock) { gomp_hal_init_lock(lock); }
//#################################################################### // Functions from memutils.c void omp_initenv(int nprocs, int pid) { int i; gomp_team_t * root_team; shmalloc_init(STATIC_TCDM_SIZE + sizeof(int)); #ifdef HEAP_HANDLERS heap_handler = heap_init(2048); //change pr("####################################", 0x0, PR_STRING | PR_NEWL); #endif gomp_hal_init_locks(FIRST_FREE_LOCK_ID); GLOBAL_IDLE_CORES = nprocs - 1; GLOBAL_THREAD_POOL = (1 << MASTER_ID); /* pr("locks = ", locks, PR_STRING | PR_NEWL | PR_HEX); pr("next_lock = ", locks, PR_STRING | PR_NEWL | PR_HEX); pr("global_lock = ", locks, PR_STRING | PR_NEWL | PR_HEX); pr("next_lock_lock = ", locks, PR_STRING | PR_NEWL | PR_HEX); */ gomp_hal_init_lock(GLOBAL_LOCK); for(i=0; i<nprocs; i++){ CURR_TEAM(i) = (gomp_team_t *) NULL; } //Create "main" team descriptor. This also intializes master core's curr_team descriptor // gomp_team_start (_app_main, NULL, 1, &root_team); // Equivalent to GOMP_TEAM_START gomp_master_region_start (/*_app_main*/ (void*) 0x3090, NULL, 1, &root_team); // Update pointer to first available SHMEM location so that application-level queries to shmalloc //are returned values non-overlapping with the addresses used in the runtime system // //shmalloc_init(0xa000); //pr("After initenv, shmem_next = ", shmem_next, PR_STRING | PR_NEWL | PR_HEX); alloc_global_point = shmem_next; shmem_next += sizeof(global_point_t); Init_Flag = shmem_next; shmem_next += sizeof(int); //Allocate Space for 5 barriers. (ID: 0, 1, 2, 3, 4) Barrier_Base = shmem_next; shmem_next += 5*Barrier_Size; global_data_base = shmem_next; shmem_next += sizeof(global_data); base = (Header *) shmem_next; freep = NULL; /* for (i=0; i<NUM_FREE_LISTS; i++) { global_data.free_lists[i] = NULL; } global_data.free_lists[NUM_FREE_LISTS] = shmem_next; global_data.free_lists[NUM_FREE_LISTS]->s.next = global_data.free_lists[NUM_FREE_LISTS]; global_data.free_lists[NUM_FREE_LISTS]->s.prev = global_data.free_lists[NUM_FREE_LISTS]; */ pr("Heap usage after Initialization:" , shmem_next - 0x8000000, PR_HEX|PR_STRING|PR_NEWL); }