unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@supelec.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: AJMR <ajmr@ilovetortilladepatatas.com>, emacs-devel@gnu.org
Subject: Re: Windows 64 port
Date: Sun, 19 Feb 2012 23:05:52 +0100	[thread overview]
Message-ID: <CAFgFV9O1VfEiDLQpbZ23xJyyX8EZb42DGGVCSakb9cCCRr59nw@mail.gmail.com> (raw)
In-Reply-To: <834numv7js.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 1322 bytes --]

Hi Eli,

Here is my Windows 64 bits patch. It is quite crude and only attempts to
make it possible to compile
a 64bits emacs with the MS Sdk.
I have sent the paperwork to the FSF last week, so this patch could be
reviewed and maybe integrated soon.
It is against emacs-24, current trunk.
Not everything is taken cared of: the heap allocation scheme should
probably be reworked. Anyway,
I was able to run an emacs and make it allocate everything available on my
Windows 64 machine
(4Gb of Ram + around 10Gb of swap). It just did it without crashing.

Best regards,

Fabrice


2012/2/19 Eli Zaretskii <eliz@gnu.org>

> > Date: Sun, 19 Feb 2012 21:18:00 +0100
> > From: AJMR <ajmr@ilovetortilladepatatas.com>
> >
> > I would love to start to contribute to the GNU community and I thought
> > that porting Emacs 23 to Windows 64, could be a good useful entry.
>
> Thanks, it will.
>
> > However, I have no idea on how to, or where, start.
>
> Start with bug #9960, where some of this was discussed.  Maybe Fabrice
> could post the patches he has till now.
>



-- 
Fabrice Popineau
-----------------------------
SUPELEC
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------

[-- Attachment #1.2: Type: text/html, Size: 1902 bytes --]

[-- Attachment #2: emacs-64bits.patch --]
[-- Type: application/octet-stream, Size: 36509 bytes --]

=== modified file 'lib/strftime.c'
--- lib/strftime.c	2011-03-31 04:24:03 +0000
+++ lib/strftime.c	2011-12-05 13:09:35 +0000
@@ -36,9 +36,13 @@
 #include <ctype.h>
 #include <time.h>
 
+#ifdef _MSC_VER
+#define tzname _tzname
+#else
 #if HAVE_TZNAME && !HAVE_DECL_TZNAME
 extern char *tzname[];
 #endif
+#endif
 
 /* Do multibyte processing if multibytes are supported, unless
    multibyte sequences are safe in formats.  Multibyte sequences are

=== modified file 'nt/addsection.c'
--- nt/addsection.c	2012-01-19 07:21:25 +0000
+++ nt/addsection.c	2012-02-05 20:06:34 +0000
@@ -36,9 +36,9 @@
 
 PIMAGE_NT_HEADERS
 (__stdcall * pfnCheckSumMappedFile) (LPVOID BaseAddress,
-				     DWORD FileLength,
-				     LPDWORD HeaderSum,
-				     LPDWORD CheckSum);
+				     DWORD_PTR FileLength,
+				     PDWORD_PTR HeaderSum,
+				     PDWORD_PTR CheckSum);
 
 #undef min
 #undef max
@@ -164,7 +164,7 @@
 /* Return pointer to section header for section containing the given
    relative virtual address. */
 IMAGE_SECTION_HEADER *
-rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header)
+rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
 {
   PIMAGE_SECTION_HEADER section;
   int i;
@@ -179,7 +179,7 @@
 	 some very old exes (eg. gzip dated Dec 1993).  Since
 	 w32_executable_type relies on this function to work reliably,
 	 we need to cope with this.  */
-      DWORD real_size = max (section->SizeOfRawData,
+      DWORD_PTR real_size = max (section->SizeOfRawData,
 			     section->Misc.VirtualSize);
       if (rva >= section->VirtualAddress
 	  && rva < section->VirtualAddress + real_size)
@@ -192,7 +192,7 @@
 /* Return pointer to section header for section containing the given
    offset in its raw data area. */
 IMAGE_SECTION_HEADER *
-offset_to_section (DWORD offset, IMAGE_NT_HEADERS * nt_header)
+offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
 {
   PIMAGE_SECTION_HEADER section;
   int i;
@@ -212,8 +212,8 @@
 /* Return offset to an object in dst, given offset in src.  We assume
    there is at least one section in both src and dst images, and that
    the some sections may have been added to dst (after sections in src).  */
-static DWORD
-relocate_offset (DWORD offset,
+static DWORD_PTR
+relocate_offset (DWORD_PTR offset,
 		 IMAGE_NT_HEADERS * src_nt_header,
 		 IMAGE_NT_HEADERS * dst_nt_header)
 {
@@ -247,32 +247,32 @@
 }
 
 #define OFFSET_TO_RVA(offset, section) \
-	  (section->VirtualAddress + ((DWORD)(offset) - section->PointerToRawData))
+	  (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData))
 
 #define RVA_TO_OFFSET(rva, section) \
-	  (section->PointerToRawData + ((DWORD)(rva) - section->VirtualAddress))
+	  (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress))
 
 #define RVA_TO_SECTION_OFFSET(rva, section) \
-	  ((DWORD)(rva) - section->VirtualAddress)
+	  ((DWORD_PTR)(rva) - section->VirtualAddress)
 
 /* Convert address in executing image to RVA.  */
-#define PTR_TO_RVA(ptr) ((DWORD)(ptr) - (DWORD) GetModuleHandle (NULL))
+#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
 
 #define PTR_TO_OFFSET(ptr, pfile_data) \
           ((unsigned const char *)(ptr) - (pfile_data)->file_base)
 
 #define OFFSET_TO_PTR(offset, pfile_data) \
-          ((pfile_data)->file_base + (DWORD)(offset))
+          ((pfile_data)->file_base + (DWORD_PTR)(offset))
 
-#define ROUND_UP(p, align)   (((DWORD)(p) + (align)-1) & ~((align)-1))
-#define ROUND_DOWN(p, align) ((DWORD)(p) & ~((align)-1))
+#define ROUND_UP(p, align)   (((DWORD_PTR)(p) + (align)-1) & ~((align)-1))
+#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((align)-1))
 
 
 static void
 copy_executable_and_add_section (file_data *p_infile,
 				 file_data *p_outfile,
 				 const char *new_section_name,
-				 DWORD new_section_size)
+				 DWORD_PTR new_section_size)
 {
   unsigned char *dst;
   PIMAGE_DOS_HEADER dos_header;
@@ -280,7 +280,7 @@
   PIMAGE_NT_HEADERS dst_nt_header;
   PIMAGE_SECTION_HEADER section;
   PIMAGE_SECTION_HEADER dst_section;
-  DWORD offset;
+  DWORD_PTR offset;
   int i;
   int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
 
@@ -324,10 +324,10 @@
   dst = (unsigned char *) p_outfile->file_base;
 
   COPY_CHUNK ("Copying DOS header...", dos_header,
-	      (DWORD) nt_header - (DWORD) dos_header, be_verbose);
+	      (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose);
   dst_nt_header = (PIMAGE_NT_HEADERS) dst;
   COPY_CHUNK ("Copying NT header...", nt_header,
-	      (DWORD) section - (DWORD) nt_header, be_verbose);
+	      (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose);
   dst_section = (PIMAGE_SECTION_HEADER) dst;
   COPY_CHUNK ("Copying section table...", section,
 	      nt_header->FileHeader.NumberOfSections * sizeof (*section),
@@ -509,8 +509,8 @@
   /* Patch up header fields; profiler is picky about this. */
   {
     HANDLE hImagehelp = LoadLibrary ("imagehlp.dll");
-    DWORD  headersum;
-    DWORD  checksum;
+    DWORD_PTR  headersum;
+    DWORD_PTR  checksum;
 
     dos_header = (PIMAGE_DOS_HEADER) out_file.file_base;
     nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew);

=== modified file 'nt/config.nt'
--- nt/config.nt	2012-01-29 15:46:05 +0000
+++ nt/config.nt	2012-02-05 20:06:34 +0000
@@ -433,7 +433,11 @@
 
    See m/template.h for documentation on writing m/MACHINE.h files.  */
 #undef config_machfile
+#ifdef _WIN64
+#include "m/amdx86-64.h"
+#else
 #include "m/intel386.h"
+#endif
 
 /* Define `subprocesses' should be defined if you want to
    have code for asynchronous subprocesses

=== modified file 'nt/emacs.rc'
--- nt/emacs.rc	2012-02-09 07:48:22 +0000
+++ nt/emacs.rc	2012-02-05 20:06:34 +0000
@@ -1,6 +1,10 @@
 Emacs ICON   icons\emacs.ico
 32649 CURSOR icons\hand.cur
-1 24 "emacs.manifest"
+#ifdef WIN64
+1 24 "emacs-x64.manifest"
+#else
+1 24 "emacs-x86.manifest"
+#endif
 
 #ifndef VS_VERSION_INFO
 #define VS_VERSION_INFO 1

=== modified file 'nt/nmake.defs'
--- nt/nmake.defs	2012-02-05 20:40:36 +0000
+++ nt/nmake.defs	2012-02-19 21:54:33 +0000
@@ -86,7 +86,11 @@
 !    if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
 ARCH		= ppc
 !    else
-!     error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
+!     if "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
+ARCH		= AMD64
+!     else
+!      error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
+!     endif
 !    endif
 !   endif
 !  endif
@@ -105,11 +109,11 @@
 CC_OUT		= -Fo
 LINK		= link
 LINK_OUT	= -out:
-RC		= rc
+RC		= rc $(ARCH_RCFLAGS)
 RC_OUT		= -Fo
 RC_INCLUDE	= -i
 
-USE_CRT_DLL	= 1
+# USE_CRT_DLL	= 1
 
 !ifdef USE_CRT_DLL
 libc		= msvcrt$(D).lib
@@ -151,20 +155,17 @@
 !endif
 
 CFLAGS          = -I. $(ARCH_CFLAGS) \
+		  -D_CRT_SECURE_NO_WARNINGS \
 		  $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
 ESC_CFLAGS      = -I. $(ARCH_CFLAGS) \
+		  -D_CRT_SECURE_NO_WARNINGS \
 		  $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
 
 #SYS_LDFLAGS	= -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
-!ifdef NOOPT
-SYS_LDFLAGS	= -nologo -manifest -dynamicbase:no -debug -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
-!else
-SYS_LDFLAGS	= -nologo -manifest -dynamicbase:no -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
-!endif
+SYS_LDFLAGS	= -nologo -manifest -dynamicbase:no -incremental:no -version:5.10 -swaprun:cd -swaprun:net setargv.obj
 
 # see comments in allocate_heap in w32heap.c before changing any of the
-# -stack, -heap, or -base settings.
-TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -pdb:$(BLD)\temacs.pdb -machine:$(ARCH) $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
+TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -pdb:$(BLD)\temacs.pdb -machine:$(TARGET_CPU) $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
 
 !ifdef NOOPT
 OBJDIR          = obj
@@ -195,7 +196,7 @@
 
 !ifdef NODEBUG
 DEBUG_FLAG =
-DEBUG_LINK =
+DEBUG_LINK = -release
 D =
 !else
 DEBUG_FLAG = -Zi
@@ -233,15 +234,28 @@
 !else
 !if "$(ARCH)" == "ppc"
 # These flags are a guess...if they don't work, please send me mail.
-ARCH_CFLAGS	= -D_PPC_=1 -c -Ze -Zi -W2 -Od
 ARCH_LDFLAGS	= $(SYS_LDFLAGS)
 
 !else
+!if "$(ARCH)" == "AMD64"
+# These flags are a guess...if they don't work, please send me mail.
+!ifdef NOOPT
+#ARCH_CFLAGS     = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS     = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)
+!else
+#ARCH_CFLAGS     = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
+ARCH_CFLAGS     = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy -Gd $(DEBUG_FLAG)
+!endif
+ARCH_LDFLAGS	= $(SYS_LDFLAGS) -machine:x64
+ARCH_RCFLAGS	= -DWIN64
+
+!else
 !ERROR Unknown architecture type "$(ARCH)".
 !endif
 !endif
 !endif
 !endif
+!endif
 
 LINK_FLAGS	= $(ARCH_LDFLAGS) $(DEBUG_LINK) $(USER_LDFLAGS)
 

=== modified file 'src/alloc.c'
--- src/alloc.c	2012-01-19 07:21:25 +0000
+++ src/alloc.c	2012-02-05 20:06:34 +0000
@@ -64,6 +64,7 @@
 
 #ifdef WINDOWSNT
 #include "w32.h"
+#include "w32heap.h"
 #endif
 
 #ifdef DOUG_LEA_MALLOC
@@ -1150,7 +1151,8 @@
 
   if (2 > (intptr_t) ABLOCKS_BUSY (abase))
     { /* All the blocks are free.  */
-      int i = 0, aligned = (intptr_t) ABLOCKS_BUSY (abase);
+      int i = 0;
+      intptr_t aligned = (intptr_t) ABLOCKS_BUSY (abase);
       struct ablock **tem = &free_ablock;
       struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1];
 
@@ -2967,7 +2969,7 @@
 /* Allocate other vector-like structures.  */
 
 struct Lisp_Vector *
-allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag)
+allocate_pseudovector (size_t memlen, size_t lisplen, EMACS_INT tag)
 {
   struct Lisp_Vector *v = allocate_vectorlike (memlen);
   int i;
@@ -5029,13 +5031,13 @@
 	    /* If a buffer's gap size is more than 10% of the buffer
 	       size, or larger than 2000 bytes, then shrink it
 	       accordingly.  Keep a minimum size of 20 bytes.  */
-	    int size = min (2000, max (20, (nextb->text->z_byte / 10)));
+	    size_t size = min (2000, max (20, (nextb->text->z_byte / 10)));
 
 	    if (nextb->text->gap_size > size)
 	      {
 		struct buffer *save_current = current_buffer;
 		current_buffer = nextb;
-		make_gap (-(nextb->text->gap_size - size));
+		make_gap ((size - nextb->text->gap_size));
 		current_buffer = save_current;
 	      }
 	  }

=== modified file 'src/dosfns.c'
--- src/dosfns.c	2012-01-19 07:21:25 +0000
+++ src/dosfns.c	2012-02-05 20:06:34 +0000
@@ -542,7 +542,7 @@
       double pmem;
       EXFUN (Fget_internal_run_time, 0);
 #ifndef SYSTEM_MALLOC
-      extern unsigned long ret_lim_data ();
+      extern size_t ret_lim_data ();
 #endif
 
       uid = getuid ();
@@ -579,7 +579,7 @@
 #ifndef SYSTEM_MALLOC
       /* ret_lim_data is on vm-limit.c, which is not compiled in under
 	 SYSTEM_MALLOC.  */
-      pmem = (double)((unsigned long) sbrk (0)) / ret_lim_data () * 100.0;
+      pmem = (double)((size_t) sbrk (0)) / ret_lim_data () * 100.0;
       if (pmem > 100)
 #endif
 	pmem = 100;

=== modified file 'src/editfns.c'
--- src/editfns.c	2012-01-19 07:21:25 +0000
+++ src/editfns.c	2012-02-05 20:06:34 +0000
@@ -82,6 +82,8 @@
 
 #ifdef WINDOWSNT
 extern Lisp_Object w32_get_internal_run_time (void);
+
+extern struct tm *localtime (const time_t *t);
 #endif
 
 static void time_overflow (void) NO_RETURN;

=== modified file 'src/eval.c'
--- src/eval.c	2012-02-15 04:00:34 +0000
+++ src/eval.c	2012-02-19 21:54:33 +0000
@@ -1408,7 +1408,7 @@
    rather than passed in a list.  Used by Fbyte_code.  */
 
 Lisp_Object
-internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform,
+internal_lisp_condition_case (/* volatile */ Lisp_Object var, Lisp_Object bodyform,
 			      Lisp_Object handlers)
 {
   Lisp_Object val;

=== modified file 'src/frame.c'
--- src/frame.c	2012-01-19 07:21:25 +0000
+++ src/frame.c	2012-02-05 20:06:34 +0000
@@ -812,6 +812,7 @@
 #ifdef HAVE_WINDOW_SYSTEM
   if (track && FRAME_WINDOW_P (XFRAME (frame)))
     {
+      extern Lisp_Object x_get_focus_frame(struct frame *);
       Lisp_Object focus, xfocus;
 
       xfocus = x_get_focus_frame (XFRAME (frame));

=== modified file 'src/gmalloc.c'
--- src/gmalloc.c	2011-09-09 01:06:52 +0000
+++ src/gmalloc.c	2011-12-05 14:55:54 +0000
@@ -56,6 +56,7 @@
 
 #endif	/* _MALLOC_INTERNAL.  */
 
+#include <w32heap.h>
 
 #ifdef	__cplusplus
 extern "C"
@@ -459,7 +460,7 @@
      __malloc_size_t size;
 {
   __ptr_t result;
-  unsigned long int adj;
+  intptr_t adj;
 
   /* align accepts an unsigned argument, but __morecore accepts a
      signed one.  This could lead to trouble if SIZE overflows a
@@ -469,8 +470,8 @@
     result = 0;
   else
     result = (*__morecore) (size);
-  adj = (unsigned long int) ((unsigned long int) ((char *) result -
-						  (char *) NULL)) % BLOCKSIZE;
+  adj = (intptr_t) (((char *) result -
+                     (char *) NULL)) % BLOCKSIZE;
   if (adj != 0)
     {
       __ptr_t new;
@@ -539,7 +540,7 @@
   _heapinfo[block].busy.info.size = blocks;
   /* Leave back-pointers for malloc_find_address.  */
   while (--blocks > 0)
-    _heapinfo[block + blocks].busy.info.size = -blocks;
+    _heapinfo[block + blocks].busy.info.size = -((__malloc_ptrdiff_t)blocks);
 }
 
 #ifdef USE_PTHREAD
@@ -715,7 +716,7 @@
  	  /* Did it fail?  */
  	  if (newinfo == NULL)
  	    {
- 	      (*__morecore) (-size);
+ 	      (*__morecore) (-((__malloc_ptrdiff_t)size));
  	      return NULL;
  	    }
 
@@ -727,7 +728,7 @@
  	    break;
 
  	  /* Must try again.  First give back most of what we just got.  */
- 	  (*__morecore) (- newsize * sizeof (malloc_info));
+ 	  (*__morecore) (- ((ptrdiff_t)newsize * sizeof (malloc_info)));
  	  newsize *= 2;
   	}
 
@@ -809,8 +810,8 @@
 	    next->next->prev = next->prev;
 	  block = BLOCK (result);
 	  if (--_heapinfo[block].busy.info.frag.nfree != 0)
-	    _heapinfo[block].busy.info.frag.first = (unsigned long int)
-	      ((unsigned long int) ((char *) next->next - (char *) NULL)
+	    _heapinfo[block].busy.info.frag.first = (intptr_t)
+	      (((char *) next->next - (char *) NULL)
 	       % BLOCKSIZE) >> log;
 
 	  /* Update the statistics.  */
@@ -951,7 +952,7 @@
 	 first with a negative number so you can find the first block by
 	 adding that adjustment.  */
       while (--blocks > 0)
-	_heapinfo[block + blocks].busy.info.size = -blocks;
+	_heapinfo[block + blocks].busy.info.size = -((ptrdiff_t)blocks);
     }
 
   PROTECT_MALLOC_STATE (1);
@@ -1224,7 +1225,7 @@
 	    {
 	      register __malloc_size_t bytes = blocks * BLOCKSIZE;
 	      _heaplimit -= blocks;
-	      (*__morecore) (-bytes);
+	      (*__morecore) (-((__malloc_ptrdiff_t)bytes));
 	      _heapinfo[_heapinfo[block].free.prev].free.next
 		= _heapinfo[block].free.next;
 	      _heapinfo[_heapinfo[block].free.next].free.prev
@@ -1295,8 +1296,8 @@
 	     it is the first free fragment of this block. */
 	  prev = (struct list *) ptr;
 	  _heapinfo[block].busy.info.frag.nfree = 1;
-	  _heapinfo[block].busy.info.frag.first = (unsigned long int)
-	    ((unsigned long int) ((char *) ptr - (char *) NULL)
+	  _heapinfo[block].busy.info.frag.first = (intptr_t)
+	    ((intptr_t) ((char *) ptr - (char *) NULL)
 	     % BLOCKSIZE >> type);
 	  prev->next = _fraghead[type].next;
 	  prev->prev = &_fraghead[type];
@@ -1689,7 +1690,7 @@
      __malloc_size_t size;
 {
   __ptr_t result;
-  unsigned long int adj, lastadj;
+  intptr_t adj, lastadj;
   __ptr_t (*hook) (__malloc_size_t, __malloc_size_t) = __memalign_hook;
 
   if (hook)
@@ -1703,7 +1704,7 @@
 
   /* Figure out how much we will need to pad this particular block
      to achieve the required alignment.  */
-  adj = (unsigned long int) ((char *) result - (char *) NULL) % alignment;
+  adj = (intptr_t) ((char *) result - (char *) NULL) % alignment;
 
   do
     {
@@ -1714,7 +1715,7 @@
 	return NULL;
 
       lastadj = adj;
-      adj = (unsigned long int) ((char *) result - (char *) NULL) % alignment;
+      adj = (intptr_t) ((char *) result - (char *) NULL) % alignment;
       /* It's conceivable we might have been so unlucky as to get a
 	 different block with weaker alignment.  If so, this block is too
 	 short to contain SIZE after alignment correction.  So we must
@@ -1904,7 +1905,7 @@
 struct hdr
   {
     __malloc_size_t size;		/* Exact size requested by user.  */
-    unsigned long int magic;	/* Magic number to check header integrity.  */
+    uint64_t magic;	/* Magic number to check header integrity.  */
   };
 
 static enum mcheck_status checkhdr (const struct hdr *);

=== modified file 'src/lisp.h'
--- src/lisp.h	2012-01-19 07:21:25 +0000
+++ src/lisp.h	2012-02-05 20:06:34 +0000
@@ -483,7 +483,7 @@
 /* For integers known to be positive, XFASTINT provides fast retrieval
    and XSETFASTINT provides fast storage.  This takes advantage of the
    fact that Lisp_Int is 0.  */
-#define XFASTINT(a) ((a) + 0)
+#define XFASTINT(a) ((int)((a) + 0))
 #define XSETFASTINT(a, b) ((a) = (b))
 
 /* Extract the value of a Lisp_Object as a (un)signed integer.  */
@@ -2811,7 +2811,7 @@
 EXFUN (Fmake_bool_vector, 2);
 extern Lisp_Object Qchar_table_extra_slots;
 extern struct Lisp_Vector *allocate_vector (EMACS_INT);
-extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag);
+extern struct Lisp_Vector *allocate_pseudovector (size_t memlen, size_t lisplen, EMACS_INT tag);
 #define ALLOCATE_PSEUDOVECTOR(typ,field,tag)				\
   ((typ*)								\
    allocate_pseudovector						\

=== modified file 'src/m/amdx86-64.h'
--- src/m/amdx86-64.h	2012-01-19 07:21:25 +0000
+++ src/m/amdx86-64.h	2012-02-05 20:06:34 +0000
@@ -17,7 +17,8 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define BITS_PER_LONG           64
+#define BITS_PER_LONG           32
+#define BITS_PER_LONG_LONG      64
 #define BITS_PER_EMACS_INT      64
 
 /* Now define a symbol for the cpu type, if your compiler
@@ -27,9 +28,11 @@
 /* __x86_64 defined automatically.  */
 
 /* Define the type to use.  */
-#define EMACS_INT               long
-#define pI			"l"
-#define EMACS_UINT              unsigned long
+#define EMACS_INT               __int64
+#define EMACS_UINT              unsigned __int64
+#define pI			"ll"
+#define VIRT_ADDR_VARIES
+#define DATA_START 	get_data_start ()
 
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #undef DATA_SEG_BITS

=== modified file 'src/makefile.w32-in'
--- src/makefile.w32-in	2012-01-19 07:21:25 +0000
+++ src/makefile.w32-in	2012-02-05 20:06:34 +0000
@@ -25,7 +25,7 @@
 EMACSLOADPATH=$(CURDIR)/../lisp
 
 # Size in MBs of the static heap in temacs.exe.
-HEAPSIZE = 27
+HEAPSIZE = 42
 
 #
 # HAVE_CONFIG_H is required by some generic gnu sources stuck into

=== modified file 'src/ralloc.c'
--- src/ralloc.c	2012-02-01 16:51:20 +0000
+++ src/ralloc.c	2012-02-05 20:06:34 +0000
@@ -24,6 +24,10 @@
 
 #ifdef emacs
 
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#define SIZE ESIZE
+
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"		/* Needed for VALBITS.  */
@@ -76,7 +80,7 @@
 /* Declarations for working with the malloc, ralloc, and system breaks.  */
 
 /* Function to set the real break value.  */
-POINTER (*real_morecore) (long int);
+POINTER (*real_morecore) (intptr_t);
 
 /* The break value, as seen by malloc.  */
 static POINTER virtual_break_value;
@@ -95,20 +99,20 @@
 /* Macros for rounding.  Note that rounding to any value is possible
    by changing the definition of PAGE.  */
 #define PAGE (getpagesize ())
-#define ALIGNED(addr) (((unsigned long int) (addr) & (page_size - 1)) == 0)
-#define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \
+#define ALIGNED(addr) (((intptr_t) (addr) & (page_size - 1)) == 0)
+#define ROUNDUP(size) (((intptr_t) (size) + page_size - 1) \
 		       & ~(page_size - 1))
 #define ROUND_TO_PAGE(addr) (addr & (~(page_size - 1)))
 
 #define MEM_ALIGN sizeof (double)
-#define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \
+#define MEM_ROUNDUP(addr) (((intptr_t)(addr) + MEM_ALIGN - 1) \
 				   & ~(MEM_ALIGN - 1))
 
 /* The hook `malloc' uses for the function which gets more space
    from the system.  */
 
 #ifndef SYSTEM_MALLOC
-extern POINTER (*__morecore) (long int);
+extern POINTER (*__morecore) (intptr_t);
 #endif
 
 
@@ -315,7 +319,7 @@
 relinquish (void)
 {
   register heap_ptr h;
-  long excess = 0;
+  ptrdiff_t excess = 0;
 
   /* Add the amount of space beyond break_value
      in all heaps which have extend beyond break_value at all.  */
@@ -370,7 +374,7 @@
 /* Return the total size in use by relocating allocator,
    above where malloc gets space.  */
 
-long
+intptr_t
 r_alloc_size_in_use (void)
 {
   return (char *) break_value - (char *) virtual_break_value;
@@ -749,7 +753,7 @@
    GNU malloc package.  */
 
 POINTER
-r_alloc_sbrk (long int size)
+r_alloc_sbrk (ptrdiff_t size)
 {
   register bloc_ptr b;
   POINTER address;
@@ -1020,7 +1024,7 @@
    malloc must return a null pointer.  */
 
 void
-r_alloc_freeze (long int size)
+r_alloc_freeze (intptr_t size)
 {
   if (! r_alloc_initialized)
     r_alloc_init ();

=== modified file 'src/s/ms-w32.h'
--- src/s/ms-w32.h	2012-01-19 07:21:25 +0000
+++ src/s/ms-w32.h	2012-02-05 20:06:34 +0000
@@ -281,13 +281,14 @@
 #define utimbuf	  _utimbuf
 #endif
 #define strdup    _strdup
+#define strtoll   _strtoi64
 #define strupr    _strupr
 #define strnicmp  _strnicmp
 #define stricmp   _stricmp
 #define tzset     _tzset
 
+#if !defined (_MSC_VER) /* || (_MSC_VER < 1400) */
 #define tzname    _tzname
-#if !defined (_MSC_VER) || (_MSC_VER < 1400)
 #undef  utime
 #define utime	  _utime
 #endif

=== modified file 'src/unexw32.c'
--- src/unexw32.c	2012-01-19 07:21:25 +0000
+++ src/unexw32.c	2012-02-05 20:06:34 +0000
@@ -67,18 +67,18 @@
 /* Cached info about the .data section in the executable.  */
 PIMAGE_SECTION_HEADER data_section;
 PCHAR  data_start = 0;
-DWORD  data_size = 0;
+DWORD_PTR  data_size = 0;
 
 /* Cached info about the .bss section in the executable.  */
 PIMAGE_SECTION_HEADER bss_section;
 PCHAR  bss_start = 0;
-DWORD  bss_size = 0;
-DWORD  extra_bss_size = 0;
+DWORD_PTR  bss_size = 0;
+DWORD_PTR  extra_bss_size = 0;
 /* bss data that is static might be discontiguous from non-static.  */
 PIMAGE_SECTION_HEADER bss_section_static;
 PCHAR  bss_start_static = 0;
-DWORD  bss_size_static = 0;
-DWORD  extra_bss_size_static = 0;
+DWORD_PTR  bss_size_static = 0;
+DWORD_PTR  extra_bss_size_static = 0;
 
 PIMAGE_SECTION_HEADER heap_section;
 
@@ -231,7 +231,7 @@
 /* Return pointer to section header for section containing the given
    relative virtual address. */
 IMAGE_SECTION_HEADER *
-rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header)
+rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
 {
   PIMAGE_SECTION_HEADER section;
   int i;
@@ -246,7 +246,7 @@
 	 some very old exes (eg. gzip dated Dec 1993).  Since
 	 w32_executable_type relies on this function to work reliably,
 	 we need to cope with this.  */
-      DWORD real_size = max (section->SizeOfRawData,
+      DWORD_PTR real_size = max (section->SizeOfRawData,
 			     section->Misc.VirtualSize);
       if (rva >= section->VirtualAddress
 	  && rva < section->VirtualAddress + real_size)
@@ -259,7 +259,7 @@
 /* Return pointer to section header for section containing the given
    offset in its raw data area. */
 IMAGE_SECTION_HEADER *
-offset_to_section (DWORD offset, IMAGE_NT_HEADERS * nt_header)
+offset_to_section (DWORD_PTR offset, IMAGE_NT_HEADERS * nt_header)
 {
   PIMAGE_SECTION_HEADER section;
   int i;
@@ -279,8 +279,8 @@
 /* Return offset to an object in dst, given offset in src.  We assume
    there is at least one section in both src and dst images, and that
    the some sections may have been added to dst (after sections in src).  */
-DWORD
-relocate_offset (DWORD offset,
+DWORD_PTR
+relocate_offset (DWORD_PTR offset,
 		 IMAGE_NT_HEADERS * src_nt_header,
 		 IMAGE_NT_HEADERS * dst_nt_header)
 {
@@ -314,16 +314,16 @@
 }
 
 #define OFFSET_TO_RVA(offset, section) \
-	  (section->VirtualAddress + ((DWORD)(offset) - section->PointerToRawData))
+	  (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData))
 
 #define RVA_TO_OFFSET(rva, section) \
-	  (section->PointerToRawData + ((DWORD)(rva) - section->VirtualAddress))
+	  (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress))
 
 #define RVA_TO_SECTION_OFFSET(rva, section) \
-	  ((DWORD)(rva) - section->VirtualAddress)
+	  ((DWORD_PTR)(rva) - section->VirtualAddress)
 
 /* Convert address in executing image to RVA.  */
-#define PTR_TO_RVA(ptr) ((DWORD)(ptr) - (DWORD) GetModuleHandle (NULL))
+#define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))
 
 #define RVA_TO_PTR(var,section,filedata) \
 	  ((void *)(RVA_TO_OFFSET (var,section) + (filedata).file_base))
@@ -332,7 +332,7 @@
           ((unsigned char *)(ptr) - (pfile_data)->file_base)
 
 #define OFFSET_TO_PTR(offset, pfile_data) \
-          ((pfile_data)->file_base + (DWORD)(offset))
+          ((pfile_data)->file_base + (DWORD_PTR)(offset))
 
 
 /* Flip through the executable and cache the info necessary for dumping.  */
@@ -349,7 +349,7 @@
       printf ("Unknown EXE header in %s...bailing.\n", p_infile->name);
       exit (1);
     }
-  nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) +
+  nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) +
 				   dos_header->e_lfanew);
   if (nt_header == NULL)
     {
@@ -488,7 +488,7 @@
   PIMAGE_NT_HEADERS dst_nt_header;
   PIMAGE_SECTION_HEADER section;
   PIMAGE_SECTION_HEADER dst_section;
-  DWORD offset;
+  DWORD_PTR offset;
   int i;
   int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
 
@@ -541,17 +541,17 @@
      Note that dst is updated implicitly by each COPY_CHUNK.  */
 
   dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base;
-  nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) +
+  nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) +
 				   dos_header->e_lfanew);
   section = IMAGE_FIRST_SECTION (nt_header);
 
   dst = (unsigned char *) p_outfile->file_base;
 
   COPY_CHUNK ("Copying DOS header...", dos_header,
-	      (DWORD) nt_header - (DWORD) dos_header, be_verbose);
+	      (DWORD_PTR) nt_header - (DWORD_PTR) dos_header, be_verbose);
   dst_nt_header = (PIMAGE_NT_HEADERS) dst;
   COPY_CHUNK ("Copying NT header...", nt_header,
-	      (DWORD) section - (DWORD) nt_header, be_verbose);
+	      (DWORD_PTR) section - (DWORD_PTR) nt_header, be_verbose);
   dst_section = (PIMAGE_SECTION_HEADER) dst;
   COPY_CHUNK ("Copying section table...", section,
 	      nt_header->FileHeader.NumberOfSections * sizeof (*section),
@@ -627,8 +627,8 @@
 	}
       if (section == heap_section)
 	{
-	  DWORD heap_start = (DWORD) get_heap_start ();
-	  DWORD heap_size = get_committed_heap_size ();
+	  DWORD_PTR heap_start = (DWORD_PTR) get_heap_start ();
+	  DWORD_PTR heap_size = get_committed_heap_size ();
 
 	  /* Dump the used portion of the predump heap, adjusting the
              section's size to the appropriate size.  */

=== modified file 'src/vm-limit.c'
--- src/vm-limit.c	2012-01-19 07:21:25 +0000
+++ src/vm-limit.c	2012-02-05 20:06:34 +0000
@@ -20,7 +20,7 @@
 #include <setjmp.h>
 #include "lisp.h"
 #include "mem-limits.h"
-
+#include "w32heap.h"
 /*
   Level number of warnings already issued.
   0 -- no warnings issued.
@@ -41,7 +41,7 @@
 static POINTER data_space_start;
 
 /* Number of bytes of writable memory we can expect to be able to get.  */
-static unsigned long lim_data;
+static size_t lim_data;
 \f
 
 #if defined (HAVE_GETRLIMIT) && defined (RLIMIT_AS)
@@ -79,7 +79,7 @@
     lim_data = ULIMIT_BREAK_VALUE;
 #endif
 
-  lim_data -= (long) data_space_start;
+  lim_data -= (intptr_t) data_space_start;
 }
 
 #else /* not USG */
@@ -88,7 +88,7 @@
 static void
 get_lim_data (void)
 {
-  extern unsigned long reserved_heap_size;
+  extern size_t reserved_heap_size;
   lim_data = reserved_heap_size;
 }
 
@@ -127,7 +127,7 @@
     lim_data = 512U * 1024U * 1024U;
 }
 
-unsigned long
+size_t
 ret_lim_data (void)
 {
   get_lim_data ();
@@ -166,13 +166,13 @@
 check_memory_limits (void)
 {
 #ifdef REL_ALLOC
-  extern POINTER (*real_morecore) (long);
+  extern POINTER (*real_morecore) (__malloc_ptrdiff_t);
 #endif
-  extern POINTER (*__morecore) (long);
+  extern POINTER (*__morecore) (__malloc_ptrdiff_t);
 
   register POINTER cp;
-  unsigned long five_percent;
-  unsigned long data_size;
+  size_t five_percent;
+  size_t data_size;
   enum warnlevel new_warnlevel;
 
   if (lim_data == 0)

=== modified file 'src/w32.c'
--- src/w32.c	2012-02-04 13:48:38 +0000
+++ src/w32.c	2012-02-05 20:06:34 +0000
@@ -1703,7 +1703,8 @@
       /* FIXME: should use substring of get_emacs_configuration ().
 	 But I don't think the Windows build supports alpha, mips etc
          anymore, so have taken the easy option for now.  */
-      else if (p && xstrcasecmp (p, "\\i386") == 0)
+      else if (p && (xstrcasecmp (p, "\\i386") == 0
+                     || xstrcasecmp (p, "\\AMD64") == 0))
 	{
 	  *p = 0;
 	  p = strrchr (modname, '\\');
@@ -1861,7 +1862,12 @@
     case PROCESSOR_INTEL_386:
     case PROCESSOR_INTEL_486:
     case PROCESSOR_INTEL_PENTIUM:
+    case PROCESSOR_AMD_X8664:
+#ifdef _WIN64
+      arch = "amd64";
+#else
       arch = "i386";
+#endif
       break;
 #endif
 
@@ -2400,7 +2406,7 @@
 	return NULL;
     }
 
-  if (!(dirp = (DIR *) malloc (sizeof (DIR))))
+  if (!(dirp = (DIR *) xmalloc (sizeof (DIR))))
     return NULL;
 
   dirp->dd_fd = 0;

=== modified file 'src/w32heap.c'
--- src/w32heap.c	2012-01-19 07:21:25 +0000
+++ src/w32heap.c	2012-02-05 20:06:34 +0000
@@ -27,7 +27,7 @@
 #include "w32heap.h"
 #include "lisp.h"  /* for VALMASK */
 
-#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD)(rva) + (DWORD)GetModuleHandle (NULL)))
+#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL)))
 
 /* This gives us the page size and the size of the allocation unit on NT.  */
 SYSTEM_INFO sysinfo_cache;
@@ -98,7 +98,7 @@
 unsigned char *data_region_base = NULL;
 unsigned char *data_region_end = NULL;
 unsigned char *real_data_region_end = NULL;
-unsigned long  reserved_heap_size = 0;
+size_t  reserved_heap_size = 0;
 
 /* The start of the data segment.  */
 unsigned char *
@@ -122,11 +122,11 @@
      the preload heap section up to the usable address limit.  Since GNU
      malloc can handle gaps in the memory it gets from sbrk, we can
      simply set the sbrk pointer to the base of the new heap region.  */
-  unsigned long base =
+  DWORD_PTR base =
     ROUND_UP ((RVA_TO_PTR (preload_heap_section->VirtualAddress)
 	       + preload_heap_section->Misc.VirtualSize),
 	      get_allocation_unit ());
-  unsigned long end  = 1 << VALBITS; /* 256MB */
+  DWORD_PTR end  = 1 << VALBITS; /* 256MB */
   void *ptr = NULL;
 
   while (!ptr && (base < end))
@@ -145,7 +145,11 @@
 static char *
 allocate_heap (void)
 {
-  unsigned long size = 0x80000000; /* start by asking for 2GB */
+#ifdef _WIN64
+  size_t size = 0x800000000i64; /* start by asking for 32GB */
+#else
+  size_t size = 0x80000000; /* start by asking for 2GB */
+#endif
   void *ptr = NULL;
 
   while (!ptr && size > 0x00100000)
@@ -167,17 +171,17 @@
    be the address of the _start_ (not end) of the new block in case of
    success, and zero (not -1) in case of failure.  */
 void *
-sbrk (unsigned long increment)
+sbrk (size_t increment)
 {
   void *result;
-  long size = (long) increment;
+  ptrdiff_t size = (ptrdiff_t)increment;
 
   result = data_region_end;
 
   /* If size is negative, shrink the heap by decommitting pages.  */
   if (size < 0)
     {
-      int new_size;
+      ptrdiff_t new_size;
       unsigned char *new_data_region_end;
 
       size = -size;
@@ -190,7 +194,7 @@
 	 partial deallocation [cga].  */
       new_data_region_end = (data_region_end - size);
       new_data_region_end = (unsigned char *)
-	((long) (new_data_region_end + syspage_mask) & ~syspage_mask);
+	((DWORD_PTR) (new_data_region_end + syspage_mask) & ~syspage_mask);
       new_size = real_data_region_end - new_data_region_end;
       real_data_region_end = new_data_region_end;
       if (new_size > 0)
@@ -221,7 +225,7 @@
       /* We really only commit full pages, so record where
 	 the real end of committed memory is [cga].  */
       real_data_region_end = (unsigned char *)
-	  ((long) (data_region_end + syspage_mask) & ~syspage_mask);
+	  ((DWORD_PTR) (data_region_end + syspage_mask) & ~syspage_mask);
     }
 
   return result;
@@ -246,7 +250,7 @@
   PIMAGE_NT_HEADERS nt_header;
 
   dos_header = (PIMAGE_DOS_HEADER) RVA_TO_PTR (0);
-  nt_header = (PIMAGE_NT_HEADERS) (((unsigned long) dos_header) +
+  nt_header = (PIMAGE_NT_HEADERS) (((DWORD_PTR) dos_header) +
 				   dos_header->e_lfanew);
   preload_heap_section = find_section ("EMHEAP", nt_header);
 
@@ -262,7 +266,7 @@
 #if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG)
       /* Ensure that the addresses don't use the upper tag bits since
 	 the Lisp type goes there.  */
-      if (((unsigned long) data_region_base & ~VALMASK) != 0)
+      if (((DWORD_PTR) data_region_base & ~VALMASK) != 0)
 	{
 	  printf ("Error: The heap was allocated in upper memory.\n");
 	  exit (1);
@@ -285,13 +289,13 @@
 
 /* Round the heap up to the given alignment.  */
 void
-round_heap (unsigned long align)
+round_heap (DWORD_PTR align)
 {
-  unsigned long needs_to_be;
-  unsigned long need_to_alloc;
+  DWORD_PTR needs_to_be;
+  DWORD_PTR need_to_alloc;
 
-  needs_to_be = (unsigned long) ROUND_UP (get_heap_end (), align);
-  need_to_alloc = needs_to_be - (unsigned long) get_heap_end ();
+  needs_to_be = (DWORD_PTR) ROUND_UP (get_heap_end (), align);
+  need_to_alloc = needs_to_be - (DWORD_PTR) get_heap_end ();
 
   if (need_to_alloc)
     sbrk (need_to_alloc);

=== modified file 'src/w32heap.h'
--- src/w32heap.h	2012-01-19 07:21:25 +0000
+++ src/w32heap.h	2012-02-05 20:06:34 +0000
@@ -24,8 +24,8 @@
 
 #include <windows.h>
 
-#define ROUND_UP(p, align)   (((DWORD)(p) + (align)-1) & ~((align)-1))
-#define ROUND_DOWN(p, align) ((DWORD)(p) & ~((align)-1))
+#define ROUND_UP(p, align)   (((DWORD_PTR)(p) + (align)-1) & ~((align)-1))
+#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((align)-1))
 
 /*
  * Heap related stuff.
@@ -42,7 +42,7 @@
 
 extern unsigned char *get_data_start (void);
 extern unsigned char *get_data_end (void);
-extern unsigned long  reserved_heap_size;
+extern size_t         reserved_heap_size;
 extern SYSTEM_INFO    sysinfo_cache;
 extern OSVERSIONINFO  osinfo_cache;
 extern BOOL   	      using_dynamic_heap;
@@ -58,13 +58,13 @@
 extern int os_subtype;
 
 /* Emulation of Unix sbrk().  */
-extern void *sbrk (unsigned long size);
+extern void *sbrk (size_t size);
 
 /* Initialize heap structures for sbrk on startup.  */
 extern void init_heap (void);
 
 /* Round the heap to this size.  */
-extern void round_heap (unsigned long size);
+extern void round_heap (size_t size);
 
 /* Cache system info, e.g., the NT page size.  */
 extern void cache_system_info (void);
@@ -89,7 +89,7 @@
 
 /* Return pointer to section header for section containing the given
    relative virtual address. */
-IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header);
+IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header);
 
 #endif /* NTHEAP_H_ */
 

=== modified file 'src/w32proc.c'
--- src/w32proc.c	2012-01-19 07:21:25 +0000
+++ src/w32proc.c	2012-02-05 20:06:34 +0000
@@ -63,7 +63,7 @@
 
 #define RVA_TO_PTR(var,section,filedata) \
   ((void *)((section)->PointerToRawData					\
-	    + ((DWORD)(var) - (section)->VirtualAddress)		\
+	    + ((DWORD_PTR)(var) - (section)->VirtualAddress)		\
 	    + (filedata).file_base))
 
 Lisp_Object Qhigh, Qlow;
@@ -111,7 +111,7 @@
 child_process child_procs[ MAX_CHILDREN ];
 child_process *dead_child = NULL;
 
-static DWORD WINAPI reader_thread (void *arg);
+static DWORD_PTR WINAPI reader_thread (void *arg);
 
 /* Find an unused process slot.  */
 child_process *


[-- Attachment #3: amdx86-64.h --]
[-- Type: text/x-chdr, Size: 1366 bytes --]

/* machine description file for AMD x86-64.

Copyright (C) 2002-2012  Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */

#define BITS_PER_LONG           32
#define BITS_PER_LONG_LONG      64
#define BITS_PER_EMACS_INT      64

/* Now define a symbol for the cpu type, if your compiler
   does not define it automatically:
   Ones defined so far include vax, m68000, ns16000, pyramid,
   orion, tahoe, APOLLO and many others */
/* __x86_64 defined automatically.  */

/* Define the type to use.  */
#define EMACS_INT               __int64
#define EMACS_UINT              unsigned __int64
#define pI			"ll"
#define VIRT_ADDR_VARIES
#define DATA_START 	get_data_start ()

/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
#undef DATA_SEG_BITS

  reply	other threads:[~2012-02-19 22:05 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19 20:18 Windows 64 port AJMR
2012-02-19 21:26 ` Eli Zaretskii
2012-02-19 22:05   ` Fabrice Popineau [this message]
2012-02-20  3:53     ` Eli Zaretskii
2012-02-20 17:48     ` Paul Eggert
2012-02-20 19:20       ` Fabrice Popineau
2012-02-20 20:43         ` Paul Eggert
2012-02-20 20:58           ` Eli Zaretskii
2012-02-20 23:11             ` Fabrice Popineau
2012-02-20 23:46               ` Paul Eggert
2012-02-21 13:22         ` Stefan Monnier
2012-02-21 18:26           ` Paul Eggert
2012-02-22 10:39         ` Richard Stallman
2012-02-22 16:27           ` Eli Zaretskii
2012-02-23 18:44             ` Richard Stallman
2012-02-23 19:16               ` Aurélien
2012-02-23 19:50                 ` Lennart Borgman
2012-02-23 20:48                 ` Fabrice Popineau
2012-02-24  5:52                   ` Aurélien
2012-02-28 21:00       ` Fabrice Popineau
2012-02-28 22:09         ` Paul Eggert
2012-02-28 22:39           ` Fabrice Popineau
2012-02-29 18:08             ` Eli Zaretskii
2012-02-29 22:08               ` Paul Eggert
2012-02-29 18:04           ` Eli Zaretskii
2012-02-29 19:43             ` Paul Eggert
2012-02-29 21:24               ` Eli Zaretskii
2012-03-01  3:34                 ` Paul Eggert
2012-03-01  4:03                   ` Eli Zaretskii
2012-03-01  6:28                     ` Paul Eggert
2012-03-01  7:04                       ` Fabrice Popineau
2012-03-22 17:31               ` Fabrice Popineau
2012-03-23 18:26                 ` Paul Eggert
2012-03-24  9:27                   ` Fabrice Popineau
2012-03-22 17:39           ` Fabrice Popineau
2012-03-22 18:02             ` Andreas Schwab
2012-03-22 18:34               ` Fabrice Popineau
2012-03-22 22:46                 ` Andreas Schwab
2012-03-22 23:06                   ` Fabrice Popineau
2012-03-22 23:38                     ` Andreas Schwab
2012-03-23  8:12                       ` Eli Zaretskii
2012-03-23  9:45                         ` Andreas Schwab
2012-03-23 10:27                           ` Fabrice Popineau
2012-03-23 10:42                             ` Andreas Schwab
2012-03-23 12:21                             ` Eli Zaretskii
2012-03-23 10:11                         ` Fabrice Popineau
2012-03-23 18:13                           ` Paul Eggert
2012-02-20 20:47     ` Eli Zaretskii
2012-02-26 20:17       ` AJMR
2012-02-26 21:25         ` Eli Zaretskii
2012-02-27 17:37           ` AJMR
2012-02-28 21:32       ` Fabrice Popineau
2012-03-01  3:23         ` Paul Eggert
2012-03-01  7:24           ` Fabrice Popineau
2012-03-01  8:58             ` Paul Eggert
2012-03-01 17:45               ` Eli Zaretskii
2012-03-01 20:05               ` Fabrice Popineau
2012-03-02  9:22               ` Eli Zaretskii
2012-03-02 20:35                 ` Paul Eggert
2012-03-02 21:32                   ` Fabrice Popineau
2012-03-02 22:06                   ` Eli Zaretskii
2012-03-03  5:42                     ` Paul Eggert
2012-03-03  7:18                       ` Eli Zaretskii
2012-03-04 21:48                         ` Paul Eggert
2012-03-03  7:58             ` Eli Zaretskii
2012-03-10 13:43               ` Eli Zaretskii
2012-03-22 17:15           ` Fabrice Popineau
2012-03-22 17:22           ` Fabrice Popineau
2012-03-22 18:29           ` Fabrice Popineau
2012-03-22 20:53             ` Stefan Monnier
2012-03-27 12:47           ` Fabrice Popineau
2012-03-27 16:08             ` Paul Eggert
2012-02-20  9:41 ` Richard Stallman
2012-02-20 10:28   ` Dani Moncayo
2012-02-21 12:10     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFgFV9O1VfEiDLQpbZ23xJyyX8EZb42DGGVCSakb9cCCRr59nw@mail.gmail.com \
    --to=fabrice.popineau@supelec.fr \
    --cc=ajmr@ilovetortilladepatatas.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).