#define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
#define HVMLOADER_PHYSICAL_ADDRESS 0x00100000
+extern unsigned long scratch_start;
+
#endif /* __HVMLOADER_CONFIG_H__ */
/*
" .text \n"
);
+unsigned long scratch_start = SCRATCH_PHYSICAL_ADDRESS;
+
static void init_hypercalls(void)
{
uint32_t eax, ebx, ecx, edx;
cmos_write_memory_size();
printf("BIOS map:\n");
+ if ( SCRATCH_PHYSICAL_ADDRESS != scratch_start )
+ printf(" %05x-%05lx: Scratch space\n",
+ SCRATCH_PHYSICAL_ADDRESS, scratch_start);
if ( vgabios_sz )
printf(" %05x-%05x: VGA BIOS\n",
VGABIOS_PHYSICAL_ADDRESS,
/* Create a list of device BARs in descending order of size. */
struct bars {
uint32_t devfn, bar_reg, bar_sz;
- } *bars = (struct bars *)SCRATCH_PHYSICAL_ADDRESS;
+ } *bars = (struct bars *)scratch_start;
unsigned int i, nr_bars = 0;
/* Program PCI-ISA bridge with appropriate link routes. */
static void rombios_create_smbios_tables(void)
{
- hvm_write_smbios_tables(SCRATCH_PHYSICAL_ADDRESS,
+ hvm_write_smbios_tables(scratch_start,
SMBIOS_PHYSICAL_ADDRESS,
SMBIOS_PHYSICAL_END);
}
return (void *)(unsigned long)s;
}
+void *scratch_alloc(uint32_t size, uint32_t align)
+{
+ uint32_t s, e;
+
+ /* Align to at least one kilobyte. */
+ if ( align < 1024 )
+ align = 1024;
+
+ s = (scratch_start + align - 1) & ~(align - 1);
+ e = s + size - 1;
+
+ BUG_ON(e < s);
+
+ scratch_start = e;
+
+ return (void *)(unsigned long)s;
+}
+
uint32_t ioapic_read(uint32_t reg)
{
*(volatile uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00) = reg;
void *mem_alloc(uint32_t size, uint32_t align);
#define virt_to_phys(v) ((unsigned long)(v))
+/* Allocate memory in a scratch region */
+void *scratch_alloc(uint32_t size, uint32_t align);
+
/* Connect our xenbus client to the backend.
* Call once, before any other xenbus actions. */
void xenbus_setup(void);