summaryrefslogtreecommitdiff
path: root/riscv_new/tests/webtbs/tw11563.pp
blob: 1d03b348dea8366340cc1b063c86bbd78047a7fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ %target=linux,haiku}
{ %result=216 }

program ExecStack;
  procedure DoIt;
  type
    proc = procedure;
  var
{$if defined(cpupowerpc) or defined(cpupowerpc64)}
    ret: longint;
{$endif}
{$if defined(cpuaarch64)}
    ret: longint;
{$endif}
{$if defined(cpui386) or defined(cpux86_64)}
    ret: Byte;
{$endif}
{$ifdef cpuarm}
    'add arm code to test stack execution'
{$endif}
{$ifdef cpumips}
    ret: array[0..1] of longword;
{$endif}
{$ifdef cpum68k}
    ret: word;
{$endif}
    DoNothing: proc;

  begin
{$if defined(cpupowerpc) or defined(cpupowerpc64)}
    ret := ($4e shl 24) or ($80 shl 16) or ($00 shl 8) or $20;
{$if defined(cpupowerpc64)}
    { can't use proc(@ret) because linux/ppc64 always expects some kind of
      trampoline
    }
    asm
      la r0, ret
      mtctr r0
      bctrl
    end;
{$else}
    DoNothing := proc(@ret);
    DoNothing;
{$endif}
{$endif}
{$if defined(cpuaarch64)}
    ret := $d65f03c0;
    DoNothing := proc(@ret);
    DoNothing;
{$endif}
{$if defined(cpui386) or defined(cpux86_64)}
    ret := $C3;
    DoNothing := proc(@ret);
    DoNothing;
{$endif}
{$ifdef cpumips}
{$ifdef ENDIAN_BIG}
    ret[0]:=$03e00008;
{$else ENDIAN_BIG}
    ret[0]:=$0800e003;
{$endif ENDIAN_BIG}    
    ret[1]:=0;                   { delay slot }
    DoNothing:=proc(@ret);
    DoNothing;
{$endif cpumips}
{$ifdef cpum68k}
    ret:=$4E75;
    DoNothing:=proc(@ret);
    DoNothing;
{$endif cpum68k}

  end;
begin
  DoIt;
end.