xref: /openbmc/qemu/pc-bios/s390-ccw/start.S (revision b45c03f5)
1/*
2 * First stage boot loader for virtio devices. The compiled output goes
3 * into the pc-bios directory of qemu.
4 *
5 * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
6 * Copyright 2013 IBM Corp.
7 *
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
10 * directory.
11 */
12
13        .globl _start
14_start:
15
16larl	%r15, stack + 0x8000    /* Set up stack */
17larl    %r6, boot_value
18stg     %r7, 0(%r6)     /* save the boot_value before any function calls */
19j	main                    /* And call C */
20
21/*
22 * void disabled_wait(void)
23 *
24 * stops the current guest cpu.
25 */
26	.globl disabled_wait
27disabled_wait:
28        larl %r1,disabled_wait_psw
29        lpswe   0(%r1)
30
31
32/*
33 * void consume_sclp_int(void)
34 *
35 * eats one sclp interrupt
36 */
37        .globl consume_sclp_int
38consume_sclp_int:
39        /* enable service interrupts in cr0 */
40        stctg 0,0,0(15)
41        oi 6(15), 0x2
42        lctlg 0,0,0(15)
43        /* prepare external call handler */
44        larl %r1, external_new_code
45        stg %r1, 0x1b8
46        larl %r1, external_new_mask
47        mvc 0x1b0(8),0(%r1)
48        /* load enabled wait PSW */
49        larl %r1, enabled_wait_psw
50        lpswe 0(%r1)
51
52external_new_code:
53        /* disable service interrupts in cr0 */
54        stctg 0,0,0(15)
55        ni 6(15), 0xfd
56        lctlg 0,0,0(15)
57        br 14
58
59        .align  8
60disabled_wait_psw:
61        .quad   0x0002000180000000,0x0000000000000000
62enabled_wait_psw:
63        .quad   0x0302000180000000,0x0000000000000000
64external_new_mask:
65        .quad   0x0000000180000000
66