Changeset 8626


Ignore:
Timestamp:
Feb 29, 2008, 4:41:27 PM (12 years ago)
Author:
andreas
Message:

Rebase PE image address to 0x10000, so we have allocated memory from
0x11000-0x21000. Also, code to find full executable path name, and
to print Windows error messages.

Location:
branches/win64/lisp-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/lisp-kernel/pmcl-kernel.c

    r8575 r8626  
    114114#endif
    115115#include "Threads.h"
     116
     117#ifdef WINDOWS
     118#include <stdio.h>
     119void
     120wperror(char* message)
     121{
     122  char* buffer;
     123  DWORD last_error = GetLastError();
     124 
     125  FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
     126                FORMAT_MESSAGE_FROM_SYSTEM|
     127                FORMAT_MESSAGE_IGNORE_INSERTS,
     128                NULL,
     129                last_error,
     130                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
     131                (LPTSTR)&buffer,
     132                0, NULL);
     133  fprintf(stderr, "%s: 0x%x %s\n", message, last_error, buffer);
     134  LocalFree(buffer);
     135}
     136#endif
    116137
    117138#ifndef MAP_NORESERVE
     
    10011022    memmove(p,exepath,n);
    10021023    p[n]=0;
     1024    return p;
     1025  }
     1026  return argv0;
     1027#endif
     1028#ifdef WINDOWS
     1029  char path[PATH_MAX], *p;
     1030  int len = GetModuleFileName(NULL, path, PATH_MAX);
     1031  if (len > 0) {
     1032    p = malloc(len + 1);
     1033    memmove(p, path, len);
     1034    p[len] = 0;
    10031035    return p;
    10041036  }
     
    13161348remap_spjump()
    13171349{
     1350  extern opcode spjump_start;
     1351  pc new, old;
     1352  DWORD old_protect;
     1353
     1354  new = VirtualProtect((pc) 0x15000,
     1355                       0x1000,
     1356                       PAGE_EXECUTE_READWRITE,
     1357                       &old_protect);
     1358  if (!new) {
     1359    wperror("VirtualProtect spjump");
     1360    _exit(1);
     1361  }
     1362  memmove((pc) 0x15000, &spjump_start, 0x1000);
    13181363}
    13191364#else
     
    13421387{
    13431388#ifdef WINDOWS
     1389  /* We should be able to run with any version of Windows that actually gets here executing the binary, so don't do anything for now. */
    13441390#else
    13451391  struct utsname uts;
     
    14541500  check_os_version(argv[0]);
    14551501  real_executable_name = determine_executable_name(argv[0]);
    1456   page_size = getpagesize();
     1502  page_size = getpagesize(); /* Implement with GetSystemInfo on Windows w/o MinGW */
    14571503
    14581504#ifdef LINUX
  • branches/win64/lisp-kernel/win64/Makefile

    r8625 r8626  
    7070
    7171../../wx86cl64.exe:     $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) Makefile pei-x86-64.x
    72         $(CC) -Wl,-script=pei-x86-64.x -m64 $(CDEBUG)  -Wl,--export-dynamic $(HASH_STYLE) -o $@ $(USE_LINK_MAP) $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) $(OSLIBS)
     72        $(CC) -Wl,--image-base=0x10000 -Wl,-script=pei-x86-64.x -m64 $(CDEBUG)  -Wl,--export-dynamic $(HASH_STYLE) -o $@ $(USE_LINK_MAP) $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) $(OSLIBS)
    7373
    7474
Note: See TracChangeset for help on using the changeset viewer.