Subversion Repositories shark

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators:
 *   Giorgio Buttazzo    <giorgio@sssup.it>
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *
 * Authors     :
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *   (see the web pages for full authors list)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


/*
 * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * 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
 *
 *
 * CVS :        $Id: memtest.c,v 1.1 2002-11-11 08:22:46 pj Exp $
 */


/*
 * Copyright (C) 2000 Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * 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 <kernel/kern.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
  void *a;

  clear();

  a = malloc(4500);
  cprintf("malloc   : %ld\n", (DWORD)a);
  free(a);

  kern_cli(); a = DOS_alloc(4500); kern_sti();
  cprintf("below 1 M: %ld\n", (DWORD)a);
  kern_cli(); DOS_free(a,4500); kern_sti();

  kern_cli(); a = kern_alloc_aligned(10000,MEMORY_UNDER_16M,10,0); kern_sti();
  cprintf("below 16M: %ld\n", (DWORD)a);
  kern_cli(); kern_free(a,10000); kern_sti();

  kern_cli(); a = kern_alloc_aligned(10000,MEMORY_FROM_1M_TO_16M,2,0); kern_sti();
  cprintf(">1M <16M : %ld\n", (DWORD)a);
  kern_cli(); kern_free(a,10000); kern_sti();

  kern_cli(); a = kern_alloc(10000); kern_sti();
  cprintf("normal   : %ld\n", (DWORD)a);
  kern_cli(); kern_free(a,10000); kern_sti();

  kern_cli(); a = kern_alloc_page(MEMORY_UNDER_1M); kern_sti();
  cprintf("page <1M : %ld\n", (DWORD)a);
  kern_cli(); kern_free_page(a); kern_sti();

  kern_cli(); a = kern_alloc_page(MEMORY_FROM_1M_TO_16M); kern_sti();
  cprintf("p>1<16M  : %ld\n", (DWORD)a);
  kern_cli(); kern_free_page(a); kern_sti();

  kern_cli(); a = kern_alloc_page(0); kern_sti();
  cprintf("page     : %ld\n", (DWORD)a);
  kern_cli(); kern_free_page(a); kern_sti();

  return 0;
}