Subversion Repositories HelenOS-historic

Rev

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

Rev 110 Rev 113
Line 62... Line 62...
62
        /*
62
        /*
63
         * Identity mapping for all but 0th page.
63
         * Identity mapping for all but 0th page.
64
         * PA2KA(identity) mapping for all but 0th page.
64
         * PA2KA(identity) mapping for all but 0th page.
65
         */
65
         */
66
        for (i = 1; i < frames; i++) {
66
        for (i = 1; i < frames; i++) {
67
            map_page_to_frame(i * PAGE_SIZE, i * PAGE_SIZE, PAGE_CACHEABLE, dba);
67
            map_page_to_frame(i * PAGE_SIZE, i * PAGE_SIZE, PAGE_CACHEABLE, KA2PA(dba));
68
            map_page_to_frame(PA2KA(i * PAGE_SIZE), i * PAGE_SIZE, PAGE_CACHEABLE, dba);
68
            map_page_to_frame(PA2KA(i * PAGE_SIZE), i * PAGE_SIZE, PAGE_CACHEABLE, KA2PA(dba));
69
        }
69
        }
70
 
70
 
71
        trap_register(14, page_fault);
71
        trap_register(14, page_fault);
72
        cpu_write_dba(KA2PA(dba));
72
        cpu_write_dba(KA2PA(dba));
73
    }
73
    }
Line 110... Line 110...
110
    else dba = cpu_read_dba();
110
    else dba = cpu_read_dba();
111
 
111
 
112
    pde = page >> 22;       /* page directory entry */
112
    pde = page >> 22;       /* page directory entry */
113
    pte = (page >> 12) & 0x3ff; /* page table entry */
113
    pte = (page >> 12) & 0x3ff; /* page table entry */
114
   
114
   
115
    pd = (struct page_specifier *) dba;
115
    pd = (struct page_specifier *) PA2KA(dba);
116
   
116
   
117
    if (!pd[pde].present) {
117
    if (!pd[pde].present) {
118
        /*
118
        /*
119
         * There is currently no page table for this address. Allocate
119
         * There is currently no page table for this address. Allocate
120
         * frame for the page table and clean it.
120
         * frame for the page table and clean it.
Line 124... Line 124...
124
        memsetb(newpt, PAGE_SIZE, 0);
124
        memsetb(newpt, PAGE_SIZE, 0);
125
        pd[pde].present = 1;
125
        pd[pde].present = 1;
126
        pd[pde].uaccessible = 1;
126
        pd[pde].uaccessible = 1;
127
    }
127
    }
128
   
128
   
129
    pt = (struct page_specifier *) (pd[pde].frame_address << 12);
129
    pt = (struct page_specifier *) PA2KA((pd[pde].frame_address << 12));
130
 
130
 
131
    pt[pte].frame_address = frame >> 12;
131
    pt[pte].frame_address = frame >> 12;
132
    pt[pte].present = !(flags & PAGE_NOT_PRESENT);
132
    pt[pte].present = !(flags & PAGE_NOT_PRESENT);
133
    pt[pte].page_cache_disable = !(flags & PAGE_CACHEABLE);
133
    pt[pte].page_cache_disable = !(flags & PAGE_CACHEABLE);
134
    pt[pte].uaccessible = (flags & PAGE_USER) != 0;
134
    pt[pte].uaccessible = (flags & PAGE_USER) != 0;