1*23242Smckusick /* 2*23242Smckusick * Copyright (c) 1982 Regents of the University of California. 3*23242Smckusick * All rights reserved. The Berkeley software License Agreement 4*23242Smckusick * specifies the terms and conditions for redistribution. 5*23242Smckusick * 6*23242Smckusick * @(#)srt0.c 6.2 (Berkeley) 06/08/85 7*23242Smckusick */ 8326Sbill 99186Ssam #include "../vax/mtpr.h" 103349Swnj #define LOCORE 119186Ssam #include "../vax/cpu.h" 123263Swnj 131914Swnj /* 141914Swnj * Startup code for standalone system 151914Swnj * Non-relocating version -- for programs which are loaded by boot 161914Swnj */ 17326Sbill 183349Swnj .globl _end 191757Sbill .globl _edata 20326Sbill .globl _main 21326Sbill .globl __rtt 223263Swnj .globl _configure 233349Swnj .globl _cpu 243349Swnj .globl _openfirst 25326Sbill 26326Sbill .set HIGH,31 # mask for total disable 27326Sbill 282438Swnj entry: .globl entry 29326Sbill .word 0x0 30326Sbill mtpr $HIGH,$IPL # just in case 313349Swnj #ifdef REL 323349Swnj movl $RELOC,sp 333349Swnj #else 343349Swnj movl $RELOC-0x2400,sp 353349Swnj #endif 362438Swnj start: 373349Swnj movl aedata,r0 38411Sbill clr: 39411Sbill clrl (r0)+ 40411Sbill cmpl r0,sp 41411Sbill jlss clr 423349Swnj #ifdef REL 4312366Ssam movc3 aedata,*$0,(sp) 4412366Ssam /* 4512366Ssam * Reclear bss segment separately from text and data 4612366Ssam * since movc3 can't move more than 64K bytes 4712366Ssam */ 4812366Ssam dclr: 4912366Ssam clrl (r3)+ 5012366Ssam cmpl r3,$_end 5112366Ssam jlss dclr 5212366Ssam /* this loop shouldn't be necessary, but is when booting from an ra81 */ 5312366Ssam xclr: 5412366Ssam clrl (r3)+ 5512366Ssam cmpl r3,$0x100000 5612366Ssam jlss xclr 573349Swnj jmp *abegin 583349Swnj begin: 593349Swnj #endif 603349Swnj mtpr $0,$SCBB 613263Swnj calls $0,_configure 623349Swnj movl $1,_openfirst 63326Sbill calls $0,_main 643349Swnj #ifndef TP 65326Sbill jmp start 663349Swnj #else 673349Swnj ret 683349Swnj #endif 69326Sbill 703349Swnj .data 713349Swnj #ifdef REL 723349Swnj abegin: .long begin 733349Swnj aedata: .long _edata-RELOC 743349Swnj #else 753349Swnj aedata: .long _edata 763349Swnj #endif 773349Swnj 78326Sbill __rtt: 79326Sbill .word 0x0 80326Sbill jmp start 813349Swnj 823349Swnj .globl _badloc 833349Swnj _badloc: 843349Swnj .word 0 853349Swnj movl $1,r0 863349Swnj movl 4(ap),r3 873349Swnj movl $4,r2 883349Swnj movab 9f,(r2) 893349Swnj tstl (r3) 903349Swnj 1: clrl r0 # made it w/o machine checks 913349Swnj 2: movl $4,r2 923349Swnj clrl (r2) 933349Swnj ret 943349Swnj .align 2 953349Swnj 9: 963349Swnj casel _cpu,$1,$VAX_MAX 973349Swnj 0: 983349Swnj .word 8f-0b # 1 is 780 993349Swnj .word 5f-0b # 2 is 750 1007446Sroot .word 5f-0b # 3 is 730 1013349Swnj 5: 1023349Swnj mtpr $0xf,$MCESR 1033349Swnj brb 1f 1043349Swnj 8: 1053349Swnj mtpr $0,$SBIFS 1063349Swnj 1: 1073349Swnj addl2 (sp)+,sp # discard mchchk trash 1083349Swnj movab 2b,(sp) 1093349Swnj rei 110