luxos/exp/Memory manager/mem.h

38 lines
1.0 KiB
C

/*
* ord-arr.h
*
* Created on: Aug 24, 2011
* Author: Tiberiu
*/
#ifndef ORD_ARR_H_
#define ORD_ARR_H_
#include <stdio.h>
typedef unsigned int uint32;
typedef unsigned char uint8;
#define Log(...) { printf(__VA_ARGS__); }
#define Error(...) { fprintf(stderr, __VA_ARGS__); }
#define Panic(...) { printf("[PANIC] Kernel panic: "); printf(__VA_ARGS__); }
#define LogMem(...) { Log("[MemLog] "); Log(__VA_ARGS__); }
#define ErrorMem(...) { Error("[MemErr] "); Error(__VA_ARGS__); }
extern uint32* FrameMap;
extern uint32 TotalFrames;
extern uint32 TotalMemory;
extern void ConvertIndexToFrame (uint32 index, uint32* address, uint32* offset);
extern uint32 ConvertFrameToIndex (uint32 address, uint32 offset);
extern void MemPhSetFrame (uint32 frame, uint8 value);
extern uint32 MemPhGetFrame (uint32 frame);
extern uint32 MemPhFindFreeFrame();
extern void MemPhAllocFrame(uint8 isKernel, uint8 isWriteable);
extern void MemPhInitialize(uint32 SystemMemoryKb);
extern void MemPhReserveFrames (uint32 address, uint32 length);
#endif /* ORD_ARR_H_ */