target/mips/rel6_translate: Change license to GNU LGPL v2.1 (or later)
[qemu/ar7.git] / tests / migration / i386 / a-b-bootblock.S
blob3f97f280233d8631616361bbfccbba3015341ec7
1 # x86 bootblock used in migration test
2 #  repeatedly increments the first byte of each page in a 100MB
3 #  range.
4 #  Outputs an initial 'A' on serial followed by repeated 'B's
6 # Copyright (c) 2016 Red Hat, Inc. and/or its affiliates
7 # This work is licensed under the terms of the GNU GPL, version 2 or later.
8 # See the COPYING file in the top-level directory.
10 # Author: dgilbert@redhat.com
13 .code16
14 .org 0x7c00
15         .file   "fill.s"
16         .text
17         .globl  start
18         .type   start, @function
19 start:             # at 0x7c00 ?
20         cli
21         lgdt gdtdesc
22         mov $1,%eax
23         mov %eax,%cr0  # Protected mode enable
24         data32 ljmp $8,$0x7c20
26 .org 0x7c20
27 .code32
28         # A20 enable - not sure I actually need this
29         inb $0x92,%al
30         or  $2,%al
31         outb %al, $0x92
33         # set up DS for the whole of RAM (needed on KVM)
34         mov $16,%eax
35         mov %eax,%ds
37         mov $65,%ax
38         mov $0x3f8,%dx
39         outb %al,%dx
41         # bl keeps a counter so we limit the output speed
42         mov $0, %bl
43 mainloop:
44         # Start from 1MB
45         mov $(1024*1024),%eax
46 innerloop:
47         incb (%eax)
48         add $4096,%eax
49         cmp $(100*1024*1024),%eax
50         jl innerloop
52         inc %bl
53         jnz mainloop
55         mov $66,%ax
56         mov $0x3f8,%dx
57         outb %al,%dx
59         jmp mainloop
61         # GDT magic from old (GPLv2)  Grub startup.S
62         .p2align        2       /* force 4-byte alignment */
63 gdt:
64         .word   0, 0
65         .byte   0, 0, 0, 0
67         /* -- code segment --
68          * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present
69          * type = 32bit code execute/read, DPL = 0
70          */
71         .word   0xFFFF, 0
72         .byte   0, 0x9A, 0xCF, 0
74         /* -- data segment --
75          * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present
76          * type = 32 bit data read/write, DPL = 0
77          */
78         .word   0xFFFF, 0
79         .byte   0, 0x92, 0xCF, 0
81 gdtdesc:
82         .word   0x27                    /* limit */
83         .long   gdt                     /* addr */
85 /* I'm a bootable disk */
86 .org 0x7dfe
87         .byte 0x55
88         .byte 0xAA