|
|
1.1 ! root 1: /* sizmem.s - sizmem */ ! 2: ! 3: #include <procreg.h> ! 4: #include <conf.h> ! 5: #include <mach.h> ! 6: ! 7: /*---------------------------------------------------------------------------- ! 8: * sizmem -- size memory, place highest valid address of an int in _maxaddr ! 9: * assumption: executing on kernel stack, interrupts disabled ! 10: *---------------------------------------------------------------------------- ! 11: */ ! 12: ! 13: #define HIGHADDR 0x20000000 /* highest address of int on VAX*/ ! 14: /* (below device csr addresses) */ ! 15: #define CONSDB 0x2000 /* sizeof UVAXII console database */ ! 16: .text ! 17: .align 1 ! 18: .globl sizmem ! 19: sizmem: ! 20: .word 0x4 /* save register 2 */ ! 21: tstl -(sp) /* allocate local for disable */ ! 22: pushal -4(fp) /* address of local */ ! 23: calls $1, _disable /* disable interrupts */ ! 24: movl lowcore+4, -(sp) /* push old exception vector */ ! 25: bisl3 $1, $siztrap, lowcore+4 /* set exception vector to */ ! 26: /* catch memory exceptions */ ! 27: /* (with memory mapping */ ! 28: /* disabled, the VAX takes a */ ! 29: /* machine check exception) */ ! 30: /* NOTE: must handle mach. chk. */ ! 31: /* on interrupt stack */ ! 32: /* (hence bits<1,0> == 01) */ ! 33: calls $0, _ovfloff /* disable int oflow exceptions */ ! 34: clrl r0 /* r0 holds low address */ ! 35: movl $HIGHADDR, r1 /* r1 = highest addr of an int */ ! 36: sizloop: ! 37: cmpl r0, r1 /* see if low > high */ ! 38: jgtru setsize /* yes: restore & return */ ! 39: addl3 r0, r1, r2 /* calculate midpoint */ ! 40: jcc rotate /* if carry set, set low bit, */ ! 41: bisl2 $1, r2 /* soon to be high bit */ ! 42: rotate: ! 43: rotl $-1, r2, r2 /* div by 2 by shifting right 1 */ ! 44: bicl2 $3, r2 /* address is multiple of 4 */ ! 45: tstl (r2)+ /* reference what r2 points to */ ! 46: /* note: if exception taken, r2 */ ! 47: /* is not incremented */ ! 48: movl r2, r0 /* mid caused no exception -- */ ! 49: /* set low to mid address + 4 */ ! 50: jbr sizloop ! 51: setsize: ! 52: mfpr $SID, r3 /* get system id register value */ ! 53: bicl2 $SYSTYPE, r3 /* mask off system id */ ! 54: cmpl r3, $UVAXIISID /* compare with UVAXII sid value*/ ! 55: jneq uimax /* if MicroVAX II, reserve 8K */ ! 56: subl3 $CONSDB, r1, _maxaddr /* high mem for console database*/ ! 57: jmp rest ! 58: uimax: movl r1, _maxaddr /* store result */ ! 59: rest: movl (sp)+, lowcore+4 /* restore exception vector */ ! 60: pushal -4(fp) /* argument to restore */ ! 61: calls $1, _restore /* restore interrupts */ ! 62: ret /* return to caller */ ! 63: .align 2 /* align on longword boundary */ ! 64: siztrap: ! 65: /* machine chk--on intrrpt stk */ ! 66: subl3 $4, r2, r1 /* midpt caused exception, set */ ! 67: /* high address to mid - 4 */ ! 68: addl2 (sp)+, sp /* pop error data from exception*/ ! 69: /* erase machine check history: */ ! 70: #if defined(VAX780) || defined(VAX785) ! 71: mtpr $SBIFSCLR, $SBIFS /* clear SBI history of machchk */ ! 72: #endif VAX78X ! 73: #if defined(UVAX) || defined(VAX750) || \ ! 74: defined(VAX730) || defined(VAX725) ! 75: mtpr $MCESRCLR, $MCESR /* clear machine check history */ ! 76: #endif UVAXX || VAX750 || VAX730 || VAX725 ! 77: #if defined(VAX8600) ! 78: mtpr $0, $EHSR ! 79: #endif VAX8600 ! 80: moval sizloop, (sp) /* go back to sizloop on rei */ ! 81: rei /* back on kernel stack again */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.