[edk2] [PATCH] OvmfPkg/XenBusDxe: Convert *.asm to NASM.

Subject: [edk2] [PATCH] OvmfPkg/XenBusDxe: Convert *.asm to NASM.

From: Anthony PERARD <anthony.perard@citrix.com>

To: EDK2 devel <edk2-devel@lists.sourceforge.net>

Date: 2014-11-05 22:21:42

The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
all *.asm to *.nasm.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Anthony PERARD 
---
 .../XenBusDxe/Ia32/InterlockedCompareExchange16.S  | 15 ---------------
 ...nge16.asm => InterlockedCompareExchange16.nasm} |  9 +++------
 OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.S           | 13 -------------
 .../{TestAndClearBit.asm => TestAndClearBit.nasm}  |  7 +++----
 OvmfPkg/XenBusDxe/Ia32/hypercall.S                 | 22 ----------------------
 .../Ia32/{hypercall.asm => hypercall.nasm}         |  7 +++----
 .../XenBusDxe/X64/InterlockedCompareExchange16.S   | 13 -------------
 ...nge16.asm => InterlockedCompareExchange16.nasm} |  8 ++++----
 OvmfPkg/XenBusDxe/X64/TestAndClearBit.S            | 12 ------------
 .../{TestAndClearBit.asm => TestAndClearBit.nasm}  |  8 ++++----
 OvmfPkg/XenBusDxe/X64/hypercall.S                  | 22 ----------------------
 .../X64/{hypercall.asm => hypercall.nasm}          |  8 ++++----
 OvmfPkg/XenBusDxe/XenBusDxe.inf                    | 18 ++++++------------
 13 files changed, 27 insertions(+), 135 deletions(-)
 delete mode 100644 OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.S
 rename OvmfPkg/XenBusDxe/Ia32/{InterlockedCompareExchange16.asm => InterlockedCompareExchange16.nasm} (88%)
 delete mode 100644 OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.S
 rename OvmfPkg/XenBusDxe/Ia32/{TestAndClearBit.asm => TestAndClearBit.nasm} (67%)
 delete mode 100644 OvmfPkg/XenBusDxe/Ia32/hypercall.S
 rename OvmfPkg/XenBusDxe/Ia32/{hypercall.asm => hypercall.nasm} (83%)
 delete mode 100644 OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.S
 rename OvmfPkg/XenBusDxe/X64/{InterlockedCompareExchange16.asm => InterlockedCompareExchange16.nasm} (88%)
 delete mode 100644 OvmfPkg/XenBusDxe/X64/TestAndClearBit.S
 rename OvmfPkg/XenBusDxe/X64/{TestAndClearBit.asm => TestAndClearBit.nasm} (63%)
 delete mode 100644 OvmfPkg/XenBusDxe/X64/hypercall.S
 rename OvmfPkg/XenBusDxe/X64/{hypercall.asm => hypercall.nasm} (77%)

diff --git a/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.S b/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.S
deleted file mode 100644
index 5306448..0000000
--- a/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.S
+++ /dev/null
@@ -1,15 +0,0 @@
-# UINT16
-# EFIAPI
-# InternalSyncCompareExchange16 (
-#   IN      volatile UINT16           *Value,
-#   IN      UINT16                    CompareValue,
-#   IN      UINT16                    ExchangeValue
-#   );
-ASM_GLOBAL ASM_PFX(InternalSyncCompareExchange16)
-ASM_PFX(InternalSyncCompareExchange16):
-  mov 4(%esp), %ecx
-  mov 8(%esp), %eax
-  mov 12(%esp), %edx
-  lock
-  cmpxchgw %dx, (%ecx)
-  ret
diff --git a/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.asm b/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.nasm
similarity index 88%
rename from OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.asm
rename to OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.nasm
index adcfbd0..fe6eb02 100644
--- a/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.asm
+++ b/OvmfPkg/XenBusDxe/Ia32/InterlockedCompareExchange16.nasm
@@ -21,9 +21,7 @@
 ;
 ;------------------------------------------------------------------------------
 
