VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp@ 70381

Last change on this file since 70381 was 57358, checked in by vboxsync, 9 years ago

*: scm cleanup run.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.7 KB
Line 
1/* $Id: initterm-r0drv-os2.cpp 57358 2015-08-14 15:16:38Z vboxsync $ */
2/** @file
3 * IPRT - Initialization & Termination, Ring-0 Driver, OS/2.
4 */
5
6/*
7 * Copyright (c) 2007 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#define RT_STRICT
32
33
34/*********************************************************************************************************************************
35* Header Files *
36*********************************************************************************************************************************/
37#include "the-os2-kernel.h"
38
39#include "internal/initterm.h"
40#include <iprt/err.h>
41#include <iprt/assert.h>
42
43
44/*********************************************************************************************************************************
45* Global Variables *
46*********************************************************************************************************************************/
47/** Pointer to the 1st DOS variable table. */
48PCDOSTABLE g_pDosTable = NULL;
49/** Pointer to the 2nd DOS variable table. */
50PCDOSTABLE2 g_pDosTable2 = NULL;
51/** Pointer to the global info segment. */
52PGINFOSEG g_pGIS = NULL;
53/** Far 16:16 pointer to the local info segment.
54 * IIRC this must be converted to a flat pointer when accessed to work correctly on SMP systems. */
55RTFAR16 g_fpLIS = {0, 0};
56
57
58DECLHIDDEN(int) rtR0InitNative(void)
59{
60 /*
61 * Get the DOS Tables.
62 */
63 RTFAR16 fp;
64 int rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_DOSTABLES, 0, &fp);
65 AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR);
66 g_pDosTable = (PCDOSTABLE)RTR0Os2Virt2Flat(fp);
67 AssertReturn(g_pDosTable, VERR_INTERNAL_ERROR);
68 g_pDosTable2 = (PCDOSTABLE2)((const uint8_t *)g_pDosTable + g_pDosTable->cul * sizeof(ULONG) + 1);
69
70 /*
71 * Get the addresses of the two info segments.
72 */
73 rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_SYSINFOSEG, 0, &fp);
74 AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR);
75 g_pGIS = (PGINFOSEG)RTR0Os2Virt2Flat(fp);
76 rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_LOCINFOSEG, 0, &fp);
77 AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR);
78 g_fpLIS = fp;
79
80 return VINF_SUCCESS;
81}
82
83
84DECLHIDDEN(void) rtR0TermNative(void)
85{
86 /* nothing to do here yet. */
87}
88
89
90/**
91 * Converts a 16:16 pointer to a flat pointer.
92 *
93 * @returns Flat pointer (NULL if fp is NULL).
94 * @param fp Far pointer to convert.
95 */
96RTR0DECL(void *) RTR0Os2Virt2Flat(RTFAR16 fp)
97{
98 return (void *)KernSelToFlat((fp.sel << 16) | fp.off);
99}
100
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