Subversion Repositories HelenOS-historic

Rev

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

Rev 1278 Rev 1288
Line 38... Line 38...
38
#include <ddi/ddi.h>
38
#include <ddi/ddi.h>
39
#include <ddi/ddi_arg.h>
39
#include <ddi/ddi_arg.h>
40
#include <proc/task.h>
40
#include <proc/task.h>
41
#include <security/cap.h>
41
#include <security/cap.h>
42
#include <mm/frame.h>
42
#include <mm/frame.h>
43
#include <mm/page.h>
-
 
44
#include <mm/as.h>
43
#include <mm/as.h>
45
#include <synch/spinlock.h>
44
#include <synch/spinlock.h>
-
 
45
#include <syscall/copy.h>
46
#include <arch.h>
46
#include <arch.h>
47
#include <align.h>
47
#include <align.h>
48
#include <errno.h>
48
#include <errno.h>
49
 
49
 
50
/** Map piece of physical memory into virtual address space of specified task.
50
/** Map piece of physical memory into virtual address space of specified task.
Line 181... Line 181...
181
 * @return 0 on success, otherwise it returns error code found in errno.h
181
 * @return 0 on success, otherwise it returns error code found in errno.h
182
 */
182
 */
183
__native sys_physmem_map(ddi_memarg_t *uspace_mem_arg)
183
__native sys_physmem_map(ddi_memarg_t *uspace_mem_arg)
184
{
184
{
185
    ddi_memarg_t arg;
185
    ddi_memarg_t arg;
-
 
186
    int rc;
186
   
187
   
187
    copy_from_uspace(&arg, uspace_mem_arg, sizeof(ddi_memarg_t));
188
    rc = copy_from_uspace(&arg, uspace_mem_arg, sizeof(ddi_memarg_t));
-
 
189
    if (rc != 0)
-
 
190
        return (__native) rc;
-
 
191
       
188
    return (__native) ddi_physmem_map((task_id_t) arg.task_id, ALIGN_DOWN((__address) arg.phys_base, FRAME_SIZE),
192
    return (__native) ddi_physmem_map((task_id_t) arg.task_id, ALIGN_DOWN((__address) arg.phys_base, FRAME_SIZE),
189
                      ALIGN_DOWN((__address) arg.virt_base, PAGE_SIZE), (count_t) arg.pages,
193
                      ALIGN_DOWN((__address) arg.virt_base, PAGE_SIZE), (count_t) arg.pages,
190
                      (bool) arg.writable);
194
                      (bool) arg.writable);
191
}
195
}
192
 
196
 
Line 197... Line 201...
197
 * @return 0 on success, otherwise it returns error code found in errno.h
201
 * @return 0 on success, otherwise it returns error code found in errno.h
198
 */
202
 */
199
__native sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
203
__native sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
200
{
204
{
201
    ddi_ioarg_t arg;
205
    ddi_ioarg_t arg;
-
 
206
    int rc;
202
   
207
   
203
    copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
208
    rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
-
 
209
    if (rc != 0)
-
 
210
        return (__native) rc;
-
 
211
       
204
    return (__native) ddi_iospace_enable((task_id_t) arg.task_id, (__address) arg.ioaddr, (size_t) arg.size);
212
    return (__native) ddi_iospace_enable((task_id_t) arg.task_id, (__address) arg.ioaddr, (size_t) arg.size);
205
}
213
}