Offer realloc to iPXE.

parent 01ae2c5b
Subproject commit 1554cd549eaeedb0c998c912c77c7e732c56da63
Subproject commit 421e8fbe9d7d8aec9372ce0afaa5014f9119d439
......@@ -24,6 +24,7 @@ void *get_table_end(const char *name);
void *asmc_malloc(size_t size);
void asmc_free(void *ptr);
void *asmc_realloc(void *ptr, size_t size);
void push_to_asmc(void *msg);
void *pop_from_asmc(void);
......
......@@ -42,6 +42,7 @@ typedef struct {
void (*coro_yield)();
void *(*malloc)(size_t size);
void (*free)(void *ptr);
void *(*realloc)(void *ptr, size_t size);
} ipxe_handover;
static void ipxe_list_reset(ipxe_list *list) {
......
......@@ -72,6 +72,10 @@ void asmc_free(void *ptr) {
ih->free(ptr);
}
void *asmc_realloc(void *ptr, size_t size) {
return ih->realloc(ptr, size);
}
void push_to_asmc(void *msg) {
ipxe_list_push(ih, &ih->from_ipxe, msg);
}
......
......@@ -477,6 +477,7 @@ int main(int argc, char *argv[]) {
ih.coro_yield = coro_yield;
ih.malloc = malloc;
ih.free = free;
ih.realloc = realloc;
printf("Starting iPXE coroutine!\n");
coro_ipxe = coro_init(main_symb, &ih);
......
......@@ -198,6 +198,7 @@ void load_linux32() {
initrd = realloc(initrd, initrd_size + 4096);
void *initrd_aligned = (void*)(((((unsigned long)initrd)-1) | (4096-1)) + 1);
memmove(initrd_aligned, initrd, initrd_size);
printf("Initrd initially allocated at 0x%x, then moved at 0x%x\n", initrd, initrd_aligned);
prepare_boot_params(real_mode, initrd_aligned, initrd_size);
load_linux_gdt();
char *cmdline = "verbose";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment