Added tag v0.12 for changeset d3934b75e5e7
[hvf.git] / installer / setmode.s
blobbd0fd0f5ba45be14375882520bdb62962b7352ef
2 # Copyright (c) 2007-2011 Josef 'Jeff' Sipek
5 .globl MAIN
6 .type MAIN, @function
7 MAIN:
9 # At this point, the machine is running in ESA390 mode. Let's load a new
10 # PSW, making it switch to 64-bit mode
13 # switch to 64-bit mode
15 # Signal Processor
16 # Order 0x12: Set Architecture
17 # R1 bits 56-63 = 0x01 (switch all CPUs to z/Arch)
18 SR %r1, %r1
19 LHI %r1, 0x1 # switch all to z/Arch
20 SR %r3, %r3 # CPU Address (CPU0000)
21 SIGP %r1, %r3, 0x12 # Signal, order 0x12
22 SAM64
23 # On error:
24 # Bit 55 = 1, cc1 (inval param)
25 # Bit 54 = 1, cc1 (incorrect state)
27 # FIXME: check for errors?
30 # At this point, we should be in 64-bit mode
34 # It is unfortunate that the below code is required.
36 # Let's set the stack pointer to make gcc happy
38 # A standard stack frame is 160 bytes.
41 # r15 = 0x100000
42 # = (1 << 20)
44 SGR %r15, %r15
45 LGHI %r15, 0x1
46 SLLG %r15, %r15, 20
47 AGHI %r15, -160
49 BRC 15,load_nucleus