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

git-svn-id: trunk@32013 -
This commit is contained in:
nickysn 2015-10-11 12:16:26 +00:00
parent 2116552b36
commit 12a9664181
4 changed files with 9 additions and 5 deletions

View File

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

View File

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

View File

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

View File

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