diff options
author | RajithaY <rajithax.yerrumsetty@intel.com> | 2017-04-25 03:31:15 -0700 |
---|---|---|
committer | Rajitha Yerrumchetty <rajithax.yerrumsetty@intel.com> | 2017-05-22 06:48:08 +0000 |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/openhackware/src/mm.c | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (diff) |
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to
kvmfornfv repo and make use of the updated latest qemu for the
execution of all testcase
Change-Id: I1280af507a857675c7f81d30c95255635667bdd7
Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/openhackware/src/mm.c')
-rw-r--r-- | qemu/roms/openhackware/src/mm.c | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/qemu/roms/openhackware/src/mm.c b/qemu/roms/openhackware/src/mm.c deleted file mode 100644 index e7fa067cc..000000000 --- a/qemu/roms/openhackware/src/mm.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Open Hack'Ware BIOS memory management. - * - * Copyright (c) 2004-2005 Jocelyn Mayer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License V2 - * as published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <stdlib.h> -#include "bios.h" - -#if 0 -static uint8_t *page_bitmap; -static uint32_t memory_size; - -static void mark_page_in_use (uint32_t page_nb) -{ - uint32_t offset, bit; - - offset = page_nb >> 3; - bit = page_nb & 7; - page_bitmap[offset] |= 1 << bit; -} - -static void mark_page_free (uint32_t page_nb) -{ - uint32_t offset, bit; - - offset = page_nb >> 3; - bit = page_nb & 7; - page_bitmap[offset] &= ~(1 << bit); -} - -static int is_page_in_use (uint32_t page_nb) -{ - uint32_t offset, bit; - - offset = page_nb >> 3; - bit = page_nb & 7; - - return (page_bitmap[offset] & (~(1 << bit))) != 0; -} - -void mm_init (uint32_t memsize) -{ - uint32_t page_start, page_ram_start, page, ram_start; - uint32_t nb_pages, bitmap_size; - - /* Init bitmap */ - ram_start = (uint32_t)(&_ram_start); - ram_start = (ram_start + (1 << 12) - 1) & ~((1 << 12) - 1); - page_bitmap = (void *)ram_start; - nb_pages = (memsize + (1 << 12) - 1) >> 12; - bitmap_size = (nb_pages + 7) >> 3; - /* First mark all pages as free */ - memset(page_bitmap, 0, bitmap_size); - /* Mark all pages used by the BIOS as used (code + data + bitmap) */ - page_start = (uint32_t)(0x05800000) >> 12; /* TO FIX */ - ram_start += bitmap_size; - ram_start = (ram_start + (1 << 12) - 1) & ~((1 << 12) - 1); - page_ram_start = ram_start >> 12; - for (page = page_start; page < page_ram_start; page++) - mark_page_in_use(page); - memory_size = memsize; -} - -void *page_get (int nb_pages) -{ - uint32_t page_start, page_end, page; - int nb; - - page_start = (uint32_t)(0x05800000) >> 12; /* TO FIX */ - page_end = memory_size >> 12; - for (page = page_start; page < page_end; ) { - /* Skip all full "blocs" */ - for (; page < page_end; page += 8) { - if (page_bitmap[page >> 3] != 0xFF) - break; - } - for (nb = 0; page < page_end; page++) { - if (!is_page_in_use(page)) { - nb++; - if (nb == nb_pages) { - /* Found ! */ - for (; nb >= 0; nb--, page--) - mark_page_in_use(page); - - return (void *)(page << 12); - } - } - } - } - - return NULL; -} - -void page_put (void *addr, int nb_pages) -{ - uint32_t page_start, page_end, page; - - page_start = (uint32_t)addr >> 12; - page_end = page_start + nb_pages; - for (page = page_start; page < page_end; page++) { - if (!is_page_in_use(page)) - printf("ERROR: page %u has already been freed !\n", page); - mark_page_free(page); - } -} -#else -static uint8_t *page_alloc; - -void mm_init (unused uint32_t memsize) -{ - uint32_t ram_start; - ram_start = (uint32_t)(&_ram_start); - ram_start = (ram_start + (1 << 12) - 1) & ~((1 << 12) - 1); - page_alloc = (void *)ram_start; -} - -void *page_get (unused int nb_pages) -{ - void *ret; - - ret = page_alloc; - page_alloc += nb_pages << 12; - memset(ret, 0, nb_pages << 12); - - return ret; -} - -void page_put (unused void *addr, unused int nb_pages) -{ -} -#endif |