-    .486
-    .model  flat,C
-    .code
+SECTION .text
 
 ;------------------------------------------------------------------------------
 ; UINT32
@@ -34,12 +32,11 @@
 ;   IN      UINT16                    ExchangeValue
 ;   );
 ;------------------------------------------------------------------------------
-InternalSyncCompareExchange16   PROC
+global ASM_PFX(InternalSyncCompareExchange16)
+ASM_PFX(InternalSyncCompareExchange16):
     mov     ecx, [esp + 4]
     mov     eax, [esp + 8]
     mov     edx, [esp + 12]
     lock    cmpxchg [ecx], dx
     ret
-InternalSyncCompareExchange16   ENDP
 
-    END
diff --git a/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.S b/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.S
deleted file mode 100644
index 58dfa8b..0000000
--- a/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.S
+++ /dev/null
@@ -1,13 +0,0 @@
-# INT32
-# EFIAPI
-# TestAndClearBit (
-#   IN  INT32 Bit,
-#   IN  volatile VOID* Address
-#   );
-ASM_GLOBAL ASM_PFX(TestAndClearBit)
-ASM_PFX(TestAndClearBit):
-  mov 4(%esp), %ecx
-  mov 8(%esp), %edx
-  lock btrl %ecx, (%edx)
-  sbbl %eax, %eax
-  ret
diff --git a/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.asm b/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.nasm
similarity index 67%
rename from OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.asm
rename to OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.nasm
index ac80902..d77f74e 100644
--- a/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.asm
+++ b/OvmfPkg/XenBusDxe/Ia32/TestAndClearBit.nasm
@@ -1,4 +1,4 @@
-.code
+SECTION .text
 
 ; INT32
 ; EFIAPI
@@ -6,12 +6,11 @@
 ;   IN  INT32 Bit,
 ;   IN  volatile VOID* Address
 ;   );
-TestAndClearBit PROC
+global ASM_PFX(TestAndClearBit)
+ASM_PFX(TestAndClearBit):
   mov ecx, [esp + 4]
   mov edx, [esp + 8]
   lock btr [edx], ecx
   sbb eax, eax
   ret
-TestAndClearBit ENDP
 
-END
diff --git a/OvmfPkg/XenBusDxe/Ia32/hypercall.S b/OvmfPkg/XenBusDxe/Ia32/hypercall.S
deleted file mode 100644
index 77d3478..0000000
--- a/OvmfPkg/XenBusDxe/Ia32/hypercall.S
+++ /dev/null
@@ -1,22 +0,0 @@
-# INTN
-# EFIAPI
-# XenHypercall2 (
-#   IN     VOID *HypercallAddr,
-#   IN OUT INTN Arg1,
-#   IN OUT INTN Arg2
-#   );
-ASM_GLOBAL ASM_PFX(XenHypercall2)
-ASM_PFX(XenHypercall2):
-  # Save only ebx, ecx is supposed to be a scratch register and needs to be
-  # saved by the caller
-  push %ebx
-  # Copy HypercallAddr to eax
-  mov 8(%esp), %eax
-  # Copy Arg1 to the register expected by Xen
-  mov 12(%esp), %ebx
-  # Copy Arg2 to the register expected by Xen
-  mov 16(%esp), %ecx
-  # Call HypercallAddr
-  call *%eax
-  pop %ebx
-  ret
diff --git a/OvmfPkg/XenBusDxe/Ia32/hypercall.asm b/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm
similarity index 83%
rename from OvmfPkg/XenBusDxe/Ia32/hypercall.asm
rename to OvmfPkg/XenBusDxe/Ia32/hypercall.nasm
index 9ead740..8547c30 100644
--- a/OvmfPkg/XenBusDxe/Ia32/hypercall.asm
+++ b/OvmfPkg/XenBusDxe/Ia32/hypercall.nasm
@@ -1,4 +1,4 @@
-.code
+SECTION .text
 
 ; INTN
 ; EFIAPI
