Translate and print the IEP (Instruction Execution Protection) flag for
Region-Third-Table entries and Segment-Table entries of Format
Control 1 and also for Page-Table entries. Display the flags in s390x 'vtop'
command output like shown below:

  STE: 0000000033be8ac0 => 0000000015803503 (flags = 03503)
       flags in binary : AV=0; ACC=0011; F=0; FC=1; P=0; IEP=1; I=0; CS=0; TT=0
or
  PTE: 00000000031c6fd8 => 000000000842e13d (flags = 13d)
       flags in binary : I=0; P=0; IEP=1

Suggested-by: Heiko Carstens <[email protected]>
Signed-off-by: Mikhail Zaslonko <[email protected]>
Reviewed-by: Heiko Carstens <[email protected]>
---
 s390x.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/s390x.c b/s390x.c
index 0e8e2b3..8c0bba4 100644
--- a/s390x.c
+++ b/s390x.c
@@ -29,6 +29,7 @@
 #define S390X_PTE_FLAG_BITS     0xfffULL /* Page table entry flag bits */
 #define S390X_PAGE_PRESENT      0x001ULL /* set: loaded in physical memory
                                           * clear: not loaded in physical mem 
*/
+#define S390X_PAGE_IEP          0x100ULL /* Instruction-execution protection  
*/
 #define S390X_PAGE_RO           0x200ULL /* HW read-only */
 #define S390X_PAGE_INVALID      0x400ULL /* HW invalid */
 #define S390X_PAGE_INVALID_MASK 0x601ULL /* for linux 2.6 */
@@ -65,6 +66,7 @@
 #define S390X_RTE_TF           0xc0ULL
 #define S390X_RTE_TF_10        0x80ULL
 #define S390X_RTE_TF_01        0x40ULL
+#define S390X_RTE_IEP          0x100ULL
 #define S390X_RTE_P            0x200ULL
 #define S390X_RTE_FC           0x400ULL
 #define S390X_RTE_F            0x800ULL
@@ -82,6 +84,7 @@
 #define S390X_STE_TT_01        0x4ULL
 #define S390X_STE_CS           0x10ULL
 #define S390X_STE_I            0x20ULL
+#define S390X_STE_IEP          0x100ULL
 #define S390X_STE_P            0x200ULL
 #define S390X_STE_FC           0x400ULL
 #define S390X_STE_F            0x800ULL
@@ -979,7 +982,7 @@ static inline int s390x_pte_present(unsigned long x){
 /* Print flags of Segment-Table entry with format control = 1 */
 static void print_segment_entry_fc1(ulong val)
 {
-       fprintf(fp, "AV=%u; ACC=%u%u%u%u; F=%u; FC=%u; P=%u; I=%u; CS=%u; 
TT=%u%u\n",
+       fprintf(fp, "AV=%u; ACC=%u%u%u%u; F=%u; FC=%u; P=%u; IEP=%u; I=%u; 
CS=%u; TT=%u%u\n",
                !!(val & S390X_STE_AV),
                !!(val & S390X_STE_ACC_1000),
                !!(val & S390X_STE_ACC_0100),
@@ -988,6 +991,7 @@ static void print_segment_entry_fc1(ulong val)
                !!(val & S390X_STE_F),
                !!(val & S390X_STE_FC),
                !!(val & S390X_STE_P),
+               !!(val & S390X_STE_IEP),
                !!(val & S390X_STE_I),
                !!(val & S390X_STE_CS),
                !!(val & S390X_STE_TT_10),
@@ -1009,7 +1013,7 @@ static void print_segment_entry_fc0(ulong val)
 /* Print flags of Region-Third-Table entry with format control = 1 */
 static void print_region_third_entry_fc1(ulong val)
 {
-       fprintf(fp, "AV=%u; ACC=%u%u%u%u; F=%u; FC=%u; P=%u; I=%u; CR=%u; 
TT=%u%u\n",
+       fprintf(fp, "AV=%u; ACC=%u%u%u%u; F=%u; FC=%u; P=%u; IEP=%u; I=%u; 
CR=%u; TT=%u%u\n",
                !!(val & S390X_RTE_AV),
                !!(val & S390X_RTE_ACC_1000),
                !!(val & S390X_RTE_ACC_0100),
@@ -1018,6 +1022,7 @@ static void print_region_third_entry_fc1(ulong val)
                !!(val & S390X_RTE_F),
                !!(val & S390X_RTE_FC),
                !!(val & S390X_RTE_P),
+               !!(val & S390X_RTE_IEP),
                !!(val & S390X_RTE_I),
                !!(val & S390X_RTE_CR),
                !!(val & S390X_RTE_TT_10),
@@ -1151,8 +1156,10 @@ static ulong _kl_pg_table_deref_s390x(ulong vaddr, ulong 
table, int verbose)
        if (verbose) {
                fprintf(fp, "%5s: %016lx => %016lx (flags = %03llx)\n",
                        "PTE", addr, entry, entry & S390X_PTE_FLAG_BITS);
-               fprintf(fp, "       flags in binary : I=%u; P=%u\n",
-                       !!(entry & S390X_PAGE_INVALID), !!(entry & 
S390X_PAGE_RO));
+               fprintf(fp, "       flags in binary : I=%u; P=%u; IEP=%u\n",
+                       !!(entry & S390X_PAGE_INVALID),
+                       !!(entry & S390X_PAGE_RO),
+                       !!(entry & S390X_PAGE_IEP));
                fprintf(fp, "%5s: %016llx\n", "PAGE", entry & 
~S390X_PTE_FLAG_BITS);
        }
        /*
-- 
2.49.0
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to