Index: trunk/include/VBox/pdmdev.h
===================================================================
--- trunk/include/VBox/pdmdev.h	(revision 27125)
+++ trunk/include/VBox/pdmdev.h	(revision 27126)
@@ -1711,7 +1711,7 @@
      * @returns rc if we failed to set legacy mode.
      * @param   pDevIns         Device instance of the HPET.
-     * @param   fActivate       Activate or deactivate legacy mode.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnSetLegacyMode,(PPDMDEVINS pDevIns, bool fActivate));
+     * @param   fActivated      Whether legacy mode is activated or deactivated.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnSetLegacyMode,(PPDMDEVINS pDevIns, bool fActivated));
 
 
Index: trunk/include/VBox/pdmifs.h
===================================================================
--- trunk/include/VBox/pdmifs.h	(revision 27125)
+++ trunk/include/VBox/pdmifs.h	(revision 27126)
@@ -1937,41 +1937,24 @@
 #define PDMIVMMDEVPORT_IID                      "d7e52035-3b6c-422e-9215-2a75646a945d"
 
-/** Pointer to a PIT port interface. */
-typedef struct PDMIPITPORT *PPDMIPITPORT;
-/**
- * PIT port interface.
- */
-typedef struct PDMIPITPORT
-{
-    /**
-     * Notify PIT about change of HPET legacy mode.
-     *
-     * @returns VBox status code
-     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
-     * @param   fActivate       If HPET legacy mode activated or deactivated.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnNotifyHpetLegacy,(PPDMIPITPORT pInterface, bool fActivate));
-} PDMIPITPORT;
-/** PDMIPITPORT interface ID. */
-#define PDMIPITPORT_IID                        "06127207-3182-4394-b16e-0ecfeb5cbb27"
-
-/** Pointer to a RTC port interface. */
-typedef struct PDMIRTCPORT *PPDMIRTCPORT;
-/**
- * RTC port interface.
- */
-typedef struct PDMIRTCPORT
-{
-    /**
-     * Notify RTC about change of HPET legacy mode.
-     *
-     * @returns VBox status code
-     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
-     * @param   fActivate       If HPET legacy mode activated or deactivated.
-     */
-    DECLR3CALLBACKMEMBER(int, pfnNotifyHpetLegacy,(PPDMIRTCPORT pInterface, bool fActivate));
-} PDMIRTCPORT;
-/** PDMIRTCPORT interface ID. */
-#define PDMIRTCPORT_IID                        "b6af0d7c-56c7-4064-85aa-ba78b43a26e7"
+
+/** Pointer to a HPET legacy notifcation interface. */
+typedef struct PDMIHPETLEGACYNOTIFY *PPDMIHPETLEGACYNOTIFY;
+/**
+ * HPET legacy notifcation interface.
+ */
+typedef struct PDMIHPETLEGACYNOTIFY
+{
+    /**
+     * Notify about change of HPET legacy mode.
+     *
+     * @param   pInterface      Pointer to the interface structure containing the
+     *                          called function pointer.
+     * @param   fActivated      If HPET legacy mode is activated (@c true) or
+     *                          deactivated (@c false).
+     */
+    DECLR3CALLBACKMEMBER(void, pfnModeChanged,(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated));
+} PDMIHPETLEGACYNOTIFY;
+/** PDMIHPETLEGACYNOTIFY interface ID. */
+#define PDMIHPETLEGACYNOTIFY_IID                "c9ada595-4b65-4311-8b21-b10498997774"
 
 
Index: trunk/src/VBox/Devices/PC/DevHPET.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevHPET.cpp	(revision 27125)
+++ trunk/src/VBox/Devices/PC/DevHPET.cpp	(revision 27126)
@@ -616,5 +616,5 @@
             iOldValue = (uint32_t)(pThis->u64Config);
 
-            /**
+            /*
              * This check must be here, before actual update, as hpetLegacyMode
              * may request retry in R3 - so we must keep state intact.
Index: trunk/src/VBox/Devices/PC/DevPit-i8254.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevPit-i8254.cpp	(revision 27125)
+++ trunk/src/VBox/Devices/PC/DevPit-i8254.cpp	(revision 27126)
@@ -156,15 +156,10 @@
     /** Config: Speaker enabled. */
     bool                    fSpeakerCfg;
-    uint8_t                 fDisabledByHpet;
-#if HC_ARCH_BITS == 64
-    bool                    afAlignment0[4];
-#endif
+    bool                    fDisabledByHpet;
+    bool                    afAlignment0[HC_ARCH_BITS == 32 ? 4 : 4];
     /** PIT port interface. */
-    PDMIPITPORT             IPITPort;
+    PDMIHPETLEGACYNOTIFY    IHpetLegacyNotify;
     /** Pointer to the device instance. */
     PPDMDEVINSR3            pDevIns;
-#if HC_ARCH_BITS == 32
-    uint32_t                alignment1;
-#endif
     /** Number of IRQs that's been raised. */
     STAMCOUNTER             StatPITIrq;
@@ -789,6 +784,4 @@
 
     SSMR3PutS32(pSSM, pThis->speaker_data_on);
-
-
 #ifdef FAKE_REFRESH_CLOCK
     SSMR3PutS32(pSSM, pThis->dummy_refresh_clock);
@@ -797,7 +790,5 @@
 #endif
 
-    SSMR3PutU8(pSSM, pThis->fDisabledByHpet);
-
-    return 0;
+    return SSMR3PutBool(pSSM, pThis->fDisabledByHpet);
 }
 
