Subversion Repositories HelenOS

Rev

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

Rev 2106 Rev 2125
Line 79... Line 79...
79
 
79
 
80
#ifdef CONFIG_VIRT_IDX_DCACHE
80
#ifdef CONFIG_VIRT_IDX_DCACHE
81
#include <arch/mm/cache.h>
81
#include <arch/mm/cache.h>
82
#endif /* CONFIG_VIRT_IDX_DCACHE */
82
#endif /* CONFIG_VIRT_IDX_DCACHE */
83
 
83
 
-
 
84
#ifndef __OBJC__
84
/**
85
/**
85
 * Each architecture decides what functions will be used to carry out
86
 * Each architecture decides what functions will be used to carry out
86
 * address space operations such as creating or locking page tables.
87
 * address space operations such as creating or locking page tables.
87
 */
88
 */
88
as_operations_t *as_operations = NULL;
89
as_operations_t *as_operations = NULL;
-
 
90
#endif
89
 
91
 
90
/**
92
/**
91
 * Slab for as_t objects.
93
 * Slab for as_t objects.
92
 */
94
 */
93
static slab_cache_t *as_slab;
95
static slab_cache_t *as_slab;
Line 990... Line 992...
990
 *
992
 *
991
 * @return First entry of the page table.
993
 * @return First entry of the page table.
992
 */
994
 */
993
pte_t *page_table_create(int flags)
995
pte_t *page_table_create(int flags)
994
{
996
{
-
 
997
#ifdef __OBJC__
-
 
998
    return [as_t page_table_create: flags];
-
 
999
#else
995
        ASSERT(as_operations);
1000
    ASSERT(as_operations);
996
        ASSERT(as_operations->page_table_create);
1001
    ASSERT(as_operations->page_table_create);
997
 
1002
   
998
        return as_operations->page_table_create(flags);
1003
    return as_operations->page_table_create(flags);
-
 
1004
#endif
999
}
1005
}
1000
 
1006
 
1001
/** Destroy page table.
1007
/** Destroy page table.
1002
 *
1008
 *
1003
 * Destroy page table in architecture specific way.
1009
 * Destroy page table in architecture specific way.
1004
 *
1010
 *
1005
 * @param page_table Physical address of PTL0.
1011
 * @param page_table Physical address of PTL0.
1006
 */
1012
 */
1007
void page_table_destroy(pte_t *page_table)
1013
void page_table_destroy(pte_t *page_table)
1008
{
1014
{
-
 
1015
#ifdef __OBJC__
-
 
1016
    return [as_t page_table_destroy: page_table];
-
 
1017
#else
1009
        ASSERT(as_operations);
1018
    ASSERT(as_operations);
1010
        ASSERT(as_operations->page_table_destroy);
1019
    ASSERT(as_operations->page_table_destroy);
1011
 
1020
   
1012
        as_operations->page_table_destroy(page_table);
1021
    as_operations->page_table_destroy(page_table);
-
 
1022
#endif
1013
}
1023
}
1014
 
1024
 
1015
/** Lock page table.
1025
/** Lock page table.
1016
 *
1026
 *
1017
 * This function should be called before any page_mapping_insert(),
1027
 * This function should be called before any page_mapping_insert(),
Line 1024... Line 1034...
1024
 * @param as Address space.
1034
 * @param as Address space.
1025
 * @param lock If false, do not attempt to lock as->lock.
1035
 * @param lock If false, do not attempt to lock as->lock.
1026
 */
1036
 */
1027
void page_table_lock(as_t *as, bool lock)
1037
void page_table_lock(as_t *as, bool lock)
1028
{
1038
{
-
 
1039
#ifdef __OBJC__
-
 
1040
    [as page_table_lock: lock];
-
 
1041
#else
1029
    ASSERT(as_operations);
1042
    ASSERT(as_operations);
1030
    ASSERT(as_operations->page_table_lock);
1043
    ASSERT(as_operations->page_table_lock);
1031
 
1044
   
1032
    as_operations->page_table_lock(as, lock);
1045
    as_operations->page_table_lock(as, lock);
-
 
1046
#endif
1033
}
1047
}
1034
 
1048
 
1035
/** Unlock page table.
1049
/** Unlock page table.
1036
 *
1050
 *
1037
 * @param as Address space.
1051
 * @param as Address space.
1038
 * @param unlock If false, do not attempt to unlock as->lock.
1052
 * @param unlock If false, do not attempt to unlock as->lock.
1039
 */
1053
 */
1040
void page_table_unlock(as_t *as, bool unlock)
1054
void page_table_unlock(as_t *as, bool unlock)
1041
{
1055
{
-
 
1056
#ifdef __OBJC__
-
 
1057
    [as page_table_unlock: unlock];
-
 
1058
#else
1042
    ASSERT(as_operations);
1059
    ASSERT(as_operations);
1043
    ASSERT(as_operations->page_table_unlock);
1060
    ASSERT(as_operations->page_table_unlock);
1044
 
1061
   
1045
    as_operations->page_table_unlock(as, unlock);
1062
    as_operations->page_table_unlock(as, unlock);
-
 
1063
#endif
1046
}
1064
}
1047
 
1065
 
1048
 
1066
 
1049
/** Find address space area and lock it.
1067
/** Find address space area and lock it.
1050
 *
1068
 *