diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-01-21 22:34:01 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-01-21 22:34:01 +0000 |
commit | 9e30c3705aed9fbec4c3304570e4d6e707856bcb (patch) | |
tree | b19e6acb5a67af31a4e7742e05c2166dc3f1444c /arch/i386 | |
parent | 72919904796333a20c6a5d5c380091b42e407aa9 (diff) |
Merge with Linux 2.3.22.
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/Makefile | 12 | ||||
-rw-r--r-- | arch/i386/boot/bootsect.S | 4 | ||||
-rw-r--r-- | arch/i386/boot/setup.S | 6 | ||||
-rw-r--r-- | arch/i386/config.in | 138 | ||||
-rw-r--r-- | arch/i386/defconfig | 2 | ||||
-rw-r--r-- | arch/i386/kernel/entry.S | 3 | ||||
-rw-r--r-- | arch/i386/kernel/pci-pc.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/ptrace.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/setup.c | 157 | ||||
-rw-r--r-- | arch/i386/mm/init.c | 59 |
10 files changed, 199 insertions, 186 deletions
diff --git a/arch/i386/Makefile b/arch/i386/Makefile index e13adc089..9978cac9d 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile @@ -17,7 +17,6 @@ # LD=$(CROSS_COMPILE)ld -m elf_i386 -CPP=$(CC) -E OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S LDFLAGS=-e stext LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinux.lds $(LDFLAGS) @@ -58,6 +57,12 @@ CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null >/dev/null AFLAGS := $(AFLAGS) -DCPU=686 endif +ifdef CONFIG_MK7 +CFLAGS := $(CFLAGS) -DCPU=686 -march=pentiumpro -mpentiumpro -malign-functions=4 -fschedule-insns2 -mwide-multiply -fexpensive-optimizations +CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i686"; fi) +AFLAGS := $(AFLAGS) -DCPU=686 +endif + HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o SUBDIRS := $(SUBDIRS) arch/i386/kernel arch/i386/mm arch/i386/lib @@ -80,10 +85,13 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot vmlinux: arch/i386/vmlinux.lds arch/i386/vmlinux.lds: arch/i386/vmlinux.lds.S FORCE - gcc -E -C -P -I$(HPATH) -imacros $(HPATH)/asm-i386/page_offset.h -Ui386 arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds + $(CPP) -C -P -imacros $(HPATH)/asm-i386/page_offset.h -Ui386 arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds FORCE: ; +.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ + clean archclean archmrproper archdep + zImage: vmlinux @$(MAKEBOOT) zImage diff --git a/arch/i386/boot/bootsect.S b/arch/i386/boot/bootsect.S index ffddb4327..e7327e1e1 100644 --- a/arch/i386/boot/bootsect.S +++ b/arch/i386/boot/bootsect.S @@ -247,7 +247,7 @@ die: jne die # es must be at 64kB boundary xorw %bx, %bx # bx is starting address within segment rp_read: #ifdef __BIG_KERNEL__ - lcall bootsect_kludge # in setup.S + .word 0x1eff, 0x0220 # lcall *bootsect_kludge in setup.S #else movw %es, %ax subw $SYSSEG, %ax @@ -401,7 +401,7 @@ kill_motor: pushw %dx movw $0x3f2, %dx xorb %al, %al - outw %al, %dx + outb %al, %dx popw %dx ret diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S index 1a6d6baa8..859c7248b 100644 --- a/arch/i386/boot/setup.S +++ b/arch/i386/boot/setup.S @@ -145,7 +145,7 @@ start_of_setup: #ifdef SAFE_RESET_DISK_CONTROLLER # Reset the disk controller. movw $0x0000, %ax - movb $0x80, $dl + movb $0x80, %dl int $0x13 #endif @@ -400,7 +400,7 @@ is_disk1: subw $DELTA_INITSEG, %ax # aka INITSEG movw %ax, %ds xorw %ax, %ax - movw %ax, 0xa0 # set table length to 0 + movw %ax, (0xa0) # set table length to 0 movb $0xc0, %ah stc int $0x15 # moves feature table to es:bx @@ -496,7 +496,7 @@ done_apm_bios: cmpw $0, %cs:realmode_swtch jz rmodeswtch_normal - call *%cs:realmode_swtch + lcall %cs:realmode_swtch jmp rmodeswtch_end diff --git a/arch/i386/config.in b/arch/i386/config.in index 872822e6c..9d373d1ed 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -19,21 +19,27 @@ choice 'Processor family' \ 486/Cx486 CONFIG_M486 \ 586/K5/5x86/6x86 CONFIG_M586 \ Pentium/K6/TSC CONFIG_M586TSC \ - PPro/6x86MX CONFIG_M686" PPro + PPro/6x86MX CONFIG_M686 \ + Athlon CONFIG_MK7" PPro # # Define implied options from the CPU selection here # if [ "$CONFIG_M386" != "y" ]; then - define_bool CONFIG_X86_WP_WORKS_OK y - define_bool CONFIG_X86_INVLPG y - define_bool CONFIG_X86_BSWAP y - define_bool CONFIG_X86_POPAD_OK y + define_bool CONFIG_X86_WP_WORKS_OK y + define_bool CONFIG_X86_INVLPG y + define_bool CONFIG_X86_BSWAP y + define_bool CONFIG_X86_POPAD_OK y fi if [ "$CONFIG_M686" = "y" -o "$CONFIG_M586TSC" = "y" ]; then - define_bool CONFIG_X86_TSC y + define_bool CONFIG_X86_TSC y fi if [ "$CONFIG_M686" = "y" ]; then - define_bool CONFIG_X86_GOOD_APIC y + define_bool CONFIG_X86_GOOD_APIC y +fi +if [ "$CONFIG_MK7" = "y" ]; then + define_bool CONFIG_X86_TSC y + define_bool CONFIG_X86_GOOD_APIC y + define_bool CONFIG_X86_USE_3DNOW y fi choice 'Maximum Physical Memory' \ @@ -49,8 +55,8 @@ mainmenu_option next_comment comment 'Loadable module support' bool 'Enable loadable module support' CONFIG_MODULES if [ "$CONFIG_MODULES" = "y" ]; then - bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS - bool 'Kernel module loader' CONFIG_KMOD + bool ' Set version information on all module symbols' CONFIG_MODVERSIONS + bool ' Kernel module loader' CONFIG_KMOD fi endmenu @@ -61,28 +67,29 @@ bool 'BIGMEM support' CONFIG_BIGMEM bool 'Networking support' CONFIG_NET bool 'SGI Visual Workstation support' CONFIG_VISWS if [ "$CONFIG_VISWS" = "y" ]; then - define_bool CONFIG_X86_VISWS_APIC y - define_bool CONFIG_X86_LOCAL_APIC y - define_bool CONFIG_PCI y + define_bool CONFIG_X86_VISWS_APIC y + define_bool CONFIG_X86_LOCAL_APIC y + define_bool CONFIG_PCI y else - if [ "$CONFIG_SMP" = "y" ]; then - define_bool CONFIG_X86_IO_APIC y - define_bool CONFIG_X86_LOCAL_APIC y - fi - bool 'PCI support' CONFIG_PCI - if [ "$CONFIG_PCI" = "y" ]; then - choice 'PCI access mode' \ + if [ "$CONFIG_SMP" = "y" ]; then + define_bool CONFIG_X86_IO_APIC y + define_bool CONFIG_X86_LOCAL_APIC y + fi + bool 'PCI support' CONFIG_PCI + if [ "$CONFIG_PCI" = "y" ]; then + choice ' PCI access mode' \ "BIOS CONFIG_PCI_GOBIOS \ Direct CONFIG_PCI_GODIRECT \ Any CONFIG_PCI_GOANY" Any - if [ "$CONFIG_PCI_GOBIOS" = "y" -o "$CONFIG_PCI_GOANY" = "y" ]; then - define_bool CONFIG_PCI_BIOS y - fi - if [ "$CONFIG_PCI_GODIRECT" = "y" -o "$CONFIG_PCI_GOANY" = "y" ]; then - define_bool CONFIG_PCI_DIRECT y - fi - fi - bool 'MCA support' CONFIG_MCA + if [ "$CONFIG_PCI_GOBIOS" = "y" -o "$CONFIG_PCI_GOANY" = "y" ]; then + define_bool CONFIG_PCI_BIOS y + fi + if [ "$CONFIG_PCI_GODIRECT" = "y" -o "$CONFIG_PCI_GOANY" = "y" ]; then + define_bool CONFIG_PCI_DIRECT y + fi + fi + bool 'MCA support' CONFIG_MCA + fi source drivers/pcmcia/Config.in @@ -96,17 +103,17 @@ tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC source drivers/parport/Config.in -tristate 'Advanced Power Management BIOS support' CONFIG_APM +bool 'Advanced Power Management BIOS support' CONFIG_APM if [ "$CONFIG_APM" != "n" ]; then - bool ' Ignore USER SUSPEND' CONFIG_APM_IGNORE_USER_SUSPEND - bool ' Enable PM at boot time' CONFIG_APM_DO_ENABLE - bool ' Make CPU Idle calls when idle' CONFIG_APM_CPU_IDLE - bool ' Enable console blanking using APM' CONFIG_APM_DISPLAY_BLANK - bool ' Power off on shutdown' CONFIG_APM_POWER_OFF - bool ' Ignore multiple suspend' CONFIG_APM_IGNORE_MULTIPLE_SUSPEND - bool ' Ignore multiple suspend/resume cycles' CONFIG_APM_IGNORE_SUSPEND_BOUNCE - bool ' RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT - bool ' Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS + bool ' Ignore USER SUSPEND' CONFIG_APM_IGNORE_USER_SUSPEND + bool ' Enable PM at boot time' CONFIG_APM_DO_ENABLE + bool ' Make CPU Idle calls when idle' CONFIG_APM_CPU_IDLE + bool ' Enable console blanking using APM' CONFIG_APM_DISPLAY_BLANK + bool ' Power off on shutdown' CONFIG_APM_POWER_OFF + bool ' Ignore multiple suspend' CONFIG_APM_IGNORE_MULTIPLE_SUSPEND + bool ' Ignore multiple suspend/resume cycles' CONFIG_APM_IGNORE_SUSPEND_BOUNCE + bool ' RTC stores time in GMT' CONFIG_APM_RTC_IS_GMT + bool ' Allow interrupts during APM BIOS calls' CONFIG_APM_ALLOW_INTS fi endmenu @@ -118,7 +125,7 @@ source drivers/pnp/Config.in source drivers/block/Config.in if [ "$CONFIG_NET" = "y" ]; then - source net/Config.in + source net/Config.in fi mainmenu_option next_comment @@ -127,22 +134,22 @@ comment 'SCSI support' tristate 'SCSI support' CONFIG_SCSI if [ "$CONFIG_SCSI" != "n" ]; then - source drivers/scsi/Config.in + source drivers/scsi/Config.in fi endmenu if [ "$CONFIG_NET" = "y" ]; then - mainmenu_option next_comment - comment 'Network device support' - - bool 'Network device support' CONFIG_NETDEVICES - if [ "$CONFIG_NETDEVICES" = "y" ]; then - source drivers/net/Config.in - if [ "$CONFIG_ATM" = "y" ]; then - source drivers/atm/Config.in - fi - fi - endmenu + mainmenu_option next_comment + comment 'Network device support' + + bool 'Network device support' CONFIG_NETDEVICES + if [ "$CONFIG_NETDEVICES" = "y" ]; then + source drivers/net/Config.in + if [ "$CONFIG_ATM" = "y" ]; then + source drivers/atm/Config.in + fi + fi + endmenu fi source net/ax25/Config.in @@ -152,10 +159,10 @@ source net/irda/Config.in mainmenu_option next_comment comment 'ISDN subsystem' if [ "$CONFIG_NET" != "n" ]; then - tristate 'ISDN support' CONFIG_ISDN - if [ "$CONFIG_ISDN" != "n" ]; then - source drivers/isdn/Config.in - fi + tristate 'ISDN support' CONFIG_ISDN + if [ "$CONFIG_ISDN" != "n" ]; then + source drivers/isdn/Config.in + fi fi endmenu @@ -164,7 +171,7 @@ comment 'Old CD-ROM drivers (not SCSI, not IDE)' bool 'Support non-SCSI/IDE/ATAPI CDROM drives' CONFIG_CD_NO_IDESCSI if [ "$CONFIG_CD_NO_IDESCSI" != "n" ]; then - source drivers/cdrom/Config.in + source drivers/cdrom/Config.in fi endmenu @@ -177,15 +184,15 @@ source drivers/misc/Config.in source fs/Config.in if [ "$CONFIG_VT" = "y" ]; then - mainmenu_option next_comment - comment 'Console drivers' - bool 'VGA text console' CONFIG_VGA_CONSOLE - bool 'Video mode selection support' CONFIG_VIDEO_SELECT - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE - source drivers/video/Config.in - fi - endmenu + mainmenu_option next_comment + comment 'Console drivers' + bool 'VGA text console' CONFIG_VGA_CONSOLE + bool 'Video mode selection support' CONFIG_VIDEO_SELECT + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE + source drivers/video/Config.in + fi + endmenu fi mainmenu_option next_comment @@ -193,7 +200,7 @@ comment 'Sound' tristate 'Sound card support' CONFIG_SOUND if [ "$CONFIG_SOUND" != "n" ]; then - source drivers/sound/Config.in + source drivers/sound/Config.in fi endmenu @@ -203,4 +210,3 @@ comment 'Kernel hacking' #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ endmenu - diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 4523a6c7e..49137cda4 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -17,6 +17,7 @@ CONFIG_ISA=y # CONFIG_M586 is not set # CONFIG_M586TSC is not set CONFIG_M686=y +# CONFIG_MK7 is not set CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y @@ -203,6 +204,7 @@ CONFIG_SCSI_CONSTANTS=y # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_NCR53C406A is not set # CONFIG_SCSI_SYM53C416 is not set +# CONFIG_SCSI_SIM710 is not set # CONFIG_SCSI_NCR53C7xx is not set # CONFIG_SCSI_NCR53C8XX is not set CONFIG_SCSI_SYM53C8XX=y diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 4b88dda89..c0cb65324 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -237,8 +237,11 @@ tracesys: movl $-ENOSYS,EAX(%esp) call SYMBOL_NAME(syscall_trace) movl ORIG_EAX(%esp),%eax + cmpl $(NR_syscalls),%eax + jae tracesys_exit call *SYMBOL_NAME(sys_call_table)(,%eax,4) movl %eax,EAX(%esp) # save the return value +tracesys_exit: call SYMBOL_NAME(syscall_trace) jmp ret_from_sys_call badsys: diff --git a/arch/i386/kernel/pci-pc.c b/arch/i386/kernel/pci-pc.c index be3076f30..8ce187d3f 100644 --- a/arch/i386/kernel/pci-pc.c +++ b/arch/i386/kernel/pci-pc.c @@ -120,7 +120,7 @@ static struct pci_ops pci_direct_conf1 = { #define IOADDR(devfn, where) ((0xC000 | ((devfn & 0x78) << 5)) + where) #define FUNC(devfn) (((devfn & 7) << 1) | 0xf0) -#define SET(dev) if (dev->devfn) return PCIBIOS_DEVICE_NOT_FOUND; \ +#define SET(dev) if (dev->devfn & 0x80) return PCIBIOS_DEVICE_NOT_FOUND; \ outb(FUNC(dev->devfn), 0xCF8); \ outb(dev->bus->number, 0xCFA); diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index e86451291..1e6576860 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c @@ -71,8 +71,6 @@ static int putreg(struct task_struct *child, unsigned long regno, unsigned long value) { switch (regno >> 2) { - case ORIG_EAX: - return -EIO; case FS: if (value && (value & 3) != 3) return -EIO; diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 88ba3feeb..734cfca65 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -25,6 +25,10 @@ * * Memory region support * David Parsons <orc@pell.chi.il.us>, July-August 1999 + * + * Cleaned up cache-detection code + * Dave Jones <dave@powertweak.com>, October 1999 + * */ /* @@ -462,7 +466,7 @@ void __init setup_memory_region(void) void __init setup_arch(char **cmdline_p, unsigned long * memory_start_p, unsigned long * memory_end_p) { - unsigned long memory_start, memory_end; + unsigned long high_pfn, max_pfn; char c = ' ', *to = command_line, *from = COMMAND_LINE; int len = 0; int i; @@ -493,7 +497,6 @@ void __init setup_arch(char **cmdline_p, unsigned long * memory_start_p, unsigne if (!MOUNT_ROOT_RDONLY) root_mountflags &= ~MS_RDONLY; - memory_start = (unsigned long) &_end; init_mm.start_code = (unsigned long) &_text; init_mm.end_code = (unsigned long) &_etext; init_mm.end_data = (unsigned long) &_edata; @@ -557,51 +560,53 @@ void __init setup_arch(char **cmdline_p, unsigned long * memory_start_p, unsigne *to = '\0'; *cmdline_p = command_line; -#define VMALLOC_RESERVE (128 << 20) /* 128MB for vmalloc and initrd */ -#define MAXMEM ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE)) - - memory_end = 0; + /* Find the highest page frame number we have available */ + max_pfn = 0; for (i=0; i < e820.nr_map; i++) { /* RAM? */ if (e820.map[i].type == E820_RAM) { - unsigned long end = e820.map[i].addr + e820.map[i].size; + unsigned long end_pfn = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; - if (end > memory_end) - memory_end = end; + if (end_pfn > max_pfn) + max_pfn = end_pfn; } } - memory_end &= PAGE_MASK; - ram_resources[1].end = memory_end-1; +/* + * We can only allocate a limited amount of direct-mapped memory + */ +#define VMALLOC_RESERVE (128 << 20) /* 128MB for vmalloc and initrd */ +#define MAXMEM ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE)) +#define MAXMEM_PFN (MAXMEM >> PAGE_SHIFT) + + high_pfn = MAXMEM_PFN; + if (max_pfn < high_pfn) + high_pfn = max_pfn; + +/* + * But the bigmem stuff may be able to use more of it + * (but currently only up to about 4GB) + */ #ifdef CONFIG_BIGMEM - bigmem_start = bigmem_end = memory_end; -#endif - if (memory_end > MAXMEM) - { -#ifdef CONFIG_BIGMEM -#define MAXBIGMEM ((unsigned long)(~(VMALLOC_RESERVE-1))) - bigmem_start = MAXMEM; - bigmem_end = (memory_end < MAXBIGMEM) ? memory_end : MAXBIGMEM; -#endif - memory_end = MAXMEM; -#ifdef CONFIG_BIGMEM - printk(KERN_NOTICE "%ldMB BIGMEM available.\n", - (bigmem_end-bigmem_start)>>20); -#else - printk(KERN_WARNING "Warning only %ldMB will be used.\n", - MAXMEM>>20); + #define MAXBIGMEM ((unsigned long)(~(VMALLOC_RESERVE-1))) + #define MAXBIGMEM_PFN (MAXBIGMEM >> PAGE_SHIFT) + if (max_pfn > MAX_PFN) + max_pfn = MAX_PFN; + +/* When debugging, make half of "normal" memory be BIGMEM memory instead */ +#ifdef BIGMEM_DEBUG + high_pfn >>= 1; #endif - } -#if defined(CONFIG_BIGMEM) && defined(BIGMEM_DEBUG) - else { - memory_end -= memory_end/4; - bigmem_start = memory_end; - } + + bigmem_start = high_pfn << PAGE_SHIFT; + bigmem_end = max_pfn << PAGE_SHIFT; + printk(KERN_NOTICE "%ldMB BIGMEM available.\n", (bigmem_end-bigmem_start) >> 20); #endif - memory_end += PAGE_OFFSET; - *memory_start_p = memory_start; - *memory_end_p = memory_end; + ram_resources[1].end = (high_pfn << PAGE_SHIFT)-1; + + *memory_start_p = (unsigned long) &_end; + *memory_end_p = PAGE_OFFSET + (high_pfn << PAGE_SHIFT); #ifdef __SMP__ /* @@ -876,6 +881,15 @@ static void __init cyrix_model(struct cpuinfo_x86 *c) * on the MediaGX. So we turn it off for now. */ +#ifdef CONFIG_PCI + /* It isnt really a PCI quirk directly, but the cure is the + same. The MediaGX has deep magic SMM stuff that handles the + SB emulation. It thows away the fifo on disable_dma() which + is wrong and ruins the audio. */ + + printk(KERN_INFO "Working around Cyrix MediaGX virtual DMA bug.\n"); + isa_dma_bridge_buggy = 1; +#endif /* GXm supports extended cpuid levels 'ala' AMD */ if (c->cpuid_level == 2) { get_model_name(c); /* get CPU marketing name */ @@ -888,15 +902,6 @@ static void __init cyrix_model(struct cpuinfo_x86 *c) c->x86_model = (dir1 & 0x20) ? 1 : 2; c->x86_capability&=~X86_FEATURE_TSC; } -#ifdef CONFIG_PCI - /* It isnt really a PCI quirk directly, but the cure is the - same. The MediaGX has deep magic SMM stuff that handles the - SB emulation. It thows away the fifo on disable_dma() which - is wrong and ruins the audio. */ - - printk(KERN_INFO "Working around Cyrix MediaGX virtual DMA bug.\n"); - isa_dma_bridge_buggy = 1; -#endif break; case 5: /* 6x86MX/M II */ @@ -1129,49 +1134,47 @@ void __init identify_cpu(struct cpuinfo_x86 *c) } } - for (i = 0; i < sizeof(cpu_models)/sizeof(struct cpu_model_info); i++) { - if (c->cpuid_level > 1) { - /* supports eax=2 call */ - int edx, cache_size, dummy; - - cpuid(2, &dummy, &dummy, &dummy, &edx); + if (c->cpuid_level > 1) { + /* supports eax=2 call */ + int edx, dummy; - /* We need only the LSB */ - edx &= 0xff; + cpuid(2, &dummy, &dummy, &dummy, &edx); - switch (edx) { - case 0x40: - cache_size = 0; - break; + /* We need only the LSB */ + edx &= 0xff; - case 0x41: - cache_size = 128; - break; + switch (edx) { + case 0x40: + c->x86_cache_size = 0; + break; - case 0x42: - cache_size = 256; - break; + case 0x41: + c->x86_cache_size = 128; + break; - case 0x43: - cache_size = 512; - break; + case 0x42: + c->x86_cache_size = 256; + break; - case 0x44: - cache_size = 1024; - break; + case 0x43: + c->x86_cache_size = 512; + break; - case 0x45: - cache_size = 2048; - break; + case 0x44: + c->x86_cache_size = 1024; + break; - default: - cache_size = 0; - break; - } + case 0x45: + c->x86_cache_size = 2048; + break; - c->x86_cache_size = cache_size; + default: + c->x86_cache_size = 0; + break; } + } + for (i = 0; i < sizeof(cpu_models)/sizeof(struct cpu_model_info); i++) { if (cpu_models[i].vendor == c->x86_vendor && cpu_models[i].x86 == c->x86) { if (c->x86_model <= 16) diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 05684997f..b1140f892 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -367,6 +367,22 @@ void __init test_wp_bit(void) printk(".\n"); } +static void __init mem_init_region(unsigned long pfn, unsigned long count, unsigned long start_mem_pfn) +{ + printk("memory region: %luk @ %08lx000\n", count << 2, pfn); + + do { + if (pfn >= max_mapnr) + break; + + /* Avoid the kernel mapping between HIGH_MEMORY and "start_mem".. */ + if (pfn < (HIGH_MEMORY >> PAGE_SHIFT) || pfn >= start_mem_pfn) + clear_bit(PG_reserved, &mem_map[pfn].flags); + + pfn++; + } while (--count > 0); +} + void __init mem_init(unsigned long start_mem, unsigned long end_mem) { unsigned long start_low_mem = PAGE_SIZE; @@ -412,45 +428,22 @@ void __init mem_init(unsigned long start_mem, unsigned long end_mem) /* walk the whitelist, unreserving good memory */ for (avail = i = 0; i < e820.nr_map; i++) { - unsigned long addr, end, size; + unsigned long start_pfn, end_pfn; if (e820.map[i].type != E820_RAM) /* not usable memory */ continue; - addr = e820.map[i].addr; - size = e820.map[i].size; - /* Silently ignore memory regions starting above 4gb */ - if (addr != e820.map[i].addr) + start_pfn = (e820.map[i].addr + PAGE_SIZE - 1) >> PAGE_SHIFT; + end_pfn = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; + + /* We have a certain amount of low memory reserved */ + if (start_pfn < MAP_NR(start_low_mem)) + start_pfn = MAP_NR(start_low_mem); + + if (end_pfn <= start_pfn) continue; - printk("memory region: %luk @ %08lx\n", size >> 10, addr ); - - /* Make sure we don't get fractional pages */ - end = PAGE_OFFSET + ((addr + size) & PAGE_MASK); - addr= PAGE_OFFSET + PAGE_ALIGN(addr); - - for ( ; addr < end; addr += PAGE_SIZE) { - - /* this little bit of grossness is for dealing - * with memory borrowing for system bookkeeping - * (smp stacks, zero page, kernel code, etc) - * without having to go back and edit the e820 - * map to compensate. - * - * if we're in low memory (<1024k), we need to - * avoid the smp stack and zero page. - * if we're in high memory, we need to avoid - * the kernel code. - * in any case, we don't want to hack mem_map - * entries above end_mem. - */ - if ( (addr < start_low_mem) - || (addr >= (HIGH_MEMORY + PAGE_OFFSET)&& addr <= start_mem) - || (addr > end_mem) ) - continue; - - clear_bit(PG_reserved, &mem_map[MAP_NR(addr)].flags); - } + mem_init_region(start_pfn, end_pfn - start_pfn, MAP_NR(start_mem)); } for (tmp = PAGE_OFFSET ; tmp < end_mem ; tmp += PAGE_SIZE) { |