[GOOD] BUILD 0.1.0.450 DATE 8/29/2011 AT 10:30 AM
==================================================== + Changed 'align 0x4' line above multiboot header in loader.asm to 'align 4' + Removed -e option for echo in build.sh + Modified build.sh for linux + Fixed triple fault when enabling paging + Fixed page faults at memory manager initialization + Fixed 'mem' console function + Added more info about page fault at crash screen + Added Panic() macro + Added verbose mode for memory manager [ BAD] BUILD 0.1.0.390 DATE 8/27/2011 AT 10:54 PM ==================================================== + Added stdlib routines, separated in different files + Rewritten physical memory manager + Added virtual mem manager + Added memory allocation/freeing + Added memory library + Added temporary allocation (at end of kernel), until paging is started - Removed functionality from debug console function 'mem' - Removed system.h, the one remaining function now in stdio.h
This commit is contained in:
31
Kernel/include/ctype.h
Normal file
31
Kernel/include/ctype.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef __CTYPE_H
|
||||
#define __CTYPE_H
|
||||
|
||||
extern unsigned char _ctype[];
|
||||
|
||||
#define _CTYPE_ISCONTROL 0x01 // 0000 0001
|
||||
#define _CTYPE_ISSPACE 0x02 // 0000 0010
|
||||
#define _CTYPE_ISBLANK 0x04 // 0000 0100 etc.
|
||||
#define _CTYPE_ISPUNCT 0x08
|
||||
#define _CTYPE_ISDIGIT 0x10
|
||||
#define _CTYPE_ISHEX 0x20
|
||||
#define _CTYPE_ISUPPER 0x40
|
||||
#define _CTYPE_ISLOWER 0x80
|
||||
|
||||
#define isalnum(c) (_ctype[(int)c+1] & (_CTYPE_ISLOWER | _CTYPE_ISUPPER | _CTYPE_ISDIGIT))
|
||||
#define isalpha(c) (_ctype[(int)c+1] & (_CTYPE_ISLOWER | _CTYPE_ISUPPER))
|
||||
#define isblank(c) (_ctype[(int)c+1] & (_CTYPE_ISBLANK))
|
||||
#define iscntrl(c) (_ctype[(int)c+1] & (_CTYPE_ISCONTROL))
|
||||
#define isdigit(c) (_ctype[(int)c+1] & (_CTYPE_ISDIGIT))
|
||||
#define isgraph(c) (_ctype[(int)c+1] & (_CTYPE_ISLOWER | _CTYPE_ISUPPER | _CTYPE_ISDIGIT | _CTYPE_ISPUNCT))
|
||||
#define islower(c) (_ctype[(int)c+1] & (_CTYPE_ISLOWER))
|
||||
#define isprint(c) (_ctype[(int)c+1] & (_CTYPE_ISLOWER | _CTYPE_ISUPPER | _CTYPE_ISDIGIT | _CTYPE_ISPUNCT | _CTYPE_ISBLANK))
|
||||
#define ispunct(c) (_ctype[(int)c+1] & (_CTYPE_ISPUNCT))
|
||||
#define isspace(c) (_ctype[(int)c+1] & (_CTYPE_ISSPACE))
|
||||
#define isupper(c) (_ctype[(int)c+1] & (_CTYPE_ISUPPER))
|
||||
#define isxdigit(c) (_ctype[(int)c+1] & (_CTYPE_ISHEX))
|
||||
|
||||
extern int toupper(int c);
|
||||
extern int tolower(int c);
|
||||
|
||||
#endif
|
88
Kernel/include/debugio.h
Normal file
88
Kernel/include/debugio.h
Normal file
@ -0,0 +1,88 @@
|
||||
#ifndef __DEBUGIO__H
|
||||
#define __DEBUGIO__H
|
||||
|
||||
#include <types.h>
|
||||
#include <settings.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
enum Colors
|
||||
{
|
||||
ColorBlack = 0x0,
|
||||
ColorBlue = 0x1,
|
||||
ColorGreen = 0x2,
|
||||
ColorCyan = 0x3,
|
||||
ColorRed = 0x4,
|
||||
ColorMagenta = 0x5,
|
||||
ColorBrown = 0x6,
|
||||
ColorLightGray = 0x7,
|
||||
ColorDarkGray = 0x8,
|
||||
ColorLightBlue = 0x9,
|
||||
ColorLightGreen = 0xA,
|
||||
ColorLightCyan = 0xB,
|
||||
ColorLightRed = 0xC,
|
||||
ColorLightMagenta = 0xD,
|
||||
ColorYellow = 0xE,
|
||||
ColorWhite = 0xF
|
||||
};
|
||||
|
||||
extern uint8 Color (uint8 back, uint8 fore);
|
||||
|
||||
// Cursor position
|
||||
extern Point ConsoleGetCursor();
|
||||
extern void ConsoleSetCursor(Point p);
|
||||
extern void ConsoleCursorGoto(Point p);
|
||||
|
||||
extern void ConsoleCursorIncreasePos (int32 delta);
|
||||
extern void ConsoleCursorNewline();
|
||||
extern void ConsoleCursorUpdateHardware();
|
||||
|
||||
// Get/set properties
|
||||
extern void ConsoleSetDefaultColor(uint8 color);
|
||||
extern uint8 ConsoleGetDefaultColor ();
|
||||
extern UPoint ConsoleGetSize();
|
||||
|
||||
extern void ConsoleSetChar(Point pos, char c);
|
||||
extern void ConsoleSetColor(Point pos, uint8 color);
|
||||
extern char ConsoleGetChar(Point pos);
|
||||
extern uint8 ConsoleGetColor (Point pos);
|
||||
|
||||
|
||||
// Basic console operations
|
||||
extern void ConsoleClear();
|
||||
extern void ConsoleScroll (uint32 lines);
|
||||
|
||||
// Console write operations
|
||||
extern void ConsoleWriteChar (char c);
|
||||
extern void ConsoleWriteString (string s);
|
||||
extern int32 ConsoleWrite (string format, ...);
|
||||
|
||||
// Console read operations
|
||||
extern void ConsoleReadString (string s, int32 buffer_size, char end_char);
|
||||
|
||||
// Console main loop
|
||||
extern void ConsoleMain();
|
||||
|
||||
// Debug print
|
||||
#if VERBOSE_MODE==1
|
||||
#define Log(...) ConsoleWrite(__VA_ARGS__)
|
||||
#else
|
||||
#define Log(...)
|
||||
#endif
|
||||
|
||||
// Error print
|
||||
#if VERBOSE_ERROR==1
|
||||
#define Error(...) ConsoleWrite(__VA_ARGS__)
|
||||
#else
|
||||
#define Error(...)
|
||||
#endif
|
||||
|
||||
// Panic
|
||||
#if VERBOSE_PANIC==1
|
||||
#define Panic(...) { ConsoleWrite("%#[PANIC] KERNEL PANIC: ", ColorLightRed); \
|
||||
ConsoleWrite(__VA_ARGS__); \
|
||||
asm volatile ("cli\nhlt"); }
|
||||
#else
|
||||
#define Panic(...)
|
||||
#endif
|
||||
|
||||
#endif
|
70
Kernel/include/fileio.h
Normal file
70
Kernel/include/fileio.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* fileio.h
|
||||
*
|
||||
* Created on: Aug 23, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef FILEIO_H_
|
||||
#define FILEIO_H_
|
||||
|
||||
#include <types.h>
|
||||
|
||||
enum FsFlags
|
||||
{
|
||||
FsFile = 0x1,
|
||||
FsDirectory = 0x2,
|
||||
FsCharDevice = 0x3,
|
||||
FsBlockDevice = 0x4,
|
||||
FsPipe = 0x5,
|
||||
FsSymbolLink = 0x6,
|
||||
FsMountPoint = 0x8
|
||||
};
|
||||
|
||||
typedef uint32 (*ReadRoutine)(struct _FsNode*, uint32, uint32, uint8*);
|
||||
typedef uint32 (*WriteRoutine)(struct _FsNode*, uint32, uint32, uint8*);
|
||||
typedef void (*OpenRoutine)(struct _FsNode*);
|
||||
typedef void (*CloseRoutine)(struct _FsNode*);
|
||||
typedef struct _DirectoryEntry (*ReadDirRoutine)(struct _FsNode*,uint32);
|
||||
typedef struct _FsNode* (*FindDirRoutine)(struct _FsNode*,char *name);
|
||||
|
||||
typedef struct _FsNode
|
||||
{
|
||||
char Name[128]; // The filename.
|
||||
uint32 Permissions; // The permissions mask.
|
||||
uint32 UserId; // The owning user.
|
||||
uint32 GroupId; // The owning group.
|
||||
uint32 Flags; // Includes the node type. See enum above.
|
||||
uint32 INode; // This is device-specific - provides a way for a filesystem to identify files.
|
||||
uint32 Length; // Size of the file, in bytes.
|
||||
uint32 Implementation; // An implementation-defined number.
|
||||
ReadRoutine Read;
|
||||
WriteRoutine Write;
|
||||
OpenRoutine Open;
|
||||
CloseRoutine Close;
|
||||
ReadDirRoutine ReadDir;
|
||||
FindDirRoutine FindDir;
|
||||
struct _FsNode *Ptr; // Used by mountpoints and symlinks.
|
||||
} FsNode;
|
||||
|
||||
|
||||
typedef struct _DirectoryEntry
|
||||
{
|
||||
char Name[128];
|
||||
uint32 INode;
|
||||
} DirectoryEntry;
|
||||
|
||||
|
||||
extern uint32 FsRead(FsNode *node, uint32 offset, uint32 size, uint8 *buffer);
|
||||
extern uint32 FsWrite(FsNode *node, uint32 offset, uint32 size, uint8 *buffer);
|
||||
extern void FsOpen(FsNode *node, uint8 read, uint8 write);
|
||||
extern void FsClose(FsNode *node);
|
||||
extern DirectoryEntry *FsReadDir(FsNode *node, uint32 index);
|
||||
extern FsNode *FsFindDir(FsNode *node, char *name);
|
||||
|
||||
#ifdef NEVER
|
||||
void VfsRegisterFilesys();
|
||||
void VfsMount();
|
||||
#endif
|
||||
|
||||
#endif /* FILEIO_H_ */
|
97
Kernel/include/memory-add.h
Normal file
97
Kernel/include/memory-add.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* memory-add.h
|
||||
*
|
||||
* Created on: Aug 27, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef MEMORY_ADD_H_
|
||||
#define MEMORY_ADD_H_
|
||||
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <debugio.h>
|
||||
|
||||
/***************************************************
|
||||
* Paging *
|
||||
***************************************************/
|
||||
typedef uint32 Page;
|
||||
|
||||
enum PageFlags
|
||||
{
|
||||
PagePresent = 0x1,
|
||||
PageWriteable = 0x2,
|
||||
PageUser = 0x4,
|
||||
PageWriteThough = 0x8,
|
||||
PageNotCacheable = 0x10,
|
||||
PageAccessed = 0x20,
|
||||
PageDirty = 0x40,
|
||||
PagePAT = 0x80,
|
||||
PageCpuGlobal = 0x100,
|
||||
PageLvl4Global = 0x200,
|
||||
PageFrame = 0xFFFFF000
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
Page Pages[1024];
|
||||
} PageTable;
|
||||
|
||||
typedef struct {
|
||||
PageTable* Tables[1024];
|
||||
uint32 TablesPhysical[1024];
|
||||
uint32 PhysicalAddr;
|
||||
} PageDirectory;
|
||||
|
||||
extern PageDirectory* CurrentDirectory;
|
||||
extern PageDirectory* KernelDirectory;
|
||||
|
||||
extern void PagingInitialize(uint32 SystemMemory);
|
||||
extern void PagingSwitchPageDirectory (PageDirectory* dir);
|
||||
extern Page* PagingGetPage(uint32 addr, uint8 make, PageDirectory* dir);
|
||||
|
||||
|
||||
/***************************************************
|
||||
* Physical memory manager *
|
||||
***************************************************/
|
||||
extern uint32 TotalFrames;
|
||||
extern uint32 TotalMemory;
|
||||
extern uint32 UsedFrames;
|
||||
|
||||
void MemPhInitialize(uint32 SystemMemoryKb);
|
||||
extern void MemPhSetFrame (uint32 frame, uint8 value);
|
||||
uint32 MemPhGetFrame (uint32 frame);
|
||||
uint32 MemPhFindFreeFrame();
|
||||
void MemPhAllocFrame(Page* page, uint8 isKernel, uint8 isWriteable);
|
||||
void MemPhFreeFrame(Page* page);
|
||||
void MemPhReserveFrames (uint32 address, uint32 length);
|
||||
|
||||
|
||||
/***************************************************
|
||||
* Memory heap *
|
||||
***************************************************/
|
||||
typedef struct
|
||||
{
|
||||
OrderedArray Index;
|
||||
uint32 StartAddress, EndAddress, MaxAddress;
|
||||
// bit 0: supervisor-only bit 1: read-only
|
||||
uint8 Flags;
|
||||
} MemHeap;
|
||||
|
||||
extern MemHeap* KernelHeap;
|
||||
|
||||
extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap);
|
||||
extern int32 MemHeapCompare (uint32 a, uint32 b);
|
||||
extern MemHeap* MemHeapCreate(uint32 start, uint32 end, uint32 max, uint8 flags);
|
||||
extern void MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd);
|
||||
extern uint32 MemHeapContract(uint32 newsz, MemHeap* heap, PageDirectory* pd);
|
||||
extern uint32 MemHeapAlloc (uint32 size, uint8 isPageAligned, MemHeap* heap, PageDirectory* pd);
|
||||
extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd);
|
||||
|
||||
|
||||
#define LogMem(...) { Log("%#[Mem] ", ColorLightCyan); Log(__VA_ARGS__); }
|
||||
#define ErrorMem(...) { Error("%#[Mem] ", ColorLightCyan); Error(__VA_ARGS__); }
|
||||
|
||||
|
||||
#endif /* MEMORY_ADD_H_ */
|
96
Kernel/include/memory-add.h~
Normal file
96
Kernel/include/memory-add.h~
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* memory-add.h
|
||||
*
|
||||
* Created on: Aug 27, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef MEMORY_ADD_H_
|
||||
#define MEMORY_ADD_H_
|
||||
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <debugio.h>
|
||||
|
||||
/***************************************************
|
||||
* Paging *
|
||||
***************************************************/
|
||||
typedef uint32 Page;
|
||||
|
||||
enum PageFlags
|
||||
{
|
||||
PagePresent = 0x1,
|
||||
PageWriteable = 0x2,
|
||||
PageUser = 0x4,
|
||||
PageWriteThough = 0x8,
|
||||
PageNotCacheable = 0x10,
|
||||
PageAccessed = 0x20,
|
||||
PageDirty = 0x40,
|
||||
PagePAT = 0x80,
|
||||
PageCpuGlobal = 0x100,
|
||||
PageLvl4Global = 0x200,
|
||||
PageFrame = 0xFFFFF000
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
Page Pages[1024];
|
||||
} PageTable;
|
||||
|
||||
typedef struct {
|
||||
PageTable* Tables[1024];
|
||||
uint32 TablesPhysical[1024];
|
||||
uint32 PhysicalAddr;
|
||||
} PageDirectory;
|
||||
|
||||
extern PageDirectory* CurrentDirectory;
|
||||
extern PageDirectory* KernelDirectory;
|
||||
|
||||
extern void PagingInitialize(uint32 SystemMemory);
|
||||
extern void PagingSwitchPageDirectory (PageDirectory* dir);
|
||||
extern Page* PagingGetPage(uint32 addr, uint8 make, PageDirectory* dir);
|
||||
|
||||
|
||||
/***************************************************
|
||||
* Physical memory manager *
|
||||
***************************************************/
|
||||
extern uint32 TotalFrames;
|
||||
extern uint32 TotalMemory;
|
||||
|
||||
void MemPhInitialize(uint32 SystemMemoryKb);
|
||||
extern void MemPhSetFrame (uint32 frame, uint8 value);
|
||||
uint32 MemPhGetFrame (uint32 frame);
|
||||
uint32 MemPhFindFreeFrame();
|
||||
void MemPhAllocFrame(Page* page, uint8 isKernel, uint8 isWriteable);
|
||||
void MemPhFreeFrame(Page* page);
|
||||
void MemPhReserveFrames (uint32 address, uint32 length);
|
||||
|
||||
|
||||
/***************************************************
|
||||
* Memory heap *
|
||||
***************************************************/
|
||||
typedef struct
|
||||
{
|
||||
OrderedArray Index;
|
||||
uint32 StartAddress, EndAddress, MaxAddress;
|
||||
// bit 0: supervisor-only bit 1: read-only
|
||||
uint8 Flags;
|
||||
} MemHeap;
|
||||
|
||||
extern MemHeap* KernelHeap;
|
||||
|
||||
extern uint32 MemHeapFindSmallestHole (uint32 size, uint8 page_align, MemHeap* heap);
|
||||
extern int32 MemHeapCompare (uint32 a, uint32 b);
|
||||
extern MemHeap* MemHeapCreate(uint32 start, uint32 end, uint32 max, uint8 flags);
|
||||
extern void MemHeapExpand(uint32 newsz, MemHeap* heap, PageDirectory* pd);
|
||||
extern uint32 MemHeapContract(uint32 newsz, MemHeap* heap, PageDirectory* pd);
|
||||
extern uint32 MemHeapAlloc (uint32 size, uint8 isPageAligned, MemHeap* heap, PageDirectory* pd);
|
||||
extern void MemHeapFree (uint32 address, MemHeap* heap, PageDirectory* pd);
|
||||
|
||||
|
||||
#define LogMem(...) { Log("%#[Mem] ", ColorLightCyan); Log(__VA_ARGS__); }
|
||||
#define ErrorMem(...) { Error("%#[Mem] ", ColorLightCyan); Error(__VA_ARGS__); }
|
||||
|
||||
|
||||
#endif /* MEMORY_ADD_H_ */
|
29
Kernel/include/memory.h
Normal file
29
Kernel/include/memory.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __MEMORY__H
|
||||
#define __MEMORY__H
|
||||
|
||||
#include <types.h>
|
||||
#include <settings.h>
|
||||
#include <multiboot.h>
|
||||
|
||||
/***************************************************
|
||||
* Basic memory operations: alloc, free *
|
||||
***************************************************/
|
||||
extern void* kmalloc (uint32 size);
|
||||
extern void* kmalloc_a (uint32 size);
|
||||
extern void* kmalloc_p (uint32 size, uint32* phys);
|
||||
extern void* kmalloc_ap (uint32 size, uint32* phys);
|
||||
extern void kfree (void* addr);
|
||||
|
||||
extern void MemoryTempInitialize (uint32 kernel_end);
|
||||
extern void MemoryInitialize (MultibootInfo* info);
|
||||
|
||||
extern uint32 MemoryGetTotal();
|
||||
extern uint32 MemoryGetFree(); // Returns total free physical memory in kilobytes
|
||||
extern uint32 MemoryGetUsed(); // Total used physical memory in kbytes
|
||||
extern uint32 MemoryGetFrameSize(); // Same as above functions, but in frames
|
||||
extern uint32 MemoryGetFramesTotal();
|
||||
extern uint32 MemoryGetFramesUsed();
|
||||
extern uint32 MemoryGetFramesFree();
|
||||
|
||||
|
||||
#endif
|
29
Kernel/include/memory.h~
Normal file
29
Kernel/include/memory.h~
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __MEMORY__H
|
||||
#define __MEMORY__H
|
||||
|
||||
#include <types.h>
|
||||
#include <settings.h>
|
||||
#include <multiboot.h>
|
||||
|
||||
/***************************************************
|
||||
* Basic memory operations: alloc, free *
|
||||
***************************************************/
|
||||
extern void* kmalloc (uint32 size);
|
||||
extern void* kmalloc_a (uint32 size);
|
||||
extern void* kmalloc_p (uint32 size, uint32* phys);
|
||||
extern void* kmalloc_ap (uint32 size, uint32* phys);
|
||||
extern void kfree (void* addr);
|
||||
|
||||
extern void MemoryTempInitialize (uint32 kernel_end);
|
||||
extern void MemoryInitialize (MultibootInfo* info);
|
||||
|
||||
extern uint32 MemoryGetTotal();
|
||||
extern uint32 MemoryGetFree(); // Returns total free physical memory in bytes
|
||||
extern uint32 MemoryGetUsed(); // Total used physical memory in bytes
|
||||
extern uint32 MemoryGetFrameSize(); // Same as above functions, but in frames
|
||||
extern uint32 MemoryGetFramesTotal();
|
||||
extern uint32 MemoryGetFramesUsed();
|
||||
extern uint32 MemoryGetFramesFree();
|
||||
|
||||
|
||||
#endif
|
119
Kernel/include/multiboot.h
Normal file
119
Kernel/include/multiboot.h
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* multiboot.h
|
||||
*
|
||||
* Created on: Aug 17, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef MULTIBOOT_H_
|
||||
#define MULTIBOOT_H_
|
||||
|
||||
#include <types.h>
|
||||
|
||||
// Flags to be set in the 'flags' member of the multiboot info structure.
|
||||
#define MultibootInfo_MEMORY 0x00000001 // is there basic lower/upper memory information?
|
||||
#define MultibootInfo_BOOTDEV 0x00000002 // is there a boot device set?
|
||||
#define MultibootInfo_CMDLINE 0x00000004 // is the command-line defined?
|
||||
#define MultibootInfo_MODS 0x00000008 // are there modules to do something with?
|
||||
|
||||
// These next two are mutually exclusive
|
||||
#define MultibootInfo_AOUT_SYMS 0x00000010 // is there a symbol table loaded?
|
||||
#define MultibootInfo_ELF_SHDR 0X00000020 // is there an ELF section header table?
|
||||
|
||||
|
||||
#define MultibootInfo_MEM_MAP 0x00000040 // is there a full memory map?
|
||||
#define MultibootInfo_DRIVE_INFO 0x00000080 // Is there drive info?
|
||||
#define MultibootInfo_CONFIG_TABLE 0x00000100 // Is there a config table?
|
||||
#define MultibootInfo_BOOT_LOADER_NAME 0x00000200 // Is there a boot loader name?
|
||||
#define MultibootInfo_APM_TABLE 0x00000400 // Is there a APM table?
|
||||
#define MultibootInfo_VIDEO_INFO 0x00000800 // Is there video information?
|
||||
|
||||
|
||||
// The symbol table for a.out.
|
||||
typedef struct
|
||||
{
|
||||
uint32 TableSize;
|
||||
uint32 StrSize;
|
||||
uint32 Address;
|
||||
uint32 Reserved;
|
||||
} MultibootAoutSymbolTable;
|
||||
|
||||
|
||||
// The section header table for ELF.
|
||||
typedef struct
|
||||
{
|
||||
uint32 Number;
|
||||
uint32 Size;
|
||||
uint32 Address;
|
||||
uint32 Shndx;
|
||||
} MultibootElfSectionHeaderTable;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 Flags; // Multiboot info version number
|
||||
|
||||
uint32 MemoryLower; // Available memory from BIOS
|
||||
uint32 MemoryUpper;
|
||||
|
||||
uint32 BootDevice; // "root" partition
|
||||
|
||||
uint32 CommandLine; // Kernel command line
|
||||
|
||||
uint32 ModulesCount; // Boot-Module list
|
||||
uint32 ModulesAddress;
|
||||
|
||||
union
|
||||
{
|
||||
MultibootAoutSymbolTable AoutSymbols;
|
||||
MultibootElfSectionHeaderTable ElfSectionHeaderTable;
|
||||
} Symbols;
|
||||
|
||||
uint32 MemoryMapLength; // Memory Mapping buffer
|
||||
uint32 MemoryMapAddress;
|
||||
|
||||
uint32 DrivesLength; // Drive Info buffer
|
||||
uint32 DrivesAddress;
|
||||
|
||||
uint32 ConfigurationTable; // ROM configuration table
|
||||
|
||||
uint32 BootLoaderName; // Boot Loader Name
|
||||
|
||||
uint32 ApmTable; // APM table
|
||||
|
||||
uint32 VbeControlInfo; // Video
|
||||
uint32 VbeModeInfo;
|
||||
uint16 VbeMode;
|
||||
uint16 VbeInterfaceSegment;
|
||||
uint16 VbeInterfaceOffset;
|
||||
uint16 VbeInterfaceLength;
|
||||
} MultibootInfo;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 Size;
|
||||
uint64 Address;
|
||||
uint64 Length;
|
||||
|
||||
#define MULTIBOOT_MEMORY_AVAILABLE 1
|
||||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
|
||||
uint32 Type;
|
||||
} __attribute__((packed)) MultibootMemoryMapEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive
|
||||
uint32 ModuleStart;
|
||||
uint32 ModuleEnd;
|
||||
|
||||
// Module command line
|
||||
uint32 CommandLine;
|
||||
|
||||
// padding to take it to 16 bytes (must be zero)
|
||||
uint32 _Padding;
|
||||
} MultibootModule;
|
||||
|
||||
|
||||
#endif
|
38
Kernel/include/settings.h
Normal file
38
Kernel/include/settings.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* settings.h
|
||||
*
|
||||
* Created on: Aug 16, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef SETTINGS_H_
|
||||
#define SETTINGS_H_
|
||||
|
||||
// OS info
|
||||
#define OS_STRING "lux"
|
||||
#define OS_VERSION "0.1 [pre-Alpha]"
|
||||
#define OS_BUILD_DATE __DATE__
|
||||
#define OS_BUILD_TIME __TIME__
|
||||
|
||||
#include <version.h>
|
||||
|
||||
// Logger
|
||||
#define VERBOSE_MODE 1
|
||||
#define VERBOSE_ERROR 1
|
||||
#define VERBOSE_PANIC 1
|
||||
|
||||
|
||||
// Clock
|
||||
#define PIT_FREQUENCY 100
|
||||
|
||||
// Console
|
||||
#define CONSOLE_MAX_PARAMS 32
|
||||
#define CONSOLE_DEFAULT_COLOR 0x7
|
||||
|
||||
// Memory manager
|
||||
#define KERNEL_HEAP_START 0xC0000000
|
||||
#define KERNEL_HEAP_INITIAL_SIZE 0x100000
|
||||
#define KERNEL_HEAP_END (KERNEL_HEAP_START + KERNEL_HEAP_INITIAL_SIZE)
|
||||
|
||||
|
||||
#endif /* SETTINGS_H_ */
|
37
Kernel/include/settings.h~
Normal file
37
Kernel/include/settings.h~
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* settings.h
|
||||
*
|
||||
* Created on: Aug 16, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef SETTINGS_H_
|
||||
#define SETTINGS_H_
|
||||
|
||||
// OS info
|
||||
#define OS_STRING "lux"
|
||||
#define OS_VERSION "0.1 [pre-Alpha]"
|
||||
#define OS_BUILD_DATE __DATE__
|
||||
#define OS_BUILD_TIME __TIME__
|
||||
|
||||
#include <version.h>
|
||||
|
||||
// Logger
|
||||
#define VERBOSE_MODE 1
|
||||
#define VERBOSE_ERROR 1
|
||||
#define VERBOSE_PANIC 1
|
||||
|
||||
|
||||
// Clock
|
||||
#define PIT_FREQUENCY 100
|
||||
|
||||
// Console
|
||||
#define CONSOLE_MAX_PARAMS 32
|
||||
#define CONSOLE_DEFAULT_COLOR 0x7
|
||||
|
||||
// Memory manager
|
||||
#define KERNEL_HEAP_START 0xC0000000
|
||||
#define KERNEL_HEAP_END 0xCFFFF000
|
||||
#define KERNEL_HEAP_INITIAL_SIZE 0x100000
|
||||
|
||||
#endif /* SETTINGS_H_ */
|
38
Kernel/include/stdarg.h
Normal file
38
Kernel/include/stdarg.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef __STDARG__H
|
||||
#define __STDARG__H
|
||||
|
||||
#include <va_list.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* width of stack == width of int */
|
||||
#define STACKITEM int
|
||||
|
||||
/* round up width of objects pushed on stack. The expression before the
|
||||
& ensures that we get 0 for objects of size 0. */
|
||||
#define VA_SIZE(TYPE) \
|
||||
((sizeof(TYPE) + sizeof(STACKITEM) - 1) \
|
||||
& ~(sizeof(STACKITEM) - 1))
|
||||
|
||||
/* &(LASTARG) points to the LEFTMOST argument of the function call
|
||||
(before the ...) */
|
||||
#define va_start(AP, LASTARG) \
|
||||
(AP=((va_list)&(LASTARG) + VA_SIZE(LASTARG)))
|
||||
|
||||
/* nothing for va_end */
|
||||
#define va_end(AP)
|
||||
|
||||
#define va_arg(AP, TYPE) \
|
||||
(AP += VA_SIZE(TYPE), *((TYPE *)(AP - VA_SIZE(TYPE))))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
29
Kernel/include/stdio.h
Normal file
29
Kernel/include/stdio.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __STDIO__H
|
||||
#define __STDIO__H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#define inb(port) inportb(port)
|
||||
#define outb(port) outportb(port)
|
||||
|
||||
extern uint8 inportb (uint16 _port);
|
||||
|
||||
static inline void outportb (uint16 _port, uint8 _data) {
|
||||
asm volatile ("outb %1, %0" : : "dN" (_port), "a" (_data));
|
||||
}
|
||||
|
||||
static inline void iowait() {
|
||||
asm volatile ("outb %al, $0x80");
|
||||
}
|
||||
|
||||
static inline void MagicBreakpoint()
|
||||
{
|
||||
asm volatile ("xchg %bx, %bx");
|
||||
}
|
||||
|
||||
extern void SystemReboot();
|
||||
|
||||
extern Key ReadKey();
|
||||
extern KeyEvent ReadKeyEvent();
|
||||
|
||||
#endif
|
69
Kernel/include/stdlib.h
Normal file
69
Kernel/include/stdlib.h
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef __STDLIB__H
|
||||
#define __STDLIB__H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#define IsDigit(c) (c >= '0' && c <= '9')
|
||||
#define IsHexDigit(c) ( (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') )
|
||||
#define IsUpper(c) (c >= 'A' && c <= 'Z')
|
||||
#define IsLower(c) (c >= 'a' && c <= 'z')
|
||||
|
||||
#define IsAlpha(c) (IsLower(c) || IsUpper(c))
|
||||
#define IsAlphaNum(c) (IsAlpha(c) || IsDigit(c))
|
||||
|
||||
#define ToLower(c) ((IsUpper(c)) ? (c - 'A' + 'a') : c)
|
||||
#define ToUpper(c) ((IsLower(c)) ? (c - 'a' + 'A') : c)
|
||||
|
||||
#define Max(a,b) ((a > b) ? (a) : (b))
|
||||
#define Min(a,b) ((a < b) ? (a) : (b))
|
||||
#define Abs(a) ((a < 0) ? (a * -1) : (a))
|
||||
|
||||
/***************************************************
|
||||
* String operations: len, cmp, cpy *
|
||||
***************************************************/
|
||||
extern uint32 strlen (string s);
|
||||
extern int32 strcmp (string a, string b);
|
||||
extern string strcpy (string s1, const string s2);
|
||||
|
||||
/***************************************************
|
||||
* Number operations: len *
|
||||
***************************************************/
|
||||
extern uint32 numlen (int32 number, int32 base);
|
||||
extern uint32 unumlen (uint32 number, int32 base);
|
||||
|
||||
/***************************************************
|
||||
* Memory operations: cpy, cmp, set *
|
||||
***************************************************/
|
||||
void* memcpy (void *dest, const void *src, uint32 count);
|
||||
int32 memcmp (const void *s1, const void *s2, uint32 count);
|
||||
void* memset (void *dest, uint8 val, uint32 count);
|
||||
|
||||
/***************************************************
|
||||
* Conversion operations: num-str/str-num *
|
||||
***************************************************/
|
||||
extern int32 ConvertIntToString (string buffer, int32 number, int32 base);
|
||||
extern uint32 ConvertUIntToString (string buffer, uint32 number, int32 base);
|
||||
extern int32 ConvertStringToInt (string buffer);
|
||||
extern uint32 ConvertStringToUInt (string buffer);
|
||||
extern uint32 ConvertStringToIntHex (string buffer);
|
||||
|
||||
/***************************************************
|
||||
* Ordered array implementation *
|
||||
***************************************************/
|
||||
typedef int (*ComparePredicate) (uint32, uint32);
|
||||
typedef struct {
|
||||
uint32* Data;
|
||||
uint32 Size;
|
||||
uint32 SizeLimit;
|
||||
ComparePredicate Compare;
|
||||
} OrderedArray;
|
||||
|
||||
extern OrderedArray OrderedArrayCreate (uint32 maxSize, ComparePredicate p);
|
||||
extern OrderedArray OrderedArrayPlace (uint32 addr, uint32 maxSize, ComparePredicate p);
|
||||
extern void OrderedArrayDispose (OrderedArray* arr);
|
||||
extern uint32 OrderedArraySearch (uint32 key, OrderedArray* arr, ComparePredicate predicate);
|
||||
extern void OrderedArrayInsert (uint32 item, OrderedArray* arr);
|
||||
extern uint32 OrderedArrayLookup (uint32 index, OrderedArray* arr);
|
||||
extern void OrderedArrayDeleteIndex (uint32 index, OrderedArray* arr);
|
||||
|
||||
#endif
|
69
Kernel/include/stdlib.h~
Normal file
69
Kernel/include/stdlib.h~
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef __STDLIB__H
|
||||
#define __STDLIB__H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#define IsDigit(c) (c >= '0' && c <= '9')
|
||||
#define IsHexDigit(c) ( (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') )
|
||||
#define IsUpper(c) (c >= 'A' && c <= 'Z')
|
||||
#define IsLower(c) (c >= 'a' && c <= 'z')
|
||||
|
||||
#define IsAlpha(c) (IsLower(c) || IsUpper(c))
|
||||
#define IsAlphaNum(c) (IsAlpha(c) || IsDigit(c))
|
||||
|
||||
#define ToLower(c) ((IsUpper(c)) ? (c - 'A' + 'a') : c)
|
||||
#define ToUpper(c) ((IsLower(c)) ? (c - 'a' + 'A') : c)
|
||||
|
||||
#define Max(a,b) ((a > b) ? (a) : (b))
|
||||
#define Min(a,b) ((a < b) ? (a) : (b))
|
||||
#define Abs(a) ((a < 0) ? (a * -1) : (a))
|
||||
|
||||
/***************************************************
|
||||
* String operations: len, cmp, cpy *
|
||||
***************************************************/
|
||||
extern uint32 strlen (string s);
|
||||
extern int32 strcmp (string a, string b);
|
||||
extern string strcpy (string s1, const string s2);
|
||||
|
||||
/***************************************************
|
||||
* Number operations: len *
|
||||
***************************************************/
|
||||
extern uint32 numlen (int32 number, int32 base);
|
||||
extern uint32 unumlen (uint32 number, int32 base);
|
||||
|
||||
/***************************************************
|
||||
* Memory operations: cpy, cmp, set *
|
||||
***************************************************/
|
||||
void* memcpy (void *dest, const void *src, uint32 count);
|
||||
int32 memcmp (const void *s1, const void *s2, uint32 count);
|
||||
void* memset (void *dest, uint8 val, uint32 count);
|
||||
|
||||
/***************************************************
|
||||
* Conversion operations: num-str/str-num *
|
||||
***************************************************/
|
||||
extern int32 ConvertIntToString (string buffer, int32 number, int32 base);
|
||||
extern uint32 ConvertUIntToString (string buffer, uint32 number, int32 base);
|
||||
extern int32 ConvertStringToInt (string buffer);
|
||||
extern uint32 ConvertStringToUInt (string buffer);
|
||||
extern uint32 ConvertStringToIntHex (string buffer);
|
||||
|
||||
/***************************************************
|
||||
* Ordered array implementation *
|
||||
***************************************************/
|
||||
typedef int (*ComparePredicate) (uint32, uint32);
|
||||
typedef struct {
|
||||
uint32* Data;
|
||||
uint32 Size;
|
||||
uint32 SizeLimit;
|
||||
ComparePredicate Compare;
|
||||
} OrderedArray;
|
||||
|
||||
extern OrderedArray OrderedArrayCreate (uint32 maxSize, ComparePredicate p);
|
||||
extern OrderedArray OrderedArrayPlace (uint32 addr, uint32 maxSize, ComparePredicate p);
|
||||
extern void OrderedArrayDispose (OrderedArray* arr);
|
||||
extern uint32 OrderedArraySearch (uint32 key, OrderedArray* arr, ComparePredicate predicate);
|
||||
extern void OrderedArrayInsert (uint32 item, OrderedArray* arr);
|
||||
extern uint32 OrderedArrayLookup (uint32 index, OrderedArray* arr);
|
||||
extern void OrderedArrayDeleteIndex (uint32 index, OrderedArray* arr);
|
||||
|
||||
#endif
|
65
Kernel/include/storage.h
Normal file
65
Kernel/include/storage.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* storage.h
|
||||
*
|
||||
* Created on: Aug 23, 2011
|
||||
* Author: Tiberiu
|
||||
*/
|
||||
|
||||
#ifndef STORAGE_H_
|
||||
#define STORAGE_H_
|
||||
|
||||
#include <types.h>
|
||||
|
||||
// Storage device
|
||||
typedef struct {
|
||||
|
||||
char MountPointName[32];// E.g. "fd0"; you should avoid spaces, or special chars, or otherwise get weird paths like "Mom's floppy\virus.exe"
|
||||
uint32 DeviceID; // Autocompleted by VFS
|
||||
|
||||
uint32 BlockSize; // E.g. sector size
|
||||
uint32 BlockCount; // How many blocks are loaded in memory per read
|
||||
|
||||
/********************************************************
|
||||
* READ DATA *
|
||||
* Params: *
|
||||
* > offset: read starting from block ~ *
|
||||
* Returns: address to data, NULL for error *
|
||||
********************************************************/
|
||||
uint32 (*ReadData) (uint32 offset);
|
||||
|
||||
/********************************************************
|
||||
* WRITE DATA *
|
||||
* Params: *
|
||||
* > offset: write starting from block ~ *
|
||||
* > address: where to write from *
|
||||
* Returns: NULL for error *
|
||||
********************************************************/
|
||||
uint32 (*WriteData) (uint32 offset, uint32 address);
|
||||
|
||||
uint32 FileSystemID; // Autocompleted by 'mount'... at least should be
|
||||
|
||||
} StorageDevice;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32 FileSystemID; // Autocompleted by VFS
|
||||
|
||||
/********************************************************
|
||||
* DETECT IF THIS IS THE FS ON STORAGE DEVICE *
|
||||
* Params: *
|
||||
* > *s: Pointer to device info & routines *
|
||||
* Returns: positive if match, NULL otherwise *
|
||||
********************************************************/
|
||||
uint32 (*Detect) (StorageDevice *s);
|
||||
|
||||
uint32 (*Open) (StorageDevice *s, string path);
|
||||
uint32 (*CreateNode) (StorageDevice *s, string path);
|
||||
uint32 (*DeleteNode) (StorageDevice *s, string path);
|
||||
|
||||
} FileSystem;
|
||||
|
||||
|
||||
|
||||
extern void ConvertLbaToChs(uint32 SectorsPerTrack, uint32 lba, uint32 *cyl, uint32 *head, uint32 *sector);
|
||||
|
||||
#endif /* STORAGE_H_ */
|
37
Kernel/include/time.h
Normal file
37
Kernel/include/time.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef __TIME__H
|
||||
#define __TIME__H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
// User friendly time structure
|
||||
struct _Time
|
||||
{
|
||||
int32 Year;
|
||||
uint8 Month, WeekDay, Day; // Day starts monday
|
||||
uint8 Hour, Minute, Second;
|
||||
uint16 Milisecond;
|
||||
} __attribute__((packed));
|
||||
|
||||
// System time structure
|
||||
struct _TimeSystem {
|
||||
uint32 Date, Time;
|
||||
} __attribute__((packed));
|
||||
|
||||
typedef struct _Time Time;
|
||||
typedef struct _TimeSystem TimeSystem;
|
||||
|
||||
|
||||
extern TimeSystem TimeConvertToTimeSystem (Time t);
|
||||
extern Time TimeConvertToTime (TimeSystem InternalTime);
|
||||
extern uint16 TimeCalculateWeekday (Time t);
|
||||
|
||||
extern TimeSystem TimeGetInternalTime();
|
||||
extern uint32 TimeGetInternalFrequency ();
|
||||
|
||||
extern void TimeSetInternalTime(TimeSystem t);
|
||||
extern void TimeSetInternalFrequency (uint32 f);
|
||||
|
||||
extern void TimerStart (uint32 ms);
|
||||
extern uint8 TimerIsDone ();
|
||||
|
||||
#endif
|
267
Kernel/include/types.h
Normal file
267
Kernel/include/types.h
Normal file
@ -0,0 +1,267 @@
|
||||
#ifndef __TYPES__H
|
||||
#define __TYPES__H
|
||||
|
||||
// Get rid of annoying unused params warnings
|
||||
#ifdef UNUSED
|
||||
#elif defined(__GNUC__)
|
||||
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
|
||||
#elif defined(__LCLINT__)
|
||||
# define UNUSED(x) /*@unused@*/ x
|
||||
#else
|
||||
# define UNUSED(x) x
|
||||
#endif
|
||||
|
||||
/****************************************
|
||||
* NULL constant *
|
||||
****************************************/
|
||||
#define null 0
|
||||
#define NULL 0
|
||||
|
||||
/****************************************
|
||||
* Int definitions *
|
||||
****************************************/
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int int32;
|
||||
typedef unsigned uint32;
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
|
||||
/****************************************
|
||||
* Limits definitions *
|
||||
****************************************/
|
||||
#define INT8_MIN (-128)
|
||||
#define INT16_MIN (-32768)
|
||||
#define INT32_MIN (-2147483647 - 1)
|
||||
#define INT64_MIN (-9223372036854775807LL - 1)
|
||||
|
||||
#define INT8_MAX 127
|
||||
#define INT16_MAX 32767
|
||||
#define INT32_MAX 2147483647
|
||||
#define INT64_MAX 9223372036854775807LL
|
||||
|
||||
#define UINT8_MAX 0xff /* 255U */
|
||||
#define UINT16_MAX 0xffff /* 65535U */
|
||||
#define UINT32_MAX 0xffffffff /* 4294967295U */
|
||||
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
||||
|
||||
|
||||
/****************************************
|
||||
* Registers *
|
||||
****************************************/
|
||||
// 32 bit registers
|
||||
typedef struct {
|
||||
uint32 eax, ebx, ecx, edx, esi, edi, ebp, esp, eflags;
|
||||
uint8 cflag;
|
||||
} _R32BIT;
|
||||
|
||||
// 16 bit registers
|
||||
typedef struct {
|
||||
uint16 ax, bx, cx, dx, si, di, bp, sp, es, cs, ss, ds, flags;
|
||||
uint8 cflag;
|
||||
} _R16BIT ;
|
||||
|
||||
// 16 bit registers expressed in 32 bit registers
|
||||
typedef struct {
|
||||
uint16 ax, axh, bx, bxh, cx, cxh, dx, dxh;
|
||||
uint16 si, di, bp, sp, es, cs, ss, ds, flags;
|
||||
uint8 cflags;
|
||||
} _R16BIT32 ;
|
||||
|
||||
// 8 bit registers
|
||||
typedef struct {
|
||||
uint8 al, ah, bl, bh, cl, ch, dl, dh;
|
||||
} _R8BIT;
|
||||
|
||||
// 8 bit registers expressed in 32 bit registers
|
||||
typedef struct {
|
||||
uint8 al, ah; uint16 axh;
|
||||
uint8 bl, bh; uint16 bxh;
|
||||
uint8 cl, ch; uint16 cxh;
|
||||
uint8 dl, dh; uint16 dxh;
|
||||
} _R8BIT32;
|
||||
|
||||
// 8 and 16 bit registers union
|
||||
typedef union {
|
||||
_R16BIT x;
|
||||
_R8BIT h;
|
||||
}_INTR16;
|
||||
|
||||
// 32 bit, 16 bit and 8 bit registers union
|
||||
typedef union {
|
||||
_R32BIT x;
|
||||
_R16BIT32 l;
|
||||
_R8BIT32 h;
|
||||
} _INTR32;
|
||||
|
||||
/* This defines what the stack looks like after an ISR was running */
|
||||
typedef struct
|
||||
{
|
||||
uint32 gs, fs, es, ds; /* pushed the segs last */
|
||||
uint32 edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
|
||||
uint32 int_no, err_code; /* our 'push byte #' and ecodes do this */
|
||||
uint32 eip, cs, eflags, useresp, ss; /* pushed by the processor automatically */
|
||||
} _RegsStack32;
|
||||
|
||||
|
||||
/****************************************
|
||||
* Keyboard data types *
|
||||
****************************************/
|
||||
enum KeyboardKeys {
|
||||
|
||||
KeyboardKeyF9 = 0x01,
|
||||
KeyboardKeyF7 = 0x02,
|
||||
KeyboardKeyF5 = 0x03,
|
||||
KeyboardKeyF3 = 0x04,
|
||||
KeyboardKeyF1 = 0x05,
|
||||
KeyboardKeyF2 = 0x06,
|
||||
KeyboardKeyF12 = 0x07,
|
||||
KeyboardKeyMediaNext = 0x08,
|
||||
KeyboardKeyF10 = 0x09,
|
||||
KeyboardKeyF8 = 0x0A,
|
||||
KeyboardKeyF6 = 0x0B,
|
||||
KeyboardKeyF4 = 0x0C,
|
||||
KeyboardKeyTab = 0x0D,
|
||||
KeyboardKeyTilda = 0x0E,
|
||||
KeyboardKeyMediaPrevious = 0x0F,
|
||||
KeyboardKeyMediaStop = 0x10,
|
||||
KeyboardKeyLeftAlt = 0x11,
|
||||
KeyboardKeyLeftShift = 0x12,
|
||||
KeyboardKeyMediaPause = 0x13,
|
||||
KeyboardKeyLeftCtrl = 0x14,
|
||||
KeyboardKeyQ = 0x15,
|
||||
KeyboardKey1 = 0x16,
|
||||
KeyboardKeyMediaVolUp = 0x17,
|
||||
KeyboardKeyMediaVolDown = 0x18,
|
||||
KeyboardKeyMediaSelect = 0x19,
|
||||
KeyboardKeyZ = 0x1A,
|
||||
KeyboardKeyS = 0x1B,
|
||||
KeyboardKeyA = 0x1C,
|
||||
KeyboardKeyW = 0x1D,
|
||||
KeyboardKey2 = 0x1E,
|
||||
KeyboardKeyLeftWin = 0x1F,
|
||||
KeyboardKeyMediaEmail = 0x20,
|
||||
KeyboardKeyC = 0x21,
|
||||
KeyboardKeyX = 0x22,
|
||||
KeyboardKeyD = 0x23,
|
||||
KeyboardKeyE = 0x24,
|
||||
KeyboardKey4 = 0x25,
|
||||
KeyboardKey3 = 0x26,
|
||||
KeyboardKeyRightWin = 0x27,
|
||||
KeyboardKeyMediaCalculator = 0x28,
|
||||
KeyboardKeySpace = 0x29,
|
||||
KeyboardKeyV = 0x2A,
|
||||
KeyboardKeyF = 0x2B,
|
||||
KeyboardKeyT = 0x2C,
|
||||
KeyboardKeyR = 0x2D,
|
||||
KeyboardKey5 = 0x2E,
|
||||
KeyboardKeyMenu = 0x2F,
|
||||
KeyboardKeyMediaComputer = 0x30,
|
||||
KeyboardKeyN = 0x31,
|
||||
KeyboardKeyB = 0x32,
|
||||
KeyboardKeyH = 0x33,
|
||||
KeyboardKeyG = 0x34,
|
||||
KeyboardKeyY = 0x35,
|
||||
KeyboardKey6 = 0x36,
|
||||
KeyboardKeyPower = 0x37,
|
||||
KeyboardKeyMediaWebSearch = 0x38,
|
||||
KeyboardKeyMediaWebHome = 0x39,
|
||||
KeyboardKeyM = 0x3A,
|
||||
KeyboardKeyJ = 0x3B,
|
||||
KeyboardKeyU = 0x3C,
|
||||
KeyboardKey7 = 0x3D,
|
||||
KeyboardKey8 = 0x3E,
|
||||
KeyboardKeySleep = 0x3F,
|
||||
KeyboardKeyWake = 0x40,
|
||||
KeyboardKeyComma = 0x41,
|
||||
KeyboardKeyK = 0x42,
|
||||
KeyboardKeyI = 0x43,
|
||||
KeyboardKeyO = 0x44,
|
||||
KeyboardKey0 = 0x45,
|
||||
KeyboardKey9 = 0x46,
|
||||
KeyboardKeyMediaWebBack = 0x47,
|
||||
KeyboardKeyMediaWebForward = 0x48,
|
||||
KeyboardKeyPeriod = 0x49,
|
||||
KeyboardKeySlash = 0x4A,
|
||||
KeyboardKeyL = 0x4B,
|
||||
KeyboardKeySemicolon = 0x4C,
|
||||
KeyboardKeyP = 0x4D,
|
||||
KeyboardKeyDash = 0x4E,
|
||||
KeyboardKeyMediaWebStop = 0x4F,
|
||||
KeyboardKeyMediaWebRefresh = 0x50,
|
||||
KeyboardKeyMediaWebFavorites = 0x51,
|
||||
KeyboardKeyApostrophe = 0x52,
|
||||
KeyboardKeyRightAlt = 0x53,
|
||||
KeyboardKeyLeftBracket = 0x54,
|
||||
KeyboardKeyEqual = 0x55,
|
||||
KeyboardKeyPrintScreen = 0x56,
|
||||
KeyboardKeyPause = 0x57,
|
||||
KeyboardKeyCapsLock = 0x58,
|
||||
KeyboardKeyRightShift = 0x59,
|
||||
KeyboardKeyReturn = 0x5A,
|
||||
KeyboardKeyRightBracket = 0x5B,
|
||||
KeyboardKeyRightCtrl = 0x5C,
|
||||
KeyboardKeyBackSlash = 0x5D,
|
||||
KeyboardKeyInsert = 0x5E,
|
||||
KeyboardKeyDelete = 0x5F,
|
||||
KeyboardKeyHome = 0x60,
|
||||
KeyboardKeyEnd = 0x61,
|
||||
KeyboardKeyPageUp = 0x62,
|
||||
KeyboardKeyPageDown = 0x63,
|
||||
KeyboardKeyLeft = 0x64,
|
||||
KeyboardKeyDown = 0x65,
|
||||
KeyboardKeyBackspace = 0x66,
|
||||
KeyboardKeyRight = 0x67,
|
||||
KeyboardKeyUp = 0x68,
|
||||
KeyboardKeyNumpad1 = 0x69,
|
||||
KeyboardKeyNumpadSlash = 0x6A,
|
||||
KeyboardKeyNumpad4 = 0x6B,
|
||||
KeyboardKeyNumpad7 = 0x6C,
|
||||
KeyboardKeyNumpadEnter = 0x6D,
|
||||
KeyboardKeyMediaMute = 0x6E,
|
||||
KeyboardKeyNumpad0 = 0x70,
|
||||
KeyboardKeyNumpadColon = 0x71,
|
||||
KeyboardKeyNumpad2 = 0x72,
|
||||
KeyboardKeyNumpad5 = 0x73,
|
||||
KeyboardKeyNumpad6 = 0x74,
|
||||
KeyboardKeyNumpad8 = 0x75,
|
||||
KeyboardKeyEscape = 0x76,
|
||||
KeyboardKeyNumLock = 0x77,
|
||||
KeyboardKeyF11 = 0x78,
|
||||
KeyboardKeyNumpadPlus = 0x79,
|
||||
KeyboardKeyNumpad3 = 0x7A,
|
||||
KeyboardKeyNumpadMinus = 0x7B,
|
||||
KeyboardKeyNumpadAsterisk = 0x7C,
|
||||
KeyboardKeyNumpad9 = 0x7D,
|
||||
KeyboardKeyScrollLock = 0x7E
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char Character;
|
||||
uint8 Scancode;
|
||||
} Key;
|
||||
|
||||
typedef struct {
|
||||
uint8 Pressed;
|
||||
char Character;
|
||||
uint8 Scancode;
|
||||
} KeyEvent;
|
||||
|
||||
/****************************************
|
||||
* Other data types *
|
||||
****************************************/
|
||||
typedef struct {
|
||||
int32 X, Y;
|
||||
} Point;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 X, Y;
|
||||
} UPoint;
|
||||
|
||||
typedef char* string;
|
||||
|
||||
#endif
|
17
Kernel/include/va_list.h
Normal file
17
Kernel/include/va_list.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef __VA_LIST__H
|
||||
#define __VA_LIST__H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* va list parameter list */
|
||||
typedef unsigned char *va_list;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
1
Kernel/include/version.h
Normal file
1
Kernel/include/version.h
Normal file
@ -0,0 +1 @@
|
||||
#define OS_BUILD "0.1.0.450"
|
1
Kernel/include/version.h~
Normal file
1
Kernel/include/version.h~
Normal file
@ -0,0 +1 @@
|
||||
-e #define OS_BUILD "0.1.0.418"
|
Reference in New Issue
Block a user