Attachment – The Yasm Modular Assembler Project

AMD64: amd64.org_asm-include_fixes4yasm.200603221217.patch

File amd64.org_asm-include_fixes4yasm.200603221217.patch, 7.6 kB (added by no_mayl@…, 3 years ago)

Patch for the amd64.org downloads (fixes some obvious errors, and makes them work with yasm)

  • aa64_crx.inc

    diff -ur asm-includes.amd64.org/aa64_crx.inc asm-includes.4yasm/aa64_crx.inc
    old new  
    1717%define                 CR3_AVL64               (BITS_QWORD - BITS_CR3_AVL64) 
    1818 
    1919%if BITS_AA64_PHYSICAL > CR3_AVL64 
    20  %error due to the AVL64 bits CR3 can't hold that many base address bits 
     20 %error "due to the AVL64 bits CR3 can't hold that many base address bits" 
    2121%endif 
    2222 
    2323%define                 CR3_BAS_PML4            12 
  • aa64_desc.inc

    Only in asm-includes.4yasm: aa64_crx.inc~
    diff -ur asm-includes.amd64.org/aa64_desc.inc asm-includes.4yasm/aa64_desc.inc
    old new  
    272272                        %elifidni %3,GATE 
    273273                         %ifidni %4,CALL 
    274274                          %ifidn %1,IDT64 
    275                            %error 64 bit call gate descriptors can't reside in the IDT 
     275                           %error "64 bit call gate descriptors can't reside in the IDT" 
    276276                          %endif 
    277277                          istruc MEM_DESC_GATE_CALL64 
    278278                           at MEM_DESC_GATE_CALL64.OFF_15_0,    dw ((%6) & MAX_WORD) 
  • aa64_opc_rm32.inc

    Only in asm-includes.4yasm: aa64_desc.inc~
    diff -ur asm-includes.amd64.org/aa64_opc_rm32.inc asm-includes.4yasm/aa64_opc_rm32.inc
    old new  
    1919 
    2020%define                 RM32_REG_R8B            8 
    2121%define                 RM32_REG_R9B            9 
    22 %define                 RM32_REG_R11B           10 
     22%define                 RM32_REG_R10B           10 
    2323%define                 RM32_REG_R11B           11 
    2424%define                 RM32_REG_R12B           12 
    2525%define                 RM32_REG_R13B           13 
     
    2828 
    2929%define                 RM32_REG_R8W            8 
    3030%define                 RM32_REG_R9W            9 
    31 %define                 RM32_REG_R11W           10 
     31%define                 RM32_REG_R10W           10 
    3232%define                 RM32_REG_R11W           11 
    3333%define                 RM32_REG_R12W           12 
    3434%define                 RM32_REG_R13W           13 
     
    3737 
    3838%define                 RM32_REG_R8D            8 
    3939%define                 RM32_REG_R9D            9 
    40 %define                 RM32_REG_R11D           10 
     40%define                 RM32_REG_R10D           10 
    4141%define                 RM32_REG_R11D           11 
    4242%define                 RM32_REG_R12D           12 
    4343%define                 RM32_REG_R13D           13 
     
    4646 
    4747%define                 RM32_REG_R8             8 
    4848%define                 RM32_REG_R9             9 
    49 %define                 RM32_REG_R11            10 
     49%define                 RM32_REG_R10            10 
    5050%define                 RM32_REG_R11            11 
    5151%define                 RM32_REG_R12            12 
    5252%define                 RM32_REG_R13            13 
  • aa64_paging.inc

    Only in asm-includes.4yasm: aa64_opc_rm32.inc~
    diff -ur asm-includes.amd64.org/aa64_paging.inc asm-includes.4yasm/aa64_paging.inc
    old new  
    3636%define                 PMLxE_AVL64             (BITS_QWORD - BITS_PMLxE_AVL64) 
    3737 
    3838%if BITS_AA64_PHYSICAL > PMLxE_AVL64 
    39  %error due to the AVL64 bits a PMLxE can't hold that many base address bits 
     39 %error "due to the AVL64 bits a PMLxE can't hold that many base address bits" 
    4040%endif 
    4141 
    4242%define                 MASK_PMLxE_AVL64        (((1 << BITS_PMLxE_AVL64) - 1) << PMLxE_AVL64) 
     
    186186%define                 MASK_PDE_4KB_BAS        (((1 << (BITS_AA64_PHYSICAL - PDE_4KB_BAS)) - 1) << PDE_4KB_BAS) 
    187187 
    188188%if BITS_AA64_PHYSICAL > 41 
    189  %error the 4 MB PDE can't hold more than 41 page base address bits 
     189 %error "the 4 MB PDE can't hold more than 41 page base address bits" 
    190190%endif 
    191191 
    192192%define                 MASK_PDE_4MB_BAS_HIGH   (((1 << (BITS_AA64_PHYSICAL - BITS_DWORD)) - 1) << PDE_4MB_BAS_HIGH) 
  • ia32_desc.inc

    Only in asm-includes.4yasm: aa64_paging.inc~
    diff -ur asm-includes.amd64.org/ia32_desc.inc asm-includes.4yasm/ia32_desc.inc
    old new  
    425425                        %elifidni %3,SEG 
    426426                         %ifidni %4,CODE 
    427427                          %ifidn %1,IDT 
    428                            %error code segment descriptors can't reside in the IDT 
     428                           %error "code segment descriptors can't reside in the IDT" 
    429429                          %endif 
    430430                          istruc MEM_DESC_SEG_CODE 
    431431                           at MEM_DESC_SEG_CODE.LIM_15_0,       dw (temp1 & MAX_WORD) 
     
    436436                          iend 
    437437                         %elifidni %4,DATA 
    438438                          %ifidn %1,IDT 
    439                            %error data segment descriptors can't reside in the IDT 
     439                           %error "data segment descriptors can't reside in the IDT" 
    440440                          %endif 
    441441                          %if (temp2 & MASK_AR_SEG_DATA_X) = MASK_AR_SEG_DATA_X 
    442442                           %if (temp2 & MASK_AR_SEG_DATA_W) = 0 
     
    478478                        %elifidni %3,GATE 
    479479                         %ifidni %4,CALL 
    480480                          %ifidn %1,IDT 
    481                            %error call gate descriptors can't reside in the IDT 
     481                           %error "call gate descriptors can't reside in the IDT" 
    482482                          %endif 
    483483                          istruc MEM_DESC_GATE_CALL 
    484484                           at MEM_DESC_GATE_CALL.OFF_15_0,      dw ((%6) & MAX_WORD) 
  • ia32_msr.inc

    Only in asm-includes.4yasm: ia32_desc.inc~
    diff -ur asm-includes.amd64.org/ia32_msr.inc asm-includes.4yasm/ia32_msr.inc
    old new  
    276276%define                 MSR_MTRR_PHYS_MASK_n_V          11 
    277277 
    278278%define                 MASK_MSR_MTRR_PHYS_MASK_n_MASK  (((1 << (BITS_IA32_PHYSICAL - MSR_MTRR_PHYS_MASK_n_MASK)) - 1) << MSR_MTRR_PHYS_MASK_n_MASK) 
    279 %define                 MASK_MSR_MTRR_PHYS_MASK_n_V     (MAX_BYTE << MSR_MTRR_PHYS_MASK_n_V) 
     279%define                 MASK_MSR_MTRR_PHYS_MASK_n_V     (1 << MSR_MTRR_PHYS_MASK_n_V) 
    280280 
    281281;------------------------------------------------------------------------------ 
    282282;       MCAR MSR bits 
     
    390390%define                 MSR_APIC_BASE_E                 11 
    391391%define                 MSR_APIC_BASE_BSP               8 
    392392 
    393 %define                 MSR_APIC_BASE_BASE              (((1 << (BITS_IA32_PHYSICAL - MSR_APIC_BASE_BASE)) - 1) << MSR_APIC_BASE_BASE) 
     393%define                 MASK_MSR_APIC_BASE_BASE         (((1 << (BITS_IA32_PHYSICAL - MSR_APIC_BASE_BASE)) - 1) << MSR_APIC_BASE_BASE) 
    394394%define                 MASK_MSR_APIC_BASE_E            (1 << MSR_APIC_BASE_E) 
    395395%define                 MASK_MSR_APIC_BASE_BSP          (1 << MSR_APIC_BASE_BSP) 
    396396 
  • ia32_paging.inc

    Only in asm-includes.4yasm: ia32_msr.inc~
    diff -ur asm-includes.amd64.org/ia32_paging.inc asm-includes.4yasm/ia32_paging.inc
    old new  
    123123%define                 PDE_4MB_P               PxE_P 
    124124 
    125125%if BITS_IA32_PHYSICAL > 41 
    126  %error the 4 MB PDE can't hold more than 41 page base address bits 
     126 %error "the 4 MB PDE can't hold more than 41 page base address bits" 
    127127%endif 
    128128 
    129129%define                 MASK_PDE_4MB_BAS        (((1 << (BITS_DWORD - PDE_4MB_BAS)) - 1) << PDE_4MB_BAS) 
  • ia32_tss.inc

    Only in asm-includes.4yasm: ia32_paging.inc~
    diff -ur asm-includes.amd64.org/ia32_tss.inc asm-includes.4yasm/ia32_tss.inc
    old new  
    145145%macro                  CALC_C_IOPB 3           ; port, offset, mask 
    146146 
    147147                        %if (%1) < MIN_WORD 
    148                          %error port can't be negative 
     148                         %error "port can't be negative" 
    149149                        %endif 
    150150 
    151151                        %if (%1) > (MAX_WORD + BYTES_DWORD - 1) 
  • asm-includes.

    Only in asm-includes.4yasm: ia32_tss.inc~
    diff -ur asm-includes.amd64.org/main.asm asm-includes.4yasm/main.asm
    old new  
    1212;       NASM stuff 
    1313;------------------------------------------------------------------------------ 
    1414 
    15 %locals . 
     15; not recognized by yasm: 
     16; %locals . 
    1617 
    1718%define off offset      ; since there is a "seg", using "off" is cleaner 
    1819 
     
    125126;------------------------------------------------------------------------------ 
    126127 
    127128%macro CHECK_C_STRUC_SIZE 2 
    128  %if %1_size <> (%2) 
    129   %error structure has unexpected size 
    130  %endif 
     129;  yasm does not like the "%1_size" 
     130; %if %1_size <> (%2) 
     131;  %error structure has unexpected size 
     132; %endif 
    131133%endmacro 
    132134 
    133135;------------------------------------------------------------------------------