delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/04/13:02:57

Date: Sun, 4 Sep 1994 08:42:39 -0700 (PDT)
From: "Frederick W. Reimer" <fwreimer AT crl DOT com>
Subject: Callback clarifications
To: djgpp <djgpp AT sun DOT soe DOT clarkson DOT edu>

I am writing an interface library for packet drivers for use by djgpp 
programs.  I have the latest specs from FTP (PDS111.TXT) and have 
reviewed the sample packet driver included with djgpp (pktdrvr.c).  My 
test programs work, but end up in missing a lot of packets.  I would like 
to restructure my programs to speed them up, but need some clairification 
on how callbacks are implemented in djgpp.

The packet driver needs a callback function so the application program 
can receive packets of a certain type.  I followed the example and used 
_go32_dpmi_allocate_real_mode_callback_retf and passed the segment and 
offset generated to the real mode packet driver (via 
_go32_simulate_int).  The question is: once my callback function gets 
control of the system, is it in protected mode?  I would guess that it 
is, since it would get compiled into 32 bit code, but am not quite 
positive.  The callback function needs to provide the packet driver with 
the address (real mode) of a buffer which the packet driver will copy the 
packet into.  I would like to use a large buffer for all packets.  Can my 
callback function use the _go32_dpmi_allocate_dos_memory and somehow 
specify where the memory will be located at?

If this is not making sense look at it like this:

I want to allocate a large buffer like so:
#define MTU 1500
char packets[1000][MTU];
int next_available_packet = 0;

and in the callback function send the packet driver the real mode address 
of a particular element of the packets array:
realmode_address =
	_go32_get_real_mode_address(packets[next_available_packet++]);

is this possible?


The other option is that, in later versions of the packet driver spec, 
the driver should provide a real mode address of a look ahead buffer to 
the callback function.  If I can get the protected mode linear address of 
this real mode address, I could use _go32_dosmemget to copy the packet 
from the real mode buffer to my protected mode array.  However, this is 
only available with more recent packet drivers, and would not work on 
older packet drivers.


Fred Reimer

+-------------------------------------------------------------+
| The views expressed in the above are solely my own, and are |
| not necessarily the views of my employer.  Have a nice day! |
| PGP2.6 public key available via `finger fwreimer AT crl DOT com`   |
+-------------------------------------------------------------+



- Raw text -


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