Changeset d7533c7 in mainline
- Timestamp:
- 2011-01-29T18:57:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6119f24
- Parents:
- 0b6931a
- Location:
- kernel
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/gta02/gta02.c
r0b6931a rd7533c7 174 174 fb_parea.pbase = GTA02_FB_BASE; 175 175 fb_parea.frames = 150; 176 fb_parea.unpriv = false; 176 177 ddi_parea_register(&fb_parea); 177 178 } -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
r0b6931a rd7533c7 300 300 fb_parea.pbase = ICP_FB; 301 301 fb_parea.frames = 300; 302 fb_parea.unpriv = false; 302 303 ddi_parea_register(&fb_parea); 303 304 } -
kernel/arch/sparc64/src/drivers/niagara.c
r0b6931a rd7533c7 216 216 outbuf_parea.pbase = (uintptr_t) (KA2PA(&output_buffer)); 217 217 outbuf_parea.frames = 1; 218 outbuf_parea.unpriv = false; 218 219 ddi_parea_register(&outbuf_parea); 219 220 … … 221 222 inbuf_parea.pbase = (uintptr_t) (KA2PA(&input_buffer)); 222 223 inbuf_parea.frames = 1; 224 inbuf_parea.unpriv = false; 223 225 ddi_parea_register(&inbuf_parea); 224 226 -
kernel/generic/include/ddi/ddi.h
r0b6931a rd7533c7 43 43 /** Structure representing contiguous physical memory area. */ 44 44 typedef struct { 45 uintptr_t pbase; /**< Physical base of the area. */ 46 pfn_t frames; /**< Number of frames in the area. */ 45 link_t link; /**< Linked list link */ 47 46 48 link_t link; /**< Linked list link */ 47 uintptr_t pbase; /**< Physical base of the area. */ 48 pfn_t frames; /**< Number of frames in the area. */ 49 bool unpriv; /**< Allow mapping by unprivileged tasks. */ 49 50 } parea_t; 50 51 … … 60 61 extern int ddi_iospace_enable_arch(task_t *, uintptr_t, size_t); 61 62 62 63 63 #endif 64 64 -
kernel/generic/src/console/console.c
r0b6931a rd7533c7 160 160 klog_parea.pbase = (uintptr_t) faddr; 161 161 klog_parea.frames = SIZE2FRAMES(sizeof(klog)); 162 klog_parea.unpriv = false; 162 163 ddi_parea_register(&klog_parea); 163 164 -
kernel/generic/src/ddi/ddi.c
r0b6931a rd7533c7 104 104 { 105 105 ASSERT(TASK); 106 ASSERT((pf % FRAME_SIZE) == 0); 107 ASSERT((vp % PAGE_SIZE) == 0); 108 109 /* 110 * Make sure the caller is authorised to make this syscall. 111 */ 112 cap_t caps = cap_get(TASK); 113 if (!(caps & CAP_MEM_MANAGER)) 114 return EPERM; 106 107 if ((pf % FRAME_SIZE) != 0) 108 return EBADMEM; 109 110 if ((vp % PAGE_SIZE) != 0) 111 return EBADMEM; 112 113 /* 114 * Unprivileged tasks are only allowed to map pareas 115 * which are explicitly marked as such. 116 */ 117 bool priv = 118 ((cap_get(TASK) & CAP_MEM_MANAGER) == CAP_MEM_MANAGER); 115 119 116 120 mem_backend_data_t backend_data; … … 123 127 124 128 if (znum == (size_t) -1) { 125 /* Frames not found in any zones 126 * -> assume it is hardware device and allow mapping 129 /* 130 * Frames not found in any zone 131 * -> assume it is a hardware device and allow mapping 132 * for privileged tasks. 127 133 */ 128 134 irq_spinlock_unlock(&zones.lock, true); 135 136 if (!priv) 137 return EPERM; 138 129 139 goto map; 130 140 } 131 141 132 142 if (zones.info[znum].flags & ZONE_FIRMWARE) { 133 /* Frames are part of firmware */ 143 /* 144 * Frames are part of firmware 145 * -> allow mapping for privileged tasks. 146 */ 134 147 irq_spinlock_unlock(&zones.lock, true); 148 149 if (!priv) 150 return EPERM; 151 135 152 goto map; 136 153 } … … 138 155 if (zone_flags_available(zones.info[znum].flags)) { 139 156 /* 140 * Frames are part of physical memory, check if the memory141 * region is enabled for mapping.157 * Frames are part of physical memory, check 158 * if the memory region is enabled for mapping. 142 159 */ 143 160 irq_spinlock_unlock(&zones.lock, true); … … 150 167 if ((!parea) || (parea->frames < pages)) { 151 168 mutex_unlock(&parea_lock); 152 goto err; 169 return ENOENT; 170 } 171 172 if (!priv) { 173 if (!parea->unpriv) { 174 mutex_unlock(&parea_lock); 175 return EPERM; 176 } 153 177 } 154 178 … … 158 182 159 183 irq_spinlock_unlock(&zones.lock, true); 160 161 err:162 184 return ENOENT; 163 185 -
kernel/generic/src/lib/rd.c
r0b6931a rd7533c7 90 90 FRAME_SIZE); 91 91 rd_parea.frames = SIZE2FRAMES(dsize); 92 rd_parea.unpriv = false; 92 93 ddi_parea_register(&rd_parea); 93 94 -
kernel/generic/src/time/clock.c
r0b6931a rd7533c7 93 93 clock_parea.pbase = (uintptr_t) faddr; 94 94 clock_parea.frames = 1; 95 clock_parea.unpriv = true; 95 96 ddi_parea_register(&clock_parea); 96 97 … … 100 101 * 101 102 */ 102 sysinfo_set_item_val("clock.cacheable", NULL, (sysarg_t) true);103 103 sysinfo_set_item_val("clock.faddr", NULL, (sysarg_t) faddr); 104 104 }
Note:
See TracChangeset
for help on using the changeset viewer.