123242Smckusick /* 223242Smckusick * Copyright (c) 1982 Regents of the University of California. 323242Smckusick * All rights reserved. The Berkeley software License Agreement 423242Smckusick * specifies the terms and conditions for redistribution. 523242Smckusick * 6*25442Skarels * @(#)srt0.c 6.4 (Berkeley) 11/08/85 723242Smckusick */ 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 16*25442Skarels * Relocating version for boot* 171914Swnj */ 18326Sbill 193349Swnj .globl _end 201757Sbill .globl _edata 21326Sbill .globl _main 22326Sbill .globl __rtt 233263Swnj .globl _configure 243349Swnj .globl _cpu 253349Swnj .globl _openfirst 26326Sbill 27326Sbill .set HIGH,31 # mask for total disable 28326Sbill 292438Swnj entry: .globl entry 30326Sbill .word 0x0 31326Sbill mtpr $HIGH,$IPL # just in case 323349Swnj #ifdef REL 333349Swnj movl $RELOC,sp 343349Swnj #else 353349Swnj movl $RELOC-0x2400,sp 363349Swnj #endif 372438Swnj start: 383349Swnj movl aedata,r0 39411Sbill clr: 40411Sbill clrl (r0)+ 41411Sbill cmpl r0,sp 42411Sbill jlss clr 433349Swnj #ifdef REL 4412366Ssam movc3 aedata,*$0,(sp) 4512366Ssam /* 4612366Ssam * Reclear bss segment separately from text and data 4712366Ssam * since movc3 can't move more than 64K bytes 4812366Ssam */ 4912366Ssam dclr: 5012366Ssam clrl (r3)+ 5112366Ssam cmpl r3,$_end 5212366Ssam jlss dclr 5312366Ssam /* this loop shouldn't be necessary, but is when booting from an ra81 */ 5412366Ssam xclr: 5512366Ssam clrl (r3)+ 5612366Ssam cmpl r3,$0x100000 5712366Ssam jlss xclr 583349Swnj jmp *abegin 593349Swnj begin: 603349Swnj #endif 613349Swnj mtpr $0,$SCBB 623263Swnj calls $0,_configure 633349Swnj movl $1,_openfirst 64326Sbill calls $0,_main 653349Swnj #ifndef TP 66326Sbill jmp start 673349Swnj #else 683349Swnj ret 693349Swnj #endif 70326Sbill 713349Swnj .data 723349Swnj #ifdef REL 733349Swnj abegin: .long begin 743349Swnj aedata: .long _edata-RELOC 753349Swnj #else 763349Swnj aedata: .long _edata 773349Swnj #endif 783349Swnj 79326Sbill __rtt: 80326Sbill .word 0x0 81*25442Skarels #ifdef REL 82*25442Skarels halt 83*25442Skarels #else 84326Sbill jmp start 85*25442Skarels #endif 863349Swnj 873349Swnj .globl _badloc 883349Swnj _badloc: 893349Swnj .word 0 903349Swnj movl $1,r0 913349Swnj movl 4(ap),r3 923349Swnj movl $4,r2 933349Swnj movab 9f,(r2) 943349Swnj tstl (r3) 953349Swnj 1: clrl r0 # made it w/o machine checks 963349Swnj 2: movl $4,r2 973349Swnj clrl (r2) 983349Swnj ret 993349Swnj .align 2 1003349Swnj 9: 1013349Swnj casel _cpu,$1,$VAX_MAX 1023349Swnj 0: 1033349Swnj .word 8f-0b # 1 is 780 1043349Swnj .word 5f-0b # 2 is 750 1057446Sroot .word 5f-0b # 3 is 730 10624153Sbloom .word 6f-0b # 4 is 8600 1073349Swnj 5: 1083349Swnj mtpr $0xf,$MCESR 1093349Swnj brb 1f 11024153Sbloom 6: 11124153Sbloom mtpr $0,$EHSR 11224153Sbloom brb 1f 1133349Swnj 8: 1143349Swnj mtpr $0,$SBIFS 1153349Swnj 1: 1163349Swnj addl2 (sp)+,sp # discard mchchk trash 1173349Swnj movab 2b,(sp) 1183349Swnj rei 119