From mboxrd@z Thu Jan 1 00:00:00 1970 From: wkt@tuhs.org (Warren Toomey) Date: Wed, 7 Jan 2015 17:39:35 +1100 Subject: [TUHS] pdp11 UNIX memory allocation. In-Reply-To: References: <54AC4394.3050302@update.uu.se> <1420576433.410248.210385277.513EF8EC@webmail.messagingengine.com> <5E62DDAA-0055-46FB-8077-92DB856DEEE0@ronnatalie.com> <2509FDBD-67C4-4552-BB58-01281049DCB6@ronnatalie.com> Message-ID: <20150107063935.GA27943@www.oztivo.net> On Wed, Jan 07, 2015 at 05:29:45PM +1100, Dave Horsfall wrote: > I heard a story that on sufficiently-early Unices, the header was indeed > loaded, hence the "407". > Any grey-beards here like to comment? My beard isn't grey (yet), but here's the link to the 1st Edition code which does exec(2): http://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/u2.s and here is the relevant code: mov $14,u.count mov $u.off,u.fofp clr u.off / set offset in file to be read to zero jsr r0,readi / read in first six words of user's file, starting / at $core mov sp,r5 / put users stack address in r5 sub $core+40.,r5 / subtract $core +40, from r5 (leaves / number of words less 26 available for / program in user core mov r5,u.count / cmp core,$405 / br .+14 is first instruction if file is / standard a.out format bne 1f / branch, if not standard format mov core+2,r5 / put 2nd word of users program in r5; number of / bytes in program text sub $14,r5 / subtract 12 cmp r5,u.count / bgt 1f / branch if r5 greater than u.count mov r5,u.count jsr r0,readi / read in rest of user's program text add core+10,u.nread / add size of user data area to u.nread br 2f 1: jsr r0,readi / read in rest of file My memory of PDP-11 assembly is too rusty to interpret this. Anybody else? Cheers, Warren