Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.70 retrieving revision 1.76 diff -u -p -r1.70 -r1.76 --- src/sys/arch/i386/i386/locore.S 2008/04/29 18:27:18 1.70 +++ src/sys/arch/i386/i386/locore.S 2008/06/02 14:41:41 1.76 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.70 2008/04/29 18:27:18 ad Exp $ */ +/* $NetBSD: locore.S,v 1.76 2008/06/02 14:41:41 ad Exp $ */ /* * Copyright-o-rama! @@ -134,7 +134,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.70 2008/04/29 18:27:18 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.76 2008/06/02 14:41:41 ad Exp $"); #include "opt_compat_oldboot.h" #include "opt_ddb.h" @@ -204,7 +204,9 @@ __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1 .data .globl _C_LABEL(cpu) + .globl _C_LABEL(cpuid_level) .globl _C_LABEL(esym) + .globl _C_LABEL(eblob) .globl _C_LABEL(atdevbase) .globl _C_LABEL(proc0uarea),_C_LABEL(PDPpaddr) .globl _C_LABEL(gdt) @@ -235,6 +237,7 @@ _C_LABEL(lapic_tpr): #endif _C_LABEL(cpu): .long 0 # are we 80486, Pentium, or.. +_C_LABEL(cpuid_level): .long 0 _C_LABEL(atdevbase): .long 0 # location of start of iomem in virtual _C_LABEL(proc0uarea): .long 0 _C_LABEL(PDPpaddr): .long 0 # paddr of PDP, for libkvm @@ -308,7 +311,7 @@ _C_LABEL(Multiboot_Header): movw %ax,%fs movw %ax,%gs decl %eax - movl %eax,RELOC(cpu_info_primary)+CPU_INFO_LEVEL + movl %eax,RELOC(cpuid_level) /* Find out our CPU type. */ @@ -468,7 +471,7 @@ trycyrix486: try586: /* Use the `cpuid' instruction. */ xorl %eax,%eax cpuid - movl %eax,RELOC(cpu_info_primary)+CPU_INFO_LEVEL + movl %eax,RELOC(cpuid_level) 2: /* @@ -488,8 +491,8 @@ try586: /* Use the `cpuid' instruction. /* * Virtual address space of kernel: * - * text | data | bss | [syms] | page dir | proc0 kstack | L1 ptp - * 0 1 2 3 + * text | data | bss | [syms] | [blobs] | page dir | proc0 kstack | L1 ptp + * 0 1 2 3 */ #define PROC0_PDIR_OFF 0 @@ -512,6 +515,7 @@ try586: /* Use the `cpuid' instruction. /* Find end of kernel image. */ movl $RELOC(end),%edi + #if (NKSYMS || defined(DDB) || defined(LKM)) && !defined(SYMTAB_SPACE) /* Save the symbols (if loaded). */ movl RELOC(esym),%eax @@ -522,8 +526,15 @@ try586: /* Use the `cpuid' instruction. 1: #endif + /* Skip over any modules/blobs. */ + movl RELOC(eblob),%eax + testl %eax,%eax + jz 1f + subl $KERNBASE,%eax + movl %eax,%edi +1: /* Compute sizes */ - movl %edi,%esi # edi = esym ? esym : end + movl %edi,%esi addl $PGOFSET,%esi # page align up andl $~PGOFSET,%esi @@ -739,11 +750,11 @@ start: movw %ax,%fs movw %ax,%gs decl %eax - movl %eax,RELOC(cpu_info_primary)+CPU_INFO_LEVEL + movl %eax,RELOC(cpuid_level) xorl %eax,%eax cpuid - movl %eax,RELOC(cpu_info_primary)+CPU_INFO_LEVEL + movl %eax,RELOC(cpuid_level) call xen_pmap_bootstrap /* @@ -796,6 +807,7 @@ NENTRY(lgdt_finish) pushl $GSEL(GCODE_SEL, SEL_KPL) pushl %eax lret +END(lgdt_finish) #endif /* XEN */ @@ -820,6 +832,7 @@ NENTRY(lwp_trampoline) addl $4,%esp jmp .Lsyscall_checkast /* NOTREACHED */ +END(lwp_trampoline) /* * sigcode() @@ -841,6 +854,7 @@ NENTRY(sigcode) int $0x80 # exit if sigreturn fails .globl _C_LABEL(esigcode) _C_LABEL(esigcode): +END(sigcode) /* * int setjmp(label_t *) @@ -858,6 +872,7 @@ ENTRY(setjmp) movl %edx,20(%eax) # save eip xorl %eax,%eax # return 0 ret +END(setjmp) /* * int longjmp(label_t *) @@ -875,6 +890,7 @@ ENTRY(longjmp) movl %edx,(%esp) # put in return frame movl $1,%eax # return 1 ret +END(longjmp) /* * void dumpsys(void) @@ -890,6 +906,7 @@ ENTRY(dumpsys) call _C_LABEL(dodumpsys) # dump! addl $(3*4), %esp # unwind switchframe ret +END(dumpsys) /* * struct lwp *cpu_switchto(struct lwp *oldlwp, struct newlwp, @@ -910,10 +927,11 @@ ENTRY(cpu_switchto) #if defined(DIAGNOSTIC) && !defined(XEN) cmpl $IPL_SCHED,CPUVAR(ILEVEL) jbe 0f + pushl CPUVAR(ILEVEL) pushl $.Lstr call _C_LABEL(panic) - addl $4,%esp -.Lstr: .string "cpu_switcho: switching above IPL_SCHED\0" + addl $8,%esp +.Lstr: .string "cpu_switchto: switching above IPL_SCHED (%d)\0" 0: #endif @@ -1040,6 +1058,7 @@ ENTRY(cpu_switchto) popl %esi movl $((CPU_INFO_IOMAP - CPU_INFO_TSS) << 16),CPUVAR(IOBASE) jmp .Liobitmap_done +END(cpu_switchto) /* * void savectx(struct pcb *pcb); @@ -1051,6 +1070,7 @@ ENTRY(savectx) movl %esp,PCB_ESP(%edx) movl %ebp,PCB_EBP(%edx) ret +END(savectx) /* * osyscall() @@ -1062,6 +1082,7 @@ IDTVEC(osyscall) popl 8(%esp) pushl $7 # size of instruction for restart jmp syscall1 +IDTVEC_END(osyscall) /* * syscall() @@ -1153,6 +1174,7 @@ syscall1: call _C_LABEL(trap) addl $4,%esp jmp .Lsyscall_checkast /* re-check ASTs */ +IDTVEC_END(syscall) #if NNPX > 0 /* @@ -1175,6 +1197,7 @@ NENTRY(probeintr) outb %al,$0xf0 # clear BUSY# latch popl %eax iret +END(probeintr) /* * void probetrap(void) @@ -1184,6 +1207,7 @@ NENTRY(probetrap) incl _C_LABEL(npx_traps_while_probing) fnclex iret +END(probetrap) /* * int npx586bug1(int a, int b) @@ -1199,21 +1223,25 @@ NENTRY(npx586bug1) fistpl (%esp) popl %eax ret +END(npx586bug1) #endif /* NNPX > 0 */ /* - * void sse2_zero_page(void *pg) + * void sse2_idlezero_page(void *pg) * - * Zero a page without polluting the cache. + * Zero a page without polluting the cache. Preemption must be + * disabled by the caller. Abort if a preemption is pending. */ -ENTRY(sse2_zero_page) +ENTRY(sse2_idlezero_page) pushl %ebp movl %esp,%ebp movl 8(%esp), %edx - movl $PAGE_SIZE, %ecx + movl $(PAGE_SIZE/32), %ecx xorl %eax, %eax .align 16 1: + cmpl $0, CPUVAR(RESCHED) + jnz 2f movnti %eax, 0(%edx) movnti %eax, 4(%edx) movnti %eax, 8(%edx) @@ -1222,43 +1250,15 @@ ENTRY(sse2_zero_page) movnti %eax, 20(%edx) movnti %eax, 24(%edx) movnti %eax, 28(%edx) - subl $32, %ecx - leal 32(%edx), %edx + addl $32, %edx + decl %ecx jnz 1b sfence + incl %eax pop %ebp ret - -/* - * void sse2_copy_page(void *src, void *dst) - * - * Copy a page without polluting the cache. - */ -ENTRY(sse2_copy_page) - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl 20(%esp), %esi - movl 24(%esp), %edi - movl $PAGE_SIZE, %ebp - .align 16 -1: - movl 0(%esi), %eax - movl 4(%esi), %ebx - movl 8(%esi), %ecx - movl 12(%esi), %edx - movnti %eax, 0(%edi) - movnti %ebx, 4(%edi) - movnti %ecx, 8(%edi) - movnti %edx, 12(%edi) - subl $16, %ebp - leal 16(%esi), %esi - leal 16(%edi), %edi - jnz 1b +2: sfence - popl %edi - popl %esi - popl %ebx popl %ebp ret +END(sse2_idlezero_page)