@@ -877,9 +868,8 @@
     SSMR3GetS32(pSSM, &u32Dummy);
 #endif
-
     if (uVersion > PIT_SAVED_STATE_VERSION_VBOX_31)
-        SSMR3GetU8(pSSM, &pThis->fDisabledByHpet);
-
-    return 0;
+        SSMR3GetBool(pSSM, &pThis->fDisabledByHpet);
+
+    return VINF_SUCCESS;
 }
 
@@ -903,4 +893,70 @@
 
 /**
+ * Info handler, device version.
+ *
+ * @param   pDevIns     Device instance which registered the info.
+ * @param   pHlp        Callback functions for doing output.
+ * @param   pszArgs     Argument string. Optional and specific to the handler.
+ */
+static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
+{
+    PITState   *pThis = PDMINS_2_DATA(pDevIns, PITState *);
+    unsigned    i;
+    for (i = 0; i < RT_ELEMENTS(pThis->channels); i++)
+    {
+        const PITChannelState *pCh = &pThis->channels[i];
+
+        pHlp->pfnPrintf(pHlp,
+                        "PIT (i8254) channel %d status: irq=%#x\n"
+                        "      count=%08x"      "  latched_count=%04x  count_latched=%02x\n"
+                        "           status=%02x   status_latched=%02x     read_state=%02x\n"
+                        "      write_state=%02x      write_latch=%02x        rw_mode=%02x\n"
+                        "             mode=%02x              bcd=%02x           gate=%02x\n"
+                        "  count_load_time=%016RX64 next_transition_time=%016RX64\n"
+                        "      u64ReloadTS=%016RX64            u64NextTS=%016RX64\n"
+                        ,
+                        i, pCh->irq,
+                        pCh->count,         pCh->latched_count,     pCh->count_latched,
+                        pCh->status,        pCh->status_latched,    pCh->read_state,
+                        pCh->write_state,   pCh->write_latch,       pCh->rw_mode,
+                        pCh->mode,          pCh->bcd,               pCh->gate,
+                        pCh->count_load_time,   pCh->next_transition_time,
+                        pCh->u64ReloadTS,       pCh->u64NextTS);
+    }
+#ifdef FAKE_REFRESH_CLOCK
+    pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n",
+                    pThis->speaker_data_on, pThis->dummy_refresh_clock);
+#else
+    pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pThis->speaker_data_on);
+#endif
+    if (pThis->fDisabledByHpet)
+        pHlp->pfnPrintf(pHlp, "Disabled by HPET\n");
+}
+
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) pitQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDEVINS  pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);
+    PITState   *pThis   = PDMINS_2_DATA(pDevIns, PITState *);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE,    &pDevIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHPETLEGACYNOTIFY, &pThis->IHpetLegacyNotify);
+    return NULL;
+}
+
+
+/**
+ * @interface_method_impl{PDMIHPETLEGACYNOTIFY,pfnModeChanged}
+ */
+static DECLCALLBACK(void) pitNotifyHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)
+{
+    PITState *pThis = RT_FROM_MEMBER(pInterface, PITState, IHpetLegacyNotify);
+    pThis->fDisabledByHpet = fActivated;
+}
+
+
+/**
  * Relocation notification.
  *
@@ -924,6 +980,4 @@
 }
 
-/** @todo remove this! */
-static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
 
 /**
@@ -966,71 +1020,4 @@
 
 /**
- * Info handler, device version.
- *
- * @param   pDevIns     Device instance which registered the info.
- * @param   pHlp        Callback functions for doing output.
- * @param   pszArgs     Argument string. Optional and specific to the handler.
- */
-static DECLCALLBACK(void) pitInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
-{
-    PITState   *pThis = PDMINS_2_DATA(pDevIns, PITState *);
-    unsigned    i;
-    for (i = 0; i < RT_ELEMENTS(pThis->channels); i++)
-    {
-        const PITChannelState *pCh = &pThis->channels[i];
-
-        pHlp->pfnPrintf(pHlp,
-                        "PIT (i8254) channel %d status: irq=%#x\n"
-                        "      count=%08x"      "  latched_count=%04x  count_latched=%02x\n"
-                        "           status=%02x   status_latched=%02x     read_state=%02x\n"
-                        "      write_state=%02x      write_latch=%02x        rw_mode=%02x\n"
-                        "             mode=%02x              bcd=%02x           gate=%02x\n"
-                        "  count_load_time=%016RX64 next_transition_time=%016RX64\n"
-                        "      u64ReloadTS=%016RX64            u64NextTS=%016RX64\n"
-                        ,
-                        i, pCh->irq,
-                        pCh->count,         pCh->latched_count,     pCh->count_latched,
-                        pCh->status,        pCh->status_latched,    pCh->read_state,
-                        pCh->write_state,   pCh->write_latch,       pCh->rw_mode,
-                        pCh->mode,          pCh->bcd,               pCh->gate,
-                        pCh->count_load_time,   pCh->next_transition_time,
-                        pCh->u64ReloadTS,       pCh->u64NextTS);
-    }
-#ifdef FAKE_REFRESH_CLOCK
-    pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x dummy_refresh_clock=%#x\n",
-                    pThis->speaker_data_on, pThis->dummy_refresh_clock);
-#else
-    pHlp->pfnPrintf(pHlp, "speaker_data_on=%#x\n", pThis->speaker_data_on);
-#endif
-    if (pThis->fDisabledByHpet)
-        pHlp->pfnPrintf(pHlp, "Disabled by HPET\n");
-}
-
-/**
- * @interface_method_impl{PDMIBASE,pfnQueryInterface}
- */
-static DECLCALLBACK(void *) pitQueryInterface(PPDMIBASE pInterface, const char *pszIID)
-{
-    PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);
-    PITState *pThis = PDMINS_2_DATA(pDevIns, PITState *);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE,    &pDevIns->IBase);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIPITPORT, &pThis->IPITPort);
-    return NULL;
-}
-
-/**
- * @interface_method_impl{PDMIPITPORT,pfnNotifyHpetLegacy}
- *
- * @returns VBox status code
- * @param   pInterface      Pointer to the interface structure containing the called function pointer.
- */
-static DECLCALLBACK(int) pitNotifyHpetLegacy(PPDMIPITPORT pInterface, bool fActivate)
-{
-    PITState *pThis = RT_FROM_MEMBER(pInterface, PITState, IPITPort);
-    pThis->fDisabledByHpet = fActivate;
-    return VINF_SUCCESS;
-}
-
-/**
  * @interface_method_impl{PDMDEVREG,pfnConstruct}
  */
