Subversion Repositories HelenOS-historic

Rev

Rev 1075 | Rev 1131 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1075 Rev 1130
Line 34... Line 34...
34
#define KERNEL_END ((void *) &_binary_____________kernel_kernel_bin_end)
34
#define KERNEL_END ((void *) &_binary_____________kernel_kernel_bin_end)
35
#define KERNEL_SIZE ((unsigned int) KERNEL_END - (unsigned int) KERNEL_START)
35
#define KERNEL_SIZE ((unsigned int) KERNEL_END - (unsigned int) KERNEL_START)
36
 
36
 
37
#define HEAP_GAP 1024000
37
#define HEAP_GAP 1024000
38
 
38
 
-
 
39
typedef struct {
39
memmap_t memmap;
40
    memmap_t memmap;
-
 
41
    screen_t screen;
-
 
42
} bootinfo_t;
-
 
43
 
-
 
44
bootinfo_t bootinfo;
40
 
45
 
41
 
46
 
42
static void check_align(const void *addr, const char *desc)
47
static void check_align(const void *addr, const char *desc)
43
{
48
{
44
    if ((unsigned int) addr % PAGE_SIZE != 0) {
49
    if ((unsigned int) addr % PAGE_SIZE != 0) {
Line 80... Line 85...
80
   
85
   
81
    check_align(KERNEL_START, "Kernel image");
86
    check_align(KERNEL_START, "Kernel image");
82
    check_align(&real_mode, "Bootstrap trampoline");
87
    check_align(&real_mode, "Bootstrap trampoline");
83
    check_align(&trans, "Translation table");
88
    check_align(&trans, "Translation table");
84
   
89
   
85
    if (!ofw_memmap(&memmap)) {
90
    if (!ofw_memmap(&bootinfo.memmap)) {
86
        printf("Error: Unable to get memory map\n");
91
        printf("Error: Unable to get memory map\n");
87
        halt();
92
        halt();
88
    }
93
    }
89
   
94
   
-
 
95
    if (!ofw_screen(&bootinfo.screen)) {
-
 
96
        printf("Error: Unable to get screen properties\n");
-
 
97
        halt();
-
 
98
    }
-
 
99
   
-
 
100
    printf("\nDevice statistics\n");
-
 
101
    printf(" screen at %L, resolution %dx%d, %d bpp (scanline %d bytes)\n", bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);
-
 
102
   
90
    void *real_mode_pa = ofw_translate(&real_mode);
103
    void *real_mode_pa = ofw_translate(&real_mode);
91
    void *trans_pa = ofw_translate(&trans);
104
    void *trans_pa = ofw_translate(&trans);
92
    void *memmap_pa = ofw_translate(&memmap);
105
    void *bootinfo_pa = ofw_translate(&bootinfo);
93
   
106
   
94
    printf("Memory statistics (total %d MB)\n", memmap.total >> 20);
107
    printf("\nMemory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
95
    printf(" kernel image         at %L (size %d bytes)\n", KERNEL_START, KERNEL_SIZE);
108
    printf(" kernel image         at %L (size %d bytes)\n", KERNEL_START, KERNEL_SIZE);
96
    printf(" memory map           at %L (physical %L)\n", &memmap, memmap_pa);
109
    printf(" boot info            at %L (physical %L)\n", &bootinfo, bootinfo_pa);
97
    printf(" bootstrap trampoline at %L (physical %L)\n", &real_mode, real_mode_pa);
110
    printf(" bootstrap trampoline at %L (physical %L)\n", &real_mode, real_mode_pa);
98
    printf(" translation table    at %L (physical %L)\n", &trans, trans_pa);
111
    printf(" translation table    at %L (physical %L)\n", &trans, trans_pa);
99
   
112
   
100
    unsigned int top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE);
113
    unsigned int top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE);
101
    unsigned int addr;
114
    unsigned int addr;
Line 105... Line 118...
105
        trans[addr >> PAGE_WIDTH] = pa;
118
        trans[addr >> PAGE_WIDTH] = pa;
106
    }
119
    }
107
   
120
   
108
    fix_overlap(&real_mode, &real_mode_pa, "Bootstrap trampoline", &top);
121
    fix_overlap(&real_mode, &real_mode_pa, "Bootstrap trampoline", &top);
109
    fix_overlap(&trans, &trans_pa, "Translation table", &top);
122
    fix_overlap(&trans, &trans_pa, "Translation table", &top);
110
    fix_overlap(&memmap, &memmap_pa, "Memory map", &top);
123
    fix_overlap(&bootinfo, &bootinfo_pa, "Boot info", &top);
111
   
124
   
112
    printf("Booting the kernel...\n");
125
    printf("\nBooting the kernel...\n");
113
    jump_to_kernel(memmap_pa, trans_pa, KERNEL_SIZE, real_mode_pa);
126
    jump_to_kernel(bootinfo_pa, trans_pa, KERNEL_SIZE, real_mode_pa);
114
}
127
}