Subversion Repositories shark

Rev

Rev 1618 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
 
22
/**
23
 ------------
79 pj 24
 CVS :        $Id: mem.h,v 1.2 2003-03-13 13:36:28 pj Exp $
2 pj 25
 
26
 File:        $File$
79 pj 27
 Revision:    $Revision: 1.2 $
28
 Last update: $Date: 2003-03-13 13:36:28 $
2 pj 29
 ------------
30
 
31
- Memory Management functions
32
 
33
**/
34
 
35
/*
36
 * Copyright (C) 2000 Paolo Gai
37
 *
38
 * This program is free software; you can redistribute it and/or modify
39
 * it under the terms of the GNU General Public License as published by
40
 * the Free Software Foundation; either version 2 of the License, or
41
 * (at your option) any later version.
42
 *
43
 * This program is distributed in the hope that it will be useful,
44
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
45
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
46
 * GNU General Public License for more details.
47
 *
48
 * You should have received a copy of the GNU General Public License
49
 * along with this program; if not, write to the Free Software
50
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
51
 *
52
 */
53
 
54
/*---------------------------------------------------------------------*/
55
/* Memory Management                                                   */
56
/*---------------------------------------------------------------------*/
57
 
58
#ifndef __KERNEL_MEM_H__
59
#define __KERNEL_MEM_H__
60
 
61
#include <kernel/lmm.h>
1621 fabio 62
#include <arch/sys/cdefs.h>
2 pj 63
 
79 pj 64
__BEGIN_DECLS
65
 
2 pj 66
/* Memory regions to be passed as flags... */
67
#define MEMORY_UNDER_1M       1
68
#define MEMORY_FROM_1M_TO_16M 2
69
#define MEMORY_UNDER_16M      3
70
 
71
/* init the memory allocator */
72
void kern_mem_init(struct multiboot_info *multiboot);
73
 
74
/* alloc memory without requirements on the address... */
75
void *kern_alloc(DWORD s);
76
 
77
/* alloc an aligned block of memory */
78
void *kern_alloc_aligned(size_t size, lmm_flags_t flags,
79
                        int align_bits, DWORD align_ofs);
80
 
81
/* alloc memory with general constraints */
82
void *kern_alloc_gen(size_t size, lmm_flags_t flags,
83
                    int align_bits, DWORD align_ofs,
84
                    DWORD bounds_min, DWORD bounds_max);
85
 
86
/* free a block */
87
void kern_free(void *block, size_t size);
88
 
89
/* alloc and free a page */
90
void *kern_alloc_page(lmm_flags_t flags);
91
void kern_free_page(void *block);
92
 
93
/* alloc and free memory <1Mb */
94
void *DOS_alloc(DWORD size);
95
void DOS_free(void *ptr,DWORD size);
96
 
97
/* statistical stuffs */
98
void kern_mem_dump(void);
99
 
79 pj 100
__END_DECLS
2 pj 101
#endif