@@ -1091,4 +1078,12 @@
         pThis->channels[i].pPitRC = PDMINS_2_DATA_RCPTR(pDevIns);
     }
+
+    /*
+     * Interfaces
+     */
+    /* IBase */
+    pDevIns->IBase.pfnQueryInterface        = pitQueryInterface;
+    /* IHpetLegacyNotify */
+    pThis->IHpetLegacyNotify.pfnModeChanged = pitNotifyHpetLegacyNotify_ModeChanged;
 
     /*
@@ -1135,12 +1130,4 @@
     if (RT_FAILURE(rc))
         return rc;
-
-    /*
-     * Interfaces
-     */
-    /* IBase */
-    pDevIns->IBase.pfnQueryInterface            = pitQueryInterface;
-    /* IPITPort */
-    pThis->IPITPort.pfnNotifyHpetLegacy         = pitNotifyHpetLegacy;
 
     /*
Index: trunk/src/VBox/Devices/PC/DevRTC.cpp
===================================================================
--- trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 27125)
+++ trunk/src/VBox/Devices/PC/DevRTC.cpp	(revision 27126)
@@ -146,6 +146,5 @@
     uint8_t cmos_data[128];
     uint8_t cmos_index;
-    uint8_t fDisabledByHpet;
-    uint8_t Alignment0[6];
+    uint8_t Alignment0[7];
     struct my_tm current_tm;
     /** The configured IRQ. */
@@ -155,11 +154,10 @@
     /** Use UTC or local time initially. */
     bool fUTC;
+    /** Disabled by HPET legacy mode. */
+    bool fDisabledByHpet;
     /* periodic timer */
     int64_t next_periodic_time;
     /* second update */
     int64_t next_second_time;
-
-    /** RTC port interface. */
-    PDMIRTCPORT  IRTCPort;
 
     /** Pointer to the device instance - R3 Ptr. */
@@ -198,4 +196,7 @@
     /** The current/previous timer period. Used to prevent flooding changes. */
     int32_t CurPeriod;
+
+    /** HPET legacy mode notification interface. */
+    PDMIHPETLEGACYNOTIFY  IHpetLegacyNotify;
 };
 
@@ -237,5 +238,4 @@
     }
 }
-
 
 static void rtc_raise_irq(RTCState* pThis, uint32_t iLevel)
@@ -663,7 +663,5 @@
     TMR3TimerSave(pThis->CTX_SUFF(pSecondTimer2), pSSM);
 
-    SSMR3PutU8(pSSM, pThis->fDisabledByHpet);
-
-    return VINF_SUCCESS;
+    return SSMR3PutBool(pSSM, pThis->fDisabledByHpet);
 }
 
@@ -723,4 +721,7 @@
     TMR3TimerLoad(pThis->CTX_SUFF(pSecondTimer), pSSM);
     TMR3TimerLoad(pThis->CTX_SUFF(pSecondTimer2), pSSM);
+
+    if (uVersion > RTC_SAVED_STATE_VERSION_VBOX_31)
+         SSMR3GetBool(pSSM, &pThis->fDisabledByHpet);
 
     int period_code = pThis->cmos_data[RTC_REG_A] & 0x0f;
@@ -738,8 +739,4 @@
     pThis->cRelLogEntries = 0;
 
-
-    if (uVersion > RTC_SAVED_STATE_VERSION_VBOX_31)
-         SSMR3GetU8(pSSM, &pThis->fDisabledByHpet);
-
     return VINF_SUCCESS;
 }
@@ -862,4 +859,27 @@
 
 /**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) rtcQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDEVINS  pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);
+    RTCState   *pThis   = PDMINS_2_DATA(pDevIns, RTCState *);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE,             &pDevIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHPETLEGACYNOTIFY, &pThis->IHpetLegacyNotify);
+    return NULL;
+}
+
+
+/**
+ * @interface_method_impl{PDMIHPETLEGACYNOTIFY,pfnModeChanged}
+ */
+static DECLCALLBACK(void) rtcHpetLegacyNotify_ModeChanged(PPDMIHPETLEGACYNOTIFY pInterface, bool fActivated)
+{
+    RTCState *pThis = RT_FROM_MEMBER(pInterface, RTCState, IHpetLegacyNotify);
+    pThis->fDisabledByHpet = fActivated;
+}
+
+
+/**
  * @copydoc
  */
@@ -874,25 +894,4 @@
 }
 
-/**
- * @interface_method_impl{PDMIBASE,pfnQueryInterface}
- */
-static DECLCALLBACK(void *) rtcQueryInterface(PPDMIBASE pInterface, const char *pszIID)
-{
-    PPDMDEVINS pDevIns = RT_FROM_MEMBER(pInterface, PDMDEVINS, IBase);
-    RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE,    &pDevIns->IBase);
-    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIRTCPORT, &pThis->IRTCPort);
-    return NULL;
-}
-
-/**
- * @interface_method_impl{PDMIRTCPORT,pfnNotifyHpetLegacy}
- */
-static DECLCALLBACK(int) rtcNotifyHpetLegacy(PPDMIRTCPORT pInterface, bool fActivate)
-{
-    RTCState *pThis = RT_FROM_MEMBER(pInterface, RTCState, IRTCPort);
-    pThis->fDisabledByHpet = fActivate;
-    return VINF_SUCCESS;
-}
 
 /**
@@ -964,4 +963,9 @@
     pThis->fDisabledByHpet      = false;
 
+    /* IBase */
+    pDevIns->IBase.pfnQueryInterface        = rtcQueryInterface;
+    /* IHpetLegacyNotify */
+    pThis->IHpetLegacyNotify.pfnModeChanged = rtcHpetLegacyNotify_ModeChanged;
+
     /*
      * Create timers, arm them, register I/O Ports and save state.
@@ -1020,14 +1024,5 @@
 
     /*
-     * Interfaces
-     */
-    /* IBase */
-    pDevIns->IBase.pfnQueryInterface            = rtcQueryInterface;
-    /* IRTCPort */
-    pThis->IRTCPort.pfnNotifyHpetLegacy         = rtcNotifyHpetLegacy;
-
-    /*
      * Register ourselves as the RTC/CMOS with PDM.
-     * @todo: maybe use generic iface above?
      */
     rc = PDMDevHlpRTCRegister(pDevIns, &pThis->RtcReg, &pThis->pRtcHlpR3);
