Changeset 36e86862 in mainline


Ignore:
Timestamp:
2008-06-14T12:53:42Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
62cd66f
Parents:
b22304b
Message:

Maintain cache coherence when the ELF backend duplicates a frame from an
executable segment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/backend_elf.c

    rb22304b r36e86862  
    4949#include <macros.h>
    5050#include <arch.h>
     51#include <arch/barrier.h>
    5152
    5253#ifdef CONFIG_VIRT_IDX_DCACHE
     
    6869 * The address space area and page tables must be already locked.
    6970 *
    70  * @param area Pointer to the address space area.
    71  * @param addr Faulting virtual address.
    72  * @param access Access mode that caused the fault (i.e. read/write/exec).
    73  *
    74  * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e.
    75  *     serviced).
     71 * @param area          Pointer to the address space area.
     72 * @param addr          Faulting virtual address.
     73 * @param access        Access mode that caused the fault (i.e.
     74 *                      read/write/exec).
     75 *
     76 * @return              AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK
     77 *                      on success (i.e. serviced).
    7678 */
    7779int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
     
    151153                        memcpy((void *) PA2KA(frame),
    152154                            (void *) (base + i * FRAME_SIZE), FRAME_SIZE);
     155                        if (entry->p_flags & PF_X)
     156                                smc_coherence_block(PA2KA(frame), FRAME_SIZE);
    153157                        dirty = true;
    154158                } else {
     
    188192                    (void *) (base + i * FRAME_SIZE + pad_lo),
    189193                    FRAME_SIZE - pad_lo - pad_hi);
     194                if (entry->p_flags & PF_X)
     195                        smc_coherence_block(PA2KA(frame) + pad_lo, FRAME_SIZE -
     196                            pad_lo - pad_hi);
    190197                memsetb((void *) PA2KA(frame), pad_lo, 0);
    191                 memsetb((void *) (PA2KA(frame) + FRAME_SIZE - pad_hi), pad_hi, 0);
     198                memsetb((void *) (PA2KA(frame) + FRAME_SIZE - pad_hi), pad_hi,
     199                    0);
    192200                dirty = true;
    193201        }
     
    213221 * The address space area and page tables must be already locked.
    214222 *
    215  * @param area Pointer to the address space area.
    216  * @param page Page that is mapped to frame. Must be aligned to PAGE_SIZE.
    217  * @param frame Frame to be released.
     223 * @param area          Pointer to the address space area.
     224 * @param page          Page that is mapped to frame. Must be aligned to
     225 *                      PAGE_SIZE.
     226 * @param frame         Frame to be released.
    218227 *
    219228 */
     
    258267 * The address space and address space area must be locked prior to the call.
    259268 *
    260  * @param area Address space area.
     269 * @param area          Address space area.
    261270 */
    262271void elf_share(as_area_t *area)
Note: See TracChangeset for help on using the changeset viewer.