/* boot.c 1.5 86/12/18 */
#include "../machine/mtpr.h"
* Boot program... arguments passed in r10 and r11 determine
* whether boot stops to ask for system name and which device
/* Types in r10 specifying major device */
#define MAXTYPE (sizeof(devname) / sizeof(devname[0]))
#define DEV_DFLT 1 /* vd/dk */
register dummy
; /* skip r12 */
register howto
, devtype
; /* howto=r11, devtype=r10 */
register type
, part
, unit
;
howto
= RB_ASKNAME
|RB_SINGLE
;
if ((devtype
& B_MAGICMASK
) != B_DEVMAGIC
)
devtype
= DEV_DFLT
<< B_TYPESHIFT
; /* unit, partition 0 */
type
= (devtype
>> B_TYPESHIFT
) & B_TYPEMASK
;
unit
= (devtype
>> B_UNITSHIFT
) & B_UNITMASK
;
unit
+= 8 * ((devtype
>> B_ADAPTORSHIFT
) & B_ADAPTORMASK
);
part
= (devtype
>> B_PARTITIONSHIFT
) & B_PARTITIONMASK
;
if ((howto
& RB_ASKNAME
) == 0) {
if (type
>= 0 && type
<= MAXTYPE
&& devname
[type
][0]) {
*cp
++ = devname
[type
][0];
*cp
++ = devname
[type
][1];
howto
= RB_SINGLE
|RB_ASKNAME
;
if (howto
& RB_ASKNAME
) {
if (howto
& RB_ASKNAME
) {
* Build up devtype register to pass on to
for (i
= 0; i
<= MAXTYPE
; i
++)
if ((devname
[i
][0] == cp
[0]) &&
(devname
[i
][1] == cp
[1]))
devtype
= i
<< B_TYPESHIFT
;
if (*cp
>= '0' && *cp
<= '9')
i
= i
* 10 + *cp
++ - '0';
devtype
|= ((i
% 8) << B_UNITSHIFT
);
devtype
|= ((i
/ 8) << B_ADAPTORSHIFT
);
devtype
|= atol(cp
) << B_PARTITIONSHIFT
;
copyunix(howto
, devtype
, io
);
howto
= RB_SINGLE
|RB_ASKNAME
;
howto
|= RB_SINGLE
|RB_ASKNAME
;
copyunix(howto
, devtype
, io
)
register io
, howto
, devtype
; /* NOTE ORDER */
register int esym
; /* must be r9 */
i
= read(io
, (char *)&x
, sizeof x
);
(x
.a_magic
!= 0407 && x
.a_magic
!= 0413 && x
.a_magic
!= 0410))
if (x
.a_magic
== 0413 && lseek(io
, 0x400, 0) == -1)
if (read(io
, (char *)RELOC
, x
.a_text
) != x
.a_text
)
addr
= (char *)(x
.a_text
+ RELOC
);
if (x
.a_magic
== 0413 || x
.a_magic
== 0410)
while ((int)addr
& CLOFSET
)
if (read(io
, addr
, x
.a_data
) != x
.a_data
)
if (howto
& RB_KDB
&& x
.a_syms
) {
for (i
= 0; i
< x
.a_bss
; i
++)
*(int *)addr
= x
.a_syms
; /* symbol table size */
printf("[+%d", x
.a_syms
);
if (read(io
, addr
, x
.a_syms
) != x
.a_syms
)
if (read(io
, addr
, sizeof (int)) != sizeof (int))
i
= *(int *)addr
- sizeof (int); /* string table size */
if (read(io
, addr
, i
) != i
)
esym
= roundup((int)addr
, sizeof (int));
x
.a_bss
+= 32*1024; /* slop */
for (i
= 0; i
< x
.a_bss
; i
++)
printf(" start 0x%x\n", x
.a_entry
);
mtpr(PADC
, 0); /* Purge data cache */
mtpr(PACC
, 0); /* Purge code cache */
mtpr(DCR
, 1); /* Enable data cache */
(*((int (*)()) x
.a_entry
))();