metalsvm/kernel/main.c
stefan 0aea73bdc7 - add a simple memory mangement unit
- use a bitmask to mark used pages (see lecture notes "BS")


git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@7 315a16e6-25f9-4109-90ae-ca3045a26c18
2010-08-02 07:43:56 +00:00

78 lines
1.7 KiB
C

/*
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
* RWTH Aachen University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of MetalSVM.
*/
#include <metalsvm/stddef.h>
#include <metalsvm/stdio.h>
#include <metalsvm/time.h>
#include <metalsvm/irq.h>
#include <metalsvm/irqflags.h>
#include <metalsvm/mmu.h>
#include <metalsvm/tasks.h>
#include <metalsvm/processor.h>
#include <asm/kb.h>
void* STDCALL foo(void* arg)
{
int i;
if (!arg)
return NULL;
for(i=0; i<5; i++) {
kputs((char*) arg);
sleep(1);
}
return NULL;
}
int main(void)
{
tid_t id1, id2;
system_init();
irq_init();
koutput_init();
timer_init();
keyboard_init();
mmu_init();
multitasking_init();
irq_enable();
kprintf("Here is MetalSVM %s\n", METALSVM_VERSION);
detect_cpu_frequency();
kprintf("Processor frequency: %d MHz\n", get_cpu_frequency()/1000000);
kprintf("Kernel size: %u KBytes\n", atomic_size_read(&total_usage)/1024);
timer_set_frequency(TIMER_FREQ);
create_kernel_task(&id1, foo, "Hello from foo1\n", 8192);
create_kernel_task(&id2, foo, "Hello from foo2\n", 0);
current_task->idle = 1;
schedule();
while(1) {
NOP8;
}
return 0;
}