| .. | .. |
|---|
| 57 | 57 | |
|---|
| 58 | 58 | #ifdef CONFIG_SMP |
|---|
| 59 | 59 | extern s32 vm_committed_as_batch; |
|---|
| 60 | +extern void mm_compute_batch(int overcommit_policy); |
|---|
| 60 | 61 | #else |
|---|
| 61 | 62 | #define vm_committed_as_batch 0 |
|---|
| 63 | +static inline void mm_compute_batch(int overcommit_policy) |
|---|
| 64 | +{ |
|---|
| 65 | +} |
|---|
| 62 | 66 | #endif |
|---|
| 63 | 67 | |
|---|
| 64 | 68 | unsigned long vm_memory_committed(void); |
|---|
| .. | .. |
|---|
| 74 | 78 | } |
|---|
| 75 | 79 | |
|---|
| 76 | 80 | /* |
|---|
| 77 | | - * Allow architectures to handle additional protection bits |
|---|
| 81 | + * Allow architectures to handle additional protection and flag bits. The |
|---|
| 82 | + * overriding macros must be defined in the arch-specific asm/mman.h file. |
|---|
| 78 | 83 | */ |
|---|
| 79 | 84 | |
|---|
| 80 | 85 | #ifndef arch_calc_vm_prot_bits |
|---|
| 81 | 86 | #define arch_calc_vm_prot_bits(prot, pkey) 0 |
|---|
| 87 | +#endif |
|---|
| 88 | + |
|---|
| 89 | +#ifndef arch_calc_vm_flag_bits |
|---|
| 90 | +#define arch_calc_vm_flag_bits(flags) 0 |
|---|
| 82 | 91 | #endif |
|---|
| 83 | 92 | |
|---|
| 84 | 93 | #ifndef arch_vm_get_page_prot |
|---|
| .. | .. |
|---|
| 97 | 106 | return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0; |
|---|
| 98 | 107 | } |
|---|
| 99 | 108 | #define arch_validate_prot arch_validate_prot |
|---|
| 109 | +#endif |
|---|
| 110 | + |
|---|
| 111 | +#ifndef arch_validate_flags |
|---|
| 112 | +/* |
|---|
| 113 | + * This is called from mmap() and mprotect() with the updated vma->vm_flags. |
|---|
| 114 | + * |
|---|
| 115 | + * Returns true if the VM_* flags are valid. |
|---|
| 116 | + */ |
|---|
| 117 | +static inline bool arch_validate_flags(unsigned long flags) |
|---|
| 118 | +{ |
|---|
| 119 | + return true; |
|---|
| 120 | +} |
|---|
| 121 | +#define arch_validate_flags arch_validate_flags |
|---|
| 100 | 122 | #endif |
|---|
| 101 | 123 | |
|---|
| 102 | 124 | /* |
|---|
| .. | .. |
|---|
| 131 | 153 | return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | |
|---|
| 132 | 154 | _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | |
|---|
| 133 | 155 | _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) | |
|---|
| 134 | | - _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ); |
|---|
| 156 | + _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) | |
|---|
| 157 | + arch_calc_vm_flag_bits(flags); |
|---|
| 135 | 158 | } |
|---|
| 136 | 159 | |
|---|
| 137 | 160 | unsigned long vm_commit_limit(void); |
|---|