[GOOD] BUILD 0.1.0.551 DATE 9/03/2011 AT 9:25 AM

====================================================
Mainly changed: HAL.FSs
+ Updated 'mount' call in floppy driver, now done after controller is
initialized
+ Added 'detect' function for FAT file systems
+ Implemented 'initdr' driver, however still bugged
+ Improved logger
This commit is contained in:
2021-09-14 18:51:43 +03:00
parent 0372dcee81
commit caa7718af9
59 changed files with 991 additions and 112 deletions

View File

@ -2,7 +2,6 @@
#define __DEBUGIO__H
#include <types.h>
#include <settings.h>
#include <stdarg.h>
enum Colors
@ -62,27 +61,14 @@ extern void ConsoleReadString (string s, int32 buffer_size, char end_char);
// Console main loop
extern void ConsoleMain();
// External test routines
extern void SystemPanic();
extern int32 LogWrite (uint8 error, string device, string format, ...);
// 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
#define Log(dev, ...) { LogWrite(0, dev, __VA_ARGS__); }
#define Error(dev, ...) { LogWrite(1, dev, __VA_ARGS__); }
#define Panic(dev, ...) { LogWrite(1, dev, __VA_ARGS__); SystemPanic(); }
#endif

View File

@ -11,6 +11,9 @@
#include <types.h>
#include <time.h>
#define MAX_FILENAME_LEN 256
#define MAX_MOUNTPOINTNAME_LEN 64
// Device routines, will read/write 'BlockSize' bytes per call
typedef uint32 (*DevReadRoutine)(uint32 offset, void* buffer);
typedef uint32 (*DevWriteRoutine)(uint32 offset, void* buffer);
@ -37,11 +40,12 @@ enum FileFlags
};
typedef struct _FILE
typedef struct
{
uint32 DeviceId; // The VFS identifies the mounted device that uses this
uint32 Id; // The FS idenitifies files using this field
char Name[128];
//char Name[MAX_FILENAME_LEN];
char* Name;
/*** Looks like this:
* bits description
@ -52,7 +56,8 @@ typedef struct _FILE
* 12 hidden
* 13-31 (unassigned yet)
*
* Note: In windows FS, the readonly and system attributes are set using permissions and userid */
* Note: In windows FS, the readonly and system
* attributes are set using permissions and owner id */
uint32 Flags;
uint32 OwnerId, GroupId;
uint32 Size;
@ -61,7 +66,7 @@ typedef struct _FILE
typedef struct _DirectoryEntry
{
char Name[128];
char Name[MAX_FILENAME_LEN];
uint32 Flags, OwnerId, GroupId, Size;
TimeSystem TimeCreated, TimeModified, TimeAccessed;
@ -71,7 +76,7 @@ typedef struct _DirectoryEntry
typedef struct {
uint32 Id;
uint32 FsId;
char Name[128];
char Name[MAX_MOUNTPOINTNAME_LEN];
uint32 BlockSize;
DevReadRoutine Read;
@ -88,18 +93,23 @@ typedef FILE* (*FsCloseRoutine)(const MountPoint*, FILE*);
typedef DirectoryEntry* (*FsReadDirRoutine)(const MountPoint*,FILE*,uint32);
typedef uint32 (*FsDetectRoutine) (DevReadRoutine, uint32 blocksz);
typedef void (*FsMountRoutine) (const MountPoint*);
typedef void (*FsUnmountRoutine) (const MountPoint*);
// File system structure
typedef struct {
uint32 Id;
char Name[16];
FsDetectRoutine Detect;
FsDetectRoutine Detect; // Returns 0 if detection failed, something positive otherwise
FsMountRoutine MountDevice; // Tells FS a device has to be mounted. This way, the FS can cache data for faster access
FsUnmountRoutine UnmountDevice; // Tells FS a device has been unmounted. This way, the FS can free cached data.
FsOpenRoutine Open;
FsCloseRoutine Close;
FsReadRoutine Read;
FsWriteRoutine Write;
FsTestRoutine Test; // See if file exists without having to open it
FsTestRoutine Test; // See if file exists without having to open it
FsReadDirRoutine ReadDirectory;
} FileSystem;

View File

@ -89,9 +89,4 @@ 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_ */

View File

@ -17,9 +17,9 @@
#include <version.h>
// Logger
#define VERBOSE_MODE 1
#define VERBOSE_ERROR 1
#define VERBOSE_PANIC 1
#define LOGGER_ALLOW 1
#define LOGGER_ALLOW_ERROR 1
#define LOGGER_ALLOW_PANIC 1
// Clock

View File

@ -23,6 +23,7 @@
***************************************************/
extern uint32 strlen (string s);
extern int32 strcmp (string a, string b);
extern int32 strcasecmp (string a, string b);
extern string strcpy (string s1, const string s2);
extern char* strchr (string s, int c);
extern char* strrchr (string s, int c);

View File

@ -1 +1 @@
#define OS_BUILD "0.1.0.470"
#define OS_BUILD "0.1.0.551"