Sure. For this file:
Code: Select all
.title 'IFC$RTL_MACRO - IFC Run-Time System code in MACRO-32'
.ident 'X01.00-00'
;
; Edit History:
; 13-Sep-2009 TES Converted the MACRO-32 module to BLISS.
; 04-Nov-2023 JEH Converted the BLISS module back to MACRO-32.
;
.EXTERNAL IFC$MESSAGE_LIST, IFC$MESSAGE_INDENT_LIST
.PSECT CODE,NOWRT,SHR,PIC,EXE,RD
IFC$MESSAGE:: .CALL_ENTRY PRESERVE=<>,MAX_ARGS=10,HOME_ARGS=TRUE,output=<r0>
PUSHL AP
CALLS #1,G^IFC$MESSAGE_LIST
RET
IFC$MESSAGE_INDENT:: .CALL_ENTRY PRESERVE=<>,MAX_ARGS=10,HOME_ARGS=TRUE,output=<r0>
PUSHL AP
CALLS #1,G^IFC$MESSAGE_INDENT_LIST
RET
.END
"ana/obj/disass" gives:
Code: Select all
Analyze/Disassemble Object File 5-NOV-2023 10:02:00.51
Page 1
DKA100:[home.jhamby.Projects.vms-halls-of-zk.x86_64.OBJ]IFC$RTL_MACRO.OBJ;1
ANALYZ X01-86
.MAIN. Machine Code Listing 5-NOV-2023 09:48 XMAC X6.0-111
X01.00-00
.section CODE, "ax", "progbits" # EXE,SHR
.align 16
Section size 285 bytes
.cfi_startproc
IFC$MESSAGE::
55 00000000: pushq %rbp
# 000013
E5 89 48 00000001: movq %rsp,%rbp
53 00000004: pushq %rbx
57 41 00000005: pushq %r15
56 41 00000007: pushq %r14
55 41 00000009: pushq %r13
DC B6 0F 0000000B: movzbl %ah,%ebx
00 00 00 00 E8 0000000E: callq LIB$ALPHA_REG_VECTOR_BASE@PLT
93 48 00000013: xchgq %rax,%rbx
54 41 00000015: pushq %r12
C8 C4 83 48 00000017: addq $-38,%rsp
18 24 4C 89 44 0000001B: movl %r9d,18(%rsp)
14 24 44 89 44 00000020: movl %r8d,14(%rsp)
10 24 4C 89 00000025: movl %ecx,10(%rsp)
0C 24 54 89 00000029: movl %edx,0C(%rsp)
08 24 74 89 0000002D: movl %esi,08(%rsp)
04 24 7C 89 00000031: movl %edi,04(%rsp)
24 04 89 00000035: movl %eax,(%rsp)
28 45 8B 00000038: movl 28(%rbp),%eax
28 24 44 89 0000003B: movl %eax,28(%rsp)
20 45 8B 0000003F: movl 20(%rbp),%eax
24 24 44 89 00000042: movl %eax,24(%rsp)
18 45 8B 00000046: movl 18(%rbp),%eax
20 24 44 89 00000049: movl %eax,20(%rsp)
10 45 8B 0000004D: movl 10(%rbp),%eax
1C 24 44 89 00000050: movl %eax,1C(%rsp)
E4 89 49 00000054: movq %rsp,%r12
_$$L1:
E2 89 4D 00000057: movq %r12,%r10
# 000066
52 41 0000005A: pushq %r10
5F 0000005C: popq %rdi
# 000067
00 00 01 00 C0 C7 48 0000005D: movq $00000100,%rax
00 00 00 00 E8 00000064: callq IFC$MESSAGE_LIST@PLT
03 89 48 00000069: movq %rax,(%rbx)
08 53 89 48 0000006C: movq %rdx,08(%rbx)
_$$_0:
D8 65 8D 48 00000070: leaq -28(%rbp),%rsp
# 000068
FE 00 00 00 F0 A3 80 00000074: andb $-02,000000F0(%rbx)
03 8B 48 0000007B: movq (%rbx),%rax
08 53 8B 48 0000007E: movq 08(%rbx),%rdx
5C 41 00000082: popq %r12
5D 41 00000084: popq %r13
5E 41 00000086: popq %r14
5F 41 00000088: popq %r15
5B 0000008A: popq %rbx
Analyze/Disassemble Object File 5-NOV-2023 10:02:00.52
Page 2
DKA100:[home.jhamby.Projects.vms-halls-of-zk.x86_64.OBJ]IFC$RTL_MACRO.OBJ;1
ANALYZ X01-86
5D 0000008B: popq %rbp
C3 0000008C: retq
.cfi_endproc
_$$_3:
90 90 90 0000008D: .byte 0x90,0x90,0x90
IFC$MESSAGE_INDENT::
55 00000090: pushq %rbp
# 000070
E5 89 48 00000091: movq %rsp,%rbp
53 00000094: pushq %rbx
57 41 00000095: pushq %r15
56 41 00000097: pushq %r14
55 41 00000099: pushq %r13
DC B6 0F 0000009B: movzbl %ah,%ebx
00 00 00 00 E8 0000009E: callq LIB$ALPHA_REG_VECTOR_BASE@PLT
93 48 000000A3: xchgq %rax,%rbx
54 41 000000A5: pushq %r12
C8 C4 83 48 000000A7: addq $-38,%rsp
18 24 4C 89 44 000000AB: movl %r9d,18(%rsp)
14 24 44 89 44 000000B0: movl %r8d,14(%rsp)
10 24 4C 89 000000B5: movl %ecx,10(%rsp)
0C 24 54 89 000000B9: movl %edx,0C(%rsp)
08 24 74 89 000000BD: movl %esi,08(%rsp)
04 24 7C 89 000000C1: movl %edi,04(%rsp)
24 04 89 000000C5: movl %eax,(%rsp)
28 45 8B 000000C8: movl 28(%rbp),%eax
28 24 44 89 000000CB: movl %eax,28(%rsp)
20 45 8B 000000CF: movl 20(%rbp),%eax
24 24 44 89 000000D2: movl %eax,24(%rsp)
18 45 8B 000000D6: movl 18(%rbp),%eax
20 24 44 89 000000D9: movl %eax,20(%rsp)
10 45 8B 000000DD: movl 10(%rbp),%eax
1C 24 44 89 000000E0: movl %eax,1C(%rsp)
E4 89 49 000000E4: movq %rsp,%r12
_$$L3:
E2 89 4D 000000E7: movq %r12,%r10
# 000071
52 41 000000EA: pushq %r10
5F 000000EC: popq %rdi
# 000072
00 00 01 00 C0 C7 48 000000ED: movq $00000100,%rax
00 00 00 00 E8 000000F4: callq IFC$MESSAGE_INDENT_LIST@PLT
03 89 48 000000F9: movq %rax,(%rbx)
08 53 89 48 000000FC: movq %rdx,08(%rbx)
_$$_1:
D8 65 8D 48 00000100: leaq -28(%rbp),%rsp
# 000073
FE 00 00 00 F0 A3 80 00000104: andb $-02,000000F0(%rbx)
03 8B 48 0000010B: movq (%rbx),%rax
08 53 8B 48 0000010E: movq 08(%rbx),%rdx
5C 41 00000112: popq %r12
5D 41 00000114: popq %r13
5E 41 00000116: popq %r14
5F 41 00000118: popq %r15
5B 0000011A: popq %rbx
5D 0000011B: popq %rbp
C3 0000011C: retq
_$$_5:
The generated boilerplate code looks good to me, but there's only one set of .cfi_startproc / .cfi_endproc lines.
Added in 7 minutes 35 seconds:
This morning I figured out why the game code to print the description of signs, or any message containing a blank line, was failing. I found a VSI Pascal optimizer bug that gives bad behavior when some arguments aren't present. Here's a test case containing a similar function to the one that's behaving badly for me:
Code: Select all
(* Test argument passing with default params *)
program TestArgs(output);
[global] function put_scroll_dx(
column_number : [truncate] integer;
str : [truncate] string;
new_attributes : [truncate] unsigned) : unsigned;
begin
writeln('In put_scroll_dx:');
if (present(new_attributes)) then
begin
write('new_attributes: ');
write(new_attributes);
writeln;
end;
if (present(column_number)) then
begin
write('column_number: ');
write(column_number);
writeln;
end;
if (present(str)) then
begin
write('string: ');
write(str);
writeln;
end;
put_scroll_dx := 1;
end;
begin
writeln('Hello, world!');
put_scroll_dx(1, 'test', 3);
put_scroll_dx(1);
put_scroll_dx(2, 'foo');
put_scroll_dx;
end.
The code that's failing is calling "put_scroll_dx" with no parameters. It should print:
Code: Select all
Hello, world!
In put_scroll_dx:
new_attributes: 3
column_number: 1
string: test
In put_scroll_dx:
column_number: 1
In put_scroll_dx:
column_number: 2
string: foo
In put_scroll_dx:
When I build with /NoOpt, it works fine. When I build with the default optimization, it crashes:
Code: Select all
Hello, world!
In put_scroll_dx:
new_attributes: 3
column_number: 1
string: test
%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=0000000000000000, PC=00000000800001DC, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
image module routine line rel PC abs PC
testargs testargs.pas;4 PUT_SCROLL_DX
5 00000000000001DC 00000000800001DC
testargs testargs.pas;4 TESTARGS 35 00000000000000B2 00000000800000B2
0 FFFF8300081FC0A6 FFFF8300081FC0A6
DCL 0 000000008006778B 000000007ADEB78B
%TRACE-I-END, end of TRACE stack dump
It looks like I'll have to modify the Pascal code to work around this bug for now, since I'd prefer not to disable optimization if I can avoid it.