summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-27 11:47:53 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-27 11:47:53 +0000
commit1aa54c6db6a10bf671a80eddf93630fbbea4f810 (patch)
tree6c2d44ce06689e3dfa7b80f4f0d52fb0825e5ad9 /win32
parent41e9245e853c6d1f02a60f431afa87aeb7749787 (diff)
* include/ruby/win32.h, win32/Makefile.sub, win32/configure.bat,
win32/mkexports.rb, win32/setup.mak, win32/win32.c: import x64-mswin64 port. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile.sub7
-rwxr-xr-xwin32/configure.bat5
-rwxr-xr-xwin32/mkexports.rb2
-rw-r--r--win32/setup.mak25
-rw-r--r--win32/win32.c42
5 files changed, 55 insertions, 26 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 1cfa8435f3..b9d02efcb3 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -255,7 +255,11 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub
#define SIZEOF___INT64 8
#define _INTEGRAL_MAX_BITS 64
#define SIZEOF_OFF_T 8
+!if "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
+#define SIZEOF_VOIDP 8
+!else
#define SIZEOF_VOIDP 4
+!endif
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
!if $(MSC_VER) >= 1400
@@ -520,7 +524,8 @@ $(LIBRUBY_SO): $(LIBRUBY_A) $(DLDOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
$(LDSHARED_2)
$(RUBYDEF): $(LIBRUBY_A) $(PREP)
- $(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A)
+ $(MINIRUBY) $(srcdir)/win32/mkexports.rb \
+ -output=$@ -arch=$(ARCH) $(LIBRUBY_A)
{$(srcdir)/win32}.def.lib:
$(AR) $(ARFLAGS)$@ -def:$<
diff --git a/win32/configure.bat b/win32/configure.bat
index 96e2ab40c3..f6aad57b8c 100755
--- a/win32/configure.bat
+++ b/win32/configure.bat
@@ -65,6 +65,11 @@ goto :loop
:target
echo>> ~tmp~.mak "%2" \
echo>>confargs.tmp --target=%2 \
+ if "%2" == "x64-mswin64" goto target2
+ if NOT "%2" == "ia64-mswin64" goto target3
+:target2
+ echo>> ~tmp~.mak "OS=mswin64" \
+:target3
shift
shift
goto :loop
diff --git a/win32/mkexports.rb b/win32/mkexports.rb
index 7ef12cdffd..90c4d7f914 100755
--- a/win32/mkexports.rb
+++ b/win32/mkexports.rb
@@ -80,7 +80,7 @@ end
class Exports::Mswin < Exports
def each_export(objs)
- noprefix = ($arch ||= nil and /^sh/ !~ $arch)
+ noprefix = ($arch ||= nil and /^(sh|i\d86)/ !~ $arch)
objs = objs.collect {|s| s.tr('/', '\\')}
filetype = nil
IO.popen(%w"dumpbin -symbols -exports" + objs) do |f|
diff --git a/win32/setup.mak b/win32/setup.mak
index 797ed56a02..eb7b24b69b 100644
--- a/win32/setup.mak
+++ b/win32/setup.mak
@@ -12,7 +12,9 @@ srcdir = $(WIN32DIR)/..
!ifndef prefix
prefix = /usr
!endif
+!if "$(OS)" != "mswin64"
OS = mswin32
+!endif
BANG = !
APPEND = echo>>$(MAKEFILE)
!ifdef MAKEFILE
@@ -26,14 +28,18 @@ CC = cl -nologo
CPP = $(CC) -EP
all: -prologue- -generic- -epilogue-
-i386-$(OS): -prologue- -i386- -epilogue-
-i486-$(OS): -prologue- -i486- -epilogue-
-i586-$(OS): -prologue- -i586- -epilogue-
-i686-$(OS): -prologue- -i686- -epilogue-
-alpha-$(OS): -prologue- -alpha- -epilogue-
+i386-mswin32: -prologue- -i386- -epilogue-
+i486-mswin32: -prologue- -i486- -epilogue-
+i586-mswin32: -prologue- -i586- -epilogue-
+i686-mswin32: -prologue- -i686- -epilogue-
+alpha-mswin32: -prologue- -alpha- -epilogue-
+x64-mswin64: -prologue64- -x64- -epilogue-
+ia64-mswin64: -prologue64- -ia64- -epilogue-
-prologue-: -basic-vars- -system-vars- -version- -program-name-
+-prologue64-: -basic-vars- -system-vars64- -version- -program-name-
+
-basic-vars-: nul
@type << > $(MAKEFILE)
### Makefile for ruby $(OS) ###
@@ -54,9 +60,14 @@ BASERUBY = $(BASERUBY)
-system-vars-: -osname- -runtime-
+-system-vars64-: -osname64- -runtime-
+
-osname-: nul
@echo OS = mswin32 >>$(MAKEFILE)
+-osname64-: nul
+ @echo OS = mswin64 >>$(MAKEFILE)
+
-runtime-: nul
@$(CC) -MD <<rtname.c user32.lib > nul
#include <windows.h>
@@ -151,6 +162,10 @@ $(CPU) = $(PROCESSOR_LEVEL)
-alpha-: nul
@$(APPEND) $(ARCH) = alpha
+-x64-: nul
+ @$(APPEND) $(ARCH) = x64
+-ia64-: nul
+ @$(APPEND) $(ARCH) = ia64
-ix86-: nul
@$(APPEND) $(ARCH) = x86
diff --git a/win32/win32.c b/win32/win32.c
index 9824f1019a..819f214d5f 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -68,7 +68,7 @@ static int has_redirection(const char *);
static void StartSockets(void);
int rb_w32_wait_events(HANDLE *events, int num, DWORD timeout);
#if !defined(_WIN32_WCE)
-static int rb_w32_open_osfhandle(long osfhandle, int flags);
+static int rb_w32_open_osfhandle(intptr_t osfhandle, int flags);
#else
#define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags)
#endif
@@ -243,8 +243,8 @@ GetCurrentThreadHandle(void)
} while (0)
#define LK_LEN ULONG_MAX
-static VALUE
-flock_winnt(VALUE self, int argc, VALUE* argv)
+static uintptr_t
+flock_winnt(uintptr_t self, int argc, uintptr_t* argv)
{
OVERLAPPED o;
int i = -1;
@@ -280,8 +280,8 @@ flock_winnt(VALUE self, int argc, VALUE* argv)
}
#ifdef WIN95
-static VALUE
-flock_win95(VALUE self, int argc, VALUE* argv)
+static uintptr_t
+flock_win95(uintptr_t self, int argc, uintptr_t* argv)
{
int i = -1;
const HANDLE fh = (HANDLE)self;
@@ -802,7 +802,7 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe)
}
/* associate handle to file descritor */
- *pipe = rb_w32_open_osfhandle((long)hDupFile, pipemode);
+ *pipe = rb_w32_open_osfhandle((intptr_t)hDupFile, pipemode);
CloseHandle(hOrg);
if (*pipe == -1) {
CloseHandle(hDupFile);
@@ -1622,9 +1622,9 @@ rb_w32_closedir(DIR *dirp)
#endif
typedef struct {
- long osfhnd; /* underlying OS file HANDLE */
- char osfile; /* attributes of file (e.g., open in text mode?) */
- char pipech; /* one char buffer for handles opened on pipes */
+ intptr_t osfhnd; /* underlying OS file HANDLE */
+ char osfile; /* attributes of file (e.g., open in text mode?) */
+ char pipech; /* one char buffer for handles opened on pipes */
#ifdef MSVCRT_THREADS
int lockinitflag;
CRITICAL_SECTION lock;
@@ -1685,7 +1685,7 @@ set_pioinfo_extra(void)
#define FTEXT 0x80 /* file handle is in text mode */
static int
-rb_w32_open_osfhandle(long osfhandle, int flags)
+rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
{
int fh;
char fileflags; /* _osfile flags */
@@ -3651,11 +3651,15 @@ setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
*--esp = ctx->Eip;
ctx->Esp = (DWORD)esp;
ctx->Eip = (DWORD)rb_w32_call_handler;
-#else
-#ifndef _WIN32_WCE
+#elif defined(_M_AMD64)
+ DWORD64 *rsp = (DWORD64 *)ctx->Rsp;
+ *--rsp = (DWORD64)harg;
+ *--rsp = ctx->Rip;
+ ctx->Rsp = (DWORD64)rsp;
+ ctx->Rip = (DWORD64)rb_w32_call_handler;
+#else !defined(_WIN32_WCE)
#error unsupported processor
#endif
-#endif
}
static void
@@ -3733,10 +3737,10 @@ struct asynchronous_arg_t {
int errnum;
/* input field */
- VALUE (*func)(VALUE self, int argc, VALUE* argv);
- VALUE self;
+ uintptr_t (*func)(uintptr_t self, int argc, uintptr_t* argv);
+ uintptr_t self;
int argc;
- VALUE* argv;
+ uintptr_t* argv;
};
static DWORD WINAPI
@@ -3750,9 +3754,9 @@ call_asynchronous(PVOID argp)
return ret;
}
-VALUE
-rb_w32_asynchronize(asynchronous_func_t func, VALUE self,
- int argc, VALUE* argv, VALUE intrval)
+uintptr_t
+rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self,
+ int argc, uintptr_t* argv, uintptr_t intrval)
{
DWORD val;
BOOL interrupted = FALSE;