VirtualBox

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

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

initterm-r0drv-os2.cpp: drop RT_STRICT.

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