Mail Archives: djgpp/1994/08/07/03:16:03
movedata() and dosmemxxx() should do the same thing, but
movedata() seems not always to work. The following short
program illustrates this. Under DPMI, it GP faults when
movedata() is used, but works ok if dosmemput() is used
instead. (When invoked with GO32=nodpmi, it doesn't bomb,
but prints garbage instead of argv[0].)
-------------- file movd_tst.c -------------------
#include <stdio.h>
#include <stdlib.h>
#include <dpmi.h>
#include <go32.h>
void main(int argc, char *argv[])
{
char progname[128];
#ifdef MOVEDATA
movedata(_go32_my_ds(), (u_int)argv[0], _go32_conventional_mem_selector(),
_go32_info_block.linear_address_of_transfer_buffer,
strlen(argv[0]) + 1);
#else
dosmemput(argv[0], strlen(argv[0]) + 1,
_go32_info_block.linear_address_of_transfer_buffer);
#endif
dosmemget(_go32_info_block.linear_address_of_transfer_buffer,
strlen(argv[0]) + 1, progname);
printf("Copy: %s\n", progname);
exit(0);
}
-----------------------------------------------------
What's the reason for that? I want to use movedata() because
it's faster: it moves 32-bit words instead of bytes (my actual
program moves more than a few bytes to conventional memory, so
it could be a win).
What am I doing wrong? Can anybody help me?
Eli Zaretskii
- Raw text -