Import source
[hvf.git] / Documentation / ipl.txt
blob83e6ee605d48924454624be2e7d792c557dec7a1
1 This file attempts to describe what happens during IPL.
3 NOTE: At the time, only IPL from tape is supported.
5 1) system reads 24 bytes from the device
7    a) bytes   0-7: new PSW, no interrupts, start address 0x800000 (8MB)
9    b) bytes  8-15: CCW to rewind the tape to previous TM
11    c) bytes 16-23: CCW to read the entire loader to 0x800000 (8 MB)
13 2) arch mode is changed to z/Arch (see ipl/setmode.S)
15 3) temporary stack is set up (R15 being the pointer) (see ipl/setmode.S)
17 4) loader begins to execute: function load_nucleus (see ipl/loader.c)
19    NOTE: loader.c use static inlines extensively, and thefore stack usage is
20    minimal
22    a) nucleus is read from tape to 0x400000 (4 MB)
24       NOTE: the data at 4MB just read is an 64-bit s390 ELF binary with
25       Linux ABI bits
27       i)   addition CCW address is set in the ORB
29       ii)  __readnucleus() is called; this function is implemented in
30            assembly (see ipl/loader_asm.S)
32       iii) IO interrupt handler is set up (implemented in asm, see
33            ipl/loader_asm.S)
35       iv)  ORB is sent to the subchannel
37       v)   interrupts are enabled
39       vi)  a new PSW with wait state bit set is loaded
41       vii) on IO interrupt
43            1) TSCH is issued to fill in a IRB
45            2) magic value (ORB int param) is checked
47            3) Device End flag is checked in the IRB
49               NOTE: more checks should be performed here
51            4) If the device end flag is set, return to code that set up the
52               interrupt handler
54            5) otherwise, load up the old IO PSW (the one with the wait
55               state)
57       viii)return to caller (back to ipl/loader.c)
59    b) verify ELF header magic number, machine, type, etc. values
61    c) traverse the section headers & copy data to final destination
63       i)   if the section type is PROGBITS (data stored in the ELF), copy
64            the data from it's temporary location to the desired location
65            (destination, offset within file, and length are all stored in
66            the section header) - this takes care of .text, .data, and
67            .rodata sections
69       ii)  if the section type is NOBITS (uninitialized storage, e.g.,
70            .bss), do nothing, just assume that the location is a valid
71            location in memory
73       iii) skip any other section types
75       NOTE: SYMTAB and STRTAB section types should be copied to a useful
76       location to allow for symbols to be looked up during nucleus execution
78    d) jump to the entry point as indicated by the ELF header
80 At this point, the nucleus is executing.