VirtualBox

source: vbox/trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInit.cpp@ 75650

Last change on this file since 75650 was 75597, checked in by vboxsync, 6 years ago

os2/VBoxSF: Complain if the embedded buffer feature is missing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 5.4 KB
Line 
1/* $Id: VBoxSFInit.cpp 75597 2018-11-19 19:51:02Z vboxsync $ */
2/** @file
3 * VBoxSF - OS/2 Shared Folders, Initialization.
4 */
5
6/*
7 * Copyright (c) 2007-2018 knut st. osmundsen <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31
32/*********************************************************************************************************************************
33* Header Files *
34*********************************************************************************************************************************/
35#define LOG_GROUP LOG_GROUP_DEFAULT
36#include "VBoxSFInternal.h"
37
38#include <VBox/VBoxGuestLib.h>
39#include <VBox/VBoxGuest.h>
40#include <VBox/log.h>
41#include <iprt/assert.h>
42#include <iprt/initterm.h>
43
44
45/*********************************************************************************************************************************
46* Global Variables *
47*********************************************************************************************************************************/
48RT_C_DECLS_BEGIN
49/* from VBoxSFA.asm */
50extern RTFAR16 g_fpfnDevHlp;
51extern VBGLOS2ATTACHDD g_VBoxGuestIDC;
52extern uint32_t g_u32Info;
53/* from sys0.asm and the linker/end.lib. */
54extern char _text, _etext, _data, _end;
55RT_C_DECLS_END
56
57
58
59/**
60 * 32-bit Ring-0 init routine.
61 *
62 * This is called the first time somebody tries to use the IFS.
63 * It will initialize IPRT, Vbgl and whatever else is required.
64 *
65 * The caller will do the necessary AttachDD and calling of the 16 bit
66 * IDC to initialize the g_VBoxGuestIDC global. Perhaps we should move
67 * this bit to VbglR0InitClient? It's just that it's so much simpler to do it
68 * while we're on the way here...
69 *
70 */
71DECLASM(void) VBoxSFR0Init(void)
72{
73 RTLogBackdoorPrintf("VBoxSFR0Init: g_fpfnDevHlp=%lx u32Version=%RX32 u32Session=%RX32 pfnServiceEP=%p g_u32Info=%u (%#x)\n",
74 g_fpfnDevHlp, g_VBoxGuestIDC.u32Version, g_VBoxGuestIDC.u32Session, g_VBoxGuestIDC.pfnServiceEP, g_u32Info, g_u32Info);
75 RTLogBackdoorPrintf("&KernSISData=%p\n", &KernSISData);
76 RTLogBackdoorPrintf("&KernLISData=%p\n", &KernLISData);
77 RTLogBackdoorPrintf("KernInterruptLevel=%#x\n", KernInterruptLevel);
78 RTLogBackdoorPrintf("KernTKSSBase=%p\n", KernTKSSBase);
79
80 KernAllocMutexLock(&g_MtxFolders);
81 RTListInit(&g_FolderHead);
82
83 /*
84 * Start by initializing IPRT.
85 */
86 if ( g_VBoxGuestIDC.u32Version == VBGL_IOC_VERSION
87 && VALID_PTR(g_VBoxGuestIDC.u32Session)
88 && VALID_PTR(g_VBoxGuestIDC.pfnServiceEP))
89 {
90 int rc = RTR0Init(0);
91 if (RT_SUCCESS(rc))
92 {
93 rc = VbglR0InitClient();
94 if (RT_SUCCESS(rc))
95 {
96 /*
97 * Complain if the embedded buffers feature is missing.
98 */
99 uint32_t fFeatures = 0;
100 rc = VbglR0QueryHostFeatures(&fFeatures);
101 if (RT_FAILURE(rc))
102 RTLogBackdoorPrintf("VBoxSFR0Init: Missing VBoxGuest.sys IDC connection! Check order in Config.kmk!\n");
103 else if (!(fFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS))
104 RTLogBackdoorPrintf("VBoxSFR0Init: Embedded buffers feature is missing. Upgrade to latest VirtualBox!\n");
105
106#ifndef DONT_LOCK_SEGMENTS
107 /*
108 * Lock the 32-bit segments in memory.
109 */
110 static KernVMLock_t s_Text32, s_Data32;
111 rc = KernVMLock(VMDHL_LONG,
112 &_text, (uintptr_t)&_etext - (uintptr_t)&_text,
113 &s_Text32, (KernPageList_t *)-1, NULL);
114 AssertMsg(rc == NO_ERROR, ("locking text32 failed, rc=%d\n"));
115 rc = KernVMLock(VMDHL_LONG | VMDHL_WRITE,
116 &_data, (uintptr_t)&_end - (uintptr_t)&_data,
117 &s_Data32, (KernPageList_t *)-1, NULL);
118 AssertMsg(rc == NO_ERROR, ("locking text32 failed, rc=%d\n"));
119#endif
120
121 RTLogBackdoorPrintf("VBoxSFR0Init: completed successfully\n");
122 return;
123 }
124 }
125
126 RTLogBackdoorPrintf("VBoxSF: RTR0Init failed, rc=%Rrc\n", rc);
127 }
128 else
129 RTLogBackdoorPrintf("VBoxSF: Failed to connect to VBoxGuest.sys.\n");
130}
131
Note: See TracBrowser for help on using the repository browser.

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