diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index d130dc5..5fd5f4d 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -258,12 +258,13 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address, pgprot_t required = __pgprot(0); /* - * The BIOS area between 640k and 1Mb needs to be executable for + * The BIOS area between 896k and 1Mb (ROM) needs to be executable for * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support. */ #ifdef CONFIG_PCI_BIOS - if (within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT)) - pgprot_val(forbidden) |= _PAGE_NX; + if ((__supported_pte_mask & _PAGE_NX) && + within(pfn, 0xe0000 >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT)) + pgprot_val(forbidden) |= _PAGE_NX|_PAGE_RW; #endif /* diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c index 34ccb73..ac35d6f 100644 --- a/arch/x86/pci/pcbios.c +++ b/arch/x86/pci/pcbios.c @@ -11,6 +11,7 @@ #include #include +#define ROM_BEGIN 0xe0000 /* BIOS32 signature: "_32_" */ #define BIOS32_SIGNATURE (('_' << 0) + ('3' << 8) + ('2' << 16) + ('_' << 24)) @@ -301,7 +302,7 @@ static struct pci_raw_ops * __devinit pci_find_bios(void) * 0xe0000 through 0xfffff for a valid BIOS32 structure. */ - for (check = (union bios32 *) __va(0xe0000); + for (check = (union bios32 *) __va(ROM_BEGIN); check <= (union bios32 *) __va(0xffff0); ++check) { long sig; @@ -424,18 +425,20 @@ EXPORT_SYMBOL(pcibios_set_irq_routing); /* according some bios specification * http://members.datafast.net.au/dft0802/specs/bios21.pdf, we could * restrict the x zone to some pages and make it ro. But we - * really don't care, processor with NX support should be able to use - * mmconfig for pci that disable pcibios... + * really don't care, system rom should always be ro and x. */ -static inline void set_bios_x(void) +static inline void set_bios_rox(void) { - set_memory_x(PAGE_OFFSET + BIOS_BEGIN, (BIOS_END - BIOS_BEGIN) >> PAGE_SHIFT); + if (__supported_pte_mask & _PAGE_NX) { + set_memory_ro(PAGE_OFFSET + ROM_BEGIN, (BIOS_END - ROM_BEGIN) >> PAGE_SHIFT); + set_memory_x(PAGE_OFFSET + ROM_BEGIN, (BIOS_END - ROM_BEGIN) >> PAGE_SHIFT); + } } void __init pci_pcbios_init(void) { if (pci_probe & PCI_PROBE_BIOS) { - set_bios_x(); + set_bios_rox(); if ((raw_pci_ops = pci_find_bios())) { pci_bios_present = 1; }