@@ -1096,2 +1091,3 @@
 #endif /* IN_RING3 */
 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
+
Index: trunk/src/VBox/VMM/PDMDevMiscHlp.cpp
===================================================================
--- trunk/src/VBox/VMM/PDMDevMiscHlp.cpp	(revision 27125)
+++ trunk/src/VBox/VMM/PDMDevMiscHlp.cpp	(revision 27126)
@@ -557,38 +557,36 @@
 
 /** @interface_method_impl{PDMHPETHLPR3,pfnSetLegacyMode} */
-static DECLCALLBACK(int) pdmR3HpetHlp_SetLegacyMode(PPDMDEVINS pDevIns, bool fActivate)
-{
-    PDMDEV_ASSERT_DEVINS(pDevIns);
-    LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: fActivate=%d\n", pDevIns->pReg->szName, pDevIns->iInstance, fActivate));
-
-    PPDMIBASE pBase;
-    int rc;
-
-    rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3, "i8254", 0, &pBase);
-    /* No PIT - no problems too */
-    if (RT_SUCCESS(rc))
+static DECLCALLBACK(int) pdmR3HpetHlp_SetLegacyMode(PPDMDEVINS pDevIns, bool fActivated)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: fActivated=%RTbool\n", pDevIns->pReg->szName, pDevIns->iInstance, fActivated));
+
+    size_t                      i;
+    int                         rc = VINF_SUCCESS;
+    static const char * const   s_apszDevsToNotify[] =
     {
-        Assert(pBase);
-        PPDMIPITPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIPITPORT);
-
-        rc = pPort ? pPort->pfnNotifyHpetLegacy(pPort, fActivate) : VINF_SUCCESS;
+        "i8254",
+        "mc146818"
+    };
+    for (i = 0; i < RT_ELEMENTS(s_apszDevsToNotify); i++)
+    {
+        PPDMIBASE pBase;
+        rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3, "i8254", 0, &pBase);
+        if (RT_SUCCESS(rc))
+        {
+            PPDMIHPETLEGACYNOTIFY pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIHPETLEGACYNOTIFY);
+            AssertLogRelMsgBreakStmt(pPort, ("%s\n", s_apszDevsToNotify[i]), rc == VERR_INTERNAL_ERROR_3);
+            pPort->pfnModeChanged(pPort, fActivated);
+        }
+        else if (   rc == VERR_PDM_DEVICE_NOT_FOUND
+                 || rc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND)
+            rc = VINF_SUCCESS; /* the device isn't configured, ignore. */
+        else
+            AssertLogRelMsgFailedBreak(("%s -> %Rrc\n", s_apszDevsToNotify[i], rc));
     }
-    else
-        rc = VINF_SUCCESS;
-
-    if (RT_FAILURE(rc))
-        return rc;
-
-    rc = PDMR3QueryDevice(pDevIns->Internal.s.pVMR3, "mc146818", 0, &pBase);
-    /* No RTC - no problems too */
-    if (RT_SUCCESS(rc))
-    {
-        Assert(pBase);
-        PPDMIRTCPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIRTCPORT);
-        rc = pPort ? pPort->pfnNotifyHpetLegacy(pPort, fActivate) : VINF_SUCCESS;
-    }
-    else
-        rc = VINF_SUCCESS;
-
+
+    /* Don't bother cleaning up, any failure here will cause a guru meditation. */
+
+    LogFlow(("pdmR3HpetHlp_SetLegacyMode: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
     return rc;
 }
