Explorar o código

* use 16-bit offsets for threadvars on CPUs with 16-bit address space

git-svn-id: trunk@32013 -
nickysn %!s(int64=9) %!d(string=hai) anos
pai
achega
12a9664181
Modificáronse 4 ficheiros con 9 adicións e 5 borrados
  1. 4 0
      compiler/symdef.pas
  2. 2 2
      rtl/inc/thread.inc
  3. 2 2
      rtl/inc/threadh.inc
  4. 1 1
      rtl/inc/threadvr.inc

+ 4 - 0
compiler/symdef.pas

@@ -1236,7 +1236,11 @@ implementation
         result:=crecorddef.create_global_internal(
           name,sizeof(pint),sizeof(pint),
           init_settings.alignment.maxCrecordalign);
+{$ifdef cpu16bitaddr}
+        index_field:=result.add_field_by_def('',u16inttype);
+{$else cpu16bitaddr}
         index_field:=result.add_field_by_def('',u32inttype);
+{$endif cpu16bitaddr}
         non_mt_data_field:=result.add_field_by_def('',def);
         { no need to add alignment padding, we won't create arrays of these }
       end;

+ 2 - 2
rtl/inc/thread.inc

@@ -437,13 +437,13 @@ begin
   Result:=-1;
 end;
 
-procedure NoInitThreadvar(var offset : dword;size : dword);
+procedure NoInitThreadvar(var offset : {$ifdef cpu16}word{$else}dword{$endif};size : dword);
 
 begin
   NoThreadError;
 end;
 
-function NoRelocateThreadvar(offset : dword) : pointer;
+function NoRelocateThreadvar(offset : {$ifdef cpu16}word{$else}dword{$endif}) : pointer;
 
 begin
   NoThreadError;

+ 2 - 2
rtl/inc/threadh.inc

@@ -47,8 +47,8 @@ type
   TGetCurrentThreadIdHandler = Function : TThreadID;
   TCriticalSectionHandler = Procedure (var cs);
   TCriticalSectionHandlerTryEnter = function (var cs):longint;
-  TInitThreadVarHandler = Procedure(var offset : dword;size : dword);
-  TRelocateThreadVarHandler = Function(offset : dword) : pointer;
+  TInitThreadVarHandler = Procedure(var offset : {$ifdef cpu16}word{$else}dword{$endif};size : dword);
+  TRelocateThreadVarHandler = Function(offset : {$ifdef cpu16}word{$else}dword{$endif}) : pointer;
   TAllocateThreadVarsHandler = Procedure;
   TReleaseThreadVarsHandler = Procedure;
   TBasicEventHandler        = procedure(state:peventstate);

+ 1 - 1
rtl/inc/threadvr.inc

@@ -23,7 +23,7 @@
 type
   pltvInitEntry = ^ltvInitEntry;
   ltvInitEntry = packed record
-     varaddr : pdword;
+     varaddr : {$ifdef cpu16}pword{$else}pdword{$endif};
      size    : longint;
   end;