2
0
Эх сурвалжийг харах

* changed the codepointer type in the i8086 small and compact memory models from
nearpointer to nearcspointer

git-svn-id: trunk@37730 -

nickysn 7 жил өмнө
parent
commit
0119e7afb3

+ 0 - 18
compiler/i8086/n8086mem.pas

@@ -35,7 +35,6 @@ interface
        ti8086addrnode = class(ti86addrnode)
         protected
          procedure set_absvarsym_resultdef; override;
-         function typecheck_non_proc(realsource: tnode; out res: tnode): boolean; override;
          procedure pass_generate_code;override;
         public
          get_offset_only: boolean;
@@ -78,23 +77,6 @@ implementation
       end;
 
 
-    function ti8086addrnode.typecheck_non_proc(realsource: tnode; out res: tnode): boolean;
-      begin
-        res:=nil;
-        if (realsource.nodetype=loadn) and
-           (tloadnode(realsource).symtableentry.typ=labelsym) then
-          begin
-            if current_settings.x86memorymodel in x86_far_code_models then
-              resultdef:=voidfarpointertype
-            else
-              resultdef:=voidnearpointertype;
-            result:=true
-          end
-        else
-          result:=inherited;
-      end;
-
-
     procedure ti8086addrnode.pass_generate_code;
       begin
         if get_offset_only then

+ 8 - 2
compiler/nmem.pas

@@ -638,8 +638,14 @@ implementation
         result:=false;
         res:=nil;
         if (realsource.nodetype=loadn) and
-           (tloadnode(realsource).symtableentry.typ=absolutevarsym) and
-           (tabsolutevarsym(tloadnode(realsource).symtableentry).abstyp=toaddr) then
+           (tloadnode(realsource).symtableentry.typ=labelsym) then
+          begin
+            resultdef:=voidcodepointertype;
+            result:=true;
+          end
+        else if (realsource.nodetype=loadn) and
+                (tloadnode(realsource).symtableentry.typ=absolutevarsym) and
+                (tabsolutevarsym(tloadnode(realsource).symtableentry).abstyp=toaddr) then
           begin
             offset:=tabsolutevarsym(tloadnode(realsource).symtableentry).addroffset;
             hp:=left;

+ 3 - 1
compiler/psystem.pas

@@ -166,8 +166,10 @@ implementation
 {$ifdef i8086}
         if current_settings.x86memorymodel in x86_far_code_models then
           voidcodepointertype:=voidfarpointertype
+        else if current_settings.x86memorymodel=mm_tiny then
+          voidcodepointertype:=voidnearpointertype
         else
-          voidcodepointertype:=voidnearpointertype;
+          voidcodepointertype:=voidnearcspointertype;
         voidstackpointertype:=voidnearsspointertype;
 {$else i8086}
         voidcodepointertype:=voidpointertype;

+ 30 - 0
rtl/i8086/i8086.inc

@@ -1045,6 +1045,36 @@ begin
   HexStr:=HexStr(Word(Val),4);
 end;
 
+function HexStr(Val: NearCsPointer): ShortString;
+begin
+  HexStr:='CS:'+HexStr(Word(Val),4);
+end;
+
+function HexStr(Val: NearDsPointer): ShortString;
+begin
+  HexStr:='DS:'+HexStr(Word(Val),4);
+end;
+
+function HexStr(Val: NearEsPointer): ShortString;
+begin
+  HexStr:='ES:'+HexStr(Word(Val),4);
+end;
+
+function HexStr(Val: NearSsPointer): ShortString;
+begin
+  HexStr:='SS:'+HexStr(Word(Val),4);
+end;
+
+function HexStr(Val: NearFsPointer): ShortString;
+begin
+  HexStr:='FS:'+HexStr(Word(Val),4);
+end;
+
+function HexStr(Val: NearGsPointer): ShortString;
+begin
+  HexStr:='GS:'+HexStr(Word(Val),4);
+end;
+
 function HexStr(Val: FarPointer): ShortString;
 type
   TFarPointerRec = record

+ 11 - 1
rtl/inc/systemh.inc

@@ -406,10 +406,14 @@ Type
     CodePointer = FarPointer;
     CodePtrInt = Longint;
     CodePtrUInt = DWord;
-  {$elseif defined(FPC_X86_CODE_NEAR)}
+  {$elseif defined(FPC_MM_TINY)}
     CodePointer = NearPointer;
     CodePtrInt = Integer;
     CodePtrUInt = Word;
+  {$elseif defined(FPC_X86_CODE_NEAR)}
+    CodePointer = NearCsPointer;
+    CodePtrInt = Integer;
+    CodePtrUInt = Word;
   {$else}
     CodePointer = Pointer;
     CodePtrInt = PtrInt;
@@ -1195,6 +1199,12 @@ Function  OctStr(Val:qword;cnt:byte):shortstring;
 Function  binStr(Val:qword;cnt:byte):shortstring;
 {$ifdef CPUI8086}
 Function  hexStr(Val:NearPointer):shortstring;
+function  hexStr(Val:NearCsPointer):shortstring;
+function  hexStr(Val:NearDsPointer):shortstring;
+function  hexStr(Val:NearEsPointer):shortstring;
+function  hexStr(Val:NearSsPointer):shortstring;
+function  hexStr(Val:NearFsPointer):shortstring;
+function  hexStr(Val:NearGsPointer):shortstring;
 Function  hexStr(Val:FarPointer):shortstring;
 Function  hexStr(Val:HugePointer):shortstring;{$ifdef SYSTEMINLINE}inline;{$endif}
 {$else CPUI8086}

+ 2 - 2
rtl/msdos/classes.pp

@@ -18,9 +18,9 @@
 { determine the type of the resource/form file }
 {$define Win16Res}
 
-{$if defined(FPC_MM_TINY) or defined(FPC_MM_SMALL) or defined(FPC_MM_LARGE) or defined(FPC_MM_HUGE)}
+{$if defined(FPC_MM_TINY) or defined(FPC_MM_LARGE) or defined(FPC_MM_HUGE)}
   { CodePointer = Pointer; nothing to define }
-{$elseif defined(FPC_MM_MEDIUM) or defined(FPC_MM_COMPACT)}
+{$elseif defined(FPC_MM_SMALL) or defined(FPC_MM_MEDIUM) or defined(FPC_MM_COMPACT)}
   {$define FPC_CODEPOINTER_DIFFERENT_THAN_POINTER}
 {$else}
   {$fatal Unknown i8086 memory model.}