This catches up i386 with the changes to acpi_wakecode.S and mptramp.s
that were made on amd64 for clang. Here's kettenis@'s original
commit message:
------------------->
Generating mixed 16-bit/32-bit/64-bit code with clang's integrated
assembler is a bit tricky. It supports the .code16, .code32 and
.code64 directives. But it doesn't know about the data16/data32 and
addr16/addr32 instruction prefixes. Instead it tries to determine
those from the instruction opcode. It mostly succeeds, but there are
a couple of corner cases where clang will generate the "addr32" form
where gas generates the "addr16" form in .code16 segments. That
should be no problem (and just waste a couple of bytes), but it makes
comparing the generated code a bit difficult.
Allow the trampoline code to be compiled with both. For clang #define
away the addr32 prefix and avoid using the data32 prefix by using a
mnemonic that explicitly encodes the size of the operand. Add a few
addr32 prefixes in .code16 blocks to reduce the differences between
code generated by clang and gas.
<-------------------
ok?
Index: acpi_wakecode.S
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/acpi_wakecode.S,v
retrieving revision 1.27
diff -u -p -r1.27 acpi_wakecode.S
--- acpi_wakecode.S 20 May 2016 02:30:41 -0000 1.27
+++ acpi_wakecode.S 4 Jun 2017 21:06:47 -0000
@@ -52,6 +52,10 @@
#include <machine/segments.h>
#include <dev/acpi/acpivar.h>
+#ifdef __clang__
+#define addr32
+#endif
+
#define _ACPI_TRMP_LABEL(a) a = . - _C_LABEL(acpi_real_mode_resume) +
ACPI_TRAMPOLINE
#define _ACPI_TRMP_OFFSET(a) a = . - _C_LABEL(acpi_real_mode_resume)
#define _ACPI_TRMP_DATA_LABEL(a) a = . - _C_LABEL(acpi_tramp_data_start) + \
@@ -108,7 +112,7 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
movw %ax, %ss
movw %cs, %ax
movw %ax, %es
- lidtl clean_idt
+ addr32 lidtl clean_idt
/*
* Set up stack to grow down from offset 0x0FFE.
@@ -140,7 +144,7 @@ _ACPI_TRMP_OFFSET(acpi_s3_vector_real)
* to sleep (although on i386, the saved GDT will most likely
* represent something similar based on machine/segment.h).
*/
- data32 addr32 lgdt tmp_gdt
+ addr32 lgdtl tmp_gdt
/*
* Enable protected mode by setting the PE bit in CR0
@@ -342,7 +346,7 @@ _ACPI_TRMP_LABEL(hibernate_resume_vector
movw %ax, %fs
movw %ax, %gs
movl $0x0FFE, %esp
- lidtl clean_idt
+ addr32 lidtl clean_idt
/* Jump to the S3 resume vector */
ljmp $(_ACPI_RM_CODE_SEG), $acpi_s3_vector_real
Index: mptramp.s
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/mptramp.s,v
retrieving revision 1.20
diff -u -p -r1.20 mptramp.s
--- mptramp.s 6 Feb 2017 01:50:36 -0000 1.20
+++ mptramp.s 4 Jun 2017 20:32:04 -0000
@@ -84,6 +84,10 @@
#include <machine/mpbiosvar.h>
#include <machine/i82489reg.h>
+#ifdef __clang__
+#define addr32
+#endif
+
#define GDTE(a,b) .byte 0xff,0xff,0x0,0x0,0x0,a,b,0x0
#define _RELOC(x) ((x) - KERNBASE)
#define RELOC(x) _RELOC(_C_LABEL(x))
@@ -115,7 +119,7 @@ _C_LABEL(cpu_spinup_trampoline):
movw %cs, %ax
movw %ax, %es
movw %ax, %ss
- data32 addr32 lgdt (gdt_desc) # load flat descriptor table
+ addr32 lgdtl (gdt_desc) # load flat descriptor table
movl %cr0, %eax # get cr0
orl $0x1, %eax # enable protected mode
movl %eax, %cr0 # doit
--
Christian "naddy" Weisgerber [email protected]