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.47.4.7 retrieving revision 1.49 diff -u -p -r1.47.4.7 -r1.49 --- src/sys/arch/i386/i386/locore.S 2007/10/09 15:22:04 1.47.4.7 +++ src/sys/arch/i386/i386/locore.S 2007/08/16 17:00:05 1.49 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.47.4.7 2007/10/09 15:22:04 ad Exp $ */ +/* $NetBSD: locore.S,v 1.49 2007/08/16 17:00:05 ad Exp $ */ /*- * Copyright (c) 1998, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc. @@ -630,6 +630,47 @@ NENTRY(sigcode) _C_LABEL(esigcode): /* + * void lgdt(struct region_descriptor *rdp); + * + * Load a new GDT pointer (and do any necessary cleanup). + * XXX It's somewhat questionable whether reloading all the segment registers + * is necessary, since the actual descriptor data is not changed except by + * process creation and exit, both of which clean up via task switches. OTOH, + * this only happens at run time when the GDT is resized. + */ +NENTRY(lgdt) + /* Reload the descriptor table. */ + movl 4(%esp),%eax + lgdt (%eax) + /* Flush the prefetch queue. */ + jmp 1f + nop +1: /* Reload "stale" selectors. */ + movl $GSEL(GDATA_SEL, SEL_KPL),%eax + movw %ax,%ds + movw %ax,%es + movw %ax,%gs + movw %ax,%ss + movl $GSEL(GCPU_SEL, SEL_KPL),%eax + movw %ax,%fs + /* Reload code selector by doing intersegment return. */ + popl %eax + pushl $GSEL(GCODE_SEL, SEL_KPL) + pushl %eax + lret + +/* + * void x86_flush() + * + * Flush instruction pipelines by doing an intersegment (far) return. + */ +NENTRY(x86_flush) + popl %eax + pushl $GSEL(GCODE_SEL, SEL_KPL) + pushl %eax + lret + +/* * int setjmp(label_t *) * * Used primarily by DDB. @@ -664,8 +705,7 @@ ENTRY(longjmp) ret /* - * struct lwp *cpu_switchto(struct lwp *oldlwp, struct newlwp, - * bool returning) + * struct lwp *cpu_switchto(struct lwp *oldlwp, struct newlwp) * * 1. if (oldlwp != NULL), save its context. * 2. then, restore context of newlwp. @@ -681,7 +721,6 @@ ENTRY(cpu_switchto) movl 16(%esp),%esi # oldlwp movl 20(%esp),%edi # newlwp - movl 24(%esp),%edx # returning testl %esi,%esi jz 1f @@ -695,13 +734,6 @@ ENTRY(cpu_switchto) movl PCB_EBP(%ebx),%ebp movl PCB_ESP(%ebx),%esp - /* Set curlwp. */ - movl %edi,CPUVAR(CURLWP) - - /* Skip the rest if returning to a pinned LWP. */ - testl %edx,%edx - jnz 4f - /* Switch TSS. Reset "task busy" flag before loading. */ movl %cr3,%eax movl %eax,PCB_CR3(%ebx) # for TSS gates @@ -710,6 +742,9 @@ ENTRY(cpu_switchto) andl $~0x0200,4(%eax,%edx, 1) ltr %dx + /* Set curlwp. */ + movl %edi,CPUVAR(CURLWP) + /* Don't bother with the rest if switching to a system process. */ testl $LW_SYSTEM,L_FLAG(%edi) jnz 4f @@ -902,65 +937,3 @@ NENTRY(npx586bug1) popl %eax ret #endif /* NNPX > 0 */ - -/* - * void sse2_zero_page(void *pg) - * - * Zero a page without polluting the cache. - */ -ENTRY(sse2_zero_page) - pushl %ebp - movl %esp,%ebp - movl 8(%esp), %edx - movl $PAGE_SIZE, %ecx - xorl %eax, %eax - .align 16 -1: - movnti %eax, 0(%edx) - movnti %eax, 4(%edx) - movnti %eax, 8(%edx) - movnti %eax, 12(%edx) - movnti %eax, 16(%edx) - movnti %eax, 20(%edx) - movnti %eax, 24(%edx) - movnti %eax, 28(%edx) - subl $32, %ecx - leal 32(%edx), %edx - jnz 1b - sfence - 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 - sfence - popl %edi - popl %esi - popl %ebx - popl %ebp - ret