Changeset e39d7b8 in mainline


Ignore:
Timestamp:
2019-06-17T15:12:44Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
64b7854
Parents:
ef705e14
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-06-16 17:59:34)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-06-17 15:12:44)
Message:

Change type of uspace pointers in kernel from pointer type to numeric type

From kernel's perspective, userspace addresses are not valid pointers,
and can only be used in calls to copy_to/from_uspace().
Therefore, we change the type of those arguments and variables to
uspace_addr_t which is an alias for sysarg_t.

This allows the compiler to catch accidental direct accesses to
userspace addresses.

Additionally, to avoid losing the type information in code,
a macro uspace_ptr(type) is used that translates to uspace_addr_t.
I makes no functional difference, but allows keeping the type information
in code in case we implement some sort of static checking for it in the future.

Files:
55 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    ref705e14 re39d7b8  
    421421uspace/srv/volsrv/test-volsrv
    422422uspace/srv/volsrv/volsrv
     423uspace/drv/block/virtio-blk/virtio-blk
  • abi/include/_bits/native.h

    ref705e14 re39d7b8  
    5656typedef intptr_t  native_t;
    5757
     58#ifdef KERNEL
     59
     60typedef sysarg_t uspace_addr_t;
     61/* We might implement a way to check validity of the type some day. */
     62#define uspace_ptr(type) uspace_addr_t
     63#define USPACE_NULL 0
     64
     65#else /* !KERNEL */
     66
     67typedef void *uspace_addr_t;
     68#define uspace_ptr(type) type *
     69
     70#endif
     71
    5872__HELENOS_DECLS_END;
    5973
  • abi/include/abi/proc/uarg.h

    ref705e14 re39d7b8  
    3737
    3838#include <stddef.h>
     39#include <_bits/native.h>
     40
     41typedef void (uspace_thread_function_t)(void *);
    3942
    4043/** Structure passed to uinit kernel thread as argument. */
    4144typedef struct uspace_arg {
    42         void *uspace_entry;
    43         void *uspace_stack;
     45        uspace_addr_t uspace_entry;
     46        uspace_addr_t uspace_stack;
    4447        size_t uspace_stack_size;
    4548
    46         void (*uspace_thread_function)(void *);
    47         void *uspace_thread_arg;
     49        uspace_ptr(uspace_thread_function_t) uspace_thread_function;
     50        uspace_addr_t uspace_thread_arg;
    4851
    49         struct uspace_arg *uspace_uarg;
     52        uspace_ptr(struct uspace_arg) uspace_uarg;
    5053} uspace_arg_t;
    5154
  • kernel/arch/abs32le/src/abs32le.c

    ref705e14 re39d7b8  
    126126}
    127127
    128 uintptr_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
     128uintptr_t memcpy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size)
    129129{
    130130        return 0;
    131131}
    132132
    133 uintptr_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
     133uintptr_t memcpy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size)
    134134{
    135135        return 0;
  • kernel/arch/amd64/src/debug/stacktrace.c

    ref705e14 re39d7b8  
    6969bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    7070{
    71         return !copy_from_uspace((void *) prev,
    72             (uint64_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));
     71        return !copy_from_uspace(prev,
     72            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
    7373}
    7474
    7575bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    7676{
    77         return !copy_from_uspace((void *) ra,
    78             (uint64_t *) ctx->fp + FRAME_OFFSET_RA, sizeof(*ra));
     77        return !copy_from_uspace(ra,
     78            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
    7979}
    8080
  • kernel/arch/amd64/src/userspace.c

    ref705e14 re39d7b8  
    6666            "iretq\n"
    6767            :: [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
    68               [stack_top] "r" ((uint8_t *) kernel_uarg->uspace_stack +
     68              [stack_top] "r" (kernel_uarg->uspace_stack +
    6969              kernel_uarg->uspace_stack_size),
    7070              [rflags] "r" (rflags),
  • kernel/arch/arm32/src/debug/stacktrace.c

    ref705e14 re39d7b8  
    6868bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    6969{
    70         return !copy_from_uspace((void *) prev,
    71             (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));
     70        return !copy_from_uspace(prev,
     71            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
    7272}
    7373
    7474bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    7575{
    76         return !copy_from_uspace((void *) ra,
    77             (uint32_t *) ctx->fp + FRAME_OFFSET_RA, sizeof(*ra));
     76        return !copy_from_uspace(ra,
     77            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
    7878}
    7979
  • kernel/arch/arm32/src/userspace.c

    ref705e14 re39d7b8  
    7171
    7272        /* set first parameter */
    73         ustate.r0 = (uintptr_t) kernel_uarg->uspace_uarg;
     73        ustate.r0 = kernel_uarg->uspace_uarg;
    7474
    7575        /* %r1 is defined to hold pcb_ptr - set it to 0 */
     
    9393
    9494        /* set user stack */
    95         ustate.sp = ((uint32_t) kernel_uarg->uspace_stack) +
     95        ustate.sp = kernel_uarg->uspace_stack +
    9696            kernel_uarg->uspace_stack_size;
    9797
    9898        /* set where uspace execution starts */
    99         ustate.pc = (uintptr_t) kernel_uarg->uspace_entry;
     99        ustate.pc = kernel_uarg->uspace_entry;
    100100
    101101        /* status register in user mode */
  • kernel/arch/arm64/src/arm64.c

    ref705e14 re39d7b8  
    156156
    157157        /* Set program entry. */
    158         ELR_EL1_write((uint64_t) kernel_uarg->uspace_entry);
     158        ELR_EL1_write(kernel_uarg->uspace_entry);
    159159
    160160        /* Set user stack. */
    161         SP_EL0_write(((uint64_t) kernel_uarg->uspace_stack +
    162             kernel_uarg->uspace_stack_size));
     161        SP_EL0_write(kernel_uarg->uspace_stack +
     162            kernel_uarg->uspace_stack_size);
    163163
    164164        /* Clear Thread ID register. */
  • kernel/arch/arm64/src/debug/stacktrace.c

    ref705e14 re39d7b8  
    6868bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    6969{
    70         return !copy_from_uspace((void *) prev,
    71             (uint64_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));
     70        return !copy_from_uspace(prev,
     71            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
    7272}
    7373
    7474bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    7575{
    76         return !copy_from_uspace((void *) ra,
    77             (uint64_t *) ctx->fp + FRAME_OFFSET_RA, sizeof(*ra));
     76        return !copy_from_uspace(ra,
     77            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
    7878}
    7979
  • kernel/arch/ia32/src/debug/stacktrace.c

    ref705e14 re39d7b8  
    6767bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    6868{
    69         return !copy_from_uspace((void *) prev,
    70             (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));
     69        return !copy_from_uspace(prev,
     70            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
    7171}
    7272
    7373bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    7474{
    75         return !copy_from_uspace((void *) ra,
    76             (uint32_t *) ctx->fp + FRAME_OFFSET_RA, sizeof(*ra));
     75        return !copy_from_uspace(ra,
     76            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
    7777}
    7878
  • kernel/arch/ia32/src/userspace.c

    ref705e14 re39d7b8  
    7070            : [eflags_mask] "i" (~EFLAGS_NT),
    7171              [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
    72               [stack_top] "r" ((uint8_t *) kernel_uarg->uspace_stack +
     72              [stack_top] "r" (kernel_uarg->uspace_stack +
    7373              kernel_uarg->uspace_stack_size),
    7474              [eflags] "r" ((eflags & ~(EFLAGS_NT)) | EFLAGS_IF),
  • kernel/arch/ia64/src/ia64.c

    ref705e14 re39d7b8  
    244244         * uspace_stack_size / 2 bytes.
    245245         */
    246         switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
    247             ((uintptr_t) kernel_uarg->uspace_stack) +
     246        switch_to_userspace(kernel_uarg->uspace_entry,
     247            kernel_uarg->uspace_stack +
    248248            kernel_uarg->uspace_stack_size / 2 -
    249249            ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT),
    250             ((uintptr_t) kernel_uarg->uspace_stack) +
     250            kernel_uarg->uspace_stack +
    251251            kernel_uarg->uspace_stack_size / 2,
    252             (uintptr_t) kernel_uarg->uspace_uarg, psr.value, rsc.value);
     252            kernel_uarg->uspace_uarg, psr.value, rsc.value);
    253253
    254254        while (true)
  • kernel/arch/mips32/src/mips32.c

    ref705e14 re39d7b8  
    171171        cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit |
    172172            cp0_status_um_bit | cp0_status_ie_enabled_bit));
    173         cp0_epc_write((uintptr_t) kernel_uarg->uspace_entry);
    174         userspace_asm(((uintptr_t) kernel_uarg->uspace_stack +
    175             kernel_uarg->uspace_stack_size),
    176             (uintptr_t) kernel_uarg->uspace_uarg,
    177             (uintptr_t) kernel_uarg->uspace_entry);
     173        cp0_epc_write(kernel_uarg->uspace_entry);
     174        userspace_asm(kernel_uarg->uspace_stack +
     175            kernel_uarg->uspace_stack_size,
     176            kernel_uarg->uspace_uarg,
     177            kernel_uarg->uspace_entry);
    178178
    179179        while (true)
  • kernel/arch/ppc32/src/debug/stacktrace.c

    ref705e14 re39d7b8  
    6767bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
    6868{
    69         return !copy_from_uspace((void *) prev,
    70             (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));
     69        return !copy_from_uspace(prev,
     70            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
    7171}
    7272
    7373bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
    7474{
    75         return !copy_from_uspace((void *) ra,
    76             (uint32_t *) ctx->fp + FRAME_OFFSET_RA, sizeof(*ra));
     75        return !copy_from_uspace(ra,
     76            ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
    7777}
    7878
  • kernel/arch/ppc32/src/ppc32.c

    ref705e14 re39d7b8  
    292292void userspace(uspace_arg_t *kernel_uarg)
    293293{
    294         userspace_asm((uintptr_t) kernel_uarg->uspace_uarg,
    295             (uintptr_t) kernel_uarg->uspace_stack +
     294        userspace_asm(kernel_uarg->uspace_uarg,
     295            kernel_uarg->uspace_stack +
    296296            kernel_uarg->uspace_stack_size - SP_DELTA,
    297             (uintptr_t) kernel_uarg->uspace_entry);
     297            kernel_uarg->uspace_entry);
    298298
    299299        unreachable();
  • kernel/arch/riscv64/src/riscv64.c

    ref705e14 re39d7b8  
    143143}
    144144
    145 uintptr_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size)
     145uintptr_t memcpy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size)
    146146{
    147147        return 0;
    148148}
    149149
    150 uintptr_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size)
     150uintptr_t memcpy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size)
    151151{
    152152        return 0;
  • kernel/arch/sparc64/src/sun4u/sparc64.c

    ref705e14 re39d7b8  
    163163{
    164164        (void) interrupts_disable();
    165         switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
    166             ((uintptr_t) kernel_uarg->uspace_stack) +
     165        switch_to_userspace(kernel_uarg->uspace_entry,
     166            kernel_uarg->uspace_stack +
    167167            kernel_uarg->uspace_stack_size -
    168168            (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS),
    169             (uintptr_t) kernel_uarg->uspace_uarg);
     169            kernel_uarg->uspace_uarg);
    170170
    171171        /* Not reached */
  • kernel/arch/sparc64/src/sun4v/sparc64.c

    ref705e14 re39d7b8  
    161161{
    162162        (void) interrupts_disable();
    163         switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
    164             ((uintptr_t) kernel_uarg->uspace_stack) +
     163        switch_to_userspace(kernel_uarg->uspace_entry,
     164            kernel_uarg->uspace_stack +
    165165            kernel_uarg->uspace_stack_size -
    166166            (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS),
    167             (uintptr_t) kernel_uarg->uspace_uarg);
     167            kernel_uarg->uspace_uarg);
    168168
    169169        /* Not reached */
  • kernel/generic/include/console/console.h

    ref705e14 re39d7b8  
    7171extern wchar_t getc(indev_t *indev);
    7272extern size_t gets(indev_t *indev, char *buf, size_t buflen);
    73 extern sys_errno_t sys_kio(int cmd, const void *buf, size_t size);
     73extern sys_errno_t sys_kio(int cmd, uspace_ptr(void) buf, size_t size);
    7474
    7575extern void grab_console(void);
  • kernel/generic/include/ddi/ddi.h

    ref705e14 re39d7b8  
    6363extern void pio_unmap(void *, void *, size_t);
    6464
    65 extern sys_errno_t sys_physmem_map(uintptr_t, size_t, unsigned int, void *,
     65extern sys_errno_t sys_physmem_map(uintptr_t, size_t, unsigned int, uspace_ptr(void),
    6666    uintptr_t);
    6767extern sys_errno_t sys_physmem_unmap(uintptr_t);
    6868
    69 extern sys_errno_t sys_dmamem_map(size_t, unsigned int, unsigned int, void *,
    70     void *, uintptr_t);
     69extern sys_errno_t sys_dmamem_map(size_t, unsigned int, unsigned int, uspace_ptr(void),
     70    uspace_ptr(void), uintptr_t);
    7171extern sys_errno_t sys_dmamem_unmap(uintptr_t, size_t, unsigned int);
    7272
    73 extern sys_errno_t sys_iospace_enable(ddi_ioarg_t *);
    74 extern sys_errno_t sys_iospace_disable(ddi_ioarg_t *);
     73extern sys_errno_t sys_iospace_enable(uspace_ptr(ddi_ioarg_t));
     74extern sys_errno_t sys_iospace_disable(uspace_ptr(ddi_ioarg_t));
    7575
    7676/*
  • kernel/generic/include/ipc/irq.h

    ref705e14 re39d7b8  
    5050extern void ipc_irq_top_half_handler(irq_t *);
    5151
    52 extern errno_t ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, irq_code_t *,
    53     cap_irq_handle_t *);
     52extern errno_t ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, uspace_ptr(irq_code_t),
     53    uspace_ptr(cap_irq_handle_t));
    5454extern errno_t ipc_irq_unsubscribe(answerbox_t *, cap_irq_handle_t);
    5555
  • kernel/generic/include/ipc/sysipc.h

    ref705e14 re39d7b8  
    4444extern sys_errno_t sys_ipc_call_async_fast(cap_phone_handle_t, sysarg_t,
    4545    sysarg_t, sysarg_t, sysarg_t, sysarg_t);
    46 extern sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t, ipc_data_t *,
     46extern sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t, uspace_ptr(ipc_data_t),
    4747    sysarg_t);
    4848extern sys_errno_t sys_ipc_answer_fast(cap_call_handle_t, sysarg_t, sysarg_t,
    4949    sysarg_t, sysarg_t, sysarg_t);
    50 extern sys_errno_t sys_ipc_answer_slow(cap_call_handle_t, ipc_data_t *);
    51 extern sys_errno_t sys_ipc_wait_for_call(ipc_data_t *, uint32_t, unsigned int);
     50extern sys_errno_t sys_ipc_answer_slow(cap_call_handle_t, uspace_ptr(ipc_data_t));
     51extern sys_errno_t sys_ipc_wait_for_call(uspace_ptr(ipc_data_t), uint32_t, unsigned int);
    5252extern sys_errno_t sys_ipc_poke(void);
    5353extern sys_errno_t sys_ipc_forward_fast(cap_call_handle_t, cap_phone_handle_t,
    5454    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    5555extern sys_errno_t sys_ipc_forward_slow(cap_call_handle_t, cap_phone_handle_t,
    56     ipc_data_t *, unsigned int);
     56    uspace_ptr(ipc_data_t), unsigned int);
    5757extern sys_errno_t sys_ipc_hangup(cap_phone_handle_t);
    5858
    59 extern sys_errno_t sys_ipc_irq_subscribe(inr_t, sysarg_t, irq_code_t *,
    60     cap_irq_handle_t *);
     59extern sys_errno_t sys_ipc_irq_subscribe(inr_t, sysarg_t, uspace_ptr(irq_code_t),
     60    uspace_ptr(cap_irq_handle_t));
    6161extern sys_errno_t sys_ipc_irq_unsubscribe(cap_irq_handle_t);
    6262
    63 extern sys_errno_t sys_ipc_connect_kbox(task_id_t *, cap_phone_handle_t *);
     63extern sys_errno_t sys_ipc_connect_kbox(uspace_ptr(task_id_t), uspace_ptr(cap_phone_handle_t));
    6464
    6565#endif
  • kernel/generic/include/log.h

    ref705e14 re39d7b8  
    5252    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
    5353
    54 extern sys_errno_t sys_klog(sysarg_t, void *buf, size_t size,
    55     sysarg_t level, size_t *uspace_nread);
     54extern sys_errno_t sys_klog(sysarg_t, uspace_ptr(void) buf, size_t size,
     55    sysarg_t level, uspace_ptr(size_t) uspace_nread);
    5656
    5757#endif /* KERN_LOG_H_ */
  • kernel/generic/include/mm/as.h

    ref705e14 re39d7b8  
    373373/* Address space area related syscalls. */
    374374extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int, uintptr_t,
    375     as_area_pager_info_t *);
     375    uspace_ptr(as_area_pager_info_t));
    376376extern sys_errno_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
    377377extern sys_errno_t sys_as_area_change_flags(uintptr_t, unsigned int);
    378 extern sys_errno_t sys_as_area_get_info(uintptr_t, as_area_info_t *);
     378extern sys_errno_t sys_as_area_get_info(uintptr_t, uspace_ptr(as_area_info_t));
    379379extern sys_errno_t sys_as_area_destroy(uintptr_t);
    380380
  • kernel/generic/include/mm/page.h

    ref705e14 re39d7b8  
    6868
    6969extern errno_t page_find_mapping(uintptr_t, uintptr_t *);
    70 extern sys_errno_t sys_page_find_mapping(uintptr_t, uintptr_t *);
     70extern sys_errno_t sys_page_find_mapping(uintptr_t, uspace_ptr(uintptr_t));
    7171
    7272#endif
  • kernel/generic/include/proc/program.h

    ref705e14 re39d7b8  
    5555extern void *program_loader;
    5656
    57 extern errno_t program_create(as_t *, uintptr_t, char *, program_t *);
     57extern errno_t program_create(as_t *, uspace_addr_t, char *, program_t *);
    5858extern errno_t program_create_from_image(void *, char *, program_t *);
    5959extern errno_t program_create_loader(program_t *, char *);
    6060extern void program_ready(program_t *);
    6161
    62 extern sys_errno_t sys_program_spawn_loader(char *, size_t);
     62extern sys_errno_t sys_program_spawn_loader(uspace_ptr(char), size_t);
    6363
    6464#endif
  • kernel/generic/include/proc/task.h

    ref705e14 re39d7b8  
    164164
    165165#ifdef __32_BITS__
    166 extern sys_errno_t sys_task_get_id(sysarg64_t *);
     166extern sys_errno_t sys_task_get_id(uspace_ptr(sysarg64_t));
    167167#endif
    168168
     
    171171#endif
    172172
    173 extern sys_errno_t sys_task_set_name(const char *, size_t);
    174 extern sys_errno_t sys_task_kill(task_id_t *);
     173extern sys_errno_t sys_task_set_name(uspace_ptr(const char), size_t);
     174extern sys_errno_t sys_task_kill(uspace_ptr(task_id_t));
    175175extern sys_errno_t sys_task_exit(sysarg_t);
    176176
  • kernel/generic/include/proc/thread.h

    ref705e14 re39d7b8  
    265265
    266266/* Thread syscall prototypes. */
    267 extern sys_errno_t sys_thread_create(uspace_arg_t *, char *, size_t,
    268     thread_id_t *);
     267extern sys_errno_t sys_thread_create(uspace_ptr(uspace_arg_t), uspace_ptr(char), size_t,
     268    uspace_ptr(thread_id_t));
    269269extern sys_errno_t sys_thread_exit(int);
    270 extern sys_errno_t sys_thread_get_id(thread_id_t *);
     270extern sys_errno_t sys_thread_get_id(uspace_ptr(thread_id_t));
    271271extern sys_errno_t sys_thread_usleep(uint32_t);
    272272extern sys_errno_t sys_thread_udelay(uint32_t);
  • kernel/generic/include/security/perm.h

    ref705e14 re39d7b8  
    7575#ifdef __32_BITS__
    7676
    77 extern sys_errno_t sys_perm_grant(sysarg64_t *, perm_t);
    78 extern sys_errno_t sys_perm_revoke(sysarg64_t *, perm_t);
     77extern sys_errno_t sys_perm_grant(uspace_ptr(sysarg64_t), perm_t);
     78extern sys_errno_t sys_perm_revoke(uspace_ptr(sysarg64_t), perm_t);
    7979
    8080#endif  /* __32_BITS__ */
  • kernel/generic/include/synch/syswaitq.h

    ref705e14 re39d7b8  
    4343extern void sys_waitq_task_cleanup(void);
    4444
    45 extern sys_errno_t sys_waitq_create(cap_waitq_handle_t *);
     45extern sys_errno_t sys_waitq_create(uspace_ptr(cap_waitq_handle_t));
    4646extern sys_errno_t sys_waitq_sleep(cap_waitq_handle_t, uint32_t, unsigned int);
    4747extern sys_errno_t sys_waitq_wakeup(cap_waitq_handle_t);
  • kernel/generic/include/syscall/copy.h

    ref705e14 re39d7b8  
    4444extern char memcpy_to_uspace_failover_address;
    4545
    46 extern errno_t copy_from_uspace(void *dst, const void *uspace_src, size_t size);
    47 extern errno_t copy_to_uspace(void *dst_uspace, const void *src, size_t size);
     46extern errno_t copy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size);
     47extern errno_t copy_to_uspace(uspace_addr_t dst_uspace, const void *src, size_t size);
    4848
    4949/*
     
    5151 * The functions return zero on failure and nonzero on success.
    5252 */
    53 extern uintptr_t memcpy_from_uspace(void *dst, const void *uspace_src, size_t size);
    54 extern uintptr_t memcpy_to_uspace(void *uspace_dst, const void *src, size_t size);
     53extern uintptr_t memcpy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size);
     54extern uintptr_t memcpy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size);
    5555
    5656#endif
  • kernel/generic/include/sysinfo/sysinfo.h

    ref705e14 re39d7b8  
    162162extern void sysinfo_dump(sysinfo_item_t *);
    163163
    164 extern sys_errno_t sys_sysinfo_get_keys_size(void *, size_t, void *);
    165 extern sys_errno_t sys_sysinfo_get_keys(void *, size_t, void *, size_t, size_t *);
    166 extern sysarg_t sys_sysinfo_get_val_type(void *, size_t);
    167 extern sys_errno_t sys_sysinfo_get_value(void *, size_t, void *);
    168 extern sys_errno_t sys_sysinfo_get_data_size(void *, size_t, void *);
    169 extern sys_errno_t sys_sysinfo_get_data(void *, size_t, void *, size_t, size_t *);
     164extern sys_errno_t sys_sysinfo_get_keys_size(uspace_ptr(void), size_t, uspace_ptr(void));
     165extern sys_errno_t sys_sysinfo_get_keys(uspace_ptr(void), size_t, uspace_ptr(void), size_t, uspace_ptr(size_t));
     166extern sysarg_t sys_sysinfo_get_val_type(uspace_ptr(void), size_t);
     167extern sys_errno_t sys_sysinfo_get_value(uspace_ptr(void), size_t, uspace_ptr(void));
     168extern sys_errno_t sys_sysinfo_get_data_size(uspace_ptr(void), size_t, uspace_ptr(void));
     169extern sys_errno_t sys_sysinfo_get_data(uspace_ptr(void), size_t, uspace_ptr(void), size_t, uspace_ptr(size_t));
    170170
    171171#endif
  • kernel/generic/include/udebug/udebug_ops.h

    ref705e14 re39d7b8  
    5555errno_t udebug_regs_read(thread_t *t, void **buffer);
    5656
    57 errno_t udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer);
     57errno_t udebug_mem_read(uspace_ptr(void) uspace_addr, size_t n, void **buffer);
    5858
    5959#endif
  • kernel/generic/src/console/console.c

    ref705e14 re39d7b8  
    395395 *
    396396 */
    397 sys_errno_t sys_kio(int cmd, const void *buf, size_t size)
     397sys_errno_t sys_kio(int cmd, uspace_ptr(void) buf, size_t size)
    398398{
    399399        char *data;
  • kernel/generic/src/ddi/ddi.c

    ref705e14 re39d7b8  
    248248 */
    249249sys_errno_t sys_physmem_map(uintptr_t phys, size_t pages, unsigned int flags,
    250     void *virt_ptr, uintptr_t bound)
     250    uspace_ptr(void) virt_ptr, uintptr_t bound)
    251251{
    252252        uintptr_t virt;
     
    262262        rc = copy_to_uspace(virt_ptr, &virt, sizeof(virt));
    263263        if (rc != EOK) {
    264                 physmem_unmap((uintptr_t) virt);
     264                physmem_unmap(virt);
    265265                return rc;
    266266        }
     
    393393 *
    394394 */
    395 sys_errno_t sys_iospace_enable(ddi_ioarg_t *uspace_io_arg)
     395sys_errno_t sys_iospace_enable(uspace_ptr(ddi_ioarg_t) uspace_io_arg)
    396396{
    397397        ddi_ioarg_t arg;
     
    404404}
    405405
    406 sys_errno_t sys_iospace_disable(ddi_ioarg_t *uspace_io_arg)
     406sys_errno_t sys_iospace_disable(uspace_ptr(ddi_ioarg_t) uspace_io_arg)
    407407{
    408408        ddi_ioarg_t arg;
     
    465465
    466466sys_errno_t sys_dmamem_map(size_t size, unsigned int map_flags, unsigned int flags,
    467     void *phys_ptr, void *virt_ptr, uintptr_t bound)
     467    uspace_ptr(void) phys_ptr, uspace_ptr(void) virt_ptr, uintptr_t bound)
    468468{
    469469        if ((flags & DMAMEM_FLAGS_ANONYMOUS) == 0) {
     
    473473
    474474                uintptr_t phys;
    475                 errno_t rc = dmamem_map((uintptr_t) virt_ptr, size, map_flags,
     475                errno_t rc = dmamem_map(virt_ptr, size, map_flags,
    476476                    flags, &phys);
    477477
     
    481481                rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
    482482                if (rc != EOK) {
    483                         dmamem_unmap((uintptr_t) virt_ptr, size);
     483                        dmamem_unmap(virt_ptr, size);
    484484                        return rc;
    485485                }
     
    508508                rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
    509509                if (rc != EOK) {
    510                         dmamem_unmap_anonymous((uintptr_t) virt);
     510                        dmamem_unmap_anonymous(virt);
    511511                        return rc;
    512512                }
     
    514514                rc = copy_to_uspace(virt_ptr, &virt, sizeof(virt));
    515515                if (rc != EOK) {
    516                         dmamem_unmap_anonymous((uintptr_t) virt);
     516                        dmamem_unmap_anonymous(virt);
    517517                        return rc;
    518518                }
  • kernel/generic/src/ipc/irq.c

    ref705e14 re39d7b8  
    223223 *
    224224 */
    225 static irq_code_t *code_from_uspace(irq_code_t *ucode)
     225static irq_code_t *code_from_uspace(uspace_ptr(irq_code_t) ucode)
    226226{
    227227        irq_pio_range_t *ranges = NULL;
     
    242242        if (!ranges)
    243243                goto error;
    244         rc = copy_from_uspace(ranges, code->ranges,
     244        rc = copy_from_uspace(ranges, (uintptr_t) code->ranges,
    245245            sizeof(code->ranges[0]) * code->rangecount);
    246246        if (rc != EOK)
     
    250250        if (!cmds)
    251251                goto error;
    252         rc = copy_from_uspace(cmds, code->cmds,
     252        rc = copy_from_uspace(cmds, (uintptr_t) code->cmds,
    253253            sizeof(code->cmds[0]) * code->cmdcount);
    254254        if (rc != EOK)
     
    323323 */
    324324errno_t ipc_irq_subscribe(answerbox_t *box, inr_t inr, sysarg_t imethod,
    325     irq_code_t *ucode, cap_irq_handle_t *uspace_handle)
     325    uspace_ptr(irq_code_t) ucode, uspace_ptr(cap_irq_handle_t) uspace_handle)
    326326{
    327327        if ((inr < 0) || (inr > last_inr))
  • kernel/generic/src/ipc/ops/dataread.c

    ref705e14 re39d7b8  
    6363        if (!ipc_get_retval(&answer->data)) {
    6464                /* The recipient agreed to send data. */
    65                 uintptr_t src = ipc_get_arg1(&answer->data);
    66                 uintptr_t dst = ipc_get_arg1(olddata);
     65                uspace_addr_t src = ipc_get_arg1(&answer->data);
     66                uspace_addr_t dst = ipc_get_arg1(olddata);
    6767                size_t max_size = ipc_get_arg2(olddata);
    6868                size_t size = ipc_get_arg2(&answer->data);
     
    8181                        }
    8282                        errno_t rc = copy_from_uspace(answer->buffer,
    83                             (void *) src, size);
     83                            src, size);
    8484                        if (rc) {
    8585                                ipc_set_retval(&answer->data, rc);
     
    103103{
    104104        if (answer->buffer) {
    105                 uintptr_t dst = ipc_get_arg1(&answer->data);
     105                uspace_addr_t dst = ipc_get_arg1(&answer->data);
    106106                size_t size = ipc_get_arg2(&answer->data);
    107107                errno_t rc;
    108108
    109                 rc = copy_to_uspace((void *) dst, answer->buffer, size);
     109                rc = copy_to_uspace(dst, answer->buffer, size);
    110110                if (rc)
    111111                        ipc_set_retval(&answer->data, rc);
  • kernel/generic/src/ipc/ops/datawrite.c

    ref705e14 re39d7b8  
    4343static errno_t request_preprocess(call_t *call, phone_t *phone)
    4444{
    45         uintptr_t src = ipc_get_arg1(&call->data);
     45        uspace_addr_t src = ipc_get_arg1(&call->data);
    4646        size_t size = ipc_get_arg2(&call->data);
    4747
     
    5959        if (!call->buffer)
    6060                return ENOMEM;
    61         errno_t rc = copy_from_uspace(call->buffer, (void *) src, size);
     61        errno_t rc = copy_from_uspace(call->buffer, src, size);
    6262        if (rc != EOK) {
    6363                /*
     
    7777        if (!ipc_get_retval(&answer->data)) {
    7878                /* The recipient agreed to receive data. */
    79                 uintptr_t dst = (uintptr_t)ipc_get_arg1(&answer->data);
    80                 size_t size = (size_t)ipc_get_arg2(&answer->data);
    81                 size_t max_size = (size_t)ipc_get_arg2(olddata);
     79                uspace_addr_t dst = ipc_get_arg1(&answer->data);
     80                size_t size = ipc_get_arg2(&answer->data);
     81                size_t max_size = ipc_get_arg2(olddata);
    8282
    8383                if (size <= max_size) {
    84                         errno_t rc = copy_to_uspace((void *) dst,
     84                        errno_t rc = copy_to_uspace(dst,
    8585                            answer->buffer, size);
    8686                        if (rc)
  • kernel/generic/src/ipc/ops/debug.c

    ref705e14 re39d7b8  
    4747{
    4848        if (answer->buffer) {
    49                 uintptr_t dst = ipc_get_arg1(&answer->data);
     49                uspace_addr_t dst = ipc_get_arg1(&answer->data);
    5050                size_t size = ipc_get_arg2(&answer->data);
    5151                errno_t rc;
    5252
    53                 rc = copy_to_uspace((void *) dst, answer->buffer, size);
     53                rc = copy_to_uspace(dst, answer->buffer, size);
    5454                if (rc)
    5555                        ipc_set_retval(&answer->data, rc);
  • kernel/generic/src/ipc/ops/shareout.c

    ref705e14 re39d7b8  
    7070
    7171                if (rc == EOK) {
    72                         rc = copy_to_uspace((void *) ipc_get_arg2(&answer->data),
     72                        rc = copy_to_uspace(ipc_get_arg2(&answer->data),
    7373                            &dst_base, sizeof(dst_base));
    7474                }
  • kernel/generic/src/ipc/sysipc.c

    ref705e14 re39d7b8  
    419419 *
    420420 */
    421 sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t handle, ipc_data_t *data,
     421sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t handle, uspace_ptr(ipc_data_t) data,
    422422    sysarg_t label)
    423423{
     
    437437        }
    438438
    439         errno_t rc = copy_from_uspace(&call->data.args, &data->args,
     439        errno_t rc = copy_from_uspace(&call->data.args, data + offsetof(ipc_data_t, args),
    440440            sizeof(call->data.args));
    441441        if (rc != EOK) {
     
    623623 */
    624624sys_errno_t sys_ipc_forward_slow(cap_call_handle_t chandle,
    625     cap_phone_handle_t phandle, ipc_data_t *data, unsigned int mode)
     625    cap_phone_handle_t phandle, uspace_ptr(ipc_data_t) data, unsigned int mode)
    626626{
    627627        ipc_data_t newdata;
    628         errno_t rc = copy_from_uspace(&newdata.args, &data->args,
     628        errno_t rc = copy_from_uspace(&newdata.args, data + offsetof(ipc_data_t, args),
    629629            sizeof(newdata.args));
    630630        if (rc != EOK)
     
    700700 *
    701701 */
    702 sys_errno_t sys_ipc_answer_slow(cap_call_handle_t chandle, ipc_data_t *data)
     702sys_errno_t sys_ipc_answer_slow(cap_call_handle_t chandle, uspace_ptr(ipc_data_t) data)
    703703{
    704704        kobject_t *kobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
     
    718718                saved = false;
    719719
    720         errno_t rc = copy_from_uspace(&call->data.args, &data->args,
     720        errno_t rc = copy_from_uspace(&call->data.args, data + offsetof(ipc_data_t, args),
    721721            sizeof(call->data.args));
    722722        if (rc != EOK) {
     
    766766 * @return An error code on error.
    767767 */
    768 sys_errno_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec,
     768sys_errno_t sys_ipc_wait_for_call(uspace_ptr(ipc_data_t) calldata, uint32_t usec,
    769769    unsigned int flags)
    770770{
     
    888888 */
    889889sys_errno_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod,
    890     irq_code_t *ucode, cap_irq_handle_t *uspace_handle)
     890    uspace_ptr(irq_code_t) ucode, uspace_ptr(cap_irq_handle_t) uspace_handle)
    891891{
    892892        if (!(perm_get(TASK) & PERM_IRQ_REG))
     
    918918 *
    919919 */
    920 sys_errno_t sys_ipc_connect_kbox(task_id_t *uspace_taskid,
    921     cap_phone_handle_t *uspace_phone)
     920sys_errno_t sys_ipc_connect_kbox(uspace_ptr(task_id_t) uspace_taskid,
     921    uspace_ptr(cap_phone_handle_t) uspace_phone)
    922922{
    923923#ifdef CONFIG_UDEBUG
  • kernel/generic/src/log/log.c

    ref705e14 re39d7b8  
    295295 *
    296296 */
    297 sys_errno_t sys_klog(sysarg_t operation, void *buf, size_t size,
    298     sysarg_t level, size_t *uspace_nread)
     297sys_errno_t sys_klog(sysarg_t operation, uspace_ptr(void) buf, size_t size,
     298    sysarg_t level, uspace_ptr(size_t) uspace_nread)
    299299{
    300300        char *data;
  • kernel/generic/src/main/uinit.c

    ref705e14 re39d7b8  
    7070#endif
    7171
    72         uspace_arg_t *uarg = (uspace_arg_t *) arg;
     72        uspace_arg_t *uarg = arg;
    7373        uspace_arg_t local_uarg;
    7474
     
    7777        local_uarg.uspace_stack_size = uarg->uspace_stack_size;
    7878        local_uarg.uspace_uarg = uarg->uspace_uarg;
    79         local_uarg.uspace_thread_function = NULL;
    80         local_uarg.uspace_thread_arg = NULL;
     79        local_uarg.uspace_thread_function = USPACE_NULL;
     80        local_uarg.uspace_thread_arg = USPACE_NULL;
    8181
    8282        free(uarg);
  • kernel/generic/src/mm/as.c

    ref705e14 re39d7b8  
    20922092
    20932093sysarg_t sys_as_area_create(uintptr_t base, size_t size, unsigned int flags,
    2094     uintptr_t bound, as_area_pager_info_t *pager_info)
     2094    uintptr_t bound, uspace_ptr(as_area_pager_info_t) pager_info)
    20952095{
    20962096        uintptr_t virt = base;
     
    20982098        mem_backend_data_t backend_data;
    20992099
    2100         if (pager_info == AS_AREA_UNPAGED)
     2100        if (!pager_info)
    21012101                backend = &anon_backend;
    21022102        else {
     
    21252125}
    21262126
    2127 sys_errno_t sys_as_area_get_info(uintptr_t address, as_area_info_t *dest)
     2127sys_errno_t sys_as_area_get_info(uintptr_t address, uspace_ptr(as_area_info_t) dest)
    21282128{
    21292129        as_area_t *area;
     
    21362136        }
    21372137
    2138         dest->start_addr = area->base;
    2139         dest->size = P2SZ(area->pages);
    2140         dest->flags = area->flags;
     2138        as_area_info_t info = {
     2139                .start_addr = area->base,
     2140                .size = P2SZ(area->pages),
     2141                .flags = area->flags,
     2142        };
    21412143
    21422144        mutex_unlock(&area->lock);
    21432145        mutex_unlock(&AS->lock);
     2146
     2147        copy_to_uspace(dest, &info, sizeof(info));
    21442148        return EOK;
    21452149}
  • kernel/generic/src/mm/page.c

    ref705e14 re39d7b8  
    215215 *
    216216 */
    217 sys_errno_t sys_page_find_mapping(uintptr_t virt, uintptr_t *phys_ptr)
     217sys_errno_t sys_page_find_mapping(uintptr_t virt, uspace_ptr(uintptr_t) phys_ptr)
    218218{
    219219        uintptr_t phys;
  • kernel/generic/src/proc/program.c

    ref705e14 re39d7b8  
    6969 *
    7070 */
    71 errno_t program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *prg)
     71errno_t program_create(as_t *as, uspace_addr_t entry_addr, char *name, program_t *prg)
    7272{
    7373        uspace_arg_t *kernel_uarg = (uspace_arg_t *)
     
    8686         * Create the stack address space area.
    8787         */
    88         uintptr_t virt = (uintptr_t) -1;
     88        uintptr_t virt = (uintptr_t) AS_AREA_ANY;
    8989        uintptr_t bound = USER_ADDRESS_SPACE_END - (STACK_SIZE_USER - 1);
    9090
     
    103103        }
    104104
    105         kernel_uarg->uspace_entry = (void *) entry_addr;
    106         kernel_uarg->uspace_stack = (void *) virt;
     105        kernel_uarg->uspace_entry = entry_addr;
     106        kernel_uarg->uspace_stack = virt;
    107107        kernel_uarg->uspace_stack_size = STACK_SIZE_USER;
    108         kernel_uarg->uspace_thread_function = NULL;
    109         kernel_uarg->uspace_thread_arg = NULL;
    110         kernel_uarg->uspace_uarg = NULL;
     108        kernel_uarg->uspace_thread_function = USPACE_NULL;
     109        kernel_uarg->uspace_thread_arg = USPACE_NULL;
     110        kernel_uarg->uspace_uarg = USPACE_NULL;
    111111
    112112        /*
     
    218218 *
    219219 */
    220 sys_errno_t sys_program_spawn_loader(char *uspace_name, size_t name_len)
     220sys_errno_t sys_program_spawn_loader(uspace_ptr(char) uspace_name, size_t name_len)
    221221{
    222222        /* Cap length of name and copy it from userspace. */
  • kernel/generic/src/proc/task.c

    ref705e14 re39d7b8  
    323323 *
    324324 */
    325 sys_errno_t sys_task_get_id(sysarg64_t *uspace_taskid)
     325sys_errno_t sys_task_get_id(uspace_ptr(sysarg64_t) uspace_taskid)
    326326{
    327327        /*
     
    363363 *
    364364 */
    365 sys_errno_t sys_task_set_name(const char *uspace_name, size_t name_len)
     365sys_errno_t sys_task_set_name(const uspace_ptr(char) uspace_name, size_t name_len)
    366366{
    367367        char namebuf[TASK_NAME_BUFLEN];
     
    404404 *
    405405 */
    406 sys_errno_t sys_task_kill(task_id_t *uspace_taskid)
     406sys_errno_t sys_task_kill(uspace_ptr(task_id_t) uspace_taskid)
    407407{
    408408        task_id_t taskid;
  • kernel/generic/src/proc/thread.c

    ref705e14 re39d7b8  
    998998 *
    999999 */
    1000 sys_errno_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name,
    1001     size_t name_len, thread_id_t *uspace_thread_id)
     1000sys_errno_t sys_thread_create(uspace_ptr(uspace_arg_t) uspace_uarg, uspace_ptr(char) uspace_name,
     1001    size_t name_len, uspace_ptr(thread_id_t) uspace_thread_id)
    10021002{
    10031003        if (name_len > THREAD_NAME_BUFLEN - 1)
     
    10291029            THREAD_FLAG_USPACE | THREAD_FLAG_NOATTACH, namebuf);
    10301030        if (thread) {
    1031                 if (uspace_thread_id != NULL) {
     1031                if (uspace_thread_id) {
    10321032                        rc = copy_to_uspace(uspace_thread_id, &thread->tid,
    10331033                            sizeof(thread->tid));
     
    10881088 *
    10891089 */
    1090 sys_errno_t sys_thread_get_id(thread_id_t *uspace_thread_id)
     1090sys_errno_t sys_thread_get_id(uspace_ptr(thread_id_t) uspace_thread_id)
    10911091{
    10921092        /*
  • kernel/generic/src/security/perm.c

    ref705e14 re39d7b8  
    158158 *
    159159 */
    160 sys_errno_t sys_perm_grant(sysarg64_t *uspace_taskid, perm_t perms)
     160sys_errno_t sys_perm_grant(uspace_ptr(sysarg64_t) uspace_taskid, perm_t perms)
    161161{
    162162        sysarg64_t taskid;
     
    179179 *
    180180 */
    181 sys_errno_t sys_perm_revoke(sysarg64_t *uspace_taskid, perm_t perms)
     181sys_errno_t sys_perm_revoke(uspace_ptr(sysarg64_t) uspace_taskid, perm_t perms)
    182182{
    183183        sysarg64_t taskid;
  • kernel/generic/src/synch/syswaitq.c

    ref705e14 re39d7b8  
    8888 * @return              Error code.
    8989 */
    90 sys_errno_t sys_waitq_create(cap_waitq_handle_t *whandle)
     90sys_errno_t sys_waitq_create(uspace_ptr(cap_waitq_handle_t) whandle)
    9191{
    9292        waitq_t *wq = slab_alloc(waitq_cache, FRAME_ATOMIC);
  • kernel/generic/src/syscall/copy.c

    ref705e14 re39d7b8  
    5959 * @return EOK on success or an error code from @ref errno.h.
    6060 */
    61 errno_t copy_from_uspace(void *dst, const void *uspace_src, size_t size)
     61errno_t copy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size)
    6262{
    6363        ipl_t ipl;
     
    6868
    6969        if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
    70                 if (overlaps((uintptr_t) uspace_src, size,
     70                if (overlaps(uspace_src, size,
    7171                    KERNEL_ADDRESS_SPACE_START,
    7272                    KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START)) {
     
    8282         * Check whether the address is outside the address space hole.
    8383         */
    84         if (overlaps((uintptr_t) uspace_src, size, ADDRESS_SPACE_HOLE_START,
     84        if (overlaps(uspace_src, size, ADDRESS_SPACE_HOLE_START,
    8585            ADDRESS_SPACE_HOLE_END - ADDRESS_SPACE_HOLE_START))
    8686                return EPERM;
     
    110110 * @return 0 on success or an error code from @ref errno.h.
    111111 */
    112 errno_t copy_to_uspace(void *uspace_dst, const void *src, size_t size)
     112errno_t copy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size)
    113113{
    114114        ipl_t ipl;
     
    119119
    120120        if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
    121                 if (overlaps((uintptr_t) uspace_dst, size,
     121                if (overlaps(uspace_dst, size,
    122122                    KERNEL_ADDRESS_SPACE_START,
    123123                    KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START)) {
     
    133133         * Check whether the address is outside the address space hole.
    134134         */
    135         if (overlaps((uintptr_t) uspace_dst, size, ADDRESS_SPACE_HOLE_START,
     135        if (overlaps(uspace_dst, size, ADDRESS_SPACE_HOLE_START,
    136136            ADDRESS_SPACE_HOLE_END - ADDRESS_SPACE_HOLE_START))
    137137                return EPERM;
  • kernel/generic/src/sysinfo/sysinfo.c

    ref705e14 re39d7b8  
    677677 *
    678678 */
    679 _NO_TRACE static sysinfo_return_t sysinfo_get_item_uspace(void *ptr, size_t size,
     679_NO_TRACE static sysinfo_return_t sysinfo_get_item_uspace(uspace_ptr(void) ptr, size_t size,
    680680    bool dry_run)
    681681{
     
    786786 *
    787787 */
    788 _NO_TRACE static sysinfo_return_t sysinfo_get_keys_uspace(void *ptr, size_t size,
     788_NO_TRACE static sysinfo_return_t sysinfo_get_keys_uspace(uspace_ptr(void) ptr, size_t size,
    789789    bool dry_run)
    790790{
     
    831831 *
    832832 */
    833 sys_errno_t sys_sysinfo_get_keys_size(void *path_ptr, size_t path_size,
    834     void *size_ptr)
     833sys_errno_t sys_sysinfo_get_keys_size(uspace_ptr(void) path_ptr, size_t path_size,
     834    uspace_ptr(void) size_ptr)
    835835{
    836836        errno_t rc;
     
    879879 *
    880880 */
    881 sys_errno_t sys_sysinfo_get_keys(void *path_ptr, size_t path_size,
    882     void *buffer_ptr, size_t buffer_size, size_t *size_ptr)
     881sys_errno_t sys_sysinfo_get_keys(uspace_ptr(void) path_ptr, size_t path_size,
     882    uspace_ptr(void) buffer_ptr, size_t buffer_size, uspace_ptr(size_t) size_ptr)
    883883{
    884884        errno_t rc;
     
    914914 *
    915915 */
    916 sysarg_t sys_sysinfo_get_val_type(void *path_ptr, size_t path_size)
     916sysarg_t sys_sysinfo_get_val_type(uspace_ptr(void) path_ptr, size_t path_size)
    917917{
    918918        /*
     
    950950 *
    951951 */
    952 sys_errno_t sys_sysinfo_get_value(void *path_ptr, size_t path_size,
    953     void *value_ptr)
     952sys_errno_t sys_sysinfo_get_value(uspace_ptr(void) path_ptr, size_t path_size,
     953    uspace_ptr(void) value_ptr)
    954954{
    955955        errno_t rc;
     
    986986 *
    987987 */
    988 sys_errno_t sys_sysinfo_get_data_size(void *path_ptr, size_t path_size,
    989     void *size_ptr)
     988sys_errno_t sys_sysinfo_get_data_size(uspace_ptr(void) path_ptr, size_t path_size,
     989    uspace_ptr(void) size_ptr)
    990990{
    991991        errno_t rc;
     
    10361036 *
    10371037 */
    1038 sys_errno_t sys_sysinfo_get_data(void *path_ptr, size_t path_size,
    1039     void *buffer_ptr, size_t buffer_size, size_t *size_ptr)
     1038sys_errno_t sys_sysinfo_get_data(uspace_ptr(void) path_ptr, size_t path_size,
     1039    uspace_ptr(void) buffer_ptr, size_t buffer_size, uspace_ptr(size_t) size_ptr)
    10401040{
    10411041        errno_t rc;
  • kernel/generic/src/udebug/udebug_ipc.c

    ref705e14 re39d7b8  
    398398static void udebug_receive_mem_read(call_t *call)
    399399{
    400         sysarg_t uspace_dst;
    401         sysarg_t uspace_src;
     400        uspace_ptr(void) uspace_dst;
     401        uspace_ptr(void) uspace_src;
    402402        unsigned size;
    403403        void *buffer = NULL;
  • kernel/generic/src/udebug/udebug_ops.c

    ref705e14 re39d7b8  
    548548 *
    549549 */
    550 errno_t udebug_mem_read(sysarg_t uspace_addr, size_t n, void **buffer)
     550errno_t udebug_mem_read(uspace_addr_t uspace_addr, size_t n, void **buffer)
    551551{
    552552        /* Verify task state */
     
    569569         *
    570570         */
    571         errno_t rc = copy_from_uspace(data_buffer, (void *) uspace_addr, n);
     571        errno_t rc = copy_from_uspace(data_buffer, uspace_addr, n);
    572572        mutex_unlock(&TASK->udebug.lock);
    573573
Note: See TracChangeset for help on using the changeset viewer.