> I suppose "DATE" is used within these include files. You should change
DATE in
> bigforth.c to something else (e.g. VERSION_DATE), and also in the
invocation
>of GCC.

    That's correct. I figured that out and could build with old gcc
(2.9.5.2) from
    MinGW (built under Windows command prompt).

    I merged linker.s into bf_link of bigforth.c and been trying to port to
MSVC.
    (for debugging purpose).

    It's compiled and linked OK but somehow crashed upon returning from
bf_link.
    (called from 'linkit').

    Upon entry to bflink (before pusha)

    EAX: undefined        EBX: 7FFdF000    ECX: 00000000 EDX: 00440044
    ESI: 0012FBFC       EDI: 0012FA50     EBP: 0012FA50
    EIP: 00401661         ESP: 0012F93C

    Before leaving bf_link (after popa)

    EAX: 0000CCCC    EBX: 0000F000    ECX: 00000000 EDX: 00440044
    ESI: 0044FBFC       EDI: 0044FA50     EBP: 0044FA50
    EIP: 00401696         ESP: 0012F93C

    Any idea as what may be causing the crash ?

    Tanks for your help.

    Cheers,

    PhiHo.

void bf_link(int * this, int * that, unsigned short * thread)
{
  PRINTVX(3, "Linking %s ", cstring(((char*)this)+0x30));
  PRINTVX(3, "with %s\n", that ? cstring(((char*)that)+0x30) : "nil");

#ifdef _MSC_VER
 __asm
 {
  jmp  bflink

linkthread:
  mov  edi, esi
    add  edi, 4[esi]
    xor  ecx, ecx
    jmp  Llink2

Llink1:
  mov  ax, word ptr [ecx + esi]
    mov  bx, word ptr 2[ecx + esi]
    add  ebx, ebp
    bts  [edi], ecx
    mov  [ecx + esi], ebx
    sub  ebx, ebp

Llink2:
  cmp  cx, ax
    mov  ecx, eax
    jne  Llink1
    ret

linkrel:
  mov  edi, esi
  add  edi, 4[esi]
  sub  ebp, esi
  sub  ebp, 4      ;;   $4
  xor  ecx,ecx
  jmp  Llink4

Llink3:
  mov  ax, word ptr [ecx + esi]
  mov  bx, word ptr 2[ecx + esi]
  push ebx
  add  ebx, ebp
  sub  ebx, ecx
  bts  [edi], ecx
  mov  [ecx + esi], ebx
  inc  ecx
  bts  [edi], ecx
  dec  ecx
  pop  ebx

Llink4:
  cmp  cx, ax
  mov  ecx, eax
  jne  Llink3
  lea  ebp, 4[esi + ebp]
  ret

bflink:
  pusha
    mov  ebx, 0x10[ebp]
    mov  esi, 0x08[ebp]
    mov  ebp, 0x0C[ebp]
    mov  ax, word ptr [ebx]
    shl  eax, 16        ;;  $16
    mov  ax, word ptr 4[ebx]
    push ebx
    mov   bx, word ptr 2[ebx]
    shl   ebx, 16        ;;  $16
    call  linkthread
    pop   ebx
    mov   ax, word ptr 6[ebx]
    mov  bx, word ptr 2[ebx]
    shl   ebx, 16        ;;  $16
    call  linkrel
    popa
 }
#else
  asm("jmp bflink\n\
  linkthread: movl  %esi,%edi\n\
    addl  4(%esi),%edi\n\
    xorl  %ecx,%ecx\n\
    jmp Llink2\n\
Llink1: movw  (%ecx,%esi),%ax\n\
    movw  2(%ecx,%esi),%bx\n\
    addl  %ebp,%ebx\n\
    bts %ecx,(%edi)\n\
    movl  %ebx,(%ecx,%esi)\n\
    subl  %ebp,%ebx\n\
Llink2: cmpw  %ax,%cx\n\
    movl  %eax,%ecx\n\
    jne Llink1\n\
    ret\n\
linkrel:movl  %esi,%edi\n\
  addl  4(%esi),%edi\n\
  subl  %esi,%ebp\n\
  subl  $4,%ebp\n\
  xorl  %ecx,%ecx\n\
  jmp Llink4\n\
Llink3: movw  (%ecx,%esi),%ax\n\
  movw  2(%ecx,%esi),%bx\n\
  pushl %ebx\n\
  addl  %ebp,%ebx\n\
  subl  %ecx,%ebx\n\
  bts %ecx,(%edi)\n\
  movl  %ebx,(%ecx,%esi)\n\
  incl  %ecx\n\
  bts %ecx,(%edi)\n\
  decl  %ecx\n\
  popl  %ebx\n\
Llink4: cmpw  %ax,%cx\n\
  movl  %eax,%ecx\n\
  jne Llink3\n\
  leal  4(%esi,%ebp),%ebp\n\
  ret\n\
bflink: pushal\n\
        movl    0x10(%ebp),%ebx\n\
        movl    0x08(%ebp),%esi\n\
        movl    0x0C(%ebp),%ebp\n\
        movw    (%ebx),%ax\n\
        shll    $16,%eax\n\
        movw    4(%ebx),%ax\n\
        pushl   %ebx\n\
        movw    2(%ebx),%bx\n\
        shll    $16,%ebx\n\
        call    linkthread\n\
        popl    %ebx\n\
        movw    6(%ebx),%ax\n\
        movw    2(%ebx),%bx\n\
        shll    $16,%ebx\n\
        call    linkrel\n\
        popal");
#endif // _MSC_VER
}


----- Original Message ----- 
From: "Bernd Paysan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 12, 2003 12:00 PM
Subject: Re: [bigforth] I am not a 'real programmer'


On Tuesday 07 January 2003 18:44, PhiHo Hoang wrote:
> $ gcc -O2 -DDATE='"07jan2003"' -mno-cygwin bigforth.c linker.S -o
> forthker.exe
> In file included from /usr/include/w32api/objbase.h:57,
>                  from /usr/include/w32api/ole2.h:9,
>                  from /usr/include/w32api/windows.h:108,
>                  from bigforth.c:15:
> /usr/include/w32api/wtypes.h:97: parse error before string constant
> In file included from /usr/include/w32api/objbase.h:59,
>                  from /usr/include/w32api/ole2.h:9,
>                  from /usr/include/w32api/windows.h:108,
>                  from bigforth.c:15:
> /usr/include/w32api/objidl.h:247: parse error before string constant
> /usr/include/w32api/objidl.h:321: parse error before string constant
> /usr/include/w32api/objidl.h:344: parse error before "cadate"
> /usr/include/w32api/objidl.h:353: parse error before '}' token
> /usr/include/w32api/objidl.h:894: parse error before "PROPVARIANT"
> /usr/include/w32api/objidl.h:895: parse error before "PROPVARIANT"

I suppose "DATE" is used within these include files. You should change DATE
in
bigforth.c to something else (e.g. VERSION_DATE), and also in the invocation
of GCC.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to