|
@@ -3,8 +3,6 @@
|
3
|
3
|
#include "memsizes.h"
|
4
|
4
|
#include "heap.h"
|
5
|
5
|
|
6
|
|
-#define ASSERT(...)
|
7
|
|
-
|
8
|
6
|
struct heap_block {
|
9
|
7
|
size_t size;
|
10
|
8
|
char data[0];
|
|
@@ -102,7 +100,7 @@ void * emalloc ( size_t size, unsigned int align ) {
|
102
|
100
|
physaddr_t addr;
|
103
|
101
|
struct heap_block *block;
|
104
|
102
|
|
105
|
|
- ASSERT ( ! ( align & ( align - 1 ) ) );
|
|
103
|
+ ASSERT ( ( align & ( align - 1 ) ) == 0 );
|
106
|
104
|
|
107
|
105
|
addr = ( ( ( heap_ptr - size ) & ~( align - 1 ) )
|
108
|
106
|
- sizeof ( struct heap_block ) );
|
|
@@ -132,7 +130,7 @@ void * emalloc_all ( size_t *size ) {
|
132
|
130
|
void efree ( void *ptr ) {
|
133
|
131
|
struct heap_block *block;
|
134
|
132
|
|
135
|
|
- ASSERT ( ptr == ( heap_ptr + sizeof ( size_t ) ) );
|
|
133
|
+ ASSERT ( ptr == phys_to_virt ( heap_ptr + sizeof ( size_t ) ) );
|
136
|
134
|
|
137
|
135
|
block = ( struct heap_block * )
|
138
|
136
|
( ptr - offsetof ( struct heap_block, data ) );
|