Print this page
de-linting of .s files
m

@@ -28,14 +28,12 @@
 #include <sys/regset.h>
 #include <sys/privregs.h>
 #include <sys/x86_archext.h>
 #include <sys/cpr_wakecode.h>
 
-#if !defined(__lint)
 #include <sys/segments.h>
 #include "assym.h"
-#endif
 
 #ifdef  DEBUG
 #define LED     1
 #define SERIAL  1
 #endif  /*      DEBUG   */

@@ -74,21 +72,10 @@
  *
  *      Our actions:
  *
  */
 
-#if defined(lint) || defined(__lint)
-
-/*ARGSUSED*/
-int
-wc_save_context(wc_cpu_t *pcpu)
-{ return 0; }
-
-#else   /* lint */
-
-#if defined(__amd64)
-
         ENTRY_NP(wc_save_context)
 
         movq    (%rsp), %rdx            / return address
         movq    %rdx, WC_RETADDR(%rdi)
         pushq   %rbp

@@ -172,64 +159,11 @@
 
         ret
 
         SET_SIZE(wc_save_context)
 
-#elif defined(__i386)
 
-        ENTRY_NP(wc_save_context)
-
-        movl    4(%esp), %eax           / wc_cpu_t *
-        movl    %eax, WC_VIRTADDR(%eax)
-
-        movl    (%esp), %edx            / return address
-        movl    %edx, WC_RETADDR(%eax)
-
-        str     WC_TR(%eax)             / stash everything else we need
-        sgdt    WC_GDT(%eax)
-        sldt    WC_LDT(%eax)
-        sidt    WC_IDT(%eax)
-
-        movl    %cr0, %edx
-        movl    %edx, WC_CR0(%eax)
-        movl    %cr3, %edx
-        movl    %edx, WC_CR3(%eax)
-        movl    %cr4, %edx
-        movl    %edx, WC_CR4(%eax)
-
-        movl    %ebx, WC_EBX(%eax)
-        movl    %edi, WC_EDI(%eax)
-        movl    %esi, WC_ESI(%eax)
-        movl    %ebp, WC_EBP(%eax)
-        movl    %esp, WC_ESP(%eax)
-
-        movw    %ss, WC_SS(%eax)
-        movw    %cs, WC_CS(%eax)
-        movw    %ds, WC_DS(%eax)
-        movw    %es, WC_ES(%eax)
-        movw    %fs, WC_FS(%eax)
-        movw    %gs, WC_GS(%eax)
-
-        pushfl
-        popl    WC_EFLAGS(%eax)
-
-        pushl   %gs:CPU_ID              / save current cpu id
-        popl    WC_CPU_ID(%eax)
-
-        wbinvd                          / flush the cache
-        mfence
-
-        movl    $1, %eax                / at suspend return 1
-        ret
-
-        SET_SIZE(wc_save_context)
-
-#endif  /* __amd64 */
-
-#endif /* lint */
-
-
 /*
  *      Our assumptions:
  *              - We are running in real mode.
  *              - Interrupts are disabled.
  *

@@ -242,24 +176,10 @@
  *              - We load the default TSS into the hardware task register.
  *              - We restore registers
  *              - We return to original caller (a la setjmp)
  */
 
