9fans archive / 1996 / 11 / 5 / prev next
From: Tad Hunt tad@elw...
Subject: DEC pmax support in vl (W/O broken attachments)
Date: Sun, 03 Nov 1996 13:31:16 -0500
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <21904.847045875.1@elw...>
Looks like I screwed up the attachments. This is attempt number 2.
I'm working on porting plan9 to the DEC pmax. The pmax is a little
endian based mips port. Step one was to make the plan9 mips toolset output
little endian code. The following 3 diffs patch vl(1) to make bootable
pmax code.
-Tad
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <21904.847045875.2@elw...>
Content-Description: "vl/asm.c.diff"
373a
wput(short s)
{
WPUT(s);
}
void
..
350a
case 6:
/* struct filehdr */
wput(0x162); /* f_magic (MIPSELMAGIC) */
wput(3); /* f_nscns */
lput(time(0)); /* f_timdat */
lput(0); /* f_symptr */
lput(0); /* f_nsyms */
wput(56); /* f_opthdr */
wput(7); /* f_flags */
/* struct aouthdr */
wput(0407); /* magic (OMAGIC) */
wput(0x300); /* vstamp */
lput(rnd(textsize,INITRND)); /* tsize */
lput(rnd(datsize,INITRND)); /* dsize */
lput(rnd(bsssize,INITRND)); /* bsize */
lput(entryvalue()); /* entry */
lput(INITTEXT); /* text_start */
lput(INITDAT); /* data_start */
lput(rnd(INITDAT+datsize,
INITRND)); /* bss_start */
lput(~0L); /* gp reg mask */
lput(0L); /* cprmask[0] */
lput(~0L); /* cprmask[1] */
lput(0L); /* cprmask[2] */
lput(0L); /* cprmask[3] */
lput(~0L); /* gp value */
/* section header: text */
strnput(".text", 8); /* s_name: text segment */
lput(INITTEXT); /* s_paddr: phys addr */
lput(INITTEXT); /* s_vaddr: virt addr */
lput(rnd(textsize,INITRND)); /* s_size: section size */
lput(rnd(HEADR,INITRND)); /* s_scnptr: filep offset */
lput(0L); /* s_relptr: filep to reloc */
lput(0L); /* s_lnnoptr: unused */
wput(0); /* s_nreloc */
wput(0); /* s_nlnno: unused */
lput(0x20); /* s_flags: TEXT */
/* section header: data */
strnput(".data", 8); /* s_name: data segment */
lput(INITDAT); /* s_paddr: phys addr */
lput(INITDAT); /* s_vaddr: virt addr */
lput(rnd(datsize,INITRND)); /* s_size: section size */
lput(rnd(HEADR,INITRND)
+rnd(textsize,INITRND)); /* s_scnptr: filep offset */
lput(0L); /* s_relptr: filep to reloc */
lput(0L); /* s_lnnoptr: unused */
wput(0); /* s_nreloc */
wput(0); /* s_nlnno: unused */
lput(0x40); /* s_flags: DATA */
/* section header: bss */
strnput(".bss", 8); /* s_name: bss segment */
lput(rnd(INITDAT+
datsize,INITRND)); /* s_paddr: phys addr */
lput(rnd(INITDAT+
datsize,INITRND)); /* s_vaddr: virt addr */
lput(rnd(bsssize,INITRND)); /* s_size: section size */
lput(0L); /* s_scnptr: filep to section */
lput(0L); /* s_relptr: filep to reloc */
lput(0L); /* s_lnnoptr: unused */
wput(0); /* s_nreloc */
wput(0); /* s_nlnno: unused */
lput(0x80); /* s_flags: BSS */
..
132a
case 6:
OFFSET=rnd(HEADR,INITRND)
+rnd(HEADR+textsize,INITRND)
+rnd(datsize,INITRND);
seek(cout, OFFSET, 0);
break;
..
105a
case 6:
OFFSET = rnd(HEADR,INITRND)+rnd(textsize,INITRND);
seek(cout, OFFSET, 0);
break;
..
64c
switch(HEADTYPE) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
OFFSET = HEADR;
break;
case 6:
OFFSET = rnd(HEADR,INITRND);
break;
}
..
27a
#define WPUT(c) { if(endian == 'B') { cbp[0] = (c)>>8; cbp[1] = (c); } else { cbp[0] = (c); cbp[1] = (c)>>8; } cbp += 2; cbc -= 2; if(cbc <= 0) cflush(); }
..
18,21c
if(endian == 'B') { \
cbp[0] = (c)>>24;\
cbp[1] = (c)>>16;\
cbp[2] = (c)>>8;\
cbp[3] = (c);\
} else { \
cbp[0] = (c);\
cbp[1] = (c)>>8;\
cbp[2] = (c)>>16;\
cbp[3] = (c)>>24;\
} \
..
2a
extern char endian;
..
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <21904.847045875.3@elw...>
Content-Description: "vl/obj.c.diff"
1220c
c = find1(order, i+1);
..
1218a
long order;
if(endian == 'B') order = 0x01020304L;
else order = 0x04030201L;
..
151a
case 6: /* boot for dec pmax */
HEADR = 20L+56L+3*40L;
if(INITTEXT == -1)
INITTEXT = 0x80020000L;
if(INITDAT == -1)
INITDAT = 0;
if(INITRND == -1)
INITRND = 16;
endian = 'L';
break;
..
125c
case 3: /* boot for sgi 4k */
..
107c
case 1: /* boot for sgi 3k */
..
19a
* -H6 -T0x80030000 -R16 is dec pmax boot coff executable
..
17c
* -H3 -T0x80020000 -R8 is bootp() format for sgi 4k
..
15c
* -H1 -T0x80020000 -R4 is bootp() format for sgi 3k
..
12a
char endian = 'B';
..
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <21904.847045875.4@elw...>
Content-Description: "vl/l.h"
273a
void wput(short);
..
------- =_aaaaaaaaaa0--