## diffname pc/l.s 1991/0614 ## diff -e /dev/null /n/bootesdump/1991/0614/sys/src/9/safari/l.s 0a /* * Boot first processor */ TEXT start(SB),$0 /* clear bss */ CALL main(SB) /* never returns */ TEXT traptab(SB),$0 CALL noerrcode(SB) /* divide */ CALL noerrcode(SB) /* debug */ CALL noerrcode(SB) /* non maskable interrupt */ CALL noerrcode(SB) /* breakpoint */ CALL noerrcode(SB) /* overflow */ CALL noerrcode(SB) /* bounds check */ CALL noerrcode(SB) /* invalid opcode */ CALL noerrcode(SB) /* coprocessor not available */ CALL errcode(SB) /* double fault */ CALL noerrcode(SB) /* coprocessor segment overrun */ CALL errcode(SB) /* invalid tss */ CALL errcode(SB) /* segment not present */ CALL errcode(SB) /* stack exception */ CALL errcode(SB) /* general protection exception */ CALL errcode(SB) /* page fault */ CALL noerrcode(SB) /* coprocessor error */ CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) CALL noerrcode(SB) TEXT noerrcode(SB),$0 PUSH EAX /* drop through */ TEXT errcode(SB),$0 PUSH EAX PUSH EBX PUSH ECX PUSH EDX PUSH EBP PUSH ESI PUSH EDI CALL trap(SB) POP EDI POP ESI POP EBP POP EDX POP ECX POP EBX POP EAX ADD $8,ESP /* jump over error code + return addr */ IRET . ## diffname pc/l.s 1991/0619 ## diff -e /n/bootesdump/1991/0614/sys/src/9/safari/l.s /n/bootesdump/1991/0619/sys/src/9/safari/l.s 292a TEXT trap(SB),$0 RET TEXT main(SB),$0 RET . 284,291c ADDL $4,ESP /* drop trap number */ POPL EDI POPL ESI POPL EBP POPL EDX POPL ECX POPL EBX POPL EAX ADDL $4,ESP /* drop error code */ . 276,282c XCHGL (ESP),EAX /* fall through */ TEXT saveregs(SB),$0 george: PUSHL EBX MOVL $noerrcode(SB),EBX /* calculate trap number */ SUBL EAX,EBX /* ... */ SHRL $1,EBX /* ... */ PUSHL ECX PUSHL EDX PUSHL EBP PUSHL ESI PUSHL EDI PUSHL EBX /* save trap number */ . 273,274c PUSHL EAX MOVL 4(ESP),EAX /* JMP george /**/ . 11a /* * trap vector, each instruction is 4 bytes long */ . 3c * boot first processor . ## diffname pc/l.s 1991/0620 ## diff -e /n/bootesdump/1991/0619/sys/src/9/safari/l.s /n/bootesdump/1991/0620/sys/src/9/safari/l.s 15,31c divtrap: PUSHL $0 PUSHL $0 JMP alltrap debtrap: PUSHL $0 PUSHL $1 JMP alltrap nmitrap: PUSHL $0 PUSHL $2 JMP alltrap bptrap: PUSHL $0 PUSHL $3 JMP alltrap oftrap: PUSHL $0 PUSHL $4 JMP alltrap boundtrap: PUSHL $0 PUSHL $5 JMP alltrap invtrap: PUSHL $0 PUSHL $6 JMP alltrap nocotrap: PUSHL $0 PUSHL $7 JMP alltrap dfault: PUSHL $8 JMP alltrap csotrap: PUSHL $0 PUSHL $9 JMP alltrap tsstrap: PUSHL $0 PUSHL $10 JMP alltrap segtrap: PUSHL $11 JMP alltrap stacktrap: PUSHL $12 JMP alltrap prottrap: PUSHL $13 JMP alltrap pagefault: PUSHL $14 JMP alltrap cetrap: PUSHL $0 PUSHL $15 JMP alltrap . 13c * standard traps . ## diffname pc/l.s 1991/0622 ## diff -e /n/bootesdump/1991/0620/sys/src/9/safari/l.s /n/bootesdump/1991/0622/sys/src/9/safari/l.s 342,355c POPAL IRETL . 323,340c alltrap: PUSHAL . 319,321c PUSHL $0 PUSHL $16 JMP alltrap . 317c TEXT invtrap(SB),$0 . 74,315d 70c TEXT trap15(SB),$0 . 67c TEXT trap14(SB),$0 . 64c TEXT trap13(SB),$0 . 61c TEXT trap12(SB),$0 . 58c TEXT trap11(SB),$0 . 54c TEXT trap10(SB),$0 . 50c TEXT trap9(SB),$0 . 47c TEXT trap8(SB),$0 . 43c TEXT trap7(SB),$0 . 39c TEXT trap6(SB),$0 . 35c TEXT trap5(SB),$0 . 31c TEXT trap4(SB),$0 . 27c TEXT trap3(SB),$0 . 23c TEXT trap2(SB),$0 . 19c TEXT trap1(SB),$0 . 15c TEXT trap0(SB),$0 . 11d 3c * boot processor . ## diffname pc/l.s 1991/0623 ## diff -e /n/bootesdump/1991/0622/sys/src/9/safari/l.s /n/bootesdump/1991/0623/sys/src/9/safari/l.s 118a RET TEXT trap(SB),$0 . 117a /* * stubs */ . 115a ADDL $#8,SP /* pop the trap and error codes */ . 112a . 111a /* * common trap code */ . 108c PUSHL $0 /* put on an error code */ . 105a /* * invalid trap */ . 102c PUSHL $0 /* put on an error code */ . 76c PUSHL $0 /* put on an error code */ . 70c PUSHL $0 /* put on an error code */ . 59c PUSHL $0 /* put on an error code */ . 53c PUSHL $0 /* put on an error code */ . 47c PUSHL $0 /* put on an error code */ . 41c PUSHL $0 /* put on an error code */ . 35c PUSHL $0 /* put on an error code */ . 29c PUSHL $0 /* put on an error code */ . 23c PUSHL $0 /* put on an error code */ . 18d 16a PUSHL $0 /* put on an error code */ . 14d 12c * first 16 ``standard'' traps . ## diffname pc/l.s 1991/0625 ## diff -e /n/bootesdump/1991/0623/sys/src/9/safari/l.s /n/bootesdump/1991/0625/sys/src/9/safari/l.s 124,134d 122c POPL DS ADDL $8,SP /* pop the trap and error codes */ . 119a MOVL $KDSEL, AX MOVW AX, DS . 118a PUSHL DS . 7c CLI /* disable interrupts */ MOVW $NULLSEL,IDTR /* force shutdown on error */ /* point data segment at low memory */ XORL AX,AX MOVW AX,DS /* load gdt address (valid after paging) */ LEAL gdtptr(SB),AX MOVL -KZERO(AX),GDTR . 1a GLOBL gdtptr(SB),$6 DATA gdtptr+0(SB)/2, $(6*8) DATA gdtptr+2(SB)/4, $gdt(SB) . 0a #include "mem.h" . ## diffname pc/l.s 1991/0626 ## diff -e /n/bootesdump/1991/0625/sys/src/9/safari/l.s /n/bootesdump/1991/0626/sys/src/9/safari/l.s 141c /* POPL DS /**/ . 138c /* MOVW AX, DS /**/ . 135c /* PUSHL DS /**/ . 22c /* MOVL (AX),GDTR /**/ . 20c /* point CPU at the interrupt/trap table */ . 18c /* MOVW AX,DS /**/ . 15a /* point CPU at the interrupt/trap table */ LEAL idtptr(SB),AX /* MOVL (AX),IDTR /**/ . 14d 8a * pointer to idt (must be in first 64K of program) */ GLOBL idtptr(SB),$6 DATA idtptr+0(SB)/2, $(6*8) DATA idtptr+2(SB)/4, $idt(SB) /* . 5c DATA gdtptr+0(SB)/2, $(5*8) . 2a /* * pointer to initial gdt (must be in first 64K of program) */ . ## diffname pc/l.s 1991/0627 ## diff -e /n/bootesdump/1991/0626/sys/src/9/safari/l.s /n/bootesdump/1991/0627/sys/src/9/safari/l.s 38c /* point CPU at the global descriptor table */ MOVL gdtptr(SB),GDTR /* switch to protected mode */ MOVL CR0,AX ORL $1,AX MOVL AX,CR0 /* clear prefetch buffer */ JMP flush /* * come here in USE16 protected mode */ flush: /* map data and stack address to physical memory */ MOVW $SELECTOR(1, SELGDT, 0),AX MOVW AX,DS MOVW AX,ES MOVW AX,SS /* switch to 32 bit code */ JMPFAR SELECTOR(2, SELGDT, 0):start32 /* * come here in USE32 protected mode */ TEXT start32(SB),$0 /* clear bss (should use REP) */ MOVL $edata(SB),SI MOVL $edata+4(SB),DI MOVL $end(SB),CX SUBL DI,CX SHRL $2,CX XORL AX,AX MOVL AX,edata(SB) CLD REP MOVSL (SI),(DI) /* set up stack */ MOVL $mach0(SB),AX MOVL A0, m(SB) MOVL $0, 0(A0) MOVL A0, A7 ADDL $(MACHSIZE-4), A7 /* start stack under machine struct */ MOVL $0, u(SB) CALL main(SB),$0 . 34,36c /* point CPU at the interrupt descriptor table */ MOVL tgdt(SB),IDTR . 32c MOVW AX,DS . 26,29d 22,23c start16: . 20c * come here in (16bit) real-address mode . 16,17c WORD $(3*8) LONG $tgdt(SB) . 14c TEXT tgdtptr(SB),$0 . 12c * pointer to initial gdt . 10a /* data segment descriptor for 4 gigabytes (PL 0) */ LONG SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW LONG 0xFFFF /* exec segment descriptor for 4 gigabytes (PL 0) */ LONG SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(p)|SEGEXEC|SEGR LONG 0xFFFF . 8,9c /* null descriptor */ LONG $0 LONG $0 . 6c TEXT tgdt(SB),$0 . 4c * gdt to get us to 32-bit/segmented/unpaged mode . 2a TEXT start(SB),$0 JMP start16 . ## diffname pc/l.s 1991/0628 ## diff -e /n/bootesdump/1991/0627/sys/src/9/safari/l.s /n/bootesdump/1991/0628/sys/src/9/safari/l.s 88,91c MOVL AX, m(SB) MOVL $0, 0(AX) MOVL AX, SP ADDL $(MACHSIZE-4), AX /* start stack under machine struct */ . 67c /* JMPFAR SELECTOR(2, SELGDT, 0):start32 /**/ . 30c LONG tgdt(SB) . 21,22c LONG $(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR) LONG $(0xFFFF) . 17,18c LONG $(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW) LONG $(0xFFFF) . 4d ## diffname pc/l.s 1991/0629 ## diff -e /n/bootesdump/1991/0628/sys/src/9/safari/l.s /n/bootesdump/1991/0629/sys/src/9/safari/l.s 199,212c GLOBL mach0+0(SB), $MACHSIZE GLOBL u(SB), $4 GLOBL m(SB), $4 . 195,197c loop: JMP loop . 193c MOVL $0xb8100,BX MOVB $0x34,AL MOVB AL,(BX) INCW BX MOVB $0x43,AL MOVB AL,(BX) . 191c * print a blue 4 on a red background . 107,189c CALL main(SB) . 105c /* * stack and mach */ MOVL $mach0(SB),SP MOVL SP,m(SB) MOVL $0,0(SP) ADDL $(MACHSIZE-4),SP /* start stack under machine struct */ MOVL $0, u(SB) . 101,103d 99c MOVL $0xb8100,BX MOVB $0x34,AL MOVB AL,(BX) INCW BX MOVB $0x43,AL MOVB AL,(BX) here: JMP here . 97c * print a blue 4 on a red background . 93,95d 85,91d 83c MOVSL . 79,81d 73,76c /* * Clear BSS */ LEAL edata(SB),SI LEAL edata+4(SB),DI MOVL $0,AX MOVL AX,(SI) LEAL end(SB),CX . 71c MOVL $0xb8100,BX MOVB $0x33,AL MOVB AL,(BX) INCW BX MOVB $0x43,AL MOVB AL,(BX) . 69c * print a blue 3 on a red background . 67a TEXT mode32bit(SB),$0 . 65,66c /* JMPFAR* SELECTOR(2, SELGDT, 0):$protected(SB) /**/ BYTE $0xEA WORD $mode32bit(SB) WORD $SELECTOR(2, SELGDT, 0) . 63a MOVW AX,ES . 62d 59,60c /* * set all segs */ /* MOVW $SELECTOR(1, SELGDT, 0),AX /**/ BYTE $0xc7 BYTE $0xc0 WORD $SELECTOR(1, SELGDT, 0) . 57a CLC JCC flush MOVL AX,AX . 56c * clear prefetch queue (wierd code to avoid optimizations) . 52,54d 47c /* * now that we're in low core, update the DS */ MOVL $0,BX MOVW BX,DS /* * goto protected mode */ /* MOVL tgdtptr(SB),GDTR /**/ BYTE $0x0f BYTE $0x01 BYTE $0x16 WORD $tgdtptr(SB) . 44,45c /* * move the next 63K down */ MOVL $0,CX INCL CX SHLL $(15-1),CX SUBL BX,CX SHLL $1,BX MOVL BX,SI MOVL BX,DI REP MOVSL . 41,42c TEXT lowcore(SB),$0 . 37,39c /* * move the first 1k bytes down to low core and jump to them * - looks wierd because it is being assembled by a 32 bit * assembler for a 16 bit world */ MOVL $0,BX INCL BX SHLL $(10-1),BX MOVL BX,CX MOVL $0,SI MOVW SI,ES MOVL SI,DI CLD REP MOVSL /* JMPFAR* 00:$lowcore(SB) /**/ BYTE $0xEA WORD $lowcore(SB) WORD $0 . 34,35c CLI . 32c * about to walk all over ms/dos - turn off interrupts . 30a TEXT start(SB),$0 . 28,29c DATA tgdtptr+0(SB)/2, $(3*8) DATA tgdtptr+2(SB)/4, $tgdt(SB) . 26c GLOBL tgdtptr(SB),$6 . 20,21c DATA tgdt+16(SB)/4, $(0xFFFF) DATA tgdt+20(SB)/4, $(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR) . 16,17c DATA tgdt+8(SB)/4, $(0xFFFF) DATA tgdt+12(SB)/4, $(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW) . 12,13c DATA tgdt+0(SB)/4, $0 DATA tgdt+4(SB)/4, $0 . 9c GLOBL tgdt(SB),$(6*4) . 3,5d ## diffname pc/l.s 1991/0702 ## diff -e /n/bootesdump/1991/0629/sys/src/9/safari/l.s /n/bootesdump/1991/0702/sys/src/9/safari/l.s 177a /* * gdt to get us to 32-bit/segmented/unpaged mode */ TEXT tgdt(SB),$0 /* null descriptor */ LONG $0 LONG $0 /* data segment descriptor for 4 gigabytes (PL 0) */ LONG $(0xFFFF) LONG $(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW) /* exec segment descriptor for 4 gigabytes (PL 0) */ LONG $(0xFFFF) LONG $(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR) /* * pointer to initial gdt */ TEXT tgdtptr(SB),$0 WORD $(3*8) LONG $tgdt(SB) /* * input a byte */ TEXT inb(SB),$0 MOVL p+0(FP),DX XORL AX,AX INB RET /* * output a byte */ TEXT outb(SB),$0 MOVL p+0(FP),DX MOVL b+4(FP),AX OUTB RET . 162,170d 138,151d 115,124d 50c /* JMPFAR 00:$lowcore(SB) /**/ . 32a TEXT origin(SB),$0 . 4,30d ## diffname pc/l.s 1991/0703 ## diff -e /n/bootesdump/1991/0702/sys/src/9/safari/l.s /n/bootesdump/1991/0703/sys/src/9/safari/l.s 164a /* * test and set */ TEXT tas(SB),$0 MOVL $0xdeadead,AX MOVL l+0(FP),BX XCHGL AX,(BX) RET /* * load the idt */ GLOBL idtptr(SB),$6 TEXT lidt(SB),$0 MOVL t+0(FP),AX MOVL AX,idtptr+2(SB) MOVL l+4(FP),AX MOVW AX,idtptr(SB) MOVL idtptr(SB),IDTR RET /* * load the gdt */ GLOBL gdtptr(SB),$6 TEXT lgdt(SB),$0 MOVL t+0(FP),AX MOVL AX,gdtptr+2(SB) MOVL l+4(FP),AX MOVW AX,gdtptr(SB) MOVL gdtptr(SB),GDTR RET /* * special traps */ TEXT intr0(SB),$0 PUSHL $0 PUSHL $0 JMP intrcommon TEXT intr1(SB),$0 PUSHL $0 PUSHL $1 JMP intrcommon TEXT intr2(SB),$0 PUSHL $0 PUSHL $2 JMP intrcommon TEXT intr3(SB),$0 PUSHL $0 PUSHL $3 JMP intrcommon TEXT intr4(SB),$0 PUSHL $0 PUSHL $4 JMP intrcommon TEXT intr5(SB),$0 PUSHL $0 PUSHL $5 JMP intrcommon TEXT intr6(SB),$0 PUSHL $0 PUSHL $6 JMP intrcommon TEXT intr7(SB),$0 PUSHL $0 PUSHL $7 JMP intrcommon TEXT intr8(SB),$0 PUSHL $8 JMP intrscommon TEXT intr9(SB),$0 PUSHL $0 PUSHL $9 JMP intrcommon TEXT intr10(SB),$0 PUSHL $10 JMP intrscommon TEXT intr11(SB),$0 PUSHL $11 JMP intrscommon TEXT intr12(SB),$0 PUSHL $12 JMP intrscommon TEXT intr13(SB),$0 PUSHL $13 JMP intrscommon TEXT intr14(SB),$0 PUSHL $14 JMP intrscommon TEXT intr15(SB),$0 PUSHL $0 PUSHL $15 JMP intrcommon TEXT intr16(SB),$0 PUSHL $0 PUSHL $16 JMP intrcommon TEXT intrbad(SB),$0 PUSHL $0 PUSHL $0x1ff JMP intrcommon intrcommon: PUSHL DS PUSHAL LEAL 0(SP),AX PUSHL AX CALL trap(SB) POPL AX POPAL POPL DS ADDL $8,SP /* error code and trap type */ IRETL RET intrscommon: PUSHL DS PUSHAL LEAL 0(SP),AX PUSHL AX CALL trap(SB) POPL AX POPAL POPL DS ADDL $8,SP /* error code and trap type */ IRETL RET /* * turn on interrupts */ TEXT sti(SB),$0 STI RET . ## diffname pc/l.s 1991/0704 ## diff -e /n/bootesdump/1991/0703/sys/src/9/safari/l.s /n/bootesdump/1991/0704/sys/src/9/safari/l.s 299a RET /* * turn interrupts and traps off */ TEXT splhi(SB),$0 CLI . 298c TEXT spllo(SB),$0 . 296c * turn interrupts and traps on . ## diffname pc/l.s 1991/0705 ## diff -e /n/bootesdump/1991/0704/sys/src/9/safari/l.s /n/bootesdump/1991/0705/sys/src/9/safari/l.s 307a /* * set interrupt level */ TEXT splx(SB),$0 RET . ## diffname pc/l.s 1991/0706 ## diff -e /n/bootesdump/1991/0705/sys/src/9/safari/l.s /n/bootesdump/1991/0706/sys/src/9/safari/l.s 313a /* * */ TEXT idle(SB),$0 HLT . 263a TEXT intr17(SB),$0 PUSHL $0 PUSHL $17 JMP intrcommon TEXT intr18(SB),$0 PUSHL $0 PUSHL $18 JMP intrcommon TEXT intr19(SB),$0 PUSHL $0 PUSHL $19 JMP intrcommon TEXT intr20(SB),$0 PUSHL $0 PUSHL $20 JMP intrcommon TEXT intr21(SB),$0 PUSHL $0 PUSHL $21 JMP intrcommon TEXT intr22(SB),$0 PUSHL $0 PUSHL $22 JMP intrcommon TEXT intr23(SB),$0 PUSHL $0 PUSHL $23 JMP intrcommon . 83c /* JMPFAR SELECTOR(2, SELGDT, 0):$mode32bit(SB) /**/ . ## diffname pc/l.s 1991/0710 ## diff -e /n/bootesdump/1991/0706/sys/src/9/safari/l.s /n/bootesdump/1991/0710/sys/src/9/safari/l.s 347a RET /* * label consists of a stack pointer and a PC */ TEXT gotolabel(SB),$0 MOVL l+0(FP),AX MOVL 0(AX),SP /* restore sp */ MOVL 4(AX),AX /* put return pc on the stack */ MOVL AX,0(SP) RET TEXT setlabel(SB),$0 MOVL l+0(FP),AX MOVL SP,0(AX) /* store sp */ MOVL 0(SP),BX /* store return pc */ MOVL BX,4(AX) RET . 344c * do nothing whatsoever till interrupt happens . 340a MOVL s+0(FP),AX PUSHL AX POPFL . 333a PUSHFL POPL AX . 326a PUSHFL POPL AX . 291a TEXT intr64(SB),$0 PUSHL $0 PUSHL $64 JMP intrcommon . 144c LONG $tgdt-KZERO(SB) . 119a GLOBL tpt(SB), $(BY2PG*3) . 103a * make a bottom level page table page that maps the first * 4 meg of physical memory */ LEAL tpt-KZERO(SB),AX /* get phys addr of temporary page table */ ADDL $(BY2PG-1),AX /* must be page alligned */ ANDL $(~(BY2PG-1)),AX /* ... */ MOVL $1024,CX /* pte's per page */ MOVL $(((1024-1)<<12)|PTEVALID|PTEKERNEL|PTEWRITE),BX setpte: MOVL BX,-4(AX)(CX*4) SUBL $(1<<12),BX LOOP setpte /* * make a top level page table page that maps the first * 4 meg of memory to 0 thru 4meg and to KZERO thru KZERO+4meg */ MOVL AX,BX ADDL $BY2PG,AX MOVL BX,0(AX) MOVL BX,((KZERO>>22)&(BY2PG-1))(AX) /* * point processor to top level page & turn on paging */ MOVL AX,CR3 MOVL CR0,AX ORL $1,AX MOVL AX,CR0 /* . 97c LEAL end-KZERO(SB),CX . 93,94c LEAL edata-KZERO(SB),SI MOVL SI,DI ADDL $4,DI . 85c WORD $mode32bit-KZERO(SB) . 59c WORD $tgdtptr-KZERO(SB) . 27c WORD $lowcore-KZERO(SB) . ## diffname pc/l.s 1991/0711 ## diff -e /n/bootesdump/1991/0710/sys/src/9/safari/l.s /n/bootesdump/1991/0711/sys/src/9/safari/l.s 408a RET TEXT touser(SB),$0 . 152c GLOBL tpt(SB), $(BY2PG*6) . 132c ORL $0X80000000,AX . 125c MOVL BX,((((KZERO>>1)&0x7FFFFFFF)>>(2*PGSHIFT-1-4))+0)(AX) ADDL $BY2PG,BX MOVL BX,4(AX) MOVL BX,((((KZERO>>1)&0x7FFFFFFF)>>(2*PGSHIFT-1-4))+4)(AX) ADDL $BY2PG,BX MOVL BX,8(AX) MOVL BX,((((KZERO>>1)&0x7FFFFFFF)>>(2*PGSHIFT-1-4))+8)(AX) ADDL $BY2PG,BX MOVL BX,12(AX) MOVL BX,((((KZERO>>1)&0x7FFFFFFF)>>(2*PGSHIFT-1-4))+12)(AX) . 123c ADDL $(4*BY2PG),AX ADDL $(PTEVALID|PTEKERNEL|PTEWRITE),BX . 120c * 16 meg of memory to 0 thru 16meg and to KZERO thru KZERO+16meg . 115c SUBL $(1<splpc */ MOVL (SP), BX MOVL BX, 4(AX) . 564a MOVL m(SB), AX /* save PC in m->splpc */ MOVL (SP), BX MOVL BX, 4(AX) . 558,563d ## diffname pc/l.s 1997/0327 ## diff -e /n/fornaxdump/1995/0822/sys/src/brazil/pc/l.s /n/emeliedump/1997/0327/sys/src/brazil/pc/l.s 817,824c TEXT forkret(SB), $0 POPL AX POPAL POPL GS POPL FS POPL ES POPL DS ADDL $8, SP /* pop error code and trap type */ IRETL TEXT vectortable(SB), $0 CALL strayintr(SB); BYTE $0x00 /* divide error */ CALL strayintr(SB); BYTE $0x01 /* debug exception */ CALL strayintr(SB); BYTE $0x02 /* NMI interrupt */ CALL strayintr(SB); BYTE $0x03 /* breakpoint */ CALL strayintr(SB); BYTE $0x04 /* overflow */ CALL strayintr(SB); BYTE $0x05 /* bound */ CALL strayintr(SB); BYTE $0x06 /* invalid opcode */ CALL strayintr(SB); BYTE $0x07 /* no coprocessor available */ CALL strayintrx(SB); BYTE $0x08 /* double fault */ CALL strayintr(SB); BYTE $0x09 /* coprocessor segment overflow */ CALL strayintrx(SB); BYTE $0x0A /* invalid TSS */ CALL strayintrx(SB); BYTE $0x0B /* segment not available */ CALL strayintrx(SB); BYTE $0x0C /* stack exception */ CALL strayintrx(SB); BYTE $0x0D /* general protection error */ CALL strayintrx(SB); BYTE $0x0E /* page fault */ CALL strayintr(SB); BYTE $0x0F /* */ CALL strayintr(SB); BYTE $0x10 /* coprocessor error */ CALL strayintrx(SB); BYTE $0x11 /* alignment check */ CALL strayintr(SB); BYTE $0x12 /* machine check */ CALL strayintr(SB); BYTE $0x13 CALL strayintr(SB); BYTE $0x14 CALL strayintr(SB); BYTE $0x15 CALL strayintr(SB); BYTE $0x16 CALL strayintr(SB); BYTE $0x17 CALL strayintr(SB); BYTE $0x18 CALL strayintr(SB); BYTE $0x19 CALL strayintr(SB); BYTE $0x1A CALL strayintr(SB); BYTE $0x1B CALL strayintr(SB); BYTE $0x1C CALL strayintr(SB); BYTE $0x1D CALL strayintr(SB); BYTE $0x1E CALL strayintr(SB); BYTE $0x1F CALL strayintr(SB); BYTE $0x20 /* VectorLAPIC */ CALL strayintr(SB); BYTE $0x21 CALL strayintr(SB); BYTE $0x22 CALL strayintr(SB); BYTE $0x23 CALL strayintr(SB); BYTE $0x24 CALL strayintr(SB); BYTE $0x25 CALL strayintr(SB); BYTE $0x26 CALL strayintr(SB); BYTE $0x27 CALL strayintr(SB); BYTE $0x28 CALL strayintr(SB); BYTE $0x29 CALL strayintr(SB); BYTE $0x2A CALL strayintr(SB); BYTE $0x2B CALL strayintr(SB); BYTE $0x2C CALL strayintr(SB); BYTE $0x2D CALL strayintr(SB); BYTE $0x2E CALL strayintr(SB); BYTE $0x2F CALL strayintr(SB); BYTE $0x30 CALL strayintr(SB); BYTE $0x31 CALL strayintr(SB); BYTE $0x32 CALL strayintr(SB); BYTE $0x33 CALL strayintr(SB); BYTE $0x34 CALL strayintr(SB); BYTE $0x35 CALL strayintr(SB); BYTE $0x36 CALL strayintr(SB); BYTE $0x37 CALL strayintr(SB); BYTE $0x38 CALL strayintr(SB); BYTE $0x39 CALL strayintr(SB); BYTE $0x3A CALL strayintr(SB); BYTE $0x3B CALL strayintr(SB); BYTE $0x3C CALL strayintr(SB); BYTE $0x3D CALL strayintr(SB); BYTE $0x3E CALL strayintr(SB); BYTE $0x3F CALL strayintr(SB); BYTE $0x40 /* VectorSYSCALL */ CALL strayintr(SB); BYTE $0x41 CALL strayintr(SB); BYTE $0x42 CALL strayintr(SB); BYTE $0x43 CALL strayintr(SB); BYTE $0x44 CALL strayintr(SB); BYTE $0x45 CALL strayintr(SB); BYTE $0x46 CALL strayintr(SB); BYTE $0x47 CALL strayintr(SB); BYTE $0x48 CALL strayintr(SB); BYTE $0x49 CALL strayintr(SB); BYTE $0x4A CALL strayintr(SB); BYTE $0x4B CALL strayintr(SB); BYTE $0x4C CALL strayintr(SB); BYTE $0x4D CALL strayintr(SB); BYTE $0x4E CALL strayintr(SB); BYTE $0x4F CALL strayintr(SB); BYTE $0x50 CALL strayintr(SB); BYTE $0x51 CALL strayintr(SB); BYTE $0x52 CALL strayintr(SB); BYTE $0x53 CALL strayintr(SB); BYTE $0x54 CALL strayintr(SB); BYTE $0x55 CALL strayintr(SB); BYTE $0x56 CALL strayintr(SB); BYTE $0x57 CALL strayintr(SB); BYTE $0x58 CALL strayintr(SB); BYTE $0x59 CALL strayintr(SB); BYTE $0x5A CALL strayintr(SB); BYTE $0x5B CALL strayintr(SB); BYTE $0x5C CALL strayintr(SB); BYTE $0x5D CALL strayintr(SB); BYTE $0x5E CALL strayintr(SB); BYTE $0x5F CALL strayintr(SB); BYTE $0x60 CALL strayintr(SB); BYTE $0x61 CALL strayintr(SB); BYTE $0x62 CALL strayintr(SB); BYTE $0x63 CALL strayintr(SB); BYTE $0x64 CALL strayintr(SB); BYTE $0x65 CALL strayintr(SB); BYTE $0x66 CALL strayintr(SB); BYTE $0x67 CALL strayintr(SB); BYTE $0x68 CALL strayintr(SB); BYTE $0x69 CALL strayintr(SB); BYTE $0x6A CALL strayintr(SB); BYTE $0x6B CALL strayintr(SB); BYTE $0x6C CALL strayintr(SB); BYTE $0x6D CALL strayintr(SB); BYTE $0x6E CALL strayintr(SB); BYTE $0x6F CALL strayintr(SB); BYTE $0x70 CALL strayintr(SB); BYTE $0x71 CALL strayintr(SB); BYTE $0x72 CALL strayintr(SB); BYTE $0x73 CALL strayintr(SB); BYTE $0x74 CALL strayintr(SB); BYTE $0x75 CALL strayintr(SB); BYTE $0x76 CALL strayintr(SB); BYTE $0x77 CALL strayintr(SB); BYTE $0x78 CALL strayintr(SB); BYTE $0x79 CALL strayintr(SB); BYTE $0x7A CALL strayintr(SB); BYTE $0x7B CALL strayintr(SB); BYTE $0x7C CALL strayintr(SB); BYTE $0x7D CALL strayintr(SB); BYTE $0x7E CALL strayintr(SB); BYTE $0x7F CALL strayintr(SB); BYTE $0x80 /* Vector[A]PIC */ CALL strayintr(SB); BYTE $0x81 CALL strayintr(SB); BYTE $0x82 CALL strayintr(SB); BYTE $0x83 CALL strayintr(SB); BYTE $0x84 CALL strayintr(SB); BYTE $0x85 CALL strayintr(SB); BYTE $0x86 CALL strayintr(SB); BYTE $0x87 CALL strayintr(SB); BYTE $0x88 CALL strayintr(SB); BYTE $0x89 CALL strayintr(SB); BYTE $0x8A CALL strayintr(SB); BYTE $0x8B CALL strayintr(SB); BYTE $0x8C CALL strayintr(SB); BYTE $0x8D CALL strayintr(SB); BYTE $0x8E CALL strayintr(SB); BYTE $0x8F CALL strayintr(SB); BYTE $0x90 CALL strayintr(SB); BYTE $0x91 CALL strayintr(SB); BYTE $0x92 CALL strayintr(SB); BYTE $0x93 CALL strayintr(SB); BYTE $0x94 CALL strayintr(SB); BYTE $0x95 CALL strayintr(SB); BYTE $0x96 CALL strayintr(SB); BYTE $0x97 CALL strayintr(SB); BYTE $0x98 CALL strayintr(SB); BYTE $0x99 CALL strayintr(SB); BYTE $0x9A CALL strayintr(SB); BYTE $0x9B CALL strayintr(SB); BYTE $0x9C CALL strayintr(SB); BYTE $0x9D CALL strayintr(SB); BYTE $0x9E CALL strayintr(SB); BYTE $0x9F CALL strayintr(SB); BYTE $0xA0 CALL strayintr(SB); BYTE $0xA1 CALL strayintr(SB); BYTE $0xA2 CALL strayintr(SB); BYTE $0xA3 CALL strayintr(SB); BYTE $0xA4 CALL strayintr(SB); BYTE $0xA5 CALL strayintr(SB); BYTE $0xA6 CALL strayintr(SB); BYTE $0xA7 CALL strayintr(SB); BYTE $0xA8 CALL strayintr(SB); BYTE $0xA9 CALL strayintr(SB); BYTE $0xAA CALL strayintr(SB); BYTE $0xAB CALL strayintr(SB); BYTE $0xAC CALL strayintr(SB); BYTE $0xAD CALL strayintr(SB); BYTE $0xAE CALL strayintr(SB); BYTE $0xAF CALL strayintr(SB); BYTE $0xB0 CALL strayintr(SB); BYTE $0xB1 CALL strayintr(SB); BYTE $0xB2 CALL strayintr(SB); BYTE $0xB3 CALL strayintr(SB); BYTE $0xB4 CALL strayintr(SB); BYTE $0xB5 CALL strayintr(SB); BYTE $0xB6 CALL strayintr(SB); BYTE $0xB7 CALL strayintr(SB); BYTE $0xB8 CALL strayintr(SB); BYTE $0xB9 CALL strayintr(SB); BYTE $0xBA CALL strayintr(SB); BYTE $0xBB CALL strayintr(SB); BYTE $0xBC CALL strayintr(SB); BYTE $0xBD CALL strayintr(SB); BYTE $0xBE CALL strayintr(SB); BYTE $0xBF CALL strayintr(SB); BYTE $0xC0 CALL strayintr(SB); BYTE $0xC1 CALL strayintr(SB); BYTE $0xC2 CALL strayintr(SB); BYTE $0xC3 CALL strayintr(SB); BYTE $0xC4 CALL strayintr(SB); BYTE $0xC5 CALL strayintr(SB); BYTE $0xC6 CALL strayintr(SB); BYTE $0xC7 CALL strayintr(SB); BYTE $0xC8 CALL strayintr(SB); BYTE $0xC9 CALL strayintr(SB); BYTE $0xCA CALL strayintr(SB); BYTE $0xCB CALL strayintr(SB); BYTE $0xCC CALL strayintr(SB); BYTE $0xCD CALL strayintr(SB); BYTE $0xCE CALL strayintr(SB); BYTE $0xCF CALL strayintr(SB); BYTE $0xD0 CALL strayintr(SB); BYTE $0xD1 CALL strayintr(SB); BYTE $0xD2 CALL strayintr(SB); BYTE $0xD3 CALL strayintr(SB); BYTE $0xD4 CALL strayintr(SB); BYTE $0xD5 CALL strayintr(SB); BYTE $0xD6 CALL strayintr(SB); BYTE $0xD7 CALL strayintr(SB); BYTE $0xD8 CALL strayintr(SB); BYTE $0xD9 CALL strayintr(SB); BYTE $0xDA CALL strayintr(SB); BYTE $0xDB CALL strayintr(SB); BYTE $0xDC CALL strayintr(SB); BYTE $0xDD CALL strayintr(SB); BYTE $0xDE CALL strayintr(SB); BYTE $0xDF CALL strayintr(SB); BYTE $0xE0 CALL strayintr(SB); BYTE $0xE1 CALL strayintr(SB); BYTE $0xE2 CALL strayintr(SB); BYTE $0xE3 CALL strayintr(SB); BYTE $0xE4 CALL strayintr(SB); BYTE $0xE5 CALL strayintr(SB); BYTE $0xE6 CALL strayintr(SB); BYTE $0xE7 CALL strayintr(SB); BYTE $0xE8 CALL strayintr(SB); BYTE $0xE9 CALL strayintr(SB); BYTE $0xEA CALL strayintr(SB); BYTE $0xEB CALL strayintr(SB); BYTE $0xEC CALL strayintr(SB); BYTE $0xED CALL strayintr(SB); BYTE $0xEE CALL strayintr(SB); BYTE $0xEF CALL strayintr(SB); BYTE $0xF0 CALL strayintr(SB); BYTE $0xF1 CALL strayintr(SB); BYTE $0xF2 CALL strayintr(SB); BYTE $0xF3 CALL strayintr(SB); BYTE $0xF4 CALL strayintr(SB); BYTE $0xF5 CALL strayintr(SB); BYTE $0xF6 CALL strayintr(SB); BYTE $0xF7 CALL strayintr(SB); BYTE $0xF8 CALL strayintr(SB); BYTE $0xF9 CALL strayintr(SB); BYTE $0xFA CALL strayintr(SB); BYTE $0xFB CALL strayintr(SB); BYTE $0xFC CALL strayintr(SB); BYTE $0xFD CALL strayintr(SB); BYTE $0xFE CALL strayintr(SB); BYTE $0xFF . 811,815c intrcommon: PUSHL DS PUSHL ES PUSHL FS PUSHL GS PUSHAL MOVL $(KDSEL),AX MOVW AX, DS MOVW AX, ES PUSHL SP CALL trap(SB) . 802,809c TEXT strayintrx(SB), $0 XCHGL AX, (SP) /* exchange AX with pointer to trap type */ MOVBLZX (AX), AX /* trap type -> AX */ XCHGL AX, (SP) /* exchange trap type with AX */ . 796,800c TEXT strayintr(SB), $0 PUSHL AX /* save AX */ MOVL 4(SP), AX /* return PC from vectortable(SB) */ MOVBLZX (AX), AX /* trap type */ XCHGL AX, (SP) /* restore AX and put the type on the stack */ JMP intrcommon . 794c * Interrupt/exception handling. * Each entry in the vector table calls either strayintr or strayintrx depending * on whether an error code has beemn automatically pushed onto the stack * (strayintrx) or not, in which case a dummy entry must be pushed before retrieving * the trap type from the vector table entry and placing it on the stack as part * of the Ureg structure. * The size of each entry in the vector table (6 bytes) is known in trapinit(). . 755,790c TEXT setlabel(SB), $0 MOVL label+0(FP), AX MOVL SP, 0(AX) /* store sp */ MOVL 0(SP), BX /* store return pc */ MOVL BX, 4(AX) MOVL $0, AX /* return 0 */ . 722,752c TEXT gotolabel(SB), $0 MOVL label+0(FP), AX MOVL 0(AX), SP /* restore sp */ MOVL 4(AX), AX /* put return pc on the stack */ MOVL AX, 0(SP) MOVL $1, AX /* return 1 */ . 720c * label consists of a stack pointer and a PC . 701,718d 696,699d 686,694d 660,684c TEXT xchgl(SB), $0 MOVL v+4(FP), AX MOVL p+0(FP), BX XCHGL AX, (BX) . 651,658d 640,648c TEXT xchgw(SB), $0 MOVL v+4(FP), AX MOVL p+0(FP), BX XCHGW AX, (BX) . 629,637c TEXT wbflush(SB), $0 CPUID . 593,626c TEXT tas(SB), $0 MOVL $0xDEADDEAD, AX MOVL lock+0(FP), BX XCHGL AX, (BX) /* lock->key */ . 591c * Test-And-Set . 587a ANDL $0x200, AX /* interrupt enable flag */ . 585c TEXT islo(SB), $0 . 581a RET . 578c TEXT spllo(SB), $0 . 573c MOVL s+0(FP), AX . 571c MOVL BX, (AX) . 568,569c TEXT splx(SB), $0 MOVL $(MACHADDR+0x04), AX /* save PC in m->splpc */ . 561c MOVL BX, (AX) . 356,559c TEXT splhi(SB), $0 MOVL $(MACHADDR+0x04), AX /* save PC in m->splpc */ . 354d 348,349c TEXT fpenv(SB), $0 /* save state without waiting */ MOVL p+0(FP), AX . 344c TEXT fpstatus(SB), $0 /* get floating point status */ . 339c MOVL p+0(FP), AX . 337c TEXT fprestore(SB), $0 /* enable and restore state */ . 330,331c TEXT fpsave(SB), $0 /* save state and disable */ MOVL p+0(FP), AX . 325c FLDCW 0(SP) /* ignore underflow/precision, signal others */ . 320c TEXT fpinit(SB), $0 /* enable and init */ . 316c TEXT fpoff(SB), $0 /* disable */ . 311,314c #define FPON ;\ MOVL CR0, AX ;\ ANDL $~0x4, AX /* EM=0 */ ;\ MOVL AX, CR0 . 305,309c /* * Floating point. */ #define FPOFF ;\ WAIT ;\ MOVL CR0, AX ;\ ORL $0x24, AX /* EM=1, NE=1 */ ;\ MOVL AX, CR0 . 301,302c /* * Basic timing loop to determine CPU frequency. */ TEXT aamloop(SB), $0 MOVL count+0(FP), CX _aamloop: AAM LOOP _aamloop . 297,298c MOVL $1, AX CPUID JMP _cpuid _cpu486: MOVL $0x400, AX MOVL $0, DX JMP _cpuid _cpu386: MOVL $0x300, AX MOVL $0, DX _cpuid: MOVL ax+4(FP), BP MOVL AX, 0(BP) MOVL dx+8(FP), BP MOVL DX, 0(BP) . 293,295c MOVL $0, AX CPUID MOVL id+0(FP), BP MOVL BX, 0(BP) /* "Genu" "Auth" "Cyri" */ MOVL DX, 4(BP) /* "ineI" "enti" "xIns" */ MOVL CX, 8(BP) /* "ntel" "cAMD" "tead" */ . 288,291c PUSHFL POPL AX /* retrieve value */ XORL BX, AX TESTL $0x040000, AX /* Ac */ JZ _cpu386 /* can't set this bit on 386 */ TESTL $0x200000, AX /* Id */ JZ _cpu486 /* can't toggle this bit on some 486 */ . 283,286c MOVL $0, AX PUSHL AX POPFL /* clear Id|Ac, EFLAGS initialised */ . 274,281c PUSHFL POPL BX /* retrieve value */ . 265,272c TEXT cpuid(SB), $0 MOVL $0x240000, AX PUSHL AX POPFL /* set Id|Ac */ . 263c * Try to determine the CPU type which requires fiddling with EFLAGS. * If the Id bit can be toggled then the CPUID instruciton can be used * to determine CPU identity and features. First have to check if it's * a 386 (Ac bit can't be set). If it's not a 386 and the Id bit can't be * toggled then it's an older 486 of some kind. * * cpuid(id[], &ax, &dx); . 253,259c TEXT wbinvd(SB), $0 WBINVD . 251a TEXT wrmsr(SB), $0 MOVL index+0(FP), CX MOVL hi+4(FP), DX MOVL lo+8(FP), AX WRMSR RET . 244,250c TEXT rdmsr(SB), $0 /* model-specific register */ MOVL index+0(FP), CX RDMSR MOVL hi+4(FP), CX MOVL DX, (CX) MOVL lo+8(FP), CX MOVL AX, (CX) . 238,241c TEXT putcr4(SB), $0 MOVL cr4+0(FP), AX MOVL AX, CR4 . 233,236c TEXT getcr4(SB), $0 /* CR4 - extensions */ MOVL CR4, AX RET . 224,230c TEXT putcr3(SB), $0 MOVL cr3+0(FP), AX MOVL AX, CR3 . 218,221c TEXT getcr3(SB), $0 /* CR3 - page directory base */ MOVL CR3, AX . 213,216c TEXT getcr2(SB), $0 /* CR2 - page fault linear address */ MOVL CR2, AX RET . 208,210c TEXT getcr0(SB), $0 /* CR0 - processor control */ MOVL CR0, AX . 203,206c TEXT ltr(SB), $0 /* TR - task register */ MOVL tptr+0(FP), AX MOVW AX, TASK RET . 197,200c TEXT lidt(SB), $0 /* IDTR - interrupt descriptor table */ MOVL idtptr+0(FP), AX MOVL (AX), IDTR . 195c TEXT lgdt(SB), $0 /* GDTR - global descriptor table */ MOVL gdtptr+0(FP), AX MOVL (AX), GDTR RET . 193c * Read/write various system registers. * CR4 and the 'model specific registers' should only be read/written * after it has been determined the processor supports them . 183,189c TEXT outsl(SB), $0 MOVL port+0(FP), DX MOVL address+4(FP), SI MOVL count+8(FP), CX CLD REP; OUTSL . 177,180c TEXT outl(SB), $0 MOVL port+0(FP), DX MOVL long+4(FP), AX OUTL . 172,175c TEXT outss(SB), $0 MOVL port+0(FP), DX MOVL address+4(FP), SI MOVL count+8(FP), CX CLD REP; OP16; OUTSL RET . 167,169c TEXT outs(SB), $0 MOVL port+0(FP), DX MOVL short+4(FP), AX OP16; OUTL . 162,165c TEXT outsb(SB),$0 MOVL port+0(FP), DX MOVL address+4(FP), SI MOVL count+8(FP), CX CLD REP; OUTSB RET . 156,159c TEXT outb(SB), $0 MOVL port+0(FP), DX MOVL byte+4(FP), AX OUTB . 151,154c TEXT insl(SB), $0 MOVL port+0(FP), DX MOVL address+4(FP), DI MOVL count+8(FP), CX CLD REP; INSL RET . 146,148c TEXT inl(SB), $0 MOVL port+0(FP), DX INL . 141,144c TEXT inss(SB), $0 MOVL port+0(FP), DX MOVL address+4(FP), DI MOVL count+8(FP), CX CLD REP; OP16; INSL RET . 135,138c TEXT ins(SB), $0 MOVL port+0(FP), DX XORL AX, AX OP16; INL . 130,133c TEXT insb(SB), $0 MOVL port+0(FP), DX MOVL address+4(FP), DI MOVL count+8(FP), CX CLD REP; INSB RET . 125,126c /* * Port I/O. * in[bsl] input a byte|short|long * ins[bsl] input a string of bytes|shorts|longs * out[bsl] output a byte|short|long * outs[bsl] output a string of bytes|shorts|longs */ TEXT inb(SB), $0 MOVL port+0(FP), DX XORL AX, AX . 123c TEXT idle(SB), $0 _idle: HLT JMP _idle . 121c * Park a processor. Should never fall through a return from main to here, * should only be called by application processors when shutting down. . 117,118c CALL main(SB) . 115c MOVL $0, AX PUSHL AX POPFL . 113c * Need to do one final thing to ensure a clean machine enviroment, * clear the EFLAGS register, which can only be done once there is a stack. . 111a ADDL $(MACHSIZE-4), SP /* initialise stack */ . 108,110c MOVL $MACHADDR, SP MOVL SP, m(SB) /* initialise global Mach pointer */ MOVL $0, 0(SP) /* initialise m->machno */ . 104,106c CLD REP; STOSL /* clear BSS */ . 100,102c _clearbss: MOVL $edata(SB), DI XORL AX, AX MOVL $end(SB), CX SUBL DI, CX /* end-edata bytes */ SHRL $2, CX /* end-edata doublewords */ . 98c TEXT _startpg(SB), $0 MOVL CX, AX /* physical address of PDB */ ORL $KZERO, AX MOVL $0, (PDO(0))(AX) /* undo double-map of KZERO at 0 */ MOVL CX, CR3 /* load and flush the mmu */ . 96c * Basic machine environment set, can clear BSS and create a stack. * The stack starts at the top of the page containing the Mach structure. * The x86 architecture forces the use of the same virtual address for * each processor's Mach structure, so the global Mach pointer 'm' can * be initialised here. . 90,94d 87,88c MOVL $_startpg(SB), AX MOVL DX, CR0 /* turn on paging */ JMP* AX . 85c MOVL CR0, DX ORL $0x80010000, DX /* PG|WP */ ANDL $~0x6000000A, DX /* ~(CD|NW|TS|MP) */ . 78,83c /* * Now ready to use the new map. Make sure the processor options are what is wanted. * It is necessary on some processors to follow mode switching with a JMP instruction * to clear the prefetch queues. * There's a little mystery here - the Pentium Pro appears to need an identity * mmu map for the switch to virtual mode. The manual doesn't say this is necessary * and it isn't required on the Pentium. * To this end double map KZERO at virtual 0 and undo the mapping once virtual * nirvana has been attained. */ MOVL $PADDR(CPU0PDB), CX /* load address of page directory */ MOVL CX, BX MOVL (PDO(KZERO))(BX), DX /* double-map KZERO at 0 */ MOVL DX, (PDO(0))(BX) MOVL CX, CR3 DELAY /* JMP .+2 */ . 69,76c MOVL $CPU0MACHPTE, AX ADDL $PTO(MACHADDR), AX /* page table entry offset for MACHADDR */ MOVL $PADDR(CPU0MACH), (AX) /* PTE for Mach */ MOVL $(PTEWRITE|PTEVALID), BX /* page permissions */ ORL BX, (AX) . 67c MOVL $CPU0PDB, AX ADDL $PDO(MACHADDR), AX /* page directory offset for MACHADDR */ MOVL $PADDR(CPU0MACHPTE), (AX) /* PTE's for 4MB containing MACHADDR */ MOVL $(PTEWRITE|PTEVALID), BX /* page permissions */ ORL BX, (AX) . 60,65c MOVL $CPU0PTE, AX /* first page of page table */ MOVL $1024, CX /* 1024 pages in 4MB */ _setpte: MOVL BX, (AX) ADDL $(1<>22) & 0x03FF)<<2) #define PTO(a) (((((a))>>12) & 0x03FF)<<2) /* * Entered here from the bootstrap programme possibly via a jump to 0x00100020, so * need to make another jump to set the correct virtual address. * In protected mode with paging turned on, the first 4MB of physical memory mapped * to KZERO and up. */ TEXT _start0x00100020(SB),$0 . 10c #define OP16 BYTE $0x66 #define DELAY BYTE $0xEB; BYTE $0x00 /* JMP .+2 */ #define CPUID BYTE $0x0F; BYTE $0xA2 /* CPUID, argument in AX */ #define WRMSR BYTE $0x0F; BYTE $0x30 /* WRMSR, argument in AX/DX (lo/hi) */ #define RDMSR BYTE $0x0F; BYTE $0x32 /* RDMSR, result in AX/DX (lo/hi) */ #define WBINVD BYTE $0x0F; BYTE $0x09 . 7,8c * Some machine instructions not handled by 8[al]. . 3,4c #define PADDR(a) ((a) & ~KZERO) #define KADDR(a) (KZERO|(a)) . ## diffname pc/l.s 1997/1101 ## diff -e /n/emeliedump/1997/0327/sys/src/brazil/pc/l.s /n/emeliedump/1997/1101/sys/src/brazil/pc/l.s 554,809c CALL _strayintr(SB); BYTE $0x00 /* divide error */ CALL _strayintr(SB); BYTE $0x01 /* debug exception */ CALL _strayintr(SB); BYTE $0x02 /* NMI interrupt */ CALL _strayintr(SB); BYTE $0x03 /* breakpoint */ CALL _strayintr(SB); BYTE $0x04 /* overflow */ CALL _strayintr(SB); BYTE $0x05 /* bound */ CALL _strayintr(SB); BYTE $0x06 /* invalid opcode */ CALL _strayintr(SB); BYTE $0x07 /* no coprocessor available */ CALL _strayintrx(SB); BYTE $0x08 /* double fault */ CALL _strayintr(SB); BYTE $0x09 /* coprocessor segment overflow */ CALL _strayintrx(SB); BYTE $0x0A /* invalid TSS */ CALL _strayintrx(SB); BYTE $0x0B /* segment not available */ CALL _strayintrx(SB); BYTE $0x0C /* stack exception */ CALL _strayintrx(SB); BYTE $0x0D /* general protection error */ CALL _strayintrx(SB); BYTE $0x0E /* page fault */ CALL _strayintr(SB); BYTE $0x0F /* */ CALL _strayintr(SB); BYTE $0x10 /* coprocessor error */ CALL _strayintrx(SB); BYTE $0x11 /* alignment check */ CALL _strayintr(SB); BYTE $0x12 /* machine check */ CALL _strayintr(SB); BYTE $0x13 CALL _strayintr(SB); BYTE $0x14 CALL _strayintr(SB); BYTE $0x15 CALL _strayintr(SB); BYTE $0x16 CALL _strayintr(SB); BYTE $0x17 CALL _strayintr(SB); BYTE $0x18 CALL _strayintr(SB); BYTE $0x19 CALL _strayintr(SB); BYTE $0x1A CALL _strayintr(SB); BYTE $0x1B CALL _strayintr(SB); BYTE $0x1C CALL _strayintr(SB); BYTE $0x1D CALL _strayintr(SB); BYTE $0x1E CALL _strayintr(SB); BYTE $0x1F CALL _strayintr(SB); BYTE $0x20 /* VectorLAPIC */ CALL _strayintr(SB); BYTE $0x21 CALL _strayintr(SB); BYTE $0x22 CALL _strayintr(SB); BYTE $0x23 CALL _strayintr(SB); BYTE $0x24 CALL _strayintr(SB); BYTE $0x25 CALL _strayintr(SB); BYTE $0x26 CALL _strayintr(SB); BYTE $0x27 CALL _strayintr(SB); BYTE $0x28 CALL _strayintr(SB); BYTE $0x29 CALL _strayintr(SB); BYTE $0x2A CALL _strayintr(SB); BYTE $0x2B CALL _strayintr(SB); BYTE $0x2C CALL _strayintr(SB); BYTE $0x2D CALL _strayintr(SB); BYTE $0x2E CALL _strayintr(SB); BYTE $0x2F CALL _strayintr(SB); BYTE $0x30 CALL _strayintr(SB); BYTE $0x31 CALL _strayintr(SB); BYTE $0x32 CALL _strayintr(SB); BYTE $0x33 CALL _strayintr(SB); BYTE $0x34 CALL _strayintr(SB); BYTE $0x35 CALL _strayintr(SB); BYTE $0x36 CALL _strayintr(SB); BYTE $0x37 CALL _strayintr(SB); BYTE $0x38 CALL _strayintr(SB); BYTE $0x39 CALL _strayintr(SB); BYTE $0x3A CALL _strayintr(SB); BYTE $0x3B CALL _strayintr(SB); BYTE $0x3C CALL _strayintr(SB); BYTE $0x3D CALL _strayintr(SB); BYTE $0x3E CALL _strayintr(SB); BYTE $0x3F CALL _syscallintr(SB); BYTE $0x40 /* VectorSYSCALL */ CALL _strayintr(SB); BYTE $0x41 CALL _strayintr(SB); BYTE $0x42 CALL _strayintr(SB); BYTE $0x43 CALL _strayintr(SB); BYTE $0x44 CALL _strayintr(SB); BYTE $0x45 CALL _strayintr(SB); BYTE $0x46 CALL _strayintr(SB); BYTE $0x47 CALL _strayintr(SB); BYTE $0x48 CALL _strayintr(SB); BYTE $0x49 CALL _strayintr(SB); BYTE $0x4A CALL _strayintr(SB); BYTE $0x4B CALL _strayintr(SB); BYTE $0x4C CALL _strayintr(SB); BYTE $0x4D CALL _strayintr(SB); BYTE $0x4E CALL _strayintr(SB); BYTE $0x4F CALL _strayintr(SB); BYTE $0x50 CALL _strayintr(SB); BYTE $0x51 CALL _strayintr(SB); BYTE $0x52 CALL _strayintr(SB); BYTE $0x53 CALL _strayintr(SB); BYTE $0x54 CALL _strayintr(SB); BYTE $0x55 CALL _strayintr(SB); BYTE $0x56 CALL _strayintr(SB); BYTE $0x57 CALL _strayintr(SB); BYTE $0x58 CALL _strayintr(SB); BYTE $0x59 CALL _strayintr(SB); BYTE $0x5A CALL _strayintr(SB); BYTE $0x5B CALL _strayintr(SB); BYTE $0x5C CALL _strayintr(SB); BYTE $0x5D CALL _strayintr(SB); BYTE $0x5E CALL _strayintr(SB); BYTE $0x5F CALL _strayintr(SB); BYTE $0x60 CALL _strayintr(SB); BYTE $0x61 CALL _strayintr(SB); BYTE $0x62 CALL _strayintr(SB); BYTE $0x63 CALL _strayintr(SB); BYTE $0x64 CALL _strayintr(SB); BYTE $0x65 CALL _strayintr(SB); BYTE $0x66 CALL _strayintr(SB); BYTE $0x67 CALL _strayintr(SB); BYTE $0x68 CALL _strayintr(SB); BYTE $0x69 CALL _strayintr(SB); BYTE $0x6A CALL _strayintr(SB); BYTE $0x6B CALL _strayintr(SB); BYTE $0x6C CALL _strayintr(SB); BYTE $0x6D CALL _strayintr(SB); BYTE $0x6E CALL _strayintr(SB); BYTE $0x6F CALL _strayintr(SB); BYTE $0x70 CALL _strayintr(SB); BYTE $0x71 CALL _strayintr(SB); BYTE $0x72 CALL _strayintr(SB); BYTE $0x73 CALL _strayintr(SB); BYTE $0x74 CALL _strayintr(SB); BYTE $0x75 CALL _strayintr(SB); BYTE $0x76 CALL _strayintr(SB); BYTE $0x77 CALL _strayintr(SB); BYTE $0x78 CALL _strayintr(SB); BYTE $0x79 CALL _strayintr(SB); BYTE $0x7A CALL _strayintr(SB); BYTE $0x7B CALL _strayintr(SB); BYTE $0x7C CALL _strayintr(SB); BYTE $0x7D CALL _strayintr(SB); BYTE $0x7E CALL _strayintr(SB); BYTE $0x7F CALL _strayintr(SB); BYTE $0x80 /* Vector[A]PIC */ CALL _strayintr(SB); BYTE $0x81 CALL _strayintr(SB); BYTE $0x82 CALL _strayintr(SB); BYTE $0x83 CALL _strayintr(SB); BYTE $0x84 CALL _strayintr(SB); BYTE $0x85 CALL _strayintr(SB); BYTE $0x86 CALL _strayintr(SB); BYTE $0x87 CALL _strayintr(SB); BYTE $0x88 CALL _strayintr(SB); BYTE $0x89 CALL _strayintr(SB); BYTE $0x8A CALL _strayintr(SB); BYTE $0x8B CALL _strayintr(SB); BYTE $0x8C CALL _strayintr(SB); BYTE $0x8D CALL _strayintr(SB); BYTE $0x8E CALL _strayintr(SB); BYTE $0x8F CALL _strayintr(SB); BYTE $0x90 CALL _strayintr(SB); BYTE $0x91 CALL _strayintr(SB); BYTE $0x92 CALL _strayintr(SB); BYTE $0x93 CALL _strayintr(SB); BYTE $0x94 CALL _strayintr(SB); BYTE $0x95 CALL _strayintr(SB); BYTE $0x96 CALL _strayintr(SB); BYTE $0x97 CALL _strayintr(SB); BYTE $0x98 CALL _strayintr(SB); BYTE $0x99 CALL _strayintr(SB); BYTE $0x9A CALL _strayintr(SB); BYTE $0x9B CALL _strayintr(SB); BYTE $0x9C CALL _strayintr(SB); BYTE $0x9D CALL _strayintr(SB); BYTE $0x9E CALL _strayintr(SB); BYTE $0x9F CALL _strayintr(SB); BYTE $0xA0 CALL _strayintr(SB); BYTE $0xA1 CALL _strayintr(SB); BYTE $0xA2 CALL _strayintr(SB); BYTE $0xA3 CALL _strayintr(SB); BYTE $0xA4 CALL _strayintr(SB); BYTE $0xA5 CALL _strayintr(SB); BYTE $0xA6 CALL _strayintr(SB); BYTE $0xA7 CALL _strayintr(SB); BYTE $0xA8 CALL _strayintr(SB); BYTE $0xA9 CALL _strayintr(SB); BYTE $0xAA CALL _strayintr(SB); BYTE $0xAB CALL _strayintr(SB); BYTE $0xAC CALL _strayintr(SB); BYTE $0xAD CALL _strayintr(SB); BYTE $0xAE CALL _strayintr(SB); BYTE $0xAF CALL _strayintr(SB); BYTE $0xB0 CALL _strayintr(SB); BYTE $0xB1 CALL _strayintr(SB); BYTE $0xB2 CALL _strayintr(SB); BYTE $0xB3 CALL _strayintr(SB); BYTE $0xB4 CALL _strayintr(SB); BYTE $0xB5 CALL _strayintr(SB); BYTE $0xB6 CALL _strayintr(SB); BYTE $0xB7 CALL _strayintr(SB); BYTE $0xB8 CALL _strayintr(SB); BYTE $0xB9 CALL _strayintr(SB); BYTE $0xBA CALL _strayintr(SB); BYTE $0xBB CALL _strayintr(SB); BYTE $0xBC CALL _strayintr(SB); BYTE $0xBD CALL _strayintr(SB); BYTE $0xBE CALL _strayintr(SB); BYTE $0xBF CALL _strayintr(SB); BYTE $0xC0 CALL _strayintr(SB); BYTE $0xC1 CALL _strayintr(SB); BYTE $0xC2 CALL _strayintr(SB); BYTE $0xC3 CALL _strayintr(SB); BYTE $0xC4 CALL _strayintr(SB); BYTE $0xC5 CALL _strayintr(SB); BYTE $0xC6 CALL _strayintr(SB); BYTE $0xC7 CALL _strayintr(SB); BYTE $0xC8 CALL _strayintr(SB); BYTE $0xC9 CALL _strayintr(SB); BYTE $0xCA CALL _strayintr(SB); BYTE $0xCB CALL _strayintr(SB); BYTE $0xCC CALL _strayintr(SB); BYTE $0xCD CALL _strayintr(SB); BYTE $0xCE CALL _strayintr(SB); BYTE $0xCF CALL _strayintr(SB); BYTE $0xD0 CALL _strayintr(SB); BYTE $0xD1 CALL _strayintr(SB); BYTE $0xD2 CALL _strayintr(SB); BYTE $0xD3 CALL _strayintr(SB); BYTE $0xD4 CALL _strayintr(SB); BYTE $0xD5 CALL _strayintr(SB); BYTE $0xD6 CALL _strayintr(SB); BYTE $0xD7 CALL _strayintr(SB); BYTE $0xD8 CALL _strayintr(SB); BYTE $0xD9 CALL _strayintr(SB); BYTE $0xDA CALL _strayintr(SB); BYTE $0xDB CALL _strayintr(SB); BYTE $0xDC CALL _strayintr(SB); BYTE $0xDD CALL _strayintr(SB); BYTE $0xDE CALL _strayintr(SB); BYTE $0xDF CALL _strayintr(SB); BYTE $0xE0 CALL _strayintr(SB); BYTE $0xE1 CALL _strayintr(SB); BYTE $0xE2 CALL _strayintr(SB); BYTE $0xE3 CALL _strayintr(SB); BYTE $0xE4 CALL _strayintr(SB); BYTE $0xE5 CALL _strayintr(SB); BYTE $0xE6 CALL _strayintr(SB); BYTE $0xE7 CALL _strayintr(SB); BYTE $0xE8 CALL _strayintr(SB); BYTE $0xE9 CALL _strayintr(SB); BYTE $0xEA CALL _strayintr(SB); BYTE $0xEB CALL _strayintr(SB); BYTE $0xEC CALL _strayintr(SB); BYTE $0xED CALL _strayintr(SB); BYTE $0xEE CALL _strayintr(SB); BYTE $0xEF CALL _strayintr(SB); BYTE $0xF0 CALL _strayintr(SB); BYTE $0xF1 CALL _strayintr(SB); BYTE $0xF2 CALL _strayintr(SB); BYTE $0xF3 CALL _strayintr(SB); BYTE $0xF4 CALL _strayintr(SB); BYTE $0xF5 CALL _strayintr(SB); BYTE $0xF6 CALL _strayintr(SB); BYTE $0xF7 CALL _strayintr(SB); BYTE $0xF8 CALL _strayintr(SB); BYTE $0xF9 CALL _strayintr(SB); BYTE $0xFA CALL _strayintr(SB); BYTE $0xFB CALL _strayintr(SB); BYTE $0xFC CALL _strayintr(SB); BYTE $0xFD CALL _strayintr(SB); BYTE $0xFE CALL _strayintr(SB); BYTE $0xFF . 537c MOVL $(KDSEL), AX . 526c TEXT _strayintrx(SB), $0 . 519c TEXT _strayintr(SB), $0 . 514c * (_strayintrx) or not, in which case a dummy entry must be pushed before retrieving . 512c * Each entry in the vector table calls either _strayintr or _strayintrx depending . 449,454d 443a TEXT _splx(SB), $0 /* for iunlock */ . 438a TEXT spllo(SB), $0 PUSHFL POPL AX STI RET . 69,75c MOVL $CPU0PTE, AX . ## diffname pc/l.s 1998/0130 ## diff -e /n/emeliedump/1997/1101/sys/src/brazil/pc/l.s /n/emeliedump/1998/0130/sys/src/brazil/pc/l.s 38,39c * a page directory, a page table for mapping the first 4MB of physical memory, and * virtual and physical pages for mapping the Mach structure. . ## diffname pc/l.s 1998/0401 ## diff -e /n/emeliedump/1998/0130/sys/src/brazil/pc/l.s /n/emeliedump/1998/0401/sys/src/brazil/pc/l.s 295,296c MOVL lo+4(FP), AX MOVL hi+8(FP), DX . 287,290c MOVL vlong+4(FP), CX /* &vlong */ MOVL AX, (CX) /* lo */ MOVL DX, 4(CX) /* hi */ . ## diffname pc/l.s 1998/0430 ## diff -e /n/emeliedump/1998/0401/sys/src/brazil/pc/l.s /n/emeliedump/1998/0430/sys/src/brazil/pc/l.s 130c * Need to do one final thing to ensure a clean machine environment, . ## diffname pc/l.s 1998/0603 ## diff -e /n/emeliedump/1998/0430/sys/src/brazil/pc/l.s /n/emeliedump/1998/0603/sys/src/brazil/pc/l.s 507c * on whether an error code has been automatically pushed onto the stack . ## diffname pc/l.s 1998/0605 ## diff -e /n/emeliedump/1998/0603/sys/src/brazil/pc/l.s /n/emeliedump/1998/0605/sys/src/brazil/pc/l.s 144a STI . ## diffname pc/l.s 1998/0606 ## diff -e /n/emeliedump/1998/0605/sys/src/brazil/pc/l.s /n/emeliedump/1998/0606/sys/src/brazil/pc/l.s 444c TEXT splxpc(SB), $0 /* for iunlock */ . ## diffname pc/l.s 1998/0916 ## diff -e /n/emeliedump/1998/0606/sys/src/brazil/pc/l.s /n/emeliedump/1998/0916/sys/src/brazil/pc/l.s 400,401c FSAVE 0(AX) /* no WAIT */ . ## diffname pc/l.s 1999/0528 ## diff -e /n/emeliedump/1998/0916/sys/src/brazil/pc/l.s /n/emeliedump/1999/0528/sys/src/brazil/pc/l.s 520a /* time stamp for interrupt */ PUSHL AX PUSHL DX PUSHL CX MOVL $0x10, CX RDMSR MOVL AX, intrts(SB) MOVL DX, intrts+4(SB) POPL CX POPL DX POPL AX . 514a PUSHL DX PUSHL CX MOVL $0x10, CX RDMSR MOVL AX, intrts(SB) MOVL DX, intrts+4(SB) POPL CX POPL DX . 513a /* time stamp for interrupt */ . ## diffname pc/l.s 1999/0609 ## diff -e /n/emeliedump/1999/0528/sys/src/brazil/pc/l.s /n/emeliedump/1999/0609/sys/src/brazil/pc/l.s 532,544d 517,525d 514,515d ## diffname pc/l.s 1999/1008 ## diff -e /n/emeliedump/1999/0609/sys/src/brazil/pc/l.s /n/emeliedump/1999/1008/sys/src/brazil/pc/l.s 381c ANDL $~0xC, AX /* EM=0, TS=0 */ ;\ . 376c ANDL $~0x4, AX /* EM=0 */ ;\ ORL $0x28, AX /* NE=1, TS=1 */ ;\ . ## diffname pc/l.s 1999/1020 ## diff -e /n/emeliedump/1999/1008/sys/src/brazil/pc/l.s /n/emeliedump/1999/1020/sys/src/brazil/pc/l.s 532,535c PUSHL SP /* Ureg* argument to trap */ . 527,529c PUSHL DS /* save DS */ PUSHL $(KDSEL) POPL DS /* fix up DS */ MOVBLZX (AX), AX /* trap type -> AX */ XCHGL AX, 4(SP) /* exchange trap type with saved AX */ PUSHL ES /* save ES */ PUSHL $(KDSEL) POPL ES /* fix up ES */ PUSHL FS /* save the rest of the Ureg struct */ . 522,525c XCHGL AX, (SP) /* swap AX with vectortable CALL PC */ . 515,518c PUSHL AX /* save AX */ MOVL 4(SP), AX /* return PC from vectortable(SB) */ . ## diffname pc/l.s 2000/0929 ## diff -e /n/emeliedump/1999/1020/sys/src/brazil/pc/l.s /n/emeliedump/2000/0929/sys/src/9/pc/l.s 393,394c /* setfcr(FPPDBL|FPRNR|FPINVAL|FPZDIV|FPOVFL) */ /* note that low 6 bits are masks, not enables, on this chip */ PUSHW $0x0232 FLDCW 0(SP) . ## diffname pc/l.s 2000/1221 ## diff -e /n/emeliedump/2000/0929/sys/src/9/pc/l.s /n/emeliedump/2000/1221/sys/src/9/pc/l.s 504a RET /* * Attempt at power saving. -rsc */ TEXT halt(SB), $0 HLT . 14a #define HLT BYTE $0xF4 . ## diffname pc/l.s 2001/0527 ## diff -e /n/emeliedump/2000/1221/sys/src/9/pc/l.s /n/emeliedump/2001/0527/sys/src/9/pc/l.s 511a CLI CMPL nrdy(SB), $0 JEQ _nothingready STI RET _nothingready: STI . ## diffname pc/l.s 2001/1130 ## diff -e /n/emeliedump/2001/0527/sys/src/9/pc/l.s /n/emeliedump/2001/1130/sys/src/9/pc/l.s 290c MOVL AX, 0(CX) /* lo */ . 285a TEXT rdtsc(SB), $0 /* time stamp counter; cycles since power up */ RDTSC MOVL vlong+0(FP), CX /* &vlong */ MOVL AX, 0(CX) /* lo */ MOVL DX, 4(CX) /* hi */ RET . 13a #define RDTSC BYTE $0x0F; BYTE $0x31 . ## diffname pc/l.s 2002/0109 ## diff -e /n/emeliedump/2001/1130/sys/src/9/pc/l.s /n/emeliedump/2002/0109/sys/src/9/pc/l.s 127a . 110,112c MOVL $0, (PDO(0))(CX) /* undo double-map of KZERO at 0 */ . 100c JMP* AX /* jump to the virtual nirvana */ . 98c MOVL $_startpg(SB), AX /* this is a virtual address */ . 88,90c MOVL (PDO(KZERO))(CX), DX /* double-map KZERO at 0 */ MOVL DX, (PDO(0))(CX) . 81,85d 79c * It is necessary on some processors to immediately follow mode switching with a JMP instruction . 71c MOVL $PADDR(CPU0PTE), AX . 63c MOVL $PADDR(CPU0PTE), AX /* first page of page table */ . 57c MOVL $PADDR(CPU0PDB), AX . 49c MOVL $PADDR(CPU0PDB), DI /* clear 4 pages for the tables etc. */ . 44,47c TEXT _start0x00100020(SB),$0 CLI /* make sure interrupts are off */ . 42a * An identity mmu map is also needed for the switch to virtual mode. This * identity mapping is removed once the MMU is going and the JMP has been made * to virtual memory. . 38,41c * In protected mode with paging turned off and segment registers setup to linear map all memory. * Entered via a jump to 0x00100020, the physical address of the virtual kernel entry point of 0x80100020 * Make the basic page tables for processor 0. Four pages are needed for the basic set: * a page directory, a page table for mapping the first 4MB of physical memory to KZERO, * and virtual and physical pages for mapping the Mach structure. . 36d 32,34c TEXT _start0x80100020(SB),$0 MOVL $_start0x00100020(SB), AX ANDL $~KZERO, AX . 27,30c * For backwards compatiblity with 9load - should go away when 9load is changed * 9load currently sets up the mmu, however the first 16MB of memory is identity * mapped, so behave as if the mmu was not setup . ## diffname pc/l.s 2002/0413 ## diff -e /n/emeliedump/2002/0109/sys/src/9/pc/l.s /n/emeliedump/2002/0413/sys/src/9/pc/l.s 497a MOVL $1, AX /* return 1 */ RET TEXT swaplabel(SB), $0 MOVL label+0(FP), AX MOVL pc+4(FP), BX MOVL 0(AX), SP /* restore sp */ MOVL 4(AX), CX /* put return pc on the stack */ MOVL CX, 0(SP) MOVL BX, 4(AX) /* put caller pc where return pc was */ . 305a TEXT sfence(SB), $0 SFENCE RET . 16a #define SFENCE BYTE $0x0F; BYTE $0xAE; BYTE $0xF8 . ## diffname pc/l.s 2002/0703 ## diff -e /n/emeliedump/2002/0413/sys/src/9/pc/l.s /n/emeliedump/2002/0703/sys/src/9/pc/l.s 506,515d ## diffname pc/l.s 2003/0401 ## diff -e /n/emeliedump/2002/0703/sys/src/9/pc/l.s /n/emeliedump/2003/0401/sys/src/9/pc/l.s 829a TEXT realmode(SB), $0 RET . 10c #define DELAY BYTE $0xEB; BYTE $0x00 /* JMP .+2 */ . ## diffname pc/l.s 2003/0402 ## diff -e /n/emeliedump/2003/0401/sys/src/9/pc/l.s /n/emeliedump/2003/0402/sys/src/9/pc/l.s 831,833d