-#if defined(lint) || defined(__lint)
-
-void
-wc_rm_start(void)
-{}
-
-void
-wc_rm_end(void)
-{}
-
-#else   /* lint */
-
-#if defined(__amd64)
-
         ENTRY_NP(wc_rm_start)
 
         /*
          * For the Sun Studio 10 assembler we needed to do a .code32 and
          * mentally invert the meaning of the addr16 and data16 prefixes to

@@ -869,301 +789,6 @@
         SET_SIZE(asmspin)
 
         .globl wc_rm_end
 wc_rm_end:
         nop
-
-#elif defined(__i386)
-
-        ENTRY_NP(wc_rm_start)
-
-/entry: jmp             entry                   / stop here for HDT
-
-        cli
-        movw            %cs, %ax
-        movw            %ax, %ds                / establish ds ...
-        movw            %ax, %ss                / ... and ss:esp
-        D16 movl        $WC_STKSTART, %esp
-
-#if     LED
-        D16 movl        $WC_LED, %edx
-        D16 movb        $0xd1, %al
-        outb    (%dx)
-#endif
-
-#if     SERIAL
-        D16 movl        $WC_COM, %edx
-        D16 movb        $0x61, %al
-        outb    (%dx)
-#endif
-
-
-        D16 call        vgainit
-        D16 call        kbdinit
-        D16 call        cominit
-
-#if     LED
-        D16 movl        $WC_LED, %edx
-        D16 movb        $0xd2, %al
-        outb    (%dx)
-#endif
-
-#if     SERIAL
-        D16 movl        $WC_COM, %edx
-        D16 movb        $0x62, %al
-        outb    (%dx)
-#endif
-
-        D16 A16 movl    $WC_CPU, %ebx           / base add of wc_cpu_t
-
-#if     LED
-        D16 movb        $0xd3, %al
-        outb    $WC_LED
-#endif
-
-#if     SERIAL
-        D16 movl        $WC_COM, %edx
-        D16 movb        $0x63, %al
-        outb    (%dx)
-#endif
-
-        D16 A16 movl    %cs:WC_DS(%ebx), %edx   / %ds post prot/paging transit
-
-#if     LED
-        D16 movb        $0xd4, %al
-        outb    $WC_LED
-#endif
-
-        D16 A16 lgdt    %cs:WC_GDT(%ebx)        / restore gdt and idtr
-        D16 A16 lidt    %cs:WC_IDT(%ebx)
-
-#if     LED
-        D16 movb        $0xd5, %al
-        outb    $WC_LED
-#endif
-
-        D16 A16 movl    %cs:WC_CR4(%ebx), %eax  / restore cr4
-        D16 andl        $_BITNOT(CR4_PGE), %eax / don't set Global Enable yet
-        movl            %eax, %cr4
-
-#if     LED
-        D16 movb        $0xd6, %al
-        outb    $WC_LED
-#endif
-
-        D16 A16 movl    %cs:WC_CR3(%ebx), %eax  / set PDPT
-        movl            %eax, %cr3
-
-#if     LED
-        D16 movb        $0xd7, %al
-        outb    $WC_LED
-#endif
-
-        D16 A16 movl    %cs:WC_CR0(%ebx), %eax  / enable prot/paging, etc.
-        movl            %eax, %cr0
-
-#if     LED
-        D16 movb        $0xd8, %al
-        outb    $WC_LED
-#endif
-
-        D16 A16 movl    %cs:WC_VIRTADDR(%ebx), %ebx     / virtaddr of wc_cpu_t
-
-#if     LED
-        D16 movb        $0xd9, %al
-        outb    $WC_LED
-#endif
-
-#if     LED
-        D16 movb        $0xda, %al
-        outb    $WC_LED
-#endif
-
-        jmp             flush                   / flush prefetch queue
-flush:
-        D16 pushl       $KCS_SEL
-        D16 pushl       $kernel_wc_code
-        D16 lret                                / re-appear at kernel_wc_code
-
-
-/*
- * Support routine to re-initialize VGA subsystem
- */
-vgainit:
-        D16 ret
-
-/*
- * Support routine to re-initialize keyboard (which is USB - help!)
- */
-kbdinit:
-        D16 ret
-
-/*
- * Support routine to re-initialize COM ports to something sane for debug output
- */
-cominit:
-#if     DEBUG
-/*
- * on debug kernels we need to initialize COM1 & COM2 here, so that
- * we can get debug output before the asy driver has resumed
- */
-
-/ select COM1
-        D16 movl        $_CONST(COM1+LCR), %edx
-        D16 movb        $DLAB, %al              / divisor latch
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM1+DLL), %edx / divisor latch lsb
-        D16 movb        $B9600L, %al            / divisor latch
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM1+DLH), %edx / divisor latch hsb
-        D16 movb        $B9600H, %al            / divisor latch
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM1+LCR), %edx / select COM1
-        D16 movb        $_CONST(STOP1|BITS8), %al       / 1 stop bit, 8bit word len
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM1+MCR), %edx / select COM1
-        D16 movb        $_CONST(RTS|DTR), %al           / 1 stop bit, 8bit word len
-        outb    (%dx)
-
-/ select COM2
-        D16 movl        $_CONST(COM2+LCR), %edx
-        D16 movb        $DLAB, %al              / divisor latch
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM2+DLL), %edx / divisor latch lsb
-        D16 movb        $B9600L, %al            / divisor latch
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM2+DLH), %edx / divisor latch hsb
-        D16 movb        $B9600H, %al            / divisor latch
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM2+LCR), %edx / select COM1
-        D16 movb        $_CONST(STOP1|BITS8), %al       / 1 stop bit, 8bit word len
-        outb    (%dx)
-
-        D16 movl        $_CONST(COM2+MCR), %edx / select COM1
-        D16 movb        $_CONST(RTS|DTR), %al           / 1 stop bit, 8bit word len
-        outb    (%dx)
-#endif  /*      DEBUG   */
-
-        D16 ret
-
-        .globl wc_rm_end
-wc_rm_end:
-        nop
-
-        .globl  kernel_wc_code
-kernel_wc_code:
-        / At this point we are with kernel's cs and proper eip.
-        / We will be executing not from the copy in real mode platter,
-        / but from the original code where boot loaded us.
-        / By this time GDT and IDT are loaded as is cr0, cr3 and cr4.
-        / %ebx is wc_cpu
-        / %dx is our ds
-
-#if     LED
-        D16 movb        $0xdb, %al
-        outb    $WC_LED
-#endif
-
-/ got here OK
-
-        movw    %dx, %ds                / $KDS_SEL
-
-#if     LED
-        movb    $0xdc, %al
-        outb    $WC_LED
-#endif
-
-        /*
-         * Before proceeding, enable usage of the page table NX bit if
-         * that's how the page tables are set up.
-         */
-        bt      $X86FSET_NX, x86_featureset
-        jnc     1f
-        movl    $MSR_AMD_EFER, %ecx
-        rdmsr
-        orl     $AMD_EFER_NXE, %eax
-        wrmsr
-1:
-
-        movl    WC_CR4(%ebx), %eax      / restore full cr4 (with Global Enable)
-        movl    %eax, %cr4
-
-
-        lldt    WC_LDT(%ebx)            / $LDT_SEL
-
-        movzwl  WC_TR(%ebx), %eax       / clear TSS busy bit
-        addl    WC_GDT+2(%ebx), %eax
-        andl    $_BITNOT(0x200), 4(%eax)
-        ltr     WC_TR(%ebx)             / $UTSS_SEL
-
-        movw    WC_SS(%ebx), %ss        / restore segment registers
-        movw    WC_ES(%ebx), %es
-        movw    WC_FS(%ebx), %fs
-        movw    WC_GS(%ebx), %gs
-
-        /*
-         * set the stack pointer to point into the identity mapped page
-         * temporarily, so we can make function calls
-         */
-        .globl  rm_platter_va
-        movl    rm_platter_va, %eax
-        movl    $WC_STKSTART, %esp
-        addl    %eax, %esp
-        movl    %esp, %ebp
-
-        /*
-         * if we are not running on the boot CPU restore stack contents by
-         * calling i_cpr_restore_stack(curthread, save_stack);
-         */
-        call    i_cpr_bootcpuid
-        cmpl    %eax, WC_CPU_ID(%ebx)
-        je      2f
-
-        pushl   WC_SAVED_STACK(%ebx)
-        pushl   %gs:CPU_THREAD
-        call    i_cpr_restore_stack
-        addl    $0x10, %esp
-2:
-
-        movl    WC_ESP(%ebx), %esp
-        movl    %esp, %ebp
-
-        movl    WC_RETADDR(%ebx), %eax  / return to caller of wc_save_context
-        movl    %eax, (%esp)
-
-        /*
-         * APIC initialization, skip iff function pointer is NULL
-         */
-        cmpl    $0, ap_mlsetup
-        je      3f
-        call    *ap_mlsetup
-3:
-
-        call    *cpr_start_cpu_func
-
-        pushl   WC_EFLAGS(%ebx)         / restore flags
-        popfl
-
-        movl    WC_EDI(%ebx), %edi      / restore general registers
-        movl    WC_ESI(%ebx), %esi
-        movl    WC_EBP(%ebx), %ebp
-        movl    WC_EBX(%ebx), %ebx
-
-/exit:  jmp     exit                    / stop here for HDT
-
-        xorl    %eax, %eax              / at wakeup return 0
-        ret
-
-        SET_SIZE(wc_rm_start)
-
-
-#endif  /* defined(__amd64) */
-
-#endif /* lint */