UbixOS V2
2.0
kmalloc.h
Go to the documentation of this file.
1
/*-
2
* Copyright (c) 2002-2018 The UbixOS Project.
3
* All rights reserved.
4
*
5
* This was developed by Christopher W. Olsen for the UbixOS Project.
6
*
7
* Redistribution and use in source and binary forms, with or without modification, are permitted
8
* provided that the following conditions are met:
9
*
10
* 1) Redistributions of source code must retain the above copyright notice, this list of
11
* conditions, the following disclaimer and the list of authors.
12
* 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13
* conditions, the following disclaimer and the list of authors in the documentation and/or
14
* other materials provided with the distribution.
15
* 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16
* endorse or promote products derived from this software without specific prior written
17
* permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#ifndef _LIB_KMALLOC_H
30
#define _LIB_KMALLOC_H
31
32
#include <
sys/types.h
>
33
34
#ifdef __cplusplus
35
extern
"C"
{
36
#endif
37
38
#define sysID -2
39
#define MALLOC_ALIGN_SIZE 32
40
#define MALLOC_ALIGN(size) (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE)))))
41
42
struct
memDescriptor
{
43
struct
memDescriptor
*
prev
;
//4
44
struct
memDescriptor
*
next
;
//4
45
void
*
baseAddr
;
//4
46
uInt32
limit
;
//4
47
/*uInt8 status; //1 */
48
/*char reserved[11]; //11 */
49
};
50
51
void
kfree
(
void
*
baseAddr
);
52
void
*
kmalloc
(
uInt32
len);
53
54
#ifdef __cplusplus
55
}
56
#endif
57
58
#endif
59
60
/***
61
$Log: kmalloc.h,v $
62
Revision 1.1.1.1 2006/06/01 12:46:13 reddawg
63
ubix2
64
65
Revision 1.2 2005/10/12 00:13:36 reddawg
66
Removed
67
68
Revision 1.1.1.1 2005/09/26 17:23:40 reddawg
69
no message
70
71
Revision 1.7 2004/09/14 20:57:01 reddawg
72
Bug fixes: macro problem over opt a multiply
73
74
Revision 1.6 2004/07/21 10:02:09 reddawg
75
devfs: renamed functions
76
device system: renamed functions
77
fdc: fixed a few potential bugs and cleaned up some unused variables
78
strol: fixed definition
79
endtask: made it print out freepage debug info
80
kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost
81
ld: fixed a pointer conversion
82
file: cleaned up a few unused variables
83
sched: broke task deletion
84
kprintf: fixed ogPrintf definition
85
86
Revision 1.5 2004/07/19 02:08:27 reddawg
87
Cleaned out the rest of debuging code also temporarily disabled the ip stack to improve boot time
88
89
Revision 1.4 2004/07/18 05:24:15 reddawg
90
Fixens
91
92
Revision 1.3 2004/05/21 15:00:27 reddawg
93
Cleaned up
94
95
END
96
***/
uInt32
unsigned long int uInt32
Definition:
objgfx30.h:49
memDescriptor::baseAddr
void * baseAddr
Definition:
kmalloc.h:45
memDescriptor::prev
struct memDescriptor * prev
Definition:
kmalloc.h:43
kfree
void kfree(void *baseAddr)
Definition:
kmalloc.c:342
types.h
memDescriptor::next
struct memDescriptor * next
Definition:
kmalloc.h:44
memDescriptor::limit
uInt32 limit
Definition:
kmalloc.h:46
kmalloc
void * kmalloc(uInt32 len)
Definition:
kmalloc.c:241
memDescriptor
Definition:
kmalloc.h:42
C:
Dev
git
UbixOS
sys
include
lib
kmalloc.h
Generated by
1.8.16