1 This file attempts to describe what happens during IPL.
3 NOTE: At the time, only IPL from tape and card reader is supported.
5 1) system reads 24 bytes from the device
7 a) bytes 0-7: new PSW, no interrupts, start address 0x800000 (8MB)
11 b) bytes 8-15: CCW to rewind the tape to previous TM
13 c) bytes 16-23: CCW to read the entire loader to 0x800000 (8 MB)
17 b) bytes 8-15: CCW to read 80 bytes (containing up to 10 CCWs) to
20 c) bytes 16-23: CCW to read 24 bytes (containing up to 3 CCWs) to 0x68
22 Command chaining starts reading CCWs from addres 0x18 on. These read
23 the loader to 0x800000 (8 MB)
25 2) arch mode is changed to z/Arch (see ipl/setmode.S)
27 3) temporary stack is set up (R15 being the pointer) (see ipl/setmode.S)
29 4) loader begins to execute: function load_nucleus (see ipl/loader.c)
31 NOTE: loader.c use static inlines extensively, and thefore stack usage is
34 a) If the IPL was from a tape, a CCW is issues to seek to the next TM
36 b) nucleus is read from tape to 0x400000 (4 MB)
38 NOTE: the data at 4MB just read is a 64-bit s390 ELF binary with Linux
41 i) addition CCW address is set in the ORB
43 ii) __readnucleus() is called; this function is implemented in
44 assembly (see ipl/loader_asm.S)
46 iii) IO interrupt handler is set up (implemented in asm, see
49 iv) ORB is sent to the subchannel
51 v) interrupts are enabled
53 vi) a new PSW with wait state bit set is loaded
57 1) TSCH is issued to fill in a IRB
59 2) magic value (ORB int param) is checked
61 3) Device End flag is checked in the IRB
63 NOTE: more checks should be performed here
65 4) If the device end flag is set, return to code that set up the
68 5) otherwise, load up the old IO PSW (the one with the wait
71 viii)return to caller (back to ipl/loader.c)
73 c) verify ELF header magic number, machine, type, etc. values
75 d) traverse the section headers & copy data to final destination
77 i) if the section type is PROGBITS (data stored in the ELF), copy
78 the data from it's temporary location to the desired location
79 (destination, offset within file, and length are all stored in
80 the section header) - this takes care of .text, .data, and
83 ii) if the section type is NOBITS (uninitialized storage, e.g.,
84 .bss), do nothing, just assume that the location is a valid
87 iii) skip any other section types
89 NOTE: SYMTAB and STRTAB section types should be copied to a useful
90 location to allow for symbols to be looked up during nucleus execution
92 e) jump to the entry point as indicated by the ELF header
94 At this point, the nucleus is executing.