Changeset 8561


Ignore:
Timestamp:
Feb 22, 2008, 4:04:06 PM (12 years ago)
Author:
andreas
Message:
  • no pid_t on native Windows
  • not gettimeofday either
  • C calling conventions are different: short documentation, and one implementation
Location:
trunk/source/lisp-kernel
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/gc-common.c

    r8473 r8561  
    2424#include <stdlib.h>
    2525#include <string.h>
     26
     27#ifndef WINDOWS
    2628#include <sys/time.h>
     29#endif
    2730
    2831#ifndef timeradd
     
    274277ncircle_mark_weak_htabv(LispObj htabv)
    275278{
    276   int i, skip = hash_table_vector_header_count;;
     279  int i, skip = hash_table_vector_header_count;
    277280  hash_table_vector_header *hashp = (hash_table_vector_header *)(untag(htabv));
    278281  natural
     
    984987*/
    985988
    986 
     989#ifdef WINDOWS
     990#define get_time(when) /* FIXME */
     991#else
    987992#define get_time(when) gettimeofday(&when, NULL)
    988 
     993#endif
    989994
    990995
  • trunk/source/lisp-kernel/lisp-debug.c

    r8547 r8561  
    869869}
    870870
     871#ifndef WINDOWS
    871872extern pid_t main_thread_pid;
     873#endif
    872874
    873875OSStatus
     
    905907  fprintf(stderr, "? for help\n");
    906908  while (state == debug_continue) {
     909#ifdef WINDOWS
     910    fprintf(stderr, "[%d] OpenMCL kernel debugger: ", 23 /* FIXME */);
     911#else
    907912    fprintf(stderr, "[%d] OpenMCL kernel debugger: ", main_thread_pid);
     913#endif
    908914    state = apply_debug_command(xp, readc(), info, why);
    909915  }
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r8547 r8561  
    12271227}
    12281228
     1229#ifdef WINDOWS
     1230void
     1231terminate_lisp()
     1232{
     1233}
     1234#else
    12291235pid_t main_thread_pid = (pid_t)0;
    12301236
    1231 #ifdef WINDOWS
    1232 void
    1233 terminate_lisp()
    1234 {
    1235 }
    1236 #else
    12371237void
    12381238terminate_lisp()
     
    15241524#endif
    15251525
     1526#ifndef WINDOWS
    15261527  main_thread_pid = getpid();
     1528#endif
    15271529  tcr_area_lock = (void *)new_recursive_lock();
    15281530
  • trunk/source/lisp-kernel/win64/Makefile.nmake

    r8511 r8561  
    2727AS = yasm
    2828M4FLAGS = -DWIN64 -DWINDOWS -DX86 -DX8664 -DHAVE_TLS -DEMUTLS
    29 CDEFINES = /I.. /DWIN64 /DWINDOWS /D_REENTRANT /DX86 /DX8664 /D_GNU_SOURCE /DHAVE_TLS /DEMUTLS #-DDISABLE_EGC
     29CDEFINES = /I.. /DWIN64 /DWINDOWS /D_REENTRANT /DX86 /DX8664 /D_GNU_SOURCE /DHAVE_TLS /DEMUTLS /DVC #-DDISABLE_EGC
    3030CDEBUG = /Zi
    3131COPT =
     
    6666        $(LD) $(LDFLAGS) /out:$@ $(KSPOBJ) $(KERNELOBJ) $(DEBUGOBJ) $(OSLIBS)
    6767
     68cobjs: $(COBJ)
    6869
    6970$(SPOBJ): $(SPINC)
  • trunk/source/lisp-kernel/x86-asmutils64.s

    r7624 r8561  
    133133
    134134/* int cpuid (int code, int *pebx, int *pecx, int *pedx)  */
    135 /*                %rdi,     %rsi,      %rdx,      %rcx               */
     135/* UNIX           %rdi,     %rsi,      %rdx,      %rcx               */
     136/* WIN            %ecx,     %rdx,      %r8,       %r9 */   
    136137_exportfn(C(cpuid))
     138        __ifdef([WINDOWS])
     139        __(pushq %r8)           /* pecx */
     140        __(pushq %r9)           /* pedx */
     141        __(movq %rdx, %rsi)     /* pebx */
     142        __(pushq %rbx)          /* %rbx is non-volatile */
     143        __(xorq %rax, %rax)
     144        __(movl %ecx,%eax)
     145        __else
    137146        __(pushq %rdx)          /* pecx */
    138147        __(pushq %rcx)          /* pedx */
    139148        __(pushq %rbx)          /* %rbx is non-volatile */
    140149        __(movq %rdi,%rax)
     150        __endif
    141151        __(xorl %ecx,%ecx)
    142152        __(cpuid)
  • trunk/source/lisp-kernel/x86-constants64.s

    r8397 r8561  
    2020
    2121
     22/*
     23
     24        Register usage in C calling conventions differ between
     25        Darwin/Linux/FreeBSD (which use the AMD-defined ABI) and
     26        Windows64 (which uses something else).  The good news is that
     27        Win64 did away with the cdecl/stdcall/fastcall madness, there
     28        is only one ABI left.  Here's a rundown.
     29
     30        AMD64^Wx86-64 ABI:
     31         * Integer and pointer function arguments passed (from left to
     32        right) in RDI, RSI, RDX, RCX, R8 and R9
     33         * FP arguments are passed in XMM0..XMM7
     34         * rest is passed on stack
     35         * return value in RAX
     36         * Callee must preserve RBP, RBX, R12..R15, MXCSR control bits
     37         * On function entry, x87 mode and DF clear is assumed
     38         * [RSP]..[RSP-128] must not be touched by signal handlers
     39
     40        Win64 ABI:
     41         * Integer and pointers passed in RCX, RDX, R8, R9
     42         * FP passed in XMM0..XMM3
     43         * rest is passed on stack
     44         * Return value in RAX or XMM0
     45         * Caller (!) responsible for creating and cleaning stack space for
     46        spilling integer registers
     47         * Callee must preserve RBP, RBX, RSI, RDI, R12..R15, XMM6..XMM15
     48
     49        Both want their stack pointers to be 16 byte aligned on call,
     50        equivalent to 8 byte offset after call due to pushed return address.
     51       
     52        http://msdn2.microsoft.com/en-us/library/zthk2dkh(VS.80).aspx
     53        http://www.tortall.net/projects/yasm/manual/html/objfmt-win64-exception.html
     54        http://www.x86-64.org/documentation/abi.pdf
     55
     56
     57        Lisp register usage:
     58
     59        Clozure CL renames the physical registers, giving them names
     60        based on their usage. An overview:
     61
     62        imm0..imm2
     63        temp0..temp2
     64        save0..save3
     65        arg_x, arg_y, arg_z
     66        fn
     67
     68        On top of that, further mappings are defined:
     69
     70        fname, next_method_context:     temp0
     71        nargs:                          imm2
     72        ra0:                            temp2
     73        xfn:                            temp1
     74        allocptr:                       temp0
     75        stack_temp:                     mm7     
     76       
     77        x86-64 ABI mapping:
     78       
     79        imm0..imm2:             RAX, RDX, RCX
     80        temp0..temp2:           RBX, R9, R10
     81        save0..save3:           R15, R14, R12, R11
     82        arg_x, arg_y, arg_z:    R8, RDI, RSI
     83        fn:                     R13     
     84       
     85*/
     86       
    2287
    2388/* Redefining these standard register names - with the same _l, _w, _b suffixes  */
Note: See TracChangeset for help on using the changeset viewer.