rem: pd->m_Properties.m_SuperCustomShadow = GetProperties( pd->m_SuperContext, (ULONG) pd->m_CustomShadowBuffer, TAG_DONE );
context: RemapMemory( struct PUHData* pd ){  BOOL  rc = FALSE;  // Get properties for the areas we will modify  pd->m_Properties.m_UserROM =      GetProperties( pd->m_UserContext, (ULONG) pd->m_ROM, TAG_DONE );  pd->m_Properties.m_UserROMShadow =      GetProperties( pd->m_UserContext, (ULONG) pd->m_ROMShadowBuffer, TAG_DONE );  pd->m_Properties.m_UserCustom =       GetProperties( pd->m_UserContext, (ULONG) 0xdff000, TAG_DONE );  pd->m_Properties.m_UserCustomShadow =       GetProperties( pd->m_UserContext, (ULONG) pd->m_CustomShadowBuffer, TAG_DONE );  pd->m_Properties.m_SuperROM =      GetProperties( pd->m_SuperContext, (ULONG) pd->m_ROM, TAG_DONE );  pd->m_Properties.m_SuperROMShadow =      GetProperties( pd->m_SuperContext, (ULONG) pd->m_ROMShadowBuffer, TAG_DONE );  pd->m_Properties.m_SuperCustom =       GetProperties( pd->m_SuperContext, (ULONG) 0xdff000, TAG_DONE );  pd->m_Properties.m_SuperCustomShadow =       GetProperties( pd->m_SuperContext, (ULONG) pd->m_CustomShadowBuffer, TAG_DONE );  if( ( pd->m_Properties.m_UserCustom  & MAPP_REPAIRABLE ) ||      ( pd->m_Properties.m_SuperCustom & MAPP_REPAIRABLE ) )  {    // This is odd ...    printf( "Custom chip register area marked 'repairable'!" );  }  else  {    struct MinList* user_mapping;    struct MinList* super_mapping;    LockContextList();    LockMMUContext( pd->m_UserContext );    LockMMUContext( pd->m_SuperContext );    // Save current mapping if we have to abort!    user_mapping  = GetMapping( pd->m_UserContext );    super_mapping = GetMapping( pd->m_SuperContext );    if( user_mapping == NULL || super_mapping == NULL )    {      printf( "Failed to get mappings.\n" );    }    else    {      if( ! SetProperties( pd->m_UserContext,                           ( pd->m_Properties.m_UserCustom |                              MAPP_REMAPPED ),                           ~0UL,                           (ULONG) pd->m_CustomShadowBuffer,                            pd->m_CustomSize,                           MAPTAG_DESTINATION, 0xdff000,                           TAG_DONE ) ||          ! SetProperties( pd->m_SuperContext,                           ( pd->m_Properties.m_SuperCustom |                              MAPP_REMAPPED ),                           ~0UL,                           (ULONG) pd->m_CustomShadowBuffer,                            pd->m_CustomSize,                           MAPTAG_DESTINATION, 0xdff000,                           TAG_DONE ) )      {        printf( "Failed to set properties for re-mapped area.\n" );      }      else      {        ULONG address;#ifdef TEST_MODE        address = (ULONG) pd->m_CustomShadowBuffer;#else        address = 0xdff000;#endif        if( ! SetProperties( pd->m_UserContext,                             ( pd->m_Properties.m_UserCustom |                                MAPP_SINGLEPAGE |                               MAPP_REPAIRABLE ),                             ~0UL,                             address,                              pd->m_CustomSize,                             TAG_DONE ) ||            ! SetProperties( pd->m_SuperContext,                             ( pd->m_Properties.m_SuperCustom |                                MAPP_SINGLEPAGE |                               MAPP_REPAIRABLE ),                             ~0UL,                             address,                              pd->m_CustomSize,                             TAG_DONE ) )        {          printf( "Failed to set properties for custom chip register area.\n" );        }        else        {          BOOL activate = TRUE;          // Remap Kickstart ROM, if provided                    if( pd->m_ROMShadowBuffer != NULL )          {            activate =             SetProperties( pd->m_UserContext,                           ( pd->m_Properties.m_UserROM |                              MAPP_ROM ),                           ~0UL,                           (ULONG) pd->m_ROMShadowBuffer,                            pd->m_ROMSize,                           TAG_DONE ) &&            SetProperties( pd->m_SuperContext,                           ( pd->m_Properties.m_SuperROM |                              MAPP_ROM ),                             ~0UL,                             (ULONG) pd->m_ROMShadowBuffer,                             pd->m_ROMSize,                             TAG_DONE ) &&            SetProperties( pd->m_UserContext,                           ( pd->m_Properties.m_UserROM |                             MAPP_ROM | MAPP_REMAPPED ),                             ~0UL,                             (ULONG) pd->m_ROM,                             pd->m_ROMSize,                             MAPTAG_DESTINATION, (ULONG) pd->m_ROMShadowBuffer,                             TAG_DONE ) &&            SetProperties( pd->m_SuperContext,                           ( pd->m_Properties.m_SuperROM |                             MAPP_ROM | MAPP_REMAPPED ),                             ~0UL,                             (ULONG) pd->m_ROM,                             pd->m_ROMSize,                             MAPTAG_DESTINATION, (ULONG) pd->m_ROMShadowBuffer,                             TAG_DONE );          }                    if( activate )          {            struct MMUContext* ctxs[ 3 ] =             {              pd->m_UserContext,              pd->m_SuperContext,              NULL            };            // We need to disable, since we may have patched exec.library!            Disable();            rc = RebuildTreesA( ctxs );            Enable();            if( ! rc )            {              printf( "Failed to rebuild MMU trees.\n" );            }          }        }      }      if( ! rc )      {        // Roll-back!        SetPropertyList( pd->m_UserContext, user_mapping );        SetPropertyList( pd->m_SuperContext, super_mapping );      }    }    if( user_mapping != NULL )    {      ReleaseMapping( pd->m_UserContext, user_mapping );    }    if( super_mapping != NULL )    {      ReleaseMapping( pd->m_SuperContext, super_mapping );    }    UnlockMMUContext( pd->m_SuperContext );    UnlockMMUContext( pd->m_UserContext );    UnlockContextList();  }  return rc;}