MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / command_write

Function command_write

src/scsiemul.cpp:456–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456static int command_write(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
457{
458 uae_u32 blocksize = dev->di.bytespersector;
459 length /= blocksize;
460 offset /= blocksize;
461 while (length > 0) {
462 uae_u8 buffer[4096];
463 int err;
464 trap_memcpyah_safe(ctx, buffer, data, blocksize);
465 err = sys_command_write (dev->unitnum, buffer, (int)offset, 1);
466 if (!err)
467 return 20;
468 if (err < 0)
469 return 28; // write protected
470 data += blocksize;
471 offset++;
472 length--;
473 }
474 return 0;
475}
476
477static int command_cd_read(TrapContext *ctx, struct devstruct *dev, uaecptr data, uae_u64 offset, uae_u32 length, uae_u32 *io_actual)
478{

Callers 1

dev_do_io_cdFunction · 0.85

Calls 2

trap_memcpyah_safeFunction · 0.85
sys_command_writeFunction · 0.85

Tested by

no test coverage detected