.byte 0x83, 0x12, 0x00, 0x08

== diag 1,2,8 (CP command)

You can either load r1/r2 in the _asm_ section or tell gcc to bind the 
variables to the registers.

Remember, though, that diag is a privileged instruction and won't work in a 
userland program.

In what particular diag are you interested?


-------- Original message --------
From: Donald Russell <[email protected]>
Date: 11/10/18 06:00 (GMT-05:00)
To: [email protected]
Subject: [LINUX-390] Using diagnose instruction from C on RHEL 7

Hello,

I want to write a program in C and use a diagnose instruction.

I thought I could do

__asm___( “ diag ... “ ...);

but that fails because diag is not a real instruction mnemonic.  When I use
gcc to compile and link I get an error:

Program.c(.text+0x578): undefined reference to ‘x480a032’
collect2: error: ld returned 1 exit status

I thought I could code dc x’8312....’ and force the use of registers 1 and
2 but it complains that dc is not valid. (The doc says instructions
including directives are ok.  But obviously not dc directives. :-)  I also
tried upper case just to be thorough)

How can I coerce C into generating a diagnose instruction?

Thanks,
Don

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to