FIX: No Stack Frame From CMACROS.INC cProc FORCEFRAME

Last reviewed: September 16, 1997
Article ID: Q94943
6.00 6.00a 6.00b 6.10 6.10a | 6.00 6.00a 6.00b
MS-DOS                      | OS/2
kbtool kbfixlist kbbuglist

The information in this article applies to:

  • Microsoft Macro Assembler for MS-DOS, versions 6.0, 6.0a, 6.0b, 6.1, and 6.1a
  • Microsoft Macro Assembler for OS/2, versions 6.0, 6.0a, and 6.0b

SYMPTOMS

When an application includes the CMACROS.INC file and specifies the FORCEFRAME option with the cProc macro, the assembler does not generate a stack frame.

CAUSE

The code to determine that the application specifies the FORCEFRAME option was omitted from the cProc macro.

RESOLUTION

To correct this problem, add the following three lines to CMACROS.INC. Modify version 5.3 to add the following lines before line 876 or modify version 5.31 to add the following lines before line 1518.

   ifidn <x>,<FORCEFRAME>
   ?ff=1
   endif

Alternately, modify the application source code to remove the cProc macro and in its place specify the PROC directive with the FORCEFRAME argument.

STATUS

Microsoft has confirmed this to be a problem in CMACROS.INC versions 5.3 and 5.31 distributed with MASM versions 6.0, 6.0a, 6.0b, 6.1, and 6.1a. This problem was corrected in the CMACROS.INC distributed with MASM for MS-DOS version 6.11.

MORE INFORMATION

The corrected CMACROS.INC file is as follows:

   ifidn <x>,<ATOMIC>
   ?nx=1
   endif

   ifidn <x>,<FORCEFRAME>
   ?ff=1
   endif

   ifidn <x>,<C>
   ?pcc=0
   endif

Comments in the CMACROS.INC file version 5.31 document the cProc macro as follows:

   cProc - define a 'c' procedure

   cProc is the procedure definition for procedures.

      format:
              cProc n,cf,a
      where:
              n       is the name of the procedure

              cf      controls certain definitions, and may be:
                      NEAR       proc is to be a near label
                      FAR        proc is to be a far label
                      PUBLIC     proc is to be defined as public
                      SMALL      call makeframe procedure
                      NODATA     don't create prolog code to setup DS
                      ATOMIC     don't link stack if not needed
                                 NODATA must be specified for ATOMIC
                      FORCEFRAME Force generation of a frame
                      C          proc is to be a C procedure
                      PLM        proc is to be a PL/M procedure
                      PASCAL     proc is to be a PL/M procedure
                      WIN        proc is to be a Windows procedure
                      NONWIN     proc isn't to be a Windows procedure

              a       is a list of registers that are to be saved whenever
                      the procedure is invoked.

                    makeframe procedure: If small is specified, then the
                    "makeframe procedure" is invoked instead of generating
                    normal prologues/epilogues

                    A call is performed to the makeframe procedure. The
                    call is followed by two bytes. the first byte is the
                    number of locals to allocate for the frame, the second
                    is the number of bytes of parameters. The makeframe
                    procedure will in turn call the cProc routine at the
                    address following the data bytes. When the cProc is
                    finished, it will do a near return to the makeframe
                    procedure to clean up the frame and exit.

                    Note that register parameters and makeframe are
                    incompatible and cannot be used together.

                    The makeframe procedure will save SI, DI, and also DS
                    if a far procedure. These registers will be removed
                    from the autosave list if specified.

The following code example demonstrates this problem.

Sample Code

; Assemble options needed: none

INCLUDE cmacros.inc

sBegin code assumes cs, code assumes ds, data

   cProc my_proc, <FORCEFRAME, PUBLIC>, <>
   cBegin my_proc      ; stack frame prologue code belongs here
   xor bx, bx
   cEnd                ; stack frame epilogue code belongs here
sEnd

_text SEGMENT start:
   call my_proc
   mov ax, 4C00h
   int 21h
_text ENDS END start


Additional reference words: 5.30 6.00 6.00a 6.00b 6.10 6.10a buglist6.00a
buglist6.00b buglist6.10 buglist6.10a fixlist6.11
KBCategory: kbtool kbfixlist kbbuglist
KBSubCategory: MLIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.