Esempio n. 1
0
status_t
smp_init_post_generic_syscalls(void)
{
#if B_DEBUG_SPINLOCK_CONTENTION
	return register_generic_syscall(SPINLOCK_CONTENTION,
		&spinlock_contention_syscall, 0, 0);
#else
	return B_OK;
#endif
}
Esempio n. 2
0
static status_t
arp_init()
{
	mutex_init(&sCacheLock, "arp cache");

	sCache = new(std::nothrow) AddressCache();
	if (sCache == NULL || sCache->Init(64) != B_OK) {
		mutex_destroy(&sCacheLock);
		return B_NO_MEMORY;
	}

	register_generic_syscall(ARP_SYSCALLS, arp_control, 1, 0);
	return B_OK;
}
Esempio n. 3
0
static status_t
arp_init()
{
	mutex_init(&sCacheLock, "arp cache");

	sCache = hash_init(64, offsetof(struct arp_entry, next),
		&arp_entry::Compare, &arp_entry::Hash);
	if (sCache == NULL) {
		mutex_destroy(&sCacheLock);
		return B_NO_MEMORY;
	}

	register_generic_syscall(ARP_SYSCALLS, arp_control, 1, 0);
	return B_OK;
}
Esempio n. 4
0
static status_t
init()
{
	sTeamHash = hash_init(64, Session::NextOffset(), &team_compare, &team_hash);
	if (sTeamHash == NULL)
		return B_NO_MEMORY;

	status_t status;

	sPrefetchHash = hash_init(64, Session::NextOffset(), &prefetch_compare, &prefetch_hash);
	if (sPrefetchHash == NULL) {
		status = B_NO_MEMORY;
		goto err1;
	}

	recursive_lock_init(&sLock, "launch speedup");

	// register kernel syscalls
	if (register_generic_syscall(LAUNCH_SPEEDUP_SYSCALLS,
			launch_speedup_control, 1, 0) != B_OK) {
		status = B_ERROR;
		goto err3;
	}

	// read in prefetch knowledge base

	mkdir("/etc/launch_cache", 0755);
	load_prefetch_data();

	// start boot session

	sMainSession = start_session(-1, -1, -1, "system boot");
	sMainSession->Unlock();
	dprintf("START BOOT %Ld\n", system_time());
	return B_OK;

err3:
	recursive_lock_destroy(&sLock);
	hash_uninit(sPrefetchHash);
err1:
	hash_uninit(sTeamHash);
	return status;
}
Esempio n. 5
0
extern "C" status_t
file_cache_init(void)
{
	// allocate a clean page we can use for writing zeroes
	vm_page_reservation reservation;
	vm_page_reserve_pages(&reservation, 1, VM_PRIORITY_SYSTEM);
	vm_page* page = vm_page_allocate_page(&reservation,
		PAGE_STATE_WIRED | VM_PAGE_ALLOC_CLEAR);
	vm_page_unreserve_pages(&reservation);

	sZeroPage = (phys_addr_t)page->physical_page_number * B_PAGE_SIZE;

	for (uint32 i = 0; i < kZeroVecCount; i++) {
		sZeroVecs[i].base = sZeroPage;
		sZeroVecs[i].length = B_PAGE_SIZE;
	}

	register_generic_syscall(CACHE_SYSCALLS, file_cache_control, 1, 0);
	return B_OK;
}