void Solve() { answer = false; for(int i = 0; i < 8; i++) { current[0] = i; used1[i] = true; for(int j = i + 1; j < 8; j++) { current[1] = j; used1[j] = true; for(int k = j + 1; k < 8; k++) { current[2] = k; used1[k] = true; for(int m = k + 1; m < 8; m++) { current[3] = m; used1[m] = true; if(Check()) { int next = 0; for(int tt = 0; tt < 8; tt++) { if(!used1[tt]) { current2[next] = tt; next++; if(next == 4) break; } } if(Check2()) { answer = true; return; } } current[3] = -1; used1[m] = false; } current[2] = -1; used1[k] = false; } current[1] = -1; used1[j] = false; } current[0] = -1; used1[i] = false; } }
void HW::ACPI::RSDP :: Locate () { uint32_t Error; if ( TableFound ) return; MM::Paging::AddressSpace :: RetrieveKernelAddressSpace () -> Alloc ( 0x1000, reinterpret_cast <void **> ( & Table ), & Error ); if ( Error != MM::Paging::AddressSpace :: kAlloc_Error_None ) { return; } TablePhysical = kEBDA_PotentialStart; while ( TablePhysical < kEBDA_End ) { Table = reinterpret_cast <RSDPTable *> ( ( reinterpret_cast <uint32_t> ( Table ) & 0xFFFFF000 ) + ( TablePhysical & 0x00000FFF ) ); Table2 = reinterpret_cast <RSDPTable2 *> ( Table ); MM::Paging::PageTable :: SetKernelMapping ( reinterpret_cast <uint32_t> ( Table ), TablePhysical, MM::Paging::PageTable :: Flags_Present | MM::Paging::PageTable :: Flags_Writeable ); if ( Check1 ( Table ) ) { if ( Table -> Revision != kACPI_Revision_1 ) { if ( Check2 ( Table2 ) ) { HW::ACPI::RSDP :: Revision = kACPI_Revision_2; TableFound = true; return; } } else { HW::ACPI::RSDP :: Revision = kACPI_Revision_1; TableFound = true; return; } } TablePhysical += 0x10; } TablePhysical = kHighBIOS_Start; while ( TablePhysical < kHighBIOS_End ) { Table = reinterpret_cast <RSDPTable *> ( ( reinterpret_cast <uint32_t> ( Table ) & 0xFFFFF000 ) + ( TablePhysical & 0x00000FFF ) ); Table2 = reinterpret_cast <RSDPTable2 *> ( Table ); MM::Paging::PageTable :: SetKernelMapping ( reinterpret_cast <uint32_t> ( Table ), TablePhysical, MM::Paging::PageTable :: Flags_Present | MM::Paging::PageTable :: Flags_Writeable ); if ( Check1 ( Table ) ) { if ( Table -> Revision != kACPI_Revision_1 ) { if ( Check2 ( Table2 ) ) { HW::ACPI::RSDP :: Revision = kACPI_Revision_2; TableFound = true; return; } } else { HW::ACPI::RSDP :: Revision = kACPI_Revision_1; TableFound = true; return; } } TablePhysical += 0x10; } MM::Paging::PageTable :: ClearKernelMapping ( reinterpret_cast <uint32_t> ( Table ) ); MM::Paging::AddressSpace :: RetrieveKernelAddressSpace () -> Free ( reinterpret_cast <void *> ( Table ), & Error ); Revision = 0; Table = NULL; Table2 = NULL; };