Subversion Repositories HelenOS-historic

Rev

Rev 1708 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1708 Rev 1780
Line 60... Line 60...
60
 *
60
 *
61
 * @return 0 on success, EPERM if the caller lacks capabilities to use this syscall,
61
 * @return 0 on success, EPERM if the caller lacks capabilities to use this syscall,
62
 *     ENOENT if there is no task matching the specified ID and ENOMEM if
62
 *     ENOENT if there is no task matching the specified ID and ENOMEM if
63
 *     there was a problem in creating address space area.
63
 *     there was a problem in creating address space area.
64
 */
64
 */
65
static int ddi_physmem_map(__address pf, __address vp, count_t pages, int flags)
65
static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags)
66
{
66
{
67
    ipl_t ipl;
67
    ipl_t ipl;
68
    cap_t caps;
68
    cap_t caps;
69
    mem_backend_data_t backend_data;
69
    mem_backend_data_t backend_data;
70
 
70
 
Line 108... Line 108...
108
 * @param size Size of the enabled I/O space..
108
 * @param size Size of the enabled I/O space..
109
 *
109
 *
110
 * @return 0 on success, EPERM if the caller lacks capabilities to use this syscall,
110
 * @return 0 on success, EPERM if the caller lacks capabilities to use this syscall,
111
 *     ENOENT if there is no task matching the specified ID.
111
 *     ENOENT if there is no task matching the specified ID.
112
 */
112
 */
113
static int ddi_iospace_enable(task_id_t id, __address ioaddr, size_t size)
113
static int ddi_iospace_enable(task_id_t id, uintptr_t ioaddr, size_t size)
114
{
114
{
115
    ipl_t ipl;
115
    ipl_t ipl;
116
    cap_t caps;
116
    cap_t caps;
117
    task_t *t;
117
    task_t *t;
118
    int rc;
118
    int rc;
Line 156... Line 156...
156
 * @param pages Number of pages
156
 * @param pages Number of pages
157
 * @param flags Flags of newly mapped pages
157
 * @param flags Flags of newly mapped pages
158
 *
158
 *
159
 * @return 0 on success, otherwise it returns error code found in errno.h
159
 * @return 0 on success, otherwise it returns error code found in errno.h
160
 */
160
 */
161
__native sys_physmem_map(__native phys_base, __native virt_base, __native pages,
161
unative_t sys_physmem_map(unative_t phys_base, unative_t virt_base, unative_t pages,
162
             __native flags)
162
             unative_t flags)
163
{
163
{
164
    return (__native) ddi_physmem_map(ALIGN_DOWN((__address) phys_base, FRAME_SIZE),
164
    return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base, FRAME_SIZE),
165
                      ALIGN_DOWN((__address) virt_base, PAGE_SIZE), (count_t) pages,
165
                      ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE), (count_t) pages,
166
                      (int) flags);
166
                      (int) flags);
167
}
167
}
168
 
168
 
169
/** Wrapper for SYS_ENABLE_IOSPACE syscall.
169
/** Wrapper for SYS_ENABLE_IOSPACE syscall.
170
 *
170
 *
171
 * @param uspace_io_arg User space address of DDI argument structure.
171
 * @param uspace_io_arg User space address of DDI argument structure.
172
 *
172
 *
173
 * @return 0 on success, otherwise it returns error code found in errno.h
173
 * @return 0 on success, otherwise it returns error code found in errno.h
174
 */
174
 */
175
__native sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
175
unative_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
176
{
176
{
177
    ddi_ioarg_t arg;
177
    ddi_ioarg_t arg;
178
    int rc;
178
    int rc;
179
   
179
   
180
    rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
180
    rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
181
    if (rc != 0)
181
    if (rc != 0)
182
        return (__native) rc;
182
        return (unative_t) rc;
183
       
183
       
184
    return (__native) ddi_iospace_enable((task_id_t) arg.task_id, (__address) arg.ioaddr, (size_t) arg.size);
184
    return (unative_t) ddi_iospace_enable((task_id_t) arg.task_id, (uintptr_t) arg.ioaddr, (size_t) arg.size);
185
}
185
}
186
 
186
 
187
/** Disable or enable preemption.
187
/** Disable or enable preemption.
188
 *
188
 *
189
 * @param enable If non-zero, the preemption counter will be decremented, leading to potential
189
 * @param enable If non-zero, the preemption counter will be decremented, leading to potential
190
 *       enabling of preemption. Otherwise the preemption counter will be incremented,
190
 *       enabling of preemption. Otherwise the preemption counter will be incremented,
191
 *       preventing preemption from occurring.
191
 *       preventing preemption from occurring.
192
 *
192
 *
193
 * @return Zero on success or EPERM if callers capabilities are not sufficient.
193
 * @return Zero on success or EPERM if callers capabilities are not sufficient.
194
 */
194
 */
195
__native sys_preempt_control(int enable)
195
unative_t sys_preempt_control(int enable)
196
{
196
{
197
        if (! cap_get(TASK) & CAP_PREEMPT_CONTROL)
197
        if (! cap_get(TASK) & CAP_PREEMPT_CONTROL)
198
                return EPERM;
198
                return EPERM;
199
        if (enable)
199
        if (enable)
200
                preemption_enable();
200
                preemption_enable();