diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-02-08 23:08:38 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-02-08 23:08:38 +0000 |
commit | e9a1ab19d196aa50619fd8b77157bd11a5a8aa01 (patch) | |
tree | 4cd5e2be4f4399a71ed1b51d7d2d2023f3159dba /exec.c | |
parent | 1193610e5df9eb88eaf7750f290fe8dd24ed620d (diff) | |
download | qemu-e9a1ab19d196aa50619fd8b77157bd11a5a8aa01.zip qemu-e9a1ab19d196aa50619fd8b77157bd11a5a8aa01.tar.gz qemu-e9a1ab19d196aa50619fd8b77157bd11a5a8aa01.tar.bz2 |
ram allocation functions
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2404 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -82,6 +82,7 @@ int phys_ram_size; int phys_ram_fd; uint8_t *phys_ram_base; uint8_t *phys_ram_dirty; +static ram_addr_t phys_ram_alloc_offset = 0; CPUState *first_cpu; /* current CPU in the current thread. It is only valid inside @@ -1812,6 +1813,24 @@ uint32_t cpu_get_physical_page_desc(target_phys_addr_t addr) return p->phys_offset; } +/* XXX: better than nothing */ +ram_addr_t qemu_ram_alloc(unsigned int size) +{ + ram_addr_t addr; + if ((phys_ram_alloc_offset + size) >= phys_ram_size) { + fprintf(stderr, "Not enough memory (requested_size = %u, max memory = %d)\n", + size, phys_ram_size); + abort(); + } + addr = phys_ram_alloc_offset; + phys_ram_alloc_offset = TARGET_PAGE_ALIGN(phys_ram_alloc_offset + size); + return addr; +} + +void qemu_ram_free(ram_addr_t addr) +{ +} + static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr) { #ifdef DEBUG_UNASSIGNED |