/* * 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 #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_ROCKCREEK #include #endif extern int test_init(void); /* * Note that linker symbols are not variables, they have no memory allocated for * maintaining a value, rather their address is their value. */ extern const void kernel_start; extern const void kernel_end; extern char __BUILD_DATE; extern char __BUILD_TIME; static void list_fs(vfs_node_t* node, uint32_t depth) { int j, i = 0; dirent_t* dirent = NULL; while ((dirent = readdir_fs(node, i)) != 0) { for(j=0; jname); if (strcmp(dirent->name, ".") && strcmp(dirent->name, "..")) { vfs_node_t *new_node = finddir_fs(node, dirent->name); if (new_node) { if (new_node->type == FS_FILE) { char buff[16] = {[0 ... 15] = 0x00}; read_fs(new_node, (uint8_t*)buff, 8, 0); for(j=0; j 1 // idle loop of the application processors int smp_main(void) { irq_enable(); while(1) { HALT; } return 0; } #endif int main(void) { lowlevel_init(); pushbg(COL_BLUE); kprintf("This is MetalSVM %s Build %u, %u\n", METALSVM_VERSION, &__BUILD_DATE, &__BUILD_TIME); popbg(); system_init(); irq_init(); timer_init(); #ifdef CONFIG_KEYBOARD keyboard_init(); #endif multitasking_init(); mmu_init(); #ifdef CONFIG_ROCKCREEK icc_init(); #endif initrd_init(); irq_enable(); kprintf("Kernel starts at %p and ends at %p\n", &kernel_start, &kernel_end); system_calibration(); network_init(); kprintf("Processor frequency: %u MHz\n", get_cpu_frequency()); kprintf("Total memory: %u MBytes\n", atomic_int32_read(&total_pages)/((1024*1024)/PAGE_SIZE)); kprintf("Current allocated memory: %u KBytes\n", atomic_int32_read(&total_allocated_pages)*(PAGE_SIZE/1024)); kprintf("Current available memory: %u MBytes\n", atomic_int32_read(&total_available_pages)/((1024*1024)/PAGE_SIZE)); sleep(5); list_root(); test_init(); per_core(current_task)->status = TASK_IDLE; per_core(current_task)->time_slices = 0; // reset the number of time slices reschedule(); while(1) { #ifdef CONFIG_ROCKCREEK icc_halt(); #else HALT; #endif } return 0; }