From: SMTP%"VAXman@tmesis.com" 9-DEC-1997 16:23:59.98 To: EVERHART@ARISIA.GCE.COM CC: Subj: Primogeniture Return-Path: system@tmesis.com Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX); Tue, 9 Dec 1997 16:23:06 -0500 Received: from ALPHA.TMESIS.COM (tmesis.com [206.136.149.211]) by mercury.mv.net (8.8.8/mem-971025) with ESMTP id RAA02879 for ; Mon, 8 Dec 1997 17:55:45 -0500 (EST) Received: by TMESIS.COM (MX H5.0) id 2; Mon, 8 Dec 1997 18:01:20 -0400 Date: Mon, 8 Dec 1997 18:01:20 -0400 From: "Brian Schenkenberger, VAXman-" Reply-To: VAXman@TMESIS.COM To: EVERHART@ARISIA.GCE.COM Message-ID: <009BE78B.C0606263.2@TMESIS.COM> Subject: Primogeniture Hi, I'm still working on wording some of the documentation for Primogeniture but I thought, if you're curious, you might want to play with it for the time being. I put it on my anonymous FTP server for you. If you grab it, let me know and I will then delete it. Here is the comment section from the header of the PRIMOGEN.MAR file. It explains, in some detail, the elaborate steps needed to start a process in the context of the SYSINIT process prior to STARTUP.COM. ; The following details the various stages of the SYSINIT process and steps ; taken by PRIMOGENITURE at the various stages of the SYSINIT process. ; ; (-0-) The OpenVMS system is bootstrapped and proceeds with its normal ; system initialization processes as described in the OpenVMS VAX ; and/or Alpha Internals and Data Structures manuals. The system ; initialization process eventually creates the SYSINIT process. ; ; (-1-) The SYSINIT process is created and proceeds normally to when it ; invokes the routine LDR$ALTERNATE_LOAD to load optional execlets. ; At this time, it will load the PRIMOGENITURE support execlet. ; ; The execlet's initialization routine is, subsequently, invoked. ; ; (-2-) The PRIMOGENITURE initialization routine checks the base image ; cell EXE$GL_STATE to determine the current status and progress ; of the system's initialization. It checks the BOOSTATE$V_XQP ; bit in this cell ; ; If the BOOSTATE$V_XQP bit is 0, the initialization routine will ; allocate process P0 work space, declare a user mode AST, clear ; the INIRTN$V_NO_RECALL bit and return to its caller. ; ; Processing continues with step 3. ; ; If the BOOSTATE$V_XQP bit is 1, the initialization routine will ; locate a vector table in the supporting shareable image, merged ; into the SYSINIT process, obtain the entry point address of the ; create process routine and declare a user mode AST to start the ; PRIMOGENITURE process. ; ; Processing resumes at step 15. ; ; (-3-) The SYSINIT process returns to user mode after loading optional ; execlets. The user mode AST declared within the initialization ; routine is delivered and executes. ; ; An intercept is inserted into the servicing routine path of the ; SYS$ENQ system service. When the system service is invoked, it ; will determine if the lock request is for the MOU$nt resource. ; If so, an AST is queued to SYSINIT and the intercept is removed. ; The AST then returns to its caller. ; ; (-4-) When SYSINIT attempts to mount the boot device, an AST is queued ; to the SYSINIT process. ; ; (-5-) SYSINIT mounts the system boot device and returns to user mode. ; ; (-6-) Back at user mode, the user mode AST (see step 4) is delivered. ; This AST changes mode to executive and invokes a routine which ; opens and maps the XQP. (This is moot as of OpenVMS VAX V7.0.) ; ; On OpenVMS Alpha, the XQP is mapped by SYSINIT before mounting ; the boot device. OpenVMS Alpha processing continues at step 9. ; ; (-7-) The open XQP routine initilizes a FAB and opens the F11BQPX.EXE ; image file. The XQP open routine reads the XQP image's header ; and then, changes to kernel mode to map the XQP. ; ; (-8-) The XQP map routine scans the image's header locating the XQP's ; image section descriptors (ISDs). If the ISD's attributes are ; appropriate, it invokes the SYS$CRMPSC system service to create ; and map the ISDs as global sections named SYSXQP_nnn. For each ; section that is mapped, the routine increments XQP$GL_SECTIONS. ; ; This duplicates the normal SYSINIT process's mapping of the XQP. ; The routine then returns to its caller and subsequently, to its ; caller's caller. ; ; (-9-) Back at user mode, the completion AST changes to executive mode ; merging PRIMOGENITURE's support shareable image (Which doubles ; as PRIMOGENITURE's loadable executive image as well.) into the ; process address space of the SYSINIT process. When image fixup ; is complete, the virtual address space is expanded by an amount ; sufficiently sized to maintain a copy of the merged image which ; is then copied into this address space and the address space of ; the merged image is deleted. This removes any page references ; allowing later deassignment of the channel used for mapping the ; image. When the merged image address space is deleted, virtual ; address space is recreated in the original range and the merged ; image is copied back. This places the fixed up image into its ; original location. ; ;(-10-) Back at user mode, the AST uses the base address of the merged ; shareable to lookup the address of the INI_RECALL.MRG_AST_U AST ; routine in the merged shareable image's routine vector. Then, ; the complete AST declares a user mode AST with this address as ; an AST routine address. ; ;(-11-) The completion routine returns to its caller. The AST which it ; declared above is delivered. ; ;(-12-) This AST invokes the system routine LDR$INIT_ALL at kernel mode ; which will re-invoked the initialization routine of this image. ; ;(-13-) The initialization routine checks the BOOSTATE$V_XQP bit in the ; global cell EXE$GL_STATE. At this time, the bit should be set. ; The routine sets the bit LDRIMG$V_CAN_UNL to permit the execlet ; to be completely removed from memory. The routine then obtains ; the base address of the merged shareable image and it uses this ; address to lookup the address of the routine used to start the ; PRIMOGENITURE process. It declares the user mode AST that will ; invoke this routine. The initialization routine returns to its ; caller and it is subsequently deallocated. ; ;(-14-) SYSINIT returns to user mode. This causes the process creation ; AST to be delivered. ; ;(-15-) The process creation AST creates a mailbox and obtains its unit ; number. A write attention AST is queued on this mailbox. The ; write attention AST routine will read the mailbox to obtain the ; PRIMOGENITURE process's termination record. Termination status ; is written in the merged image's data program section for debug ; purposes when the PRIMOGENITURE process terminates. ; ;(-16-) The process creation AST invokes the SYS$CREPRC system service ; and creates the PRIMOGENITURE process. Upon its creation under ; OpenVMS VAX, the routine zeroes XQP$GL_SECTIONS. SYSINIT will ; recount the XQP sections when it maps the XQP routine. Because ; the XQP sections have already been created, the SYSINIT mapping ; routine simply maps these existing sections, recounts them, and ; stores the count in XQP$GL_SECTIONS. ; ;(-17-) The final consequence of the process creation AST routine is to ; place the SYSINIT process into a hibernate (HIB) state to await ; the completion of the PRIMOGENITURE process. ; ;(-18-) The AST returns to its caller and SYSINIT hibernates until the ; PRIMOGENITURE process has completed. ; ;(-19-) The PRIMOGENITURE process executes the commands in PRIMOGEN.COM ; and then, terminates. ; ;(-20-) The termination mailbox AST will record the termination status ; and then, wakes the SYSINIT process. SYSINIT continues to its ; final initialization steps where it creates the normal OpenVMS ; STARTUP process. ; ;(-21-) The SYSINIT process terminates. ; ; All of the events described above are closely related to the OpenVMS VAX ; and/or Alpha system initialization sequence, as well as, the functions of ; the executive image loader. Details of the OpenVMS system initialization ; sequence and the executive image loader are detailed in the following: ; ; "VAX/VMS Internals and Data Structures (Version 5.2)" ; "OpenVMS AXP Internals and Data Structures (Version 1.5)". -- VAXman- OpenVMS APE certification number: AAA-0001 VAXman@TMESIS.COM All your spirit rack abuses, come to haunt you back by day. All your byzantine excuses, given time, give you away. Don't be surprised when daylight comes, to find that memory prick your thumbs. You'll tell them where we run to hide. I'm already dead. Matter of time.