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 5# 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. 9# 10# Author: dgilbert@redhat.com 11 12 13.code16 14.org 0x7c00 15 .file "fill.s" 16 .text 17 .globl start 18 .type start, @function 19start: # at 0x7c00 ? 20 cli 21 lgdt gdtdesc 22 mov $1,%eax 23 mov %eax,%cr0 # Protected mode enable 24 data32 ljmp $8,$0x7c20 25 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 32 33 # set up DS for the whole of RAM (needed on KVM) 34 mov $16,%eax 35 mov %eax,%ds 36 37# Start from 1MB 38.set TEST_MEM_START, (1024*1024) 39.set TEST_MEM_END, (100*1024*1024) 40 41 mov $65,%ax 42 mov $0x3f8,%dx 43 outb %al,%dx 44 45 # bl keeps a counter so we limit the output speed 46 mov $0, %bl 47 48pre_zero: 49 mov $TEST_MEM_START,%eax 50do_zero: 51 movb $0, (%eax) 52 add $4096,%eax 53 cmp $TEST_MEM_END,%eax 54 jl do_zero 55 56mainloop: 57 mov $TEST_MEM_START,%eax 58innerloop: 59 incb (%eax) 60 add $4096,%eax 61 cmp $TEST_MEM_END,%eax 62 jl innerloop 63 64 inc %bl 65 andb $0x3f,%bl 66 jnz mainloop 67 68 mov $66,%ax 69 mov $0x3f8,%dx 70 outb %al,%dx 71 72 jmp mainloop 73 74 # GDT magic from old (GPLv2) Grub startup.S 75 .p2align 2 /* force 4-byte alignment */ 76gdt: 77 .word 0, 0 78 .byte 0, 0, 0, 0 79 80 /* -- code segment -- 81 * base = 0x00000000, limit = 0xFFFFF (4 KiB Granularity), present 82 * type = 32bit code execute/read, DPL = 0 83 */ 84 .word 0xFFFF, 0 85 .byte 0, 0x9A, 0xCF, 0 86 87 /* -- data segment -- 88 * base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present 89 * type = 32 bit data read/write, DPL = 0 90 */ 91 .word 0xFFFF, 0 92 .byte 0, 0x92, 0xCF, 0 93 94gdtdesc: 95 .word 0x27 /* limit */ 96 .long gdt /* addr */ 97 98/* I'm a bootable disk */ 99.org 0x7dfe 100 .byte 0x55 101 .byte 0xAA 102