mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-05 22:47:09 +01:00
+ added x86 (i8086, i386 and x86_64) intrinsics fpc_x86_get_cs/ss/ds/es/fs/gs
for getting the value of x86 segment registers git-svn-id: trunk@39433 -
This commit is contained in:
parent
dd32f877ed
commit
9272bf59b2
@ -19,4 +19,10 @@
|
||||
in_x86_outportw = fpc_in_cpu_first+4,
|
||||
in_x86_outportl = fpc_in_cpu_first+5,
|
||||
in_x86_cli = fpc_in_cpu_first+6,
|
||||
in_x86_sti = fpc_in_cpu_first+7
|
||||
in_x86_sti = fpc_in_cpu_first+7,
|
||||
in_x86_get_cs = fpc_in_cpu_first+8,
|
||||
in_x86_get_ss = fpc_in_cpu_first+9,
|
||||
in_x86_get_ds = fpc_in_cpu_first+10,
|
||||
in_x86_get_es = fpc_in_cpu_first+11,
|
||||
in_x86_get_fs = fpc_in_cpu_first+12,
|
||||
in_x86_get_gs = fpc_in_cpu_first+13
|
||||
|
||||
@ -139,6 +139,17 @@ implementation
|
||||
in_x86_cli,
|
||||
in_x86_sti:
|
||||
resultdef:=voidtype;
|
||||
in_x86_get_cs,
|
||||
in_x86_get_ss,
|
||||
in_x86_get_ds,
|
||||
in_x86_get_es,
|
||||
in_x86_get_fs,
|
||||
in_x86_get_gs:
|
||||
{$ifdef i8086}
|
||||
resultdef:=u16inttype;
|
||||
{$else i8086}
|
||||
resultdef:=s32inttype;
|
||||
{$endif i8086}
|
||||
else
|
||||
Result:=inherited pass_typecheck_cpu;
|
||||
end;
|
||||
@ -151,7 +162,13 @@ implementation
|
||||
case inlinenumber of
|
||||
in_x86_inportb,
|
||||
in_x86_inportw,
|
||||
in_x86_inportl:
|
||||
in_x86_inportl,
|
||||
in_x86_get_cs,
|
||||
in_x86_get_ss,
|
||||
in_x86_get_ds,
|
||||
in_x86_get_es,
|
||||
in_x86_get_fs,
|
||||
in_x86_get_gs:
|
||||
expectloc:=LOC_REGISTER;
|
||||
in_x86_outportb,
|
||||
in_x86_outportw,
|
||||
@ -448,6 +465,13 @@ implementation
|
||||
hlcg.ungetcpuregister(current_asmdata.CurrAsmList,dreg);
|
||||
end;
|
||||
|
||||
procedure get_segreg(segreg:tregister);
|
||||
begin
|
||||
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
|
||||
location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,resultdef);
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_MOV,TCGSize2OpSize[def_cgsize(resultdef)],segreg,location.register));
|
||||
end;
|
||||
|
||||
begin
|
||||
case inlinenumber of
|
||||
in_x86_inportb:
|
||||
@ -466,6 +490,18 @@ implementation
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLI));
|
||||
in_x86_sti:
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_STI));
|
||||
in_x86_get_cs:
|
||||
get_segreg(NR_CS);
|
||||
in_x86_get_ss:
|
||||
get_segreg(NR_SS);
|
||||
in_x86_get_ds:
|
||||
get_segreg(NR_DS);
|
||||
in_x86_get_es:
|
||||
get_segreg(NR_ES);
|
||||
in_x86_get_fs:
|
||||
get_segreg(NR_FS);
|
||||
in_x86_get_gs:
|
||||
get_segreg(NR_GS);
|
||||
else
|
||||
inherited pass_generate_code_cpu;
|
||||
end;
|
||||
|
||||
@ -34,3 +34,9 @@ procedure fpc_x86_outportw(port : word;data : word);[internproc:fpc_in_x86_outpo
|
||||
procedure fpc_x86_outportl(port : word;data : longint);[internproc:fpc_in_x86_outportl];
|
||||
procedure fpc_x86_cli;[internproc:fpc_in_x86_cli];
|
||||
procedure fpc_x86_sti;[internproc:fpc_in_x86_sti];
|
||||
function fpc_x86_get_cs:longint;[internproc:fpc_in_x86_get_cs];
|
||||
function fpc_x86_get_ss:longint;[internproc:fpc_in_x86_get_ss];
|
||||
function fpc_x86_get_ds:longint;[internproc:fpc_in_x86_get_ds];
|
||||
function fpc_x86_get_es:longint;[internproc:fpc_in_x86_get_es];
|
||||
function fpc_x86_get_fs:longint;[internproc:fpc_in_x86_get_fs];
|
||||
function fpc_x86_get_gs:longint;[internproc:fpc_in_x86_get_gs];
|
||||
|
||||
@ -20,3 +20,9 @@
|
||||
fpc_in_x86_outportl = fpc_in_cpu_first+5;
|
||||
fpc_in_x86_cli = fpc_in_cpu_first+6;
|
||||
fpc_in_x86_sti = fpc_in_cpu_first+7;
|
||||
fpc_in_x86_get_cs = fpc_in_cpu_first+8;
|
||||
fpc_in_x86_get_ss = fpc_in_cpu_first+9;
|
||||
fpc_in_x86_get_ds = fpc_in_cpu_first+10;
|
||||
fpc_in_x86_get_es = fpc_in_cpu_first+11;
|
||||
fpc_in_x86_get_fs = fpc_in_cpu_first+12;
|
||||
fpc_in_x86_get_gs = fpc_in_cpu_first+13;
|
||||
@ -34,3 +34,9 @@ procedure fpc_x86_outportw(port : word;data : word);[internproc:fpc_in_x86_outpo
|
||||
//procedure fpc_x86_outportl(port : word;data : longint);[internproc:fpc_in_x86_outportl];
|
||||
procedure fpc_x86_cli;[internproc:fpc_in_x86_cli];
|
||||
procedure fpc_x86_sti;[internproc:fpc_in_x86_sti];
|
||||
function fpc_x86_get_cs:word;[internproc:fpc_in_x86_get_cs];
|
||||
function fpc_x86_get_ss:word;[internproc:fpc_in_x86_get_ss];
|
||||
function fpc_x86_get_ds:word;[internproc:fpc_in_x86_get_ds];
|
||||
function fpc_x86_get_es:word;[internproc:fpc_in_x86_get_es];
|
||||
function fpc_x86_get_fs:word;[internproc:fpc_in_x86_get_fs];
|
||||
function fpc_x86_get_gs:word;[internproc:fpc_in_x86_get_gs];
|
||||
|
||||
@ -20,3 +20,9 @@
|
||||
// fpc_in_x86_outportl = fpc_in_cpu_first+5;
|
||||
fpc_in_x86_cli = fpc_in_cpu_first+6;
|
||||
fpc_in_x86_sti = fpc_in_cpu_first+7;
|
||||
fpc_in_x86_get_cs = fpc_in_cpu_first+8;
|
||||
fpc_in_x86_get_ss = fpc_in_cpu_first+9;
|
||||
fpc_in_x86_get_ds = fpc_in_cpu_first+10;
|
||||
fpc_in_x86_get_es = fpc_in_cpu_first+11;
|
||||
fpc_in_x86_get_fs = fpc_in_cpu_first+12;
|
||||
fpc_in_x86_get_gs = fpc_in_cpu_first+13;
|
||||
@ -25,3 +25,9 @@ procedure fpc_x86_outportw(port : word;data : word);[internproc:fpc_in_x86_outpo
|
||||
procedure fpc_x86_outportl(port : word;data : longint);[internproc:fpc_in_x86_outportl];
|
||||
procedure fpc_x86_cli;[internproc:fpc_in_x86_cli];
|
||||
procedure fpc_x86_sti;[internproc:fpc_in_x86_sti];
|
||||
function fpc_x86_get_cs:longint;[internproc:fpc_in_x86_get_cs];
|
||||
function fpc_x86_get_ss:longint;[internproc:fpc_in_x86_get_ss];
|
||||
function fpc_x86_get_ds:longint;[internproc:fpc_in_x86_get_ds];
|
||||
function fpc_x86_get_es:longint;[internproc:fpc_in_x86_get_es];
|
||||
function fpc_x86_get_fs:longint;[internproc:fpc_in_x86_get_fs];
|
||||
function fpc_x86_get_gs:longint;[internproc:fpc_in_x86_get_gs];
|
||||
|
||||
@ -20,3 +20,9 @@
|
||||
fpc_in_x86_outportl = fpc_in_cpu_first+5;
|
||||
fpc_in_x86_cli = fpc_in_cpu_first+6;
|
||||
fpc_in_x86_sti = fpc_in_cpu_first+7;
|
||||
fpc_in_x86_get_cs = fpc_in_cpu_first+8;
|
||||
fpc_in_x86_get_ss = fpc_in_cpu_first+9;
|
||||
fpc_in_x86_get_ds = fpc_in_cpu_first+10;
|
||||
fpc_in_x86_get_es = fpc_in_cpu_first+11;
|
||||
fpc_in_x86_get_fs = fpc_in_cpu_first+12;
|
||||
fpc_in_x86_get_gs = fpc_in_cpu_first+13;
|
||||
Loading…
Reference in New Issue
Block a user