Commit ec3b93ae authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Misc fixes and minor updates all over the place:

   - an SGI/UV fix
   - a defconfig update
   - a build warning fix
   - move the boot_params file to the arch location in debugfs
   - a pkeys fix
   - selftests fix
   - boot message fixes
   - sparse fixes
   - a resume warning fix
   - ioapic hotplug fixes
   - reboot quirks

  ... plus various minor cleanups"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/build/x86_64_defconfig: Enable CONFIG_R8169
  x86/reboot/quirks: Add ASUS EeeBook X205TA/W reboot quirk
  x86/hpet: Prevent might sleep splat on resume
  x86/boot: Correct setup_header.start_sys name
  x86/purgatory: Fix sparse warning, symbol not declared
  x86/purgatory: Make functions and variables static
  x86/events: Remove last remnants of old filenames
  x86/pkeys: Check against max pkey to avoid overflows
  x86/ioapic: Split IOAPIC hot-removal into two steps
  x86/PCI: Implement pcibios_release_device to release IRQ from IOAPIC
  x86/intel_rdt: Remove duplicate inclusion of linux/cpu.h
  x86/vmware: Remove duplicate inclusion of asm/timer.h
  x86/hyperv: Hide unused label
  x86/reboot/quirks: Add ASUS EeeBook X205TA reboot quirk
  x86/platform/uv/BAU: Fix HUB errors by remove initial write to sw-ack register
  x86/selftests: Add clobbers for int80 on x86_64
  x86/apic: Simplify enable_IR_x2apic(), remove try_to_enable_IR()
  x86/apic: Fix a warning message in logical CPU IDs allocation
  x86/kdebugfs: Move boot params hierarchy under (debugfs)/x86/
