linuxboot: compute initrd loading address

Even though hw/i386/pc.c tries to compute a valid loading address for the
initrd, close to the top of RAM, this does not take into account other
data that is malloced into that memory by SeaBIOS.

Luckily we can easily look at the memory map to find out how much memory is
used up there.  This patch places the initrd in the first four gigabytes,
below the first hole (as returned by INT 15h, AX=e801h).

Without this patch:
[    0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff]
[    0.000000] RAMDISK: [mem 0x0710a000-0x07fd7fff]

With this patch:
[    0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff]
[    0.000000] RAMDISK: [mem 0x07112000-0x07fdffff]

So linuxboot is able to use the 64k that were added as padding for
QEMU <= 2.1.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 files changed
tree: 7e355ce31516dbd959a49639e6f2ed15f6cb6e6f
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. disas/
  7. docs/
  8. fpu/
  9. fsdev/
  10. gdb-xml/
  11. hw/
  12. include/
  13. libcacard/
  14. libdecnumber/
  15. linux-headers/
  16. linux-user/
  17. net/
  18. pc-bios/
  19. po/
  20. qapi/
  21. qga/
  22. qobject/
  23. qom/
  24. roms/
  25. scripts/
  26. slirp/
  27. stubs/
  28. sysconfigs/
  29. target-alpha/
  30. target-arm/
  31. target-cris/
  32. target-i386/
  33. target-lm32/
  34. target-m68k/
  35. target-microblaze/
  36. target-mips/
  37. target-moxie/
  38. target-openrisc/
  39. target-ppc/
  40. target-s390x/
  41. target-sh4/
  42. target-sparc/
  43. target-tricore/
  44. target-unicore32/
  45. target-xtensa/
  46. tcg/
  47. tests/
  48. trace/
  49. ui/
  50. util/
  51. .exrc
  52. .gitignore
  53. .gitmodules
  54. .mailmap
  55. .travis.yml
  56. accel.c
  57. aio-posix.c
  58. aio-win32.c
  59. arch_init.c
  60. async.c
  61. balloon.c
  62. block-migration.c
  63. block.c
  64. blockdev-nbd.c
  65. blockdev.c
  66. blockjob.c
  67. bt-host.c
  68. bt-vhci.c
  69. Changelog
  70. CODING_STYLE
  71. configure
  72. COPYING
  73. COPYING.LIB
  74. coroutine-gthread.c
  75. coroutine-sigaltstack.c
  76. coroutine-ucontext.c
  77. coroutine-win32.c
  78. cpu-exec.c
  79. cpus.c
  80. cputlb.c
  81. device-hotplug.c
  82. device_tree.c
  83. disas.c
  84. dma-helpers.c
  85. dump.c
  86. exec.c
  87. gdbstub.c
  88. HACKING
  89. hmp-commands.hx
  90. hmp.c
  91. hmp.h
  92. iohandler.c
  93. ioport.c
  94. iothread.c
  95. kvm-all.c
  96. kvm-stub.c
  97. LICENSE
  98. main-loop.c
  99. MAINTAINERS
  100. Makefile
  101. Makefile.objs
  102. Makefile.target
  103. memory.c
  104. memory_mapping.c
  105. migration-exec.c
  106. migration-fd.c
  107. migration-rdma.c
  108. migration-tcp.c
  109. migration-unix.c
  110. migration.c
  111. module-common.c
  112. monitor.c
  113. nbd.c
  114. numa.c
  115. os-posix.c
  116. os-win32.c
  117. page_cache.c
  118. qapi-schema.json
  119. qdev-monitor.c
  120. qdict-test-data.txt
  121. qemu-bridge-helper.c
  122. qemu-char.c
  123. qemu-coroutine-io.c
  124. qemu-coroutine-lock.c
  125. qemu-coroutine-sleep.c
  126. qemu-coroutine.c
  127. qemu-doc.texi
  128. qemu-file.c
  129. qemu-img-cmds.hx
  130. qemu-img.c
  131. qemu-img.texi
  132. qemu-io-cmds.c
  133. qemu-io.c
  134. qemu-log.c
  135. qemu-nbd.c
  136. qemu-nbd.texi
  137. qemu-options-wrapper.h
  138. qemu-options.h
  139. qemu-options.hx
  140. qemu-seccomp.c
  141. qemu-tech.texi
  142. qemu-timer.c
  143. qemu.nsi
  144. qemu.sasl
  145. qmp-commands.hx
  146. qmp.c
  147. qtest.c
  148. README
  149. rules.mak
  150. savevm.c
  151. softmmu_template.h
  152. spice-qemu-char.c
  153. tcg-runtime.c
  154. tci.c
  155. thread-pool.c
  156. thunk.c
  157. tpm.c
  158. trace-events
  159. translate-all.c
  160. translate-all.h
  161. user-exec.c
  162. VERSION
  163. version.rc
  164. vl.c
  165. vmstate.c
  166. xbzrle.c
  167. xen-common-stub.c
  168. xen-common.c
  169. xen-hvm-stub.c
  170. xen-hvm.c
  171. xen-mapcache.c