cp: make con_printf non-fatal no-op
[hvf.git] / loader / setmode.s
blob1c83c9cb24cdafe741acf5eae51b7da4d957d1e5
2 # Copyright (c) 2007-2009 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.
40 # NOTE: Once this thread of execution turns into the idle thread,
41 # the stack can be reused for something else. Since it's allocated
42 # in the 128th processor's PSA, we have to make sure that it won't
43 # get initialized until after the idle thread kicks in.
46 # r15 = 0x100000
47 # = (1 << 20)
49 SR %r15, %r15
50 LHI %r15, 0x1
51 SLL %r15, 20
52 AHI %r15, -160
54 BRC 15,load_nucleus