[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using XMS function 0bh - move EMB
- To: Mailing List Recipients <pci-sig-request@znyx.com>
- Subject: using XMS function 0bh - move EMB
- From: Noam Efrati <noam@genie.terra.co.il>
- Date: Wed, 30 Oct 1996 10:40:40 +0200 (IST)
- Resent-Date: Wed, 30 Oct 1996 10:40:40 +0200 (IST)
- Resent-From: pci-sig-request@znyx.com
- Resent-Message-Id: <"hsyVh1.0.Yt.qKnTo"@dart>
- Resent-Sender: pci-sig-request@znyx.com
Hi all,
I am trying to read from a 32-bit address space in real mode,
using the XMS function 0b (move extended memory block).
The function is described in a book from 1991 called DOS
extending.
The C code is listed below. I run it with a debugger and I saw that
the xms call returns 01 in AX, which is a result of a successful
operation. Still the value of the destination location in memory
remains unchanged.
I have loaded the himem.sys, and the command mem/c finds xms
and reports an xms version of 3.00.
I would appreciate an answer if someone had experienced in this
before.
Thanks, noam.
==============================================================
#include <alloc.h>
#include <dos.h>
#include <stdlib.h>
unsigned long read_pci_space(linear_address)
unsigned long linear_address;
{
static int first_call = 1;
void far (*xms_function)();
static void far (*xms_entry_point)();
unsigned long *destination;
unsigned long pci_address,return_value;
unsigned long destination_address;
unsigned int *parameter_block;
unsigned int shandle=0,dhandle=0;
unsigned int temp[8],i;
unsigned int block_segment,block_offset;
union REGS regs;
struct SREGS sregs;
if (first_call)
{
first_call = 0;
regs.x.ax = 0x4310; /* func. 43h, subf. 10h */
int86x(0x2f,®s,®s,&sregs);
xms_function = MK_FP(sregs.es,regs.x.bx);
xms_entry_point = xms_function;
}
else xms_function = xms_entry_point;
destination = malloc(4);
destination_address = 16 * (unsigned long)(FP_SEG(destination)) +
(unsigned long)(FP_OFF(destination));
*destination = 0;
parameter_block = malloc(16);
block_segment = FP_SEG(parameter_block);
block_offset = FP_OFF(parameter_block);
*parameter_block = 4; /* move one dword */
*(parameter_block + 1) = 0;
*(parameter_block + 2) = shandle;
*(parameter_block + 3) = (unsigned int)(linear_address);
*(parameter_block + 4) = (unsigned int)(linear_address >> 16);
*(parameter_block + 5) = dhandle;
*(parameter_block + 6) = (unsigned int)(destination_address);
*(parameter_block + 7) = (unsigned int)(destination_address >> 16);
/* for debug */
for (i=0;i<8;++i)
temp[i] = *(parameter_block + i);
/* xms function: move extended memory block */
asm {
push ds
push si
push ax
}
_AH = 0x0b;
_SI = block_offset;
_DS = block_segment;
(*xms_function)();
asm {
pop ax
pop si
pop ds
}
free(parameter_block);
return_value = *destination;
free(destination);
return(return_value);
}
=========================================================================
Noam Efrati | e-mail: noam@terra.co.il
Terra computers ltd. | phone : 972-7-6483444
Omer Industrial Park | fax : 972-7-6483445
84965 Israel |
=========================================================================
× ,