?? RIGHT := 110 ??                                                                                            
?? NEWTITLE := 'NOS/VE Dump Analyzer : Display Memory Command' ??                                             
MODULE dum$display_memory_command;                                                                            
                                                                                                              
{ PURPOSE:                                                                                                    
{   This module contains the code for the display_memory command.                                             
                                                                                                              
?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??                                      
?? PUSH (LISTEXT := ON) ??                                                                                    
*copyc cle$ecc_parsing                                                                                        
*copyc duc$dump_analyzer_constants                                                                            
*copyc due$exception_condition_codes                                                                          
?? POP ??                                                                                                     
*copyc clp$close_display                                                                                      
*copyc clp$open_display_reference                                                                             
*copyc clp$put_display                                                                                        
*copyc dup$access_real_memory                                                                                 
*copyc dup$copy_virtual_memory_pva                                                                            
*copyc dup$copy_virtual_memory_sva                                                                            
*copyc dup$display_data                                                                                       
*copyc dup$display_message                                                                                    
*copyc dup$evaluate_parameters                                                                                
*copyc dup$new_page_procedure                                                                                 
*copyc dup$retrieve_exchange_package                                                                          
*copyc osp$append_status_integer                                                                              
*copyc osp$append_status_parameter                                                                            
*copyc osp$disestablish_cond_handler                                                                          
*copyc osp$establish_block_exit_hndlr                                                                         
*copyc osp$set_status_abnormal                                                                                
?? EJECT ??                                                                                                   
*copyc duv$dump_environment_p                                                                                 
*copyc duv$execution_environment                                                                              
*copyc duv$title_data                                                                                         
?? OLDTITLE ??                                                                                                
?? NEWTITLE := 'dup$display_memory_command', EJECT ??                                                         
                                                                                                              
{ PURPOSE:                                                                                                    
{   This procedure displays memory from the restart file.                                                     
                                                                                                              
  PROCEDURE [XDCL] dup$display_memory_command                                                                 
    (    parameter_list: clt$parameter_list;                                                                  
     VAR status: ost$status);                                                                                 
                                                                                                              
{ PROCEDURE display_memory, dism (                                                                            
{   address, a: integer = $required                                                                           
{   bytes, b: integer 0..duc$maximum_memory_display = 8                                                       
{   exchange, e: any of                                                                                       
{       key                                                                                                   
{         (active a) (monitor m) (job j)                                                                      
{       keyend                                                                                                
{       integer 0..0ffffffff(16)                                                                              
{     anyend = 0ffffffff(16)                                                                                  
{   processor, p: integer 0..3 = 0                                                                            
{   address_mode, am: key                                                                                     
{       (process_virtual_address pva) (system_virtual_address sva) (real_memory_address rma)                  
{     keyend = process_virtual_address                                                                        
{   display_option, do: list 1..2 of key                                                                      
{        (numeric n) (ascii a) (display_code dc)                                                              
{     keyend = (numeric ascii)                                                                                
{   title, t: string 1..31 = 'display_memory'                                                                 
{   radix, r: integer 8..16 = 16                                                                              
{   repeat_count, rc: integer = 0                                                                             
{   output, o: file                                                                                           
{   status)                                                                                                   
                                                                                                              
?? PUSH (LISTEXT := ON) ??                                                                                    
?? FMT (FORMAT := OFF) ??                                                                                     
  VAR                                                                                                         
    pdt: [STATIC, READ, cls$declaration_section] record                                                       
      header: clt$pdt_header,                                                                                 
      names: array [1 .. 21] of clt$pdt_parameter_name,                                                       
      parameters: array [1 .. 11] of clt$pdt_parameter,                                                       
      type1: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$integer_type_qualifier,                                                                
      recend,                                                                                                 
      type2: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$integer_type_qualifier,                                                                
        default_value: string (1),                                                                            
      recend,                                                                                                 
      type3: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$union_type_qualifier,                                                                  
        type_size_1: clt$type_specification_size,                                                             
        element_type_spec_1: record                                                                           
          header: clt$type_specification_header,                                                              
          qualifier: clt$keyword_type_qualifier,                                                              
          keyword_specs: array [1 .. 6] of clt$keyword_specification,                                         
        recend,                                                                                               
        type_size_2: clt$type_specification_size,                                                             
        element_type_spec_2: record                                                                           
          header: clt$type_specification_header,                                                              
          qualifier: clt$integer_type_qualifier,                                                              
        recend,                                                                                               
        default_value: string (13),                                                                           
      recend,                                                                                                 
      type4: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$integer_type_qualifier,                                                                
        default_value: string (1),                                                                            
      recend,                                                                                                 
      type5: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$keyword_type_qualifier,                                                                
        keyword_specs: array [1 .. 6] of clt$keyword_specification,                                           
        default_value: string (23),                                                                           
      recend,                                                                                                 
      type6: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$list_type_qualifier_v2,                                                                
        element_type_spec: record                                                                             
          header: clt$type_specification_header,                                                              
          qualifier: clt$keyword_type_qualifier,                                                              
          keyword_specs: array [1 .. 6] of clt$keyword_specification,                                         
        recend,                                                                                               
        default_value: string (15),                                                                           
      recend,                                                                                                 
      type7: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$string_type_qualifier,                                                                 
        default_value: string (16),                                                                           
      recend,                                                                                                 
      type8: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$integer_type_qualifier,                                                                
        default_value: string (2),                                                                            
      recend,                                                                                                 
      type9: record                                                                                           
        header: clt$type_specification_header,                                                                
        qualifier: clt$integer_type_qualifier,                                                                
        default_value: string (1),                                                                            
      recend,                                                                                                 
      type10: record                                                                                          
        header: clt$type_specification_header,                                                                
      recend,                                                                                                 
      type11: record                                                                                          
        header: clt$type_specification_header,                                                                
      recend,                                                                                                 
    recend := [                                                                                               
    [1,                                                                                                       
    [92, 1, 22, 11, 37, 20, 951],                                                                             
    clc$command, 21, 11, 1, 0, 0, 0, 11, ''], [                                                               
    ['A                              ',clc$abbreviation_entry, 1],                                            
    ['ADDRESS                        ',clc$nominal_entry, 1],                                                 
    ['ADDRESS_MODE                   ',clc$nominal_entry, 5],                                                 
    ['AM                             ',clc$abbreviation_entry, 5],                                            
    ['B                              ',clc$abbreviation_entry, 2],                                            
    ['BYTES                          ',clc$nominal_entry, 2],                                                 
    ['DISPLAY_OPTION                 ',clc$nominal_entry, 6],                                                 
    ['DO                             ',clc$abbreviation_entry, 6],                                            
    ['E                              ',clc$abbreviation_entry, 3],                                            
    ['EXCHANGE                       ',clc$nominal_entry, 3],                                                 
    ['O                              ',clc$abbreviation_entry, 10],                                           
    ['OUTPUT                         ',clc$nominal_entry, 10],                                                
    ['P                              ',clc$abbreviation_entry, 4],                                            
    ['PROCESSOR                      ',clc$nominal_entry, 4],                                                 
    ['R                              ',clc$abbreviation_entry, 8],                                            
    ['RADIX                          ',clc$nominal_entry, 8],                                                 
    ['RC                             ',clc$abbreviation_entry, 9],                                            
    ['REPEAT_COUNT                   ',clc$nominal_entry, 9],                                                 
    ['STATUS                         ',clc$nominal_entry, 11],                                                
    ['T                              ',clc$abbreviation_entry, 7],                                            
    ['TITLE                          ',clc$nominal_entry, 7]],                                                
    [                                                                                                         
{ PARAMETER 1                                                                                                 
    [2, clc$normal_usage_entry, clc$non_secure_parameter,                                                     
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$required_parameter, 
  0, 0],                                                                                                      
{ PARAMETER 2                                                                                                 
    [6, clc$normal_usage_entry, clc$non_secure_parameter,                                                     
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20,                         
  clc$optional_default_parameter, 0, 1],                                                                      
{ PARAMETER 3                                                                                                 
    [10, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 269,                        
  clc$optional_default_parameter, 0, 13],                                                                     
{ PARAMETER 4                                                                                                 
    [14, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20,                         
  clc$optional_default_parameter, 0, 1],                                                                      
{ PARAMETER 5                                                                                                 
    [3, clc$normal_usage_entry, clc$non_secure_parameter,                                                     
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 229,                        
  clc$optional_default_parameter, 0, 23],                                                                     
{ PARAMETER 6                                                                                                 
    [7, clc$normal_usage_entry, clc$non_secure_parameter,                                                     
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 245,                        
  clc$optional_default_parameter, 0, 15],                                                                     
{ PARAMETER 7                                                                                                 
    [21, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 8,                          
  clc$optional_default_parameter, 0, 16],                                                                     
{ PARAMETER 8                                                                                                 
    [16, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20,                         
  clc$optional_default_parameter, 0, 2],                                                                      
{ PARAMETER 9                                                                                                 
    [18, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20,                         
  clc$optional_default_parameter, 0, 1],                                                                      
{ PARAMETER 10                                                                                                
    [12, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],                               
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$optional_parameter, 0
  , 0],                                                                                                       
{ PARAMETER 11                                                                                                
    [19, clc$normal_usage_entry, clc$non_secure_parameter,                                                    
    $clt$parameter_spec_methods[clc$specify_by_name],                                                         
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,                      
  clc$optional_parameter, 0, 0]],                                                                             
{ PARAMETER 1                                                                                                 
    [[1, 0, clc$integer_type], [clc$min_integer, clc$max_integer, 10]],                                       
{ PARAMETER 2                                                                                                 
    [[1, 0, clc$integer_type], [0, duc$maximum_memory_display, 10],                                           
    '8'],                                                                                                     
{ PARAMETER 3                                                                                                 
    [[1, 0, clc$union_type], [[clc$integer_type, clc$keyword_type],                                           
    FALSE, 2],                                                                                                
    229, [[1, 0, clc$keyword_type], [6], [                                                                    
      ['A                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],                 
      ['ACTIVE                         ', clc$nominal_entry, clc$normal_usage_entry, 1],                      
      ['J                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],                 
      ['JOB                            ', clc$nominal_entry, clc$normal_usage_entry, 3],                      
      ['M                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],                 
      ['MONITOR                        ', clc$nominal_entry, clc$normal_usage_entry, 2]]                      
      ],                                                                                                      
    20, [[1, 0, clc$integer_type], [0, 0ffffffff(16), 10]]                                                    
    ,                                                                                                         
    '0ffffffff(16)'],                                                                                         
{ PARAMETER 4                                                                                                 
    [[1, 0, clc$integer_type], [0, 3, 10],                                                                    
    '0'],                                                                                                     
{ PARAMETER 5                                                                                                 
    [[1, 0, clc$keyword_type], [6], [                                                                         
    ['PROCESS_VIRTUAL_ADDRESS        ', clc$nominal_entry, clc$normal_usage_entry, 1],                        
    ['PVA                            ', clc$abbreviation_entry, clc$normal_usage_entry, 1],                   
    ['REAL_MEMORY_ADDRESS            ', clc$nominal_entry, clc$normal_usage_entry, 3],                        
    ['RMA                            ', clc$abbreviation_entry, clc$normal_usage_entry, 3],                   
    ['SVA                            ', clc$abbreviation_entry, clc$normal_usage_entry, 2],                   
    ['SYSTEM_VIRTUAL_ADDRESS         ', clc$nominal_entry, clc$normal_usage_entry, 2]]                        
    ,                                                                                                         
    'process_virtual_address'],                                                                               
{ PARAMETER 6                                                                                                 
    [[1, 0, clc$list_type], [229, 1, 2, 0, FALSE, FALSE],                                                     
      [[1, 0, clc$keyword_type], [6], [                                                                       
      ['A                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],                 
      ['ASCII                          ', clc$nominal_entry, clc$normal_usage_entry, 2],                      
      ['DC                             ', clc$abbreviation_entry, clc$normal_usage_entry, 3],                 
      ['DISPLAY_CODE                   ', clc$nominal_entry, clc$normal_usage_entry, 3],                      
      ['N                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],                 
      ['NUMERIC                        ', clc$nominal_entry, clc$normal_usage_entry, 1]]                      
      ]                                                                                                       
    ,                                                                                                         
    '(numeric ascii)'],                                                                                       
{ PARAMETER 7                                                                                                 
    [[1, 0, clc$string_type], [1, 31, FALSE],                                                                 
    '''display_memory'''],                                                                                    
{ PARAMETER 8                                                                                                 
    [[1, 0, clc$integer_type], [8, 16, 10],                                                                   
    '16'],                                                                                                    
{ PARAMETER 9                                                                                                 
    [[1, 0, clc$integer_type], [clc$min_integer, clc$max_integer, 10],                                        
    '0'],                                                                                                     
{ PARAMETER 10                                                                                                
    [[1, 0, clc$file_type]],                                                                                  
{ PARAMETER 11                                                                                                
    [[1, 0, clc$status_type]]];                                                                               
?? FMT (FORMAT := ON) ??                                                                                      
?? POP ??                                                                                                     
                                                                                                              
    CONST                                                                                                     
      p$address = 1,                                                                                          
      p$bytes = 2,                                                                                            
      p$exchange = 3,                                                                                         
      p$processor = 4,                                                                                        
      p$address_mode = 5,                                                                                     
      p$display_option = 6,                                                                                   
      p$title = 7,                                                                                            
      p$radix = 8,                                                                                            
      p$repeat_count = 9,                                                                                     
      p$output = 10,                                                                                          
      p$status = 11;                                                                                          
                                                                                                              
    VAR                                                                                                       
      pvt: array [1 .. 11] of clt$parameter_value;                                                            
                                                                                                              
    CONST                                                                                                     
      c$partial_count = 10000(16);                                                                            
                                                                                                              
    VAR                                                                                                       
      access_data: dut$access_data,                                                                           
      address: dut$ee_address_parameter,                                                                      
      bytes: ost$segment_length,                                                                              
      bytes_allowed: 0 .. c$partial_count,                                                                    
      bytes_pushed: 0 .. c$partial_count,                                                                     
      bytes_returned: ost$segment_length,                                                                     
      default_list: ARRAY [1 .. 3] OF dut$default_change_list_entry,                                          
      display_control: clt$display_control,                                                                   
      display_count: integer,                                                                                 
      display_string: string (osc$max_string_size),                                                           
      end_of_input_file: boolean,                                                                             
      exchange_package_p: ^dut$exchange_package,                                                              
      ignore_status: ost$status,                                                                              
      invalid_segment_issued: boolean,                                                                        
      local_status: ost$status,                                                                               
      memory_buffer_p: ^SEQ ( * ),                                                                            
      new_byte_size: ost$segment_length,                                                                      
      output_display_opened: boolean,                                                                         
      page_fault_encountered: boolean,                                                                        
      real_memory_p: ^cell,                                                                                   
      repeat_index: integer,                                                                                  
      ring_attributes: amt$ring_attributes,                                                                   
      skip_start: ost$segment_offset,                                                                         
      skipping_page_faulted_memory: boolean,                                                                  
      some_memory_copied: boolean,                                                                            
      string_length: integer;                                                                                 
                                                                                                              
*copy dup$abort_handler                                                                                       
?? NEWTITLE := 'clean_up', EJECT ??                                                                           
                                                                                                              
{ PURPOSE:                                                                                                    
{   This procedure is called from the abort handler to close the file.                                        
                                                                                                              
    PROCEDURE [INLINE] clean_up;                                                                              
                                                                                                              
      VAR                                                                                                     
        ignore_status: ost$status;                                                                            
                                                                                                              
      IF output_display_opened THEN                                                                           
        clp$close_display (display_control, ignore_status);                                                   
      IFEND;                                                                                                  
                                                                                                              
    PROCEND clean_up;                                                                                         
?? OLDTITLE, EJECT ??                                                                                         
                                                                                                              
    status.normal := TRUE;                                                                                    
                                                                                                              
    { Change the default value for the EXCHANGE, PROCESSOR and ADDRESS_MODE parameters.                       
                                                                                                              
    default_list [1].default_name := duc$dp_exchange;                                                         
    default_list [1].number := p$exchange;                                                                    
    default_list [2].default_name := duc$dp_processor;                                                        
    default_list [2].number := p$processor;                                                                   
    default_list [3].default_name := duc$dp_address_mode;                                                     
    default_list [3].number := p$address_mode;                                                                
    dup$evaluate_parameters (parameter_list, default_list, #SEQ (pdt), ^pvt, status);                         
    IF NOT status.normal THEN                                                                                 
      RETURN;  {---->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF duv$dump_environment_p = NIL THEN                                                                      
      osp$set_status_abnormal (duc$dump_analyzer_id, due$no_restart_file, '', status);                        
      RETURN;  {---->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    IF (duv$execution_environment.processing_options = duc$ee_po_no_memory) OR                                
          (NOT duv$dump_environment_p^.central_memory.available AND                                           
          NOT duv$dump_environment_p^.critical_memory.available) THEN                                         
      osp$set_status_abnormal (duc$dump_analyzer_id, due$data_not_on_dump, 'The central memory is', status);  
      RETURN;  {---->                                                                                         
    IFEND;                                                                                                    
    IF pvt [p$bytes].value^.integer_value.value = 0 THEN                                                      
      RETURN;  {---->                                                                                         
    IFEND;                                                                                                    
                                                                                                              
    { Retrieve the exchange package if needed.                                                                
                                                                                                              
    IF (pvt [p$address_mode].value^.keyword_value <> 'PROCESS_VIRTUAL_ADDRESS') AND                           
          pvt [p$exchange].specified THEN                                                                     
      osp$set_status_abnormal (duc$dump_analyzer_id, due$rma_and_exc_specified, '', status);                  
      RETURN;  {---->                                                                                         
    IFEND;                                                                                                    
    IF pvt [p$address_mode].value^.keyword_value = 'PROCESS_VIRTUAL_ADDRESS' THEN                             
      dup$retrieve_exchange_package (pvt [p$processor].value^.integer_value.value, pvt [p$exchange].value^,   
            exchange_package_p, status);                                                                      
      IF NOT status.normal THEN                                                                               
        RETURN;  {---->                                                                                       
      IFEND;                                                                                                  
    IFEND;                                                                                                    
                                                                                                              
    output_display_opened := FALSE;                                                                           
    osp$establish_block_exit_hndlr (^abort_handler);                                                          
                                                                                                              
   /display_opened/                                                                                           
    BEGIN                                                                                                     
                                                                                                              
      { Prepare the output display file.                                                                      
                                                                                                              
      IF pvt [p$output].specified THEN                                                                        
        ring_attributes.r1 := #RING (^ring_attributes);                                                       
        ring_attributes.r2 := #RING (^ring_attributes);                                                       
        ring_attributes.r3 := #RING (^ring_attributes);                                                       
        clp$open_display_reference (pvt [p$output].value^.file_value^, ^dup$new_page_procedure, fsc$list,     
              ring_attributes, display_control, status);                                                      
        IF NOT status.normal THEN                                                                             
          EXIT /display_opened/;  {---->                                                                      
        IFEND;                                                                                                
        output_display_opened := TRUE;                                                                        
      ELSE                                                                                                    
        display_control := duv$execution_environment.output_file.display_control;                             
        display_control.line_number := display_control.page_length + 1;                                       
      IFEND;                                                                                                  
                                                                                                              
      duv$title_data.build_title := TRUE;                                                                     
      duv$title_data.command_name := pvt [p$title].value^.string_value^;                                      
                                                                                                              
      address.rma_part := pvt [p$address].value^.integer_value.value;                                         
      bytes := pvt [p$bytes].value^.integer_value.value;                                                      
                                                                                                              
      { Determine the number of bytes to display.  If radix <> 16 then round the number of bytes up to a full 
      { word and start displaying the data on a word boundary.                                                
                                                                                                              
      IF pvt [p$radix].value^.integer_value.value <> 16 THEN                                                  
        IF (bytes MOD 8) <> 0 THEN                                                                            
          bytes := bytes + (8 - (bytes MOD 8));                                                               
        IFEND;                                                                                                
        address.rma_part := address.rma_part - (address.rma_part MOD 8);                                      
      IFEND;                                                                                                  
                                                                                                              
      IF pvt [p$address_mode].value^.keyword_value = 'PROCESS_VIRTUAL_ADDRESS' THEN                           
        STRINGREP (display_string, string_length, 'segment =', address.pva_part.seg: #(16));                  
        clp$put_display (display_control, display_string (1, string_length), clc$no_trim, status);            
      IFEND;                                                                                                  
      memory_buffer_p := NIL;                                                                                 
                                                                                                              
      FOR repeat_index := 0 to pvt [p$repeat_count].value^.integer_value.value DO                             
                                                                                                              
        IF (pvt [p$address_mode].value^.keyword_value = 'PROCESS_VIRTUAL_ADDRESS') OR                         
              (pvt [p$address_mode].value^.keyword_value = 'SYSTEM_VIRTUAL_ADDRESS') THEN                     
          IF memory_buffer_p = NIL THEN                                                                       
            IF bytes > c$partial_count THEN                                                                   
              bytes_pushed := c$partial_count;                                                                
            ELSE                                                                                              
              bytes_pushed := bytes;                                                                          
            IFEND;                                                                                            
            PUSH memory_buffer_p: [[REP bytes_pushed OF cell]];                                               
            IF memory_buffer_p = NIL THEN                                                                     
              osp$set_status_abnormal (duc$dump_analyzer_id, due$nil_pointer, '', status);                    
              EXIT /display_opened/;  {---->                                                                  
            IFEND;                                                                                            
          IFEND;                                                                                              
                                                                                                              
          display_count := bytes;                                                                             
          page_fault_encountered := FALSE;                                                                    
          skipping_page_faulted_memory := FALSE;                                                              
          some_memory_copied := FALSE;                                                                        
          invalid_segment_issued := FALSE;                                                                    
                                                                                                              
          REPEAT                                                                                              
            RESET memory_buffer_p;                                                                            
            IF display_count >= bytes_pushed THEN                                                             
              bytes_allowed := bytes_pushed;                                                                  
            ELSE                                                                                              
              bytes_allowed := display_count;                                                                 
            IFEND;                                                                                            
            IF pvt [p$address_mode].value^.keyword_value = 'PROCESS_VIRTUAL_ADDRESS' THEN                     
              dup$copy_virtual_memory_pva (address.pva_part, exchange_package_p^,                             
                    pvt [p$processor].value^.integer_value.value, bytes_allowed, FALSE, bytes_returned,       
                    memory_buffer_p, access_data, status);                                                    
            ELSE                                                                                              
              dup$copy_virtual_memory_sva (address.sva_part, pvt [p$processor].value^.integer_value.value,    
                    bytes_allowed, FALSE, bytes_returned, memory_buffer_p, access_data, status);              
            IFEND;                                                                                            
            IF NOT status.normal AND (status.condition <> due$memory_partially_avail) THEN                    
              EXIT /display_opened/;  {---->                                                                  
            IFEND;                                                                                            
                                                                                                              
            page_fault_encountered := (access_data.page_fault AND NOT access_data.memory_found);              
                                                                                                              
            IF NOT access_data.valid_segment AND NOT invalid_segment_issued THEN                              
              invalid_segment_issued := TRUE;                                                                 
              osp$set_status_abnormal (duc$dump_analyzer_id, due$invalid_seg_trans_poss, '', local_status);   
              dup$display_message (local_status, display_control);                                            
            IFEND;                                                                                            
                                                                                                              
            IF access_data.page_fault AND access_data.memory_found THEN                                       
              osp$set_status_abnormal (duc$dump_analyzer_id, due$soft_page_fault, '', local_status);          
              IF pvt [p$address_mode].value^.keyword_value = 'PROCESS_VIRTUAL_ADDRESS' THEN                   
                osp$append_status_parameter (osc$status_parameter_delimiter, ', segment = ', local_status);   
                osp$append_status_integer (osc$status_parameter_delimiter, address.pva_part.seg, 16, TRUE,    
                      local_status);                                                                          
              ELSE                                                                                            
                osp$append_status_parameter (osc$status_parameter_delimiter, ', asid = ', local_status);      
                osp$append_status_integer (osc$status_parameter_delimiter, address.sva_part.asid.value, 16,   
                      TRUE, local_status);                                                                    
              IFEND;                                                                                          
              osp$append_status_parameter (osc$status_parameter_delimiter, ', offset = ', local_status);      
              osp$append_status_integer (osc$status_parameter_delimiter, access_data.page_fault_offset,       
                    16, TRUE, local_status);                                                                  
              dup$display_message (local_status, display_control);                                            
            IFEND;                                                                                            
                                                                                                              
            IF bytes_returned > 0 THEN                                                                        
              some_memory_copied := TRUE;                                                                     
              IF skipping_page_faulted_memory THEN                                                            
                skipping_page_faulted_memory := FALSE;                                                        
                osp$set_status_abnormal (duc$dump_analyzer_id, due$pages_skipped, '', local_status);          
                osp$append_status_integer (osc$status_parameter_delimiter, skip_start, 16, TRUE,              
                      local_status);                                                                          
                osp$append_status_integer (osc$status_parameter_delimiter, address.pva_part.offset - 1, 16,   
                      TRUE, local_status);                                                                    
                dup$display_message (local_status, display_control);                                          
              IFEND;                                                                                          
              RESET memory_buffer_p;                                                                          
              dup$display_data (pvt [p$display_option].value, TRUE,                                           
                    pvt [p$radix].value^.integer_value.value, address.pva_part.offset, bytes_returned,        
                    display_control, memory_buffer_p, end_of_input_file, status);                             
              IF NOT status.normal THEN                                                                       
                EXIT /display_opened/;  {---->                                                                
              IFEND;                                                                                          
              display_count := display_count - bytes_returned;                                                
            IFEND;                                                                                            
                                                                                                              
            IF access_data.page_fault THEN                                                                    
              address.pva_part.offset := access_data.next_page_offset;                                        
              IF NOT access_data.memory_found THEN                                                            
                IF NOT skipping_page_faulted_memory THEN                                                      
                  skipping_page_faulted_memory := TRUE;                                                       
                  skip_start := access_data.page_fault_offset;                                                
                IFEND;                                                                                        
                display_count := display_count - (access_data.next_page_offset -                              
                      access_data.page_fault_offset);                                                         
              IFEND;                                                                                          
            ELSE                                                                                              
              address.rma_part := address.rma_part + bytes_returned;                                          
            IFEND;                                                                                            
          UNTIL display_count <= 0;                                                                           
                                                                                                              
          IF page_fault_encountered THEN                                                                      
            IF skipping_page_faulted_memory THEN                                                              
              osp$set_status_abnormal (duc$dump_analyzer_id, due$pages_skipped, '', local_status);            
              osp$append_status_integer (osc$status_parameter_delimiter, skip_start, 16, TRUE,                
                    local_status);                                                                            
              osp$append_status_integer (osc$status_parameter_delimiter,                                      
                    (access_data.next_page_offset + display_count - 1), 16, TRUE, local_status);              
              dup$display_message (local_status, display_control);                                            
            IFEND;                                                                                            
            IF some_memory_copied THEN                                                                        
              osp$set_status_abnormal (duc$dump_analyzer_id, due$incomplete_memory_display,                   
                    ' a page fault was encountered.', status);                                                
            ELSE                                                                                              
              osp$set_status_abnormal (duc$dump_analyzer_id, due$no_memory_displayed,                         
                    ' a page fault was encountered.', status);                                                
            IFEND;                                                                                            
            EXIT /display_opened/;  {---->                                                                    
          IFEND;                                                                                              
                                                                                                              
        ELSE  { address_mode = REAL_MEMORY_ADDRESS                                                            
                                                                                                              
          dup$access_real_memory (bytes, address.rma_part, real_memory_p, new_byte_size, status);             
          IF NOT status.normal AND (status.condition <> due$memory_partially_avail) THEN                      
            EXIT /display_opened/;  {---->                                                                    
          IFEND;                                                                                              
          RESET duv$execution_environment.memory_file_p^.segment_pointer.sequence_pointer TO real_memory_p;   
          bytes_returned := new_byte_size;                                                                    
                                                                                                              
          REPEAT                                                                                              
            IF bytes_returned >= c$partial_count THEN                                                         
              bytes_allowed := c$partial_count;                                                               
            ELSE                                                                                              
              bytes_allowed := bytes_returned;                                                                
            IFEND;                                                                                            
            NEXT memory_buffer_p: [[REP bytes_allowed OF cell]] IN                                            
                  duv$execution_environment.memory_file_p^.segment_pointer.sequence_pointer;                  
            IF memory_buffer_p = NIL THEN                                                                     
              osp$set_status_abnormal (duc$dump_analyzer_id, due$incomplete_memory_display,                   
                    ' the remaining memory is not contained in the dump.', status);                           
              EXIT /display_opened/;  {---->                                                                  
            IFEND;                                                                                            
            dup$display_data (pvt [p$display_option].value, TRUE, pvt [p$radix].value^.integer_value.value,   
                  address.rma_part, bytes_allowed, display_control, memory_buffer_p, end_of_input_file,       
                  status);                                                                                    
            IF NOT status.normal THEN                                                                         
              EXIT /display_opened/;  {---->                                                                  
            IFEND;                                                                                            
            bytes_returned := bytes_returned - bytes_allowed;                                                 
            address.rma_part := address.rma_part + bytes_allowed;                                             
          UNTIL bytes_returned <= 0;                                                                          
          IF new_byte_size < bytes THEN                                                                       
            osp$set_status_abnormal (duc$dump_analyzer_id, due$incomplete_memory_display,                     
                  ' the remaining memory is not contained in the dump.', local_status);                       
            dup$display_message (local_status, display_control);                                              
          IFEND;                                                                                              
        IFEND;                                                                                                
      FOREND;                                                                                                 
    END /display_opened/;                                                                                     
                                                                                                              
    IF output_display_opened THEN                                                                             
      clp$close_display (display_control, ignore_status);                                                     
    IFEND;                                                                                                    
    osp$disestablish_cond_handler;                                                                            
                                                                                                              
  PROCEND dup$display_memory_command;                                                                         
MODEND dum$display_memory_command;                                                                            
