ml을 사용해서 어셈블링을 하는데 어셈블링 결과가 processor: 8086/8088 memory model: small이 뜹니다. 왜?????

ssibseya의 이미지

걍 간단한 예제를 아래에 실었습니다.
어셈블링은 visualStudio2005을 사용하고 커스텀 명령라인은 다음과 같고 밑에 예제코드가 있습니다.
왜 어셈블결과가 processor: 8086/8088 memory model: small인지 모르겠습니다.
실제로 tracing을 하면 "push ecx"가 "push cx"로 컴파일 되는데 이것 또한 이해가 가지 않습니다.
뭐가 문제죠???????
고수분들의 도움 부탁드립니다;;;;

ml -I$(ProjectDir)..\include\ -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).obj debug\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"

page ,132
title chkstk - C stack checking routine
;***
;refer:
; ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.ko/dv_vcmasm/html/1446d55f-e2e7-4fd1-a9b8-b15cf7d4e47c.htm
;*******************************************************************************

;***
;chkstk.asm - C stack checking routine
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; Provides support for automatic stack checking in C procedures
; when stack checking is enabled.
;
;*******************************************************************************

.xlist
include debug__assembler.inc
include cruntime.inc
.list

%define X386P 1
IFDEF X386P
;%error
;.386P ; If use CR0 reg
.486P ;
ENDIF

; size of a page of memory

_PAGESIZE_ equ 1000h

CODESEG

page
;***
;_chkstk - check stack upon procedure entry
;
;Purpose:
; Provide stack checking on procedure entry. Method is to simply probe
; each page of memory required for the stack in descending order. This
; causes the necessary pages of memory to be allocated via the guard
; page scheme, if possible. In the event of failure, the OS raises the
; _XCPT_UNABLE_TO_GROW_STACK exception.
;
; NOTE: Currently, the (EAX < _PAGESIZE_) code path falls through
; to the "lastpage" label of the (EAX >= _PAGESIZE_) code path. This
; is small; a minor speed optimization would be to special case
; this up top. This would avoid the painful save/restore of
; ecx and would shorten the code path by 4-6 instructions.
;
;Entry:
; EAX = size of local frame
;
;Exit:
; ESP = new stackframe, if successful
;
;Uses:
; EAX
;
;Exceptions:
; _XCPT_GUARD_PAGE_VIOLATION - May be raised on a page probe. NEVER TRAP
; THIS!!!! It is used by the OS to grow the
; stack on demand.
; _XCPT_UNABLE_TO_GROW_STACK - The stack cannot be grown. More precisely,
; the attempt by the OS memory manager to
; allocate another guard page in response
; to a _XCPT_GUARD_PAGE_VIOLATION has
; failed.
;
;*******************************************************************************

public _alloca_probe

_chkstk proc

_alloca_probe = _chkstk

push ecx

; Calculate new TOS.

lea ecx, [esp] + 8 - 4 ; TOS before entering function + size for ret value
sub ecx, eax ; new TOS

; Handle allocation size that results in wraparound.
; Wraparound will result in StackOverflow exception.

sbb eax, eax ; 0 if CF==0, ~0 if CF==1
not eax ; ~0 if TOS did not wrapped around, 0 otherwise
and ecx, eax ; set to 0 if wraparound

mov eax, esp ; current TOS
and eax, not ( _PAGESIZE_ - 1) ; Round down to current page boundary

cs10:
cmp ecx, eax ; Is new TOS
jb short cs20 ; in probed page?
mov eax, ecx ; yes.
pop ecx
xchg esp, eax ; update esp
mov eax, dword ptr [eax] ; get return address
mov dword ptr [esp], eax ; and put it at new TOS
ret

; Find next lower page and probe
cs20:
sub eax, _PAGESIZE_ ; decrease by PAGESIZE
test dword ptr [eax],eax ; probe page.
jmp short cs10

_chkstk endp

end

익명 사용자의 이미지

본지가 오래되서 그런지 지시어 형식이 좀 생소하군요.
파일이 전부 있지 않아서 확인하기는 힘듭니다만..

윈도우용 어셈블리라면 딱 3가지만 선언되면 됩니다. 아래의 3가지가 선언되지 않으면 CPU가 8086으로 인식되고 기본 메모리 모델인 small 모델로 선택됩니다.

.xlist
include debug__assembler.inc
include cruntime.inc
.list
 
%define X386P 1
IFDEF X386P
;%error
;.386P ; If use CR0 reg
.486P ;
ENDIF
 
; size of a page of memory
 
_PAGESIZE_ equ 1000h
 
CODESEG

이 부분 대신

.386P
 
.MODEL FLAT
.CODE
 
; size of a page of memory
 
_PAGESIZE_ equ 1000h

로 넣고 해 보시기 바랍니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.