name
stringlengths
1
473k
code
stringlengths
7
647k
asm
stringlengths
4
3.39M
file
stringlengths
8
196
bip32_key_init_alloc
int bip32_key_init_alloc(uint32_t version, uint32_t depth, uint32_t child_num, const unsigned char *chain_code, size_t chain_code_len, const unsigned char *pub_key, size_t pub_key_len, const unsigned char *priv_key, size_t priv_key_len, const unsigned char *hash160, size_t hash160_len, const unsigned char *parent160, size_t parent160_len, struct ext_key **output) { int ret; ALLOC_KEY(); ret = bip32_key_init(version, depth, child_num, chain_code, chain_code_len, pub_key, pub_key_len, priv_key, priv_key_len, hash160, hash160_len, parent160, parent160_len, *output); if (ret != WALLY_OK) { wally_free((void *)*output); *output = NULL; } return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax cmpq $0x0, 0x78(%rsp) je 0x59c5a movq %r9, %rbx movq %r8, %r14 movq %rcx, %r15 movl %edx, %ebp movl %esi, %r12d movl %edi, %r13d movl $0xc0, %edi callq 0xbd3b movq 0x78(%rsp), %rcx movq %rax, (%rcx) testq %rax, %rax je 0x59c61 movl %r13d, %edi movl %r12d, %esi movl %ebp, %edx movq %r15, %rcx movq %r14, %r8 movq %rbx, %r9 pushq %rax pushq 0x78(%rsp) pushq 0x78(%rsp) pushq 0x78(%rsp) pushq 0x78(%rsp) pushq 0x78(%rsp) pushq 0x78(%rsp) pushq 0x78(%rsp) callq 0x59c7b addq $0x40, %rsp testl %eax, %eax je 0x59c68 movl %eax, %ebx movq 0x78(%rsp), %r14 movq (%r14), %rdi callq 0xba94 movq $0x0, (%r14) jmp 0x59c6a movl $0xfffffffe, %ebx # imm = 0xFFFFFFFE jmp 0x59c6a movl $0xfffffffd, %ebx # imm = 0xFFFFFFFD jmp 0x59c6a xorl %ebx, %ebx movl %ebx, %eax addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/p2pderivatives[P]cfd-go/external/libwally-core/src/bip32.c
bip32_key_init
int bip32_key_init(uint32_t version, uint32_t depth, uint32_t child_num, const unsigned char *chain_code, size_t chain_code_len, const unsigned char *pub_key, size_t pub_key_len, const unsigned char *priv_key, size_t priv_key_len, const unsigned char *hash160, size_t hash160_len, const unsigned char *parent160, size_t parent160_len, struct ext_key *key_out) { if (!key_out) return WALLY_EINVAL; switch (version) { case BIP32_VER_MAIN_PRIVATE: case BIP32_VER_TEST_PRIVATE: if (!priv_key || priv_key_len != key_size(priv_key) - 1) return WALLY_EINVAL; break; case BIP32_VER_MAIN_PUBLIC: case BIP32_VER_TEST_PUBLIC: if (!pub_key || pub_key_len != key_size(pub_key)) return WALLY_EINVAL; break; } if (!chain_code || chain_code_len != key_size(chain_code)) return WALLY_EINVAL; if ((priv_key && priv_key_len != key_size(priv_key) - 1) || (!priv_key && priv_key_len) || (pub_key && pub_key_len != key_size(pub_key)) || (!pub_key && pub_key_len) || (hash160 && hash160_len != key_size(hash160)) || (!hash160 && hash160_len) || (parent160 && !is_valid_parent160_len(parent160_len)) || (!parent160 && parent160_len) || depth > 0xff) return WALLY_EINVAL; wally_clear(key_out, sizeof(*key_out)); key_out->version = version; key_out->depth = depth; key_out->child_num = child_num; memcpy(key_out->chain_code, chain_code, key_size(chain_code)); if (priv_key && version != BIP32_VER_MAIN_PUBLIC && version != BIP32_VER_TEST_PUBLIC) memcpy(key_out->priv_key + 1, priv_key, key_size(priv_key) - 1); else key_out->priv_key[0] = BIP32_FLAG_KEY_PUBLIC; if (pub_key) memcpy(key_out->pub_key, pub_key, key_size(pub_key)); else if (version == BIP32_VER_MAIN_PRIVATE || version == BIP32_VER_TEST_PRIVATE) { /* Compute the public key if not given */ int ret = key_compute_pub_key(key_out); if (ret != WALLY_OK) { wally_clear(key_out, sizeof(*key_out)); return ret; } } if (hash160) memcpy(key_out->hash160, hash160, key_size(hash160)); else key_compute_hash160(key_out); if (parent160) memcpy(key_out->parent160, parent160, parent160_len); return WALLY_OK; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq 0x78(%rsp), %rbx movl $0xfffffffe, %ebp # imm = 0xFFFFFFFE testq %rbx, %rbx je 0x59f0f movq %r9, %r14 movq %rcx, %r12 movl %esi, %r13d movl %edi, %r15d movq 0x50(%rsp), %rcx movq 0x48(%rsp), %rdi movq 0x40(%rsp), %rax cmpl $0x488ade3, %r15d # imm = 0x488ADE3 jg 0x59cd1 cmpl $0x4358394, %r15d # imm = 0x4358394 je 0x59ce3 cmpl $0x43587cf, %r15d # imm = 0x43587CF je 0x59cf0 jmp 0x59d08 cmpl $0x488b21e, %r15d # imm = 0x488B21E je 0x59cf0 cmpl $0x488ade4, %r15d # imm = 0x488ADE4 jne 0x59d08 testq %rdi, %rdi sete %r9b cmpq $0x20, %rcx jmp 0x59cfb testq %r14, %r14 sete %r9b cmpq $0x21, %rax setne %sil orb %r9b, %sil jne 0x59f0f testq %r12, %r12 sete %r9b cmpq $0x20, %r8 setne %sil orb %r9b, %sil jne 0x59f0f testq %rdi, %rdi setne %r8b cmpq $0x20, %rcx setne %sil testb %sil, %r8b jne 0x59f0f testq %rdi, %rdi sete %sil testq %rcx, %rcx setne %cl testb %cl, %sil jne 0x59f0f testq %r14, %r14 setne %cl cmpq $0x21, %rax setne %sil testb %sil, %cl jne 0x59f0f testq %r14, %r14 sete %cl testq %rax, %rax setne %al testb %al, %cl jne 0x59f0f movq 0x60(%rsp), %rax movq 0x58(%rsp), %rdi testq %rdi, %rdi setne %cl cmpq $0x14, %rax setne %sil testb %sil, %cl jne 0x59f0f testq %rdi, %rdi sete %cl testq %rax, %rax setne %al testb %al, %cl jne 0x59f0f movq 0x70(%rsp), %rsi movq 0x68(%rsp), %rdi testq %rdi, %rdi setne %al movq %rsi, %rcx andq $-0x11, %rcx cmpq $0x4, %rcx setne %cl testb %cl, %al jne 0x59f0f testq %rdi, %rdi sete %al testq %rsi, %rsi setne %cl cmpl $0xff, %r13d ja 0x59f0f andb %cl, %al jne 0x59f0f movl $0xc0, %esi movq %rbx, %rdi movl %edx, %ebp callq 0xba8b movq 0x48(%rsp), %rax movl %r15d, 0x78(%rbx) movb %r13b, 0x34(%rbx) movl %ebp, 0x60(%rbx) movups (%r12), %xmm0 movups 0x10(%r12), %xmm1 movups %xmm0, (%rbx) movups %xmm1, 0x10(%rbx) testq %rax, %rax je 0x59e3d cmpl $0x43587cf, %r15d # imm = 0x43587CF je 0x59e3d cmpl $0x488b21e, %r15d # imm = 0x488B21E jne 0x59e43 movb $0x1, 0x3f(%rbx) jmp 0x59e52 movups (%rax), %xmm0 movups 0x10(%rax), %xmm1 movups %xmm1, 0x50(%rbx) movups %xmm0, 0x40(%rbx) movq 0x58(%rsp), %rcx testq %r14, %r14 movq 0x68(%rsp), %rsi je 0x59e93 movb 0x20(%r14), %al movb %al, 0x9f(%rbx) movups (%r14), %xmm0 movups 0x10(%r14), %xmm1 movups %xmm1, 0x8f(%rbx) movups %xmm0, 0x7f(%rbx) testq %rcx, %rcx je 0x59edb movl 0x10(%rcx), %eax movl %eax, 0x74(%rbx) movups (%rcx), %xmm0 movups %xmm0, 0x64(%rbx) jmp 0x59ef7 cmpl $0x488ade4, %r15d # imm = 0x488ADE4 je 0x59ea5 cmpl $0x4358394, %r15d # imm = 0x4358394 jne 0x59e7f leaq 0x40(%rbx), %rdi leaq 0x7f(%rbx), %rdx movl $0x20, %esi movl $0x21, %ecx callq 0xde0c movq 0x58(%rsp), %rcx movq 0x68(%rsp), %rsi testl %eax, %eax je 0x59e7f movl %eax, %ebp movl $0xc0, %esi movq %rbx, %rdi callq 0xba8b jmp 0x59f0f leaq 0x7f(%rbx), %rdi leaq 0x64(%rbx), %rdx movl $0x21, %esi movl $0x14, %ecx callq 0xbc9c movq 0x68(%rsp), %rsi xorl %ebp, %ebp testq %rsi, %rsi je 0x59f0f addq $0x20, %rbx movq %rbx, %rdi movq 0x70(%rsp), %rdx callq 0x5100 movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/p2pderivatives[P]cfd-go/external/libwally-core/src/bip32.c
bip32_key_get_fingerprint
int bip32_key_get_fingerprint(struct ext_key *hdkey, unsigned char *bytes_out, size_t len) { /* Validate our arguments and then the input key */ if (!hdkey || !key_is_valid(hdkey) || !bytes_out || len != BIP32_KEY_FINGERPRINT_LEN) return WALLY_EINVAL; /* Derive hash160 if needed. */ if (mem_is_zero(hdkey->hash160, sizeof(hdkey->hash160))) { key_compute_hash160(hdkey); } /* Fingerprint is first 32 bits of the key hash. */ memcpy(bytes_out, hdkey->hash160, BIP32_KEY_FINGERPRINT_LEN); return WALLY_OK; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movl $0xfffffffe, %ebp # imm = 0xFFFFFFFE testq %rdi, %rdi je 0x5a0a4 movq %rdx, %r15 movq %rsi, %rbx movq %rdi, %r14 callq 0x5927e cmpq $0x4, %r15 jne 0x5a0a4 testq %rbx, %rbx je 0x5a0a4 testb %al, %al je 0x5a0a4 leaq 0x64(%r14), %r15 cmpb $0x0, 0x64(%r14) jne 0x5a09d xorl %eax, %eax cmpq $0x13, %rax je 0x5a084 leaq 0x1(%rax), %rcx cmpb $0x0, 0x65(%r14,%rax) movq %rcx, %rax je 0x5a066 decq %rcx cmpq $0x13, %rcx jb 0x5a09d addq $0x7f, %r14 movl $0x21, %esi movl $0x14, %ecx movq %r14, %rdi movq %r15, %rdx callq 0xbc9c movl (%r15), %eax movl %eax, (%rbx) xorl %ebp, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq nopl (%rax)
/p2pderivatives[P]cfd-go/external/libwally-core/src/bip32.c
scan_flux_gcr(TrackData&)
void scan_flux_gcr(TrackData& trackdata) { int bitcell_ns; // C64 GCR disks are zoned, with variable rate depending on cylinder if (trackdata.cylhead.cyl < 17) bitcell_ns = 3200; else if (trackdata.cylhead.cyl < 24) bitcell_ns = 3500; else if (trackdata.cylhead.cyl < 30) bitcell_ns = 3750; else bitcell_ns = 4000; FluxDecoder decoder(trackdata.flux(), bitcell_ns, opt.scale); BitBuffer bitbuf(DataRate::_250K, decoder); trackdata.add(std::move(bitbuf)); scan_bitstream_gcr(trackdata); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx subq $0xa8, %rsp movq %rdi, %rbx movl (%rdi), %eax movl $0xc80, %ebp # imm = 0xC80 cmpl $0x11, %eax jl 0x39ed1 movl $0xdac, %ebp # imm = 0xDAC cmpl $0x18, %eax jl 0x39ed1 cmpl $0x1e, %eax movl $0xea6, %eax # imm = 0xEA6 movl $0xfa0, %ebp # imm = 0xFA0 cmovll %eax, %ebp movq %rbx, %rdi callq 0x74ec0 leaq 0xa5860(%rip), %rcx # 0xdf740 movl 0x124(%rcx), %ecx leaq 0x68(%rsp), %r14 movq %r14, %rdi movq %rax, %rsi movl %ebp, %edx movl $0x4, %r8d callq 0x5d654 movq %rsp, %r15 movq %r15, %rdi movl $0x3d090, %esi # imm = 0x3D090 movq %r14, %rdx callq 0x37c98 movq %rbx, %rdi movq %r15, %rsi callq 0x74cc0 movq %rbx, %rdi callq 0x3cb20 movq 0x38(%rsp), %rdi testq %rdi, %rdi je 0x39f3b movq 0x48(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x20(%rsp), %rdi testq %rdi, %rdi je 0x39f52 movq 0x30(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x39f69 movq 0x18(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 addq $0xa8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx movq %rsp, %rdi callq 0x38cd8 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamDecoder.cpp
scan_bitstream_mfm_fm(TrackData&)
void scan_bitstream_mfm_fm(TrackData& trackdata) { Track track; uint32_t sync_mask = opt.a1sync ? 0xffdfffdf : 0xffffffff; auto& bitbuf = trackdata.bitstream(); bitbuf.seek(0); track.tracklen = bitbuf.track_bitsize(); CRC16 crc; std::vector<std::pair<int, Encoding>> data_fields; uint32_t dword = 0; uint8_t last_fm_am = 0; while (!bitbuf.wrapped()) { // Give up if no headers were found in the first revolution if (!track.size() && bitbuf.tell() > track.tracklen) break; dword = (dword << 1) | bitbuf.read1(); if ((dword & sync_mask) == 0x44894489) { if ((bitbuf.read16() & sync_mask) != 0x4489) continue; bitbuf.encoding = Encoding::MFM; crc.init(CRC16::A1A1A1); } else if (opt.encoding == Encoding::MFM) // FM disabled? continue; else { // Check for known FM address marks switch (dword) { case 0xaa222888: // F8/C7 DDAM case 0xaa22288a: // F9/C7 Alt-DDAM case 0xaa2228a8: // FA/C7 Alt-DAM case 0xaa2228aa: // FB/C7 DAM case 0xaa2a2a88: // FC/D7 IAM case 0xaa222a8a: // FD/C7 RX02 DAM case 0xaa222aa8: // FE/C7 IDAM break; // Not a recognised FM mark, so keep searching default: continue; } // With FM the address mark is also the sync, so step back to read it again bitbuf.seek(bitbuf.tell() - 32); bitbuf.encoding = Encoding::FM; crc.init(); } auto am_offset = bitbuf.tell(); auto am = bitbuf.read_byte(); crc.add(am); switch (am) { case 0xfe: // IDAM { std::array<uint8_t, 6> id; // CHRN + 16-bit CRC bitbuf.read(id); // Check header CRC, skipping if it's bad, unless the user wants it. // Don't allow FM sectors with ID CRC errors, due to the false-positive risk. crc.add(id.data(), id.size()); if (!crc || (opt.idcrc == 1 && bitbuf.encoding != Encoding::FM)) { Header header(id[0], id[1], id[2], id[3]); Sector s(bitbuf.datarate, bitbuf.encoding, header); s.set_badidcrc(crc != 0); s.offset = bitbuf.track_offset(am_offset); if (opt.debug) util::cout << "s_b_mfm_fm " << bitbuf.encoding << " IDAM (id=" << header.sector << ") at offset " << am_offset << " (" << s.offset << ")\n"; track.add(std::move(s)); if (opt.debug && crc != 0) { util::cout << util::fmt(" s_b_mfm_fm bad id CRC: %02X %02X, expected %02X %02X\n", id[4], id[5], crc.msb(), crc.lsb()); } if (bitbuf.encoding == Encoding::FM) last_fm_am = am; } break; } case 0xfb: case 0xfa: // normal data (+alt) case 0xf8: case 0xf9: // deleted data (+alt) case 0xfd: // RX02 { // FM address marks are short, so false positives are likely. if (bitbuf.encoding == Encoding::FM) { // Require a valid FM IDAM before we accept an FM DAM. if (last_fm_am != 0xfe) break; last_fm_am = am; } if (opt.debug) util::cout << "s_b_mfm_fm " << bitbuf.encoding << " DAM (am=" << am << ") at offset " << am_offset << " (" << bitbuf.track_offset(am_offset) << ")\n"; data_fields.push_back(std::make_pair(am_offset, bitbuf.encoding)); break; } case 0xfc: // IAM if (opt.debug) util::cout << "s_b_mfm_fm " << bitbuf.encoding << " IAM at offset " << am_offset << " (" << bitbuf.track_offset(am_offset) << ")\n"; break; default: if (opt.debug) util::cout << "s_b_mfm_fm unknown " << bitbuf.encoding << " AM (" << std::hex << am << std::dec << ") at offset " << am_offset << " on " << trackdata.cylhead << "\n"; break; } } // Process each sector header to look for an associated data field for (auto it = track.begin(); it != track.end(); ++it) { auto& sector = *it; auto final_sector = std::next(it) == track.end(); auto shift = (sector.encoding == Encoding::FM) ? 5 : 4; auto gap2_size = (sector.datarate == DataRate::_1M) ? GAP2_MFM_ED : GAP2_MFM_DDHD; // gap2 size in MFM bytes (FM is half size but double encoding overhead) auto min_distance = ((1 + 6) << shift) + (gap2_size << 4); // AM, ID, gap2 (fixed shift as FM is half size) auto max_distance = ((1 + 6) << shift) + ((23 + gap2_size) << 4); // 1=AM, 6=ID, 21+gap2=max WD177x offset (gap2 may be longer when formatted by different type of controller) // If the header has a CRC error, the data can't be reached if (sector.has_badidcrc()) continue; if (opt.debug) util::cout << " s_b_mfm_fm finding " << trackdata.cylhead << " sector " << sector.header.sector << ":\n"; for (auto itData = data_fields.begin(); itData != data_fields.end(); ++itData) { const auto& dam_offset = itData->first; const Encoding& data_encoding = itData->second; auto itDataNext = (std::next(itData) == data_fields.end()) ? data_fields.begin() : std::next(itData); // Data field must be the same encoding type if (data_encoding != sector.encoding) continue; // Determine distance from header to data field, taking care of track wrapping auto dam_track_offset = bitbuf.track_offset(dam_offset); auto distance = ((dam_track_offset < sector.offset) ? track.tracklen : 0) + dam_track_offset - sector.offset; // Reject if the data field is too close or too far away if (distance < min_distance || distance > max_distance) continue; bitbuf.seek(dam_offset); bitbuf.encoding = data_encoding; auto dam = bitbuf.read_byte(); crc.init((data_encoding == Encoding::MFM) ? CRC16::A1A1A1 : CRC16::INIT_CRC); crc.add(dam); // RX02 modified MFM uses an FM DAM followed by MFM data and CRC. if (data_encoding == Encoding::FM && dam == 0xfd) { // Convert the sector to RX02, its size to match the data. sector.encoding = Encoding::RX02; ++sector.header.size; // Switch to decoding the data as MFM. bitbuf.encoding = Encoding::MFM; shift = 4; } // Determine the offset and distance to the next IDAM, taking care of track wrap if it's the final sector auto next_idam_offset = final_sector ? track.begin()->offset : std::next(it)->offset; auto next_idam_distance = ((next_idam_offset <= dam_track_offset) ? track.tracklen : 0) + next_idam_offset - dam_track_offset; auto next_idam_bytes = (next_idam_distance >> shift) - 1; // -1 due to DAM being read above auto next_idam_align = next_idam_distance & ((1 << shift) - 1); // Determine the bit offset and distance to the next DAM auto next_dam_offset = itDataNext->first; auto next_dam_distance = ((next_dam_offset <= dam_offset) ? bitbuf.size() : 0) + next_dam_offset - dam_offset; auto next_dam_bytes = (next_dam_distance >> shift) - 1; // -1 due to DAM being read above // Attempt to read gap2 from non-final sectors, unless we're asked not to auto read_gap2 = !final_sector && (opt.gap2 != 0); // Calculate the extent of the current data field, up to the next header or data field (depending if gap2 is required) auto extent_bytes = read_gap2 ? next_dam_bytes : next_idam_bytes; if (extent_bytes >= 3 && sector.encoding == Encoding::MFM) extent_bytes -= 3; // remove A1A1A1 auto normal_bytes = sector.size() + 2; // data size + CRC bytes auto data_bytes = std::max(normal_bytes, extent_bytes); // data size needed to check CRC // Calculate bytes remaining in the data in current data encoding auto avail_bytes = bitbuf.remaining() >> shift; // Ignore truncated copies, unless it's the only copy we have if (avail_bytes < normal_bytes) { // If we've already got a copy, ignore the truncated version if (sector.copies() && (!sector.is_8k_sector() || avail_bytes < 0x1802)) // ToDo: fix nasty check { if (opt.debug) util::cout << " s_b_mfm_fm ignoring truncated sector copy\n"; continue; } if (opt.debug) util::cout << " s_b_mfm_fm using truncated sector data as only copy\n"; } // Read the full data field and check its CRC Data data(data_bytes); bitbuf.read(data); bool bad_crc = crc.add(data.data(), normal_bytes) != 0; if (opt.debug && bad_crc) { util::cout << util::fmt(" s_b_mfm_fm bad data CRC: %02X %02X, expected %02X %02X\n", data[sector.size()], data[sector.size() + 1], crc.msb(), crc.lsb()); } // Truncate at the extent size, unless we're asked to keep overlapping sectors if (!opt.keepoverlap && extent_bytes < sector.size()) data.resize(extent_bytes); else if (data.size() > sector.size() && (opt.gaps == GAPS_NONE || (opt.gap4b == 0 && final_sector))) data.resize(sector.size()); auto gap2_offset = next_idam_bytes + 1 + 4 + 2; auto has_gap2 = data.size() >= gap2_offset; auto has_gap3_4b = data.size() >= normal_bytes; auto remove_gap2 = false; auto remove_gap3_4b = false; // Check IDAM bit alignment and value, as AnglaisCollege\track00.0.raw has rogue FE junk on cyls 22+26 if (has_gap2) remove_gap2 = next_idam_align != 0 || data[next_idam_bytes] != 0xfe || test_remove_gap2(data, gap2_offset); if (has_gap3_4b) { if (final_sector) remove_gap3_4b = test_remove_gap4b(data, normal_bytes); else remove_gap3_4b = test_remove_gap3(data, normal_bytes, sector.gap3); } if (opt.gaps != GAPS_ALL) { if (has_gap2 && remove_gap2) { if (opt.debug) util::cout << " s_b_mfm_fm removing gap2 data\n"; data.resize(next_idam_bytes - ((sector.encoding == Encoding::MFM) ? 3 : 0)); } else if (has_gap2) { if (opt.debug) util::cout << " s_b_mfm_fm skipping gap2 removal\n"; } if (has_gap3_4b && remove_gap3_4b && (!has_gap2 || remove_gap2)) { if (!final_sector) { if (opt.debug) util::cout << " s_b_mfm_fm removing gap3 data\n"; data.resize(sector.size()); } else { if (opt.debug) util::cout << " s_b_mfm_fm removing gap4b data\n"; data.resize(sector.size()); } } } // If it's an 8K sector, attempt to validate any embedded checksum std::set<ChecksumType> chk8k_methods; if (sector.is_8k_sector()) { chk8k_methods = ChecksumMethods(data.data(), data.size()); if (opt.debug) util::cout << " s_b_mfm_fm chk8k_method = " << ChecksumName(chk8k_methods) << '\n'; } // Consider good sectors overhanging the index if (final_sector && !bad_crc) { auto splice_offset = bitbuf.track_offset(dam_offset + (normal_bytes << shift)); if (splice_offset < dam_offset) bitbuf.splicepos(std::max(splice_offset, bitbuf.splicepos())); } sector.add(std::move(data), bad_crc, dam); // If the data is good there's no need to search for more data fields if (!bad_crc || !chk8k_methods.empty()) break; } } trackdata.add(std::move(track)); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x178, %rsp # imm = 0x178 movq %rdi, %rbx leaq 0x118(%rsp), %rdi xorl %r13d, %r13d xorl %esi, %esi callq 0x713b8 leaq 0xa4e58(%rip), %rax # 0xdf740 cmpl $0x1, 0x118(%rax) sbbl %r13d, %r13d movq %rbx, 0xe0(%rsp) movq %rbx, %rdi callq 0x74e48 movq %rax, %rbx movq %rax, %rdi xorl %esi, %esi callq 0x3807c movq %rbx, %rdi callq 0x387b0 movl %eax, 0x118(%rsp) leaq 0xc(%rsp), %rdi movl $0xffff, %esi # imm = 0xFFFF callq 0x5349c orl $0xffdfffdf, %r13d # imm = 0xFFDFFFDF xorps %xmm0, %xmm0 leaq 0x100(%rsp), %rax movaps %xmm0, (%rax) movq $0x0, 0x10(%rax) movq %rbx, %r15 addq $0x4, %r15 leaq 0x118(%rsp), %r12 movl $0x0, 0x10(%rsp) xorl %ebp, %ebp movq %rbx, 0x28(%rsp) movq %rbx, %rdi callq 0x38062 testb %al, %al jne 0x3afad movq %r12, %rdi callq 0x713fc testl %eax, %eax jne 0x3a999 movq %rbx, %rdi callq 0x37eee cmpl 0x118(%rsp), %eax jg 0x3afad movq %rbx, %rdi callq 0x38290 movl %ebp, %ecx addl %ebp, %ecx movzbl %al, %ebp orl %ecx, %ebp movl %ebp, %eax andl %r13d, %eax cmpl $0x44894489, %eax # imm = 0x44894489 jne 0x3a9d8 movq %rbx, %rdi callq 0x38406 movzwl %ax, %eax andl %r13d, %eax cmpl $0x4489, %eax # imm = 0x4489 jne 0x3a968 movl $0x1, 0x4(%rbx) movw $0xcdb4, %ax # imm = 0xCDB4 jmp 0x3aa37 leaq 0xa4d61(%rip), %rax # 0xdf740 cmpl $0x1, 0x134(%rax) je 0x3a968 cmpl $0xaa222a89, %ebp # imm = 0xAA222A89 jg 0x3aa9f leal 0x55ddd778(%rbp), %eax cmpl $0x22, %eax ja 0x3a968 movabsq $0x500000005, %rcx # imm = 0x500000005 btq %rax, %rcx jae 0x3a968 movq %rbx, %rdi callq 0x37eee addl $-0x20, %eax movq %rbx, %rdi movl %eax, %esi callq 0x3807c movl $0x2, 0x4(%rbx) movw $0xffff, %ax # imm = 0xFFFF movzwl %ax, %esi leaq 0xc(%rsp), %rdi callq 0x5350c movq %rbx, %rdi callq 0x37eee movl %eax, 0x1c(%rsp) movq %rbx, %rdi callq 0x384c8 movb %al, 0xf(%rsp) movzbl %al, %esi leaq 0xc(%rsp), %rdi callq 0x535b8 movzbl 0xf(%rsp), %ebx leal -0xf8(%rbx), %eax cmpl $0x6, %eax ja 0x3abaa leaq 0x707c4(%rip), %rcx # 0xab248 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x2, (%r15) jne 0x3aac8 cmpb $-0x2, 0x10(%rsp) je 0x3aace jmp 0x3aba0 cmpl $0xaa222a8a, %ebp # imm = 0xAA222A8A je 0x3aa17 cmpl $0xaa2a2a88, %ebp # imm = 0xAA2A2A88 je 0x3aa17 cmpl $0xaa222aa8, %ebp # imm = 0xAA222AA8 jne 0x3a968 jmp 0x3aa17 movl 0x10(%rsp), %eax movl %eax, %ebx leaq 0xa4c6b(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3ab75 leaq 0xa57ca(%rip), %rdi # 0xe02b0 leaq 0x70dd3(%rip), %rsi # 0xab8c0 callq 0x4055d movq %rax, %rdi movq %r15, %rsi callq 0x4045e movq %rax, %rdi leaq 0x70c0a(%rip), %rsi # 0xab711 callq 0x405c6 movq %rax, %rdi leaq 0xf(%rsp), %rsi callq 0x3f708 movq %rax, %rdi leaq 0x70a05(%rip), %rsi # 0xab528 callq 0x3f69f movq %rax, %rdi leaq 0x1c(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x7393d(%rip), %rsi # 0xae47c callq 0x38bb8 movq %rax, %r14 movl 0x1c(%rsp), %esi movq 0x28(%rsp), %rdi callq 0x37ef2 movl %eax, 0x70(%rsp) movq %r14, %rdi leaq 0x70(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x74b0c(%rip), %rsi # 0xaf67c callq 0x38bb8 movl 0x1c(%rsp), %eax movl (%r15), %ecx shlq $0x20, %rcx orq %rax, %rcx movq %rcx, 0x70(%rsp) leaq 0x100(%rsp), %rdi leaq 0x70(%rsp), %rsi callq 0x41b66 movl %ebx, %eax movl %eax, 0x10(%rsp) movq 0x28(%rsp), %rbx jmp 0x3a968 leaq 0xa4b8f(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3aba0 leaq 0xa56f2(%rip), %rdi # 0xe02b0 leaq 0x70d4f(%rip), %rsi # 0xab914 callq 0x3f758 movq %rax, %rdi movq %r15, %rsi callq 0x4045e movq %rax, %rdi leaq 0x7389a(%rip), %rsi # 0xae479 callq 0x40701 movq %rax, %r14 cmpb $0x1, 0x11(%rax) jne 0x3abff movb $0x0, 0x11(%r14) movq %r14, %rdi movl $0x1, %esi callq 0x7897a movq (%r14), %rax movq (%rax), %rcx movq -0x18(%rcx), %rcx movl 0x18(%rax,%rcx), %edx andl $-0x4b, %edx orl $0x8, %edx movl %edx, 0x18(%rax,%rcx) movq 0x8(%r14), %rax testq %rax, %rax je 0x3ac3c cmpb $0x0, 0x10(%r14) jne 0x3ac3c movq (%rax), %rcx movq -0x18(%rcx), %rcx movl 0x18(%rax,%rcx), %edx andl $-0x4b, %edx orl $0x8, %edx movl %edx, 0x18(%rax,%rcx) movq %r14, %rdi leaq 0xf(%rsp), %rsi callq 0x3f708 movq %rax, %r14 cmpb $0x1, 0x11(%rax) jne 0x3ac64 movb $0x0, 0x11(%r14) movq %r14, %rdi movl $0x1, %esi callq 0x7897a movq (%r14), %rax movq (%rax), %rcx movq -0x18(%rcx), %rcx movl 0x18(%rax,%rcx), %edx andl $-0x4b, %edx orl $0x2, %edx movl %edx, 0x18(%rax,%rcx) movq 0x8(%r14), %rax testq %rax, %rax je 0x3aca1 cmpb $0x0, 0x10(%r14) jne 0x3aca1 movq (%rax), %rcx movq -0x18(%rcx), %rcx movl 0x18(%rax,%rcx), %edx andl $-0x4b, %edx orl $0x2, %edx movl %edx, 0x18(%rax,%rcx) movq %r14, %rdi leaq 0x7087d(%rip), %rsi # 0xab528 callq 0x3f69f movq %rax, %rdi leaq 0x1c(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x76e98(%rip), %rsi # 0xb1b5f callq 0x40698 movq %rax, %rdi movq 0xe0(%rsp), %rsi callq 0x3fa09 movq %rax, %rdi leaq 0x72748(%rip), %rsi # 0xad42e callq 0x38d1e jmp 0x3aba0 leaq 0xa4a49(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3aba0 leaq 0xa55a8(%rip), %rdi # 0xe02b0 leaq 0x70bb1(%rip), %rsi # 0xab8c0 callq 0x4055d movq %rax, %rdi movq %r15, %rsi callq 0x4045e movq %rax, %rdi leaq 0x70bdb(%rip), %rsi # 0xab904 callq 0x4062f movq %rax, %rdi leaq 0x1c(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x73737(%rip), %rsi # 0xae47c callq 0x38bb8 movq %rax, %r14 movl 0x1c(%rsp), %esi movq 0x28(%rsp), %rdi callq 0x37ef2 movl %eax, 0x70(%rsp) movq %r14, %rdi leaq 0x70(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x74906(%rip), %rsi # 0xaf67c callq 0x38bb8 jmp 0x3aba0 movq 0x28(%rsp), %rbx movq %rbx, %rdi leaq 0x36(%rsp), %rsi callq 0x403b8 movl $0x6, %edx leaq 0xc(%rsp), %rdi leaq 0x36(%rsp), %rsi callq 0x53578 leaq 0xc(%rsp), %rdi callq 0x535b4 testw %ax, %ax je 0x3add0 leaq 0xa4984(%rip), %rax # 0xdf740 cmpl $0x1, 0x38(%rax) jne 0x3aba0 cmpl $0x2, 0x4(%rbx) je 0x3aba0 movzbl 0x36(%rsp), %esi movzbl 0x37(%rsp), %edx movzbl 0x38(%rsp), %ecx movzbl 0x39(%rsp), %r8d leaq 0x50(%rsp), %r14 movq %r14, %rdi callq 0x60752 movl (%rbx), %esi movl 0x4(%rbx), %edx leaq 0x70(%rsp), %rdi movq %r14, %rcx xorl %r8d, %r8d callq 0x6bb84 leaq 0xc(%rsp), %rdi callq 0x535b4 xorl %esi, %esi testw %ax, %ax setne %sil leaq 0x70(%rsp), %rdi callq 0x6c2de movl 0x1c(%rsp), %esi movq %rbx, %rdi callq 0x37ef2 movl %eax, 0x88(%rsp) leaq 0xa4902(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3aecc leaq 0xa5461(%rip), %rdi # 0xe02b0 leaq 0x70a6a(%rip), %rsi # 0xab8c0 callq 0x4055d movq %rax, %rdi movq %r15, %rsi callq 0x4045e movq %rax, %rdi leaq 0x706ad(%rip), %rsi # 0xab51d callq 0x403f5 movq %rax, %rdi leaq 0x58(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x7069c(%rip), %rsi # 0xab528 callq 0x3f69f movq %rax, %rdi leaq 0x1c(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x735d4(%rip), %rsi # 0xae47c callq 0x38bb8 movq %rax, %rdi leaq 0x88(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x747b5(%rip), %rsi # 0xaf67c callq 0x38bb8 movq %r12, %rdi leaq 0x70(%rsp), %rsi callq 0x71b18 leaq 0xa4860(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3af86 leaq 0xc(%rsp), %rdi callq 0x535b4 testw %ax, %ax je 0x3af86 movzbl 0x3a(%rsp), %r14d movzbl 0x3b(%rsp), %eax movl %eax, 0xe8(%rsp) leaq 0xc(%rsp), %rdi callq 0x5360c movl %eax, %ebx leaq 0xc(%rsp), %rdi callq 0x53610 movzbl %bl, %r8d movzbl %al, %r9d leaq 0xb0(%rsp), %rdi leaq 0x70990(%rip), %rsi # 0xab8cc movl %r14d, %edx movl 0xe8(%rsp), %ecx xorl %eax, %eax callq 0x784cc leaq 0xa535c(%rip), %rdi # 0xe02b0 leaq 0xb0(%rsp), %rsi callq 0x3f60b movq 0xb0(%rsp), %rdi leaq 0xc0(%rsp), %rax cmpq %rax, %rdi je 0x3af86 movq 0xc0(%rsp), %rsi incq %rsi callq 0x355d0 cmpl $0x2, (%r15) movzbl 0x10(%rsp), %eax movzbl 0xf(%rsp), %ecx cmovnel %eax, %ecx movl %ecx, 0x10(%rsp) leaq 0x98(%rsp), %rdi callq 0x410b8 jmp 0x3aba0 movq 0x120(%rsp), %rcx movq 0x128(%rsp), %rax movq %rax, 0x40(%rsp) cmpq %rax, %rcx je 0x3b873 movq %rcx, %rdi xorl %ecx, %ecx cmpl $0x2, 0x14(%rdi) sete %cl orl $0x4, %ecx movl $0x7, %edx movl %ecx, 0x3c(%rsp) shll %cl, %edx leal 0x160(%rdx), %eax addl $0x290, %edx # imm = 0x290 cmpl $0xf4240, 0x10(%rdi) # imm = 0xF4240 cmovnel %eax, %edx movq %rdx, 0x138(%rsp) movq %rdi, 0x10(%rsp) callq 0x6c11a movq 0x10(%rsp), %rcx addq $0x40, %rcx movq %rcx, 0x48(%rsp) testb %al, %al jne 0x3b85c leaq 0xa4716(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3b082 leaq 0xa5279(%rip), %rdi # 0xe02b0 leaq 0x708ea(%rip), %rsi # 0xab928 callq 0x4076a movq %rax, %rdi movq 0xe0(%rsp), %rsi callq 0x3fa09 movq %rax, %rdi leaq 0x75ea6(%rip), %rsi # 0xb0f03 callq 0x3f9a0 movq 0x10(%rsp), %rcx leaq 0x8(%rcx), %rsi movq %rax, %rdi callq 0x38c21 movq %rax, %rdi leaq 0x723c4(%rip), %rsi # 0xad441 callq 0x38bb8 movq 0x100(%rsp), %rbx movq 0x108(%rsp), %rax cmpq %rax, %rbx je 0x3b85c movq 0x138(%rsp), %rcx addl $0x170, %ecx # imm = 0x170 movl %ecx, 0xf8(%rsp) movq 0x48(%rsp), %rcx cmpq 0x40(%rsp), %rcx setne 0x27(%rsp) movq 0x10(%rsp), %rcx addq $0x1c, %rcx movq %rcx, 0x140(%rsp) leaq 0x8(%rbx), %rcx movq %rcx, %r15 movq %rcx, 0xe8(%rsp) cmpq %rax, %rcx jne 0x3b0ec movq 0x100(%rsp), %r15 movl 0x4(%rbx), %eax movl $0xb, %r12d movq 0x10(%rsp), %rcx cmpl 0x14(%rcx), %eax jne 0x3b835 movl (%rbx), %esi movq 0x28(%rsp), %rdi callq 0x37ef2 movl %eax, %ebp xorl %eax, %eax movq 0x10(%rsp), %rcx movl 0x18(%rcx), %edx movl %ebp, %ecx subl %edx, %ecx jge 0x3b128 movl 0x118(%rsp), %eax addl %ecx, %eax cmpl 0x138(%rsp), %eax jl 0x3b835 cmpl 0xf8(%rsp), %eax jg 0x3b835 movl (%rbx), %esi movq 0x28(%rsp), %r14 movq %r14, %rdi callq 0x3807c movl 0x4(%rbx), %eax movl %eax, 0x4(%r14) movq %r14, %rdi callq 0x384c8 movl %eax, %r14d cmpl $0x1, 0x4(%rbx) movl $0xffff, %esi # imm = 0xFFFF movl $0xcdb4, %eax # imm = 0xCDB4 cmovel %eax, %esi leaq 0xc(%rsp), %rdi callq 0x5350c movzbl %r14b, %esi leaq 0xc(%rsp), %rdi movl %esi, 0xfc(%rsp) callq 0x535b8 cmpb $-0x3, %r14b jne 0x3b1c4 cmpl $0x2, 0x4(%rbx) jne 0x3b1c4 movq 0x10(%rsp), %rax movl $0x3, 0x14(%rax) incl 0xc(%rax) movq 0x28(%rsp), %rax movl $0x1, 0x4(%rax) movl $0x4, 0x3c(%rsp) movq 0x48(%rsp), %rcx movq %rcx, %rax cmpq 0x40(%rsp), %rcx jne 0x3b1db movq 0x120(%rsp), %rax movl 0x18(%rax), %ecx xorl %eax, %eax movl $0x0, %edx subl %ebp, %ecx jg 0x3b1f0 movl 0x118(%rsp), %edx leal (%rcx,%rdx), %r14d movl %r14d, %edx movl 0x3c(%rsp), %ecx sarl %cl, %edx movl %edx, 0x6c(%rsp) movl $0xffffffff, %edx # imm = 0xFFFFFFFF shll %cl, %edx movl %edx, 0xf4(%rsp) movl (%r15), %ebp cmpl (%rbx), %ebp jg 0x3b220 movq 0x28(%rsp), %rdi callq 0x3806e movl %r14d, 0xf0(%rsp) movslq 0x6c(%rsp), %r15 decq %r15 addl %ebp, %eax subl (%rbx), %eax movl 0x3c(%rsp), %ecx sarl %cl, %eax decl %eax leaq 0xa44fd(%rip), %rcx # 0xdf740 cmpl $0x0, 0x30(%rcx) cmovel %r15d, %eax movq 0x48(%rsp), %rcx cmpq 0x40(%rsp), %rcx cmovel %r15d, %eax leal -0x3(%rax), %r13d movq 0x10(%rsp), %rdi cmpl $0x1, 0x14(%rdi) cmovnel %eax, %r13d cmpl $0x3, %eax cmovll %eax, %r13d callq 0x6bce0 addl $0x2, %eax cmpl %r13d, %eax movl %r13d, %r14d movl %eax, 0x20(%rsp) cmovgl %eax, %r14d movq 0x28(%rsp), %rdi callq 0x38072 movl %eax, %ebp movl 0x3c(%rsp), %ecx sarl %cl, %ebp cmpl 0x20(%rsp), %ebp jge 0x3b2e8 movq 0x10(%rsp), %rdi callq 0x6bcaa testl %eax, %eax je 0x3b2c8 movq 0x10(%rsp), %rdi callq 0x6c16a cmpl $0x1802, %ebp # imm = 0x1802 setge %cl testb %al, %cl je 0x3b5b2 leaq 0xa4471(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3b2e8 leaq 0xa4fd4(%rip), %rdi # 0xe02b0 leaq 0x70688(%rip), %rsi # 0xab96b callq 0x4083c movslq %r14d, %rsi leaq 0x50(%rsp), %r14 movq %r14, %rdi leaq 0x70(%rsp), %rdx callq 0x38b58 movq 0x28(%rsp), %rdi movq %r14, %rsi callq 0x3f5ca movq 0x50(%rsp), %rsi movslq 0x20(%rsp), %rdx leaq 0xc(%rsp), %rdi callq 0x53578 movw %ax, 0x1a(%rsp) cmpw $0x0, 0x1a(%rsp) je 0x3b3d6 leaq 0xa440a(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3b3d6 movq 0x10(%rsp), %rdi callq 0x6bce0 cltq movq 0x50(%rsp), %rcx movzbl (%rcx,%rax), %ebp movq 0x10(%rsp), %rdi callq 0x6bce0 movq 0x50(%rsp), %rcx cltq movzbl 0x1(%rcx,%rax), %r12d leaq 0xc(%rsp), %rdi callq 0x5360c movl %eax, %r14d leaq 0xc(%rsp), %rdi callq 0x53610 movzbl %r14b, %r8d movzbl %al, %r9d leaq 0x70(%rsp), %rdi leaq 0x7060b(%rip), %rsi # 0xab9a2 movl %ebp, %edx movl %r12d, %ecx xorl %eax, %eax callq 0x784cc leaq 0xa4f06(%rip), %rdi # 0xe02b0 leaq 0x70(%rsp), %rsi callq 0x3f60b movq 0x70(%rsp), %rdi leaq 0x80(%rsp), %rax cmpq %rax, %rdi je 0x3b3d6 movq 0x80(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0xa4363(%rip), %rax # 0xdf740 cmpl $0x0, 0xf8(%rax) jne 0x3b3f5 movq 0x10(%rsp), %rdi callq 0x6bce0 cmpl %eax, %r13d jl 0x3b444 movq 0x50(%rsp), %r12 movq 0x58(%rsp), %r14 movq 0x10(%rsp), %rdi callq 0x6bce0 subl %r12d, %r14d cmpl %r14d, %eax jge 0x3b451 leaq 0xa4328(%rip), %rax # 0xdf740 cmpl $0x0, 0x2c(%rax) je 0x3b437 movq 0x48(%rsp), %rax cmpq 0x40(%rsp), %rax jne 0x3b451 leaq 0xa430f(%rip), %rax # 0xdf740 cmpl $0x0, 0x34(%rax) jne 0x3b451 movq 0x10(%rsp), %rdi callq 0x6bce0 movl %eax, %r13d movslq %r13d, %rsi leaq 0x50(%rsp), %rdi callq 0x38b2c movl 0x6c(%rsp), %r12d addl $0x6, %r12d movl 0x58(%rsp), %r14d movq 0x50(%rsp), %rax subl %eax, %r14d cmpl %r14d, %r12d jg 0x3b49a movl 0xf4(%rsp), %ecx notl %ecx movb $0x1, %r13b testl %ecx, 0xf0(%rsp) jne 0x3b49d cmpb $-0x2, (%rax,%r15) jne 0x3b49d leaq 0x50(%rsp), %rdi movl %r12d, %esi callq 0x5a979 movl %eax, %r13d jmp 0x3b49d xorl %r13d, %r13d cmpl %r14d, 0x20(%rsp) jg 0x3b4c8 movq 0x48(%rsp), %rax cmpq 0x40(%rsp), %rax je 0x3b4cc leaq 0x50(%rsp), %rdi movl 0x20(%rsp), %esi movq 0x140(%rsp), %rdx callq 0x59b10 jmp 0x3b4da xorl %ebp, %ebp jmp 0x3b4dc leaq 0x50(%rsp), %rdi movl 0x20(%rsp), %esi callq 0x5add0 movl %eax, %ebp leaq 0xa425d(%rip), %rax # 0xdf740 cmpl $0x2, 0x2c(%rax) je 0x3b609 cmpl %r14d, %r12d movl %r12d, %edx setg %r12b setle %cl andb %r13b, %cl leaq 0xa423c(%rip), %rax # 0xdf740 movl 0x74(%rax), %eax cmpb $0x1, %cl jne 0x3b548 testl %eax, %eax je 0x3b523 leaq 0xa4d99(%rip), %rdi # 0xe02b0 leaq 0x704be(%rip), %rsi # 0xab9dc callq 0x408a5 xorl %eax, %eax movq 0x10(%rsp), %rcx cmpl $0x1, 0x14(%rcx) setne %al leal (%rax,%rax,2), %eax leal -0x3(%r15,%rax), %eax movslq %eax, %rsi leaq 0x50(%rsp), %rdi callq 0x38b2c jmp 0x3b56c cmpl %r14d, %edx setle %cl testl %eax, %eax setne %al andb %cl, %al cmpb $0x1, %al jne 0x3b56c leaq 0xa4d50(%rip), %rdi # 0xe02b0 leaq 0x70496(%rip), %rsi # 0xab9fd callq 0x4090e cmpl %r14d, 0x20(%rsp) jg 0x3b609 orb %r12b, %r13b andb %bpl, %r13b je 0x3b609 leaq 0xa41b6(%rip), %rax # 0xdf740 movl 0x74(%rax), %eax movq 0x48(%rsp), %rcx cmpq 0x40(%rsp), %rcx je 0x3b5db testl %eax, %eax je 0x3b5f2 leaq 0xa4d0c(%rip), %rdi # 0xe02b0 leaq 0x70476(%rip), %rsi # 0xaba21 callq 0x408a5 jmp 0x3b5f2 leaq 0xa4187(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3b835 leaq 0xa4ce6(%rip), %rdi # 0xe02b0 leaq 0x7036d(%rip), %rsi # 0xab93e callq 0x407d3 jmp 0x3b835 testl %eax, %eax je 0x3b5f2 leaq 0xa4cca(%rip), %rdi # 0xe02b0 leaq 0x70455(%rip), %rsi # 0xaba42 callq 0x40977 movq 0x10(%rsp), %rdi callq 0x6bce0 movslq %eax, %rsi leaq 0x50(%rsp), %rdi callq 0x38b2c movl $0x0, 0x78(%rsp) xorl %ecx, %ecx movq %rcx, 0x80(%rsp) leaq 0x78(%rsp), %rax movq %rax, 0x88(%rsp) movq %rax, 0x90(%rsp) movq %rcx, 0x98(%rsp) movq 0x10(%rsp), %rdi callq 0x6c16a leaq 0x50(%rsp), %r15 testb %al, %al je 0x3b78f movq 0x50(%rsp), %rsi movl 0x58(%rsp), %edx subl %esi, %edx leaq 0xb0(%rsp), %rdi callq 0x58731 leaq 0x70(%rsp), %rdi callq 0x412d8 movq 0xc0(%rsp), %rax testq %rax, %rax je 0x3b6e4 movl 0xb8(%rsp), %ecx movl %ecx, 0x78(%rsp) movq %rax, 0x80(%rsp) movups 0xc8(%rsp), %xmm0 movups %xmm0, 0x88(%rsp) leaq 0x78(%rsp), %rcx movq %rcx, 0x8(%rax) movq 0xd8(%rsp), %rax movq %rax, 0x98(%rsp) xorl %ecx, %ecx movq %rcx, 0xc0(%rsp) leaq 0xb8(%rsp), %rax movq %rax, 0xc8(%rsp) movq %rax, 0xd0(%rsp) movq %rcx, 0xd8(%rsp) leaq 0xb0(%rsp), %rdi callq 0x41342 leaq 0xa4048(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3b78f leaq 0xa4ba7(%rip), %rdi # 0xe02b0 leaq 0x70354(%rip), %rsi # 0xaba64 callq 0x40a46 movq %rax, %r14 leaq 0x148(%rsp), %r13 movq %r13, %rdi leaq 0x70(%rsp), %rsi callq 0x41356 leaq 0xb0(%rsp), %r12 movq %r12, %rdi movq %r13, %rsi callq 0x59dfd movq %r14, %rdi movq %r12, %rsi callq 0x3f60b movb $0xa, 0x36(%rsp) movq %rax, %rdi leaq 0x36(%rsp), %rsi callq 0x409e0 movq 0xb0(%rsp), %rdi leaq 0xc0(%rsp), %rax cmpq %rax, %rdi je 0x3b782 movq 0xc0(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x148(%rsp), %rdi callq 0x41342 cmpw $0x0, 0x1a(%rsp) setne %al orb 0x27(%rsp), %al jne 0x3b7d5 movl 0x3c(%rsp), %ecx movl 0x20(%rsp), %esi shll %cl, %esi addl (%rbx), %esi movq 0x28(%rsp), %rdi callq 0x37ef2 movl %eax, %ebp cmpl (%rbx), %eax jge 0x3b7d5 movq 0x28(%rsp), %rdi callq 0x3811a cmpl %eax, %ebp cmovgl %ebp, %eax movq 0x28(%rsp), %rdi movl %eax, %esi callq 0x3811e xorl %edx, %edx cmpw $0x0, 0x1a(%rsp) setne %dl movq 0x10(%rsp), %rdi movq %r15, %rsi movl 0xfc(%rsp), %ecx callq 0x6bd6c cmpw $0x0, 0x1a(%rsp) sete %bl cmpq $0x0, 0x98(%rsp) setne %bpl leaq 0x70(%rsp), %rdi callq 0x41342 movq 0x50(%rsp), %rdi testq %rdi, %rdi je 0x3b82b movq 0x60(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 orb %bpl, %bl movzbl %bl, %eax leal (%rax,%rax,8), %r12d cmpl $0xb, %r12d je 0x3b840 testl %r12d, %r12d jne 0x3b85c movq 0x108(%rsp), %rax movq 0xe8(%rsp), %rcx movq %rcx, %rbx cmpq %rax, %rcx jne 0x3b0d0 movq 0x128(%rsp), %rax movq %rax, 0x40(%rsp) movq 0x48(%rsp), %rcx jmp 0x3afc2 leaq 0x118(%rsp), %rsi movq 0xe0(%rsp), %rdi callq 0x74be0 leaq 0x120(%rsp), %rbx movq 0x100(%rsp), %rdi testq %rdi, %rdi je 0x3b8ad movq 0x110(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq %rbx, %rdi callq 0x4106a addq $0x178, %rsp # imm = 0x178 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx movq 0xb0(%rsp), %rdi leaq 0xc0(%rsp), %rax cmpq %rax, %rdi je 0x3b91b movq 0xc0(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x3b91b jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b918 jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b932 jmp 0x3b9f2 movq %rax, %rbx leaq 0x98(%rsp), %rdi callq 0x410b8 jmp 0x3b9f5 jmp 0x3b9f2 movq %rax, %rbx jmp 0x3ba12 jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b94d movq %rax, %rbx jmp 0x3b975 jmp 0x3b9bf movq %rax, %rbx movq 0xb0(%rsp), %rdi leaq 0xc0(%rsp), %rax cmpq %rax, %rdi je 0x3b975 movq 0xc0(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x148(%rsp), %rdi callq 0x41342 jmp 0x3b9c2 jmp 0x3b9bf jmp 0x3b9bf jmp 0x3b9bf movq %rax, %rbx movq 0x70(%rsp), %rdi leaq 0x80(%rsp), %rax cmpq %rax, %rdi je 0x3b9d7 movq 0x80(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x3b9d7 jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b9d4 jmp 0x3b9f2 jmp 0x3b9f2 jmp 0x3b9d4 jmp 0x3b9f2 movq %rax, %rbx leaq 0x70(%rsp), %rdi callq 0x41342 jmp 0x3b9d7 jmp 0x3b9f2 jmp 0x3b9d4 jmp 0x3b9f2 movq %rax, %rbx movq 0x50(%rsp), %rdi testq %rdi, %rdi je 0x3b9f5 movq 0x60(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 jmp 0x3b9f5 jmp 0x3b9f2 movq %rax, %rbx movq 0x100(%rsp), %rdi testq %rdi, %rdi je 0x3ba12 movq 0x110(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x120(%rsp), %rdi callq 0x4106a movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamDecoder.cpp
scan_bitstream_ace(TrackData&)
void scan_bitstream_ace(TrackData& trackdata) { auto& bitbuf = trackdata.bitstream(); bitbuf.seek(0); Track track; track.tracklen = bitbuf.track_bitsize(); uint32_t word = 0; enum State { stateWant255, stateWant42, stateData }; State state = stateWant255; Data block; int idle = 0; bool dataerror = false; int bit; int data_offset = 0; while (!bitbuf.wrapped()) { // Read the next clock and data bits word = (bitbuf.read1() << 1) | bitbuf.read1(); // If the clock is missing, attempt to re-sync by skipping a bit if (!(word & 2)) { bitbuf.read1(); continue; } // Outside a frame a 1 represents the idle state if (~word & 1) { // Stop if we've found an idle patch after valid data if (++idle > 64 && state == stateData) break; // Ignore idle otherwise continue; } // The transition to 0 represents a potential start bit, so reset the idle count idle = 0; bit = 0; uint8_t data = 0; // no data yet int parity = 1; // odd parity int clock = 2; // valid clock // Read 8 data bits, 1 parity bit, 1 stop bit for (int i = 0; i < 10; ++i) { // Fetch clock and data bits word = (bitbuf.read1() << 1) | bitbuf.read1(); // Extract bit, update parity and clock status bit = ~word & 1; parity ^= bit; clock &= word; // Add data bit (lsb to msb order) data |= (bit << i) & 0xff; } // Check for errors if (!clock || !bit || !parity) { if (state != stateData) continue; // Report only first error during the data block, unless verbose if (!dataerror || opt.verbose) { dataerror = true; if (!clock || !bit) Message(msgWarning, "framing error at offset %u on on %s", block.size(), CH(trackdata.cylhead.cyl, trackdata.cylhead.head)); else if (!parity) // inverted due to inclusion of stop bit above Message(msgWarning, "parity error at offset %u on on %s", block.size(), CH(trackdata.cylhead.cyl, trackdata.cylhead.head)); } } else { switch (state) { case stateWant255: if (data == 255) state = stateWant42; else block.clear(); break; case stateWant42: if (data == 42) { state = stateData; data_offset = bitbuf.track_offset(bitbuf.tell()); } else if (data != 255) { state = stateWant255; block.clear(); } break; default: break; } } // Save the byte block.push_back(data); } // If we found a block on the track, save it in a 4K sector with id=0. if (state == stateData) { Sector sector(DataRate::_250K, Encoding::Ace, Header(trackdata.cylhead, 0, SizeToCode(4096))); sector.offset = data_offset; // Skip header bytes if (!IsValidDeepThoughtData(block)) { Message(msgWarning, "block checksum error on %s", CH(trackdata.cylhead.cyl, trackdata.cylhead.head)); dataerror = true; } sector.add(std::move(block), dataerror, 0x00); track.add(std::move(sector)); } trackdata.add(std::move(track)); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xa8, %rsp movq %rdi, %rbx callq 0x74e48 movq %rax, %r14 xorl %r15d, %r15d movq %rax, %rdi xorl %esi, %esi callq 0x3807c leaq 0x48(%rsp), %rdi xorl %esi, %esi callq 0x713b8 movq %r14, %rdi callq 0x387b0 movl %eax, 0x48(%rsp) xorps %xmm0, %xmm0 leaq 0x10(%rsp), %rax movaps %xmm0, (%rax) movq $0x0, 0x10(%rax) xorl %ebp, %ebp movl $0x0, 0x34(%rsp) xorl %r13d, %r13d movq %r14, %rdi callq 0x38062 testb %al, %al jne 0x3d73d movq %r14, %rdi callq 0x38290 movl %eax, %r12d movq %r14, %rdi callq 0x38290 movzbl %r12b, %ecx addl %ecx, %ecx movzbl %al, %edx orl %ecx, %edx testb $0x2, %dl jne 0x3d52e movq %r14, %rdi callq 0x38290 jmp 0x3d4f1 testb $0x1, %al jne 0x3d550 cmpl $0x2, %r15d sete %al cmpl $0x40, %r13d leal 0x1(%r13), %ecx setae %dl movl %ecx, %r13d testb %al, %dl je 0x3d4f1 jmp 0x3d73d movl %ebp, 0xc(%rsp) movq %rbx, 0x28(%rsp) movb $0x0, 0xb(%rsp) movl $0x1, %ecx movl $0x2, %ebx xorl %r12d, %r12d movl %ecx, %ebp movq %r14, %rdi callq 0x38290 movl %eax, %r13d movq %r14, %rdi callq 0x38290 movzbl %r13b, %esi addl %esi, %esi movzbl %al, %edx orl %edx, %esi andl $0x1, %edx movl %edx, %eax xorl $0x1, %eax movl %eax, %edi movl %r12d, %ecx shll %cl, %edi andl %esi, %ebx orb %dil, 0xb(%rsp) movl %eax, %ecx xorl %ebp, %ecx incl %r12d cmpl $0xa, %r12d jne 0x3d56b testl %ebx, %ebx setne %sil testl %edx, %edx sete %cl andb %sil, %cl cmpl %ebp, %eax setne %dl testb %dl, %cl je 0x3d5e9 cmpl $0x1, %r15d movq 0x28(%rsp), %rbx je 0x3d625 testl %r15d, %r15d movl 0xc(%rsp), %ebp jne 0x3d70d cmpb $-0x1, 0xb(%rsp) jne 0x3d65b jmp 0x3d68a cmpl $0x2, %r15d jne 0x3d617 movl $0x2, %r15d testb $0x1, 0xc(%rsp) je 0x3d678 leaq 0xa213d(%rip), %rdx # 0xdf740 cmpl $0x0, 0x78(%rdx) jne 0x3d678 movq 0x28(%rsp), %rbx movl 0xc(%rsp), %ebp jmp 0x3d70d movq 0x28(%rsp), %rbx movl 0xc(%rsp), %ebp jmp 0x3d4ee movzbl 0xb(%rsp), %eax cmpl $0xff, %eax movl 0xc(%rsp), %ebp je 0x3d68a cmpl $0x2a, %eax jne 0x3d65b movq %r14, %rdi callq 0x37eee movq %r14, %rdi movl %eax, %esi callq 0x37ef2 movl %eax, 0x34(%rsp) movl $0x2, %r15d jmp 0x3d70d movq 0x10(%rsp), %rax xorl %r15d, %r15d cmpq %rax, 0x18(%rsp) je 0x3d70d movq %rax, 0x18(%rsp) jmp 0x3d70d testb %cl, %cl je 0x3d692 cmpl %ebp, %eax je 0x3d6cf movq 0x28(%rsp), %rbx jmp 0x3d70a movl $0x1, %r15d jmp 0x3d70d movl 0x18(%rsp), %eax subl 0x10(%rsp), %eax movl %eax, 0x38(%rsp) movq 0x28(%rsp), %rbx movl (%rbx), %edi movl 0x4(%rbx), %esi callq 0x76a95 movq %rax, 0x68(%rsp) movl $0x3, %edi leaq 0x6e107(%rip), %rsi # 0xab7c5 leaq 0x38(%rsp), %rdx leaq 0x68(%rsp), %rcx callq 0x3ff22 jmp 0x3d70a movl 0x18(%rsp), %eax subl 0x10(%rsp), %eax movl %eax, 0x38(%rsp) movq 0x28(%rsp), %rbx movl (%rbx), %edi movl 0x4(%rbx), %esi callq 0x76a95 movq %rax, 0x68(%rsp) movl $0x3, %edi leaq 0x6e0ee(%rip), %rsi # 0xab7e9 leaq 0x38(%rsp), %rdx leaq 0x68(%rsp), %rcx callq 0x3ff22 movb $0x1, %bpl movq 0x18(%rsp), %rsi cmpq 0x20(%rsp), %rsi je 0x3d729 movb 0xb(%rsp), %al movb %al, (%rsi) incq 0x18(%rsp) jmp 0x3d4ee leaq 0x10(%rsp), %rdi leaq 0xb(%rsp), %rdx callq 0x41cdc jmp 0x3d4ee cmpl $0x2, %r15d jne 0x3d7f1 movl $0x1000, %edi # imm = 0x1000 callq 0x77ea2 leaq 0x38(%rsp), %rdi movq %rbx, %rsi xorl %edx, %edx movl %eax, %ecx callq 0x60760 leaq 0x68(%rsp), %rdi leaq 0x38(%rsp), %rcx movl $0x3d090, %esi # imm = 0x3D090 movl $0x6, %edx xorl %r8d, %r8d callq 0x6bb84 movl 0x34(%rsp), %eax movl %eax, 0x80(%rsp) leaq 0x10(%rsp), %rdi callq 0x62229 testb %al, %al jne 0x3d7bd movl (%rbx), %edi movl 0x4(%rbx), %esi callq 0x76a95 leaq 0x38(%rsp), %rdx movq %rax, (%rdx) leaq 0x6e05c(%rip), %rsi # 0xab80c movl $0x3, %edi callq 0x400e2 movb $0x1, %bpl movzbl %bpl, %edx andl $0x1, %edx leaq 0x68(%rsp), %rdi leaq 0x10(%rsp), %rsi xorl %ecx, %ecx callq 0x6bd6c leaq 0x48(%rsp), %rdi leaq 0x68(%rsp), %rsi callq 0x71b18 leaq 0x90(%rsp), %rdi callq 0x410b8 leaq 0x48(%rsp), %rsi movq %rbx, %rdi callq 0x74be0 movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x3d815 movq 0x20(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x50(%rsp), %rdi callq 0x4106a addq $0xa8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x3d856 jmp 0x3d856 jmp 0x3d856 jmp 0x3d840 jmp 0x3d856 movq %rax, %rbx jmp 0x3d870 movq %rax, %rbx leaq 0x90(%rsp), %rdi callq 0x410b8 jmp 0x3d859 jmp 0x3d856 jmp 0x3d856 movq %rax, %rbx movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x3d870 movq 0x20(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x50(%rsp), %rdi callq 0x4106a movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamDecoder.cpp
scan_bitstream_mx(TrackData&)
void scan_bitstream_mx(TrackData& trackdata) { Track track; Data block; uint64_t dword = 0; uint16_t stored_cksum = 0, cksum = 0, stored_track = 0, extra = 0; bool zero_cksum = false; auto& bitbuf = trackdata.bitstream(); bitbuf.seek(0); bitbuf.encoding = Encoding::FM; track.tracklen = bitbuf.track_bitsize(); bool sync = false; while (!bitbuf.wrapped()) { // Give up if no headers were found in the first revolution if (!track.size() && bitbuf.tell() > track.tracklen) break; // ignore sync sequences after first one if (sync) break; dword = (dword << 1) | bitbuf.read1(); switch (dword) { case 0x88888888aaaa88aa: // FM-encoded 0x00f3 (000363 octal) sync = true; if (opt.debug) util::cout << " s_b_mx found sync at " << bitbuf.tell() << "\n"; break; default: continue; } // skip track number stored_track = bitbuf.read_byte() << 8; stored_track |= bitbuf.read_byte(); // read sectors for (auto s = 0; s < 11; s++) { Sector sector(bitbuf.datarate, Encoding::MX, Header(stored_track, trackdata.cylhead.head, s, SizeToCode(256))); sector.offset = bitbuf.track_offset(bitbuf.tell()); block.clear(); cksum = 0; for (auto i = 0; i < 128; i++) { auto msb = bitbuf.read_byte(); auto lsb = bitbuf.read_byte(); cksum += (lsb | (msb << 8)); block.push_back(lsb); block.push_back(msb); } stored_cksum = bitbuf.read_byte() << 8; stored_cksum |= bitbuf.read_byte(); if (opt.debug) util::cout << util::fmt("cksum s %2d disk:calc %06o:%06o (%04x:%04x)\n", s, stored_cksum, cksum, stored_cksum, cksum); /* * Flux stream on some marginal disks may decode as stream of zero bits instead of valid * data, but checksum of all zeros is also zero... */ if (cksum != stored_cksum) { sector.add(std::move(block), true, 0); if (stored_cksum == 0) { zero_cksum = true; } } else { sector.add(std::move(block), (zero_cksum && stored_cksum == 0), 0); } track.add(std::move(sector)); } extra = bitbuf.read_byte() << 8; extra |= bitbuf.read_byte(); if (opt.debug) util::cout << util::fmt(" s_b_mx c:h %d:%d stored %d extra %06o\n", trackdata.cylhead.cyl, trackdata.cylhead.head, stored_track, extra); } trackdata.add(std::move(track)); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xb8, %rsp movq %rdi, %rbx leaq 0x58(%rsp), %rdi xorl %esi, %esi callq 0x713b8 xorps %xmm0, %xmm0 movaps %xmm0, 0x10(%rsp) movq $0x0, 0x20(%rsp) movq %rbx, 0x30(%rsp) movq %rbx, %rdi callq 0x74e48 movq %rax, %r14 movq %rax, %rdi xorl %esi, %esi callq 0x3807c movl $0x2, 0x4(%r14) movq %r14, %rdi callq 0x387b0 movabsq $-0x7777777755557756, %rbp # imm = 0x88888888AAAA88AA leaq 0x58(%rsp), %rcx movl %eax, (%rcx) movl $0x0, 0xc(%rsp) xorl %r13d, %r13d xorl %r15d, %r15d movq %r14, %rdi callq 0x38062 testb %al, %al jne 0x3dc53 leaq 0x58(%rsp), %rdi callq 0x713fc testl %eax, %eax je 0x3d925 testb $0x1, %r15b je 0x3d93f jmp 0x3dc53 movq %r14, %rdi callq 0x37eee cmpl 0x58(%rsp), %eax setg %al orb %r15b, %al testb $0x1, %al jne 0x3dc53 movq %r14, %rdi callq 0x38290 addq %r13, %r13 movzbl %al, %eax orq %rax, %r13 cmpq %rbp, %r13 jne 0x3d8fc leaq 0xa1de4(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3d9a0 leaq 0xa2947(%rip), %rdi # 0xe02b0 leaq 0x6deb7(%rip), %rsi # 0xab827 callq 0x402a0 movq %rax, %rbx movq %r14, %rdi callq 0x37eee movl %eax, 0x78(%rsp) movq %rbx, %rdi leaq 0x78(%rsp), %rsi callq 0x38c21 movq %rax, %rdi leaq 0x6fa93(%rip), %rsi # 0xad42e callq 0x38d1e movq %r14, %rdi callq 0x384c8 movl %eax, %ebx movq %r14, %rdi callq 0x384c8 movzbl %bl, %ecx shll $0x8, %ecx movzbl %al, %eax orl %ecx, %eax movzwl %ax, %eax movl %eax, 0x2c(%rsp) xorl %ebp, %ebp leaq 0x38(%rsp), %r12 movl (%r14), %ebx movq 0x30(%rsp), %rax movl 0x4(%rax), %r15d movl $0x100, %edi # imm = 0x100 callq 0x77ea2 movq %r12, %rdi movl 0x2c(%rsp), %esi movl %r15d, %edx movl %ebp, %ecx movl %eax, %r8d callq 0x60752 leaq 0x78(%rsp), %rdi movl %ebx, %esi movl $0x7, %edx movq %r12, %rcx xorl %r8d, %r8d callq 0x6bb84 movq %r14, %rdi callq 0x37eee movq %r14, %rdi movl %eax, %esi callq 0x37ef2 movl %eax, 0x90(%rsp) movq 0x10(%rsp), %rax cmpq %rax, 0x18(%rsp) je 0x3da36 movq %rax, 0x18(%rsp) movl $0x80, %r13d xorl %r15d, %r15d movq %r14, %rdi callq 0x384c8 movb %al, 0x38(%rsp) movq %r14, %rdi callq 0x384c8 movl %eax, %ebx movb %al, 0xb(%rsp) movzbl 0x38(%rsp), %r12d movq 0x18(%rsp), %rsi cmpq 0x20(%rsp), %rsi je 0x3da74 movb %bl, (%rsi) incq 0x18(%rsp) jmp 0x3da83 leaq 0x10(%rsp), %rdi leaq 0xb(%rsp), %rdx callq 0x41cdc movq 0x18(%rsp), %rsi cmpq 0x20(%rsp), %rsi je 0x3da9c movb 0x38(%rsp), %al movb %al, (%rsi) incq 0x18(%rsp) jmp 0x3daab leaq 0x10(%rsp), %rdi leaq 0x38(%rsp), %rdx callq 0x41cdc movzbl %bl, %eax shll $0x8, %r12d addl %eax, %r15d addl %r12d, %r15d decl %r13d leaq 0x38(%rsp), %r12 jne 0x3da3f movq %r14, %rdi callq 0x384c8 movl %eax, %ebx movq %r14, %rdi callq 0x384c8 movzbl %bl, %ecx shll $0x8, %ecx movzbl %al, %ebx orl %ecx, %ebx leaq 0xa1c56(%rip), %rax # 0xdf740 cmpl $0x0, 0x74(%rax) je 0x3db3c movzwl %bx, %ecx movzwl %r15w, %r8d movl %r8d, (%rsp) movq %r12, %rdi leaq 0x6dd3a(%rip), %rsi # 0xab83f movl %ebp, %edx movl %ecx, %r9d xorl %eax, %eax callq 0x784cc leaq 0xa2798(%rip), %rdi # 0xe02b0 movq %r12, %rsi callq 0x3f60b movq 0x38(%rsp), %rdi leaq 0x48(%rsp), %rax cmpq %rax, %rdi je 0x3db3c movq 0x48(%rsp), %rsi incq %rsi callq 0x355d0 cmpw %bx, %r15w jne 0x3db62 testw %bx, %bx sete %al andb 0xc(%rsp), %al movzbl %al, %edx leaq 0x78(%rsp), %rdi leaq 0x10(%rsp), %rsi xorl %ecx, %ecx callq 0x6bd6c jmp 0x3db8e leaq 0x78(%rsp), %rdi leaq 0x10(%rsp), %rsi movl $0x1, %edx xorl %ecx, %ecx callq 0x6bd6c testw %bx, %bx movl 0xc(%rsp), %ecx movzbl %cl, %ecx movl $0x1, %eax cmovel %eax, %ecx movl %ecx, 0xc(%rsp) leaq 0x58(%rsp), %rdi leaq 0x78(%rsp), %rsi callq 0x71b18 leaq 0xa0(%rsp), %rdi callq 0x410b8 incl %ebp cmpl $0xb, %ebp jne 0x3d9cb movq %r14, %rdi callq 0x384c8 movabsq $-0x7777777755557756, %rbp # imm = 0x88888888AAAA88AA movl %eax, %ebx movq %r14, %rdi callq 0x384c8 movb $0x1, %r15b leaq 0xa1b65(%rip), %rcx # 0xdf740 cmpl $0x0, 0x74(%rcx) movq %rbp, %r13 leaq 0x88(%rsp), %r12 je 0x3d8fc movzbl %bl, %ecx shll $0x8, %ecx movzbl %al, %r9d orl %ecx, %r9d movq 0x30(%rsp), %rax movl (%rax), %edx movl 0x4(%rax), %ecx leaq 0x78(%rsp), %rbx movq %rbx, %rdi leaq 0x6dc56(%rip), %rsi # 0xab86c movl 0x2c(%rsp), %r8d xorl %eax, %eax callq 0x784cc leaq 0xa2687(%rip), %rdi # 0xe02b0 movq %rbx, %rsi callq 0x3f60b movq 0x78(%rsp), %rdi cmpq %r12, %rdi je 0x3dc4b movq 0x88(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbp, %r13 jmp 0x3d8fc leaq 0x58(%rsp), %rsi movq 0x30(%rsp), %rdi callq 0x74be0 movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x3dc79 movq 0x20(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x60(%rsp), %rdi callq 0x4106a addq $0xb8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx movq 0x78(%rsp), %rdi cmpq %r12, %rdi je 0x3dcfc movq 0x88(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x3dcfc jmp 0x3dce3 jmp 0x3dce3 jmp 0x3dce3 jmp 0x3dce3 jmp 0x3dce3 jmp 0x3dcec movq %rax, %rbx movq 0x38(%rsp), %rdi leaq 0x48(%rsp), %rax cmpq %rax, %rdi je 0x3dcef movq 0x48(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x3dcef jmp 0x3dce3 movq %rax, %rbx jmp 0x3dcfc jmp 0x3dcec jmp 0x3dcec movq %rax, %rbx leaq 0xa0(%rsp), %rdi callq 0x410b8 movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x3dd13 movq 0x20(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x60(%rsp), %rdi callq 0x4106a movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamDecoder.cpp
void Message<char const*, unsigned char&, unsigned char&, unsigned char&, int&, char const*>(MsgType, char const*, char const*&&, unsigned char&, unsigned char&, unsigned char&, int&, char const*&&)
void Message(MsgType type, const char* pcsz_, Args&& ...args) { std::string msg = util::fmt(pcsz_, std::forward<Args>(args)...); if (type == msgError) throw util::exception(msg); if (type != msgStatus) { if (seen_messages.find(msg) != seen_messages.end()) return; seen_messages.insert(msg); } switch (type) { case msgStatus: break; case msgInfo: util::cout << "Info: "; break; case msgFix: util::cout << colour::GREEN << "Fixed: "; break; case msgWarning: util::cout << colour::YELLOW << "Warning: "; break; case msgError: util::cout << colour::RED << "Error: "; break; } if (type == msgStatus) util::cout << ttycmd::statusbegin << "\r" << msg << ttycmd::statusend; else util::cout << msg << colour::none << '\n'; }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %edi, %ebx movq 0x48(%rsp), %r10 movq 0x40(%rsp), %rax movq (%rdx), %rdx movzbl (%rcx), %ecx movzbl (%r8), %r8d movzbl (%r9), %r9d movl (%rax), %r11d leaq 0x8(%rsp), %rdi xorl %eax, %eax pushq (%r10) pushq %r11 callq 0x784cc addq $0x10, %rsp testl %ebx, %ebx je 0x3f8dc cmpl $0x4, %ebx je 0x3f939 leaq 0xa05e6(%rip), %r14 # 0xdfdf8 leaq 0x8(%rsp), %rsi movq %r14, %rdi callq 0x418a4 addq $0x8, %r14 cmpq %r14, %rax jne 0x3f916 leaq 0xa05c5(%rip), %rdi # 0xdfdf8 leaq 0x8(%rsp), %rsi callq 0x4192e cmpl $0x3, %ebx ja 0x3f8af movl %ebx, %eax leaq 0x6bb25(%rip), %rcx # 0xab370 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0xa0a55(%rip), %rdi # 0xe02b0 leaq 0x6c536(%rip), %rsi # 0xabd98 callq 0x4172b jmp 0x3f8ab leaq 0xa0a40(%rip), %rdi # 0xe02b0 movl $0xa0, %esi callq 0x788ea leaq 0x6c51e(%rip), %rsi # 0xabd9f movq %rax, %rdi callq 0x41794 jmp 0x3f8ab leaq 0xa0a1e(%rip), %rdi # 0xe02b0 movl $0xa1, %esi callq 0x788ea leaq 0x6c504(%rip), %rsi # 0xabda7 movq %rax, %rdi callq 0x405c6 testl %ebx, %ebx je 0x3f8dc leaq 0xa09fa(%rip), %rdi # 0xe02b0 leaq 0x8(%rsp), %rsi callq 0x3f60b movq %rax, %rdi xorl %esi, %esi callq 0x788ea leaq 0x7(%rsp), %rsi movb $0xa, (%rsi) movq %rax, %rdi callq 0x409e0 jmp 0x3f916 leaq 0xa09cd(%rip), %rdi # 0xe02b0 movl $0x2, %esi callq 0x7897a leaq 0x6f56f(%rip), %rsi # 0xaee63 movq %rax, %rdi callq 0x38d1e leaq 0x8(%rsp), %rsi movq %rax, %rdi callq 0x3f60b movq %rax, %rdi movl $0x3, %esi callq 0x7897a leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x3f931 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 addq $0x28, %rsp popq %rbx popq %r14 retq movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x8(%rsp), %rsi movq %rax, %rdi callq 0x416b6 leaq 0x9c226(%rip), %rsi # 0xdbb80 movq 0x9d61f(%rip), %rdx # 0xdcf80 movq %r14, %rdi callq 0x35a50 jmp 0x3f97a movq %rax, %rbx movq %r14, %rdi callq 0x35430 jmp 0x3f97d jmp 0x3f97a movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x3f998 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/Util.h
util::LogHelper& util::operator<<<char [45]>(util::LogHelper&, char const (&) [45])
LogHelper& operator<<(LogHelper& h, const T& t) { if (h.clearline) { h.clearline = false; h << ttycmd::clearline; } *h.screen << t; if (h.file && !h.statusmsg) *h.file << t; return h; }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx cmpb $0x1, 0x11(%rdi) jne 0x407f5 movb $0x0, 0x11(%rbx) movq %rbx, %rdi movl $0x1, %esi callq 0x7897a movq (%rbx), %r15 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq 0x8(%rbx), %r15 testq %r15, %r15 je 0x40833 cmpb $0x0, 0x10(%rbx) jne 0x40833 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/simonowen[P]samdisk/include/utils.h
util::LogHelper& util::operator<<<char [33]>(util::LogHelper&, char const (&) [33])
LogHelper& operator<<(LogHelper& h, const T& t) { if (h.clearline) { h.clearline = false; h << ttycmd::clearline; } *h.screen << t; if (h.file && !h.statusmsg) *h.file << t; return h; }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx cmpb $0x1, 0x11(%rdi) jne 0x408c7 movb $0x0, 0x11(%rbx) movq %rbx, %rdi movl $0x1, %esi callq 0x7897a movq (%rbx), %r15 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq 0x8(%rbx), %r15 testq %r15, %r15 je 0x40905 cmpb $0x0, 0x10(%rbx) jne 0x40905 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/simonowen[P]samdisk/include/utils.h
util::LogHelper& util::operator<<<char [43]>(util::LogHelper&, char const (&) [43])
LogHelper& operator<<(LogHelper& h, const T& t) { if (h.clearline) { h.clearline = false; h << ttycmd::clearline; } *h.screen << t; if (h.file && !h.statusmsg) *h.file << t; return h; }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx cmpb $0x1, 0x11(%rdi) jne 0x40f7c movb $0x0, 0x11(%rbx) movq %rbx, %rdi movl $0x1, %esi callq 0x7897a movq (%rbx), %r15 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq 0x8(%rbx), %r15 testq %r15, %r15 je 0x40fba cmpb $0x0, 0x10(%rbx) jne 0x40fba movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/simonowen[P]samdisk/include/utils.h
util::LogHelper& util::operator<<<char [53]>(util::LogHelper&, char const (&) [53])
LogHelper& operator<<(LogHelper& h, const T& t) { if (h.clearline) { h.clearline = false; h << ttycmd::clearline; } *h.screen << t; if (h.file && !h.statusmsg) *h.file << t; return h; }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx cmpb $0x1, 0x11(%rdi) jne 0x40fe5 movb $0x0, 0x11(%rbx) movq %rbx, %rdi movl $0x1, %esi callq 0x7897a movq (%rbx), %r15 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq 0x8(%rbx), %r15 testq %r15, %r15 je 0x41023 cmpb $0x0, 0x10(%rbx) jne 0x41023 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/simonowen[P]samdisk/include/utils.h
util::exception::exception<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x417fd movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x416f3 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x9a4ae(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x41723 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
util::LogHelper& util::operator<<<char [7]>(util::LogHelper&, char const (&) [7])
LogHelper& operator<<(LogHelper& h, const T& t) { if (h.clearline) { h.clearline = false; h << ttycmd::clearline; } *h.screen << t; if (h.file && !h.statusmsg) *h.file << t; return h; }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx cmpb $0x1, 0x11(%rdi) jne 0x4174d movb $0x0, 0x11(%rbx) movq %rbx, %rdi movl $0x1, %esi callq 0x7897a movq (%rbx), %r15 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq 0x8(%rbx), %r15 testq %r15, %r15 je 0x4178b cmpb $0x0, 0x10(%rbx) jne 0x4178b movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/simonowen[P]samdisk/include/utils.h
util::LogHelper& util::operator<<<char [8]>(util::LogHelper&, char const (&) [8])
LogHelper& operator<<(LogHelper& h, const T& t) { if (h.clearline) { h.clearline = false; h << ttycmd::clearline; } *h.screen << t; if (h.file && !h.statusmsg) *h.file << t; return h; }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx cmpb $0x1, 0x11(%rdi) jne 0x417b6 movb $0x0, 0x11(%rbx) movq %rbx, %rdi movl $0x1, %esi callq 0x7897a movq (%rbx), %r15 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq 0x8(%rbx), %r15 testq %r15, %r15 je 0x417f4 cmpb $0x0, 0x10(%rbx) jne 0x417f4 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq (%r14), %rsi movq 0x8(%r14), %rdx movq %r15, %rdi callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x9b739(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x41865 movq %rax, %rbx movq 0x9b709(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
generate_special(TrackData&)
bool generate_special(TrackData& trackdata) { auto track{ trackdata.track() }; int weak_offset{ 0 }, weak_size{ 0 }; // Special formats have special conversions if (IsEmptyTrack(track)) trackdata.add(GenerateEmptyTrack(trackdata.cylhead, track)); else if (IsKBI19Track(track)) trackdata.add(GenerateKBI19Track(trackdata.cylhead, track)); else if (IsSystem24Track(track)) trackdata.add(GenerateSystem24Track(trackdata.cylhead, track)); else if (IsSpectrumSpeedlockTrack(track, weak_offset, weak_size)) trackdata.add(GenerateSpectrumSpeedlockTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsCpcSpeedlockTrack(track, weak_offset, weak_size)) trackdata.add(GenerateCpcSpeedlockTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsRainbowArtsTrack(track, weak_offset, weak_size)) trackdata.add(GenerateRainbowArtsTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsKBIWeakSectorTrack(track, weak_offset, weak_size)) trackdata.add(GenerateKBIWeakSectorTrack(trackdata.cylhead, track, weak_offset, weak_size)); else if (IsLogoProfTrack(track)) trackdata.add(GenerateLogoProfTrack(trackdata.cylhead, track)); else if (IsOperaSoftTrack(track)) trackdata.add(GenerateOperaSoftTrack(trackdata.cylhead, track)); else if (Is8KSectorTrack(track)) trackdata.add(Generate8KSectorTrack(trackdata.cylhead, track)); else if (Is11SectorTrack(track)) trackdata.add(Generate11SectorTrack(trackdata.cylhead, track)); else return false; return true; }
pushq %rbp pushq %r14 pushq %rbx subq $0xe0, %rsp movq %rdi, %r14 callq 0x74e16 movq (%rax), %rcx leaq 0x10(%rsp), %rbx movq %rcx, -0x8(%rbx) leaq 0x8(%rax), %rsi movq %rbx, %rdi callq 0x42ec8 xorl %eax, %eax movl %eax, 0x4(%rsp) movl %eax, (%rsp) leaq 0x8(%rsp), %rdi callq 0x6c9d0 testb %al, %al je 0x4221a leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6c9dd leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x422fe leaq 0x8(%rsp), %rdi callq 0x6cac3 testb %al, %al je 0x4224c leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6cb93 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x422fe leaq 0x8(%rsp), %rdi callq 0x6d011 testb %al, %al je 0x4227e leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6d0a7 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x422fe leaq 0x8(%rsp), %rdi leaq 0x4(%rsp), %rsi movq %rsp, %rdx callq 0x6d1bc testb %al, %al je 0x422bd movl 0x4(%rsp), %ecx movl (%rsp), %r8d leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6d355 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x422fe leaq 0x8(%rsp), %rdi leaq 0x4(%rsp), %rsi movq %rsp, %rdx callq 0x6d6d8 testb %al, %al je 0x4237b movl 0x4(%rsp), %ecx movl (%rsp), %r8d leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6d8ee leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa leaq 0xc0(%rsp), %r14 movq %r14, %rdi callq 0x42e7a movq -0x30(%r14), %rdi testq %rdi, %rdi je 0x42327 movq 0xa0(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x78(%rsp), %rdi testq %rdi, %rdi je 0x42341 movq 0x88(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x60(%rsp), %rdi testq %rdi, %rdi je 0x42358 movq 0x70(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x40(%rsp), %rdi callq 0x4106a movb $0x1, %bpl movq %rbx, %rdi callq 0x4106a movl %ebp, %eax addq $0xe0, %rsp popq %rbx popq %r14 popq %rbp retq leaq 0x8(%rsp), %rdi leaq 0x4(%rsp), %rsi movq %rsp, %rdx callq 0x6dc71 testb %al, %al je 0x423bd movl 0x4(%rsp), %ecx movl (%rsp), %r8d leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6dd9d leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x424bc leaq 0x8(%rsp), %rdi leaq 0x4(%rsp), %rsi movq %rsp, %rdx callq 0x6e120 testb %al, %al je 0x423ff movl 0x4(%rsp), %ecx movl (%rsp), %r8d leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6e299 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x424bc leaq 0x8(%rsp), %rdi callq 0x6e637 testb %al, %al je 0x42431 leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6e769 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x424bc leaq 0x8(%rsp), %rdi callq 0x6e897 testb %al, %al je 0x42460 leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6e948 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x424bc leaq 0x8(%rsp), %rdi callq 0x6ebd7 testb %al, %al je 0x4248f leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6ec51 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa jmp 0x424bc leaq 0x8(%rsp), %rdi callq 0x6f05d testb %al, %al je 0x424cb leaq 0x28(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %r14, %rsi callq 0x6f0e2 leaq 0x28(%rsp), %rsi movq %r14, %rdi callq 0x750fa leaq 0x28(%rsp), %rdi callq 0x42c00 jmp 0x42362 xorl %ebp, %ebp jmp 0x42365 jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b jmp 0x424fa jmp 0x4250b movq %rax, %r14 leaq 0x28(%rsp), %rdi callq 0x42c00 jmp 0x4250e jmp 0x4250b movq %rax, %r14 movq %rbx, %rdi callq 0x4106a movq %r14, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamEncoder.cpp
generate_bitstream(TrackData&)
void generate_bitstream(TrackData& trackdata) { assert(trackdata.has_track()); // Special formats have special conversions (unless disabled) if (!opt.nospecial && generate_special(trackdata)) { // Fail if we've encountered a flux-only special format, as converting // it to bitstream is unlikely to give a working track. if (!trackdata.has_bitstream()) throw util::exception("no suitable bitstream representation for ", trackdata.cylhead); } else if (opt.nottb) throw util::exception("track to bitstream conversion not permitted for ", trackdata.cylhead); else if (!generate_simple(trackdata)) throw util::exception("bitstream conversion not yet implemented for ", trackdata.cylhead); }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx callq 0x74dee testb %al, %al je 0x42937 leaq 0x9ce4c(%rip), %r14 # 0xdf740 cmpl $0x0, 0xb4(%r14) jne 0x4291e movq %rbx, %rdi callq 0x421b4 testb %al, %al je 0x4291e movq %rbx, %rdi callq 0x74df4 testb %al, %al je 0x4298b addq $0x8, %rsp popq %rbx popq %r14 retq cmpl $0x0, 0xcc(%r14) jne 0x42956 movq %rbx, %rdi addq $0x8, %rsp popq %rbx popq %r14 jmp 0x4251e leaq 0x69534(%rip), %rdi # 0xabe72 leaq 0x69543(%rip), %rsi # 0xabe88 leaq 0x6959b(%rip), %rcx # 0xabee7 movl $0x74, %edx callq 0x35380 movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x695cc(%rip), %rsi # 0xabf36 movq %rax, %rdi movq %rbx, %rdx callq 0x42e04 leaq 0x99204(%rip), %rsi # 0xdbb80 movq 0x9a5fd(%rip), %rdx # 0xdcf80 movq %r14, %rdi callq 0x35a50 movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x6956d(%rip), %rsi # 0xabf0c movq %rax, %rdi movq %rbx, %rdx callq 0x42d8e jmp 0x42975 jmp 0x429ae movq %rax, %rbx movq %r14, %rdi callq 0x35430 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamEncoder.cpp
generate_flux(TrackData&)
void generate_flux(TrackData& trackdata) { uint8_t last_bit{ 0 }, curr_bit{ 0 }; auto& bitbuf = trackdata.bitstream(); auto ns_per_bitcell = bitcell_ns(bitbuf.datarate); bitbuf.seek(0); uint32_t flux_time{ 0 }; FluxData flux_data{}; std::vector<uint32_t> flux_times{}; flux_times.reserve(bitbuf.size()); while (!bitbuf.wrapped()) { auto next_bit{ bitbuf.read1() }; flux_time += ns_per_bitcell; if (curr_bit) { if (trackdata.cylhead.cyl < 40) { flux_times.push_back(flux_time); flux_time = 0; } else { auto pre_comp_ns{ (last_bit == next_bit) ? 0 : (last_bit ? +240 : -240) }; flux_times.push_back(flux_time + pre_comp_ns); flux_time = 0 - pre_comp_ns; } } last_bit = curr_bit; curr_bit = next_bit; if (bitbuf.index()) { flux_data.push_back(std::move(flux_times)); flux_times.clear(); } } if (flux_data.empty() || !flux_times.empty()) flux_data.push_back(std::move(flux_times)); trackdata.add(std::move(flux_data), true); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x58, %rsp movq %rdi, 0x50(%rsp) callq 0x74e48 movq %rax, %r14 movl (%rax), %eax cmpl $0x7a11f, %eax # imm = 0x7A11F jg 0x429fa cmpl $0x3d090, %eax # imm = 0x3D090 je 0x42a13 cmpl $0x493e0, %eax # imm = 0x493E0 jne 0x42a0f movl $0x683, %ebp # imm = 0x683 jmp 0x42a1f cmpl $0x7a120, %eax # imm = 0x7A120 je 0x42a1a cmpl $0xf4240, %eax # imm = 0xF4240 jne 0x42a0f movl $0x1f4, %ebp # imm = 0x1F4 jmp 0x42a1f xorl %ebp, %ebp jmp 0x42a1f movl $0x7d0, %ebp # imm = 0x7D0 jmp 0x42a1f movl $0x3e8, %ebp # imm = 0x3E8 xorl %ebx, %ebx movq %r14, %rdi xorl %esi, %esi callq 0x3807c movl $0x0, 0xc(%rsp) movq %rbx, 0x40(%rsp) xorps %xmm0, %xmm0 movaps %xmm0, 0x30(%rsp) movq %rbx, 0x20(%rsp) movaps %xmm0, 0x10(%rsp) movq %r14, %rdi callq 0x3806e movslq %eax, %rsi leaq 0x10(%rsp), %rdi callq 0x41106 xorl %r13d, %r13d xorl %r12d, %r12d movl %r13d, %r15d movq %r14, %rdi callq 0x38062 testb %al, %al jne 0x42b63 movq %r14, %rdi callq 0x38290 movl %eax, %r13d movl 0xc(%rsp), %eax addl %ebp, %eax movl %eax, 0xc(%rsp) testb %r15b, %r15b je 0x42b21 movq 0x50(%rsp), %rcx cmpl $0x27, (%rcx) jg 0x42ab9 movq 0x18(%rsp), %rsi cmpq 0x20(%rsp), %rsi je 0x42af3 movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x18(%rsp) jmp 0x42b02 testb %r12b, %r12b movl $0xf0, %ebx movl $0xffffff10, %ecx # imm = 0xFFFFFF10 cmovel %ecx, %ebx cmpb %r13b, %r12b movl $0x0, %ecx cmovel %ecx, %ebx addl %ebx, %eax movl %eax, 0x2c(%rsp) movq 0x18(%rsp), %rsi cmpq 0x20(%rsp), %rsi je 0x42b0c movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x18(%rsp) jmp 0x42b1b leaq 0x10(%rsp), %rdi leaq 0xc(%rsp), %rdx callq 0x411b8 movl $0x0, 0xc(%rsp) jmp 0x42b21 leaq 0x10(%rsp), %rdi leaq 0x2c(%rsp), %rdx callq 0x4361a negl %ebx movl %ebx, 0xc(%rsp) movq %r14, %rdi callq 0x38122 movl %r15d, %r12d testb %al, %al je 0x42a65 leaq 0x30(%rsp), %rdi leaq 0x10(%rsp), %rsi callq 0x436f6 movq 0x10(%rsp), %rax movl %r15d, %r12d cmpq %rax, 0x18(%rsp) je 0x42a65 movq %rax, 0x18(%rsp) movl %r15d, %r12d jmp 0x42a65 movq 0x30(%rsp), %rax cmpq 0x38(%rsp), %rax je 0x42b7b movq 0x10(%rsp), %rax cmpq 0x18(%rsp), %rax je 0x42b8a leaq 0x30(%rsp), %rdi leaq 0x10(%rsp), %rsi callq 0x436f6 leaq 0x30(%rsp), %rsi movq 0x50(%rsp), %rdi movl $0x1, %edx callq 0x74dd2 movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x42bb5 movq 0x20(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x30(%rsp), %rdi callq 0x42e7a addq $0x58, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x42bd4 jmp 0x42bd4 jmp 0x42bd4 movq %rax, %rbx movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x42bee movq 0x20(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x30(%rsp), %rdi callq 0x42e7a movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BitstreamEncoder.cpp
util::exception::exception<char const (&) [49], CylHead&>(char const (&) [49], CylHead&)
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x43512 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x42e41 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x98d60(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x42e71 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [44], Encoding const&, char const (&) [9]>(char const (&) [44], Encoding const&, char const (&) [9])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x1a0, %rsp # imm = 0x1A0 movq %rcx, %r14 movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %rbx leaq 0x28(%rsp), %r13 movq %r13, %rdi callq 0x35760 movq %r12, %rdi callq 0x35210 movq %r13, %rdi movq %r12, %rsi movq %rax, %rdx callq 0x356a0 movl (%r15), %eax leaq 0x4(%rsp), %rsi movl %eax, (%rsi) leaq 0x8(%rsp), %rdi callq 0x600df movq 0x8(%rsp), %rsi movq 0x10(%rsp), %rdx leaq 0x28(%rsp), %rdi callq 0x356a0 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x43260 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %r14, %rdi callq 0x35210 leaq 0x28(%rsp), %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x30(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x99cec(%rip), %rsi # 0xdcf78 leaq 0x28(%rsp), %rdi callq 0x352b0 leaq 0x98(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x1a0, %rsp # imm = 0x1A0 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x432d9 movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x432dc movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x432dc movq %rax, %rbx movq 0x99c95(%rip), %rsi # 0xdcf78 leaq 0x28(%rsp), %rdi callq 0x352b0 leaq 0x98(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [36], CylHead&>(char const (&) [36], CylHead&)
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x198, %rsp # imm = 0x198 movq %rdx, %r14 movq %rsi, %r15 movq %rdi, %rbx leaq 0x20(%rsp), %r12 movq %r12, %rdi callq 0x35760 movq %r15, %rdi callq 0x35210 movq %r12, %rdi movq %r15, %rsi movq %rax, %rdx callq 0x356a0 movl (%r14), %edx movl 0x4(%r14), %ecx leaq 0x68a91(%rip), %rsi # 0xabddb movq %rsp, %rdi xorl %eax, %eax callq 0x784cc movq (%rsp), %rsi movq 0x8(%rsp), %rdx leaq 0x20(%rsp), %rdi callq 0x356a0 leaq 0x10(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x43382 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x28(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x99be2(%rip), %rsi # 0xdcf78 leaq 0x20(%rsp), %rdi callq 0x352b0 leaq 0x90(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x198, %rsp # imm = 0x198 popq %rbx popq %r12 popq %r14 popq %r15 retq jmp 0x433e1 movq %rax, %rbx leaq 0x10(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x433e4 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x433e4 movq %rax, %rbx movq 0x99b8d(%rip), %rsi # 0xdcf78 leaq 0x20(%rsp), %rdi callq 0x352b0 leaq 0x90(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [49], CylHead&>(char const (&) [49], CylHead&)
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x198, %rsp # imm = 0x198 movq %rdx, %r14 movq %rsi, %r15 movq %rdi, %rbx leaq 0x20(%rsp), %r12 movq %r12, %rdi callq 0x35760 movq %r15, %rdi callq 0x35210 movq %r12, %rdi movq %r15, %rsi movq %rax, %rdx callq 0x356a0 movl (%r14), %edx movl 0x4(%r14), %ecx leaq 0x68881(%rip), %rsi # 0xabddb movq %rsp, %rdi xorl %eax, %eax callq 0x784cc movq (%rsp), %rsi movq 0x8(%rsp), %rdx leaq 0x20(%rsp), %rdi callq 0x356a0 leaq 0x10(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x43592 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x28(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x999d2(%rip), %rsi # 0xdcf78 leaq 0x20(%rsp), %rdi callq 0x352b0 leaq 0x90(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x198, %rsp # imm = 0x198 popq %rbx popq %r12 popq %r14 popq %r15 retq jmp 0x435f1 movq %rax, %rbx leaq 0x10(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x435f4 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x435f4 movq %rax, %rbx movq 0x9997d(%rip), %rsi # 0xdcf78 leaq 0x20(%rsp), %rdi callq 0x352b0 leaq 0x90(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
BlockDevice::Unlock()
void BlockDevice::Unlock() { #ifdef _WIN32 DWORD dwRet; // Anything to unlock? if (lLockHandles.size()) { for (auto p : lLockHandles) { if (p.first != INVALID_HANDLE_VALUE) CloseHandle(p.first); } lLockHandles.clear(); // Refresh the disk properties DeviceIoControl(hdev, IOCTL_DISK_UPDATE_PROPERTIES, nullptr, 0, nullptr, 0, &dwRet, nullptr); } #endif }
retq nop
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
bool BlockDevice::Open(const std::string& path, bool uncached) { auto flags = O_BINARY | (uncached ? O_DIRECT : 0); // Open as read-write, falling back on read-only if ((h = open(path.c_str(), O_RDWR | flags)) == -1 && (h = open(path.c_str(), O_RDONLY | flags)) == -1) { // Win32 has a second attempt at opening, via SAMdiskHelper #ifdef _WIN32 #define PIPENAME R"(\\.\pipe\SAMdiskHelper)" #define FN_OPEN 2 #pragma pack(push,1) struct PIPEMESSAGE { union { struct { DWORD dwMessage; char szPath[MAX_PATH]; } Input; struct { DWORD dwError; DWORD64 hDevice; } Output; }; }; #pragma pack(pop) DWORD dwRead; PIPEMESSAGE msg = {}; msg.Input.dwMessage = FN_OPEN; strncpy(msg.Input.szPath, path.c_str(), MAX_PATH - 1); if (CallNamedPipe(PIPENAME, &msg, sizeof(msg.Input), &msg, sizeof(msg.Output), &dwRead, NMPWAIT_NOWAIT)) { if (dwRead == sizeof(msg.Output) && msg.Output.dwError == 0) { // Wrap the Win32 handler in a CRT file handle h = _open_osfhandle((intptr_t)msg.Output.hDevice, 0); } else if (msg.Output.dwError != 0) { SetLastError(msg.Output.dwError); } } if (h == -1) #endif { return false; } } #ifdef _WIN32 DWORD dwRet; // Retrieve the Win32 file handle for IOCTL calls hdev = reinterpret_cast<HANDLE>(_get_osfhandle(h)); // Determine sector size DISK_GEOMETRY dg; if (DeviceIoControl(hdev, IOCTL_DISK_GET_DRIVE_GEOMETRY, nullptr, 0, &dg, sizeof(dg), &dwRet, nullptr) && dg.BytesPerSector) sector_size = dg.BytesPerSector; else sector_size = SECTOR_SIZE; // Determine byte size, and from that calculate sector count PARTITION_INFORMATION pi; if (DeviceIoControl(hdev, IOCTL_DISK_GET_PARTITION_INFO, nullptr, 0, &pi, sizeof(pi), &dwRet, nullptr)) { total_bytes = pi.PartitionLength.QuadPart; // HACK: round to an even number of sectors, to fix broken CF cards/readers total_bytes &= ~0x3ff; total_sectors = total_bytes / sector_size; #if 0 // ToDo: still needed? // Rather than clip to 32-bits, use the maximum value if (total_bytes > total_sectors* sector_size) total_sectors = (1LL << 32) - 1; #endif } #elif defined(BLKSSZGET) && defined(BLKGETSIZE64) if (ioctl(h, BLKSSZGET, &sector_size) < 0) sector_size = SECTOR_SIZE; if (ioctl(h, BLKGETSIZE64, &total_bytes) == 0) total_sectors = total_bytes / sector_size; #elif defined(HAVE_DISKARBITRATION_DISKARBITRATION_H) DASessionRef session = DASessionCreate(kCFAllocatorDefault); DADiskRef disk = DADiskCreateFromBSDName(kCFAllocatorDefault, session, path.c_str()); if (disk) { CFDictionaryRef diskInfo = DADiskCopyDescription(disk); if (diskInfo) { long long llSize = 0; int nBlockSize = SECTOR_SIZE; auto numMediaSize = static_cast<CFNumberRef>(CFDictionaryGetValue(diskInfo, kDADiskDescriptionMediaSizeKey)); auto numBlockSize = static_cast<CFNumberRef>(CFDictionaryGetValue(diskInfo, kDADiskDescriptionMediaBlockSizeKey)); CFNumberGetValue(numMediaSize, kCFNumberLongLongType, &llSize); CFNumberGetValue(numBlockSize, kCFNumberIntType, &nBlockSize); sector_size = nBlockSize; total_bytes = llSize; total_sectors = total_bytes / sector_size; CFRelease(diskInfo); } CFRelease(disk); CFRelease(session); } #endif // WIN32 else { if (IsFile(path)) { #ifdef _WIN32 SetLastError(ERROR_ACCESS_DENIED); #endif return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx movl %edx, %r15d movq %rsi, %r14 movq %rdi, %rbx shll $0xe, %r15d movq (%rsi), %rdi leal 0x2(%r15), %esi xorl %eax, %eax callq 0x35a70 movl %eax, 0x8(%rbx) cmpl $-0x1, %eax jne 0x43b6a movq (%r14), %rdi xorl %ebp, %ebp movl %r15d, %esi xorl %eax, %eax callq 0x35a70 movl %eax, 0x8(%rbx) cmpl $-0x1, %eax je 0x43c57 movl 0x8(%rbx), %edi leaq 0x18(%rbx), %r15 movl $0x1268, %esi # imm = 0x1268 movq %r15, %rdx xorl %eax, %eax callq 0x357f0 testl %eax, %eax jns 0x43b8b movl $0x200, (%r15) # imm = 0x200 movl 0x8(%rbx), %edi leaq 0x28(%rbx), %r12 movl $0x80081272, %esi # imm = 0x80081272 movq %r12, %rdx xorl %eax, %eax callq 0x357f0 testl %eax, %eax je 0x43bdc movq %r14, %rdi callq 0x76fdd testb %al, %al jne 0x43c55 movl $0x200, 0x18(%rbx) # imm = 0x200 movq %r14, %rdi callq 0x76f95 movslq 0x1c(%rbx), %rcx subq %rcx, %rax movq %rax, 0x28(%rbx) movslq 0x18(%rbx), %rcx cqto idivq %rcx movl %eax, %eax jmp 0x43be8 movq (%r12), %rax movslq (%r15), %rcx cqto idivq %rcx movq %rax, 0x20(%rbx) testq %rax, %rax je 0x43c55 movl 0x8(%rbx), %edi leaq 0x9b435(%rip), %rdx # 0xdf030 movl $0x30d, %esi # imm = 0x30D xorl %eax, %eax callq 0x357f0 testl %eax, %eax jne 0x43c2d movl $0x200, 0x90(%rbx) # imm = 0x200 leaq 0x94(%rbx), %rdi leaq 0x9b40d(%rip), %rsi # 0xdf030 movl $0x200, %edx # imm = 0x200 callq 0x354c0 cmpl $0x0, 0x14(%rbx) jne 0x43c48 leaq 0x14(%rbx), %rcx movq 0x20(%rbx), %rdi leaq 0xc(%rbx), %rsi leaq 0x10(%rbx), %rdx callq 0x77c05 movq %rbx, %rdi callq 0x43ca2 movb $0x1, %bpl jmp 0x43c57 xorl %ebp, %ebp movl %ebp, %eax popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::ReadIdentifyData(void*, IDENTIFYDEVICE&)
bool BlockDevice::ReadIdentifyData(HANDLE h_, IDENTIFYDEVICE& identify_) { #ifdef _WIN32 DWORD dwRet = 0; // Input is the identify command (0xEC) DWORD dwInSize = sizeof(SENDCMDINPARAMS) - 1; MEMORY memIn(dwInSize); SENDCMDINPARAMS* pIn = reinterpret_cast<SENDCMDINPARAMS*>(memIn.pb); pIn->irDriveRegs.bCommandReg = ID_CMD; // Output is a buffer for the identify data DWORD dwOutSize = sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1; MEMORY memOut(dwOutSize); SENDCMDOUTPARAMS* pOut = reinterpret_cast<SENDCMDOUTPARAMS*>(memOut.pb); pOut->cBufferSize = IDENTIFY_BUFFER_SIZE; // Read the identify data buffer, and copy to the caller's buffer if (DeviceIoControl(h_, SMART_RCV_DRIVE_DATA, pIn, dwInSize, pOut, dwOutSize, &dwRet, nullptr)) { memset(&identify_, 0, sizeof(identify_)); identify_.len = std::min(dwRet, static_cast<DWORD>(sizeof(identify_.byte))); memcpy(&identify_.byte, pOut->bBuffer, identify_.len); return true; } #else (void)h_; #endif // WIN32 #ifdef HAVE_LINUX_HDREG_H static struct hd_driveid hd; // ATA query if (!ioctl(h, HDIO_GET_IDENTITY, &hd)) { identify_.len = std::min(sizeof(hd), sizeof(identify_.byte)); memcpy(&identify_.byte, &hd, identify_.len); } #else (void)identify_; #endif return false; }
pushq %rbx movq %rdx, %rbx movl 0x8(%rdi), %edi leaq 0x9b3c0(%rip), %rdx # 0xdf030 movl $0x30d, %esi # imm = 0x30D xorl %eax, %eax callq 0x357f0 testl %eax, %eax jne 0x43c9e movl $0x200, (%rbx) # imm = 0x200 addq $0x4, %rbx leaq 0x9b39f(%rip), %rsi # 0xdf030 movl $0x200, %edx # imm = 0x200 movq %rbx, %rdi callq 0x354c0 xorl %eax, %eax popq %rbx retq
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::ReadMakeModelRevisionSerial(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BlockDevice::ReadMakeModelRevisionSerial(const std::string& path) { #ifdef _WIN32 (void)path; // unused MEMORY mem(512); PSTORAGE_DEVICE_DESCRIPTOR pDevDesc = reinterpret_cast<PSTORAGE_DEVICE_DESCRIPTOR>(mem.pb); pDevDesc->Size = static_cast<DWORD>(mem.size); STORAGE_PROPERTY_QUERY spq; spq.QueryType = PropertyStandardQuery; spq.PropertyId = StorageDeviceProperty; DWORD dwRet; HANDLE hdevice = reinterpret_cast<HANDLE>(_get_osfhandle(this->h)); if (DeviceIoControl(hdevice, IOCTL_STORAGE_QUERY_PROPERTY, &spq, sizeof(spq), pDevDesc, pDevDesc->Size, &dwRet, nullptr) && pDevDesc->ProductIdOffset) { // We've read something, so clear existing values strMakeModel = strFirmwareRevision = strSerialNumber = ""; if (pDevDesc->VendorIdOffset) { std::string s(reinterpret_cast<char*>(pDevDesc) + pDevDesc->VendorIdOffset); strMakeModel = util::trim(s); } if (pDevDesc->ProductIdOffset) { std::string s(reinterpret_cast<char*>(pDevDesc) + pDevDesc->ProductIdOffset); strMakeModel += util::trim(s); } if (pDevDesc->ProductRevisionOffset) { std::string s(reinterpret_cast<char*>(pDevDesc) + pDevDesc->ProductRevisionOffset); strFirmwareRevision = util::trim(s); } if (pDevDesc->SerialNumberOffset) { std::string s(reinterpret_cast<char*>(pDevDesc) + pDevDesc->SerialNumberOffset); strSerialNumber = util::trim(s); } return true; } #endif // WIN32 #ifdef HAVE_LINUX_HDREG_H (void)path; // unused static struct hd_driveid hd; // ATA query if (!ioctl(h, HDIO_GET_IDENTITY, &hd)) { std::string s = std::string(reinterpret_cast<const char*>(hd.model), 40); strMakeModel = util::trim(s); s = std::string(reinterpret_cast<const char*>(hd.serial_no), 20); strSerialNumber = util::trim(s); s = std::string(reinterpret_cast<const char*>(hd.fw_rev), 8); strFirmwareRevision = util::trim(s); return true; } #endif // HDIO_GET_IDENTITY #if defined(HAVE_SCSI_SCSI_H) && defined(HAVE_SCSI_SG_H) // SCSI query { uint8_t buf[96]; static const uint8_t cmdInquiry[] = { INQUIRY, 0, 0, 0, sizeof(buf), 0 }; static const uint8_t cmdSerial[] = { INQUIRY, 0x01, 0x80, 0, sizeof(buf), 0 }; // Read the device details if (ScsiCmd(h, cmdInquiry, sizeof(cmdInquiry), buf, sizeof(buf), true) == 0) { /* // Vendor identification (8-15) std::string s = std::string(reinterpret_cast<char*>(buf+8), 8); strMakeModel = util::trim(s); */ // Product identification (16-31) auto s = std::string(reinterpret_cast<char*>(buf + 16), 16); strMakeModel = util::trim(s); // Product revision level (32-35) s = std::string(reinterpret_cast<char*>(buf + 32), 4); strFirmwareRevision = util::trim(s); // Read the device serial number if (ScsiCmd(h, cmdSerial, sizeof(cmdSerial), buf, sizeof(buf), true) == 0) { if (buf[1] == 0x80) // Page 80h = Unit serial number { s = std::string(reinterpret_cast<char*>(buf + 4), buf[3]); strSerialNumber = util::trim(s); } } return true; } } #endif #if defined(HAVE_DISKARBITRATION_DISKARBITRATION_H) DASessionRef session = DASessionCreate(kCFAllocatorDefault); DADiskRef disk = DADiskCreateFromBSDName(kCFAllocatorDefault, session, path.c_str()); if (disk) { CFDictionaryRef diskInfo = DADiskCopyDescription(disk); if (diskInfo) { // Clear existing values strMakeModel = strFirmwareRevision = strSerialNumber = ""; auto strVendor = static_cast<CFStringRef>(CFDictionaryGetValue(diskInfo, kDADiskDescriptionDeviceVendorKey)); auto strModel = static_cast<CFStringRef>(CFDictionaryGetValue(diskInfo, kDADiskDescriptionDeviceModelKey)); auto strRevision = static_cast<CFStringRef>(CFDictionaryGetValue(diskInfo, kDADiskDescriptionDeviceRevisionKey)); if (strVendor) { std::string s = CFStringGetCStringPtr(strVendor, 0); strMakeModel = util::trim(s); } if (strModel) { std::string s = CFStringGetCStringPtr(strModel, 0); strMakeModel += util::trim(s); } if (strRevision) { std::string s = CFStringGetCStringPtr(strRevision, 0); strFirmwareRevision = util::trim(s); } CFRelease(diskInfo); } CFRelease(disk); CFRelease(session); } #endif // HAVE_DISKARBITRATION_DISKARBITRATION_H return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0xb0, %rsp movq %rdi, %rbx movl 0x8(%rdi), %edi leaq 0x9b572(%rip), %rdx # 0xdf230 movl $0x30d, %esi # imm = 0x30D xorl %eax, %eax callq 0x357f0 testl %eax, %eax je 0x43ec3 movl 0x8(%rbx), %esi movl $0x1, (%rsp) leaq 0x68351(%rip), %rdx # 0xac034 leaq 0x50(%rsp), %r8 movl $0x6, %ecx movl $0x60, %r9d callq 0x442fe testl %eax, %eax sete %bpl jne 0x44085 leaq 0x20(%rsp), %r15 movq %r15, -0x10(%r15) leaq 0x30(%rsp), %rsi movq $0x10, (%rsi) leaq 0x10(%rsp), %rdi xorl %edx, %edx callq 0x35ad0 leaq 0x10(%rsp), %rsi movq %rax, (%rsi) leaq 0x30(%rsp), %rdi movq (%rdi), %rcx movq %rcx, 0x10(%rsi) movaps 0x60(%rsp), %xmm0 movups %xmm0, (%rax) movq %rcx, 0x8(%rsi) movq (%rsi), %rax movb $0x0, (%rax,%rcx) callq 0x78744 leaq 0x30(%rbx), %rdi leaq 0x30(%rsp), %r14 movq %r14, %rsi callq 0x35700 movq (%r14), %rdi leaq 0x40(%rsp), %r12 cmpq %r12, %rdi je 0x43d7c movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x30(%rsp), %r14 movq %r12, (%r14) movl 0x70(%rsp), %eax movl %eax, 0x10(%r14) movq $0x4, 0x8(%r14) movb $0x0, 0x14(%r14) leaq 0x10(%rsp), %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x43dbb movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x30(%rsp), %rdi leaq 0x10(%rsp), %rsi callq 0x78744 leaq 0x70(%rbx), %rdi leaq 0x30(%rsp), %r14 movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x43df0 movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 movl 0x8(%rbx), %esi movl $0x1, (%rsp) leaq 0x68239(%rip), %rdx # 0xac03a leaq 0x50(%rsp), %r8 movl $0x6, %ecx movl $0x60, %r9d callq 0x442fe testl %eax, %eax jne 0x43ea3 movb 0x51(%rsp), %al negb %al jno 0x43ea3 leaq 0x54(%rsp), %rsi movzbl -0x1(%rsi), %eax leaq 0x30(%rsp), %rdi movq %r12, (%rdi) leaq (%rsp,%rax), %rdx addq $0x54, %rdx callq 0x445b8 leaq 0x10(%rsp), %rdi leaq 0x30(%rsp), %r14 movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x43e6b movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x30(%rsp), %rdi leaq 0x10(%rsp), %rsi callq 0x78744 addq $0x50, %rbx leaq 0x30(%rsp), %r14 movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x43ea3 movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x10(%rsp), %rdi cmpq %r15, %rdi je 0x44085 movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x44085 leaq 0x60(%rsp), %r15 movq %r15, -0x10(%r15) leaq 0x10(%rsp), %rsi movq $0x28, (%rsi) leaq 0x50(%rsp), %rdi xorl %edx, %edx callq 0x35ad0 leaq 0x50(%rsp), %rsi movq %rax, (%rsi) leaq 0x10(%rsp), %rdi movq (%rdi), %rcx movq %rcx, 0x10(%rsi) movq 0x9b387(%rip), %rdx # 0xdf286 movq %rdx, 0x20(%rax) movups 0x9b36c(%rip), %xmm0 # 0xdf276 movups %xmm0, 0x10(%rax) movups 0x9b351(%rip), %xmm0 # 0xdf266 movups %xmm0, (%rax) movq %rcx, 0x8(%rsi) movb $0x0, (%rax,%rcx) callq 0x78744 leaq 0x30(%rbx), %rdi leaq 0x10(%rsp), %r14 movq %r14, %rsi callq 0x35700 movq (%r14), %rdi leaq 0x20(%rsp), %r12 cmpq %r12, %rdi je 0x43f50 movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x10(%rsp), %rdi movq %r12, (%rdi) leaq 0x30(%rsp), %rsi movq $0x14, (%rsi) xorl %edx, %edx callq 0x35ad0 leaq 0x10(%rsp), %r14 movq %rax, (%r14) movq 0x30(%rsp), %rcx movq %rcx, 0x10(%r14) movl 0x9b2d2(%rip), %edx # 0xdf254 movl %edx, 0x10(%rax) movups 0x9b2b8(%rip), %xmm0 # 0xdf244 movups %xmm0, (%rax) movq %rcx, 0x8(%r14) movq (%r14), %rax movb $0x0, (%rax,%rcx) leaq 0x50(%rsp), %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x43fbc movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x10(%rsp), %rdi leaq 0x50(%rsp), %rsi callq 0x78744 leaq 0x50(%rbx), %rdi leaq 0x10(%rsp), %r14 movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x43ff1 movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x10(%rsp), %r14 movq %r12, (%r14) movq 0x9b25e(%rip), %rax # 0xdf25e movq %rax, 0x10(%r14) movq $0x8, 0x8(%r14) movb $0x0, 0x18(%r14) leaq 0x50(%rsp), %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x44033 movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x10(%rsp), %rdi leaq 0x50(%rsp), %rsi callq 0x78744 addq $0x70, %rbx leaq 0x10(%rsp), %r14 movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x4406b movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x50(%rsp), %rdi cmpq %r15, %rdi je 0x44082 movq 0x60(%rsp), %rsi incq %rsi callq 0x355d0 movb $0x1, %bpl movl %ebp, %eax addq $0xb0, %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq jmp 0x4409d jmp 0x4409d jmp 0x4409d movq %rax, %rbx movq 0x10(%rsp), %rdi cmpq %r15, %rdi je 0x440d8 movq 0x20(%rsp), %rsi jmp 0x440cb jmp 0x440d5 jmp 0x440b9 jmp 0x440b9 jmp 0x440b9 movq %rax, %rbx movq 0x50(%rsp), %rdi cmpq %r15, %rdi je 0x440d8 movq 0x60(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x440d8 movq %rax, %rbx movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::Lock()
bool BlockDevice::Lock() { #ifdef _WIN32 DWORD dwRet; std::vector<std::string> lVolumes = GetVolumeList(); // Logic from: http://www.techtalkz.com/microsoft-device-drivers/250612-lock-entire-disk-physicaldrive-fsctl_lock_volume.html#post983810 // Open and lock all volumes for (auto sVolume : lVolumes) { std::string sDevice = R"(\\.\)" + sVolume; // Open the volume HANDLE hdevice = CreateFile(sDevice.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); lLockHandles.push_back(std::make_pair(hdevice, sVolume)); // Lock the volume to give us exclusive access if (!DeviceIoControl(hdevice, FSCTL_LOCK_VOLUME, nullptr, 0, nullptr, 0, &dwRet, nullptr)) throw util::exception("failed to lock ", sVolume, " filesystem"); } // Discount volumes for (auto p : lLockHandles) { if (!DeviceIoControl(p.first, FSCTL_DISMOUNT_VOLUME, nullptr, 0, nullptr, 0, &dwRet, nullptr)) throw util::exception("failed to dismount ", p.second, " filesystem"); } #endif return true; }
movb $0x1, %al retq nop
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::GetVolumeList[abi:cxx11]() const
std::vector<std::string> BlockDevice::GetVolumeList() const { std::vector<std::string> lVolumes; #ifdef _WIN32 STORAGE_DEVICE_NUMBER sdn; DWORD dwRet; if (DeviceIoControl(hdev, IOCTL_STORAGE_GET_DEVICE_NUMBER, nullptr, 0, &sdn, sizeof(sdn), &dwRet, nullptr)) { DWORD dwDrives = GetLogicalDrives(); char szDrive[] = R"(\\.\X:)"; for (char i = 0; i < 26; ++i) { // Skip non-existent drives if (!(dwDrives & (1 << i))) continue; // Form the volume device path szDrive[4] = 'A' + i; // Open the volume without accessing the drive contents HANDLE hdevice = CreateFile(szDrive, 0, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); if (hdevice != INVALID_HANDLE_VALUE) { BYTE ab[256]; PVOLUME_DISK_EXTENTS pvde = reinterpret_cast<PVOLUME_DISK_EXTENTS>(ab); // Get the extents of the volume, which may span multiple physical drives if (DeviceIoControl(hdevice, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, nullptr, 0, pvde, sizeof(ab), &dwRet, nullptr)) { // Check each extent against the supplied drive number, and mark any matches for (DWORD u = 0; u < pvde->NumberOfDiskExtents; ++u) if (pvde->Extents[u].DiskNumber == sdn.DeviceNumber) lVolumes.push_back(szDrive + 4); } CloseHandle(hdevice); } } } #endif return lVolumes; }
movq %rdi, %rax xorps %xmm0, %xmm0 movups %xmm0, (%rdi) movq $0x0, 0x10(%rdi) retq
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::IsFileHDD(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BlockDevice::IsFileHDD(const std::string& path) { if (!IsFile(path)) return false; // Reject files under max image size, and those not an exact sector multiple if (FileSize(path) <= MAX_IMAGE_SIZE || (FileSize(path) & (SECTOR_SIZE - 1))) return false; // Appears valid return true; }
pushq %rbx movq %rdi, %rbx callq 0x76fdd testb %al, %al je 0x44193 movq %rbx, %rdi callq 0x76f95 cmpq $0x10000001, %rax # imm = 0x10000001 jge 0x44197 xorl %eax, %eax jmp 0x441a6 movq %rbx, %rdi callq 0x76f95 shlq $0x37, %rax sete %al popq %rbx retq
/simonowen[P]samdisk/src/BlockDevice.cpp
BlockDevice::GetDeviceList[abi:cxx11]()
std::vector<std::string> BlockDevice::GetDeviceList() { std::vector<std::string> vDevices; #ifdef _WIN32 for (int i = 0; i < 20; ++i) { std::string str = util::fmt(R"(\\.\PhysicalDrive%d)", i); HANDLE h = CreateFile(str.c_str(), 0, 0, nullptr, OPEN_EXISTING, 0, nullptr); if (h != INVALID_HANDLE_VALUE) { CloseHandle(h); vDevices.push_back(util::fmt("%d", i)); } } #elif defined(__linux__) for (int i = 0; i < 16; ++i) { char sz[32] = {}; snprintf(sz, sizeof(sz), "/dev/sd%c", 'a' + i); struct stat st; if (!stat(sz, &st) && S_ISBLK(st.st_mode)) vDevices.push_back(sz); } #else CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOMediaClass); if (matchingDict != nullptr) { CFDictionarySetValue(matchingDict, CFSTR(kIOMediaWholeKey), kCFBooleanTrue); // whole disk objects only io_iterator_t iter; if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter) == KERN_SUCCESS) { for (io_object_t nextMedia; (nextMedia = IOIteratorNext(iter)); IOObjectRelease(nextMedia)) { auto deviceRef = static_cast<CFStringRef>(IORegistryEntryCreateCFProperty(nextMedia, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0)); if (!deviceRef) continue; CFMutableStringRef pathRef = CFStringCreateMutable(kCFAllocatorDefault, 0); CFStringAppend(pathRef, CFSTR(_PATH_DEV)); CFStringAppend(pathRef, deviceRef); char bsdPath[PATH_MAX]; CFStringGetCString(pathRef, bsdPath, PATH_MAX, kCFStringEncodingUTF8); vDevices.push_back(bsdPath); CFRelease(pathRef); CFRelease(deviceRef); } } } #endif // Sort the list and return it std::sort(vDevices.begin(), vDevices.end()); return vDevices; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xd8, %rsp movq %rdi, %rbx xorps %xmm0, %xmm0 movups %xmm0, (%rdi) movq $0x0, 0x10(%rdi) movl $0x61, %ebp leaq 0x67e54(%rip), %r14 # 0xac02a leaq 0x20(%rsp), %r15 leaq 0x48(%rsp), %r12 movq %rsp, %r13 xorps %xmm0, %xmm0 movaps %xmm0, 0x30(%rsp) movaps %xmm0, 0x20(%rsp) movl $0x20, %esi movq %r15, %rdi movq %r14, %rdx movl %ebp, %ecx xorl %eax, %eax callq 0x35940 movq %r15, %rdi movq %r12, %rsi callq 0x35a60 testl %eax, %eax jne 0x4426f movl 0x60(%rsp), %eax movl $0xf000, %ecx # imm = 0xF000 andl %ecx, %eax cmpl $0x6000, %eax # imm = 0x6000 jne 0x4426f leaq 0x10(%rsp), %rax movq %rax, (%rsp) movq %r15, %rdi callq 0x35210 leaq (%rsp,%rax), %rdx addq $0x20, %rdx movq %r13, %rdi movq %r15, %rsi callq 0x445b8 movq %rbx, %rdi movq %r13, %rsi callq 0x44648 movq (%rsp), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x4426f movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 incl %ebp cmpl $0x71, %ebp jne 0x441e3 movq (%rbx), %r14 movq 0x8(%rbx), %r15 cmpq %r15, %r14 je 0x442b3 movq %r15, %rax subq %r14, %rax sarq $0x5, %rax bsrq %rax, %rdx xorl $0x3f, %edx addl %edx, %edx xorq $0x7e, %rdx movq %r14, %rdi movq %r15, %rsi callq 0x448af movq %r14, %rdi movq %r15, %rsi callq 0x44993 movq %rbx, %rax addq $0xd8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x442ea movq %rax, %r14 movq (%rsp), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x442ed movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x442ed movq %rax, %r14 movq %rbx, %rdi callq 0x44540 movq %r14, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/src/BlockDevice.cpp
FormatImage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Range)
bool FormatImage(const std::string& path, Range range) { auto disk = std::make_shared<Disk>(); if (!ReadImage(path, disk)) return false; ValidateRange(range, MAX_TRACKS, MAX_SIDES, 1, disk->cyls(), disk->heads()); // Start with MGT or ProDos format, but with automatic gap3. Format fmt{ !opt.cpm ? RegularFormat::MGT : RegularFormat::ProDos }; fmt.gap3 = 0; // Halve the default sector count in FM to ensure it fits. if (opt.encoding == Encoding::FM) fmt.sectors /= 2; // Allow everything to be overridden, but check it's sensible. fmt.Override(true); fmt.Validate(); util::cout << util::fmt("%s %s, %2u cyls, %u heads, %2u sectors/track, %4u bytes/sector\n", to_string(fmt.datarate).c_str(), to_string(fmt.encoding).c_str(), range.cyls(), range.heads(), fmt.sectors, fmt.sector_size()); range.each([&](const CylHead& cylhead) { Track track; track.format(cylhead, fmt); Message(msgStatus, "Formatting %s", CH(cylhead.cyl, cylhead.head)); disk->write(cylhead, std::move(track)); }, fmt.cyls_first); return WriteImage(path, disk); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xc8, %rsp movq %rdi, %r15 movq %rsi, 0x10(%rsp) movq %rdx, 0x18(%rsp) leaq 0x8(%rsp), %rdi movq $0x0, -0x8(%rdi) movq %rsp, %rbx leaq 0x4c(%rsp), %rdx movq %rbx, %rsi callq 0x4747e movq %r15, %rdi movq %rbx, %rsi movl $0x1, %edx callq 0x60f68 testb %al, %al je 0x4c6ed movq (%rsp), %rdi callq 0x54940 movl %eax, %ebp movq (%rsp), %rdi callq 0x54964 leaq 0x10(%rsp), %rdi movl $0x80, %esi movl $0x2, %edx movl $0x1, %ecx movl %ebp, %r8d movl %eax, %r9d callq 0x77d3f leaq 0x93207(%rip), %rbx # 0xdf740 xorl %esi, %esi cmpl $0x0, 0xe0(%rbx) setne %sil leaq 0x4c(%rsp), %rdi callq 0x5db04 movl $0x0, 0x80(%rsp) cmpl $0x2, 0x134(%rbx) jne 0x4c575 movl 0x60(%rsp), %eax movl %eax, %ecx shrl $0x1f, %ecx addl %eax, %ecx sarl %ecx movl %ecx, 0x60(%rsp) leaq 0x4c(%rsp), %rdi movl $0x1, %esi callq 0x5e9a2 leaq 0x4c(%rsp), %rdi callq 0x5e81a leaq 0x58(%rsp), %rsi leaq 0xa8(%rsp), %rdi callq 0x60054 movq 0xa8(%rsp), %r12 leaq 0x5c(%rsp), %rsi leaq 0x88(%rsp), %rdi callq 0x600df movq 0x88(%rsp), %r13 leaq 0x10(%rsp), %rdi callq 0x65908 movl %eax, %ebp leaq 0x10(%rsp), %rdi callq 0x6590e movl %eax, %r14d leaq 0x4c(%rsp), %rdi movl 0x14(%rdi), %ebx callq 0x5e0ee movl %eax, %r10d leaq 0x6040a(%rip), %rsi # 0xac9fc leaq 0x20(%rsp), %rdi movq %r12, %rdx movq %r13, %rcx movl %ebp, %r8d movl %r14d, %r9d xorl %eax, %eax pushq %r10 pushq %rbx callq 0x784cc addq $0x10, %rsp leaq 0x93c98(%rip), %rdi # 0xe02b0 leaq 0x20(%rsp), %rsi callq 0x3f60b movq %rsp, %r14 leaq 0x30(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x4c640 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x98(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x4c661 movq 0x98(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0xb8(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x4c682 movq 0xb8(%rsp), %rsi incq %rsi callq 0x355d0 xorps %xmm0, %xmm0 leaq 0x20(%rsp), %rsi movaps %xmm0, (%rsi) movaps %xmm0, 0x10(%rsi) leaq 0x4c(%rsp), %rax movq %rax, (%rsi) movq %r14, 0x8(%rsi) leaq 0x718(%rip), %rax # 0x4cdbc movq %rax, 0x18(%rsi) leaq 0x799(%rip), %rax # 0x4ce48 movq %rax, 0x10(%rsi) movzbl 0x85(%rsp), %edx leaq 0x10(%rsp), %rdi callq 0x659a2 movq 0x30(%rsp), %rax testq %rax, %rax je 0x4c6de leaq 0x20(%rsp), %rdi movq %rdi, %rsi movl $0x3, %edx callq *%rax movq %rsp, %rsi movq %r15, %rdi callq 0x61368 movl %eax, %ebx jmp 0x4c6ef xorl %ebx, %ebx movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x4c6fe callq 0x4740e movl %ebx, %eax addq $0xc8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x4c736 movq %rax, %rbx movq 0x30(%rsp), %rax testq %rax, %rax je 0x4c7b1 leaq 0x20(%rsp), %rdi movq %rdi, %rsi movl $0x3, %edx callq *%rax jmp 0x4c7b1 movq %rax, %rdi callq 0x410ac movq %rax, %rbx leaq 0x30(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x4c768 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x4c768 movq %rax, %rbx jmp 0x4c789 jmp 0x4c7ae movq %rax, %rbx leaq 0x98(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x4c789 movq 0x98(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0xb8(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x4c7b1 movq 0xb8(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x4c7b1 jmp 0x4c7ae movq %rax, %rbx movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x4c7c0 callq 0x4740e movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/cmd_format.cpp
UnformatImage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Range)
bool UnformatImage(const std::string& path, Range range) { auto disk = std::make_shared<Disk>(); if (!ReadImage(path, disk)) return false; ValidateRange(range, MAX_TRACKS, MAX_SIDES, 1, disk->cyls(), disk->heads()); range.each([&](const CylHead& cylhead) { Message(msgStatus, "Unformatting %s", CH(cylhead.cyl, cylhead.head)); disk->write(cylhead, Track()); }); return WriteImage(path, disk); }
pushq %rbp pushq %r14 pushq %rbx subq $0x40, %rsp movq %rdi, %rbx movq %rsi, 0x10(%rsp) movq %rdx, 0x18(%rsp) leaq 0x8(%rsp), %rdi movq $0x0, -0x8(%rdi) movq %rsp, %r14 leaq 0x20(%rsp), %rdx movq %r14, %rsi callq 0x4747e movq %rbx, %rdi movq %r14, %rsi movl $0x1, %edx callq 0x60f68 testb %al, %al je 0x4c8a1 movq (%rsp), %rdi callq 0x54940 movl %eax, %ebp movq (%rsp), %rdi callq 0x54964 leaq 0x10(%rsp), %rdi movl $0x80, %esi movl $0x2, %edx movl $0x1, %ecx movl %ebp, %r8d movl %eax, %r9d callq 0x77d3f xorps %xmm0, %xmm0 leaq 0x20(%rsp), %rsi movaps %xmm0, (%rsi) movaps %xmm0, 0x10(%rsi) movq %r14, (%rsi) leaq 0x612(%rip), %rax # 0x4ce70 movq %rax, 0x18(%rsi) leaq 0x67f(%rip), %rax # 0x4cee8 movq %rax, 0x10(%rsi) leaq 0x10(%rsp), %rdi xorl %edx, %edx callq 0x659a2 movq 0x30(%rsp), %rax testq %rax, %rax je 0x4c892 leaq 0x20(%rsp), %rdi movq %rdi, %rsi movl $0x3, %edx callq *%rax movq %rsp, %rsi movq %rbx, %rdi callq 0x61368 movl %eax, %ebx jmp 0x4c8a3 xorl %ebx, %ebx movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x4c8b2 callq 0x4740e movl %ebx, %eax addq $0x40, %rsp popq %rbx popq %r14 popq %rbp retq jmp 0x4c8dd movq %rax, %rbx movq 0x30(%rsp), %rax testq %rax, %rax je 0x4c8e8 leaq 0x20(%rsp), %rdi movq %rdi, %rsi movl $0x3, %edx callq *%rax jmp 0x4c8e8 movq %rax, %rdi callq 0x410ac movq %rax, %rbx movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x4c8f7 callq 0x4740e movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/cmd_format.cpp
util::exception::exception<char const (&) [32]>(char const (&) [32])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x53371 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x53339 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x88868(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x53369 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [32]>(char const (&) [32])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x89bbe(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x533e0 movq %rax, %rbx movq 0x89b8e(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [34]>(char const (&) [34])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x89b29(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x53475 movq %rax, %rbx movq 0x89af9(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
CRC16::init_crc_table()
void CRC16::init_crc_table() { if (!s_crc_lookup[0]) { for (uint16_t i = 0; i < 256; ++i) { uint16_t crc = i << 8; for (int j = 0; j < 8; ++j) crc = (crc << 1) ^ ((crc & 0x8000) ? POLYNOMIAL : 0); s_crc_lookup[i] = crc; } } }
cmpw $0x0, 0x8bfd0(%rip) # 0xdf4a2 jne 0x5350b xorl %eax, %eax leaq 0x8bfc5(%rip), %rcx # 0xdf4a2 movl %eax, %edx shll $0x8, %edx movl $0x8, %esi leal (%rdx,%rdx), %edi movswl %dx, %edx shrl $0xf, %edx andl $0x1021, %edx # imm = 0x1021 xorl %edi, %edx decl %esi jne 0x534e7 movw %dx, (%rcx,%rax,2) incq %rax cmpq $0x100, %rax # imm = 0x100 jne 0x534dd retq
/simonowen[P]samdisk/src/CRC16.cpp
CRC16::CRC16(void const*, unsigned long, unsigned short)
CRC16::CRC16(const void* buf, size_t len, uint16_t init_) { std::call_once(flag, init_crc_table); init(init_); add(buf, len); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movl %ecx, %ebp movq %rdx, %rbx movq %rsi, %r14 movq %rdi, %r15 movw $0xffff, (%rdi) # imm = 0xFFFF leaq 0x8c176(%rip), %rdi # 0xdf6a4 leaq -0x6b(%rip), %rsi # 0x534ca callq 0x53613 movw %bp, (%r15) testq %rbx, %rbx je 0x5356c xorl %eax, %eax leaq 0x8bf56(%rip), %rcx # 0xdf4a2 movzbl (%r14,%rax), %edx movzwl %bp, %esi shll $0x8, %ebp shrl $0x8, %esi xorl %edx, %esi xorw (%rcx,%rsi,2), %bp movw %bp, (%r15) incq %rax cmpq %rax, %rbx jne 0x5354c addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq nop
/simonowen[P]samdisk/src/CRC16.cpp
DemandDisk::read(CylHead const&, bool)
const TrackData& DemandDisk::read(const CylHead& cylhead, bool uncached) { if (uncached || !m_loaded[cylhead]) { // Quick first read, plus sector-based conversion auto trackdata = load(cylhead, true); auto& track = trackdata.track(); // If the disk supports sector-level retries we won't duplicate them. auto retries = supports_retries() ? 0 : opt.retries; auto rescans = opt.rescans; // Consider rescans and error retries. while (rescans > 0 || retries > 0) { // If no more rescans are required, stop when there's nothing to fix. if (rescans <= 0 && track.has_good_data()) break; auto rescan_trackdata = load(cylhead); auto& rescan_track = rescan_trackdata.track(); // If the rescan found more sectors, use the new track data. if (rescan_track.size() > track.size()) std::swap(trackdata, rescan_trackdata); // Flux reads include 5 revolutions, others just 1 auto revs = trackdata.has_flux() ? REMAIN_READ_REVS : 1; rescans -= revs; retries -= revs; } std::lock_guard<std::mutex> lock(m_trackdata_mutex); m_trackdata[cylhead] = std::move(trackdata); m_loaded[cylhead] = true; } return Disk::read(cylhead); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x188, %rsp # imm = 0x188 movq %rsi, %rbx movq %rdi, %r14 testl %edx, %edx jne 0x536de movq %rbx, %rdi callq 0x60728 cltq movq %rax, %rcx shrq $0x6, %rcx movq 0xf0(%r14,%rcx,8), %rcx btq %rax, %rcx jb 0x53a3e movq (%r14), %rax leaq 0x18(%rsp), %r15 movq %r15, %rdi movq %r14, %rsi movq %rbx, %rdx movl $0x1, %ecx callq *0x38(%rax) movq %r15, %rdi callq 0x74e16 movq %rax, %r15 movq (%r14), %rax movq %r14, %rdi callq *0x30(%rax) movq %rbx, 0x10(%rsp) leaq 0x8c029(%rip), %rcx # 0xdf740 xorl %ebx, %ebx testb %al, %al jne 0x53723 movl 0x11c(%rcx), %ebx movl 0x100(%rcx), %r12d testl %r12d, %r12d jg 0x53737 testl %ebx, %ebx jle 0x53833 leaq 0xd0(%rsp), %rbp testl %r12d, %r12d jg 0x53754 movq %r15, %rdi callq 0x71850 testb %al, %al jne 0x53833 movq (%r14), %rax movq %rbp, %rdi movq %r14, %rsi movq 0x10(%rsp), %rdx xorl %ecx, %ecx callq *0x38(%rax) movq %rbp, %rdi callq 0x74e16 movq %rax, %rdi callq 0x713fc movl %eax, %r13d movq %r15, %rdi callq 0x713fc cmpl %eax, %r13d jle 0x53794 leaq 0x18(%rsp), %rdi movq %rbp, %rsi callq 0x53bd0 leaq 0x18(%rsp), %rdi callq 0x74dfc movl %eax, %r13d leaq 0x168(%rsp), %rdi callq 0x42e7a movq 0x138(%rsp), %rdi testq %rdi, %rdi je 0x537cb movq 0x148(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x120(%rsp), %rdi testq %rdi, %rdi je 0x537e8 movq 0x130(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x108(%rsp), %rdi testq %rdi, %rdi je 0x53805 movq 0x118(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movzbl %r13b, %eax leal 0x1(,%rax,4), %eax subl %eax, %r12d subl %eax, %ebx leaq 0xe8(%rsp), %rdi callq 0x4106a testl %r12d, %r12d jg 0x5373f testl %ebx, %ebx jg 0x5373f leaq 0xc8(%r14), %rbx movq %rbx, %rdi callq 0x35890 testl %eax, %eax jne 0x53a5d movq %rbx, 0x8(%rsp) leaq 0x98(%r14), %rdi movq 0x10(%rsp), %rbx movq %rbx, %rsi callq 0x53b50 movq %rax, %r12 leaq 0x50(%rsp), %rbp movups -0x38(%rbp), %xmm0 movups %xmm0, (%rax) movq -0x28(%rbp), %rax movq %rax, 0x10(%r12) xorl %r15d, %r15d leaq 0xd0(%rsp), %r13 movq %r15, 0x10(%r13) xorps %xmm0, %xmm0 movaps %xmm0, (%r13) movq 0x18(%r12), %rax movups 0x20(%r12), %xmm0 movq -0x20(%rbp), %rcx movq %rcx, 0x18(%r12) movq -0x18(%rbp), %rcx movq %rcx, 0x20(%r12) movq -0x10(%rbp), %rcx movq %rcx, 0x28(%r12) movq (%r13), %rcx movq 0x8(%r13), %rdx movq 0x10(%r13), %rsi movq %rax, (%r13) movups %xmm0, 0x8(%r13) movq %rcx, -0x20(%rbp) movq %rdx, -0x18(%rbp) movq %rsi, -0x10(%rbp) movq %r13, %rdi callq 0x4106a movq -0x8(%rbp), %rax movq %rax, 0x30(%r12) leaq 0x38(%r12), %rdi movq %rbp, %rsi callq 0x3909e leaq 0x50(%r12), %rdi leaq 0x68(%rsp), %rsi callq 0x390de movq %r12, %rdi addq $0x68, %rdi leaq 0x80(%rsp), %rbp movq %rbp, %rsi callq 0x390de movb 0x28(%rbp), %al movb %al, 0x90(%r12) movups 0x18(%rbp), %xmm0 movups %xmm0, 0x80(%r12) movq %r15, 0x10(%r13) xorps %xmm0, %xmm0 movaps %xmm0, (%r13) movq 0x98(%r12), %rax movups 0xa0(%r12), %xmm0 movq 0x30(%rbp), %rcx movq %rcx, 0x98(%r12) movq 0x38(%rbp), %rcx movq %rcx, 0xa0(%r12) movq 0x40(%rbp), %rcx movq %rcx, 0xa8(%r12) movq (%r13), %rcx movq 0x8(%r13), %rdx movq 0x10(%r13), %rsi movq %rax, (%r13) movups %xmm0, 0x8(%r13) movq %rcx, 0x30(%rbp) movq %rdx, 0x38(%rbp) movq %rsi, 0x40(%rbp) leaq 0xd0(%rsp), %rdi callq 0x42e7a movb 0x48(%rbp), %al movb %al, 0xb0(%r12) movq %rbx, %rdi callq 0x60728 leaq 0xb0(%rsp), %r12 movslq %eax, %rdx movl $0x1, %esi movl %eax, %ecx shlq %cl, %rsi shrq $0x6, %rdx orq %rsi, 0xf0(%r14,%rdx,8) movq 0x8(%rsp), %rdi callq 0x35470 movq %r12, %rdi callq 0x42e7a movq -0x30(%r12), %rdi testq %rdi, %rdi je 0x53a04 movq 0x90(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x68(%rsp), %rdi testq %rdi, %rdi je 0x53a1b movq 0x78(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x30(%rsp), %r15 movq 0x20(%r15), %rdi testq %rdi, %rdi je 0x53a36 movq 0x60(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq %r15, %rdi callq 0x4106a movq %r14, %rdi movq %rbx, %rsi xorl %edx, %edx callq 0x54c7e addq $0x188, %rsp # imm = 0x188 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movl %eax, %edi callq 0x353b0 jmp 0x53a66 movq %rax, %rbx movq 0x8(%rsp), %rdi callq 0x35470 jmp 0x53a94 jmp 0x53a7f jmp 0x53a7f jmp 0x53a7f jmp 0x53a7f jmp 0x53a84 movq %rax, %rbx jmp 0x53a94 movq %rax, %rbx leaq 0xd0(%rsp), %rdi callq 0x42c00 leaq 0x18(%rsp), %rdi callq 0x42c00 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/DemandDisk.cpp
util::exception::exception<char const (&) [50]>(char const (&) [50])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x545dd movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x53f99 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x87c08(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x53fc9 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [50]>(char const (&) [50])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x88952(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x5464c movq %rax, %rbx movq 0x88922(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
util::exception::exception<char const (&) [24]>(char const (&) [24])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x5d513 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x5d4db movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x7e6c6(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x5d50b movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
FluxDecoder::FluxDecoder(std::vector<std::vector<unsigned int, std::allocator<unsigned int>>, std::allocator<std::vector<unsigned int, std::allocator<unsigned int>>>> const&, int, int, int)
FluxDecoder::FluxDecoder(const FluxData& flux_revs, int bitcell_ns, int flux_scale_percent, int pll_adjust) : m_flux_revs(flux_revs), m_clock(bitcell_ns), m_clock_centre(bitcell_ns), m_clock_min(bitcell_ns* (100 - pll_adjust) / 100), m_clock_max(bitcell_ns* (100 + pll_adjust) / 100), m_flux_scale_percent(flux_scale_percent), m_pll_adjust(pll_adjust) { assert(flux_revs.size()); m_rev_it = m_flux_revs.cbegin(); m_flux_it = (*m_rev_it).cbegin(); }
movq %rsi, (%rdi) xorps %xmm0, %xmm0 movups %xmm0, 0x8(%rdi) movl %edx, 0x18(%rdi) movl %edx, 0x1c(%rdi) movl $0x64, %eax subl %r8d, %eax imull %edx, %eax cltq imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F movq %rax, %r9 shrq $0x3f, %r9 sarq $0x25, %rax addl %r9d, %eax movl %eax, 0x20(%rdi) leal 0x64(%r8), %eax imull %edx, %eax cltq imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F movq %rax, %rdx shrq $0x3f, %rdx sarq $0x25, %rax addl %edx, %eax movl %eax, 0x24(%rdi) movq $0x0, 0x28(%rdi) movl %ecx, 0x30(%rdi) movl %r8d, 0x34(%rdi) movl $0x0, 0x38(%rdi) movw $0x0, 0x3c(%rdi) movq (%rsi), %rax cmpq %rax, 0x8(%rsi) je 0x5d6da movq %rax, 0x8(%rdi) movq (%rax), %rax movq %rax, 0x10(%rdi) retq pushq %rax leaq 0x50e54(%rip), %rdi # 0xae536 leaq 0x50e5e(%rip), %rsi # 0xae547 leaq 0x50eb1(%rip), %rcx # 0xae5a1 movl $0xf, %edx callq 0x35380
/simonowen[P]samdisk/src/FluxDecoder.cpp
FluxDecoder::flux_count() const
int FluxDecoder::flux_count() const { auto count = 0; for (const auto& vec : m_flux_revs) count += static_cast<int>(vec.size()); return count; }
movq (%rdi), %rax movq (%rax), %rcx movq 0x8(%rax), %rdx xorl %eax, %eax cmpq %rdx, %rcx je 0x5d734 movq 0x8(%rcx), %rsi subq (%rcx), %rsi shrq $0x2, %rsi addl %esi, %eax addq $0x18, %rcx jmp 0x5d71c retq nop
/simonowen[P]samdisk/src/FluxDecoder.cpp
FluxDecoder::next_bit()
int FluxDecoder::next_bit() { int new_flux; while (m_flux < m_clock / 2) { if ((new_flux = next_flux()) == -1) return -1; if (m_flux_scale_percent != 100) new_flux = new_flux * m_flux_scale_percent / 100; m_flux += new_flux; m_clocked_zeros = 0; } m_flux -= m_clock; if (m_flux >= m_clock / 2) { ++m_clocked_zeros; ++m_goodbits; return 0; } // PLL: Adjust clock frequency according to phase mismatch if (m_clocked_zeros <= 3) { // In sync: adjust base clock by percentage of phase mismatch m_clock += m_flux * m_pll_adjust / 100; } else { // Out of sync: adjust base clock towards centre m_clock += (m_clock_centre - m_clock) * m_pll_adjust / 100; // Require 256 good bits before reporting another loss of sync if (m_goodbits >= 256) m_sync_lost = true; m_goodbits = 0; } // Clamp the clock's adjustment range m_clock = std::min(std::max(m_clock_min, m_clock), m_clock_max); // Authentic PLL: Do not snap the timing window to each flux transition new_flux = m_flux * (100 - opt.pllphase) / 100; m_flux = new_flux; ++m_goodbits; return 1; }
pushq %rbx movq %rdi, %rbx movl 0x18(%rdi), %ecx movl 0x28(%rdi), %eax movl %ecx, %edx shrl $0x1f, %edx addl %ecx, %edx sarl %edx cmpl %edx, %eax jge 0x5d79e movq %rbx, %rdi callq 0x5d874 cmpl $-0x1, %eax je 0x5d7df movl 0x30(%rbx), %ecx cmpl $0x64, %ecx je 0x5d78c imull %eax, %ecx movslq %ecx, %rax imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F movq %rax, %rcx shrq $0x3f, %rcx sarq $0x25, %rax addl %ecx, %eax addl 0x28(%rbx), %eax movl %eax, 0x28(%rbx) movl $0x0, 0x2c(%rbx) movl 0x18(%rbx), %ecx jmp 0x5d750 subl %ecx, %eax movl %eax, 0x28(%rbx) movl 0x2c(%rbx), %esi cmpl %edx, %eax jge 0x5d7d3 cmpl $0x3, %esi jg 0x5d7e9 movl 0x34(%rbx), %edx imull %eax, %edx movslq %edx, %rdx imulq $0x51eb851f, %rdx, %rdx # imm = 0x51EB851F movq %rdx, %rsi shrq $0x3f, %rsi sarq $0x25, %rdx addl %esi, %edx addl %ecx, %edx movl %edx, 0x18(%rbx) jmp 0x5d824 incl %esi movl %esi, 0x2c(%rbx) xorl %eax, %eax jmp 0x5d86e movl $0xffffffff, %eax # imm = 0xFFFFFFFF jmp 0x5d871 movl 0x1c(%rbx), %edx movl 0x38(%rbx), %esi subl %ecx, %edx imull 0x34(%rbx), %edx movslq %edx, %rdx imulq $0x51eb851f, %rdx, %rdx # imm = 0x51EB851F movq %rdx, %rdi shrq $0x3f, %rdi sarq $0x25, %rdx addl %edi, %edx addl %ecx, %edx movl %edx, 0x18(%rbx) cmpl $0x100, %esi # imm = 0x100 jl 0x5d81d movb $0x1, 0x3d(%rbx) movl $0x0, 0x38(%rbx) movl 0x18(%rbx), %ecx movl 0x20(%rbx), %edx movl 0x24(%rbx), %esi cmpl %ecx, %edx cmovgl %edx, %ecx cmpl %ecx, %esi cmovll %esi, %ecx movl %ecx, 0x18(%rbx) leaq 0x81eff(%rip), %rcx # 0xdf740 movl $0x64, %edx subl 0x128(%rcx), %edx imull %eax, %edx movslq %edx, %rax imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F movq %rax, %rcx shrq $0x3f, %rcx sarq $0x25, %rax addl %ecx, %eax movl %eax, 0x28(%rbx) movl $0x1, %eax incl 0x38(%rbx) popq %rbx retq nop
/simonowen[P]samdisk/src/FluxDecoder.cpp
FluxTrackBuilder::FluxTrackBuilder(CylHead const&, DataRate, Encoding)
FluxTrackBuilder::FluxTrackBuilder(const CylHead& cylhead, DataRate datarate, Encoding encoding) : TrackBuilder(datarate, encoding), m_cylhead(cylhead), m_bitcell_ns(bitcell_ns(datarate)), m_flux_time(0U - m_bitcell_ns) { // We start with a negative cell time to absorb the first zero m_cur_bit. // This ensures the first reversal exactly matches the added data. }
pushq %rbp pushq %r14 pushq %rbx movl %edx, %ebp movq %rsi, %r14 movq %rdi, %rbx movl %edx, %esi movl %ecx, %edx callq 0x73520 leaq 0x7e948(%rip), %rax # 0xdc220 movq %rax, (%rbx) movq (%r14), %rax movq %rax, 0x14(%rbx) xorps %xmm0, %xmm0 movups %xmm0, 0x20(%rbx) movq $0x0, 0x30(%rbx) cmpl $0x7a11f, %ebp # imm = 0x7A11F jg 0x5d910 cmpl $0x3d090, %ebp # imm = 0x3D090 je 0x5d92b cmpl $0x493e0, %ebp # imm = 0x493E0 jne 0x5d927 movl $0x683, %eax # imm = 0x683 jmp 0x5d937 cmpl $0x7a120, %ebp # imm = 0x7A120 je 0x5d932 cmpl $0xf4240, %ebp # imm = 0xF4240 jne 0x5d927 movl $0x1f4, %eax # imm = 0x1F4 jmp 0x5d937 xorl %eax, %eax jmp 0x5d937 movl $0x7d0, %eax # imm = 0x7D0 jmp 0x5d937 movl $0x3e8, %eax # imm = 0x3E8 movl %eax, 0x38(%rbx) negl %eax movl %eax, 0x3c(%rbx) movw $0x0, 0x40(%rbx) popq %rbx popq %r14 popq %rbp retq
/simonowen[P]samdisk/src/FluxTrackBuilder.cpp
FluxTrackBuilder::addRawBit(bool)
void FluxTrackBuilder::addRawBit(bool next_bit) { m_flux_time += m_bitcell_ns; if (m_curr_bit) { if (m_cylhead.cyl < 40) { m_flux_times.push_back(m_flux_time); m_flux_time = 0; } else { // Move adjacent transitions further apart, to account for attraction when written. auto pre_comp_ns{ (m_last_bit == next_bit) ? 0 : (m_last_bit ? +PRECOMP_NS : -PRECOMP_NS) }; m_flux_times.push_back(m_flux_time + pre_comp_ns); m_flux_time = 0 - pre_comp_ns; } } m_last_bit = m_curr_bit; m_curr_bit = next_bit; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx movl 0x3c(%rdi), %eax addl 0x38(%rdi), %eax movl %esi, %ebp movl %eax, 0x3c(%rdi) cmpb $0x1, 0x41(%rdi) jne 0x5d9e3 leaq 0x3c(%rbx), %r14 cmpl $0x27, 0x14(%rbx) jg 0x5d985 movq 0x28(%rbx), %rsi cmpq 0x30(%rbx), %rsi je 0x5d9be movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x28(%rbx) jmp 0x5d9ca movb 0x40(%rbx), %cl testb %cl, %cl movl $0xf0, %edx movl $0xffffff10, %esi # imm = 0xFFFFFF10 cmovnel %edx, %esi xorl %r15d, %r15d cmpb %bpl, %cl cmovnel %esi, %r15d addl %r15d, %eax movl %eax, 0x4(%rsp) movq 0x28(%rbx), %rsi cmpq 0x30(%rbx), %rsi je 0x5d9cf movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x28(%rbx) jmp 0x5d9dd leaq 0x20(%rbx), %rdi movq %r14, %rdx callq 0x411b8 xorl %r15d, %r15d jmp 0x5d9e0 leaq 0x20(%rbx), %rdi leaq 0x4(%rsp), %rdx callq 0x4361a negl %r15d movl %r15d, (%r14) movb 0x41(%rbx), %al movb %al, 0x40(%rbx) movb %bpl, 0x41(%rbx) addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/simonowen[P]samdisk/src/FluxTrackBuilder.cpp
FluxTrackBuilder::addWeakBlock(int)
void FluxTrackBuilder::addWeakBlock(int length) { // Flush out previous constant block. addRawBit(1); addRawBit(1); // Approximately 11 ambigious reversals per weak byte. length = length * 21 / 2; while (length-- > 0) m_flux_times.push_back(m_bitcell_ns * 3 / 2); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movl %esi, %r14d movq %rdi, %rbx movl $0x1, %esi callq 0x5d94a movq %rbx, %rdi movl $0x1, %esi callq 0x5d94a testl %r14d, %r14d jle 0x5da6a leal (%r14,%r14,4), %eax leal (%r14,%rax,4), %ebp shrl %ebp leaq 0x20(%rbx), %r14 incl %ebp leaq 0x4(%rsp), %r15 movl 0x38(%rbx), %eax leal (%rax,%rax,2), %eax shrl %eax movl %eax, 0x4(%rsp) movq 0x28(%rbx), %rsi cmpq 0x30(%rbx), %rsi je 0x5da58 movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x28(%rbx) jmp 0x5da63 movq %r14, %rdi movq %r15, %rdx callq 0x4361a decl %ebp cmpl $0x1, %ebp jg 0x5da36 addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq nop
/simonowen[P]samdisk/src/FluxTrackBuilder.cpp
FluxTrackBuilder::buffer()
std::vector<uint32_t>& FluxTrackBuilder::buffer() { // Flush any buffered time with a transition. if (m_flux_time) { m_flux_times.push_back(m_flux_time); m_flux_time = 0; } return m_flux_times; }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx movl 0x3c(%rdi), %eax testl %eax, %eax je 0x5dab1 leaq 0x3c(%rbx), %r14 movq 0x28(%rbx), %rsi cmpq 0x30(%rbx), %rsi je 0x5da9e movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x28(%rbx) jmp 0x5daaa leaq 0x20(%rbx), %rdi movq %r14, %rdx callq 0x411b8 movl $0x0, (%r14) addq $0x20, %rbx movq %rbx, %rax addq $0x8, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/FluxTrackBuilder.cpp
Format::get_ids(CylHead const&) const
std::vector<int> Format::get_ids(const CylHead& cylhead) const { std::vector<bool> used(sectors); std::vector<int> ids(sectors); auto base_id = base; for (auto s = 0; s < sectors; ++s) { // Calculate the expected sector index using the interleave and skew auto index = (offset + s * interleave + skew * (cylhead.cyl)) % sectors; // Find a free slot starting from the expected position for (; used[index]; index = (index + 1) % sectors); used[index] = 1; // Assign the sector number, with offset adjustments ids[index] = base_id + s; } return ids; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x38, %rsp movq %rdx, %r14 movq %rsi, %r15 movq %rdi, %rbx movslq 0x14(%rsi), %rsi leaq 0x6(%rsp), %rdx movb $0x0, (%rdx) leaq 0x10(%rsp), %rdi leaq 0x7(%rsp), %rcx callq 0x5eba4 movslq 0x14(%r15), %rsi leaq 0x6(%rsp), %rdx movq %rbx, 0x8(%rsp) movq %rbx, %rdi callq 0x5eaa4 movl 0x14(%r15), %ebp testl %ebp, %ebp jle 0x5e2c2 movl 0x1c(%r15), %esi movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000 movq 0x10(%rsp), %r8 movq 0x8(%rsp), %rax movq (%rax), %r9 xorl %r10d, %r10d leaq 0x3f(%rdi), %r11 movl 0x24(%r15), %ecx imull %r10d, %ecx addl 0x20(%r15), %ecx movl (%r14), %eax imull 0x28(%r15), %eax addl %ecx, %eax cltd idivl %ebp movslq %edx, %rcx leaq 0x3f(%rcx), %rax testq %rcx, %rcx cmovnsq %rcx, %rax sarq $0x6, %rax movq %rcx, %rbx andq %r11, %rbx xorl %edx, %edx cmpq %rdi, %rbx setbe %dl movl $0x1, %r12d shlq %cl, %r12 leaq (%r8,%rax,8), %r13 movq -0x8(%r13,%rdx,8), %rbx leal 0x1(%rcx), %eax btq %rcx, %rbx jb 0x5e260 leaq -0x8(,%rdx,8), %rax orq %rbx, %r12 movq %r12, (%r13,%rax) leal (%r10,%rsi), %eax movl %eax, (%r9,%rcx,4) incl %r10d movl 0x14(%r15), %ebp cmpl %ebp, %r10d jl 0x5e24a movq 0x10(%rsp), %rdi testq %rdi, %rdi je 0x5e2f2 movq 0x30(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 xorl %eax, %eax movq %rax, 0x10(%rsp) movl %eax, 0x18(%rsp) movq %rax, 0x20(%rsp) movl %eax, 0x28(%rsp) movq %rax, 0x30(%rsp) movq 0x8(%rsp), %rax addq $0x38, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx movq 0x10(%rsp), %rsi testq %rsi, %rsi je 0x5e31d leaq 0x10(%rsp), %rdi callq 0x3613d movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/src/Format.cpp
Format::FromSize(long, Format&)
bool Format::FromSize(int64_t size, Format& fmt) { switch (size) { case 143360: // Apple ][ fmt = RegularFormat::DO; break; case 163840: // 5.25" SSSD (160K) fmt = RegularFormat::PC320; fmt.heads = 1; break; case 184320: // 5.25" SSSD (180K) fmt = RegularFormat::PC360; fmt.heads = 1; break; case 327680: // 5.25" DSDD (320K) fmt = RegularFormat::PC320; break; case 368640: // 5.25" DSDD (360K) fmt = RegularFormat::PC360; break; case 655360: // 3.5" DSDD (640K) fmt = RegularFormat::PC640; break; case 737280: // 3.5" DSDD (720K) fmt = RegularFormat::PC720; break; case 819200: // MGT (800K), for legacy matching. fmt = RegularFormat::MGT; break; case 1228800: // 5.25" DSHD (1200K) fmt = RegularFormat::PC1200; break; case 1261568: // 5.25" DSHD (1232K) fmt = RegularFormat::PC1232; break; case 1474560: // 3.5" DSHD (1440K) fmt = RegularFormat::PC1440; break; case 1638400: // 3.5" DSHD (1600K) fmt = RegularFormat::PC1440; fmt.sectors = 20; fmt.gap3 = 0; break; case 1720320: // 3.5" DSHD (1680K) fmt = RegularFormat::PC1440; fmt.sectors = 21; fmt.gap3 = 0; break; case 1763328: // 3.5" DSHD (1722K) fmt = RegularFormat::PC1440; fmt.cyls = 82; fmt.sectors = 21; fmt.gap3 = 0; break; case 1784832: // 3.5" DSHD (1743K) fmt = RegularFormat::PC1440; fmt.cyls = 83; fmt.sectors = 21; fmt.gap3 = 0; break; case 1802240: // 3.5" DSHD (1760K) fmt = RegularFormat::PC1440; fmt.sectors = 22; fmt.gap3 = 0; break; case 1884160: // 3.5" DSHD (1840K) fmt = RegularFormat::PC1440; fmt.sectors = 23; fmt.gap3 = 0; break; case 1966080: // 3.5" DSHD (1920K) fmt = RegularFormat::PC1440; fmt.sectors = 24; fmt.gap3 = 0; break; case 2949120: // 3.5" DSED (2880K) fmt = RegularFormat::PC2880; break; default: return false; } return true; }
xorl %eax, %eax cmpq $0x133fff, %rdi # imm = 0x133FFF jle 0x5e3ad cmpq $0x1b3bff, %rdi # imm = 0x1B3BFF jg 0x5e404 cmpq $0x18ffff, %rdi # imm = 0x18FFFF jle 0x5e51f cmpq $0x190000, %rdi # imm = 0x190000 je 0x5e71b cmpq $0x1a4000, %rdi # imm = 0x1A4000 je 0x5e678 cmpq $0x1ae800, %rdi # imm = 0x1AE800 jne 0x5e819 movaps 0x50387(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x50386(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) movl $0x52, (%rsi) jmp 0x5e802 cmpq $0x59fff, %rdi # imm = 0x59FFF jle 0x5e467 cmpq $0xb3fff, %rdi # imm = 0xB3FFF jle 0x5e4cc cmpq $0xb4000, %rdi # imm = 0xB4000 je 0x5e66f cmpq $0xc8000, %rdi # imm = 0xC8000 je 0x5e636 cmpq $0x12c000, %rdi # imm = 0x12C000 jne 0x5e819 movaps 0x5030b(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movaps 0x50351(%rip), %xmm0 # 0xae750 jmp 0x5e7a7 cmpq $0x1cbfff, %rdi # imm = 0x1CBFFF jle 0x5e568 cmpq $0x1cc000, %rdi # imm = 0x1CC000 je 0x5e75a cmpq $0x1e0000, %rdi # imm = 0x1E0000 je 0x5e6ad cmpq $0x2d0000, %rdi # imm = 0x2D0000 jne 0x5e819 movaps 0x50291(%rip), %xmm0 # 0xae6d0 movups %xmm0, (%rsi) movaps 0x50297(%rip), %xmm0 # 0xae6e0 movups %xmm0, 0x10(%rsi) movaps 0x5029c(%rip), %xmm0 # 0xae6f0 movups %xmm0, 0x20(%rsi) movabsq $0x5300000001, %rax # imm = 0x5300000001 jmp 0x5e7c0 cmpq $0x2cfff, %rdi # imm = 0x2CFFF jg 0x5e49c cmpq $0x23000, %rdi # imm = 0x23000 je 0x5e5c1 cmpq $0x28000, %rdi # imm = 0x28000 jne 0x5e819 movl $0x28, (%rsi) movaps 0x50339(%rip), %xmm0 # 0xae7d0 jmp 0x5e5f9 cmpq $0x2d000, %rdi # imm = 0x2D000 je 0x5e5ec cmpq $0x50000, %rdi # imm = 0x50000 jne 0x5e819 movaps 0x502f3(%rip), %xmm0 # 0xae7b0 movups %xmm0, (%rsi) movaps 0x502d9(%rip), %xmm0 # 0xae7a0 jmp 0x5e6fd cmpq $0x5a000, %rdi # imm = 0x5A000 je 0x5e6ec cmpq $0xa0000, %rdi # imm = 0xA0000 jne 0x5e819 movaps 0x50293(%rip), %xmm0 # 0xae780 movups %xmm0, (%rsi) movaps 0x502a9(%rip), %xmm0 # 0xae7a0 movups %xmm0, 0x10(%rsi) movaps 0x501ee(%rip), %xmm0 # 0xae6f0 movups %xmm0, 0x20(%rsi) movabsq $0x5000000001, %rax # imm = 0x5000000001 movq %rax, 0x30(%rsi) movw $0xe5, 0x38(%rsi) jmp 0x5e817 cmpq $0x134000, %rdi # imm = 0x134000 je 0x5e796 cmpq $0x168000, %rdi # imm = 0x168000 jne 0x5e819 movaps 0x501c0(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movaps 0x501d6(%rip), %xmm0 # 0xae720 movups %xmm0, 0x10(%rsi) movaps 0x5019b(%rip), %xmm0 # 0xae6f0 movups %xmm0, 0x20(%rsi) movabsq $0x6500000001, %rax # imm = 0x6500000001 jmp 0x5e7c0 cmpq $0x1b3c00, %rdi # imm = 0x1B3C00 je 0x5e7cc cmpq $0x1b8000, %rdi # imm = 0x1B8000 jne 0x5e819 movaps 0x50177(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x50176(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) movabsq $0x200000016, %rax # imm = 0x200000016 jmp 0x5e80c movaps 0x50218(%rip), %xmm0 # 0xae7e0 movups %xmm0, (%rsi) movaps 0x5021e(%rip), %xmm0 # 0xae7f0 movups %xmm0, 0x10(%rsi) movsd 0x50012(%rip), %xmm0 # 0xae5f0 movups %xmm0, 0x20(%rsi) movq $0x1, 0x30(%rsi) jmp 0x5e664 movl $0x28, (%rsi) movaps 0x501c7(%rip), %xmm0 # 0xae7c0 movups %xmm0, 0xc(%rsi) movaps 0x5010c(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movl $0x50, 0x34(%rsi) movw $0xf6, 0x38(%rsi) movabsq $0x100000001, %rax # imm = 0x100000001 movq %rax, 0x4(%rsi) jmp 0x5e817 movaps 0x50123(%rip), %xmm0 # 0xae760 movups %xmm0, (%rsi) movaps 0x50129(%rip), %xmm0 # 0xae770 movups %xmm0, 0x10(%rsi) movaps 0x5009e(%rip), %xmm0 # 0xae6f0 movups %xmm0, 0x20(%rsi) movabsq $0x1800000001, %rax # imm = 0x1800000001 movq %rax, 0x30(%rsi) movw $0x0, 0x38(%rsi) jmp 0x5e817 movaps 0x5010a(%rip), %xmm0 # 0xae780 jmp 0x5e6f3 movaps 0x50081(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x50080(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) jmp 0x5e802 movaps 0x5004c(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x5004b(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) movabsq $0x200000018, %rax # imm = 0x200000018 jmp 0x5e80c movaps 0x500bd(%rip), %xmm0 # 0xae7b0 movups %xmm0, (%rsi) movaps 0x50093(%rip), %xmm0 # 0xae790 movups %xmm0, 0x10(%rsi) movaps 0x4ffe8(%rip), %xmm0 # 0xae6f0 movups %xmm0, 0x20(%rsi) movabsq $0x5000000001, %rax # imm = 0x5000000001 jmp 0x5e7c0 movaps 0x4ffde(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x4ffdd(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) movabsq $0x200000014, %rax # imm = 0x200000014 jmp 0x5e80c movaps 0x4ff9f(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x4ff9e(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) movabsq $0x200000017, %rax # imm = 0x200000017 jmp 0x5e80c movaps 0x4ff93(%rip), %xmm0 # 0xae730 movups %xmm0, (%rsi) movaps 0x4ff99(%rip), %xmm0 # 0xae740 movups %xmm0, 0x10(%rsi) movaps 0x4ff3e(%rip), %xmm0 # 0xae6f0 movups %xmm0, 0x20(%rsi) movabsq $0x5400000001, %rax # imm = 0x5400000001 movq %rax, 0x30(%rsi) movw $0xf6, 0x38(%rsi) jmp 0x5e817 movaps 0x4ff2d(%rip), %xmm0 # 0xae700 movups %xmm0, (%rsi) movl $0x1, 0x10(%rsi) movaps 0x4ff2c(%rip), %xmm0 # 0xae710 movups %xmm0, 0x1c(%rsi) movabsq $0x100000000, %rax # imm = 0x100000000 movq %rax, 0x2c(%rsi) movw $0xf6, 0x38(%rsi) movl $0x53, (%rsi) movabsq $0x200000015, %rax # imm = 0x200000015 movq %rax, 0x14(%rsi) movl $0x0, 0x34(%rsi) movb $0x1, %al retq
/simonowen[P]samdisk/src/Format.cpp
Format::Override(bool)
void Format::Override(bool full_control/*=false*/) { if (full_control) { if (opt.range.cyls()) cyls = opt.range.cyls(); if (opt.range.heads()) heads = opt.range.heads(); if (opt.sectors != -1) sectors = opt.sectors; if (opt.size >= 0 && opt.size <= 7) size = opt.size; if (datarate == DataRate::Unknown) datarate = DataRate::_250K; if (encoding == Encoding::Unknown) encoding = Encoding::MFM; } // Merge any overrides from the command-line if (opt.fill >= 0) fill = static_cast<uint8_t>(opt.fill); if (opt.gap3 >= 0) gap3 = opt.gap3; if (opt.base != -1) base = opt.base; if (opt.interleave >= 0) interleave = opt.interleave; if (opt.skew >= 0) skew = opt.skew; if (opt.head0 != -1) head0 = opt.head0; if (opt.head1 != -1) head1 = opt.head1; if (opt.cylsfirst != -1) cyls_first = (opt.cylsfirst != 0); if (opt.datarate != DataRate::Unknown) datarate = opt.datarate; if (opt.encoding != Encoding::Unknown) encoding = opt.encoding; }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx testl %esi, %esi je 0x5ea23 leaq 0x80d8c(%rip), %rdi # 0xdf740 callq 0x65908 testl %eax, %eax je 0x5e9cb leaq 0x80d7c(%rip), %rdi # 0xdf740 callq 0x65908 movl %eax, (%rbx) leaq 0x80d6e(%rip), %r14 # 0xdf740 movq %r14, %rdi callq 0x6590e testl %eax, %eax je 0x5e9ed leaq 0x80d5b(%rip), %rdi # 0xdf740 callq 0x6590e movl %eax, 0x4(%rbx) movq 0x140(%r14), %rax cmpq $-0x1, %rax je 0x5e9fd movl %eax, 0x14(%rbx) movl 0x18(%r14), %eax cmpl $0x7, %eax ja 0x5ea09 movl %eax, 0x18(%rbx) cmpl $0x0, 0xc(%rbx) jne 0x5ea16 movl $0x3d090, 0xc(%rbx) # imm = 0x3D090 cmpl $0x0, 0x10(%rbx) jne 0x5ea23 movl $0x1, 0x10(%rbx) leaq 0x80d16(%rip), %rax # 0xdf740 movl 0x28(%rax), %ecx testl %ecx, %ecx js 0x5ea34 movb %cl, 0x38(%rbx) movl 0x1c(%rax), %ecx testl %ecx, %ecx js 0x5ea3e movl %ecx, 0x34(%rbx) movl 0x14(%rax), %ecx cmpl $-0x1, %ecx je 0x5ea49 movl %ecx, 0x1c(%rbx) movl 0x20(%rax), %ecx testl %ecx, %ecx js 0x5ea53 movl %ecx, 0x24(%rbx) movl 0x24(%rax), %ecx testl %ecx, %ecx js 0x5ea5d movl %ecx, 0x28(%rbx) movl 0x48(%rax), %ecx cmpl $-0x1, %ecx je 0x5ea68 movl %ecx, 0x2c(%rbx) movl 0x4c(%rax), %ecx cmpl $-0x1, %ecx je 0x5ea73 movl %ecx, 0x30(%rbx) movl 0x44(%rax), %ecx cmpl $-0x1, %ecx je 0x5ea81 testl %ecx, %ecx setne 0x39(%rbx) movl 0x138(%rax), %ecx testl %ecx, %ecx je 0x5ea8e movl %ecx, 0xc(%rbx) movl 0x134(%rax), %eax testl %eax, %eax je 0x5ea9b movl %eax, 0x10(%rbx) addq $0x8, %rsp popq %rbx popq %r14 retq nop
/simonowen[P]samdisk/src/Format.cpp
HDD::Reset()
void HDD::Reset() { h = -1; cyls = heads = sectors = 0; total_sectors = total_bytes = 0; sector_size = data_offset = 0; memset(&sIdentify, 0, sizeof(sIdentify)); strMakeModel = strSerialNumber = strFirmwareRevision = ""; }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx movl $0xffffffff, 0x8(%rdi) # imm = 0xFFFFFFFF addq $0x90, %rdi movl $0x204, %edx # imm = 0x204 xorl %esi, %esi callq 0x352d0 leaq 0x70(%rbx), %rdi xorps %xmm0, %xmm0 movups %xmm0, 0xc(%rbx) movups %xmm0, 0x1c(%rbx) movl $0x0, 0x2c(%rbx) movq 0x78(%rbx), %rdx leaq 0x4e13d(%rip), %rcx # 0xad081 xorl %esi, %esi xorl %r8d, %r8d callq 0x358f0 leaq 0x50(%rbx), %r14 movq %r14, %rdi movq %rax, %rsi callq 0x352c0 addq $0x30, %rbx movq %rbx, %rdi movq %r14, %rsi addq $0x8, %rsp popq %rbx popq %r14 jmp 0x352c0 nop
/simonowen[P]samdisk/src/HDD.cpp
HDD::Tell() const
int64_t HDD::Tell() const { #ifdef _WIN32 int64_t llOffset = _telli64(h) - data_offset; #else off_t llOffset = lseek(h, 0L, SEEK_CUR) - data_offset; #endif return llOffset / sector_size; }
pushq %rbx movq %rdi, %rbx movl 0x8(%rdi), %edi xorl %esi, %esi movl $0x1, %edx callq 0x354e0 movslq 0x1c(%rbx), %rcx subq %rcx, %rax movslq 0x18(%rbx), %rcx cqto idivq %rcx popq %rbx retq nop
/simonowen[P]samdisk/src/HDD.cpp
HDD::CreateDisk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, long, IDENTIFYDEVICE const*, bool)
std::shared_ptr<HDD> HDD::CreateDisk(const std::string& path, int64_t llTotalBytes_, const IDENTIFYDEVICE* pIdentify_, bool fOverwrite_) { std::shared_ptr<HDD> hdd; if (IsHddImage(path)) hdd = std::shared_ptr<HDD>(new HDFHDD()); if (hdd && !hdd->Create(path, llTotalBytes_, pIdentify_, fOverwrite_)) hdd.reset(); return hdd; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movl %r8d, %ebp movq %rcx, %r14 movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %rbx xorps %xmm0, %xmm0 movups %xmm0, (%rdi) movq %rsi, %rdi callq 0x77075 testb %al, %al je 0x5f038 movl $0x298, %edi # imm = 0x298 callq 0x355b0 movq %rax, %r13 movl $0x298, %edx # imm = 0x298 movq %rax, %rdi xorl %esi, %esi callq 0x352d0 movq %r13, %rdi callq 0x44394 leaq 0x7d36c(%rip), %rax # 0xdc360 addq $0x10, %rax movq %rax, (%r13) leaq 0x8(%rsp), %rdi movq %r13, -0x8(%rdi) movq %r13, %rsi callq 0x5fc40 movaps (%rsp), %xmm0 xorps %xmm1, %xmm1 movaps %xmm1, (%rsp) movq 0x8(%rbx), %rdi movups %xmm0, (%rbx) testq %rdi, %rdi je 0x5f029 callq 0x4740e movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x5f038 callq 0x4740e movq (%rbx), %rdi testq %rdi, %rdi je 0x5f06b movq (%rdi), %rax movzbl %bpl, %r8d movq %r12, %rsi movq %r15, %rdx movq %r14, %rcx callq *0x40(%rax) testb %al, %al jne 0x5f06b xorps %xmm0, %xmm0 movq 0x8(%rbx), %rdi movups %xmm0, (%rbx) testq %rdi, %rdi je 0x5f06b callq 0x4740e movq %rbx, %rax addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %r14 movl $0x298, %esi # imm = 0x298 movq %r13, %rdi callq 0x355d0 jmp 0x5f094 jmp 0x5f091 movq %rax, %r14 movq 0x8(%rbx), %rdi testq %rdi, %rdi je 0x5f0a2 callq 0x4740e movq %r14, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/HDD.cpp
HDD::SetIdentifyData(IDENTIFYDEVICE const*)
void HDD::SetIdentifyData(const IDENTIFYDEVICE* pIdentify_) { // Use any supplied identify data if (pIdentify_) { // Copy the supplied data memcpy(&sIdentify, pIdentify_, sizeof(sIdentify)); // Update CHS from the identify data cyls = sIdentify.word[1]; heads = sIdentify.word[3]; sectors = sIdentify.word[6]; // Invalidate the identify length if we're told to ignore it if (opt.noidentify) sIdentify.len = 0; } else { // Generate CHS values from the total sector count CalculateGeometry(total_sectors, cyls, heads, sectors); // Clear any existing data and set the full data size memset(&sIdentify, 0, sizeof(sIdentify)); sIdentify.len = sizeof(sIdentify.byte); sIdentify.word[0] = (1 << 6); // fixed device // CHS values sIdentify.word[1] = static_cast<uint16_t>(cyls); sIdentify.word[3] = static_cast<uint16_t>(heads); sIdentify.word[6] = static_cast<uint16_t>(sectors); // Form 8-character date string from SAMdisk build date, to use as firmware revision std::string strDate = util::fmt("%04u%02u%02u", YEAR, MONTH + 1, DAY); // Serial number, firmware revision and model number SetIdentifyString("", &sIdentify.word[10], 20); SetIdentifyString(strDate, &sIdentify.word[23], 8); SetIdentifyString("SAMdisk Device", &sIdentify.word[27], 40); sIdentify.word[47] = 1; // read/write multiple supports 1 sector blocks sIdentify.word[49] = (1 << 9); // LBA supported // Current override CHS values sIdentify.word[53] = (1 << 0); // words 54-58 are valid sIdentify.word[54] = sIdentify.word[1]; // current cyls sIdentify.word[55] = sIdentify.word[3]; // current heads sIdentify.word[56] = sIdentify.word[6]; // current sectors // Max CHS sector count is just C*H*S with maximum values for each auto uMaxSectorsCHS = 16383 * 16 * 63; auto uTotalSectorsCHS = (total_sectors > uMaxSectorsCHS) ? uMaxSectorsCHS : total_sectors; sIdentify.word[57] = static_cast<uint16_t>(uTotalSectorsCHS & 0xffff); sIdentify.word[58] = static_cast<uint16_t>((uTotalSectorsCHS >> 16) & 0xffff); // Max LBA28 sector count is 0x0fffffff auto uMaxSectorsLBA28 = (1 << 28) - 1; auto uTotalSectorsLBA28 = (total_sectors > uMaxSectorsLBA28) ? uMaxSectorsLBA28 : total_sectors; sIdentify.word[60] = uTotalSectorsLBA28 & 0xffff; sIdentify.word[61] = (uTotalSectorsLBA28 >> 16) & 0xffff; // Max LBA48 sector count is 0x0000ffffffffffff auto llTotalSectors = total_bytes / sector_size; auto llMaxSectorsLBA48 = (1LL << 48) - 1; auto llTotalSectorsLBA48 = (llTotalSectors > llMaxSectorsLBA48) ? llMaxSectorsLBA48 : llTotalSectors; sIdentify.word[100] = static_cast<uint16_t>(llTotalSectorsLBA48 & 0xffff); sIdentify.word[101] = static_cast<uint16_t>((llTotalSectorsLBA48 >> 16) & 0xffff); sIdentify.word[102] = static_cast<uint16_t>((llTotalSectorsLBA48 >> 32) & 0xffff); sIdentify.word[103] = 0; // If CFA ((CompactFlash Association) support isn't explicitly disabled, enable it if (!opt.nocfa) { sIdentify.word[0] = 0x848a; // special value used to indicate CFA feature set support sIdentify.word[83] |= (1 << 2) | (1 << 14); // CFA feature set supported, feature bits are valid sIdentify.word[84] |= (1 << 14); // indicate feature bits are valid sIdentify.word[86] |= (1 << 2); // CFA feature set enabled sIdentify.word[87] |= (1 << 14); // indicate features enabled are valid } } // Read the strings for serial number, firmware revision and make/model strSerialNumber = GetIdentifyString(&sIdentify.word[10], 20); strFirmwareRevision = GetIdentifyString(&sIdentify.word[23], 8); strMakeModel = GetIdentifyString(&sIdentify.word[27], 40); }
pushq %r15 pushq %r14 pushq %rbx subq $0x40, %rsp movq %rdi, %rbx testq %rsi, %rsi je 0x5f1e1 leaq 0x90(%rbx), %r14 movl $0x204, %edx # imm = 0x204 movq %r14, %rdi callq 0x354c0 movzwl 0x96(%rbx), %eax movl %eax, 0xc(%rbx) movzwl 0x9a(%rbx), %eax movl %eax, 0x10(%rbx) movzwl 0xa0(%rbx), %eax movl %eax, 0x14(%rbx) leaq 0x80578(%rip), %rax # 0xdf740 cmpl $0x0, 0xb0(%rax) je 0x5f48d movl $0x0, (%r14) jmp 0x5f48d movq 0x20(%rbx), %rdi leaq 0xc(%rbx), %rsi leaq 0x10(%rbx), %rdx leaq 0x14(%rbx), %rcx callq 0x77c05 leaq 0x90(%rbx), %rdi movl $0x204, %edx # imm = 0x204 xorl %esi, %esi callq 0x352d0 movl $0x200, 0x90(%rbx) # imm = 0x200 movw $0x40, 0x94(%rbx) movzwl 0xc(%rbx), %eax movzwl 0x10(%rbx), %ecx movw %ax, 0x96(%rbx) movw %cx, 0x9a(%rbx) movzwl 0x14(%rbx), %eax movw %ax, 0xa0(%rbx) leaq 0x4f76c(%rip), %rsi # 0xae9b0 movq %rsp, %rdi movl $0x7e9, %edx # imm = 0x7E9 movl $0x4, %ecx movl $0x1a, %r8d xorl %eax, %eax callq 0x784cc leaq 0x30(%rsp), %r14 movq %r14, -0x10(%r14) leaq 0x4de13(%rip), %rdx # 0xad081 leaq 0x20(%rsp), %rdi movq %rdx, %rsi callq 0x445b8 leaq 0xa8(%rbx), %rax movaps 0x4f707(%rip), %xmm0 # 0xae990 movups %xmm0, 0xa8(%rbx) movl $0x20202020, 0xb8(%rbx) # imm = 0x20202020 xorl %ecx, %ecx movq 0x20(%rsp), %rdi movb (%rdi,%rcx), %dl testb %dl, %dl je 0x5f2bb movq %rcx, %rsi xorq $0x1, %rsi movb %dl, (%rax,%rsi) incq %rcx cmpq $0x14, %rcx jne 0x5f2a1 cmpq %r14, %rdi je 0x5f2cd movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movabsq $0x2020202020202020, %r15 # imm = 0x2020202020202020 movq %r15, 0xc2(%rbx) xorl %eax, %eax movq (%rsp), %rcx movb (%rcx,%rax), %dl testb %dl, %dl je 0x5f302 movq %rax, %rsi xorq $0x1, %rsi movb %dl, 0xc2(%rbx,%rsi) incq %rax cmpq $0x8, %rax jne 0x5f2e4 leaq 0x20(%rsp), %rdi movq %r14, (%rdi) leaq 0x4f6ac(%rip), %rsi # 0xae9bd leaq 0x4f6b3(%rip), %rdx # 0xae9cb callq 0x445b8 leaq 0xca(%rbx), %rax movq %r15, 0xea(%rbx) movaps 0x4f65e(%rip), %xmm0 # 0xae990 movups %xmm0, 0xda(%rbx) movups %xmm0, 0xca(%rbx) xorl %ecx, %ecx movq 0x20(%rsp), %rdi movb (%rdi,%rcx), %dl testb %dl, %dl je 0x5f361 movq %rcx, %rsi xorq $0x1, %rsi movb %dl, (%rax,%rsi) incq %rcx cmpq $0x28, %rcx jne 0x5f347 cmpq %r14, %rdi je 0x5f373 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movw $0x1, %ax movw %ax, 0xf2(%rbx) movw $0x200, 0xf6(%rbx) # imm = 0x200 movw %ax, 0xfe(%rbx) movzwl 0x96(%rbx), %eax movw %ax, 0x100(%rbx) movzwl 0x9a(%rbx), %eax movw %ax, 0x102(%rbx) movzwl 0xa0(%rbx), %eax movw %ax, 0x104(%rbx) movq 0x20(%rbx), %rcx movq 0x28(%rbx), %rax movl $0xfbfc10, %edx # imm = 0xFBFC10 cmpq %rdx, %rcx cmovlq %rcx, %rdx movw %dx, 0x106(%rbx) shrl $0x10, %edx movw %dx, 0x108(%rbx) movl $0xfffffff, %edx # imm = 0xFFFFFFF cmpq %rdx, %rcx cmovlq %rcx, %rdx movw %dx, 0x10c(%rbx) shrl $0x10, %edx movw %dx, 0x10e(%rbx) movslq 0x18(%rbx), %rcx cqto idivq %rcx movabsq $0xffffffffffff, %rcx # imm = 0xFFFFFFFFFFFF cmpq %rcx, %rax cmovlq %rax, %rcx movw %cx, 0x15c(%rbx) movl %ecx, %eax shrl $0x10, %eax movw %ax, 0x15e(%rbx) shrq $0x20, %rcx movw %cx, 0x160(%rbx) movw $0x0, 0x162(%rbx) leaq 0x802fe(%rip), %rax # 0xdf740 cmpl $0x0, 0xac(%rax) jne 0x5f472 movw $0x848a, 0x94(%rbx) # imm = 0x848A orw $0x4004, 0x13a(%rbx) # imm = 0x4004 orb $0x40, 0x13d(%rbx) orb $0x4, 0x140(%rbx) orb $0x40, 0x143(%rbx) leaq 0x10(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x5f48d movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0xa8(%rbx), %rdx movq %rsp, %r14 movl $0x14, %ecx movq %r14, %rdi callq 0x5f5be leaq 0x50(%rbx), %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi leaq 0x10(%rsp), %r15 cmpq %r15, %rdi je 0x5f4ca movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0xc2(%rbx), %rdx movq %rsp, %r14 movl $0x8, %ecx movq %r14, %rdi callq 0x5f5be leaq 0x70(%rbx), %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r15, %rdi je 0x5f502 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0xca(%rbx), %rdx movq %rsp, %r14 movl $0x28, %ecx movq %r14, %rdi callq 0x5f5be addq $0x30, %rbx movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r15, %rdi je 0x5f53d movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 addq $0x40, %rsp popq %rbx popq %r14 popq %r15 retq jmp 0x5f549 movq %rax, %rbx leaq 0x10(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x5f567 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/src/HDD.cpp
HDD::GetIdentifyString[abi:cxx11](void*, unsigned long)
std::string HDD::GetIdentifyString(void* p, size_t n) { // Buffer length must be even n &= ~1; auto pcsz = reinterpret_cast<const char*>(p); std::string s(pcsz, n); // Copy the string, up to the size of the buffer for (size_t i = 0; i < n; i += 2) std::swap(s[i], s[i + 1]); // Trim leading and trailing spaces s = util::trim(s); return s; }
pushq %r15 pushq %r14 pushq %rbx subq $0x20, %rsp movq %rcx, %r14 movq %rdi, %rbx andq $-0x2, %r14 leaq 0x10(%rdi), %r15 movq %r15, (%rdi) leaq (%rdx,%r14), %rax movq %rdx, %rsi movq %rax, %rdx callq 0x445b8 testq %r14, %r14 je 0x5f60a xorl %eax, %eax movq (%rbx), %rcx movb (%rcx,%rax), %dl movb 0x1(%rcx,%rax), %sil movb %sil, (%rcx,%rax) movb %dl, 0x1(%rcx,%rax) addq $0x2, %rax cmpq %r14, %rax jb 0x5f5ee movq %rsp, %rdi movq %rbx, %rsi callq 0x78744 movq %rsp, %r14 movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x5f63d movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rax addq $0x20, %rsp popq %rbx popq %r14 popq %r15 retq movq %rax, %r14 movq (%rbx), %rdi cmpq %r15, %rdi je 0x5f660 movq (%r15), %rsi incq %rsi callq 0x355d0 movq %r14, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/HDD.cpp
HDD::Copy(HDD*, long, long, long, long, char const*)
bool HDD::Copy(HDD* phSrc_, int64_t uSectors_, int64_t uSrcOffset_/*=0*/, int64_t uDstOffset_/*=0*/, int64_t uTotal_/*=0*/, const char* pcszAction_) { MEMORY mem(SECTOR_BLOCK * sector_size); if (!uTotal_) uTotal_ = uSectors_; for (int64_t uPos = 0;;) { // Sync source and destinations if (phSrc_) phSrc_->Seek(uSrcOffset_ + uPos); Seek(uDstOffset_ + uPos); // Determine how much to transfer in one go if (uPos > uSectors_) uPos = uSectors_; auto uBlock = std::min(static_cast<int>(uSectors_ - uPos), SECTOR_BLOCK); Message(msgStatus, "%s... %d%%", pcszAction_ ? pcszAction_ : "Copying", static_cast<int>((static_cast<uint64_t>(uDstOffset_ + uPos) * 100 / uTotal_))); if (!uBlock) break; // Read from source disk auto uRead = phSrc_ ? phSrc_->Read(mem, uBlock) : uBlock; if (uRead != uBlock) { Message(msgStatus, "Read error at sector %lu: %s", uSrcOffset_ + uPos + uRead, LastError()); // Clear the bad block, but include it in the read data memset(mem + (uRead * sector_size), 0, sector_size); ++uRead; } // Forced byte-swapping? if (opt.byteswap) ByteSwap(mem, uRead * sector_size); // Write to target disk auto uWritten = Write(mem, uRead); if (uWritten != uRead) { Message(msgStatus, "Write error at sector %lu: %s", uDstOffset_ + uPos + uWritten, LastError()); // Skip past the write error ++uWritten; } // Advance by the amount written uPos += uWritten; } return true; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x48, %rsp movq %r9, %r14 movq %r8, %r15 movq %rcx, 0x30(%rsp) movq %rdx, %rbp movq %rsi, 0x20(%rsp) movq %rdi, %r12 movq 0x80(%rsp), %rbx movl 0x18(%rdi), %edi shll $0xb, %edi callq 0x77560 testq %r14, %r14 cmoveq %rbp, %r14 movq %r14, 0x40(%rsp) movq %r15, %r14 testq %rbx, %rbx leaq 0x4f302(%rip), %rcx # 0xae9ec cmovneq %rbx, %rcx movq %rcx, 0x38(%rsp) movq %rax, (%rsp) xorl %r13d, %r13d movq %r15, 0x28(%rsp) movq %rbp, 0x18(%rsp) movq 0x20(%rsp), %rdx testq %rdx, %rdx je 0x5f72f movq 0x30(%rsp), %rax addq %r13, %rax movslq 0x18(%rdx), %rcx imulq %rax, %rcx movslq 0x1c(%rdx), %rsi addq %rcx, %rsi movl 0x8(%rdx), %edi xorl %edx, %edx callq 0x354e0 leaq (%r14,%r13), %rax movslq 0x18(%r12), %rcx imulq %rax, %rcx movslq 0x1c(%r12), %rsi addq %rcx, %rsi movl 0x8(%r12), %edi xorl %edx, %edx callq 0x354e0 cmpq %rbp, %r13 jl 0x5f758 movq %rbp, %r13 movl %ebp, %r15d subl %r13d, %r15d movl $0x800, %eax # imm = 0x800 movl %r15d, %ebx cmpl %eax, %r15d jl 0x5f770 movl $0x800, %ebx # imm = 0x800 movq 0x38(%rsp), %rax movq %rax, 0x10(%rsp) leaq (%r14,%r13), %rbp imulq $0x64, %rbp, %rax xorl %edx, %edx divq 0x40(%rsp) movl %eax, 0x8(%rsp) xorl %edi, %edi leaq 0x4f24b(%rip), %rsi # 0xae9e1 leaq 0x10(%rsp), %rdx leaq 0x8(%rsp), %rcx callq 0x5f9b9 testl %r15d, %r15d je 0x5f895 movl %ebx, %r14d movq 0x20(%rsp), %rax testq %rax, %rax je 0x5f7e5 movl 0x18(%rax), %edx imull %ebx, %edx movl 0x8(%rax), %edi movq (%rsp), %rsi callq 0x35840 testq %rax, %rax jg 0x5f7d4 xorl %eax, %eax movq 0x20(%rsp), %rcx movslq 0x18(%rcx), %rcx cqto idivq %rcx movq %rax, %r14 cmpl %ebx, %r14d je 0x5f839 movq 0x30(%rsp), %rax addq %r13, %rax movslq %r14d, %rbx addq %rbx, %rax movq %rax, 0x10(%rsp) callq 0x76eae movq %rax, 0x8(%rsp) xorl %edi, %edi leaq 0x4f1e4(%rip), %rsi # 0xae9f4 leaq 0x10(%rsp), %rdx leaq 0x8(%rsp), %rcx callq 0x4d28b movslq 0x18(%r12), %rdx imulq %rdx, %rbx addq (%rsp), %rbx movq %rbx, %rdi xorl %esi, %esi callq 0x352d0 incl %r14d leaq 0x7ff00(%rip), %rax # 0xdf740 cmpl $0x0, 0x9c(%rax) je 0x5f85e movslq 0x18(%r12), %rax movslq %r14d, %rsi imulq %rax, %rsi movq (%rsp), %rdi callq 0x777c3 movl 0x18(%r12), %edx imull %r14d, %edx movl 0x8(%r12), %edi movq (%rsp), %rsi callq 0x35190 testq %rax, %rax jg 0x5f87c xorl %eax, %eax movslq 0x18(%r12), %rcx cqto idivq %rcx movq %rax, %rbx cmpl %ebx, %r14d jne 0x5f89c movq 0x28(%rsp), %r14 jmp 0x5f8d1 movq 0x18(%rsp), %rbp jmp 0x5f8dc movslq %ebx, %rax addq %rbp, %rax movq %rax, 0x10(%rsp) callq 0x76eae movq 0x28(%rsp), %r14 movq %rax, 0x8(%rsp) xorl %edi, %edi leaq 0x4f152(%rip), %rsi # 0xaea11 leaq 0x10(%rsp), %rdx leaq 0x8(%rsp), %rcx callq 0x4d28b incq %rbx movq 0x18(%rsp), %rbp movslq %ebx, %rax addq %rax, %r13 testl %r15d, %r15d jne 0x5f704 movq (%rsp), %rdi callq 0x775ea movb $0x1, %al addq $0x48, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x5f91d jmp 0x5f909 jmp 0x5f909 jmp 0x5f909 jmp 0x5f909 movq %rax, %rbx movq (%rsp), %rdi callq 0x775ea movq %rbx, %rdi callq 0x35aa0 movq %rax, %rdi callq 0x410ac nop
/simonowen[P]samdisk/src/HDD.cpp
void Message<char const*, int>(MsgType, char const*, char const*&&, int&&)
void Message(MsgType type, const char* pcsz_, Args&& ...args) { std::string msg = util::fmt(pcsz_, std::forward<Args>(args)...); if (type == msgError) throw util::exception(msg); if (type != msgStatus) { if (seen_messages.find(msg) != seen_messages.end()) return; seen_messages.insert(msg); } switch (type) { case msgStatus: break; case msgInfo: util::cout << "Info: "; break; case msgFix: util::cout << colour::GREEN << "Fixed: "; break; case msgWarning: util::cout << colour::YELLOW << "Warning: "; break; case msgError: util::cout << colour::RED << "Error: "; break; } if (type == msgStatus) util::cout << ttycmd::statusbegin << "\r" << msg << ttycmd::statusend; else util::cout << msg << colour::none << '\n'; }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %edi, %ebx movq (%rdx), %rdx movl (%rcx), %ecx leaq 0x8(%rsp), %rdi xorl %eax, %eax callq 0x784cc testl %ebx, %ebx je 0x5fab5 cmpl $0x4, %ebx je 0x5fb12 leaq 0x8040d(%rip), %r14 # 0xdfdf8 leaq 0x8(%rsp), %rsi movq %r14, %rdi callq 0x418a4 addq $0x8, %r14 cmpq %r14, %rax jne 0x5faef leaq 0x803ec(%rip), %rdi # 0xdfdf8 leaq 0x8(%rsp), %rsi callq 0x4192e cmpl $0x3, %ebx ja 0x5fa88 movl %ebx, %eax leaq 0x4ef7c(%rip), %rcx # 0xae9a0 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x8087c(%rip), %rdi # 0xe02b0 leaq 0x4c35d(%rip), %rsi # 0xabd98 callq 0x4172b jmp 0x5fa84 leaq 0x80867(%rip), %rdi # 0xe02b0 movl $0xa0, %esi callq 0x788ea leaq 0x4c345(%rip), %rsi # 0xabd9f movq %rax, %rdi callq 0x41794 jmp 0x5fa84 leaq 0x80845(%rip), %rdi # 0xe02b0 movl $0xa1, %esi callq 0x788ea leaq 0x4c32b(%rip), %rsi # 0xabda7 movq %rax, %rdi callq 0x405c6 testl %ebx, %ebx je 0x5fab5 leaq 0x80821(%rip), %rdi # 0xe02b0 leaq 0x8(%rsp), %rsi callq 0x3f60b movq %rax, %rdi xorl %esi, %esi callq 0x788ea leaq 0x7(%rsp), %rsi movb $0xa, (%rsi) movq %rax, %rdi callq 0x409e0 jmp 0x5faef leaq 0x807f4(%rip), %rdi # 0xe02b0 movl $0x2, %esi callq 0x7897a leaq 0x4f396(%rip), %rsi # 0xaee63 movq %rax, %rdi callq 0x38d1e leaq 0x8(%rsp), %rsi movq %rax, %rdi callq 0x3f60b movq %rax, %rdi movl $0x3, %esi callq 0x7897a leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x5fb0a movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 addq $0x28, %rsp popq %rbx popq %r14 retq movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x8(%rsp), %rsi movq %rax, %rdi callq 0x416b6 leaq 0x7c04d(%rip), %rsi # 0xdbb80 movq 0x7d446(%rip), %rdx # 0xdcf80 movq %r14, %rdi callq 0x35a50 jmp 0x5fb53 movq %rax, %rbx movq %r14, %rdi callq 0x35430 jmp 0x5fb56 jmp 0x5fb53 movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x5fb71 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/Util.h
HDFHDD::IsRecognised(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool HDFHDD::IsRecognised(const std::string& path) { int h = -1; RS_IDE sHeader = {}; // Open as read-write, falling back on read-only if ((h = open(path.c_str(), O_RDWR | O_BINARY)) == -1 && (h = open(path.c_str(), O_RDONLY | O_BINARY)) == -1) return false; // Read the file header and check the signature string if (read(h, &sHeader, sizeof(sHeader)) != sizeof(sHeader) || memcmp(sHeader.szSignature, "RS-IDE", sizeof(sHeader.szSignature))) { close(h); return false; } // Appears valid close(h); return true; }
pushq %rbp pushq %r14 pushq %rbx subq $0x20, %rsp movq %rdi, %r14 xorps %xmm0, %xmm0 movaps %xmm0, (%rsp) movq $0x0, 0xe(%rsp) movq (%rdi), %rdi movl $0x2, %esi xorl %eax, %eax callq 0x35a70 cmpl $-0x1, %eax jne 0x5fd32 movq (%r14), %rdi xorl %ebp, %ebp xorl %esi, %esi xorl %eax, %eax callq 0x35a70 cmpl $-0x1, %eax je 0x5fd6d movl %eax, %ebx movq %rsp, %rsi movl $0x16, %edx movl %eax, %edi callq 0x35840 cmpq $0x16, %rax jne 0x5fd64 movl $0x492d5352, %eax # imm = 0x492D5352 xorl (%rsp), %eax movzwl 0x4(%rsp), %ecx xorl $0x4544, %ecx # imm = 0x4544 orl %eax, %ecx sete %bpl jmp 0x5fd66 xorl %ebp, %ebp movl %ebx, %edi callq 0x35b90 movl %ebp, %eax addq $0x20, %rsp popq %rbx popq %r14 popq %rbp retq
/simonowen[P]samdisk/src/HDFHDD.cpp
HDFHDD::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
bool HDFHDD::Open(const std::string& path, bool /*uncached*/) { // Open as read-write, falling back on read-only if ((h = open(path.c_str(), O_RDWR | O_BINARY)) == -1 && (h = open(path.c_str(), O_RDONLY | O_BINARY)) == -1) return false; RS_IDE sHeader = {}; // Read the header and check for signature if (read(h, &sHeader, sizeof(sHeader)) == sizeof(sHeader) && !sHeader.bFlags && !memcmp(sHeader.szSignature, "RS-IDE", sizeof(sHeader.szSignature))) { // Read start of sector data, and determine identify length from that data_offset = (sHeader.bOffsetHigh << 8) | sHeader.bOffsetLow; sIdentify.len = data_offset - sizeof(sHeader); // Limit identify data size to a single sector if (sIdentify.len > SECTOR_SIZE) sIdentify.len = SECTOR_SIZE; // Read the identify data from the image if (read(h, sIdentify.byte, sIdentify.len) == static_cast<int>(sIdentify.len)) { // Sector size is fixed at 512 bytes sector_size = SECTOR_SIZE; // Byte and sector counts are taken from the file size (excluding the header) total_bytes = FileSize(path) - data_offset; total_sectors = static_cast<unsigned>(total_bytes / sector_size); // Update CHS from the identify data SetIdentifyData(&sIdentify); return true; } } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx subq $0x18, %rsp movq %rsi, %r14 movq %rdi, %rbx movq (%rsi), %rdi movl $0x2, %esi xorl %eax, %eax callq 0x35a70 movl %eax, 0x8(%rbx) cmpl $-0x1, %eax jne 0x5fdb9 movq (%r14), %rdi xorl %ebp, %ebp xorl %esi, %esi xorl %eax, %eax callq 0x35a70 movl %eax, 0x8(%rbx) cmpl $-0x1, %eax je 0x5fe83 xorps %xmm0, %xmm0 movq %rsp, %rsi movaps %xmm0, (%rsi) movq $0x0, 0xe(%rsi) movl 0x8(%rbx), %edi movl $0x16, %edx callq 0x35840 xorl %ebp, %ebp cmpq $0x16, %rax jne 0x5fe83 cmpb $0x0, 0x8(%rsp) jne 0x5fe83 movl $0x492d5352, %eax # imm = 0x492D5352 xorl (%rsp), %eax movzwl 0x4(%rsp), %ecx xorl $0x4544, %ecx # imm = 0x4544 orl %eax, %ecx jne 0x5fe81 movzwl 0x9(%rsp), %eax movl %eax, 0x1c(%rbx) leal -0x16(%rax), %ecx cmpl $0x217, %eax # imm = 0x217 movl $0x200, %eax # imm = 0x200 cmovbl %ecx, %eax movl %eax, 0x90(%rbx) movl 0x8(%rbx), %edi leaq 0x94(%rbx), %rsi movslq %eax, %rdx callq 0x35840 movslq 0x90(%rbx), %rcx cmpq %rcx, %rax jne 0x5fe81 leaq 0x90(%rbx), %r15 movl $0x200, 0x18(%rbx) # imm = 0x200 movq %r14, %rdi callq 0x76f95 movslq 0x1c(%rbx), %rcx subq %rcx, %rax movq %rax, 0x28(%rbx) movslq 0x18(%rbx), %rcx cqto idivq %rcx movl %eax, %eax movq %rax, 0x20(%rbx) movq %rbx, %rdi movq %r15, %rsi callq 0x5f17e movb $0x1, %bpl jmp 0x5fe83 xorl %ebp, %ebp movl %ebp, %eax addq $0x18, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/simonowen[P]samdisk/src/HDFHDD.cpp
HDFHDD::Create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long, IDENTIFYDEVICE const*, bool)
bool HDFHDD::Create(const std::string& path, uint64_t total_bytes_, const IDENTIFYDEVICE* pIdentify_, bool fOverwrite_/*=false*/) { bool fRet = true; if ((h = open(path.c_str(), O_CREAT | O_RDWR | O_SEQUENTIAL | O_BINARY | (fOverwrite_ ? 0 : O_EXCL), S_IREAD | S_IWRITE)) == -1) return false; // Set the new disk geometry data_offset = 0; sector_size = SECTOR_SIZE; total_bytes = total_bytes_; total_sectors = static_cast<unsigned>(total_bytes_ / sector_size); // Preserve the source identify data if it's complete, otherwise generate new if (pIdentify_ && pIdentify_->len == sizeof(*pIdentify_)) SetIdentifyData(pIdentify_); else SetIdentifyData(); // HDF v1.0 header RS_IDE sHeader = { {'R','S','-','I','D','E'}, 0x1a, 0x10, 0x00, 0,0, {} }; // Are we creating an HDF image? if (IsFileExt(path, "hdf")) { // Are we forced to use HDF v1.0? if (opt.hdf == 10) { // v1.0 has a 128-byte limit for the header+identify data sIdentify.len = 128 - sizeof(RS_IDE); } else { // v1.1 preserves all identify data, and has a new version number sHeader.bRevision = 0x11; } // Complete the HDD data offset now it's known data_offset = sizeof(RS_IDE) + sIdentify.len; sHeader.bOffsetLow = data_offset & 0xff; sHeader.bOffsetHigh = static_cast<uint8_t>(data_offset >> 8); } #ifdef _WIN32 HANDLE hfile = reinterpret_cast<HANDLE>(_get_osfhandle(h)); // Ensure there's space for the full file, then truncate and write just the header if (_lseeki64(h, total_bytes + data_offset, SEEK_SET) != static_cast<int64_t>(total_bytes + data_offset) || !SetEndOfFile(hfile) || _lseeki64(h, 0, SEEK_SET) != 0 || !SetEndOfFile(hfile)) fRet = false; #endif // If this is an HDF image, write the header and identity data if (fRet && data_offset && (write(h, &sHeader, sizeof(sHeader)) != sizeof(sHeader) || write(h, sIdentify.byte, sIdentify.len) != static_cast<int>(sIdentify.len))) fRet = false; // If anything went wrong, delete the (possibly partial) file if (!fRet) { close(h); h = -1; unlink(path.c_str()); } return fRet; }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x40, %rsp movq %rcx, %r15 movq %rdx, %r12 movq %rsi, %rbx movq %rdi, %r14 movq (%rsi), %rdi xorb $0x1, %r8b movzbl %r8b, %esi shll $0x7, %esi orl $0x42, %esi xorl %ebp, %ebp movl $0x180, %edx # imm = 0x180 xorl %eax, %eax callq 0x35a70 movl %eax, 0x8(%r14) cmpl $-0x1, %eax je 0x60009 movq $0x200, 0x18(%r14) # imm = 0x200 movq %r12, 0x28(%r14) shrq $0x9, %r12 movl %r12d, %eax movq %rax, 0x20(%r14) testq %r15, %r15 je 0x5ff01 cmpl $0x204, (%r15) # imm = 0x204 jne 0x5ff01 movq %r14, %rdi movq %r15, %rsi jmp 0x5ff06 movq %r14, %rdi xorl %esi, %esi callq 0x5f17e movups 0x4eba9(%rip), %xmm0 # 0xaeabb movaps %xmm0, (%rsp) movq $0x0, 0xe(%rsp) leaq 0x30(%rsp), %r12 movq %r12, -0x10(%r12) leaq 0x4eb87(%rip), %rsi # 0xaeab7 leaq 0x4eb83(%rip), %rdx # 0xaeaba leaq 0x20(%rsp), %r15 movq %r15, %rdi callq 0x445b8 movq %rbx, %rdi movq %r15, %rsi callq 0x77230 movl %eax, %ebp movq 0x20(%rsp), %rdi cmpq %r12, %rdi je 0x5ff68 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 testb %bpl, %bpl je 0x5ffa5 leaq 0x7f7cc(%rip), %rax # 0xdf740 cmpl $0xa, 0xd8(%rax) jne 0x5ff8a movl $0x6a, 0x90(%r14) jmp 0x5ff8f movb $0x11, 0x7(%rsp) movl 0x90(%r14), %eax addl $0x16, %eax movl %eax, 0x1c(%r14) movb %al, 0x9(%rsp) movb %ah, 0xa(%rsp) movb $0x1, %bpl cmpl $0x0, 0x1c(%r14) je 0x5ffeb movl 0x8(%r14), %edi movq %rsp, %rsi movl $0x16, %edx callq 0x35190 cmpq $0x16, %rax jne 0x5ffe9 movl 0x8(%r14), %edi leaq 0x94(%r14), %rsi movslq 0x90(%r14), %rdx callq 0x35190 movslq 0x90(%r14), %rcx cmpq %rcx, %rax je 0x5ffeb xorl %ebp, %ebp testb %bpl, %bpl jne 0x60009 movl 0x8(%r14), %edi callq 0x35b90 movl $0xffffffff, 0x8(%r14) # imm = 0xFFFFFFFF movq (%rbx), %rdi callq 0x35240 movl %ebp, %eax addq $0x40, %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx movq 0x20(%rsp), %rdi cmpq %r12, %rdi je 0x60032 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/HDFHDD.cpp
GetFormatGap(int, DataRate, Encoding, int, int)
int GetFormatGap(int drive_speed, DataRate datarate, Encoding encoding, int sectors, int size_) { if (!sectors) return 0; // Check for common formats that use specific gap sizes for (auto& fg : standard_gaps) { // If the format matches exactly, return the known gap if (fg.drivespeed == drive_speed && fg.datarate == datarate && fg.encoding == encoding && fg.sectors == sectors && fg.size == size_) return fg.gap3; } auto track_len = GetTrackCapacity(drive_speed, datarate, encoding) - GetTrackOverhead(encoding); auto chunk = track_len / sectors; auto overhead = Sector::SizeCodeToLength(size_) + GetSectorOverhead(encoding); auto gap3 = (chunk > overhead) ? chunk - overhead : 0; return (gap3 > MAX_GAP3) ? MAX_GAP3 : gap3; }
testl %ecx, %ecx je 0x60a47 pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx movl %r8d, %r14d movl %ecx, %ebx movl %edx, %ebp movl $0x14, %ecx xorl %edx, %edx leaq 0x4e326(%rip), %r8 # 0xaecc0 movb $0x1, %r9b cmpl %edi, -0x14(%rcx,%r8) jne 0x609c7 cmpl %esi, -0x10(%rcx,%r8) jne 0x609c7 cmpl %ebp, -0xc(%rcx,%r8) jne 0x609c7 cmpl %ebx, -0x8(%rcx,%r8) jne 0x609c7 cmpl %r14d, -0x4(%rcx,%r8) jne 0x609c7 movl (%rcx,%r8), %eax xorl %r9d, %r9d testb %r9b, %r9b je 0x609d9 addq $0x18, %rcx cmpq $0x5c, %rcx sete %dl jne 0x6099a testb $0x1, %dl je 0x60a3e movl %ebp, %edx callq 0x60887 imull $0x7cb, %eax, %eax # imm = 0x7CB cltq imulq $0x10624dd3, %rax, %r15 # imm = 0x10624DD3 movq %r15, %r12 sarq $0x27, %r12 shrq $0x3f, %r15 movl %r14d, %edi callq 0x6c57a movl %eax, %ecx leal 0x21(%rcx), %edx addl $0x3e, %ecx cmpl $0x1, %ebp leal -0x92(%r12,%r15), %esi leal -0x49(%r12,%r15), %eax cmovel %esi, %eax cmovnel %edx, %ecx cltd idivl %ebx movl %eax, %edx subl %ecx, %eax cmpl $0x52, %eax movl $0x52, %esi cmovll %eax, %esi xorl %eax, %eax cmpl %ecx, %edx cmovgl %esi, %eax popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq xorl %eax, %eax retq
/simonowen[P]samdisk/src/IBMPC.cpp
ReadImage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::shared_ptr<Disk>&, bool)
bool ReadImage(const std::string& path, std::shared_ptr<Disk>& disk, bool normalise) { MemFile file; bool f = false; if (path.empty()) throw util::exception("invalid empty path"); // Try devices first as the path may use a custom syntax for (auto p = aDeviceTypes; !f && p->pszType; ++p) { if (p->pfnRead) f = p->pfnRead(path, disk); } if (!f && IsDir(path)) throw util::exception("path is a directory"); // Next try regular files (and archives) if (!f) { if (!file.open(path, !opt.nozip)) return false; // Present the image to all types with read support for (auto p = aImageTypes; !f && p->pszType; ++p) { if (p->pfnRead) f = p->pfnRead(file, disk); } // Store the archive type the image was found in, if any if (f) { if (file.compression() != Compress::None) disk->metadata["archive"] = to_string(file.compression()); if (file.path().rfind(file.name()) + file.name().size() != file.path().size()) disk->metadata["filename"] = file.name(); } } #if 0 // Unwrap any sub-containers if (!f) f = UnwrapSDF(olddisk, disk); // MakeSDF image if (!f) f = UnwrapCPM(olddisk, disk); // BDOS CP/M record format #endif if (!f) throw util::exception("unrecognised disk image format"); if (normalise) { // ToDo: Make resize and flip optional? replace fNormalise) and fLoadFilter_? #if 0 // breaks with sub-ranges if (!opt.range.empty()) disk->resize(opt.range.cyls(), opt.range.heads()); #endif // Forcibly correct +3 boot loader problems? if (opt.fix == 1) FixPlus3BootLoader(disk); if (opt.flip) disk->flip_sides(); } #if 0 auto cyls = disk->cyls(), heads = disk->heads(); for (uint8_t head = 0; head < heads; ++head) { // Determine any forced head value for sectors on this track (-1 for none) int nHeadVal = head ? opt.head1 : opt.head0; // If nothing forced and we're using a regular format, use its head values if (nHeadVal == -1 && olddisk->format.sectors) nHeadVal = head ? olddisk->format.head1 : olddisk->format.head0; for (uint8_t cyl = 0; cyl < cyls; ++cyl) { PTRACK pt = disk->GetTrack(cyl, head); // Optionally normalise the track, to allow 'scan' to normalise on the fly if (fNormalise_) pt->Normalise(fLoadFilter_); // Forced head? if (nHeadVal != -1) { for (int i = 0; i < pt->sectors; ++i) pt->sector[i].head = nHeadVal; } } } #endif return f; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xb8, %rsp movl %edx, 0x4(%rsp) leaq 0x60(%rsp), %r13 movq %r13, -0x10(%r13) xorl %eax, %eax movq %rax, -0x8(%r13) movb %al, (%r13) leaq 0x80(%rsp), %rbp movq %rbp, -0x10(%rbp) movq %rax, -0x8(%rbp) movb %al, (%rbp) xorps %xmm0, %xmm0 movups %xmm0, 0x10(%rbp) movups %xmm0, 0x20(%rbp) movl $0x0, 0x30(%rbp) cmpq %rax, 0x8(%rdi) je 0x61281 movq %rsi, %rbx movq %rdi, %r15 leaq 0x7df84(%rip), %r12 # 0xdef50 xorl %r14d, %r14d cmpq $0x0, (%r12) je 0x6103e movq 0x8(%r12), %rax testq %rax, %rax je 0x60feb movq %r15, %rdi movq %rbx, %rsi callq *%rax movl %eax, %r14d addq $0x18, %r12 testb $0x1, %r14b je 0x60fcf testb $0x1, %r14b je 0x6129f movb $0x1, %r14b cmpb $0x0, 0x4(%rsp) je 0x6121e leaq 0x7e72c(%rip), %r15 # 0xdf740 cmpl $0x1, 0x5c(%r15) jne 0x61023 movq %rbx, %rdi callq 0x6f52a cmpl $0x0, 0x104(%r15) je 0x6121e movq (%rbx), %rdi callq 0x55258 jmp 0x6121e movq %r15, %rdi callq 0x77029 testb %al, %al jne 0x612bd leaq 0x7e6eb(%rip), %rax # 0xdf740 xorl %edx, %edx cmpl $0x0, 0xb8(%rax) sete %dl leaq 0x50(%rsp), %rdi movq %r15, %rsi callq 0x63f58 testb %al, %al je 0x6121b testb $0x1, %r14b jne 0x610b2 leaq 0x7da1d(%rip), %r12 # 0xdeaa0 leaq 0x50(%rsp), %r15 cmpq $0x0, (%r12) je 0x60ff5 movq 0x8(%r12), %rax testq %rax, %rax je 0x610a8 movq %r15, %rdi movq %rbx, %rsi callq *%rax movl %eax, %r14d addq $0x18, %r12 testb $0x1, %r14b je 0x61088 leaq 0x50(%rsp), %rdi callq 0x64ca8 testl %eax, %eax je 0x61154 leaq 0x50(%rsp), %rdi callq 0x64ca8 leaq 0x2c(%rsp), %rsi movl %eax, (%rsi) leaq 0x8(%rsp), %rdi callq 0x63ed8 movq (%rbx), %r15 leaq 0x40(%rsp), %r12 movq %r12, -0x10(%r12) leaq 0x4dc3c(%rip), %rsi # 0xaed2f leaq 0x4dc3c(%rip), %rdx # 0xaed36 leaq 0x30(%rsp), %rdi callq 0x445b8 addq $0x48, %r15 leaq 0x30(%rsp), %rsi movq %r15, %rdi callq 0x48d0c leaq 0x8(%rsp), %rsi movq %rax, %rdi callq 0x35700 movq 0x30(%rsp), %rdi cmpq %r12, %rdi je 0x61139 movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x61154 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x50(%rsp), %rdi callq 0x64c9e movq %rax, %r15 leaq 0x50(%rsp), %rdi callq 0x64ca2 movq (%rax), %rsi movq 0x8(%rax), %rcx movq %r15, %rdi movq $-0x1, %rdx callq 0x35790 movq %rax, %r15 leaq 0x50(%rsp), %rdi callq 0x64ca2 movq 0x8(%rax), %r12 leaq 0x50(%rsp), %rdi callq 0x64c9e addq %r15, %r12 cmpq 0x8(%rax), %r12 je 0x60ff5 leaq 0x50(%rsp), %rdi callq 0x64ca2 movq %rax, %r15 movq (%rbx), %r12 leaq 0x18(%rsp), %rax movq %rax, -0x10(%rax) leaq 0x4db6e(%rip), %rsi # 0xaed37 leaq 0x4db6f(%rip), %rdx # 0xaed3f leaq 0x8(%rsp), %rdi callq 0x445b8 addq $0x48, %r12 leaq 0x8(%rsp), %rsi movq %r12, %rdi callq 0x48d0c movq %rax, %rdi movq %r15, %rsi callq 0x352c0 movq 0x8(%rsp), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x60ff5 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x60ff5 xorl %r14d, %r14d movq 0x90(%rsp), %rdi testq %rdi, %rdi je 0x6123b movq 0xa0(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x70(%rsp), %rdi cmpq %rbp, %rdi je 0x61255 movq 0x80(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x50(%rsp), %rdi cmpq %r13, %rdi je 0x6126c movq 0x60(%rsp), %rsi incq %rsi callq 0x355d0 movl %r14d, %eax addq $0xb8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x4da73(%rip), %rsi # 0xaed08 movq %rax, %rdi callq 0x615f0 jmp 0x612d9 movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x4da8d(%rip), %rsi # 0xaed40 movq %rax, %rdi callq 0x61666 jmp 0x612d9 movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x4da4a(%rip), %rsi # 0xaed1b movq %rax, %rdi callq 0x4d44c leaq 0x7a8a0(%rip), %rsi # 0xdbb80 movq 0x7bc99(%rip), %rdx # 0xdcf80 movq %r14, %rdi callq 0x35a50 jmp 0x61353 movq %rax, %rbx movq 0x30(%rsp), %rdi cmpq %r12, %rdi je 0x61310 movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x61310 movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi jmp 0x61328 movq %rax, %rbx movq 0x8(%rsp), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x61356 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x61356 jmp 0x61353 jmp 0x61342 jmp 0x61342 movq %rax, %rbx movq %r14, %rdi callq 0x35430 jmp 0x61356 jmp 0x61353 jmp 0x61353 movq %rax, %rbx leaq 0x50(%rsp), %rdi callq 0x473c2 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/Image.cpp
util::exception::exception<char const (&) [25]>(char const (&) [25])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x61dbf movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x61719 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x7a488(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x61749 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::format<char const*, char const (&) [29]>(char const*, char const (&) [29])
std::string format(T arg, Args&&... args) { using namespace std; // pull in to_string for other types std::string s = to_string(arg) + format(std::forward<Args>(args)...); return s; }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x68, %rsp movq %rdx, %r14 movq %rdi, %rbx leaq 0x48(%rsp), %r15 leaq 0x7(%rsp), %rdx movq %r15, %rdi callq 0x5b424 leaq 0x38(%rsp), %r12 movq %r12, -0x10(%r12) movq (%r15), %rsi movq 0x8(%r15), %rdx addq %rsi, %rdx leaq 0x28(%rsp), %rdi callq 0x41ad6 leaq 0x8(%rsp), %rdi movq %r14, %rsi callq 0x61e54 movq 0x28(%rsp), %rcx movq 0x30(%rsp), %r8 movq 0x10(%rsp), %rdx leaq (%rdx,%r8), %rax movl $0xf, %esi cmpq %r12, %rcx je 0x617c1 movq 0x38(%rsp), %rsi cmpq %rsi, %rax jbe 0x617e0 leaq 0x18(%rsp), %rdi movl $0xf, %esi cmpq %rdi, -0x10(%rdi) je 0x617db movq 0x18(%rsp), %rsi cmpq %rsi, %rax jbe 0x617f1 movq 0x8(%rsp), %rsi leaq 0x28(%rsp), %rdi callq 0x35150 jmp 0x617ff leaq 0x8(%rsp), %rdi xorl %esi, %esi xorl %edx, %edx callq 0x35690 leaq 0x10(%rbx), %rdx movq %rdx, (%rbx) movq (%rax), %rsi leaq 0x10(%rax), %rcx cmpq %rcx, %rsi je 0x6181e movq %rsi, (%rbx) movq (%rcx), %rdx movq %rdx, 0x10(%rbx) jmp 0x61824 movups (%rcx), %xmm0 movups %xmm0, (%rdx) movq %rax, %rdx addq $0x8, %rdx movq 0x8(%rax), %rsi movq %rsi, 0x8(%rbx) movq %rcx, (%rax) movq $0x0, (%rdx) movb $0x0, (%rcx) leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x6185b movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x28(%rsp), %rdi cmpq %r12, %rdi je 0x61872 movq 0x38(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x58(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x6188d movq 0x58(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rax addq $0x68, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x618bf movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x618bf movq %rax, %rbx movq 0x28(%rsp), %rdi cmpq %r12, %rdi je 0x618db movq 0x38(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x618db movq %rax, %rbx leaq 0x58(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x618f6 movq 0x58(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
util::exception::exception<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&&)
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x61c07 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x6193b movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x7a266(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x6196b movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
util::exception::exception<char const (&) [45]>(char const (&) [45])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x61fd7 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x619ed movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x7a1b4(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x61a1d movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&&)
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq (%r14), %rsi movq 0x8(%r14), %rdx movq %r15, %rdi callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x7b32f(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x61c6f movq %rax, %rbx movq 0x7b2ff(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [19]>(char const (&) [19])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x7b29a(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x61d04 movq %rax, %rbx movq 0x7b26a(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [25]>(char const (&) [25])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x7b170(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x61e2e movq %rax, %rbx movq 0x7b140(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::format<char const*>(char const*)
std::string format(T arg, Args&&... args) { using namespace std; // pull in to_string for other types std::string s = to_string(arg) + format(std::forward<Args>(args)...); return s; }
pushq %r15 pushq %r14 pushq %rbx subq $0x70, %rsp movq %rdi, %rbx leaq 0x50(%rsp), %r14 leaq 0xf(%rsp), %rdx movq %r14, %rdi callq 0x5b424 leaq 0x20(%rsp), %r15 movq %r15, -0x10(%r15) movq (%r14), %rsi movq 0x8(%r14), %rdx addq %rsi, %rdx leaq 0x10(%rsp), %rdi callq 0x41ad6 leaq 0x40(%rsp), %r14 movq %r14, -0x10(%r14) movq $0x0, -0x8(%r14) movb $0x0, (%r14) movq 0x10(%rsp), %rcx movq 0x18(%rsp), %r8 movl $0xf, %eax cmpq %r15, %rcx je 0x61ebd movq 0x20(%rsp), %rax cmpq $0xf, %r8 ja 0x61ed8 cmpq %rax, %r8 jbe 0x61ed8 leaq 0x30(%rsp), %rdi xorl %esi, %esi xorl %edx, %edx callq 0x35690 jmp 0x61ee7 leaq 0x10(%rsp), %rdi movq %r14, %rsi xorl %edx, %edx callq 0x35150 leaq 0x10(%rbx), %rdx movq %rdx, (%rbx) movq (%rax), %rsi leaq 0x10(%rax), %rcx cmpq %rcx, %rsi je 0x61f06 movq %rsi, (%rbx) movq (%rcx), %rdx movq %rdx, 0x10(%rbx) jmp 0x61f0c movups (%rcx), %xmm0 movups %xmm0, (%rdx) movq %rax, %rdx addq $0x8, %rdx movq 0x8(%rax), %rsi movq %rsi, 0x8(%rbx) movq %rcx, (%rax) movq $0x0, (%rdx) movb $0x0, (%rcx) movq 0x30(%rsp), %rdi cmpq %r14, %rdi je 0x61f3f movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x10(%rsp), %rdi cmpq %r15, %rdi je 0x61f56 movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x60(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x61f71 movq 0x60(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rax addq $0x70, %rsp popq %rbx popq %r14 popq %r15 retq movq %rax, %rbx movq 0x30(%rsp), %rdi cmpq %r14, %rdi je 0x61f98 movq 0x40(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x10(%rsp), %rdi cmpq %r15, %rdi je 0x61fb4 movq 0x20(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x61fb4 movq %rax, %rbx leaq 0x60(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x61fcf movq 0x60(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
GetDeepThoughtDataOffset(Data const&)
int GetDeepThoughtDataOffset(const Data& data) { for (auto i = 0; i < data.size(); ++i) { // Check for 255 sync byte if (data[i] != 255) continue; // If 255 is followed by 42 we've found the data start if ((i + 2) < data.size() && data[i + 1] == 42) return i + 2; } // Not found return 0; }
movq (%rdi), %rcx movq 0x8(%rdi), %rdx subq %rcx, %rdx testl %edx, %edx jle 0x620a0 movl %edx, %esi andl $0x7fffffff, %esi # imm = 0x7FFFFFFF xorl %eax, %eax cmpb $-0x1, (%rcx,%rax) jne 0x62098 leal 0x2(%rax), %edi cmpl %edx, %edi jge 0x62098 cmpb $0x2a, 0x1(%rcx,%rax) je 0x620a3 incq %rax cmpq %rax, %rsi jne 0x62084 xorl %eax, %eax retq addl $0x2, %eax retq
/simonowen[P]samdisk/src/JupiterAce.cpp
GetDeepThoughtData[abi:cxx11](Data const&)
std::string GetDeepThoughtData(const Data& data) { std::string str; auto offset = GetDeepThoughtDataOffset(data); if (offset != 0) str = std::string(reinterpret_cast<const char*>(data.data() + offset), data.size() - offset); return str; }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x28, %rsp movq %rsi, %r14 movq %rdi, %rbx leaq 0x10(%rdi), %r15 movq %r15, (%rdi) movq $0x0, 0x8(%rdi) movb $0x0, 0x10(%rdi) movq %rsi, %rdi callq 0x6206c testl %eax, %eax je 0x62127 movq (%r14), %rcx movslq %eax, %rsi addq %rcx, %rsi movl 0x8(%r14), %edx subl %ecx, %edx subl %eax, %edx movslq %edx, %rdx leaq 0x18(%rsp), %r12 movq %r12, -0x10(%r12) addq %rsi, %rdx leaq 0x8(%rsp), %rdi callq 0x445b8 leaq 0x8(%rsp), %r14 movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x62127 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rax addq $0x28, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq movq %rax, %r14 movq (%rbx), %rdi cmpq %r15, %rdi je 0x6214c movq (%r15), %rsi incq %rsi callq 0x355d0 movq %r14, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/JupiterAce.cpp
IsDeepThoughtDisk(Disk&, Sector const*&)
bool IsDeepThoughtDisk(Disk& disk, const Sector*& sector) { // Try the primary catalogue location on cyl 0 if (!disk.find(Header(0, 0, 0, SizeToCode(4096)), sector)) { // Try the backup location on cyl 1 if (!disk.find(Header(1, 0, 0, SizeToCode(4096)), sector)) return false; } return true; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx subq $0x18, %rsp movq %rsi, %rbx movq %rdi, %r14 movl $0x1000, %edi # imm = 0x1000 callq 0x77ea2 leaq 0x8(%rsp), %r15 movq %r15, %rdi xorl %esi, %esi xorl %edx, %edx xorl %ecx, %ecx movl %eax, %r8d callq 0x60752 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx callq 0x55642 testb %al, %al jne 0x62219 movl $0x1000, %edi # imm = 0x1000 callq 0x77ea2 leaq 0x8(%rsp), %r15 xorl %ebp, %ebp movq %r15, %rdi movl $0x1, %esi xorl %edx, %edx xorl %ecx, %ecx movl %eax, %r8d callq 0x60752 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx callq 0x55642 testb %al, %al je 0x6221c movb $0x1, %bpl movl %ebp, %eax addq $0x18, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/simonowen[P]samdisk/src/JupiterAce.cpp
IsValidDeepThoughtData(Data const&)
bool IsValidDeepThoughtData(const Data& data) { auto offset = GetDeepThoughtDataOffset(data); if (!offset || offset == data.size()) return false; uint8_t sum = 0; for (auto i = offset; i < data.size() - 1; ++i) sum += data[i]; return sum == data[data.size() - 1]; }
pushq %rbx movq %rdi, %rbx callq 0x6206c testl %eax, %eax je 0x62242 movl 0x8(%rbx), %edx movq (%rbx), %rcx subl %ecx, %edx cmpl %edx, %eax jne 0x62246 xorl %eax, %eax jmp 0x6226d movslq %edx, %rdx decq %rdx cmpl %edx, %eax jge 0x62265 movslq %eax, %rsi movslq %edx, %rdi xorl %eax, %eax addb (%rcx,%rsi), %al incq %rsi cmpq %rdi, %rsi jl 0x62258 jmp 0x62267 xorl %eax, %eax cmpb (%rcx,%rdx), %al sete %al popq %rbx retq nop
/simonowen[P]samdisk/src/JupiterAce.cpp
KryoFlux::UploadFirmware()
void KryoFlux::UploadFirmware() { // Set interactive then non-interactive mode, to check for boot responses // https://sourceforge.net/p/lejos/wiki-nxt/SAM-BA%20Protocol/ SamBaCommand("T#", ">"); SamBaCommand("N#", "\n\r"); auto fwpath = util::resource_dir() + KF_FW_FILE; std::ifstream fwfile(fwpath, std::ios::binary); if (!fwfile) throw posix_error(errno, fwpath.c_str()); auto fwdata = std::vector<uint8_t>(std::istreambuf_iterator<char>(fwfile), std::istreambuf_iterator<char>()); auto fwsize = static_cast<int>(fwdata.size()); SamBaCommand(util::fmt("S%08lx,%08lx#", KF_FW_LOAD_ADDR, fwsize)); auto offset = 0; while (offset < fwsize) offset += Write(fwdata.data() + offset, fwsize - offset); SamBaCommand(util::fmt("R%08lx,%08lx#", KF_FW_LOAD_ADDR, fwsize)); std::vector<uint8_t> fwverify(fwsize); for (offset = 0; offset < fwsize; ) offset += Read(fwverify.data() + offset, fwsize - offset); if (fwdata != fwverify) throw util::exception("firmware verification failed"); SamBaCommand(util::fmt("G%08lx#", KF_FW_EXEC_ADDR)); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x298, %rsp # imm = 0x298 movq %rdi, %rbx leaq 0xa0(%rsp), %r12 movq %r12, -0x10(%r12) leaq 0x4cbb8(%rip), %rsi # 0xaee5c leaq 0x4cbb3(%rip), %rdx # 0xaee5e leaq 0x90(%rsp), %rdi callq 0x445b8 leaq 0x10(%rsp), %r15 movq %r15, -0x10(%r15) leaq 0x4a2e6(%rip), %rsi # 0xac5ae leaq 0x4a2e0(%rip), %rdx # 0xac5af movq %rsp, %rdi callq 0x445b8 leaq 0x90(%rsp), %rsi movq %rsp, %rdx movq %rbx, %rdi callq 0x628da movq (%rsp), %rdi cmpq %r15, %rdi je 0x62300 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x90(%rsp), %rdi cmpq %r12, %rdi je 0x6231d movq 0xa0(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x90(%rsp), %rdi movq %r12, (%rdi) leaq 0x4cb30(%rip), %rsi # 0xaee5f leaq 0x4cb2b(%rip), %rdx # 0xaee61 callq 0x445b8 movq %rsp, %rdi movq %r15, (%rdi) leaq 0x4cb1a(%rip), %rsi # 0xaee62 leaq 0x4cb15(%rip), %rdx # 0xaee64 callq 0x445b8 leaq 0x90(%rsp), %rsi movq %rsp, %rdx movq %rbx, %rdi callq 0x628da movq (%rsp), %rdi cmpq %r15, %rdi je 0x6237d movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x90(%rsp), %rdi cmpq %r12, %rdi je 0x6239a movq 0xa0(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x90(%rsp), %r14 movq %r14, %rdi callq 0x78826 movq 0x7ba77(%rip), %rsi # 0xdde28 movq %r14, %rdi callq 0x35b60 movq %r15, (%rsp) movq (%rax), %rdx movq %rax, %rcx addq $0x10, %rcx cmpq %rcx, %rdx je 0x623da movq %rdx, (%rsp) movq (%rcx), %rdx movq %rdx, 0x10(%rsp) jmp 0x623e1 movups (%rcx), %xmm0 movups %xmm0, (%r15) movq 0x8(%rax), %rdx movq %rdx, 0x8(%rsp) movq %rcx, (%rax) movq $0x0, 0x8(%rax) movb $0x0, 0x10(%rax) movq 0x90(%rsp), %rdi cmpq %r12, %rdi je 0x62416 movq 0xa0(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x90(%rsp), %rdi movq %rsp, %rsi movl $0x4, %edx callq 0x35970 movq 0x90(%rsp), %rax movq -0x18(%rax), %rcx testb $0x5, 0xb0(%rsp,%rcx) jne 0x6270a movq -0x18(%rax), %rax movq 0x178(%rsp,%rax), %rsi leaq 0x60(%rsp), %rdi leaq 0x20(%rsp), %r9 movl $0xffffffff, %edx # imm = 0xFFFFFFFF xorl %ecx, %ecx movl $0xffffffff, %r8d # imm = 0xFFFFFFFF callq 0x638ec movq 0x68(%rsp), %r14 subq 0x60(%rsp), %r14 leaq 0x4c9e7(%rip), %rsi # 0xaee65 leaq 0x20(%rsp), %rdi movl $0x202000, %edx # imm = 0x202000 movl %r14d, %ecx xorl %eax, %eax callq 0x784cc leaq 0x50(%rsp), %r13 movq %r13, -0x10(%r13) leaq 0x4abdf(%rip), %rdx # 0xad081 leaq 0x40(%rsp), %rdi movq %rdx, %rsi callq 0x445b8 leaq 0x20(%rsp), %rsi leaq 0x40(%rsp), %rdx movq %rbx, %rdi callq 0x628da movq 0x40(%rsp), %rdi cmpq %r13, %rdi je 0x624d8 movq 0x50(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x30(%rsp), %r12 movq -0x10(%r12), %rdi cmpq %r12, %rdi je 0x624f4 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 testl %r14d, %r14d jle 0x6251b xorl %ebp, %ebp movslq %ebp, %rax movq 0x60(%rsp), %rsi addq %rax, %rsi movl %r14d, %edx subl %eax, %edx movq (%rbx), %rax movq %rbx, %rdi callq *0x28(%rax) addl %eax, %ebp cmpl %r14d, %ebp jl 0x624fb leaq 0x4c951(%rip), %rsi # 0xaee73 leaq 0x20(%rsp), %rdi movl $0x202000, %edx # imm = 0x202000 movl %r14d, %ecx xorl %eax, %eax callq 0x784cc leaq 0x40(%rsp), %rdi movq %r13, (%rdi) leaq 0x4ab3c(%rip), %rdx # 0xad081 movq %rdx, %rsi callq 0x445b8 leaq 0x20(%rsp), %rsi leaq 0x40(%rsp), %rdx movq %rbx, %rdi callq 0x628da movq 0x40(%rsp), %rdi cmpq %r13, %rdi je 0x62576 movq 0x50(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x20(%rsp), %rdi cmpq %r12, %rdi je 0x6258d movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movslq %r14d, %rsi leaq 0x78(%rsp), %rdi leaq 0x20(%rsp), %rdx callq 0x38b58 testl %r14d, %r14d jle 0x625c6 xorl %ebp, %ebp movslq %ebp, %rax movq 0x78(%rsp), %rsi addq %rax, %rsi movl %r14d, %edx subl %eax, %edx movq (%rbx), %rax movq %rbx, %rdi callq *0x20(%rax) addl %eax, %ebp cmpl %r14d, %ebp jl 0x625a6 movq 0x60(%rsp), %rdi movq 0x68(%rsp), %rax movq %rax, %rdx subq %rdi, %rdx movq 0x78(%rsp), %rsi movq 0x80(%rsp), %rcx subq %rsi, %rcx cmpq %rcx, %rdx jne 0x626d6 cmpq %rdi, %rax je 0x62601 callq 0x355f0 testl %eax, %eax jne 0x626d6 leaq 0x4c896(%rip), %rsi # 0xaee9e leaq 0x20(%rsp), %rdi movl $0x202000, %edx # imm = 0x202000 xorl %eax, %eax callq 0x784cc leaq 0x40(%rsp), %rdi movq %r13, (%rdi) leaq 0x4aa59(%rip), %rdx # 0xad081 movq %rdx, %rsi callq 0x445b8 leaq 0x20(%rsp), %rsi leaq 0x40(%rsp), %rdx movq %rbx, %rdi callq 0x628da movq 0x40(%rsp), %rdi cmpq %r13, %rdi je 0x62659 movq 0x50(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x20(%rsp), %rdi cmpq %r12, %rdi je 0x62670 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x78(%rsp), %rdi testq %rdi, %rdi je 0x6268a movq 0x88(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x60(%rsp), %rdi testq %rdi, %rdi je 0x626a1 movq 0x70(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x90(%rsp), %rdi callq 0x350f0 movq (%rsp), %rdi cmpq %r15, %rdi je 0x626c4 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 addq $0x298, %rsp # imm = 0x298 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x4c797(%rip), %rsi # 0xaee81 movq %rax, %rdi callq 0x6392e leaq 0x79487(%rip), %rsi # 0xdbb80 movq 0x7a880(%rip), %rdx # 0xdcf80 movq %r14, %rdi callq 0x35a50 jmp 0x62740 movl $0x20, %edi callq 0x35260 movq %rax, %r14 callq 0x35050 movl (%rax), %esi movq (%rsp), %rdx movq %r14, %rdi callq 0x61974 leaq 0x79c9f(%rip), %rsi # 0xdc3d0 movq 0x7a828(%rip), %rdx # 0xdcf60 movq %r14, %rdi callq 0x35a50 jmp 0x62823 movq %rax, %rbx movq %r14, %rdi callq 0x35430 jmp 0x628ae jmp 0x62875 movq %rax, %rbx movq %r14, %rdi callq 0x35430 jmp 0x62878 movq %rax, %rbx movq 0x40(%rsp), %rdi cmpq %r13, %rdi je 0x62789 movq 0x50(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x62789 movq %rax, %rbx movq 0x20(%rsp), %rdi cmpq %r12, %rdi je 0x62878 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x62878 jmp 0x62875 jmp 0x62894 movq %rax, %rbx movq 0x40(%rsp), %rdi cmpq %r13, %rdi je 0x627d2 movq 0x50(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x627d2 movq %rax, %rbx movq 0x20(%rsp), %rdi cmpq %r12, %rdi jne 0x62817 jmp 0x62897 jmp 0x62894 movq %rax, %rbx movq 0x40(%rsp), %rdi cmpq %r13, %rdi je 0x62805 movq 0x50(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x62805 movq %rax, %rbx leaq 0x30(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x62897 movq 0x30(%rsp), %rsi incq %rsi jmp 0x6288d jmp 0x62894 movq %rax, %rbx jmp 0x628ae movq %rax, %rbx jmp 0x628bb jmp 0x62856 jmp 0x6283b jmp 0x62856 jmp 0x62870 movq %rax, %rbx movq (%rsp), %rdi cmpq %r15, %rdi je 0x62859 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x62859 movq %rax, %rbx movq 0x90(%rsp), %rdi cmpq %r12, %rdi je 0x628d1 movq 0xa0(%rsp), %rsi jmp 0x628c9 movq %rax, %rbx jmp 0x628d1 movq %rax, %rbx movq 0x78(%rsp), %rdi testq %rdi, %rdi je 0x62897 movq 0x88(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 jmp 0x62897 movq %rax, %rbx movq 0x60(%rsp), %rdi testq %rdi, %rdi je 0x628ae movq 0x70(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x90(%rsp), %rdi callq 0x350f0 movq (%rsp), %rdi cmpq %r15, %rdi je 0x628d1 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::SamBaCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void KryoFlux::SamBaCommand(const std::string& cmd, const std::string& end) { std::string s; uint8_t buf[512]; try { Write(cmd.c_str(), static_cast<int>(cmd.length())); if (!end.empty()) { for (;;) { auto len = Read(buf, sizeof(buf)); s += std::string(reinterpret_cast<char*>(buf), len); if (s.length() >= end.length() && s.compare(s.length() - end.length(), end.length(), end) == 0) { break; } } } } catch (...) { throw util::exception("firmware upload failed, try resetting device"); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x248, %rsp # imm = 0x248 movq %rdx, %rbx movq %rdi, %r14 leaq 0x30(%rsp), %rax movq %rax, -0x10(%rax) movq $0x0, -0x8(%rax) movb $0x0, (%rax) movq (%rsi), %rax movl 0x8(%rsi), %edx movq (%rdi), %rcx movq %rax, %rsi callq *0x28(%rcx) cmpq $0x0, 0x8(%rbx) je 0x6299f leaq 0x10(%rsp), %rbp leaq 0x40(%rsp), %r15 movq %rsp, %r12 leaq 0x20(%rsp), %r13 movq (%r14), %rax movq %r14, %rdi movq %r15, %rsi movl $0x200, %edx # imm = 0x200 callq *0x20(%rax) cltq movq %rbp, (%rsp) leaq (%rsp,%rax), %rdx addq $0x40, %rdx movq %r12, %rdi movq %r15, %rsi callq 0x445b8 movq (%rsp), %rsi movq 0x8(%rsp), %rdx movq %r13, %rdi callq 0x35150 movq (%rsp), %rdi cmpq %rbp, %rdi je 0x62982 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x28(%rsp), %rsi movq 0x8(%rbx), %rdx subq %rdx, %rsi jb 0x62931 movq %r13, %rdi movq %rbx, %rcx callq 0x35730 testl %eax, %eax jne 0x62931 movq 0x20(%rsp), %rdi leaq 0x30(%rsp), %rax cmpq %rax, %rdi je 0x629bb movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 addq $0x248, %rsp # imm = 0x248 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x629ec jmp 0x629ec movq %rax, %rbx movq (%rsp), %rdi cmpq %rbp, %rdi je 0x629ef movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x629ef movq %rax, %rbx movq %rbx, %rdi callq 0x35200 movl $0x10, %edi callq 0x35260 movq %rax, %r14 leaq 0x4c49b(%rip), %rsi # 0xaeea6 movq %rax, %rdi callq 0x619b0 leaq 0x79166(%rip), %rsi # 0xdbb80 movq 0x7a55f(%rip), %rdx # 0xdcf80 movq %r14, %rdi callq 0x35a50 movq %rax, %rbx jmp 0x62a39 movq %rax, %rbx movq %r14, %rdi callq 0x35430 callq 0x359a0 movq 0x20(%rsp), %rdi leaq 0x30(%rsp), %rax cmpq %rax, %rdi je 0x62a5a movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 movq %rax, %rdi callq 0x410ac
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::Reset()
int KryoFlux::Reset() { return ResponseCode(Control(REQ_RESET)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0x5, %edx xorl %ecx, %ecx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62ada movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::SelectDevice(int)
int KryoFlux::SelectDevice(int device) { return ResponseCode(Control(REQ_DEVICE, device)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0x6, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62b2a movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::EnableMotor(int)
int KryoFlux::EnableMotor(int enable) { return ResponseCode(Control(REQ_MOTOR, enable)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0x7, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62b7a movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::Seek(int)
int KryoFlux::Seek(int cyl) { return ResponseCode(Control(REQ_TRACK, cyl)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0xa, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62bca movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::SelectDensity(bool)
int KryoFlux::SelectDensity(bool density) { return ResponseCode(Control(REQ_DENSITY, density)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0x8, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62c1a movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::SelectSide(int)
int KryoFlux::SelectSide(int head) { return ResponseCode(Control(REQ_SIDE, head)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0x9, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62c6a movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::SetMinTrack(int)
int KryoFlux::SetMinTrack(int cyl) { return ResponseCode(Control(REQ_MIN_TRACK, cyl)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0xc, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62cba movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::SetMaxTrack(int)
int KryoFlux::SetMaxTrack(int cyl) { return ResponseCode(Control(REQ_MAX_TRACK, cyl)); }
pushq %r14 pushq %rbx subq $0x28, %rsp movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax leaq 0x8(%rsp), %r14 movq %r14, %rdi movl $0xd, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %r14, %rdi callq 0x62a6a movl %eax, %ebx movq (%r14), %rdi leaq 0x18(%rsp), %rax cmpq %rax, %rdi je 0x62d0a movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movl %ebx, %eax addq $0x28, %rsp popq %rbx popq %r14 retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::GetInfo(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int KryoFlux::GetInfo(int index, std::string& info) { info = Control(REQ_INFO | REQ_GET, index); auto ret = ResponseCode(info); info.erase(0, info.find(' ') + 1); // remove time code info.erase(0, info.find(' ') + 1); // remove info response return ret; }
pushq %rbp pushq %r14 pushq %rbx subq $0x20, %rsp movq %rdx, %rbx movl %esi, %ecx movq %rdi, %rsi movq (%rdi), %rax movq %rsp, %r14 movq %r14, %rdi movl $0x81, %edx xorl %r8d, %r8d callq *0x18(%rax) movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x62d5d movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x62a6a movl %eax, %ebp movq %rbx, %rdi movl $0x20, %esi xorl %edx, %edx callq 0x35740 leaq 0x1(%rax), %rdx movq %rbx, %rdi xorl %esi, %esi callq 0x350d0 movq %rbx, %rdi movl $0x20, %esi xorl %edx, %edx callq 0x35740 leaq 0x1(%rax), %rdx movq %rbx, %rdi xorl %esi, %esi callq 0x350d0 movl %ebp, %eax addq $0x20, %rsp popq %rbx popq %r14 popq %rbp retq
/simonowen[P]samdisk/src/KryoFlux.cpp
KryoFlux::DecodeStream(Data const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
FluxData KryoFlux::DecodeStream(const Data& data, std::vector<std::string>& warnings) { FluxData flux_revs; std::vector<uint32_t> flux_times, flux_counts; flux_times.reserve(data.size()); flux_counts.resize(data.size()); uint32_t time = 0, stream_pos = 0; uint32_t ps_per_tick = PS_PER_TICK(SAMPLE_FREQ); std::vector<uint32_t> index_offsets; int hard_indexes = 0; auto itBegin = data.begin(), it = itBegin, itEnd = data.end(); while (it != itEnd) { // Store current flux count at each stream position flux_counts[stream_pos] = static_cast<int>(flux_times.size()); auto type = *it++; switch (type) { case 0x0c: // Flux3 type = *it++; stream_pos++; case 0x00: case 0x01: case 0x02: case 0x03: // Flux 2 case 0x04: case 0x05: case 0x06: case 0x07: time += (static_cast<uint32_t>(type) << 8) | *it++; flux_times.push_back(time * ps_per_tick / 1000); stream_pos += 2; time = 0; break; case 0xa: // Nop3 it++; stream_pos++; case 0x9: // Nop2 it++; stream_pos++; case 0x8: // Nop1 stream_pos++; break; case 0xb: // Ovl16 time += 0x10000; stream_pos++; break; case OOB: // OOB { auto subtype = *it++; uint16_t size = *it++; size |= (*it++ << 8); switch (subtype) { case 0x00: // Invalid warnings.push_back("invalid OOB detected"); it = itEnd; break; case 0x01: // StreamInfo assert(size == 8); break; case 0x02: // Index { assert(size == 12); // Soft-sectored disks have a single start-of-track index. // Hard-sectors are combined to achieve the same result. if (opt.hardsectors <= 1 || !(++hard_indexes % opt.hardsectors)) { auto pdw = reinterpret_cast<const uint32_t*>(&*it); index_offsets.push_back(util::letoh(pdw[0])); } break; } case 0x03: // StreamEnd { assert(size == 8); auto pdw = reinterpret_cast<const uint32_t*>(&*it); // auto eof_pos = util::letoh(pdw[0]); auto eof_ret = util::letoh(pdw[1]); if (eof_ret == 1) warnings.push_back("stream end (buffering problem)"); else if (eof_ret == 2) warnings.push_back("stream end (no index detected)"); else if (eof_ret != 0) warnings.push_back(util::fmt("stream end problem (%u)", eof_ret)); break; } case 0x04: // KFInfo { std::string info = reinterpret_cast<const char*>(&*it); for (auto& entry : util::split(info, ',')) { auto pos = entry.find('='); if (pos != entry.npos) { auto name = util::trim(entry.substr(0, pos)); auto value = util::trim(entry.substr(pos + 1)); if (!name.empty() && !value.empty()) { // disk.metadata[name] = value; if (name == "sck") ps_per_tick = PS_PER_TICK(std::atoi(value.c_str())); } } } break; } case 0x0d: // EOF assert(size == 0x0d0d); // documented value size = 0; // size is fake, so clear it it = itEnd; // advance to end break; default: warnings.push_back(util::fmt("unexpected OOB sub-type (%X)", subtype)); it = itEnd; break; } it += size; break; } default: // Flux1 time += type; flux_times.push_back(time * ps_per_tick / 1000); stream_pos++; time = 0; break; } } uint32_t last_pos = 0; for (auto index_offset : index_offsets) { // Ignore first partial track if (last_pos != 0) { // Find the most recent flux count. while (index_offset && !flux_counts[index_offset]) --index_offset; // Extract flux segment for current revolution flux_revs.emplace_back(std::vector<uint32_t>( flux_times.begin() + last_pos, flux_times.begin() + flux_counts[index_offset])); } last_pos = flux_counts[index_offset]; } if (flux_revs.size() == 0) warnings.push_back("no flux data"); return flux_revs; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x128, %rsp # imm = 0x128 movq %rdx, 0x28(%rsp) movq %rsi, %r14 xorl %eax, %eax movq %rax, 0x10(%rdi) xorps %xmm0, %xmm0 movq %rdi, 0x98(%rsp) movups %xmm0, (%rdi) leaq 0x40(%rsp), %rdi movq %rax, 0x10(%rdi) movaps %xmm0, (%rdi) movq %rax, 0x90(%rsp) movaps %xmm0, 0x80(%rsp) movl 0x8(%rsi), %eax subl (%rsi), %eax movslq %eax, %rsi callq 0x41106 movl 0x8(%r14), %eax subl (%r14), %eax movslq %eax, %rsi leaq 0x80(%rsp), %rdi callq 0x639a4 xorps %xmm0, %xmm0 movaps %xmm0, 0x60(%rsp) movq $0x0, 0x70(%rsp) movq (%r14), %rax movq 0x8(%r14), %rcx movq %rcx, 0x38(%rsp) cmpq %rcx, %rax je 0x635a4 movl $0xa293, 0x24(%rsp) # imm = 0xA293 movq %rsp, %r12 leaq 0xa0(%rsp), %r13 xorl %r14d, %r14d xorl %ebx, %ebx movl $0x0, 0x34(%rsp) movq 0x48(%rsp), %rsi movq %rsi, %rcx subq 0x40(%rsp), %rcx shrq $0x2, %rcx movl %ebx, %edx movq 0x80(%rsp), %rdi movl %ecx, (%rdi,%rdx,4) leaq 0x1(%rax), %r15 movzbl (%rax), %ecx cmpq $0xd, %rcx ja 0x631bd leaq 0x4bd09(%rip), %rdi # 0xaedd0 movslq (%rdi,%rcx,4), %rdx addq %rdi, %rdx jmpq *%rdx movzbl %cl, %eax shll $0x8, %eax movzbl (%r15), %ecx addl %ecx, %r14d addl %eax, %r14d imull 0x24(%rsp), %r14d imulq $0x10624dd3, %r14, %rax # imm = 0x10624DD3 shrq $0x26, %rax movl %eax, (%rsp) cmpq 0x50(%rsp), %rsi je 0x63108 movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x48(%rsp) jmp 0x63115 leaq 0x40(%rsp), %rdi movq %r12, %rdx callq 0x4361a incq %r15 addl $0x2, %ebx xorl %r14d, %r14d jmp 0x631aa addl $0x10000, %r14d # imm = 0x10000 jmp 0x631a8 movb 0x1(%rax), %cl addq $0x2, %rax incl %ebx movq %rax, %r15 jmp 0x630d0 movl $0x1, %ecx jmp 0x6319f movzbl 0x1(%rax), %edx movzwl 0x2(%rax), %ebp cmpq $0xd, %rdx ja 0x63262 leaq 0x4(%rax), %r15 leaq 0x4bcaa(%rip), %rsi # 0xaee08 movslq (%rsi,%rdx,4), %rcx addq %rsi, %rcx jmpq *%rcx leaq 0x10(%rsp), %rax movq %rax, (%rsp) movq %r12, %rdi leaq 0x4bd61(%rip), %rsi # 0xaeedb leaq 0x4bd6e(%rip), %rdx # 0xaeeef callq 0x445b8 movq 0x28(%rsp), %rdi movq %r12, %rsi callq 0x44648 jmp 0x63280 incl %ebx movl $0x2, %ecx leaq (%rax,%rcx), %r15 incq %r15 incl %ebx incl %ebx movq %r15, %rax cmpq 0x38(%rsp), %r15 jne 0x63091 jmp 0x635a4 addl %ecx, %r14d imull 0x24(%rsp), %r14d imulq $0x10624dd3, %r14, %rax # imm = 0x10624DD3 shrq $0x26, %rax movl %eax, (%rsp) cmpq 0x50(%rsp), %rsi je 0x631e8 movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x48(%rsp) jmp 0x631f5 leaq 0x40(%rsp), %rdi movq %r12, %rdx callq 0x4361a incl %ebx jmp 0x6311b cmpw $0xc, %bp jne 0x63734 leaq 0x7c533(%rip), %rax # 0xdf740 movl 0x68(%rax), %ecx cmpl $0x2, %ecx jl 0x6322a movl 0x34(%rsp), %eax incl %eax movl %eax, 0x34(%rsp) cltd idivl %ecx testl %edx, %edx jne 0x63595 movl (%r15), %eax movl %eax, (%rsp) movq 0x68(%rsp), %rsi cmpq 0x70(%rsp), %rsi je 0x6351f movl %eax, (%rsi) addq $0x4, %rsi movq %rsi, 0x68(%rsp) jmp 0x63595 movzwl %bp, %eax cmpl $0xd0d, %eax # imm = 0xD0D jne 0x636f6 xorl %ebp, %ebp jmp 0x6329b movq %r12, %rdi leaq 0x4bdaa(%rip), %rsi # 0xaf016 xorl %eax, %eax callq 0x784cc movq 0x28(%rsp), %rdi movq %r12, %rsi callq 0x44648 movq (%rsp), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x6329b movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x38(%rsp), %rax jmp 0x63598 cmpw $0x8, %bp movq %r15, %rax je 0x63598 jmp 0x63753 cmpw $0x8, %bp jne 0x63715 movl 0x8(%rax), %edx testl %edx, %edx je 0x63595 cmpl $0x2, %edx je 0x6352e cmpl $0x1, %edx jne 0x6355c leaq 0x10(%rsp), %rax movq %rax, (%rsp) movq %r12, %rdi leaq 0x4bcbc(%rip), %rsi # 0xaefad leaq 0x4bcd3(%rip), %rdx # 0xaefcb callq 0x445b8 movq 0x28(%rsp), %rdi movq %r12, %rsi callq 0x44648 jmp 0x6357a leaq 0x10(%rsp), %rax movq %rax, (%rsp) movq %r15, %rdi callq 0x35210 leaq (%rax,%r15), %rdx movq %r12, %rdi movq %r15, %rsi callq 0x445b8 movq %r15, 0xe0(%rsp) movl %ebp, 0x7c(%rsp) leaq 0x110(%rsp), %rdi movq %r12, %rsi movl $0x2c, %edx xorl %ecx, %ecx callq 0x78621 movq 0x110(%rsp), %r15 movq 0x118(%rsp), %rax movq %rax, 0xe8(%rsp) cmpq %rax, %r15 je 0x634e9 movq %r15, %rdi movl $0x3d, %esi xorl %edx, %edx callq 0x35740 cmpq $-0x1, %rax je 0x634d4 movq %rax, %r12 movq %r13, %rbp movq %r13, %rdi movq %r15, %rsi xorl %edx, %edx movq %rax, %rcx callq 0x35600 leaq 0xc0(%rsp), %rdi movq %rbp, %rsi callq 0x78744 movq 0xa0(%rsp), %rdi leaq 0xb0(%rsp), %rax cmpq %rax, %rdi je 0x633d7 movq 0xb0(%rsp), %rsi incq %rsi callq 0x355d0 incq %r12 leaq 0xf0(%rsp), %rbp movq %rbp, %rdi movq %r15, %rsi movq %r12, %rdx movq $-0x1, %rcx callq 0x35600 movq %r13, %rdi movq %rbp, %rsi callq 0x78744 movq %rsp, %r12 movq 0xf0(%rsp), %rdi leaq 0x100(%rsp), %rax cmpq %rax, %rdi je 0x6342a movq 0x100(%rsp), %rsi incq %rsi callq 0x355d0 cmpq $0x0, 0xc8(%rsp) je 0x63488 cmpq $0x0, 0xa8(%rsp) je 0x63488 leaq 0xc0(%rsp), %rdi leaq 0x4bbb4(%rip), %rsi # 0xaf003 callq 0x35120 testl %eax, %eax jne 0x63488 movq 0xa0(%rsp), %rdi callq 0x35900 cltq imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3 movq %rcx, %rax shrq $0x3f, %rax sarq $0x26, %rcx addl %eax, %ecx movl $0x3b9aca00, %eax # imm = 0x3B9ACA00 xorl %edx, %edx idivl %ecx movl %eax, 0x24(%rsp) movq 0xa0(%rsp), %rdi leaq 0xb0(%rsp), %rax cmpq %rax, %rdi je 0x634ad movq 0xb0(%rsp), %rsi incq %rsi callq 0x355d0 movq 0xc0(%rsp), %rdi leaq 0xd0(%rsp), %rax cmpq %rax, %rdi je 0x634d7 movq 0xd0(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x634d7 movq %rsp, %r12 addq $0x20, %r15 cmpq 0xe8(%rsp), %r15 jne 0x63373 leaq 0x110(%rsp), %rdi callq 0x44540 movq (%rsp), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x63511 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movl 0x7c(%rsp), %ebp movq 0xe0(%rsp), %rax jmp 0x63598 leaq 0x60(%rsp), %rdi movq %r12, %rdx callq 0x4361a jmp 0x63595 leaq 0x10(%rsp), %rax movq %rax, (%rsp) movq %r12, %rdi leaq 0x4ba8b(%rip), %rsi # 0xaefcc leaq 0x4baa2(%rip), %rdx # 0xaefea callq 0x445b8 movq 0x28(%rsp), %rdi movq %r12, %rsi callq 0x44648 jmp 0x6357a movq %r12, %rdi leaq 0x4ba85(%rip), %rsi # 0xaefeb xorl %eax, %eax callq 0x784cc movq 0x28(%rsp), %rdi movq %r12, %rsi callq 0x44648 movq (%rsp), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x63595 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq %r15, %rax movzwl %bp, %r15d addq %rax, %r15 jmp 0x631aa movq 0x60(%rsp), %rbx movq 0x68(%rsp), %r12 cmpq %r12, %rbx movq 0x98(%rsp), %r13 je 0x6364a xorl %eax, %eax movq %rsp, %r14 leaq 0xc0(%rsp), %r15 movl (%rbx), %ebp testl %eax, %eax je 0x63634 testl %ebp, %ebp je 0x635ec movq 0x80(%rsp), %rcx movl %ebp, %edx cmpl $0x0, (%rcx,%rdx,4) jne 0x635ec decl %ebp jne 0x635de xorl %ebp, %ebp movq 0x40(%rsp), %rcx movl %eax, %eax leaq (%rcx,%rax,4), %rsi movl %ebp, %eax movq 0x80(%rsp), %rdx movl (%rdx,%rax,4), %eax leaq (%rcx,%rax,4), %rdx movq %r14, %rdi movq %r15, %rcx callq 0x639d6 movq %r13, %rdi movq %r14, %rsi callq 0x436f6 movq (%rsp), %rdi testq %rdi, %rdi je 0x63634 movq 0x10(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movl %ebp, %eax movq 0x80(%rsp), %rcx movl (%rcx,%rax,4), %eax addq $0x4, %rbx cmpq %r12, %rbx jne 0x635cc movq 0x8(%r13), %rax cmpq (%r13), %rax jne 0x63696 leaq 0x10(%rsp), %rbx movq %rbx, -0x10(%rbx) leaq 0x4b9cf(%rip), %rsi # 0xaf033 leaq 0x4b9d4(%rip), %rdx # 0xaf03f movq %rsp, %rdi callq 0x445b8 movq %rsp, %rsi movq 0x28(%rsp), %rdi callq 0x44648 movq (%rsp), %rdi cmpq %rbx, %rdi je 0x63696 movq 0x10(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x60(%rsp), %rdi testq %rdi, %rdi je 0x636ad movq 0x70(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x80(%rsp), %rdi testq %rdi, %rdi je 0x636ca movq 0x90(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x40(%rsp), %rdi testq %rdi, %rdi je 0x636e1 movq 0x50(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq %r13, %rax addq $0x128, %rsp # imm = 0x128 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x4b90a(%rip), %rdi # 0xaf007 leaq 0x4b7f6(%rip), %rsi # 0xaeefa leaq 0x4b846(%rip), %rcx # 0xaef51 movl $0x147, %edx # imm = 0x147 callq 0x35380 leaq 0x4b7d4(%rip), %rdi # 0xaeef0 leaq 0x4b7d7(%rip), %rsi # 0xaeefa leaq 0x4b827(%rip), %rcx # 0xaef51 movl $0x120, %edx # imm = 0x120 callq 0x35380 leaq 0x4b867(%rip), %rdi # 0xaefa2 leaq 0x4b7b8(%rip), %rsi # 0xaeefa leaq 0x4b808(%rip), %rcx # 0xaef51 movl $0x112, %edx # imm = 0x112 callq 0x35380 leaq 0x4b796(%rip), %rdi # 0xaeef0 leaq 0x4b799(%rip), %rsi # 0xaeefa leaq 0x4b7e9(%rip), %rcx # 0xaef51 movl $0x10d, %edx # imm = 0x10D callq 0x35380 jmp 0x6379a jmp 0x6386e jmp 0x6379a jmp 0x6379a jmp 0x6386e jmp 0x6386e jmp 0x6386e jmp 0x6379a jmp 0x6386e jmp 0x6379a jmp 0x6386e movq %rax, %r14 jmp 0x63854 jmp 0x6386e movq %rax, %r14 movq (%rsp), %rdi cmpq %rbx, %rdi jne 0x63862 jmp 0x6388c jmp 0x6386e jmp 0x6386e movq %rax, %r14 jmp 0x638a3 movq %rax, %r14 movq 0xf0(%rsp), %rdi leaq 0x100(%rsp), %rax cmpq %rax, %rdi je 0x637fb movq 0x100(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x637fb movq %rax, %r14 movq 0xc0(%rsp), %rdi leaq 0xd0(%rsp), %rax cmpq %rax, %rdi je 0x63847 movq 0xd0(%rsp), %rsi jmp 0x6383a movq %rax, %r14 movq 0xa0(%rsp), %rdi leaq 0xb0(%rsp), %rax cmpq %rax, %rdi je 0x63847 movq 0xb0(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x63847 movq %rax, %r14 leaq 0x110(%rsp), %rdi callq 0x44540 movq (%rsp), %rdi leaq 0x10(%rsp), %rax cmpq %rax, %rdi je 0x6388c movq 0x10(%rsp), %rsi incq %rsi jmp 0x63887 jmp 0x6386e movq %rax, %r14 jmp 0x6388c movq %rax, %r14 movq (%rsp), %rdi testq %rdi, %rdi je 0x6388c movq 0x10(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x60(%rsp), %rdi testq %rdi, %rdi je 0x638a3 movq 0x70(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x80(%rsp), %rdi testq %rdi, %rdi je 0x638c0 movq 0x90(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x40(%rsp), %rdi testq %rdi, %rdi je 0x638d7 movq 0x50(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 movq 0x98(%rsp), %rdi callq 0x42e7a movq %r14, %rdi callq 0x35aa0
/simonowen[P]samdisk/src/KryoFlux.cpp
to_string[abi:cxx11](Compress const&)
std::string to_string(const Compress& compression) { switch (compression) { default: case Compress::None: return "none"; case Compress::Zip: return "zip"; case Compress::Gzip: return "gzip"; case Compress::Bzip2: return "bzip2"; case Compress::Xz: return "xz"; } }
pushq %rbx movq %rdi, %rbx movl (%rsi), %eax leaq 0x10(%rdi), %rcx movq %rcx, (%rdi) decl %eax cmpl $0x3, %eax ja 0x63f3c leaq 0x4b14d(%rip), %rcx # 0xaf040 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x4bba7(%rip), %rsi # 0xafaaa leaq 0x4bba3(%rip), %rdx # 0xafaad jmp 0x63f4a leaq 0x4b149(%rip), %rsi # 0xaf05c leaq 0x4b147(%rip), %rdx # 0xaf061 jmp 0x63f4a leaq 0x4b13f(%rip), %rsi # 0xaf062 leaq 0x4b13a(%rip), %rdx # 0xaf064 jmp 0x63f4a leaq 0x4b124(%rip), %rsi # 0xaf057 leaq 0x4b121(%rip), %rdx # 0xaf05b jmp 0x63f4a leaq 0x4a5c2(%rip), %rsi # 0xae505 leaq 0x4a5bf(%rip), %rdx # 0xae509 movq %rbx, %rdi callq 0x445b8 movq %rbx, %rax popq %rbx retq nop
/simonowen[P]samdisk/src/MemFile.cpp
MemFile::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
bool MemFile::open(const std::string& path_, bool uncompress) { std::string filename; MEMORY mem(MAX_IMAGE_SIZE + 1); size_t uRead = 0; // Check if zlib is available #ifndef HAVE_ZLIB bool have_zlib = false; #else bool have_zlib = zlibVersion()[0] == ZLIB_VERSION[0]; // Read start of file to check for compression signatures. if (uncompress && have_zlib) { FILE* f = fopen(path_.c_str(), "rb"); if (!f) throw posix_error(errno, path_.c_str()); if (!fread(mem, 1, 2, f)) mem[0] = mem[1] = '\0'; fclose(f); } if (uncompress && have_zlib) { // Require zip file header magic. if (mem[0U] == 'P' && mem[1U] == 'K') { unzFile hfZip = unzOpen(path_.c_str()); if (!hfZip) throw util::exception("bad zip file"); int nRet; unz_file_info sInfo; uLong ulMaxSize = 0; // Iterate through the contents of the zip looking for a file with a suitable size for (nRet = unzGoToFirstFile(hfZip); nRet == UNZ_OK; nRet = unzGoToNextFile(hfZip)) { char szFile[MAX_PATH]; // Get details of the current file unzGetCurrentFileInfo(hfZip, &sInfo, szFile, MAX_PATH, nullptr, 0, nullptr, 0); // Ignore directories and empty files if (!sInfo.uncompressed_size) continue; // If the file extension is recognised, read the file contents // ToDo: GetFileType doesn't really belong here? if (GetFileType(szFile) != ftUnknown && unzOpenCurrentFile(hfZip) == UNZ_OK) { nRet = unzReadCurrentFile(hfZip, mem, static_cast<unsigned int>(mem.size)); unzCloseCurrentFile(hfZip); filename = szFile; break; } // Rememeber the largest uncompressed file size if (sInfo.uncompressed_size > ulMaxSize) ulMaxSize = sInfo.uncompressed_size; } // Did we fail to find a matching extension? if (nRet == UNZ_END_OF_LIST_OF_FILE) { // Loop back over the archive for (nRet = unzGoToFirstFile(hfZip); nRet == UNZ_OK; nRet = unzGoToNextFile(hfZip)) { // Get details of the current file unzGetCurrentFileInfo(hfZip, &sInfo, nullptr, 0, nullptr, 0, nullptr, 0); // Open the largest file found about if (sInfo.uncompressed_size == ulMaxSize && unzOpenCurrentFile(hfZip) == UNZ_OK) { nRet = unzReadCurrentFile(hfZip, mem, static_cast<unsigned int>(mem.size)); unzCloseCurrentFile(hfZip); break; } } } // Close the zip archive unzClose(hfZip); if (nRet < 0) throw util::exception("zip extraction failed (", nRet, ")"); uRead = nRet; m_compress = Compress::Zip; } // Require gzip file header magic. else if (mem[0U] == 0x1f && mem[1U] == 0x8b) { // Open as gzipped or uncompressed gzFile gf = gzopen(path_.c_str(), "rb"); if (gf == Z_NULL) throw posix_error(errno, path_.c_str()); uRead = gzread(gf, mem, static_cast<unsigned>(mem.size)); m_compress = gzdirect(gf) ? Compress::None : Compress::Gzip; gzclose(gf); // If gzipped, attempt to extract the original filename if (m_compress == Compress::Gzip) { std::ifstream zs(path_.c_str(), std::ios_base::binary); std::vector<uint8_t> zbuf((std::istreambuf_iterator<char>(zs)), std::istreambuf_iterator<char>()); z_stream stream{}; stream.next_in = zbuf.data(); stream.avail_in = static_cast<uInt>(zbuf.size()); stream.next_out = zbuf.data(); // same as next_in! stream.avail_out = 0; // we don't want data auto zerr = inflateInit2(&stream, 16 + MAX_WBITS); // 16=gzip if (zerr == Z_OK) { Bytef name[MAX_PATH]{}; gz_header header{}; header.name = name; header.name_max = MAX_PATH; zerr = inflateGetHeader(&stream, &header); zerr = inflate(&stream, 0); if (zerr == Z_OK && name[0]) filename = reinterpret_cast<const char*>(name); inflateEnd(&stream); } } } } #endif // HAVE_ZLIB // If didn't read as a compressed file, open as normal file. if (!uRead) { FILE* f = fopen(path_.c_str(), "rb"); if (!f) throw posix_error(errno, path_.c_str()); uRead = fread(mem, 1, mem.size, f); fclose(f); m_compress = Compress::None; } // zip compressed? (and not handled above) if (uncompress && mem[0U] == 'P' && mem[1U] == 'K') throw util::exception("zlib support is not available for zipped files"); // gzip compressed? if (uncompress && mem[0U] == 0x1f && mem[1U] == 0x8b) { if (!have_zlib) throw util::exception("zlib support is not available for gzipped files"); // Unknowingly gzipped image files may be zipped, so we need to handle // a second level of decompression here. #ifdef HAVE_ZLIB MEMORY mem2(MAX_IMAGE_SIZE + 1); z_stream stream{}; stream.next_in = mem.pb; stream.avail_in = static_cast<uInt>(uRead); stream.next_out = mem2.pb; stream.avail_out = static_cast<uInt>(mem2.size); auto zerr = inflateInit2(&stream, 16 + MAX_WBITS); if (zerr == Z_OK) { Bytef name[MAX_PATH]{}; gz_header header{}; header.name = name; header.name_max = MAX_PATH; zerr = inflateGetHeader(&stream, &header); zerr = inflate(&stream, Z_FINISH); if (zerr == Z_STREAM_END && name[0]) filename = reinterpret_cast<const char*>(name); inflateEnd(&stream); } if (zerr != Z_STREAM_END) throw util::exception("gzip decompression failed (", zerr, ")"); memcpy(mem.pb, mem2.pb, uRead = stream.total_out); m_compress = Compress::Zip; #endif } // bzip2 compressed? if (uncompress && mem[0U] == 'B' && mem[1U] == 'Z') { #ifndef HAVE_BZIP2 throw util::exception("bzip2 support is not available"); #else MEMORY mem2(MAX_IMAGE_SIZE + 1); auto uBzRead = static_cast<unsigned>(mem2.size); auto bzerr = BZ2_bzBuffToBuffDecompress( reinterpret_cast<char*>(mem2.pb), &uBzRead, reinterpret_cast<char*>(mem.pb), static_cast<int>(uRead), 0, 0); if (bzerr != BZ_OK) throw util::exception("bzip2 decompression failed (", bzerr, ")"); memcpy(mem.pb, mem2.pb, uRead = uBzRead); m_compress = Compress::Bzip2; #endif // HAVE_BZIP2 } if (uncompress && mem.size > 6 && !memcmp(mem.pb, "\xfd\x37\x7a\x58\x5a\x00", 6)) { #ifndef HAVE_LZMA throw util::exception("lzma support is not available"); #else MEMORY mem2(MAX_IMAGE_SIZE + 1); lzma_stream strm{}; const uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK; auto ret = lzma_stream_decoder(&strm, UINT64_MAX, flags); if (ret == LZMA_OK) { strm.next_in = mem.pb; strm.avail_in = mem.size; strm.next_out = mem2.pb; strm.avail_out = mem2.size; ret = lzma_code(&strm, LZMA_FINISH); if (ret == LZMA_STREAM_END) { uRead = mem2.size - strm.avail_out; memcpy(mem.pb, mem2.pb, uRead); m_compress = Compress::Xz; ret = LZMA_OK; } } if (ret != LZMA_OK) throw util::exception("xz decompression failed (", ret, ")"); #endif } if (uRead <= MAX_IMAGE_SIZE) return open(mem.pb, static_cast<int>(uRead), path_, filename); throw util::exception("file size too big"); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x528, %rsp # imm = 0x528 movl %edx, %ebp movq %rsi, %r15 movq %rdi, 0x18(%rsp) leaq 0x30(%rsp), %rax movq %rax, -0x10(%rax) movq $0x0, -0x8(%rax) movb $0x0, (%rax) movl $0x10000001, %edi # imm = 0x10000001 callq 0x77560 movq %rax, %rbx callq 0x35100 movb (%rax), %r13b cmpb $0x31, %r13b sete %r14b andb %bpl, %r14b cmpb $0x1, %r14b jne 0x642dd movq (%r15), %rdi leaq 0x4b0b1(%rip), %rsi # 0xaf06c callq 0x35680 testq %rax, %rax je 0x646e1 movq %rax, %r12 movl $0x1, %esi movl $0x2, %edx movq %rbx, %rdi movq %rax, %rcx callq 0x358a0 testq %rax, %rax jne 0x63feb movw $0x0, (%rbx) movq %r12, %rdi callq 0x355a0 testb %r14b, %r14b je 0x642dd movzbl (%rbx), %eax cmpl $0x1f, %eax je 0x6412a cmpl $0x50, %eax jne 0x642dd cmpb $0x4b, 0x1(%rbx) jne 0x64122 movb %r13b, 0x17(%rsp) movq (%r15), %rdi callq 0xa8d4e movq %rax, %r12 testq %rax, %rax je 0x648b0 movq %r12, %rdi callq 0xa9550 xorl %r14d, %r14d movq %rbx, 0x58(%rsp) movl %eax, 0x60(%rsp) testl %eax, %eax jne 0x64536 xorps %xmm0, %xmm0 movups %xmm0, (%rsp) movl $0x200, %ecx # imm = 0x200 movq %r12, %rdi leaq 0x120(%rsp), %rsi leaq 0x320(%rsp), %rdx xorl %r8d, %r8d xorl %r9d, %r9d callq 0xa9470 cmpq $0x0, 0x158(%rsp) je 0x640b1 leaq 0x320(%rsp), %rdi callq 0x7765b testl %eax, %eax je 0x640a2 movq %r12, %rdi callq 0xa9df4 testl %eax, %eax je 0x640ca movq 0x158(%rsp), %rax cmpq %r14, %rax cmovaq %rax, %r14 xorl %r13d, %r13d testb %r13b, %r13b jne 0x64536 movq %r12, %rdi callq 0xa95b5 jmp 0x64044 movq %r12, %rdi movq %rbx, %rsi movl $0x10000001, %edx # imm = 0x10000001 callq 0xa9e38 movl %eax, 0x60(%rsp) movq %r12, %rdi callq 0xa8d9b movq %r15, %rbx movq 0x28(%rsp), %r15 leaq 0x320(%rsp), %rdi callq 0x35210 movb $0x1, %r13b leaq 0x20(%rsp), %rdi xorl %esi, %esi movq %r15, %rdx movq %rbx, %r15 movq 0x58(%rsp), %rbx leaq 0x320(%rsp), %rcx movq %rax, %r8 callq 0x358f0 jmp 0x640b4 cmpb $0x1f, %al jne 0x642dd cmpb $-0x75, 0x1(%rbx) jne 0x642dd movl %r13d, %r14d movq (%r15), %rdi leaq 0x4af2b(%rip), %rsi # 0xaf06c callq 0x358b0 movq %rax, %r12 testq %rax, %rax je 0x64870 movq %r12, %rdi movq %rbx, %rsi movl $0x10000001, %edx # imm = 0x10000001 callq 0x35b40 movl %eax, %r13d movq %r12, %rdi callq 0x35590 xorl %ecx, %ecx testl %eax, %eax sete %cl addl %ecx, %ecx movq 0x18(%rsp), %rax movl %ecx, 0x60(%rax) movq %r12, %rdi callq 0x359f0 movslq %r13d, %r12 movq 0x18(%rsp), %rax cmpl $0x2, 0x60(%rax) jne 0x642d8 movq (%r15), %rsi leaq 0x320(%rsp), %rdi movl $0x4, %edx callq 0x35b10 movq 0x320(%rsp), %rax movq -0x18(%rax), %rax movq 0x408(%rsp,%rax), %rsi leaq 0x40(%rsp), %rdi leaq 0x120(%rsp), %r13 movl $0xffffffff, %edx # imm = 0xFFFFFFFF xorl %ecx, %ecx movl $0xffffffff, %r8d # imm = 0xFFFFFFFF movq %r13, %r9 callq 0x638ec xorps %xmm0, %xmm0 leaq 0x60(%rsp), %rdi movaps %xmm0, (%rdi) movaps %xmm0, 0x10(%rdi) movaps %xmm0, 0x20(%rdi) movaps %xmm0, 0x60(%rdi) movaps %xmm0, 0x50(%rdi) movaps %xmm0, 0x40(%rdi) movaps %xmm0, 0x30(%rdi) movq 0x40(%rsp), %rax movq %rax, (%rdi) movl 0x48(%rsp), %ecx subl %eax, %ecx movl %ecx, 0x8(%rdi) movq %rax, 0x18(%rdi) movl $0x0, 0x20(%rdi) leaq 0x4ae3c(%rip), %rdx # 0xaf065 movl $0x1f, %esi movl $0x70, %ecx callq 0x354f0 testl %eax, %eax jne 0x642b4 movl $0x200, %edx # imm = 0x200 movq %r13, %rdi xorl %esi, %esi callq 0x352d0 xorps %xmm0, %xmm0 leaq 0xd0(%rsp), %rsi movaps %xmm0, 0x20(%rsi) movaps %xmm0, 0x30(%rsi) movaps %xmm0, 0x40(%rsi) movaps %xmm0, 0x10(%rsi) movaps %xmm0, (%rsi) movq %r13, 0x28(%rsi) movl $0x200, 0x30(%rsi) # imm = 0x200 leaq 0x60(%rsp), %rdi callq 0x351a0 leaq 0x60(%rsp), %rdi xorl %esi, %esi callq 0x354a0 testl %eax, %eax jne 0x642aa cmpb $0x0, 0x120(%rsp) je 0x642aa leaq 0x20(%rsp), %rdi leaq 0x120(%rsp), %rsi callq 0x35770 leaq 0x60(%rsp), %rdi callq 0x35620 movq 0x40(%rsp), %rdi testq %rdi, %rdi je 0x642cb movq 0x50(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x320(%rsp), %rdi callq 0x350f0 movl %r14d, %r13d jmp 0x642e0 xorl %r12d, %r12d testq %r12, %r12 jne 0x64332 movl %r13d, %r14d movq (%r15), %rdi leaq 0x4ad7a(%rip), %rsi # 0xaf06c callq 0x35680 testq %rax, %rax je 0x64721 movq %rax, %r13 movl $0x1, %esi movl $0x10000001, %edx # imm = 0x10000001 movq %rbx, %rdi movq %rax, %rcx callq 0x358a0 movq %rax, %r12 movq %r13, %rdi callq 0x355a0 movq 0x18(%rsp), %rax movl $0x0, 0x60(%rax) movl %r14d, %r13d testb %bpl, %bpl je 0x644b1 movb (%rbx), %al cmpb $0x50, %al jne 0x6434b cmpb $0x4b, 0x1(%rbx) je 0x64761 cmpb $0x1f, %al setne %al movl %ebp, %ecx xorb $0x1, %cl orb %al, %cl jne 0x644b1 cmpb $-0x75, 0x1(%rbx) jne 0x644b1 cmpb $0x31, %r13b jne 0x647a3 movl $0x10000001, %edi # imm = 0x10000001 callq 0x77560 movq %rax, %r13 xorps %xmm0, %xmm0 leaq 0x120(%rsp), %rdi movaps %xmm0, (%rdi) movaps %xmm0, 0x10(%rdi) movaps %xmm0, 0x20(%rdi) movaps %xmm0, 0x60(%rdi) movaps %xmm0, 0x50(%rdi) movaps %xmm0, 0x40(%rdi) movaps %xmm0, 0x30(%rdi) movq %rbx, (%rdi) movl %r12d, 0x8(%rdi) movq %rax, 0x18(%rdi) movl $0x10000001, 0x20(%rdi) # imm = 0x10000001 leaq 0x4aca8(%rip), %rdx # 0xaf065 movl $0x1f, %esi movl $0x70, %ecx callq 0x354f0 movl %eax, 0xd0(%rsp) testl %eax, %eax jne 0x64479 movq %r15, %r14 leaq 0x320(%rsp), %r15 movl $0x200, %edx # imm = 0x200 movq %r15, %rdi xorl %esi, %esi callq 0x352d0 xorps %xmm0, %xmm0 leaq 0x60(%rsp), %rsi movaps %xmm0, 0x20(%rsi) movaps %xmm0, 0x30(%rsi) movaps %xmm0, 0x40(%rsi) movaps %xmm0, 0x10(%rsi) movaps %xmm0, (%rsi) movq %r15, 0x28(%rsi) movl $0x200, 0x30(%rsi) # imm = 0x200 leaq 0x120(%rsp), %rdi callq 0x351a0 movl %eax, 0xd0(%rsp) leaq 0x120(%rsp), %rdi movl $0x4, %esi callq 0x354a0 movl %eax, 0xd0(%rsp) cmpl $0x1, %eax jne 0x64469 cmpb $0x0, 0x320(%rsp) je 0x64469 leaq 0x20(%rsp), %rdi leaq 0x320(%rsp), %rsi callq 0x35770 leaq 0x120(%rsp), %rdi callq 0x35620 movq %r14, %r15 cmpl $0x1, 0xd0(%rsp) jne 0x647db movq 0x148(%rsp), %r12 movq %rbx, %rdi movq %r13, %rsi movq %r12, %rdx callq 0x354c0 movq 0x18(%rsp), %rax movl $0x1, 0x60(%rax) movq %r13, %rdi callq 0x775ea testb %bpl, %bpl je 0x64618 cmpb $0x42, (%rbx) jne 0x644c9 cmpb $0x5a, 0x1(%rbx) je 0x64782 testb %bpl, %bpl je 0x64618 movl $0x587a37fd, %eax # imm = 0x587A37FD xorl (%rbx), %eax movzwl 0x4(%rbx), %ecx xorl $0x5a, %ecx orl %eax, %ecx jne 0x64618 movq %r15, %r14 movl $0x10000001, %edi # imm = 0x10000001 callq 0x77560 movq %rax, %r13 leaq 0x320(%rsp), %r15 movl $0x88, %edx movq %r15, %rdi xorl %esi, %esi callq 0x352d0 movq %r15, %rdi movq $-0x1, %rsi movl $0x2, %edx callq 0x35160 movl %eax, 0x120(%rsp) testl %eax, %eax je 0x6459d movq %r14, %r15 jmp 0x64602 cmpl $-0x64, 0x60(%rsp) jne 0x64691 movq %r12, %rdi callq 0xa9550 leaq 0x120(%rsp), %r13 movl %eax, 0x60(%rsp) testl %eax, %eax jne 0x64691 xorps %xmm0, %xmm0 movups %xmm0, (%rsp) movq %r12, %rdi movq %r13, %rsi xorl %edx, %edx xorl %ecx, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq 0xa9470 cmpq %r14, 0x158(%rsp) jne 0x64593 movq %r12, %rdi callq 0xa9df4 testl %eax, %eax je 0x64675 movq %r12, %rdi callq 0xa95b5 jmp 0x64551 leaq 0x320(%rsp), %rdi movq %rbx, (%rdi) movl $0x10000001, %ebp # imm = 0x10000001 movq %rbp, 0x8(%rdi) movq %r13, 0x18(%rdi) movq %rbp, 0x20(%rdi) movl $0x3, %esi callq 0x351f0 movl %eax, 0x120(%rsp) cmpl $0x1, %eax movq %r14, %r15 jne 0x64602 subq 0x340(%rsp), %rbp movq %rbx, %rdi movq %r13, %rsi movq %rbp, %rdx callq 0x354c0 movq 0x18(%rsp), %rax movl $0x4, 0x60(%rax) movl $0x0, 0x120(%rsp) movq %rbp, %r12 cmpl $0x0, 0x120(%rsp) jne 0x64827 movq %r13, %rdi callq 0x775ea cmpq $0x10000000, %r12 # imm = 0x10000000 ja 0x646bd leaq 0x20(%rsp), %r8 movq 0x18(%rsp), %rdi movq %rbx, %rsi movl %r12d, %edx movq %r15, %rcx callq 0x64a28 movq %rbx, %rdi callq 0x775ea movq 0x20(%rsp), %rdi leaq 0x30(%rsp), %rax cmpq %rax, %rdi je 0x64661 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movb $0x1, %al addq $0x528, %rsp # imm = 0x528 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %r12, %rdi movq %rbx, %rsi movl $0x10000001, %edx # imm = 0x10000001 callq 0xa9e38 movl %eax, 0x60(%rsp) movq %r12, %rdi callq 0xa8d9b movq %r12, %rdi callq 0xa8d63 movslq 0x60(%rsp), %r12 testq %r12, %r12 movb 0x17(%rsp), %r13b js 0x648ea movq 0x18(%rsp), %rax movl $0x1, 0x60(%rax) jmp 0x642e0 movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4aa74(%rip), %rsi # 0xaf148 movq %rax, %rdi callq 0x64fd6 jmp 0x647c2 movq %rbx, %r12 movl $0x20, %edi callq 0x35260 movq %r15, %rbx movq %rax, %r15 callq 0x35050 movl (%rax), %esi movq (%rbx), %rdx movq %r15, %rdi callq 0x61974 leaq 0x77cc3(%rip), %rsi # 0xdc3d0 movq 0x7884c(%rip), %rdx # 0xdcf60 movq %r15, %rdi callq 0x35a50 jmp 0x6492e movq %rbx, %r12 movl $0x20, %edi callq 0x35260 movq %r15, %rbx movq %rax, %r15 callq 0x35050 movl (%rax), %esi movq (%rbx), %rdx movq %r15, %rdi callq 0x61974 leaq 0x77c83(%rip), %rsi # 0xdc3d0 movq 0x7880c(%rip), %rdx # 0xdcf60 movq %r15, %rdi callq 0x35a50 jmp 0x6492e movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a91c(%rip), %rsi # 0xaf094 movq %rax, %rdi callq 0x46f2c jmp 0x647c2 movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a976(%rip), %rsi # 0xaf10f movq %rax, %rdi callq 0x61666 jmp 0x647c2 movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a909(%rip), %rsi # 0xaf0c3 movq %rax, %rdi callq 0x64e74 leaq 0x773b7(%rip), %rsi # 0xdbb80 movq 0x787b0(%rip), %rdx # 0xdcf80 movq %r15, %rdi movq %r12, %rbx callq 0x35a50 movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a901(%rip), %rsi # 0xaf0f3 leaq 0x4a7a7(%rip), %rcx # 0xaefa0 leaq 0xd0(%rsp), %rdx movq %rax, %rdi callq 0x64eea leaq 0x77370(%rip), %rsi # 0xdbb80 movq 0x78769(%rip), %rdx # 0xdcf80 movq %r15, %rdi movq %r12, %rbx callq 0x35a50 jmp 0x6492e movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a8f0(%rip), %rsi # 0xaf12e leaq 0x4a75b(%rip), %rcx # 0xaefa0 leaq 0x120(%rsp), %rdx movq %rax, %rdi callq 0x64f60 leaq 0x77324(%rip), %rsi # 0xdbb80 movq 0x7871d(%rip), %rdx # 0xdcf80 movq %r15, %rdi callq 0x35a50 jmp 0x6492e movq %rbx, %r12 movl $0x20, %edi callq 0x35260 movq %r15, %rbx movq %rax, %r15 callq 0x35050 movl (%rax), %esi movq (%rbx), %rdx movq %r15, %rdi callq 0x61974 leaq 0x77b34(%rip), %rsi # 0xdc3d0 movq 0x786bd(%rip), %rdx # 0xdcf60 movq %r15, %rdi movq %r12, %rbx callq 0x35a50 jmp 0x6492e movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a7a8(%rip), %rsi # 0xaf06f movq %rax, %rdi callq 0x5eb2e leaq 0x772aa(%rip), %rsi # 0xdbb80 movq 0x786a3(%rip), %rdx # 0xdcf80 movq %r15, %rdi movq %r12, %rbx callq 0x35a50 jmp 0x6492e movq %rbx, %r12 movl $0x10, %edi callq 0x35260 movq %rax, %r15 leaq 0x4a77b(%rip), %rsi # 0xaf07c leaq 0x4a698(%rip), %rcx # 0xaefa0 leaq 0x60(%rsp), %rdx movq %rax, %rdi callq 0x64dfe leaq 0x77264(%rip), %rsi # 0xdbb80 movq 0x7865d(%rip), %rdx # 0xdcf80 movq %r15, %rdi movq %r12, %rbx callq 0x35a50 jmp 0x649d4 jmp 0x649d4 jmp 0x6494c movq %rbx, %r12 movq %rax, %r14 jmp 0x64969 jmp 0x649ee jmp 0x649d4 movq %rbx, %r12 movq %rax, %r14 movq 0x40(%rsp), %rdi testq %rdi, %rdi je 0x64969 movq 0x50(%rsp), %rsi subq %rdi, %rsi callq 0x355d0 leaq 0x320(%rsp), %rdi callq 0x350f0 jmp 0x649f4 movq %rax, %r14 jmp 0x64988 movq %rax, %r14 movq %r15, %rdi callq 0x35430 movq %r13, %rdi callq 0x775ea jmp 0x649f4 jmp 0x64a20 movq %rax, %r14 movq %r15, %rdi callq 0x35430 jmp 0x649be jmp 0x649d4 jmp 0x649ee jmp 0x64a20 jmp 0x649ee jmp 0x64a20 jmp 0x649ee jmp 0x649d4 jmp 0x649d4 jmp 0x649ee jmp 0x649b8 movq %rbx, %r12 movq %rax, %r14 movq %r13, %rdi callq 0x775ea jmp 0x649f4 jmp 0x649f1 jmp 0x649d4 jmp 0x64a20 jmp 0x649ee jmp 0x649f1 jmp 0x649d4 movq %rax, %r14 movq %r15, %rdi callq 0x35430 jmp 0x649f4 jmp 0x649ee jmp 0x64a20 movq %rax, %r14 jmp 0x649fc jmp 0x649ee jmp 0x649ee movq %rbx, %r12 movq %rax, %r14 movq %r12, %rdi callq 0x775ea movq 0x20(%rsp), %rdi leaq 0x30(%rsp), %rax cmpq %rax, %rdi je 0x64a18 movq 0x30(%rsp), %rsi incq %rsi callq 0x355d0 movq %r14, %rdi callq 0x35aa0 movq %rax, %rdi callq 0x410ac
/simonowen[P]samdisk/src/MemFile.cpp
MemFile::open(void const*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool MemFile::open(const void* buf, int len, const std::string& path_, const std::string& filename_) { auto pb = reinterpret_cast<const uint8_t*>(buf); m_data.clear(); m_it = m_data.insert(m_data.begin(), pb, pb + len); m_path = path_; m_filename = filename_; // If a filename wasn't supplied from an archive, determine it here. if (filename_.empty()) { std::string::size_type pos = m_path.rfind(PATH_SEPARATOR_CHR); m_filename = (pos == m_path.npos) ? m_path : m_path.substr(pos + 1); // Remove the archive extension from single compressed files. if (IsFileExt(m_filename, "gz") || IsFileExt(m_filename, "xz")) m_filename = m_filename.substr(0, m_filename.size() - 3); else if (IsFileExt(m_filename, "bz2")) m_filename = m_filename.substr(0, m_filename.size() - 4); } return true; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x48, %rsp movq %r8, %r15 movq %rcx, %rbx movl %edx, %eax movq %rsi, %rdx movq %rdi, %r14 addq $0x40, %rdi movq 0x40(%r14), %rsi cmpq %rsi, 0x48(%r14) je 0x64a56 movq %rsi, 0x48(%r14) movslq %eax, %rcx addq %rdx, %rcx callq 0x65410 movq 0x40(%r14), %rax movq %rax, 0x58(%r14) movq %r14, %rdi movq %rbx, %rsi callq 0x352c0 leaq 0x20(%r14), %rbx movq %rbx, %rdi movq %r15, %rsi callq 0x352c0 cmpq $0x0, 0x8(%r15) jne 0x64c2d movq %r14, %rdi movl $0x2f, %esi movq $-0x1, %rdx callq 0x35ba0 leaq 0x18(%rsp), %r12 cmpq $-0x1, %rax je 0x64ac9 incq %rax leaq 0x8(%rsp), %rdi movq %r14, %rsi movq %rax, %rdx movq $-0x1, %rcx callq 0x35600 jmp 0x64ae0 leaq 0x8(%rsp), %rdi movq %r12, (%rdi) movq (%r14), %rsi movq 0x8(%r14), %rdx addq %rsi, %rdx callq 0x41ad6 leaq 0x8(%rsp), %r15 movq %rbx, %rdi movq %r15, %rsi callq 0x35700 movq (%r15), %rdi cmpq %r12, %rdi je 0x64b05 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x8(%rsp), %rdi movq %r12, (%rdi) leaq 0x4a646(%rip), %rsi # 0xaf15a leaq 0x4a641(%rip), %rdx # 0xaf15c callq 0x445b8 leaq 0x8(%rsp), %rsi movq %rbx, %rdi callq 0x77230 movl %eax, %r15d movb $0x1, %bpl testb %al, %al jne 0x64b67 leaq 0x38(%rsp), %r13 movq %r13, -0x10(%r13) leaq 0x4a51b(%rip), %rsi # 0xaf062 leaq 0x4a516(%rip), %rdx # 0xaf064 leaq 0x28(%rsp), %rdi callq 0x445b8 leaq 0x28(%rsp), %rsi movq %rbx, %rdi callq 0x77230 movl %eax, %ebp testb %r15b, %r15b jne 0x64b87 leaq 0x38(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64b87 movq 0x38(%rsp), %rsi incq %rsi callq 0x355d0 movq 0x8(%rsp), %rdi cmpq %r12, %rdi je 0x64b9e movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 testb %bpl, %bpl je 0x64bad movq 0x28(%r14), %rcx addq $-0x3, %rcx jmp 0x64bfb leaq 0x8(%rsp), %rdi movq %r12, (%rdi) leaq 0x4a5a1(%rip), %rsi # 0xaf15d leaq 0x4a59d(%rip), %rdx # 0xaf160 callq 0x445b8 leaq 0x8(%rsp), %rsi movq %rbx, %rdi callq 0x77230 movl %eax, %ebp movq 0x8(%rsp), %rdi cmpq %r12, %rdi je 0x64bee movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 testb %bpl, %bpl je 0x64c2d movq 0x28(%r14), %rcx addq $-0x4, %rcx leaq 0x8(%rsp), %r14 movq %r14, %rdi movq %rbx, %rsi xorl %edx, %edx callq 0x35600 movq %rbx, %rdi movq %r14, %rsi callq 0x35700 movq (%r14), %rdi cmpq %r12, %rdi je 0x64c2d movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movb $0x1, %al addq $0x48, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x64c60 jmp 0x64c7c movq %rax, %rbx movq 0x28(%rsp), %rdi cmpq %r13, %rdi je 0x64c63 movq 0x38(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x64c63 jmp 0x64c60 movq %rax, %rbx movq 0x8(%rsp), %rdi cmpq %r12, %rdi je 0x64c7f movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 jmp 0x64c7f movq %rax, %rbx movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/src/MemFile.cpp
MemFile::read(int)
std::vector<uint8_t> MemFile::read(int len) { auto avail_bytes = std::min(len, remaining()); std::vector<uint8_t> data(m_it, m_it + avail_bytes); m_it += avail_bytes; return data; }
pushq %r15 pushq %r14 pushq %rbx subq $0x10, %rsp movq %rsi, %rbx movq %rdi, %r14 movl 0x48(%rsi), %eax movq 0x58(%rsi), %rsi subl %esi, %eax cmpl %edx, %eax cmovgel %edx, %eax movslq %eax, %r15 leaq (%rsi,%r15), %rdx leaq 0xf(%rsp), %rcx callq 0x6504c addq %r15, 0x58(%rbx) movq %r14, %rax addq $0x10, %rsp popq %rbx popq %r14 popq %r15 retq nop
/simonowen[P]samdisk/src/MemFile.cpp
MemFile::read(void*, int, int)
int MemFile::read(void* buf, int len, int count) { if (!len) return count; // can read as many zero-length units as requested! auto avail_items = std::min(count, remaining() / len); read(buf, avail_items * len); return avail_items; }
pushq %r15 pushq %r14 pushq %rbx movl %ecx, %ebx testl %edx, %edx je 0x64da9 movl %edx, %ecx movq %rdi, %r14 movl 0x48(%rdi), %edi movq 0x58(%r14), %r8 subl %r8d, %edi movl %edi, %eax cltd idivl %ecx cmpl %ebx, %eax cmovll %eax, %ebx imull %ebx, %ecx cmpl %ecx, %edi cmovll %edi, %ecx setl %al testl %ecx, %ecx sete %dl orb %al, %dl jne 0x64da9 movslq %ecx, %r15 movq %rsi, %rdi movq %r8, %rsi movq %r15, %rdx callq 0x354c0 addq %r15, 0x58(%r14) movl %ebx, %eax popq %rbx popq %r14 popq %r15 retq nop
/simonowen[P]samdisk/src/MemFile.cpp
util::exception::exception<char const (&) [24], int&, char const (&) [2]>(char const (&) [24], int&, char const (&) [2])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x6508d movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64e3b movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x76d66(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64e6b movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
util::exception::exception<char const (&) [48]>(char const (&) [48])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x65155 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64eb1 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x76cf0(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64ee1 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
util::exception::exception<char const (&) [28], int&, char const (&) [2]>(char const (&) [28], int&, char const (&) [2])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x651ea movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64f27 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x76c7a(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64f57 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
util::exception::exception<char const (&) [26], lzma_ret&, char const (&) [2]>(char const (&) [26], lzma_ret&, char const (&) [2])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x652b2 movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64f9d movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x76c04(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x64fcd movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
util::exception::exception<char const (&) [18]>(char const (&) [18])
explicit exception(Args&& ... args) : std::runtime_error(make_string(std::forward<Args>(args)...)) {}
pushq %r14 pushq %rbx subq $0x28, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %r14 movq %r14, %rdi callq 0x6537a movq %rbx, %rdi movq %r14, %rsi callq 0x35710 leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x65013 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 leaq 0x76b8e(%rip), %rax # 0xdbba8 movq %rax, (%rbx) addq $0x28, %rsp popq %rbx popq %r14 retq movq %rax, %rbx leaq 0x18(%rsp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x65043 movq 0x18(%rsp), %rsi incq %rsi callq 0x355d0 movq %rbx, %rdi callq 0x35aa0 nop
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [48]>(char const (&) [48])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rsi, %r14 movq %rdi, %rbx leaq 0x8(%rsp), %r15 movq %r15, %rdi callq 0x35760 movq %r14, %rdi callq 0x35210 movq %r15, %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x77dda(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r14 popq %r15 retq jmp 0x651c4 movq %rax, %rbx movq 0x77daa(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> util::make_string<char const (&) [26], lzma_ret&, char const (&) [2]>(char const (&) [26], lzma_ret&, char const (&) [2])
std::string make_string(Args&& ... args) { std::ostringstream ss; (void)std::initializer_list<bool> {(ss << args, false)...}; return ss.str(); }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x180, %rsp # imm = 0x180 movq %rcx, %r14 movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %rbx leaq 0x8(%rsp), %r13 movq %r13, %rdi callq 0x35760 movq %r12, %rdi callq 0x35210 movq %r13, %rdi movq %r12, %rsi movq %rax, %rdx callq 0x356a0 movl (%r15), %esi leaq 0x8(%rsp), %rdi callq 0x35a80 movq %r14, %rdi callq 0x35210 leaq 0x8(%rsp), %rdi movq %r14, %rsi movq %rax, %rdx callq 0x356a0 leaq 0x10(%rsp), %rsi movq %rbx, %rdi callq 0x35920 movq 0x77c4e(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rax addq $0x180, %rsp # imm = 0x180 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x65354 movq %rax, %rbx movq 0x77c1a(%rip), %rsi # 0xdcf78 leaq 0x8(%rsp), %rdi callq 0x352b0 leaq 0x78(%rsp), %rdi callq 0x35180 movq %rbx, %rdi callq 0x35aa0
/simonowen[P]samdisk/include/utils.h