Subversion Repositories HelenOS-historic

Rev

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

Rev 755 Rev 756
Line 40... Line 40...
40
#include <debug.h>
40
#include <debug.h>
41
#include <memstr.h>
41
#include <memstr.h>
42
#include <print.h>
42
#include <print.h>
43
#include <interrupt.h>
43
#include <interrupt.h>
44
 
44
 
45
static __address bootstrap_dba;
-
 
46
 
-
 
47
void page_arch_init(void)
45
void page_arch_init(void)
48
{
46
{
49
    __address dba;
-
 
50
    __address cur;
47
    __address cur;
51
 
48
 
52
    if (config.cpu_active == 1) {
49
    if (config.cpu_active == 1) {
53
        page_operations = &page_pt_operations;
50
        page_operations = &page_pt_operations;
54
   
51
   
55
        dba = frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL);
-
 
56
        memsetb(dba, PAGE_SIZE, 0);
-
 
57
 
-
 
58
        bootstrap_dba = dba;
-
 
59
       
-
 
60
        /*
52
        /*
61
         * PA2KA(identity) mapping for all frames until last_frame.
53
         * PA2KA(identity) mapping for all frames until last_frame.
62
         */
54
         */
63
        for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
55
        for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
64
            page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba));
56
            page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, PAGE_CACHEABLE);
65
 
57
 
66
        exc_register(14, "page_fault", page_fault);
58
        exc_register(14, "page_fault", page_fault);
67
        write_cr3(KA2PA(dba));
59
        write_cr3((__address) AS_KERNEL->page_table);
68
    }
60
    }
69
    else {
61
    else {
70
        write_cr3(KA2PA(bootstrap_dba));
62
        write_cr3((__address) AS_KERNEL->page_table);
71
    }
63
    }
72
 
64
 
73
    paging_on();
65
    paging_on();
74
}
66
}