working version, prior to cleanup
authorBill Joy <bill@ucbvax.Berkeley.EDU>
Fri, 7 Dec 1990 06:20:22 +0000 (22:20 -0800)
committerBill Joy <bill@ucbvax.Berkeley.EDU>
Fri, 7 Dec 1990 06:20:22 +0000 (22:20 -0800)
SCCS-vsn: sys/i386/i386/locore.s 5.7

usr/src/sys/i386/i386/locore.s

index 3f4138f..b5f7a66 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)locore.s    5.6 (Berkeley) %G%
+ *     @(#)locore.s    5.7 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
  *             Written by William F. Jolitz, 386BSD Project
  */
 
  *             Written by William F. Jolitz, 386BSD Project
  */
 
-#include "psl.h"
-#include "pte.h"
+#include "machine/psl.h"
+#include "machine/pte.h"
 
 #include "errno.h"
 #include "cmap.h"
 
 
 #include "errno.h"
 #include "cmap.h"
 
-#include "../i386/trap.h"
+#include "machine/trap.h"
 
 /*
  * Note: This version greatly munged to avoid various assembler errors
 
 /*
  * Note: This version greatly munged to avoid various assembler errors
@@ -206,6 +206,7 @@ start:                              # This is assumed to be location zero!
        rep
        stosb
 
        rep
        stosb
 
+#ifdef notdef
        /* pass parameters on stack (howto, bootdev, unit, cyloffset) */
 
        movl    4(%esp),%eax
        /* pass parameters on stack (howto, bootdev, unit, cyloffset) */
 
        movl    4(%esp),%eax
@@ -215,7 +216,6 @@ start:                              # This is assumed to be location zero!
        movl    12(%esp),%eax
        movl    %eax, _cyloffset-SYSTEM
 
        movl    12(%esp),%eax
        movl    %eax, _cyloffset-SYSTEM
 
-#ifdef notdef
 
        movl    $0x36000,%edi
        movl    $0x68000,%ecx
 
        movl    $0x36000,%edi
        movl    $0x68000,%ecx
@@ -361,11 +361,6 @@ begin:
        movl    %ecx,PCB_P1BR(%eax)     # p1br: P1PAGES from end of PT
        movl    $ P1PAGES-UPAGES,PCB_P1LR(%eax) # p1lr: vax style
        movl    $ CLSIZE,PCB_SZPT(%eax) # page table size
        movl    %ecx,PCB_P1BR(%eax)     # p1br: P1PAGES from end of PT
        movl    $ P1PAGES-UPAGES,PCB_P1LR(%eax) # p1lr: vax style
        movl    $ CLSIZE,PCB_SZPT(%eax) # page table size
-       # fninit
-       # pushl $0x262
-       # fldcw 0(%esp)
-       # popl  %ecx
-       # fnsave        PCB_SAVEFPU(%eax)
        movl    %edi,PCB_CR3(%eax)
        pushl   %edi    # cr3
        movl    %esi,%eax
        movl    %edi,PCB_CR3(%eax)
        pushl   %edi    # cr3
        movl    %esi,%eax
@@ -434,7 +429,7 @@ _icode:
        pushl   %eax    # dummy out rta
        LCALL(0x7,0x0)
 
        pushl   %eax    # dummy out rta
        LCALL(0x7,0x0)
 
-init:  .asciz  "/etc/init"
+init:  .asciz  "/sbin/init"
        .align  2
 _initflags:
        .long   0
        .align  2
 _initflags:
        .long   0
@@ -948,8 +943,8 @@ badsw:
  * Swtch()
  */
 ENTRY(swtch)
  * Swtch()
  */
 ENTRY(swtch)
-       movl    _cpl,%eax
-       movl    %eax,_u+PCB_IML
+       movw    _cpl, %ax
+       movw    %ax, _u+PCB_IML
        movl    $1,%eax
        movl    %eax,_noproc
        incl    _cnt+V_SWTCH
        movl    $1,%eax
        movl    %eax,_noproc
        incl    _cnt+V_SWTCH
@@ -991,16 +986,14 @@ sw2:
        movl    P_ADDR(%ecx),%edx
        movl    (%edx),%eax
        movl    %eax,_Swtchmap
        movl    P_ADDR(%ecx),%edx
        movl    (%edx),%eax
        movl    %eax,_Swtchmap
-       movl    4(%edx),%eax
-       movl    %eax,_Swtchmap+4
+       # movl  4(%edx),%eax
+       # movl  %eax,_Swtchmap+4
        # movl  %cr3,%eax
        # movl  %cr3,%eax
-       # orl   $ I386_CR3PAT,%eax
        # movl  %eax,%cr3
        movl    _Swtchbase+PCB_CR3,%edx
 
        # movl  %eax,%cr3
        movl    _Swtchbase+PCB_CR3,%edx
 
- # pushal; pushl %edx ; pushl P_CR3(%ecx); pushl $l2; call _pg; popl %eax ; popl %eax; popl %eax ; popal ; .data ; l2: .asciz "s %x %x " ; .text
-
 /* switch to new process. first, save context as needed */
 /* switch to new process. first, save context as needed */
+
        movl    $_u,%ecx
 
        movl    (%esp),%eax             # Hardware registers
        movl    $_u,%ecx
 
        movl    (%esp),%eax             # Hardware registers
@@ -1020,9 +1013,6 @@ sw2:
        movl    %edx,%cr3       # context switch
 
        movl    $_u,%ecx
        movl    %edx,%cr3       # context switch
 
        movl    $_u,%ecx
-       # .globl        __gsel_tss
-       # movw  __gsel_tss,%ax
-       # ltr   %ax
 
 /* restore context */
        movl    PCB_EBX(%ecx), %ebx
 
 /* restore context */
        movl    PCB_EBX(%ecx), %ebx
@@ -1042,9 +1032,10 @@ sw2:
        cmpl    $0,PCB_SSWAP(%ecx)      # do an alternate return?
        jne     res3                    # yes, go reload regs
 
        cmpl    $0,PCB_SSWAP(%ecx)      # do an alternate return?
        jne     res3                    # yes, go reload regs
 
-       pushl   PCB_IML(%ecx)
-       call    _splx
-       popl    %eax
+       # pushl PCB_IML(%ecx)
+       # call  _splx
+       # popl  %eax
+       call _spl0
        movl    $0,%eax
        ret
 
        movl    $0,%eax
        ret
 
@@ -1052,8 +1043,6 @@ res3:
        xorl    %eax,%eax               # inline restore context
        xchgl   PCB_SSWAP(%ecx),%eax    # addr of saved context, clear it
 
        xorl    %eax,%eax               # inline restore context
        xchgl   PCB_SSWAP(%ecx),%eax    # addr of saved context, clear it
 
- #pushal; pushl 20(%eax); pushl $l2; call _printf; popl %eax ; popl %eax; popal ; .data ; l2: .asciz "s %x\n" ; .text
-
        movl     0(%eax),%ebx           # restore ebx
        movl     4(%eax),%esp           # restore esp
        movl     8(%eax),%ebp           # restore ebp
        movl     0(%eax),%ebx           # restore ebx
        movl     4(%eax),%esp           # restore esp
        movl     8(%eax),%ebp           # restore ebp
@@ -1061,7 +1050,12 @@ res3:
        movl    16(%eax),%edi           # restore edi
        movl    20(%eax),%edx           # get rta
        movl    %edx,(%esp)             # put in return frame
        movl    16(%eax),%edi           # restore edi
        movl    20(%eax),%edx           # get rta
        movl    %edx,(%esp)             # put in return frame
-       call    _spl0
+
+       # call  _spl0
+       pushl   _u+PCB_IML
+       call    _splx
+       popl    %eax
+
        xorl    %eax,%eax               # return (1);
        incl    %eax
        ret
        xorl    %eax,%eax               # return (1);
        incl    %eax
        ret
@@ -1074,6 +1068,8 @@ res3:
 ENTRY(resume)
        # movl  4(%esp),%ecx
        movl    $_u,%ecx
 ENTRY(resume)
        # movl  4(%esp),%ecx
        movl    $_u,%ecx
+       movw    _cpl, %ax
+       movw    %ax,  PCB_IML(%ecx)
        movl    (%esp),%eax     
        movl    %eax, PCB_EIP(%ecx)
        movl    %ebx, PCB_EBX(%ecx)
        movl    (%esp),%eax     
        movl    %eax, PCB_EIP(%ecx)
        movl    %ebx, PCB_EBX(%ecx)
@@ -1084,11 +1080,10 @@ ENTRY(resume)
 #ifdef FPUNOTYET
 #endif
        fsave   PCB_SAVEFPU(%ecx)
 #ifdef FPUNOTYET
 #endif
        fsave   PCB_SAVEFPU(%ecx)
-       movl    _cpl,%eax
-       movl    %eax,PCB_IML(%ecx)
        movl    $0,%eax
        ret
 
        movl    $0,%eax
        ret
 
+
 .data
        .globl  _cyloffset
 _cyloffset:    .long   0
 .data
        .globl  _cyloffset
 _cyloffset:    .long   0