@@ -7,7 +7,8 @@
 ;   IN OUT INTN Arg1,
 ;   IN OUT INTN Arg2
 ;   );
-XenHypercall2 PROC
+global ASM_PFX(XenHypercall2)
+ASM_PFX(XenHypercall2):
   ; Save only ebx, ecx is supposed to be a scratch register and needs to be
   ; saved by the caller
   push ebx
@@ -21,6 +22,4 @@ XenHypercall2 PROC
   call eax
   pop ebx
   ret
-XenHypercall2 ENDP
 
-END
diff --git a/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.S b/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.S
deleted file mode 100644
index 23e08f3..0000000
--- a/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.S
+++ /dev/null
@@ -1,13 +0,0 @@
-# UINT16
-# EFIAPI
-# InternalSyncCompareExchange16 (
-#   IN      volatile UINT16           *Value,
-#   IN      UINT16                    CompareValue,
-#   IN      UINT16                    ExchangeValue
-#   );
-ASM_GLOBAL ASM_PFX(InternalSyncCompareExchange16)
-ASM_PFX(InternalSyncCompareExchange16):
-  mov %edx, %eax
-  lock
-  cmpxchgw %r8w, (%rcx)
-  ret
diff --git a/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.asm b/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.nasm
similarity index 88%
rename from OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.asm
rename to OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.nasm
index b23e421..7385c78 100644
--- a/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.asm
+++ b/OvmfPkg/XenBusDxe/X64/InterlockedCompareExchange16.nasm
@@ -21,7 +21,8 @@
 ;
 ;------------------------------------------------------------------------------
 
-    .code
+DEFAULT REL
+SECTION .text
 
 ;------------------------------------------------------------------------------
 ; UINT16
@@ -32,10 +33,9 @@
 ;   IN      UINT16                    ExchangeValue
 ;   );
 ;------------------------------------------------------------------------------
-InternalSyncCompareExchange16   PROC
+global ASM_PFX(InternalSyncCompareExchange16)
+ASM_PFX(InternalSyncCompareExchange16):
     mov     eax, edx
     lock    cmpxchg [rcx], r8w
     ret
-InternalSyncCompareExchange16   ENDP
 
-    END
diff --git a/OvmfPkg/XenBusDxe/X64/TestAndClearBit.S b/OvmfPkg/XenBusDxe/X64/TestAndClearBit.S
deleted file mode 100644
index 0372e83..0000000
--- a/OvmfPkg/XenBusDxe/X64/TestAndClearBit.S
+++ /dev/null
@@ -1,12 +0,0 @@
-# INT32
-# EFIAPI
-# TestAndClearBit (
-#   IN  INT32 Bit,                // rcx
-#   IN  volatile VOID* Address    // rdx
-#   );
-ASM_GLOBAL ASM_PFX(TestAndClearBit)
-ASM_PFX(TestAndClearBit):
-  lock
-  btrl %ecx, (%rdx)
-  sbbl %eax, %eax
-  ret
diff --git a/OvmfPkg/XenBusDxe/X64/TestAndClearBit.asm b/OvmfPkg/XenBusDxe/X64/TestAndClearBit.nasm
similarity index 63%
rename from OvmfPkg/XenBusDxe/X64/TestAndClearBit.asm
rename to OvmfPkg/XenBusDxe/X64/TestAndClearBit.nasm
index 3a25879..38ac549 100644
--- a/OvmfPkg/XenBusDxe/X64/TestAndClearBit.asm
+++ b/OvmfPkg/XenBusDxe/X64/TestAndClearBit.nasm
@@ -1,4 +1,5 @@
-.code
+DEFAULT REL
+SECTION .text
 
 ; INT32
 ; EFIAPI
