Skip to content

atad: fix zero-progress loop for 65536-sector LBA48 transfers - #913

Merged
uyjulian merged 1 commit into
ps2dev:masterfrom
LAP87:fix-lba48-65536-sector-io
Aug 27, 2026
Merged

atad: fix zero-progress loop for 65536-sector LBA48 transfers#913
uyjulian merged 1 commit into
ps2dev:masterfrom
LAP87:fix-lba48-65536-sector-io

Conversation

@LAP87

@LAP87 LAP87 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

ata_device_sector_io64 narrows the per-iteration transfer length to u16 before using it for the loop accounting. A request of 65536 sectors or more therefore computes len == 0, passes blkcount 0 to sceAtaExecCmd, and advances buf/lba/nsectors by zero — an infinite loop that never makes progress.

This change keeps the iteration length in a u32 (chunk) and only narrows to u16 for the sector-count register, where 0 legitimately means 65536. The 28-bit path is expressed the same way for consistency; its behaviour is unchanged (max 256).

Found while characterizing large GPT/exFAT drives on clone network adapters (measurements and test tooling: https://github.com/LAP87/ps2-gamestar-pio), but the defect is independent of adapter type — any BDM/APA caller requesting ≥ 32 MiB in one call hits it.

🤖 Generated with Claude Code

ata_device_sector_io64 truncates the per-iteration length to u16 before
using it for the transfer accounting. A request of 65536 sectors or more
therefore computes len == 0, passes blkcount 0 to sceAtaExecCmd, and
advances buf/lba/nsectors by zero - an infinite loop that never makes
progress.

Keep the iteration length in a u32 and only narrow it to u16 for the
sector-count register, where 0 legitimately means 65536.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@uyjulian

Copy link
Copy Markdown
Member

Looks good to me

@uyjulian
uyjulian merged commit 6d169e7 into ps2dev:master Aug 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants