From 37d4621bd4a912b6a032bc21906f7032e602cbf2 Mon Sep 17 00:00:00 2001 From: Niklas Hallqvist Date: Sat, 23 Nov 1996 04:12:06 +0000 Subject: Merge to Cygnus 961112 + add some support (not ready) for shared libs --- gnu/usr.bin/binutils/gdb/mswin/win-e7kpc.c | 160 +++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 gnu/usr.bin/binutils/gdb/mswin/win-e7kpc.c (limited to 'gnu/usr.bin/binutils/gdb/mswin/win-e7kpc.c') diff --git a/gnu/usr.bin/binutils/gdb/mswin/win-e7kpc.c b/gnu/usr.bin/binutils/gdb/mswin/win-e7kpc.c new file mode 100644 index 00000000000..d4745f447b8 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/mswin/win-e7kpc.c @@ -0,0 +1,160 @@ + +/* This code is 32-bit code which calls 16-bit functions defined in + * win-e7kpc16.c in order to interface with the memory mapped + * physical memory for the Hitachi e7000-pc. + */ + +#include +#include "win-e7kpc.h" +typedef int (CALLBACK *PROC16_PFN)(int); + +// Prototype undocumented KERNEL32 functions +HINSTANCE WINAPI LoadLibrary16( PSTR ); +void WINAPI FreeLibrary16( HINSTANCE ); +FARPROC WINAPI GetProcAddress16( HINSTANCE, PSTR ); +void __cdecl QT_Thunk(void); + +PROC16_PFN pfn_set_mem = 0; // We don't want these as locals in +PROC16_PFN pfn_get_mem = 0; +HINSTANCE hInstUser16; // main(), since QT_THUNK could +static long save_sp; +static WORD set_mem_rc; // trash them... +static WORD mem; +static long mem_offset; +static long mem_parms; + + static int i; +//============= stand-alone test code ================== +#ifdef STAND_ALONE + static int len=20; + static int offset=10; + static char buf[512]; + static FILE *fout; +#ifdef _WIN32 +main() + +#else + int PASCAL WinMain (HINSTANCE hinst, + HINSTANCE hinstPrev, + LPSTR lpszCmdLine, + int cmdShow + ) +#endif +{ + //============= trash space ================== + char buffer[0x40]; + buffer[0] = 0; // Make sure to use the local variable so that the + // compiler sets up an EBP frame + + fout=fopen("errs","w"); + fprintf(fout,"Testing... i=%d, offset=%d\n", i,offset); + if (win_load_e7kpc() != 0) + { + fprintf(fout,"ERROR! unable to load e7kpc dll\n"); + return 1; + } + + //============= do test ============================ + for (i=0; i