Ejemplo n.º 1
0
void process_init()
{
	process_cache = kmem_cache_create("process_cache",
		sizeof(struct process), 32, NULL, NULL);
	if(!process_cache)
		panic("process_init: Not Enough Memory to boot ManRiX\n");

	phash =	(phashtable_t)kmem_alloc(PAGE_SIZE);
	if(!phash)
		panic("process_init: Not Enough Memory to boot ManRiX\n");
	memset(phash, 0, PAGE_SIZE);

	list_init(&kernel_process.threads);
	list_init(&kernel_process.proclist);
	list_init(&kernel_process.child);
	list_init(&kernel_process.sigqueue);
	list_init(&kernel_process.timer);
	kernel_process.parent = kernel;
	list_init(&sysinfo.proclist);
	SPIN_LOCK_INIT(&kernel_process.lock);

	thread_init();
	init_signal();
	id_init();
	fd_init();
	sync_init();
}
Ejemplo n.º 2
0
void buffer_init()
{
	struct  hlist_head* begin = buffer_hash;
	struct  hlist_head* end = buffer_hash + HASH_SIZE;
	for (begin; begin < end; begin++) {
		INIT_HLIST_HEAD(begin);
	}
	SPIN_LOCK_INIT(&hash_lock);
	buffer_count = 0;

}
Ejemplo n.º 3
0
static struct buffer_head *
buffer_alloc(int dev,uint32_t block)
{
	struct buffer_head *buf;
	buf = kmalloc(sizeof(struct buffer_head));

	if (!buf)
		return NULL;

	memset(buf,0x0,sizeof(struct buffer_head));
	buf->b_blocknr = block;
	buf->b_dev = dev;
	SPIN_LOCK_INIT(&buf->b_lock);
	INIT_HLIST_NODE(&buf->list_free);

	return buf;
}
Ejemplo n.º 4
0
static struct clocksource_t __cs_dummy = {
	.keeper = {
		.interval = 35184372083832,
		.last = 0,
		.nsec = 0,
		.lock = { 0 },
	},
	.name = "cs-dummy",
	.mask = CLOCKSOURCE_MASK(64),
	.mult = 2621440000,
	.shift = 18,
	.read = __cs_dummy_read,
};
static struct clocksource_t * __clocksource = &__cs_dummy;
static spinlock_t __clocksource_lock = SPIN_LOCK_INIT();

static ssize_t clocksource_read_mult(struct kobj_t * kobj, void * buf, size_t size)
{
	struct clocksource_t * cs = (struct clocksource_t *)kobj->priv;
	return sprintf(buf, "%u", cs->mult);
}

static ssize_t clocksource_read_shift(struct kobj_t * kobj, void * buf, size_t size)
{
	struct clocksource_t * cs = (struct clocksource_t *)kobj->priv;
	return sprintf(buf, "%u", cs->shift);
}

static ssize_t clocksource_read_period(struct kobj_t * kobj, void * buf, size_t size)
{
Ejemplo n.º 5
0
{
	return 0;
}

static ssize_t __console_dummy_write(struct console_t * console, const unsigned char * buf, size_t count)
{
	return 0;
}

static struct console_t __console_dummy = {
	.name	= "console-dummy",
	.read	= __console_dummy_read,
	.write	= __console_dummy_write,
};
static struct console_t * __console = &__console_dummy;
static spinlock_t __console_lock = SPIN_LOCK_INIT();

static ssize_t console_read_active(struct kobj_t * kobj, void * buf, size_t size)
{
	struct console_t * console = (struct console_t *)kobj->priv;

	return sprintf(buf, "%d", (__console == console) ? 1 : 0);
}

static ssize_t console_write_active(struct kobj_t * kobj, void * buf, size_t size)
{
	struct console_t * console = (struct console_t *)kobj->priv;
	irq_flags_t flags;

	spin_lock_irqsave(&__console_lock, flags);
	__console = console;