ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/03/15/02:48:27

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Tue, 15 Mar 2011 02:48:22 -0400
Message-Id: <E1PzO3K-0007xl-Bg@fencepost.gnu.org>
From: Eli Zaretskii <eliz AT gnu DOT org>
To: djgpp AT delorie DOT com
In-reply-to:
<428d9bd6-efc5-4f66-bab3-961a0c4598f9 AT f31g2000pri DOT googlegroups DOT com>
(message from Jim Michaels on Mon, 14 Mar 2011 16:38:41 -0700 (PDT))
Subject: Re: csdpmi7 not working on virtualbox, how use dosmemget with seg ofs
from int21h?
References: <39cdc18e-eccb-4213-b896-db3be020702e AT w9g2000prg DOT googlegroups DOT com>
<iknmth$1lb$1 AT speranza DOT aioe DOT org> <3e035797-6b8e-4106-bd29-98e87a9cc121 AT a21g2000prj DOT googlegroups DOT com>
<E1Pz5o6-0001qv-4s AT fencepost DOT gnu DOT org> <428d9bd6-efc5-4f66-bab3-961a0c4598f9 AT f31g2000pri DOT googlegroups DOT com>
Reply-To: djgpp AT delorie DOT com

> From: Jim Michaels <jmichae3 AT yahoo DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Mon, 14 Mar 2011 16:38:41 -0700 (PDT)
> 
> I tried this, and I got 0 for a structure size back.

You mean in your ret_size_of_returned_structure member?  Or somewhere
else?

Did you check the Carry flag after __dpmi_int returns?  If the CF is
set, it means the interrupt failed, and the AX register will contain
the error code.  Did you check that?

> #if defined(__DJGPP__)
> #define HANDLE_PRAGMA_PACK_PUSH_POP 1
> #pragma pack(push,1)
> 
> typedef struct extFAT32FreeSpaceStructure {
> /* 00h	WORD*/uint16_t	ret_size_of_returned_structure;
> /* 02h	WORD*/uint16_t	call_structure_version_ret_actual_structure_version;// (0000h)
> /* 04h	DWORD*/uint32_t number_of_sectors_per_cluster_with_adjustment_for_compression;
> /* 08h	DWORD*/uint32_t	number_of_bytes_per_sector;
> /* 0Ch	DWORD*/uint32_t	number_of_available_clusters;
> /* 10h	DWORD*/uint32_t	total_number_of_clusters_on_the_drive;
> /* 14h	DWORD*/uint32_t	number_of_physical_sectors_available_on_the_drive_without_adjustment_for_compression;
> /* 18h	DWORD*/uint32_t	total_number_of_physical_sectors_on_the_drive_without_adjustment_for_compression;
> /* 1Ch	DWORD*/uint32_t	number_of_available_allocation_units_without_adjustment_for_compression;
> /* 20h	DWORD*/uint32_t	total_allocation_units_without_adjustment_for_compression;
> /* 24h  8 BYTEs*/uint64_t	reserved;
> uint32_t wastedspace;
> } extFAT32FreeSpaceStructure;
> 
> #pragma pack(pop)
> 
> #endif
> 
> 
> 
> 
> #define STR_OFS 0x30
> #define STRUCT_OFS 0x0
>                   unsigned long adr=r.x.es;
>                     adr<<=4;
>                     adr += r.x.di;
>                     dosmemget(__tb+STRUCT_OFS+adr, sizeof(extFAT32FreeSpaceStructure), pds);

What is `pds' here?  Please show complete code, not fragments that
omit crucial details.

And why do you include the `wastedspace' member in the struct?  It is
not part of the structure, according to RBIL.

Also, what does `sizeof(extFAT32FreeSpaceStructure)' return?  It
should be 32; if not, you should look for a bug.

Anyway, your use of dosmemget is incorrect.  According to the
dosmemget documentation, ES:DI is not an offset into the transfer
buffer, it's the real-time SEG:OFF address itself.  So you should do
this:

  dosmemget(adr, sizeof(extFAT32FreeSpaceStructure), pds);

(assuming `pds' is correct, and you remove `wastedspace' from the
structure, because it makes you fetch data beyond what DOS fills in).

Or you could use __tb+STRUCT_OFS instead of `adr', because my reading
of RBIL is that DOS fills the buffer whose address you passed to it in
ES:DI when you called __dpmi_int.  Per the FAQ, you should have put
the segment and offset of __tb in ES:DI before invoking __dpmi_int, so
the buffer filled by DOS is in the transfer buffer, and __tb is its
address.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019