@@ -6,11 +7,10 @@
 ;   IN  INT32 Bit,                // rcx
 ;   IN  volatile VOID* Address    // rdx
 ;   );
-TestAndClearBit PROC
+global ASM_PFX(TestAndClearBit)
+ASM_PFX(TestAndClearBit):
   lock
   btr [rdx], ecx
   sbb eax, eax
   ret
-TestAndClearBit ENDP
 
-END
diff --git a/OvmfPkg/XenBusDxe/X64/hypercall.S b/OvmfPkg/XenBusDxe/X64/hypercall.S
deleted file mode 100644
index 83cf466..0000000
--- a/OvmfPkg/XenBusDxe/X64/hypercall.S
+++ /dev/null
@@ -1,22 +0,0 @@
-# INTN
-# EFIAPI
-# XenHypercall2 (
-#   IN     VOID *HypercallAddr,
-#   IN OUT INTN Arg1,
-#   IN OUT INTN Arg2
-#   );
-ASM_GLOBAL ASM_PFX(XenHypercall2)
-ASM_PFX(XenHypercall2):
-  push %rdi
-  push %rsi
-  # Copy HypercallAddr to rax
-  movq %rcx, %rax
-  # Copy Arg1 to the register expected by Xen
-  movq %rdx, %rdi
-  # Copy Arg2 to the register expected by Xen
-  movq %r8, %rsi
-  # Call HypercallAddr
-  call *%rax
-  pop %rsi
-  pop %rdi
-  ret
diff --git a/OvmfPkg/XenBusDxe/X64/hypercall.asm b/OvmfPkg/XenBusDxe/X64/hypercall.nasm
similarity index 77%
rename from OvmfPkg/XenBusDxe/X64/hypercall.asm
rename to OvmfPkg/XenBusDxe/X64/hypercall.nasm
index 5b34514..177f271 100644
--- a/OvmfPkg/XenBusDxe/X64/hypercall.asm
+++ b/OvmfPkg/XenBusDxe/X64/hypercall.nasm
@@ -1,4 +1,5 @@
-.code
+DEFAULT REL
+SECTION .text
 
 ; INTN
 ; EFIAPI
@@ -7,7 +8,8 @@
 ;   IN OUT INTN Arg1,
 ;   IN OUT INTN Arg2
 ;   );
-XenHypercall2 PROC
+global ASM_PFX(XenHypercall2)
+ASM_PFX(XenHypercall2):
   push rdi
   push rsi
   ; Copy HypercallAddr to rax
@@ -21,6 +23,4 @@ XenHypercall2 PROC
   pop rsi
   pop rdi
   ret
-XenHypercall2 ENDP
 
-END
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf
index 17a5a90..4ce4743 100644
--- a/OvmfPkg/XenBusDxe/XenBusDxe.inf
+++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf
@@ -49,20 +49,14 @@
   Helpers.c
 
 [Sources.IA32]
-  Ia32/hypercall.S
-  Ia32/hypercall.asm
-  Ia32/InterlockedCompareExchange16.S
-  Ia32/InterlockedCompareExchange16.asm
-  Ia32/TestAndClearBit.S
-  Ia32/TestAndClearBit.asm
+  Ia32/hypercall.nasm
+  Ia32/InterlockedCompareExchange16.nasm
+  Ia32/TestAndClearBit.nasm
 
 [Sources.X64]
-  X64/hypercall.S
-  X64/hypercall.asm
-  X64/InterlockedCompareExchange16.S
-  X64/InterlockedCompareExchange16.asm
-  X64/TestAndClearBit.S
-  X64/TestAndClearBit.asm
+  X64/hypercall.nasm
+  X64/InterlockedCompareExchange16.nasm
+  X64/TestAndClearBit.nasm
 
 [LibraryClasses]
   UefiDriverEntryPoint
-- 
Anthony PERARD


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel