From: John Hodge Date: Sun, 16 May 2010 11:24:21 +0000 (+0800) Subject: Added architectue documentation X-Git-Tag: rel0.06~186 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=791563ede5ec10e1d4f4581330160350452083bc;p=tpg%2Facess2.git Added architectue documentation - also added a fixed typo --- diff --git a/Kernel/Doxyfile.api b/Kernel/Doxyfile.api index 5b02591a..18c15372 100644 --- a/Kernel/Doxyfile.api +++ b/Kernel/Doxyfile.api @@ -570,8 +570,9 @@ INPUT = include/apidoc_mainpage.h \ include/binary.h \ include/modules.h \ include/vfs.h include/vfs_ext.h \ - include/fs_devfs.h include/fs_sysfs.h \ + include/fs_devfs.h include/fs_sysfs.h \ include/iocache.h \ + arch/archdoc.h \ include/apidoc/arch_x86.h \ include/tpl_drv_common.h \ include/tpl_drv_video.h \ diff --git a/Kernel/arch/archdoc.h b/Kernel/arch/archdoc.h new file mode 100644 index 00000000..ef3331f7 --- /dev/null +++ b/Kernel/arch/archdoc.h @@ -0,0 +1,124 @@ +/** + * \file archdoc.h + * \brief Documentation Definitions for the Acess 2 Architecture Interface + * \author John Hodge (thePowersGang) + * + * Acess 2 allows different architecture builds to be made off almost + * the same source tree. The difference between the trees is the inclusion + * of a different directory from the "Kernel/arch/" directory that + * contains the architecture specific intialisation and management code. + * Each achitecture tree must provide all the definitions from this + * document in some form or another (usually in the most efficient way + * avaliable) + * The values and types used in this documentation are a guide only and + * will most probably be incorrect for most architectures. + */ +#ifndef _ARCHDOC_H_ +#define _ARCHDOC_H_ + +/** + * \brief Maximum number of CPUs supported by this architecture driver + * (in the current build) + */ +#define MAX_CPUS 1 +/** + * \brief Number of bits in a machine word (Uint) + */ +#define BITS 32 +/** + * \brief Number of valid bits in a \a tPAddr + */ +#define PHYS_BITS 32 + +/** + * \name Syncronisation Primitives + * \{ + */ +/** + * \brief Spinlock type + */ +typedef volatile int tSpinlock; +/** + * \brief Acquire a spinlock + */ +#define LOCK(lockptr) do{while(*(tSpinlock*)lockptr)Threads_Yield();*(tSpinlock*)lockptr=1;}while(0) +/** + * \brief Release a held spinlock + */ +#define RELEASE(lockptr) do{*(tSpinlock*)lockptr=0;}while(0) +/** + * \} + */ +//#define HALT() __asm__ __volatile__ ("hlt") + + +/** + * \name Atomic Types + * \{ + */ +typedef unsigned int Uint; //!< Unsigned machine native integer +typedef unsigned char Uint8; //!< Unsigned 8-bit integer +typedef unsigned short Uint16; //!< Unsigned 16-bit integer +typedef unsigned long Uint32; //!< Unsigned 32-bit integer +typedef unsigned long long Uint64; //!< Unsigned 64-bit integer +typedef signed int Sint; //!< Signed Machine Native integer +typedef signed char Sint8; //!< Signed 8-bit integer +typedef signed short Sint16; //!< Signed 16-bit integer +typedef signed long Sint32; //!< Signed 32-bit integer +typedef signed long long Sint64; //!< Signed 16-bit integer +/** + * \} + */ + +typedef Uint size_t; //!< Counter/Byte count type +typedef Uint32 tVAddr; //!< Virtual address type +typedef Uint32 tPAddr; //!< Physical Address type + +/** + * \brief Register state passed to the syscall handler + * + * The \a tSyscallRegs structure allows the system call handler to read + * the user state to get the arguments for the call. It also allows the + * handler to alter specific parts of the user state to reflect the + * result of the call. + * \note The fields shown here are need only be present in the actual + * structure, in any order. The implementation may also add more + * fields for padding purposes. + */ +typedef struct { + Uint Arg4; //!< Fourth argument + Uint Arg3; //!< Third argument + Uint Arg2; //!< Second argument + union { + Uint Arg1; //!< First arugment + Uint RetHi; //!< High part of the return + }; + union { + Uint Num; //!< Call Number + Uint Return; //!< Low return value + }; + + Uint StackPointer; //!< User stack pointer +} tSyscallRegs; + +/** + * \brief Opaque structure definining the MMU state for a task + */ +typedef struct sMemoryState tMemoryState; + +/** + * \brief Opque structure defining the CPU state for a task + */ +typedef struct sTaskState tTaskState; + + +/** + * \name Memory Management + * \{ + */ +/** + * \} + */ + + +#endif diff --git a/Kernel/arch/x86_64/mm_virt.c b/Kernel/arch/x86_64/mm_virt.c index b7814219..985fa844 100644 --- a/Kernel/arch/x86_64/mm_virt.c +++ b/Kernel/arch/x86_64/mm_virt.c @@ -280,5 +280,5 @@ tPAddr MM_Clone(void) // #2 Alter the fractal pointer // #3 Set Copy-On-Write to all user pages // #4 Return - + return 0; }