Subversion Repositories HelenOS

Rev

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

Rev 3104 Rev 3382
Line 76... Line 76...
76
 *     serviced).
76
 *     serviced).
77
 */
77
 */
78
int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
78
int anon_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
79
{
79
{
80
    uintptr_t frame;
80
    uintptr_t frame;
81
    bool dirty = false;
-
 
82
 
81
 
83
    if (!as_area_check_access(area, access))
82
    if (!as_area_check_access(area, access))
84
        return AS_PF_FAULT;
83
        return AS_PF_FAULT;
85
 
84
 
86
    if (area->sh_info) {
85
    if (area->sh_info) {
Line 104... Line 103...
104
             * Zero can be returned as a valid frame address.
103
             * Zero can be returned as a valid frame address.
105
             * Just a small workaround.
104
             * Just a small workaround.
106
             */
105
             */
107
            for (i = 0; i < leaf->keys; i++) {
106
            for (i = 0; i < leaf->keys; i++) {
108
                if (leaf->key[i] ==
107
                if (leaf->key[i] ==
109
                    ALIGN_DOWN(addr, PAGE_SIZE)) {
108
                    ALIGN_DOWN(addr, PAGE_SIZE) - area->base) {
110
                    allocate = false;
109
                    allocate = false;
111
                    break;
110
                    break;
112
                }
111
                }
113
            }
112
            }
114
            if (allocate) {
113
            if (allocate) {
115
                frame = (uintptr_t) frame_alloc(ONE_FRAME, 0);
114
                frame = (uintptr_t) frame_alloc(ONE_FRAME, 0);
116
                memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
115
                memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
117
                dirty = true;
-
 
118
               
116
               
119
                /*
117
                /*
120
                 * Insert the address of the newly allocated
118
                 * Insert the address of the newly allocated
121
                 * frame to the pagemap.
119
                 * frame to the pagemap.
122
                 */
120
                 */
Line 143... Line 141...
143
         *   do not forget to distinguish between
141
         *   do not forget to distinguish between
144
         *   the different causes
142
         *   the different causes
145
         */
143
         */
146
        frame = (uintptr_t) frame_alloc(ONE_FRAME, 0);
144
        frame = (uintptr_t) frame_alloc(ONE_FRAME, 0);
147
        memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
145
        memsetb((void *) PA2KA(frame), FRAME_SIZE, 0);
148
        dirty = true;
-
 
149
    }
146
    }
150
   
147
   
151
    /*
148
    /*
152
     * Map 'page' to 'frame'.
149
     * Map 'page' to 'frame'.
153
     * Note that TLB shootdown is not attempted as only new information is
150
     * Note that TLB shootdown is not attempted as only new information is