genode/base-foc/include/base/cap_sel_alloc.h

69 lines
1.7 KiB
C
Raw Normal View History

2011-12-22 15:19:25 +00:00
/*
* \brief Interface for process-local capability-selector allocation
* \author Norman Feske
* \author Stefan Kalkowski
* \date 2010-01-19
*
* This interface is Fiasco-specific and not part of the Genode API. It should
* only be used internally by the framework or by Fiasco-specific code. The
* implementation of the interface is part of the environment library.
*
* This implementation is borrowed by the nova-platform equivalent.
* (TODO: merge it)
*/
/*
2012-01-03 14:35:05 +00:00
* Copyright (C) 2010-2012 Genode Labs GmbH
2011-12-22 15:19:25 +00:00
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__CAP_SEL_ALLOC_H_
#define _INCLUDE__BASE__CAP_SEL_ALLOC_H_
#include <base/stdint.h>
namespace Genode
{
class Capability_allocator
{
private:
addr_t _cap_idx;
/**
* Constructor
*/
Capability_allocator();
public:
/**
* Return singleton instance of 'Capability_allocator'
*/
static Capability_allocator* allocator();
/**
* Allocate range of capability selectors
*
* \param num_caps_log2 number of capability selectors. By default,
* the function returns a single capability selector.
* \return first capability selector of allocated range,
* or 0 if allocation failed
*/
addr_t alloc(size_t num_caps = 1);
/**
* Release range of capability selectors
*
* \param cap first capability selector of range
* \param num_caps_log2 number of capability selectors to free.
*/
void free(addr_t cap, size_t num_caps = 1);
};
}
#endif /* _INCLUDE__BASE__CAP_SEL_ALLOC_H_ */