From: Nick Newsgroups: comp.os.msdos.djgpp Subject: ASPI issue Date: Sun, 06 Jul 2003 13:48:48 +0200 Organization: Serveur de NEWS des eleves de l'I.I.E. Lines: 74 Message-ID: NNTP-Posting-Host: gravelle-1-81-57-174-106.fbx.proxad.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: goldorak.iie.cnam.fr 1057492243 13961 81.57.174.106 (6 Jul 2003 11:50:43 GMT) X-Complaints-To: newsmaster AT listes DOT iiens DOT net NNTP-Posting-Date: Sun, 6 Jul 2003 11:50:43 +0000 (UTC) X-Newsreader: Forte Agent 1.8/32.548 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello all, I'm attempting to write a programs to read SCSI drives, hence I need to use ASPI. Unfortunately the ASPI drivers are in real mode and DJGPP is in protected mode. That's where my problems begin. My code is void ( *Aspi )( unsigned char * ) = ( void * )0; static __dpmi_regs callback_regs; static _go32_dpmi_seginfo callback_info; typedef struct { unsigned char commandCode; unsigned char commandStatus; unsigned char hostAdapterNo; unsigned char scsiRequestFlag; unsigned char reserved1[ 4 ]; unsigned char targetId; unsigned char targetLun; unsigned char dataAllocLength[4]; unsigned char senseAllocLength; unsigned char dataBufferOffset[4]; unsigned char dataBufferSegment[4]; unsigned char srbLinkOffest[4]; unsigned char srbLinkSegment[4]; unsigned char scsiCdbLength; unsigned char hostAdapterStatus; unsigned char targetStatus; unsigned char postRoutineOffset[4]; unsigned char postRoutineSegment[4]; unsigned char reserved2[ 34 ]; unsigned char cdb[ 6 ]; unsigned char sense[ SENSE_LENGTH ]; } srbCdb6; srbCdb6 srb; int AspiInit() { int handle; __dpmi_regs rg; if( ( handle = open( "SCSIMGR$", O_RDONLY ) ) == -1 ){ printf( "Error : ASPI SCSI manager not found.\n" ); printf( " Please add ASPI SCSI manager to your config.sys.\n" ); return( -1 ); } callback_info.pm_offset = (long)Aspi; _go32_dpmi_allocate_real_mode_callback_retf(&callback_info, &callback_regs); rg.x.ax = 0x4402; /* IOCTL in */ rg.x.bx = handle; rg.x.cx = 4; rg.x.es = callback_info.rm_segment; rg.x.dx = callback_info.rm_offset; __dpmi_int(0x21, &rg); close( handle ); return( 0 ); } And when I try to use Aspi(srb) I have a seg fault. I assume it's because either srb should be in Dos memory, but i've copied it in __tb and it crashed as well, or Aspi is not well defined, or there is something else I didn't catch. Thanks for your help Nick