VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/netbsd/memuserkernel-r0drv-netbsd.c@ 63354

Last change on this file since 63354 was 63345, checked in by vboxsync, 8 years ago

r0drv/netbsd: re-import r0drv support for NetBSD on top of svn copy of
FreeBSD sources for cases where the differences are obvious and
minimal.

From Haomai Wang GSoC project with additional changes by Arto Huusko.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/* $Id: memuserkernel-r0drv-netbsd.c 63345 2016-08-11 18:25:33Z vboxsync $ */
2/** @file
3 * IPRT - User & Kernel Memory, Ring-0 Driver, NetBSD.
4 */
5
6/*
7 * Copyright (C) 2009-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#include "the-netbsd-kernel.h"
32
33#include <iprt/mem.h>
34#include <iprt/err.h>
35
36
37RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)
38{
39 int rc = copyin((const void *)R3PtrSrc, pvDst, cb);
40 if (RT_LIKELY(rc == 0))
41 return VINF_SUCCESS;
42 return VERR_ACCESS_DENIED;
43}
44
45
46RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)
47{
48 int rc = copyout(pvSrc, (void *)R3PtrDst, cb);
49 if (RT_LIKELY(rc == 0))
50 return VINF_SUCCESS;
51 return VERR_ACCESS_DENIED;
52}
53
54
55RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr)
56{
57 return R3Ptr < VM_MAXUSER_ADDRESS;
58}
59
60
61RTR0DECL(bool) RTR0MemKernelIsValidAddr(void *pv)
62{
63 return (uintptr_t)pv >= VM_MAXUSER_ADDRESS;
64}
65
66
67RTR0DECL(bool) RTR0MemAreKrnlAndUsrDifferent(void)
68{
69 return true;
70}
71
72
73RTR0DECL(int) RTR0MemKernelCopyFrom(void *pvDst, void const *pvSrc, size_t cb)
74{
75 return VERR_NOT_SUPPORTED;
76}
77
78
79RTR0DECL(int) RTR0MemKernelCopyTo(void *pvDst, void const *pvSrc, size_t cb)
80{
81 return VERR_NOT_SUPPORTED;
82}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette