/SPARTAN/trunk/include/config.h |
---|
38,11 → 38,11 |
struct config { |
__address base; |
__u32 memory_size; |
__u32 kernel_size; |
size_t memory_size; |
size_t kernel_size; |
int cpu_count; |
volatile int cpu_active; |
count_t cpu_count; |
volatile count_t cpu_active; |
}; |
extern config_t config; |
/SPARTAN/trunk/include/mm/frame.h |
---|
30,18 → 30,19 |
#define __FRAME_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#define FRAME_KA 1 /* skip frames conflicting with user address space */ |
#define FRAME_PANIC 2 /* panic on failure */ |
extern __u32 frames; |
extern __u32 frames_free; |
extern count_t frames; |
extern count_t frames_free; |
extern __u32 kernel_frames; |
extern __u32 kernel_frames_free; |
extern count_t kernel_frames; |
extern count_t kernel_frames_free; |
extern __u8 *frame_bitmap; |
extern __u32 frame_bitmap_octets; |
extern count_t frame_bitmap_octets; |
extern __u8 *frame_kernel_bitmap; |
/SPARTAN/trunk/include/mm/heap.h |
---|
40,7 → 40,7 |
__u8 data[0]; |
}; |
extern void heap_init(__address heap, __u32 size); |
extern void heap_init(__address heap, size_t size); |
extern void *malloc(size_t size); |
extern void free(void *ptr); |
/SPARTAN/trunk/include/typedefs.h |
---|
35,6 → 35,7 |
typedef short bool; |
typedef unsigned int size_t; |
typedef unsigned int count_t; |
typedef struct config config_t; |
typedef struct cpu_private_data cpu_private_data_t; |
/SPARTAN/trunk/src/mm/frame.c |
---|
42,11 → 42,11 |
#include <synch/spinlock.h> |
__u32 frames; |
__u32 frames_free; |
count_t frames = 0; |
count_t frames_free; |
__u8 *frame_bitmap; |
__u32 frame_bitmap_octets; |
count_t frame_bitmap_octets; |
/* |
* This is for kernel address space frames (allocated with FRAME_KA). |
53,8 → 53,8 |
* Their addresses may not interfere with user address space. |
*/ |
__u8 *frame_kernel_bitmap; |
__u32 kernel_frames; |
__u32 kernel_frames_free; |
count_t kernel_frames; |
count_t kernel_frames_free; |
static spinlock_t framelock; |
68,7 → 68,6 |
frames = config.memory_size / FRAME_SIZE; |
frame_bitmap_octets = frames / 8 + (frames % 8 > 0); |
frame_bitmap = (__u8 *) malloc(frame_bitmap_octets); |
if (!frame_bitmap) |
panic("malloc/frame_bitmap\n"); |
110,7 → 109,7 |
int i; |
pri_t pri; |
__u8 **frame_bitmap_ptr = &frame_bitmap; |
__u32 *frames_ptr = &frames, *frames_free_ptr = &frames_free; |
count_t *frames_ptr = &frames, *frames_free_ptr = &frames_free; |
if (flags & FRAME_KA) { |
frame_bitmap_ptr = &frame_kernel_bitmap; |
165,7 → 164,7 |
{ |
pri_t pri; |
__u32 frame; |
__u32 *frames_free_ptr = &frames_free, *frames_ptr = &frames; |
count_t *frames_free_ptr = &frames_free, *frames_ptr = &frames; |
__u8 **frame_bitmap_ptr = &frame_bitmap; |
if (IS_KA(addr)) { |
195,9 → 194,9 |
frames_free++; |
} |
} |
else panic("frame_free: frame already free\n"); |
else panic("frame already free\n"); |
} |
else panic("frame_free: frame number too big\n"); |
else panic("frame number too big\n"); |
spinlock_unlock(&framelock); |
cpu_priority_restore(pri); |
211,7 → 210,7 |
{ |
pri_t pri; |
__u32 frame; |
__u32 *frames_ptr = &frames, *frames_free_ptr = &frames_free; |
count_t *frames_ptr = &frames, *frames_free_ptr = &frames_free; |
__u8 **frame_bitmap_ptr = &frame_bitmap; |
pri = cpu_priority_high(); |
/SPARTAN/trunk/src/mm/heap.c |
---|
42,7 → 42,7 |
static chunk_t *chunk0; |
static spinlock_t heaplock; |
void heap_init(__address heap, __u32 size) |
void heap_init(__address heap, size_t size) |
{ |
spinlock_initialize(&heaplock); |
memsetb(heap, size, 0); |
62,7 → 62,7 |
chunk_t *x, *y, *z; |
if (size == 0) |
panic("malloc: zero-size allocation request"); |
panic("zero-size allocation request"); |
x = chunk0; |
pri = cpu_priority_high(); |
/SPARTAN/trunk/arch/ia64/include/mm/frame.h |
---|
29,7 → 29,7 |
#ifndef __ia64_FRAME_H__ |
#define __ia64_FRAME_H__ |
#define FRAME_SIZE 2*4096 |
#define FRAME_SIZE (16*1024) |
extern void frame_arch_init(void); |
/SPARTAN/trunk/arch/ia64/src/asm.S |
---|
42,3 → 42,18 |
.global memcopy |
memcopy: |
br _memcopy |
.global memsetb |
memsetb: |
br _memsetb |
.global cpu_halt |
cpu_halt: |
br cpu_halt |
.global panic_printf |
panic_printf: |
{ |
br.call.sptk.many b0=printf |
} |
br cpu_halt |
/SPARTAN/trunk/arch/ia64/src/ia64.c |
---|
31,9 → 31,9 |
void arch_pre_mm_init(void) |
{ |
ski_init_console(); |
} |
void arch_post_mm_init(void) |
{ |
ski_init_console(); |
} |
/SPARTAN/trunk/arch/ia64/src/fake.s |
---|
34,7 → 34,6 |
.global before_thread_runs_arch |
.global arch_late_init |
.global cpu_arch_init |
.global cpu_halt |
.global cpu_identify |
.global cpu_print_report |
.global cpu_priority_high |
44,8 → 43,6 |
.global cpu_sleep |
.global frame_arch_init |
.global map_page_to_frame |
.global memsetb |
.global panic_printf |
before_thread_runs_arch: |
userspace: |
53,7 → 50,6 |
asm_delay_loop: |
arch_late_init: |
cpu_arch_init: |
cpu_halt: |
cpu_identify: |
cpu_print_report: |
cpu_priority_high: |
63,7 → 59,5 |
cpu_sleep: |
frame_arch_init: |
map_page_to_frame: |
memsetb: |
panic_printf: |
br.ret.sptk.many b0 |
/SPARTAN/trunk/arch/ia64/src/start.S |
---|
40,6 → 40,7 |
# initialize register stack |
mov ar.rsc = r0 |
mov ar.bspstore = r0 |
loadrs |
.explicit |