From: ameline@vnet.ibm.com (Ian Ameline)
Date: Mon, 14 Dec 92 13:48:35 EST
Subject: cset/2 main() except
Newsgroups: comp.os.os2.programmer
Organization: C-Set/2 Development, IBM Canada Lab.
Disclaimer: This posting represents the poster's views, not those of IBM

In article <1992Dec11.1048.5763@channel1>,
"richard hajinlian" <richard.hajinlian@channel1.com> writes:
>
>Any guesses as to why this CSET/2 generated assembler code causes a
>protection exception?  The instruction indicated by <================
>causes an abend.  I have no Idea.  I should have copied the icc command
>line for you review but I forgot to take it home.
>
>Thanks for your support!
>
>        TITLE        PCFN001S.C
>        .386
>        .387
>        INCLUDELIB OS2386.LIB
>        INCLUDELIB dde4mbsi.lib
>        INCLUDELIB dde4mbmi.lib
>CODE32        SEGMENT DWORD USE32 PUBLIC 'CODE'
>CODE32        ENDS
>DATA32        SEGMENT DWORD USE32 PUBLIC 'DATA'
>DATA32        ENDS
>CONST32        SEGMENT DWORD USE32 PUBLIC 'CONST'
>CONST32        ENDS
>BSS32        SEGMENT DWORD USE32 PUBLIC 'BSS'
>BSS32        ENDS
>DGROUP        GROUP CONST32, BSS32, DATA32
>        ASSUME        CS:FLAT, DS:FLAT, SS:FLAT, ES:FLAT
>        PUBLIC        HostName
>        PUBLIC        ServiceName
>        EXTRN        memcpy:PROC
>        EXTRN        LogAndExit:PROC
>        EXTRN        translateMessageHeader:PROC
>
>@STAT20        DB "Inside StoreSchedulerPro"
>DB "cessId.",0aH,0H
>        DD        _exeentry
>DATA32        ENDS
>BSS32        SEGMENT
>        ALIGN 04H
>COMM        name:BYTE:09H
>        ALIGN 04H
>COMM        timeVal:DWORD
>        ALIGN 04H
>COMM        maxConReq:DWORD
>        ALIGN 04H
>COMM        serverEntry:BYTE:010H
>        ALIGN 04H
>COMM        sp:DWORD
>BSS32        ENDS
>CONST32        SEGMENT
>CONST32        ENDS
>CODE32        SEGMENT
>
>;***** 196 main(SHORT argc, PCHAR argv[], PCHAR envp[])
>        ALIGN 04H
>
>        PUBLIC main
>main        PROC
>        PUSH        EBP
>        MOV        EBP,ESP
>        MOV        ECX,0570H
>BLBL56:
>        SUB        ECX,01000H
>        MOV        BYTE PTR [ESP+ECX],0H
><=================================???? [Stack Probes--Ian]
>        CMP        ECX,0ffff1570H
>        JG        BLBL56
>        SUB        ESP,0ea90H
>        PUSH        ESI
>        PUSH        EDI
>        SUB        ESP,0cH
>
>;***** 201   char service[] = "fdpnetd";
>        MOV        ECX,08H
>        MOV        EDX,OFFSET FLAT: @STAT1
>        LEA        EAX,[EBP-08H];        service
>        CALL        memcpy
>
>;***** 202   short int shutdown;
>;***** 203   /*
>;***** 204   *     Define the message variable.  This also contains the
>user
>;***** 205   *     data of the packet.
>;***** 206   */
>;***** 207   struct MessageHeaderStr MessageHeader;
>;***** 208   /*
>;***** 209   *     Work buffer for the network packet.
>;***** 210   */
>;***** 211   char msg[MAXMSGSIZE];
>

   Those are stack probes -- probing the stack to make sure the guard
page mechanism for stack growth works properly when you have more than
4K of locals. I suspect that your stack size is being left at the
default size of 4K. Note that the guard page mechanism will grow your
stack to a maximum specified size, and no larger -- that default
size is 4K. You can change it by using the /Stack option on your link386
command. ie LINK386 foo.obj /ST:32000;

Regards,
Ian Ameline.
Newsgroups: comp.os.os2.programmer