mirror of
https://github.com/drasko/codezero.git
synced 2026-01-16 04:43:16 +01:00
Initial commit
This commit is contained in:
8
tasks/fs0/include/bdev.h
Normal file
8
tasks/fs0/include/bdev.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __BLOCK_DEV_H__
|
||||
#define __BLOCK_DEV_H__
|
||||
|
||||
void bdev_open(void);
|
||||
void bdev_readpage(unsigned long offset, void *buf);
|
||||
void bdev_writepage(unsigned long offset, void *buf);
|
||||
|
||||
#endif /* __BLOCK_DEV_H__ */
|
||||
90
tasks/fs0/include/fs.h
Normal file
90
tasks/fs0/include/fs.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* VFS definitions.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban.
|
||||
*/
|
||||
#ifndef __FS_H__
|
||||
#define __FS_H__
|
||||
#include <l4/lib/list.h>
|
||||
|
||||
typedef void (*dentry_op_t)(void);
|
||||
typedef void (*superblock_op_t)(void);
|
||||
typedef void (*vnode_op_t)(void);
|
||||
typedef void (*file_op_t)(void);
|
||||
|
||||
struct dentry_ops {
|
||||
dentry_op_t compare;
|
||||
};
|
||||
|
||||
struct file_ops {
|
||||
file_op_t open;
|
||||
file_op_t read;
|
||||
file_op_t write;
|
||||
file_op_t close;
|
||||
file_op_t mmap;
|
||||
file_op_t seek;
|
||||
file_op_t flush;
|
||||
file_op_t fsync;
|
||||
};
|
||||
|
||||
struct vnode_ops {
|
||||
vnode_op_t create;
|
||||
vnode_op_t lookup;
|
||||
vnode_op_t link;
|
||||
vnode_op_t unlink;
|
||||
vnode_op_t mkdir;
|
||||
vnode_op_t rmdir;
|
||||
vnode_op_t rename;
|
||||
vnode_op_t getattr;
|
||||
vnode_op_t setattr;
|
||||
};
|
||||
|
||||
struct superblock_ops {
|
||||
superblock_op_t read_sb;
|
||||
superblock_op_t write_sb;
|
||||
superblock_op_t read_vnode;
|
||||
superblock_op_t write_vnode;
|
||||
};
|
||||
|
||||
struct dentry;
|
||||
struct file;
|
||||
struct filesystem;
|
||||
struct superblock;
|
||||
struct vnode;
|
||||
|
||||
struct dentry {
|
||||
int refcnt;
|
||||
char name[512];
|
||||
struct dentry *parent; /* Parent dentry */
|
||||
struct list_head siblings; /* List of dentries with same parent */
|
||||
struct vnode *vnode; /* The vnode associated with dirent */
|
||||
struct dentry_ops ops;
|
||||
};
|
||||
|
||||
struct file {
|
||||
int refcnt;
|
||||
struct dentry *dentry;
|
||||
struct file_ops ops;
|
||||
};
|
||||
|
||||
struct vnode {
|
||||
unsigned long id; /* Filesystem-wide unique vnode id */
|
||||
int refcnt; /* Reference counter */
|
||||
struct vnode_ops ops; /* Operations on this vnode */
|
||||
struct list_head dirents; /* Dirents that refer to this vnode */
|
||||
struct list_head state_list; /* List for vnode's dirty/clean state */
|
||||
unsigned long size; /* Total size of vnode in bytes */
|
||||
};
|
||||
|
||||
struct filesystem {
|
||||
unsigned long magic;
|
||||
char name[256];
|
||||
};
|
||||
|
||||
struct superblock {
|
||||
struct filesystem fs;
|
||||
struct superblock_ops ops;
|
||||
struct dentry *root_dirent;
|
||||
};
|
||||
|
||||
#endif /* __FS_H__ */
|
||||
26
tasks/fs0/include/kdata.h
Normal file
26
tasks/fs0/include/kdata.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
#ifndef __MM_KDATA_H__
|
||||
#define __MM_KDATA_H__
|
||||
|
||||
#include <l4/macros.h>
|
||||
#include <l4/config.h>
|
||||
#include <l4/types.h>
|
||||
#include <l4/generic/physmem.h>
|
||||
#include INC_PLAT(offsets.h)
|
||||
#include INC_GLUE(memory.h)
|
||||
#include INC_GLUE(memlayout.h)
|
||||
#include INC_ARCH(bootdesc.h)
|
||||
#include <vm_area.h>
|
||||
|
||||
struct initdata {
|
||||
struct bootdesc *bootdesc;
|
||||
struct block_device *bdev;
|
||||
};
|
||||
|
||||
extern struct initdata initdata;
|
||||
|
||||
int request_initdata(struct initdata *i);
|
||||
|
||||
#endif /* __MM_KDATA_H__ */
|
||||
36
tasks/fs0/include/linker.lds
Normal file
36
tasks/fs0/include/linker.lds
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Simple linker script for userspace or svc tasks.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
|
||||
/*
|
||||
* The only catch with this linker script is that everything
|
||||
* is linked starting at virtual_base, and loaded starting
|
||||
* at physical_base. virtual_base is the predefined region
|
||||
* of virtual memory for userland applications. physical_base
|
||||
* is determined at build-time, it is one of the subsequent pages
|
||||
* that come after the kernel image's load area.
|
||||
*/
|
||||
/* USER_AREA_START, see memlayout.h */
|
||||
virtual_base = 0x10000000;
|
||||
__stack = 0x20000000;
|
||||
INCLUDE "include/physical_base.lds"
|
||||
|
||||
/* physical_base = 0x228000; */
|
||||
offset = virtual_base - physical_base;
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = virtual_base;
|
||||
_start_text = .;
|
||||
.text : AT (ADDR(.text) - offset) { crt0.o(.text) *(.text) }
|
||||
/* rodata is needed else your strings will link at physical! */
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
.data : AT (ADDR(.data) - offset) { *(.data) }
|
||||
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
7
tasks/fs0/include/task.h
Normal file
7
tasks/fs0/include/task.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef __FS0_TASK_H__
|
||||
#define __FS0_TASK_H__
|
||||
|
||||
#define __TASKNAME__ "FS0"
|
||||
|
||||
#endif /* __FS0_TASK_H__ */
|
||||
|
||||
Reference in New Issue
Block a user