parents 8a917235 f2853308
...@@ -176,6 +176,7 @@ CONFIG_E1000E=y ...@@ -176,6 +176,7 @@ CONFIG_E1000E=y
CONFIG_SKY2=y CONFIG_SKY2=y
CONFIG_FORCEDETH=y CONFIG_FORCEDETH=y
CONFIG_8139TOO=y CONFIG_8139TOO=y
CONFIG_R8169=y
CONFIG_FDDI=y CONFIG_FDDI=y
CONFIG_INPUT_POLLDEV=y CONFIG_INPUT_POLLDEV=y
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
......
...@@ -604,7 +604,7 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, int idx, ...@@ -604,7 +604,7 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, int idx,
return &amd_f15_PMC20; return &amd_f15_PMC20;
} }
case AMD_EVENT_NB: case AMD_EVENT_NB:
/* moved to perf_event_amd_uncore.c */ /* moved to uncore.c */
return &emptyconstraint; return &emptyconstraint;
default: default:
return &emptyconstraint; return &emptyconstraint;
......
/* /*
* perf_event_intel_cstate.c: support cstate residency counters * Support cstate residency counters
* *
* Copyright (C) 2015, Intel Corp. * Copyright (C) 2015, Intel Corp.
* Author: Kan Liang (kan.liang@intel.com) * Author: Kan Liang (kan.liang@intel.com)
......
/* /*
* perf_event_intel_rapl.c: support Intel RAPL energy consumption counters * Support Intel RAPL energy consumption counters
* Copyright (C) 2013 Google, Inc., Stephane Eranian * Copyright (C) 2013 Google, Inc., Stephane Eranian
* *
* Intel RAPL interface is specified in the IA-32 Manual Vol3b * Intel RAPL interface is specified in the IA-32 Manual Vol3b
......
...@@ -360,7 +360,7 @@ extern struct list_head pci2phy_map_head; ...@@ -360,7 +360,7 @@ extern struct list_head pci2phy_map_head;
extern struct pci_extra_dev *uncore_extra_pci_dev; extern struct pci_extra_dev *uncore_extra_pci_dev;
extern struct event_constraint uncore_constraint_empty; extern struct event_constraint uncore_constraint_empty;
/* perf_event_intel_uncore_snb.c */ /* uncore_snb.c */
int snb_uncore_pci_init(void); int snb_uncore_pci_init(void);
int ivb_uncore_pci_init(void); int ivb_uncore_pci_init(void);
int hsw_uncore_pci_init(void); int hsw_uncore_pci_init(void);
...@@ -371,7 +371,7 @@ void nhm_uncore_cpu_init(void); ...@@ -371,7 +371,7 @@ void nhm_uncore_cpu_init(void);
void skl_uncore_cpu_init(void); void skl_uncore_cpu_init(void);
int snb_pci2phy_map_init(int devid); int snb_pci2phy_map_init(int devid);
/* perf_event_intel_uncore_snbep.c */ /* uncore_snbep.c */
int snbep_uncore_pci_init(void); int snbep_uncore_pci_init(void);
void snbep_uncore_cpu_init(void); void snbep_uncore_cpu_init(void);
int ivbep_uncore_pci_init(void); int ivbep_uncore_pci_init(void);
...@@ -385,5 +385,5 @@ void knl_uncore_cpu_init(void); ...@@ -385,5 +385,5 @@ void knl_uncore_cpu_init(void);
int skx_uncore_pci_init(void); int skx_uncore_pci_init(void);
void skx_uncore_cpu_init(void); void skx_uncore_cpu_init(void);
/* perf_event_intel_uncore_nhmex.c */ /* uncore_nhmex.c */
void nhmex_uncore_cpu_init(void); void nhmex_uncore_cpu_init(void);
...@@ -158,13 +158,13 @@ void hyperv_init(void) ...@@ -158,13 +158,13 @@ void hyperv_init(void)
clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100); clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100);
return; return;
} }
register_msr_cs:
#endif #endif
/* /*
* For 32 bit guests just use the MSR based mechanism for reading * For 32 bit guests just use the MSR based mechanism for reading
* the partition counter. * the partition counter.
*/ */
register_msr_cs:
hyperv_cs = &hyperv_cs_msr; hyperv_cs = &hyperv_cs_msr;
if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100); clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
......
...@@ -46,6 +46,15 @@ extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, ...@@ -46,6 +46,15 @@ extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
static inline static inline
bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
{ {
/*
* "Allocated" pkeys are those that have been returned
* from pkey_alloc(). pkey 0 is special, and never
* returned from pkey_alloc().
*/
if (pkey <= 0)
return false;
if (pkey >= arch_max_pkey())
return false;
return mm_pkey_allocation_map(mm) & (1U << pkey); return mm_pkey_allocation_map(mm) & (1U << pkey);
} }
...@@ -82,12 +91,6 @@ int mm_pkey_alloc(struct mm_struct *mm) ...@@ -82,12 +91,6 @@ int mm_pkey_alloc(struct mm_struct *mm)
static inline static inline
int mm_pkey_free(struct mm_struct *mm, int pkey) int mm_pkey_free(struct mm_struct *mm, int pkey)
{ {
/*
* pkey 0 is special, always allocated and can never
* be freed.
*/
if (!pkey)
return -EINVAL;
if (!mm_pkey_is_allocated(mm, pkey)) if (!mm_pkey_is_allocated(mm, pkey))
return -EINVAL; return -EINVAL;
......
...@@ -58,7 +58,7 @@ struct setup_header { ...@@ -58,7 +58,7 @@ struct setup_header {
__u32 header; __u32 header;
__u16 version; __u16 version;
__u32 realmode_swtch; __u32 realmode_swtch;
__u16 start_sys; __u16 start_sys_seg;
__u16 kernel_version; __u16 kernel_version;
__u8 type_of_loader; __u8 type_of_loader;
__u8 loadflags; __u8 loadflags;
......
...@@ -1610,24 +1610,15 @@ static inline void try_to_enable_x2apic(int remap_mode) { } ...@@ -1610,24 +1610,15 @@ static inline void try_to_enable_x2apic(int remap_mode) { }
static inline void __x2apic_enable(void) { } static inline void __x2apic_enable(void) { }
#endif /* !CONFIG_X86_X2APIC */ #endif /* !CONFIG_X86_X2APIC */
static int __init try_to_enable_IR(void)
{
#ifdef CONFIG_X86_IO_APIC
if (!x2apic_enabled() && skip_ioapic_setup) {
pr_info("Not enabling interrupt remapping due to skipped IO-APIC setup\n");
return -1;
}
#endif
return irq_remapping_enable();
}
void __init enable_IR_x2apic(void) void __init enable_IR_x2apic(void)
{ {
unsigned long flags; unsigned long flags;
int ret, ir_stat; int ret, ir_stat;
if (skip_ioapic_setup) if (skip_ioapic_setup) {
pr_info("Not enabling interrupt remapping due to skipped IO-APIC setup\n");
return; return;
}
ir_stat = irq_remapping_prepare(); ir_stat = irq_remapping_prepare();
if (ir_stat < 0 && !x2apic_supported()) if (ir_stat < 0 && !x2apic_supported())
...@@ -1645,7 +1636,7 @@ void __init enable_IR_x2apic(void) ...@@ -1645,7 +1636,7 @@ void __init enable_IR_x2apic(void)
/* If irq_remapping_prepare() succeeded, try to enable it */ /* If irq_remapping_prepare() succeeded, try to enable it */
if (ir_stat >= 0) if (ir_stat >= 0)
ir_stat = try_to_enable_IR(); ir_stat = irq_remapping_enable();
/* ir_stat contains the remap mode or an error code */ /* ir_stat contains the remap mode or an error code */
try_to_enable_x2apic(ir_stat); try_to_enable_x2apic(ir_stat);
...@@ -2062,10 +2053,10 @@ static int allocate_logical_cpuid(int apicid) ...@@ -2062,10 +2053,10 @@ static int allocate_logical_cpuid(int apicid)
/* Allocate a new cpuid. */ /* Allocate a new cpuid. */
if (nr_logical_cpuids >= nr_cpu_ids) { if (nr_logical_cpuids >= nr_cpu_ids) {
WARN_ONCE(1, "Only %d processors supported." WARN_ONCE(1, "APIC: NR_CPUS/possible_cpus limit of %i reached. "
"Processor %d/0x%x and the rest are ignored.\n", "Processor %d/0x%x and the rest are ignored.\n",
nr_cpu_ids - 1, nr_logical_cpuids, apicid); nr_cpu_ids, nr_logical_cpuids, apicid);
return -1; return -EINVAL;
} }
cpuid_to_apicid[nr_logical_cpuids] = apicid; cpuid_to_apicid[nr_logical_cpuids] = apicid;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include <linux/sched/task.h> #include <linux/sched/task.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/cpu.h>
#include <linux/task_work.h> #include <linux/task_work.h>
#include <uapi/linux/magic.h> #include <uapi/linux/magic.h>
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <asm/hypervisor.h> #include <asm/hypervisor.h>
#include <asm/timer.h> #include <asm/timer.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/timer.h>
#undef pr_fmt #undef pr_fmt
#define pr_fmt(fmt) "vmware: " fmt #define pr_fmt(fmt) "vmware: " fmt
......
...@@ -354,7 +354,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer) ...@@ -354,7 +354,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer)
irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq)); irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq));
irq_domain_activate_irq(irq_get_irq_data(hdev->irq)); irq_domain_activate_irq(irq_get_irq_data(hdev->irq));
disable_irq(hdev->irq); disable_hardirq(hdev->irq);
irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu)); irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu));
enable_irq(hdev->irq); enable_irq(hdev->irq);
} }
......
...@@ -167,7 +167,7 @@ static int __init boot_params_kdebugfs_init(void) ...@@ -167,7 +167,7 @@ static int __init boot_params_kdebugfs_init(void)
struct dentry *dbp, *version, *data; struct dentry *dbp, *version, *data;
int error = -ENOMEM; int error = -ENOMEM;
dbp = debugfs_create_dir("boot_params", NULL); dbp = debugfs_create_dir("boot_params", arch_debugfs_dir);
if (!dbp) if (!dbp)
return -ENOMEM; return -ENOMEM;
......
...@@ -223,6 +223,22 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { ...@@ -223,6 +223,22 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
DMI_MATCH(DMI_BOARD_NAME, "P4S800"), DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
}, },
}, },
{ /* Handle problems with rebooting on ASUS EeeBook X205TA */
.callback = set_acpi_reboot,
.ident = "ASUS EeeBook X205TA",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X205TAW"),
},
},
{ /* Handle problems with rebooting on ASUS EeeBook X205TAW */
.callback = set_acpi_reboot,
.ident = "ASUS EeeBook X205TAW",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X205TAW"),
},
},
/* Certec */ /* Certec */
{ /* Handle problems with rebooting on Certec BPC600 */ { /* Handle problems with rebooting on Certec BPC600 */
......
...@@ -735,6 +735,15 @@ void pcibios_disable_device (struct pci_dev *dev) ...@@ -735,6 +735,15 @@ void pcibios_disable_device (struct pci_dev *dev)
pcibios_disable_irq(dev); pcibios_disable_irq(dev);
} }
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
void pcibios_release_device(struct pci_dev *dev)
{
if (atomic_dec_return(&dev->enable_cnt) >= 0)
pcibios_disable_device(dev);
}
#endif
int pci_ext_cfg_avail(void) int pci_ext_cfg_avail(void)
{ {
if (raw_pci_ext_ops) if (raw_pci_ext_ops)
......
...@@ -1847,7 +1847,6 @@ static void pq_init(int node, int pnode) ...@@ -1847,7 +1847,6 @@ static void pq_init(int node, int pnode)
ops.write_payload_first(pnode, first); ops.write_payload_first(pnode, first);
ops.write_payload_last(pnode, last); ops.write_payload_last(pnode, last);
ops.write_g_sw_ack(pnode, 0xffffUL);
/* in effect, all msg_type's are set to MSG_NOOP */ /* in effect, all msg_type's are set to MSG_NOOP */
memset(pqp, 0, sizeof(struct bau_pq_entry) * DEST_Q_SIZE); memset(pqp, 0, sizeof(struct bau_pq_entry) * DEST_Q_SIZE);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
*/ */
#include "sha256.h" #include "sha256.h"
#include "purgatory.h"
#include "../boot/string.h" #include "../boot/string.h"
struct sha_region { struct sha_region {
...@@ -18,11 +19,11 @@ struct sha_region { ...@@ -18,11 +19,11 @@ struct sha_region {
unsigned long len; unsigned long len;
}; };
unsigned long backup_dest = 0; static unsigned long backup_dest;
unsigned long backup_src = 0; static unsigned long backup_src;
unsigned long backup_sz = 0; static unsigned long backup_sz;
u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 }; static u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
struct sha_region sha_regions[16] = {}; struct sha_region sha_regions[16] = {};
...@@ -39,7 +40,7 @@ static int copy_backup_region(void) ...@@ -39,7 +40,7 @@ static int copy_backup_region(void)
return 0; return 0;
} }
int verify_sha256_digest(void) static int verify_sha256_digest(void)
{ {
struct sha_region *ptr, *end; struct sha_region *ptr, *end;
u8 digest[SHA256_DIGEST_SIZE]; u8 digest[SHA256_DIGEST_SIZE];
......
#ifndef PURGATORY_H
#define PURGATORY_H
#ifndef __ASSEMBLY__
extern void purgatory(void);
#endif /* __ASSEMBLY__ */
#endif /* PURGATORY_H */
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* This source code is licensed under the GNU General Public License, * This source code is licensed under the GNU General Public License,
* Version 2. See the file COPYING for more details. * Version 2. See the file COPYING for more details.
*/ */
#include "purgatory.h"
.text .text
.globl purgatory_start .globl purgatory_start
......
...@@ -41,8 +41,10 @@ void acpi_gpe_apply_masked_gpes(void); ...@@ -41,8 +41,10 @@ void acpi_gpe_apply_masked_gpes(void);
void acpi_container_init(void); void acpi_container_init(void);
void acpi_memory_hotplug_init(void); void acpi_memory_hotplug_init(void);
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
void pci_ioapic_remove(struct acpi_pci_root *root);
int acpi_ioapic_remove(struct acpi_pci_root *root); int acpi_ioapic_remove(struct acpi_pci_root *root);
#else #else
static inline void pci_ioapic_remove(struct acpi_pci_root *root) { return; }
static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; } static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
#endif #endif
#ifdef CONFIG_ACPI_DOCK #ifdef CONFIG_ACPI_DOCK
......
...@@ -206,24 +206,34 @@ int acpi_ioapic_add(acpi_handle root_handle) ...@@ -206,24 +206,34 @@ int acpi_ioapic_add(acpi_handle root_handle)
return ACPI_SUCCESS(status) && ACPI_SUCCESS(retval) ? 0 : -ENODEV; return ACPI_SUCCESS(status) && ACPI_SUCCESS(retval) ? 0 : -ENODEV;
} }
int acpi_ioapic_remove(struct acpi_pci_root *root) void pci_ioapic_remove(struct acpi_pci_root *root)
{ {
int retval = 0;
struct acpi_pci_ioapic *ioapic, *tmp; struct acpi_pci_ioapic *ioapic, *tmp;
mutex_lock(&ioapic_list_lock); mutex_lock(&ioapic_list_lock);
list_for_each_entry_safe(ioapic, tmp, &ioapic_list, list) { list_for_each_entry_safe(ioapic, tmp, &ioapic_list, list) {
if (root->device->handle != ioapic->root_handle) if (root->device->handle != ioapic->root_handle)
continue; continue;
if (acpi_unregister_ioapic(ioapic->handle, ioapic->gsi_base))
retval = -EBUSY;
if (ioapic->pdev) { if (ioapic->pdev) {
pci_release_region(ioapic->pdev, 0); pci_release_region(ioapic->pdev, 0);
pci_disable_device(ioapic->pdev); pci_disable_device(ioapic->pdev);
pci_dev_put(ioapic->pdev); pci_dev_put(ioapic->pdev);
} }
}
mutex_unlock(&ioapic_list_lock);
}
int acpi_ioapic_remove(struct acpi_pci_root *root)
{
int retval = 0;
struct acpi_pci_ioapic *ioapic, *tmp;
mutex_lock(&ioapic_list_lock);
list_for_each_entry_safe(ioapic, tmp, &ioapic_list, list) {
if (root->device->handle != ioapic->root_handle)
continue;
if (acpi_unregister_ioapic(ioapic->handle, ioapic->gsi_base))
retval = -EBUSY;
if (ioapic->res.flags && ioapic->res.parent) if (ioapic->res.flags && ioapic->res.parent)
release_resource(&ioapic->res); release_resource(&ioapic->res);
list_del(&ioapic->list); list_del(&ioapic->list);
......
...@@ -648,12 +648,12 @@ static void acpi_pci_root_remove(struct acpi_device *device) ...@@ -648,12 +648,12 @@ static void acpi_pci_root_remove(struct acpi_device *device)
pci_stop_root_bus(root->bus); pci_stop_root_bus(root->bus);
WARN_ON(acpi_ioapic_remove(root)); pci_ioapic_remove(root);
device_set_run_wake(root->bus->bridge, false); device_set_run_wake(root->bus->bridge, false);
pci_acpi_remove_bus_pm_notifier(device); pci_acpi_remove_bus_pm_notifier(device);
pci_remove_root_bus(root->bus); pci_remove_root_bus(root->bus);
WARN_ON(acpi_ioapic_remove(root));
dmar_device_remove(device->handle); dmar_device_remove(device->handle);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#error Instruction buffer size too small #error Instruction buffer size too small
#endif #endif
/* Based on branch_type() from perf_event_intel_lbr.c */ /* Based on branch_type() from arch/x86/events/intel/lbr.c */
static void intel_pt_insn_decoder(struct insn *insn, static void intel_pt_insn_decoder(struct insn *insn,
struct intel_pt_insn *intel_pt_insn) struct intel_pt_insn *intel_pt_insn)
{ {
......
...@@ -245,7 +245,7 @@ void do_unexpected_base(void) ...@@ -245,7 +245,7 @@ void do_unexpected_base(void)
long ret; long ret;
asm volatile ("int $0x80" asm volatile ("int $0x80"
: "=a" (ret) : "a" (243), "b" (low_desc) : "=a" (ret) : "a" (243), "b" (low_desc)
: "flags"); : "r8", "r9", "r10", "r11");
memcpy(&desc, low_desc, sizeof(desc)); memcpy(&desc, low_desc, sizeof(desc));
munmap(low_desc, sizeof(desc)); munmap(low_desc, sizeof(desc));
......
...@@ -45,6 +45,12 @@ ...@@ -45,6 +45,12 @@
#define AR_DB (1 << 22) #define AR_DB (1 << 22)
#define AR_G (1 << 23) #define AR_G (1 << 23)
#ifdef __x86_64__
# define INT80_CLOBBERS "r8", "r9", "r10", "r11"
#else
# define INT80_CLOBBERS
#endif
static int nerrs; static int nerrs;
/* Points to an array of 1024 ints, each holding its own index. */ /* Points to an array of 1024 ints, each holding its own index. */
...@@ -588,7 +594,7 @@ static int invoke_set_thread_area(void) ...@@ -588,7 +594,7 @@ static int invoke_set_thread_area(void)
asm volatile ("int $0x80" asm volatile ("int $0x80"
: "=a" (ret), "+m" (low_user_desc) : : "=a" (ret), "+m" (low_user_desc) :
"a" (243), "b" (low_user_desc) "a" (243), "b" (low_user_desc)
: "flags"); : INT80_CLOBBERS);
return ret; return ret;
} }
...@@ -657,7 +663,7 @@ static void test_gdt_invalidation(void) ...@@ -657,7 +663,7 @@ static void test_gdt_invalidation(void)
"+a" (eax) "+a" (eax)
: "m" (low_user_desc_clear), : "m" (low_user_desc_clear),
[arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear)
: "flags"); : INT80_CLOBBERS);
if (sel != 0) { if (sel != 0) {
result = "FAIL"; result = "FAIL";
...@@ -688,7 +694,7 @@ static void test_gdt_invalidation(void) ...@@ -688,7 +694,7 @@ static void test_gdt_invalidation(void)
"+a" (eax) "+a" (eax)
: "m" (low_user_desc_clear), : "m" (low_user_desc_clear),
[arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear)
: "flags"); : INT80_CLOBBERS);
if (sel != 0) { if (sel != 0) {
result = "FAIL"; result = "FAIL";
...@@ -721,7 +727,7 @@ static void test_gdt_invalidation(void) ...@@ -721,7 +727,7 @@ static void test_gdt_invalidation(void)
"+a" (eax) "+a" (eax)
: "m" (low_user_desc_clear), : "m" (low_user_desc_clear),
[arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear)
: "flags"); : INT80_CLOBBERS);
#ifdef __x86_64__ #ifdef __x86_64__
syscall(SYS_arch_prctl, ARCH_GET_FS, &new_base); syscall(SYS_arch_prctl, ARCH_GET_FS, &new_base);
...@@ -774,7 +780,7 @@ static void test_gdt_invalidation(void) ...@@ -774,7 +780,7 @@ static void test_gdt_invalidation(void)
"+a" (eax) "+a" (eax)
: "m" (low_user_desc_clear), : "m" (low_user_desc_clear),
[arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear)
: "flags"); : INT80_CLOBBERS);
#ifdef __x86_64__ #ifdef __x86_64__
syscall(SYS_arch_prctl, ARCH_GET_GS, &new_base); syscall(SYS_arch_prctl, ARCH_GET_GS, &new_base);
......
...@@ -58,7 +58,8 @@ static void do_full_int80(struct syscall_args32 *args) ...@@ -58,7 +58,8 @@ static void do_full_int80(struct syscall_args32 *args)
asm volatile ("int $0x80" asm volatile ("int $0x80"
: "+a" (args->nr), : "+a" (args->nr),
"+b" (args->arg0), "+c" (args->arg1), "+d" (args->arg2), "+b" (args->arg0), "+c" (args->arg1), "+d" (args->arg2),
"+S" (args->arg3), "+D" (args->arg4), "+r" (bp)); "+S" (args->arg3), "+D" (args->arg4), "+r" (bp)
: : "r8", "r9", "r10", "r11");
args->arg5 = bp; args->arg5 = bp;
#else #else
sys32_helper(args, int80_and_ret); sys32_helper(args, int80_and_ret);
......
...@@ -56,9 +56,11 @@ static volatile sig_atomic_t sig_traps; ...@@ -56,9 +56,11 @@ static volatile sig_atomic_t sig_traps;
#ifdef __x86_64__ #ifdef __x86_64__
# define REG_IP REG_RIP # define REG_IP REG_RIP
# define WIDTH "q" # define WIDTH "q"
# define INT80_CLOBBERS "r8", "r9", "r10", "r11"
#else #else
# define REG_IP REG_EIP # define REG_IP REG_EIP
# define WIDTH "l" # define WIDTH "l"
# define INT80_CLOBBERS
#endif #endif
static unsigned long get_eflags(void) static unsigned long get_eflags(void)
...@@ -140,7 +142,8 @@ int main() ...@@ -140,7 +142,8 @@ int main()
printf("[RUN]\tSet TF and check int80\n"); printf("[RUN]\tSet TF and check int80\n");
set_eflags(get_eflags() | X86_EFLAGS_TF); set_eflags(get_eflags() | X86_EFLAGS_TF);
asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid)); asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid)
: INT80_CLOBBERS);
check_result(); check_result();
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment