xref: /openbmc/qemu/tests/migration/s390x/a-b-bios.c (revision 6dcf8a9a749bb612aff8b172d55b53d5d994e28c)
15571dc82SThomas Huth /*
25571dc82SThomas Huth  * S390 guest code used in migration tests
35571dc82SThomas Huth  *
45571dc82SThomas Huth  * Copyright 2018 Thomas Huth, Red Hat Inc.
55571dc82SThomas Huth  *
65571dc82SThomas Huth  * This code is free software; you can redistribute it and/or modify it
75571dc82SThomas Huth  * under the terms of the GNU General Public License as published by the
85571dc82SThomas Huth  * Free Software Foundation; either version 2 of the License, or (at your
95571dc82SThomas Huth  * option) any later version.
105571dc82SThomas Huth  */
115571dc82SThomas Huth 
125571dc82SThomas Huth #define LOADPARM_LEN 8  /* Needed for sclp.h */
135571dc82SThomas Huth 
145571dc82SThomas Huth #include <libc.h>
155571dc82SThomas Huth #include <s390-ccw.h>
165571dc82SThomas Huth #include <sclp.h>
175571dc82SThomas Huth 
185571dc82SThomas Huth char stack[0x8000] __attribute__((aligned(4096)));
195571dc82SThomas Huth 
205571dc82SThomas Huth #define START_ADDRESS  (1024 * 1024)
215571dc82SThomas Huth #define END_ADDRESS    (100 * 1024 * 1024)
225571dc82SThomas Huth 
main(void)235571dc82SThomas Huth void main(void)
245571dc82SThomas Huth {
255571dc82SThomas Huth     unsigned long addr;
265571dc82SThomas Huth 
275571dc82SThomas Huth     sclp_setup();
285571dc82SThomas Huth     sclp_print("A");
295571dc82SThomas Huth 
30*b28e3ecfSDaniil Tatianin     /*
31*b28e3ecfSDaniil Tatianin      * Make sure all of the pages have consistent contents before incrementing
32*b28e3ecfSDaniil Tatianin      * the first byte below.
33*b28e3ecfSDaniil Tatianin      */
34*b28e3ecfSDaniil Tatianin     for (addr = START_ADDRESS; addr < END_ADDRESS; addr += 4096) {
35*b28e3ecfSDaniil Tatianin         *(volatile char *)addr = 0;
36*b28e3ecfSDaniil Tatianin     }
37*b28e3ecfSDaniil Tatianin 
385571dc82SThomas Huth     while (1) {
395571dc82SThomas Huth         for (addr = START_ADDRESS; addr < END_ADDRESS; addr += 4096) {
405571dc82SThomas Huth             *(volatile char *)addr += 1;  /* Change pages */
415571dc82SThomas Huth         }
425571dc82SThomas Huth         sclp_print("B");
435571dc82SThomas Huth     }
445571dc82SThomas Huth }
45