DECLHIDDEN(int) rtR0InitNative(void) { /* * Get the DOS Tables. */ RTFAR16 fp; int rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_DOSTABLES, 0, &fp); AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR); g_pDosTable = (PCDOSTABLE)RTR0Os2Virt2Flat(fp); AssertReturn(g_pDosTable, VERR_INTERNAL_ERROR); g_pDosTable2 = (PCDOSTABLE2)((const uint8_t *)g_pDosTable + g_pDosTable->cul * sizeof(ULONG) + 1); /* * Get the addresses of the two info segments. */ rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_SYSINFOSEG, 0, &fp); AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR); g_pGIS = (PGINFOSEG)RTR0Os2Virt2Flat(fp); rc = RTR0Os2DHQueryDOSVar(DHGETDOSV_LOCINFOSEG, 0, &fp); AssertMsgReturn(!rc, ("rc=%d\n", rc), VERR_INTERNAL_ERROR); g_fpLIS = fp; return VINF_SUCCESS; }
RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void) { PLINFOSEG pLIS = (PLINFOSEG)RTR0Os2Virt2Flat(g_fpLIS); AssertReturn(pLIS, NIL_RTNATIVETHREAD); return pLIS->tidCurrent | (pLIS->pidCurrent << 16); }
RTDECL(RTPROCESS) RTProcSelf(void) { PLINFOSEG pLIS = (PLINFOSEG)RTR0Os2Virt2Flat(g_fpLIS); AssertReturn(pLIS, NIL_RTPROCESS); return pLIS->pidCurrent; }