The other little issue that came up was the following error message:
LLVM ERROR: Cannot encode high byte register in REX-prefixed instruction
Ripped down a module that was throwing the error and it reduced to the following
Please keep in mind, this is a judgement free zone, no comments about what the code is doing, I know its not
supported in any shape or form, but its what this system has used since 1985, (vax 11/730). Its just a reproducer.
Code: Select all
[PSECT (CODE_MENU),
INHERIT('SYS$LIBRARY:STARLET')]
Module menu( input, output );
type
$ubyte = [byte] 0..255 ;
$word = [word] -32768..32767 ;
$uword = [word] 0..65535 ;
$quad = [quad,unsafe] record l0: unsigned ; l1: integer;end;
uv_iosb_def = [byte(8), volatile] record
io_status : [pos(0*8)] $uword;
io_length : [pos(2*8)] $uword;
case integer of
0 : ( io_term : [pos(4*8)] $uword;
io_term_len : [pos(6*8)] $uword );
1 : ( reserved : [pos(4*8)] integer );
2 : ( buffer_address : [pos(4*8)] unsigned );
end;
%if ((%arch_name = "VAX") or
(%arch_name = "Alpha") or
(%arch_name = "IA64") or
(%arch_name = "x86_64"))
%then
(*
(* rlp 14-Nov-2023
(*
(* I really can't say where these definitions came from. But I picked them
(* up from somewhere back when we ported from VAX to Alpha. Some of them
(* came from the termio.mar code. I have to assume some of the rest was
(* gleamed from a source code listing or something that we had back
(* then. Maybe the Pascal Compiler listing spit out extra data on the
(* VAX code, who knows.
(*
(* They worked for the VAX, Alpha and I64, lets hope they work for x86
(*
(* Maybe John Reagan will feel bad for us and toss in a flush routine
(* into the Pascal Extended library routines that will flush out the
(* pascal buffer.
(*
(* Maybe something like changing put(<filename>) to flush out the buffer
(* instead of doing nothing. Oh, I have tried it and everything else, I can
(* think of to avoid this code.
(**)
type
$BOOL = [BIT(1),UNSAFE] BOOLEAN;
PFV$FIELDS = record case integer of
1 : (pfv$a_buffer : [pos( 0)] UNSIGNED;
pfv$b_version : [pos(32)] $UBYTE;
pfv$b_spare : [pos(40)] $UBYTE;
pfv$w_flags : [pos(48)] $UWORD;
pfv$a_pfd : [pos(64)] UNSIGNED;
pfv$a_fcb : [pos(96)] UNSIGNED );
2 : ( PFV$V_VALID : [pos(48)] $BOOL;
PFV$V_DFB : [pos(49)] $BOOL;
PFV$V_EOF_DEFINED : [pos(50)] $BOOL;
PFV$V_EOLN : [pos(51)] $BOOL;
PFV$V_BOUND : [pos(52)] $BOOL;
PFV$V_RELBUF : [pos(53)] $BOOL;
PFV$V_RELPFD : [pos(54)] $BOOL;
PFV$V_OPEN : [pos(55)] $BOOL;
PFV$V_FCB_VALID : [pos(56)] $BOOL;
PFV$V_LOCK : [pos(57)] $BOOL );
3 : ( pfv$L_STATUS : [pos(96)] unsigned );
end;
type
FCB$FCB_STRUCT_FIELDSET = record case integer of
1 : (
FCB$A_RECORD_BEG : unsigned; (* -24 *)
FCB$A_RECORD_CUR : unsigned; (* -20 *)
FCB$A_RECORD_END : unsigned; (* -16 *) );
end;
const
FCB$S_FCB_STRUCT = 56;
%endif
var
io_channel : [volatile] $uword;
(*
(* Routine used to initialize io_channel, needs to be called if you
(* really going to run this code.
(**)
[global]
procedure mu_tinit;
var
vms_status : integer;
begin
vms_status := $assign( 'SYS$INPUT', io_channel );
(*
(* whole bunch of code to determine the type of terminal and how to
(* init it which does not apply to the
(*
(* LLVM ERROR: Cannot encode high byte register in REX-prefixed instruction
(**)
if not odd(vms_status) then
writeln( '\MU_TINIT Failed\ ', vms_status:1);
end;
[global]
procedure mu_prmptrd_ast ( var pfv : text;
var outbuffer : varying [n] of char ;
var ast_iosb : [truncate] uv_iosb_def;
[unbound, asynchronous] procedure ast_completion;
timeout : integer := 0 ;
clear_type : boolean := false;
no_echo : boolean := false
);
(*
(* Perform a non blocking read with prompt from the terminal.
(* The supplied ast_completion routine will be evoked when the
(* $qio completes.
(**)
var
pfv_ptr : ^PFV$FIELDS;
fcb_ptr : ^FCB$FCB_STRUCT_FIELDSET;
len : integer;
vms_status : integer;
io_function : integer;
io_terms : $quad;
iosb : uv_iosb_def;
begin
outbuffer.length := 0;
pfv_ptr :: integer := iaddress( pfv );
fcb_ptr :: integer := pfv_ptr^.pfv$a_fcb - fcb$s_fcb_struct;
len := fcb_ptr^.fcb$a_record_cur - fcb_ptr^.fcb$a_record_beg;
fcb_ptr^.fcb$a_record_cur := fcb_ptr^.fcb$a_record_beg;
io_function := IO$_READPROMPT;
if timeout > 0 then
io_function := io_function + IO$M_TIMED;
if clear_type then
io_function := io_function + IO$M_PURGE;
if no_echo then
io_function := io_function + IO$M_NOECHO;
io_terms.l0 := 0;
io_terms.l1 := -1; (* all of the bits set, char 0 to 31 *)
vms_status := $qio( chan := io_channel,
func := io_function,
iosb := ast_iosb,
astadr := ast_completion,
p1 := outbuffer.body,
p2 := N,
p3 := timeout,
p4 := iaddress(io_terms),
p5 := fcb_ptr^.fcb$a_record_beg,
p6 := len );
if not odd(vms_status) then
writeln( '\MU_PRMPTRD_AST Failed\ ', vms_status:1);
end;
end.
{/code]