diff --git a/Doxyfile b/Doxyfile index 4bd06db..ab275c6 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1,283 +1,283 @@ -# Doxyfile 1.4.1-KDevelop - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "UbixOS V2" -PROJECT_NUMBER = 2.0 -OUTPUT_DIRECTORY = /usr/home/reddawg/source/ubix2/doc -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = YES -INLINE_INHERITED_MEMB = YES -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = /usr/home/reddawg/source/ubix2/ -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = YES -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = YES -SORT_BY_SCOPE_NAME = YES -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = /usr/home/reddawg/source/ubix2/src/sys/ -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.C \ - *.CC \ - *.C++ \ - *.II \ - *.I++ \ - *.H \ - *.HH \ - *.H++ \ - *.CS \ - *.PHP \ - *.PHP3 \ - *.M \ - *.MM \ - *.C \ - *.H \ - *.tlh \ - *.diff \ - *.patch \ - *.moc \ - *.xpm \ - *.dox \ - *.s \ - *.S -RECURSIVE = YES -EXCLUDE = /usr/home/reddawg/source/ubix2/src/sys/sde \ - /usr/home/reddawg/source/ubix2/src/lib/objgfx40 \ - /usr/home/reddawg/source/ubix2/src/sys/ubixfsv2 \ - /usr/home/reddawg/source/ubix2/src/sys/include/objgfx \ - /usr/home/reddawg/source/ubix2/src/sys/compile \ - /usr/home/reddawg/source/ubix2/src/sys/net \ - /usr/home/reddawg/source/ubix2/src/sys/include/net -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = Makefile.inc -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = YES -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = YES -BINARY_TOC = YES -TOC_EXPAND = YES -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = YES -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = ubix2.tag -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = YES +# Doxyfile 1.4.1-KDevelop + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "UbixOS V2" +PROJECT_NUMBER = 2.0 +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /usr/home/reddawg/source/ubix2/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = YES +SORT_BY_SCOPE_NAME = YES +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = sys +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.C \ + *.CC \ + *.C++ \ + *.II \ + *.I++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS \ + *.PHP \ + *.PHP3 \ + *.M \ + *.MM \ + *.C \ + *.H \ + *.tlh \ + *.diff \ + *.patch \ + *.moc \ + *.xpm \ + *.dox \ + *.s \ + *.S +RECURSIVE = YES +EXCLUDE = /usr/home/reddawg/source/ubix2/src/sys/sde \ + /usr/home/reddawg/source/ubix2/src/lib/objgfx40 \ + /usr/home/reddawg/source/ubix2/src/sys/ubixfsv2 \ + /usr/home/reddawg/source/ubix2/src/sys/include/objgfx \ + /usr/home/reddawg/source/ubix2/src/sys/compile \ + /usr/home/reddawg/source/ubix2/src/sys/net \ + /usr/home/reddawg/source/ubix2/src/sys/include/net +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = Makefile.inc +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = YES +BINARY_TOC = YES +TOC_EXPAND = YES +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = YES +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = ubix2.tag +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = YES +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = YES diff --git a/doc/xml/8259_8c.xml b/doc/xml/8259_8c.xml index ba7a25f..5f28023 100644 --- a/doc/xml/8259_8c.xml +++ b/doc/xml/8259_8c.xml @@ -1,147 +1,231 @@ - - - + + + 8259.c isa/8259.h sys/io.h lib/kprintf.h - - - - - + + + - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - int - int i8259_init - () - i8259_init - -initialize the 8259 PIC - -This will initialize both PICs for all of our IRQs - - - - icw1 - icw4 - kprintf - mImr - mPic - mVec - outportByte - sImr - sPic - sVec - - - void - void irqDisable - (u_int16_t irqNo) - irqDisable - - u_int16_t - irqNo - - -disable specified IRQ - - - -irqNo - - -IRQ to disable - - - - - - - irqMask - mPic - outportByte - sPic - - - void - void irqEnable - (u_int16_t irqNo) - irqEnable - - u_int16_t - irqNo - - -enable specified IRQ - - - -irqNo - - -IRQ to enable - - - - - - - irqMask - mPic - outportByte - sPic - - - + unsigned int unsigned int irqMask irqMask - 0xFFFF + = 0xFFFF - - irqDisable - irqEnable + + + + + + int + int i8259_init + () + i8259_init + +initialize the 8259 PIC + + +This will initialize both PICs for all of our IRQs + + + + + icw1 + icw4 + kprintf + mImr + mPic + mVec + outportByte + sImr + sPic + sVec + + + void + void irqDisable + (uint16_t irqNo) + irqDisable + + uint16_t + irqNo + + + + + + + + + inportByte + mImr + outportByte + sImr + + + void + void irqDisable_old + (u_int16_t irqNo) + irqDisable_old + + u_int16_t + irqNo + + +disable specified IRQ + + + + +irqNo + + +IRQ to disable + + + + + + + + + + + void + void irqEnable + (uint16_t irqNo) + irqEnable + + uint16_t + irqNo + + + + + + + + + inportByte + mImr + outportByte + sImr + + + void + void irqEnable_old + (u_int16_t irqNo) + irqEnable_old + + u_int16_t + irqNo + + +enable specified IRQ + + + + +irqNo + + +IRQ to enable + + + + + + + + @@ -149,83 +233,112 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: 8259_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<isa/8259.h> -#include<sys/io.h> -#include<lib/kprintf.h> - -staticunsignedintirqMask=0xFFFF; - -inti8259_init(){ -outportByte(mPic,icw1);/*InitializeMasterPIC*/ -outportByte(sPic,icw1);/*InitializeSeconaryPIC*/ -outportByte(mPic+1,mVec);/*MasterInterrupVector*/ -outportByte(sPic+1,sVec);/*SecondaryInterruptVector*/ -outportByte(mPic+1,1<<2);/*BitmaskforcascadeonIRQ2*/ -outportByte(sPic+1,2);/*CascadeonIRQ2*/ -outportByte(mPic+1,icw4);/*FinishPrimaryInitialization*/ -outportByte(sPic+1,icw4);/*FinishSeconaryInitialization*/ -outportByte(mImr,0xff);/*MaskAllPrimaryInterrupts*/ -outportByte(sImr,0xff);/*MaskAllSeconaryInterrupts*/ - -/*Printoutthesysteminfoforthis*/ -kprintf("pic0-Port:[0x%X]\n",mPic); -kprintf("pic1-Port:[0x%X]\n",sPic); - -/*Returnsothesystemknowsitwentwell*/ -return(0x0); -} - -voidirqEnable(u_int16_tirqNo){ -irqMask&=~(1<<irqNo); -if(irqNo>=8){ -irqMask&=~(1<<2); -} -outportByte(mPic+1,irqMask&0xFF); -outportByte(sPic+1,(irqMask>>8)&0xFF); -} - -voidirqDisable(u_int16_tirqNo){ -irqMask|=(1<<irqNo); -if((irqMask&0xFF00)==0xFF00){ -irqMask|=(1<<2); -} -outportByte(mPic+1,irqMask&0xFF); -outportByte(sPic+1,(irqMask>>8)&0xFF); -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<isa/8259.h> +#include<sys/io.h> +#include<lib/kprintf.h> + +staticunsignedintirqMask=0xFFFF; + +inti8259_init(){ +outportByte(mPic,icw1);/*InitializeMasterPIC*/ +outportByte(sPic,icw1);/*InitializeSeconaryPIC*/ +outportByte(mPic+1,mVec);/*MasterInterrupVector*/ +outportByte(sPic+1,sVec);/*SecondaryInterruptVector*/ +outportByte(mPic+1,1<<2);/*BitmaskforcascadeonIRQ2*/ +outportByte(sPic+1,2);/*CascadeonIRQ2*/ +outportByte(mPic+1,icw4);/*FinishPrimaryInitialization*/ +outportByte(sPic+1,icw4);/*FinishSeconaryInitialization*/ +outportByte(mImr,0xff);/*MaskAllPrimaryInterrupts*/ +outportByte(sImr,0xff);/*MaskAllSeconaryInterrupts*/ + +/*Printoutthesysteminfoforthis*/ +kprintf("pic0-Port:[0x%X]\n",mPic); +kprintf("pic1-Port:[0x%X]\n",sPic); + +/*Returnsothesystemknowsitwentwell*/ +return(0x0); +} + +voidirqEnable_old(u_int16_tirqNo){ +irqMask&=~(1<<irqNo); +if(irqNo>=8){ +irqMask&=~(1<<2); +} +outportByte(mPic+1,irqMask&0xFF); +outportByte(sPic+1,(irqMask>>8)&0xFF); +} + +voidirqEnable(uint16_tirqNo){ +uint16_tport; +uint8_tvalue; + +if(irqNo<8){ +port=mImr; +} +else{ +port=sImr; +irqNo-=8; +} +value=inportByte(port)&~(1<<irqNo); +outportByte(port,value); +} -/*** -END -***/ +voidirqDisable_old(u_int16_tirqNo){ +irqMask|=(1<<irqNo); +if((irqMask&0xFF00)==0xFF00){ +irqMask|=(1<<2); +} +outportByte(mPic+1,irqMask&0xFF); +outportByte(sPic+1,(irqMask>>8)&0xFF); +} + +voidirqDisable(uint16_tirqNo){ +uint16_tport; +uint8_tvalue; + +if(irqNo<8){ +port=mImr; +} +else{ +port=sImr; +irqNo-=8; +} +value=inportByte(port)|(1<<irqNo); +outportByte(port,value); +} + +/*** +END +***/ - + diff --git a/doc/xml/8259_8h.xml b/doc/xml/8259_8h.xml index a9122a0..3ce8a25 100644 --- a/doc/xml/8259_8h.xml +++ b/doc/xml/8259_8h.xml @@ -1,117 +1,169 @@ - - - + + + 8259.h - ubixos/types.h - src/sys/include/ubixos/init.h - src/sys/isa/8259.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/mouse.c - src/sys/isa/ne2k.c - src/sys/kernel/endtask.c - src/sys/kernel/kpanic.c - src/sys/kernel/sched.c - src/sys/pci/lnc.c - src/sys/sys/idt.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/kpanic.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/kpanic.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/8259.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/mouse.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/endtask.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/sys/idt.c - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - + + - - - - - - + + - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + - + eoi 0x20 @@ -120,12 +172,9 @@ - - mouseHandler - mouseInit - ne2kHandler + - + icw1 0x11 @@ -134,10 +183,9 @@ - - i8259_init + - + icw4 0x01 @@ -146,10 +194,9 @@ - - i8259_init + - + mImr 0x21 @@ -158,10 +205,9 @@ - - i8259_init + - + mPic 0x20 @@ -170,15 +216,9 @@ - - i8259_init - irqDisable - irqEnable - mouseHandler - mouseInit - ne2kHandler + - + mVec 0x68 @@ -187,15 +227,9 @@ - - atkbd_init - fdc_init - i8259_init - initLNC - mouseInit - ne2k_init + - + ocw3Irr 0x0A @@ -204,9 +238,9 @@ - + - + ocw3Isr 0x0B @@ -215,9 +249,9 @@ - + - + sImr 0xA1 @@ -226,10 +260,9 @@ - - i8259_init + - + sPic 0xA0 @@ -238,15 +271,9 @@ - - i8259_init - irqDisable - irqEnable - mouseHandler - mouseInit - ne2kHandler + - + sVec 0x70 @@ -255,41 +282,42 @@ - - i8259_init + - + int int i8259_init () i8259_init -initialize the 8259 PIC +initialize the 8259 PIC + -This will initialize both PICs for all of our IRQs +This will initialize both PICs for all of our IRQs + - - icw1 - icw4 - kprintf - mImr - mPic - mVec - outportByte - sImr - sPic - sVec + + icw1 + icw4 + kprintf + mImr + mPic + mVec + outportByte + sImr + sPic + sVec - + void void irqDisable (uInt16 irqNo) irqDisable - uInt16 + uInt16 irqNo @@ -298,18 +326,16 @@ - - _int13 - kpanic - ne2kHandler + + kpanic - + void void irqEnable (uInt16 irqNo) irqEnable - uInt16 + uInt16 irqNo @@ -318,14 +344,9 @@ - - _int13 - atkbd_init - fdc_init - kmain - mouseInit - ne2k_init - ne2kHandler + + fdc_init + initLNC @@ -333,85 +354,81 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: 8259_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_8259_H -#define_8259_H - -#include<ubixos/types.h> - -#definemPic0x20//I/OformasterPIC -#definemImr0x21//I/OformasterIMR -#definesPic0xA0//I/OforslavePIC -#definesImr0xA1//I/OforslaceIMR -#defineeoi0x20//EOIcommand -#defineicw10x11//Cascade,Edgetriggered -#defineicw40x01//8088mode -#definemVec0x68//Vectorformaster -#definesVec0x70//Vectorforslave -#defineocw3Irr0x0A//ReadIRR -#defineocw3Isr0x0B//ReadISR - -inti8259_init(); -voidirqEnable(uInt16irqNo); -voidirqDisable(uInt16irqNo); - -#endif - -/*** -$Log: 8259_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:39reddawg -nomessage - -Revision1.42004/07/0913:20:08reddawg -Ohyeahduhyoucannotnamefunctionswithnumbers - -Revision1.32004/07/0913:14:29reddawg -8259:changedinit8259to8259_init -AdjustedStartupRoutines - -Revision1.22004/05/2114:57:16reddawg -Cleanedup - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_ISA_8259_H +#define_ISA_8259_H + +#include<sys/types.h> + +#definemPic0x20//I/OformasterPIC +#definemImr0x21//I/OformasterIMR +#definesPic0xA0//I/OforslavePIC +#definesImr0xA1//I/OforslaceIMR +#defineeoi0x20//EOIcommand +#defineicw10x11//Cascade,Edgetriggered +#defineicw40x01//8088mode +#definemVec0x68//Vectorformaster +#definesVec0x70//Vectorforslave +#defineocw3Irr0x0A//ReadIRR +#defineocw3Isr0x0B//ReadISR + +inti8259_init(); +voidirqEnable(uInt16irqNo); +voidirqDisable(uInt16irqNo); + +#endif + +/*** +$Log:8259.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:39reddawg +nomessage + +Revision1.42004/07/0913:20:08reddawg +Ohyeahduhyoucannotnamefunctionswithnumbers + +Revision1.32004/07/0913:14:29reddawg +8259:changedinit8259to8259_init +AdjustedStartupRoutines + +Revision1.22004/05/2114:57:16reddawg +Cleanedup + +END +***/ - + diff --git a/doc/xml/__types_8h.xml b/doc/xml/__types_8h.xml index e16923f..197f82a 100644 --- a/doc/xml/__types_8h.xml +++ b/doc/xml/__types_8h.xml @@ -1,1576 +1,3724 @@ - - - + + + _types.h - src/sys/include/ubixos/times.h - src/sys/include/ubixos/types.h + C:/Dev/git/UbixOS/sys/include/sys/_sigset.h + C:/Dev/git/UbixOS/sys/include/sys/_timespec.h + C:/Dev/git/UbixOS/sys/include/sys/_timeval.h + C:/Dev/git/UbixOS/sys/include/sys/resource.h + C:/Dev/git/UbixOS/sys/include/sys/select.h + C:/Dev/git/UbixOS/sys/include/sys/stdatomic.h + C:/Dev/git/UbixOS/sys/include/sys/types.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + - - - - + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - __int64_t + + int + typedef int ___wchar_t + + ___wchar_t + + + + + + + + + + __int64_t typedef __int64_t __blkcnt_t __blkcnt_t @@ -1580,10 +3728,10 @@ - + - - __uint32_t + + __uint32_t typedef __uint32_t __blksize_t __blksize_t @@ -1593,9 +3741,35 @@ - + - + + __uint_least16_t + typedef __uint_least16_t __char16_t + + __char16_t + + + + + + + + + + __uint_least32_t + typedef __uint_least32_t __char32_t + + __char32_t + + + + + + + + + unsigned long typedef unsigned long __clock_t @@ -1606,10 +3780,10 @@ - + - - __uint32_t + + __uint32_t typedef __uint32_t __dev_t __dev_t @@ -1619,10 +3793,10 @@ - + - - __uint32_t + + __uint32_t typedef __uint32_t __fflags_t __fflags_t @@ -1632,10 +3806,10 @@ - + - - __uint32_t + + __uint32_t typedef __uint32_t __gid_t __gid_t @@ -1645,10 +3819,10 @@ - + - - __uint32_t + + __uint32_t typedef __uint32_t __ino_t __ino_t @@ -1658,9 +3832,9 @@ - + - + short typedef short __int16_t @@ -1671,9 +3845,9 @@ - + - + int typedef int __int32_t @@ -1684,9 +3858,9 @@ - + - + long long typedef long long __int64_t @@ -1697,11 +3871,11 @@ - + - - __signed char - typedef __signed char __int8_t + + char + typedef char __int8_t __int8_t @@ -1710,10 +3884,140 @@ - + - - __uint16_t + + __int16_t + typedef __int16_t __int_fast16_t + + __int_fast16_t + + + + + + + + + + __int32_t + typedef __int32_t __int_fast32_t + + __int_fast32_t + + + + + + + + + + __int64_t + typedef __int64_t __int_fast64_t + + __int_fast64_t + + + + + + + + + + __int8_t + typedef __int8_t __int_fast8_t + + __int_fast8_t + + + + + + + + + + __int16_t + typedef __int16_t __int_least16_t + + __int_least16_t + + + + + + + + + + __int32_t + typedef __int32_t __int_least32_t + + __int_least32_t + + + + + + + + + + __int64_t + typedef __int64_t __int_least64_t + + __int_least64_t + + + + + + + + + + __int8_t + typedef __int8_t __int_least8_t + + __int_least8_t + + + + + + + + + + __int64_t + typedef __int64_t __intmax_t + + __intmax_t + + + + + + + + + + __int32_t + typedef __int32_t __intptr_t + + __intptr_t + + + + + + + + + + __uint16_t typedef __uint16_t __mode_t __mode_t @@ -1723,10 +4027,10 @@ - + - - __uint16_t + + __uint16_t typedef __uint16_t __nlink_t __nlink_t @@ -1736,10 +4040,62 @@ - + - - __int32_t + + __int32_t + typedef __int32_t __pid_t + + __pid_t + + + + + + + + + + __int32_t + typedef __int32_t __ptrdiff_t + + __ptrdiff_t + + + + + + + + + + __int64_t + typedef __int64_t __rlim_t + + __rlim_t + + + + + + + + + + __uint32_t + typedef __uint32_t __size_t + + __size_t + + + + + + + + + + __int32_t typedef __int32_t __ssize_t __ssize_t @@ -1749,10 +4105,23 @@ - + - - __int32_t + + long + typedef long __suseconds_t + + __suseconds_t + + + + + + + + + + __int32_t typedef __int32_t __time_t __time_t @@ -1762,10 +4131,10 @@ - + - - __uint32_t + + __uint32_t typedef __uint32_t __uid_t __uid_t @@ -1775,9 +4144,9 @@ - + - + unsigned short typedef unsigned short __uint16_t @@ -1788,9 +4157,9 @@ - + - + unsigned int typedef unsigned int __uint32_t @@ -1801,9 +4170,9 @@ - + - + unsigned long long typedef unsigned long long __uint64_t @@ -1814,9 +4183,9 @@ - + - + unsigned char typedef unsigned char __uint8_t @@ -1827,7 +4196,150 @@ - + + + + __uint16_t + typedef __uint16_t __uint_fast16_t + + __uint_fast16_t + + + + + + + + + + __uint32_t + typedef __uint32_t __uint_fast32_t + + __uint_fast32_t + + + + + + + + + + __uint64_t + typedef __uint64_t __uint_fast64_t + + __uint_fast64_t + + + + + + + + + + __uint8_t + typedef __uint8_t __uint_fast8_t + + __uint_fast8_t + + + + + + + + + + __uint16_t + typedef __uint16_t __uint_least16_t + + __uint_least16_t + + + + + + + + + + __uint32_t + typedef __uint32_t __uint_least32_t + + __uint_least32_t + + + + + + + + + + __uint64_t + typedef __uint64_t __uint_least64_t + + __uint_least64_t + + + + + + + + + + __uint8_t + typedef __uint8_t __uint_least8_t + + __uint_least8_t + + + + + + + + + + __uint32_t + typedef __uint32_t __uintfptr_t + + __uintfptr_t + + + + + + + + + + __uint64_t + typedef __uint64_t __uintmax_t + + __uintmax_t + + + + + + + + + + __uint32_t + typedef __uint32_t __uintptr_t + + __uintptr_t + + + + + + + @@ -1835,73 +4347,70 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: __types_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef__TYPES_H -#define__TYPES_H - -//#include<ubixos/types.h> - -typedef__signedchar__int8_t; -typedefunsignedchar__uint8_t; -typedefshort__int16_t; -typedefunsignedshort__uint16_t; -typedefint__int32_t; -typedefunsignedint__uint32_t; -typedeflonglong__int64_t; -typedefunsignedlonglong__uint64_t; - - -typedefunsignedlong__clock_t; -//typedeflong__time_t; -typedef__uint32_t__ino_t; -typedef__int32_t__ssize_t; - -/*stattypes*/ -typedef__uint32_t__dev_t;/*devicenumber*/ -typedef__uint16_t__mode_t; -typedef__uint16_t__nlink_t;/*linkcount*/ -typedef__uint32_t__uid_t; -typedef__uint32_t__gid_t; -typedef__int32_t__time_t; -typedef__int64_t__blkcnt_t;/*fileblockcount*/ -typedef__uint32_t__blksize_t;/*fileblocksize*/ -typedef__uint32_t__fflags_t;/*fileflags*/ - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS__TYPES_H_ +#define_SYS__TYPES_H_ + + +typedefchar__int8_t; +typedefunsignedchar__uint8_t; +typedefshort__int16_t; +typedefunsignedshort__uint16_t; +typedefint__int32_t; +typedefunsignedint__uint32_t; +typedeflonglong__int64_t; +typedefunsignedlonglong__uint64_t; + +typedef__int64_t__rlim_t;/*resourcelimit-intentionally*/ +/*signed,becauseoflegacycode*/ +/*thatuses-1forRLIM_INFINITY*/ + +typedefunsignedlong__clock_t; +typedef__uint32_t__ino_t;typedef__int32_t__ssize_t;/*stattypes*/ +typedef__uint32_t__dev_t;/*devicenumber*/ +typedef__uint16_t__mode_t;typedef__uint16_t__nlink_t;/*linkcount*/ +typedef__uint32_t__uid_t;typedef__uint32_t__gid_t;typedef__int32_t__time_t;typedef__int64_t__blkcnt_t;/*fileblockcount*/ +typedef__uint32_t__blksize_t;/*fileblocksize*/ +typedef__uint32_t__fflags_t;/*fileflags*/ +typedef__int8_t__int_fast8_t;typedef__uint8_t__uint_fast8_t;typedef__int16_t__int_fast16_t;typedef__uint16_t__uint_fast16_t;typedef__int32_t__int_fast32_t;typedef__uint32_t__uint_fast32_t;typedef__int64_t__int_fast64_t;typedef__uint64_t__uint_fast64_t;typedef__int32_t__intptr_t;typedef__uint32_t__uintptr_t;typedef__uint32_t__uintfptr_t;typedef__uint32_t__size_t;typedef__int64_t__intmax_t;typedef__uint64_t__uintmax_t;typedef__int32_t__ptrdiff_t;typedef__uint8_t__uint_least8_t;typedef__uint16_t__uint_least16_t;typedef__uint32_t__uint_least32_t;typedef__uint64_t__uint_least64_t;typedef__int8_t__int_least8_t;typedef__int16_t__int_least16_t;typedef__int32_t__int_least32_t;typedef__int64_t__int_least64_t;typedef +int___wchar_t; + +typedeflong__suseconds_t;/*microseconds(signed)*/ +typedef__int32_t__pid_t;/*process[group]*/ + +#if!defined(__clang__)||!defined(__cplusplus) +typedef__uint_least16_t__char16_t;typedef__uint_least32_t__char32_t; +#endif + +#endif - + diff --git a/doc/xml/api_8h.xml b/doc/xml/api_8h.xml index 76f568d..1c66563 100644 --- a/doc/xml/api_8h.xml +++ b/doc/xml/api_8h.xml @@ -1,1483 +1,503 @@ - - - + + + api.h net/opt.h - net/pbuf.h - net/sys.h - net/ipv4/ip.h - net/udp.h - net/tcp.h - net/err.h - src/sys/include/net/api_msg.h - src/sys/net/api/api_lib.c - src/sys/net/api/sockets.c - src/sys/net/net/bot.c - src/sys/net/net/shell.c - src/sys/net/net/udpecho.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/net/udpecho.c - - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - - - - + + + + - - - - - + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - - - - - - - + + + + - + - + + + + + - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - netbuf - netconn - - - NETCONN_COPY - 0x01 - - - - - - - - lwip_send - lwip_write - - - NETCONN_NOCOPY - 0x00 - - - - - - - - sendstr - - - - - netconn_state - - NETCONN_NONE - - - - - - - NETCONN_WRITE - - - - - - - NETCONN_ACCEPT - - - - - - - NETCONN_RECV - - - - - - - NETCONN_CONNECT - - - - - - - NETCONN_CLOSE - - - - - - - - - - - - - - - netconn_type - - NETCONN_TCP - - - - - - - NETCONN_UDP - - - - - - - NETCONN_UDPLITE - - - - - - - NETCONN_UDPNOCHKSUM - - - - - - - - - - - - - - - - - void * - void* netbuf_alloc - (struct netbuf *buf, uInt16 size) - netbuf_alloc - - struct netbuf * - buf - - - uInt16 - size - - - - - - - - - NULL - netbuf::p - pbuf::payload - pbuf_alloc - pbuf_free - PBUF_RAM - PBUF_TRANSPORT - netbuf::ptr - - - void - void netbuf_chain - (struct netbuf *head, struct netbuf *tail) - netbuf_chain - - struct netbuf * - head - - - struct netbuf * - tail - - - - - - - - - memp_freep - MEMP_NETBUF - netbuf::p - pbuf_chain - netbuf::ptr - - - void - void netbuf_copy - (struct netbuf *buf, void *dataptr, uInt16 len) - netbuf_copy - - struct netbuf * - buf - - - void * - dataptr - - - uInt16 - len - - - - - - - - - netbuf_copy_partial - bot_thread - shell_main - udpecho_thread - - - void - void netbuf_copy_partial - (struct netbuf *buf, void *dataptr, uInt16 len, uInt16 offset) - netbuf_copy_partial - - struct netbuf * - buf - - - void * - dataptr - - - uInt16 - len - - - uInt16 - offset - - - - - - - - - pbuf::len - pbuf::next - NULL - netbuf::p - pbuf::payload - lwip_recvfrom - netbuf_copy - - - err_t - err_t netbuf_data - (struct netbuf *buf, void **dataptr, uInt16 *len) - netbuf_data - - struct netbuf * - buf - - - void ** - dataptr - - - uInt16 * - len - - - - - - - - - ERR_BUF - ERR_OK - pbuf::len - NULL - pbuf::payload - netbuf::ptr - - - void - void netbuf_delete - (struct netbuf *buf) - netbuf_delete - - struct netbuf * - buf - - - - - - - - - memp_freep - MEMP_NETBUF - NULL - netbuf::p - pbuf_free - netbuf::ptr - bot_thread - lwip_close - lwip_recvfrom - lwip_send - netconn_delete - shell_main - udpecho_thread - - - void - void netbuf_first - (struct netbuf *buf) - netbuf_first - - struct netbuf * - buf - - - - - - - - - netbuf::p - netbuf::ptr - - - void - void netbuf_free - (struct netbuf *buf) - netbuf_free - - struct netbuf * - buf - - - - - - - - - NULL - netbuf::p - pbuf_free - netbuf::ptr - - - ip_addr * - struct ip_addr* netbuf_fromaddr - (struct netbuf *buf) - netbuf_fromaddr - - struct netbuf * - buf - - - - - - - - - netbuf::fromaddr - lwip_recvfrom - udpecho_thread - - - uInt16 - uInt16 netbuf_fromport - (struct netbuf *buf) - netbuf_fromport - - struct netbuf * - buf - - - - - - - - - netbuf::fromport - lwip_recvfrom - udpecho_thread - - - uInt16 - uInt16 netbuf_len - (struct netbuf *buf) - netbuf_len - - struct netbuf * - buf - - - - - - - - - netbuf::p - pbuf::tot_len - bot_thread - lwip_recvfrom - shell_main - - - netbuf * - struct netbuf* netbuf_new - (void) - netbuf_new - - void - - - - - - - - - memp_mallocp - MEMP_NETBUF - NULL - netbuf::p - netbuf::ptr - lwip_send - - - Int8 - Int8 netbuf_next - (struct netbuf *buf) - netbuf_next - - struct netbuf * - buf - - - - - - - - - pbuf::next - NULL - netbuf::ptr - - - void - void netbuf_ref - (struct netbuf *buf, void *dataptr, uInt16 size) - netbuf_ref - - struct netbuf * - buf - - - void * - dataptr - - - uInt16 - size - - - - - - - - - pbuf::len - NULL - netbuf::p - pbuf::payload - pbuf_alloc - pbuf_free - PBUF_ROM - PBUF_TRANSPORT - netbuf::ptr - pbuf::tot_len - lwip_send - - - netconn * - struct netconn* netconn_accept - (struct netconn *conn) - netconn_accept - - struct netconn * - conn - - - - - - - - - netconn::acceptmbox - NULL - sys_mbox_fetch - lwip_accept - shell_thread - - - err_t - err_t netconn_addr - (struct netconn *conn, struct ip_addr **addr, uInt16 *port) - netconn_addr - - struct netconn * - conn - - - struct ip_addr ** - addr - - - uInt16 * - port - - - - - - - - - netconn::err - ERR_OK - tcp_pcb::local_ip - udp_pcb::local_port - tcp_pcb::local_port - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - netconn::pcb - netconn::tcp - netconn::type - netconn::udp - - - err_t - err_t netconn_bind - (struct netconn *conn, struct ip_addr *addr, uInt16 port) - netconn_bind - - struct netconn * - conn - - - struct ip_addr * - addr - - - uInt16 - port - - - - - - - - - API_MSG_BIND - api_msg_post - api_msg_msg::bc - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg::msg - api_msg_msg::msg - NETCONN_TCP - NULL - netconn::recvmbox - sys_mbox_fetch - sys_mbox_new - SYS_MBOX_NULL - netconn::type - lwip_bind - shell_thread - udpecho_thread - - - err_t - err_t netconn_close - (struct netconn *conn) - netconn_close - - struct netconn * - conn - - - - - - - - - API_MSG_CLOSE - api_msg_post - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg::msg - api_msg_msg::msg - NETCONN_CLOSE - NETCONN_NONE - NULL - netconn::sem - netconn::state - sys_mbox_fetch - SYS_SEM_NULL - sys_sem_wait - shell_main - - - err_t - err_t netconn_connect - (struct netconn *conn, struct ip_addr *addr, uInt16 port) - netconn_connect - - struct netconn * - conn - - - struct ip_addr * - addr - - - uInt16 - port - - - - - - - - - API_MSG_CONNECT - api_msg_post - api_msg_msg::bc - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - kprintf - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg::msg - api_msg_msg::msg - NULL - netconn::recvmbox - sys_mbox_fetch - sys_mbox_new - SYS_MBOX_NULL - bot_thread - lwip_connect - lwip_sendto - udpecho_thread - - - err_t - err_t netconn_delete - (struct netconn *conn) - netconn_delete - - struct netconn * - conn - - - - - - - - - netconn::acceptmbox - API_MSG_DELCONN - api_msg_post - api_msg_msg::conn - ERR_MEM - ERR_OK - netconn::mbox - MEMP_API_MSG - memp_free - memp_freep - memp_mallocp - MEMP_NETCONN - api_msg::msg - api_msg_msg::msg - netbuf_delete - netconn_delete - NETCONN_TCP - NULL - pbuf_free - netconn::recvmbox - netconn::sem - sys_arch_mbox_fetch - sys_mbox_fetch - sys_mbox_free - SYS_MBOX_NULL - sys_sem_free - SYS_SEM_NULL - netconn::type - lwip_accept - lwip_close - lwip_socket - netconn_delete - - - err_t - err_t netconn_err - (struct netconn *conn) - netconn_err - - struct netconn * - conn - - - - - - - - - netconn::err - - - err_t - err_t netconn_listen - (struct netconn *conn) - netconn_listen - - struct netconn * - conn - - - - - - - - - netconn::acceptmbox - API_MSG_LISTEN - api_msg_post - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg::msg - api_msg_msg::msg - NULL - sys_mbox_fetch - sys_mbox_new - SYS_MBOX_NULL - lwip_listen - shell_thread - - - netconn * - struct netconn* netconn_new - (enum netconn_type type) - netconn_new - - enum netconn_type - type - - - - - - - - - netconn::acceptmbox - netconn::mbox - memp_freep - memp_mallocp - MEMP_NETCONN - NETCONN_NONE - NULL - netconn::pcb - netconn::recvmbox - netconn::sem - netconn::state - sys_mbox_new - SYS_MBOX_NULL - SYS_SEM_NULL - netconn::tcp - netconn::type - bot_thread - lwip_socket - shell_thread - udpecho_thread - - - err_t - err_t netconn_peer - (struct netconn *conn, struct ip_addr **addr, uInt16 *port) - netconn_peer - - struct netconn * - conn - - - struct ip_addr ** - addr - - - uInt16 * - port - - - - - - - - - netconn::err - ERR_OK - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - netconn::pcb - udp_pcb::remote_ip - tcp_pcb::remote_ip - udp_pcb::remote_port - tcp_pcb::remote_port - netconn::tcp - netconn::type - netconn::udp - lwip_accept - lwip_sendto - - - netbuf * - struct netbuf* netconn_recv - (struct netconn *conn) - netconn_recv - - struct netconn * - conn - - - - - - - - - API_LIB_DEBUG - api_msg_post - API_MSG_RECV - api_msg_msg::conn - DEBUGF - netconn::err - ERR_CONN - ERR_MEM - ERR_OK - netbuf::fromaddr - netbuf::fromport - api_msg_msg::len - LISTEN - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - MEMP_NETBUF - api_msg::msg - api_msg_msg::msg - NETCONN_TCP - NULL - netbuf::p - netconn::pcb - netbuf::ptr - netconn::recvmbox - tcp_pcb::state - sys_mbox_fetch - sys_mbox_free - SYS_MBOX_NULL - netconn::tcp - pbuf::tot_len - netconn::type - api_msg::type - bot_thread - lwip_recvfrom - shell_main - udpecho_thread - - - err_t - err_t netconn_send - (struct netconn *conn, struct netbuf *buf) - netconn_send - - struct netconn * - conn - - - struct netbuf * - buf - - - - - - - - - API_LIB_DEBUG - api_msg_post - API_MSG_SEND - api_msg_msg::conn - DEBUGF - netconn::err - ERR_MEM - ERR_OK - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg::msg - api_msg_msg::msg - NULL - netbuf::p - api_msg_msg::p - sys_mbox_fetch - pbuf::tot_len - lwip_send - udpecho_thread - - - enum netconn_type - enum netconn_type netconn_type - (struct netconn *conn) - netconn_type - - struct netconn * - conn - - - - - - - - - netconn::type - lwip_recvfrom - lwip_send - lwip_write - - - err_t - err_t netconn_write - (struct netconn *conn, void *dataptr, uInt16 size, uInt8 copy) - netconn_write - - struct netconn * - conn - - - void * - dataptr - - - uInt16 - size - - - uInt8 - copy - - - - - - - - - API_LIB_DEBUG - api_msg_post - API_MSG_WRITE - api_msg_msg::conn - DEBUGF - netconn::err - ERR_MEM - ERR_OK - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg::msg - api_msg_msg::msg - NETCONN_NONE - NETCONN_TCP - NETCONN_WRITE - NULL - netconn::pcb - netconn::sem - netconn::state - sys_mbox_fetch - sys_sem_free - sys_sem_new - SYS_SEM_NULL - sys_sem_wait - netconn::tcp - tcp_sndbuf - netconn::type - api_msg_msg::w - lwip_send - lwip_write - sendstr - - +netconn API (to be used from non-TCPIP threads) -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: api_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_API_H__ -#define__LWIP_API_H__ - -#include"net/opt.h" -#include"net/pbuf.h" -#include"net/sys.h" + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_API_H +#defineLWIP_HDR_API_H + +#include"net/opt.h" -#include"net/ipv4/ip.h" - -#include"net/udp.h" -#include"net/tcp.h" - -#include"net/err.h" - -#defineNETCONN_NOCOPY0x00 -#defineNETCONN_COPY0x01 - -enumnetconn_type{ -NETCONN_TCP, -NETCONN_UDP, -NETCONN_UDPLITE, -NETCONN_UDPNOCHKSUM -}; - -enumnetconn_state{ -NETCONN_NONE, -NETCONN_WRITE, -NETCONN_ACCEPT, -NETCONN_RECV, -NETCONN_CONNECT, -NETCONN_CLOSE -}; - -structnetbuf{ -structpbuf*p,*ptr; -structip_addr*fromaddr; -uInt16fromport; -err_terr; -}; - -structnetconn{ -enumnetconn_typetype; -enumnetconn_statestate; -union{ -structtcp_pcb*tcp; -structudp_pcb*udp; -}pcb; -err_terr; -sys_mbox_tmbox; -sys_mbox_trecvmbox; -sys_mbox_tacceptmbox; -sys_sem_tsem; -}; - -/*Networkbufferfunctions:*/ -structnetbuf*netbuf_new(void); -voidnetbuf_delete(structnetbuf*buf); -void*netbuf_alloc(structnetbuf*buf,uInt16size); -voidnetbuf_free(structnetbuf*buf); -voidnetbuf_ref(structnetbuf*buf, -void*dataptr,uInt16size); -voidnetbuf_chain(structnetbuf*head, -structnetbuf*tail); - -uInt16netbuf_len(structnetbuf*buf); -err_tnetbuf_data(structnetbuf*buf, -void**dataptr,uInt16*len); -Int8netbuf_next(structnetbuf*buf); -voidnetbuf_first(structnetbuf*buf); - -voidnetbuf_copy(structnetbuf*buf, -void*dataptr,uInt16len); -structip_addr*netbuf_fromaddr(structnetbuf*buf); -uInt16netbuf_fromport(structnetbuf*buf); - -/*Networkconnectionfunctions:*/ -structnetconn*netconn_new(enumnetconn_typetype); -err_tnetconn_delete(structnetconn*conn); -enumnetconn_typenetconn_type(structnetconn*conn); -err_tnetconn_peer(structnetconn*conn, -structip_addr**addr, -uInt16*port); -err_tnetconn_addr(structnetconn*conn, -structip_addr**addr, -uInt16*port); -err_tnetconn_bind(structnetconn*conn, -structip_addr*addr, -uInt16port); -err_tnetconn_connect(structnetconn*conn, -structip_addr*addr, -uInt16port); -err_tnetconn_listen(structnetconn*conn); -structnetconn*netconn_accept(structnetconn*conn); -structnetbuf*netconn_recv(structnetconn*conn); -err_tnetconn_send(structnetconn*conn, -structnetbuf*buf); -err_tnetconn_write(structnetconn*conn, -void*dataptr,uInt16size, -uInt8copy); -err_tnetconn_close(structnetconn*conn); - -err_tnetconn_err(structnetconn*conn); - -voidnetbuf_copy_partial(structnetbuf*buf,void*dataptr,uInt16len,uInt16offset); - -#endif/*__LWIP_API_H__*/ +#ifLWIP_NETCONN||LWIP_SOCKET/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ +/*Note:NetconnAPIisalwaysavailablewhensocketsareenabled- +*socketsareimplementedontopofthem*/ + +#include"net/arch.h" +#include"net/netbuf.h" +#include"net/sys.h" +#include"net/ip_addr.h" +#include"net/err.h" + +#ifdef__cplusplus +extern"C"{ +#endif + +/*Throughoutthisfile,IPaddressesandportnumbersareexpectedtobein +*thesamebyteorderasinthecorrespondingpcb. +*/ + +/*Flagsfornetconn_write(u8_t)*/ +#defineNETCONN_NOFLAG0x00 +#defineNETCONN_NOCOPY0x00/*Onlyforsourcecodecompatibility*/ +#defineNETCONN_COPY0x01 +#defineNETCONN_MORE0x02 +#defineNETCONN_DONTBLOCK0x04 + +/*Flagsforstructnetconn.flags(u8_t)*/ +#defineNETCONN_FLAG_NON_BLOCKING0x02 + +#defineNETCONN_FLAG_IN_NONBLOCKING_CONNECT0x04 + +#defineNETCONN_FLAG_CHECK_WRITESPACE0x10 +#ifLWIP_IPV6 + +#defineNETCONN_FLAG_IPV6_V6ONLY0x20 +#endif/*LWIP_IPV6*/ + + +/*Helperstoprocessseveralnetconn_typesbythesamecode*/ +#defineNETCONNTYPE_GROUP(t)((t)&0xF0) +#defineNETCONNTYPE_DATAGRAM(t)((t)&0xE0) +#ifLWIP_IPV6 +#defineNETCONN_TYPE_IPV60x08 +#defineNETCONNTYPE_ISIPV6(t)(((t)&NETCONN_TYPE_IPV6)!=0) +#defineNETCONNTYPE_ISUDPLITE(t)(((t)&0xF3)==NETCONN_UDPLITE) +#defineNETCONNTYPE_ISUDPNOCHKSUM(t)(((t)&0xF3)==NETCONN_UDPNOCHKSUM) +#else/*LWIP_IPV6*/ +#defineNETCONNTYPE_ISIPV6(t)(0) +#defineNETCONNTYPE_ISUDPLITE(t)((t)==NETCONN_UDPLITE) +#defineNETCONNTYPE_ISUDPNOCHKSUM(t)((t)==NETCONN_UDPNOCHKSUM) +#endif/*LWIP_IPV6*/ + +enumnetconn_type{ +NETCONN_INVALID=0, +NETCONN_TCP=0x10, +#ifLWIP_IPV6 + +NETCONN_TCP_IPV6=NETCONN_TCP|NETCONN_TYPE_IPV6/*0x18*/, +#endif/*LWIP_IPV6*/ + +NETCONN_UDP=0x20, +NETCONN_UDPLITE=0x21, +NETCONN_UDPNOCHKSUM=0x22, + +#ifLWIP_IPV6 + +NETCONN_UDP_IPV6=NETCONN_UDP|NETCONN_TYPE_IPV6/*0x28*/, +NETCONN_UDPLITE_IPV6=NETCONN_UDPLITE|NETCONN_TYPE_IPV6/*0x29*/, +NETCONN_UDPNOCHKSUM_IPV6=NETCONN_UDPNOCHKSUM|NETCONN_TYPE_IPV6/*0x2a*/, +#endif/*LWIP_IPV6*/ + +NETCONN_RAW=0x40 +#ifLWIP_IPV6 + +,NETCONN_RAW_IPV6=NETCONN_RAW|NETCONN_TYPE_IPV6/*0x48*/ +#endif/*LWIP_IPV6*/ +}; + +enumnetconn_state{ +NETCONN_NONE, +NETCONN_WRITE, +NETCONN_LISTEN, +NETCONN_CONNECT, +NETCONN_CLOSE +}; - +enumnetconn_evt{ +NETCONN_EVT_RCVPLUS, +NETCONN_EVT_RCVMINUS, +NETCONN_EVT_SENDPLUS, +NETCONN_EVT_SENDMINUS, +NETCONN_EVT_ERROR +}; + +#ifLWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD) + +enumnetconn_igmp{ +NETCONN_JOIN, +NETCONN_LEAVE +}; +#endif/*LWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD)*/ + +#ifLWIP_DNS +/*Usedfornetconn_gethostbyname_addrtype(),theseshouldmatchtheDNS_ADDRTYPEdefinesindns.h*/ +#defineNETCONN_DNS_DEFAULTNETCONN_DNS_IPV4_IPV6 +#defineNETCONN_DNS_IPV40 +#defineNETCONN_DNS_IPV61 +#defineNETCONN_DNS_IPV4_IPV62/*trytoresolveIPv4first,tryIPv6ifIPv4failsonly*/ +#defineNETCONN_DNS_IPV6_IPV43/*trytoresolveIPv6first,tryIPv4ifIPv6failsonly*/ +#endif/*LWIP_DNS*/ + +/*forward-declaresomestructstoavoidtoincludetheirheaders*/ +structip_pcb; +structtcp_pcb; +structudp_pcb; +structraw_pcb; +structnetconn; +structapi_msg; + +typedefvoid(*netconn_callback)(structnetconn*,enumnetconn_evt,u16_tlen); + +structnetconn{ +enumnetconn_typetype; +enumnetconn_statestate; +union{ +structip_pcb*ip; +structtcp_pcb*tcp; +structudp_pcb*udp; +structraw_pcb*raw; +}pcb; +err_tlast_err; +#if!LWIP_NETCONN_SEM_PER_THREAD + +sys_sem_top_completed; +#endif + +sys_mbox_trecvmbox; +#ifLWIP_TCP + +sys_mbox_tacceptmbox; +#endif/*LWIP_TCP*/ + +#ifLWIP_SOCKET +intsocket; +#endif/*LWIP_SOCKET*/ +#ifLWIP_SO_SNDTIMEO + +s32_tsend_timeout; +#endif/*LWIP_SO_RCVTIMEO*/ +#ifLWIP_SO_RCVTIMEO + +intrecv_timeout; +#endif/*LWIP_SO_RCVTIMEO*/ +#ifLWIP_SO_RCVBUF + +intrecv_bufsize; +intrecv_avail; +#endif/*LWIP_SO_RCVBUF*/ +#ifLWIP_SO_LINGER + +s16_tlinger; +#endif/*LWIP_SO_LINGER*/ + +u8_tflags; +#ifLWIP_TCP + +size_twrite_offset; +structapi_msg*current_msg; +#endif/*LWIP_TCP*/ + +netconn_callbackcallback; +}; + +#defineAPI_EVENT(c,e,l)if(c->callback){\ +(*c->callback)(c,e,l);\ +} + +#defineNETCONN_SET_SAFE_ERR(conn,err)do{if((conn)!=NULL){\ +SYS_ARCH_DECL_PROTECT(netconn_set_safe_err_lev);\ +SYS_ARCH_PROTECT(netconn_set_safe_err_lev);\ +if(!ERR_IS_FATAL((conn)->last_err)){\ +(conn)->last_err=err;\ +}\ +SYS_ARCH_UNPROTECT(netconn_set_safe_err_lev);\ +}}while(0); + +/*Networkconnectionfunctions:*/ + +#definenetconn_new(t)netconn_new_with_proto_and_callback(t,0,NULL) +#definenetconn_new_with_callback(t,c)netconn_new_with_proto_and_callback(t,0,c) +structnetconn*netconn_new_with_proto_and_callback(enumnetconn_typet,u8_tproto, +netconn_callbackcallback); +err_tnetconn_delete(structnetconn*conn); +#definenetconn_type(conn)(conn->type) + +err_tnetconn_getaddr(structnetconn*conn,ip_addr_t*addr, +u16_t*port,u8_tlocal); +#definenetconn_peer(c,i,p)netconn_getaddr(c,i,p,0) + +#definenetconn_addr(c,i,p)netconn_getaddr(c,i,p,1) + +err_tnetconn_bind(structnetconn*conn,constip_addr_t*addr,u16_tport); +err_tnetconn_connect(structnetconn*conn,constip_addr_t*addr,u16_tport); +err_tnetconn_disconnect(structnetconn*conn); +err_tnetconn_listen_with_backlog(structnetconn*conn,u8_tbacklog); +#definenetconn_listen(conn)netconn_listen_with_backlog(conn,TCP_DEFAULT_LISTEN_BACKLOG) +err_tnetconn_accept(structnetconn*conn,structnetconn**new_conn); +err_tnetconn_recv(structnetconn*conn,structnetbuf**new_buf); +err_tnetconn_recv_tcp_pbuf(structnetconn*conn,structpbuf**new_buf); +err_tnetconn_sendto(structnetconn*conn,structnetbuf*buf, +constip_addr_t*addr,u16_tport); +err_tnetconn_send(structnetconn*conn,structnetbuf*buf); +err_tnetconn_write_partly(structnetconn*conn,constvoid*dataptr,size_tsize, +u8_tapiflags,size_t*bytes_written); +#definenetconn_write(conn,dataptr,size,apiflags)\ +netconn_write_partly(conn,dataptr,size,apiflags,NULL) +err_tnetconn_close(structnetconn*conn); +err_tnetconn_shutdown(structnetconn*conn,u8_tshut_rx,u8_tshut_tx); + +#ifLWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD) +err_tnetconn_join_leave_group(structnetconn*conn,constip_addr_t*multiaddr, +constip_addr_t*netif_addr,enumnetconn_igmpjoin_or_leave); +#endif/*LWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD)*/ +#ifLWIP_DNS +#ifLWIP_IPV4&&LWIP_IPV6 +err_tnetconn_gethostbyname_addrtype(constchar*name,ip_addr_t*addr,u8_tdns_addrtype); +#definenetconn_gethostbyname(name,addr)netconn_gethostbyname_addrtype(name,addr,NETCONN_DNS_DEFAULT) +#else/*LWIP_IPV4&&LWIP_IPV6*/ +err_tnetconn_gethostbyname(constchar*name,ip_addr_t*addr); +#definenetconn_gethostbyname_addrtype(name,addr,dns_addrtype)netconn_gethostbyname(name,addr) +#endif/*LWIP_IPV4&&LWIP_IPV6*/ +#endif/*LWIP_DNS*/ + +#definenetconn_err(conn)((conn)->last_err) +#definenetconn_recv_bufsize(conn)((conn)->recv_bufsize) + +#definenetconn_set_nonblocking(conn,val)do{if(val){\ +(conn)->flags|=NETCONN_FLAG_NON_BLOCKING;\ +}else{\ +(conn)->flags&=~NETCONN_FLAG_NON_BLOCKING;}}while(0) + +#definenetconn_is_nonblocking(conn)(((conn)->flags&NETCONN_FLAG_NON_BLOCKING)!=0) + +#ifLWIP_IPV6 + +#definenetconn_set_ipv6only(conn,val)do{if(val){\ +(conn)->flags|=NETCONN_FLAG_IPV6_V6ONLY;\ +}else{\ +(conn)->flags&=~NETCONN_FLAG_IPV6_V6ONLY;}}while(0) + +#definenetconn_get_ipv6only(conn)(((conn)->flags&NETCONN_FLAG_IPV6_V6ONLY)!=0) +#endif/*LWIP_IPV6*/ + +#ifLWIP_SO_SNDTIMEO + +#definenetconn_set_sendtimeout(conn,timeout)((conn)->send_timeout=(timeout)) + +#definenetconn_get_sendtimeout(conn)((conn)->send_timeout) +#endif/*LWIP_SO_SNDTIMEO*/ +#ifLWIP_SO_RCVTIMEO + +#definenetconn_set_recvtimeout(conn,timeout)((conn)->recv_timeout=(timeout)) + +#definenetconn_get_recvtimeout(conn)((conn)->recv_timeout) +#endif/*LWIP_SO_RCVTIMEO*/ +#ifLWIP_SO_RCVBUF + +#definenetconn_set_recvbufsize(conn,recvbufsize)((conn)->recv_bufsize=(recvbufsize)) + +#definenetconn_get_recvbufsize(conn)((conn)->recv_bufsize) +#endif/*LWIP_SO_RCVBUF*/ + +#ifLWIP_NETCONN_SEM_PER_THREAD +voidnetconn_thread_init(void); +voidnetconn_thread_cleanup(void); +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +#definenetconn_thread_init() +#definenetconn_thread_cleanup() +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_NETCONN||LWIP_SOCKET*/ + +#endif/*LWIP_HDR_API_H*/ - + diff --git a/doc/xml/api__lib_8c.xml b/doc/xml/api__lib_8c.xml index c455e81..51cd098 100644 --- a/doc/xml/api__lib_8c.xml +++ b/doc/xml/api__lib_8c.xml @@ -1,1843 +1,936 @@ - - - + + + api_lib.c - ubixos/types.h - net/debug.h - net/api.h - net/api_msg.h - net/memp.h - lib/kprintf.h + net/opt.h - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - - - - - - - - - - - + - - - - + + + + - + - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - void * - void* netbuf_alloc - (struct netbuf *buf, uInt16 size) - netbuf_alloc - - struct netbuf * - buf - - - uInt16 - size - - - - - - - - - NULL - netbuf::p - pbuf::payload - pbuf_alloc - pbuf_free - PBUF_RAM - PBUF_TRANSPORT - netbuf::ptr - - - void - void netbuf_chain - (struct netbuf *head, struct netbuf *tail) - netbuf_chain - - struct netbuf * - head - - - struct netbuf * - tail - - - - - - - - - memp_freep - MEMP_NETBUF - netbuf::p - pbuf_chain - netbuf::ptr - - - void - void netbuf_copy - (struct netbuf *buf, void *dataptr, uInt16 len) - netbuf_copy - - struct netbuf * - buf - - - void * - dataptr - - - uInt16 - len - - - - - - - - - netbuf_copy_partial - bot_thread - shell_main - udpecho_thread - - - void - void netbuf_copy_partial - (struct netbuf *buf, void *dataptr, uInt16 len, uInt16 offset) - netbuf_copy_partial - - struct netbuf * - buf - - - void * - dataptr - - - uInt16 - len - - - uInt16 - offset - - - - - - - - - pbuf::len - pbuf::next - NULL - netbuf::p - pbuf::payload - lwip_recvfrom - netbuf_copy - - - err_t - err_t netbuf_data - (struct netbuf *buf, void **dataptr, uInt16 *len) - netbuf_data - - struct netbuf * - buf - - - void ** - dataptr - - - uInt16 * - len - - - - - - - - - ERR_BUF - ERR_OK - pbuf::len - NULL - pbuf::payload - netbuf::ptr - - - void - void netbuf_delete - (struct netbuf *buf) - netbuf_delete - - struct netbuf * - buf - - - - - - - - - memp_freep - MEMP_NETBUF - NULL - netbuf::p - pbuf_free - netbuf::ptr - bot_thread - lwip_close - lwip_recvfrom - lwip_send - netconn_delete - shell_main - udpecho_thread - - - void - void netbuf_first - (struct netbuf *buf) - netbuf_first - - struct netbuf * - buf - - - - - - - - - netbuf::p - netbuf::ptr - - - void - void netbuf_free - (struct netbuf *buf) - netbuf_free - - struct netbuf * - buf - - - - - - - - - NULL - netbuf::p - pbuf_free - netbuf::ptr - - - ip_addr * - struct ip_addr* netbuf_fromaddr - (struct netbuf *buf) - netbuf_fromaddr - - struct netbuf * - buf - - - - - - - - - netbuf::fromaddr - lwip_recvfrom - udpecho_thread - - - uInt16 - uInt16 netbuf_fromport - (struct netbuf *buf) - netbuf_fromport - - struct netbuf * - buf - - - - - - - - - netbuf::fromport - lwip_recvfrom - udpecho_thread - - - uInt16 - uInt16 netbuf_len - (struct netbuf *buf) - netbuf_len - - struct netbuf * - buf - - - - - - - - - netbuf::p - pbuf::tot_len - bot_thread - lwip_recvfrom - shell_main - - - netbuf * - struct netbuf* netbuf_new - (void) - netbuf_new - - void - - - - - - - - - memp_mallocp - MEMP_NETBUF - NULL - netbuf::p - netbuf::ptr - lwip_send - - - Int8 - Int8 netbuf_next - (struct netbuf *buf) - netbuf_next - - struct netbuf * - buf - - - - - - - - - pbuf::next - NULL - netbuf::ptr - - - void - void netbuf_ref - (struct netbuf *buf, void *dataptr, uInt16 size) - netbuf_ref - - struct netbuf * - buf - - - void * - dataptr - - - uInt16 - size - - - - - - - - - pbuf::len - NULL - netbuf::p - pbuf::payload - pbuf_alloc - pbuf_free - PBUF_ROM - PBUF_TRANSPORT - netbuf::ptr - pbuf::tot_len - lwip_send - - - netconn * - struct netconn* netconn_accept - (struct netconn *conn) - netconn_accept - - struct netconn * - conn - - - - - - - - - netconn::acceptmbox - NULL - sys_mbox_fetch - lwip_accept - shell_thread - - - err_t - err_t netconn_addr - (struct netconn *conn, struct ip_addr **addr, uInt16 *port) - netconn_addr - - struct netconn * - conn - - - struct ip_addr ** - addr - - - uInt16 * - port - - - - - - - - - netconn::err - ERR_OK - tcp_pcb::local_ip - tcp_pcb::local_port - udp_pcb::local_port - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - netconn::pcb - netconn::tcp - netconn::type - netconn::udp - - - err_t - err_t netconn_bind - (struct netconn *conn, struct ip_addr *addr, uInt16 port) - netconn_bind - - struct netconn * - conn - - - struct ip_addr * - addr - - - uInt16 - port - - - - - - - - - API_MSG_BIND - api_msg_post - api_msg_msg::bc - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg_msg::msg - api_msg::msg - NETCONN_TCP - NULL - netconn::recvmbox - sys_mbox_fetch - sys_mbox_new - SYS_MBOX_NULL - netconn::type - lwip_bind - shell_thread - udpecho_thread - - - err_t - err_t netconn_close - (struct netconn *conn) - netconn_close - - struct netconn * - conn - - - - - - - - - API_MSG_CLOSE - api_msg_post - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg_msg::msg - api_msg::msg - NETCONN_CLOSE - NETCONN_NONE - NULL - netconn::sem - netconn::state - sys_mbox_fetch - SYS_SEM_NULL - sys_sem_wait - shell_main - - - err_t - err_t netconn_connect - (struct netconn *conn, struct ip_addr *addr, uInt16 port) - netconn_connect - - struct netconn * - conn - - - struct ip_addr * - addr - - - uInt16 - port - - - - - - - - - API_MSG_CONNECT - api_msg_post - api_msg_msg::bc - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - kprintf - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg_msg::msg - api_msg::msg - NULL - netconn::recvmbox - sys_mbox_fetch - sys_mbox_new - SYS_MBOX_NULL - bot_thread - lwip_connect - lwip_sendto - udpecho_thread - - - err_t - err_t netconn_delete - (struct netconn *conn) - netconn_delete - - struct netconn * - conn - - - - - - - - - netconn::acceptmbox - API_MSG_DELCONN - api_msg_post - api_msg_msg::conn - ERR_MEM - ERR_OK - netconn::mbox - MEMP_API_MSG - memp_free - memp_freep - memp_mallocp - MEMP_NETCONN - api_msg_msg::msg - api_msg::msg - netbuf_delete - netconn_delete - NETCONN_TCP - NULL - pbuf_free - netconn::recvmbox - netconn::sem - sys_arch_mbox_fetch - sys_mbox_fetch - sys_mbox_free - SYS_MBOX_NULL - sys_sem_free - SYS_SEM_NULL - netconn::type - lwip_accept - lwip_close - lwip_socket - netconn_delete - - - err_t - err_t netconn_err - (struct netconn *conn) - netconn_err - - struct netconn * - conn - - - - - - - - - netconn::err - - - err_t - err_t netconn_listen - (struct netconn *conn) - netconn_listen - - struct netconn * - conn - - - - - - - - - netconn::acceptmbox - API_MSG_LISTEN - api_msg_post - api_msg_msg::conn - netconn::err - ERR_MEM - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg_msg::msg - api_msg::msg - NULL - sys_mbox_fetch - sys_mbox_new - SYS_MBOX_NULL - lwip_listen - shell_thread - - - netconn * - struct netconn* netconn_new - (enum netconn_type t) - netconn_new - - enum netconn_type - t - - - - - - - - - netconn::acceptmbox - netconn::mbox - memp_freep - memp_mallocp - MEMP_NETCONN - NETCONN_NONE - NULL - netconn::pcb - netconn::recvmbox - netconn::sem - netconn::state - sys_mbox_new - SYS_MBOX_NULL - SYS_SEM_NULL - netconn::tcp - netconn::type - bot_thread - lwip_socket - shell_thread - udpecho_thread - - - err_t - err_t netconn_peer - (struct netconn *conn, struct ip_addr **addr, uInt16 *port) - netconn_peer - - struct netconn * - conn - - - struct ip_addr ** - addr - - - uInt16 * - port - - - - - - - - - netconn::err - ERR_OK - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - netconn::pcb - tcp_pcb::remote_ip - udp_pcb::remote_ip - tcp_pcb::remote_port - udp_pcb::remote_port - netconn::tcp - netconn::type - netconn::udp - lwip_accept - lwip_sendto - - - netbuf * - struct netbuf* netconn_recv - (struct netconn *conn) - netconn_recv - - struct netconn * - conn - - - - - - - - - API_LIB_DEBUG - api_msg_post - API_MSG_RECV - api_msg_msg::conn - DEBUGF - netconn::err - ERR_CONN - ERR_MEM - ERR_OK - netbuf::fromaddr - netbuf::fromport - api_msg_msg::len - LISTEN - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - MEMP_NETBUF - api_msg_msg::msg - api_msg::msg - NETCONN_TCP - NULL - netbuf::p - netconn::pcb - netbuf::ptr - netconn::recvmbox - tcp_pcb::state - sys_mbox_fetch - sys_mbox_free - SYS_MBOX_NULL - netconn::tcp - pbuf::tot_len - api_msg::type - netconn::type - bot_thread - lwip_recvfrom - shell_main - udpecho_thread - - - err_t - err_t netconn_send - (struct netconn *conn, struct netbuf *buf) - netconn_send - - struct netconn * - conn - - - struct netbuf * - buf - - - - - - - - - API_LIB_DEBUG - api_msg_post - API_MSG_SEND - api_msg_msg::conn - DEBUGF - netconn::err - ERR_MEM - ERR_OK - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg_msg::msg - api_msg::msg - NULL - api_msg_msg::p - netbuf::p - sys_mbox_fetch - pbuf::tot_len - lwip_send - udpecho_thread - - - enum netconn_type - enum netconn_type netconn_type - (struct netconn *conn) - netconn_type - - struct netconn * - conn - - - - - - - - - netconn::type - lwip_recvfrom - lwip_send - lwip_write - - - err_t - err_t netconn_write - (struct netconn *conn, void *dataptr, uInt16 size, uInt8 copy) - netconn_write - - struct netconn * - conn - - - void * - dataptr - - - uInt16 - size - - - uInt8 - copy - - - - - - - - - API_LIB_DEBUG - api_msg_post - API_MSG_WRITE - api_msg_msg::conn - DEBUGF - netconn::err - ERR_MEM - ERR_OK - ERR_VAL - netconn::mbox - MEMP_API_MSG - memp_freep - memp_mallocp - api_msg_msg::msg - api_msg::msg - NETCONN_NONE - NETCONN_TCP - NETCONN_WRITE - NULL - netconn::pcb - netconn::sem - netconn::state - sys_mbox_fetch - sys_sem_free - sys_sem_new - SYS_SEM_NULL - sys_sem_wait - netconn::tcp - tcp_sndbuf - netconn::type - api_msg_msg::w - lwip_send - lwip_write - sendstr - - +Sequential API External module -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: api__lib_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -/*ThisisthepartoftheAPIthatislinkedwith -theapplication*/ - -#include<ubixos/types.h> - -#include"net/debug.h" -#include"net/api.h" -#include"net/api_msg.h" -#include"net/memp.h" - -#include"net/debug.h" - -#include"lib/kprintf.h" -/*-----------------------------------------------------------------------------------*/ -struct -netbuf*netbuf_new(void) -{ -structnetbuf*buf; + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +*/ -buf=memp_mallocp(MEMP_NETBUF); -if(buf!=NULL){ -buf->p=NULL; -buf->ptr=NULL; -returnbuf; -}else{ -returnNULL; -} -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_delete(structnetbuf*buf) -{ -if(buf!=NULL){ -if(buf->p!=NULL){ -pbuf_free(buf->p); -buf->p=buf->ptr=NULL; -} -memp_freep(MEMP_NETBUF,buf); -} -} -/*-----------------------------------------------------------------------------------*/ -void* -netbuf_alloc(structnetbuf*buf,uInt16size) -{ -/*Deallocateanypreviouslyallocatedmemory.*/ -if(buf->p!=NULL){ -pbuf_free(buf->p); -} -buf->p=pbuf_alloc(PBUF_TRANSPORT,size,PBUF_RAM); -if(buf->p==NULL){ -returnNULL; -} -buf->ptr=buf->p; -returnbuf->p->payload; -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_free(structnetbuf*buf) -{ -if(buf->p!=NULL){ -pbuf_free(buf->p); -} -buf->p=buf->ptr=NULL; -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_ref(structnetbuf*buf,void*dataptr,uInt16size) -{ -if(buf->p!=NULL){ -pbuf_free(buf->p); -} -buf->p=pbuf_alloc(PBUF_TRANSPORT,0,PBUF_ROM); -buf->p->payload=dataptr; -buf->p->len=buf->p->tot_len=size; -buf->ptr=buf->p; -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_chain(structnetbuf*head,structnetbuf*tail) -{ -pbuf_chain(head->p,tail->p); -head->ptr=head->p; -memp_freep(MEMP_NETBUF,tail); -} -/*-----------------------------------------------------------------------------------*/ -uInt16 -netbuf_len(structnetbuf*buf) -{ -returnbuf->p->tot_len; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netbuf_data(structnetbuf*buf,void**dataptr,uInt16*len) -{ -if(buf->ptr==NULL){ -returnERR_BUF; -} -*dataptr=buf->ptr->payload; -*len=buf->ptr->len; -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -Int8 -netbuf_next(structnetbuf*buf) -{ -if(buf->ptr->next==NULL){ -return-1; -} -buf->ptr=buf->ptr->next; -if(buf->ptr->next==NULL){ -return1; -} -return0; -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_first(structnetbuf*buf) -{ -buf->ptr=buf->p; -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_copy_partial(structnetbuf*buf,void*dataptr,uInt16len,uInt16offset) -{ -structpbuf*p; -uInt16i,left; - -left=0; - -if(buf==NULL){ -return; -} - -/*Thisimplementationisbad.Itshouldusebcopy -instead.*/ -for(p=buf->p;left<len&&p!=NULL;p=p->next){ -if(offset!=0&&offset>=p->len){ -offset-=p->len; -}else{ -for(i=offset;i<p->len;++i){ -((char*)dataptr)[left]=((char*)p->payload)[i]; -if(++left>=len){ -return; -} -} -} -} -} -/*-----------------------------------------------------------------------------------*/ -void -netbuf_copy(structnetbuf*buf,void*dataptr,uInt16len) -{ -netbuf_copy_partial(buf,dataptr,len,0); -} -/*-----------------------------------------------------------------------------------*/ -structip_addr* -netbuf_fromaddr(structnetbuf*buf) -{ -returnbuf->fromaddr; -} -/*-----------------------------------------------------------------------------------*/ -uInt16 -netbuf_fromport(structnetbuf*buf) -{ -returnbuf->fromport; -} -/*-----------------------------------------------------------------------------------*/ -struct -netconn*netconn_new(enumnetconn_typet) -{ -structnetconn*conn; - -conn=memp_mallocp(MEMP_NETCONN); -if(conn==NULL){ -returnNULL; -} -conn->type=t; -conn->pcb.tcp=NULL; - -if((conn->mbox=sys_mbox_new())==SYS_MBOX_NULL){ -memp_freep(MEMP_NETCONN,conn); -returnNULL; -} -conn->recvmbox=SYS_MBOX_NULL; -conn->acceptmbox=SYS_MBOX_NULL; -conn->sem=SYS_SEM_NULL; -conn->state=NETCONN_NONE; -returnconn; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_delete(structnetconn*conn) -{ -structapi_msg*msg; -void*mem; - -if(conn==NULL){ -returnERR_OK; -} - -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -returnERR_MEM; -} - -msg->type=API_MSG_DELCONN; -msg->msg.conn=conn; -api_msg_post(msg); -sys_mbox_fetch(conn->mbox,NULL); -memp_freep(MEMP_API_MSG,msg); - -/*Draintherecvmbox.*/ -if(conn->recvmbox!=SYS_MBOX_NULL){ -while(sys_arch_mbox_fetch(conn->recvmbox,&mem,1)!=0){ -if(conn->type==NETCONN_TCP){ -pbuf_free((structpbuf*)mem); -}else{ -netbuf_delete((structnetbuf*)mem); -} -} -sys_mbox_free(conn->recvmbox); -conn->recvmbox=SYS_MBOX_NULL; -} - - -/*Draintheacceptmbox.*/ -if(conn->acceptmbox!=SYS_MBOX_NULL){ -while(sys_arch_mbox_fetch(conn->acceptmbox,&mem,1)!=0){ -netconn_delete((structnetconn*)mem); -} - -sys_mbox_free(conn->acceptmbox); -conn->acceptmbox=SYS_MBOX_NULL; -} - -sys_mbox_free(conn->mbox); -conn->mbox=SYS_MBOX_NULL; -if(conn->sem!=SYS_SEM_NULL){ -sys_sem_free(conn->sem); -} -/*conn->sem=SYS_SEM_NULL;*/ -memp_free(MEMP_NETCONN,conn); -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -enumnetconn_type -netconn_type(structnetconn*conn) -{ -returnconn->type; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_peer(structnetconn*conn,structip_addr**addr, -uInt16*port) -{ -switch(conn->type){ -caseNETCONN_UDPLITE: -caseNETCONN_UDPNOCHKSUM: -caseNETCONN_UDP: -*addr=&(conn->pcb.udp->remote_ip); -*port=conn->pcb.udp->remote_port; -break; -caseNETCONN_TCP: -*addr=&(conn->pcb.tcp->remote_ip); -*port=conn->pcb.tcp->remote_port; -break; -} -return(conn->err=ERR_OK); -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_addr(structnetconn*conn,structip_addr**addr, -uInt16*port) -{ -switch(conn->type){ -caseNETCONN_UDPLITE: -caseNETCONN_UDPNOCHKSUM: -caseNETCONN_UDP: -*addr=&(conn->pcb.udp->local_ip); -*port=conn->pcb.udp->local_port; -break; -caseNETCONN_TCP: -*addr=&(conn->pcb.tcp->local_ip); -*port=conn->pcb.tcp->local_port; -break; -} -return(conn->err=ERR_OK); -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_bind(structnetconn*conn,structip_addr*addr, -uInt16port) +/*ThisisthepartoftheAPIthatislinkedwith +theapplication*/ + +#include<net/opt.h> + +#ifLWIP_NETCONN/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include<net/api.h> +#include<net/memp.h> + +#include<net/ip.h> +#include<net/raw.h> +#include<net/udp.h> +#include<net/priv/api_msg.h> +#include<net/priv/tcp_priv.h> +#include<net/priv/tcpip_priv.h> + +#include<string.h> + +#defineAPI_MSG_VAR_REF(name)API_VAR_REF(name) +#defineAPI_MSG_VAR_DECLARE(name)API_VAR_DECLARE(structapi_msg,name) +#defineAPI_MSG_VAR_ALLOC(name)API_VAR_ALLOC(structapi_msg,MEMP_API_MSG,name,ERR_MEM) +#defineAPI_MSG_VAR_ALLOC_RETURN_NULL(name)API_VAR_ALLOC(structapi_msg,MEMP_API_MSG,name,NULL) +#defineAPI_MSG_VAR_FREE(name)API_VAR_FREE(MEMP_API_MSG,name) + +staticerr_tnetconn_close_shutdown(structnetconn*conn,u8_thow); + +staticerr_t +netconn_apimsg(tcpip_callback_fnfn,structapi_msg*apimsg) +{ +err_terr; + +#ifdefLWIP_DEBUG +/*catchfunctionsthatdon'tseterr*/ +apimsg->err=ERR_VAL; +#endif/*LWIP_DEBUG*/ + +#ifLWIP_NETCONN_SEM_PER_THREAD +apimsg->op_completed_sem=LWIP_NETCONN_THREAD_SEM_GET(); +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +err=tcpip_send_msg_wait_sem(fn,apimsg,LWIP_API_MSG_SEM(apimsg)); +if(err==ERR_OK){ +returnapimsg->err; +} +returnerr; +} + +structnetconn* +netconn_new_with_proto_and_callback(enumnetconn_typet,u8_tproto,netconn_callbackcallback) +{ +structnetconn*conn; +API_MSG_VAR_DECLARE(msg); +API_MSG_VAR_ALLOC_RETURN_NULL(msg); + +conn=netconn_alloc(t,callback); +if(conn!=NULL){ +err_terr; + +API_MSG_VAR_REF(msg).msg.n.proto=proto; +API_MSG_VAR_REF(msg).conn=conn; +err=netconn_apimsg(lwip_netconn_do_newconn,&API_MSG_VAR_REF(msg)); +if(err!=ERR_OK){ +LWIP_ASSERT("freeingconnwithoutfreeingpcb",conn->pcb.tcp==NULL); +LWIP_ASSERT("connhasnorecvmbox",sys_mbox_valid(&conn->recvmbox)); +#ifLWIP_TCP +LWIP_ASSERT("conn->acceptmboxshouldn'texist",!sys_mbox_valid(&conn->acceptmbox)); +#endif/*LWIP_TCP*/ +#if!LWIP_NETCONN_SEM_PER_THREAD +LWIP_ASSERT("connhasnoop_completed",sys_sem_valid(&conn->op_completed)); +sys_sem_free(&conn->op_completed); +#endif/*!LWIP_NETCONN_SEM_PER_THREAD*/ +sys_mbox_free(&conn->recvmbox); +memp_free(MEMP_NETCONN,conn); +API_MSG_VAR_FREE(msg); +returnNULL; +} +} +API_MSG_VAR_FREE(msg); +returnconn; +} + +err_t +netconn_delete(structnetconn*conn) +{ +err_terr; +API_MSG_VAR_DECLARE(msg); + +/*NoASSERTherebecausepossibletogeta(conn==NULL)ifwegotanaccepterror*/ +if(conn==NULL){ +returnERR_OK; +} + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +#ifLWIP_SO_SNDTIMEO||LWIP_SO_LINGER +/*getthetimewestarted,whichislatercomparedto +sys_now()+conn->send_timeout*/ +API_MSG_VAR_REF(msg).msg.sd.time_started=sys_now(); +#else/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +#ifLWIP_TCP +API_MSG_VAR_REF(msg).msg.sd.polls_left= +((LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT+TCP_SLOW_INTERVAL-1)/TCP_SLOW_INTERVAL)+1; +#endif/*LWIP_TCP*/ +#endif/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +err=netconn_apimsg(lwip_netconn_do_delconn,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +if(err!=ERR_OK){ +returnerr; +} + +netconn_free(conn); + +returnERR_OK; +} + +err_t +netconn_getaddr(structnetconn*conn,ip_addr_t*addr,u16_t*port,u8_tlocal) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; + +LWIP_ERROR("netconn_getaddr:invalidconn",(conn!=NULL),returnERR_ARG;); +LWIP_ERROR("netconn_getaddr:invalidaddr",(addr!=NULL),returnERR_ARG;); +LWIP_ERROR("netconn_getaddr:invalidport",(port!=NULL),returnERR_ARG;); + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +API_MSG_VAR_REF(msg).msg.ad.local=local; +#ifLWIP_MPU_COMPATIBLE +err=netconn_apimsg(lwip_netconn_do_getaddr,&API_MSG_VAR_REF(msg)); +*addr=msg->msg.ad.ipaddr; +*port=msg->msg.ad.port; +#else/*LWIP_MPU_COMPATIBLE*/ +msg.msg.ad.ipaddr=addr; +msg.msg.ad.port=port; +err=netconn_apimsg(lwip_netconn_do_getaddr,&msg); +#endif/*LWIP_MPU_COMPATIBLE*/ +API_MSG_VAR_FREE(msg); + +returnerr; +} + +err_t +netconn_bind(structnetconn*conn,constip_addr_t*addr,u16_tport) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; + +LWIP_ERROR("netconn_bind:invalidconn",(conn!=NULL),returnERR_ARG;); + +#ifLWIP_IPV4 +/*Don'tpropagateNULLpointer(IP_ADDR_ANYalias)tosubsequentfunctions*/ +if(addr==NULL){ +addr=IP4_ADDR_ANY; +} +#endif/*LWIP_IPV4*/ + +#ifLWIP_IPV4&&LWIP_IPV6 +/*"SocketAPIlike"dual-stacksupport:IfIPtobindtoisIP6_ADDR_ANY, +*andNETCONN_FLAG_IPV6_V6ONLYis0,useIP_ANY_TYPEtobind +*/ +if((netconn_get_ipv6only(conn)==0)&& +ip_addr_cmp(addr,IP6_ADDR_ANY)){ +addr=IP_ANY_TYPE; +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +API_MSG_VAR_REF(msg).msg.bc.ipaddr=API_MSG_VAR_REF(addr); +API_MSG_VAR_REF(msg).msg.bc.port=port; +err=netconn_apimsg(lwip_netconn_do_bind,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +} + +err_t +netconn_connect(structnetconn*conn,constip_addr_t*addr,u16_tport) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; + +LWIP_ERROR("netconn_connect:invalidconn",(conn!=NULL),returnERR_ARG;); + +#ifLWIP_IPV4 +/*Don'tpropagateNULLpointer(IP_ADDR_ANYalias)tosubsequentfunctions*/ +if(addr==NULL){ +addr=IP4_ADDR_ANY; +} +#endif/*LWIP_IPV4*/ + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +API_MSG_VAR_REF(msg).msg.bc.ipaddr=API_MSG_VAR_REF(addr); +API_MSG_VAR_REF(msg).msg.bc.port=port; +err=netconn_apimsg(lwip_netconn_do_connect,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +} + +err_t +netconn_disconnect(structnetconn*conn) { -structapi_msg*msg; - -if(conn==NULL){ -returnERR_VAL; -} - -if(conn->type!=NETCONN_TCP&& -conn->recvmbox==SYS_MBOX_NULL){ -if((conn->recvmbox=sys_mbox_new())==SYS_MBOX_NULL){ -returnERR_MEM; -} -} - -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -return(conn->err=ERR_MEM); -} -msg->type=API_MSG_BIND; -msg->msg.conn=conn; -msg->msg.msg.bc.ipaddr=addr; -msg->msg.msg.bc.port=port; -api_msg_post(msg); -sys_mbox_fetch(conn->mbox,NULL); -memp_freep(MEMP_API_MSG,msg); -returnconn->err; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_connect(structnetconn*conn,structip_addr*addr, -uInt16port) -{ -structapi_msg*msg; - -if(conn==NULL){ -returnERR_VAL; -} - - -if(conn->recvmbox==SYS_MBOX_NULL){ -if((conn->recvmbox=sys_mbox_new())==SYS_MBOX_NULL){ -returnERR_MEM; -} -} - -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -returnERR_MEM; -} -msg->type=API_MSG_CONNECT; -msg->msg.conn=conn; -msg->msg.msg.bc.ipaddr=addr; -msg->msg.msg.bc.port=port; -kprintf("1"); -api_msg_post(msg); -kprintf("2:[0x%X]",conn->mbox); -sys_mbox_fetch(conn->mbox,NULL); -kprintf("3"); -memp_freep(MEMP_API_MSG,msg); -kprintf("4"); -returnconn->err; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_listen(structnetconn*conn) -{ -structapi_msg*msg; - -if(conn==NULL){ -returnERR_VAL; -} +API_MSG_VAR_DECLARE(msg); +err_terr; + +LWIP_ERROR("netconn_disconnect:invalidconn",(conn!=NULL),returnERR_ARG;); + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +err=netconn_apimsg(lwip_netconn_do_disconnect,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +} + +err_t +netconn_listen_with_backlog(structnetconn*conn,u8_tbacklog) +{ +#ifLWIP_TCP +API_MSG_VAR_DECLARE(msg); +err_terr; + +/*Thisdoesnoharm.IfTCP_LISTEN_BACKLOGisoff,backlogisunused.*/ +LWIP_UNUSED_ARG(backlog); + +LWIP_ERROR("netconn_listen:invalidconn",(conn!=NULL),returnERR_ARG;); + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +#ifTCP_LISTEN_BACKLOG +API_MSG_VAR_REF(msg).msg.lb.backlog=backlog; +#endif/*TCP_LISTEN_BACKLOG*/ +err=netconn_apimsg(lwip_netconn_do_listen,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +#else/*LWIP_TCP*/ +LWIP_UNUSED_ARG(conn); +LWIP_UNUSED_ARG(backlog); +returnERR_ARG; +#endif/*LWIP_TCP*/ +} + +err_t +netconn_accept(structnetconn*conn,structnetconn**new_conn) +{ +#ifLWIP_TCP +void*accept_ptr; +structnetconn*newconn; +#ifTCP_LISTEN_BACKLOG +API_MSG_VAR_DECLARE(msg); +#endif/*TCP_LISTEN_BACKLOG*/ -if(conn->acceptmbox==SYS_MBOX_NULL){ -conn->acceptmbox=sys_mbox_new(); -if(conn->acceptmbox==SYS_MBOX_NULL){ -returnERR_MEM; -} -} - -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -return(conn->err=ERR_MEM); -} -msg->type=API_MSG_LISTEN; -msg->msg.conn=conn; -api_msg_post(msg); -sys_mbox_fetch(conn->mbox,NULL); -memp_freep(MEMP_API_MSG,msg); -returnconn->err; -} -/*-----------------------------------------------------------------------------------*/ -structnetconn* -netconn_accept(structnetconn*conn) -{ -structnetconn*newconn; - -if(conn==NULL){ -returnNULL; -} - -sys_mbox_fetch(conn->acceptmbox,(void**)&newconn); - -returnnewconn; -} -/*-----------------------------------------------------------------------------------*/ -structnetbuf* -netconn_recv(structnetconn*conn) -{ -structapi_msg*msg; -structnetbuf*buf; -structpbuf*p; - -if(conn==NULL){ -returnNULL; -} - -if(conn->recvmbox==SYS_MBOX_NULL){ -conn->err=ERR_CONN; -returnNULL; -} - -if(conn->err!=ERR_OK){ -returnNULL; -} - -if(conn->type==NETCONN_TCP){ -if(conn->pcb.tcp->state==LISTEN){ -conn->err=ERR_CONN; -returnNULL; -} +LWIP_ERROR("netconn_accept:invalidpointer",(new_conn!=NULL),returnERR_ARG;); +*new_conn=NULL; +LWIP_ERROR("netconn_accept:invalidconn",(conn!=NULL),returnERR_ARG;); + +if(ERR_IS_FATAL(conn->last_err)){ +/*don'trecvonfatalerrors:thismightblocktheapplicationtask +waitingonacceptmboxforever!*/ +returnconn->last_err; +} +if(!sys_mbox_valid(&conn->acceptmbox)){ +returnERR_CLSD; +} + +#ifTCP_LISTEN_BACKLOG +API_MSG_VAR_ALLOC(msg); +#endif/*TCP_LISTEN_BACKLOG*/ + +#ifLWIP_SO_RCVTIMEO +if(sys_arch_mbox_fetch(&conn->acceptmbox,&accept_ptr,conn->recv_timeout)==SYS_ARCH_TIMEOUT){ +#ifTCP_LISTEN_BACKLOG +API_MSG_VAR_FREE(msg); +#endif/*TCP_LISTEN_BACKLOG*/ +returnERR_TIMEOUT; +} +#else +sys_arch_mbox_fetch(&conn->acceptmbox,&accept_ptr,0); +#endif/*LWIP_SO_RCVTIMEO*/ +newconn=(structnetconn*)accept_ptr; +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVMINUS,0); + +if(accept_ptr==&netconn_aborted){ +/*aconnectionhasbeenaborted:outofpcbsoroutofnetconnsduringaccept*/ +/*@todo:setnetconnerror,butthiswouldbefatalandthusblockfurtheraccepts*/ +#ifTCP_LISTEN_BACKLOG +API_MSG_VAR_FREE(msg); +#endif/*TCP_LISTEN_BACKLOG*/ +returnERR_ABRT; +} +if(newconn==NULL){ +/*connectionhasbeenaborted*/ +/*inthisspecialcase,wesetthenetconnerrorfromapplicationthread,as +onaready-to-acceptlisteningnetconn,thereshouldnotbeanythingrunning +intcpip_thread*/ +NETCONN_SET_SAFE_ERR(conn,ERR_CLSD); +#ifTCP_LISTEN_BACKLOG +API_MSG_VAR_FREE(msg); +#endif/*TCP_LISTEN_BACKLOG*/ +returnERR_CLSD; +} +#ifTCP_LISTEN_BACKLOG +/*Letthestackknowthatwehaveacceptedtheconnection.*/ +API_MSG_VAR_REF(msg).conn=newconn; +/*don'tcareforthereturnvalueoflwip_netconn_do_recv*/ +netconn_apimsg(lwip_netconn_do_accepted,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); +#endif/*TCP_LISTEN_BACKLOG*/ - -buf=memp_mallocp(MEMP_NETBUF); - -if(buf==NULL){ -conn->err=ERR_MEM; -returnNULL; -} - -sys_mbox_fetch(conn->recvmbox,(void**)&p); - -/*Ifweareclosed,weindicatethatwenolongerwishtorecieve -databysettingconn->recvmboxtoSYS_MBOX_NULL.*/ -if(p==NULL){ -memp_freep(MEMP_NETBUF,buf); -sys_mbox_free(conn->recvmbox); -conn->recvmbox=SYS_MBOX_NULL; -returnNULL; -} - -buf->p=p; -buf->ptr=p; -buf->fromport=0; -buf->fromaddr=NULL; - -/*Letthestackknowthatwehavetakenthedata.*/ -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -conn->err=ERR_MEM; -returnbuf; -} -msg->type=API_MSG_RECV; -msg->msg.conn=conn; -if(buf!=NULL){ -msg->msg.msg.len=buf->p->tot_len; -}else{ -msg->msg.msg.len=1; -} -api_msg_post(msg); - -sys_mbox_fetch(conn->mbox,NULL); -memp_freep(MEMP_API_MSG,msg); -}else{ -sys_mbox_fetch(conn->recvmbox,(void**)&buf); -} - - - - -DEBUGF(API_LIB_DEBUG,("netconn_recv:received%p(err%d)\n",buf,conn->err)); - - -returnbuf; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_send(structnetconn*conn,structnetbuf*buf) -{ -structapi_msg*msg; - -if(conn==NULL){ -returnERR_VAL; -} - -if(conn->err!=ERR_OK){ -returnconn->err; -} - -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -return(conn->err=ERR_MEM); -} - -DEBUGF(API_LIB_DEBUG,("netconn_send:sending%dbytes\n",buf->p->tot_len)); -msg->type=API_MSG_SEND; -msg->msg.conn=conn; -msg->msg.msg.p=buf->p; -api_msg_post(msg); - -sys_mbox_fetch(conn->mbox,NULL); -memp_freep(MEMP_API_MSG,msg); -returnconn->err; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_write(structnetconn*conn,void*dataptr,uInt16size,uInt8copy) -{ -structapi_msg*msg; -uInt16len; - -if(conn==NULL){ -returnERR_VAL; -} - -if(conn->err!=ERR_OK){ -returnconn->err; -} - -if(conn->sem==SYS_SEM_NULL){ -conn->sem=sys_sem_new(0); -if(conn->sem==SYS_SEM_NULL){ -returnERR_MEM; -} -} - -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -return(conn->err=ERR_MEM); -} -msg->type=API_MSG_WRITE; -msg->msg.conn=conn; - - -conn->state=NETCONN_WRITE; -while(conn->err==ERR_OK&&size>0){ -msg->msg.msg.w.dataptr=dataptr; -msg->msg.msg.w.copy=copy; - -if(conn->type==NETCONN_TCP){ -if(tcp_sndbuf(conn->pcb.tcp)==0){ -sys_sem_wait(conn->sem); -if(conn->err!=ERR_OK){ -gotoret; -} -} -if(size>tcp_sndbuf(conn->pcb.tcp)){ -/*Wecannotsendmorethanonesendbuffer'sworthofdataata -time.*/ -len=tcp_sndbuf(conn->pcb.tcp); -}else{ -len=size; -} -}else{ -len=size; -} - -DEBUGF(API_LIB_DEBUG,("netconn_write:writing%dbytes(%d)\n",len,copy)); -msg->msg.msg.w.len=len; -api_msg_post(msg); -sys_mbox_fetch(conn->mbox,NULL); -if(conn->err==ERR_OK){ -dataptr=(void*)((char*)dataptr+len); -size-=len; -}elseif(conn->err==ERR_MEM){ -conn->err=ERR_OK; -sys_sem_wait(conn->sem); -}else{ -gotoret; -} -} -ret: -memp_freep(MEMP_API_MSG,msg); -conn->state=NETCONN_NONE; -if(conn->sem!=SYS_SEM_NULL){ -sys_sem_free(conn->sem); -conn->sem=SYS_SEM_NULL; -} -returnconn->err; +*new_conn=newconn; +/*don'tsetconn->last_err:it'sonlyERR_OK,anyway*/ +returnERR_OK; +#else/*LWIP_TCP*/ +LWIP_UNUSED_ARG(conn); +LWIP_UNUSED_ARG(new_conn); +returnERR_ARG; +#endif/*LWIP_TCP*/ +} + +staticerr_t +netconn_recv_data(structnetconn*conn,void**new_buf) +{ +void*buf=NULL; +u16_tlen; +#ifLWIP_TCP +API_MSG_VAR_DECLARE(msg); +#ifLWIP_MPU_COMPATIBLE +msg=NULL; +#endif +#endif/*LWIP_TCP*/ + +LWIP_ERROR("netconn_recv:invalidpointer",(new_buf!=NULL),returnERR_ARG;); +*new_buf=NULL; +LWIP_ERROR("netconn_recv:invalidconn",(conn!=NULL),returnERR_ARG;); +#ifLWIP_TCP +#if(LWIP_UDP||LWIP_RAW) +if(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP) +#endif/*(LWIP_UDP||LWIP_RAW)*/ +{ +if(!sys_mbox_valid(&conn->recvmbox)){ +/*ThishappenswhencallingthisfunctionafterreceivingFIN*/ +returnsys_mbox_valid(&conn->acceptmbox)?ERR_CONN:ERR_CLSD; +} +} +#endif/*LWIP_TCP*/ +LWIP_ERROR("netconn_recv:invalidrecvmbox",sys_mbox_valid(&conn->recvmbox),returnERR_CONN;); + +if(ERR_IS_FATAL(conn->last_err)){ +/*don'trecvonfatalerrors:thismightblocktheapplicationtask +waitingonrecvmboxforever!*/ +/*@todo:thisdoesnotallowustofetchdatathathasbeenputintorecvmbox +beforethefatalerroroccurred-isthataproblem?*/ +returnconn->last_err; +} +#ifLWIP_TCP +#if(LWIP_UDP||LWIP_RAW) +if(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP) +#endif/*(LWIP_UDP||LWIP_RAW)*/ +{ +API_MSG_VAR_ALLOC(msg); +} +#endif/*LWIP_TCP*/ + +#ifLWIP_SO_RCVTIMEO +if(sys_arch_mbox_fetch(&conn->recvmbox,&buf,conn->recv_timeout)==SYS_ARCH_TIMEOUT){ +#ifLWIP_TCP +#if(LWIP_UDP||LWIP_RAW) +if(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP) +#endif/*(LWIP_UDP||LWIP_RAW)*/ +{ +API_MSG_VAR_FREE(msg); +} +#endif/*LWIP_TCP*/ +returnERR_TIMEOUT; +} +#else +sys_arch_mbox_fetch(&conn->recvmbox,&buf,0); +#endif/*LWIP_SO_RCVTIMEO*/ + +#ifLWIP_TCP +#if(LWIP_UDP||LWIP_RAW) +if(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP) +#endif/*(LWIP_UDP||LWIP_RAW)*/ +{ +/*Letthestackknowthatwehavetakenthedata.*/ +/*@todo:Speedup:Don'tblockandwaitfortheanswerhere +(topreventmultiplethread-switches).*/ +API_MSG_VAR_REF(msg).conn=conn; +if(buf!=NULL){ +API_MSG_VAR_REF(msg).msg.r.len=((structpbuf*)buf)->tot_len; +}else{ +API_MSG_VAR_REF(msg).msg.r.len=1; +} + +/*don'tcareforthereturnvalueoflwip_netconn_do_recv*/ +netconn_apimsg(lwip_netconn_do_recv,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +/*Ifweareclosed,weindicatethatwenolongerwishtousethesocket*/ +if(buf==NULL){ +API_EVENT(conn,NETCONN_EVT_RCVMINUS,0); +if(conn->pcb.ip==NULL){ +/*racecondition:RSTduringrecv*/ +returnconn->last_err==ERR_OK?ERR_RST:conn->last_err; +} +/*RXsideisclosed,sodeallocatetherecvmbox*/ +netconn_close_shutdown(conn,NETCONN_SHUT_RD); +/*Don'storeERR_CLSDasconn->errsinceweareonlyhalf-closed*/ +returnERR_CLSD; +} +len=((structpbuf*)buf)->tot_len; +} +#endif/*LWIP_TCP*/ +#ifLWIP_TCP&&(LWIP_UDP||LWIP_RAW) +else +#endif/*LWIP_TCP&&(LWIP_UDP||LWIP_RAW)*/ +#if(LWIP_UDP||LWIP_RAW) +{ +LWIP_ASSERT("buf!=NULL",buf!=NULL); +len=netbuf_len((structnetbuf*)buf); +} +#endif/*(LWIP_UDP||LWIP_RAW)*/ + +#ifLWIP_SO_RCVBUF +SYS_ARCH_DEC(conn->recv_avail,len); +#endif/*LWIP_SO_RCVBUF*/ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVMINUS,len); + +LWIP_DEBUGF(API_LIB_DEBUG,("netconn_recv_data:received%p,len=%"U16_F"\n",buf,len)); + +*new_buf=buf; +/*don'tsetconn->last_err:it'sonlyERR_OK,anyway*/ +returnERR_OK; +} + +err_t +netconn_recv_tcp_pbuf(structnetconn*conn,structpbuf**new_buf) +{ +LWIP_ERROR("netconn_recv:invalidconn",(conn!=NULL)&& +NETCONNTYPE_GROUP(netconn_type(conn))==NETCONN_TCP,returnERR_ARG;); + +returnnetconn_recv_data(conn,(void**)new_buf); } -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_close(structnetconn*conn) -{ -structapi_msg*msg; - -if(conn==NULL){ -returnERR_VAL; -} -if((msg=memp_mallocp(MEMP_API_MSG))==NULL){ -return(conn->err=ERR_MEM); -} - -conn->state=NETCONN_CLOSE; -again: -msg->type=API_MSG_CLOSE; -msg->msg.conn=conn; -api_msg_post(msg); -sys_mbox_fetch(conn->mbox,NULL); -if(conn->err==ERR_MEM&& -conn->sem!=SYS_SEM_NULL){ -sys_sem_wait(conn->sem); -gotoagain; -} -conn->state=NETCONN_NONE; -memp_freep(MEMP_API_MSG,msg); -returnconn->err; -} -/*-----------------------------------------------------------------------------------*/ -err_t -netconn_err(structnetconn*conn) -{ -returnconn->err; -} -/*-----------------------------------------------------------------------------------*/ - - - - + +err_t +netconn_recv(structnetconn*conn,structnetbuf**new_buf) +{ +#ifLWIP_TCP +structnetbuf*buf=NULL; +err_terr; +#endif/*LWIP_TCP*/ + +LWIP_ERROR("netconn_recv:invalidpointer",(new_buf!=NULL),returnERR_ARG;); +*new_buf=NULL; +LWIP_ERROR("netconn_recv:invalidconn",(conn!=NULL),returnERR_ARG;); + +#ifLWIP_TCP +#if(LWIP_UDP||LWIP_RAW) +if(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP) +#endif/*(LWIP_UDP||LWIP_RAW)*/ +{ +structpbuf*p=NULL; +/*Thisisnotalisteningnetconn,sincerecvmboxisset*/ + +buf=(structnetbuf*)memp_malloc(MEMP_NETBUF); +if(buf==NULL){ +returnERR_MEM; +} + +err=netconn_recv_data(conn,(void**)&p); +if(err!=ERR_OK){ +memp_free(MEMP_NETBUF,buf); +returnerr; +} +LWIP_ASSERT("p!=NULL",p!=NULL); + +buf->p=p; +buf->ptr=p; +buf->port=0; +ip_addr_set_zero(&buf->addr); +*new_buf=buf; +/*don'tsetconn->last_err:it'sonlyERR_OK,anyway*/ +returnERR_OK; +} +#endif/*LWIP_TCP*/ +#ifLWIP_TCP&&(LWIP_UDP||LWIP_RAW) +else +#endif/*LWIP_TCP&&(LWIP_UDP||LWIP_RAW)*/ +{ +#if(LWIP_UDP||LWIP_RAW) +returnnetconn_recv_data(conn,(void**)new_buf); +#endif/*(LWIP_UDP||LWIP_RAW)*/ +} +} + +err_t +netconn_sendto(structnetconn*conn,structnetbuf*buf,constip_addr_t*addr,u16_tport) +{ +if(buf!=NULL){ +ip_addr_set(&buf->addr,addr); +buf->port=port; +returnnetconn_send(conn,buf); +} +returnERR_VAL; +} + +err_t +netconn_send(structnetconn*conn,structnetbuf*buf) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; + +LWIP_ERROR("netconn_send:invalidconn",(conn!=NULL),returnERR_ARG;); + +LWIP_DEBUGF(API_LIB_DEBUG,("netconn_send:sending%"U16_F"bytes\n",buf->p->tot_len)); + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +API_MSG_VAR_REF(msg).msg.b=buf; +err=netconn_apimsg(lwip_netconn_do_send,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +} + +err_t +netconn_write_partly(structnetconn*conn,constvoid*dataptr,size_tsize, +u8_tapiflags,size_t*bytes_written) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; +u8_tdontblock; + +LWIP_ERROR("netconn_write:invalidconn",(conn!=NULL),returnERR_ARG;); +LWIP_ERROR("netconn_write:invalidconn->type",(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP),returnERR_VAL;); +if(size==0){ +returnERR_OK; +} +dontblock=netconn_is_nonblocking(conn)||(apiflags&NETCONN_DONTBLOCK); +#ifLWIP_SO_SNDTIMEO +if(conn->send_timeout!=0){ +dontblock=1; +} +#endif/*LWIP_SO_SNDTIMEO*/ +if(dontblock&&!bytes_written){ +/*Thisimpliesnetconn_write()cannotbeusedfornon-blockingsend,since +ithasnowaytoreturnthenumberofbyteswritten.*/ +returnERR_VAL; +} + +API_MSG_VAR_ALLOC(msg); +/*non-blockingwritesendsasmuch*/ +API_MSG_VAR_REF(msg).conn=conn; +API_MSG_VAR_REF(msg).msg.w.dataptr=dataptr; +API_MSG_VAR_REF(msg).msg.w.apiflags=apiflags; +API_MSG_VAR_REF(msg).msg.w.len=size; +#ifLWIP_SO_SNDTIMEO +if(conn->send_timeout!=0){ +/*getthetimewestarted,whichislatercomparedto +sys_now()+conn->send_timeout*/ +API_MSG_VAR_REF(msg).msg.w.time_started=sys_now(); +}else{ +API_MSG_VAR_REF(msg).msg.w.time_started=0; +} +#endif/*LWIP_SO_SNDTIMEO*/ + +/*Forlockingthecore:this_can_bedelayedonlowmemory/lowsendbuffer, +butifitis,thisisdoneinsideapi_msg.c:do_write(),sowecanusethe +non-blockingversionhere.*/ +err=netconn_apimsg(lwip_netconn_do_write,&API_MSG_VAR_REF(msg)); +if((err==ERR_OK)&&(bytes_written!=NULL)){ +if(dontblock){ +/*nonblockingwrite:maybethedatahasbeensentpartly*/ +*bytes_written=API_MSG_VAR_REF(msg).msg.w.len; +}else{ +/*blockingcallsucceeded:alldatahasbeensentifit*/ +*bytes_written=size; +} +} +API_MSG_VAR_FREE(msg); + +returnerr; +} + +staticerr_t +netconn_close_shutdown(structnetconn*conn,u8_thow) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; +LWIP_UNUSED_ARG(how); + +LWIP_ERROR("netconn_close:invalidconn",(conn!=NULL),returnERR_ARG;); + +API_MSG_VAR_ALLOC(msg); +API_MSG_VAR_REF(msg).conn=conn; +#ifLWIP_TCP +/*shuttingdownbothendsisthesameasclosing*/ +API_MSG_VAR_REF(msg).msg.sd.shut=how; +#ifLWIP_SO_SNDTIMEO||LWIP_SO_LINGER +/*getthetimewestarted,whichislatercomparedto +sys_now()+conn->send_timeout*/ +API_MSG_VAR_REF(msg).msg.sd.time_started=sys_now(); +#else/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +API_MSG_VAR_REF(msg).msg.sd.polls_left= +((LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT+TCP_SLOW_INTERVAL-1)/TCP_SLOW_INTERVAL)+1; +#endif/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +#endif/*LWIP_TCP*/ +err=netconn_apimsg(lwip_netconn_do_close,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +} + +err_t +netconn_close(structnetconn*conn) +{ +/*shuttingdownbothendsisthesameasclosing*/ +returnnetconn_close_shutdown(conn,NETCONN_SHUT_RDWR); +} + +err_t +netconn_shutdown(structnetconn*conn,u8_tshut_rx,u8_tshut_tx) +{ +returnnetconn_close_shutdown(conn,(shut_rx?NETCONN_SHUT_RD:0)|(shut_tx?NETCONN_SHUT_WR:0)); +} + +#ifLWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD) + +err_t +netconn_join_leave_group(structnetconn*conn, +constip_addr_t*multiaddr, +constip_addr_t*netif_addr, +enumnetconn_igmpjoin_or_leave) +{ +API_MSG_VAR_DECLARE(msg); +err_terr; + +LWIP_ERROR("netconn_join_leave_group:invalidconn",(conn!=NULL),returnERR_ARG;); + +API_MSG_VAR_ALLOC(msg); + +#ifLWIP_IPV4 +/*Don'tpropagateNULLpointer(IP_ADDR_ANYalias)tosubsequentfunctions*/ +if(multiaddr==NULL){ +multiaddr=IP4_ADDR_ANY; +} +if(netif_addr==NULL){ +netif_addr=IP4_ADDR_ANY; +} +#endif/*LWIP_IPV4*/ + +API_MSG_VAR_REF(msg).conn=conn; +API_MSG_VAR_REF(msg).msg.jl.multiaddr=API_MSG_VAR_REF(multiaddr); +API_MSG_VAR_REF(msg).msg.jl.netif_addr=API_MSG_VAR_REF(netif_addr); +API_MSG_VAR_REF(msg).msg.jl.join_or_leave=join_or_leave; +err=netconn_apimsg(lwip_netconn_do_join_leave_group,&API_MSG_VAR_REF(msg)); +API_MSG_VAR_FREE(msg); + +returnerr; +} +#endif/*LWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD)*/ + +#ifLWIP_DNS + +#ifLWIP_IPV4&&LWIP_IPV6 +err_t +netconn_gethostbyname_addrtype(constchar*name,ip_addr_t*addr,u8_tdns_addrtype) +#else +err_t +netconn_gethostbyname(constchar*name,ip_addr_t*addr) +#endif +{ +API_VAR_DECLARE(structdns_api_msg,msg); +#if!LWIP_MPU_COMPATIBLE +sys_sem_tsem; +#endif/*LWIP_MPU_COMPATIBLE*/ +err_terr; +err_tcberr; + +LWIP_ERROR("netconn_gethostbyname:invalidname",(name!=NULL),returnERR_ARG;); +LWIP_ERROR("netconn_gethostbyname:invalidaddr",(addr!=NULL),returnERR_ARG;); +#ifLWIP_MPU_COMPATIBLE +if(strlen(name)>=DNS_MAX_NAME_LENGTH){ +returnERR_ARG; +} +#endif + +API_VAR_ALLOC(structdns_api_msg,MEMP_DNS_API_MSG,msg,ERR_MEM); +#ifLWIP_MPU_COMPATIBLE +strncpy(API_VAR_REF(msg).name,name,DNS_MAX_NAME_LENGTH-1); +API_VAR_REF(msg).name[DNS_MAX_NAME_LENGTH-1]=0; +#else/*LWIP_MPU_COMPATIBLE*/ +msg.err=&err; +msg.sem=&sem; +API_VAR_REF(msg).addr=API_VAR_REF(addr); +API_VAR_REF(msg).name=name; +#endif/*LWIP_MPU_COMPATIBLE*/ +#ifLWIP_IPV4&&LWIP_IPV6 +API_VAR_REF(msg).dns_addrtype=dns_addrtype; +#endif/*LWIP_IPV4&&LWIP_IPV6*/ +#ifLWIP_NETCONN_SEM_PER_THREAD +API_VAR_REF(msg).sem=LWIP_NETCONN_THREAD_SEM_GET(); +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +err=sys_sem_new(API_EXPR_REF(API_VAR_REF(msg).sem),0); +if(err!=ERR_OK){ +API_VAR_FREE(MEMP_DNS_API_MSG,msg); +returnerr; +} +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +cberr=tcpip_callback(lwip_netconn_do_gethostbyname,&API_VAR_REF(msg)); +if(cberr!=ERR_OK){ +#if!LWIP_NETCONN_SEM_PER_THREAD +sys_sem_free(API_EXPR_REF(API_VAR_REF(msg).sem)); +#endif/*!LWIP_NETCONN_SEM_PER_THREAD*/ +API_VAR_FREE(MEMP_DNS_API_MSG,msg); +returncberr; +} +sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem)); +#if!LWIP_NETCONN_SEM_PER_THREAD +sys_sem_free(API_EXPR_REF(API_VAR_REF(msg).sem)); +#endif/*!LWIP_NETCONN_SEM_PER_THREAD*/ + +#ifLWIP_MPU_COMPATIBLE +*addr=msg->addr; +err=msg->err; +#endif/*LWIP_MPU_COMPATIBLE*/ + +API_VAR_FREE(MEMP_DNS_API_MSG,msg); +returnerr; +} +#endif/*LWIP_DNS*/ + +#ifLWIP_NETCONN_SEM_PER_THREAD +void +netconn_thread_init(void) +{ +sys_sem_t*sem=LWIP_NETCONN_THREAD_SEM_GET(); +if((sem==NULL)||!sys_sem_valid(sem)){ +/*callalloconlyonce*/ +LWIP_NETCONN_THREAD_SEM_ALLOC(); +LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC()failed",sys_sem_valid(LWIP_NETCONN_THREAD_SEM_GET())); +} +} + +void +netconn_thread_cleanup(void) +{ +sys_sem_t*sem=LWIP_NETCONN_THREAD_SEM_GET(); +if((sem!=NULL)&&sys_sem_valid(sem)){ +/*callfreeonlyonce*/ +LWIP_NETCONN_THREAD_SEM_FREE(); +} +} +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +#endif/*LWIP_NETCONN*/ - + diff --git a/doc/xml/api__msg_8c.xml b/doc/xml/api__msg_8c.xml index 194af32..d4ab691 100644 --- a/doc/xml/api__msg_8c.xml +++ b/doc/xml/api__msg_8c.xml @@ -1,1538 +1,1895 @@ - - - + + + api_msg.c - ubixos/types.h - net/debug.h - net/arch.h - net/api_msg.h - net/memp.h - net/sys.h - net/tcpip.h + net/opt.h - - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + - - - - + + + + - + - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - void(*) - typedef void(* ) api_msg_decode(struct api_msg_msg *msg) - (struct api_msg_msg *msg) - api_msg_decode - - - - - - - - - - - - err_t - static err_t accept_function - (void *arg, struct tcp_pcb *newpcb, err_t err) - accept_function - - void * - arg - - - struct tcp_pcb * - newpcb - - - err_t - err - - - - - - - - - netconn::acceptmbox - netconn::err - ERR_MEM - ERR_OK - netconn::mbox - mbox - memp_free - memp_mallocp - MEMP_NETCONN - NETCONN_TCP - NULL - netconn::pcb - netconn::recvmbox - netconn::sem - setup_tcp - tcp_pcb::state - sys_mbox_free - sys_mbox_new - SYS_MBOX_NULL - sys_mbox_post - sys_sem_new - SYS_SEM_NULL - netconn::tcp - netconn::type - do_listen - - - void - void api_msg_input - (struct api_msg *msg) - api_msg_input - - struct api_msg * - msg - - - - - - - - - decode - api_msg_msg::msg - tcpip_thread - - - void - void api_msg_post - (struct api_msg *msg) - api_msg_post - - struct api_msg * - msg - - - - - - - - - api_msg_msg::msg - tcpip_apimsg - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_recv - netconn_send - netconn_write - - - void - static void do_accept - (struct api_msg_msg *msg) - do_accept - - struct api_msg_msg * - msg - - - - - - - - - API_MSG_DEBUG - api_msg_msg::conn - DEBUGF - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - netconn::tcp - netconn::type - - - void - static void do_bind - (struct api_msg_msg *msg) - do_bind - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::bc - api_msg_msg::conn - netconn::err - netconn::mbox - api_msg_msg::msg - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - recv_udp - setup_tcp - sys_mbox_post - netconn::tcp - tcp_bind - tcp_new - netconn::type - netconn::udp - udp_bind - UDP_FLAGS_NOCHKSUM - UDP_FLAGS_UDPLITE - udp_new - udp_recv - udp_setflags - - - void - static void do_close - (struct api_msg_msg *msg) - do_close - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::conn - netconn::err - LISTEN - netconn::mbox - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - tcp_pcb::state - sys_mbox_post - netconn::tcp - tcp_close - netconn::type - - - void - static void do_connect - (struct api_msg_msg *msg) - do_connect - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::bc - api_msg_msg::conn - do_connected - netconn::err - ERR_MEM - netconn::mbox - api_msg_msg::msg - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - recv_udp - setup_tcp - sys_mbox_post - netconn::tcp - tcp_connect - tcp_new - netconn::type - netconn::udp - udp_connect - UDP_FLAGS_NOCHKSUM - UDP_FLAGS_UDPLITE - udp_new - udp_recv - udp_setflags - - - err_t - static err_t do_connected - (void *arg, struct tcp_pcb *pcb, err_t err) - do_connected - - void * - arg - - - struct tcp_pcb * - pcb - - - err_t - err - - - - - - - - - netconn::err - ERR_OK - ERR_VAL - netconn::mbox - NETCONN_TCP - NULL - setup_tcp - sys_mbox_post - netconn::type - do_connect - - - void - static void do_delconn - (struct api_msg_msg *msg) - do_delconn - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::conn - ERR_OK - LISTEN - netconn::mbox - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - udp_pcb::recv_arg - tcp_pcb::state - SYS_MBOX_NULL - sys_mbox_post - netconn::tcp - tcp_abort - tcp_accept - tcp_arg - tcp_close - tcp_err - tcp_poll - tcp_recv - tcp_sent - netconn::type - netconn::udp - udp_remove - - - void - static void do_listen - (struct api_msg_msg *msg) - do_listen - - struct api_msg_msg * - msg - - - - - - - - - accept_function - netconn::acceptmbox - API_MSG_DEBUG - api_msg_msg::conn - DEBUGF - netconn::err - ERR_MEM - netconn::mbox - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - sys_mbox_new - SYS_MBOX_NULL - sys_mbox_post - netconn::tcp - tcp_accept - tcp_arg - tcp_listen - netconn::type - - - void - static void do_newconn - (struct api_msg_msg *msg) - do_newconn - - struct api_msg_msg * - msg - - - - - - - - - - - void - static void do_recv - (struct api_msg_msg *msg) - do_recv - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::conn - api_msg_msg::len - netconn::mbox - api_msg_msg::msg - NETCONN_TCP - NULL - netconn::pcb - sys_mbox_post - netconn::tcp - tcp_recved - netconn::type - - - void - static void do_send - (struct api_msg_msg *msg) - do_send - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::conn - netconn::mbox - api_msg_msg::msg - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - api_msg_msg::p - netconn::pcb - sys_mbox_post - netconn::tcp - netconn::type - netconn::udp - udp_send - - - void - static void do_write - (struct api_msg_msg *msg) - do_write - - struct api_msg_msg * - msg - - - - - - - - - api_msg_msg::conn - netconn::err - ERR_OK - ERR_VAL - netconn::mbox - api_msg_msg::msg - NETCONN_TCP - NETCONN_UDP - NETCONN_UDPLITE - NETCONN_UDPNOCHKSUM - NULL - netconn::pcb - sys_mbox_post - netconn::tcp - tcp_output - tcp_write - netconn::type - tcp_pcb::unacked - api_msg_msg::w - - - void - static void err_tcp - (void *arg, err_t err) - err_tcp - - void * - arg - - - err_t - err - - - - - - - - - netconn::acceptmbox - netconn::err - netconn::mbox - NULL - netconn::pcb - netconn::recvmbox - netconn::sem - SYS_MBOX_NULL - sys_mbox_post - SYS_SEM_NULL - sys_sem_signal - netconn::tcp - setup_tcp - - - err_t - static err_t poll_tcp - (void *arg, struct tcp_pcb *pcb) - poll_tcp - - void * - arg - - - struct tcp_pcb * - pcb - - - - - - - - - ERR_OK - NETCONN_CLOSE - NETCONN_WRITE - NULL - netconn::sem - netconn::state - SYS_SEM_NULL - sys_sem_signal - setup_tcp - - - err_t - static err_t recv_tcp - (void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) - recv_tcp - - void * - arg - - - struct tcp_pcb * - pcb - - - struct pbuf * - p - - - err_t - err - - - - - - - - - netconn::err - ERR_OK - ERR_VAL - NULL - pbuf_free - netconn::recvmbox - SYS_MBOX_NULL - sys_mbox_post - setup_tcp - - - void - static void recv_udp - (void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, uInt16 port) - recv_udp - - void * - arg - - - struct udp_pcb * - pcb - - - struct pbuf * - p - - - struct ip_addr * - addr - - - uInt16 - port - - - - - - - - - netbuf::fromaddr - netbuf::fromport - memp_mallocp - MEMP_NETBUF - NULL - netbuf::p - pbuf_free - netbuf::ptr - netconn::recvmbox - SYS_MBOX_NULL - sys_mbox_post - do_bind - do_connect - - - err_t - static err_t sent_tcp - (void *arg, struct tcp_pcb *pcb, uInt16 len) - sent_tcp - - void * - arg - - - struct tcp_pcb * - pcb - - - uInt16 - len - - - - - - - - - ERR_OK - NULL - netconn::sem - SYS_SEM_NULL - sys_sem_signal - setup_tcp - - - void - static void setup_tcp - (struct netconn *conn) - setup_tcp - - struct netconn * - conn - - - - - - - - - err_tcp - netconn::pcb - poll_tcp - recv_tcp - sent_tcp - netconn::tcp - tcp_arg - tcp_err - tcp_poll - tcp_recv - tcp_sent - accept_function - do_bind - do_connect - do_connected - - - - - api_msg_decode - api_msg_decode decode[API_MSG_MAX] - [API_MSG_MAX] - decode - { - do_newconn, - do_delconn, - do_bind, - do_connect, - do_listen, - do_accept, - do_send, - do_recv, - do_write, - do_close - } - - - - - - - - api_msg_input - - +Sequential API Internal module -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. * -*$Id: api__msg_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -#include<ubixos/types.h> - -#include"net/debug.h" -#include"net/arch.h" -#include"net/api_msg.h" -#include"net/memp.h" -#include"net/sys.h" -#include"net/tcpip.h" +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ + +#include<net/opt.h> + +#ifLWIP_NETCONN/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include<net/priv/api_msg.h> -/*-----------------------------------------------------------------------------------*/ -staticerr_t -recv_tcp(void*arg,structtcp_pcb*pcb,structpbuf*p,err_terr) -{ -structnetconn*conn; +#include<net/ip.h> +#include<net/ip_addr.h> +#include<net/udp.h> +#include<net/tcp.h> +#include<net/raw.h> -conn=arg; - -if(conn==NULL){ -pbuf_free(p); -returnERR_VAL; -} - -if(conn->recvmbox!=SYS_MBOX_NULL){ -conn->err=err; -sys_mbox_post(conn->recvmbox,p); -} -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -recv_udp(void*arg,structudp_pcb*pcb,structpbuf*p, -structip_addr*addr,uInt16port) -{ -structnetbuf*buf; -structnetconn*conn; - -conn=arg; - -if(conn==NULL){ -pbuf_free(p); -return; -} - -if(conn->recvmbox!=SYS_MBOX_NULL){ -buf=memp_mallocp(MEMP_NETBUF); -if(buf==NULL){ -pbuf_free(p); -return; -}else{ -buf->p=p; -buf->ptr=p; -buf->fromaddr=addr; -buf->fromport=port; -} - -sys_mbox_post(conn->recvmbox,buf); -} -} -/*-----------------------------------------------------------------------------------*/ -staticerr_t -poll_tcp(void*arg,structtcp_pcb*pcb) -{ -structnetconn*conn; - -conn=arg; -if(conn!=NULL&& -(conn->state==NETCONN_WRITE||conn->state==NETCONN_CLOSE)&& -conn->sem!=SYS_SEM_NULL){ -sys_sem_signal(conn->sem); -} -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -staticerr_t -sent_tcp(void*arg,structtcp_pcb*pcb,uInt16len) -{ -structnetconn*conn; - -conn=arg; -if(conn!=NULL&&conn->sem!=SYS_SEM_NULL){ -sys_sem_signal(conn->sem); -} -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -err_tcp(void*arg,err_terr) -{ -structnetconn*conn; - -conn=arg; - -conn->pcb.tcp=NULL; - - -conn->err=err; -if(conn->recvmbox!=SYS_MBOX_NULL){ -sys_mbox_post(conn->recvmbox,NULL); -} -if(conn->mbox!=SYS_MBOX_NULL){ -sys_mbox_post(conn->mbox,NULL); -} -if(conn->acceptmbox!=SYS_MBOX_NULL){ -sys_mbox_post(conn->acceptmbox,NULL); -} -if(conn->sem!=SYS_SEM_NULL){ -sys_sem_signal(conn->sem); -} -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -setup_tcp(structnetconn*conn) -{ -structtcp_pcb*pcb; - -pcb=conn->pcb.tcp; -tcp_arg(pcb,conn); -tcp_recv(pcb,recv_tcp); -tcp_sent(pcb,sent_tcp); -tcp_poll(pcb,poll_tcp,4); -tcp_err(pcb,err_tcp); -} -/*-----------------------------------------------------------------------------------*/ -staticerr_t -accept_function(void*arg,structtcp_pcb*newpcb,err_terr) -{ -sys_mbox_t*mbox; -structnetconn*newconn; - -#ifAPI_MSG_DEBUG -#ifTCP_DEBUG -tcp_debug_print_state(newpcb->state); -#endif/*TCP_DEBUG*/ -#endif/*API_MSG_DEBUG*/ -mbox=(sys_mbox_t*)arg; -newconn=memp_mallocp(MEMP_NETCONN); -if(newconn==NULL){ -returnERR_MEM; -} -newconn->type=NETCONN_TCP; -newconn->pcb.tcp=newpcb; -setup_tcp(newconn); -newconn->recvmbox=sys_mbox_new(); -if(newconn->recvmbox==SYS_MBOX_NULL){ -memp_free(MEMP_NETCONN,newconn); -returnERR_MEM; -} -newconn->mbox=sys_mbox_new(); -if(newconn->mbox==SYS_MBOX_NULL){ -sys_mbox_free(newconn->recvmbox); -memp_free(MEMP_NETCONN,newconn); -returnERR_MEM; -} -newconn->sem=sys_sem_new(0); -if(newconn->sem==SYS_SEM_NULL){ -sys_mbox_free(newconn->recvmbox); -sys_mbox_free(newconn->mbox); -memp_free(MEMP_NETCONN,newconn); -returnERR_MEM; -} -newconn->acceptmbox=SYS_MBOX_NULL; -newconn->err=err; -sys_mbox_post(*mbox,newconn); -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_newconn(structapi_msg_msg*msg) -{ -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_delconn(structapi_msg_msg*msg) -{ -if(msg->conn->pcb.tcp!=NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -msg->conn->pcb.udp->recv_arg=NULL; -udp_remove(msg->conn->pcb.udp); -break; -caseNETCONN_TCP: -tcp_arg(msg->conn->pcb.tcp,NULL); -tcp_sent(msg->conn->pcb.tcp,NULL); -tcp_recv(msg->conn->pcb.tcp,NULL); -tcp_accept(msg->conn->pcb.tcp,NULL); -tcp_poll(msg->conn->pcb.tcp,NULL,0); -tcp_err(msg->conn->pcb.tcp,NULL); -if(msg->conn->pcb.tcp->state==LISTEN){ -tcp_close(msg->conn->pcb.tcp); -}else{ -if(tcp_close(msg->conn->pcb.tcp)!=ERR_OK){ -tcp_abort(msg->conn->pcb.tcp); -} -} -break; -} -} -if(msg->conn->mbox!=SYS_MBOX_NULL){ -sys_mbox_post(msg->conn->mbox,NULL); -} -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_bind(structapi_msg_msg*msg) +#include<net/memp.h> +#include<net/igmp.h> +#include<net/dns.h> +#include<net/mld6.h> +#include<net/priv/tcpip_priv.h> + +#include<string.h> + +/*netconnsarepolledoncepersecond(e.g.continuewriteonmemoryerror)*/ +#defineNETCONN_TCP_POLL_INTERVAL2 + +#defineSET_NONBLOCKING_CONNECT(conn,val)do{if(val){\ +(conn)->flags|=NETCONN_FLAG_IN_NONBLOCKING_CONNECT;\ +}else{\ +(conn)->flags&=~NETCONN_FLAG_IN_NONBLOCKING_CONNECT;}}while(0) +#defineIN_NONBLOCKING_CONNECT(conn)(((conn)->flags&NETCONN_FLAG_IN_NONBLOCKING_CONNECT)!=0) + +/*forwarddeclarations*/ +#ifLWIP_TCP +#ifLWIP_TCPIP_CORE_LOCKING +#defineWRITE_DELAYED,1 +#defineWRITE_DELAYED_PARAM,u8_tdelayed +#else/*LWIP_TCPIP_CORE_LOCKING*/ +#defineWRITE_DELAYED +#defineWRITE_DELAYED_PARAM +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +staticerr_tlwip_netconn_do_writemore(structnetconn*connWRITE_DELAYED_PARAM); +staticerr_tlwip_netconn_do_close_internal(structnetconn*connWRITE_DELAYED_PARAM); +#endif + +#ifLWIP_TCPIP_CORE_LOCKING +#defineTCPIP_APIMSG_ACK(m)NETCONN_SET_SAFE_ERR((m)->conn,(m)->err) +#else/*LWIP_TCPIP_CORE_LOCKING*/ +#defineTCPIP_APIMSG_ACK(m)do{NETCONN_SET_SAFE_ERR((m)->conn,(m)->err);sys_sem_signal(LWIP_API_MSG_SEM(m));}while(0) +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +#ifLWIP_TCP +u8_tnetconn_aborted; +#endif/*LWIP_TCP*/ + +#ifLWIP_RAW + +staticu8_t +recv_raw(void*arg,structraw_pcb*pcb,structpbuf*p, +constip_addr_t*addr) +{ +structpbuf*q; +structnetbuf*buf; +structnetconn*conn; + +LWIP_UNUSED_ARG(addr); +conn=(structnetconn*)arg; + +if((conn!=NULL)&&sys_mbox_valid(&conn->recvmbox)){ +#ifLWIP_SO_RCVBUF +intrecv_avail; +SYS_ARCH_GET(conn->recv_avail,recv_avail); +if((recv_avail+(int)(p->tot_len))>conn->recv_bufsize){ +return0; +} +#endif/*LWIP_SO_RCVBUF*/ +/*copythewholepacketintonewpbufs*/ +q=pbuf_alloc(PBUF_RAW,p->tot_len,PBUF_RAM); +if(q!=NULL){ +if(pbuf_copy(q,p)!=ERR_OK){ +pbuf_free(q); +q=NULL; +} +} + +if(q!=NULL){ +u16_tlen; +buf=(structnetbuf*)memp_malloc(MEMP_NETBUF); +if(buf==NULL){ +pbuf_free(q); +return0; +} + +buf->p=q; +buf->ptr=q; +ip_addr_copy(buf->addr,*ip_current_src_addr()); +buf->port=pcb->protocol; + +len=q->tot_len; +if(sys_mbox_trypost(&conn->recvmbox,buf)!=ERR_OK){ +netbuf_delete(buf); +return0; +}else{ +#ifLWIP_SO_RCVBUF +SYS_ARCH_INC(conn->recv_avail,len); +#endif/*LWIP_SO_RCVBUF*/ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,len); +} +} +} + +return0;/*donoteatthepacket*/ +} +#endif/*LWIP_RAW*/ + +#ifLWIP_UDP + +staticvoid +recv_udp(void*arg,structudp_pcb*pcb,structpbuf*p, +constip_addr_t*addr,u16_tport) +{ +structnetbuf*buf; +structnetconn*conn; +u16_tlen; +#ifLWIP_SO_RCVBUF +intrecv_avail; +#endif/*LWIP_SO_RCVBUF*/ + +LWIP_UNUSED_ARG(pcb);/*onlyusedforasserts...*/ +LWIP_ASSERT("recv_udpmusthaveapcbargument",pcb!=NULL); +LWIP_ASSERT("recv_udpmusthaveanargument",arg!=NULL); +conn=(structnetconn*)arg; + +if(conn==NULL){ +pbuf_free(p); +return; +} + +LWIP_ASSERT("recv_udp:recvforwrongpcb!",conn->pcb.udp==pcb); + +#ifLWIP_SO_RCVBUF +SYS_ARCH_GET(conn->recv_avail,recv_avail); +if(!sys_mbox_valid(&conn->recvmbox)|| +((recv_avail+(int)(p->tot_len))>conn->recv_bufsize)){ +#else/*LWIP_SO_RCVBUF*/ +if(!sys_mbox_valid(&conn->recvmbox)){ +#endif/*LWIP_SO_RCVBUF*/ +pbuf_free(p); +return; +} + +buf=(structnetbuf*)memp_malloc(MEMP_NETBUF); +if(buf==NULL){ +pbuf_free(p); +return; +}else{ +buf->p=p; +buf->ptr=p; +ip_addr_set(&buf->addr,addr); +buf->port=port; +#ifLWIP_NETBUF_RECVINFO +{ +/*gettheUDPheader-alwaysinthefirstpbuf,ensuredbyudp_input*/ +conststructudp_hdr*udphdr=(conststructudp_hdr*)ip_next_header_ptr(); +#ifLWIP_CHECKSUM_ON_COPY +buf->flags=NETBUF_FLAG_DESTADDR; +#endif/*LWIP_CHECKSUM_ON_COPY*/ +ip_addr_set(&buf->toaddr,ip_current_dest_addr()); +buf->toport_chksum=udphdr->dest; +} +#endif/*LWIP_NETBUF_RECVINFO*/ +} + +len=p->tot_len; +if(sys_mbox_trypost(&conn->recvmbox,buf)!=ERR_OK){ +netbuf_delete(buf); +return; +}else{ +#ifLWIP_SO_RCVBUF +SYS_ARCH_INC(conn->recv_avail,len); +#endif/*LWIP_SO_RCVBUF*/ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,len); +} +} +#endif/*LWIP_UDP*/ + +#ifLWIP_TCP + +staticerr_t +recv_tcp(void*arg,structtcp_pcb*pcb,structpbuf*p,err_terr) { -if(msg->conn->pcb.tcp==NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -msg->conn->pcb.udp=udp_new(); -udp_setflags(msg->conn->pcb.udp,UDP_FLAGS_UDPLITE); -udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); -break; -caseNETCONN_UDPNOCHKSUM: -msg->conn->pcb.udp=udp_new(); -udp_setflags(msg->conn->pcb.udp,UDP_FLAGS_NOCHKSUM); -udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); -break; -caseNETCONN_UDP: -msg->conn->pcb.udp=udp_new(); -udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); -break; -caseNETCONN_TCP: -msg->conn->pcb.tcp=tcp_new(); -setup_tcp(msg->conn); -break; -} -} -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -udp_bind(msg->conn->pcb.udp,msg->msg.bc.ipaddr,msg->msg.bc.port); -break; -caseNETCONN_TCP: -msg->conn->err=tcp_bind(msg->conn->pcb.tcp, -msg->msg.bc.ipaddr,msg->msg.bc.port); -break; +structnetconn*conn; +u16_tlen; + +LWIP_UNUSED_ARG(pcb); +LWIP_ASSERT("recv_tcpmusthaveapcbargument",pcb!=NULL); +LWIP_ASSERT("recv_tcpmusthaveanargument",arg!=NULL); +conn=(structnetconn*)arg; + +if(conn==NULL){ +returnERR_VAL; +} +LWIP_ASSERT("recv_tcp:recvforwrongpcb!",conn->pcb.tcp==pcb); + +if(!sys_mbox_valid(&conn->recvmbox)){ +/*recvmboxalreadydeleted*/ +if(p!=NULL){ +tcp_recved(pcb,p->tot_len); +pbuf_free(p); +} +returnERR_OK; +} +/*UnlikeforUDPorRAWpcbs,don'tcheckforavailablespace +usingrecv_availsincethatcouldbreaktheconnection +(dataisalreadyACKed)*/ + +/*don'toverwritefatalerrors!*/ +if(err!=ERR_OK){ +NETCONN_SET_SAFE_ERR(conn,err); +} + +if(p!=NULL){ +len=p->tot_len; +}else{ +len=0; } -sys_mbox_post(msg->conn->mbox,NULL); -} -/*-----------------------------------------------------------------------------------*/ -staticerr_t -do_connected(void*arg,structtcp_pcb*pcb,err_terr) -{ -structnetconn*conn; - -conn=arg; - -if(conn==NULL){ -returnERR_VAL; -} - -conn->err=err; - -if(conn->type==NETCONN_TCP&&err==ERR_OK){ -setup_tcp(conn); -} - -sys_mbox_post(conn->mbox,NULL); -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_connect(structapi_msg_msg*msg) -{ -if(msg->conn->pcb.tcp==NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -msg->conn->pcb.udp=udp_new(); -if(msg->conn->pcb.udp==NULL){ -msg->conn->err=ERR_MEM; -sys_mbox_post(msg->conn->mbox,NULL); -return; -} -udp_setflags(msg->conn->pcb.udp,UDP_FLAGS_UDPLITE); -udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); -break; -caseNETCONN_UDPNOCHKSUM: -msg->conn->pcb.udp=udp_new(); -if(msg->conn->pcb.udp==NULL){ -msg->conn->err=ERR_MEM; -sys_mbox_post(msg->conn->mbox,NULL); -return; -} -udp_setflags(msg->conn->pcb.udp,UDP_FLAGS_NOCHKSUM); -udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); -break; -caseNETCONN_UDP: -msg->conn->pcb.udp=udp_new(); -if(msg->conn->pcb.udp==NULL){ -msg->conn->err=ERR_MEM; -sys_mbox_post(msg->conn->mbox,NULL); -return; -} -udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); -break; -caseNETCONN_TCP: -msg->conn->pcb.tcp=tcp_new(); -if(msg->conn->pcb.tcp==NULL){ -msg->conn->err=ERR_MEM; -sys_mbox_post(msg->conn->mbox,NULL); -return; -} -break; -} -} -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -udp_connect(msg->conn->pcb.udp,msg->msg.bc.ipaddr,msg->msg.bc.port); -sys_mbox_post(msg->conn->mbox,NULL); -break; -caseNETCONN_TCP: -/*tcp_arg(msg->conn->pcb.tcp,msg->conn);*/ -setup_tcp(msg->conn); -tcp_connect(msg->conn->pcb.tcp,msg->msg.bc.ipaddr,msg->msg.bc.port, -do_connected); -/*tcp_output(msg->conn->pcb.tcp);*/ -break; -} -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_listen(structapi_msg_msg*msg) -{ -if(msg->conn->pcb.tcp!=NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -DEBUGF(API_MSG_DEBUG,("api_msg:listenUDP:cannotlistenforUDP.\n")); -break; -caseNETCONN_TCP: -msg->conn->pcb.tcp=tcp_listen(msg->conn->pcb.tcp); -if(msg->conn->pcb.tcp==NULL){ -msg->conn->err=ERR_MEM; -}else{ -if(msg->conn->acceptmbox==SYS_MBOX_NULL){ -msg->conn->acceptmbox=sys_mbox_new(); -if(msg->conn->acceptmbox==SYS_MBOX_NULL){ -msg->conn->err=ERR_MEM; -break; -} -} -tcp_arg(msg->conn->pcb.tcp,(void*)&(msg->conn->acceptmbox)); -tcp_accept(msg->conn->pcb.tcp,accept_function); -} -break; -} -} -sys_mbox_post(msg->conn->mbox,NULL); -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_accept(structapi_msg_msg*msg) -{ -if(msg->conn->pcb.tcp!=NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -DEBUGF(API_MSG_DEBUG,("api_msg:acceptUDP:cannotacceptforUDP.\n")); -break; -caseNETCONN_TCP: -break; -} -} -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_send(structapi_msg_msg*msg) -{ -if(msg->conn->pcb.tcp!=NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -udp_send(msg->conn->pcb.udp,msg->msg.p); -break; -caseNETCONN_TCP: -break; -} -} -sys_mbox_post(msg->conn->mbox,NULL); -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_recv(structapi_msg_msg*msg) -{ -if(msg->conn->pcb.tcp!=NULL){ -if(msg->conn->type==NETCONN_TCP){ -tcp_recved(msg->conn->pcb.tcp,msg->msg.len); + +if(sys_mbox_trypost(&conn->recvmbox,p)!=ERR_OK){ +/*don'tdeallocatep:itispresentedtouslateragainfromtcp_fasttmr!*/ +returnERR_MEM; +}else{ +#ifLWIP_SO_RCVBUF +SYS_ARCH_INC(conn->recv_avail,len); +#endif/*LWIP_SO_RCVBUF*/ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,len); +} + +returnERR_OK; +} + +staticerr_t +poll_tcp(void*arg,structtcp_pcb*pcb) +{ +structnetconn*conn=(structnetconn*)arg; + +LWIP_UNUSED_ARG(pcb); +LWIP_ASSERT("conn!=NULL",(conn!=NULL)); + +if(conn->state==NETCONN_WRITE){ +lwip_netconn_do_writemore(connWRITE_DELAYED); +}elseif(conn->state==NETCONN_CLOSE){ +#if!LWIP_SO_SNDTIMEO&&!LWIP_SO_LINGER +if(conn->current_msg&&conn->current_msg->msg.sd.polls_left){ +conn->current_msg->msg.sd.polls_left--; +} +#endif/*!LWIP_SO_SNDTIMEO&&!LWIP_SO_LINGER*/ +lwip_netconn_do_close_internal(connWRITE_DELAYED); +} +/*@todo:implementconnecttimeouthere?*/ + +/*Didanonblockingwritefailbefore?Thencheckavailablewrite-space.*/ +if(conn->flags&NETCONN_FLAG_CHECK_WRITESPACE){ +/*Ifthequeuedbyte-orpbuf-countdropsbelowtheconfiguredlow-waterlimit, +letselectmarkthispcbaswritableagain.*/ +if((conn->pcb.tcp!=NULL)&&(tcp_sndbuf(conn->pcb.tcp)>TCP_SNDLOWAT)&& +(tcp_sndqueuelen(conn->pcb.tcp)<TCP_SNDQUEUELOWAT)){ +conn->flags&=~NETCONN_FLAG_CHECK_WRITESPACE; +API_EVENT(conn,NETCONN_EVT_SENDPLUS,0); +} +} + +returnERR_OK; +} + +staticerr_t +sent_tcp(void*arg,structtcp_pcb*pcb,u16_tlen) +{ +structnetconn*conn=(structnetconn*)arg; + +LWIP_UNUSED_ARG(pcb); +LWIP_ASSERT("conn!=NULL",(conn!=NULL)); + +if(conn){ +if(conn->state==NETCONN_WRITE){ +lwip_netconn_do_writemore(connWRITE_DELAYED); +}elseif(conn->state==NETCONN_CLOSE){ +lwip_netconn_do_close_internal(connWRITE_DELAYED); +} + +/*Ifthequeuedbyte-orpbuf-countdropsbelowtheconfiguredlow-waterlimit, +letselectmarkthispcbaswritableagain.*/ +if((conn->pcb.tcp!=NULL)&&(tcp_sndbuf(conn->pcb.tcp)>TCP_SNDLOWAT)&& +(tcp_sndqueuelen(conn->pcb.tcp)<TCP_SNDQUEUELOWAT)){ +conn->flags&=~NETCONN_FLAG_CHECK_WRITESPACE; +API_EVENT(conn,NETCONN_EVT_SENDPLUS,len); +} +} + +returnERR_OK; +} + +staticvoid +err_tcp(void*arg,err_terr) +{ +structnetconn*conn; +enumnetconn_stateold_state; + +conn=(structnetconn*)arg; +LWIP_ASSERT("conn!=NULL",(conn!=NULL)); + +conn->pcb.tcp=NULL; + +/*resetconn->statenowbeforewakingupotherthreads*/ +old_state=conn->state; +conn->state=NETCONN_NONE; + +if(old_state==NETCONN_CLOSE){ +/*RSTduringclose:letclosereturnsuccess&deallocthenetconn*/ +err=ERR_OK; +NETCONN_SET_SAFE_ERR(conn,ERR_OK); +}else{ +/*nochecksincethisisalwaysfatal!*/ +SYS_ARCH_SET(conn->last_err,err); +} + +/*@todo:thetypeofNETCONN_EVTcreatedshoulddependon'old_state'*/ + +/*Notifytheuserlayeraboutaconnectionerror.Usedtosignalselect.*/ +API_EVENT(conn,NETCONN_EVT_ERROR,0); +/*Trytoreleaseselectspendingon'read'or'write',too. +Theywillgetanerroriftheyactuallytrytoreadorwrite.*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,0); +API_EVENT(conn,NETCONN_EVT_SENDPLUS,0); + +/*passNULL-messagetorecvmboxtowakeuppendingrecv*/ +if(sys_mbox_valid(&conn->recvmbox)){ +/*usetryposttopreventdeadlock*/ +sys_mbox_trypost(&conn->recvmbox,NULL); +} +/*passNULL-messagetoacceptmboxtowakeuppendingaccept*/ +if(sys_mbox_valid(&conn->acceptmbox)){ +/*usetryposttoprevendeadlock*/ +sys_mbox_trypost(&conn->acceptmbox,NULL); +} + +if((old_state==NETCONN_WRITE)||(old_state==NETCONN_CLOSE)|| +(old_state==NETCONN_CONNECT)){ +/*callinglwip_netconn_do_writemore/lwip_netconn_do_close_internalisnotnecessary +sincethepcbhasalreadybeendeleted!*/ +intwas_nonblocking_connect=IN_NONBLOCKING_CONNECT(conn); +SET_NONBLOCKING_CONNECT(conn,0); + +if(!was_nonblocking_connect){ +sys_sem_t*op_completed_sem; +/*seterrorreturncode*/ +LWIP_ASSERT("conn->current_msg!=NULL",conn->current_msg!=NULL); +conn->current_msg->err=err; +op_completed_sem=LWIP_API_MSG_SEM(conn->current_msg); +LWIP_ASSERT("inavlidop_completed_sem",sys_sem_valid(op_completed_sem)); +conn->current_msg=NULL; +/*wakeupthewaitingtask*/ +NETCONN_SET_SAFE_ERR(conn,err); +sys_sem_signal(op_completed_sem); } -} -sys_mbox_post(msg->conn->mbox,NULL); -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_write(structapi_msg_msg*msg) -{ -err_terr; -if(msg->conn->pcb.tcp!=NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -msg->conn->err=ERR_VAL; -break; -caseNETCONN_TCP: -err=tcp_write(msg->conn->pcb.tcp,msg->msg.w.dataptr, -msg->msg.w.len,msg->msg.w.copy); -/*ThisistheNaglealgorithm:inhibitthesendingofnewTCP -segmentswhennewoutgoingdataarrivesfromtheuserifany -previouslytransmitteddataontheconnectionremains -unacknowledged.*/ -if(err==ERR_OK&&msg->conn->pcb.tcp->unacked==NULL){ -tcp_output(msg->conn->pcb.tcp); -} -msg->conn->err=err; -break; -} -} -sys_mbox_post(msg->conn->mbox,NULL); -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -do_close(structapi_msg_msg*msg) -{ -err_terr; -if(msg->conn->pcb.tcp!=NULL){ -switch(msg->conn->type){ -caseNETCONN_UDPLITE: -/*FALLTHROUGH*/ -caseNETCONN_UDPNOCHKSUM: -/*FALLTHROUGH*/ -caseNETCONN_UDP: -break; -caseNETCONN_TCP: -if(msg->conn->pcb.tcp->state==LISTEN){ -err=tcp_close(msg->conn->pcb.tcp); -}else{ -err=tcp_close(msg->conn->pcb.tcp); -} -msg->conn->err=err; -break; -} -} -sys_mbox_post(msg->conn->mbox,NULL); -} -/*-----------------------------------------------------------------------------------*/ -typedefvoid(*api_msg_decode)(structapi_msg_msg*msg); -staticapi_msg_decodedecode[API_MSG_MAX]={ -do_newconn, -do_delconn, -do_bind, -do_connect, -do_listen, -do_accept, -do_send, -do_recv, -do_write, -do_close -}; -void -api_msg_input(structapi_msg*msg) -{ -decode[msg->type](&(msg->msg)); -} -/*-----------------------------------------------------------------------------------*/ -void -api_msg_post(structapi_msg*msg) -{ -tcpip_apimsg(msg); -} -/*-----------------------------------------------------------------------------------*/ - - +}else{ +LWIP_ASSERT("conn->current_msg==NULL",conn->current_msg==NULL); +} +} + +staticvoid +setup_tcp(structnetconn*conn) +{ +structtcp_pcb*pcb; + +pcb=conn->pcb.tcp; +tcp_arg(pcb,conn); +tcp_recv(pcb,recv_tcp); +tcp_sent(pcb,sent_tcp); +tcp_poll(pcb,poll_tcp,NETCONN_TCP_POLL_INTERVAL); +tcp_err(pcb,err_tcp); +} + +staticerr_t +accept_function(void*arg,structtcp_pcb*newpcb,err_terr) +{ +structnetconn*newconn; +structnetconn*conn=(structnetconn*)arg; + +if(conn==NULL){ +returnERR_VAL; +} +if(!sys_mbox_valid(&conn->acceptmbox)){ +LWIP_DEBUGF(API_MSG_DEBUG,("accept_function:acceptmboxalreadydeleted\n")); +returnERR_VAL; +} + +if(newpcb==NULL){ +/*out-of-pcbsduringconnect:passonthiserrortotheapplication*/ +if(sys_mbox_trypost(&conn->acceptmbox,&netconn_aborted)==ERR_OK){ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,0); +} +returnERR_VAL; +} + +LWIP_DEBUGF(API_MSG_DEBUG,("accept_function:newpcb->tate:%s\n",tcp_debug_state_str(newpcb->state))); + +/*Wehavetosetthecallbackhereeventhough +*thenewsocketisunknown.newconn->socketismarkedas-1.*/ +newconn=netconn_alloc(conn->type,conn->callback); +if(newconn==NULL){ +/*outofnetconns:passonthiserrortotheapplication*/ +if(sys_mbox_trypost(&conn->acceptmbox,&netconn_aborted)==ERR_OK){ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,0); +} +returnERR_MEM; +} +newconn->pcb.tcp=newpcb; +setup_tcp(newconn); +/*noprotection:whencreatingthepcb,thenetconnisnotyetknown +totheapplicationthread*/ +newconn->last_err=err; + +/*handlebacklogcounter*/ +tcp_backlog_delayed(newpcb); + +if(sys_mbox_trypost(&conn->acceptmbox,newconn)!=ERR_OK){ +/*Whenreturning!=ERR_OK,thepcbisabortedintcp_process(), +sodonothinghere!*/ +/*removeallreferencestothisnetconnfromthepcb*/ +structtcp_pcb*pcb=newconn->pcb.tcp; +tcp_arg(pcb,NULL); +tcp_recv(pcb,NULL); +tcp_sent(pcb,NULL); +tcp_poll(pcb,NULL,0); +tcp_err(pcb,NULL); +/*removereferencefromtothepcbfromthisnetconn*/ +newconn->pcb.tcp=NULL; +/*noneedtodrainsinceweknowtherecvmboxisempty.*/ +sys_mbox_free(&newconn->recvmbox); +sys_mbox_set_invalid(&newconn->recvmbox); +netconn_free(newconn); +returnERR_MEM; +}else{ +/*Registereventwithcallback*/ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,0); +} + +returnERR_OK; +} +#endif/*LWIP_TCP*/ + +staticvoid +pcb_new(structapi_msg*msg) +{ +enumlwip_ip_addr_typeiptype=IPADDR_TYPE_V4; + +LWIP_ASSERT("pcb_new:pcbalreadyallocated",msg->conn->pcb.tcp==NULL); + +#ifLWIP_IPV6&&LWIP_IPV4 +/*IPv6:Dual-stackbydefault,unlessnetconn_set_ipv6only()iscalled*/ +if(NETCONNTYPE_ISIPV6(netconn_type(msg->conn))){ +iptype=IPADDR_TYPE_ANY; +} +#endif + +/*AllocateaPCBforthisconnection*/ +switch(NETCONNTYPE_GROUP(msg->conn->type)){ +#ifLWIP_RAW +caseNETCONN_RAW: +msg->conn->pcb.raw=raw_new_ip_type(iptype,msg->msg.n.proto); +if(msg->conn->pcb.raw!=NULL){ +#ifLWIP_IPV6 +/*ICMPv6packetsshouldalwayshavechecksumcalculatedbythestackasperRFC3542chapter3.1*/ +if(NETCONNTYPE_ISIPV6(msg->conn->type)&&msg->conn->pcb.raw->protocol==IP6_NEXTH_ICMP6){ +msg->conn->pcb.raw->chksum_reqd=1; +msg->conn->pcb.raw->chksum_offset=2; +} +#endif/*LWIP_IPV6*/ +raw_recv(msg->conn->pcb.raw,recv_raw,msg->conn); +} +break; +#endif/*LWIP_RAW*/ +#ifLWIP_UDP +caseNETCONN_UDP: +msg->conn->pcb.udp=udp_new_ip_type(iptype); +if(msg->conn->pcb.udp!=NULL){ +#ifLWIP_UDPLITE +if(NETCONNTYPE_ISUDPLITE(msg->conn->type)){ +udp_setflags(msg->conn->pcb.udp,UDP_FLAGS_UDPLITE); +} +#endif/*LWIP_UDPLITE*/ +if(NETCONNTYPE_ISUDPNOCHKSUM(msg->conn->type)){ +udp_setflags(msg->conn->pcb.udp,UDP_FLAGS_NOCHKSUM); +} +udp_recv(msg->conn->pcb.udp,recv_udp,msg->conn); +} +break; +#endif/*LWIP_UDP*/ +#ifLWIP_TCP +caseNETCONN_TCP: +msg->conn->pcb.tcp=tcp_new_ip_type(iptype); +if(msg->conn->pcb.tcp!=NULL){ +setup_tcp(msg->conn); +} +break; +#endif/*LWIP_TCP*/ +default: +/*Unsupportednetconntype,e.g.protocoldisabled*/ +msg->err=ERR_VAL; +return; +} +if(msg->conn->pcb.ip==NULL){ +msg->err=ERR_MEM; +} +} + +void +lwip_netconn_do_newconn(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +msg->err=ERR_OK; +if(msg->conn->pcb.tcp==NULL){ +pcb_new(msg); +} +/*Else?This"new"connectionalreadyhasaPCBallocated.*/ +/*Isthisanerrorcondition?Shoulditbedeleted?*/ +/*Wecurrentlyjustarehappyandreturn.*/ + +TCPIP_APIMSG_ACK(msg); +} + +structnetconn* +netconn_alloc(enumnetconn_typet,netconn_callbackcallback) +{ +structnetconn*conn; +intsize; + +conn=(structnetconn*)memp_malloc(MEMP_NETCONN); +if(conn==NULL){ +returnNULL; +} + +conn->last_err=ERR_OK; +conn->type=t; +conn->pcb.tcp=NULL; + +/*Ifallsizesarethesame,everycompilershouldoptimizethisswitchtonothing*/ +switch(NETCONNTYPE_GROUP(t)){ +#ifLWIP_RAW +caseNETCONN_RAW: +size=DEFAULT_RAW_RECVMBOX_SIZE; +break; +#endif/*LWIP_RAW*/ +#ifLWIP_UDP +caseNETCONN_UDP: +size=DEFAULT_UDP_RECVMBOX_SIZE; +break; +#endif/*LWIP_UDP*/ +#ifLWIP_TCP +caseNETCONN_TCP: +size=DEFAULT_TCP_RECVMBOX_SIZE; +break; +#endif/*LWIP_TCP*/ +default: +LWIP_ASSERT("netconn_alloc:undefinednetconn_type",0); +gotofree_and_return; +} + +if(sys_mbox_new(&conn->recvmbox,size)!=ERR_OK){ +gotofree_and_return; +} +#if!LWIP_NETCONN_SEM_PER_THREAD +if(sys_sem_new(&conn->op_completed,0)!=ERR_OK){ +sys_mbox_free(&conn->recvmbox); +gotofree_and_return; +} +#endif + +#ifLWIP_TCP +sys_mbox_set_invalid(&conn->acceptmbox); +#endif +conn->state=NETCONN_NONE; +#ifLWIP_SOCKET +/*initializesocketto-1since0isavalidsocket*/ +conn->socket=-1; +#endif/*LWIP_SOCKET*/ +conn->callback=callback; +#ifLWIP_TCP +conn->current_msg=NULL; +conn->write_offset=0; +#endif/*LWIP_TCP*/ +#ifLWIP_SO_SNDTIMEO +conn->send_timeout=0; +#endif/*LWIP_SO_SNDTIMEO*/ +#ifLWIP_SO_RCVTIMEO +conn->recv_timeout=0; +#endif/*LWIP_SO_RCVTIMEO*/ +#ifLWIP_SO_RCVBUF +conn->recv_bufsize=RECV_BUFSIZE_DEFAULT; +conn->recv_avail=0; +#endif/*LWIP_SO_RCVBUF*/ +#ifLWIP_SO_LINGER +conn->linger=-1; +#endif/*LWIP_SO_LINGER*/ +conn->flags=0; +returnconn; +free_and_return: +memp_free(MEMP_NETCONN,conn); +returnNULL; +} + +void +netconn_free(structnetconn*conn) +{ +LWIP_ASSERT("PCBmustbedeallocatedoutsidethisfunction",conn->pcb.tcp==NULL); +LWIP_ASSERT("recvmboxmustbedeallocatedbeforecallingthisfunction", +!sys_mbox_valid(&conn->recvmbox)); +#ifLWIP_TCP +LWIP_ASSERT("acceptmboxmustbedeallocatedbeforecallingthisfunction", +!sys_mbox_valid(&conn->acceptmbox)); +#endif/*LWIP_TCP*/ + +#if!LWIP_NETCONN_SEM_PER_THREAD +sys_sem_free(&conn->op_completed); +sys_sem_set_invalid(&conn->op_completed); +#endif + +memp_free(MEMP_NETCONN,conn); +} + +staticvoid +netconn_drain(structnetconn*conn) +{ +void*mem; +#ifLWIP_TCP +structpbuf*p; +#endif/*LWIP_TCP*/ + +/*Thisrunsintcpip_thread,sowedon'tneedtolockagainstrxpackets*/ + +/*Deleteanddraintherecvmbox.*/ +if(sys_mbox_valid(&conn->recvmbox)){ +while(sys_mbox_tryfetch(&conn->recvmbox,&mem)!=SYS_MBOX_EMPTY){ +#ifLWIP_TCP +if(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP){ +if(mem!=NULL){ +p=(structpbuf*)mem; +/*pcbmightbesettoNULLalreadybyerr_tcp()*/ +if(conn->pcb.tcp!=NULL){ +tcp_recved(conn->pcb.tcp,p->tot_len); +} +pbuf_free(p); +} +}else +#endif/*LWIP_TCP*/ +{ +netbuf_delete((structnetbuf*)mem); +} +} +sys_mbox_free(&conn->recvmbox); +sys_mbox_set_invalid(&conn->recvmbox); +} + +/*Deleteanddraintheacceptmbox.*/ +#ifLWIP_TCP +if(sys_mbox_valid(&conn->acceptmbox)){ +while(sys_mbox_tryfetch(&conn->acceptmbox,&mem)!=SYS_MBOX_EMPTY){ +if(mem!=&netconn_aborted){ +structnetconn*newconn=(structnetconn*)mem; +/*Onlytcppcbshaveanacceptmbox,sononeedtocheckconn->type*/ +/*pcbmightbesettoNULLalreadybyerr_tcp()*/ +/*drainrecvmbox*/ +netconn_drain(newconn); +if(newconn->pcb.tcp!=NULL){ +tcp_abort(newconn->pcb.tcp); +newconn->pcb.tcp=NULL; +} +netconn_free(newconn); +} +} +sys_mbox_free(&conn->acceptmbox); +sys_mbox_set_invalid(&conn->acceptmbox); +} +#endif/*LWIP_TCP*/ +} + +#ifLWIP_TCP + +staticerr_t +lwip_netconn_do_close_internal(structnetconn*connWRITE_DELAYED_PARAM) +{ +err_terr; +u8_tshut,shut_rx,shut_tx,close; +u8_tclose_finished=0; +structtcp_pcb*tpcb; +#ifLWIP_SO_LINGER +u8_tlinger_wait_required=0; +#endif/*LWIP_SO_LINGER*/ + +LWIP_ASSERT("invalidconn",(conn!=NULL)); +LWIP_ASSERT("thisisfortcpnetconnsonly",(NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP)); +LWIP_ASSERT("connmustbeinstateNETCONN_CLOSE",(conn->state==NETCONN_CLOSE)); +LWIP_ASSERT("pcbalreadyclosed",(conn->pcb.tcp!=NULL)); +LWIP_ASSERT("conn->current_msg!=NULL",conn->current_msg!=NULL); + +tpcb=conn->pcb.tcp; +shut=conn->current_msg->msg.sd.shut; +shut_rx=shut&NETCONN_SHUT_RD; +shut_tx=shut&NETCONN_SHUT_WR; +/*shuttingdownbothendsisthesameasclosing +(alsoifRDorWRsidewasshutdownbeforealready)*/ +if(shut==NETCONN_SHUT_RDWR){ +close=1; +}elseif(shut_rx&& +((tpcb->state==FIN_WAIT_1)|| +(tpcb->state==FIN_WAIT_2)|| +(tpcb->state==CLOSING))){ +close=1; +}elseif(shut_tx&&((tpcb->flags&TF_RXCLOSED)!=0)){ +close=1; +}else{ +close=0; +} + +/*Setbacksomecallbackpointers*/ +if(close){ +tcp_arg(tpcb,NULL); +} +if(tpcb->state==LISTEN){ +tcp_accept(tpcb,NULL); +}else{ +/*somecallbackshavetoberesetiftcp_closeisnotsuccessful*/ +if(shut_rx){ +tcp_recv(tpcb,NULL); +tcp_accept(tpcb,NULL); +} +if(shut_tx){ +tcp_sent(tpcb,NULL); +} +if(close){ +tcp_poll(tpcb,NULL,0); +tcp_err(tpcb,NULL); +} +} +/*Trytoclosetheconnection*/ +if(close){ +#ifLWIP_SO_LINGER +/*checklingerpossibilitesbeforecallingtcp_close*/ +err=ERR_OK; +/*lingerenabled/requiredatall?(i.e.isthereuntransmitteddataleft?)*/ +if((conn->linger>=0)&&(conn->pcb.tcp->unsent||conn->pcb.tcp->unacked)){ +if((conn->linger==0)){ +/*dataleftbutlingerpreventswaiting*/ +tcp_abort(tpcb); +tpcb=NULL; +}elseif(conn->linger>0){ +/*dataleftandlingersaysweshouldwait*/ +if(netconn_is_nonblocking(conn)){ +/*dataleftonanonblockingnetconn->cannotlinger*/ +err=ERR_WOULDBLOCK; +}elseif((s32_t)(sys_now()-conn->current_msg->msg.sd.time_started)>= +(conn->linger*1000)){ +/*dataleftbutlingertimeouthasexpired(thishappensonfurther +callstothisfunctionthroughpoll_tcp*/ +tcp_abort(tpcb); +tpcb=NULL; +}else{ +/*dataleft->needtowaitforACKaftersuccessfulclose*/ +linger_wait_required=1; +} +} +} +if((err==ERR_OK)&&(tpcb!=NULL)) +#endif/*LWIP_SO_LINGER*/ +{ +err=tcp_close(tpcb); +} +}else{ +err=tcp_shutdown(tpcb,shut_rx,shut_tx); +} +if(err==ERR_OK){ +close_finished=1; +#ifLWIP_SO_LINGER +if(linger_wait_required){ +/*waitforACKofallunsent/unackeddatabyjustgettingcalledagain*/ +close_finished=0; +err=ERR_INPROGRESS; +} +#endif/*LWIP_SO_LINGER*/ +}else{ +if(err==ERR_MEM){ +/*Closingfailedbecauseofmemoryshortage,tryagainlater.Evenfor +nonblockingnetconns,wehavetowaitsincenostandardsocketapplication +ispreparedforclosefailingbecauseofresourceshortage. +Checkthetimeout:thisiskindofanlwipadditiontothestandardsockets: +wewaitforsometimewhenfailingtoallocateasegmentfortheFIN*/ +#ifLWIP_SO_SNDTIMEO||LWIP_SO_LINGER +s32_tclose_timeout=LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT; +#ifLWIP_SO_SNDTIMEO +if(conn->send_timeout>0){ +close_timeout=conn->send_timeout; +} +#endif/*LWIP_SO_SNDTIMEO*/ +#ifLWIP_SO_LINGER +if(conn->linger>=0){ +/*uselingertimeout(seconds)*/ +close_timeout=conn->linger*1000U; +} +#endif +if((s32_t)(sys_now()-conn->current_msg->msg.sd.time_started)>=close_timeout){ +#else/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +if(conn->current_msg->msg.sd.polls_left==0){ +#endif/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +close_finished=1; +if(close){ +/*inthiscase,wewanttoRSTtheconnection*/ +tcp_abort(tpcb); +err=ERR_OK; +} +} +}else{ +/*Closingfailedforanon-memoryerror:giveup*/ +close_finished=1; +} +} +if(close_finished){ +/*Closingdone(succeeded,non-memoryerror,nonblockingerrorortimeout)*/ +sys_sem_t*op_completed_sem=LWIP_API_MSG_SEM(conn->current_msg); +conn->current_msg->err=err; +conn->current_msg=NULL; +conn->state=NETCONN_NONE; +if(err==ERR_OK){ +if(close){ +/*Setbacksomecallbackpointersasconnisgoingaway*/ +conn->pcb.tcp=NULL; +/*Triggerselect()insocketlayer.Makesureeverybodynoticesactivity +ontheconnection,errorfirst!*/ +API_EVENT(conn,NETCONN_EVT_ERROR,0); +} +if(shut_rx){ +API_EVENT(conn,NETCONN_EVT_RCVPLUS,0); +} +if(shut_tx){ +API_EVENT(conn,NETCONN_EVT_SENDPLUS,0); +} +} +NETCONN_SET_SAFE_ERR(conn,err); +#ifLWIP_TCPIP_CORE_LOCKING +if(delayed) +#endif +{ +/*wakeuptheapplicationtask*/ +sys_sem_signal(op_completed_sem); +} +returnERR_OK; +} +if(!close_finished){ +/*Closingfailedandwewanttowait:restoresomeofthecallbacks*/ +/*Closingoflistenpcbwillneverfail!*/ +LWIP_ASSERT("Closingalistenpcbmaynotfail!",(tpcb->state!=LISTEN)); +if(shut_tx){ +tcp_sent(tpcb,sent_tcp); +} +/*whenwaitingforclose,setuppollintervalto500ms*/ +tcp_poll(tpcb,poll_tcp,1); +tcp_err(tpcb,err_tcp); +tcp_arg(tpcb,conn); +/*don'trestorerecvcallback:wedon'twanttoreceiveanymoredata*/ +} +/*Ifclosingdidn'tsucceed,wegetcalledagaineither +frompoll_tcporfromsent_tcp*/ +LWIP_ASSERT("err!=ERR_OK",err!=ERR_OK); +returnerr; +} +#endif/*LWIP_TCP*/ + +void +lwip_netconn_do_delconn(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +enumnetconn_statestate=msg->conn->state; +LWIP_ASSERT("netconnstateerror",/*thisonlyhappensforTCPnetconns*/ +(state==NETCONN_NONE)||(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_TCP)); +#ifLWIP_NETCONN_FULLDUPLEX +/*Infullduplexmode,blockingwrite/connectisabortedwithERR_CLSD*/ +if(state!=NETCONN_NONE){ +if((state==NETCONN_WRITE)|| +((state==NETCONN_CONNECT)&&!IN_NONBLOCKING_CONNECT(msg->conn))){ +/*closerequested,abortrunningwrite/connect*/ +sys_sem_t*op_completed_sem; +LWIP_ASSERT("msg->conn->current_msg!=NULL",msg->conn->current_msg!=NULL); +op_completed_sem=LWIP_API_MSG_SEM(msg->conn->current_msg); +msg->conn->current_msg->err=ERR_CLSD; +msg->conn->current_msg=NULL; +msg->conn->write_offset=0; +msg->conn->state=NETCONN_NONE; +NETCONN_SET_SAFE_ERR(msg->conn,ERR_CLSD); +sys_sem_signal(op_completed_sem); +} +} +#else/*LWIP_NETCONN_FULLDUPLEX*/ +if(((state!=NETCONN_NONE)&& +(state!=NETCONN_LISTEN)&& +(state!=NETCONN_CONNECT))|| +((state==NETCONN_CONNECT)&&!IN_NONBLOCKING_CONNECT(msg->conn))){ +/*Thismeanseitherablockingwriteorblockingconnectisrunning +(nonblockingwritereturnsandsetsstatetoNONE)*/ +msg->err=ERR_INPROGRESS; +}else +#endif/*LWIP_NETCONN_FULLDUPLEX*/ +{ +LWIP_ASSERT("blockingconnectinprogress", +(state!=NETCONN_CONNECT)||IN_NONBLOCKING_CONNECT(msg->conn)); +msg->err=ERR_OK; +/*Drainanddeletemboxes*/ +netconn_drain(msg->conn); + +if(msg->conn->pcb.tcp!=NULL){ + +switch(NETCONNTYPE_GROUP(msg->conn->type)){ +#ifLWIP_RAW +caseNETCONN_RAW: +raw_remove(msg->conn->pcb.raw); +break; +#endif/*LWIP_RAW*/ +#ifLWIP_UDP +caseNETCONN_UDP: +msg->conn->pcb.udp->recv_arg=NULL; +udp_remove(msg->conn->pcb.udp); +break; +#endif/*LWIP_UDP*/ +#ifLWIP_TCP +caseNETCONN_TCP: +LWIP_ASSERT("alreadywritingorclosing",msg->conn->current_msg==NULL&& +msg->conn->write_offset==0); +msg->conn->state=NETCONN_CLOSE; +msg->msg.sd.shut=NETCONN_SHUT_RDWR; +msg->conn->current_msg=msg; +#ifLWIP_TCPIP_CORE_LOCKING +if(lwip_netconn_do_close_internal(msg->conn,0)!=ERR_OK){ +LWIP_ASSERT("state!",msg->conn->state==NETCONN_CLOSE); +UNLOCK_TCPIP_CORE(); +sys_arch_sem_wait(LWIP_API_MSG_SEM(msg),0); +LOCK_TCPIP_CORE(); +LWIP_ASSERT("state!",msg->conn->state==NETCONN_NONE); +} +#else/*LWIP_TCPIP_CORE_LOCKING*/ +lwip_netconn_do_close_internal(msg->conn); +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +/*API_EVENTiscalledinsidelwip_netconn_do_close_internal,beforereleasing +theapplicationthread,sowecanreturnatthispoint!*/ +return; +#endif/*LWIP_TCP*/ +default: +break; +} +msg->conn->pcb.tcp=NULL; +} +/*tcpnetconnsdon'tcomehere!*/ + +/*@todo:thisletsselectmakethesocketreadableandwritable, +whichiswrong!errfdinstead?*/ +API_EVENT(msg->conn,NETCONN_EVT_RCVPLUS,0); +API_EVENT(msg->conn,NETCONN_EVT_SENDPLUS,0); +} +if(sys_sem_valid(LWIP_API_MSG_SEM(msg))){ +TCPIP_APIMSG_ACK(msg); +} +} + +void +lwip_netconn_do_bind(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(ERR_IS_FATAL(msg->conn->last_err)){ +msg->err=msg->conn->last_err; +}else{ +msg->err=ERR_VAL; +if(msg->conn->pcb.tcp!=NULL){ +switch(NETCONNTYPE_GROUP(msg->conn->type)){ +#ifLWIP_RAW +caseNETCONN_RAW: +msg->err=raw_bind(msg->conn->pcb.raw,API_EXPR_REF(msg->msg.bc.ipaddr)); +break; +#endif/*LWIP_RAW*/ +#ifLWIP_UDP +caseNETCONN_UDP: +msg->err=udp_bind(msg->conn->pcb.udp,API_EXPR_REF(msg->msg.bc.ipaddr),msg->msg.bc.port); +break; +#endif/*LWIP_UDP*/ +#ifLWIP_TCP +caseNETCONN_TCP: +msg->err=tcp_bind(msg->conn->pcb.tcp,API_EXPR_REF(msg->msg.bc.ipaddr),msg->msg.bc.port); +break; +#endif/*LWIP_TCP*/ +default: +break; +} +} +} +TCPIP_APIMSG_ACK(msg); +} + +#ifLWIP_TCP + +staticerr_t +lwip_netconn_do_connected(void*arg,structtcp_pcb*pcb,err_terr) +{ +structnetconn*conn; +intwas_blocking; +sys_sem_t*op_completed_sem=NULL; + +LWIP_UNUSED_ARG(pcb); + +conn=(structnetconn*)arg; + +if(conn==NULL){ +returnERR_VAL; +} + +LWIP_ASSERT("conn->state==NETCONN_CONNECT",conn->state==NETCONN_CONNECT); +LWIP_ASSERT("(conn->current_msg!=NULL)||conn->in_non_blocking_connect", +(conn->current_msg!=NULL)||IN_NONBLOCKING_CONNECT(conn)); + +if(conn->current_msg!=NULL){ +conn->current_msg->err=err; +op_completed_sem=LWIP_API_MSG_SEM(conn->current_msg); +} +if((NETCONNTYPE_GROUP(conn->type)==NETCONN_TCP)&&(err==ERR_OK)){ +setup_tcp(conn); +} +was_blocking=!IN_NONBLOCKING_CONNECT(conn); +SET_NONBLOCKING_CONNECT(conn,0); +LWIP_ASSERT("blockingconnectstateerror", +(was_blocking&&op_completed_sem!=NULL)|| +(!was_blocking&&op_completed_sem==NULL)); +conn->current_msg=NULL; +conn->state=NETCONN_NONE; +NETCONN_SET_SAFE_ERR(conn,ERR_OK); +API_EVENT(conn,NETCONN_EVT_SENDPLUS,0); + +if(was_blocking){ +sys_sem_signal(op_completed_sem); +} +returnERR_OK; +} +#endif/*LWIP_TCP*/ + +void +lwip_netconn_do_connect(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(msg->conn->pcb.tcp==NULL){ +/*Thismayhappenwhencallingnetconn_connect()asecondtime*/ +msg->err=ERR_CLSD; +}else{ +switch(NETCONNTYPE_GROUP(msg->conn->type)){ +#ifLWIP_RAW +caseNETCONN_RAW: +msg->err=raw_connect(msg->conn->pcb.raw,API_EXPR_REF(msg->msg.bc.ipaddr)); +break; +#endif/*LWIP_RAW*/ +#ifLWIP_UDP +caseNETCONN_UDP: +msg->err=udp_connect(msg->conn->pcb.udp,API_EXPR_REF(msg->msg.bc.ipaddr),msg->msg.bc.port); +break; +#endif/*LWIP_UDP*/ +#ifLWIP_TCP +caseNETCONN_TCP: +/*Preventconnectwhiledoinganyotheraction.*/ +if(msg->conn->state==NETCONN_CONNECT){ +msg->err=ERR_ALREADY; +}elseif(msg->conn->state!=NETCONN_NONE){ +msg->err=ERR_ISCONN; +}else{ +setup_tcp(msg->conn); +msg->err=tcp_connect(msg->conn->pcb.tcp,API_EXPR_REF(msg->msg.bc.ipaddr), +msg->msg.bc.port,lwip_netconn_do_connected); +if(msg->err==ERR_OK){ +u8_tnon_blocking=netconn_is_nonblocking(msg->conn); +msg->conn->state=NETCONN_CONNECT; +SET_NONBLOCKING_CONNECT(msg->conn,non_blocking); +if(non_blocking){ +msg->err=ERR_INPROGRESS; +}else{ +msg->conn->current_msg=msg; +/*sys_sem_signal()iscalledfromlwip_netconn_do_connected(orerr_tcp()), +whentheconnectionisestablished!*/ +#ifLWIP_TCPIP_CORE_LOCKING +LWIP_ASSERT("state!",msg->conn->state==NETCONN_CONNECT); +UNLOCK_TCPIP_CORE(); +sys_arch_sem_wait(LWIP_API_MSG_SEM(msg),0); +LOCK_TCPIP_CORE(); +LWIP_ASSERT("state!",msg->conn->state!=NETCONN_CONNECT); +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +return; +} +} +} +break; +#endif/*LWIP_TCP*/ +default: +LWIP_ERROR("Invalidnetconntype",0,do{msg->err=ERR_VAL;}while(0)); +break; +} +} +/*Forallotherprotocols,netconn_connect()callsTCPIP_APIMSG(), +souseTCPIP_APIMSG_ACK()here.*/ +TCPIP_APIMSG_ACK(msg); +} + +void +lwip_netconn_do_disconnect(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +#ifLWIP_UDP +if(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_UDP){ +udp_disconnect(msg->conn->pcb.udp); +msg->err=ERR_OK; +}else +#endif/*LWIP_UDP*/ +{ +msg->err=ERR_VAL; +} +TCPIP_APIMSG_ACK(msg); +} + +#ifLWIP_TCP + +void +lwip_netconn_do_listen(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(ERR_IS_FATAL(msg->conn->last_err)){ +msg->err=msg->conn->last_err; +}else{ +msg->err=ERR_CONN; +if(msg->conn->pcb.tcp!=NULL){ +if(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_TCP){ +if(msg->conn->state==NETCONN_NONE){ +structtcp_pcb*lpcb; +if(msg->conn->pcb.tcp->state!=CLOSED){ +/*connectionisnotclosed,cannotlisten*/ +msg->err=ERR_VAL; +}else{ +err_terr; +u8_tbacklog; +#ifTCP_LISTEN_BACKLOG +backlog=msg->msg.lb.backlog; +#else/*TCP_LISTEN_BACKLOG*/ +backlog=TCP_DEFAULT_LISTEN_BACKLOG; +#endif/*TCP_LISTEN_BACKLOG*/ +#ifLWIP_IPV4&&LWIP_IPV6 +/*"SocketAPIlike"dual-stacksupport:IfIPtolistentoisIP6_ADDR_ANY, +*andNETCONN_FLAG_IPV6_V6ONLYisNOTset,useIP_ANY_TYPEtolisten +*/ +if(ip_addr_cmp(&msg->conn->pcb.ip->local_ip,IP6_ADDR_ANY)&& +(netconn_get_ipv6only(msg->conn)==0)){ +/*changePCBtypetoIPADDR_TYPE_ANY*/ +IP_SET_TYPE_VAL(msg->conn->pcb.tcp->local_ip,IPADDR_TYPE_ANY); +IP_SET_TYPE_VAL(msg->conn->pcb.tcp->remote_ip,IPADDR_TYPE_ANY); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +lpcb=tcp_listen_with_backlog_and_err(msg->conn->pcb.tcp,backlog,&err); + +if(lpcb==NULL){ +/*inthiscase,theoldpcbisstillallocated*/ +msg->err=err; +}else{ +/*deletetherecvmboxandallocatetheacceptmbox*/ +if(sys_mbox_valid(&msg->conn->recvmbox)){ +sys_mbox_free(&msg->conn->recvmbox); +sys_mbox_set_invalid(&msg->conn->recvmbox); +} +msg->err=ERR_OK; +if(!sys_mbox_valid(&msg->conn->acceptmbox)){ +msg->err=sys_mbox_new(&msg->conn->acceptmbox,DEFAULT_ACCEPTMBOX_SIZE); +} +if(msg->err==ERR_OK){ +msg->conn->state=NETCONN_LISTEN; +msg->conn->pcb.tcp=lpcb; +tcp_arg(msg->conn->pcb.tcp,msg->conn); +tcp_accept(msg->conn->pcb.tcp,accept_function); +}else{ +/*sincetheoldpcbisalreadydeallocated,freelpcbnow*/ +tcp_close(lpcb); +msg->conn->pcb.tcp=NULL; +} +} +} +}elseif(msg->conn->state==NETCONN_LISTEN){ +/*alreadylistening,allowupdatingofthebacklog*/ +msg->err=ERR_OK; +tcp_backlog_set(msg->conn->pcb.tcp,msg->msg.lb.backlog); +} +}else{ +msg->err=ERR_ARG; +} +} +} +TCPIP_APIMSG_ACK(msg); +} +#endif/*LWIP_TCP*/ + +void +lwip_netconn_do_send(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(ERR_IS_FATAL(msg->conn->last_err)){ +msg->err=msg->conn->last_err; +}else{ +msg->err=ERR_CONN; +if(msg->conn->pcb.tcp!=NULL){ +switch(NETCONNTYPE_GROUP(msg->conn->type)){ +#ifLWIP_RAW +caseNETCONN_RAW: +if(ip_addr_isany(&msg->msg.b->addr)||IP_IS_ANY_TYPE_VAL(msg->msg.b->addr)){ +msg->err=raw_send(msg->conn->pcb.raw,msg->msg.b->p); +}else{ +msg->err=raw_sendto(msg->conn->pcb.raw,msg->msg.b->p,&msg->msg.b->addr); +} +break; +#endif +#ifLWIP_UDP +caseNETCONN_UDP: +#ifLWIP_CHECKSUM_ON_COPY +if(ip_addr_isany(&msg->msg.b->addr)||IP_IS_ANY_TYPE_VAL(msg->msg.b->addr)){ +msg->err=udp_send_chksum(msg->conn->pcb.udp,msg->msg.b->p, +msg->msg.b->flags&NETBUF_FLAG_CHKSUM,msg->msg.b->toport_chksum); +}else{ +msg->err=udp_sendto_chksum(msg->conn->pcb.udp,msg->msg.b->p, +&msg->msg.b->addr,msg->msg.b->port, +msg->msg.b->flags&NETBUF_FLAG_CHKSUM,msg->msg.b->toport_chksum); +} +#else/*LWIP_CHECKSUM_ON_COPY*/ +if(ip_addr_isany_val(msg->msg.b->addr)||IP_IS_ANY_TYPE_VAL(msg->msg.b->addr)){ +msg->err=udp_send(msg->conn->pcb.udp,msg->msg.b->p); +}else{ +msg->err=udp_sendto(msg->conn->pcb.udp,msg->msg.b->p,&msg->msg.b->addr,msg->msg.b->port); +} +#endif/*LWIP_CHECKSUM_ON_COPY*/ +break; +#endif/*LWIP_UDP*/ +default: +break; +} +} +} +TCPIP_APIMSG_ACK(msg); +} + +#ifLWIP_TCP + +void +lwip_netconn_do_recv(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +msg->err=ERR_OK; +if(msg->conn->pcb.tcp!=NULL){ +if(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_TCP){ +u32_tremaining=msg->msg.r.len; +do{ +u16_trecved=(remaining>0xffff)?0xffff:(u16_t)remaining; +tcp_recved(msg->conn->pcb.tcp,recved); +remaining-=recved; +}while(remaining!=0); +} +} +TCPIP_APIMSG_ACK(msg); +} + +#ifTCP_LISTEN_BACKLOG + +void +lwip_netconn_do_accepted(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +msg->err=ERR_OK; +if(msg->conn->pcb.tcp!=NULL){ +if(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_TCP){ +tcp_backlog_accepted(msg->conn->pcb.tcp); +} +} +TCPIP_APIMSG_ACK(msg); +} +#endif/*TCP_LISTEN_BACKLOG*/ + +staticerr_t +lwip_netconn_do_writemore(structnetconn*connWRITE_DELAYED_PARAM) +{ +err_terr; +constvoid*dataptr; +u16_tlen,available; +u8_twrite_finished=0; +size_tdiff; +u8_tdontblock; +u8_tapiflags; + +LWIP_ASSERT("conn!=NULL",conn!=NULL); +LWIP_ASSERT("conn->state==NETCONN_WRITE",(conn->state==NETCONN_WRITE)); +LWIP_ASSERT("conn->current_msg!=NULL",conn->current_msg!=NULL); +LWIP_ASSERT("conn->pcb.tcp!=NULL",conn->pcb.tcp!=NULL); +LWIP_ASSERT("conn->write_offset<conn->current_msg->msg.w.len", +conn->write_offset<conn->current_msg->msg.w.len); + +apiflags=conn->current_msg->msg.w.apiflags; +dontblock=netconn_is_nonblocking(conn)||(apiflags&NETCONN_DONTBLOCK); + +#ifLWIP_SO_SNDTIMEO +if((conn->send_timeout!=0)&& +((s32_t)(sys_now()-conn->current_msg->msg.w.time_started)>=conn->send_timeout)){ +write_finished=1; +if(conn->write_offset==0){ +/*nothinghasbeenwritten*/ +err=ERR_WOULDBLOCK; +conn->current_msg->msg.w.len=0; +}else{ +/*partialwrite*/ +err=ERR_OK; +conn->current_msg->msg.w.len=conn->write_offset; +conn->write_offset=0; +} +}else +#endif/*LWIP_SO_SNDTIMEO*/ +{ +dataptr=(constu8_t*)conn->current_msg->msg.w.dataptr+conn->write_offset; +diff=conn->current_msg->msg.w.len-conn->write_offset; +if(diff>0xffffUL){/*max_u16_t*/ +len=0xffff; +apiflags|=TCP_WRITE_FLAG_MORE; +}else{ +len=(u16_t)diff; +} +available=tcp_sndbuf(conn->pcb.tcp); +if(available<len){ +/*don'ttrytowritemorethansendbuf*/ +len=available; +if(dontblock){ +if(!len){ +err=ERR_WOULDBLOCK; +gotoerr_mem; +} +}else{ +apiflags|=TCP_WRITE_FLAG_MORE; +} +} +LWIP_ASSERT("lwip_netconn_do_writemore:invalidlength!",((conn->write_offset+len)<=conn->current_msg->msg.w.len)); +err=tcp_write(conn->pcb.tcp,dataptr,len,apiflags); +/*ifOKormemoryerror,checkavailablespace*/ +if((err==ERR_OK)||(err==ERR_MEM)){ +err_mem: +if(dontblock&&(len<conn->current_msg->msg.w.len)){ +/*non-blockingwritedidnotwriteeverything:markthepcbnon-writable +andletpoll_tcpcheckwritablespacetomarkthepcbwritableagain*/ +API_EVENT(conn,NETCONN_EVT_SENDMINUS,len); +conn->flags|=NETCONN_FLAG_CHECK_WRITESPACE; +}elseif((tcp_sndbuf(conn->pcb.tcp)<=TCP_SNDLOWAT)|| +(tcp_sndqueuelen(conn->pcb.tcp)>=TCP_SNDQUEUELOWAT)){ +/*Thequeuedbyte-orpbuf-countexceedstheconfiguredlow-waterlimit, +letselectmarkthispcbasnon-writable.*/ +API_EVENT(conn,NETCONN_EVT_SENDMINUS,len); +} +} + +if(err==ERR_OK){ +err_tout_err; +conn->write_offset+=len; +if((conn->write_offset==conn->current_msg->msg.w.len)||dontblock){ +/*returnsentlength*/ +conn->current_msg->msg.w.len=conn->write_offset; +/*everythingwaswritten*/ +write_finished=1; +} +out_err=tcp_output(conn->pcb.tcp); +if(ERR_IS_FATAL(out_err)||(out_err==ERR_RTE)){ +/*Iftcp_outputfailswithfatalerrorornorouteisfound, +don'ttrywritinganymorebutreturntheerror +totheapplicationthread.*/ +err=out_err; +write_finished=1; +conn->current_msg->msg.w.len=0; +} +}elseif(err==ERR_MEM){ +/*IfERR_MEM,wewaitforsent_tcporpoll_tcptobecalled. +Forblockingsockets,wedoNOTreturntotheapplication +thread,sinceERR_MEMisonlyatemporaryerror!Non-blocking +willremainnon-writableuntilsent_tcp/poll_tcpiscalled*/ + +/*tcp_writereturnedERR_MEM,trytcp_outputanyway*/ +err_tout_err=tcp_output(conn->pcb.tcp); +if(ERR_IS_FATAL(out_err)||(out_err==ERR_RTE)){ +/*Iftcp_outputfailswithfatalerrorornorouteisfound, +don'ttrywritinganymorebutreturntheerror +totheapplicationthread.*/ +err=out_err; +write_finished=1; +conn->current_msg->msg.w.len=0; +}elseif(dontblock){ +/*non-blockingwriteisdoneonERR_MEM*/ +err=ERR_WOULDBLOCK; +write_finished=1; +conn->current_msg->msg.w.len=0; +} +}else{ +/*Onerrors!=ERR_MEM,wedon'ttrywritinganymorebutreturn +theerrortotheapplicationthread.*/ +write_finished=1; +conn->current_msg->msg.w.len=0; +} +} +if(write_finished){ +/*everythingwaswritten:setbackconnectionstate +andbacktoapplicationtask*/ +sys_sem_t*op_completed_sem=LWIP_API_MSG_SEM(conn->current_msg); +conn->current_msg->err=err; +conn->current_msg=NULL; +conn->write_offset=0; +conn->state=NETCONN_NONE; +NETCONN_SET_SAFE_ERR(conn,err); +#ifLWIP_TCPIP_CORE_LOCKING +if(delayed) +#endif +{ +sys_sem_signal(op_completed_sem); +} +} +#ifLWIP_TCPIP_CORE_LOCKING +else{ +returnERR_MEM; +} +#endif +returnERR_OK; +} +#endif/*LWIP_TCP*/ + +void +lwip_netconn_do_write(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(ERR_IS_FATAL(msg->conn->last_err)){ +msg->err=msg->conn->last_err; +}else{ +if(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_TCP){ +#ifLWIP_TCP +if(msg->conn->state!=NETCONN_NONE){ +/*netconnisconnecting,closingorinblockingwrite*/ +msg->err=ERR_INPROGRESS; +}elseif(msg->conn->pcb.tcp!=NULL){ +msg->conn->state=NETCONN_WRITE; +/*setallthevariablesusedbylwip_netconn_do_writemore*/ +LWIP_ASSERT("alreadywritingorclosing",msg->conn->current_msg==NULL&& +msg->conn->write_offset==0); +LWIP_ASSERT("msg->msg.w.len!=0",msg->msg.w.len!=0); +msg->conn->current_msg=msg; +msg->conn->write_offset=0; +#ifLWIP_TCPIP_CORE_LOCKING +if(lwip_netconn_do_writemore(msg->conn,0)!=ERR_OK){ +LWIP_ASSERT("state!",msg->conn->state==NETCONN_WRITE); +UNLOCK_TCPIP_CORE(); +sys_arch_sem_wait(LWIP_API_MSG_SEM(msg),0); +LOCK_TCPIP_CORE(); +LWIP_ASSERT("state!",msg->conn->state!=NETCONN_WRITE); +} +#else/*LWIP_TCPIP_CORE_LOCKING*/ +lwip_netconn_do_writemore(msg->conn); +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +/*forbothcases:iflwip_netconn_do_writemorewascalled,don'tACKtheAPIMSG +sincelwip_netconn_do_writemoreACKsit!*/ +return; +}else{ +msg->err=ERR_CONN; +} +#else/*LWIP_TCP*/ +msg->err=ERR_VAL; +#endif/*LWIP_TCP*/ +#if(LWIP_UDP||LWIP_RAW) +}else{ +msg->err=ERR_VAL; +#endif/*(LWIP_UDP||LWIP_RAW)*/ +} +} +TCPIP_APIMSG_ACK(msg); +} + +void +lwip_netconn_do_getaddr(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(msg->conn->pcb.ip!=NULL){ +if(msg->msg.ad.local){ +ip_addr_copy(API_EXPR_DEREF(msg->msg.ad.ipaddr), +msg->conn->pcb.ip->local_ip); +}else{ +ip_addr_copy(API_EXPR_DEREF(msg->msg.ad.ipaddr), +msg->conn->pcb.ip->remote_ip); +} + +msg->err=ERR_OK; +switch(NETCONNTYPE_GROUP(msg->conn->type)){ +#ifLWIP_RAW +caseNETCONN_RAW: +if(msg->msg.ad.local){ +API_EXPR_DEREF(msg->msg.ad.port)=msg->conn->pcb.raw->protocol; +}else{ +/*returnanerrorasconnectingisonlyahelperforupperlayers*/ +msg->err=ERR_CONN; +} +break; +#endif/*LWIP_RAW*/ +#ifLWIP_UDP +caseNETCONN_UDP: +if(msg->msg.ad.local){ +API_EXPR_DEREF(msg->msg.ad.port)=msg->conn->pcb.udp->local_port; +}else{ +if((msg->conn->pcb.udp->flags&UDP_FLAGS_CONNECTED)==0){ +msg->err=ERR_CONN; +}else{ +API_EXPR_DEREF(msg->msg.ad.port)=msg->conn->pcb.udp->remote_port; +} +} +break; +#endif/*LWIP_UDP*/ +#ifLWIP_TCP +caseNETCONN_TCP: +if((msg->msg.ad.local==0)&& +((msg->conn->pcb.tcp->state==CLOSED)||(msg->conn->pcb.tcp->state==LISTEN))){ +/*pcbisnotconnectedandremotenameisrequested*/ +msg->err=ERR_CONN; +}else{ +API_EXPR_DEREF(msg->msg.ad.port)=(msg->msg.ad.local?msg->conn->pcb.tcp->local_port:msg->conn->pcb.tcp->remote_port); +} +break; +#endif/*LWIP_TCP*/ +default: +LWIP_ASSERT("invalidnetconn_type",0); +break; +} +}else{ +msg->err=ERR_CONN; +} +TCPIP_APIMSG_ACK(msg); +} + +void +lwip_netconn_do_close(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +#ifLWIP_TCP +enumnetconn_statestate=msg->conn->state; +/*FirstcheckifthisisaTCPnetconnandifitisinacorrectstate +(LISTENdoesn'tsupporthalfshutdown)*/ +if((msg->conn->pcb.tcp!=NULL)&& +(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_TCP)&& +((msg->msg.sd.shut==NETCONN_SHUT_RDWR)||(state!=NETCONN_LISTEN))){ +/*Checkifweareinaconnectedstate*/ +if(state==NETCONN_CONNECT){ +/*TCPconnectinprogress:cannotshutdown*/ +msg->err=ERR_CONN; +}elseif(state==NETCONN_WRITE){ +#ifLWIP_NETCONN_FULLDUPLEX +if(msg->msg.sd.shut&NETCONN_SHUT_WR){ +/*closerequested,abortrunningwrite*/ +sys_sem_t*write_completed_sem; +LWIP_ASSERT("msg->conn->current_msg!=NULL",msg->conn->current_msg!=NULL); +write_completed_sem=LWIP_API_MSG_SEM(msg->conn->current_msg); +msg->conn->current_msg->err=ERR_CLSD; +msg->conn->current_msg=NULL; +msg->conn->write_offset=0; +msg->conn->state=NETCONN_NONE; +state=NETCONN_NONE; +NETCONN_SET_SAFE_ERR(msg->conn,ERR_CLSD); +sys_sem_signal(write_completed_sem); +}else{ +LWIP_ASSERT("msg->msg.sd.shut==NETCONN_SHUT_RD",msg->msg.sd.shut==NETCONN_SHUT_RD); +/*Inthiscase,letthewritecontinueanddonotinterferewith +conn->current_msgorconn->state!*/ +msg->err=tcp_shutdown(msg->conn->pcb.tcp,1,0); +} +} +if(state==NETCONN_NONE){ +#else/*LWIP_NETCONN_FULLDUPLEX*/ +msg->err=ERR_INPROGRESS; +}else{ +#endif/*LWIP_NETCONN_FULLDUPLEX*/ +if(msg->msg.sd.shut&NETCONN_SHUT_RD){ +/*Drainanddeletemboxes*/ +netconn_drain(msg->conn); +} +LWIP_ASSERT("alreadywritingorclosing",msg->conn->current_msg==NULL&& +msg->conn->write_offset==0); +msg->conn->state=NETCONN_CLOSE; +msg->conn->current_msg=msg; +#ifLWIP_TCPIP_CORE_LOCKING +if(lwip_netconn_do_close_internal(msg->conn,0)!=ERR_OK){ +LWIP_ASSERT("state!",msg->conn->state==NETCONN_CLOSE); +UNLOCK_TCPIP_CORE(); +sys_arch_sem_wait(LWIP_API_MSG_SEM(msg),0); +LOCK_TCPIP_CORE(); +LWIP_ASSERT("state!",msg->conn->state==NETCONN_NONE); +} +#else/*LWIP_TCPIP_CORE_LOCKING*/ +lwip_netconn_do_close_internal(msg->conn); +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +/*fortcpnetconns,lwip_netconn_do_close_internalACKsthemessage*/ +return; +} +}else +#endif/*LWIP_TCP*/ +{ +msg->err=ERR_CONN; +} +TCPIP_APIMSG_ACK(msg); +} + +#ifLWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD) + +void +lwip_netconn_do_join_leave_group(void*m) +{ +structapi_msg*msg=(structapi_msg*)m; + +if(ERR_IS_FATAL(msg->conn->last_err)){ +msg->err=msg->conn->last_err; +}else{ +if(msg->conn->pcb.tcp!=NULL){ +if(NETCONNTYPE_GROUP(msg->conn->type)==NETCONN_UDP){ +#ifLWIP_UDP +#ifLWIP_IPV6&&LWIP_IPV6_MLD +if(NETCONNTYPE_ISIPV6(msg->conn->type)){ +if(msg->msg.jl.join_or_leave==NETCONN_JOIN){ +msg->err=mld6_joingroup(ip_2_ip6(API_EXPR_REF(msg->msg.jl.netif_addr)), +ip_2_ip6(API_EXPR_REF(msg->msg.jl.multiaddr))); +}else{ +msg->err=mld6_leavegroup(ip_2_ip6(API_EXPR_REF(msg->msg.jl.netif_addr)), +ip_2_ip6(API_EXPR_REF(msg->msg.jl.multiaddr))); +} +} +else +#endif/*LWIP_IPV6&&LWIP_IPV6_MLD*/ +{ +#ifLWIP_IGMP +if(msg->msg.jl.join_or_leave==NETCONN_JOIN){ +msg->err=igmp_joingroup(ip_2_ip4(API_EXPR_REF(msg->msg.jl.netif_addr)), +ip_2_ip4(API_EXPR_REF(msg->msg.jl.multiaddr))); +}else{ +msg->err=igmp_leavegroup(ip_2_ip4(API_EXPR_REF(msg->msg.jl.netif_addr)), +ip_2_ip4(API_EXPR_REF(msg->msg.jl.multiaddr))); +} +#endif/*LWIP_IGMP*/ +} +#endif/*LWIP_UDP*/ +#if(LWIP_TCP||LWIP_RAW) +}else{ +msg->err=ERR_VAL; +#endif/*(LWIP_TCP||LWIP_RAW)*/ +} +}else{ +msg->err=ERR_CONN; +} +} +TCPIP_APIMSG_ACK(msg); +} +#endif/*LWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD)*/ + +#ifLWIP_DNS + +staticvoid +lwip_netconn_do_dns_found(constchar*name,constip_addr_t*ipaddr,void*arg) +{ +structdns_api_msg*msg=(structdns_api_msg*)arg; + +/*wetrusttheinternalimplementationtobecorrect:-)*/ +LWIP_UNUSED_ARG(name); + +if(ipaddr==NULL){ +/*timeoutormemoryerror*/ +API_EXPR_DEREF(msg->err)=ERR_VAL; +}else{ +/*addresswasresolved*/ +API_EXPR_DEREF(msg->err)=ERR_OK; +API_EXPR_DEREF(msg->addr)=*ipaddr; +} +/*wakeuptheapplicationtaskwaitinginnetconn_gethostbyname*/ +sys_sem_signal(API_EXPR_REF_SEM(msg->sem)); +} + +void +lwip_netconn_do_gethostbyname(void*arg) +{ +structdns_api_msg*msg=(structdns_api_msg*)arg; +u8_taddrtype= +#ifLWIP_IPV4&&LWIP_IPV6 +msg->dns_addrtype; +#else +LWIP_DNS_ADDRTYPE_DEFAULT; +#endif + +API_EXPR_DEREF(msg->err)=dns_gethostbyname_addrtype(msg->name, +API_EXPR_REF(msg->addr),lwip_netconn_do_dns_found,msg,addrtype); +if(API_EXPR_DEREF(msg->err)!=ERR_INPROGRESS){ +/*onerrororimmediatesuccess,wakeuptheapplication +*taskwaitinginnetconn_gethostbyname*/ +sys_sem_signal(API_EXPR_REF_SEM(msg->sem)); +} +} +#endif/*LWIP_DNS*/ + +#endif/*LWIP_NETCONN*/ - + diff --git a/doc/xml/api__msg_8h.xml b/doc/xml/api__msg_8h.xml index c6e04eb..33f0dc7 100644 --- a/doc/xml/api__msg_8h.xml +++ b/doc/xml/api__msg_8h.xml @@ -1,519 +1,345 @@ - - - + + + api_msg.h net/opt.h - net/pbuf.h - net/sys.h - net/ipv4/ip.h - net/udp.h - net/tcp.h - net/api.h - src/sys/include/net/tcpip.h - src/sys/net/api/api_lib.c - src/sys/net/api/api_msg.c + C:/Dev/git/UbixOS/sys/net/core/memp.c - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - - - - - - - - - - - + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + - api_msg - api_msg_msg - - - api_msg_type - - API_MSG_NEWCONN - - - - - - - API_MSG_DELCONN - - - - - - - API_MSG_BIND - - - - - - - API_MSG_CONNECT - - - - - - - API_MSG_LISTEN - - - - - - - API_MSG_ACCEPT - - - - - - - API_MSG_SEND - - - - - - - API_MSG_RECV - - - - - - - API_MSG_WRITE - - - - - - - API_MSG_CLOSE - - - - - - - API_MSG_MAX - - - - - - - - - - - - - - - - - void - void api_msg_input - (struct api_msg *msg) - api_msg_input - - struct api_msg * - msg - - - - - - - - - decode - api_msg_msg::msg - tcpip_thread - - - void - void api_msg_post - (struct api_msg *msg) - api_msg_post - - struct api_msg * - msg - - - - - - - - - api_msg_msg::msg - tcpip_apimsg - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_recv - netconn_send - netconn_write - - +netconn API lwIP internal implementations (do not use in application code) -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: api__msg_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_API_MSG_H__ -#define__LWIP_API_MSG_H__ - -#include"net/opt.h" -#include"net/pbuf.h" -#include"net/sys.h" + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_API_MSG_H +#defineLWIP_HDR_API_MSG_H + +#include"net/opt.h" -#include"net/ipv4/ip.h" - -#include"net/udp.h" -#include"net/tcp.h" - -#include"net/api.h" - -enumapi_msg_type{ -API_MSG_NEWCONN, -API_MSG_DELCONN, - -API_MSG_BIND, -API_MSG_CONNECT, - -API_MSG_LISTEN, -API_MSG_ACCEPT, - -API_MSG_SEND, -API_MSG_RECV, -API_MSG_WRITE, - -API_MSG_CLOSE, - -API_MSG_MAX -}; +#ifLWIP_NETCONN||LWIP_SOCKET/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ +/*Note:NetconnAPIisalwaysavailablewhensocketsareenabled- +*socketsareimplementedontopofthem*/ + +#include"net/arch.h" +#include"net/ip_addr.h" +#include"net/err.h" +#include"net/sys.h" +#include"net/igmp.h" +#include"net/api.h" +#include"net/priv/tcpip_priv.h" + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifLWIP_MPU_COMPATIBLE +#ifLWIP_NETCONN_SEM_PER_THREAD +#defineAPI_MSG_M_DEF_SEM(m)*m +#else +#defineAPI_MSG_M_DEF_SEM(m)API_MSG_M_DEF(m) +#endif +#else/*LWIP_MPU_COMPATIBLE*/ +#defineAPI_MSG_M_DEF_SEM(m)API_MSG_M_DEF(m) +#endif/*LWIP_MPU_COMPATIBLE*/ -structapi_msg_msg{ -structnetconn*conn; -enumnetconn_typeconntype; -union{ -structpbuf*p; -struct{ -structip_addr*ipaddr; -uInt16port; -}bc; -struct{ -void*dataptr; -uInt16len; -unsignedcharcopy; -}w; -sys_mbox_tmbox; -uInt16len; -}msg; -}; - -structapi_msg{ -enumapi_msg_typetype; -structapi_msg_msgmsg; -}; - -voidapi_msg_input(structapi_msg*msg); -voidapi_msg_post(structapi_msg*msg); - -#endif/*__LWIP_API_MSG_H__*/ - +/*ForthenetconnAPI,thesevaluesareuseasabitmask!*/ +#defineNETCONN_SHUT_RD1 +#defineNETCONN_SHUT_WR2 +#defineNETCONN_SHUT_RDWR(NETCONN_SHUT_RD|NETCONN_SHUT_WR) + +/*IPaddressesandportnumbersareexpectedtobein +*thesamebyteorderasinthecorrespondingpcb. +*/ +structapi_msg{ +structnetconn*conn; +err_terr; +union{ +structnetbuf*b; +struct{ +u8_tproto; +}n; +struct{ +API_MSG_M_DEF_C(ip_addr_t,ipaddr); +u16_tport; +}bc; +struct{ +ip_addr_tAPI_MSG_M_DEF(ipaddr); +u16_tAPI_MSG_M_DEF(port); +u8_tlocal; +}ad; +struct{ +constvoid*dataptr; +size_tlen; +u8_tapiflags; +#ifLWIP_SO_SNDTIMEO +u32_ttime_started; +#endif/*LWIP_SO_SNDTIMEO*/ +}w; +struct{ +u32_tlen; +}r; +#ifLWIP_TCP + +struct{ +u8_tshut; +#ifLWIP_SO_SNDTIMEO||LWIP_SO_LINGER +u32_ttime_started; +#else/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +u8_tpolls_left; +#endif/*LWIP_SO_SNDTIMEO||LWIP_SO_LINGER*/ +}sd; +#endif/*LWIP_TCP*/ +#ifLWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD) + +struct{ +API_MSG_M_DEF_C(ip_addr_t,multiaddr); +API_MSG_M_DEF_C(ip_addr_t,netif_addr); +enumnetconn_igmpjoin_or_leave; +}jl; +#endif/*LWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD)*/ +#ifTCP_LISTEN_BACKLOG +struct{ +u8_tbacklog; +}lb; +#endif/*TCP_LISTEN_BACKLOG*/ +}msg; +#ifLWIP_NETCONN_SEM_PER_THREAD +sys_sem_t*op_completed_sem; +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ +}; + +#ifLWIP_NETCONN_SEM_PER_THREAD +#defineLWIP_API_MSG_SEM(msg)((msg)->op_completed_sem) +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +#defineLWIP_API_MSG_SEM(msg)(&(msg)->conn->op_completed) +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + + +#ifLWIP_DNS + +structdns_api_msg{ +#ifLWIP_MPU_COMPATIBLE +charname[DNS_MAX_NAME_LENGTH]; +#else/*LWIP_MPU_COMPATIBLE*/ +constchar*name; +#endif/*LWIP_MPU_COMPATIBLE*/ + +ip_addr_tAPI_MSG_M_DEF(addr); +#ifLWIP_IPV4&&LWIP_IPV6 + +u8_tdns_addrtype; +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +sys_sem_tAPI_MSG_M_DEF_SEM(sem); +err_tAPI_MSG_M_DEF(err); +}; +#endif/*LWIP_DNS*/ + +#ifLWIP_TCP +externu8_tnetconn_aborted; +#endif/*LWIP_TCP*/ + +voidlwip_netconn_do_newconn(void*m); +voidlwip_netconn_do_delconn(void*m); +voidlwip_netconn_do_bind(void*m); +voidlwip_netconn_do_connect(void*m); +voidlwip_netconn_do_disconnect(void*m); +voidlwip_netconn_do_listen(void*m); +voidlwip_netconn_do_send(void*m); +voidlwip_netconn_do_recv(void*m); +#ifTCP_LISTEN_BACKLOG +voidlwip_netconn_do_accepted(void*m); +#endif/*TCP_LISTEN_BACKLOG*/ +voidlwip_netconn_do_write(void*m); +voidlwip_netconn_do_getaddr(void*m); +voidlwip_netconn_do_close(void*m); +voidlwip_netconn_do_shutdown(void*m); +#ifLWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD) +voidlwip_netconn_do_join_leave_group(void*m); +#endif/*LWIP_IGMP||(LWIP_IPV6&&LWIP_IPV6_MLD)*/ + +#ifLWIP_DNS +voidlwip_netconn_do_gethostbyname(void*arg); +#endif/*LWIP_DNS*/ + +structnetconn*netconn_alloc(enumnetconn_typet,netconn_callbackcallback); +voidnetconn_free(structnetconn*conn); + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_NETCONN||LWIP_SOCKET*/ + +#endif/*LWIP_HDR_API_MSG_H*/ - + diff --git a/doc/xml/arch_8h.xml b/doc/xml/arch_8h.xml index 6d9239e..d947956 100644 --- a/doc/xml/arch_8h.xml +++ b/doc/xml/arch_8h.xml @@ -1,329 +1,1739 @@ - - - + + + arch.h - arch/cpu.h - arch/cc.h - src/sys/include/net/ipv4/icmp.h - src/sys/include/net/ipv4/inet.h - src/sys/include/net/ipv4/ip.h - src/sys/include/net/ipv4/ip_addr.h - src/sys/include/net/ipv6/inet.h - src/sys/include/net/ipv6/ip_addr.h - src/sys/include/net/mem.h - src/sys/include/net/pbuf.h - src/sys/include/net/udp.h - src/sys/net/api/api_msg.c + sys/types.h + net/arch/cc.h + lib/kprintf.h + ubixos/kpanic.h + C:/Dev/git/UbixOS/sys/include/net/debug.h + C:/Dev/git/UbixOS/sys/include/net/def.h + C:/Dev/git/UbixOS/sys/include/net/err.h + C:/Dev/git/UbixOS/sys/include/net/prot/dns.h + C:/Dev/git/UbixOS/sys/include/net/prot/etharp.h + C:/Dev/git/UbixOS/sys/include/net/prot/ethernet.h + C:/Dev/git/UbixOS/sys/include/net/prot/icmp.h + C:/Dev/git/UbixOS/sys/include/net/prot/icmp6.h + C:/Dev/git/UbixOS/sys/include/net/prot/igmp.h + C:/Dev/git/UbixOS/sys/include/net/prot/ip.h + C:/Dev/git/UbixOS/sys/include/net/prot/ip4.h + C:/Dev/git/UbixOS/sys/include/net/prot/tcp.h + C:/Dev/git/UbixOS/sys/include/net/prot/udp.h + C:/Dev/git/UbixOS/sys/include/net/sio.h - - - + + + - - - - + + + + + + + + + + + + - + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - - - + + + - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + - - - + + + - - - - + + + + + + + + - - - - - + - - - - + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + - + - + - + - + - - - + - - - - + + + + - + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + BIG_ENDIAN 4321 @@ -332,9 +1742,21 @@ - + - + + BYTE_ORDER + LITTLE_ENDIAN + + + +Define the byte order of the system. Needed for conversion of network data to host byte order. Allowed values: LITTLE_ENDIAN and BIG_ENDIAN + + + + + + LITTLE_ENDIAN 1234 @@ -343,76 +1765,685 @@ - + + + + LWIP_ALIGNMENT_CAST + target_type + val + LWIP_CONST_CAST(target_type, val) + + + +Get rid of alignment cast warnings (GCC -Wcast-align) + + + + + + + LWIP_CONST_CAST + target_type + val + ((target_type)((ptrdiff_t)val)) + + + +C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) + + + + + + + LWIP_DECLARE_MEMORY_ALIGNED + variable_name + size + u8_t variable_name[LWIP_MEM_ALIGN_BUFFER(size)] + + + +Allocates a memory buffer of specified size that is of sufficient size to align its start address using LWIP_MEM_ALIGN. You can declare your own version here e.g. to enforce alignment without adding trailing padding bytes (see LWIP_MEM_ALIGN_BUFFER) or your own section placement requirements. +e.g. if you use gcc and need 32 bit alignment: +#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] __attribute__((aligned(4))) +or more portable: +#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u32_t variable_name[(size + sizeof(u32_t) - 1) / sizeof(u32_t)] + + + + + + + LWIP_MEM_ALIGN + addr + ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1))) + + + +Align a memory pointer to the alignment defined by MEM_ALIGNMENT so that ADDR % MEM_ALIGNMENT == 0 + + + + + + + LWIP_MEM_ALIGN_BUFFER + size + (((size) + MEM_ALIGNMENT - 1U)) + + + +Calculate safe memory size for an aligned buffer when using an unaligned type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the start (e.g. if buffer is u8_t[] and actual data will be u32_t*) + + + + + + + LWIP_MEM_ALIGN_SIZE + size + (((size) + MEM_ALIGNMENT - 1U) & ~(MEM_ALIGNMENT-1U)) + + + +Calculate memory size for an aligned buffer - returns the next highest multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4). + + + + + + + LWIP_NO_INTTYPES_H + 0 + + + +Define this to 1 in arch/cc.h of your port if your compiler does not provide the inttypes.h header. You need to define the format strings listed in lwip/arch.h yourself in this case (X8_F, U16_F...). + + + + + + + LWIP_NO_LIMITS_H + 0 + + + +Define this to 1 in arch/cc.h of your port if your compiler does not provide the limits.h header. You need to define the type limits yourself in this case (e.g. INT_MAX). + + + + + + + LWIP_NO_STDDEF_H + 0 + + + +Define this to 1 in arch/cc.h of your port if you do not want to include stddef.h header to get size_t. You need to typedef size_t by yourself in this case. + + + + + + + LWIP_NO_STDINT_H + 0 + + + +Define this to 1 in arch/cc.h of your port if your compiler does not provide the stdint.h header. You need to typedef the generic types listed in lwip/arch.h yourself in this case (u8_t, u16_t...). + + + + + + + LWIP_PLATFORM_ASSERT + x + do {kprintf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); kpanic("asserted");} while(0) + + + +Platform specific assertion handling. +Note the default implementation pulls in printf, fflush and abort, which may in turn pull in a lot of standard libary code. In resource-constrained systems, this should be defined to something less resource-consuming. + + + + + + + LWIP_PLATFORM_DIAG + x + do {kprintf x;} while(0) + + + +Define random number generator function of your system Platform specific diagnostic output. +Note the default implementation pulls in printf, which may in turn pull in a lot of standard libary code. In resource-constrained systems, this should be defined to something less resource-consuming. + + + + + + + LWIP_PTR_NUMERIC_CAST + target_type + val + LWIP_CONST_CAST(target_type, val) + + + +Get rid of warnings related to pointer-to-numeric and vice-versa casts, e.g. "conversion from 'u8_t' to 'void *' of greater size" + + + + + + + LWIP_UNUSED_ARG + x + (void)x + + + +Packed structs support using #include files before and after struct to be packed. +The file included BEFORE the struct is "arch/bpstruct.h". +The file included AFTER the struct is "arch/epstruct.h". +This can be used to implement struct packing on MS Visual C compilers, see the Win32 port in the lwIP contrib repository for reference. For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. Eliminates compiler warning about unused arguments (GCC -Wextra -Wunused). + + + + + + + PACK_STRUCT_BEGIN + + + +Packed structs support. Placed BEFORE declaration of a packed struct. +For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. + + + + + + + PACK_STRUCT_END + + + +Packed structs support. Placed AFTER declaration of a packed struct. +For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. + + + + + + + PACK_STRUCT_FIELD + x + x + + + +Packed structs support. Wraps u32_t and u16_t members. +For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. + + + + + + + PACK_STRUCT_FLD_8 + x + PACK_STRUCT_FIELD(x) + + + +Packed structs support. Wraps u8_t members, where some compilers warn that packing is not necessary. +For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. + + + + + + + PACK_STRUCT_FLD_S + x + PACK_STRUCT_FIELD(x) + + + +Packed structs support. Wraps members that are packed structs themselves, where some compilers warn that packing is not necessary. +For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. + + + + + + + PACK_STRUCT_STRUCT + + + +Packed structs support. Placed between end of declaration of a packed struct and trailing semicolon. +For examples of packed struct declarations, see include/lwip/prot/ subfolder. +A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here. + + + + + + + S16_F + PRId16 + + + + + + + + + + S32_F + PRId32 + + + + + + + + + + SZT_F + PRIuPTR + + + + + + + + + + U16_F + PRIu16 + + + + + + + + + + U32_F + PRIu32 + + + + + + + + + + X16_F + PRIx16 + + + + + + + + + + X32_F + PRIx32 + + + + + + + + + + X8_F + "02" PRIx8 + + + + + + + + + + + + uintptr_t + typedef uintptr_t mem_ptr_t + + mem_ptr_t + + + + + + + + + + int16_t + typedef int16_t s16_t + + s16_t + + + + + + + + + + int32_t + typedef int32_t s32_t + + s32_t + + + + + + + + + + int8_t + typedef int8_t s8_t + + s8_t + + + + + + + + + + uint16_t + typedef uint16_t u16_t + + u16_t + + + + + + + + + + uint32_t + typedef uint32_t u32_t + + u32_t + + + + + + + + + + uint8_t + typedef uint8_t u8_t + + u8_t + + + + + + + +Support for different processor and compiler architectures -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: arch_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_ARCH_H__ -#define__LWIP_ARCH_H__ - -#ifndefLITTLE_ENDIAN -#defineLITTLE_ENDIAN1234 -#endif - -#ifndefBIG_ENDIAN -#defineBIG_ENDIAN4321 -#endif - -#include"arch/cpu.h" -#include"arch/cc.h" - -#ifndefPACK_STRUCT_BEGIN -#definePACK_STRUCT_BEGIN -#endif/*PACK_STRUCT_BEGIN*/ + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_ARCH_H +#defineLWIP_HDR_ARCH_H + +#ifndefLITTLE_ENDIAN +#defineLITTLE_ENDIAN1234 +#endif + +#ifndefBIG_ENDIAN +#defineBIG_ENDIAN4321 +#endif + +#include<sys/types.h> +#include<net/arch/cc.h> +#include<lib/kprintf.h> +#include<ubixos/kpanic.h> -#ifndefPACK_STRUCT_END -#definePACK_STRUCT_END -#endif/*PACK_STRUCT_END*/ - -#ifndefPACK_STRUCT_FIELD -#definePACK_STRUCT_FIELD(x)x -#endif/*PACK_STRUCT_FIELD*/ - -#endif/*__LWIP_ARCH_H__*/ +#ifndefBYTE_ORDER +#defineBYTE_ORDERLITTLE_ENDIAN +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_RAND()((u32_t)rand()) +#endif + +#ifndefLWIP_PLATFORM_DIAG +#defineLWIP_PLATFORM_DIAG(x)do{kprintfx;}while(0) +#endif + +#ifndefLWIP_PLATFORM_ASSERT +#defineLWIP_PLATFORM_ASSERT(x)do{kprintf("Assertion\"%s\"failedatline%din%s\n",x,__LINE__,__FILE__);kpanic("asserted");}while(0) +#endif + +#ifndefLWIP_NO_STDDEF_H +#defineLWIP_NO_STDDEF_H0 +#endif + +#if!LWIP_NO_STDDEF_H +/*forsize_t*/ +/*MrOlsen2017-12-17 +#include<stddef.h> +*/ +#endif + +#ifndefLWIP_NO_STDINT_H +#defineLWIP_NO_STDINT_H0 +#endif + +/*DefinegenerictypesusedinlwIP*/ +#if!LWIP_NO_STDINT_H +/*MrOlsen2017-12-17 +#include<stdint.h> +*/ +typedefuint8_tu8_t; +typedefint8_ts8_t; +typedefuint16_tu16_t; +typedefint16_ts16_t; +typedefuint32_tu32_t; +typedefint32_ts32_t; +typedefuintptr_tmem_ptr_t; +#endif + +#ifndefLWIP_NO_INTTYPES_H +#defineLWIP_NO_INTTYPES_H0 +#endif + +/*Define(sn)printfformattersfortheselwIPtypes*/ +#if!LWIP_NO_INTTYPES_H +/*MrOlsen +#include<inttypes.h> +*/ +#ifndefX8_F +#defineX8_F"02"PRIx8 +#endif +#ifndefU16_F +#defineU16_FPRIu16 +#endif +#ifndefS16_F +#defineS16_FPRId16 +#endif +#ifndefX16_F +#defineX16_FPRIx16 +#endif +#ifndefU32_F +#defineU32_FPRIu32 +#endif +#ifndefS32_F +#defineS32_FPRId32 +#endif +#ifndefX32_F +#defineX32_FPRIx32 +#endif +#ifndefSZT_F +#defineSZT_FPRIuPTR +#endif +#endif + +#ifndefLWIP_NO_LIMITS_H +#defineLWIP_NO_LIMITS_H0 +#endif + +/*Includelimits.h?*/ +#if!LWIP_NO_LIMITS_H +/* +#include<limits.h> +*/ +#endif + +#ifndefLWIP_CONST_CAST +#defineLWIP_CONST_CAST(target_type,val)((target_type)((ptrdiff_t)val)) +#endif + +#ifndefLWIP_ALIGNMENT_CAST +#defineLWIP_ALIGNMENT_CAST(target_type,val)LWIP_CONST_CAST(target_type,val) +#endif + +#ifndefLWIP_PTR_NUMERIC_CAST +#defineLWIP_PTR_NUMERIC_CAST(target_type,val)LWIP_CONST_CAST(target_type,val) +#endif + +#ifndefLWIP_DECLARE_MEMORY_ALIGNED +#defineLWIP_DECLARE_MEMORY_ALIGNED(variable_name,size)u8_tvariable_name[LWIP_MEM_ALIGN_BUFFER(size)] +#endif + +#ifndefLWIP_MEM_ALIGN_SIZE +#defineLWIP_MEM_ALIGN_SIZE(size)(((size)+MEM_ALIGNMENT-1U)&~(MEM_ALIGNMENT-1U)) +#endif + +#ifndefLWIP_MEM_ALIGN_BUFFER +#defineLWIP_MEM_ALIGN_BUFFER(size)(((size)+MEM_ALIGNMENT-1U)) +#endif + +#ifndefLWIP_MEM_ALIGN +#defineLWIP_MEM_ALIGN(addr)((void*)(((mem_ptr_t)(addr)+MEM_ALIGNMENT-1)&~(mem_ptr_t)(MEM_ALIGNMENT-1))) +#endif + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifndefPACK_STRUCT_BEGIN +#definePACK_STRUCT_BEGIN +#endif/*PACK_STRUCT_BEGIN*/ + +#ifndefPACK_STRUCT_END +#definePACK_STRUCT_END +#endif/*PACK_STRUCT_END*/ + +#ifndefPACK_STRUCT_STRUCT +#ifdefined(__GNUC__)||defined(__clang__) +#definePACK_STRUCT_STRUCT__attribute__((packed)) +#else +#definePACK_STRUCT_STRUCT +#endif +#endif/*PACK_STRUCT_STRUCT*/ + +#ifndefPACK_STRUCT_FIELD +#definePACK_STRUCT_FIELD(x)x +#endif/*PACK_STRUCT_FIELD*/ + +#ifndefPACK_STRUCT_FLD_8 +#definePACK_STRUCT_FLD_8(x)PACK_STRUCT_FIELD(x) +#endif/*PACK_STRUCT_FLD_8*/ + +#ifndefPACK_STRUCT_FLD_S +#definePACK_STRUCT_FLD_S(x)PACK_STRUCT_FIELD(x) +#endif/*PACK_STRUCT_FLD_S*/ + +#ifdef__DOXYGEN__ +#definePACK_STRUCT_USE_INCLUDES +#endif + +#ifndefLWIP_UNUSED_ARG +#defineLWIP_UNUSED_ARG(x)(void)x +#endif/*LWIP_UNUSED_ARG*/ + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_ARCH_H*/ - + diff --git a/doc/xml/arp_8c.xml b/doc/xml/arp_8c.xml index ac51092..6831063 100644 --- a/doc/xml/arp_8c.xml +++ b/doc/xml/arp_8c.xml @@ -1,180 +1,172 @@ - - - + + + arp.c - ubixos/types.h + sys/types.h lib/kprintf.h net/debug.h - net/ipv4/inet.h - netif/arp.h - net/ipv4/ip.h + net/ipv4/inet.h + netif/arp.h + net/ipv4/ip.h - - - - + + + + - + - + - + - + - + - - - + + + - - - - + + + + + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + arp_entry arp_hdr ethip_hdr - + ARP_MAXAGE - 2 + 2 /* 120 * 10 seconds = 20 minutes. */ - - arp_tmr + - + ARP_REPLY 2 @@ -183,10 +175,9 @@ - - arp_arp_input + - + ARP_REQUEST 1 @@ -195,11 +186,9 @@ - - arp_arp_input - arp_query + - + ARPH_HWLEN hdr (NTOHS((hdr)->_hwlen_protolen) >> 8) @@ -209,24 +198,22 @@ - + - + ARPH_HWLEN_SET hdr len - (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8)) + (hdr)->_hwlen_protolen = HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8)) - - arp_arp_input - arp_query + - + ARPH_PROTOLEN hdr (NTOHS((hdr)->_hwlen_protolen) & 0xff) @@ -236,24 +223,22 @@ - + - + ARPH_PROTOLEN_SET hdr len - (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8)) + (hdr)->_hwlen_protolen = HTONS((len) | (ARPH_HWLEN(hdr) << 8)) - - arp_arp_input - arp_query + - + HWTYPE_ETHERNET 1 @@ -262,19 +247,58 @@ - - arp_arp_input - arp_query + + + + + + struct arp_entry + struct arp_entry arp_table[ARP_TABLE_SIZE] + [ARP_TABLE_SIZE] + arp_table + + + + + + + + + + uInt8 + uInt8 ctime + + ctime + + + + + + + + + + PACK_STRUCT_BEGIN struct arp_hdr + PACK_STRUCT_BEGIN struct arp_hdr PACK_STRUCT_STRUCT + + PACK_STRUCT_STRUCT + + + + + + + - + void static void add_arp_entry (struct ip_addr *ipaddr, struct eth_addr *ethaddr) add_arp_entry - struct ip_addr * + struct ip_addr * ipaddr @@ -287,21 +311,10 @@ - - arp_table - ARP_TABLE_SIZE - ctime - arp_entry::ctime - arp_entry::ethaddr - ip_addr_cmp - ip_addr_isany - ip_addr_set - arp_entry::ipaddr - arp_arp_input - arp_ip_input + - - pbuf * + + struct pbuf * struct pbuf* arp_arp_input (struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p) arp_arp_input @@ -323,27 +336,24 @@ - - add_arp_entry - ARP_REPLY - ARP_REQUEST - ARPH_HWLEN_SET - ARPH_PROTOLEN_SET - ETHTYPE_ARP - ETHTYPE_IP - htons - HWTYPE_ETHERNET - netif::ip_addr - ip_addr_cmp - ip_addr_set - kprintf - NULL - pbuf::payload - pbuf_free - pbuf::tot_len - ethernetif_input + + ARP_REPLY + ARP_REQUEST + ARPH_HWLEN_SET + ARPH_PROTOLEN_SET + ETHTYPE_ARP + ETHTYPE_IP + htons + HWTYPE_ETHERNET + ip_addr_cmp + ip_addr_set + kprintf + NULL + pbuf::payload + pbuf_free + pbuf::tot_len - + void void arp_init (void) @@ -357,15 +367,11 @@ - - arp_table - ARP_TABLE_SIZE - IP_ADDR_ANY - ip_addr_set - arp_entry::ipaddr - ethernetif_init + + ARP_TABLE_SIZE + ip_addr_set - + void void arp_ip_input (struct netif *netif, struct pbuf *p) @@ -384,23 +390,16 @@ - - add_arp_entry - ARP_DEBUG - DEBUGF - netif::ip_addr - ip_addr_maskcmp - netif::netmask - pbuf::payload - ethernetif_input + + pbuf::payload - - eth_addr * + + struct eth_addr * struct eth_addr* arp_lookup (struct ip_addr *ipaddr) arp_lookup - struct ip_addr * + struct ip_addr * ipaddr @@ -409,15 +408,12 @@ - - arp_table - ARP_TABLE_SIZE - ip_addr_cmp - NULL - ethernetif_output + + ARP_TABLE_SIZE + ip_addr_cmp - - pbuf * + + struct pbuf * struct pbuf* arp_query (struct netif *netif, struct eth_addr *ethaddr, struct ip_addr *ipaddr) arp_query @@ -430,7 +426,7 @@ ethaddr - struct ip_addr * + struct ip_addr * ipaddr @@ -439,24 +435,22 @@ - - ARP_REQUEST - ARPH_HWLEN_SET - ARPH_PROTOLEN_SET - ETHTYPE_ARP - ETHTYPE_IP - htons - HWTYPE_ETHERNET - netif::ip_addr - ip_addr_set - NULL - pbuf::payload - pbuf_alloc - PBUF_LINK - PBUF_RAM - ethernetif_output + + ARP_REQUEST + ARPH_HWLEN_SET + ARPH_PROTOLEN_SET + ETHTYPE_ARP + ETHTYPE_IP + htons + HWTYPE_ETHERNET + ip_addr_set + NULL + pbuf::payload + pbuf_alloc + PBUF_LINK + PBUF_RAM - + void void arp_tmr (void) @@ -470,65 +464,7 @@ - - ARP_DEBUG - ARP_MAXAGE - arp_table - ARP_TABLE_SIZE - ctime - DEBUGF - IP_ADDR_ANY - ip_addr_isany - ip_addr_set - arp_entry::ipaddr - arp_timer - - - - - struct arp_entry - struct arp_entry arp_table[ARP_TABLE_SIZE] - [ARP_TABLE_SIZE] - arp_table - - - - - - - - add_arp_entry - arp_init - arp_lookup - arp_tmr - - - uInt8 - uInt8 ctime - - ctime - - - - - - - - add_arp_entry - arp_tmr - - - PACK_STRUCT_BEGIN struct arp_hdr - PACK_STRUCT_BEGIN struct arp_hdr PACK_STRUCT_STRUCT - - PACK_STRUCT_STRUCT - - - - - - - + @@ -568,113 +504,113 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: arp_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:arp.c542016-01-1101:29:55Zreddawg$ * */ -#include<ubixos/types.h> +#include<sys/types.h> #include<lib/kprintf.h> #include"net/debug.h" -#include"net/ipv4/inet.h" -#include"netif/arp.h" -#include"net/ipv4/ip.h" +#include"net/ipv4/inet.h" +#include"netif/arp.h" +#include"net/ipv4/ip.h" -#defineARP_MAXAGE2/*120*10seconds=20minutes.*/ +#defineARP_MAXAGE2/*120*10seconds=20minutes.*/ -#defineHWTYPE_ETHERNET1 - -#defineARP_REQUEST1 -#defineARP_REPLY2 - +#defineHWTYPE_ETHERNET1 + +#defineARP_REQUEST1 +#defineARP_REPLY2 + /*MUSTbecompiledwith"packstructs"orequivalent!*/ -PACK_STRUCT_BEGIN +PACK_STRUCT_BEGIN structarp_hdr{ -PACK_STRUCT_FIELD(structeth_hdrethhdr); -PACK_STRUCT_FIELD(uInt16hwtype); -PACK_STRUCT_FIELD(uInt16proto); -PACK_STRUCT_FIELD(uInt16_hwlen_protolen); -PACK_STRUCT_FIELD(uInt16opcode); -PACK_STRUCT_FIELD(structeth_addrshwaddr); -PACK_STRUCT_FIELD(structip_addrsipaddr); -PACK_STRUCT_FIELD(structeth_addrdhwaddr); -PACK_STRUCT_FIELD(structip_addrdipaddr); -}PACK_STRUCT_STRUCT; -PACK_STRUCT_END +PACK_STRUCT_FIELD(structeth_hdrethhdr); +PACK_STRUCT_FIELD(uInt16hwtype); +PACK_STRUCT_FIELD(uInt16proto); +PACK_STRUCT_FIELD(uInt16_hwlen_protolen); +PACK_STRUCT_FIELD(uInt16opcode); +PACK_STRUCT_FIELD(structeth_addrshwaddr); +PACK_STRUCT_FIELD(structip_addrsipaddr); +PACK_STRUCT_FIELD(structeth_addrdhwaddr); +PACK_STRUCT_FIELD(structip_addrdipaddr); +}PACK_STRUCT_STRUCT; +PACK_STRUCT_END -#defineARPH_HWLEN(hdr)(NTOHS((hdr)->_hwlen_protolen)>>8) -#defineARPH_PROTOLEN(hdr)(NTOHS((hdr)->_hwlen_protolen)&0xff) - +#defineARPH_HWLEN(hdr)(NTOHS((hdr)->_hwlen_protolen)>>8) +#defineARPH_PROTOLEN(hdr)(NTOHS((hdr)->_hwlen_protolen)&0xff) + -#defineARPH_HWLEN_SET(hdr,len)(hdr)->_hwlen_protolen=HTONS(ARPH_PROTOLEN(hdr)|((len)<<8)) -#defineARPH_PROTOLEN_SET(hdr,len)(hdr)->_hwlen_protolen=HTONS((len)|(ARPH_HWLEN(hdr)<<8)) - -PACK_STRUCT_BEGIN +#defineARPH_HWLEN_SET(hdr,len)(hdr)->_hwlen_protolen=HTONS(ARPH_PROTOLEN(hdr)|((len)<<8)) +#defineARPH_PROTOLEN_SET(hdr,len)(hdr)->_hwlen_protolen=HTONS((len)|(ARPH_HWLEN(hdr)<<8)) + +PACK_STRUCT_BEGIN structethip_hdr{ -PACK_STRUCT_FIELD(structeth_hdreth); -PACK_STRUCT_FIELD(structip_hdrip); +PACK_STRUCT_FIELD(structeth_hdreth); +PACK_STRUCT_FIELD(structip_hdrip); }; -PACK_STRUCT_END +PACK_STRUCT_END structarp_entry{ -structip_addripaddr; -structeth_addrethaddr; -uInt8ctime; +structip_addripaddr; +structeth_addrethaddr; +uInt8ctime; }; -staticstructarp_entryarp_table[ARP_TABLE_SIZE]; -staticuInt8ctime; +staticstructarp_entryarp_table[ARP_TABLE_SIZE]; +staticuInt8ctime; /*-----------------------------------------------------------------------------------*/ void -arp_init(void) +arp_init(void) { -uInt8i; +uInt8i; -for(i=0;i<ARP_TABLE_SIZE;++i){ -ip_addr_set(&(arp_table[i].ipaddr), -IP_ADDR_ANY); +for(i=0;i<ARP_TABLE_SIZE;++i){ +ip_addr_set(&(arp_table[i].ipaddr), +IP_ADDR_ANY); } } /*-----------------------------------------------------------------------------------*/ void -arp_tmr(void) +arp_tmr(void) { -uInt8i; +uInt8i; -++ctime; -for(i=0;i<ARP_TABLE_SIZE;++i){ -if(!ip_addr_isany(&arp_table[i].ipaddr)&& -ctime-arp_table[i].ctime>=ARP_MAXAGE){ -DEBUGF(ARP_DEBUG,("arp_timer:expiredentry%d.\n",i)); -ip_addr_set(&(arp_table[i].ipaddr), -IP_ADDR_ANY); +++ctime; +for(i=0;i<ARP_TABLE_SIZE;++i){ +if(!ip_addr_isany(&arp_table[i].ipaddr)&& +ctime-arp_table[i].ctime>=ARP_MAXAGE){ +DEBUGF(ARP_DEBUG,("arp_timer:expiredentry%d.\n",i)); +ip_addr_set(&(arp_table[i].ipaddr), +IP_ADDR_ANY); } } } /*-----------------------------------------------------------------------------------*/ staticvoid -add_arp_entry(structip_addr*ipaddr,structeth_addr*ethaddr) +add_arp_entry(structip_addr*ipaddr,structeth_addr*ethaddr) { -uInt8i,j,k; -uInt8maxtime; +uInt8i,j,k; +uInt8maxtime; /*WalkthroughtheARPmappingtableandtrytofindanentryto update.Ifnoneisfound,theIP->MACaddressmappingis insertedintheARPtable.*/ -for(i=0;i<ARP_TABLE_SIZE;++i){ +for(i=0;i<ARP_TABLE_SIZE;++i){ /*Onlycheckthoseentriesthatareactuallyinuse.*/ -if(!ip_addr_isany(&arp_table[i].ipaddr)){ +if(!ip_addr_isany(&arp_table[i].ipaddr)){ /*CheckifthesourceIPaddressoftheincomingpacketmatches theIPaddressinthisARPtableentry.*/ -if(ip_addr_cmp(ipaddr,&arp_table[i].ipaddr)){ +if(ip_addr_cmp(ipaddr,&arp_table[i].ipaddr)){ /*Anoldentryfound,updatethisandreturn.*/ for(k=0;k<6;++k){ -arp_table[i].ethaddr.addr[k]=ethaddr->addr[k]; +arp_table[i].ethaddr.addr[k]=ethaddr->addr[k]; } -arp_table[i].ctime=ctime; +arp_table[i].ctime=ctime; return; } } @@ -684,20 +620,20 @@ createone.*/ /*First,wetrytofindanunusedentryintheARPtable.*/ -for(i=0;i<ARP_TABLE_SIZE;++i){ -if(ip_addr_isany(&arp_table[i].ipaddr)){ +for(i=0;i<ARP_TABLE_SIZE;++i){ +if(ip_addr_isany(&arp_table[i].ipaddr)){ break; } } /*Ifnounusedentryisfound,wetrytofindtheoldestentryand throwitaway.*/ -if(i==ARP_TABLE_SIZE){ +if(i==ARP_TABLE_SIZE){ maxtime=0; j=0; -for(i=0;i<ARP_TABLE_SIZE;++i){ -if(ctime-arp_table[i].ctime>maxtime){ -maxtime=ctime-arp_table[i].ctime; +for(i=0;i<ARP_TABLE_SIZE;++i){ +if(ctime-arp_table[i].ctime>maxtime){ +maxtime=ctime-arp_table[i].ctime; j=i; } } @@ -706,144 +642,151 @@ /*Now,iistheARPtableentrywhichwewillfillwiththenew information.*/ -ip_addr_set(&arp_table[i].ipaddr,ipaddr); +ip_addr_set(&arp_table[i].ipaddr,ipaddr); for(k=0;k<6;++k){ -arp_table[i].ethaddr.addr[k]=ethaddr->addr[k]; +arp_table[i].ethaddr.addr[k]=ethaddr->addr[k]; } -arp_table[i].ctime=ctime; +arp_table[i].ctime=ctime; return; } /*-----------------------------------------------------------------------------------*/ void -arp_ip_input(structnetif*netif,structpbuf*p) +arp_ip_input(structnetif*netif,structpbuf*p) { structethip_hdr*hdr; -hdr=p->payload; +hdr=p->payload; /*Onlyinsert/updateanentryifthesourceIPaddressofthe incomingIPpacketcomesfromahostonthelocalnetwork.*/ -if(!ip_addr_maskcmp(&(hdr->ip.src),&(netif->ip_addr),&(netif->netmask))){ +if(!ip_addr_maskcmp(&(hdr->ip.src),&(netif->ip_addr),&(netif->netmask))){ return; } -DEBUGF(ARP_DEBUG,("arp_ip_input:updatingARPtable.\n")); -add_arp_entry(&(hdr->ip.src),&(hdr->eth.src)); +DEBUGF(ARP_DEBUG,("arp_ip_input:updatingARPtable.\n")); +add_arp_entry(&(hdr->ip.src),&(hdr->eth.src)); } /*-----------------------------------------------------------------------------------*/ structpbuf* -arp_arp_input(structnetif*netif,structeth_addr*ethaddr,structpbuf*p) +arp_arp_input(structnetif*netif,structeth_addr*ethaddr,structpbuf*p) { structarp_hdr*hdr; -uInt8i; +uInt8i; -if(p->tot_len<sizeof(structarp_hdr)){ -kprintf("arp_arp_input:packettooshort(%d/%d)\n",p->tot_len,sizeof(structarp_hdr)); -pbuf_free(p); -returnNULL; +if(p->tot_len<sizeof(structarp_hdr)){ +kprintf("arp_arp_input:packettooshort(%d/%d)\n",p->tot_len,sizeof(structarp_hdr)); +pbuf_free(p); +returnNULL; } -hdr=p->payload; - -switch(htons(hdr->opcode)){ -caseARP_REQUEST: -/*ARPrequest.Ifitaskedforouraddress,wesendouta -reply.*/ -if(ip_addr_cmp(&(hdr->dipaddr),&(netif->ip_addr))){ -hdr->opcode=htons(ARP_REPLY); - -ip_addr_set(&(hdr->dipaddr),&(hdr->sipaddr)); -ip_addr_set(&(hdr->sipaddr),&(netif->ip_addr)); - -for(i=0;i<6;++i){ -hdr->dhwaddr.addr[i]=hdr->shwaddr.addr[i]; -hdr->shwaddr.addr[i]=ethaddr->addr[i]; -hdr->ethhdr.dest.addr[i]=hdr->dhwaddr.addr[i]; -hdr->ethhdr.src.addr[i]=ethaddr->addr[i]; -} - -hdr->hwtype=htons(HWTYPE_ETHERNET); -ARPH_HWLEN_SET(hdr,6); - -hdr->proto=htons(ETHTYPE_IP); -ARPH_PROTOLEN_SET(hdr,sizeof(structip_addr)); - -hdr->ethhdr.type=htons(ETHTYPE_ARP); -returnp; -} -break; -caseARP_REPLY: -/*ARPreply.WeinsertorupdatetheARPtable.*/ -if(ip_addr_cmp(&(hdr->dipaddr),&(netif->ip_addr))){ -add_arp_entry(&(hdr->sipaddr),&(hdr->shwaddr)); +hdr=p->payload; + +//kprintf("HDR->OPCODE:[0x%X]\n",hdr->opcode); + +switch(htons(hdr->opcode)){ +caseARP_REQUEST: +//kprintf("ARP_REQUEST"); +//ip_addr_debug_print(&hdr->dipaddr); +//ip_addr_debug_print(&netif->ip_addr); +/*ARPrequest.Ifitaskedforouraddress,wesendouta +reply.*/ +if(ip_addr_cmp(&(hdr->dipaddr),&(netif->ip_addr))){ +//kprintf("MATCHED!\n"); +hdr->opcode=htons(ARP_REPLY); + +ip_addr_set(&(hdr->dipaddr),&(hdr->sipaddr)); +ip_addr_set(&(hdr->sipaddr),&(netif->ip_addr)); + +for(i=0;i<6;++i){ +hdr->dhwaddr.addr[i]=hdr->shwaddr.addr[i]; +hdr->shwaddr.addr[i]=ethaddr->addr[i]; +hdr->ethhdr.dest.addr[i]=hdr->dhwaddr.addr[i]; +hdr->ethhdr.src.addr[i]=ethaddr->addr[i]; +} + +hdr->hwtype=htons(HWTYPE_ETHERNET); +ARPH_HWLEN_SET(hdr,6); + +hdr->proto=htons(ETHTYPE_IP); +ARPH_PROTOLEN_SET(hdr,sizeof(structip_addr)); + +hdr->ethhdr.type=htons(ETHTYPE_ARP); +returnp; } break; -default: -kprintf("arp_arp_input:unknowntype%d\n",htons(hdr->opcode)); -break; -} - -pbuf_free(p); -returnNULL; -} -/*-----------------------------------------------------------------------------------*/ -structeth_addr* -arp_lookup(structip_addr*ipaddr) -{ -uInt8i; - -for(i=0;i<ARP_TABLE_SIZE;++i){ -if(ip_addr_cmp(ipaddr,&arp_table[i].ipaddr)){ -return&arp_table[i].ethaddr; -} -} -returnNULL; -} -/*-----------------------------------------------------------------------------------*/ -structpbuf* -arp_query(structnetif*netif,structeth_addr*ethaddr,structip_addr*ipaddr) -{ -structarp_hdr*hdr; -structpbuf*p; -uInt8i; - -p=pbuf_alloc(PBUF_LINK,sizeof(structarp_hdr),PBUF_RAM); -if(p==NULL){ -returnNULL; -} - -hdr=p->payload; - -hdr->opcode=htons(ARP_REQUEST); - -for(i=0;i<6;++i){ -hdr->dhwaddr.addr[i]=0x00; -hdr->shwaddr.addr[i]=ethaddr->addr[i]; -} +caseARP_REPLY: +kprintf("ARP_RREPLY"); +/*ARPreply.WeinsertorupdatetheARPtable.*/ +if(ip_addr_cmp(&(hdr->dipaddr),&(netif->ip_addr))){ +add_arp_entry(&(hdr->sipaddr),&(hdr->shwaddr)); +} +break; +default: +kprintf("arp_arp_input:unknowntype%d\n",htons(hdr->opcode)); +break; +} + +pbuf_free(p); +returnNULL; +} +/*-----------------------------------------------------------------------------------*/ +structeth_addr* +arp_lookup(structip_addr*ipaddr) +{ +uInt8i; + +for(i=0;i<ARP_TABLE_SIZE;++i){ +if(ip_addr_cmp(ipaddr,&arp_table[i].ipaddr)){ +return&arp_table[i].ethaddr; +} +} +returnNULL; +} +/*-----------------------------------------------------------------------------------*/ +structpbuf* +arp_query(structnetif*netif,structeth_addr*ethaddr,structip_addr*ipaddr) +{ +structarp_hdr*hdr; +structpbuf*p; +uInt8i; + +p=pbuf_alloc(PBUF_LINK,sizeof(structarp_hdr),PBUF_RAM); +if(p==NULL){ +returnNULL; +} + +hdr=p->payload; -ip_addr_set(&(hdr->dipaddr),ipaddr); -ip_addr_set(&(hdr->sipaddr),&(netif->ip_addr)); - -hdr->hwtype=htons(HWTYPE_ETHERNET); -ARPH_HWLEN_SET(hdr,6); - -hdr->proto=htons(ETHTYPE_IP); -ARPH_PROTOLEN_SET(hdr,sizeof(structip_addr)); - -for(i=0;i<6;++i){ -hdr->ethhdr.dest.addr[i]=0xff; -hdr->ethhdr.src.addr[i]=ethaddr->addr[i]; -} - -hdr->ethhdr.type=htons(ETHTYPE_ARP); -returnp; -} -/*-----------------------------------------------------------------------------------*/ - - - - +hdr->opcode=htons(ARP_REQUEST); + +for(i=0;i<6;++i){ +hdr->dhwaddr.addr[i]=0x00; +hdr->shwaddr.addr[i]=ethaddr->addr[i]; +} + +ip_addr_set(&(hdr->dipaddr),ipaddr); +ip_addr_set(&(hdr->sipaddr),&(netif->ip_addr)); + +hdr->hwtype=htons(HWTYPE_ETHERNET); +ARPH_HWLEN_SET(hdr,6); + +hdr->proto=htons(ETHTYPE_IP); +ARPH_PROTOLEN_SET(hdr,sizeof(structip_addr)); + +for(i=0;i<6;++i){ +hdr->ethhdr.dest.addr[i]=0xff; +hdr->ethhdr.src.addr[i]=ethaddr->addr[i]; +} + +hdr->ethhdr.type=htons(ETHTYPE_ARP); +returnp; +} +/*-----------------------------------------------------------------------------------*/ + + + + - + diff --git a/doc/xml/assert_8c.xml b/doc/xml/assert_8c.xml index 4ac0463..932871e 100644 --- a/doc/xml/assert_8c.xml +++ b/doc/xml/assert_8c.xml @@ -1,58 +1,102 @@ - - - + + + assert.c assert.h lib/kprintf.h ubixos/kpanic.h - + + + + + - - - - + + + + + + + + + + + + - - - - - - - - + + + + - - - - + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void __assert (const char *func, const char *file, int line, const char *failedexpr) __assert - const char * + const char * func - const char * + const char * file @@ -60,19 +104,20 @@ line - const char * + const char * failedexpr -The underlying assertion call which is wrapped by assert(). +The underlying assertion call which is wrapped by assert() + - - K_PANIC - kprintf - NULL + + K_PANIC + kprintf + NULL @@ -80,53 +125,52 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: assert_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<assert.h> -#include<lib/kprintf.h> -#include<ubixos/kpanic.h> - -void__assert(constchar*func,constchar*file,intline,constchar*failedexpr){ -if(func==NULL) -kprintf("Assertionfailed:(%s),file%s,line%d.\n",failedexpr,file,line); -else -kprintf("Assertionfailed:(%s),function%s,file%s,line%d.\n",failedexpr,func,file,line); - -K_PANIC("Asserted\n"); -} - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<assert.h> +#include<lib/kprintf.h> +#include<ubixos/kpanic.h> + +void__assert(constchar*func,constchar*file,intline,constchar*failedexpr){ +if(func==NULL) +kprintf("Assertionfailed:(%s),file%s,line%d.\n",failedexpr,file,line); +else +kprintf("Assertionfailed:(%s),function%s,file%s,line%d.\n",failedexpr,func,file,line); + +K_PANIC("Asserted\n"); +} + +/*** +END +***/ + - + diff --git a/doc/xml/assert_8h.xml b/doc/xml/assert_8h.xml index 0c11812..2258d43 100644 --- a/doc/xml/assert_8h.xml +++ b/doc/xml/assert_8h.xml @@ -1,162 +1,211 @@ - - - + + + assert.h - src/sys/isa/ne2k.c - src/sys/kernel/bioscall.c - src/sys/kernel/exec.c - src/sys/kernel/fork.c - src/sys/kernel/gen_calls.c - src/sys/kernel/kern_descrip.c - src/sys/kernel/kern_sig.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/ld.c - src/sys/kernel/pipe.c - src/sys/kernel/sched.c - src/sys/kernel/time.c - src/sys/kmods/kmod.c - src/sys/lib/assert.c - src/sys/lib/kmalloc.c - src/sys/sys/device.c - src/sys/ubixfs/dirCache.c - src/sys/ubixfs/ubixfs.c - src/sys/vfs/file.c - src/sys/vmm/paging.c - src/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_string.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/descrip.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_sig.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/pipe.c + C:/Dev/git/UbixOS/sys/kernel/signal.c + C:/Dev/git/UbixOS/sys/kernel/time.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/assert.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/sys/device.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + __BEGIN_DECLS @@ -164,9 +213,9 @@ - + - + __END_DECLS @@ -174,24 +223,24 @@ - + - + _assert e - assert(e) + assert(e) - + - + assert e - ((e) ? (void)0 : __assert(__func__, __FILE__, \ + ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) @@ -199,62 +248,42 @@ - - adjustCowCounter - biosCall - execFile - execThread - fclose - fork_copyProcess - fread - freePage - insertFreeDesc - kfree - kmalloc - kmod_load - ldEnable - NICtoPC - openFileUbixFS - PCtoNIC - readUbixFS - sysExec - ubixfs_cacheAdd - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize - ubixfs_loadData - writeFileByte - writeUbixFS + - + void void __assert (const char *, const char *, int, const char *) __assert - const char * + const char * + func - const char * + const char * + file int + line - const char * + const char * + failedexpr -The underlying assertion call which is wrapped by assert(). +The underlying assertion call which is wrapped by assert() + - - K_PANIC - kprintf - NULL + + K_PANIC + kprintf + NULL @@ -303,36 +332,36 @@ *$FreeBSD:src/include/assert.h,v1.42002/03/2317:24:53impExp$ */ -#ifdefined(__cplusplus) -#define__BEGIN_DECLSextern"C"{ -#define__END_DECLS} -#else -#define__BEGIN_DECLS -#define__END_DECLS -#endif - +#ifdefined(__cplusplus) +#define__BEGIN_DECLSextern"C"{ +#define__END_DECLS} +#else +#define__BEGIN_DECLS +#define__END_DECLS +#endif + /* *UnlikeotherANSIheaderfiles,<assert.h>mayusefullybeincluded *multipletimes,withandwithoutNDEBUGdefined. */ -#undefassert -#undef_assert - -#ifdefNDEBUG -#defineassert(e)((void)0) -#define_assert(e)((void)0) -#else -#define_assert(e)assert(e) - -#defineassert(e)((e)?(void)0:__assert(__func__,__FILE__,\ -__LINE__,#e)) -#endif/*NDEBUG*/ +#undefassert +#undef_assert + +#ifdefNDEBUG +#defineassert(e)((void)0) +#define_assert(e)((void)0) +#else +#define_assert(e)assert(e) + +#defineassert(e)((e)?(void)0:__assert(__func__,__FILE__,\ +__LINE__,#e)) +#endif/*NDEBUG*/ -__BEGIN_DECLS -void__assert(constchar*,constchar*,int,constchar*); -__END_DECLS +__BEGIN_DECLS +void__assert(constchar*,constchar*,int,constchar*); +__END_DECLS - + diff --git a/doc/xml/atan_8c.xml b/doc/xml/atan_8c.xml index da23bfc..fd30c6f 100644 --- a/doc/xml/atan_8c.xml +++ b/doc/xml/atan_8c.xml @@ -1,34 +1,72 @@ - - - + + + atan.c math.h - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - + double double atan (double x) @@ -43,7 +81,7 @@ - + @@ -51,71 +89,67 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: atan_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<math.h> - -doubleatan(doublex){ -return(x);/*QuickHackToMakeThisWork*/ -} - -/*** -$Log: atan_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:10reddawg -nomessage - -Revision1.32004/05/1904:07:43reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.22004/05/1903:46:32reddawg -AFewQuickHacksToMakeThingsWork - -Revision1.1.1.12004/04/1512:07:10reddawg -UbixOSv1.0 - -Revision1.22004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<math.h> + +doubleatan(doublex){ +return(x);/*QuickHackToMakeThisWork*/ +} + +/*** +$Log:atan.c,v$ +Revision1.1.1.12006/06/0112:46:16reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:10reddawg +nomessage + +Revision1.32004/05/1904:07:43reddawg +kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen + +Revision1.22004/05/1903:46:32reddawg +AFewQuickHacksToMakeThingsWork + +Revision1.1.1.12004/04/1512:07:10reddawg +UbixOSv1.0 + +Revision1.22004/04/1316:36:33reddawg +Changedourcopyright,itisallnowunderaBSD-Stylelicense + +END +***/ + - + diff --git a/doc/xml/atkbd_8c.xml b/doc/xml/atkbd_8c.xml index f9d3241..cc730cc 100644 --- a/doc/xml/atkbd_8c.xml +++ b/doc/xml/atkbd_8c.xml @@ -1,8 +1,8 @@ - - - + + + atkbd.c - isa/atkbd.h + isa/atkbd.h isa/8259.h sys/video.h sys/idt.h @@ -10,7 +10,6 @@ sys/io.h lib/kmalloc.h lib/kprintf.h - ubixos/types.h ubixos/sched.h ubixos/endtask.h ubixos/tty.h @@ -18,404 +17,517 @@ ubixos/kpanic.h ubixos/vitals.h - - - - + + + + - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - asm - (".globl atkbd_isr \n""atkbd_isr: \n"" pusha \n"" push %ss \n"" push %ds \n"" push %es \n"" push %fs \n"" push %gs \n"" call keyboardHandler \n"" mov $0x20,%dx \n"" mov $0x20,%ax \n"" outb %al,%dx \n"" pop %gs \n"" pop %fs \n"" pop %es \n"" pop %ds \n"" pop %ss \n"" popa \n"" iret \n") - asm - - ".globl atkbd_isr \n""atkbd_isr: \n"" pusha \n"" push %ss \n"" push %ds \n"" push %es \n"" push %fs \n"" push %gs \n"" call keyboardHandler \n"" mov $ - 0x20 - - - %dx\n""mov $ - 0x20 - - - %ax\n""outb% - al - - - %dx\n""pop%gs\n""pop%fs\n""pop%es\n""pop%ds\n""pop%ss\n""popa\n""iret\n" - - - - - - - - - - - int - int atkbd_init - () - atkbd_init - - - - - - - - atkbd_isr - atkbd_scan - dDpl0 - dInt - dPresent - irqEnable - kprintf - mVec - setLED - setVector - stdinBuffer - x1 - - - int - static int atkbd_scan - () - atkbd_scan - - - - - - - - inportByte - outportByte - atkbd_init - keyboardHandler - - - unsigned char - unsigned char getch - () - getch - - - - - - - - tty_termNode::stdin - stdinBuffer - tty_termNode::stdinSize - stdinSize - tty_foreground - x1 - sysFgetc - - - void - void keyboardHandler - () - keyboardHandler - - - - - - - - altKey - atkbd_scan - atkbdSpinLock - backSpace - controlKey - controlKeys - vitalsStruct::freePages - inportByte - K_PANIC - keyboardMap - keyMap - kprintf - ledCapslock - ledNumlock - ledScrolllock - ledStatus - outportByte - setLED - shiftKey - spinTryLock - spinUnlock - tty_termNode::stdin - stdinBuffer - tty_termNode::stdinSize - stdinSize - systemVitals - tty_change - tty_foreground - - - void - void setLED - () - setLED - - - - - - - - inportByte - ledStatus - outportByte - atkbd_init - keyboardHandler - - - - spinLock_t - spinLock_t atkbdSpinLock + + struct spinLock + struct spinLock atkbdSpinLock atkbdSpinLock - SPIN_LOCK_INITIALIZER + = SPIN_LOCK_INITIALIZER - - keyboardHandler + - - uInt32 + + uInt32 uInt32 controlKeys controlKeys - 0x0 + = 0x0 - - keyboardHandler + - + unsigned int unsigned int keyboardMap[255][8] [255][8] @@ -426,41 +538,37 @@ - - keyboardHandler + - + unsigned int unsigned int keyMap keyMap - 0x0 + = 0x0 - - keyboardHandler + - + unsigned int unsigned int ledStatus ledStatus - 0x0 + = 0x0 - - keyboardHandler - setLED + - + char char stdinBuffer[512] [512] @@ -471,13 +579,10 @@ - - atkbd_init - getch - keyboardHandler + - - uInt16 + + uInt16 uInt16 stdinSize stdinSize @@ -487,9 +592,129 @@ - - getch - keyboardHandler + + + + + + + asm + (".globl atkbd_isr \n" "atkbd_isr: \n" "push $0x80\n" "push $0x80\n" " pusha \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call keyboardHandler \n" " add $0x4,%esp\n" " mov $0x20,%dx \n" " mov $0x20,%ax \n" " outb %al,%dx \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popa \n" " add $0x8,%esp\n" " iret \n") + asm + + ".globl atkbd_isr \n" "atkbd_isr: \n" "push $0x80\n" "push $0x80\n" " pusha \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call keyboardHandler \n" " add + $0x4 + + + %esp\n" " mov + $0x20 + + + %dx \n" " mov + $0x20 + + + %ax \n" " outb % + al + + + %dx \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popa \n" " add + $0x8 + + + %esp\n" " iret \n" + + + + + + + + + + + int + int atkbd_init + () + atkbd_init + + + + + + + + atkbd_isr + dDpl0 + dInt + dPresent + mVec + setLED + setVector + + + int + static int atkbd_scan + () + atkbd_scan + + + + + + + + + + int + int getchar + () + getchar + + + + + + + + tty_foreground + sys_fgetc + sys_pread + sys_read + + + void + void keyboardHandler + (struct trapframe *frame) + keyboardHandler + + struct trapframe * + frame + + + + + + + + + spinTryLock + + + void + void setLED + () + setLED + + + + + + + + inportByte + outportByte + atkbd_init @@ -497,503 +722,401 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: atkbd_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<isa/atkbd.h> -#include<isa/8259.h> -#include<sys/video.h> -#include<sys/idt.h> -#include<sys/gdt.h> -#include<sys/io.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<ubixos/types.h> -#include<ubixos/sched.h> -#include<ubixos/endtask.h> -#include<ubixos/tty.h> -#include<ubixos/spinlock.h> -#include<ubixos/kpanic.h> -#include<ubixos/vitals.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<isa/atkbd.h> +#include<isa/8259.h> +#include<sys/video.h> +#include<sys/idt.h> +#include<sys/gdt.h> +#include<sys/io.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<ubixos/sched.h> +#include<ubixos/endtask.h> +#include<ubixos/tty.h> +#include<ubixos/spinlock.h> +#include<ubixos/kpanic.h> +#include<ubixos/vitals.h> + +staticintatkbd_scan(); -staticintatkbd_scan(); - -staticunsignedintkeyMap=0x0; -staticunsignedintledStatus=0x0; -staticcharstdinBuffer[512]; -staticuInt16stdinSize; -staticuInt32controlKeys=0x0; +staticunsignedintkeyMap=0x0; +staticunsignedintledStatus=0x0; +staticcharstdinBuffer[512]; +staticuInt16stdinSize; +staticuInt32controlKeys=0x0; + +staticstructspinLockatkbdSpinLock=SPIN_LOCK_INITIALIZER; -staticspinLock_tatkbdSpinLock=SPIN_LOCK_INITIALIZER; - -staticunsignedintkeyboardMap[255][8]={ -/*Ascii,Shift,Ctrl,Alt,Num,Caps,ShiftCaps,ShiftNum*/ -{0,0,0,0,0,0,0,0}, -/*ESC*/{0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B}, -/*1,!*/{0x31,0x21,0,0,0x31,0x31,0x21,0x21}, -/*2,@*/{0x32,0x40,0,0,0x32,0x32,0x40,0x40}, -/*3,#*/{0x33,0x23,0,0,0x33,0x33,0x23,0x23}, -/*4,$*/{0x34,0x24,0,0,0x34,0x34,0x24,0x24}, -/*5,%*/{0x35,0x25,0,0,0x35,0x35,0x25,0x25}, -/*6,^*/{0x36,0x5E,0,0,0x36,0x36,0x5E,0x5E}, -/*7,&*/{0x37,0x26,0,0,0x37,0x37,0x26,0x26}, -/*8,**/{0x38,0x2A,0,0,0x38,0x38,0x2A,0x2A}, -/*9.(*/{0x39,0x28,0,0,0x39,0x39,0x28,0x28}, -/*0,)*/{0x30,0x29,0,0,0x30,0x30,0x29,0x29}, -/*-,_*/{0x2D,0x5F,0,0,0x2D,0x2D,0x5F,0x5F}, -/*=,+*/{0x3D,0x2B,0,0,0x3D,0x3D,0x2B,0x2B}, -/*14*/{0x08,0x08,0x8,0x8,0x08,0x08,0x08,0x08}, -/*15*/{0x09,0,0,0,0,0,0,0}, -/**/{0x71,0x51,0,0,0,0,0,0}, -/**/{0x77,0x57,0,0,0,0,0,0}, -/**/{0x65,0x45,0,0,0,0,0,0}, -/**/{0x72,0x52,0,0,0,0,0,0}, -/**/{0x74,0x54,0,0,0,0,0,0}, -/**/{0x79,0x59,0,0,0,0,0,0}, -/**/{0x75,0x55,0,0,0,0,0,0}, -/**/{0x69,0x49,0,0,0,0,0,0}, -/**/{0x6F,0x4F,0,0,0,0,0,0}, -/**/{0x70,0x50,0,0,0,0,0,0}, -/**/{0x5B,0x7B,0,0,0,0,0,0}, -/**/{0x5D,0x7D,0,0,0,0,0,0}, -/**/{0x0A,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/*a,A*/{0x61,0x41,0x41,0,0,0,0,0}, -/**/{0x73,0x53,0,0,0,0,0,0}, -/**/{0x64,0x44,0,0,0,0,0,0}, -/**/{0x66,0x46,0,0,0,0,0,0}, -/**/{0x67,0x47,0,0,0,0,0,0}, -/**/{0x68,0x48,0,0,0,0,0,0}, -/**/{0x6A,0x4A,0,0,0,0,0,0}, -/**/{0x6B,0x4B,0,0,0,0,0,0}, -/**/{0x6C,0x4C,0,0,0,0,0,0}, -/**/{0x3B,0x3A,0,0,0,0,0,0}, -/**/{0x27,0x22,0,0,0,0,0,0}, -/**/{0x60,0x7E,0,0,0,0,0,0}, -/**/{0x2A,0x0,0,0,0,0,0,0}, -/**/{0x5C,0x3C,0,0,0,0,0,0}, -/**/{0x7A,0x5A,0,0,0,0,0,0}, -/**/{0x78,0x58,0,0,0,0,0,0}, -/*c,C*/{0x63,0x43,0x3,0x9,0,0,0,0}, -/**/{0x76,0x56,0,0,0,0,0,0}, -/**/{0x62,0x42,0,0,0,0,0,0}, -/**/{0x6E,0x4E,0,0,0,0,0,0}, -/**/{0x6D,0x4D,0,0,0,0,0,0}, -/**/{0x2C,0x3C,0,0,0,0,0,0}, -/**/{0x2E,0x3E,0,0,0,0,0,0}, -/**/{0x2F,0x3F,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/**/{0x20,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/*F1*/{0x3000,0,0,0x3000,0,0,0,0}, -/**/{0x3001,0,0,0x3001,0,0,0,0}, -/**/{0x3002,0,0,0x3002,0,0,0,0}, -/**/{0x3003,0,0,0x3003,0,0,0,0}, -/**/{0x3004,0,0,0x3004,0,0,0,0}, -/**/{0x4000,0,0,0,0,0,0,0}, -/**/{0x4100,0,0,0,0,0,0,0}, -/**/{0x4200,0,0,0,0,0,0,0}, -/**/{0x4300,0,0,0,0,0,0,0}, -/**/{0x4400,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/**/{0x4700,0,0,0,0,0,0,0}, -/**/{0x4800,0,0,0,0,0,0,0}, -/**/{0x4900,0,0,0,0,0,0,0}, -/**/{0x2D,0,0,0,0,0,0,0}, -/**/{0x4B00,0,0,0,0,0,0,0}, -/**/{0x4C00,0,0,0,0,0,0,0}, -/**/{0x4D00,0,0,0,0,0,0,0}, -/**/{0x2B,0,0,0,0,0,0,0}, -/**/{0x4F00,0,0,0,0,0,0,0}, -/**/{0x5000,0,0,0,0,0,0,0}, -/**/{0x5100,0,0,0,0,0,0,0}, -/**/{0x5200,0,0,0,0,0,0,0}, -/**/{0x5300,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0}, -/**/{0,0,0,0,0,0,0,0} -}; - -/************************************************************************ - -Function:intatkbd_init - -Description:Thisfunctionisusedtoturnonthekeyboard - -Notes: - -02/20/2004-Approvedforquality - -************************************************************************/ -intatkbd_init(){ -/*InserttheIDTvectorforthekeyboardhandler*/ -setVector(&atkbd_isr,mVec+0x1,dPresent+dInt+dDpl0); - -/*SettheLEDStotheirdefaults*/ -setLED(); - -/*ClearKeyboard*/ -atkbd_scan(); - -/*Turnonthekeyboardvector*/ -irqEnable(0x1); - -/*Printoutinformationonkeyboard*/ -kprintf("atkbd0-Address:[0x%X],KeyboardBuffer:[0x%X],BufferSize[%i]\n",&atkbd_isr,&stdinBuffer,512); - -/*Returnsoweknoweverythingwentwell*/ -return(0x0); -} - -/* -*2-23-2004mjiIthinkthepusha/popashouldbepushal/popal -*/ - -asm( -".globlatkbd_isr\n" -"atkbd_isr:\n" +staticunsignedintkeyboardMap[255][8]={ +/*Ascii,Shift,Ctrl,Alt,Num,Caps,ShiftCaps,ShiftNum*/ +{0,0,0,0,0,0,0,0}, +/*ESC*/{0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B}, +/*1,!*/{0x31,0x21,0,0,0x31,0x31,0x21,0x21}, +/*2,@*/{0x32,0x40,0,0,0x32,0x32,0x40,0x40}, +/*3,#*/{0x33,0x23,0,0,0x33,0x33,0x23,0x23}, +/*4,$*/{0x34,0x24,0,0,0x34,0x34,0x24,0x24}, +/*5,%*/{0x35,0x25,0,0,0x35,0x35,0x25,0x25}, +/*6,^*/{0x36,0x5E,0,0,0x36,0x36,0x5E,0x5E}, +/*7,&*/{0x37,0x26,0,0,0x37,0x37,0x26,0x26}, +/*8,**/{0x38,0x2A,0,0,0x38,0x38,0x2A,0x2A}, +/*9.(*/{0x39,0x28,0,0,0x39,0x39,0x28,0x28}, +/*0,)*/{0x30,0x29,0,0,0x30,0x30,0x29,0x29}, +/*-,_*/{0x2D,0x5F,0,0,0x2D,0x2D,0x5F,0x5F}, +/*=,+*/{0x3D,0x2B,0,0,0x3D,0x3D,0x2B,0x2B}, +/*14*/{0x08,0x08,0x8,0x8,0x08,0x08,0x08,0x08}, +/*15*/{0x09,0,0,0,0,0,0,0}, +/**/{0x71,0x51,0,0,0,0,0,0}, +/**/{0x77,0x57,0,0,0,0,0,0}, +/*e,E*/{0x65,0x45,0x05,0,0,0,0,0}, +/**/{0x72,0x52,0,0,0,0,0,0}, +/**/{0x74,0x54,0,0,0,0,0,0}, +/**/{0x79,0x59,0,0,0,0,0,0}, +/**/{0x75,0x55,0,0,0,0,0,0}, +/**/{0x69,0x49,0,0,0,0,0,0}, +/**/{0x6F,0x4F,0,0,0,0,0,0}, +/**/{0x70,0x50,0,0,0,0,0,0}, +/**/{0x5B,0x7B,0,0,0,0,0,0}, +/**/{0x5D,0x7D,0,0,0,0,0,0}, +/**/{0x0A,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/*a,A*/{0x61,0x41,0x01,0,0,0,0,0}, +/**/{0x73,0x53,0,0,0,0,0,0}, +/*d,D*/{0x64,0x44,0x04,0,0,0,0,0}, +/*f,F*/{0x66,0x46,0x06,0,0,0,0,0}, +/*g,G*/{0x67,0x47,0x07,0,0,0,0,0}, +/*h,H*/{0x68,0x48,0x08,0,0,0,0,0}, +/**/{0x6A,0x4A,0,0,0,0,0,0}, +/**/{0x6B,0x4B,0,0,0,0,0,0}, +/**/{0x6C,0x4C,0,0,0,0,0,0}, +/**/{0x3B,0x3A,0,0,0,0,0,0}, +/**/{0x27,0x22,0,0,0,0,0,0}, +/**/{0x60,0x7E,0,0,0,0,0,0}, +/**/{0x2A,0x0,0,0,0,0,0,0}, +/**/{0x5C,0x3C,0,0,0,0,0,0}, +/**/{0x7A,0x5A,0,0,0,0,0,0}, +/*x,X*/{0x78,0x58,0x18,0,0,0,0,0}, +/*c,C*/{0x63,0x43,0x03,0x9,0,0,0,0}, +/**/{0x76,0x56,0,0,0,0,0,0}, +/*b,B*/{0x62,0x42,0x02,0,0,0,0,0}, +/**/{0x6E,0x4E,0,0,0,0,0,0}, +/**/{0x6D,0x4D,0,0,0,0,0,0}, +/**/{0x2C,0x3C,0,0,0,0,0,0}, +/**/{0x2E,0x3E,0,0,0,0,0,0}, +/**/{0x2F,0x3F,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/**/{0x20,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/*F1*/{0x3000,0,0,0x3000,0,0,0,0}, +/**/{0x3001,0,0,0x3001,0,0,0,0}, +/**/{0x3002,0,0,0x3002,0,0,0,0}, +/**/{0x3003,0,0,0x3003,0,0,0,0}, +/**/{0x3004,0,0,0x3004,0,0,0,0}, +/**/{0x4000,0,0,0,0,0,0,0}, +/**/{0x4100,0,0,0,0,0,0,0}, +/**/{0x4200,0,0,0,0,0,0,0}, +/**/{0x4300,0,0,0,0,0,0,0}, +/**/{0x4400,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/**/{0x4700,0,0,0,0,0,0,0}, +/**/{0x4800,0,0,0,0,0,0,0}, +/**/{0x4900,0,0,0,0,0,0,0}, +/**/{0x2D,0,0,0,0,0,0,0}, +/**/{0x4B00,0,0,0,0,0,0,0}, +/**/{0x4C00,0,0,0,0,0,0,0}, +/**/{0x4D00,0,0,0,0,0,0,0}, +/**/{0x2B,0,0,0,0,0,0,0}, +/**/{0x4F00,0,0,0,0,0,0,0}, +/**/{0x5000,0,0,0,0,0,0,0}, +/**/{0x5100,0,0,0,0,0,0,0}, +/**/{0x5200,0,0,0,0,0,0,0}, +/**/{0x5300,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}, +/**/{0,0,0,0,0,0,0,0}}; + +/************************************************************************ + +Function:intatkbd_init + +Description:Thisfunctionisusedtoturnonthekeyboard + +Notes: + +02/20/2004-Approvedforquality + +************************************************************************/ +intatkbd_init(){ + +/*InserttheIDTvectorforthekeyboardhandler*/ +setVector(&atkbd_isr,mVec+0x1,dPresent+dInt+dDpl0); + +/*SettheLEDStotheirdefaults*/ +setLED(); + +/*ClearKeyboard*/ +atkbd_scan(); + +/*Turnonthekeyboardvector*/ +irqEnable(0x1); + +/*Printoutinformationonkeyboard*/ +kprintf("atkbd0-Address:[0x%X],KeyboardBuffer:[0x%X],BufferSize[%i]\n",&atkbd_isr,&stdinBuffer,512); + +/*Returnsoweknoweverythingwentwell*/ +return(0x0); +} + +/* +*2-23-2004mjiIthinkthepusha/popashouldbepushal/popal +*/ + +asm( +".globlatkbd_isr\n" +"atkbd_isr:\n" +"push$0x80\n" +"push$0x80\n" "pusha\n"/*Saveallregisters*/ -"push%ss\n" -"push%ds\n" -"push%es\n" -"push%fs\n" -"push%gs\n" +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" "callkeyboardHandler\n" -"mov$0x20,%dx\n" -"mov$0x20,%ax\n" -"outb%al,%dx\n" -"pop%gs\n" -"pop%fs\n" -"pop%es\n" -"pop%ds\n" -"pop%ss\n" +"add$0x4,%esp\n" +"mov$0x20,%dx\n" +"mov$0x20,%ax\n" +"outb%al,%dx\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" "popa\n" -"iret\n"/*Exitinterrupt*/ -); - -staticintatkbd_scan(){ -intcode=0x0; -intval=0x0; - -code=inportByte(0x60); -val=inportByte(0x61); - -outportByte(0x61,val|0x80); -outportByte(0x61,val); - -return(code); -} - -voidkeyboardHandler(){ -intkey=0x0; - -if(!spinTryLock(&atkbdSpinLock)) -return; - -key=atkbd_scan(); - -if(key>255) -return; - -/*ControlKey*/ -if(key==0x1D&&!(controlKeys&controlKey)){ -controlKeys|=controlKey; -} -if(key==0x80+0x1D){ -controlKeys&=(0xFF-controlKey); -} -/*ALTKey*/ -if(key==0x38&&!(controlKeys&altKey)){ -controlKeys|=altKey; -} -if(key==0x80+0x38){ -controlKeys&=(0xFF-altKey); -} -/*ShiftKey*/ -if((key==0x2A||key==0x36)&&!(controlKeys&shiftKey)){ -controlKeys|=shiftKey; -} -if((key==0x80+0x2A)||(key==0x80+0x36)){ -controlKeys&=(0xFF-shiftKey); -} -/*CapsLock*/ -if(key==0x3A){ -ledStatus^=ledCapslock; -setLED(); -} -/*NumLock*/ -if(key==0x45){ -ledStatus^=ledNumlock; -setLED(); -} -/*ScrollLock*/ -if(key==0x46){ -ledStatus^=ledScrolllock; -setLED(); -} -/*PickWhichKeyMap*/ -if(controlKeys==0){keyMap=0;} -elseif(controlKeys==1){keyMap=1;} -elseif(controlKeys==2){keyMap=2;} -elseif(controlKeys==4){keyMap=3;} -/*IfKeyIsNotNullAddItToHandler*/ -if(((uInt)(keyboardMap[key][keyMap])>0)&&((uInt32)(keyboardMap[key][keyMap])<0xFF)){ -switch((uInt32)keyboardMap[key][keyMap]){ -case8: -backSpace(); -if(tty_foreground==0x0){ -stdinBuffer[stdinSize]=keyboardMap[key][keyMap]; -stdinSize++; -} -else{ -tty_foreground->stdin[tty_foreground->stdinSize]=keyboardMap[key][keyMap]; -tty_foreground->stdinSize++; -} -break; -case0x3: -//if(tty_foreground!=0x0) -//endTask(tty_foreground->owner); -K_PANIC("CTRL-Cpressed\n"); -kprintf("FreePages:[0x%X]\n",systemVitals->freePages); -break; -case0x9: -kprintf("REBOOTING"); -while(inportByte(0x64)&0x02); -outportByte(0x64,0xFE); -break; -default: -if(tty_foreground==0x0){ -stdinBuffer[stdinSize]=keyboardMap[key][keyMap]; -stdinSize++; -} -else{ -tty_foreground->stdin[tty_foreground->stdinSize]=keyboardMap[key][keyMap]; -tty_foreground->stdinSize++; -} -break; -} -} -else{ -switch((keyboardMap[key][keyMap]>>8)){ -case0x30: -tty_change(keyboardMap[key][keyMap]&0xFF); -//kprintf("ChangingConsoles[0x%X:0x%X]\n",_current->id,_current); -break; -default: -break; -} -} - -/*Return*/ -spinUnlock(&atkbdSpinLock); -return; -} - -voidsetLED(){ -outportByte(0x60,0xED); -while(inportByte(0x64)&2); -outportByte(0x60,ledStatus); -while(inportByte(0x64)&2); -} - -/*Temp*/ -unsignedchargetch(){ -uInt8retKey=0x0; -uInt32i=0x0; - -/* -if((stdinSize<=0)&&(tty_foreground==0x0)){ -sched_yield(); -} -if((tty_foreground!=0x0)&&(tty_foreground->stdinSize<=0x0)){ -sched_yield(); -} -*/ - -/* -if(!spinTryLock(&atkbdSpinLock)) -return(0x0); -*/ - -if(tty_foreground==0x0){ -if(stdinSize==0x0){ -//spinUnlock(&atkbdSpinLock); -return(0x0); -} - -retKey=stdinBuffer[0]; -stdinSize--; - -for(i=0x0;i<stdinSize;i++){ -stdinBuffer[i]=stdinBuffer[i+0x1]; -} -} -else{ -if(tty_foreground->stdinSize==0x0){ -//spinUnlock(&atkbdSpinLock); -return(0x0); -} - -retKey=tty_foreground->stdin[0]; -tty_foreground->stdinSize--; - -for(i=0x0;i<tty_foreground->stdinSize;i++){ -tty_foreground->stdin[i]=tty_foreground->stdin[i+0x1]; -} -} -//spinUnlock(&atkbdSpinLock); -return(retKey); -} - -/*** - -$Log: atkbd_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.52006/12/0517:01:15reddawg -Modifiedkpanic - -Revision1.42006/12/0514:10:21reddawg -WorkignDistro - -Revision1.32006/12/0105:12:35reddawg -We'realmostthere...:) - -Revision1.22006/10/1917:52:17reddawg -WorkingOnUserland - -Revision1.1.1.12006/06/0112:46:12reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:01reddawg -nomessage - -Revision1.292004/09/1121:38:00reddawg -Fixedafewproblems - -Revision1.282004/09/0823:19:58reddawg -hmm - -Revision1.272004/09/0721:54:38reddawg -okrevertedbacktooldschedulingfornow.... - -Revision1.262004/09/0622:18:52reddawg -okbedtime - -Revision1.252004/09/0622:11:29reddawg -tty:noweachttyhasastdin.... - -Revision1.242004/09/0615:13:25reddawg -LastcommitbeforeFreeBSD6.0 - -Revision1.232004/08/2123:47:50reddawg -***emptylogmessage*** - -Revision1.222004/08/0912:58:05reddawg -letmeknowwhenyougotthesurce - -Revision1.212004/08/0622:32:16reddawg -UbixWorksAgain - -Revision1.192004/08/0318:31:19reddawg -virtualterms - -Revision1.182004/07/2921:32:16reddawg -Myquicklunchsbreaksworthofupdates.... - -Revision1.172004/07/2818:45:39reddawg -movementoffiles - -Revision1.162004/07/2817:07:25reddawg -MPI:movedthesyscalls - -Revision1.152004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.142004/07/2505:32:58reddawg -fixed - -Revision1.132004/07/2505:24:39reddawg -atkbd:removedsti...doesitstillmisskeys - -Revision1.122004/07/2420:00:51reddawg -Lotsofchangestothevmmsubsystem....Pagefaultshavebeenadjusttonowbeblockingonaperthreadbasisnotsystemwide.Thishasresultedinnomoredeadlocks..alsotheadditionofperthreadlockinghasremovedsegfaultsasaresultofCOWinwhichtwotasksfaultthesameCOWpageandtrytomodifyit. - -Revision1.112004/07/2415:12:56reddawg -NowI'mcurrent - -Revision1.102004/07/2317:49:58reddawg -atkbd:adjustthetimingissueonthedriverhopefullyitwillworkfinenow - -Revision1.92004/07/2317:37:35reddawg -Fix - -Revision1.82004/07/2309:10:06reddawg -ubixfs:cleanedupsomefunctionsplayedwiththecachingabit -vfs:renamedabunchoffunctions -cleanedupafewmiscbugs - -Revision1.72004/07/2220:53:07reddawg -atkbd:fixedproblem - -Revision1.62004/07/0913:34:51reddawg -keyboard:keyboardInittoatkbd_init -Adjustedinitializationroutines - -Revision1.52004/06/1714:49:14reddawg -atkbd:convertedsomevariablestostatic - -Revision1.42004/06/0410:19:42reddawg -notes:wecompileagain,thankg-danywaysiwasabouttocry - -Revision1.32004/05/1904:07:42reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.22004/05/1002:23:24reddawg -MinorChangesToSourceCodeToPrepareItForOpenSourceRelease - -Revision1.1.1.12004/04/1512:07:09reddawg -UbixOSv1.0 - -Revision1.192004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +"add$0x8,%esp\n" +"iret\n"/*Exitinterrupt*/ +); + +staticintatkbd_scan(){ +intcode=0x0; +intval=0x0; + +code=inportByte(0x60); +val=inportByte(0x61); + +outportByte(0x61,val|0x80); +outportByte(0x61,val); + +return(code); +} + +voidkeyboardHandler(structtrapframe*frame){ +intkey=0x0; + +if(spinTryLock(&atkbdSpinLock)) +return; + +key=atkbd_scan(); + +if(key>255) +return; + + +/*ControlKey*/ +if(key==0x1D&&!(controlKeys&controlKey)){ +controlKeys|=controlKey; +} +if(key==0x80+0x1D){ +controlKeys&=(0xFF-controlKey); +} +/*ALTKey*/ +if(key==0x38&&!(controlKeys&altKey)){ +controlKeys|=altKey; +} +if(key==0x80+0x38){ +controlKeys&=(0xFF-altKey); +} +/*ShiftKey*/ +if((key==0x2A||key==0x36)&&!(controlKeys&shiftKey)){ +controlKeys|=shiftKey; +} +if((key==0x80+0x2A)||(key==0x80+0x36)){ +controlKeys&=(0xFF-shiftKey); +} +/*CapsLock*/ +if(key==0x3A){ +ledStatus^=ledCapslock; +setLED(); +} +/*NumLock*/ +if(key==0x45){ +ledStatus^=ledNumlock; +setLED(); +} +/*ScrollLock*/ +if(key==0x46){ +ledStatus^=ledScrolllock; +setLED(); +} +/*PickWhichKeyMap*/ +if(controlKeys==0){ +keyMap=0; +} +elseif(controlKeys==1){ +keyMap=1; +} +elseif(controlKeys==2){ +keyMap=2; +} +elseif(controlKeys==4){ +keyMap=3; +} +/*IfKeyIsNotNullAddItToHandler*/ +if(((uInt)(keyboardMap[key][keyMap])>0)&&((uInt32)(keyboardMap[key][keyMap])<0xFF)){ +switch((uInt32)keyboardMap[key][keyMap]){ +case8: +backSpace(); +if(tty_foreground==0x0){ +stdinBuffer[stdinSize]=keyboardMap[key][keyMap]; +stdinSize++; +} +else{ +tty_foreground->stdin[tty_foreground->stdinSize]=keyboardMap[key][keyMap]; +tty_foreground->stdinSize++; +} +break; +case0x3: +//if(tty_foreground!=0x0) +//endTask(tty_foreground->owner); +//K_PANIC("CTRL-Cpressed\n"); +kprintf("FreePages:[0x%X]\n",systemVitals->freePages); +sched_setStatus(tty_foreground->owner,DEAD); +break; +case0x9: +kprintf("REBOOTING"); +while(inportByte(0x64)&0x02) +; +outportByte(0x64,0xFE); +break; +case0x18: +if(tty_foreground->owner==_current->id) +die_if_kernel("CTRL-X",frame,frame->tf_eax); +break; +default: +if(tty_foreground==0x0){ +stdinBuffer[stdinSize]=keyboardMap[key][keyMap]; +stdinSize++; +} +else{ +tty_foreground->stdin[tty_foreground->stdinSize]=keyboardMap[key][keyMap]; +tty_foreground->stdinSize++; +} +break; +} +} +else{ +switch((keyboardMap[key][keyMap]>>8)){ +case0x30: +tty_change(keyboardMap[key][keyMap]&0xFF); +//kprintf("ChangingConsoles[0x%X:0x%X]\n",_current->id,_current); +break; +default: +break; +} +} + +/*Return*/ +spinUnlock(&atkbdSpinLock); +return; +} + +voidsetLED(){ +outportByte(0x60,0xED); +while(inportByte(0x64)&2) +; +outportByte(0x60,ledStatus); +while(inportByte(0x64)&2) +; +} + +/*Temp*/ +intgetchar(){ +//uInt8retKey=0x0; +intretKey=0x0; +uInt32i=0x0; + +/* +if((stdinSize<=0)&&(tty_foreground==0x0)){ +sched_yield(); +} +if((tty_foreground!=0x0)&&(tty_foreground->stdinSize<=0x0)){ +sched_yield(); +} +*/ + +/* +if(spinTryLock(&atkbdSpinLock)) +return(0x0); +*/ + +if(tty_foreground==0x0){ +if(stdinSize==0x0){ +//spinUnlock(&atkbdSpinLock); +return(0x0); +} + +retKey=stdinBuffer[0]; +stdinSize--; + +for(i=0x0;i<stdinSize;i++){ +stdinBuffer[i]=stdinBuffer[i+0x1]; +} +} +else{ +if(tty_foreground->stdinSize==0x0){ +//spinUnlock(&atkbdSpinLock); +return(0x0); +} + +retKey=tty_foreground->stdin[0]; +tty_foreground->stdinSize--; + +for(i=0x0;i<tty_foreground->stdinSize;i++){ +tty_foreground->stdin[i]=tty_foreground->stdin[i+0x1]; +} +} +//spinUnlock(&atkbdSpinLock); +return(retKey); +} - + diff --git a/doc/xml/bioscall_8h.xml b/doc/xml/bioscall_8h.xml index 134bad8..1f870c3 100644 --- a/doc/xml/bioscall_8h.xml +++ b/doc/xml/bioscall_8h.xml @@ -1,48 +1,107 @@ - - - + + + bioscall.h - ubixos/types.h - src/sys/kernel/bioscall.c - src/sys/kernel/systemtask.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/sde/ogDisplay_UbixOS.cc - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + - + + + + + + + - - - + + + - - - + + + - + EFLAG_IF 0x200 @@ -51,11 +110,9 @@ - - _int13 - biosCall + - + EFLAG_IOPL3 0x3000 @@ -64,9 +121,9 @@ - + - + EFLAG_TF 0x100 @@ -75,9 +132,9 @@ - + - + EFLAG_VM 0x20000 @@ -86,13 +143,11 @@ - - _int13 - biosCall + - + void void bios16Code () @@ -103,10 +158,10 @@ - - biosCall + + biosCall - + void void biosCall (int biosInt, int eax, int ebx, int ecx, int edx, int esi, int edi, int es, int ds) @@ -153,49 +208,55 @@ - - _current - assert - tssStruct::back_link - bios16Code - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::eax - tssStruct::ebp - tssStruct::ebx - tssStruct::ecx - tssStruct::edi - tssStruct::edx - EFLAG_IF - EFLAG_VM - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - tssStruct::fs - tssStruct::gs - tssStruct::io_map - kmalloc - tssStruct::ldt - taskStruct::oInfo - READY - schedNewTask - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - taskStruct::state - tssStruct::trace_bitmap - taskStruct::tss - osInfo::v86Task - x1000 - x2000 - systemTask + + _current + assert + tssStruct::back_link + bios16Code + tssStruct::cr3 + tssStruct::cs + tssStruct::ds + tssStruct::eax + tssStruct::ebp + tssStruct::ebx + tssStruct::ecx + tssStruct::edi + tssStruct::edx + EFLAG_IF + EFLAG_VM + tssStruct::eflags + tssStruct::eip + tssStruct::es + tssStruct::esi + tssStruct::esp + tssStruct::esp0 + tssStruct::esp1 + tssStruct::esp2 + tssStruct::fs + tssStruct::gs + taskStruct::id + tssStruct::io_map + kernelPageDirectory + kmalloc + kprintf + tssStruct::ldt + taskStruct::oInfo + READY + sched_yield + schedNewTask + tssStruct::ss + tssStruct::ss0 + tssStruct::ss1 + tssStruct::ss2 + taskStruct::state + tssStruct::trace_bitmap + taskStruct::tss + osInfo::v86Task + vmm_getFreeKernelPage + ogDisplay_UbixOS::GetModeInfo + ogDisplay_UbixOS::GetVESAInfo + initVESAMode + systemTask @@ -203,71 +264,67 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: bioscall_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_BIOSCALL_H -#define_BIOSCALL_H - -#include<ubixos/types.h> - -#defineEFLAG_TF0x100 -#defineEFLAG_IF0x200 -#defineEFLAG_IOPL30x3000 -#defineEFLAG_VM0x20000 - -voidbiosCall(intbiosInt,inteax,intebx,intecx,intedx,intesi,intedi,intes,intds); -voidbios16Code(); - -#endif - -/*** -$Log: bioscall_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:40reddawg -nomessage - -Revision1.22004/05/2115:00:27reddawg -Cleanedup +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_ISA_BIOSCALL_H +#define_ISA_BIOSCALL_H + +#include<sys/types.h> + +#defineEFLAG_TF0x100 +#defineEFLAG_IF0x200 +#defineEFLAG_IOPL30x3000 +#defineEFLAG_VM0x20000 + +voidbiosCall(intbiosInt,inteax,intebx,intecx,intedx,intesi,intedi,intes,intds); +voidbios16Code(); + +#endif + +/*** +$Log:bioscall.h,v$ +Revision1.1.1.12006/06/0112:46:13reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:40reddawg +nomessage + +Revision1.22004/05/2115:00:27reddawg +Cleanedup + - -END -***/ +END +***/ - + diff --git a/doc/xml/block_8c.xml b/doc/xml/block_8c.xml index 2a2f7e6..69e9a47 100644 --- a/doc/xml/block_8c.xml +++ b/doc/xml/block_8c.xml @@ -1,154 +1,446 @@ - - - + + + block.c - ubixfs/ubixfs.h - vfs/file.h + ubixfs/ubixfs.h + vfs/file.h vfs/mount.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - + - - - - + + + + - - - + - - - - + + + + - - - - - - - - + + + + - - - - + + + + - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - + + + + - - - - + + + + - - - - - + - - - - - + + + - + int int freeBlocks - (int block, fileDescriptor *fd) + (int block, fileDescriptor_t *fd) freeBlocks int block - fileDescriptor * + fileDescriptor_t * fd @@ -157,25 +449,25 @@ - - blockAllocationTableEntry::attributes - ubixFSInfo::blockAllocationTable - vfs_mountPoint::fsInfo - fileDescriptorStruct::mp - blockAllocationTableEntry::nextBlock - syncBat + + blockAllocationTableEntry::attributes + ubixFSInfo::blockAllocationTable + vfs_mountPoint::fsInfo + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + syncBat - + int int getFreeBlocks - (int count, fileDescriptor *fd) + (int count, fileDescriptor_t *fd) getFreeBlocks int count - fileDescriptor * + fileDescriptor_t * fd @@ -184,19 +476,18 @@ - - blockAllocationTableEntry::attributes - ubixFSInfo::batEntries - ubixFSInfo::blockAllocationTable - vfs_mountPoint::fsInfo - fileDescriptorStruct::mp - blockAllocationTableEntry::nextBlock - syncBat - x1 - ubixFSmkDir - writeUbixFS + + blockAllocationTableEntry::attributes + ubixFSInfo::batEntries + ubixFSInfo::blockAllocationTable + vfs_mountPoint::fsInfo + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + syncBat + ubixFSmkDir + writeUbixFS - + void void syncBat (struct vfs_mountPoint *mp) @@ -211,18 +502,20 @@ - - ubixFSInfo::blockAllocationTable - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - vfs_mountPoint::fsInfo - device_interface::info - vfs_mountPoint::partition - ubixDiskLabel::partitions - device_interface::write - freeBlocks - getFreeBlocks + + ubixFSInfo::blockAllocationTable + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + vfs_mountPoint::fsInfo + device_interface::info + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pBatSize + ubixDiskLabel::ubixPartitions::pOffset + device_interface::write + freeBlocks + getFreeBlocks @@ -255,10 +548,7 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Log: block_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - +$Log:block.c,v$ Revision1.22006/12/0514:10:21reddawg WorkignDistro @@ -297,61 +587,61 @@ -$Id: block_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:block.c542016-01-1101:29:55Zreddawg$ *****************************************************************************************/ -#include<ubixfs/ubixfs.h> -#include<vfs/file.h> +#include<ubixfs/ubixfs.h> +#include<vfs/file.h> #include<vfs/mount.h> - -voidsyncBat(structvfs_mountPoint*mp){ -structubixFSInfo*fsInfo=mp->fsInfo; -mp->device->devInfo->write(mp->device->devInfo->info,fsInfo->blockAllocationTable,mp->diskLabel->partitions[mp->partition].pOffset,mp->diskLabel->partitions[mp->partition].pBatSize); + +voidsyncBat(structvfs_mountPoint*mp){ +structubixFSInfo*fsInfo=mp->fsInfo; +mp->device->devInfo->write(mp->device->devInfo->info,fsInfo->blockAllocationTable,mp->diskLabel->partitions[mp->partition].pOffset,mp->diskLabel->partitions[mp->partition].pBatSize); } - -intfreeBlocks(intblock,fileDescriptor*fd){ + +intfreeBlocks(intblock,fileDescriptor_t*fd){ inti=block; -structubixFSInfo*fsInfo=fd->mp->fsInfo; +structubixFSInfo*fsInfo=fd->mp->fsInfo; while(i!=0x0){ -block=fsInfo->blockAllocationTable[i].nextBlock; +block=fsInfo->blockAllocationTable[i].nextBlock; -fsInfo->blockAllocationTable[i].attributes=0x0; -fsInfo->blockAllocationTable[i].nextBlock=0x0; +fsInfo->blockAllocationTable[i].attributes=0x0; +fsInfo->blockAllocationTable[i].nextBlock=0x0; i=block; } -syncBat(fd->mp); +syncBat(fd->mp); return(i); } - -intgetFreeBlocks(intcount,fileDescriptor*fd){ -uInt32i=0x0; -uInt32x=0x0; + +intgetFreeBlocks(intcount,fileDescriptor_t*fd){ +uInt32i=0x0; +uInt32x=0x0; -structubixFSInfo*fsInfo=fd->mp->fsInfo; +structubixFSInfo*fsInfo=fd->mp->fsInfo; getBlocks: -for(i=1;i<fsInfo->batEntries;i++){ -if(fsInfo->blockAllocationTable[i].attributes==0x0){ -for(x=1;x<(uInt32)count;x++){ -if(fsInfo->blockAllocationTable[i+x].attributes!=0x0){ +for(i=1;i<fsInfo->batEntries;i++){ +if(fsInfo->blockAllocationTable[i].attributes==0x0){ +for(x=1;x<(uInt32)count;x++){ +if(fsInfo->blockAllocationTable[i+x].attributes!=0x0){ gotogetBlocks; } } for(x=i;x<i+count;x++){ -fsInfo->blockAllocationTable[x].attributes=0x1; -if((x+1)==(i+count)){ -fsInfo->blockAllocationTable[x].nextBlock=-1; +fsInfo->blockAllocationTable[x].attributes=0x1; +if((x+1)==(i+count)){ +fsInfo->blockAllocationTable[x].nextBlock=-1; } else{ -fsInfo->blockAllocationTable[x].nextBlock=x+1; +fsInfo->blockAllocationTable[x].nextBlock=x+1; } } -syncBat(fd->mp); +syncBat(fd->mp); return(i); } } @@ -363,6 +653,6 @@ ***/ - + diff --git a/doc/xml/bot_8c.xml b/doc/xml/bot_8c.xml index 0d10507..59937fe 100644 --- a/doc/xml/bot_8c.xml +++ b/doc/xml/bot_8c.xml @@ -1,6 +1,6 @@ - - - + + + bot.c lib/kmalloc.h lib/kprintf.h @@ -11,271 +11,219 @@ net/api.h net/stats.h - - - - + + + + + + + + - + - + - + - + - + + + + + - - - + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - - + - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void bot_init (void) @@ -289,12 +237,10 @@ - - bot_thread - NULL - sys_thread_new + + sys_thread_new - + void static void bot_thread (void *arg) @@ -309,18 +255,7 @@ - - IP4_ADDR - kprintf - netbuf_copy - netbuf_delete - netbuf_len - netconn_connect - netconn_new - netconn_recv - NETCONN_TCP - NULL - bot_init + @@ -360,7 +295,7 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: bot_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:bot.c542016-01-1101:29:55Zreddawg$ */ #include<lib/kmalloc.h> @@ -383,35 +318,35 @@ } */ -staticvoidbot_thread(void*arg){ -structnetconn*conn; +staticvoidbot_thread(void*arg){ +structnetconn*conn; intlen; charbufr[1500]; -structip_addripaddr; -structnetbuf*buf=0x0; +structip_addripaddr; +structnetbuf*buf=0x0; -IP4_ADDR(&ipaddr,216,152,77,10); -conn=netconn_new(NETCONN_TCP); -kprintf("StartingUbixOSBot\n"); +IP4_ADDR(&ipaddr,216,152,77,10); +conn=netconn_new(NETCONN_TCP); +kprintf("StartingUbixOSBot\n"); while(1){ -kprintf("[A"); -kprintf("\n\nCONNECT:[%i]\n",netconn_connect(conn,&ipaddr,6667)); -kprintf("B]"); +kprintf("[A"); +kprintf("\n\nCONNECT:[%i]\n",netconn_connect(conn,&ipaddr,6667)); +kprintf("B]"); while(1); -if(buf!=NULL){ -buf=netconn_recv(conn); -netbuf_copy(buf,bufr,1024); -len=netbuf_len(buf); -netbuf_delete(buf); +if(buf!=NULL){ +buf=netconn_recv(conn); +netbuf_copy(buf,bufr,1024); +len=netbuf_len(buf); +netbuf_delete(buf); bufr[len-2]='\0'; -kprintf("Bufr:[%s:%i]",bufr,len); +kprintf("Bufr:[%s:%i]",bufr,len); //sendstr("BLah\n",conn); } } } -voidbot_init(void){ -sys_thread_new(bot_thread,NULL); +voidbot_init(void){ +sys_thread_new(bot_thread,NULL); } /*** @@ -419,6 +354,6 @@ ***/ - + diff --git a/doc/xml/btree_8cpp.xml b/doc/xml/btree_8cpp.xml index 2cd01b9..f2478db 100644 --- a/doc/xml/btree_8cpp.xml +++ b/doc/xml/btree_8cpp.xml @@ -1,928 +1,780 @@ - - - + + + btree.cpp - stdlib.h - string.h - stdio.h - unistd.h - iostream - assert.h - btree.h - ubixfs.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - std - - - VERIFY - x - y - z - n - if ((x) != (y)) { cout << "verify " << z << " failed" << endl; PrintWholeTree(); } - - - - - - - - - //http://www.cs.msstate.edu/~cs2314/global/BTreeAnimation/algorithm.html -#include<stdlib.h> -#include<string.h> -#include<stdio.h> -#include<unistd.h> -#include<iostream> -#include<assert.h> -#include"btree.h" -#include"ubixfs.h" - -usingnamespacestd; -#defineVERIFY(x,y,z,n)if((x)!=(y)){cout<<"verify"<<z<<"failed"<<endl;PrintWholeTree();} - -bTree::bTree(UbixFS*filesystem,fileDescriptor*myfd){ -size_tresult=0; - -root=NULL; -tag=0; -fs=filesystem; -fd=myfd; -header=newbTreeHeader; -assert(header); -memset(header,0,sizeof(bTreeHeader)); -assert(fs); -result=fs->vfs_read(fd,header,0,sizeof(bTreeHeader)); -assert(result==sizeof(bTreeHeader)); - -//Ifthereareanyfilesinthisdir,loadthefirstnodeoftheb+tree -if(header->treeLeafCount!=0){ -assert(header->firstNodeOffset!=0); -root=newbNode; -assert(root); -result=fs->vfs_read(fd,root,header->firstNodeOffset,sizeof(bNode)); -assert(result==sizeof(bNode)); -}//if - -}//bTree::bTree - -bTree::bTree(constchar*key,ubixfsInode*inode){ -/*oncetheFSandthebTreeareinterfaced,thisshouldgoaway*/ -root=NULL; -tag=0; -header=newbTreeHeader; -assert(header); -memset(header,0,sizeof(bTreeHeader)); -header->treeDepth=1; -header->treeWidth=0; -header->treeLeafCount=0; -header->firstDeleted=-1; -header->firstNodeOffset=sizeof(bTreeHeader); - -if(inode==NULL)return; -root=allocEmptyNode(); -if(root==NULL)return; -root->used=1; -root->parent.bPtr=NULL; -root->leaf=true; -root->childCount[1]=1; - -//cout<<"---Creating"<<inode->name<<"@"<<inode<<endl; -strncpy(root->keys[0],key,B_MAX_NAME_LENGTH); -//insertpointertodatapagetotherightofthedata -root->head[1].iPtr=inode; -root->tail[1].iPtr=inode; - -root->present[1]=true; -if(inode!=NULL){ -inode->next.bPtr=inode->prev.bPtr=NULL; -}//if -return; -}//bTree:bTree - -bool -bTree::Insert(constchar*key,ubixfsInode*inode){ -bNode*bnode=root; -ubixfsInode*tmpInode=NULL; -unsignedintcurSlot=0; - -if(inode==NULL)returnfalse; - -//note:thiscodeisrightoutoftheconstructor -if(root==NULL){ -if(header==NULL)header=newbTreeHeader; -assert(header); -memset(header,0,sizeof(bTreeHeader)); -header->treeDepth=1; -header->treeWidth=0; -header->treeLeafCount=0; -header->firstDeleted=-1; -header->firstNodeOffset=sizeof(bTreeHeader); - -root=allocEmptyNode(); -assert(root); -if(root==NULL)returnfalse; - -root->used=1; -root->parent.bPtr=NULL; -root->leaf=true; -root->childCount[1]=1; - -strncpy(root->keys[0],key,B_MAX_NAME_LENGTH); -//insertpointertodatapagetotherightofthedata -root->head[1].iPtr=inode; -root->tail[1].iPtr=inode; - -root->present[1]=true; -inode->next.iPtr=inode->prev.iPtr=NULL; -returntrue; -}//if - -tmpInode=Find(key); -if(tmpInode!=NULL)returnfalse; -//PrintWholeTree(); -//cout<<"Insert("<<key<<")"<<endl; -//Info(bnode); -++header->treeLeafCount; -/* -*Findtheleafnodetheinodegoesinto -*/ -assert(bnode->used); -//cout<<"---Inserting"<<inode->name<<"@"<<inode<<endl; -while(bnode!=NULL&&!bnode->leaf){ -if(strcmp(key,bnode->keys[0])<0){ -bnode=bnode->head[0].bPtr; -}else{ -if(strcmp(key,bnode->keys[bnode->used-1])>=0){ -bnode=bnode->head[bnode->used].bPtr; -}else{ -for(unsignedinti=1;i<bnode->used;i++){ -if(strcmp(key,bnode->keys[i])<0){ -bnode=bnode->head[i].bPtr; -break; -}//if -}//fori -}//else -} -}//while - -/* -* -*/ - -assert(bnode); -if(bnode->leaf!=true)cout<<"leafnode!=true"<<endl; -assert(inode); - -if(strcmp(key,bnode->keys[curSlot=0])<0) -tmpInode=bnode->head[curSlot].iPtr; -else -if(strcmp(key,bnode->keys[(curSlot=bnode->used)-1])>=0) -tmpInode=bnode->head[bnode->used].iPtr; -else{ -for(curSlot=1;curSlot<bnode->used;curSlot++){ -if(strcmp(key,bnode->keys[curSlot])<0){ -tmpInode=bnode->head[curSlot].iPtr; -break; -}//if -}//forcurSlot -tmpInode=bnode->head[curSlot].iPtr; -}//else - - -if(tmpInode==NULL){ -/* -*Thisisthefirstnodeinthisleaf -*/ -bnode->head[curSlot].iPtr=bnode->tail[curSlot].iPtr=inode; -bnode->present[curSlot]=true; - -if(curSlot==0){ - -if(bnode->head[1].iPtr!=NULL){ -ubixfsInode*iptr=bnode->head[1].iPtr; -inode->prev.iPtr=iptr->prev.iPtr; -inode->next.iPtr=iptr; -iptr->prev.iPtr=inode; -if(inode->prev.iPtr!=NULL) -inode->prev.iPtr->next.iPtr=inode; -}else{ -inode->next.iPtr=inode->prev.iPtr=NULL; -}//else - -}else{ -++bnode->used; -}//else - -}else{ -/* -*Addnodetoleafpage.Scanthroughtofindwhereitgoes. -*/ -if(strcmp(key,bnode->head[curSlot].iPtr->name)<0) -{ - -inode->next.iPtr=bnode->head[curSlot].iPtr; -inode->prev.iPtr=inode->next.iPtr->prev.iPtr; -inode->next.iPtr->prev.iPtr=inode; -if(inode->prev.iPtr!=NULL)inode->prev.iPtr->next.iPtr=inode; -bnode->head[curSlot].iPtr=inode; - -}else{ - -if(strcmp(key,bnode->tail[curSlot].iPtr->name)>0){ - -inode->prev.iPtr=bnode->tail[curSlot].iPtr; -inode->next.iPtr=inode->prev.iPtr->next.iPtr; -inode->prev.iPtr->next.iPtr=inode; - -if(inode->next.iPtr!=NULL)inode->next.iPtr->prev.iPtr=inode; -bnode->tail[curSlot].iPtr=inode; - -}else{ - - -ubixfsInode*tmpInode=bnode->head[curSlot].iPtr; -for(unsignedinti=0;i<bnode->childCount[curSlot];i++){ -if(strcmp(key,tmpInode->name)<0){ -inode->next.iPtr=tmpInode; -inode->prev.iPtr=tmpInode->prev.iPtr; -inode->next.iPtr->prev.iPtr=inode; -inode->prev.iPtr->next.iPtr=inode; -break; -}//if -tmpInode=tmpInode->next.iPtr; -}//fori - -}//else - -}//else - -}//else - - - -if(++bnode->childCount[curSlot]==B_MAX_CHILD_COUNT){ - -//cout<<"----beforesplit----"<<endl; -//Info(bnode); - -if(curSlot!=bnode->used){ -intshift=bnode->used-curSlot+1; - -memmove(&bnode->head[curSlot+1], -&bnode->head[curSlot], -sizeof(bnode->head[0])*shift); -memmove(&bnode->tail[curSlot+1], -&bnode->tail[curSlot], -sizeof(bnode->tail[0])*shift); -memmove(&bnode->present[curSlot+1], -&bnode->present[curSlot], -sizeof(bnode->present[0])*shift); -memmove(&bnode->childCount[curSlot+1], -&bnode->childCount[curSlot], -sizeof(bnode->childCount[0])*shift); - -memmove(&bnode->keys[curSlot+1], -&bnode->keys[curSlot], -sizeof(bnode->keys[0])*(shift-1)); -memset(bnode->keys[curSlot],0,B_MAX_NAME_LENGTH); -}else{ -bnode->head[curSlot+1]=bnode->head[curSlot]; -bnode->tail[curSlot+1]=bnode->tail[curSlot]; -bnode->childCount[curSlot+1]=bnode->childCount[curSlot]; -bnode->present[curSlot+1]=bnode->present[curSlot]; -}//else - -ubixfsInode*tmpInode=bnode->head[curSlot].iPtr; - -for(unsignedinti=0;i<(B_MAX_CHILD_COUNT+1)>>1;i++){ -assert(tmpInode); -tmpInode=tmpInode->next.iPtr; -}//fori - -strncpy(bnode->keys[curSlot],tmpInode->name,B_MAX_NAME_LENGTH); -bnode->head[curSlot+1].iPtr=tmpInode; -bnode->tail[curSlot].iPtr=tmpInode->prev.iPtr; -bnode->childCount[curSlot]=(B_MAX_CHILD_COUNT+1)>>1; -bnode->childCount[curSlot+1]-=bnode->childCount[curSlot]; -bnode->present[curSlot]=true; -++header->treeWidth; -if(++bnode->used==B_MAX_KEYS)splitNode(bnode); - -}//ifleafisfull -//Info(bnode); -returntrue; -}//bTree::Insert - -void -bTree::splitNode(bNode*oldNode){ -ubixfsInode*tmpInode=NULL; -assert(oldNode); -if(oldNode==NULL)return; -if(oldNode->used!=B_MAX_KEYS)return; - -bNode*newNode=allocEmptyNode(); -if(newNode==NULL)return; - -unsignedintshift=B_MAX_KEYS>>1; -unsignedintsplitLoc=B_MAX_KEYS-shift; -++shift; -//cout<<"oldNodebeforesplit:"<<endl; -//Info(oldNode); -//cout<<"splitLoc:"<<splitLoc<<endl; -//cout<<"shift:"<<shift<<endl; - -newNode->used=oldNode->used=B_MAX_KEYS>>1; -newNode->parent.bPtr=oldNode->parent.bPtr; -newNode->leaf=oldNode->leaf; - -//cout<<"newNode->used:"<<newNode->used<<endl; -//cout<<"oldNode->used:"<<oldNode->used<<endl; - -memcpy(&newNode->keys[0], -&oldNode->keys[splitLoc], -sizeof(newNode->keys[0])*(shift-1)); - -memset(&oldNode->keys[splitLoc],0,sizeof(newNode->keys[0])*(shift-1)); - -memcpy(&newNode->present[0], -&oldNode->present[splitLoc], -sizeof(newNode->present[0])*shift); - -memset(&oldNode->present[splitLoc],0,sizeof(newNode->present[0])*shift); - -memcpy(&newNode->head[0], -&oldNode->head[splitLoc], -sizeof(newNode->head[0])*shift); - -memset(&oldNode->head[splitLoc],0, -sizeof(newNode->head[0])*shift); - -memcpy(&newNode->tail[0], -&oldNode->tail[splitLoc], -sizeof(newNode->tail[0])*shift); - -memset(&oldNode->tail[splitLoc],0, -sizeof(newNode->tail[0])*shift); - -memcpy(&newNode->childCount[0], -&oldNode->childCount[splitLoc], -sizeof(newNode->childCount[0])*shift); - -memset(&oldNode->childCount[splitLoc],0, -sizeof(newNode->childCount[0])*shift); - -if(!newNode->leaf){ -for(unsignedinti=0;i<=newNode->used;i++){ -newNode->head[i].bPtr->parent.bPtr=newNode; -}//fori -}//ifnewNodeisn'taleaf - -tmpInode=GetFirstNode(newNode); -assert(tmpInode); - -if(oldNode==root){ -//allocateanewrootnode -++header->treeDepth; -root=allocEmptyNode(); -oldNode->parent.bPtr=root; -newNode->parent.bPtr=root; -//strncpy(root->keys[0],newNode->keys[0],B_MAX_NAME_LENGTH); -strncpy(root->keys[0],tmpInode->name,B_MAX_NAME_LENGTH); -root->head[0].bPtr=oldNode; -root->tail[0].bPtr=root->tail[1].bPtr=NULL; -root->head[1].bPtr=newNode; -root->used=1; -root->leaf=false; -root->present[0]=root->present[1]=true; -root->childCount[0]=root->childCount[1]=0; -//root->childCount[0]=oldNode->used; -//root->childCount[1]=newNode->used; - -//cout<<"parent"<<endl; -//Info(newNode->parent); -//cout<<"oldNode"<<endl; -//Info(oldNode); -//cout<<"-----"<<endl; -//cout<<"newNode"<<endl; -//Info(newNode); -//cout<<"-----"<<endl; - -}else{ -insertNode(newNode->parent.bPtr,tmpInode->name,newNode); -//if(oldNode->parent->used==B_MAX_KEYS)splitNode(oldNode->parent); -}//else -return; -}//bTree::splitNode - -void -bTree::insertNode(bNode*node,constchar*key,bNode*headPtr){ -unsignedintcurSlot=0; -if(node==NULL||key==NULL)return; - -if(strcmp(key,node->keys[node->used-1])>=0){ -curSlot=node->used; -memset(node->keys[curSlot],0,B_MAX_NAME_LENGTH); -strncpy(node->keys[curSlot],key,B_MAX_NAME_LENGTH); -node->head[curSlot+1].bPtr=headPtr; -node->tail[curSlot+1].bPtr=NULL; -node->present[curSlot+1]=true; -node->childCount[node->used]=0;//maybe? - -}else{ - -for(curSlot=0;curSlot<node->used;curSlot++){ -if(strcmp(key,node->keys[curSlot])<0)break; -}//for - -/* -*notethatthereisonemoreitemforeverythingbutkeys -*So,maketheshiftcount+1andjustsubtractitfromthekeyshift -*later -*/ -intshift=node->used-curSlot+1; - -memmove(&node->head[curSlot+1], -&node->head[curSlot], -sizeof(node->head[0])*shift); -memmove(&node->tail[curSlot+1], -&node->tail[curSlot], -sizeof(node->tail[0])*shift); -memmove(&node->present[curSlot+1], -&node->present[curSlot], -sizeof(node->present[0])*shift); -memmove(&node->childCount[curSlot+1], -&node->childCount[curSlot], -sizeof(node->childCount[0])*shift); - -memmove(&node->keys[curSlot+1], -&node->keys[curSlot], -sizeof(node->keys[0])*(shift-1)); - -memset(node->keys[curSlot],0,B_MAX_NAME_LENGTH); -strncpy(node->keys[curSlot],key,B_MAX_NAME_LENGTH); -node->head[curSlot+1].bPtr=headPtr; -node->tail[curSlot+1].bPtr=NULL; -node->present[curSlot+1]=true; -//node->childCount[node->used]=?; -}//else -if(++node->used==B_MAX_KEYS)splitNode(node); -return; -}//bTree::insertNode - -bNode* -bTree::allocEmptyNode(void){ -bNode*newNode=newbNode; - -memset(newNode,0,sizeof(bNode)); -newNode->magic1=B_NODE_MAGIC_1; -newNode->magic2=B_NODE_MAGIC_2; -newNode->parent.bPtr=NULL; -newNode->tag=++tag;//thiswillstartat1(0istheheadernode) -returnnewNode; -}//bTree::allocEmptyNode - -void -bTree::Info(constbNode*node){ -ubixfsInode*inode=NULL; -if(node==NULL||root==NULL)return; -cout<<node<<"|"<<node->parent.bPtr<<endl; -for(unsignedinti=0;i<=node->used;i++){ -inode=node->head[i].iPtr; -//cout<<"("<<node->childCount[i]<<")"; -for(unsignedintk=0;k<node->childCount[i];k++){ -cout<<"["<<inode->name<<"]"; -inode=inode->next.iPtr; -}//fork -if(i!=node->used)cout<<"{"<<node->keys[i]<<"}"; -}//fori -cout<<endl; -return; -#if0 -for(unsignedinti=0;i<node->used;i++){ -cout<<"keys["<<i<<"]:"<<node->keys[i]<<""; -}//fori -cout<<endl; -cout<<"node->used:"<<node->used<<endl; -cout<<"leaf:"<<node->leaf<<endl; -for(unsignedinti=0;i<=node->used;i++){ -inode=(ubixfsInode*)node->head[i]; -cout<<"node->childCount["<<i<<"]:"<<node->childCount[i]<<endl; -for(unsignedintj=0;j<node->childCount[i];j++){ -assert(inode); -cout<<"["<<i<<"].["<<j<<"]->"<<inode->name<<endl; -inode=inode->next; -}//forj -}//fori -#endif -}//bTree::Info - -void -bTree::Info(void){ -ubixfsInode*inode=NULL; - -cout<<"treedepth:"<<header->treeDepth<<endl; -cout<<"treewidth:"<<header->treeWidth<<endl; -cout<<"treeleafcount:"<<header->treeLeafCount<<endl; -cout<<"tag:"<<tag<<endl; - -if(root==NULL)return; - -for(unsignedinti=0;i<=root->used;i++){ -cout<<"CC["<<i<<"]:"<<root->childCount[i]<<""; -}//fori - -cout<<endl; -for(unsignedinti=0;i<=root->used;i++){ -cout<<"CH["<<i<<"]:"<<root->head[i].bPtr<<""; -}//fori - -cout<<endl; -for(unsignedinti=0;i<=root->used;i++){ -cout<<"CT["<<i<<"]:"<<root->tail[i].bPtr<<""; -}//fori -cout<<endl; -for(unsignedinti=0;i<root->used;i++){ -cout<<"keys["<<i<<"]:"<<root->keys[i]<<""; -}//fori -cout<<endl; - -cout<<"root->used:"<<root->used<<endl; -for(unsignedinti=0;i<=root->used;i++){ -inode=root->head[i].iPtr; -cout<<"root->childCount["<<i<<"]:"<<root->childCount[i]<<endl; -if(root->leaf){ -cout<<"rootcontainsleafnode"<<endl; -for(unsignedintj=0;j<root->childCount[i];j++){ -assert(inode); -cout<<"["<<i<<"].["<<j<<"]->"<<inode->name<<endl; -inode=inode->next.iPtr; -}//forj -}//ifroot->leaf -}//fori -}//bTree::Info - -void -bTree::Print(void){ -ubixfsInode*node=GetFirstNode(); -while(node!=NULL){ -cout<<node->name<<endl; -node=node->next.iPtr; -} -}//bTree::Print - -ubixfsInode* -bTree::Find(constchar*key){ -/* -ubixfsInode*tmp=GetFirstNode(); -while(tmp!=NULL){ -if(strcmp(tmp->name,key)==0)returntmp; -tmp=tmp->next.iPtr; -} -returnNULL; -*/ -returntreeSearch(root,key); -}//bTree::Find - -ubixfsInode* -bTree::inodeSearch(ubixfsInode*inode,constchar*key){ -if(inode==NULL||key==NULL)returnNULL; -intresult=strcmp(inode->name,key); -if(result==0)returninode; - -if(result<0){ -inode=inode->next.iPtr; -while(inode!=NULL&&((result=strcmp(inode->name,key))<0)){ -inode=inode->next.iPtr; -}//while -}else{ -inode=inode->prev.iPtr; -while(inode!=NULL&&((result=strcmp(inode->name,key))>0)){ -inode=inode->prev.iPtr; -}//while -}//else -return(result==0?inode:NULL); -}//bTree::inodeSearch - -ubixfsInode* -bTree::treeSearch(bNode*bnode,constchar*key){ - -if(bnode==NULL||key==NULL||bnode->used==0)returnNULL; - -if(bnode->leaf) -returninodeSearch(GetFirstNode(bnode),key); - -if(strcmp(key,bnode->keys[0])<0){ -returntreeSearch(bnode->head[0].bPtr,key); -}//if - -if(strcmp(key,bnode->keys[bnode->used-1])>=0){ -returntreeSearch(bnode->head[bnode->used].bPtr,key); -}//if - -for(unsignedinti=1;i<bnode->used;i++){ -if(strcmp(key,bnode->keys[i])<0){ -returntreeSearch(bnode->head[i].bPtr,key); -}//if -}//fori - -returnNULL; -}//bTree::treeSearch - -ubixfsInode* -bTree::GetFirstNode(void){ -returnGetFirstNode(root); -}//bTree::GetFirstNode - -ubixfsInode* -bTree::GetFirstNode(bNode*node){ -bNode*tmpNode=node; - -if(tmpNode==NULL)returnNULL; - -while(!tmpNode->leaf){ -for(unsignedinti=0;i<tmpNode->used;i++){ -if(tmpNode->head[i].bPtr!=NULL){ -tmpNode=tmpNode->head[i].bPtr; -break; -}//if -}//fori -}//while - -for(unsignedinti=0;i<tmpNode->used;i++){ -if(tmpNode->head[i].iPtr!=NULL)returntmpNode->head[i].iPtr; -}//fori -returnNULL; -}//bTree::GetFirstNode - -bNode* -bTree::findLeafNode(bNode*node,constchar*key){ -assert(node); -assert(key); -if(node==NULL||key==NULL)returnNULL; -assert(node->used); -if(node->leaf)returnnode; - -if(strcmp(key,node->keys[0])<0) -returnfindLeafNode(node->head[0].bPtr,key); - -if(strcmp(key,node->keys[node->used-1])>=0) -returnfindLeafNode(node->head[node->used].bPtr,key); - -for(unsignedinti=1;i<node->used;i++){ -if(strcmp(key,node->keys[i])<0) -returnfindLeafNode(node->head[i].bPtr,key); -}//fori - -returnNULL; -}//bTree::findLeafNode - -void -bTree::saveNode(FILE*fd,bNode*node,void*tmpPtr){ - -bNode*ptr=(bNode*)tmpPtr; -assert(tmpPtr); -assert(fd); -assert(node); -cout<<"writingtag:"<<node->tag<<endl; - -memcpy(tmpPtr,node,sizeof(bNode)); - -if(node->parent.bPtr!=NULL) -ptr->parent.offset=node->parent.bPtr->tag*sizeof(bNode); -else -ptr->parent.offset=0; - -for(unsignedinti=0;i<=node->used;i++){ -bNode*bPtr=node->head[i].bPtr; - -if(bPtr!=NULL) -ptr->head[i].offset=bPtr->tag*sizeof(bNode); -else -ptr->head[i].offset=~0; -ptr->present[i]=false; -}//fori - -if(node->leaf){ - -for(unsignedinti=0;i<=node->used;i++){ -//ubixfsInode*inode=node->head[i].iPtr; -//mjiif(inode!=NULL)tmp->head[i]=inode-> -}//fori -}else{ - -for(unsignedinti=0;i<=node->used;i++){ - -if(node->head[i].bPtr!=NULL)saveNode(fd,node->head[i].bPtr,tmpPtr); - -}//fori - -}//else - -return; -}//bTree::saveNode - -bool -bTree::Save(constchar*filename){ -ubixfsInode*uPtr=NULL; -if(filename==NULL)returnfalse; -FILE*fd=NULL; -if((fd=fopen(filename,"wb+"))==NULL)returnfalse; - -cout<<"tags:"<<tag<<endl; -lseek(fileno(fd),tag*sizeof(bNode),SEEK_END); - -header->firstNodeOffset=sizeof(bNode); -header->firstDeleted=-1; -void*tmpPtr=malloc(sizeof(bNode)); -assert(tmpPtr); -uPtr=(ubixfsInode*)tmpPtr; -memset(tmpPtr,0,sizeof(bNode)); -fwrite(header,sizeof(bTreeHeader),1,fd); -saveNode(fd,root,tmpPtr); - -fclose(fd); -free(tmpPtr); -returntrue; -}//bTree::Save - -bool -bTree::Load(constchar*filename){ -if(filename==NULL)returnfalse; -returntrue; -}//bTree::Load - -bool -bTree::Delete(constchar*key){ - -if(key==NULL)returnfalse; -returntrue; -}//bTree::Delete - -bool -bTree::Verify(void){ -ubixfsInode*node=GetFirstNode(); -if(node==NULL)returntrue; - -while(node!=NULL){ -ubixfsInode*next=node->next.iPtr; -if(next!=NULL){ -//cout<<node->name<<"::"<<node->next->name<<":::"<<strcmp(node->name,node->next->name)<<endl; -if(strcmp(node->name,next->name)>0)returnfalse; -} -node=next; -}//while -returntrue; -}//bTree::Verify - -void -bTree::Print(bNode*node){ -if(node==NULL)return; -Info(node); -if(!node->leaf) -for(unsignedinti=0;i<=node->used;i++){ -Print(node->head[i].bPtr); -}//fori -}//bTree::Print - -void -bTree::PrintWholeTree(void){ -Print(root); -}//bTree::PrintWholeTree; - -bTree::~bTree(void){ -cout<<"treedepth:"<<header->treeDepth<<endl; -cout<<"treewidth:"<<header->treeWidth<<endl; -cout<<"treeleafcount:"<<header->treeLeafCount<<endl; -}//bTree::~bTree + +/* + +#include<stdlib.h> +#include<string.h> +#include<stdio.h> +#include<unistd.h> +#include<iostream> +#include<assert.h> +#include"btree.h" +#include"ubixfs.h" + +usingnamespacestd; +#defineVERIFY(x,y,z,n)if((x)!=(y)){cout<<"verify"<<z<<"failed"<<endl;PrintWholeTree();} + +bTree::bTree(UbixFS*filesystem,fileDescriptor*myfd){ +size_tresult=0; + +root=NULL; +tag=0; +fs=filesystem; +fd=myfd; +header=newbTreeHeader; +assert(header); +memset(header,0,sizeof(bTreeHeader)); +assert(fs); +result=fs->vfs_read(fd,header,0,sizeof(bTreeHeader)); +assert(result==sizeof(bTreeHeader)); + +//Ifthereareanyfilesinthisdir,loadthefirstnodeoftheb+tree +if(header->treeLeafCount!=0){ +assert(header->firstNodeOffset!=0); +root=newbNode; +assert(root); +result=fs->vfs_read(fd,root,header->firstNodeOffset,sizeof(bNode)); +assert(result==sizeof(bNode)); +}//if + +}//bTree::bTree + +bTree::bTree(constchar*key,ubixfsInode*inode){ +//oncetheFSandthebTreeareinterfaced,thisshouldgoaway +root=NULL; +tag=0; +header=newbTreeHeader; +assert(header); +memset(header,0,sizeof(bTreeHeader)); +header->treeDepth=1; +header->treeWidth=0; +header->treeLeafCount=0; +header->firstDeleted=-1; +header->firstNodeOffset=sizeof(bTreeHeader); + +if(inode==NULL)return; +root=allocEmptyNode(); +if(root==NULL)return; +root->used=1; +root->parent.bPtr=NULL; +root->leaf=true; +root->childCount[1]=1; + +//cout<<"---Creating"<<inode->name<<"@"<<inode<<endl; +strncpy(root->keys[0],key,B_MAX_NAME_LENGTH); +//insertpointertodatapagetotherightofthedata +root->head[1].iPtr=inode; +root->tail[1].iPtr=inode; + +root->present[1]=true; +if(inode!=NULL){ +inode->next.bPtr=inode->prev.bPtr=NULL; +}//if +return; +}//bTree:bTree + +bool +bTree::Insert(constchar*key,ubixfsInode*inode){ +bNode*bnode=root; +ubixfsInode*tmpInode=NULL; +unsignedintcurSlot=0; + +if(inode==NULL)returnfalse; + +//note:thiscodeisrightoutoftheconstructor +if(root==NULL){ +if(header==NULL)header=newbTreeHeader; +assert(header); +memset(header,0,sizeof(bTreeHeader)); +header->treeDepth=1; +header->treeWidth=0; +header->treeLeafCount=0; +header->firstDeleted=-1; +header->firstNodeOffset=sizeof(bTreeHeader); + +root=allocEmptyNode(); +assert(root); +if(root==NULL)returnfalse; + +root->used=1; +root->parent.bPtr=NULL; +root->leaf=true; +root->childCount[1]=1; + +strncpy(root->keys[0],key,B_MAX_NAME_LENGTH); +//insertpointertodatapagetotherightofthedata +root->head[1].iPtr=inode; +root->tail[1].iPtr=inode; + +root->present[1]=true; +inode->next.iPtr=inode->prev.iPtr=NULL; +returntrue; +}//if + +tmpInode=Find(key); +if(tmpInode!=NULL)returnfalse; +//PrintWholeTree(); +//cout<<"Insert("<<key<<")"<<endl; +//Info(bnode); +++header->treeLeafCount; +//Findtheleafnodetheinodegoesinto + +assert(bnode->used); +//cout<<"---Inserting"<<inode->name<<"@"<<inode<<endl; +while(bnode!=NULL&&!bnode->leaf){ +if(strcmp(key,bnode->keys[0])<0){ +bnode=bnode->head[0].bPtr; +}else{ +if(strcmp(key,bnode->keys[bnode->used-1])>=0){ +bnode=bnode->head[bnode->used].bPtr; +}else{ +for(unsignedinti=1;i<bnode->used;i++){ +if(strcmp(key,bnode->keys[i])<0){ +bnode=bnode->head[i].bPtr; +break; +}//if +}//fori +}//else +} +}//while + + +assert(bnode); +if(bnode->leaf!=true)cout<<"leafnode!=true"<<endl; +assert(inode); + +if(strcmp(key,bnode->keys[curSlot=0])<0) +tmpInode=bnode->head[curSlot].iPtr; +else +if(strcmp(key,bnode->keys[(curSlot=bnode->used)-1])>=0) +tmpInode=bnode->head[bnode->used].iPtr; +else{ +for(curSlot=1;curSlot<bnode->used;curSlot++){ +if(strcmp(key,bnode->keys[curSlot])<0){ +tmpInode=bnode->head[curSlot].iPtr; +break; +}//if +}//forcurSlot +tmpInode=bnode->head[curSlot].iPtr; +}//else + + +if(tmpInode==NULL){ +//Thisisthefirstnodeinthisleaf +bnode->head[curSlot].iPtr=bnode->tail[curSlot].iPtr=inode; +bnode->present[curSlot]=true; + +if(curSlot==0){ + +if(bnode->head[1].iPtr!=NULL){ +ubixfsInode*iptr=bnode->head[1].iPtr; +inode->prev.iPtr=iptr->prev.iPtr; +inode->next.iPtr=iptr; +iptr->prev.iPtr=inode; +if(inode->prev.iPtr!=NULL) +inode->prev.iPtr->next.iPtr=inode; +}else{ +inode->next.iPtr=inode->prev.iPtr=NULL; +}//else + +}else{ +++bnode->used; +}//else + +}else{ +//Addnodetoleafpage.Scanthroughtofindwhereitgoes. + +if(strcmp(key,bnode->head[curSlot].iPtr->name)<0) +{ + +inode->next.iPtr=bnode->head[curSlot].iPtr; +inode->prev.iPtr=inode->next.iPtr->prev.iPtr; +inode->next.iPtr->prev.iPtr=inode; +if(inode->prev.iPtr!=NULL)inode->prev.iPtr->next.iPtr=inode; +bnode->head[curSlot].iPtr=inode; + +}else{ + +if(strcmp(key,bnode->tail[curSlot].iPtr->name)>0){ + +inode->prev.iPtr=bnode->tail[curSlot].iPtr; +inode->next.iPtr=inode->prev.iPtr->next.iPtr; +inode->prev.iPtr->next.iPtr=inode; + +if(inode->next.iPtr!=NULL)inode->next.iPtr->prev.iPtr=inode; +bnode->tail[curSlot].iPtr=inode; + +}else{ + + +ubixfsInode*tmpInode=bnode->head[curSlot].iPtr; +for(unsignedinti=0;i<bnode->childCount[curSlot];i++){ +if(strcmp(key,tmpInode->name)<0){ +inode->next.iPtr=tmpInode; +inode->prev.iPtr=tmpInode->prev.iPtr; +inode->next.iPtr->prev.iPtr=inode; +inode->prev.iPtr->next.iPtr=inode; +break; +}//if +tmpInode=tmpInode->next.iPtr; +}//fori + +}//else + +}//else + +}//else + + + +if(++bnode->childCount[curSlot]==B_MAX_CHILD_COUNT){ + +//cout<<"----beforesplit----"<<endl; +//Info(bnode); + +if(curSlot!=bnode->used){ +intshift=bnode->used-curSlot+1; + +memmove(&bnode->head[curSlot+1], +&bnode->head[curSlot], +sizeof(bnode->head[0])*shift); +memmove(&bnode->tail[curSlot+1], +&bnode->tail[curSlot], +sizeof(bnode->tail[0])*shift); +memmove(&bnode->present[curSlot+1], +&bnode->present[curSlot], +sizeof(bnode->present[0])*shift); +memmove(&bnode->childCount[curSlot+1], +&bnode->childCount[curSlot], +sizeof(bnode->childCount[0])*shift); + +memmove(&bnode->keys[curSlot+1], +&bnode->keys[curSlot], +sizeof(bnode->keys[0])*(shift-1)); +memset(bnode->keys[curSlot],0,B_MAX_NAME_LENGTH); +}else{ +bnode->head[curSlot+1]=bnode->head[curSlot]; +bnode->tail[curSlot+1]=bnode->tail[curSlot]; +bnode->childCount[curSlot+1]=bnode->childCount[curSlot]; +bnode->present[curSlot+1]=bnode->present[curSlot]; +}//else + +ubixfsInode*tmpInode=bnode->head[curSlot].iPtr; + +for(unsignedinti=0;i<(B_MAX_CHILD_COUNT+1)>>1;i++){ +assert(tmpInode); +tmpInode=tmpInode->next.iPtr; +}//fori + +strncpy(bnode->keys[curSlot],tmpInode->name,B_MAX_NAME_LENGTH); +bnode->head[curSlot+1].iPtr=tmpInode; +bnode->tail[curSlot].iPtr=tmpInode->prev.iPtr; +bnode->childCount[curSlot]=(B_MAX_CHILD_COUNT+1)>>1; +bnode->childCount[curSlot+1]-=bnode->childCount[curSlot]; +bnode->present[curSlot]=true; +++header->treeWidth; +if(++bnode->used==B_MAX_KEYS)splitNode(bnode); + +}//ifleafisfull +//Info(bnode); +returntrue; +}//bTree::Insert + +void +bTree::splitNode(bNode*oldNode){ +ubixfsInode*tmpInode=NULL; +assert(oldNode); +if(oldNode==NULL)return; +if(oldNode->used!=B_MAX_KEYS)return; + +bNode*newNode=allocEmptyNode(); +if(newNode==NULL)return; + +unsignedintshift=B_MAX_KEYS>>1; +unsignedintsplitLoc=B_MAX_KEYS-shift; +++shift; +//cout<<"oldNodebeforesplit:"<<endl; +//Info(oldNode); +//cout<<"splitLoc:"<<splitLoc<<endl; +//cout<<"shift:"<<shift<<endl; + +newNode->used=oldNode->used=B_MAX_KEYS>>1; +newNode->parent.bPtr=oldNode->parent.bPtr; +newNode->leaf=oldNode->leaf; + +//cout<<"newNode->used:"<<newNode->used<<endl; +//cout<<"oldNode->used:"<<oldNode->used<<endl; + +memcpy(&newNode->keys[0], +&oldNode->keys[splitLoc], +sizeof(newNode->keys[0])*(shift-1)); + +memset(&oldNode->keys[splitLoc],0,sizeof(newNode->keys[0])*(shift-1)); + +memcpy(&newNode->present[0], +&oldNode->present[splitLoc], +sizeof(newNode->present[0])*shift); + +memset(&oldNode->present[splitLoc],0,sizeof(newNode->present[0])*shift); + +memcpy(&newNode->head[0], +&oldNode->head[splitLoc], +sizeof(newNode->head[0])*shift); + +memset(&oldNode->head[splitLoc],0, +sizeof(newNode->head[0])*shift); + +memcpy(&newNode->tail[0], +&oldNode->tail[splitLoc], +sizeof(newNode->tail[0])*shift); + +memset(&oldNode->tail[splitLoc],0, +sizeof(newNode->tail[0])*shift); + +memcpy(&newNode->childCount[0], +&oldNode->childCount[splitLoc], +sizeof(newNode->childCount[0])*shift); + +memset(&oldNode->childCount[splitLoc],0, +sizeof(newNode->childCount[0])*shift); + +if(!newNode->leaf){ +for(unsignedinti=0;i<=newNode->used;i++){ +newNode->head[i].bPtr->parent.bPtr=newNode; +}//fori +}//ifnewNodeisn'taleaf + +tmpInode=GetFirstNode(newNode); +assert(tmpInode); + +if(oldNode==root){ +//allocateanewrootnode +++header->treeDepth; +root=allocEmptyNode(); +oldNode->parent.bPtr=root; +newNode->parent.bPtr=root; +//strncpy(root->keys[0],newNode->keys[0],B_MAX_NAME_LENGTH); +strncpy(root->keys[0],tmpInode->name,B_MAX_NAME_LENGTH); +root->head[0].bPtr=oldNode; +root->tail[0].bPtr=root->tail[1].bPtr=NULL; +root->head[1].bPtr=newNode; +root->used=1; +root->leaf=false; +root->present[0]=root->present[1]=true; +root->childCount[0]=root->childCount[1]=0; +//root->childCount[0]=oldNode->used; +//root->childCount[1]=newNode->used; + +//cout<<"parent"<<endl; +//Info(newNode->parent); +//cout<<"oldNode"<<endl; +//Info(oldNode); +//cout<<"-----"<<endl; +//cout<<"newNode"<<endl; +//Info(newNode); +//cout<<"-----"<<endl; + +}else{ +insertNode(newNode->parent.bPtr,tmpInode->name,newNode); +//if(oldNode->parent->used==B_MAX_KEYS)splitNode(oldNode->parent); +}//else +return; +}//bTree::splitNode + +void +bTree::insertNode(bNode*node,constchar*key,bNode*headPtr){ +unsignedintcurSlot=0; +if(node==NULL||key==NULL)return; + +if(strcmp(key,node->keys[node->used-1])>=0){ +curSlot=node->used; +memset(node->keys[curSlot],0,B_MAX_NAME_LENGTH); +strncpy(node->keys[curSlot],key,B_MAX_NAME_LENGTH); +node->head[curSlot+1].bPtr=headPtr; +node->tail[curSlot+1].bPtr=NULL; +node->present[curSlot+1]=true; +node->childCount[node->used]=0;//maybe? + +}else{ + +for(curSlot=0;curSlot<node->used;curSlot++){ +if(strcmp(key,node->keys[curSlot])<0)break; +}//for + + +*//* +*notethatthereisonemoreitemforeverythingbutkeys +*So,maketheshiftcount+1andjustsubtractitfromthekeyshift +*later +*//* +intshift=node->used-curSlot+1; + +memmove(&node->head[curSlot+1], +&node->head[curSlot], +sizeof(node->head[0])*shift); +memmove(&node->tail[curSlot+1], +&node->tail[curSlot], +sizeof(node->tail[0])*shift); +memmove(&node->present[curSlot+1], +&node->present[curSlot], +sizeof(node->present[0])*shift); +memmove(&node->childCount[curSlot+1], +&node->childCount[curSlot], +sizeof(node->childCount[0])*shift); + +memmove(&node->keys[curSlot+1], +&node->keys[curSlot], +sizeof(node->keys[0])*(shift-1)); + +memset(node->keys[curSlot],0,B_MAX_NAME_LENGTH); +strncpy(node->keys[curSlot],key,B_MAX_NAME_LENGTH); +node->head[curSlot+1].bPtr=headPtr; +node->tail[curSlot+1].bPtr=NULL; +node->present[curSlot+1]=true; +//node->childCount[node->used]=?; +}//else +if(++node->used==B_MAX_KEYS)splitNode(node); +return; +}//bTree::insertNode + +bNode* +bTree::allocEmptyNode(void){ +bNode*newNode=newbNode; + +memset(newNode,0,sizeof(bNode)); +newNode->magic1=B_NODE_MAGIC_1; +newNode->magic2=B_NODE_MAGIC_2; +newNode->parent.bPtr=NULL; +newNode->tag=++tag;//thiswillstartat1(0istheheadernode) +returnnewNode; +}//bTree::allocEmptyNode + +void +bTree::Info(constbNode*node){ +ubixfsInode*inode=NULL; +if(node==NULL||root==NULL)return; +cout<<node<<"|"<<node->parent.bPtr<<endl; +for(unsignedinti=0;i<=node->used;i++){ +inode=node->head[i].iPtr; +//cout<<"("<<node->childCount[i]<<")"; +for(unsignedintk=0;k<node->childCount[i];k++){ +cout<<"["<<inode->name<<"]"; +inode=inode->next.iPtr; +}//fork +if(i!=node->used)cout<<"{"<<node->keys[i]<<"}"; +}//fori +cout<<endl; +return; +#if0 +for(unsignedinti=0;i<node->used;i++){ +cout<<"keys["<<i<<"]:"<<node->keys[i]<<""; +}//fori +cout<<endl; +cout<<"node->used:"<<node->used<<endl; +cout<<"leaf:"<<node->leaf<<endl; +for(unsignedinti=0;i<=node->used;i++){ +inode=(ubixfsInode*)node->head[i]; +cout<<"node->childCount["<<i<<"]:"<<node->childCount[i]<<endl; +for(unsignedintj=0;j<node->childCount[i];j++){ +assert(inode); +cout<<"["<<i<<"].["<<j<<"]->"<<inode->name<<endl; +inode=inode->next; +}//forj +}//fori +#endif +}//bTree::Info + +void +bTree::Info(void){ +ubixfsInode*inode=NULL; + +cout<<"treedepth:"<<header->treeDepth<<endl; +cout<<"treewidth:"<<header->treeWidth<<endl; +cout<<"treeleafcount:"<<header->treeLeafCount<<endl; +cout<<"tag:"<<tag<<endl; + +if(root==NULL)return; + +for(unsignedinti=0;i<=root->used;i++){ +cout<<"CC["<<i<<"]:"<<root->childCount[i]<<""; +}//fori + +cout<<endl; +for(unsignedinti=0;i<=root->used;i++){ +cout<<"CH["<<i<<"]:"<<root->head[i].bPtr<<""; +}//fori + +cout<<endl; +for(unsignedinti=0;i<=root->used;i++){ +cout<<"CT["<<i<<"]:"<<root->tail[i].bPtr<<""; +}//fori +cout<<endl; +for(unsignedinti=0;i<root->used;i++){ +cout<<"keys["<<i<<"]:"<<root->keys[i]<<""; +}//fori +cout<<endl; + +cout<<"root->used:"<<root->used<<endl; +for(unsignedinti=0;i<=root->used;i++){ +inode=root->head[i].iPtr; +cout<<"root->childCount["<<i<<"]:"<<root->childCount[i]<<endl; +if(root->leaf){ +cout<<"rootcontainsleafnode"<<endl; +for(unsignedintj=0;j<root->childCount[i];j++){ +assert(inode); +cout<<"["<<i<<"].["<<j<<"]->"<<inode->name<<endl; +inode=inode->next.iPtr; +}//forj +}//ifroot->leaf +}//fori +}//bTree::Info + +void +bTree::Print(void){ +ubixfsInode*node=GetFirstNode(); +while(node!=NULL){ +cout<<node->name<<endl; +node=node->next.iPtr; +} +}//bTree::Print + +ubixfsInode* +bTree::Find(constchar*key){ + +*//* +ubixfsInode*tmp=GetFirstNode(); +while(tmp!=NULL){ +if(strcmp(tmp->name,key)==0)returntmp; +tmp=tmp->next.iPtr; +} +returnNULL; +*//* +returntreeSearch(root,key); +}//bTree::Find + +ubixfsInode* +bTree::inodeSearch(ubixfsInode*inode,constchar*key){ +if(inode==NULL||key==NULL)returnNULL; +intresult=strcmp(inode->name,key); +if(result==0)returninode; + +if(result<0){ +inode=inode->next.iPtr; +while(inode!=NULL&&((result=strcmp(inode->name,key))<0)){ +inode=inode->next.iPtr; +}//while +}else{ +inode=inode->prev.iPtr; +while(inode!=NULL&&((result=strcmp(inode->name,key))>0)){ +inode=inode->prev.iPtr; +}//while +}//else +return(result==0?inode:NULL); +}//bTree::inodeSearch + +ubixfsInode* +bTree::treeSearch(bNode*bnode,constchar*key){ + +if(bnode==NULL||key==NULL||bnode->used==0)returnNULL; + +if(bnode->leaf) +returninodeSearch(GetFirstNode(bnode),key); + +if(strcmp(key,bnode->keys[0])<0){ +returntreeSearch(bnode->head[0].bPtr,key); +}//if + +if(strcmp(key,bnode->keys[bnode->used-1])>=0){ +returntreeSearch(bnode->head[bnode->used].bPtr,key); +}//if + +for(unsignedinti=1;i<bnode->used;i++){ +if(strcmp(key,bnode->keys[i])<0){ +returntreeSearch(bnode->head[i].bPtr,key); +}//if +}//fori + +returnNULL; +}//bTree::treeSearch + +ubixfsInode* +bTree::GetFirstNode(void){ +returnGetFirstNode(root); +}//bTree::GetFirstNode + +ubixfsInode* +bTree::GetFirstNode(bNode*node){ +bNode*tmpNode=node; + +if(tmpNode==NULL)returnNULL; + +while(!tmpNode->leaf){ +for(unsignedinti=0;i<tmpNode->used;i++){ +if(tmpNode->head[i].bPtr!=NULL){ +tmpNode=tmpNode->head[i].bPtr; +break; +}//if +}//fori +}//while + +for(unsignedinti=0;i<tmpNode->used;i++){ +if(tmpNode->head[i].iPtr!=NULL)returntmpNode->head[i].iPtr; +}//fori +returnNULL; +}//bTree::GetFirstNode + +bNode* +bTree::findLeafNode(bNode*node,constchar*key){ +assert(node); +assert(key); +if(node==NULL||key==NULL)returnNULL; +assert(node->used); +if(node->leaf)returnnode; + +if(strcmp(key,node->keys[0])<0) +returnfindLeafNode(node->head[0].bPtr,key); + +if(strcmp(key,node->keys[node->used-1])>=0) +returnfindLeafNode(node->head[node->used].bPtr,key); + +for(unsignedinti=1;i<node->used;i++){ +if(strcmp(key,node->keys[i])<0) +returnfindLeafNode(node->head[i].bPtr,key); +}//fori + +returnNULL; +}//bTree::findLeafNode + +void +bTree::saveNode(FILE*fd,bNode*node,void*tmpPtr){ + +bNode*ptr=(bNode*)tmpPtr; +assert(tmpPtr); +assert(fd); +assert(node); +cout<<"writingtag:"<<node->tag<<endl; + +memcpy(tmpPtr,node,sizeof(bNode)); + +if(node->parent.bPtr!=NULL) +ptr->parent.offset=node->parent.bPtr->tag*sizeof(bNode); +else +ptr->parent.offset=0; + +for(unsignedinti=0;i<=node->used;i++){ +bNode*bPtr=node->head[i].bPtr; + +if(bPtr!=NULL) +ptr->head[i].offset=bPtr->tag*sizeof(bNode); +else +ptr->head[i].offset=~0; +ptr->present[i]=false; +}//fori + +if(node->leaf){ + +for(unsignedinti=0;i<=node->used;i++){ +//ubixfsInode*inode=node->head[i].iPtr; +//mjiif(inode!=NULL)tmp->head[i]=inode-> +}//fori +}else{ + +for(unsignedinti=0;i<=node->used;i++){ + +if(node->head[i].bPtr!=NULL)saveNode(fd,node->head[i].bPtr,tmpPtr); + +}//fori + +}//else + +return; +}//bTree::saveNode + +bool +bTree::Save(constchar*filename){ +ubixfsInode*uPtr=NULL; +if(filename==NULL)returnfalse; +FILE*fd=NULL; +if((fd=fopen(filename,"wb+"))==NULL)returnfalse; + +cout<<"tags:"<<tag<<endl; +lseek(fileno(fd),tag*sizeof(bNode),SEEK_END); + +header->firstNodeOffset=sizeof(bNode); +header->firstDeleted=-1; +void*tmpPtr=malloc(sizeof(bNode)); +assert(tmpPtr); +uPtr=(ubixfsInode*)tmpPtr; +memset(tmpPtr,0,sizeof(bNode)); +fwrite(header,sizeof(bTreeHeader),1,fd); +saveNode(fd,root,tmpPtr); + +fclose(fd); +free(tmpPtr); +returntrue; +}//bTree::Save + +bool +bTree::Load(constchar*filename){ +if(filename==NULL)returnfalse; +returntrue; +}//bTree::Load + +bool +bTree::Delete(constchar*key){ + +if(key==NULL)returnfalse; +returntrue; +}//bTree::Delete + +bool +bTree::Verify(void){ +ubixfsInode*node=GetFirstNode(); +if(node==NULL)returntrue; + +while(node!=NULL){ +ubixfsInode*next=node->next.iPtr; +if(next!=NULL){ +//cout<<node->name<<"::"<<node->next->name<<":::"<<strcmp(node->name,node->next->name)<<endl; +if(strcmp(node->name,next->name)>0)returnfalse; +} +node=next; +}//while +returntrue; +}//bTree::Verify + +void +bTree::Print(bNode*node){ +if(node==NULL)return; +Info(node); +if(!node->leaf) +for(unsignedinti=0;i<=node->used;i++){ +Print(node->head[i].bPtr); +}//fori +}//bTree::Print + +void +bTree::PrintWholeTree(void){ +Print(root); +}//bTree::PrintWholeTree; + +bTree::~bTree(void){ +cout<<"treedepth:"<<header->treeDepth<<endl; +cout<<"treewidth:"<<header->treeWidth<<endl; +cout<<"treeleafcount:"<<header->treeLeafCount<<endl; +}//bTree::~bTree + +*/ - + diff --git a/doc/xml/btree_8h.xml b/doc/xml/btree_8h.xml index 28cefdd..edfcf86 100644 --- a/doc/xml/btree_8h.xml +++ b/doc/xml/btree_8h.xml @@ -1,257 +1,85 @@ - - - + + + btree.h - stdio.h - ubixfs.h - btreeheader.h - file.h - src/sys/ubixfsv2/btree.cpp - src/sys/ubixfsv2/main.cpp - src/sys/ubixfsv2/ubixfs.cpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bNode - bTree - - - B_MAX_CHILD_COUNT - 4 - - - - - - - - - - B_MAX_KEYS - 15 - - - - - - - - bTree::insertNode - bTree::splitNode - - - B_MAX_NAME_LENGTH - 240 - - - - - - - - bTree::bTree - bTree::Insert - bTree::insertNode - bTree::splitNode - - - B_NODE_MAGIC_1 - 0xDEADBEEF - - - - - - - - bTree::allocEmptyNode - - - B_NODE_MAGIC_2 - 0x1900BABE - - - - - - - - bTree::allocEmptyNode - - -#ifndefBTREE_H -#defineBTREE_H - -#include<stdio.h> - -#include"ubixfs.h" -#include"btreeheader.h" -#include"file.h" - -#defineB_NODE_MAGIC_10xDEADBEEF -#defineB_NODE_MAGIC_20x1900BABE - -#defineB_MAX_KEYS15 -#defineB_MAX_NAME_LENGTH240 -#defineB_MAX_CHILD_COUNT4 - -//ifanyofthesestructschangetheyhavetobeupdatedintheformat -//utilitytoo - -typedefstructbNode{ -uInt32magic1__attribute__((packed)); -uInt32used__attribute__((packed)); -uPtrparent__attribute__((packed)); -uInt64tag__attribute__((packed)); -charkeys[B_MAX_KEYS][B_MAX_NAME_LENGTH]__attribute__((packed)); -boolpresent[B_MAX_KEYS+1]__attribute__((packed)); -uPtrhead[B_MAX_KEYS+1]__attribute__((packed)); -uPtrtail[B_MAX_KEYS+1]__attribute__((packed)); -uInt32childCount[B_MAX_KEYS+1]__attribute__((packed)); -uInt32magic2__attribute__((packed)); -boolleaf__attribute__((packed)); -charreserved[131]__attribute__((packed)); -}bNode;//bNode - -structubixfsInode; - -classbTree{ -protected: -bNode*root; -UbixFS*fs; -bTreeHeader*header; -fileDescriptor*fd; -uInt32tag; -ubixfsInode*treeSearch(bNode*,constchar*); -ubixfsInode*inodeSearch(ubixfsInode*,constchar*); -voidsplitNode(bNode*); -bNode*allocEmptyNode(void); -voidinsertNode(bNode*,constchar*,bNode*); -bNode*findLeafNode(bNode*,constchar*); -voidPrint(bNode*); -voidsaveNode(FILE*,bNode*,void*); -public: -bTree(constchar*,ubixfsInode*); -bTree(UbixFS*,fileDescriptor*); -ubixfsInode*Find(constchar*); -ubixfsInode*GetFirstNode(void); -ubixfsInode*GetFirstNode(bNode*); -boolDelete(constchar*); -voidInfo(void); -voidInfo(constbNode*); -boolInsert(constchar*,ubixfsInode*); -boolSave(constchar*); -boolLoad(constchar*); -voidPrint(void); -voidPrintWholeTree(void); -boolVerify(void); -~bTree(void); -friendclassUbixFS; -};//bTree -#endif//!BTREE_H +/* +#ifndefBTREE_H +#defineBTREE_H + +#include<stdio.h> + +#include"ubixfs.h" +#include"btreeheader.h" +#include"file.h" + +#defineB_NODE_MAGIC_10xDEADBEEF +#defineB_NODE_MAGIC_20x1900BABE + +#defineB_MAX_KEYS15 +#defineB_MAX_NAME_LENGTH240 +#defineB_MAX_CHILD_COUNT4 + +//ifanyofthesestructschangetheyhavetobeupdatedintheformat +//utilitytoo + +typedefstructbNode{ +uInt32magic1__attribute__((packed)); +uInt32used__attribute__((packed)); +uPtrparent__attribute__((packed)); +uInt64tag__attribute__((packed)); +charkeys[B_MAX_KEYS][B_MAX_NAME_LENGTH]__attribute__((packed)); +boolpresent[B_MAX_KEYS+1]__attribute__((packed)); +uPtrhead[B_MAX_KEYS+1]__attribute__((packed)); +uPtrtail[B_MAX_KEYS+1]__attribute__((packed)); +uInt32childCount[B_MAX_KEYS+1]__attribute__((packed)); +uInt32magic2__attribute__((packed)); +boolleaf__attribute__((packed)); +charreserved[131]__attribute__((packed)); +}bNode;//bNode + +structubixfsInode; + +classbTree{ +protected: +bNode*root; +UbixFS*fs; +bTreeHeader*header; +fileDescriptor*fd; +uInt32tag; +ubixfsInode*treeSearch(bNode*,constchar*); +ubixfsInode*inodeSearch(ubixfsInode*,constchar*); +voidsplitNode(bNode*); +bNode*allocEmptyNode(void); +voidinsertNode(bNode*,constchar*,bNode*); +bNode*findLeafNode(bNode*,constchar*); +voidPrint(bNode*); +voidsaveNode(FILE*,bNode*,void*); +public: +bTree(constchar*,ubixfsInode*); +bTree(UbixFS*,fileDescriptor*); +ubixfsInode*Find(constchar*); +ubixfsInode*GetFirstNode(void); +ubixfsInode*GetFirstNode(bNode*); +boolDelete(constchar*); +voidInfo(void); +voidInfo(constbNode*); +boolInsert(constchar*,ubixfsInode*); +boolSave(constchar*); +boolLoad(constchar*); +voidPrint(void); +voidPrintWholeTree(void); +boolVerify(void); +~bTree(void); +friendclassUbixFS; +};//bTree +#endif//!BTREE_H +*/ - + diff --git a/doc/xml/btreeheader_8h.xml b/doc/xml/btreeheader_8h.xml index d155a61..aa22ee1 100644 --- a/doc/xml/btreeheader_8h.xml +++ b/doc/xml/btreeheader_8h.xml @@ -1,58 +1,26 @@ - - - + + + btreeheader.h - src/sys/ubixfsv2/btree.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bTreeHeader -#ifndefBTREEHEADER_H -#defineBTREEHEADER_H - -typedefstructbTreeHeader{ -uInt32treeDepth; -uInt32treeWidth; -uInt32treeLeafCount; -off_tfirstNodeOffset;//usedwhentreeisondisk -off_tfirstDeleted;//usedtopointtoanemptynode -charpaddington[4068]; -}bTreeHeader;//bTreeHeader - -#endif/*!BTREEHEADER_H*/ +/*#ifndefBTREEHEADER_H +#defineBTREEHEADER_H + +typedefstructbTreeHeader{ +uInt32treeDepth; +uInt32treeWidth; +uInt32treeLeafCount; +off_tfirstNodeOffset;//usedwhentreeisondisk +off_tfirstDeleted;//usedtopointtoanemptynode +charpaddington[4068]; +}bTreeHeader;//bTreeHeader + +#endif*//*!BTREEHEADER_H*/ - + diff --git a/doc/xml/buf_8h.xml b/doc/xml/buf_8h.xml index a3e6b9c..9f6b8ee 100644 --- a/doc/xml/buf_8h.xml +++ b/doc/xml/buf_8h.xml @@ -1,106 +1,395 @@ - - - + + + buf.h - ubixos/types.h - vfs/vfs.h - sys/device.h - src/sys/ufs/ffs.c + vfs/vfs.h + sys/device.h + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - + + + + + + + + + + + + + + + + - + - - - - + + + + - - - + - - - - - - - - - - - - + + + + - - - - + + + + - + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - - - - - + - + - - - - - - - + - - - - - - - - + + + + + + + + buf @@ -133,28 +422,22 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: buf_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:buf.h792016-01-1116:21:27Zreddawg$ -*****************************************************************************************/ +*****************************************************************************************/ -#ifndef_BUF_H -#define_BUF_H - -#include<ubixos/types.h> -#include<vfs/vfs.h> -#include<sys/device.h> - -structbuf{ -}; +#ifndef_BUF_H +#define_BUF_H + +#include<vfs/vfs.h> +#include<sys/device.h> + +structbuf{ +}; + - -#endif - -/*** -END -***/ - +#endif - + diff --git a/doc/xml/cc_8h.xml b/doc/xml/cc_8h.xml index 247e9e6..2e0e909 100644 --- a/doc/xml/cc_8h.xml +++ b/doc/xml/cc_8h.xml @@ -1,388 +1,1712 @@ - - - + + + cc.h - src/sys/include/net/arch.h - src/sys/include/net/err.h - src/sys/include/net/memp.h - src/sys/include/net/stats.h - src/sys/include/net/sys.h + ubixos/time.h + C:/Dev/git/UbixOS/sys/include/net/arch.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - - - + + + - - - - - - - - - - - - + + - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + - + - + - - - - - - - - - - - - - - + + + + - - - - + + + + + + + + - + + + + + - - + + + + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + - + - + + + + + - - - - + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + LWIP_ERR_T + int + + + + + + + + + PACK_STRUCT_BEGIN @@ -390,9 +1714,9 @@ - + - + PACK_STRUCT_END @@ -400,30 +1724,30 @@ - + - + PACK_STRUCT_FIELD x - x __attribute__((packed)) + x __attribute__((packed)) - + - + PACK_STRUCT_STRUCT - __attribute__((packed)) + __attribute__((packed)) - + @@ -431,50 +1755,25 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: cc_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__ARCH_CC_H__ -#define__ARCH_CC_H__ - -#definePACK_STRUCT_FIELD(x)x__attribute__((packed)) -#definePACK_STRUCT_STRUCT__attribute__((packed)) -#definePACK_STRUCT_BEGIN -#definePACK_STRUCT_END - -#endif/*__ARCH_CC_H__*/ +#ifndef__ARCH_CC_H__ +#define__ARCH_CC_H__ + +#include<ubixos/time.h> + +#definePACK_STRUCT_FIELD(x)x__attribute__((packed)) +#definePACK_STRUCT_STRUCT__attribute__((packed)) +#definePACK_STRUCT_BEGIN +#definePACK_STRUCT_END + +#defineLWIP_ERR_Tint +/* +#ifdefLWIP_ERR_T +typedefuint8_terr_t; +#endif +*/ + +#endif - + diff --git a/doc/xml/cdefs_8h.xml b/doc/xml/cdefs_8h.xml index 671fc1f..c1932f4 100644 --- a/doc/xml/cdefs_8h.xml +++ b/doc/xml/cdefs_8h.xml @@ -1,60 +1,4792 @@ - - - + + + cdefs.h - ubixos/types.h - src/sys/lib/strtol.c - - - - - - - - - - - - - - - - - - + C:/Dev/git/UbixOS/sys/include/sys/elf_generic.h + C:/Dev/git/UbixOS/sys/include/sys/select.h + C:/Dev/git/UbixOS/sys/include/sys/stdatomic.h + C:/Dev/git/UbixOS/sys/include/sys/uuid.h + C:/Dev/git/UbixOS/sys/include/ubixos/uthread.h + C:/Dev/git/UbixOS/sys/lib/strstr.c + C:/Dev/git/UbixOS/sys/lib/strtol.c - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - __dead2 - __attribute__((__noreturn__)) + + __alignof + x + __offsetof(struct { char __a; x __b; }, __b) - + - - _CDRES_H + + __alloc_align + x - + + + + __alloc_size + x + + + + + + + + + + __always_inline + + + + + + + + + + __arg_type_tag + arg_kind + arg_idx + type_tag_idx + + + + + + + + + + __asserts_exclusive + ... + __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) + + + + + + + + + + __asserts_shared + ... + __lock_annotate(assert_shared_lock(__VA_ARGS__)) + + + + + + + + + + __BEGIN_DECLS + + + + + + + + + + __BSD_VISIBLE + 1 + + + + + + + + + + __CONCAT + x + y + xy + + + + + + + + + + __const + /* delete pseudo-ANSI C keywords */ + + + + + + + + + + __containerof + x + s + m + __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) + + + + + + + + + + __COPYRIGHT + s + __IDSTRING(__CONCAT(__copyright_,__LINE__),s) + + + + + + + + + + __datatype_type_tag + kind + type + + + + + + + + + + __dead2 + + + + + + + + + + __DECONST + type + var + ((type)(__uintptr_t)(const void *)(var)) + + + + + + + + + + __DEQUALIFY + type + var + ((type)(__uintptr_t)(const volatile void *)(var)) + + + + + + + + + + __DEVOLATILE + type + var + ((type)(__uintptr_t)(volatile void *)(var)) + + + + + + + + + + __END_DECLS + + + + + + + + + + __exported + + + + + + + + + + __EXT1_VISIBLE + 1 + + + + + + + + + + __fastcall + + + + + + + + + + __FBSDID + s + __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) + + + + + + + + + + __format_arg + fmtarg + + + + + + + + + + __func__ + NULL + + + + + + + + + + __GLOBL + sym + __GLOBL1(sym) + + + + + + + + + + __GLOBL1 + sym + __asm__(".globl " #sym) + + + + + + + + + + __GNUC_PREREQ__ + ma + mi + 0 + + + + + + + + + + __guarded_by + x + __lock_annotate(guarded_by(x)) + + + + + + + + + + __has_attribute + x + 0 + + + + + + + + + + __has_builtin + x + 0 + + + + + + + + + + __has_extension + __has_feature + + + + + + + + + + __has_feature + x + 0 + + + + + + + + + + __has_include + x + 0 + + + + + + + + + + __hidden + + + + + + + + + + __IDSTRING + name + string + static const char name[] __unused = string + + + + + + + + + + __inline + + + + + + + + + + __ISO_C_VISIBLE + 2011 + + + + + + + + + + __lock_annotate + x + + + + + + + + + + __lockable + __lock_annotate(lockable) + + + + + + + + + + __locks_exclusive + ... + __lock_annotate(exclusive_lock_function(__VA_ARGS__)) + + + + + + + + + + __locks_shared + ... + __lock_annotate(shared_lock_function(__VA_ARGS__)) + + + + + + + + + + __malloc_like + + + + + + + + + + __min_size + x + (x) + + + + + + + + + + __no_lock_analysis + __lock_annotate(no_thread_safety_analysis) + + + + + + + + + + __noinline + + + + + + + + + + __nonnull + x + + + + + + + + + + __nonnull_all + + + + + + + + + + __null_sentinel + + + + + + + + + + __NULLABILITY_PRAGMA_POP + + + + + + + + + + __NULLABILITY_PRAGMA_PUSH + + + + + + + + + + __offsetof + type + field + ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) + + + + + + + + + + __P + protos + () /* traditional C preprocessor */ + + + + + + + + + + __POSIX_VISIBLE + 200809 + + + + + + + + + + __predict_false + exp + (exp) + + + + + + + + + + __predict_true + exp + (exp) + + + + + + + + + + __printf0like + fmtarg + firstvararg + + + + + + + + + + __printflike + fmtarg + firstvararg + + + + + + + + + + __pt_guarded_by + x + __lock_annotate(pt_guarded_by(x)) + + + + + + + + + + __pure + + + + + + + + + + __pure2 + + + + + + + + + + __rangeof + type + start + end + (__offsetof(type, end) - __offsetof(type, start)) + + + + + + + + + + __RCSID + s + __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) + + + + + + + + + + __RCSID_SOURCE + s + __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) + + + + + + + + + + __requires_exclusive + ... + __lock_annotate(exclusive_locks_required(__VA_ARGS__)) + + + + + + + + + + __requires_shared + ... + __lock_annotate(shared_locks_required(__VA_ARGS__)) + + + + + + + + + + __requires_unlocked + ... + __lock_annotate(locks_excluded(__VA_ARGS__)) + + + + + + + + + + __restrict + + + + + + + + + + __result_use_check + + + + + + + + + + __returns_twice + + + + + + + + + + __scanflike + fmtarg + firstvararg + + + + + + + + + + __SCCSID + s + __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) + + + + + + + + + + __signed + + + + + + + + + + __strfmonlike + fmtarg + firstvararg + + + + + + + + + + __strftimelike + fmtarg + firstvararg + + + + + + + + + + __STRING + x + "x" + + + + + + + + + + __trylocks_exclusive + ... + __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) + + + + + + + + + + __trylocks_shared + ... + __lock_annotate(shared_trylock_function(__VA_ARGS__)) + + + + + + + + + + __unlocks + ... + __lock_annotate(unlock_function(__VA_ARGS__)) + + + + + + + + + + __unreachable + + ((void)0) + + + + + + + + + + __unused + + + + + + + + + + __volatile + + + + + + + + + + __weak_symbol + __attribute__((__weak__)) + + + + + + + + + + __XSI_VISIBLE + 700 + + + + + + + + + + _Alignas + x + __aligned(x) + + + + + + + + + + _Alignof + x + __alignof(x) + + + + + + + + + + _Atomic + T + struct { T volatile __val; } + + + + + + + + + + _Nonnull + + + + + + + + + + _Noreturn + __dead2 + + + + + + + + + + _Null_unspecified + + + + + + + + + + _Nullable + + + + + + + + + + _Static_assert + x + y + struct __hack + + + + + + + + + + _Thread_local + __thread + + + + + + + + + + const + /* delete ANSI C keywords */ + + + + + + + + + + inline + + + + + + + + + + signed + + + + + + + + + + volatile + + + + + + + @@ -62,66 +4794,902 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: cdefs_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_CDEFS_H -#define_CDRES_H - -#include<ubixos/types.h> - -#define__dead2__attribute__((__noreturn__)) - - -#endif - -/*** -$Log: cdefs_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:51reddawg -nomessage - -Revision1.22004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)1991,1993 +*TheRegentsoftheUniversityofCalifornia.Allrightsreserved. +* +*ThiscodeisderivedfromsoftwarecontributedtoBerkeleyby +*BerkeleySoftwareDesign,Inc. +* +*Redistributionanduseinsourceandbinaryforms,withorwithout +*modification,arepermittedprovidedthatthefollowingconditions +*aremet: +*1.Redistributionsofsourcecodemustretaintheabovecopyright +*notice,thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyright +*notice,thislistofconditionsandthefollowingdisclaimerinthe +*documentationand/orothermaterialsprovidedwiththedistribution. +*4.NeitherthenameoftheUniversitynorthenamesofitscontributors +*maybeusedtoendorseorpromoteproductsderivedfromthissoftware +*withoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEREGENTSANDCONTRIBUTORS``ASIS''AND +*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE +*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE +*AREDISCLAIMED.INNOEVENTSHALLTHEREGENTSORCONTRIBUTORSBELIABLE +*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL +*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS +*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) +*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT +*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY +*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF +*SUCHDAMAGE. +* +*@(#)cdefs.h8.8(Berkeley)1/9/95 +*$FreeBSD:releng/11.1/sys/sys/cdefs.h3173422017-04-2320:32:46Zkib$ +*/ + +#ifndef_SYS_CDEFS_H_ +#define_SYS_CDEFS_H_ + +/* +*TestingagainstClang-specificextensions. +*/ +#ifndef__has_attribute +#define__has_attribute(x)0 +#endif +#ifndef__has_extension +#define__has_extension__has_feature +#endif +#ifndef__has_feature +#define__has_feature(x)0 +#endif +#ifndef__has_include +#define__has_include(x)0 +#endif +#ifndef__has_builtin +#define__has_builtin(x)0 +#endif + +#ifdefined(__cplusplus) +#define__BEGIN_DECLSextern"C"{ +#define__END_DECLS} +#else +#define__BEGIN_DECLS +#define__END_DECLS +#endif + +/* +*Thiscodehasbeenputinplacetohelpreducetheadditionof +*compilerspecificdefinesinFreeBSDcode.Ithelpstoaidin +*havingacompiler-agnosticsourcetree. +*/ + +#ifdefined(__GNUC__)||defined(__INTEL_COMPILER) + +#if__GNUC__>=3||defined(__INTEL_COMPILER) +#define__GNUCLIKE_ASM3 +#define__GNUCLIKE_MATH_BUILTIN_CONSTANTS +#else +#define__GNUCLIKE_ASM2 +#endif +#define__GNUCLIKE___TYPEOF1 +#define__GNUCLIKE___OFFSETOF1 +#define__GNUCLIKE___SECTION1 + +#ifndef__INTEL_COMPILER +#define__GNUCLIKE_CTOR_SECTION_HANDLING1 +#endif + +#define__GNUCLIKE_BUILTIN_CONSTANT_P1 +#ifdefined(__INTEL_COMPILER)&&defined(__cplusplus)&&\ +__INTEL_COMPILER<800 +#undef__GNUCLIKE_BUILTIN_CONSTANT_P +#endif + +#if(__GNUC_MINOR__>95||__GNUC__>=3) +#define__GNUCLIKE_BUILTIN_VARARGS1 +#define__GNUCLIKE_BUILTIN_STDARG1 +#define__GNUCLIKE_BUILTIN_VAALIST1 +#endif + +#ifdefined(__GNUC__) +#define__GNUC_VA_LIST_COMPATIBILITY1 +#endif + +/* +*Compilermemorybarriers,specifictogccandclang. +*/ +#ifdefined(__GNUC__) +#define__compiler_membar()__asm__volatile("":::"memory") +#endif + +#ifndef__INTEL_COMPILER +#define__GNUCLIKE_BUILTIN_NEXT_ARG1 +#define__GNUCLIKE_MATH_BUILTIN_RELOPS +#endif + +#define__GNUCLIKE_BUILTIN_MEMCPY1 + +/*XXX:if__GNUC__>=2:nottestedeverywhereoriginally,wherereplaced*/ +#define__CC_SUPPORTS_INLINE1 +#define__CC_SUPPORTS___INLINE1 +#define__CC_SUPPORTS___INLINE__1 + +#define__CC_SUPPORTS___FUNC__1 +#define__CC_SUPPORTS_WARNING1 + +#define__CC_SUPPORTS_VARADIC_XXX1/*seevarargs.h*/ + +#define__CC_SUPPORTS_DYNAMIC_ARRAY_INIT1 + +#endif/*__GNUC__||__INTEL_COMPILER*/ + +/* +*Macrototestifwe'reusingaspecificversionofgccorlater. +*/ +#ifdefined(__GNUC__)&&!defined(__INTEL_COMPILER) +#define__GNUC_PREREQ__(ma,mi)\ +(__GNUC__>(ma)||__GNUC__==(ma)&&__GNUC_MINOR__>=(mi)) +#else +#define__GNUC_PREREQ__(ma,mi)0 +#endif + +/* +*The__CONCATmacroisusedtoconcatenatepartsofsymbolnames,e.g. +*with"#defineOLD(foo)__CONCAT(old,foo)",OLD(foo)producesoldfoo. +*The__CONCATmacroisabittrickytouseifitmustworkinnon-ANSI +*mode--theremustbenospacesbetweenitsarguments,andfornested +*__CONCAT's,allthe__CONCAT'smustbeattheleft.__CONCATcanalso +*concatenatedouble-quotedstringsproducedbythe__STRINGmacro,but +*thisonlyworkswithANSIC. +* +*__XSTRINGislike__STRING,butitexpandsanymacrosinitsargument +*first.ItisonlyavailablewithANSIC. +*/ +#ifdefined(__STDC__)||defined(__cplusplus) +#define__P(protos)protos/*full-blownANSIC*/ +#define__CONCAT1(x,y)x##y +#define__CONCAT(x,y)__CONCAT1(x,y) +#define__STRING(x)#x/*stringifywithoutexpandingx*/ +#define__XSTRING(x)__STRING(x)/*expandx,thenstringify*/ + +#define__constconst/*definereservednamestostandard*/ +#define__signedsigned +#define__volatilevolatile +#ifdefined(__cplusplus) +#define__inlineinline/*converttoC++keyword*/ +#else +#if!(defined(__CC_SUPPORTS___INLINE)) +#define__inline/*deleteGCCkeyword*/ +#endif/*!__CC_SUPPORTS___INLINE*/ +#endif/*!__cplusplus*/ + +#else/*!(__STDC__||__cplusplus)*/ +#define__P(protos)()/*traditionalCpreprocessor*/ +#define__CONCAT(x,y)xy +#define__STRING(x)"x" + +#if!defined(__CC_SUPPORTS___INLINE) +#define__const/*deletepseudo-ANSICkeywords*/ +#define__inline +#define__signed +#define__volatile +/* +*Innon-ANSICenvironments,newprogramswillwantANSI-onlyCkeywords +*deletedfromtheprogramandoldprogramswillwantthemleftalone. +*Whenusingacompilerotherthangcc,programsusingtheANSICkeywords +*const,inlineetc.asnormalidentifiersshoulddefine-DNO_ANSI_KEYWORDS. +*Whenusing"gcc-traditional",weassumethatthisistheintent;if +*__GNUC__isdefinedbut__STDC__isnot,weleavethenewkeywordsalone. +*/ +#ifndefNO_ANSI_KEYWORDS +#defineconst/*deleteANSICkeywords*/ +#defineinline +#definesigned +#definevolatile +#endif/*!NO_ANSI_KEYWORDS*/ +#endif/*!__CC_SUPPORTS___INLINE*/ +#endif/*!(__STDC__||__cplusplus)*/ + +/* +*Compiler-dependentmacrostohelpdeclaredead(non-returning)and +*pure(nosideeffects)functions,andunusedvariables.Theyare +*nullexceptforversionsofgccthatareknowntosupportthefeatures +*properly(oldversionsofgcc-2supportedthedeadandpurefeatures +*inadifferent(wrong)way).Ifwedonotprovideanimplementation +*foragivencompiler,letthecompilefailifitistoldtouse +*afeaturethatwecannotlivewithout. +*/ +#ifdeflint +#define__dead2 +#define__pure2 +#define__unused +#define__packed +#define__aligned(x) +#define__alloc_align(x) +#define__alloc_size(x) +#define__section(x) +#define__weak_symbol +#else +#define__weak_symbol__attribute__((__weak__)) +#if!__GNUC_PREREQ__(2,5)&&!defined(__INTEL_COMPILER) +#define__dead2 +#define__pure2 +#define__unused +#endif +#if__GNUC__==2&&__GNUC_MINOR__>=5&&__GNUC_MINOR__<7&&!defined(__INTEL_COMPILER) +#define__dead2__attribute__((__noreturn__)) +#define__pure2__attribute__((__const__)) +#define__unused +/*XXXFindoutwhattodofor__packed,__alignedand__section*/ +#endif +#if__GNUC_PREREQ__(2,7)||defined(__INTEL_COMPILER) +#define__dead2__attribute__((__noreturn__)) +#define__pure2__attribute__((__const__)) +#define__unused__attribute__((__unused__)) +#define__used__attribute__((__used__)) +#define__packed__attribute__((__packed__)) +#define__aligned(x)__attribute__((__aligned__(x))) +#define__section(x)__attribute__((__section__(x))) +#endif +#if__GNUC_PREREQ__(4,3)||__has_attribute(__alloc_size__) +#define__alloc_size(x)__attribute__((__alloc_size__(x))) +#else +#define__alloc_size(x) +#endif +#if__GNUC_PREREQ__(4,9)||__has_attribute(__alloc_align__) +#define__alloc_align(x)__attribute__((__alloc_align__(x))) +#else +#define__alloc_align(x) +#endif +#endif/*lint*/ + +#if!__GNUC_PREREQ__(2,95) +#define__alignof(x)__offsetof(struct{char__a;x__b;},__b) +#endif + +/* +*KeywordsaddedinC11. +*/ + +#if!defined(__STDC_VERSION__)||__STDC_VERSION__<201112L||defined(lint) + +#if!__has_extension(c_alignas) +#if(defined(__cplusplus)&&__cplusplus>=201103L)||\ +__has_extension(cxx_alignas) +#define_Alignas(x)alignas(x) +#else +/*XXX:Onlyemulates_Alignas(constant-expression);not_Alignas(type-name).*/ +#define_Alignas(x)__aligned(x) +#endif +#endif + +#ifdefined(__cplusplus)&&__cplusplus>=201103L +#define_Alignof(x)alignof(x) +#else +#define_Alignof(x)__alignof(x) +#endif + +#if!defined(__cplusplus)&&!__has_extension(c_atomic)&&\ +!__has_extension(cxx_atomic) +/* +*Nonativesupportfor_Atomic().Placeobjectinstructuretoprevent +*mostformsofdirectnon-atomicaccess. +*/ +#define_Atomic(T)struct{Tvolatile__val;} +#endif + +#ifdefined(__cplusplus)&&__cplusplus>=201103L +#define_Noreturn[[noreturn]] +#else +#define_Noreturn__dead2 +#endif + +#if!__has_extension(c_static_assert) +#if(defined(__cplusplus)&&__cplusplus>=201103L)||\ +__has_extension(cxx_static_assert) +#define_Static_assert(x,y)static_assert(x,y) +#elif__GNUC_PREREQ__(4,6) +/*Nothing,gcc4.6andhigherhas_Static_assertbuilt-in*/ +#elifdefined(__COUNTER__) +#define_Static_assert(x,y)__Static_assert(x,__COUNTER__) +#define__Static_assert(x,y)___Static_assert(x,y) +#define___Static_assert(x,y)typedefchar__assert_##y[(x)?1:-1]\ +__unused +#else +#define_Static_assert(x,y)struct__hack +#endif +#endif + +#if!__has_extension(c_thread_local) +/* +*XXX:Somecompilers(Clang3.3,GCC4.7)falselyannounceC++11mode +*withoutactuallysupportingthethread_localkeyword.Don'tcheckfor +*thepresenceofC++11whendefining_Thread_local. +*/ +#if/*(defined(__cplusplus)&&__cplusplus>=201103L)||*/\ +__has_extension(cxx_thread_local) +#define_Thread_localthread_local +#else +#define_Thread_local__thread +#endif +#endif + +#endif/*__STDC_VERSION__||__STDC_VERSION__<201112L*/ + +/* +*EmulationofC11_Generic().UnlikethepreviouslydefinedC11 +*keywords,itisnotpossibletoimplementthisusingexactlythesame +*syntax.Thereforeimplementsomethingsimilarunderthename +*__generic().Unlike_Generic(),thismacrocanonlydistinguish +*betweenasingletype,soitrequiresnestedinvocationsto +*distinguishmultiplecases. +*/ + +#if(defined(__STDC_VERSION__)&&__STDC_VERSION__>=201112L)||\ +__has_extension(c_generic_selections) +#define__generic(expr,t,yes,no)\ +_Generic(expr,t:yes,default:no) +#elif__GNUC_PREREQ__(3,1)&&!defined(__cplusplus) +#define__generic(expr,t,yes,no)\ +__builtin_choose_expr(\ +__builtin_types_compatible_p(__typeof(expr),t),yes,no) +#endif + +/* +*C99Staticarrayindicesinfunctionparameterdeclarations.Syntaxsuchas: +*voidbar(intmyArray[static10]); +*isallowedinC99butnotinC++.Define__min_sizeappropriatelyso +*headersusingitcanbecompiledineitherlanguage.Uselikethis: +*voidbar(intmyArray[__min_size(10)]); +*/ +#if!defined(__cplusplus)&&\ +(defined(__clang__)||__GNUC_PREREQ__(4,6))&&\ +(!defined(__STDC_VERSION__)||(__STDC_VERSION__>=199901)) +#define__min_size(x)static(x) +#else +#define__min_size(x)(x) +#endif + +#if__GNUC_PREREQ__(2,96) +#define__malloc_like__attribute__((__malloc__)) +#define__pure__attribute__((__pure__)) +#else +#define__malloc_like +#define__pure +#endif + +#if__GNUC_PREREQ__(3,1)||(defined(__INTEL_COMPILER)&&__INTEL_COMPILER>=800) +#define__always_inline__attribute__((__always_inline__)) +#else +#define__always_inline +#endif + +#if__GNUC_PREREQ__(3,1) +#define__noinline__attribute__((__noinline__)) +#else +#define__noinline +#endif + +#if__GNUC_PREREQ__(3,3) +#define__nonnull(x)__attribute__((__nonnull__(x))) +#define__nonnull_all__attribute__((__nonnull__)) +#else +#define__nonnull(x) +#define__nonnull_all +#endif + +#if__GNUC_PREREQ__(3,4) +#define__fastcall__attribute__((__fastcall__)) +#define__result_use_check__attribute__((__warn_unused_result__)) +#else +#define__fastcall +#define__result_use_check +#endif + +#if__GNUC_PREREQ__(4,1) +#define__returns_twice__attribute__((__returns_twice__)) +#else +#define__returns_twice +#endif + +#if__GNUC_PREREQ__(4,6)||__has_builtin(__builtin_unreachable) +#define__unreachable()__builtin_unreachable() +#else +#define__unreachable()((void)0) +#endif + +/*XXX:shoulduse`#if__STDC_VERSION__<199901'.*/ +#if!__GNUC_PREREQ__(2,7)&&!defined(__INTEL_COMPILER) +#define__func__NULL +#endif + +#if(defined(__INTEL_COMPILER)||(defined(__GNUC__)&&__GNUC__>=2))&&!defined(__STRICT_ANSI__)||__STDC_VERSION__>=199901 +#define__LONG_LONG_SUPPORTED +#endif + +/*C++11exposesaloadofC99stuff*/ +#ifdefined(__cplusplus)&&__cplusplus>=201103L +#define__LONG_LONG_SUPPORTED +#ifndef__STDC_LIMIT_MACROS +#define__STDC_LIMIT_MACROS +#endif +#ifndef__STDC_CONSTANT_MACROS +#define__STDC_CONSTANT_MACROS +#endif +#endif + +/* +*GCC2.95provides`__restrict'asanextensiontoC90tosupportthe +*C99-specific`restrict'typequalifier.Wehappentouse`__restrict'as +*awaytodefinethe`restrict'typequalifierwithoutdisturbingolder +*softwarethatisunawareofC99keywords. +*/ +#if!(__GNUC__==2&&__GNUC_MINOR__==95) +#if!defined(__STDC_VERSION__)||__STDC_VERSION__<199901||defined(lint) +#define__restrict +#else +#define__restrictrestrict +#endif +#endif + +/* +*GNUCversion2.96addsexplicitbranchpredictionsothat +*theCPUback-endcanhinttheprocessorandalsosothat +*codeblockscanbereorderedsuchthatthepredictedpath +*seesamorelinearflow,thusimprovingcachebehavior,etc. +* +*Thefollowingtwomacrosprovideuswithawaytoutilizethis +*compilerfeature.Use__predict_true()ifyouexpecttheexpression +*toevaluatetotrue,and__predict_false()ifyouexpectthe +*expressiontoevaluatetofalse. +* +*Afewnotesaboutusage: +* +**Generally,__predict_false()errorconditionchecks(unless +*youhavesome_strong_reasontodootherwise,inwhichcase +*documentit),and/or__predict_true()`no-error'condition +*checks,assumingyouwanttooptimizefortheno-errorcase. +* +**Otherthanthat,ifyoudon'tknowthelikelihoodofatest +*succeedingfromempiricalorother`hard'evidence,don't +*makepredictions. +* +**Thesearemeanttobeusedinplacesthatarerun`alot'. +*Itiswastefultomakepredictionsincodethatisrun +*seldomly(e.g.atsubsysteminitializationtime)asthe +*basicblockreorderingthatthisaffectscanoftengenerate +*largercode. +*/ +#if__GNUC_PREREQ__(2,96) +#define__predict_true(exp)__builtin_expect((exp),1) +#define__predict_false(exp)__builtin_expect((exp),0) +#else +#define__predict_true(exp)(exp) +#define__predict_false(exp)(exp) +#endif + +#if__GNUC_PREREQ__(4,0) +#define__null_sentinel__attribute__((__sentinel__)) +#define__exported__attribute__((__visibility__("default"))) +#define__hidden__attribute__((__visibility__("hidden"))) +#else +#define__null_sentinel +#define__exported +#define__hidden +#endif + +/* +*Wedefinethisheresince<stddef.h>,<sys/queue.h>,and<sys/types.h> +*requireit. +*/ +#if__GNUC_PREREQ__(4,1) +#define__offsetof(type,field)__builtin_offsetof(type,field) +#else +#ifndef__cplusplus +#define__offsetof(type,field)\ +((__size_t)(__uintptr_t)((constvolatilevoid*)&((type*)0)->field)) +#else +#define__offsetof(type,field)\ +(__offsetof__(reinterpret_cast<__size_t>\ +(&reinterpret_cast<constvolatilechar&>\ +(static_cast<type*>(0)->field)))) +#endif +#endif +#define__rangeof(type,start,end)\ +(__offsetof(type,end)-__offsetof(type,start)) + +/* +*Giventhepointerxtothemembermofthestructs,return +*apointertothecontainingstructure.WhenusingGCC,wefirst +*assignpointerxtoalocalvariable,tocheckthatitstypeis +*compatiblewithmemberm. +*/ +#if__GNUC_PREREQ__(3,1) +#define__containerof(x,s,m)({\ +constvolatile__typeof(((s*)0)->m)*__x=(x);\ +__DEQUALIFY(s*,(constvolatilechar*)__x-__offsetof(s,m));\ +}) +#else +#define__containerof(x,s,m)\ +__DEQUALIFY(s*,(constvolatilechar*)(x)-__offsetof(s,m)) +#endif + +/* +*Compiler-dependentmacrostodeclarethatfunctionstakeprintf-like +*orscanf-likearguments.Theyarenullexceptforversionsofgcc +*thatareknowntosupportthefeaturesproperly(oldversionsofgcc-2 +*didn'tpermitkeepingthekeywordsoutoftheapplicationnamespace). +*/ +#if!__GNUC_PREREQ__(2,7)&&!defined(__INTEL_COMPILER) +#define__printflike(fmtarg,firstvararg) +#define__scanflike(fmtarg,firstvararg) +#define__format_arg(fmtarg) +#define__strfmonlike(fmtarg,firstvararg) +#define__strftimelike(fmtarg,firstvararg) +#else +#define__printflike(fmtarg,firstvararg)\ +__attribute__((__format__(__printf__,fmtarg,firstvararg))) +#define__scanflike(fmtarg,firstvararg)\ +__attribute__((__format__(__scanf__,fmtarg,firstvararg))) +#define__format_arg(fmtarg)__attribute__((__format_arg__(fmtarg))) +#define__strfmonlike(fmtarg,firstvararg)\ +__attribute__((__format__(__strfmon__,fmtarg,firstvararg))) +#define__strftimelike(fmtarg,firstvararg)\ +__attribute__((__format__(__strftime__,fmtarg,firstvararg))) +#endif + +/*Compiler-dependentmacrosthatrelyonFreeBSD-specificextensions.*/ +#ifdefined(__FreeBSD_cc_version)&&__FreeBSD_cc_version>=300001&&\ +defined(__GNUC__)&&!defined(__INTEL_COMPILER) +#define__printf0like(fmtarg,firstvararg)\ +__attribute__((__format__(__printf0__,fmtarg,firstvararg))) +#else +#define__printf0like(fmtarg,firstvararg) +#endif + +#ifdefined(__GNUC__)||defined(__INTEL_COMPILER) +#ifndef__INTEL_COMPILER +#define__strong_reference(sym,aliassym)\ +extern__typeof(sym)aliassym__attribute__((__alias__(#sym))) +#endif +#ifdef__STDC__ +#define__weak_reference(sym,alias)\ +__asm__(".weak"#alias);\ +__asm__(".equ"#alias","#sym) +#define__warn_references(sym,msg)\ +__asm__(".section.gnu.warning."#sym);\ +__asm__(".asciz\""msg"\"");\ +__asm__(".previous") +#define__sym_compat(sym,impl,verid)\ +__asm__(".symver"#impl","#sym"@"#verid) +#define__sym_default(sym,impl,verid)\ +__asm__(".symver"#impl","#sym"@@"#verid) +#else +#define__weak_reference(sym,alias)\ +__asm__(".weakalias");\ +__asm__(".equalias,sym") +#define__warn_references(sym,msg)\ +__asm__(".section.gnu.warning.sym");\ +__asm__(".asciz\"msg\"");\ +__asm__(".previous") +#define__sym_compat(sym,impl,verid)\ +__asm__(".symverimpl,sym@verid") +#define__sym_default(impl,sym,verid)\ +__asm__(".symverimpl,sym@@verid") +#endif/*__STDC__*/ +#endif/*__GNUC__||__INTEL_COMPILER*/ + +#define__GLOBL1(sym)__asm__(".globl"#sym) +#define__GLOBL(sym)__GLOBL1(sym) + +#ifdefined(__GNUC__)||defined(__INTEL_COMPILER) +#define__IDSTRING(name,string)__asm__(".ident\t\""string"\"") +#else +/* +*Thefollowingdefinitionmightnotworkwellifusedinheaderfiles, +*butitshouldbebetterthannothing.Ifyouwanta"donothing" +*version,thenitshouldgeneratesomeharmlessdeclaration,suchas: +*#define__IDSTRING(name,string)struct__hack +*/ +#define__IDSTRING(name,string)staticconstcharname[]__unused=string +#endif + +/* +*Embedthercsidofasourcefileintheresultinglibrary.Notethatin +*morerecentELFbinutils,weuse.identallowingtheIDtobestripped. +*Usage: +*__FBSDID("$FreeBSD:releng/11.1/sys/sys/cdefs.h3173422017-04-2320:32:46Zkib$"); +*/ +#ifndef__FBSDID +#if!defined(lint)&&!defined(STRIP_FBSDID) +#define__FBSDID(s)__IDSTRING(__CONCAT(__rcsid_,__LINE__),s) +#else +#define__FBSDID(s)struct__hack +#endif +#endif + +#ifndef__RCSID +#ifndefNO__RCSID +#define__RCSID(s)__IDSTRING(__CONCAT(__rcsid_,__LINE__),s) +#else +#define__RCSID(s)struct__hack +#endif +#endif + +#ifndef__RCSID_SOURCE +#ifndefNO__RCSID_SOURCE +#define__RCSID_SOURCE(s)__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) +#else +#define__RCSID_SOURCE(s)struct__hack +#endif +#endif + +#ifndef__SCCSID +#ifndefNO__SCCSID +#define__SCCSID(s)__IDSTRING(__CONCAT(__sccsid_,__LINE__),s) +#else +#define__SCCSID(s)struct__hack +#endif +#endif + +#ifndef__COPYRIGHT +#ifndefNO__COPYRIGHT +#define__COPYRIGHT(s)__IDSTRING(__CONCAT(__copyright_,__LINE__),s) +#else +#define__COPYRIGHT(s)struct__hack +#endif +#endif + +#ifndef__DECONST +#define__DECONST(type,var)((type)(__uintptr_t)(constvoid*)(var)) +#endif + +#ifndef__DEVOLATILE +#define__DEVOLATILE(type,var)((type)(__uintptr_t)(volatilevoid*)(var)) +#endif + +#ifndef__DEQUALIFY +#define__DEQUALIFY(type,var)((type)(__uintptr_t)(constvolatilevoid*)(var)) +#endif + +/*- +*Thefollowingdefinitionsareanextensionofthebehaviororiginally +*implementedin<sys/_posix.h>,butwithadifferentlevelofgranularity. +*POSIX.1requiresthatthemacroswetestbedefinedbeforeanystandard +*headerfileisincluded. +* +*Here'saquickrun-downoftheversions: +*defined(_POSIX_SOURCE)1003.1-1988 +*_POSIX_C_SOURCE==11003.1-1990 +*_POSIX_C_SOURCE==21003.2-1992CLanguageBindingOption +*_POSIX_C_SOURCE==1993091003.1b-1993 +*_POSIX_C_SOURCE==1995061003.1c-1995,1003.1i-1995, +*andtheomnibusISO/IEC9945-1:1996 +*_POSIX_C_SOURCE==2001121003.1-2001 +*_POSIX_C_SOURCE==2008091003.1-2008 +* +*Inaddition,theX/OpenPortabilityGuide,whichisnowtheSingleUNIX +*Specification,definesafeature-testmacrowhichindicatestheversionof +*thatspecification,andwhichsubsumes_POSIX_C_SOURCE. +* +*Ourmacrosbeginwithtwounderscorestoavoidnamespacescrewage. +*/ + +/*DealwithIEEEStd.1003.1-1990,inwhich_POSIX_C_SOURCE==1.*/ +#ifdefined(_POSIX_C_SOURCE)&&_POSIX_C_SOURCE==1 +#undef_POSIX_C_SOURCE/*Probablyillegal,butbeyondcaringnow.*/ +#define_POSIX_C_SOURCE199009 +#endif + +/*DealwithIEEEStd.1003.2-1992,inwhich_POSIX_C_SOURCE==2.*/ +#ifdefined(_POSIX_C_SOURCE)&&_POSIX_C_SOURCE==2 +#undef_POSIX_C_SOURCE +#define_POSIX_C_SOURCE199209 +#endif + +/*DealwithvariousX/OpenPortabilityGuidesandSingleUNIXSpec.*/ +#ifdef_XOPEN_SOURCE +#if_XOPEN_SOURCE-0>=700 +#define__XSI_VISIBLE700 +#undef_POSIX_C_SOURCE +#define_POSIX_C_SOURCE200809 +#elif_XOPEN_SOURCE-0>=600 +#define__XSI_VISIBLE600 +#undef_POSIX_C_SOURCE +#define_POSIX_C_SOURCE200112 +#elif_XOPEN_SOURCE-0>=500 +#define__XSI_VISIBLE500 +#undef_POSIX_C_SOURCE +#define_POSIX_C_SOURCE199506 +#endif +#endif + +/* +*DealwithallversionsofPOSIX.Theorderingrelativetothetestsaboveis +*important. +*/ +#ifdefined(_POSIX_SOURCE)&&!defined(_POSIX_C_SOURCE) +#define_POSIX_C_SOURCE198808 +#endif +#ifdef_POSIX_C_SOURCE +#if_POSIX_C_SOURCE>=200809 +#define__POSIX_VISIBLE200809 +#define__ISO_C_VISIBLE1999 +#elif_POSIX_C_SOURCE>=200112 +#define__POSIX_VISIBLE200112 +#define__ISO_C_VISIBLE1999 +#elif_POSIX_C_SOURCE>=199506 +#define__POSIX_VISIBLE199506 +#define__ISO_C_VISIBLE1990 +#elif_POSIX_C_SOURCE>=199309 +#define__POSIX_VISIBLE199309 +#define__ISO_C_VISIBLE1990 +#elif_POSIX_C_SOURCE>=199209 +#define__POSIX_VISIBLE199209 +#define__ISO_C_VISIBLE1990 +#elif_POSIX_C_SOURCE>=199009 +#define__POSIX_VISIBLE199009 +#define__ISO_C_VISIBLE1990 +#else +#define__POSIX_VISIBLE198808 +#define__ISO_C_VISIBLE0 +#endif/*_POSIX_C_SOURCE*/ +#else +/*- +*Dealwith_ANSI_SOURCE: +*Ifitisdefined,andnoothercompilationenvironmentisexplicitly +*requested,thendefineourinternalfeature-testmacrostozero.This +*makesnodifferencetothepreprocessor(undefinedsymbolsinpreprocessing +*expressionsaredefinedtohavevaluezero),butmakesitmoreconvenientfor +*atestprogramtoprintoutthevalues. +* +*Ifaprogrammistakenlydefines_ANSI_SOURCEandsomeothermacrosuchas +*_POSIX_C_SOURCE,wewillassumethatitwantsthebroadercompilation +*environment(andinfactwewillnevergethere). +*/ +#ifdefined(_ANSI_SOURCE)/*Hidealmosteverything.*/ +#define__POSIX_VISIBLE0 +#define__XSI_VISIBLE0 +#define__BSD_VISIBLE0 +#define__ISO_C_VISIBLE1990 +#define__EXT1_VISIBLE0 +#elifdefined(_C99_SOURCE)/*LocalismtospecifystrictC99env.*/ +#define__POSIX_VISIBLE0 +#define__XSI_VISIBLE0 +#define__BSD_VISIBLE0 +#define__ISO_C_VISIBLE1999 +#define__EXT1_VISIBLE0 +#elifdefined(_C11_SOURCE)/*LocalismtospecifystrictC11env.*/ +#define__POSIX_VISIBLE0 +#define__XSI_VISIBLE0 +#define__BSD_VISIBLE0 +#define__ISO_C_VISIBLE2011 +#define__EXT1_VISIBLE0 +#else/*Defaultenvironment:showeverything.*/ +#define__POSIX_VISIBLE200809 +#define__XSI_VISIBLE700 +#define__BSD_VISIBLE1 +#define__ISO_C_VISIBLE2011 +#define__EXT1_VISIBLE1 +#endif +#endif + +/*Useroverride__EXT1_VISIBLE*/ +#ifdefined(__STDC_WANT_LIB_EXT1__) +#undef__EXT1_VISIBLE +#if__STDC_WANT_LIB_EXT1__ +#define__EXT1_VISIBLE1 +#else +#define__EXT1_VISIBLE0 +#endif +#endif/*__STDC_WANT_LIB_EXT1__*/ + +#ifdefined(__mips)||defined(__powerpc64__)||defined(__riscv__) +#define__NO_TLS1 +#endif + +/* +*OldversionsofGCCusenon-standardARMarchsymbols;acle-compat.h +*translatesthemto__ARM_ARCHandthemodernfeaturesymbolsdefinedbyARM. +*/ +#ifdefined(__arm__)&&!defined(__ARM_ARCH) +#include<machine/acle-compat.h> +#endif + +/* +*Nullabilityqualifiers:currentlyonlysupportedbyClang. +*/ +#if!(defined(__clang__)&&__has_feature(nullability)) +#define_Nonnull +#define_Nullable +#define_Null_unspecified +#define__NULLABILITY_PRAGMA_PUSH +#define__NULLABILITY_PRAGMA_POP +#else +#define__NULLABILITY_PRAGMA_PUSH_Pragma("clangdiagnosticpush")\ +_Pragma("clangdiagnosticignored\"-Wnullability-completeness\"") +#define__NULLABILITY_PRAGMA_POP_Pragma("clangdiagnosticpop") +#endif + +/* +*TypeSafetyChecking +* +*Clangprovidesadditionalattributestoenablecheckingtypesafety +*propertiesthatcannotbeenforcedbytheCtypesystem. +*/ + +#if__has_attribute(__argument_with_type_tag__)&&\ +__has_attribute(__type_tag_for_datatype__)&&!defined(lint) +#define__arg_type_tag(arg_kind,arg_idx,type_tag_idx)\ +__attribute__((__argument_with_type_tag__(arg_kind,arg_idx,type_tag_idx))) +#define__datatype_type_tag(kind,type)\ +__attribute__((__type_tag_for_datatype__(kind,type))) +#else +#define__arg_type_tag(arg_kind,arg_idx,type_tag_idx) +#define__datatype_type_tag(kind,type) +#endif + +/* +*Lockannotations. +* +*Clangprovidessupportfordoingbasicthread-safetytestsat +*compile-time,bymarkingwhichlockswill/shouldbeheldwhen +*entering/leavingafunctions. +* +*Furthermore,itisalsopossibletoannotatevariablesandstructure +*memberstoenforcethattheyareonlyaccessedwhencertainlocksare +*held. +*/ + +#if__has_extension(c_thread_safety_attributes) +#define__lock_annotate(x)__attribute__((x)) +#else +#define__lock_annotate(x) +#endif + +/*Structureimplementsalock.*/ +#define__lockable__lock_annotate(lockable) + +/*Functionacquiresanexclusiveorsharedlock.*/ +#define__locks_exclusive(...)\ +__lock_annotate(exclusive_lock_function(__VA_ARGS__)) +#define__locks_shared(...)\ +__lock_annotate(shared_lock_function(__VA_ARGS__)) + +/*Functionattemptstoacquireanexclusiveorsharedlock.*/ +#define__trylocks_exclusive(...)\ +__lock_annotate(exclusive_trylock_function(__VA_ARGS__)) +#define__trylocks_shared(...)\ +__lock_annotate(shared_trylock_function(__VA_ARGS__)) + +/*Functionreleasesalock.*/ +#define__unlocks(...)__lock_annotate(unlock_function(__VA_ARGS__)) + +/*Functionassertsthatanexclusiveorsharedlockisheld.*/ +#define__asserts_exclusive(...)\ +__lock_annotate(assert_exclusive_lock(__VA_ARGS__)) +#define__asserts_shared(...)\ +__lock_annotate(assert_shared_lock(__VA_ARGS__)) + +/*Functionrequiresthatanexclusiveorsharedlockisorisnotheld.*/ +#define__requires_exclusive(...)\ +__lock_annotate(exclusive_locks_required(__VA_ARGS__)) +#define__requires_shared(...)\ +__lock_annotate(shared_locks_required(__VA_ARGS__)) +#define__requires_unlocked(...)\ +__lock_annotate(locks_excluded(__VA_ARGS__)) + +/*Functionshouldnotbeanalyzed.*/ +#define__no_lock_analysis__lock_annotate(no_thread_safety_analysis) + +/*Guardvariablesandstructuremembersbylock.*/ +#define__guarded_by(x)__lock_annotate(guarded_by(x)) +#define__pt_guarded_by(x)__lock_annotate(pt_guarded_by(x)) + +#endif/*!_SYS_CDEFS_H_*/ - + diff --git a/doc/xml/classogDisplay__UbixOS.xml b/doc/xml/classogDisplay__UbixOS.xml index 1ff95c0..70c5aa0 100644 --- a/doc/xml/classogDisplay__UbixOS.xml +++ b/doc/xml/classogDisplay__UbixOS.xml @@ -1,225 +1,101 @@ - - - + + + ogDisplay_UbixOS + ogSurface ogDisplay_UbixOS.h - - - bool - virtual bool ogDisplay_UbixOS::ogAlias - (ogSurface &, uInt32, uInt32, uInt32, uInt32) - ogAlias - - ogSurface & - - - uInt32 - - - uInt32 - - - uInt32 - - - uInt32 - + + + uint32_t + uint32_t ogDisplay_UbixOS::activePage + + activePage - + + ogDisplay_UbixOS - - bool - virtual bool ogDisplay_UbixOS::ogClone - (ogSurface &) - ogClone - - ogSurface & - + + ogModeInfo * + ogModeInfo* ogDisplay_UbixOS::modeInfo + + modeInfo - + + FindMode + ogDisplay_UbixOS + SetMode - - void - virtual void ogDisplay_UbixOS::ogCopyPalette - (ogSurface &) - ogCopyPalette - - ogSurface & - + + void * + void* ogDisplay_UbixOS::pages[2] + [2] + pages - + + ogDisplay_UbixOS - - bool - virtual bool ogDisplay_UbixOS::ogCreate - (uInt32, uInt32, ogPixelFmt) - ogCreate - - uInt32 - - - uInt32 - - - ogPixelFmt - + + ogVESAInfo * + ogVESAInfo* ogDisplay_UbixOS::VESAInfo + + VESAInfo - + + GetVESAInfo + ogDisplay_UbixOS - - - ogDisplay_UbixOS::ogDisplay_UbixOS - (void) - ogDisplay_UbixOS - - void - + + uint32_t + uint32_t ogDisplay_UbixOS::visualPage + + visualPage - - - - bool - virtual bool ogDisplay_UbixOS::ogLoadPalette - (const char *) - ogLoadPalette - - const char * - - - - - - - - - - - void - virtual void ogDisplay_UbixOS::ogSetPalette - (uInt8, uInt8, uInt8, uInt8, uInt8) - ogSetPalette - - uInt8 - - - uInt8 - - - uInt8 - - - uInt8 - - - uInt8 - - - - - - - - - - - void - virtual void ogDisplay_UbixOS::ogSetPalette - (uInt8, uInt8, uInt8, uInt8) - ogSetPalette - - uInt8 - - - uInt8 - - - uInt8 - - - uInt8 - - - - - - - - - - - void - virtual void ogDisplay_UbixOS::ogSetPalette - (const ogRGBA8[]) - ogSetPalette - - const - ogRGBA8 - [] - - - - - - - - - - - virtual - virtual ogDisplay_UbixOS::~ogDisplay_UbixOS - (void) - ~ogDisplay_UbixOS - - void - - - - - - - - + + ogDisplay_UbixOS - - uInt16 - uInt16 ogDisplay_UbixOS::FindMode - (uInt32, uInt32, uInt32) + + uint16_t + uint16_t ogDisplay_UbixOS::FindMode + (uint32_t, uint32_t, uint32_t) FindMode - uInt32 + uint32_t + _xRes - uInt32 + uint32_t + _yRes - uInt32 + uint32_t + _BPP @@ -227,15 +103,20 @@ - + + GetModeInfo + modeInfo + NULL + ogCreate - + void void ogDisplay_UbixOS::GetModeInfo - (uInt16) + (uint16_t) GetModeInfo - uInt16 + uint16_t + mode @@ -243,9 +124,12 @@ - + + biosCall + FindMode + SetMode - + void void ogDisplay_UbixOS::GetVESAInfo (void) @@ -259,15 +143,19 @@ - + + biosCall + VESAInfo + ogDisplay_UbixOS - + void void ogDisplay_UbixOS::SetMode - (uInt16) + (uint16_t) SetMode - uInt16 + uint16_t + mode @@ -275,9 +163,20 @@ - + + buffer + GetModeInfo + initVESAMode + KERNEL_PAGE_DEFAULT + kpanic + modeInfo + NULL + ogSetPalette + printOff + vmm_remapPage + ogCreate - + void void ogDisplay_UbixOS::SetPal (void) @@ -291,122 +190,313 @@ - + + outportByte + ogCopyPalette + ogLoadPalette - - - uInt32 - uInt32 ogDisplay_UbixOS::activePage - - activePage + + + bool + bool ogDisplay_UbixOS::ogAlias + (ogSurface &, uint32_t, uint32_t, uint32_t, uint32_t) + ogAlias + + ogSurface & + SrcObject + + + uint32_t + x1 + + + uint32_t + y1 + + + uint32_t + x2 + + + uint32_t + y2 + - + - - ogModeInfo * - ogModeInfo* ogDisplay_UbixOS::modeInfo - - modeInfo + + bool + bool ogDisplay_UbixOS::ogClone + (ogSurface &) + ogClone + + ogSurface & + SrcObject + - + - - void * - void* ogDisplay_UbixOS::pages[2] - [2] - pages + + void + void ogDisplay_UbixOS::ogCopyPalette + (ogSurface &) + ogCopyPalette + + ogSurface & + SrcObject + - + + SetPal - - ogVESAInfo * - ogVESAInfo* ogDisplay_UbixOS::VESAInfo - - VESAInfo + + bool + bool ogDisplay_UbixOS::ogCreate + (uint32_t, uint32_t, ogPixelFmt) + ogCreate + + uint32_t + _xRes + + + uint32_t + _yRes + + + ogPixelFmt + _pixFormat + - + + FindMode + SetMode - - uInt32 - uInt32 ogDisplay_UbixOS::visualPage - - visualPage + + + ogDisplay_UbixOS::ogDisplay_UbixOS + (void) + ogDisplay_UbixOS + + void + - + + activePage + GetVESAInfo + modeInfo + NULL + pages + VESAInfo + visualPage + + + bool + bool ogDisplay_UbixOS::ogLoadPalette + (const char *) + ogLoadPalette + + const char * + palfile + + + + + + + + + SetPal + + + void + virtual void ogDisplay_UbixOS::ogSetPalette + (const ogRGBA8[]) + ogSetPalette + + const + ogRGBA8 + [] + + + + + + + + + SetMode + + + void + void ogDisplay_UbixOS::ogSetPalette + (uint8_t, uint8_t, uint8_t, uint8_t) + ogSetPalette + + uint8_t + colour + + + uint8_t + red + + + uint8_t + green + + + uint8_t + blue + + + + + + + + + NULL + outportByte + + + void + void ogDisplay_UbixOS::ogSetPalette + (uint8_t, uint8_t, uint8_t, uint8_t, uint8_t) + ogSetPalette + + uint8_t + colour + + + uint8_t + red + + + uint8_t + green + + + uint8_t + blue + + + uint8_t + alpha + + + + + + + + + NULL + outportByte + + + + ogDisplay_UbixOS::~ogDisplay_UbixOS + (void) + ~ogDisplay_UbixOS + + void + + + + + + + + + + + + + + + + + + + - + + + + - + - - VESAInfo + - - modeInfo + + #VESAInfo + + + #modeInfo - + - + - ogDisplay_UbixOSactivePage - ogDisplay_UbixOSFindMode - ogDisplay_UbixOSGetModeInfo - ogDisplay_UbixOSGetVESAInfo - ogDisplay_UbixOSmodeInfo - ogDisplay_UbixOSogAlias - ogDisplay_UbixOSogClone - ogDisplay_UbixOSogCopyPalette - ogDisplay_UbixOSogCreate - ogDisplay_UbixOSogDisplay_UbixOS - ogDisplay_UbixOSogLoadPalette - ogDisplay_UbixOSogSetPalette - ogDisplay_UbixOSogSetPalette - ogDisplay_UbixOSogSetPalette - ogDisplay_UbixOSpages - ogDisplay_UbixOSSetMode - ogDisplay_UbixOSSetPal - ogDisplay_UbixOSVESAInfo - ogDisplay_UbixOSvisualPage - ogDisplay_UbixOS~ogDisplay_UbixOS + ogDisplay_UbixOSactivePage + ogDisplay_UbixOSFindMode + ogDisplay_UbixOSGetModeInfo + ogDisplay_UbixOSGetVESAInfo + ogDisplay_UbixOSmodeInfo + ogDisplay_UbixOSogAlias + ogDisplay_UbixOSogClone + ogDisplay_UbixOSogCopyPalette + ogDisplay_UbixOSogCreate + ogDisplay_UbixOSogDisplay_UbixOS + ogDisplay_UbixOSogLoadPalette + ogDisplay_UbixOSogSetPalette + ogDisplay_UbixOSogSetPalette + ogDisplay_UbixOSogSetPalette + ogDisplay_UbixOSpages + ogDisplay_UbixOSSetMode + ogDisplay_UbixOSSetPal + ogDisplay_UbixOSVESAInfo + ogDisplay_UbixOSvisualPage + ogDisplay_UbixOS~ogDisplay_UbixOS diff --git a/doc/xml/classogDisplay__VESA.xml b/doc/xml/classogDisplay__VESA.xml index 32b15ea..fe10612 100644 --- a/doc/xml/classogDisplay__VESA.xml +++ b/doc/xml/classogDisplay__VESA.xml @@ -1,28 +1,77 @@ - - - + + + ogDisplay_VESA + ogSurface ogDisplay_VESA.h - - - bool - virtual bool ogDisplay_VESA::ogAlias - (ogSurface &, uInt32, uInt32, uInt32, uInt32) - ogAlias + + + bool + bool ogDisplay_VESA::InGraphics + + InGraphics + + + + + + + + + + TMode_Rec * + TMode_Rec* ogDisplay_VESA::ModeRec + + ModeRec + + + + + + + + + + uInt16 + uInt16 ogDisplay_VESA::ScreenSelector + + ScreenSelector + + + + + + + + + + TVESA_Rec * + TVESA_Rec* ogDisplay_VESA::VESARec + + VESARec + + + + + + + + + + + + uInt16 + uInt16 ogDisplay_VESA::findMode + (uInt32, uInt32, uInt32) + findMode - ogSurface & + uInt32 - uInt32 + uInt32 - uInt32 - - - uInt32 - - - uInt32 + uInt32 @@ -30,10 +79,173 @@ - + - - bool + + void + void ogDisplay_VESA::getModeInfo + (uInt16) + getModeInfo + + uInt16 + + + + + + + + + + + void + void ogDisplay_VESA::getVESAInfo + (void) + getVESAInfo + + void + + + + + + + + + + + uInt32 + virtual uInt32 ogDisplay_VESA::rawGetPixel + (uInt32, uInt32) + rawGetPixel + + uInt32 + + + uInt32 + + + + + + + + + + + void + virtual void ogDisplay_VESA::rawLine + (uInt32, uInt32, uInt32, uInt32, uInt32) + rawLine + + uInt32 + + + uInt32 + + + uInt32 + + + uInt32 + + + uInt32 + + + + + + + + + + + void + virtual void ogDisplay_VESA::rawSetPixel + (uInt32, uInt32, uInt32) + rawSetPixel + + uInt32 + + + uInt32 + + + uInt32 + + + + + + + + + + + void + void ogDisplay_VESA::setMode + (uInt16) + setMode + + uInt16 + + + + + + + + + + + void + void ogDisplay_VESA::setPal + (void) + setPal + + void + + + + + + + + + + + + + bool + virtual bool ogDisplay_VESA::ogAlias + (ogSurface &, uInt32, uInt32, uInt32, uInt32) + ogAlias + + ogSurface & + + + uInt32 + + + uInt32 + + + uInt32 + + + uInt32 + + + + + + + + + + + bool virtual bool ogDisplay_VESA::ogAvail (void) ogAvail @@ -46,15 +258,15 @@ - + - + void virtual void ogDisplay_VESA::ogClear (uInt32) ogClear - uInt32 + uInt32 @@ -62,10 +274,10 @@ - + - - bool + + bool virtual bool ogDisplay_VESA::ogClone (ogSurface &) ogClone @@ -78,24 +290,24 @@ - + - + void virtual void ogDisplay_VESA::ogCopyLineFrom (uInt32, uInt32, void *, uInt32) ogCopyLineFrom - uInt32 + uInt32 - uInt32 + uInt32 void * - uInt32 + uInt32 @@ -103,24 +315,24 @@ - + - + void virtual void ogDisplay_VESA::ogCopyLineTo (uInt32, uInt32, const void *, uInt32) ogCopyLineTo - uInt32 + uInt32 - uInt32 + uInt32 - const void * + const void * - uInt32 + uInt32 @@ -128,9 +340,9 @@ - + - + void virtual void ogDisplay_VESA::ogCopyPal (ogSurface &) @@ -144,18 +356,18 @@ - + - - bool + + bool virtual bool ogDisplay_VESA::ogCreate (uInt32, uInt32, ogPixelFmt) ogCreate - uInt32 + uInt32 - uInt32 + uInt32 ogPixelFmt @@ -166,9 +378,9 @@ - + - + ogDisplay_VESA::ogDisplay_VESA (void) @@ -182,10 +394,10 @@ - + - - uInt32 + + uInt32 virtual uInt32 ogDisplay_VESA::ogGetPixel (int32, int32) ogGetPixel @@ -201,18 +413,18 @@ - + - + void * virtual void* ogDisplay_VESA::ogGetPtr (uInt32, uInt32) ogGetPtr - uInt32 + uInt32 - uInt32 + uInt32 @@ -220,9 +432,9 @@ - + - + void virtual void ogDisplay_VESA::ogHLine (int32, int32, int32, uInt32) @@ -237,7 +449,7 @@ int32 - uInt32 + uInt32 @@ -245,15 +457,15 @@ - + - - bool + + bool virtual bool ogDisplay_VESA::ogLoadPal (const char *) ogLoadPal - const char * + const char * @@ -261,9 +473,9 @@ - + - + void virtual void ogDisplay_VESA::ogSetPixel (int32, int32, uInt32) @@ -275,7 +487,7 @@ int32 - uInt32 + uInt32 @@ -283,24 +495,24 @@ - + - + void virtual void ogDisplay_VESA::ogSetRGBPalette (uInt8, uInt8, uInt8, uInt8) ogSetRGBPalette - uInt8 + uInt8 - uInt8 + uInt8 - uInt8 + uInt8 - uInt8 + uInt8 @@ -308,9 +520,9 @@ - + - + void virtual void ogDisplay_VESA::ogVFlip (void) @@ -324,9 +536,9 @@ - + - + void virtual void ogDisplay_VESA::ogVLine (int32, int32, int32, uInt32) @@ -341,7 +553,7 @@ int32 - uInt32 + uInt32 @@ -349,10 +561,10 @@ - + - - virtual + + virtual ogDisplay_VESA::~ogDisplay_VESA (void) ~ogDisplay_VESA @@ -365,276 +577,81 @@ - - - - - - uInt16 - uInt16 ogDisplay_VESA::findMode - (uInt32, uInt32, uInt32) - findMode - - uInt32 - - - uInt32 - - - uInt32 - - - - - - - - - - - void - void ogDisplay_VESA::getModeInfo - (uInt16) - getModeInfo - - uInt16 - - - - - - - - - - - void - void ogDisplay_VESA::getVESAInfo - (void) - getVESAInfo - - void - - - - - - - - - - - uInt32 - virtual uInt32 ogDisplay_VESA::rawGetPixel - (uInt32, uInt32) - rawGetPixel - - uInt32 - - - uInt32 - - - - - - - - - - - void - virtual void ogDisplay_VESA::rawLine - (uInt32, uInt32, uInt32, uInt32, uInt32) - rawLine - - uInt32 - - - uInt32 - - - uInt32 - - - uInt32 - - - uInt32 - - - - - - - - - - - void - virtual void ogDisplay_VESA::rawSetPixel - (uInt32, uInt32, uInt32) - rawSetPixel - - uInt32 - - - uInt32 - - - uInt32 - - - - - - - - - - - void - void ogDisplay_VESA::setMode - (uInt16) - setMode - - uInt16 - - - - - - - - - - - void - void ogDisplay_VESA::setPal - (void) - setPal - - void - - - - - - - - - - - - - bool - bool ogDisplay_VESA::InGraphics - - InGraphics - - - - - - - - - - TMode_Rec * - TMode_Rec* ogDisplay_VESA::ModeRec - - ModeRec - - - - - - - - - - uInt16 - uInt16 ogDisplay_VESA::ScreenSelector - - ScreenSelector - - - - - - - - - - TVESA_Rec * - TVESA_Rec* ogDisplay_VESA::VESARec - - VESARec - - - - - - - + + + + + + + + + + + + - + - + + + + - + - - ModeRec + - - VESARec + + #ModeRec + + + #VESARec - + - ogDisplay_VESAfindMode - ogDisplay_VESAgetModeInfo - ogDisplay_VESAgetVESAInfo - ogDisplay_VESAInGraphics - ogDisplay_VESAModeRec - ogDisplay_VESAogAlias - ogDisplay_VESAogAvail - ogDisplay_VESAogClear - ogDisplay_VESAogClone - ogDisplay_VESAogCopyLineFrom - ogDisplay_VESAogCopyLineTo - ogDisplay_VESAogCopyPal - ogDisplay_VESAogCreate - ogDisplay_VESAogDisplay_VESA - ogDisplay_VESAogGetPixel - ogDisplay_VESAogGetPtr - ogDisplay_VESAogHLine - ogDisplay_VESAogLoadPal - ogDisplay_VESAogSetPixel - ogDisplay_VESAogSetRGBPalette - ogDisplay_VESAogVFlip - ogDisplay_VESAogVLine - ogDisplay_VESArawGetPixel - ogDisplay_VESArawLine - ogDisplay_VESArawSetPixel - ogDisplay_VESAScreenSelector - ogDisplay_VESAsetMode - ogDisplay_VESAsetPal - ogDisplay_VESAVESARec - ogDisplay_VESA~ogDisplay_VESA + ogDisplay_VESAfindMode + ogDisplay_VESAgetModeInfo + ogDisplay_VESAgetVESAInfo + ogDisplay_VESAInGraphics + ogDisplay_VESAModeRec + ogDisplay_VESAogAlias + ogDisplay_VESAogAvail + ogDisplay_VESAogClear + ogDisplay_VESAogClone + ogDisplay_VESAogCopyLineFrom + ogDisplay_VESAogCopyLineTo + ogDisplay_VESAogCopyPal + ogDisplay_VESAogCreate + ogDisplay_VESAogDisplay_VESA + ogDisplay_VESAogGetPixel + ogDisplay_VESAogGetPtr + ogDisplay_VESAogHLine + ogDisplay_VESAogLoadPal + ogDisplay_VESAogSetPixel + ogDisplay_VESAogSetRGBPalette + ogDisplay_VESAogVFlip + ogDisplay_VESAogVLine + ogDisplay_VESArawGetPixel + ogDisplay_VESArawLine + ogDisplay_VESArawSetPixel + ogDisplay_VESAScreenSelector + ogDisplay_VESAsetMode + ogDisplay_VESAsetPal + ogDisplay_VESAVESARec + ogDisplay_VESA~ogDisplay_VESA diff --git a/doc/xml/combine.xslt b/doc/xml/combine.xslt index abdd9ac..f0ee1fd 100644 --- a/doc/xml/combine.xslt +++ b/doc/xml/combine.xslt @@ -3,10 +3,10 @@ xsltproc combine.xslt index.xml >all.xml --> - + - + diff --git a/doc/xml/compound.xsd b/doc/xml/compound.xsd index f08e5e6..aaf2b1c 100644 --- a/doc/xml/compound.xsd +++ b/doc/xml/compound.xsd @@ -29,6 +29,7 @@ + @@ -39,7 +40,11 @@ + + + + @@ -59,7 +64,15 @@ - + + + + + + + + + @@ -69,7 +82,7 @@ - + @@ -77,7 +90,7 @@ - + @@ -86,7 +99,7 @@ - + @@ -95,12 +108,13 @@ - + - + + @@ -141,22 +155,61 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -179,11 +232,13 @@ + + @@ -226,6 +281,7 @@ + @@ -240,12 +296,16 @@ - + + + + + @@ -256,6 +316,10 @@ + + + + @@ -263,39 +327,47 @@ - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + - - - + + + + + @@ -338,37 +410,279 @@ + + - + + + + + + - + + + + + + + + + + + + + + + - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + @@ -393,12 +707,16 @@ - + + + + + @@ -445,7 +763,9 @@ - + + + @@ -478,8 +798,8 @@ + - @@ -509,15 +829,12 @@ - - - - - - - - - + + + + + + @@ -554,10 +871,17 @@ + + + + + + + @@ -582,12 +906,39 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -605,6 +956,7 @@ + @@ -629,6 +981,8 @@ + + @@ -641,6 +995,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -658,6 +1040,10 @@ + + + + @@ -718,6 +1104,10 @@ + + + + @@ -734,6 +1124,7 @@ + @@ -752,6 +1143,7 @@ + @@ -761,6 +1153,7 @@ + @@ -778,5 +1171,16 @@ + + + + + + + + + + + diff --git a/doc/xml/copyvirtualspace_8c.xml b/doc/xml/copyvirtualspace_8c.xml index 105e346..ef079de 100644 --- a/doc/xml/copyvirtualspace_8c.xml +++ b/doc/xml/copyvirtualspace_8c.xml @@ -1,108 +1,267 @@ - - - + + + copyvirtualspace.c vmm/vmm.h + vmm/paging.h sys/kern_sysctl.h ubixos/spinlock.h ubixos/kpanic.h string.h - - - - + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - + + + + - - - - + + + + - + + + - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + struct spinLock + struct spinLock cvsSpinLock + + cvsSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + void * - void* vmmCopyVirtualSpace + void* vmm_copyVirtualSpace (pidType pid) - vmmCopyVirtualSpace + vmm_copyVirtualSpace - pidType + pidType pid @@ -111,42 +270,10 @@ - - adjustCowCounter - cvsSpinLock - kpanic - memset - PAGE_COW - PAGE_DEFAULT - PAGE_STACK - pageEntries - parentPageDirAddr - spinLock - spinUnlock - tablesBaseAddress - vmm_getPhysicalAddr - vmmGetFreeKernelPage - vmmUnmapPage - x1 - x1000 - fork_copyProcess - - - - - spinLock_t - spinLock_t cvsSpinLock - - cvsSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - vmmCopyVirtualSpace + + spinLock + fork_copyProcess + sys_fork @@ -154,266 +281,283 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: copyvirtualspace_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<vmm/paging.h> #include<sys/kern_sysctl.h> #include<ubixos/spinlock.h> #include<ubixos/kpanic.h> #include<string.h> -staticspinLock_tcvsSpinLock=SPIN_LOCK_INITIALIZER; +staticstructspinLockcvsSpinLock=SPIN_LOCK_INITIALIZER; /************************************************************************ -Function:void*vmmCopyVirtualSpace(pidTypepid); +Function:void*vmm_copyVirtualSpace(pidTypepid); -Description:CreatesACopyOfAVirtualSpaceAndSetAllNONKernel -SpaceToCOWForAForkThisWillAlsoAlterTheParents -VMSpaceToMakeThatCOWAsWell +Description:CreatesACopyOfAVirtualSpaceAndSetAllNONKernel +SpaceToCOWForAForkThisWillAlsoAlterTheParents +VMSpaceToMakeThatCOWAsWell -Notes: +Notes: -08/02/02-AddedPassingOfpidTypepidSoWeCanBetterKeepTrackOf -WhichTaskHasWhichPhysicalPages +08/02/02-AddedPassingOfpidTypepidSoWeCanBetterKeepTrackOf +WhichTaskHasWhichPhysicalPages -************************************************************************/ -void* -vmmCopyVirtualSpace(pidTypepid) -{ -void*newPageDirectoryAddress=0x0; -uInt32*parentPageDirectory=0x0,*newPageDirectory=0x0; -uInt32*parentPageTable=0x0,*newPageTable=0x0; -uInt32*parentStackPage=0x0,*newStackPage=0x0; -uInt16x=0,i=0,s=0; - -spinLock(&cvsSpinLock); - -/*SetAddressOfParentPageDirectory*/ -parentPageDirectory=(uInt32*)parentPageDirAddr; +************************************************************************/ +void*vmm_copyVirtualSpace(pidTypepid){ +void*newPageDirectoryAddress=0x0; + +uint32_t*parentPageDirectory=0x0,*newPageDirectory=0x0; +uint32_t*parentPageTable=0x0,*newPageTable=0x0; +uint32_t*parentStackPage=0x0,*newStackPage=0x0; +uint16_tx=0,i=0,s=0; + +spinLock(&cvsSpinLock); + +/*SetAddressOfParentPageDirectory*/ +parentPageDirectory=(uint32_t*)PD_BASE_ADDR; + /*AllocateANewPageForTheNewPageDirectory*/ -if((newPageDirectory=(uInt32*)vmmGetFreeKernelPage(pid,1))==0x0) -kpanic("Error:newPageDirectory==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); - +if((newPageDirectory=(uint32_t*)vmm_getFreeKernelPage(pid,1))==0x0) +kpanic("Error:newPageDirectory==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + /*SetnewPageDirectoryAddressToTheNewlyCreatedPageDirectoriesPage*/ -newPageDirectoryAddress=(void*)vmm_getPhysicalAddr((uInt32)newPageDirectory); - +newPageDirectoryAddress=(void*)vmm_getPhysicalAddr((uint32_t)newPageDirectory); + /*FirstSetUpAFlushedPageDirectory*/ -memset(newPageDirectory,0x0,0x1000); +bzero(newPageDirectory,PAGE_SIZE); -/*MapTheTop1GBRegionOfTheVMSpace*/ -for(x=768;x<pageEntries;x++){ -newPageDirectory[x]=parentPageDirectory[x]; -} - -/* -*NowForTheFunStuffForPageTables1-766WeMustMapTheseAndSet -*ThePermissionsOnEveryMappedPagesToCOWThisWillConserveMemory -*BecauseTheTwoVMSpacesWillBeSharingSomePages -*/ -for(x=0x1;x<=766;x++){ -/*IfPageTableExistsMapIt*/ -if(parentPageDirectory[x]!=0){ -/*SetParentToPropperPageTable*/ -parentPageTable=(uInt32*)(tablesBaseAddress+(0x1000*x)); -/*AllocateANewPageTable*/ -if((newPageTable=(uInt32*)vmmGetFreeKernelPage(pid,1))==0x0) -kpanic("Error:newPageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); - -/*SetParentAndNewPagesToCOW*/ -for(i=0;i<pageEntries;i++){ - -/*IfPageIsMapped*/ -if((parentPageTable[i]&0xFFFFF000)!=0x0){ -/*CheckToSeeIfItsAStackPage*/ -if(((uInt32)parentPageTable[i]&PAGE_STACK)==PAGE_STACK){ -/*AllocANewPageForThisStackPage*/ -if((newStackPage=(uInt32*)vmmGetFreeKernelPage(pid,1))==0x0) -kpanic("Error:newStackPage==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); - -/*SetPointerToParentsStackPage*/ -parentStackPage=(uInt32*)(((1024*4096)*x)+(4096*i)); - -/*CopyTheTackByteForByte(IShouldFindAFasterWay)*/ -for(s=0x0;s<pageEntries;s++){ -newStackPage[s]=parentStackPage[s]; -} -/*InsertNewStackIntoPageTable*/ -newPageTable[i]=(vmm_getPhysicalAddr((uInt32)newStackPage)|PAGE_DEFAULT|PAGE_STACK); -/*UnmapFromKernelSpace*/ -vmmUnmapPage((uInt32)newStackPage,1); -} -else{ -/*SetPageToCOWInParentAndChildSpace*/ -newPageTable[i]=(((uInt32)parentPageTable[i]&0xFFFFF000)|(PAGE_DEFAULT|PAGE_COW)); -/*IncrementTheCOWCounterForThisPage*/ -if(((uInt32)parentPageTable[i]&PAGE_COW)==PAGE_COW){ -adjustCowCounter(((uInt32)parentPageTable[i]&0xFFFFF000),1); -} -else{ -adjustCowCounter(((uInt32)parentPageTable[i]&0xFFFFF000),2); -parentPageTable[i]=newPageTable[i]; -} -} -} -else{ -newPageTable[i]=(uInt32)0x0; -} -} - -/*PutNewPageTableIntoNewPageDirectory*/ -newPageDirectory[x]=(vmm_getPhysicalAddr((uInt32)newPageTable)|PAGE_DEFAULT); -/*UnmapPageFromKernelSpaceButKeepItMarkedAsNotAvail*/ -vmmUnmapPage((uInt32)newPageTable,1); -}else{ -newPageDirectory[x]=(uInt32)0x0; -} -} -/* -*AllocateANewPageForTheTheFirstPageTableWhereWeWillMapThe -*LowerRegion -*/ -if((newPageTable=(uInt32*)vmmGetFreeKernelPage(pid,1))==0x0) -kpanic("Error:newPageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); - -/*FlushThePageFromGarbageInMemory*/ -memset(newPageTable,0x0,0x1000); - -/*MapThisIntoThePageDirectory*/ -newPageDirectory[0]=(vmm_getPhysicalAddr((uInt32)newPageTable)|PAGE_DEFAULT); -/*SetAddressOfParentsPageTable*/ -parentPageTable=(uInt32*)tablesBaseAddress; -/*MapTheFirst1MBWorthOfPages*/ -for(x=0;x<(pageEntries/4);x++){ -newPageTable[x]=parentPageTable[x]; -} -/*MapTheNext3MBWorthOfPagesButMakeThemCOW*/ -for(x=(pageEntries/4)+1;x<pageEntries;x++){ -/*IfPageIsAvaiableMapIt*/ -if((parentPageTable[x]&0xFFFFF000)!=0x0){ -/*SetPagesToCOW*/ -newPageTable[x]=(((uInt32)parentPageTable[x]&0xFFFFF000)|(PAGE_DEFAULT|PAGE_COW)); -/*IncrementTheCOWCounterForThisPage*/ -if(((uInt32)parentPageTable[x]&PAGE_COW)==PAGE_COW){ -adjustCowCounter(((uInt32)parentPageTable[x]&0xFFFFF000),1); -}else{ -adjustCowCounter(((uInt32)parentPageTable[x]&0xFFFFF000),2); -parentPageTable[x]=newPageTable[x]; -} -}else{ -newPageTable[x]=(uInt32)0x0; -} -} -/*SetVirtualMappingForPageDirectory*/ -newPageTable[256]=(vmm_getPhysicalAddr((uInt32)newPageDirectory)|PAGE_DEFAULT); - -/* -*NowTheFunStuffBuildTheInitialVirtualPageSpaceSoWeDon'tHave -*ToWorryAboutMappingThemInLaterHowEverI'mConcernedThisMay -*BecomeASecurityIssue -*/ -/*FirstLetsUnmapThePreviouslyAllocatedPageTable*/ -vmmUnmapPage((uInt32)newPageTable,1); -/*AllocateANewPageTable*/ -if((newPageTable=(uInt32*)vmmGetFreeKernelPage(pid,1))==0x0) -kpanic("Error:newPageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); -/*FirstSetOurPageDirectoryToContainThis*/ -newPageDirectory[767]=vmm_getPhysicalAddr((uInt32)newPageTable)|PAGE_DEFAULT; -/*NowLetsBuildThePageTable*/ -for(x=0;x<pageEntries;x++){ -newPageTable[x]=newPageDirectory[x]; -} -/*NowWeAreDoneSoLetsUnmapThisPage*/ -vmmUnmapPage((uInt32)newPageTable,1); -/*NowWeAreDoneWithThePageDirectorySoLetsUnmapThatToo*/ -vmmUnmapPage((uInt32)newPageDirectory,1); - -spinUnlock(&cvsSpinLock); - -/*ReturnPhysicalAddressOfPageDirectory*/ -return(newPageDirectoryAddress); -} - -/*** -$Log: copyvirtualspace_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.42006/12/0514:10:21reddawg -WorkignDistro - -Revision1.32006/12/0105:12:35reddawg -We'realmostthere...:) - -Revision1.22006/11/0619:10:12reddawg -LotsOfUpdates...Stillhavingissueswithbrk(); - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:38reddawg -Removed - -Revision1.1.1.12005/09/2617:24:49reddawg -nomessage - -Revision1.72004/07/2815:05:43reddawg -Major: -Pagesnowhavestrictsecurityenforcement. -Manynulldereferenceshavebeenresolved. -Whenappsloadedpermissionssetforpagesrwandro - -Revision1.62004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.52004/07/2506:04:00reddawg -Lastofmyfixesforthemorning - -Revision1.42004/07/2022:29:55reddawg -assert:remadeassert - -Revision1.32004/07/1901:58:12reddawg -vmmCopyVirtualSpace:cleaneduponefullpagememoryleakwewerestillusingoldsysIDoverpid - -Revision1.22004/06/1512:35:05reddawg -CleanedUp - -Revision1.1.1.12004/04/1512:06:51reddawg -UbixOSv1.0 - -Revision1.142004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +/*MapKernelCodeRegionEntries0&1*/ +newPageDirectory[0]=parentPageDirectory[0]; +//XXX:WeDontNeedThis-newPageDirectory[1]=parentPageDirectory[1]; + +if((newPageTable=(uint32_t*)vmm_getFreeKernelPage(pid,1))==0x0) +kpanic("Error:newPageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + +parentPageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*1)); + +for(x=0;x<PT_ENTRIES;x++){ +if(((parentPageTable[x])&PAGE_PRESENT)==PAGE_PRESENT){ + +/*SetPageToCOWInParentAndChildSpace*/ +newPageTable[x]=(((uint32_t)parentPageTable[x]&0xFFFFF000)|(KERNEL_PAGE_DEFAULT|PAGE_COW)); + +/*IncrementTheCOWCounterForThisPage*/ +if(((uint32_t)parentPageTable[x]&PAGE_COW)==PAGE_COW){ +adjustCowCounter(((uint32_t)parentPageTable[x]&0xFFFFF000),1); +} +else{ +/*AddTwoIfThisIsTheFirstTimeSettingToCOW*/ +adjustCowCounter(((uint32_t)parentPageTable[x]&0xFFFFF000),2); +parentPageTable[x]|=PAGE_COW;//newPageTable[i]; +} + +} +else +newPageTable[x]=parentPageTable[x]; +} + +newPageDirectory[1]=(vmm_getPhysicalAddr((uint32_t)newPageTable)|KERNEL_PAGE_DEFAULT); + +vmm_unmapPage((uint32_t)newPageTable,1); + +newPageTable=0x0; + +/*MapTheKernelMemoryRegionEntry770Address0xC0800000*/ +for(x=PD_INDEX(VMM_KERN_START);x<=PD_INDEX(VMM_KERN_END);x++) +newPageDirectory[x]=parentPageDirectory[x]; + +/*MapTheKernelStackRegion*/ +for(x=PD_INDEX(VMM_KERN_STACK_START);x<=PD_INDEX(VMM_KERN_STACK_END);x++){ +if((parentPageDirectory[x]&PAGE_PRESENT)==PAGE_PRESENT){ +/*SetParentToPropperPageTable*/ +parentPageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*x)); + +/*AllocateANewPageTable*/ +if((newPageTable=(uint32_t*)vmm_getFreeKernelPage(pid,1))==0x0) +kpanic("Error:newPageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + +bzero(newPageTable,PAGE_SIZE); + +for(i=0;i<PT_ENTRIES;i++){ +if((parentPageTable[i]&PAGE_PRESENT)==PAGE_PRESENT){ + +/*AllocANewPageForThisStackPage*/ +if((newStackPage=(uint32_t*)vmm_getFreeKernelPage(pid,1))==0x0) +kpanic("Error:newStackPage==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + +/*SetPointerToParentsStackPage*/ +parentStackPage=(uint32_t*)(((PAGE_SIZE*PD_ENTRIES)*x)+(PAGE_SIZE*i)); + +/*CopyTheStackByteForByte(IShouldFindAFasterWay)*/ +memcpy(newStackPage,parentStackPage,PAGE_SIZE); + +/*InsertNewStackIntoPageTable*/ +newPageTable[i]=(vmm_getPhysicalAddr((uint32_t)newStackPage)|PAGE_DEFAULT|PAGE_STACK); + +/*UnmapFromKernelSpace*/ +vmm_unmapPage((uint32_t)newStackPage,1); +} +} +/*PutNewPageTableIntoNewPageDirectory*/ +newPageDirectory[x]=(vmm_getPhysicalAddr((uint32_t)newPageTable)|PAGE_DEFAULT); +/*UnmapPageFromKernelSpaceButKeepItMarkedAsNotAvail*/ +vmm_unmapPage((uint32_t)newPageTable,1); +} +} + +/* +*NowForTheFunStuffForPageTables2-767WeMustMapTheseAndSet +*ThePermissionsOnEveryMappedPagesToCOWThisWillConserveMemory +*BecauseTheTwoVMSpacesWillBeSharingPagesUnlessanEXECVEHappens +* +*Westartatthe4MBboundaryasthefirst4MBisspecial +*/ + +for(x=PD_INDEX(VMM_USER_START);x<=PD_INDEX(VMM_USER_END);x++){ + +/*IfPageTableExistsMapIt*/ +if((parentPageDirectory[x]&PAGE_PRESENT)==PAGE_PRESENT){ + +/*SetParentToPropperPageTable*/ +parentPageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*x)); + +/*AllocateANewPageTable*/ +if((newPageTable=(uint32_t*)vmm_getFreeKernelPage(pid,1))==0x0) +kpanic("Error:newPageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + +bzero(newPageTable,PAGE_SIZE); + +/*SetParentAndNewPagesToCOW*/ +for(i=0;i<PD_ENTRIES;i++){ + +/*IfPageIsMapped*/ +if((parentPageTable[i]&PAGE_PRESENT)==PAGE_PRESENT){ + +/*CheckToSeeIfItsAStackPage*/ +if(((uint32_t)parentPageTable[i]&PAGE_STACK)==PAGE_STACK){ + +/*AllocANewPageForThisStackPage*/ +if((newStackPage=(uint32_t*)vmm_getFreeKernelPage(pid,1))==0x0) +kpanic("Error:newStackPage==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + +/*SetPointerToParentsStackPage*/ +parentStackPage=(uint32_t*)(((PAGE_SIZE*PD_ENTRIES)*x)+(PAGE_SIZE*i)); + +/*CopyTheStackByteForByte(IShouldFindAFasterWay)*/ +memcpy(newStackPage,parentStackPage,PAGE_SIZE); + +/*InsertNewStackIntoPageTable*/ +newPageTable[i]=(vmm_getPhysicalAddr((uint32_t)newStackPage)|PAGE_DEFAULT|PAGE_STACK); + +/*UnmapFromKernelSpace*/ +vmm_unmapPage((uint32_t)newStackPage,1); + +} +else{ + +/*SetPageToCOWInParentAndChildSpace*/ +newPageTable[i]=(((uint32_t)parentPageTable[i]&0xFFFFF000)|(PAGE_DEFAULT|PAGE_COW)); + +/*IncrementTheCOWCounterForThisPage*/ +if(((uint32_t)parentPageTable[i]&PAGE_COW)==PAGE_COW){ +adjustCowCounter(((uint32_t)parentPageTable[i]&0xFFFFF000),1); +} +else{ +/*AddTwoIfThisIsTheFirstTimeSettingToCOW*/ +adjustCowCounter(((uint32_t)parentPageTable[i]&0xFFFFF000),2); +parentPageTable[i]|=PAGE_COW;//newPageTable[i]; +} +} +} +else{ +newPageTable[i]=(uint32_t)0x0; +} +} + +/*PutNewPageTableIntoNewPageDirectory*/ +newPageDirectory[x]=(vmm_getPhysicalAddr((uint32_t)newPageTable)|PAGE_DEFAULT); +/*UnmapPageFromKernelSpaceButKeepItMarkedAsNotAvail*/ +vmm_unmapPage((uint32_t)newPageTable,1); +} +} + +/* +*AllocateANewPageForTheTheFirstPageTableWhereWeWillMapThe +*LowerRegionFirst4MB +*/ + +/* +* +*MapPageDirectoryIntoVMSpace +*FirstPageAfterPageTables +*Thismustbemappedintothepagedirectorybeforewemapall1024pagedirectoriesintothememoryspace +*/ +newPageTable=(uint32_t*)vmm_getFreePage(pid); + +newPageDirectory[PD_INDEX(PD_BASE_ADDR)]=(uint32_t)(vmm_getPhysicalAddr((uint32_t)newPageTable)|PAGE_DEFAULT); + +newPageTable[0]=(uint32_t)((uint32_t)(newPageDirectoryAddress)|PAGE_DEFAULT); + +vmm_unmapPage((uint32_t)newPageTable,1); + +/* +* +*MapPageTablesIntoVMSpace +*TheFirstPageTable(4MB)MapsToAllPageDirectories +* +*/ + +newPageTable=(uint32_t*)vmm_getFreePage(pid); + +newPageDirectory[PD_INDEX(PT_BASE_ADDR)]=(uint32_t)(vmm_getPhysicalAddr((uint32_t)newPageTable)|PAGE_DEFAULT); + +/*FlushThePageFromGarbageInMemory*/ +bzero(newPageTable,PAGE_SIZE); + +for(x=0;x<PD_ENTRIES;x++) +newPageTable[x]=newPageDirectory[x]; + +/*UnmapPageFromVirtualSpace*/ +vmm_unmapPage((uint32_t)newPageTable,1); + +/*NowWeAreDoneWithThePageDirectorySoLetsUnmapThatToo*/ +vmm_unmapPage((uint32_t)newPageDirectory,1); + +spinUnlock(&cvsSpinLock); + +/*ReturnPhysicalAddressOfPageDirectory*/ +return(newPageDirectoryAddress); +} - + diff --git a/doc/xml/createvirtualspace_8c.xml b/doc/xml/createvirtualspace_8c.xml index b6be000..b2acce5 100644 --- a/doc/xml/createvirtualspace_8c.xml +++ b/doc/xml/createvirtualspace_8c.xml @@ -1,72 +1,204 @@ - - - + + + createvirtualspace.c vmm/vmm.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - - - + + + + - - - - + + + + - - - - + + + + - + + + - - - - - - + + + + - - - - + + + + - + void * - void* vmmCreateVirtualSpace + void* vmm_createVirtualSpace (pid_t pid) - vmmCreateVirtualSpace + vmm_createVirtualSpace - pid_t + pid_t pid @@ -75,15 +207,22 @@ - - PAGE_DEFAULT - pageEntries - parentPageDirAddr - tablesBaseAddress - vmm_getPhysicalAddr - vmmGetFreePage - vmmUnmapPage - execFile + + adjustCowCounter + bzero + KERNEL_PAGE_DEFAULT + PAGE_COW + PAGE_PRESENT + PAGE_SIZE + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + PT_BASE_ADDR + PT_ENTRIES + vmm_getFreePage + vmm_getPhysicalAddr + VMM_KERN_START + vmm_unmapPage @@ -91,158 +230,199 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Log: createvirtualspace_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:38reddawg -Removed +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> + +/************************************************************************ -Revision1.1.1.12005/09/2617:24:50reddawg -nomessage - -Revision1.22004/07/2815:05:43reddawg -Major: -Pagesnowhavestrictsecurityenforcement. -Manynulldereferenceshavebeenresolved. -Whenappsloadedpermissionssetforpagesrwandro - -Revision1.1.1.12004/04/1512:06:51reddawg -UbixOSv1.0 +Function:void*vmm_createVirtualSpace(pid_t); +Description:CreatesAVirtualSpaceForANewTask +Notes: + +07/30/02-ThisIsGoingToCreateANewVMSpaceHoweverItsGoingTo +ShareTheSameTop1GBSpaceWithTheKernelsVMAndLower +1MBOfVMSpaceWithTheKernel + +07/30/02-NoteThisIsGoingToGetTheTop1GigAndLower1MBRegion +FromTheCurrentlyLoadedPageDirectoryThisIsSafeBecause +AllVMSpacesWillShareTheseRegions -Revision1.82004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - - +07/30/02-NoteIRealizedAMistakeTheFirstPageTableWillNeedToBe +ACopyButThePageTablesForTheTop1GBWillNotReasonFor +ThisIsThatWeJustShareTheFirst1MBInTheFirstPageTable +SoWeWillJustSharePhysicalPages. -$Id: createvirtualspace_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> +08/02/02-AddedPassingOfpid_tpidForBetterTrackingOfWhoHasWhich +SetOfPages + +************************************************************************/ +void*vmm_createVirtualSpace(pid_tpid){ - -/************************************************************************ - -Function:void*vmmCreateVirtualSpace(pid_t); -Description:CreatesAVirtualSpaceForANewTask -Notes: - -07/30/02-ThisIsGoingToCreateANewVMSpaceHoweverItsGoingTo -ShareTheSameTop1GBSpaceWithTheKernelsVMAndLower -1MBOfVMSpaceWithTheKernel - -07/30/02-NoteThisIsGoingToGetTheTop1GigAndLower1MBRegion -FromTheCurrentlyLoadedPageDirectoryThisIsSafeBecause -AllVMSpacesWillShareTheseRegions - -07/30/02-NoteIRealizedAMistakeTheFirstPageTableWillNeedToBe -ACopyButThePageTablesForTheTop1GBWillNotReasonFor -ThisIsThatWeJustShareTheFirst1MBInTheFirstPageTable -SoWeWillJustSharePhysicalPages. - -08/02/02-AddedPassingOfpid_tpidForBetterTrackingOfWhoHasWhich -SetOfPages - -************************************************************************/ -void* -vmmCreateVirtualSpace(pid_tpid) -{ -void*newPageDirectoryAddress=0x0; -uInt32*parentPageDirectory=0x0,*newPageDirectory=0x0; -uInt32*parentPageTable=0x0,*newPageTable=0x0; -intx=0; +void*newPageDirectoryAddress=0x0; +uint32_t*parentPageDirectory=0x0,*newPageDirectory=0x0; +uint32_t*parentPageTable=0x0,*newPageTable=0x0; + +intx=0; + +/*SetAddressOfParentPageDirectory*/ +parentPageDirectory=(uint32_t*)PD_BASE_ADDR;/*PD_BASE_ADDRistheaddressablePageDirectory*/ + +/*AllocateANewPageForTheNewPageDirectory*/ +newPageDirectory=(uint32_t*)vmm_getFreePage(pid); + +/*SetnewPageDirectoryAddressToTheNewlyCreatedPageDirectoriesPage*/ +newPageDirectoryAddress=(void*)vmm_getPhysicalAddr((uint32_t)newPageDirectory); + +/*FirstSetUpAFlushedPageDirectory*/ +bzero(newPageDirectory,PAGE_SIZE); + +/*MapTheLower8MBKernelCodeSpace*/ +/*MapFirst4MB1:1*/ +newPageDirectory[0]=parentPageDirectory[0]; +//XXX:WeDontNeedThis-newPageDirectory[1]=parentPageDirectory[1]; + +/*MapSecond4MB*/ +newPageTable=(uint32_t*)vmm_getFreePage(pid); +bzero(newPageTable,PAGE_SIZE); + +parentPageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*1)); + +for(x=0;x<PT_ENTRIES;x++){ +if(((parentPageTable[x])&PAGE_PRESENT)==PAGE_PRESENT){ -/*SetAddressOfParentPageDirectory*/ -parentPageDirectory=(uInt32*)parentPageDirAddr; -/*AllocateANewPageForTheNewPageDirectory*/ -newPageDirectory=(uInt32*)vmmGetFreePage(pid); -/*SetnewPageDirectoryAddressToTheNewlyCreatedPageDirectoriesPage*/ -newPageDirectoryAddress=(void*)vmm_getPhysicalAddr((uInt32)newPageDirectory); -/*FirstSetUpAFlushedPageDirectory*/ -for(x=0;x<pageEntries;x++){ -(uInt32)newPageDirectory[x]=(uInt32)0x0; -} -/*MapTheTop1GBRegionOfTheVMSpace*/ -for(x=768;x<pageEntries;x++){ -newPageDirectory[x]=parentPageDirectory[x]; -} -/* -*AllocateANewPageForTheTheFirstPageTableWhereWeWillMapThe -*LowerRegion -*/ -newPageTable=(uInt32*)vmmGetFreePage(pid); -/*FlushThePageFromGarbageInMemory*/ -for(x=0;x<pageEntries;x++){ -(uInt32)newPageTable[x]=(uInt32)0x0; -} -/*MapThisIntoThePageDirectory*/ -newPageDirectory[0]=(vmm_getPhysicalAddr((uInt32)newPageTable)|PAGE_DEFAULT); -/*SetAddressOfParentsPageTable*/ -parentPageTable=(uInt32*)tablesBaseAddress; -/*MapTheFirst1MBWorthOfPages*/ -for(x=0;x<(pageEntries/4);x++){ -newPageTable[x]=parentPageTable[x]; -} -/*SetVirtualMappingForPageDirectory*/ -newPageTable[256]=(vmm_getPhysicalAddr((uInt32)newPageDirectory)|PAGE_DEFAULT); - -/* -*NowTheFunStuffBuildTheInitialVirtualPageSpaceSoWeDon'tHave -*ToWorryAboutMappingThemInLaterHowEverI'mConcernedThisMay -*BecomeASecurityIssue -*/ -/*FirstLetsUnmapThePreviouslyAllocatedPageTable*/ -vmmUnmapPage((uInt32)newPageTable,1); -/*AllocateANewPageTable*/ -newPageTable=(uInt32*)vmmGetFreePage(pid); -/*FirstSetOurPageDirectoryToContainThis*/ -newPageDirectory[767]=vmm_getPhysicalAddr((uInt32)newPageTable)|PAGE_DEFAULT; -/*NowLetsBuildThePageTable*/ -for(x=0;x<pageEntries;x++){ -newPageTable[x]=newPageDirectory[x]; -} -/*NowWeAreDoneSoLetsUnmapThisPage*/ -vmmUnmapPage((uInt32)newPageTable,1); -/*NowWeAreDoneWithThePageDirectorySoLetsUnmapThatToo*/ -vmmUnmapPage((uInt32)newPageDirectory,1); -/*ReturnPhysicalAddressOfPageDirectory*/ -return(newPageDirectoryAddress); -} - -/*** -END -***/ - +/*SetPageToCOWInParentAndChildSpace*/ +newPageTable[x]=(((uint32_t)parentPageTable[x]&0xFFFFF000)|(KERNEL_PAGE_DEFAULT|PAGE_COW)); + +/*IncrementTheCOWCounterForThisPage*/ +if(((uint32_t)parentPageTable[x]&PAGE_COW)==PAGE_COW){ +adjustCowCounter(((uint32_t)parentPageTable[x]&0xFFFFF000),1); +} +else{ +/*AddTwoIfThisIsTheFirstTimeSettingToCOW*/ +adjustCowCounter(((uint32_t)parentPageTable[x]&0xFFFFF000),2); +parentPageTable[x]|=PAGE_COW;//newPageTable[i]; +} + +} +else +newPageTable[x]=parentPageTable[x]; + +} + +newPageDirectory[1]=(vmm_getPhysicalAddr((uint32_t)newPageTable)|KERNEL_PAGE_DEFAULT); + +vmm_unmapPage((uint32_t)newPageTable,1); +/*DoneMappingSecond4MB*/ + +/*MapTheTopKernel(APPROX1GB)RegionOfTheVMSpace*/ +for(x=PD_INDEX(VMM_KERN_START);x<PD_ENTRIES;x++){ +newPageDirectory[x]=parentPageDirectory[x]; +} + +/*AllocateStackPages*/ +newPageTable=(uint32_t*)vmm_getFreePage(pid); +bzero(newPageTable,PAGE_SIZE); + +newPageDirectory[1023]=(vmm_getPhysicalAddr((uint32_t)newPageTable)|KERNEL_PAGE_DEFAULT); + +parentPageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*1023)); +newPageTable[1023]=parentPageTable[1023]|PAGE_COW; +adjustCowCounter(((uint32_t)parentPageTable[1023]&0xFFFFF000),2); +newPageTable[1022]=parentPageTable[1022]|PAGE_COW; +adjustCowCounter(((uint32_t)parentPageTable[1022]&0xFFFFF000),2); + +vmm_unmapPage((uint32_t)newPageTable,1); + +/* +*AllocateANewPageForTheTheFirstPageTableWhereWeWillMapThe +*LowerRegion +*/ + +//newPageTable=(uint32_t*)vmm_getFreePage(pid); +/*FlushThePageFromGarbageInMemory*/ +//bzero(newPageTable,PAGE_SIZE); +/*MapThisIntoThePageDirectory*/ +//newPageDirectory[0]=(vmm_getPhysicalAddr((uint32_t)newPageTable)|KERNEL_PAGE_DEFAULT);//MrOlsen2018-01-14PAGE_DEFAULT +/*SetAddressOfParentsPageTable*/ +//parentPageTable=(uint32_t*)PT_BASE_ADDR; +/*MapTheFirst1MBWorthOfPages*/ +/* +for(x=0;x<(PD_ENTRIES/4);x++){ +newPageTable[x]=parentPageTable[x]; +} +*/ + +/*UnmapPageFromVirtualSpace*/ +//vmm_unmapPage((uint32_t)newPageTable,1); +/* +* +*MapPageDirectoryIntoVMSpace +*FirstPageAfterPageTables +*Thismustbemappedintothepagedirectorybeforewemapall1024pagedirectoriesintothememoryspace +*/ +newPageTable=(uint32_t*)vmm_getFreePage(pid); + +newPageDirectory[PD_INDEX(PD_BASE_ADDR)]=(uint32_t)(vmm_getPhysicalAddr((uint32_t)newPageTable)|KERNEL_PAGE_DEFAULT);//MrOlsen2018-01-14PAGE_DEFAULT + +newPageTable[0]=(uint32_t)((uint32_t)(newPageDirectoryAddress)|KERNEL_PAGE_DEFAULT);//MrOlsen2018-01-14PAGE_DEFAULT + +vmm_unmapPage((uint32_t)newPageTable,1); + +/* +* +*MapPageTablesIntoVMSpace +*TheFirstPageTable(4MB)MapsToAllPageDirectories +* +*/ + +newPageTable=(uint32_t*)vmm_getFreePage(pid); + +newPageDirectory[PD_INDEX(PT_BASE_ADDR)]=(uint32_t)(vmm_getPhysicalAddr((uint32_t)newPageTable)|KERNEL_PAGE_DEFAULT);//MrOlsen2018-01-14PAGE_DEFAULT + +/*FlushThePageFromGarbageInMemory*/ +bzero(newPageTable,PAGE_SIZE); + +for(x=0;x<PD_ENTRIES;x++){ +newPageTable[x]=newPageDirectory[x]; +} + +/*UnmapPageFromVirtualSpace*/ +vmm_unmapPage((uint32_t)newPageTable,1); + +/*NowWeAreDoneWithThePageDirectorySoLetsUnmapThatToo*/ +vmm_unmapPage((uint32_t)newPageDirectory,1); + +/*ReturnPhysicalAddressOfPageDirectory*/ +return(newPageDirectoryAddress); +} - + diff --git a/doc/xml/debug_8h.xml b/doc/xml/debug_8h.xml index e1af33d..f7e306d 100644 --- a/doc/xml/debug_8h.xml +++ b/doc/xml/debug_8h.xml @@ -1,905 +1,2008 @@ - - - + + + debug.h - src/sys/include/net/err.h - src/sys/include/net/mem.h - src/sys/include/net/memp.h - src/sys/include/net/pbuf.h - src/sys/net/api/api_lib.c - src/sys/net/api/api_msg.c - src/sys/net/api/sockets.c - src/sys/net/api/tcpip.c - src/sys/net/net/bot.c - src/sys/net/net/shell.c - src/sys/net/net/sys_arch.c - src/sys/net/netif/arp.c - src/sys/net/netif/ethernetif.c - src/sys/net/netif/loopif.c + net/arch.h + net/opt.h + C:/Dev/git/UbixOS/sys/include/net/opt.h + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/net/netif/arp.c + C:/Dev/git/UbixOS/sys/net/netif/loopif.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - - - + + + - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + - - - + + + - - - - + + + + + + + + - - - - - - - + - - - - + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + - - + + + + + + - + - + - + - + - - - + - - - - + + + + - + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - + - - - - + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Debug level (LWIP_DBG_MIN_LEVEL)
+ + LWIP_DBG_LEVEL_ALL + 0x00 + + + +Debug level: ALL messages + + + + + + + LWIP_DBG_LEVEL_SERIOUS + 0x02 + + + +Debug level: Serious. memory allocation failures, ... + + + + + + + LWIP_DBG_LEVEL_SEVERE + 0x03 + + + +Debug level: Severe + + + + + + + LWIP_DBG_LEVEL_WARNING + 0x01 + + + +Debug level: Warnings. bad checksums, dropped packets, ... + + + + + +
+ +
Enable/disable debug messages completely (LWIP_DBG_TYPES_ON)
+ + LWIP_DBG_OFF + 0x00U + + + +flag for LWIP_DEBUGF to disable that debug message + + + + + + + LWIP_DBG_ON + 0x80U + + + +flag for LWIP_DEBUGF to enable that debug message + + + + + +
+ +
Debug message types (LWIP_DBG_TYPES_ON)
+ + LWIP_DBG_FRESH + 0x10U + + + +flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet + + + + + + + LWIP_DBG_HALT + 0x08U + + + +flag for LWIP_DEBUGF to halt after printing this debug message + + + + + + + LWIP_DBG_STATE + 0x20U + + + +flag for LWIP_DEBUGF indicating a state debug message (to follow module states) + + + + + + + LWIP_DBG_TRACE + 0x40U + + + +flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) + + + + + +
- - API_LIB_DEBUG - 0 + + LWIP_ASSERT + message + assertion + do { if (!(assertion)) { \ + LWIP_PLATFORM_ASSERT(message); }} while(0) - - netconn_recv - netconn_send - netconn_write + - - API_MSG_DEBUG - 0 + + LWIP_DBG_LEVEL_OFF + LWIP_DBG_LEVEL_ALL - - do_accept - do_listen + - - ARP_DEBUG - 0 + + LWIP_DBG_MASK_LEVEL + 0x03 - - arp_ip_input - arp_tmr + - - ASSERT - x - y - - - - - - - - - - DEBUGF + + LWIP_DEBUGF debug - x + message +Enable debug message printing, but only if debug message type is enabled AND is of correct type AND is at least LWIP_DBG_LEVEL. - - arp_ip_input - arp_tmr - do_accept - do_listen - lwip_close - lwip_send - lwip_socket - lwip_write - netconn_recv - netconn_send - netconn_write + - - DELIF_DEBUG - 0 + + LWIP_ERROR + message + expression + handler + do { if (!(expression)) { \ + LWIP_PLATFORM_ERROR(message); handler;}} while(0) - + - - DEMO_DEBUG - 0 + + LWIP_PLATFORM_ERROR + message + LWIP_PLATFORM_ASSERT(message) - - - - DHCP_DEBUG - 0 - - - - - - - - - - DROPIF_DEBUG - 0 - - - - - - - - - - ICMP_DEBUG - 0 - - - - - - - - - - INET_DEBUG - 0 - - - - - - - - - - IP_DEBUG - 0 - - - - - - - - - - IP_REASS_DEBUG - 0 - - - - - - - - - - MEM_DEBUG - 0 - - - - - - - - - - MEMP_DEBUG - 0 - - - - - - - - - - NETIF_DEBUG - 0 - - - - - - - - - - PBUF_DEBUG - 0 - - - - - - - - - - SOCKETS_DEBUG - 0 - - - - - - - - lwip_close - lwip_send - lwip_socket - lwip_write - - - SYS_DEBUG - 0 - - - - - - - - - - TAPIF_DEBUG - 0 - - - - - - - - - - TCP_CWND_DEBUG - 0 - - - - - - - - - - TCP_DEBUG - 0 - - - - - - - - - - TCP_FR_DEBUG - 0 - - - - - - - - - - TCP_INPUT_DEBUG - 0 - - - - - - - - - - TCP_OUTPUT_DEBUG - 0 - - - - - - - - - - TCP_QLEN_DEBUG - 0 - - - - - - - - - - TCP_REXMIT_DEBUG - 0 - - - - - - - - - - TCP_RST_DEBUG - 0 - - - - - - - - - - TCP_RTO_DEBUG - 0 - - - - - - - - - - TCP_WND_DEBUG - 0 - - - - - - - - - - TCPDUMP_DEBUG - 0 - - - - - - - - - - TCPIP_DEBUG - 0 - - - - - - - - - - TUNIF_DEBUG - 0 - - - - - - - - - - UDP_DEBUG - 0 - - - - - - - - - - UNIXIF_DEBUG - 0 - - - - - - - + +Debug messages infrastructure -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: debug_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_DEBUG_H__ -#define__LWIP_DEBUG_H__ - -#ifdefLWIP_DEBUG - -#defineASSERT(x,y)if(!(y)){printf("Assertion\"%s\"failedatline%din%s\n",\ -x,__LINE__,__FILE__);fflush(NULL);abort();} - -/*Thesedefinescontroltheamountofdebuggingoutput:*/ -#defineMEM_TRACKING - -#defineDEMO_DEBUG1 - -#defineARP_DEBUG0 - -#defineNETIF_DEBUG1 -#definePBUF_DEBUG0 -#defineDELIF_DEBUG0 -#defineDROPIF_DEBUG0 -#defineTUNIF_DEBUG0 -#defineUNIXIF_DEBUG0 -#defineTAPIF_DEBUG0 - -#defineAPI_LIB_DEBUG0 -#defineAPI_MSG_DEBUG0 -#defineSOCKETS_DEBUG1 -#defineICMP_DEBUG0 -#defineINET_DEBUG0 -#defineIP_DEBUG0 -#defineIP_REASS_DEBUG1 -#defineMEM_DEBUG0 -#defineMEMP_DEBUG0 -#defineSYS_DEBUG0 -#defineTCP_DEBUG0 -#defineTCP_INPUT_DEBUG0 -#defineTCP_FR_DEBUG0 -#defineTCP_RTO_DEBUG0 -#defineTCP_REXMIT_DEBUG0 -#defineTCP_CWND_DEBUG0 -#defineTCP_WND_DEBUG0 -#defineTCP_OUTPUT_DEBUG0 -#defineTCP_RST_DEBUG0 -#defineTCP_QLEN_DEBUG0 -#defineUDP_DEBUG0 -#defineTCPIP_DEBUG0 -#defineTCPDUMP_DEBUG0 -#defineDHCP_DEBUG1 - -#include<stdio.h> -#defineDEBUGF(debug,x)do{if(debug){printfx;}}while(0) - + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_DEBUG_H +#defineLWIP_HDR_DEBUG_H + +#include<net/arch.h> +#include<net/opt.h> + +#defineLWIP_DBG_LEVEL_ALL0x00 + +#defineLWIP_DBG_LEVEL_WARNING0x01 + +#defineLWIP_DBG_LEVEL_SERIOUS0x02 + +#defineLWIP_DBG_LEVEL_SEVERE0x03 + +#defineLWIP_DBG_MASK_LEVEL0x03 +/*compatibilitydefineonly*/ +#defineLWIP_DBG_LEVEL_OFFLWIP_DBG_LEVEL_ALL + +#defineLWIP_DBG_ON0x80U + +#defineLWIP_DBG_OFF0x00U + +#defineLWIP_DBG_TRACE0x40U + +#defineLWIP_DBG_STATE0x20U -#else/*LWIP_DEBUG*/ +#defineLWIP_DBG_FRESH0x10U -/*DEBUGisnotdefined,sowedefinenullmacrosforASSERTandDEBUGF*/ +#defineLWIP_DBG_HALT0x08U -#defineASSERT(x,y) -#defineDEBUGF(debug,x) - -/*Andwedefinethosetobezero:*/ - -#defineDEMO_DEBUG0 -#defineARP_DEBUG0 -#defineNETIF_DEBUG0 -#definePBUF_DEBUG0 -#defineDELIF_DEBUG0 -#defineDROPIF_DEBUG0 -#defineTUNIF_DEBUG0 -#defineUNIXIF_DEBUG0 -#defineTAPIF_DEBUG0 -#defineAPI_LIB_DEBUG0 -#defineAPI_MSG_DEBUG0 -#defineSOCKETS_DEBUG0 -#defineICMP_DEBUG0 -#defineINET_DEBUG0 -#defineIP_DEBUG0 -#defineIP_REASS_DEBUG0 -#defineMEM_DEBUG0 -#defineMEMP_DEBUG0 -#defineSYS_DEBUG0 -#defineTCP_DEBUG0 -#defineTCP_INPUT_DEBUG0 -#defineTCP_FR_DEBUG0 -#defineTCP_RTO_DEBUG0 -#defineTCP_REXMIT_DEBUG0 -#defineTCP_CWND_DEBUG0 -#defineTCP_WND_DEBUG0 -#defineTCP_OUTPUT_DEBUG0 -#defineTCP_RST_DEBUG0 -#defineTCP_QLEN_DEBUG0 -#defineUDP_DEBUG0 -#defineTCPIP_DEBUG0 -#defineTCPDUMP_DEBUG0 -#defineDHCP_DEBUG0 - -#endif/*LWIP_DEBUG*/ - - -#endif/*__LWIP_DEBUG_H__*/ - - - - +#ifdef__DOXYGEN__ +#defineLWIP_NOASSERT +#undefLWIP_NOASSERT +#endif + +#ifndefLWIP_NOASSERT +#defineLWIP_ASSERT(message,assertion)do{if(!(assertion)){\ +LWIP_PLATFORM_ASSERT(message);}}while(0) +#ifndefLWIP_PLATFORM_ASSERT +#error"IfyouwanttouseLWIP_ASSERT,LWIP_PLATFORM_ASSERT(message)needstobedefinedinyourarch/cc.h" +#endif +#else/*LWIP_NOASSERT*/ +#defineLWIP_ASSERT(message,assertion) +#endif/*LWIP_NOASSERT*/ + +#ifndefLWIP_ERROR +#ifndefLWIP_NOASSERT +#defineLWIP_PLATFORM_ERROR(message)LWIP_PLATFORM_ASSERT(message) +#elifdefinedLWIP_DEBUG +#defineLWIP_PLATFORM_ERROR(message)LWIP_PLATFORM_DIAG((message)) +#else +#defineLWIP_PLATFORM_ERROR(message) +#endif + +/*if"expression"isn'ttrue,thenprint"message"andexecute"handler"expression*/ +#defineLWIP_ERROR(message,expression,handler)do{if(!(expression)){\ +LWIP_PLATFORM_ERROR(message);handler;}}while(0) +#endif/*LWIP_ERROR*/ - +#ifdef__DOXYGEN__ +#defineLWIP_DEBUG +#undefLWIP_DEBUG +#endif + +#ifdefLWIP_DEBUG +#ifndefLWIP_PLATFORM_DIAG +#error"IfyouwanttouseLWIP_DEBUG,LWIP_PLATFORM_DIAG(message)needstobedefinedinyourarch/cc.h" +#endif +#defineLWIP_DEBUGF(debug,message)do{\ +if(\ +((debug)&LWIP_DBG_ON)&&\ +((debug)&LWIP_DBG_TYPES_ON)&&\ +((s16_t)((debug)&LWIP_DBG_MASK_LEVEL)>=LWIP_DBG_MIN_LEVEL)){\ +LWIP_PLATFORM_DIAG(message);\ +if((debug)&LWIP_DBG_HALT){\ +while(1);\ +}\ +}\ +}while(0) + +#else/*LWIP_DEBUG*/ +#defineLWIP_DEBUGF(debug,message) +#endif/*LWIP_DEBUG*/ + +#endif/*LWIP_HDR_DEBUG_H*/ - +
diff --git a/doc/xml/def_8h.xml b/doc/xml/def_8h.xml index 6ff35d6..a87707e 100644 --- a/doc/xml/def_8h.xml +++ b/doc/xml/def_8h.xml @@ -1,170 +1,916 @@ - - - + + + def.h - arch/lib.h - src/sys/include/net/ipv4/ip.h - src/sys/net/net/bot.c - src/sys/net/net/shell.c - src/sys/net/netif/ethernetif.c + net/arch.h + net/opt.h + C:/Dev/git/UbixOS/sys/include/net/inet.h + C:/Dev/git/UbixOS/sys/include/net/ip.h + C:/Dev/git/UbixOS/sys/include/net/ip4_addr.h + C:/Dev/git/UbixOS/sys/include/net/ip6_addr.h + C:/Dev/git/UbixOS/sys/include/net/ip_addr.h + C:/Dev/git/UbixOS/sys/include/net/netif.h + C:/Dev/git/UbixOS/sys/net/api/err.c + C:/Dev/git/UbixOS/sys/net/core/def.c + C:/Dev/git/UbixOS/sys/net/core/inet_chksum.c + C:/Dev/git/UbixOS/sys/net/core/mem.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/core/timeouts.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - + + + + - + - + - - - - - - - - - + - - - + + + - - - + + + - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - + - - - + - - - + + + - - - - + + + + + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + htonl + x + lwip_htonl(x) + + + + + + + + + + htons + x + lwip_htons(x) + + + + + + + + + + LWIP_ARRAYSIZE + x + (sizeof(x)/sizeof((x)[0])) + + + + + + + + + + lwip_htonl + x + (x) + + + + + + + + + + lwip_htons + x + (x) + + + + + + + + + + LWIP_MAKEU32 + a + b + c + d + (((u32_t)((a) & 0xff) << 24) | \ + ((u32_t)((b) & 0xff) << 16) | \ + ((u32_t)((c) & 0xff) << 8) | \ + (u32_t)((d) & 0xff)) + + + +Create u32_t value from bytes + + + + + + + LWIP_MAX + x + y + (((x) > (y)) ? (x) : (y)) + + + + + + + + + + LWIP_MIN + x + y + (((x) < (y)) ? (x) : (y)) + + + + + + + + + + lwip_ntohl + x + (x) + + + + + + + + + + lwip_ntohs + x + (x) + + + + + + + + + + ntohl + x + lwip_ntohl(x) + + + + + + + + + + ntohs + x + lwip_ntohs(x) + + + + + + + + + NULL ((void *)0) @@ -173,185 +919,331 @@ - - __assert - accept_function - alloc_socket - arp_arp_input - arp_lookup - arp_query - arp_timer - bot_init - bot_thread - current_thread - devfs_init - device_add - device_remove - do_accept - do_bind - do_close - do_connect - do_connected - do_delconn - do_listen - do_recv - do_send - do_write - err_tcp - ethernetif_init - ethernetif_input - ethernetif_output - fclose - fopen - get_socket - inet_aton - kmain - kmod_add - kpanic - kprint - loopif_output - low_level_input - low_level_output - lwip_accept - lwip_bind - lwip_close - lwip_connect - lwip_listen - lwip_recv - lwip_recvfrom - lwip_send - lwip_sendto - lwip_socket - lwip_write - netbuf_alloc - netbuf_copy_partial - netbuf_data - netbuf_delete - netbuf_free - netbuf_new - netbuf_next - netbuf_ref - netconn_accept - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_new - netconn_recv - netconn_send - netconn_write - openFileUbixFS - poll_tcp - readUbixFS - recv_tcp - recv_udp - sent_tcp - shell_init - shell_thread - strstr - strtok_r - strtol - sys_arch_mbox_fetch - sys_mbox_free - sys_sem_new_ - sys_thread_new - sysFclose - sysFopen - sysFread - sysFseek - sysMkDir - tcpdump - tcpdump_init - tcpip_apimsg - tcpip_init - tcpip_input - tcpip_tcp_timer - tcpip_thread - ubixfs_cacheAdd - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_findName - ubixfs_init - ubixfs_loadData - udpecho_init - udpecho_thread - ufs_init - unlink - vfs_findMount - vfs_mount - vfsRegisterFS - writeFileByte - writeUbixFS + - - UMAX - a - b - ((a) > (b) ? (a) : (b)) + + PERF_START + /* null definition */ - + + + + PERF_STOP + x + /* null definition */ + + + + + + + + + + PP_HTONL + x + (x) + + + + + + + + + + PP_HTONS + x + (x) + + + + + + + + + + PP_NTOHL + x + (x) + + + + + + + + + + PP_NTOHS + x + (x) + + + + + + + + + + + + void + void lwip_itoa + (char *result, size_t bufsize, int number) + lwip_itoa + + char * + result + + + size_t + bufsize + + + int + number + + + + +lwIP default implementation for itoa() non-standard function. This can be #defined to itoa() or snprintf(result, bufsize, "%d", number) depending on your platform port. + + + + + + + int + int lwip_stricmp + (const char *str1, const char *str2) + lwip_stricmp + + const char * + str1 + + + const char * + str2 + + + + +lwIP default implementation for stricmp() non-standard function. This can be #defined to stricmp() depending on your platform port. + + + + + + + int + int lwip_strnicmp + (const char *str1, const char *str2, size_t len) + lwip_strnicmp + + const char * + str1 + + + const char * + str2 + + + size_t + len + + + + +lwIP default implementation for strnicmp() non-standard function. This can be #defined to strnicmp() depending on your platform port. + + + + + pbuf::len + + + char * + char* lwip_strnstr + (const char *buffer, const char *token, size_t n) + lwip_strnstr + + const char * + buffer + + + const char * + token + + + size_t + n + + + + +lwIP default implementation for strnstr() non-standard function. This can be #defined to strnstr() depending on your platform port. + + + + + strlen + LWIP_CONST_CAST + buffer + strncmp + NULL +various utility macros -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: def_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_DEF_H__ -#define__LWIP_DEF_H__ - -#defineUMAX(a,b)((a)>(b)?(a):(b)) - -#ifndefNULL -#defineNULL((void*)0) -#endif - -#include"arch/lib.h" - -#endif/*__LWIP_DEF_H__*/ - + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_DEF_H +#defineLWIP_HDR_DEF_H + +/*arch.hmightdefineNULLalready*/ +#include<net/arch.h> +#include<net/opt.h> +#ifLWIP_PERF +#include<net/arch/perf.h> +#else/*LWIP_PERF*/ +#definePERF_START/*nulldefinition*/ +#definePERF_STOP(x)/*nulldefinition*/ +#endif/*LWIP_PERF*/ + +#ifdef__cplusplus +extern"C"{ +#endif + +#defineLWIP_MAX(x,y)(((x)>(y))?(x):(y)) +#defineLWIP_MIN(x,y)(((x)<(y))?(x):(y)) + +/*Getthenumberofentriesinanarray('x'mustNOTbeapointer!)*/ +#defineLWIP_ARRAYSIZE(x)(sizeof(x)/sizeof((x)[0])) + +#defineLWIP_MAKEU32(a,b,c,d)(((u32_t)((a)&0xff)<<24)|\ +((u32_t)((b)&0xff)<<16)|\ +((u32_t)((c)&0xff)<<8)|\ +(u32_t)((d)&0xff)) + +#ifndefNULL +#ifdef__cplusplus +#defineNULL0 +#else +#defineNULL((void*)0) +#endif +#endif + +#ifBYTE_ORDER==BIG_ENDIAN +#definelwip_htons(x)(x) +#definelwip_ntohs(x)(x) +#definelwip_htonl(x)(x) +#definelwip_ntohl(x)(x) +#definePP_HTONS(x)(x) +#definePP_NTOHS(x)(x) +#definePP_HTONL(x)(x) +#definePP_NTOHL(x)(x) +#else/*BYTE_ORDER!=BIG_ENDIAN*/ +#ifndeflwip_htons +u16_tlwip_htons(u16_tx); +#endif +#definelwip_ntohs(x)lwip_htons(x) + +#ifndeflwip_htonl +u32_tlwip_htonl(u32_tx); +#endif +#definelwip_ntohl(x)lwip_htonl(x) + +/*Thesemacrosshouldbecalculatedbythepreprocessorandareused +withcompile-timeconstantsonly(sothatthereisnolittle-endian +overheadatruntime).*/ +#definePP_HTONS(x)((((x)&0x00ffUL)<<8)|(((x)&0xff00UL)>>8)) +#definePP_NTOHS(x)PP_HTONS(x) +#definePP_HTONL(x)((((x)&0x000000ffUL)<<24)|\ +(((x)&0x0000ff00UL)<<8)|\ +(((x)&0x00ff0000UL)>>8)|\ +(((x)&0xff000000UL)>>24)) +#definePP_NTOHL(x)PP_HTONL(x) +#endif/*BYTE_ORDER==BIG_ENDIAN*/ + +/*Provideusualfunctionnamesasmacrosforusers,butthiscanbeturnedoff*/ +#ifndefLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS +#definehtons(x)lwip_htons(x) +#definentohs(x)lwip_ntohs(x) +#definehtonl(x)lwip_htonl(x) +#definentohl(x)lwip_ntohl(x) +#endif + +/*Functionsthatarenotavailableasstandardimplementations. +*Incc.h,youcan#definethesetoimplementationsavailableon +*yourplatformtosavesomecodebytesifyouusethesefunctions +*inyourapplication,too. +*/ + +#ifndeflwip_itoa +/*Thiscanbe#definedtoitoa()orsnprintf(result,bufsize,"%d",number)dependingonyourplatform*/ +voidlwip_itoa(char*result,size_tbufsize,intnumber); +#endif +#ifndeflwip_strnicmp +/*Thiscanbe#definedtostrnicmp()orstrncasecmp()dependingonyourplatform*/ +intlwip_strnicmp(constchar*str1,constchar*str2,size_tlen); +#endif +#ifndeflwip_stricmp +/*Thiscanbe#definedtostricmp()orstrcasecmp()dependingonyourplatform*/ +intlwip_stricmp(constchar*str1,constchar*str2); +#endif +#ifndeflwip_strnstr +/*Thiscanbe#definedtostrnstr()dependingonyourplatform*/ +char*lwip_strnstr(constchar*buffer,constchar*token,size_tn); +#endif + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_DEF_H*/ - + diff --git a/doc/xml/devfs_8c.xml b/doc/xml/devfs_8c.xml index 8ca92b6..c14e79e 100644 --- a/doc/xml/devfs_8c.xml +++ b/doc/xml/devfs_8c.xml @@ -1,150 +1,467 @@ - - - + + + devfs.c devfs/devfs.h - vfs/vfs.h - sys/device.h - ubixos/types.h + vfs/vfs.h + sys/device.h ubixos/spinlock.h ubixos/kpanic.h lib/kmalloc.h - lib/string.h + string.h lib/kprintf.h - - - - + + + + + + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - - - - - - - + + + + - - - - + + + + - - - - + + + + - + - - - - - + - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + - + - - - - + + + + - - - - - + + + + + + + + int + int devfs_len + + devfs_len + = 0x0 + + + + + + + + + + struct spinLock + struct spinLock devfsSpinLock + + devfsSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + int int devfs_init () @@ -155,17 +472,10 @@ - - devfs_initialize - devfs_open - devfs_read - devfs_write - NULL - vfs_mount - vfsRegisterFS - x1 + + NULL - + void static void devfs_initialize (struct vfs_mountPoint *mp) @@ -177,17 +487,13 @@ -This is the initialized called by the vfs system when enabling devfs basically it allocates memory for the devfs module +This is the initialized called by the vfs system when enabling devfs basically it allocates memory for the devfs module + - - devfs_info::deviceList - vfs_mountPoint::fsInfo - K_PANIC - kmalloc - devfs_init + - + int int devfs_makeNode (char *name, uInt8 type, uInt16 major, uInt16 minor) @@ -197,15 +503,15 @@ name - uInt8 + uInt8 type - uInt16 + uInt16 major - uInt16 + uInt16 minor @@ -214,76 +520,40 @@ - - devfs_len - devfsSpinLock - devfs_info::deviceList - devfs_devices::devMajor - devfs_devices::devMinor - devfs_devices::devName - devfs_devices::devType - vfs_mountPoint::fsInfo - kmalloc - kprintf - devfs_devices::next - devfs_devices::prev - spinLock - spinUnlock - sprintf - strlen - vfs_findMount - fdc_init - initHardDisk + + spinLock + fdc_init - + int static int devfs_open - (char *file, fileDescriptor *fd) + (char *file, fileDescriptor_t *fd) devfs_open char * file - fileDescriptor * + fileDescriptor_t * fd -This is the open routine called by the vfs when a fopen or open is called within the user or kernel space file - this is the file node fd - this is the file descriptorThis format will be changing down the road +This is the open routine called by the vfs when a fopen or open is called within the user or kernel space file - this is the file node fd - this is the file descriptor +This format will be changing down the road + - - devfs_len - devfsSpinLock - device_find - devfs_info::deviceList - device_node::devInfo - devfs_devices::devMajor - devfs_devices::devMinor - devfs_devices::devName - vfs_mountPoint::fsInfo - kprintf - fileDescriptorStruct::mode - fileDescriptorStruct::mp - devfs_devices::next - device_interface::size - fileDescriptorStruct::size - spinLock - spinUnlock - fileDescriptorStruct::start - strcmp - x1 - devfs_init + - + int static int devfs_read - (fileDescriptor *fd, char *data, long offset, long size) + (fileDescriptor_t *fd, char *data, long offset, long size) devfs_read - fileDescriptor * + fileDescriptor_t * fd @@ -301,28 +571,19 @@ -Function: int readDevFS(fileDescriptor *fd,char *data,long offset,long size) Description: Read File Into Data Notes: +Function: int readDevFS(fileDescriptor_t *fd,char *data,long offset,long size) Description: Read File Into Data Notes: + - - fileDescriptorStruct::buffer - device_find - device_node::devInfo - devfs_devices::devMajor - devfs_devices::devMinor - device_interface::info - kprintf - device_interface::read - fileDescriptorStruct::start - devfs_init + - + int static int devfs_write - (fileDescriptor *fd, char *data, long offset, long size) + (fileDescriptor_t *fd, char *data, long offset, long size) devfs_write - fileDescriptor * + fileDescriptor_t * fd @@ -343,51 +604,7 @@ - - fileDescriptorStruct::buffer - device_find - device_node::devInfo - devfs_devices::devMajor - devfs_devices::devMinor - device_interface::info - device_interface::read - fileDescriptorStruct::start - device_interface::write - devfs_init - - - - - int - int devfs_len - - devfs_len - 0x0 - - - - - - - - devfs_makeNode - devfs_open - - - spinLock_t - spinLock_t devfsSpinLock - - devfsSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - devfs_makeNode - devfs_open + @@ -395,235 +612,227 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: devfs_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<devfs/devfs.h> -#include<vfs/vfs.h> -#include<sys/device.h> -#include<ubixos/types.h> -#include<ubixos/spinlock.h> -#include<ubixos/kpanic.h> -#include<lib/kmalloc.h> -#include<lib/string.h> -#include<lib/kprintf.h> - -/*Spinlockfordevfsweshouldstartconvertingtosem/mutex*/ -staticspinLock_tdevfsSpinLock=SPIN_LOCK_INITIALIZER; - -/*Lengthofdevlist*/ -staticintdevfs_len=0x0; - -staticvoiddevfs_initialize(structvfs_mountPoint*mp){ -structdevfs_info*fsInfo=0x0; - -/*AllocatememoryforthefsInfo*/ -if((mp->fsInfo=(structdevfs_info*)kmalloc(sizeof(structdevfs_info)))==0x0) -K_PANIC("devfs:failedtoallocatememor\n"); - -fsInfo=mp->fsInfo; -fsInfo->deviceList=0x0; - -/*Return*/ -return; -} - -staticintdevfs_open(char*file,fileDescriptor*fd){ -structdevfs_info*fsInfo=fd->mp->fsInfo; -structdevfs_devices*tmpDev=0x0; -structdevice_node*device=0x0; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<devfs/devfs.h> +#include<vfs/vfs.h> +#include<sys/device.h> +#include<ubixos/spinlock.h> +#include<ubixos/kpanic.h> +#include<lib/kmalloc.h> +#include<string.h> +#include<lib/kprintf.h> + +/*Spinlockfordevfsweshouldstartconvertingtosem/mutex*/ +staticstructspinLockdevfsSpinLock=SPIN_LOCK_INITIALIZER; + +/*Lengthofdevlist*/ +staticintdevfs_len=0x0; + +staticvoiddevfs_initialize(structvfs_mountPoint*mp){ +structdevfs_info*fsInfo=0x0; + +/*AllocatememoryforthefsInfo*/ +if((mp->fsInfo=(structdevfs_info*)kmalloc(sizeof(structdevfs_info)))==0x0) +K_PANIC("devfs:failedtoallocatememor\n"); + +fsInfo=mp->fsInfo; +fsInfo->deviceList=0x0; + +/*Return*/ +return; +} + +staticintdevfs_open(char*file,fileDescriptor_t*fd){ +structdevfs_info*fsInfo=fd->mp->fsInfo; +structdevfs_devices*tmpDev=0x0; +structdevice_node*device=0x0; + +spinLock(&devfsSpinLock); -spinLock(&devfsSpinLock); - -if(strcmp(file,"/")==0x0){ -fd->start=-1; -fd->size=devfs_len; -spinUnlock(&devfsSpinLock); -return(0x1); -} -if(file[0]=='/') -file++; -for(tmpDev=fsInfo->deviceList;tmpDev!=0x0;tmpDev=tmpDev->next){ -if(strcmp(tmpDev->devName,file)==0x0){ -switch((fd->mode&0x3)){ -case0: -case1: -device=device_find(tmpDev->devMajor,tmpDev->devMinor); -(void*)fd->start=tmpDev; -fd->size=device->devInfo->size; -break; -default: -kprintf("InvalidFileMode\n"); -spinUnlock(&devfsSpinLock); -return(-1); -break; -} -spinUnlock(&devfsSpinLock); -return(0x1); -} -} -spinUnlock(&devfsSpinLock); -return(0x0); -} - -staticintdevfs_read(fileDescriptor*fd,char*data,longoffset,longsize){ -inti=0x0,x=0x0; -uInt32sectors=0x0; -uInt16diff=0x0; -structdevice_node*device=0x0; -structdevfs_devices*tmpDev=(void*)fd->start; - -if(tmpDev==-1){ -kprintf("HiUbie[%i]!!!\n",size); -for(i=0;i<size;i++){ -data[i]='a'; -fd->buffer[i]='a'; -} -data[size-1]='\n'; -return(size); -} +if(strcmp(file,"/")==0x0){ +fd->start=-1; +fd->size=devfs_len; +spinUnlock(&devfsSpinLock); +return(0x1); +} +if(file[0]=='/') +file++; +for(tmpDev=fsInfo->deviceList;tmpDev!=0x0;tmpDev=tmpDev->next){ +if(strcmp(tmpDev->devName,file)==0x0){ +switch((fd->mode&0x3)){ +case0: +case1: +device=device_find(tmpDev->devMajor,tmpDev->devMinor); +fd->start=(uint32_t*)tmpDev;/*MrOlsen(2016-01-19)FIX:IDon'tUnderstandThis*/ +fd->size=device->devInfo->size; +break; +default: +kprintf("InvalidFileMode\n"); +spinUnlock(&devfsSpinLock); +return(-1); +break; +} +spinUnlock(&devfsSpinLock); +return(0x1); +} +} +spinUnlock(&devfsSpinLock); +return(0x0); +} + +staticintdevfs_read(fileDescriptor_t*fd,char*data,longoffset,longsize){ +inti=0x0,x=0x0; +uInt32sectors=0x0; +uInt16diff=0x0; +structdevice_node*device=0x0; +structdevfs_devices*tmpDev=(void*)fd->start; + +if(tmpDev==-1){ +kprintf("HiUbie[%i]!!!\n",size); +for(i=0;i<size;i++){ +data[i]='a'; +fd->buffer[i]='a'; +} +data[size-1]='\n'; +return(size); +} + +device=device_find(tmpDev->devMajor,tmpDev->devMinor); -device=device_find(tmpDev->devMajor,tmpDev->devMinor); - -sectors=((size+511)/512); -diff=(offset-((offset/512)*512)); - -for(i=0x0;i<sectors;i++){ -device->devInfo->read(device->devInfo->info,fd->buffer,i+(offset/512),1); -for(x=0x0;x<(size-(i*512));x++){ -if(diff>0){ -data[x]=fd->buffer[x+diff]; -} -else{ -data[x]=fd->buffer[x]; -} -} -diff=0x0; -data+=512; -} - -return(size); -} - -/************************************************************************ - -Function:intwriteDevFS(fileDescriptor*fd,char*data,longoffset,longsize) -Description:WriteDataIntoFile -Notes: - -************************************************************************/ -staticintdevfs_write(fileDescriptor*fd,char*data,longoffset,longsize){ -inti=0x0,x=0x0; -structdevice_node*device=0x0; -structdevfs_devices*tmpDev=(void*)fd->start; - -device=device_find(tmpDev->devMajor,tmpDev->devMinor); -for(i=0x0;i<((size+511)/512);i++){ -device->devInfo->read(device->devInfo->info,fd->buffer,i+(offset/512),1); -for(x=0x0;((x<512)&&((x+(i*512))<size));x++){ -fd->buffer[x]=data[x]; -} -device->devInfo->write(device->devInfo->info,fd->buffer,i+(offset/512),1); -data+=512; -} -return(size); -} - - -intdevfs_makeNode(char*name,uInt8type,uInt16major,uInt16minor){ -structvfs_mountPoint*mp=0x0; -structdevfs_info*fsInfo=0x0; -structdevfs_devices*tmpDev=0x0; - -spinLock(&devfsSpinLock); - -mp=vfs_findMount("devfs"); - -if(mp==0x0){ -kprintf("Error:Can'tFindMountPoint\n"); -spinUnlock(&devfsSpinLock); -return(-1); -} - -fsInfo=mp->fsInfo; - -tmpDev=(structdevfs_devices*)kmalloc(sizeof(structdevfs_devices)); - -tmpDev->devType=type; -tmpDev->devMajor=major; -tmpDev->devMinor=minor; -sprintf(tmpDev->devName,name); -devfs_len+=strlen(name)+1; - -tmpDev->next=fsInfo->deviceList; -tmpDev->prev=0x0; -if(fsInfo->deviceList!=0x0){ -fsInfo->deviceList->prev=tmpDev; -} - -fsInfo->deviceList=tmpDev; - -spinUnlock(&devfsSpinLock); -return(0x0); -} - -intdevfs_init(){ -/*Buildourdevfsstruct*/ -structfileSystemdevFS= -{NULL,/*prev*/ -NULL,/*next*/ -(void*)devfs_initialize,/*vfsInitFS*/ -(void*)devfs_read,/*vfsRead*/ -(void*)devfs_write,/*vfsWrite*/ -(void*)devfs_open,/*vfsOpenFile*/ -NULL,/*vfsUnlink*/ -NULL,/*vfsMakeDir*/ -NULL,/*vfsRemDir*/ -NULL,/*vfsSync*/ -1/*vfsType*/ -};/*devFS*/ - -if(vfsRegisterFS(devFS)!=0x0){ -//sysErr(systemErr,"UnableToEnableDevFS"); -return(0x1); -} -/*Mountourdevfsthiswillbuildthedevfscontainernode*/ -vfs_mount(0x0,0x0,0x0,0x1,"devfs","rw");//MountDeviceFileSystem - -/*Return*/ -return(0x0); -} - -/*** -END -***/ +sectors=((size+511)/512); +diff=(offset-((offset/512)*512)); + +for(i=0x0;i<sectors;i++){ +device->devInfo->read(device->devInfo->info,fd->buffer,i+(offset/512),1); +for(x=0x0;x<(size-(i*512));x++){ +if(diff>0){ +data[x]=fd->buffer[x+diff]; +} +else{ +data[x]=fd->buffer[x]; +} +} +diff=0x0; +data+=512; +} + +return(size); +} + +/************************************************************************ + +Function:intwriteDevFS(fileDescriptor_t*fd,char*data,longoffset,longsize) +Description:WriteDataIntoFile +Notes: + +************************************************************************/ +staticintdevfs_write(fileDescriptor_t*fd,char*data,longoffset,longsize){ +inti=0x0,x=0x0; +structdevice_node*device=0x0; +structdevfs_devices*tmpDev=(void*)fd->start; + +device=device_find(tmpDev->devMajor,tmpDev->devMinor); +for(i=0x0;i<((size+511)/512);i++){ +device->devInfo->read(device->devInfo->info,fd->buffer,i+(offset/512),1); +for(x=0x0;((x<512)&&((x+(i*512))<size));x++){ +fd->buffer[x]=data[x]; +} +device->devInfo->write(device->devInfo->info,fd->buffer,i+(offset/512),1); +data+=512; +} +return(size); +} + +intdevfs_makeNode(char*name,uInt8type,uInt16major,uInt16minor){ +structvfs_mountPoint*mp=0x0; +structdevfs_info*fsInfo=0x0; +structdevfs_devices*tmpDev=0x0; + +spinLock(&devfsSpinLock); + +mp=vfs_findMount("devfs"); + +if(mp==0x0){ +kprintf("Error:Can'tFindMountPoint\n"); +spinUnlock(&devfsSpinLock); +return(-1); +} + +fsInfo=mp->fsInfo; + +tmpDev=(structdevfs_devices*)kmalloc(sizeof(structdevfs_devices)); + +tmpDev->devType=type; +tmpDev->devMajor=major; +tmpDev->devMinor=minor; +sprintf(tmpDev->devName,name); +devfs_len+=strlen(name)+1; + +tmpDev->next=fsInfo->deviceList; +tmpDev->prev=0x0; +if(fsInfo->deviceList!=0x0){ +fsInfo->deviceList->prev=tmpDev; +} + +fsInfo->deviceList=tmpDev; + +spinUnlock(&devfsSpinLock); +return(0x0); +} + +intdevfs_init(){ +/*Buildourdevfsstruct*/ +structfileSystemdevFS={NULL,/*prev*/ +NULL,/*next*/ +(void*)devfs_initialize,/*vfsInitFS*/ +(void*)devfs_read,/*vfsRead*/ +(void*)devfs_write,/*vfsWrite*/ +(void*)devfs_open,/*vfsOpenFile*/ +NULL,/*vfsUnlink*/ +NULL,/*vfsMakeDir*/ +NULL,/*vfsRemDir*/ +NULL,/*vfsSync*/ +1/*vfsType*/ +};/*devFS*/ + +if(vfsRegisterFS(devFS)!=0x0){ +//sysErr(systemErr,"UnableToEnableDevFS"); +return(0x1); +} +/*Mountourdevfsthiswillbuildthedevfscontainernode*/ +vfs_mount(0x0,0x0,0x0,0x1,"devfs","rw");//MountDeviceFileSystem + +/*Return*/ +return(0x0); +} - + diff --git a/doc/xml/devfs_8h.xml b/doc/xml/devfs_8h.xml index 300bdcc..270c7fa 100644 --- a/doc/xml/devfs_8h.xml +++ b/doc/xml/devfs_8h.xml @@ -1,95 +1,215 @@ - - - + + + devfs.h - ubixos/types.h - vfs/file.h - src/sys/devfs/devfs.c - src/sys/include/ubixos/init.h - src/sys/isa/fdc.c - src/sys/pci/hd.c + sys/types.h + vfs/file.h + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/pci/hd.c - - - - + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - + + + + - + - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - - - - - + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + devfs_devices devfs_info - + int int devfs_init () @@ -100,17 +220,10 @@ - - devfs_initialize - devfs_open - devfs_read - devfs_write - NULL - vfs_mount - vfsRegisterFS - x1 + + NULL - + int int devfs_makeNode (char *name, uInt8 type, uInt16 major, uInt16 minor) @@ -120,15 +233,15 @@ name - uInt8 + uInt8 type - uInt16 + uInt16 major - uInt16 + uInt16 minor @@ -137,26 +250,9 @@ - - devfs_len - devfsSpinLock - devfs_info::deviceList - devfs_devices::devMajor - devfs_devices::devMinor - devfs_devices::devName - devfs_devices::devType - vfs_mountPoint::fsInfo - kmalloc - kprintf - devfs_devices::next - devfs_devices::prev - spinLock - spinUnlock - sprintf - strlen - vfs_findMount - fdc_init - initHardDisk + + spinLock + fdc_init @@ -164,102 +260,98 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: devfs_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_DEVFS_H -#define_DEVFS_H - -#include<ubixos/types.h> -#include<vfs/file.h> - -structdevfs_devices{ -structdevfs_devices*next; -structdevfs_devices*prev; -uInt8devType; -uInt16devMajor; -uInt16devMinor; -chardevName[32]; -}; - -structdevfs_info{ -structdevfs_devices*deviceList; -}; - -intdevfs_init(); -intdevfs_makeNode(char*name,uInt8type,uInt16major,uInt16minor); -/* -intdevfs_open(char*file,fileDescriptor*fd); -voiddevFSInit(structmountPoints*mp); -intdevfs_read(fileDescriptor*fd,char*data,longoffset,longsize); -intdevfs_write(fileDescriptor*fd,char*data,longoffset,longsize); -*/ - -#endif - -/*** -$Log: devfs_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:50 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:38reddawg -nomessage - -Revision1.52004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.42004/07/1412:17:52reddawg -devfs:devFSEnabletodevfs_init -ChangedStartupRoutines - -Revision1.32004/05/2114:54:41reddawg -Cleanedup +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_DEVFS_DEVFS_H +#define_DEVFS_DEVFS_H + +#include<sys/types.h> +#include<vfs/file.h> + +structdevfs_devices{ +structdevfs_devices*next; +structdevfs_devices*prev; +uInt8devType; +uInt16devMajor; +uInt16devMinor; +chardevName[32]; +}; + +structdevfs_info{ +structdevfs_devices*deviceList; +}; + +intdevfs_init(); +intdevfs_makeNode(char*name,uInt8type,uInt16major,uInt16minor); +/* +intdevfs_open(char*file,fileDescriptor*fd); +voiddevFSInit(structmountPoints*mp); +intdevfs_read(fileDescriptor*fd,char*data,longoffset,longsize); +intdevfs_write(fileDescriptor*fd,char*data,longoffset,longsize); +*/ + +#endif + +/*** +$Log:devfs.h,v$ +Revision1.1.1.12006/06/0112:46:13reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:38reddawg +nomessage + +Revision1.52004/07/2110:02:09reddawg +devfs:renamedfunctions +devicesystem:renamedfunctions +fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables +strol:fixeddefinition +endtask:madeitprintoutfreepagedebuginfo +kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost +ld:fixedapointerconversion +file:cleanedupafewunusedvariables +sched:broketaskdeletion +kprintf:fixedogPrintfdefinition + +Revision1.42004/07/1412:17:52reddawg +devfs:devFSEnabletodevfs_init +ChangedStartupRoutines + +Revision1.32004/05/2114:54:41reddawg +Cleanedup + - -END -***/ +END +***/ - + diff --git a/doc/xml/device_8c.xml b/doc/xml/device_8c.xml index d2f8de7..866225b 100644 --- a/doc/xml/device_8c.xml +++ b/doc/xml/device_8c.xml @@ -1,68 +1,142 @@ - - - + + + device.c - sys/device.h + sys/device.h ubixos/spinlock.h lib/kmalloc.h lib/kprintf.h assert.h - + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - - + - + - - - - + + + + + + - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + struct device_node * + struct device_node* devices + + devices + = 0x0 + + + + + + + + + + struct spinLock + struct spinLock deviceSpinLock + + deviceSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + int int device_add (int minor, char type, struct device_interface *devInfo) @@ -85,26 +159,19 @@ - - devices - deviceSpinLock - device_node::devInfo - device_interface::init - device_interface::initialized - kmalloc - kprintf - device_node::minor - device_node::next - NULL - device_node::prev - spinLock - spinUnlock - device_node::type - fdc_init - initHardDisk + + device_node::devInfo + kmalloc + kprintf + device_node::minor + NULL + device_node::prev + spinLock + device_node::type + fdc_init - - device_node * + + struct device_node * struct device_node* device_find (int major, int minor) device_find @@ -122,21 +189,11 @@ - - devices - deviceSpinLock - device_node::devInfo - device_interface::major - device_node::minor - device_node::next - spinLock - spinUnlock - devfs_open - devfs_read - devfs_write - vfs_mount + + spinLock + vfs_mount - + int int device_remove (struct device_node *deviceToDelete) @@ -151,50 +208,7 @@ - - devices - deviceSpinLock - kfree - device_node::next - NULL - spinLock - spinUnlock - - - - - struct device_node * - struct device_node* devices - - devices - 0x0 - - - - - - - - device_add - device_find - device_remove - - - spinLock_t - spinLock_t deviceSpinLock - - deviceSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - device_add - device_find - device_remove + @@ -202,157 +216,144 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: device_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<sys/device.h> -#include<ubixos/spinlock.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<assert.h> - -/*Linkedlistofdriversloadedinthesystemaccessablebythesubsystemonly*/ -staticstructdevice_node*devices=0x0; -staticspinLock_tdeviceSpinLock=SPIN_LOCK_INITIALIZER; - -/***************************************************************************************** - -Function:intdeviceAdd(intminor,chartype,structdevice_interface*devInfo); - -Description:Thiswilladdadevicetothesystem - -Notes: - -05/19/2004-ImprovingUponthespec - -*****************************************************************************************/ -intdevice_add(intminor,chartype,structdevice_interface*devInfo){ -structdevice_node*tmpDev=0x0; - - -tmpDev=(structdevice_node*)kmalloc(sizeof(structdevice_node)); -if(tmpDev==NULL) -kprintf("ErrorAddingDevice:memoryfailure\n"); - -tmpDev->prev=0x0; -tmpDev->minor=minor; -tmpDev->type=type; -tmpDev->devInfo=devInfo; - -spinLock(&deviceSpinLock); -tmpDev->next=devices; -devices=tmpDev; -spinUnlock(&deviceSpinLock); - -if(tmpDev->devInfo->initialized==0x0) -return(tmpDev->devInfo->init(tmpDev)); -else -return(0x0); -} - -/***************************************************************************************** +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/device.h> +#include<ubixos/spinlock.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<assert.h> + +/*Linkedlistofdriversloadedinthesystemaccessablebythesubsystemonly*/ +staticstructdevice_node*devices=0x0; +staticstructspinLockdeviceSpinLock=SPIN_LOCK_INITIALIZER; + +/***************************************************************************************** + +Function:intdeviceAdd(intminor,chartype,structdevice_interface*devInfo); + +Description:Thiswilladdadevicetothesystem + +Notes: + +05/19/2004-ImprovingUponthespec + +*****************************************************************************************/ +intdevice_add(intminor,chartype,structdevice_interface*devInfo){ +structdevice_node*tmpDev=0x0; + +tmpDev=(structdevice_node*)kmalloc(sizeof(structdevice_node)); +if(tmpDev==NULL) +kprintf("ErrorAddingDevice:memoryfailure\n"); + +tmpDev->prev=0x0; +tmpDev->minor=minor; +tmpDev->type=type; +tmpDev->devInfo=devInfo; + +spinLock(&deviceSpinLock); +tmpDev->next=devices; +devices=tmpDev; +spinUnlock(&deviceSpinLock); + +if(tmpDev->devInfo->initialized==0x0) +return(tmpDev->devInfo->init(tmpDev)); +else +return(0x0); +} + +/***************************************************************************************** + +Function:structdevice_node*deviceFind(intmajor,intminor); -Function:structdevice_node*deviceFind(intmajor,intminor); +Description:Thiswillfindadevicebasedonmajorminor -Description:Thiswillfindadevicebasedonmajorminor +Notes: -Notes: - -05/19/2004-ImprovingUponthespec - -*****************************************************************************************/ -structdevice_node*device_find(intmajor,intminor){ -structdevice_node*tmpDev=0x0; - -spinLock(&deviceSpinLock); - -for(tmpDev=devices;tmpDev;tmpDev=tmpDev->next){ -if((tmpDev->devInfo->major==major)&&(tmpDev->minor==minor)){ -spinUnlock(&deviceSpinLock); -return(tmpDev); -} -} - -spinUnlock(&deviceSpinLock); -return(0x0); -} - - -/******************************************************************************************** - -Function:intdeviceRemove(struct*device_node); - -Description:Thiswillremoveadevicebasedonit'spointer - -*********************************************************************************************/ -intdevice_remove(structdevice_node*deviceToDelete) -{ -structdevice_node*current,*previous; - - -current=devices; -previous=NULL; -spinLock(&deviceSpinLock); -while(current!=NULL) -{ -if(current==deviceToDelete)break; -else -{ -previous=current; -current=current->next; -} -} -if(current==NULL) -{ -spinUnlock(&deviceSpinLock); -return1; -} -else -{ -if(current==devices) -devices=devices->next; -else -previous->next=current->next; -kfree(current); -spinUnlock(&deviceSpinLock); -return1; -} - -spinUnlock(&deviceSpinLock); -return0x0; -} - - -/*** -END -***/ +05/19/2004-ImprovingUponthespec + +*****************************************************************************************/ +structdevice_node*device_find(intmajor,intminor){ +structdevice_node*tmpDev=0x0; + +spinLock(&deviceSpinLock); + +for(tmpDev=devices;tmpDev;tmpDev=tmpDev->next){ +if((tmpDev->devInfo->major==major)&&(tmpDev->minor==minor)){ +spinUnlock(&deviceSpinLock); +return(tmpDev); +} +} + +spinUnlock(&deviceSpinLock); +return(0x0); +} + +/******************************************************************************************** + +Function:intdeviceRemove(struct*device_node); + +Description:Thiswillremoveadevicebasedonit'spointer + +*********************************************************************************************/ +intdevice_remove(structdevice_node*deviceToDelete){ +structdevice_node*current,*previous; + +current=devices; +previous=NULL; +spinLock(&deviceSpinLock); +while(current!=NULL){ +if(current==deviceToDelete) +break; +else{ +previous=current; +current=current->next; +} +} +if(current==NULL){ +spinUnlock(&deviceSpinLock); +return1; +} +else{ +if(current==devices) +devices=devices->next; +else +previous->next=current->next; +kfree(current); +spinUnlock(&deviceSpinLock); +return1; +} + +spinUnlock(&deviceSpinLock); +return0x0; +} - + diff --git a/doc/xml/device_8old_8h.xml b/doc/xml/device_8old_8h.xml index bbfd233..7342918 100644 --- a/doc/xml/device_8old_8h.xml +++ b/doc/xml/device_8old_8h.xml @@ -1,57 +1,95 @@ - - - + + + device.old.h - ubixos/types.h - src/sys/include/isa/ne2k.h - src/sys/isa/ne2k.c + sys/types.h + C:/Dev/git/UbixOS/sys/include/isa/ne2k.h + C:/Dev/git/UbixOS/sys/isa/ne2k.c - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + - - - - + + + + @@ -63,65 +101,70 @@ -/************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistofconditions,thefollowingdisclaimerandthelistofauthors. -Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowingdisclaimerandthelistofauthors -inthedocumentationand/orothermaterialsprovidedwiththedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED -WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULAR -PURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT, -INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTE -GOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORY -OFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: device_8old_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -**************************************************************************************/ - -#ifndef_DEVICE_H -#define_DEVICE_H - -#include<ubixos/types.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ -structdevice{ -structnet*net; -uInt16ioAddr; -uInt32irq; -structei_device*priv; -uInt32mtu; -}; - -structnet{ -charmac[6]; -charbroadcast[6]; +#ifndef_DEVICE_H +#define_DEVICE_H + +#include<sys/types.h> + +structdevice{ +structnet*net; +uInt16ioAddr; +uInt32irq; +structei_device*priv; +uInt32mtu; }; -structei_device{ -inttxStartPage; -intrxStartPage; -intstopPage; -intcurrentPage; -uInt16word16; -uInt32pingPong; -inttx1; -inttx2; -}; - -#endif - -/*** -END -***/ - +structnet{ +charmac[6]; +charbroadcast[6]; +}; + +structei_device{ +inttxStartPage; +intrxStartPage; +intstopPage; +intcurrentPage; +uInt16word16; +uInt32pingPong; +inttx1; +inttx2; +}; + +#endif + +/*** +END +***/ + - + diff --git a/doc/xml/dirCache_8c.xml b/doc/xml/dirCache_8c.xml index 5c95abe..349e350 100644 --- a/doc/xml/dirCache_8c.xml +++ b/doc/xml/dirCache_8c.xml @@ -1,185 +1,495 @@ - - - + + + dirCache.c assert.h ubixfs/dirCache.h - ubixfs/ubixfs.h + ubixfs/ubixfs.h lib/kmalloc.h lib/kprintf.h - lib/string.h + string.h ubixos/spinlock.h - - - - + + + + + + - - - - - - - - - - - - - + + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + - + + + + + - + + + + + - + - - - - + + + + - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - - - - - + - - - - - + + + + + + struct spinLock + struct spinLock dca_spinLock + + dca_spinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - - cacheNode * + + struct cacheNode * struct cacheNode* ubixfs_cacheAdd (struct cacheNode *node, struct cacheNode *newNode) ubixfs_cacheAdd @@ -197,20 +507,11 @@ - - assert - dca_spinLock - cacheNode::fileListHead - cacheNode::fileListTail - cacheNode::next - NULL - cacheNode::parent - cacheNode::prev - spinLock - spinUnlock - ubixfs_cacheFind + + assert + spinLock - + void void ubixfs_cacheDelete (struct cacheNode **head) @@ -225,18 +526,18 @@ - - cacheNode::fileListHead - cacheNode::info - kfree - cacheNode::name - cacheNode::next - NULL - ubixfs_cacheDelete - ubixfs_cacheDelete + + cacheNode::fileListHead + cacheNode::info + kfree + cacheNode::name + cacheNode::next + NULL + ubixfs_cacheDelete + ubixfs_cacheDelete - - cacheNode * + + struct cacheNode * struct cacheNode* ubixfs_cacheFind (struct cacheNode *head, char *name) ubixfs_cacheFind @@ -254,41 +555,15 @@ - - assert - cacheNode::attributes - dca_spinLock - dirList - cacheNode::fileListHead - cacheNode::fileListTail - cacheNode::info - cacheNode::name - cacheNode::next - NULL - cacheNode::parent - cacheNode::permissions - cacheNode::present - cacheNode::prev - cacheNode::size - spinLock - spinUnlock - cacheNode::startCluster - strcmp - typeFile - ubixfs_cacheAdd - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_findName - openFileUbixFS - ubixfs_cacheFind + - - cacheNode * + + struct cacheNode * struct cacheNode* ubixfs_cacheNew (const char *name) ubixfs_cacheNew - const char * + const char * name @@ -297,29 +572,29 @@ - - assert - cacheNode::attributes - cacheNode::dirty - cacheNode::fileListHead - cacheNode::fileListTail - cacheNode::info - kmalloc - cacheNode::name - cacheNode::next - NULL - cacheNode::parent - cacheNode::permissions - cacheNode::present - cacheNode::prev - cacheNode::size - cacheNode::startCluster - strcpy - strlen - ubixfs_cacheFind - ubixfs_initialize + + assert + cacheNode::attributes + cacheNode::dirty + cacheNode::fileListHead + cacheNode::fileListTail + cacheNode::info + kmalloc + cacheNode::name + name + cacheNode::next + NULL + cacheNode::parent + cacheNode::permissions + cacheNode::present + cacheNode::prev + cacheNode::size + cacheNode::startCluster + strcpy + strlen + ubixfs_initialize - + struct directoryEntry * static struct directoryEntry* ubixfs_findName (struct directoryEntry *dirList, uInt32 size, char *name) @@ -329,7 +604,7 @@ dirList - uInt32 + uInt32 size @@ -342,30 +617,7 @@ - - dirList - directoryEntry::fileName - NULL - strcmp - ubixfs_cacheFind - - - - - spinLock_t - spinLock_t dca_spinLock - - dca_spinLock - SPIN_LOCK_INITIALIZER - - - - - - - - ubixfs_cacheAdd - ubixfs_cacheFind + @@ -374,445 +626,449 @@ /***************************************************************************************** -Copyright(c)2002TheUbixOSProject +Copyright(c)2002,2016TheUbixOSProject Allrightsreserved. -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: +Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are +permittedprovidedthatthefollowingconditionsaremet: -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. +Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary +formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing +disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided +withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits +contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware +withoutspecificpriorwrittenpermission. -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY +EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL +THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, +SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) +HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR +TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS +SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: dirCache_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:dirCache.c1692016-01-2001:10:22Zreddawg$ -*****************************************************************************************/ +*****************************************************************************************/ #include<assert.h> #include<ubixfs/dirCache.h> -#include<ubixfs/ubixfs.h> +#include<ubixfs/ubixfs.h> #include<lib/kmalloc.h> #include<lib/kprintf.h> -#include<lib/string.h> +#include<string.h> #include<ubixos/spinlock.h> -staticspinLock_tdca_spinLock=SPIN_LOCK_INITIALIZER; +staticstructspinLockdca_spinLock=SPIN_LOCK_INITIALIZER; -static -structdirectoryEntry* -ubixfs_findName(structdirectoryEntry*dirList,uInt32size,char*name){ -unsignedinti; - -if(dirList==NULL||name==NULL)returnNULL; +staticstructdirectoryEntry* +ubixfs_findName(structdirectoryEntry*dirList,uInt32size,char*name){ +unsignedinti; + +if(dirList==NULL||name==NULL) +returnNULL; //UBUkprintf("dirList:[0x%X],name:[0x%X]\n",dirList,name); -for(i=0;i<(size/sizeof(structdirectoryEntry));i++){ -if(strcmp(dirList[i].fileName,name)==0)return&dirList[i]; -}/*for*/ -returnNULL; -}/*ubixfs_findName*/ - -structcacheNode* -ubixfs_cacheFind(structcacheNode*head,char*name){ -structcacheNode*tmp=head; -structdirectoryEntry*dirList=NULL; -unsignedinti=0x0; -chardirName[256]; -char*nextDir=NULL; -/*kprintf("lookingfor%s\n",name);*/ -assert(name); -assert(head); -assert(*name); -spinLock(&dca_spinLock); -spinUnlock(&dca_spinLock); -if(name==NULL||head==NULL)returnNULL; -if(*name=='\0')returnNULL; - -/* -*walkdownthetreerecursivelyuntilwefindthenodewe'relooking -*for -*/ -i=0; -while(name[i]!='\0'&&name[i]!='/'&&i<sizeof(dirName)){ -dirName[i]=name[i]; -i++; -}/*while*/ -assert(i<sizeof(dirName)); -if(i==sizeof(dirName))returnNULL; - -if(i==0)dirName[i++]='/'; - -dirName[i]='\0'; - -nextDir=&name[i]; -if(*nextDir=='/')nextDir++; +for(i=0;i<(size/sizeof(structdirectoryEntry));i++){ +if(strcmp(dirList[i].fileName,name)==0) +return&dirList[i]; +}/*for*/ +returnNULL; +}/*ubixfs_findName*/ + +structcacheNode* +ubixfs_cacheFind(structcacheNode*head,char*name){ +structcacheNode*tmp=head; +structdirectoryEntry*dirList=NULL; +unsignedinti=0x0; +chardirName[256]; +char*nextDir=NULL; +/*kprintf("lookingfor%s\n",name);*/ +assert(name); +assert(head); +assert(*name); +spinLock(&dca_spinLock); +spinUnlock(&dca_spinLock); +if(name==NULL||head==NULL) +returnNULL; +if(*name=='\0') +returnNULL; + +/* +*walkdownthetreerecursivelyuntilwefindthenodewe'relooking +*for +*/ +i=0; +while(name[i]!='\0'&&name[i]!='/'&&i<sizeof(dirName)){ +dirName[i]=name[i]; +i++; +}/*while*/ +assert(i<sizeof(dirName)); +if(i==sizeof(dirName)) +returnNULL; + +if(i==0) +dirName[i++]='/'; -/* -*nextDirpointstothenextdir -*namepointstoanullterminateddirectoryname -*ifnextDirisn'tnull,thenmakesurethatthisdirispresent -*/ -/*kprintf("nextdir:%s--dirName:%s\n",nextDir,dirName);*/ -if(*nextDir!='\0'){ -while(tmp!=NULL){ -//UBUkprintf("tmp->name:[0x%X],dirName:[0x%X]\n",tmp->name,dirName); -if(strcmp(tmp->name,dirName)==0){ - -if((*tmp->attributes&typeFile)==typeFile -||tmp->fileListHead==NULL){ - -/*ifwe'rehere,thentherearenosubdirscachedtolookthrough*/ -dirList=ubixfs_findName((structdirectoryEntry*)head->info, -*head->size,nextDir); -if(dirList==NULL)returnNULL; -/*kprintf("creatingnewnode%s",dirList->fileName);*/ -tmp=ubixfs_cacheAdd(tmp,ubixfs_cacheNew(dirList->fileName)); -tmp->attributes=&dirList->attributes; -tmp->permissions=&dirList->permissions; -tmp->size=&dirList->size; -/*kprintf("size:%d\n",*tmp->size);*/ -tmp->startCluster=&dirList->startCluster; -tmp->present=0; -returntmp; -}else{ -returnubixfs_cacheFind(tmp->fileListHead,nextDir); -} -}/*if*/ -tmp=tmp->next; -}/*while*/ -/*itwasn'tpresent,returnNULL*/ -returnNULL; -}/*if*/ - -/* -*ifnextDirwasnull,thenwe'reatthebottomlevel.Lookforthe -*dirlistinghere -*/ -while(tmp!=NULL){ - -assert(tmp->name); -assert(name); -/*don'tforgettochecktoseeifit'sadirectory*/ -//UBUkprintf("tmpName:[0x%X],name:[0x%X]\n",tmp->name,name); -if(strcmp(tmp->name,name)==0){ - -/* -*wefoundthenode.Moveittothefrontofthelist -*(ifitisn'talready) -*/ -#if0 -assert(tmp->parent); -if(tmp!=tmp->parent->fileListHead){ +dirName[i]='\0'; + +nextDir=&name[i]; +if(*nextDir=='/') +nextDir++; + +/* +*nextDirpointstothenextdir +*namepointstoanullterminateddirectoryname +*ifnextDirisn'tnull,thenmakesurethatthisdirispresent +*/ +/*kprintf("nextdir:%s--dirName:%s\n",nextDir,dirName);*/ +if(*nextDir!='\0'){ +while(tmp!=NULL){ +//UBUkprintf("tmp->name:[0x%X],dirName:[0x%X]\n",tmp->name,dirName); +if(strcmp(tmp->name,dirName)==0){ + +if((*tmp->attributes&typeFile)==typeFile +||tmp->fileListHead==NULL){ + +/*ifwe'rehere,thentherearenosubdirscachedtolookthrough*/ +dirList=ubixfs_findName((structdirectoryEntry*)head->info, +*head->size,nextDir); +if(dirList==NULL) +returnNULL; +/*kprintf("creatingnewnode%s",dirList->fileName);*/ +tmp=ubixfs_cacheAdd(tmp,ubixfs_cacheNew(dirList->fileName)); +tmp->attributes=&dirList->attributes; +tmp->permissions=&dirList->permissions; +tmp->size=(int*)&dirList->size; +/*kprintf("size:%d\n",*tmp->size);*/ +tmp->startCluster=&dirList->startCluster; +tmp->present=0; +returntmp; +} +else{ +returnubixfs_cacheFind(tmp->fileListHead,nextDir); +} +}/*if*/ +tmp=tmp->next; +}/*while*/ +/*itwasn'tpresent,returnNULL*/ +returnNULL; +}/*if*/ + +/* +*ifnextDirwasnull,thenwe'reatthebottomlevel.Lookforthe +*dirlistinghere +*/ +while(tmp!=NULL){ + +assert(tmp->name); +assert(name); +/*don'tforgettochecktoseeifit'sadirectory*/ +//UBUkprintf("tmpName:[0x%X],name:[0x%X]\n",tmp->name,name); +if(strcmp(tmp->name,name)==0){ -/*ifwe'rethetail,pointthetailtoourprev*/ -if(tmp==tmp->parent->fileListTail){ -tmp->parent->fileListTail=tmp->prev; -}/*if*/ - -if(tmp->next!=NULL)tmp->next->prev=tmp->prev; -if(tmp->prev!=NULL)tmp->prev->next=tmp->next; -tmp->next=tmp->parent->fileListHead; -tmp->prev=NULL; -tmp->parent->fileListHead=tmp; -}/*if*/ -#endif -returntmp; -}/*if*/ -tmp=tmp->next; -}/*while*/ -/*ifwe'rehere,thenonelevelofthedirisn'tcached*/ - -tmp=head->parent; -assert(tmp); -assert(tmp->info); -dirList=ubixfs_findName((structdirectoryEntry*)tmp->info, -*tmp->size,name); -if(dirList==NULL)returnNULL; -/*kprintf("creatingnewnode/size%s/%d",dirList->fileName,dirList->size);*/ -tmp=ubixfs_cacheAdd(tmp,ubixfs_cacheNew(dirList->fileName)); -tmp->attributes=&dirList->attributes; -tmp->permissions=&dirList->permissions; -tmp->size=&dirList->size; -/*kprintf("size:%d\n",*tmp->size);*/ -tmp->startCluster=&dirList->startCluster; -tmp->present=0; -returntmp; -#if0 -returnNULL;/*couldn'tfindit*/ -#endif -}/*ubixfs_cacheFind*/ - -structcacheNode* -ubixfs_cacheNew(constchar*name){ -structcacheNode*tmp=kmalloc(sizeof(structcacheNode)); -assert(tmp); -tmp->parent=tmp; -tmp->prev=tmp->next=tmp->fileListHead=tmp->fileListTail=NULL; -tmp->info=NULL; -tmp->size=NULL; -tmp->present=tmp->dirty=0; -tmp->startCluster=NULL; -tmp->attributes=NULL; -tmp->permissions=NULL; -tmp->name=(char*)kmalloc(strlen(name)+1); -strcpy(tmp->name,name); -returntmp; -}/*ubixfs_cacheNew*/ - -void -ubixfs_cacheDelete(structcacheNode**head){ -structcacheNode*tmp=NULL; -structcacheNode*del=NULL; - -if(head==NULL)return; -if(*head==NULL)return; - -tmp=*head; -while(tmp!=NULL){ -/*ifthereareanychildnodes,deletethemfirst*/ - -/* -*thefollowingcommentedout``if''statementisredundant,sinceit -*willbecaughtwiththeabovechecks -*/ -/*if(tmp->fileListHead!=NULL)*/ -ubixfs_cacheDelete(&tmp->fileListHead); +/* +*wefoundthenode.Moveittothefrontofthelist +*(ifitisn'talready) +*/ +#if0 +assert(tmp->parent); +if(tmp!=tmp->parent->fileListHead){ + +/*ifwe'rethetail,pointthetailtoourprev*/ +if(tmp==tmp->parent->fileListTail){ +tmp->parent->fileListTail=tmp->prev; +}/*if*/ + +if(tmp->next!=NULL)tmp->next->prev=tmp->prev; +if(tmp->prev!=NULL)tmp->prev->next=tmp->next; +tmp->next=tmp->parent->fileListHead; +tmp->prev=NULL; +tmp->parent->fileListHead=tmp; +}/*if*/ +#endif +returntmp; +}/*if*/ +tmp=tmp->next; +}/*while*/ +/*ifwe'rehere,thenonelevelofthedirisn'tcached*/ + +tmp=head->parent; +assert(tmp); +assert(tmp->info); +dirList=ubixfs_findName((structdirectoryEntry*)tmp->info, +*tmp->size,name); +if(dirList==NULL) +returnNULL; +/*kprintf("creatingnewnode/size%s/%d",dirList->fileName,dirList->size);*/ +tmp=ubixfs_cacheAdd(tmp,ubixfs_cacheNew(dirList->fileName)); +tmp->attributes=&dirList->attributes; +tmp->permissions=&dirList->permissions; +tmp->size=(int*)&dirList->size; +/*kprintf("size:%d\n",*tmp->size);*/ +tmp->startCluster=&dirList->startCluster; +tmp->present=0; +returntmp; +#if0 +returnNULL;/*couldn'tfindit*/ +#endif +}/*ubixfs_cacheFind*/ + +structcacheNode* +ubixfs_cacheNew(constchar*name){ +structcacheNode*tmp=kmalloc(sizeof(structcacheNode)); +assert(tmp); +tmp->parent=tmp; +tmp->prev=tmp->next=tmp->fileListHead=tmp->fileListTail=NULL; +tmp->info=NULL; +tmp->size=NULL; +tmp->present=tmp->dirty=0; +tmp->startCluster=NULL; +tmp->attributes=NULL; +tmp->permissions=NULL; +tmp->name=(char*)kmalloc(strlen(name)+1); +strcpy(tmp->name,name); +returntmp; +}/*ubixfs_cacheNew*/ + +void +ubixfs_cacheDelete(structcacheNode**head){ +structcacheNode*tmp=NULL; +structcacheNode*del=NULL; + +if(head==NULL) +return; +if(*head==NULL) +return; -kfree(tmp->info); -kfree(tmp->name); -del=tmp; -tmp=tmp->next; -kfree(del); -}/*while*/ -*head=NULL; -return; -}/*deleteNode*/ -#if0 -void -addNode(structcacheNode**node,structcacheNode*newNode){ -if(node==NULL)return; -newNode->next=*node; -if(*node!=NULL)(*node)->prev=newNode; -newNode->prev=NULL; -*node=newNode; -return; -}/*addNode*/ -#endif - -structcacheNode* -ubixfs_cacheAdd(structcacheNode*node,structcacheNode*newNode){ -structcacheNode*tmp; - -assert(node); -spinLock(&dca_spinLock); -newNode->parent=node; -newNode->next=node->fileListHead; -newNode->prev=NULL; -if(node->fileListHead==NULL) -node->fileListTail=newNode; -else -node->fileListHead->prev=newNode; - -node->fileListHead=newNode; -tmp=node->fileListHead; -spinUnlock(&dca_spinLock); -returntmp; -}/*ubixfs_cacheAdd*/ - -/*** -$Log: dirCache_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:17reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:40reddawg -nomessage - -Revision1.302004/08/1411:23:02reddawg -Changes - -Revision1.292004/08/0912:58:05reddawg -letmeknowwhenyougotthesurce - -Revision1.282004/08/0117:58:39flameshadow -chg:fixedstringallocationbuginubixfs_cacheNew() - -Revision1.272004/07/2817:24:13flameshadow -chg:nocomment - -Revision1.262004/07/2817:07:29flameshadow -chg:re-addedmovingcachednodestothefrontofthelistwhenfound -add:addedanassert()inubixfs.c - -Revision1.252004/07/2719:24:31flameshadow -chg:reducedthenumberofdebuggingstatementsinthekernel. - -Revision1.242004/07/2712:02:01reddawg -chg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch - -Revision1.232004/07/2709:05:43flameshadow -chg:fixedfilenotfoundbug.Stillcan'tfindloopingissue - -Revision1.222004/07/2704:05:20flameshadow -chg:kindafixedit.Addedbunchesofdebuginfo - -Revision1.212004/07/2522:21:52flameshadow -chg:re-enabledkprintf()inubixfs_cacheFind() - -Revision1.202004/07/2417:19:24flameshadow -chg:Temporarilydisabledthemovingofthefoundcachenodetothefront -ofthelist.Itseemstocauseproblemslater(racecondition,possibly) - -Revision1.192004/07/2223:01:51reddawg -OkcheckinginbeforeIsleep - -Revision1.182004/07/2219:54:50flameshadow -chg:worksnow.Thanxubu - -Revision1.172004/07/2219:01:59flameshadow -chg:moredirectoryandfilecaching - -Revision1.162004/07/2216:34:32flameshadow -add:fileanddircachingkindawork - -Revision1.152004/07/2122:43:18flameshadow -onemoretry - -Revision1.142004/07/2122:42:25flameshadow -tryitnow - -Revision1.132004/07/2122:40:27flameshadow -weird - -Revision1.122004/07/2122:18:37flameshadow -chg:renamedsubDirsHead/TailmembersofcacheNodetofileListHead/Tail - -Revision1.112004/07/2122:12:22flameshadow -add:attributestagincacheNode -add:settingofattributesinubixfx_cacheNew()andubixfs_cacheFind() - -Revision1.102004/07/2122:07:18flameshadow -chg:renamedcachingfunctions(again) - -Revision1.92004/07/2122:00:04flameshadow -chg:ubixfws_dirCacheAddnowreturnsapointertothenodeitadded -chg:minorfixinubixfs_dirCacheFind() +tmp=*head; +while(tmp!=NULL){ +/*ifthereareanychildnodes,deletethemfirst*/ + +/* +*thefollowingcommentedout``if''statementisredundant,sinceit +*willbecaughtwiththeabovechecks +*/ +/*if(tmp->fileListHead!=NULL)*/ +ubixfs_cacheDelete(&tmp->fileListHead); + +kfree(tmp->info); +kfree(tmp->name); +del=tmp; +tmp=tmp->next; +kfree(del); +}/*while*/ +*head=NULL; +return; +}/*deleteNode*/ +#if0 +void +addNode(structcacheNode**node,structcacheNode*newNode){ +if(node==NULL)return; +newNode->next=*node; +if(*node!=NULL)(*node)->prev=newNode; +newNode->prev=NULL; +*node=newNode; +return; +}/*addNode*/ +#endif + +structcacheNode* +ubixfs_cacheAdd(structcacheNode*node,structcacheNode*newNode){ +structcacheNode*tmp; + +assert(node); +spinLock(&dca_spinLock); +newNode->parent=node; +newNode->next=node->fileListHead; +newNode->prev=NULL; +if(node->fileListHead==NULL) +node->fileListTail=newNode; +else +node->fileListHead->prev=newNode; + +node->fileListHead=newNode; +tmp=node->fileListHead; +spinUnlock(&dca_spinLock); +returntmp; +}/*ubixfs_cacheAdd*/ + +/*** +$Log:dirCache.c,v$ +Revision1.1.1.12006/06/0112:46:17reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:40reddawg +nomessage + +Revision1.302004/08/1411:23:02reddawg +Changes + +Revision1.292004/08/0912:58:05reddawg +letmeknowwhenyougotthesurce + +Revision1.282004/08/0117:58:39flameshadow +chg:fixedstringallocationbuginubixfs_cacheNew() + +Revision1.272004/07/2817:24:13flameshadow +chg:nocomment + +Revision1.262004/07/2817:07:29flameshadow +chg:re-addedmovingcachednodestothefrontofthelistwhenfound +add:addedanassert()inubixfs.c + +Revision1.252004/07/2719:24:31flameshadow +chg:reducedthenumberofdebuggingstatementsinthekernel. + +Revision1.242004/07/2712:02:01reddawg +chg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch + +Revision1.232004/07/2709:05:43flameshadow +chg:fixedfilenotfoundbug.Stillcan'tfindloopingissue + +Revision1.222004/07/2704:05:20flameshadow +chg:kindafixedit.Addedbunchesofdebuginfo + +Revision1.212004/07/2522:21:52flameshadow +chg:re-enabledkprintf()inubixfs_cacheFind() + +Revision1.202004/07/2417:19:24flameshadow +chg:Temporarilydisabledthemovingofthefoundcachenodetothefront +ofthelist.Itseemstocauseproblemslater(racecondition,possibly) + +Revision1.192004/07/2223:01:51reddawg +OkcheckinginbeforeIsleep + +Revision1.182004/07/2219:54:50flameshadow +chg:worksnow.Thanxubu + +Revision1.172004/07/2219:01:59flameshadow +chg:moredirectoryandfilecaching + +Revision1.162004/07/2216:34:32flameshadow +add:fileanddircachingkindawork + +Revision1.152004/07/2122:43:18flameshadow +onemoretry + +Revision1.142004/07/2122:42:25flameshadow +tryitnow + +Revision1.132004/07/2122:40:27flameshadow +weird + +Revision1.122004/07/2122:18:37flameshadow +chg:renamedsubDirsHead/TailmembersofcacheNodetofileListHead/Tail -Revision1.62004/07/2114:43:14flameshadow -add:addedcwc(currentworkingcontainer)totheosInfostrut - -Revision1.52004/07/2019:21:30reddawg -Youlikeleavingout$Log: dirCache_8c.xml,v $ -YoulikeleavingoutRevision 1.6 2006/12/19 14:12:51 reddawg -Youlikeleavingoutrtld-elf almost workign -Youlikeleavingout -YoulikeleavingoutRevision1.1.1.12006/06/0112:46:17reddawg -Youlikeleavingoutubix2 -Youlikeleavingout -YoulikeleavingoutRevision1.22005/10/1200:13:37reddawg -YoulikeleavingoutRemoved -Youlikeleavingout -YoulikeleavingoutRevision1.1.1.12005/09/2617:24:40reddawg -Youlikeleavingoutnomessage -Youlikeleavingout -YoulikeleavingoutRevision1.302004/08/1411:23:02reddawg -YoulikeleavingoutChanges -Youlikeleavingout -YoulikeleavingoutRevision1.292004/08/0912:58:05reddawg -Youlikeleavingoutletmeknowwhenyougotthesurce -Youlikeleavingout -YoulikeleavingoutRevision1.282004/08/0117:58:39flameshadow -Youlikeleavingoutchg:fixedstringallocationbuginubixfs_cacheNew() -Youlikeleavingout -YoulikeleavingoutRevision1.272004/07/2817:24:13flameshadow -Youlikeleavingoutchg:nocomment -Youlikeleavingout -YoulikeleavingoutRevision1.262004/07/2817:07:29flameshadow -Youlikeleavingoutchg:re-addedmovingcachednodestothefrontofthelistwhenfound -Youlikeleavingoutadd:addedanassert()inubixfs.c -Youlikeleavingout -YoulikeleavingoutRevision1.252004/07/2719:24:31flameshadow -Youlikeleavingoutchg:reducedthenumberofdebuggingstatementsinthekernel. -Youlikeleavingout -YoulikeleavingoutRevision1.242004/07/2712:02:01reddawg -Youlikeleavingoutchg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch -Youlikeleavingout -YoulikeleavingoutRevision1.232004/07/2709:05:43flameshadow -Youlikeleavingoutchg:fixedfilenotfoundbug.Stillcan'tfindloopingissue -Youlikeleavingout -YoulikeleavingoutRevision1.222004/07/2704:05:20flameshadow -Youlikeleavingoutchg:kindafixedit.Addedbunchesofdebuginfo -Youlikeleavingout -YoulikeleavingoutRevision1.212004/07/2522:21:52flameshadow -Youlikeleavingoutchg:re-enabledkprintf()inubixfs_cacheFind() -Youlikeleavingout -YoulikeleavingoutRevision1.202004/07/2417:19:24flameshadow -Youlikeleavingoutchg:Temporarilydisabledthemovingofthefoundcachenodetothefront -Youlikeleavingoutofthelist.Itseemstocauseproblemslater(racecondition,possibly) -Youlikeleavingout -YoulikeleavingoutRevision1.192004/07/2223:01:51reddawg -YoulikeleavingoutOkcheckinginbeforeIsleep -Youlikeleavingout -YoulikeleavingoutRevision1.182004/07/2219:54:50flameshadow -Youlikeleavingoutchg:worksnow.Thanxubu -Youlikeleavingout -YoulikeleavingoutRevision1.172004/07/2219:01:59flameshadow -Youlikeleavingoutchg:moredirectoryandfilecaching -Youlikeleavingout -YoulikeleavingoutRevision1.162004/07/2216:34:32flameshadow -Youlikeleavingoutadd:fileanddircachingkindawork -Youlikeleavingout -YoulikeleavingoutRevision1.152004/07/2122:43:18flameshadow -Youlikeleavingoutonemoretry -Youlikeleavingout -YoulikeleavingoutRevision1.142004/07/2122:42:25flameshadow -Youlikeleavingouttryitnow -Youlikeleavingout -YoulikeleavingoutRevision1.132004/07/2122:40:27flameshadow -Youlikeleavingoutweird -Youlikeleavingout -YoulikeleavingoutRevision1.122004/07/2122:18:37flameshadow -Youlikeleavingoutchg:renamedsubDirsHead/TailmembersofcacheNodetofileListHead/Tail -Youlikeleavingout -YoulikeleavingoutRevision1.112004/07/2122:12:22flameshadow -Youlikeleavingoutadd:attributestagincacheNode -Youlikeleavingoutadd:settingofattributesinubixfx_cacheNew()andubixfs_cacheFind() -Youlikeleavingout -YoulikeleavingoutRevision1.102004/07/2122:07:18flameshadow -Youlikeleavingoutchg:renamedcachingfunctions(again) -Youlikeleavingout -YoulikeleavingoutRevision1.92004/07/2122:00:04flameshadow -Youlikeleavingoutchg:ubixfws_dirCacheAddnowreturnsapointertothenodeitadded -Youlikeleavingoutchg:minorfixinubixfs_dirCacheFind() +Revision1.112004/07/2122:12:22flameshadow +add:attributestagincacheNode +add:settingofattributesinubixfx_cacheNew()andubixfs_cacheFind() + +Revision1.102004/07/2122:07:18flameshadow +chg:renamedcachingfunctions(again) + +Revision1.92004/07/2122:00:04flameshadow +chg:ubixfws_dirCacheAddnowreturnsapointertothenodeitadded +chg:minorfixinubixfs_dirCacheFind() + +Revision1.62004/07/2114:43:14flameshadow +add:addedcwc(currentworkingcontainer)totheosInfostrut + +Revision1.52004/07/2019:21:30reddawg +Youlikeleavingout$Log:dirCache.c,v$ +YoulikeleavingoutRevision1.1.1.12006/06/0112:46:17reddawg +Youlikeleavingoutubix2 +Youlikeleavingout +YoulikeleavingoutRevision1.22005/10/1200:13:37reddawg +YoulikeleavingoutRemoved +Youlikeleavingout +YoulikeleavingoutRevision1.1.1.12005/09/2617:24:40reddawg +Youlikeleavingoutnomessage +Youlikeleavingout +YoulikeleavingoutRevision1.302004/08/1411:23:02reddawg +YoulikeleavingoutChanges +Youlikeleavingout +YoulikeleavingoutRevision1.292004/08/0912:58:05reddawg +Youlikeleavingoutletmeknowwhenyougotthesurce +Youlikeleavingout +YoulikeleavingoutRevision1.282004/08/0117:58:39flameshadow +Youlikeleavingoutchg:fixedstringallocationbuginubixfs_cacheNew() +Youlikeleavingout +YoulikeleavingoutRevision1.272004/07/2817:24:13flameshadow +Youlikeleavingoutchg:nocomment +Youlikeleavingout +YoulikeleavingoutRevision1.262004/07/2817:07:29flameshadow +Youlikeleavingoutchg:re-addedmovingcachednodestothefrontofthelistwhenfound +Youlikeleavingoutadd:addedanassert()inubixfs.c +Youlikeleavingout +YoulikeleavingoutRevision1.252004/07/2719:24:31flameshadow +Youlikeleavingoutchg:reducedthenumberofdebuggingstatementsinthekernel. +Youlikeleavingout +YoulikeleavingoutRevision1.242004/07/2712:02:01reddawg +Youlikeleavingoutchg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch +Youlikeleavingout +YoulikeleavingoutRevision1.232004/07/2709:05:43flameshadow +Youlikeleavingoutchg:fixedfilenotfoundbug.Stillcan'tfindloopingissue +Youlikeleavingout +YoulikeleavingoutRevision1.222004/07/2704:05:20flameshadow +Youlikeleavingoutchg:kindafixedit.Addedbunchesofdebuginfo +Youlikeleavingout +YoulikeleavingoutRevision1.212004/07/2522:21:52flameshadow +Youlikeleavingoutchg:re-enabledkprintf()inubixfs_cacheFind() +Youlikeleavingout +YoulikeleavingoutRevision1.202004/07/2417:19:24flameshadow +Youlikeleavingoutchg:Temporarilydisabledthemovingofthefoundcachenodetothefront +Youlikeleavingoutofthelist.Itseemstocauseproblemslater(racecondition,possibly) +Youlikeleavingout +YoulikeleavingoutRevision1.192004/07/2223:01:51reddawg +YoulikeleavingoutOkcheckinginbeforeIsleep +Youlikeleavingout +YoulikeleavingoutRevision1.182004/07/2219:54:50flameshadow +Youlikeleavingoutchg:worksnow.Thanxubu +Youlikeleavingout +YoulikeleavingoutRevision1.172004/07/2219:01:59flameshadow +Youlikeleavingoutchg:moredirectoryandfilecaching +Youlikeleavingout +YoulikeleavingoutRevision1.162004/07/2216:34:32flameshadow +Youlikeleavingoutadd:fileanddircachingkindawork +Youlikeleavingout +YoulikeleavingoutRevision1.152004/07/2122:43:18flameshadow +Youlikeleavingoutonemoretry +Youlikeleavingout +YoulikeleavingoutRevision1.142004/07/2122:42:25flameshadow +Youlikeleavingouttryitnow +Youlikeleavingout +YoulikeleavingoutRevision1.132004/07/2122:40:27flameshadow +Youlikeleavingoutweird +Youlikeleavingout +YoulikeleavingoutRevision1.122004/07/2122:18:37flameshadow +Youlikeleavingoutchg:renamedsubDirsHead/TailmembersofcacheNodetofileListHead/Tail Youlikeleavingout -YoulikeleavingoutRevision1.62004/07/2114:43:14flameshadow -Youlikeleavingoutadd:addedcwc(currentworkingcontainer)totheosInfostrut -Youlikeleavingoutsoidon'tknowwhatisgoingoneh? - -END -***/ - - +YoulikeleavingoutRevision1.112004/07/2122:12:22flameshadow +Youlikeleavingoutadd:attributestagincacheNode +Youlikeleavingoutadd:settingofattributesinubixfx_cacheNew()andubixfs_cacheFind() +Youlikeleavingout +YoulikeleavingoutRevision1.102004/07/2122:07:18flameshadow +Youlikeleavingoutchg:renamedcachingfunctions(again) +Youlikeleavingout +YoulikeleavingoutRevision1.92004/07/2122:00:04flameshadow +Youlikeleavingoutchg:ubixfws_dirCacheAddnowreturnsapointertothenodeitadded +Youlikeleavingoutchg:minorfixinubixfs_dirCacheFind() +Youlikeleavingout +YoulikeleavingoutRevision1.62004/07/2114:43:14flameshadow +Youlikeleavingoutadd:addedcwc(currentworkingcontainer)totheosInfostrut +Youlikeleavingoutsoidon'tknowwhatisgoingoneh? + +END +***/ + - + diff --git a/doc/xml/dirCache_8h.xml b/doc/xml/dirCache_8h.xml index 29ca8dc..fea09a4 100644 --- a/doc/xml/dirCache_8h.xml +++ b/doc/xml/dirCache_8h.xml @@ -1,548 +1,1184 @@ - - - + + + dirCache.h - ubixos/types.h - src/sys/include/ubixfs/ubixfs.h - src/sys/include/vfs/file.h - src/sys/ubixfs/dirCache.c - src/sys/ubixfs/ubixfs.c + sys/types.h + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/include/ubixfs/ubixfs.h + C:/Dev/git/UbixOS/sys/include/vfs/file.h - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - - - - - - + + - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cacheNode - - cacheNode * + + struct cacheNode * struct cacheNode* ubixfs_cacheAdd (struct cacheNode *, struct cacheNode *) ubixfs_cacheAdd @@ -558,20 +1194,11 @@ - - assert - dca_spinLock - cacheNode::fileListHead - cacheNode::fileListTail - cacheNode::next - NULL - cacheNode::parent - cacheNode::prev - spinLock - spinUnlock - ubixfs_cacheFind + + assert + spinLock - + void void ubixfs_cacheDelete (struct cacheNode **) @@ -585,18 +1212,18 @@ - - cacheNode::fileListHead - cacheNode::info - kfree - cacheNode::name - cacheNode::next - NULL - ubixfs_cacheDelete - ubixfs_cacheDelete + + cacheNode::fileListHead + cacheNode::info + kfree + cacheNode::name + cacheNode::next + NULL + ubixfs_cacheDelete + ubixfs_cacheDelete - - cacheNode * + + struct cacheNode * struct cacheNode* ubixfs_cacheFind (struct cacheNode *, char *) ubixfs_cacheFind @@ -612,41 +1239,15 @@ - - assert - cacheNode::attributes - dca_spinLock - dirList - cacheNode::fileListHead - cacheNode::fileListTail - cacheNode::info - cacheNode::name - cacheNode::next - NULL - cacheNode::parent - cacheNode::permissions - cacheNode::present - cacheNode::prev - cacheNode::size - spinLock - spinUnlock - cacheNode::startCluster - strcmp - typeFile - ubixfs_cacheAdd - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_findName - openFileUbixFS - ubixfs_cacheFind + - - cacheNode * + + struct cacheNode * struct cacheNode* ubixfs_cacheNew (const char *) ubixfs_cacheNew - const char * + const char * @@ -654,27 +1255,27 @@ - - assert - cacheNode::attributes - cacheNode::dirty - cacheNode::fileListHead - cacheNode::fileListTail - cacheNode::info - kmalloc - cacheNode::name - cacheNode::next - NULL - cacheNode::parent - cacheNode::permissions - cacheNode::present - cacheNode::prev - cacheNode::size - cacheNode::startCluster - strcpy - strlen - ubixfs_cacheFind - ubixfs_initialize + + assert + cacheNode::attributes + cacheNode::dirty + cacheNode::fileListHead + cacheNode::fileListTail + cacheNode::info + kmalloc + cacheNode::name + name + cacheNode::next + NULL + cacheNode::parent + cacheNode::permissions + cacheNode::present + cacheNode::prev + cacheNode::size + cacheNode::startCluster + strcpy + strlen + ubixfs_initialize @@ -682,35 +1283,64 @@ -#ifndefDIRCACHE_H -#defineDIRCACHE_H - -/*#include"ubixfs.h"*/ -#include<ubixos/types.h> - -structcacheNode{ -char*name; -structcacheNode*prev; -structcacheNode*next; -structcacheNode*parent; -structcacheNode*fileListHead; -structcacheNode*fileListTail; -void*info; -int*size; -intpresent; -intdirty; -uInt32*startCluster; -uInt16*attributes; -uInt16*permissions; -};/*cacheNode*/ - -structcacheNode*ubixfs_cacheFind(structcacheNode*,char*); -structcacheNode*ubixfs_cacheNew(constchar*); -voidubixfs_cacheDelete(structcacheNode**); -structcacheNode*ubixfs_cacheAdd(structcacheNode*,structcacheNode*); - -#endif/*!DIRCACHE_H*/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXFS_DIRCACHE_H +#define_UBIXFS_DIRCACHE_H + +/*#include"ubixfs.h"*/ +#include<sys/types.h> + +structcacheNode{ +char*name; +structcacheNode*prev; +structcacheNode*next; +structcacheNode*parent; +structcacheNode*fileListHead; +structcacheNode*fileListTail; +void*info; +int*size; +intpresent; +intdirty; +uInt32*startCluster; +uInt16*attributes; +uInt16*permissions; +}; +/*cacheNode*/ + +structcacheNode*ubixfs_cacheFind(structcacheNode*,char*); +structcacheNode*ubixfs_cacheNew(constchar*); +voidubixfs_cacheDelete(structcacheNode**); +structcacheNode*ubixfs_cacheAdd(structcacheNode*,structcacheNode*); + +#endif/*END_UBIXFS_DIRCACHE_H*/ - + diff --git a/doc/xml/directory_8c.xml b/doc/xml/directory_8c.xml index 6e210d4..e83dfe6 100644 --- a/doc/xml/directory_8c.xml +++ b/doc/xml/directory_8c.xml @@ -1,184 +1,491 @@ - - - + + + directory.c - ubixfs/ubixfs.h - vfs/file.h + ubixfs/ubixfs.h + vfs/file.h vfs/mount.h - ubixos/types.h lib/kmalloc.h lib/kprintf.h - lib/string.h + string.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + - - - - - - - - + + + + - - - - + + + + - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - + + + + - - - - + + + + - - - - - + - - - - - + + + + + + dirList_t + dirList_t dirList + + dirList + = 0x0 + + + + + + + + + - + int int addDirEntry - (struct directoryEntry *dir, fileDescriptor *fd) + (struct directoryEntry *dir, fileDescriptor_t *fd) addDirEntry struct directoryEntry * dir - fileDescriptor * + fileDescriptor_t * fd @@ -187,19 +494,18 @@ - - kmalloc - kprintf - memcpy - fileDescriptorStruct::offset - readUbixFS - fileDescriptorStruct::size - writeUbixFS - x1000 - ubixFSmkDir + + kmalloc + kprintf + memcpy + fileDescriptor::offset + readUbixFS + fileDescriptor::size + writeUbixFS + ubixFSmkDir - - dirList_t + + dirList_t dirList_t ubixFSLoadDir (char *data) ubixFSLoadDir @@ -213,27 +519,22 @@ - - directoryList::dirCache - dirList - directoryList::dirName - kmalloc - directoryList::next - directoryList::prev - sprintf - strcmp + + directoryList::dirName + kmalloc + sprintf - + int int ubixFSmkDir - (char *directory, fileDescriptor *fd) + (char *directory, fileDescriptor_t *fd) ubixFSmkDir char * directory - fileDescriptor * + fileDescriptor_t * fd @@ -242,51 +543,32 @@ - - addDirEntry - directoryEntry::attributes - ubixFSInfo::blockAllocationTable - blockSize - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - directoryEntry::fileName - vfs_mountPoint::fsInfo - getFreeBlocks - device_interface::info - kfree - kmalloc - fileDescriptorStruct::mp - vfs_mountPoint::partition - ubixDiskLabel::partitions - directoryEntry::permissions - blockAllocationTableEntry::realSector - directoryEntry::size - sprintf - directoryEntry::startCluster - typeDirectory - UBIXFS_BLOCKSIZE_BYTES - device_interface::write - ubixfs_init - - - - - dirList_t - dirList_t dirList - - dirList - 0x0 - - - - - - - - ubixfs_cacheFind - ubixfs_findName - ubixFSLoadDir + + addDirEntry + directoryEntry::attributes + ubixFSInfo::blockAllocationTable + blockSize + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + directoryEntry::fileName + vfs_mountPoint::fsInfo + getFreeBlocks + device_interface::info + kfree + kmalloc + fileDescriptor::mp + vfs_mountPoint::partition + ubixDiskLabel::partitions + directoryEntry::permissions + ubixDiskLabel::ubixPartitions::pOffset + blockAllocationTableEntry::realSector + directoryEntry::size + sprintf + directoryEntry::startCluster + typeDirectory + UBIXFS_BLOCKSIZE_BYTES + device_interface::write @@ -319,170 +601,166 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: directory_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:directory.c792016-01-1116:21:27Zreddawg$ *****************************************************************************************/ -#include<ubixfs/ubixfs.h> -#include<vfs/file.h> +#include<ubixfs/ubixfs.h> +#include<vfs/file.h> #include<vfs/mount.h> -#include<ubixos/types.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<lib/string.h> - -staticdirList_tdirList=0x0; - -dirList_t -ubixFSLoadDir(char*data){ -dirList_ttmpDir=0x0; - -tmpDir=(dirList_t)kmalloc(sizeof(structdirectoryList)); - -sprintf(tmpDir->dirName,"%s",data); - -if(0x0==dirList){ -dirList=tmpDir; -} -else{ -tmpDir->next=dirList; -tmpDir->prev=0x0; -dirList->prev=tmpDir; -dirList=tmpDir; -} - -if(!strcmp(":",data)){ -tmpDir->dirCache=(char*)kmalloc(0x4000); -} - -return(tmpDir); -} - -int -addDirEntry(structdirectoryEntry*dir,fileDescriptor*fd){ -uInt32i=0x0; -uInt32entries=0x0; -structdirectoryEntry*tmp=0x0; - -tmp=(structdirectoryEntry*)kmalloc(fd->size); - -readUbixFS(fd,(char*)tmp,fd->offset,fd->size); -entries=fd->size/sizeof(structdirectoryEntry); -for(i=0;(tmp[i].attributes!=0x0)&&(i<entries);i++); - -if(i==entries){ -tmp=(structdirectoryEntry*)kmalloc(0x1000); -i=0x0; -} -else{ -fd->offset=0x0; -} -memcpy(&tmp[i],dir,sizeof(structdirectoryEntry)); - -if(writeUbixFS(fd,(char*)tmp,fd->offset,fd->size)==0x0){ -kprintf("ErrorCreatingDirectory\n"); -} - -return(0x0); -} - -int -ubixFSmkDir(char*directory,fileDescriptor*fd){ -intblock=0x0; - -structdirectoryEntry*dir=0x0; -structdirectoryEntry*entry=0x0; -structubixFSInfo*fsInfo=fd->mp->fsInfo; - -//kprintf("CreatingDirectory:%s",directory); - -block=getFreeBlocks(1,fd); -if(block!=0x0){ -dir=(structdirectoryEntry*)kmalloc(UBIXFS_BLOCKSIZE_BYTES); -entry=(structdirectoryEntry*)kmalloc(sizeof(structdirectoryEntry)); - -entry->startCluster=block; -entry->size=UBIXFS_BLOCKSIZE_BYTES; -entry->attributes=typeDirectory; -entry->permissions=0xEAA; -sprintf(entry->fileName,directory); - -//dir->attributes=typeDirectory; -//sprintf(dir->fileName,"TestEntry"); - -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info, -dir, -fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector, -blockSize); -addDirEntry(entry,fd); -kfree(dir); -kfree(entry); -} - -return(0x0); -} - -/*** -$Log: directory_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:17reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:41reddawg -nomessage - -Revision1.122004/08/1411:23:02reddawg -Changes - -Revision1.112004/08/0117:58:39flameshadow -chg:fixedstringallocationbuginubixfs_cacheNew() - -Revision1.102004/07/2309:10:06reddawg -ubixfs:cleanedupsomefunctionsplayedwiththecachingabit -vfs:renamedabunchoffunctions -cleanedupafewmiscbugs - -Revision1.92004/07/1620:17:29flameshadow -chg:broketheufsstuff -chg:changedvfsRegisterFS()toacceptafileSystemstruct -chg:modifiedcallstovfsRegisterFS()topassfileSystemstruct - -Revision1.82004/06/2903:59:47reddawg -Fixedafewissueswithsubdirectoriestheyareworkingmuchbetternow - -Revision1.72004/06/2823:12:58reddawg -fileformatnowcontainer:/path/to/file - -Revision1.62004/06/0413:20:22reddawg -ubixFSmkDir():playedwithitabittoseeifitstillworked - -Revision1.52004/06/0410:19:42reddawg -notes:wecompileagain,thankg-danywaysiwasabouttocry - -Revision1.42004/05/1915:20:06reddawg -Fixedreferenceproblemsduetochangesindrivesubsystem - -Revision1.32004/05/1904:07:43reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.22004/04/2802:22:55reddawg -Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel -allaround - -Revision1.1.1.12004/04/1512:07:07reddawg -UbixOSv1.0 - -Revision1.62004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<string.h> + +staticdirList_tdirList=0x0; + +dirList_t +ubixFSLoadDir(char*data){ +dirList_ttmpDir=0x0; + +tmpDir=(dirList_t)kmalloc(sizeof(structdirectoryList)); + +sprintf(tmpDir->dirName,"%s",data); + +if(0x0==dirList){ +dirList=tmpDir; +} +else{ +tmpDir->next=dirList; +tmpDir->prev=0x0; +dirList->prev=tmpDir; +dirList=tmpDir; +} + +if(!strcmp(":",data)){ +tmpDir->dirCache=(char*)kmalloc(0x4000); +} + +return(tmpDir); +} + +int +addDirEntry(structdirectoryEntry*dir,fileDescriptor_t*fd){ +uInt32i=0x0; +uInt32entries=0x0; +structdirectoryEntry*tmp=0x0; + +tmp=(structdirectoryEntry*)kmalloc(fd->size); + +readUbixFS(fd,(char*)tmp,fd->offset,fd->size); +entries=fd->size/sizeof(structdirectoryEntry); +for(i=0;(tmp[i].attributes!=0x0)&&(i<entries);i++); + +if(i==entries){ +tmp=(structdirectoryEntry*)kmalloc(0x1000); +i=0x0; +} +else{ +fd->offset=0x0; +} +memcpy(&tmp[i],dir,sizeof(structdirectoryEntry)); + +if(writeUbixFS(fd,(char*)tmp,fd->offset,fd->size)==0x0){ +kprintf("ErrorCreatingDirectory\n"); +} + +return(0x0); +} + +int +ubixFSmkDir(char*directory,fileDescriptor_t*fd){ +intblock=0x0; + +structdirectoryEntry*dir=0x0; +structdirectoryEntry*entry=0x0; +structubixFSInfo*fsInfo=fd->mp->fsInfo; + +//kprintf("CreatingDirectory:%s",directory); + +block=getFreeBlocks(1,fd); +if(block!=0x0){ +dir=(structdirectoryEntry*)kmalloc(UBIXFS_BLOCKSIZE_BYTES); +entry=(structdirectoryEntry*)kmalloc(sizeof(structdirectoryEntry)); + +entry->startCluster=block; +entry->size=UBIXFS_BLOCKSIZE_BYTES; +entry->attributes=typeDirectory; +entry->permissions=0xEAA; +sprintf(entry->fileName,directory); + +//dir->attributes=typeDirectory; +//sprintf(dir->fileName,"TestEntry"); + +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info, +dir, +fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector, +blockSize); +addDirEntry(entry,fd); +kfree(dir); +kfree(entry); +} + +return(0x0); +} + +/*** +$Log:directory.c,v$ +Revision1.1.1.12006/06/0112:46:17reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:41reddawg +nomessage + +Revision1.122004/08/1411:23:02reddawg +Changes + +Revision1.112004/08/0117:58:39flameshadow +chg:fixedstringallocationbuginubixfs_cacheNew() + +Revision1.102004/07/2309:10:06reddawg +ubixfs:cleanedupsomefunctionsplayedwiththecachingabit +vfs:renamedabunchoffunctions +cleanedupafewmiscbugs + +Revision1.92004/07/1620:17:29flameshadow +chg:broketheufsstuff +chg:changedvfsRegisterFS()toacceptafileSystemstruct +chg:modifiedcallstovfsRegisterFS()topassfileSystemstruct + +Revision1.82004/06/2903:59:47reddawg +Fixedafewissueswithsubdirectoriestheyareworkingmuchbetternow + +Revision1.72004/06/2823:12:58reddawg +fileformatnowcontainer:/path/to/file + +Revision1.62004/06/0413:20:22reddawg +ubixFSmkDir():playedwithitabittoseeifitstillworked + +Revision1.52004/06/0410:19:42reddawg +notes:wecompileagain,thankg-danywaysiwasabouttocry + +Revision1.42004/05/1915:20:06reddawg +Fixedreferenceproblemsduetochangesindrivesubsystem + +Revision1.32004/05/1904:07:43reddawg +kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen + +Revision1.22004/04/2802:22:55reddawg +Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel +allaround + +Revision1.1.1.12004/04/1512:07:07reddawg +UbixOSv1.0 + +Revision1.62004/04/1316:36:34reddawg +Changedourcopyright,itisallnowunderaBSD-Stylelicense + +END +***/ - + diff --git a/doc/xml/divdi3_8c.xml b/doc/xml/divdi3_8c.xml index 3fe609f..e078e76 100644 --- a/doc/xml/divdi3_8c.xml +++ b/doc/xml/divdi3_8c.xml @@ -1,44 +1,82 @@ - - - + + + divdi3.c math.h - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - quad_t + + quad_t quad_t __divdi3 (quad_t a, quad_t b) __divdi3 - quad_t + quad_t a - quad_t + quad_t b @@ -47,19 +85,19 @@ - + - - u_quad_t + + u_quad_t u_quad_t __udivdi3 (u_quad_t a, u_quad_t b) __udivdi3 - u_quad_t + u_quad_t a - u_quad_t + u_quad_t b @@ -68,7 +106,7 @@ - + @@ -76,72 +114,68 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: divdi3_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<math.h> - -u_quad_t__udivdi3(u_quad_ta,u_quad_tb){ -return(0);/*QuickHack*/ -} - -quad_t__divdi3(quad_ta,quad_tb){ -return(0);/*QuickHack*/ -} - -/*** -$Log: divdi3_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:10reddawg -nomessage - -Revision1.22004/05/1903:46:32reddawg -AFewQuickHacksToMakeThingsWork - -Revision1.1.1.12004/04/1512:07:10reddawg -UbixOSv1.0 - -Revision1.22004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<math.h> + +u_quad_t__udivdi3(u_quad_ta,u_quad_tb){ +return(0);/*QuickHack*/ +} + +quad_t__divdi3(quad_ta,quad_tb){ +return(0);/*QuickHack*/ +} + +/*** +$Log:divdi3.c,v$ +Revision1.1.1.12006/06/0112:46:16reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:10reddawg +nomessage + +Revision1.22004/05/1903:46:32reddawg +AFewQuickHacksToMakeThingsWork + +Revision1.1.1.12004/04/1512:07:10reddawg +UbixOSv1.0 + +Revision1.22004/04/1316:36:33reddawg +Changedourcopyright,itisallnowunderaBSD-Stylelicense + +END +***/ + - + diff --git a/doc/xml/dma_8c.xml b/doc/xml/dma_8c.xml index 0128b05..3dceb24 100644 --- a/doc/xml/dma_8c.xml +++ b/doc/xml/dma_8c.xml @@ -1,44 +1,79 @@ - - - + + + dma.c sys/dma.h sys/io.h - ubixos/types.h - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + highByte x ((x & 0xFF00) >> 8) @@ -48,10 +83,9 @@ - - _dmaXfer + - + lowByte x (x & 0x00FF) @@ -61,34 +95,119 @@ - - _dmaXfer + + + + + + uInt8 + uInt8 addrPort[8] + [8] + addrPort + = { 0x00, 0x02, 0x04, 0x06, 0xC0, 0xC4, 0xC8, 0xCC } + + + + + + + + + + uInt8 + uInt8 clearReg[8] + [8] + clearReg + = { 0x0C, 0x0C, 0x0C, 0x0C, 0xD8, 0xD8, 0xD8, 0xD8 } + + + + + + + + + + uInt8 + uInt8 countPort[8] + [8] + countPort + = { 0x01, 0x03, 0x05, 0x07, 0xC2, 0xC6, 0xCA, 0xCE } + + + + + + + + + + uInt8 + uInt8 maskReg[8] + [8] + maskReg + = { 0x0A, 0x0A, 0x0A, 0x0A, 0xD4, 0xD4, 0xD4, 0xD4 } + + + + + + + + + + uInt8 + uInt8 modeReg[8] + [8] + modeReg + = { 0x0B, 0x0B, 0x0B, 0x0B, 0xD6, 0xD6, 0xD6, 0xD6 } + + + + + + + + + + uInt8 + uInt8 pagePort[8] + [8] + pagePort + = { 0x87, 0x83, 0x81, 0x82, 0x8F, 0x8B, 0x89, 0x8A } + + + + + + + - + void void _dmaXfer (uInt8 dmaChannel, uInt8 page, uInt offset, uInt length, uInt8 mode) _dmaXfer - uInt8 + uInt8 dmaChannel - uInt8 + uInt8 page - uInt + uInt offset - uInt + uInt length - uInt8 + uInt8 mode @@ -97,37 +216,29 @@ - - addrPort - clearReg - countPort - highByte - lowByte - maskReg - modeReg - outportByte - pagePort - dmaXfer + + outportByte + dmaXfer - + void void dmaXfer - (uInt8 channel, uInt32 address, uInt length, uInt8 read) + (uint8_t channel, uint32_t address, uInt length, uint8_t read) dmaXfer - uInt8 + uint8_t channel - uInt32 + uint32_t address - uInt + uInt length - uInt8 + uint8_t read @@ -136,101 +247,9 @@ - - _dmaXfer - fdcRw - - - - - uInt8 - uInt8 addrPort[8] - [8] - addrPort - { 0x00, 0x02, 0x04, 0x06, 0xC0, 0xC4, 0xC8, 0xCC } - - - - - - - - _dmaXfer - - - uInt8 - uInt8 clearReg[8] - [8] - clearReg - { 0x0C, 0x0C, 0x0C, 0x0C, 0xD8, 0xD8, 0xD8, 0xD8 } - - - - - - - - _dmaXfer - - - uInt8 - uInt8 countPort[8] - [8] - countPort - { 0x01, 0x03, 0x05, 0x07, 0xC2, 0xC6, 0xCA, 0xCE } - - - - - - - - _dmaXfer - - - uInt8 - uInt8 maskReg[8] - [8] - maskReg - { 0x0A, 0x0A, 0x0A, 0x0A, 0xD4, 0xD4, 0xD4, 0xD4 } - - - - - - - - _dmaXfer - - - uInt8 - uInt8 modeReg[8] - [8] - modeReg - { 0x0B, 0x0B, 0x0B, 0x0B, 0xD6, 0xD6, 0xD6, 0xD6 } - - - - - - - - _dmaXfer - - - uInt8 - uInt8 pagePort[8] - [8] - pagePort - { 0x87, 0x83, 0x81, 0x82, 0x8F, 0x8B, 0x89, 0x8A } - - - - - - - - _dmaXfer + + _dmaXfer + read @@ -238,82 +257,76 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: dma_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<sys/dma.h> -#include<sys/io.h> -#include<ubixos/types.h> - -#definelowByte(x)(x&0x00FF) -#definehighByte(x)((x&0xFF00)>>8) - -staticuInt8maskReg[8]={0x0A,0x0A,0x0A,0x0A,0xD4,0xD4,0xD4,0xD4}; -staticuInt8clearReg[8]={0x0C,0x0C,0x0C,0x0C,0xD8,0xD8,0xD8,0xD8}; -staticuInt8modeReg[8]={0x0B,0x0B,0x0B,0x0B,0xD6,0xD6,0xD6,0xD6}; -staticuInt8addrPort[8]={0x00,0x02,0x04,0x06,0xC0,0xC4,0xC8,0xCC}; -staticuInt8pagePort[8]={0x87,0x83,0x81,0x82,0x8F,0x8B,0x89,0x8A}; -staticuInt8countPort[8]={0x01,0x03,0x05,0x07,0xC2,0xC6,0xCA,0xCE}; - -voiddmaXfer(uInt8channel,uInt32address,uIntlength,uInt8read){ -unsignedcharpage=0,mode=0; -unsignedintoffset=0; -if(read){ -mode=0x48+channel; -} -else{ -mode=0x44+channel; -} -page=address>>16; -offset=address&0xFFFF; -length--; -_dmaXfer(channel,page,offset,length,mode); -} - -void_dmaXfer(uInt8dmaChannel,uInt8page,uIntoffset,uIntlength,uInt8mode){ -//asm("cli"); -outportByte(maskReg[dmaChannel],0x04|dmaChannel); -outportByte(clearReg[dmaChannel],0x00); -outportByte(modeReg[dmaChannel],mode); -outportByte(addrPort[dmaChannel],lowByte(offset)); -outportByte(addrPort[dmaChannel],highByte(offset)); -outportByte(pagePort[dmaChannel],page); -outportByte(countPort[dmaChannel],lowByte(length)); -outportByte(countPort[dmaChannel],highByte(length)); -outportByte(maskReg[dmaChannel],dmaChannel); -//asm("sti"); -} - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/dma.h> +#include<sys/io.h> + +#definelowByte(x)(x&0x00FF) +#definehighByte(x)((x&0xFF00)>>8) + +staticuInt8maskReg[8]={0x0A,0x0A,0x0A,0x0A,0xD4,0xD4,0xD4,0xD4}; +staticuInt8clearReg[8]={0x0C,0x0C,0x0C,0x0C,0xD8,0xD8,0xD8,0xD8}; +staticuInt8modeReg[8]={0x0B,0x0B,0x0B,0x0B,0xD6,0xD6,0xD6,0xD6}; +staticuInt8addrPort[8]={0x00,0x02,0x04,0x06,0xC0,0xC4,0xC8,0xCC}; +staticuInt8pagePort[8]={0x87,0x83,0x81,0x82,0x8F,0x8B,0x89,0x8A}; +staticuInt8countPort[8]={0x01,0x03,0x05,0x07,0xC2,0xC6,0xCA,0xCE}; + +voiddmaXfer(uint8_tchannel,uint32_taddress,uIntlength,uint8_tread){ +unsignedcharpage=0,mode=0; +unsignedintoffset=0; +if(read){ +mode=0x48+channel; +} +else{ +mode=0x44+channel; +} +page=address>>16; +offset=address&0xFFFF; +length--; +_dmaXfer(channel,page,offset,length,mode); +} + +void_dmaXfer(uInt8dmaChannel,uInt8page,uIntoffset,uIntlength,uInt8mode){ +//asm("cli"); +outportByte(maskReg[dmaChannel],0x04|dmaChannel); +outportByte(clearReg[dmaChannel],0x00); +outportByte(modeReg[dmaChannel],mode); +outportByte(addrPort[dmaChannel],lowByte(offset)); +outportByte(addrPort[dmaChannel],highByte(offset)); +outportByte(pagePort[dmaChannel],page); +outportByte(countPort[dmaChannel],lowByte(length)); +outportByte(countPort[dmaChannel],highByte(length)); +outportByte(maskReg[dmaChannel],dmaChannel); +//asm("sti"); +} - + diff --git a/doc/xml/dma_8h.xml b/doc/xml/dma_8h.xml index 85b4f6a..879979f 100644 --- a/doc/xml/dma_8h.xml +++ b/doc/xml/dma_8h.xml @@ -1,70 +1,108 @@ - - - + + + dma.h - ubixos/types.h - src/sys/isa/fdc.c - src/sys/sys/dma.c + sys/types.h + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/sys/dma.c - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + - - + + + + + + + + + + - + void void _dmaXfer (uInt8 dmaChannel, uInt8 page, uInt offset, uInt length, uInt8 mode) _dmaXfer - uInt8 + uInt8 dmaChannel - uInt8 + uInt8 page - uInt + uInt offset - uInt + uInt length - uInt8 + uInt8 mode @@ -73,37 +111,29 @@ - - addrPort - clearReg - countPort - highByte - lowByte - maskReg - modeReg - outportByte - pagePort - dmaXfer + + outportByte + dmaXfer - + void void dmaXfer (uInt8 channel, uInt32 address, uInt length, uInt8 read) dmaXfer - uInt8 + uInt8 channel - uInt32 + uInt32 address - uInt + uInt length - uInt8 + uInt8 read @@ -112,9 +142,7 @@ - - _dmaXfer - fdcRw + @@ -122,66 +150,44 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: dma_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_DMA_H -#define_DMA_H - -#include<ubixos/types.h> - -voiddmaXfer(uInt8channel,uInt32address,uIntlength,uInt8read); -void_dmaXfer(uInt8dmaChannel,uInt8page,uIntoffset,uIntlength,uInt8mode); - -#endif - -/*** -$Log: dma_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:52reddawg -nomessage - -Revision1.32004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_DMA_H +#define_SYS_DMA_H + +#include<sys/types.h> + +voiddmaXfer(uInt8channel,uInt32address,uIntlength,uInt8read); +void_dmaXfer(uInt8dmaChannel,uInt8page,uIntoffset,uIntlength,uInt8mode); + +#endif/*END_SYS_DMA_H*/ - + diff --git a/doc/xml/driver_8h.xml b/doc/xml/driver_8h.xml index debabf2..6bb3c4c 100644 --- a/doc/xml/driver_8h.xml +++ b/doc/xml/driver_8h.xml @@ -1,31 +1,69 @@ - - - + + + driver.h - ubixos/types.h + sys/types.h - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + devMethodType driverType - - devMethodType + + struct devMethodType typedef struct devMethodType devMethod devMethod @@ -35,7 +73,7 @@ - + @@ -43,77 +81,51 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: driver_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_DRIVER_H -#define_DRIVER_H - -#include<ubixos/types.h> - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_DRIVER_H +#define_SYS_DRIVER_H + +#include<sys/types.h> + +typedefstructdevMethodTypedevMethod; -typedefstructdevMethodTypedevMethod; - -structdevMethodType{ -}; - -structdriverType{ -constchar*devName; -devMethod*methods; -} - - - - -#endif - -/*** -$Log: driver_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:52reddawg -nomessage - -Revision1.22004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +structdevMethodType{ +}; + +structdriverType{ +constchar*devName; +devMethod*methods; +} + +#endif/*END_SYS_DRIVER_H*/ - + diff --git a/doc/xml/endtask_8c.xml b/doc/xml/endtask_8c.xml index 72b810a..32e1830 100644 --- a/doc/xml/endtask_8c.xml +++ b/doc/xml/endtask_8c.xml @@ -1,191 +1,469 @@ - - - + + + endtask.c - ubixos/types.h + sys/types.h ubixos/sched.h ubixos/vitals.h vmm/vmm.h lib/kprintf.h isa/8259.h - - - - + + + + + + - - - - - - - - - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void endTask (pidType pid) endTask - pidType + pidType pid @@ -194,28 +472,23 @@ - - _current - DEAD - taskStruct::id - sched_setStatus - sched_yield - __sysctl - _int0 - _int1 - _int10 - _int11 - _int12 - _int2 - _int3 - _int4 - _int5 - _int6 - _int9 - schedEndTask - sysExec - sysExit - vmm_pageFault + + DEAD + sched_setStatus + sched_yield + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __machineCheck + __nmi + __security + __simd + __virtualization + schedEndTask + sys_exit + sysExec @@ -223,79 +496,58 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: endtask_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<ubixos/sched.h> -#include<ubixos/vitals.h> -#include<vmm/vmm.h> -#include<lib/kprintf.h> -#include<isa/8259.h> - -/************************************************************************ - -Function:endTask(pidTypepid) - -Description:Thiswilldocleanupforanendingtask - -Notes: - -************************************************************************/ -voidendTask(pidTypepid){ -//kTask_t*tmpTask=0x0; - -/*Don'tmesswithschedulerstructuresfromoutsidethescheduler!*/ -/*Justsetstatustodead,andlettheschedulercleanupitself*/ -sched_setStatus(pid,DEAD); -//tmpTask=schedFindTask(pid); -//if(sched_deleteTask(pid)!=0x0) -//kpanic("sched_deleteTask:Failed\n"); -//kprintf("EndingTask:(%i:0x%X)\n",tmpTask->id,tmpTask); -//sched_addDelTask(tmpTask); -//tmpTask->state=DEAD; - -//tmpTask->term->owner=tmpTask->parentPid; - -if(pid==_current->id) -while(1) -sched_yield(); -sched_yield(); - -return; -} - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/types.h> +#include<ubixos/sched.h> +#include<ubixos/vitals.h> +#include<vmm/vmm.h> +#include<lib/kprintf.h> +#include<isa/8259.h> + +/************************************************************************ + +Function:endTask(pidTypepid) + +Description:Thiswilldocleanupforanendingtask + +Notes: + +************************************************************************/ +voidendTask(pidTypepid){ +sched_setStatus(pid,DEAD); +sched_yield(); +while(1) +asm("hlt"); + +} - + diff --git a/doc/xml/endtask_8h.xml b/doc/xml/endtask_8h.xml index b1caff2..469e03f 100644 --- a/doc/xml/endtask_8h.xml +++ b/doc/xml/endtask_8h.xml @@ -1,160 +1,316 @@ - - - + + + endtask.h - ubixos/types.h + sys/types.h ubixos/sched.h - src/sys/isa/atkbd.c - src/sys/kernel/exec.c - src/sys/kernel/kern_descrip.c - src/sys/kernel/kern_sig.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/sched.c - src/sys/kernel/syscall.c - src/sys/kernel/syscall_new.c - src/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/trap.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/kernel/descrip.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_sig.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/sys/idt.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + - + - + - + - + - - - - - - - - - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - + - + - - - - + + + + - - - - + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - - - - - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void endTask (pidType) endTask - pidType + pidType @@ -162,28 +318,23 @@ - - _current - DEAD - taskStruct::id - sched_setStatus - sched_yield - __sysctl - _int0 - _int1 - _int10 - _int11 - _int12 - _int2 - _int3 - _int4 - _int5 - _int6 - _int9 - schedEndTask - sysExec - sysExit - vmm_pageFault + + DEAD + sched_setStatus + sched_yield + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __machineCheck + __nmi + __security + __simd + __virtualization + schedEndTask + sys_exit + sysExec @@ -191,69 +342,44 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: endtask_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_ENDTASK_H -#define_ENDTASK_H - -#include<ubixos/types.h> -#include<ubixos/sched.h> - -voidendTask(pidType); - -#endif - -/*** -$Log: endtask_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.22006/10/3120:41:16reddawg -Includes - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:54reddawg -nomessage - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_ENDTASK_H +#define_UBIXOS_ENDTASK_H + +#include<sys/types.h> +#include<ubixos/sched.h> + +voidendTask(pidType); + +#endif/*END_UBIXOS_ENDTASK_H*/ - + diff --git a/doc/xml/err_8c.xml b/doc/xml/err_8c.xml index a7b4730..a7aac59 100644 --- a/doc/xml/err_8c.xml +++ b/doc/xml/err_8c.xml @@ -1,112 +1,515 @@ - - - + + + err.c - net/err.h + net/err.h + net/def.h + net/sys.h + net/errno.h - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + - + - - - + - - - + + + + + - - - + + + + + + + + + + + + + + + + + + + + const int + const int err_to_errno_table[] + [] + err_to_errno_table + = { + 0, + ENOMEM, + ENOBUFS, + EWOULDBLOCK, + EHOSTUNREACH, + EINPROGRESS, + EINVAL, + EWOULDBLOCK, + EADDRINUSE, + EALREADY, + EISCONN, + ENOTCONN, + -1, + ECONNABORTED, + ECONNRESET, + ENOTCONN, + EIO +} + + + +Table to quickly map an lwIP error (err_t) to a socket error by using -err as an index + + + + + + + int + int errno + + errno + + + + + + + + + + + + int + int err_to_errno + (err_t err) + err_to_errno + + err_t + err + + + + + + + + + LWIP_ARRAYSIZE + + +Error Management module -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. * -*$Id: err_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -#include"net/err.h" - -#ifdefLWIP_DEBUG - -staticchar*err_strerr[]={"Ok.", -"Outofmemoryerror.", -"Buffererror.", -"Connectionaborted.", -"Connectionreset.", -"Connectionclosed.", -"Notconnected.", -"Illegalvalue.", -"Illegalargument.", -"Routingproblem.", -"Addressinuse." -}; - -/*-----------------------------------------------------------------------------------*/ -char* -lwip_strerr(err_terr) -{ -returnerr_strerr[-err]; - -} -/*-----------------------------------------------------------------------------------*/ - -#endif/*LWIP_DEBUG*/ +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ + +#include<net/err.h> +#include<net/def.h> +#include<net/sys.h> + +#include<net/errno.h> + +interrno; + +#if!NO_SYS + +staticconstinterr_to_errno_table[]={ +0,/*ERR_OK0Noerror,everythingOK.*/ +ENOMEM,/*ERR_MEM-1Outofmemoryerror.*/ +ENOBUFS,/*ERR_BUF-2Buffererror.*/ +EWOULDBLOCK,/*ERR_TIMEOUT-3Timeout*/ +EHOSTUNREACH,/*ERR_RTE-4Routingproblem.*/ +EINPROGRESS,/*ERR_INPROGRESS-5Operationinprogress*/ +EINVAL,/*ERR_VAL-6Illegalvalue.*/ +EWOULDBLOCK,/*ERR_WOULDBLOCK-7Operationwouldblock.*/ +EADDRINUSE,/*ERR_USE-8Addressinuse.*/ +EALREADY,/*ERR_ALREADY-9Alreadyconnecting.*/ +EISCONN,/*ERR_ISCONN-10Connalreadyestablished.*/ +ENOTCONN,/*ERR_CONN-11Notconnected.*/ +-1,/*ERR_IF-12Low-levelnetiferror*/ +ECONNABORTED,/*ERR_ABRT-13Connectionaborted.*/ +ECONNRESET,/*ERR_RST-14Connectionreset.*/ +ENOTCONN,/*ERR_CLSD-15Connectionclosed.*/ +EIO/*ERR_ARG-16Illegalargument.*/ +}; + +int +err_to_errno(err_terr) +{ +if((err>0)||(-err>=(err_t)LWIP_ARRAYSIZE(err_to_errno_table))){ +returnEIO; +} +returnerr_to_errno_table[-err]; +} +#endif/*!NO_SYS*/ + +#ifdefLWIP_DEBUG + +staticconstchar*err_strerr[]={ +"Ok.",/*ERR_OK0*/ +"Outofmemoryerror.",/*ERR_MEM-1*/ +"Buffererror.",/*ERR_BUF-2*/ +"Timeout.",/*ERR_TIMEOUT-3*/ +"Routingproblem.",/*ERR_RTE-4*/ +"Operationinprogress.",/*ERR_INPROGRESS-5*/ +"Illegalvalue.",/*ERR_VAL-6*/ +"Operationwouldblock.",/*ERR_WOULDBLOCK-7*/ +"Addressinuse.",/*ERR_USE-8*/ +"Alreadyconnecting.",/*ERR_ALREADY-9*/ +"Alreadyconnected.",/*ERR_ISCONN-10*/ +"Notconnected.",/*ERR_CONN-11*/ +"Low-levelnetiferror.",/*ERR_IF-12*/ +"Connectionaborted.",/*ERR_ABRT-13*/ +"Connectionreset.",/*ERR_RST-14*/ +"Connectionclosed.",/*ERR_CLSD-15*/ +"Illegalargument."/*ERR_ARG-16*/ +}; + +constchar* +lwip_strerr(err_terr) +{ +if((err>0)||(-err>=(err_t)LWIP_ARRAYSIZE(err_strerr))){ +return"Unknownerror."; +} +returnerr_strerr[-err]; +} + +#endif/*LWIP_DEBUG*/ - + diff --git a/doc/xml/err_8h.xml b/doc/xml/err_8h.xml index 152d347..6e3b2c1 100644 --- a/doc/xml/err_8h.xml +++ b/doc/xml/err_8h.xml @@ -1,412 +1,754 @@ - - - + + + err.h - ubixos/types.h - net/debug.h - net/arch/cc.h - src/sys/include/net/api.h - src/sys/include/net/ipv4/ip.h - src/sys/include/net/netif.h - src/sys/include/net/tcp.h - src/sys/include/net/udp.h - src/sys/net/api/err.c + net/opt.h + net/arch.h + C:/Dev/git/UbixOS/sys/include/net/ip.h + C:/Dev/git/UbixOS/sys/include/net/ip4_frag.h + C:/Dev/git/UbixOS/sys/include/net/netif.h + C:/Dev/git/UbixOS/sys/include/net/pbuf.h + C:/Dev/git/UbixOS/sys/include/net/sys.h + C:/Dev/git/UbixOS/sys/include/net/tcpip.h + C:/Dev/git/UbixOS/sys/include/net/timeouts.h + C:/Dev/git/UbixOS/sys/net/api/err.c + C:/Dev/git/UbixOS/sys/net/core/mem.c - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - + - - - + + + + + - - - + + + + + - - + + - - - - + + + + + + + + - + - + - - - - - - - - - + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - + + + + + + + + + + + + + + + + - + - - - + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - ERR_ABRT - -3 + + ERR_IS_FATAL + e + ((e) <= ERR_ABRT) - + - - ERR_ARG - -8 - - - - - - - - lwip_send - lwip_write - - - ERR_BUF - -2 - - - - - - - - netbuf_data - - - ERR_CLSD - -5 - - - - - - - - - - ERR_CONN - -6 - - - - - - - - netconn_recv - - - ERR_MEM - -1 - - - - - - - - accept_function - do_connect - do_listen - ethernetif_output - loopif_output - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_recv - netconn_send - netconn_write - tcpip_input - - - ERR_OK - 0 - - - - - - - - accept_function - do_connected - do_delconn - do_write - loopif_output - low_level_output - lwip_bind - lwip_connect - lwip_listen - lwip_send - lwip_write - netbuf_data - netconn_addr - netconn_delete - netconn_peer - netconn_recv - netconn_send - netconn_write - poll_tcp - recv_tcp - sent_tcp - tcpip_input - - - ERR_RST - -4 - - - - - - - - - - ERR_RTE - -9 - - - - - - - - - - ERR_USE - -10 - - - - - - - - - - ERR_VAL - -7 - - - - - - - - do_connected - do_write - netconn_bind - netconn_close - netconn_connect - netconn_listen - netconn_send - netconn_write - recv_tcp - - + lwip_strerr x "" @@ -416,103 +758,320 @@ - + + + + + + + err_enum_t + + ERR_OK + = 0 + + + +No error, everything OK. + + + + ERR_MEM + = -1 + + + +Out of memory error. + + + + + ERR_BUF + = -2 + + + +Buffer error. + + + + + ERR_TIMEOUT + = -3 + + + +Timeout. + + + + + ERR_RTE + = -4 + + + +Routing problem. + + + + + ERR_INPROGRESS + = -5 + + + +Operation in progress + + + + + ERR_VAL + = -6 + + + +Illegal value. + + + + + ERR_WOULDBLOCK + = -7 + + + +Operation would block. + + + + + ERR_USE + = -8 + + + +Address in use. + + + + + ERR_ALREADY + = -9 + + + +Already connecting. + + + + + ERR_ISCONN + = -10 + + + +Conn already established. + + + + ERR_CONN + = -11 + + + +Not connected. + + + + + ERR_IF + = -12 + + + +Low-level netif error + + + + + ERR_ABRT + = -13 + + + +Connection aborted. + + + + + ERR_RST + = -14 + + + +Connection reset. + + + + + ERR_CLSD + = -15 + + + +Connection closed. + + + + + ERR_ARG + = -16 + + + +Illegal argument. + + + + + + +Definitions for error constants. + + + + - - Int8 - typedef Int8 err_t + + s8_t + typedef s8_t err_t err_t +Define LWIP_ERR_T in cc.h if you want to use a different type for your platform (must be signed). + + + + + + + + + int + int err_to_errno + (err_t err) + err_to_errno + + err_t + err + + + + - + + LWIP_ARRAYSIZE +lwIP Error codes -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. * -*$Id: err_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_ERR_H__ -#define__LWIP_ERR_H__ - -#include<ubixos/types.h> - -#include"net/debug.h" +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_ERR_H +#defineLWIP_HDR_ERR_H + +#include<net/opt.h> +#include<net/arch.h> -#include"net/arch/cc.h" - -typedefInt8err_t; +#ifdef__cplusplus +extern"C"{ +#endif -/*Definitionsforerrorconstants.*/ - -#defineERR_OK0/*Noerror,everythingOK.*/ -#defineERR_MEM-1/*Outofmemoryerror.*/ -#defineERR_BUF-2/*Buffererror.*/ - - -#defineERR_ABRT-3/*Connectionaborted.*/ -#defineERR_RST-4/*Connectionreset.*/ -#defineERR_CLSD-5/*Connectionclosed.*/ -#defineERR_CONN-6/*Notconnected.*/ - -#defineERR_VAL-7/*Illegalvalue.*/ +#ifdefLWIP_ERR_T +typedefLWIP_ERR_Terr_t; +#else/*LWIP_ERR_T*/ +typedefs8_terr_t; +#endif/*LWIP_ERR_T*/ -#defineERR_ARG-8/*Illegalargument.*/ - -#defineERR_RTE-9/*Routingproblem.*/ - -#defineERR_USE-10/*Addressinuse.*/ - - - -#ifdefLWIP_DEBUG -externchar*lwip_strerr(err_terr); -#else -#definelwip_strerr(x)"" -#endif/*LWIP_DEBUG*/ -#endif/*__LWIP_ERR_H__*/ +typedefenum{ +ERR_OK=0, +ERR_MEM=-1, +ERR_BUF=-2, +ERR_TIMEOUT=-3, +ERR_RTE=-4, +ERR_INPROGRESS=-5, +ERR_VAL=-6, +ERR_WOULDBLOCK=-7, +ERR_USE=-8, +ERR_ALREADY=-9, +ERR_ISCONN=-10, +ERR_CONN=-11, +ERR_IF=-12, + +ERR_ABRT=-13, +ERR_RST=-14, +ERR_CLSD=-15, +ERR_ARG=-16 +}err_enum_t; + +#defineERR_IS_FATAL(e)((e)<=ERR_ABRT) + +#ifdefLWIP_DEBUG +externconstchar*lwip_strerr(err_terr); +#else +#definelwip_strerr(x)"" +#endif/*LWIP_DEBUG*/ + +#if!NO_SYS +interr_to_errno(err_terr); +#endif/*!NO_SYS*/ + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_ERR_H*/ - + diff --git a/doc/xml/ethernetif_8c.xml b/doc/xml/ethernetif_8c.xml index a960827..3468f0f 100644 --- a/doc/xml/ethernetif_8c.xml +++ b/doc/xml/ethernetif_8c.xml @@ -1,307 +1,490 @@ - - - + + + ethernetif.c - ubixos/types.h - ubixos/sched.h - lib/kmalloc.h - lib/kprintf.h - sys/device.old.h - isa/ne2k.h - net/debug.h + pci/lnc.h net/opt.h + net/tcpip.h net/def.h net/mem.h net/pbuf.h - net/sys.h - netif/arp.h + net/stats.h + net/snmp.h + net/ethip6.h + net/etharp.h - - - - + + + + + + - - - + + + - - - - + + + + + + + + - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + - - - + - - - - + + + + - - - - + + + + - - - - - - - - + + + + - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ethernetif - + IFNAME0 'e' @@ -310,48 +493,40 @@ - - ethernetif_init + - + IFNAME1 - 'd' + 'n' - - ethernetif_init + + + + + + struct nicBuffer * + struct nicBuffer* tmpBuf + + tmpBuf + = 0x0 + + + + + + + - - void - static void arp_timer - (void *arg) - arp_timer - - void * - arg - - - - - - - - - arp_tmr - ARP_TMR_INTERVAL - NULL - sys_timeout - ethernetif_init - - - void - void ethernetif_init + + err_t + err_t ethernetif_init (struct netif *netif) ethernetif_init @@ -361,31 +536,40 @@ +Should be called at the beginning of the program to set up the network interface. It calls the function low_level_init() to do the actual setup of the hardware. +This function should be passed as a parameter to netif_add(). + + +netif + + +the lwip network interface structure for this ethernetif + + + +ERR_OK if the loopif is initialized ERR_MEM if private data couldn't be allocated any other err_t on error + + - - arp_init - arp_timer - ARP_TMR_INTERVAL - ethernetif_output - netif::hwaddr - IFNAME0 - IFNAME1 - netif::linkoutput - low_level_init - low_level_output - mem_malloc - netif::name - NULL - netif::output - netif::state - sys_timeout - netMainThread + + ERR_MEM + IFNAME0 + IFNAME1 + netif::linkoutput + LWIP_ASSERT + LWIP_DEBUGF + mem_malloc + netif::name + NETIF_DEBUG + NULL + netif::state + net_init - + void - static void ethernetif_input + void ethernetif_input (struct netif *netif) ethernetif_input @@ -395,116 +579,25 @@ +This function should be called when a packet is ready to be read from the interface. It uses the function low_level_input() that should handle the actual reception of bytes from the network interface. Then the type of the received packet is determined and the appropriate input function is called. + + +netif + + +the lwip network interface structure for this ethernetif + + + + - - arp_arp_input - arp_ip_input - ethernetif::ethaddr - ETHTYPE_ARP - ETHTYPE_IP - htons - netif::input - low_level_input - low_level_output - NULL - pbuf::payload - pbuf_free - pbuf_header - netif::state - ethernetif_thread + + netif::state + lnc_thread - - err_t - static err_t ethernetif_output - (struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) - ethernetif_output - - struct netif * - netif - - - struct pbuf * - p - - - struct ip_addr * - ipaddr - - - - - - - - - arp_lookup - arp_query - ERR_MEM - ethernetif::ethaddr - ethbroadcast - ETHTYPE_IP - netif::gw - htons - ip4_addr2 - ip4_addr3 - ip4_addr4 - netif::ip_addr - ip_addr_isany - ip_addr_isbroadcast - ip_addr_ismulticast - ip_addr_maskcmp - low_level_output - netif::netmask - NULL - pbuf::payload - pbuf_alloc - pbuf_chain - pbuf_free - pbuf_header - PBUF_LINK - PBUF_RAM - netif::state - ethernetif_init - - - void - void ethernetif_thread - (void *arg) - ethernetif_thread - - void * - arg - - - - - - - - - ethernetif_input - nicBuffer::length - ne2kFreeBuffer - ne2kGetBuffer - tmpBuf - - - void - static void ethernetif_thread - () - ethernetif_thread - - - - - - - - low_level_init - - + void static void low_level_init (struct netif *netif) @@ -516,58 +609,60 @@ +In this function, the hardware should be initialized. Called from ethernetif_init(). + + +netif + + +the already initialized lwip network interface structure for this ethernetif + + + + - - dev - ethernetif::ethaddr - ethernetif_thread - device::ioAddr - device::irq - kmalloc - kprintf - netif::state - sys_thread_new - ethernetif_init + - + struct pbuf * static struct pbuf* low_level_input - (struct ethernetif *ethernetif) + (struct netif *netif) low_level_input - struct ethernetif * - ethernetif + struct netif * + netif +Should allocate a pbuf and transfer the bytes of the incoming packet from the interface into the pbuf. + + +netif + + +the lwip network interface structure for this ethernetif + + + +a pbuf filled with the received packet (including MAC header) NULL on memory error + + - - bcopy - nicBuffer::buffer - pbuf::len - nicBuffer::length - pbuf::next - NULL - pbuf::payload - pbuf_alloc - PBUF_LINK - PBUF_POOL - tmpBuf - ethernetif_input + - - err_t + + err_t static err_t low_level_output - (struct ethernetif *ethernetif, struct pbuf *p) + (struct netif *netif, struct pbuf *p) low_level_output - struct ethernetif * - ethernetif + struct netif * + netif struct pbuf * @@ -576,449 +671,323 @@ +This function should do the actual transmission of the packet. The packet is contained in the pbuf that is passed to the function. This pbuf might be chained. + + +netif + + +the lwip network interface structure for this ethernetif + + + + +p + + +the MAC packet to send (e.g. IP packet including MAC addresses and type) + + + +ERR_OK if the packet could be sent an err_t value if the packet couldn't be sent + +Returning ERR_MEM here if a DMA queue of your MAC is full can lead to strange results. You might consider waiting for space in the DMA queue to become available since the stack doesn't retry to send a packet dropped because of memory failure (except for the TCP timers). + + - - bcopy - dev - ERR_OK - device::ioAddr - device::irq - pbuf::len - pbuf::next - NULL - pbuf::payload - PCtoNIC - pbuf::tot_len - ethernetif_init - ethernetif_input - ethernetif_output - - - - - device * - struct device* dev - - dev - 0x0 - - - - - - - - dp_pkt2user - dp_recv - fdcInit2 - getblock - hdInit - low_level_init - low_level_output - NICtoPC - pci_init - PCtoNIC - - - struct eth_addr - struct eth_addr ethbroadcast - - ethbroadcast - {{0xff,0xff,0xff,0xff,0xff,0xff}} - - - - - - - - ethernetif_output - - - nicBuffer * - struct nicBuffer* tmpBuf - - tmpBuf - 0x0 - - - - - - - - dp_pkt2user - ethernetif_thread - low_level_input - ne2kAllocBuffer - ne2kGetBuffer + +Ethernet Interface Skeleton -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. * -*$Id: ethernetif_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -/* -*ThisfileisaskeletonfordevelopingEthernetnetworkinterface -*driversforlwIP.Addcodetothelow_levelfunctionsanddoa -*search-and-replacefortheword"ethernetif"toreplaceitwith -*somethingthatbetterdescribesyournetworkinterface. -*/ - -#include<ubixos/types.h> -#include<ubixos/sched.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<sys/device.old.h> -#include<isa/ne2k.h> +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ + +/* +*ThisfileisaskeletonfordevelopingEthernetnetworkinterface +*driversforlwIP.Addcodetothelow_levelfunctionsanddoa +*search-and-replacefortheword"ethernetif"toreplaceitwith +*somethingthatbetterdescribesyournetworkinterface. +*/ +#include<pci/lnc.h> +#include"net/opt.h" + +#include<net/tcpip.h>//TMP - -#include"net/debug.h" - -#include"net/opt.h" -#include"net/def.h" -#include"net/mem.h" -#include"net/pbuf.h" -#include"net/sys.h" +#include"net/def.h" +#include"net/mem.h" +#include"net/pbuf.h" +#include"net/stats.h" +#include"net/snmp.h" +#include"net/ethip6.h" +#include"net/etharp.h" +//#include"net/ppp/pppoe.h" -#include"netif/arp.h" - -/*Definethosetobetterdescribeyournetworkinterface.*/ -#defineIFNAME0'e' -#defineIFNAME1'd' - -structnicBuffer*tmpBuf=0x0; - -structethernetif{ -structeth_addr*ethaddr; -/*Addwhateverper-interfacestatethatisneededhere.*/ -}; - -staticconststructeth_addrethbroadcast={{0xff,0xff,0xff,0xff,0xff,0xff}}; - -/*Forwarddeclarations.*/ -staticvoidethernetif_input(structnetif*netif); -staticerr_tethernetif_output(structnetif*netif,structpbuf*p,structip_addr*ipaddr); -staticvoidethernetif_thread(); -structdevice*dev=0x0; - -/*-----------------------------------------------------------------------------------*/ -staticvoidlow_level_init(structnetif*netif){ -structethernetif*ethernetif; - -ethernetif=netif->state; -dev=(structdevice*)kmalloc(sizeof(structdevice)); -dev->ioAddr=0x280; -dev->irq=0x10; - -/*ObtainMACaddressfromnetworkinterface.*/ -ethernetif->ethaddr->addr[0]=0x00; -ethernetif->ethaddr->addr[1]=0x00; -ethernetif->ethaddr->addr[2]=0xC0; -ethernetif->ethaddr->addr[3]=0x97; -ethernetif->ethaddr->addr[4]=0xC6; -ethernetif->ethaddr->addr[5]=0x93; - -/*Dowhateverelseisneededtoinitializeinterface.*/ -kprintf("NETIF:[0x%X:0x%X]\n",netif,ethernetif_thread); -sys_thread_new(ethernetif_thread,netif); - -} -/*-----------------------------------------------------------------------------------*/ -/* -*low_level_output(): -* -*Shoulddotheactualtransmissionofthepacket.Thepacketis -*containedinthepbufthatispassedtothefunction.Thispbuf -*mightbechained. -* -*/ -/*-----------------------------------------------------------------------------------*/ - -staticerr_tlow_level_output(structethernetif*ethernetif,structpbuf*p){ -structpbuf*q; -charbuf[1500]; -char*bufptr=0x0; - -dev->ioAddr=0x280; -dev->irq=10; - -bufptr=&buf[0]; - -for(q=p;q!=NULL;q=q->next){ -bcopy(q->payload,bufptr,q->len); -bufptr+=q->len; -} -PCtoNIC(dev,buf,p->tot_len); -//kprintf("SendingData[%i]\n",p->tot_len); -returnERR_OK; -} - - -/*-----------------------------------------------------------------------------------*/ -/* -*low_level_input(): -* -*Shouldallocateapbufandtransferthebytesoftheincoming -*packetfromtheinterfaceintothepbuf. -* -*/ -/*-----------------------------------------------------------------------------------*/ -staticstructpbuf*low_level_input(structethernetif*ethernetif){ -structpbuf*p,*q; -uInt16len; -char*bufptr; -char*buf; - -len=tmpBuf->length; -bufptr=tmpBuf->buffer; - - -/*Weallocateapbufchainofpbufsfromthepool.*/ -p=pbuf_alloc(PBUF_LINK,len,PBUF_POOL); - -if(p!=NULL){ -/*Weiterateoverthepbufchainuntilwehavereadtheentire -packetintothepbuf.*/ -//bufptr=&buf[0]; -for(q=p;q!=NULL;q=q->next){ -/*Readenoughbytestofillthispbufinthechain.The -avaliabledatainthepbufisgivenbytheq->len -variable.*/ -/*readdatainto(q->payload,q->len);*/ -bcopy(bufptr,q->payload,q->len); -buf=q->payload; -bufptr+=q->len; -} -/*acknowledgethatpackethasbeenread();*/ -}else{ -/*droppacket();*/ +/*Definethosetobetterdescribeyournetworkinterface.*/ +#defineIFNAME0'e' +#defineIFNAME1'n' + +structnicBuffer*tmpBuf=0x0; + +structethernetif{ +structeth_addr*ethaddr; +/*Addwhateverper-interfacestatethatisneededhere.*/ +}; + +/*Forwarddeclarations.*/ +//MrOlsen2017-12-17LWIPstaticvoidethernetif_input(structnetif*netif); + +staticvoid +low_level_init(structnetif*netif) +{ +structethernetif*ethernetif=netif->state; + +/*setMAChardwareaddresslength*/ +netif->hwaddr_len=ETHARP_HWADDR_LEN; + +/*setMAChardwareaddress*/ +netif->hwaddr[0]=0x08; +netif->hwaddr[1]=0x00; +netif->hwaddr[2]=0x27; +netif->hwaddr[3]=0x73; +netif->hwaddr[4]=0xC1; +netif->hwaddr[5]=0xB6; + +/*maximumtransferunit*/ +netif->mtu=1500; + +/*devicecapabilities*/ +/*don'tsetNETIF_FLAG_ETHARPifthisdeviceisnotanethernetone*/ +netif->flags=NETIF_FLAG_BROADCAST|NETIF_FLAG_ETHARP|NETIF_FLAG_LINK_UP; + +#ifLWIP_IPV6&&LWIP_IPV6_MLD +/* +*Forhardware/netifsthatimplementMACfiltering. +*All-nodeslink-localishandledbydefault,sowemustletthehardwareknow +*toallowmulticastpacketsin. +*Shouldsetmld_mac_filterpreviously.*/ +if(netif->mld_mac_filter!=NULL){ +ip6_addr_tip6_allnodes_ll; +ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll); +netif->mld_mac_filter(netif,&ip6_allnodes_ll,NETIF_ADD_MAC_FILTER); +} +#endif/*LWIP_IPV6&&LWIP_IPV6_MLD*/ + +/*Dowhateverelseisneededtoinitializeinterface.*/ +} + +staticerr_t +low_level_output(structnetif*netif,structpbuf*p) +{ +structethernetif*ethernetif=netif->state; +structpbuf*q; + +//MrOlsen2017-12-17LWIPinitiatetransfer(); + +#ifETH_PAD_SIZE +pbuf_header(p,-ETH_PAD_SIZE);/*dropthepaddingword*/ +#endif + +for(q=p;q!=NULL;q=q->next){ +/*Sendthedatafromthepbuftotheinterface,onepbufata +time.Thesizeofthedataineachpbufiskeptinthe->len +variable.*/ +//senddatafrom(q->payload,q->len); +lnc_sendPacket(lnc,q->payload,q->len,0x0); +} + +//signalthatpacketshouldbesent(); + +MIB2_STATS_NETIF_ADD(netif,ifoutoctets,p->tot_len); +if(((u8_t*)p->payload)[0]&1){ +/*broadcastormulticastpacket*/ +MIB2_STATS_NETIF_INC(netif,ifoutnucastpkts); +} +else{ +/*unicastpacket*/ +MIB2_STATS_NETIF_INC(netif,ifoutucastpkts); } -returnp; -} - - -/*-----------------------------------------------------------------------------------*/ -/* -*ethernetif_output(): -* -*ThisfunctioniscalledbytheTCP/IPstackwhenanIPpacket -*shouldbesent.Itcallsthefunctioncalledlow_level_output()to -*dotheactualltransmissionofthepacket. -* -*/ -/*-----------------------------------------------------------------------------------*/ -staticerr_tethernetif_output(structnetif*netif,structpbuf*p,structip_addr*ipaddr){ -structethernetif*ethernetif; -structpbuf*q; -structeth_hdr*ethhdr; -structeth_addr*dest,mcastaddr; -structip_addr*queryaddr; -err_terr; -uInt8i; - -ethernetif=netif->state; - - -/*MakeroomforEthernetheader.*/ -if(pbuf_header(p,sizeof(structeth_hdr))!=0){ -/*Thepbuf_header()callshouldn'tfail,butweallocateanextra -pbufjustincase.*/ -q=pbuf_alloc(PBUF_LINK,sizeof(structeth_hdr),PBUF_RAM); -if(q==NULL){ -returnERR_MEM; -} -pbuf_chain(q,p); -p=q; -} - -/*ConstructEthernetheader.Startwithlookingupdecidingwhich -MACaddresstouseasadestinationaddress.Broadcastsand -multicastsarespecial,allotheraddressesarelookedupinthe -ARPtable.*/ -queryaddr=ipaddr; -if(ip_addr_isany(ipaddr)|| -ip_addr_isbroadcast(ipaddr,&(netif->netmask))){ -dest=(structeth_addr*)&ethbroadcast; -}elseif(ip_addr_ismulticast(ipaddr)){ -/*HashIPmulticastaddresstoMACaddress.*/ -mcastaddr.addr[0]=0x01; -mcastaddr.addr[1]=0x0; -mcastaddr.addr[2]=0x5e; -mcastaddr.addr[3]=ip4_addr2(ipaddr)&0x7f; -mcastaddr.addr[4]=ip4_addr3(ipaddr); -mcastaddr.addr[5]=ip4_addr4(ipaddr); -dest=&mcastaddr; -}else{ -if(ip_addr_maskcmp(ipaddr,&(netif->ip_addr),&(netif->netmask))){ -/*UsedestinationIPaddressifthedestinationisonthesame -subnetasweare.*/ -queryaddr=ipaddr; -}else{ -/*Otherwiseweusethedefaultrouterastheaddresstosend -theEthernetframeto.*/ -queryaddr=&(netif->gw); -} -dest=arp_lookup(queryaddr); -} - - -/*Ifthearp_lookup()didn'tfindanaddress,wesendoutanARP -queryfortheIPaddress.*/ -if(dest==NULL){ -q=arp_query(netif,ethernetif->ethaddr,queryaddr); -if(q!=NULL){ -err=low_level_output(ethernetif,q); -pbuf_free(q); -returnerr; -} -returnERR_MEM; -} -ethhdr=p->payload; - -for(i=0;i<6;i++){ -ethhdr->dest.addr[i]=dest->addr[i]; -ethhdr->src.addr[i]=ethernetif->ethaddr->addr[i]; -} - -ethhdr->type=htons(ETHTYPE_IP); - -returnlow_level_output(ethernetif,p); - -} -/*-----------------------------------------------------------------------------------*/ -/* -*ethernetif_input(): -* -*Thisfunctionshouldbecalledwhenapacketisreadytoberead -*fromtheinterface.Itusesthefunctionlow_level_input()that -*shouldhandletheactualreceptionofbytesfromthenetwork -*interface. -* -*/ -/*-----------------------------------------------------------------------------------*/ -staticvoidethernetif_input(structnetif*netif){ -structethernetif*ethernetif=0x0; -structeth_hdr*ethhdr=0x0; -structpbuf*p=0x0; - -ethernetif=netif->state; - -p=low_level_input(ethernetif); - -if(p!=NULL){ - -ethhdr=p->payload; - -switch(htons(ethhdr->type)){ -caseETHTYPE_IP: -arp_ip_input(netif,p); -pbuf_header(p,-14); -netif->input(p,netif); -break; -caseETHTYPE_ARP: -p=arp_arp_input(netif,ethernetif->ethaddr,p); -if(p!=NULL){ -low_level_output(ethernetif,p); -pbuf_free(p); -} -break; -default: -pbuf_free(p); -break; -} -} -} -/*-----------------------------------------------------------------------------------*/ -staticvoid -arp_timer(void*arg) -{ -arp_tmr(); -sys_timeout(ARP_TMR_INTERVAL,(sys_timeout_handler)arp_timer,NULL); -} - -/*-----------------------------------------------------------------------------------*/ -/* -*ethernetif_init(): -* -*Shouldbecalledatthebeginningoftheprogramtosetupthe -*networkinterface.Itcallsthefunctionlow_level_init()todothe -*actualsetupofthehardware. -* -*/ -/*-----------------------------------------------------------------------------------*/ -voidethernetif_init(structnetif*netif){ -structethernetif*ethernetif; - -ethernetif=mem_malloc(sizeof(structethernetif)); -netif->state=ethernetif; -netif->name[0]=IFNAME0; -netif->name[1]=IFNAME1; -netif->output=ethernetif_output; -netif->linkoutput=(void*)low_level_output; - -ethernetif->ethaddr=(structeth_addr*)&(netif->hwaddr[0]); - -low_level_init(netif); -arp_init(); +/*increaseifoutdiscardsorifouterrorsonerror*/ + +#ifETH_PAD_SIZE +pbuf_header(p,ETH_PAD_SIZE);/*reclaimthepaddingword*/ +#endif + +LINK_STATS_INC(link.xmit); + +returnERR_OK; +} + +staticstructpbuf* +low_level_input(structnetif*netif) +{ +structethernetif*ethernetif=netif->state; +structpbuf*p,*q; +uint16_tlen; +char*bufPtr; + +/*Obtainthesizeofthepacketandputitintothe"len" +variable.*/ +len=tmpBuf->length; +bufPtr=tmpBuf->buffer; + +#ifETH_PAD_SIZE +len+=ETH_PAD_SIZE;/*allowroomforEthernetpadding*/ +#endif + +/*Weallocateapbufchainofpbufsfromthepool.*/ +p=pbuf_alloc(PBUF_RAW,len,PBUF_POOL); + +if(p!=NULL){ + +#ifETH_PAD_SIZE +pbuf_header(p,-ETH_PAD_SIZE);/*dropthepaddingword*/ +#endif + +/*Weiterateoverthepbufchainuntilwehavereadtheentire +*packetintothepbuf.*/ +for(q=p;q!=NULL;q=q->next){ +/*Readenoughbytestofillthispbufinthechain.The +*availabledatainthepbufisgivenbytheq->len +*variable. +*Thisdoesnotnecessarilyhavetobeamemcpy,youcanalsopreallocate +*pbufsforaDMA-enabledMACandafterreceivingtruncateittothe +*actuallyreceivedsize.Inthiscase,ensurethetot_lenmemberofthe +*pbufisthesumofthechainedpbuflenmembers. +*/ +//readdatainto(q->payload,q->len); +bcopy(bufPtr,q->payload,q->len); +bufPtr+=q->len; +} +//acknowledgethatpackethasbeenread(); + +MIB2_STATS_NETIF_ADD(netif,ifinoctets,p->tot_len); +if(((u8_t*)p->payload)[0]&1){ +/*broadcastormulticastpacket*/ +MIB2_STATS_NETIF_INC(netif,ifinnucastpkts); +} +else{ +/*unicastpacket*/ +MIB2_STATS_NETIF_INC(netif,ifinucastpkts); +} +#ifETH_PAD_SIZE +pbuf_header(p,ETH_PAD_SIZE);/*reclaimthepaddingword*/ +#endif + +LINK_STATS_INC(link.recv); +} +else{ +//MrOlsen2017-12-17LWIPdroppacket(); +LINK_STATS_INC(link.memerr); +LINK_STATS_INC(link.drop); +MIB2_STATS_NETIF_INC(netif,ifindiscards); +} + +returnp; +} + +/*MrOlsen2017-12-17LWIP*/ +//staticvoidethernetif_input(structnetif*netif){ +voidethernetif_input(structnetif*netif){ +structethernetif*ethernetif; +structeth_hdr*ethhdr; +structpbuf*p; + +ethernetif=netif->state; + +/*movereceivedpacketintoanewpbuf*/ +p=low_level_input(netif); +/*ifnopacketcouldberead,silentlyignorethis*/ +if(p!=NULL){ +/*passallpacketstoethernet_input,whichdecideswhatpacketsitsupports*/ +if(netif->input(p,netif)!=ERR_OK){ +LWIP_DEBUGF(NETIF_DEBUG,("ethernetif_input:IPinputerror\n")); +pbuf_free(p); +p=NULL; +} +} +} + +err_tethernetif_init(structnetif*netif){ +structethernetif*ethernetif; + +LWIP_ASSERT("netif!=NULL",(netif!=NULL)); + +ethernetif=mem_malloc(sizeof(structethernetif)); +if(ethernetif==NULL){ +LWIP_DEBUGF(NETIF_DEBUG,("ethernetif_init:outofmemory\n")); +returnERR_MEM; +} + +#ifLWIP_NETIF_HOSTNAME +/*Initializeinterfacehostname*/ +netif->hostname="lwip"; +#endif/*LWIP_NETIF_HOSTNAME*/ + +/* +*Initializethesnmpvariablesandcountersinsidethestructnetif. +*Thelastargumentshouldbereplacedwithyourlinkspeed,inunits +*ofbitspersecond. +*/ +//MrOlsen2017-12-17LWIPMIB2_INIT_NETIF(netif,snmp_ifType_ethernet_csmacd,LINK_SPEED_OF_YOUR_NETIF_IN_BPS); + +netif->state=ethernetif; +netif->name[0]=IFNAME0; +netif->name[1]=IFNAME1; +/*Wedirectlyuseetharp_output()heretosaveafunctioncall. +*Youcaninsteaddeclareyourownfunctionancalletharp_output() +*fromitifyouhavetodosomechecksbeforesending(e.g.iflink +*isavailable...)*/ +netif->output=etharp_output; +#ifLWIP_IPV6 +netif->output_ip6=ethip6_output; +#endif/*LWIP_IPV6*/ +netif->linkoutput=low_level_output; + +ethernetif->ethaddr=(structeth_addr*)&(netif->hwaddr[0]); -sys_timeout(ARP_TMR_INTERVAL,(sys_timeout_handler)arp_timer,NULL); -} +/*initializethehardware*/ +low_level_init(netif); -/*-----------------------------------------------------------------------------------*/ - -voidethernetif_thread(void*arg){ -structnetif*netif=0x0; - -netif=arg; - -while(1){ -tmpBuf=ne2kGetBuffer(); -if(tmpBuf&&tmpBuf->length>0x0){ -ethernetif_input(netif); -} -} -ne2kFreeBuffer(tmpBuf); -} +returnERR_OK; +} - + diff --git a/doc/xml/ethernetif_8h.xml b/doc/xml/ethernetif_8h.xml index 1110d06..79c916e 100644 --- a/doc/xml/ethernetif_8h.xml +++ b/doc/xml/ethernetif_8h.xml @@ -1,36 +1,63 @@ - - - + + + ethernetif.h - net/netif.h - - - - - - - - + C:/Dev/git/UbixOS/sys/net/net/init.c + + + + + - + + + + + - - void - void ethernetif_init + + err_t + err_t ethernetif_init (struct netif *netif) ethernetif_init - struct netif * + struct netif * netif +Should be called at the beginning of the program to set up the network interface. It calls the function low_level_init() to do the actual setup of the hardware. +This function should be passed as a parameter to netif_add(). + + +netif + + +the lwip network interface structure for this ethernetif + + + +ERR_OK if the loopif is initialized ERR_MEM if private data couldn't be allocated any other err_t on error + + - + + ERR_MEM + IFNAME0 + IFNAME1 + netif::linkoutput + LWIP_ASSERT + LWIP_DEBUGF + mem_malloc + netif::name + NETIF_DEBUG + NULL + netif::state + net_init @@ -38,49 +65,8 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: ethernetif_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__NETIF_ETHERNETIF_H__ -#define__NETIF_ETHERNETIF_H__ - -#include"net/netif.h" - -voidethernetif_init(structnetif*netif); - -#endif/*__NETIF_ETHERNETIF_H__*/ +err_tethernetif_init(structnetif*netif); - + diff --git a/doc/xml/exec_8c.xml b/doc/xml/exec_8c.xml index a5672af..a6cb0ad 100644 --- a/doc/xml/exec_8c.xml +++ b/doc/xml/exec_8c.xml @@ -1,197 +1,484 @@ - - - + + + exec.c ubixos/exec.h - ubixos/elf.h + sys/elf.h ubixos/ld.h ubixos/kpanic.h ubixos/endtask.h vmm/vmm.h lib/kmalloc.h lib/kprintf.h - lib/string.h + lib/string.h assert.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - - - - + + + - - - - + + + + - + - - - - - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + - + + AT_BASE + 7 /* Interpreter's base address. */ + + + + + + + + + + AT_ENTRY + 9 /* Where interpreter should transfer control. */ + + + + + + + + + + AT_EXECFD + 2 /* File descriptor of program to load. */ + + + + + + + + + + AT_FLAGS + 8 /* Flags (unused for i386). */ + + + + + + + + + + AT_IGNORE + 1 /* Ignored entry. */ + + + + + + + + + + AT_NULL + 0 /* Terminates the vector. */ + + + + + + + + + + AT_PAGESZ + 6 /* Page size in bytes. */ + + + + + + + + + + AT_PHDR + 3 /* Program header of program already loaded. */ + + + + + + + + + + AT_PHENT + 4 /* Size of each program header entry. */ + + + + + + + + + + AT_PHNUM + 5 /* Number of program header entries. */ + + + + + + + + + + AUXARGS_ENTRY + pos + id + val + {*pos = id;pos++; *pos = val;pos++;} + + + + + + + + + STACK_ADDR 0xC800000 @@ -200,13 +487,11 @@ - - execFile - sysExec + - + void void execFile (char *file, int argc, char **argv, int console) @@ -233,82 +518,70 @@ - - _current - assert - tssStruct::back_link - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::ebp - tssStruct::edi - elfHeader::eEntry - tssStruct::eflags - elfHeader::eIdent - tssStruct::eip - elfHeader::ePhnum - elfHeader::ePhoff - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - elfHeader::eType - fclose - fopen - fread - tssStruct::fs - fseek - taskStruct::gid - tssStruct::gs - taskStruct::id - tssStruct::io_map - K_PANIC - KERNEL_PAGE_DEFAULT - kernelPageDirectory - kfree - kmalloc - kpanic - kprintf - tssStruct::ldt - memset - taskStruct::oInfo - tty_termNode::owner - PAGE_DEFAULT - PAGE_PRESENT - PAGE_STACK - PAGE_USER - fileDescriptorStruct::perms - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - READY - sched_setStatus - schedNewTask - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - STACK_ADDR - taskStruct::td - taskStruct::term - tssStruct::trace_bitmap - taskStruct::tss - tty_find - taskStruct::uid - thread::vm_daddr - vmm_remapPage - vmm_setPageAttributes - vmmCreateVirtualSpace - vmmFindFreePage - osInfo::vmStart - x1000 - x18 - x30 - kmain + + _current + assert + tssStruct::back_link + tssStruct::cr3 + tssStruct::cs + tssStruct::ds + tssStruct::ebp + tssStruct::edi + tssStruct::eflags + tssStruct::eip + tssStruct::es + tssStruct::esi + tssStruct::esp + tssStruct::esp0 + tssStruct::esp1 + tssStruct::esp2 + fclose + fopen + fread + tssStruct::fs + fseek + taskStruct::gid + tssStruct::gs + taskStruct::id + tssStruct::io_map + K_PANIC + KERNEL_PAGE_DEFAULT + kernelPageDirectory + kfree + kmalloc + kpanic + kprintf + tssStruct::ldt + memset + taskStruct::oInfo + tty_termNode::owner + PAGE_DEFAULT + PAGE_PRESENT + PAGE_STACK + PAGE_USER + fileDescriptor::perms + READY + sched_setStatus + schedNewTask + tssStruct::ss + tssStruct::ss0 + tssStruct::ss1 + tssStruct::ss2 + STACK_ADDR + taskStruct::td + taskStruct::term + tssStruct::trace_bitmap + taskStruct::tss + tty_find + taskStruct::uid + thread::vm_daddr + vmm_findFreePage + vmm_remapPage + vmm_setPageAttributes + osInfo::vmStart - - uInt32 + + uInt32 uInt32 execThread (void(*tproc)(void), uInt32 stack, char *arg) execThread @@ -317,7 +590,7 @@ tproc - uInt32 + uInt32 stack @@ -330,45 +603,45 @@ - - assert - tssStruct::back_link - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::ebp - tssStruct::edi - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - tssStruct::fs - tssStruct::gs - taskStruct::id - taskStruct::imageFd - tssStruct::io_map - kernelPageDirectory - kpanic - tssStruct::ldt - taskStruct::oInfo - READY - sched_setStatus - schedNewTask - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - tssStruct::trace_bitmap - taskStruct::tss - osInfo::vmStart - kmain - ubthread_create + + assert + tssStruct::back_link + tssStruct::cr3 + tssStruct::cs + tssStruct::ds + tssStruct::ebp + tssStruct::edi + tssStruct::eflags + tssStruct::eip + tssStruct::es + tssStruct::esi + tssStruct::esp + tssStruct::esp0 + tssStruct::esp1 + tssStruct::esp2 + tssStruct::fs + tssStruct::gs + taskStruct::id + tssStruct::io_map + kernelPageDirectory + kpanic + tssStruct::ldt + taskStruct::oInfo + READY + sched_setStatus + schedNewTask + tssStruct::ss + tssStruct::ss0 + tssStruct::ss1 + tssStruct::ss2 + tssStruct::trace_bitmap + taskStruct::tss + osInfo::vmStart + sdeThread + systemTask + ubthread_create - + void void sys_exec (char *file, char *ap) @@ -382,55 +655,21 @@ ap -New exec... +New exec... + -Clean the virtual of COW pages left over from the forkAdjust iframebuild argc and argv[]Start of Env - - _current - elfHeader::eEntry - elfHeader::eIdent - i386_frame::eip - elfHeader::ePhnum - elfHeader::ePhoff - ET_EXEC - elfHeader::eType - fclose - fopen - fread - fseek - taskStruct::id - taskStruct::imageFd - K_PANIC - kfree - kmalloc - kprintf - memset - taskStruct::oInfo - PAGE_DEFAULT - PAGE_PRESENT - PAGE_SHIFT - PAGE_USER - elfProgramHeader::phMemsz - elfProgramHeader::phOffset - elfProgramHeader::phVaddr - PT_INTERP - PT_LOAD - PT_PHDR - round_page - taskStruct::td - trunc_page - thread::vm_daddr - thread::vm_dsize - vmm_remapPage - vmm_setPageAttributes - vmmFindFreePage - osInfo::vmStart - x1000 - sysExec +copy in arg strings +Clean the virtual of COW pages left over from the fork +Adjust iframe +build argc and argv[] +Build ENV + + + sys_execve - + void void sysExec (char *file, char *ap) @@ -448,65 +687,56 @@ -Clean the virtual of COW pages left over from the forkAdjust iframebuild argc and argv[] - - _current - assert - i386_frame::ebp - elfHeader::eEntry - elfHeader::eIdent - i386_frame::eip - endTask - elfHeader::ePhnum - elfHeader::ePhoff - elfHeader::eShnum - elfHeader::eShoff - tssStruct::esp0 - elfHeader::eType - fclose - fopen - fread - fseek - taskStruct::id - taskStruct::imageFd - K_PANIC - kfree - kmalloc - kpanic - kprintf - ldEnable - memset - taskStruct::oInfo - PAGE_DEFAULT - PAGE_PRESENT - PAGE_SHIFT - PAGE_SIZE - PAGE_USER - fileDescriptorStruct::perms - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - PT_DYNAMIC - PT_INTERP - PT_LOAD - round_page - STACK_ADDR - strcpy - strlen - sys_exec - taskStruct::td - trunc_page - taskStruct::tss - i386_frame::user_esp - thread::vm_daddr - thread::vm_dsize - VM_TASK - vmm_cleanVirtualSpace - vmm_remapPage - vmm_setPageAttributes - vmmFindFreePage - vmmGetFreeVirtualPage - osInfo::vmStart - x1000 +Clean the virtual of COW pages left over from the fork +Adjust iframe +build argc and argv[] + + + _current + assert + i386_frame::ebp + i386_frame::eip + endTask + tssStruct::esp0 + fclose + taskStruct::files + fopen + fread + fseek + taskStruct::id + K_PANIC + kfree + kmalloc + kpanic + kprintf + ldEnable + memset + taskStruct::oInfo + PAGE_DEFAULT + PAGE_PRESENT + PAGE_SHIFT + PAGE_SIZE + PAGE_USER + fileDescriptor::perms + PT_DYNAMIC + PT_INTERP + PT_LOAD + round_page + STACK_ADDR + strcpy + strlen + taskStruct::td + trunc_page + taskStruct::tss + i386_frame::user_esp + thread::vm_daddr + thread::vm_dsize + VM_TASK + vmm_cleanVirtualSpace + vmm_findFreePage + vmm_remapPage + vmm_setPageAttributes + osInfo::vmStart @@ -514,716 +744,745 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDF -ITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: exec_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/exec.h> -#include<ubixos/elf.h> -#include<ubixos/ld.h> -#include<ubixos/kpanic.h> -#include<ubixos/endtask.h> -#include<vmm/vmm.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<lib/string.h> -#include<assert.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/exec.h> +#include<sys/elf.h> +#include<ubixos/ld.h> +#include<ubixos/kpanic.h> +#include<ubixos/endtask.h> +#include<vmm/vmm.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<lib/string.h> +#include<assert.h> + +#defineSTACK_ADDR0xC800000 -#defineSTACK_ADDR0xC800000 - -/***************************************************************************************** - -Function:execThread(void(*)(void),int,char*); -Description:Thisfunctionwillcreateathreadfromcodeinthecurrentmemoryspace - -Notes: - -05/19/04-ThisdoesnotworkthewayIwantittoitstillmakesacopyofkernelspace -sodonotuseoutsideofkernelspace - -*****************************************************************************************/ -uInt32execThread(void(*tproc)(void),uInt32stack,char*arg){ -kTask_t*newProcess=0x0; -/*FindANewThread*/ -newProcess=schedNewTask(); -assert(newProcess); -if(stack<0x100000) -kpanic("exec:stacknotinvalidarea:[0x%X]\n",stack); - -/*SetAllTheCorrectThreadAttributes*/ -newProcess->tss.back_link=0x0; -newProcess->tss.esp0=0x0; -newProcess->tss.ss0=0x0; -newProcess->tss.esp1=0x0; -newProcess->tss.ss1=0x0; -newProcess->tss.esp2=0x0; -newProcess->tss.ss2=0x0; -newProcess->tss.cr3=(unsignedint)kernelPageDirectory; -newProcess->tss.eip=(unsignedint)tproc; -newProcess->tss.eflags=0x206; -newProcess->tss.esp=stack; -newProcess->tss.ebp=stack; -newProcess->tss.esi=0x0; -newProcess->tss.edi=0x0; - -/*Settheseuptobering3tasks*/ -/* -newProcess->tss.es=0x30+3; -newProcess->tss.cs=0x28+3; -newProcess->tss.ss=0x30+3; -newProcess->tss.ds=0x30+3; -newProcess->tss.fs=0x30+3; -newProcess->tss.gs=0x30+3; -*/ - -newProcess->tss.es=0x10; -newProcess->tss.cs=0x08; -newProcess->tss.ss=0x10; -newProcess->tss.ds=0x10; -newProcess->tss.fs=0x10; -newProcess->tss.gs=0x10; - -newProcess->tss.ldt=0x18; -newProcess->tss.trace_bitmap=0x0000; -newProcess->tss.io_map=0x8000; -newProcess->oInfo.vmStart=0x6400000; - -newProcess->imageFd=0x0; - -/*Setupdefaultstackforthreadherefilledwitharglist3times*/ -asmvolatile( -"pusha\n" -"movl%%esp,%%ecx\n" -"movl%1,%%eax\n" -"movl%%eax,%%esp\n" -"pushl%%ebx\n" -"pushl%%ebx\n" -"pushl%%ebx\n" -"movl%%esp,%%eax\n" -"movl%%eax,%1\n" -"movl%%ecx,%%esp\n" -"popa\n" -: -:"b"(arg),"m"(newProcess->tss.esp) -); - -/*PutnewthreadintotheREADYstate*/ -sched_setStatus(newProcess->id,READY); - -/*ReturnwiththenewprocessID*/ -return((uInt32)newProcess); -} - -/***************************************************************************************** - -Function:voidexecFile(char*file); -Description:ThisFunctionExecutesAKileIntoANewVMSpaceWithOut -HavingToFork -Notes: - -07/30/02-IHaveMadeSomeHeavyChangesToThisAsWellAsFixedAFew -MemoryLeaksTheMemoryAllocatedToLoadTheBinaryIntoIs -NowUnmappedSoItCanBeUsedAgainAndNotHeldOntoUntil -TheProgramExits - -07/30/02-NowIHaveToMakeABetterMemoryAllocatorSoWeCanSetUp -TheFreshlyAllocatedPagesWithTheCorrectPermissions - -*****************************************************************************************/ -voidexecFile(char*file,intargc,char**argv,intconsole){ - -inti=0x0; -intx=0x0; -uint32_t*tmp=0x0; - -fileDescriptor*tmpFd=0x0; -elfHeader*binaryHeader=0x0; -elfProgramHeader*programHeader=0x0; - -/*GetANewTaskForThisProccess*/ -_current=schedNewTask(); -assert(_current); -_current->gid=0x0; -_current->uid=0x0; -_current->term=tty_find(console); -if(_current->term==0x0) -kprintf("Error:invalidconsole\n"); - -/*Setttyownership*/ -_current->term->owner=_current->id; +#defineAT_NULL0/*Terminatesthevector.*/ +#defineAT_IGNORE1/*Ignoredentry.*/ +#defineAT_EXECFD2/*Filedescriptorofprogramtoload.*/ +#defineAT_PHDR3/*Programheaderofprogramalreadyloaded.*/ +#defineAT_PHENT4/*Sizeofeachprogramheaderentry.*/ +#defineAT_PHNUM5/*Numberofprogramheaderentries.*/ +#defineAT_PAGESZ6/*Pagesizeinbytes.*/ +#defineAT_BASE7/*Interpreter'sbaseaddress.*/ +#defineAT_FLAGS8/*Flags(unusedfori386).*/ +#defineAT_ENTRY9/*Whereinterpretershouldtransfercontrol.*/ + +//#defineAUXARGS_ENTRY(pos,id,val){memcpy((void*)pos++,(void*)id,sizeof(long));memcpy((void*)pos++,(void*)val,sizeof(long));} +#defineAUXARGS_ENTRY(pos,id,val){*pos=id;pos++;*pos=val;pos++;} + +/***************************************************************************************** + +Function:execThread(void(*)(void),int,char*); +Description:Thisfunctionwillcreateathreadfromcodeinthecurrentmemoryspace + +Notes: + +05/19/04-ThisdoesnotworkthewayIwantittoitstillmakesacopyofkernelspace +sodonotuseoutsideofkernelspace + +*****************************************************************************************/ +uInt32execThread(void(*tproc)(void),uInt32stack,char*arg){ +kTask_t*newProcess=0x0; +/*FindANewThread*/ +newProcess=schedNewTask(); +assert(newProcess); +if(stack<0x100000) +kpanic("exec:stacknotinvalidarea:[0x%X]\n",stack); + +/*SetAllTheCorrectThreadAttributes*/ +newProcess->tss.back_link=0x0; +newProcess->tss.esp0=0x0; +newProcess->tss.ss0=0x0; +newProcess->tss.esp1=0x0; +newProcess->tss.ss1=0x0; +newProcess->tss.esp2=0x0; +newProcess->tss.ss2=0x0; +newProcess->tss.cr3=(unsignedint)kernelPageDirectory; +newProcess->tss.eip=(unsignedint)tproc; +newProcess->tss.eflags=0x206; +newProcess->tss.esp=stack; +newProcess->tss.ebp=stack; +newProcess->tss.esi=0x0; +newProcess->tss.edi=0x0; + +/*Settheseuptobering3tasks*/ +/* +newProcess->tss.es=0x30+3; +newProcess->tss.cs=0x28+3; +newProcess->tss.ss=0x30+3; +newProcess->tss.ds=0x30+3; +newProcess->tss.fs=0x30+3; +newProcess->tss.gs=0x30+3; +*/ + +newProcess->tss.es=0x10; +newProcess->tss.cs=0x08; +newProcess->tss.ss=0x10; +newProcess->tss.ds=0x10; +newProcess->tss.fs=0x10; +newProcess->tss.gs=0x10; + +newProcess->tss.ldt=0x18; +newProcess->tss.trace_bitmap=0x0000; +newProcess->tss.io_map=0x8000; +newProcess->oInfo.vmStart=0x6400000; + +//newProcess->imageFd=0x0; + +/*Setupdefaultstackforthreadherefilledwitharglist3times*/ +asmvolatile( +"pusha\n" +"movl%%esp,%%ecx\n" +"movl%1,%%eax\n" +"movl%%eax,%%esp\n" +"pushl%%ebx\n" +"pushl%%ebx\n" +"pushl%%ebx\n" +"movl%%esp,%%eax\n" +"movl%%eax,%1\n" +"movl%%ecx,%%esp\n" +"popa\n" +: +:"b"(arg),"m"(newProcess->tss.esp) +); + +/*PutnewthreadintotheREADYstate*/ +sched_setStatus(newProcess->id,READY); + +/*ReturnwiththenewprocessID*/ +return((uInt32)newProcess); +} + +/***************************************************************************************** + +Function:voidexecFile(char*file); +Description:ThisFunctionExecutesAKileIntoANewVMSpaceWithOut +HavingToFork +Notes: + +07/30/02-IHaveMadeSomeHeavyChangesToThisAsWellAsFixedAFew +MemoryLeaksTheMemoryAllocatedToLoadTheBinaryIntoIs +NowUnmappedSoItCanBeUsedAgainAndNotHeldOntoUntil +TheProgramExits + +07/30/02-NowIHaveToMakeABetterMemoryAllocatorSoWeCanSetUp +TheFreshlyAllocatedPagesWithTheCorrectPermissions + +*****************************************************************************************/ +voidexecFile(char*file,intargc,char**argv,intconsole){ + +inti=0x0; +intx=0x0; +uint32_t*tmp=0x0; + +fileDescriptor*tmpFd=0x0; +elfHeader*binaryHeader=0x0; +elfProgramHeader*programHeader=0x0; -/*NowWeMustCreateAVirtualSpaceForThisProccessToRunIn*/ -_current->tss.cr3=(uInt32)vmmCreateVirtualSpace(_current->id); - -/*ToBetterLoadThisApplicationWeWillSwitchOverToItsVMSpace*/ -asmvolatile( -"movl%0,%%eax\n" -"movl%%eax,%%cr3\n" -::"d"((uInt32*)(_current->tss.cr3)) -); - -/*LetsFindTheFile*/ -tmpFd=fopen(file,"r"); - -/*IfWeDontFindtheFileReturn*/ -if(tmpFd==0x0){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -fclose(tmpFd); -return; -} -if(tmpFd->perms==0x0){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -fclose(tmpFd); -return; -} +/*GetANewTaskForThisProccess*/ +_current=schedNewTask(); +assert(_current); +_current->gid=0x0; +_current->uid=0x0; +_current->term=tty_find(console); +if(_current->term==0x0) +kprintf("Error:invalidconsole\n"); + +/*Setttyownership*/ +_current->term->owner=_current->id; + +/*NowWeMustCreateAVirtualSpaceForThisProccessToRunIn*/ +_current->tss.cr3=(uInt32)vmmCreateVirtualSpace(_current->id); + +/*ToBetterLoadThisApplicationWeWillSwitchOverToItsVMSpace*/ +asmvolatile( +"movl%0,%%eax\n" +"movl%%eax,%%cr3\n" +::"d"((uInt32*)(_current->tss.cr3)) +); + +/*LetsFindTheFile*/ +tmpFd=fopen(file,"r"); -/*LoadELFHeader*/ -binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)); - - -//kprintf(">a:%i:0x%X:0x%X<",sizeof(elfHeader),binaryHeader,tmpFd); -fread(binaryHeader,sizeof(elfHeader),1,tmpFd); - - -/*CheckIfAppIsARealApplication*/ -if((binaryHeader->eIdent[1]!='E')&&(binaryHeader->eIdent[2]!='L')&&(binaryHeader->eIdent[3]!='F')){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -kfree(binaryHeader); -fclose(tmpFd); -return; -} -elseif(binaryHeader->eType!=2){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -kfree(binaryHeader); -fclose(tmpFd); -return; -} -elseif(binaryHeader->eEntry==0x300000){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -kfree(binaryHeader); -fclose(tmpFd); -return; -} - -/*LoadTheProgramHeader(s)*/ -programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum); -fseek(tmpFd,binaryHeader->ePhoff,0); - -//kprintf(">c:%i:0x%X:0x%X<",sizeof(elfProgramHeader)*binaryHeader->ePhnum,programHeader,tmpFd); -fread(programHeader,(sizeof(elfProgramHeader)*binaryHeader->ePhnum),1,tmpFd); -//kprintf(">d<"); - -/*LoopThroughTheHeaderAndLoadSectionsWhichNeedToBeLoaded*/ -for(i=0;i<binaryHeader->ePhnum;i++){ -if(programHeader[i].phType==1){ -/* -AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect -Settingssoithelpsusinthefuture -*/ -for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ -/*Makereadonlyandread/write!!!*/ -if(vmm_remapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x),PAGE_DEFAULT)==0x0) -K_PANIC("RemapPageFailed"); - -memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x),0x0,0x1000); -} -_current->oInfo.vmStart=0x80000000; -_current->td.vm_daddr=(char*)(programHeader[i].phVaddr&0xFFFFF000); -/*NowLoadSectionToMemory*/ -fseek(tmpFd,programHeader[i].phOffset,0); -fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); -if((programHeader[i].phFlags&0x2)!=0x2){ -kprintf("pH:[0x%X]\n",programHeader[i].phMemsz); -for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ -if((vmm_setPageAttributes((programHeader[i].phVaddr&0xFFFFF000)+x,PAGE_PRESENT|PAGE_USER))!=0x0) -kpanic("Error:vmm_setPageAttributesfailed,File:%s,Line:%i\n",__FILE__,__LINE__); -} -} -} -} - -/*SetVirtualMemoryStart*/ -_current->oInfo.vmStart=0x80000000; -_current->td.vm_daddr=(char*)(programHeader[i].phVaddr&0xFFFFF000); - -/*SetUpStackSpace*/ -for(x=1;x<100;x++){ -vmm_remapPage(vmmFindFreePage(_current->id),STACK_ADDR-(x*0x1000),PAGE_DEFAULT|PAGE_STACK); +/*IfWeDontFindtheFileReturn*/ +if(tmpFd==0x0){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +fclose(tmpFd); +return; +} +if(tmpFd->perms==0x0){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +fclose(tmpFd); +return; +} + +/*LoadELFHeader*/ +binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)); + +//kprintf(">a:%i:0x%X:0x%X<",sizeof(elfHeader),binaryHeader,tmpFd); +fread(binaryHeader,sizeof(elfHeader),1,tmpFd); + +/*CheckIfAppIsARealApplication*/ +if((binaryHeader->eIdent[1]!='E')&&(binaryHeader->eIdent[2]!='L')&&(binaryHeader->eIdent[3]!='F')){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +kfree(binaryHeader); +fclose(tmpFd); +return; +} +elseif(binaryHeader->eType!=2){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +kfree(binaryHeader); +fclose(tmpFd); +return; +} +elseif(binaryHeader->eEntry==0x300000){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +kfree(binaryHeader); +fclose(tmpFd); +return; +} + +/*LoadTheProgramHeader(s)*/ +programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum); +fseek(tmpFd,binaryHeader->ePhoff,0); + +//kprintf(">c:%i:0x%X:0x%X<",sizeof(elfProgramHeader)*binaryHeader->ePhnum,programHeader,tmpFd); +fread(programHeader,(sizeof(elfProgramHeader)*binaryHeader->ePhnum),1,tmpFd); +//kprintf(">d<"); + +/*LoopThroughTheHeaderAndLoadSectionsWhichNeedToBeLoaded*/ +for(i=0;i<binaryHeader->ePhnum;i++){ +if(programHeader[i].phType==1){ +/* +AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect +Settingssoithelpsusinthefuture +*/ +for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ +/*Makereadonlyandread/write!!!*/ +if(vmm_remapPage(vmm_findFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x),PAGE_DEFAULT)==0x0) +K_PANIC("RemapPageFailed"); + +memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x),0x0,0x1000); +} +_current->oInfo.vmStart=0x80000000; +_current->td.vm_daddr=(char*)(programHeader[i].phVaddr&0xFFFFF000); +/*NowLoadSectionToMemory*/ +fseek(tmpFd,programHeader[i].phOffset,0); +fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); +if((programHeader[i].phFlags&0x2)!=0x2){ +kprintf("pH:[0x%X]\n",programHeader[i].phMemsz); +for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ +if((vmm_setPageAttributes((programHeader[i].phVaddr&0xFFFFF000)+x,PAGE_PRESENT|PAGE_USER))!=0x0) +kpanic("Error:vmm_setPageAttributesfailed,File:%s,Line:%i\n",__FILE__,__LINE__); +} +} } - -/*KernelStack0x2000byteslong*/ -vmm_remapPage(vmmFindFreePage(_current->id),0x5BC000,KERNEL_PAGE_DEFAULT|PAGE_STACK); -vmm_remapPage(vmmFindFreePage(_current->id),0x5BB000,KERNEL_PAGE_DEFAULT|PAGE_STACK); - -/*SetAllTheProperInformationForTheTask*/ -_current->tss.back_link=0x0; -_current->tss.esp0=0x5BC000; -_current->tss.ss0=0x10; -_current->tss.esp1=0x0; -_current->tss.ss1=0x0; -_current->tss.esp2=0x0; -_current->tss.ss2=0x0; -_current->tss.eip=(long)binaryHeader->eEntry; -_current->tss.eflags=0x206; -_current->tss.esp=STACK_ADDR-12; -_current->tss.ebp=STACK_ADDR; -_current->tss.esi=0x0; -_current->tss.edi=0x0; - -/*Settheseuptobering3tasks*/ -_current->tss.es=0x30+3; -_current->tss.cs=0x28+3; -_current->tss.ss=0x30+3; -_current->tss.ds=0x30+3; -_current->tss.fs=0x30+3; -_current->tss.gs=0x30+3; - -_current->tss.ldt=0x18; -_current->tss.trace_bitmap=0x0000; -_current->tss.io_map=0x8000; - -sched_setStatus(_current->id,READY); - -kfree(binaryHeader); -kfree(programHeader); -fclose(tmpFd); +} + +/*SetVirtualMemoryStart*/ +_current->oInfo.vmStart=0x80000000; +_current->td.vm_daddr=(char*)(programHeader[i].phVaddr&0xFFFFF000); + +/*SetUpStackSpace*/ +for(x=1;x<100;x++){ +vmm_remapPage(vmm_findFreePage(_current->id),STACK_ADDR-(x*0x1000),PAGE_DEFAULT|PAGE_STACK); +} + +/*KernelStack0x2000byteslong*/ +vmm_remapPage(vmm_findFreePage(_current->id),0x5BC000,KERNEL_PAGE_DEFAULT|PAGE_STACK); +vmm_remapPage(vmm_findFreePage(_current->id),0x5BB000,KERNEL_PAGE_DEFAULT|PAGE_STACK); + +/*SetAllTheProperInformationForTheTask*/ +_current->tss.back_link=0x0; +_current->tss.esp0=0x5BC000; +_current->tss.ss0=0x10; +_current->tss.esp1=0x0; +_current->tss.ss1=0x0; +_current->tss.esp2=0x0; +_current->tss.ss2=0x0; +_current->tss.eip=(long)binaryHeader->eEntry; +_current->tss.eflags=0x206; +_current->tss.esp=STACK_ADDR-12; +_current->tss.ebp=STACK_ADDR; +_current->tss.esi=0x0; +_current->tss.edi=0x0; + +/*Settheseuptobering3tasks*/ +_current->tss.es=0x30+3; +_current->tss.cs=0x28+3; +_current->tss.ss=0x30+3; +_current->tss.ds=0x30+3; +_current->tss.fs=0x30+3; +_current->tss.gs=0x30+3; -tmp=(uInt32*)_current->tss.esp0-5; -tmp[0]=binaryHeader->eEntry; -tmp[3]=STACK_ADDR-12; +_current->tss.ldt=0x18; +_current->tss.trace_bitmap=0x0000; +_current->tss.io_map=0x8000; -tmp=(uInt32*)STACK_ADDR-2; +sched_setStatus(_current->id,READY); -if(_current->id>4) -kprintf("argv[0]:[%s]\n",argv[0]); -kprintf("argv:[0x%X]\n",argv); -tmp[0]=(uint32_t)argv; -tmp[1]=(uint32_t)argv; - - -/*SwitchBackToTheKernelsVMSpace*/ -asmvolatile( -"movl%0,%%eax\n" -"movl%%eax,%%cr3\n" -::"d"((uInt32*)(kernelPageDirectory)) -); - -/*FinallyReturn*/ -return; -} - -/***************************************************************************************** - -Function:voidsysExec(); -Description:ThisIsTheSystemCallToExecuteANewTask - -Notes: -04-22-03-ItNowLoadsSectionsNotTheFullFile - -*****************************************************************************************/ -voidsysExec(char*file,char*ap){ -inti=0x0; -intx=0x0; -intargc=0x0; -uInt32*tmp=0x0; -uInt32ldAddr=0x0; -uInt32seg_size=0x0; -uInt32seg_addr=0x0; -char*interp=0x0; -char**argv=0x0; -char**argvNew=0x0; -char*args=0x0; - -fileDescriptor*tmpFd=0x0; -elfHeader*binaryHeader=0x0; -elfProgramHeader*programHeader=0x0; -elfSectionHeader*sectionHeader=0x0; -elfDynamic*elfDynamicS=0x0; -structi386_frame*iFrame=0x0; - - -if(_current->id>4){ -sys_exec(file,ap); -return; -} - -tmpFd=fopen(file,"r"); -_current->imageFd=tmpFd; -/*IfWeDontFindtheFileReturn*/ -if(tmpFd==0x0){ -return; -} -if(tmpFd->perms==0){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -fclose(tmpFd); -return; -} - -/*LoadELFHeader*/ - -if((binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)))==0x0) -endTask(_current->id); -fread(binaryHeader,sizeof(elfHeader),1,tmpFd); -/*SetsectionHeaderToPointToLoadedBinaryToWeCanGatherInfo*/ - -/*CheckIfAppIsARealApplication*/ -if((binaryHeader->eIdent[1]!='E')&&(binaryHeader->eIdent[2]!='L')&&(binaryHeader->eIdent[3]!='F')){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -kfree(binaryHeader); -fclose(tmpFd); - -return; -} -elseif(binaryHeader->eType!=2){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -kfree(binaryHeader); -fclose(tmpFd); -return; -} -elseif(binaryHeader->eEntry==0x300000){ -kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); -kfree(binaryHeader); -fclose(tmpFd); -return; -} - -/*LoadTheProgramHeader(s)*/ -if((programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum))==0x0) -endTask(_current->id); - -assert(programHeader); -fseek(tmpFd,binaryHeader->ePhoff,0); -fread(programHeader,(sizeof(elfProgramHeader)*binaryHeader->ePhnum),1,tmpFd); - -if((sectionHeader=(elfSectionHeader*)kmalloc(sizeof(elfSectionHeader)*binaryHeader->eShnum))==0x0) -endTask(_current->id); +kfree(binaryHeader); +kfree(programHeader); +fclose(tmpFd); + +tmp=(uInt32*)_current->tss.esp0-5; +tmp[0]=binaryHeader->eEntry; +tmp[3]=STACK_ADDR-12; + +tmp=(uInt32*)STACK_ADDR-2; + +if(_current->id>4) +kprintf("argv[0]:[%s]\n",argv[0]); +kprintf("argv:[0x%X]\n",argv); +tmp[0]=(uint32_t)argv; +tmp[1]=(uint32_t)argv; + +/*SwitchBackToTheKernelsVMSpace*/ +asmvolatile( +"movl%0,%%eax\n" +"movl%%eax,%%cr3\n" +::"d"((uInt32*)(kernelPageDirectory)) +); + +/*FinallyReturn*/ +return; +} + +/***************************************************************************************** + +Function:voidsysExec(); +Description:ThisIsTheSystemCallToExecuteANewTask + +Notes: +04-22-03-ItNowLoadsSectionsNotTheFullFile + +*****************************************************************************************/ +voidsysExec(char*file,char*ap){ +inti=0x0; +intx=0x0; +intargc=0x0; +unsignedint*tmp=0x0; +uInt32ldAddr=0x0; +uInt32seg_size=0x0; +uInt32seg_addr=0x0; +char*interp=0x0; +char**argv=0x0; +char**argvNew=0x0; +char*args=0x0; + +fileDescriptor*tmpFd=0x0; +elfHeader*binaryHeader=0x0; +elfProgramHeader*programHeader=0x0; +elfSectionHeader*sectionHeader=0x0; +elfDynamic*elfDynamicS=0x0; +structi386_frame*iFrame=0x0; + +tmpFd=fopen(file,"r"); +_current->files[0]=tmpFd; +/*IfWeDontFindtheFileReturn*/ +if(tmpFd==0x0){ +return; +} +if(tmpFd->perms==0){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +fclose(tmpFd); +return; +} + +/*LoadELFHeader*/ + +if((binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)))==0x0) +endTask(_current->id); +fread(binaryHeader,sizeof(elfHeader),1,tmpFd); +/*SetsectionHeaderToPointToLoadedBinaryToWeCanGatherInfo*/ + +/*CheckIfAppIsARealApplication*/ +if((binaryHeader->eIdent[1]!='E')&&(binaryHeader->eIdent[2]!='L')&&(binaryHeader->eIdent[3]!='F')){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +kfree(binaryHeader); +fclose(tmpFd); + +return; +} +elseif(binaryHeader->eType!=2){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +kfree(binaryHeader); +fclose(tmpFd); +return; +} +elseif(binaryHeader->eEntry==0x300000){ +kprintf("ExecFormatError:BinaryFileNotExecutable.\n"); +kfree(binaryHeader); +fclose(tmpFd); +return; +} + +/*LoadTheProgramHeader(s)*/ +if((programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum))==0x0) +endTask(_current->id); + +assert(programHeader); +fseek(tmpFd,binaryHeader->ePhoff,0); +fread(programHeader,(sizeof(elfProgramHeader)*binaryHeader->ePhnum),1,tmpFd); -assert(sectionHeader); -fseek(tmpFd,binaryHeader->eShoff,0); -fread(sectionHeader,sizeof(elfSectionHeader)*binaryHeader->eShnum,1,tmpFd); - -/*LoopThroughTheHeaderAndLoadSectionsWhichNeedToBeLoaded*/ -for(i=0;i<binaryHeader->ePhnum;i++){ -switch(programHeader[i].phType){ -casePT_LOAD: -seg_addr=trunc_page(programHeader[i].phVaddr); -seg_size=round_page(programHeader[i].phMemsz+programHeader[i].phVaddr-seg_addr); - -/* -AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect -Settingssoithelpsusinthefuture -*/ -for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ -/*Makereadonlyandread/write!!!*/ -if(vmm_remapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x),PAGE_DEFAULT)==0x0) -K_PANIC("Error:RemapPageFailed"); -memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x),0x0,0x1000); -} - -/*NowLoadSectionToMemory*/ -fseek(tmpFd,programHeader[i].phOffset,0); -fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); -if((programHeader[i].phFlags&0x2)!=0x2){ -for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ -if((vmm_setPageAttributes((programHeader[i].phVaddr&0xFFFFF000)+x,PAGE_PRESENT|PAGE_USER))!=0x0) -kpanic("Error:vmm_setPageAttributesfailed,File:%s,Line:%i\n",__FILE__,__LINE__); -} -} -kprintf("settingdaddr\n"); -if(binaryHeader->eEntry>=programHeader[i].phVaddr&&binaryHeader->eEntry<(programHeader[i].phVaddr+programHeader[i].phMemsz)){ -/*We'resuposedtodosomethinghere?*/ -} -else{ -_current->td.vm_dsize=seg_size>>PAGE_SHIFT; -_current->td.vm_daddr=(char*)seg_addr; -} - -_current->oInfo.vmStart=((programHeader[i].phVaddr&0xFFFFF000)+0xA900000); -break; -casePT_DYNAMIC: -//newLoc=(char*)programHeader[i].phVaddr; -elfDynamicS=(elfDynamic*)programHeader[i].phVaddr; -fseek(tmpFd,programHeader[i].phOffset,0); -fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); -break; -casePT_INTERP: -interp=(char*)kmalloc(programHeader[i].phFilesz); -fseek(tmpFd,programHeader[i].phOffset,0); -fread((void*)interp,programHeader[i].phFilesz,1,tmpFd); -kprintf("Interp:[%s]\n",interp); -ldAddr=ldEnable(); -break; -default: -break; -} -} - -/*Whatisthisdoing?11/23/06*/ -if(elfDynamicS!=0x0){ -for(i=0;i<12;i++){ -if(elfDynamicS[i].dynVal==0x3){ -tmp=(uInt32*)elfDynamicS[i].dynPtr; -if(tmp==0x0) -kpanic("tmp:NULL\n"); -tmp[2]=(uInt32)ldAddr; -tmp[1]=(uInt32)tmpFd; -break; -} -/* -else{ -kprintf("dyn_val:%i",elfDynamicS[i].dynVal); -} -*/ -} -} - -_current->td.vm_dsize=seg_size>>PAGE_SHIFT; -_current->td.vm_daddr=(char*)seg_addr; +if((sectionHeader=(elfSectionHeader*)kmalloc(sizeof(elfSectionHeader)*binaryHeader->eShnum))==0x0) +endTask(_current->id); + +assert(sectionHeader); +fseek(tmpFd,binaryHeader->eShoff,0); +fread(sectionHeader,sizeof(elfSectionHeader)*binaryHeader->eShnum,1,tmpFd); + +/*LoopThroughTheHeaderAndLoadSectionsWhichNeedToBeLoaded*/ +for(i=0;i<binaryHeader->ePhnum;i++){ +switch(programHeader[i].phType){ +casePT_LOAD: +seg_addr=trunc_page(programHeader[i].phVaddr); +seg_size=round_page(programHeader[i].phMemsz+programHeader[i].phVaddr-seg_addr); + +/* +AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect +Settingssoithelpsusinthefuture +*/ +for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ +/*Makereadonlyandread/write!!!*/ +if(vmm_remapPage(vmm_findFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x),PAGE_DEFAULT)==0x0) +K_PANIC("Error:RemapPageFailed"); +memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x),0x0,0x1000); +} + +/*NowLoadSectionToMemory*/ +fseek(tmpFd,programHeader[i].phOffset,0); +fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); +if((programHeader[i].phFlags&0x2)!=0x2){ +for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ +if((vmm_setPageAttributes((programHeader[i].phVaddr&0xFFFFF000)+x,PAGE_PRESENT|PAGE_USER))!=0x0) +kpanic("Error:vmm_setPageAttributesfailed,File:%s,Line:%i\n",__FILE__,__LINE__); +} +} +kprintf("settingdaddr\n"); +if(binaryHeader->eEntry>=programHeader[i].phVaddr&&binaryHeader->eEntry<(programHeader[i].phVaddr+programHeader[i].phMemsz)){ +/*We'resuposedtodosomethinghere?*/ +} +else{ +_current->td.vm_dsize=seg_size>>PAGE_SHIFT; +_current->td.vm_daddr=(char*)seg_addr; +} + +_current->oInfo.vmStart=((programHeader[i].phVaddr&0xFFFFF000)+0xA900000); +break; +casePT_DYNAMIC: +//newLoc=(char*)programHeader[i].phVaddr; +elfDynamicS=(elfDynamic*)programHeader[i].phVaddr; +fseek(tmpFd,programHeader[i].phOffset,0); +fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); +break; +casePT_INTERP: +interp=(char*)kmalloc(programHeader[i].phFilesz); +fseek(tmpFd,programHeader[i].phOffset,0); +fread((void*)interp,programHeader[i].phFilesz,1,tmpFd); +kprintf("Interp:[%s]\n",interp); +ldAddr=ldEnable(); +break; +default: +break; +} +} + +/*Whatisthisdoing?11/23/06*/ +if(elfDynamicS!=0x0){ +for(i=0;i<12;i++){ +if(elfDynamicS[i].dynVal==0x3){ +tmp=(void*)elfDynamicS[i].dynPtr; +if(tmp==0x0) +kpanic("tmp:NULL\n"); +tmp[2]=(uInt32)ldAddr; +tmp[1]=(uInt32)tmpFd; +break; +} +/* +else{ +kprintf("dyn_val:%i",elfDynamicS[i].dynVal); +} +*/ +} +} -argv=ap; - -if(argv[1]!=0x0){ -argc=argv[0]; -args=(char*)vmmGetFreeVirtualPage(_current->id,1,VM_TASK); -memset(args,0x0,0x1000); -x=0x0; -argvNew=(char**)kmalloc(sizeof(char*)*argc); -for(i=0x0;i<argc;i++){ -strcpy(args+x,argv[i+1]); -argvNew[i]=args+x; -x+=strlen(argv[i+1])+1; -//args[x]='\0'; -//x++; -} -argv=argvNew; -} - -vmm_cleanVirtualSpace(_current->td.vm_daddr+(_current->td.vm_dsize<<PAGE_SIZE)); +_current->td.vm_dsize=seg_size>>PAGE_SHIFT; +_current->td.vm_daddr=(char*)seg_addr; + +argv=&ap; + +if(argv[1]!=0x0){ +argc=(int)argv[0]; +args=(char*)vmmGetFreeVirtualPage(_current->id,1,VM_TASK); +memset(args,0x0,0x1000); +x=0x0; +argvNew=(char**)kmalloc(sizeof(char*)*argc); +for(i=0x0;i<argc;i++){ +strcpy(args+x,argv[i+1]); +argvNew[i]=args+x; +x+=strlen(argv[i+1])+1; +//args[x]='\0'; +//x++; +} +argv=argvNew; +} - -iFrame=_current->tss.esp0-sizeof(structi386_frame); -iFrame->ebp=STACK_ADDR; -iFrame->eip=binaryHeader->eEntry; -iFrame->user_esp=STACK_ADDR-12; - -//if(_current->id>3){ +vmm_cleanVirtualSpace(_current->td.vm_daddr+(_current->td.vm_dsize<<PAGE_SIZE)); + +iFrame=(structi386_frame*)_current->tss.esp0-sizeof(structi386_frame); +iFrame->ebp=STACK_ADDR; +iFrame->eip=binaryHeader->eEntry; +iFrame->user_esp=STACK_ADDR-12; -iFrame->user_esp=((uint32_t)STACK_ADDR)-(sizeof(uint32_t)*(argc+3)); -tmp=iFrame->user_esp; - -tmp[0]=argc; -for(i=0;i<argc;i++){ -tmp[i+1]=argv[i]; -} -tmp[argc+1]=0x0; -tmp[argc+2]=0x1; -//} -//else{ -//tmp=(uint32_t*)STACK_ADDR-2; -//tmp[0]=0x1; -//tmp[1]=0x0; -//tmp[1]=(uint32_t)argv; -//} -kfree(argvNew); -/*NowThatWeRelocatedTheBinaryWeCanUnmapAndFreeHeaderInfo*/ -kfree(binaryHeader); -kfree(programHeader); - -return; -} - -voidsys_exec(char*file,char*ap){ -interror=0x0; -inti=0x0; -intx=0x0; -intargc=0x0; -uint32_tseg_size=0x0; -uint32_tseg_addr=0x0; -uint32_taddr=0x0; -uint32_teip=0x0; -uint32_tproghdr=0x0; -char*args=0x0; -char*interp=0x0; -char**argv=0x0; -char**argvNew=0x0; -elfHeader*binaryHeader=0x0; -elfProgramHeader*programHeader=0x0; -structi386_frame*iFrame=0x0; -Elf_Auxargs*auxargs=0x0; - -_current->imageFd=fopen(file,"r"); -if(_current->imageFd==0x0) -return(-1); - -/*LoadtheELFheader*/ -if((binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)))==0x0) -K_PANIC("mallocfailed!"); -fread(binaryHeader,sizeof(elfHeader),1,_current->imageFd); - -/*CheckIfAppIsARealApplication*/ -if(((binaryHeader->eIdent[1]!='E')&&(binaryHeader->eIdent[2]!='L')&&(binaryHeader->eIdent[3]!='F'))||(binaryHeader->eType!=ET_EXEC)){ -kfree(binaryHeader); -fclose(_current->imageFd); -return(-1); -} - -/*LoadTheProgramHeader(s)*/ -if((programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum))==0x0) -K_PANIC("mallocfailed!"); -fseek(_current->imageFd,binaryHeader->ePhoff,0); -fread(programHeader,(sizeof(elfProgramHeader)*binaryHeader->ePhnum),1,_current->imageFd); - -/*LoopThroughTheHeaderAndLoadSectionsWhichNeedToBeLoaded*/ -for(i=0x0;i<binaryHeader->ePhnum;i++){ -switch(programHeader[i].phType){ -casePT_LOAD: -seg_addr=trunc_page(programHeader[i].phVaddr); -seg_size=round_page(programHeader[i].phMemsz+programHeader[i].phVaddr-seg_addr); - -/* -AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect -Settingssoithelpsusinthefuture -*/ -for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ -/*Makereadonlyandread/write!!!*/ -if(vmm_remapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x),PAGE_DEFAULT)==0x0) -K_PANIC("Error:RemapPageFailed"); -memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x),0x0,0x1000); -} - -/*NowLoadSectionToMemory*/ -fseek(_current->imageFd,programHeader[i].phOffset,0); -fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,_current->imageFd); -if((programHeader[i].phFlags&0x2)!=0x2){ -for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ -if((vmm_setPageAttributes((programHeader[i].phVaddr&0xFFFFF000)+x,PAGE_PRESENT|PAGE_USER))!=0x0) -K_PANIC("vmm_setPageAttributesfailed"); -} -} -if(binaryHeader->eEntry>=programHeader[i].phVaddr&&binaryHeader->eEntry<(programHeader[i].phVaddr+programHeader[i].phMemsz)){ -/*We'resuposedtodosomethinghere?*/ -} -else{ -_current->td.vm_dsize=seg_size>>PAGE_SHIFT; -_current->td.vm_daddr=(char*)seg_addr; -} - -_current->oInfo.vmStart=((programHeader[i].phVaddr&0xFFFFF000)+0xA900000); -break; -casePT_INTERP: -interp=(char*)kmalloc(programHeader[i].phFilesz); -if(interp==0x0) -K_PANIC("mallocfailed"); - -fseek(_current->imageFd,programHeader[i].phOffset,0); -fread((void*)interp,programHeader[i].phFilesz,1,_current->imageFd); -kprintf("Interp:[%s]\n",interp); -//ldAddr=ldEnable(); -break; -casePT_PHDR: -proghdr=programHeader[i].phVaddr; -break; -default: -break; -} -} - -addr=LD_START; - - -if(interp!=0x0){ -kprintf("TEST"); -elf_loadfile(_current,interp,&addr,&eip); -} -kprintf("[0x%X][0x%X]\n",eip,addr); - -_current->td.vm_dsize=seg_size>>PAGE_SHIFT; -_current->td.vm_daddr=(char*)seg_addr; +//if(_current->id>3){ + +iFrame->user_esp=((uint32_t)STACK_ADDR)-(sizeof(uint32_t)*(argc+3)); +tmp=(void*)iFrame->user_esp; + +tmp[0]=argc; +for(i=0;i<argc;i++){ +tmp[i+1]=(u_int)argv[i]; +} +tmp[argc+1]=0x0; +tmp[argc+2]=0x1; +//} +//else{ +//tmp=(uint32_t*)STACK_ADDR-2; +//tmp[0]=0x1; +//tmp[1]=0x0; +//tmp[1]=(uint32_t)argv; +//} +kfree(argvNew); +/*NowThatWeRelocatedTheBinaryWeCanUnmapAndFreeHeaderInfo*/ +kfree(binaryHeader); +kfree(programHeader); + +return; +} + +voidsys_exec(char*file,char*ap){ +interror=0x0; +inti=0x0; +intx=0x0; +intargc=0x0; +uint32_t*tmp=0x0; +uint32_tseg_size=0x0; +uint32_tseg_addr=0x0; +uint32_taddr=0x0; +uint32_teip=0x0; +uint32_tproghdr=0x0; +char*args=0x0; +char*interp=0x0; +char**argv=0x0; +char**argvNew=0x0; +elfHeader*binaryHeader=0x0; +elfProgramHeader*programHeader=0x0; +structi386_frame*iFrame=0x0; +//Elf_Auxargs*auxargs=0x0; + +_current->files[0]=fopen(file,"r"); +if(_current->files[0]==0x0) +return;//WeNeedToSeterrno + +/*LoadtheELFheader*/ +if((binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)))==0x0) +K_PANIC("mallocfailed!"); +fread(binaryHeader,sizeof(elfHeader),1,_current->files[0]); + +/*CheckIfAppIsARealApplication*/ +if(((binaryHeader->eIdent[1]!='E')&&(binaryHeader->eIdent[2]!='L')&&(binaryHeader->eIdent[3]!='F'))||(binaryHeader->eType!=ET_EXEC)){ +kfree(binaryHeader); +fclose(_current->files[0]); +return;//WeNeedToSeterrno +} + +/*LoadTheProgramHeader(s)*/ +if((programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum))==0x0) +K_PANIC("mallocfailed!"); +fseek(_current->files[0],binaryHeader->ePhoff,0); +fread(programHeader,(sizeof(elfProgramHeader)*binaryHeader->ePhnum),1,_current->files[0]); + +/*LoopThroughTheHeaderAndLoadSectionsWhichNeedToBeLoaded*/ +for(i=0x0;i<binaryHeader->ePhnum;i++){ +switch(programHeader[i].phType){ +casePT_LOAD: +seg_addr=trunc_page(programHeader[i].phVaddr); +seg_size=round_page(programHeader[i].phMemsz+programHeader[i].phVaddr-seg_addr); + +/* +AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect +Settingssoithelpsusinthefuture +*/ +for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ +/*Makereadonlyandread/write!!!*/ +if(vmm_remapPage(vmm_findFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x),PAGE_DEFAULT)==0x0) +K_PANIC("Error:RemapPageFailed"); +memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x),0x0,0x1000); +} + +/*NowLoadSectionToMemory*/ +fseek(_current->files[0],programHeader[i].phOffset,0); +fread((void*)programHeader[i].phVaddr,programHeader[i].phFilesz,1,_current->files[0]); +if((programHeader[i].phFlags&0x2)!=0x2){ +for(x=0x0;x<(programHeader[i].phMemsz);x+=0x1000){ +if((vmm_setPageAttributes((programHeader[i].phVaddr&0xFFFFF000)+x,PAGE_PRESENT|PAGE_USER))!=0x0) +K_PANIC("vmm_setPageAttributesfailed"); +} +} +if(binaryHeader->eEntry>=programHeader[i].phVaddr&&binaryHeader->eEntry<(programHeader[i].phVaddr+programHeader[i].phMemsz)){ +/*We'resuposedtodosomethinghere?*/ +} +else{ +_current->td.vm_dsize=seg_size>>PAGE_SHIFT; +_current->td.vm_daddr=(char*)seg_addr; +} + +_current->oInfo.vmStart=((programHeader[i].phVaddr&0xFFFFF000)+0xA900000); +break; +casePT_INTERP: +interp=(char*)kmalloc(programHeader[i].phFilesz); +if(interp==0x0) +K_PANIC("mallocfailed") +; + +fseek(_current->files[0],programHeader[i].phOffset,0); +fread((void*)interp,programHeader[i].phFilesz,1,_current->files[0]); +kprintf("Interp:[%s]\n",interp); +//ldAddr=ldEnable(); +break; +casePT_PHDR: +proghdr=programHeader[i].phVaddr; +break; +default: +break; +} +} + +addr=LD_START; + +if(interp!=0x0){ +//kprintf("TEST"); +elf_loadfile(_current,interp,&addr,&eip); +} +//kprintf("[0x%X][0x%X]\n",eip,addr); -argv=ap; - -if(argv[1]!=0x0){ -argc=argv[0]; -args=(char*)vmmGetFreeVirtualPage(_current->id,1,VM_TASK); -memset(args,0x0,0x1000); -x=0x0; -argvNew=(char**)kmalloc(sizeof(char*)*argc); -for(i=0x0;i<argc;i++){ -strcpy(args+x,argv[i+1]); -argvNew[i]=args+x; -x+=strlen(argv[i+1])+1; -} -argv=argvNew; -} - -vmm_cleanVirtualSpace(_current->td.vm_daddr+(_current->td.vm_dsize<<PAGE_SIZE)); - +_current->td.vm_dsize=seg_size>>PAGE_SHIFT; +_current->td.vm_daddr=(char*)seg_addr; + +argv=ap; + +if(argv[1]!=0x0){ +argc=argv[0]; +args=(char*)vmmGetFreeVirtualPage(_current->id,1,VM_TASK); +memset(args,0x0,0x1000); +x=0x0; +argvNew=(char**)kmalloc(sizeof(char*)*argc); +for(i=0x0;i<argc;i++){ +strcpy(args+x,argv[i+1]); +argvNew[i]=args+x; +x+=strlen(argv[i+1])+1; +} +argv=argvNew; +} -iFrame=_current->tss.esp0-sizeof(structi386_frame); -iFrame->ebp=STACK_ADDR; -iFrame->eip=eip; - -//if(_current->id>3){ - -iFrame->user_esp=((uint32_t)STACK_ADDR)-(sizeof(uint32_t)*(argc+3+sizeof(Elf_Auxargs))); -args=iFrame->user_esp; +vmm_cleanVirtualSpace(_current->td.vm_daddr+(_current->td.vm_dsize<<PAGE_SIZE)); + +iFrame=_current->tss.esp0-sizeof(structi386_frame); +iFrame->ebp=STACK_ADDR; +iFrame->eip=eip; + +//if(_current->id>3){ -args[0]=argc; -for(i=0;i<argc;i++){ -args[i+1]=argv[i]; -} -args[argc+2]=0x0; -auxargs=iFrame->user_esp+argc+2; -auxargs->execfd=-1; -auxargs->phdr=proghdr; -auxargs->phent=binaryHeader->ePhentsize; -auxargs->phnum=binaryHeader->ePhnum; -auxargs->pagesz=PAGE_SIZE; -auxargs->base=addr; -auxargs->flags=0x0; -auxargs->entry=binaryHeader->eEntry; -auxargs->trace=0x0; -kprintf("\n\nDOH\n\n"); - -//while(1); -/* -error=elf_loadfile(_current,file,0x0,0x0); -if(error) -K_PANIC("elf_loadfilefailed"); -*/ -return; -} - -/*** -END -***/ +iFrame->user_esp=((uint32_t)STACK_ADDR)-(sizeof(uint32_t)*(argc+4));//+(sizeof(Elf_Auxargs)*2))); +kprintf("\n\n\nuser_esp:[0x%X]\n",iFrame->user_esp); +tmp=iFrame->user_esp; + +tmp[0]=argc; +for(i=0;i<argc;i++){ +tmp[i+1]=argv[i]; +} +args=(char*)vmmGetFreeVirtualPage(_current->id,1,VM_TASK); +memset(args,0x0,0x1000); +strcpy(args,"LIBRARY_PATH=/lib"); +tmp[argc+2]=args; +kprintf("env:[0x%X][0x%X]\n",(uInt32)tmp+argc+2,tmp[argc+2]); +tmp[argc+3]=0x0; +kprintf("env:[0x%X][0x%X]\n",(uInt32)tmp+argc+2,tmp[argc+2]); +//auxargs=iFrame->user_esp+argc+3; +tmp=iFrame->user_esp; +tmp+=argc+4; + +/* +auxargs->execfd=-1; +auxargs->phdr=proghdr; +auxargs->phent=binaryHeader->ePhentsize; +auxargs->phnum=binaryHeader->ePhnum; +auxargs->pagesz=PAGE_SIZE; +auxargs->base=addr; +auxargs->flags=0x0; +auxargs->entry=binaryHeader->eEntry; +auxargs->trace=0x0; + +AUXARGS_ENTRY(tmp,AT_PHDR,auxargs->phdr); +AUXARGS_ENTRY(tmp,AT_PHENT,auxargs->phent); +AUXARGS_ENTRY(tmp,AT_PHNUM,auxargs->phnum); +AUXARGS_ENTRY(tmp,AT_PAGESZ,auxargs->pagesz); +AUXARGS_ENTRY(tmp,AT_FLAGS,auxargs->flags); +AUXARGS_ENTRY(tmp,AT_ENTRY,auxargs->entry); +AUXARGS_ENTRY(tmp,AT_BASE,auxargs->base); +AUXARGS_ENTRY(tmp,AT_NULL,0); + +kprintf("AT_BASE:[0x%X]\n",auxargs->base); +*/ + +//iFrame->ebx=0x0; +//iFrame->ebx=0x0; +//iFrame->eip=binaryHeader->eEntry; +//kprintf("\n\nDOH:[0x%X]\n\n",iFrame->eip); +//while(1); +//while(1); +/* +error=elf_loadfile(_current,file,0x0,0x0); +if(error) +K_PANIC("elf_loadfilefailed"); +*/ +return; +} + +/*** +END +***/ - + diff --git a/doc/xml/exec_8h.xml b/doc/xml/exec_8h.xml index 5d0b045..b41b452 100644 --- a/doc/xml/exec_8h.xml +++ b/doc/xml/exec_8h.xml @@ -1,148 +1,297 @@ - - - + + + exec.h - ubixos/types.h + sys/types.h ubixos/sched.h - src/sys/init/main.c - src/sys/kernel/exec.c - src/sys/kernel/syscall.c - src/sys/kernel/systemtask.c - src/sys/kernel/ubthread.c - src/sys/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/sde/main.cc - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + - + - + - + - + - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - + - + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void execFile - (char *file, int argc, char **argv, int console) + (char *file, char **argv, char **envp, int console) execFile char * file - int - argc + char ** + argv char ** - argv + envp int @@ -154,91 +303,19 @@ - - _current - assert - tssStruct::back_link - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::ebp - tssStruct::edi - elfHeader::eEntry - tssStruct::eflags - elfHeader::eIdent - tssStruct::eip - elfHeader::ePhnum - elfHeader::ePhoff - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - elfHeader::eType - fclose - fopen - fread - tssStruct::fs - fseek - taskStruct::gid - tssStruct::gs - taskStruct::id - tssStruct::io_map - K_PANIC - KERNEL_PAGE_DEFAULT - kernelPageDirectory - kfree - kmalloc - kpanic - kprintf - tssStruct::ldt - memset - taskStruct::oInfo - tty_termNode::owner - PAGE_DEFAULT - PAGE_PRESENT - PAGE_STACK - PAGE_USER - fileDescriptorStruct::perms - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - READY - sched_setStatus - schedNewTask - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - STACK_ADDR - taskStruct::td - taskStruct::term - tssStruct::trace_bitmap - taskStruct::tss - tty_find - taskStruct::uid - thread::vm_daddr - vmm_remapPage - vmm_setPageAttributes - vmmCreateVirtualSpace - vmmFindFreePage - osInfo::vmStart - x1000 - x18 - x30 - kmain + - - uInt32 - uInt32 execThread - (void(*tproc)(void), uInt32, char *) + + uint32_t + uint32_t execThread + (void(*tproc)(void), uint32_t, char *) execThread void(*)(void) tproc - uInt32 + uint32_t char * @@ -249,105 +326,69 @@ - - assert - tssStruct::back_link - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::ebp - tssStruct::edi - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - tssStruct::fs - tssStruct::gs - taskStruct::id - taskStruct::imageFd - tssStruct::io_map - kernelPageDirectory - kpanic - tssStruct::ldt - taskStruct::oInfo - READY - sched_setStatus - schedNewTask - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - tssStruct::trace_bitmap - taskStruct::tss - osInfo::vmStart - kmain - ubthread_create + + assert + tssStruct::back_link + tssStruct::cr3 + tssStruct::cs + tssStruct::ds + tssStruct::ebp + tssStruct::edi + tssStruct::eflags + tssStruct::eip + tssStruct::es + tssStruct::esi + tssStruct::esp + tssStruct::esp0 + tssStruct::esp1 + tssStruct::esp2 + taskStruct::files + tssStruct::fs + tssStruct::gs + taskStruct::id + tssStruct::io_map + kernelPageDirectory + kpanic + tssStruct::ldt + taskStruct::oInfo + PAGE_SIZE + READY + sched_setStatus + schedNewTask + tssStruct::ss + tssStruct::ss0 + tssStruct::ss1 + tssStruct::ss2 + tssStruct::trace_bitmap + taskStruct::tss + vmm_getFreeKernelPage + osInfo::vmStart - - void - void sys_exec - (char *file, char *ap) + + int + int sys_exec + (struct thread *, char *, char **, char **) sys_exec - char * - file + struct thread * char * - ap + + + char ** + + + char ** -New exec... + -Clean the virtual of COW pages left over from the forkAdjust iframebuild argc and argv[]Start of Env - - _current - elfHeader::eEntry - elfHeader::eIdent - i386_frame::eip - elfHeader::ePhnum - elfHeader::ePhoff - ET_EXEC - elfHeader::eType - fclose - fopen - fread - fseek - taskStruct::id - taskStruct::imageFd - K_PANIC - kfree - kmalloc - kprintf - memset - taskStruct::oInfo - PAGE_DEFAULT - PAGE_PRESENT - PAGE_SHIFT - PAGE_USER - elfProgramHeader::phMemsz - elfProgramHeader::phOffset - elfProgramHeader::phVaddr - PT_INTERP - PT_LOAD - PT_PHDR - round_page - taskStruct::td - trunc_page - thread::vm_daddr - thread::vm_dsize - vmm_remapPage - vmm_setPageAttributes - vmmFindFreePage - osInfo::vmStart - x1000 - sysExec +Clean the virtual of COW pages left over from the fork + + @@ -355,51 +396,47 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: exec_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_EXEC_H -#define_EXEC_H - -#include<ubixos/types.h> -#include<ubixos/sched.h> - -uInt32execThread(void(*tproc)(void),uInt32,char*); -voidexecFile(char*file,intargc,char**argv,intconsole); -voidsys_exec(char*file,char*ap); +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_EXEC_H +#define_UBIXOS_EXEC_H + +#include<sys/types.h> +#include<ubixos/sched.h> + +uint32_texecThread(void(*tproc)(void),uint32_t,char*); +voidexecFile(char*file,char**argv,char**envp,intconsole); + +intsys_exec(structthread*,char*,char**,char**); -#endif - -/*** -END -***/ +#endif/*END_UBIXOS_EXEC_H*/ - + diff --git a/doc/xml/fdc_8c.xml b/doc/xml/fdc_8c.xml index 06d651f..f635e62 100644 --- a/doc/xml/fdc_8c.xml +++ b/doc/xml/fdc_8c.xml @@ -1,164 +1,437 @@ - - - + + + fdc.c isa/fdc.h isa/8259.h sys/video.h sys/gdt.h sys/idt.h - ubixos/types.h ubixos/spinlock.h sys/io.h sys/dma.h - sys/device.h + sys/device.h lib/kprintf.h lib/kmalloc.h devfs/devfs.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + - - - + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + bool + bool diskChange + + diskChange + = FALSE + + + + + + + + + + bool + volatile bool done + + done + = FALSE + + + + + + + + + + struct spinLock + struct spinLock fdcSpinLock + + fdcSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + Int8 + volatile Int8 fdcTrack + + fdcTrack + = 0xff + + + + + + + + + + drvGeom + drvGeom geometry + + geometry + = { dg144Heads, dg144Tracks, dg144Spt } + + + + + + + + + + bool + bool motor + + motor + = FALSE + + + + + + + + + + Int8 + Int8 sr0 + + sr0 + = 0 + + + + + + + + + + Int8 + Int8 statSize + + statSize + = 0 + + + + + + + + + + Int8 + Int8 status[7] + [7] + status + = { 0 } + + + + + + + + + + unsigned long + unsigned long tbaddr + + tbaddr + = 0x80000L + + + + + + + + + + int + volatile int timeOut + + timeOut + = 0 + + + + + + + + + - + asm - (".globl floppyIsr \n""floppyIsr: \n"" pusha \n"" push %ss \n"" push %ds \n"" push %es \n"" push %fs \n"" push %gs \n"" call floppyIsrhndlr \n"" pop %gs \n"" pop %fs \n"" pop %es \n"" pop %ds \n"" pop %ss \n"" popa \n"" iret \n") + (".globl floppyIsr \n" "floppyIsr: \n" " pusha \n" " push %ss \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " call floppyIsrhndlr \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n") asm - ".globl floppyIsr \n""floppyIsr: \n"" pusha \n"" push %ss \n"" push %ds \n"" push %es \n"" push %fs \n"" push %gs \n"" call floppyIsrhndlr \n"" pop %gs \n"" pop %fs \n"" pop %es \n"" pop %ds \n"" pop %ss \n"" popa \n"" iret \n" + ".globl floppyIsr \n" "floppyIsr: \n" " pusha \n" " push %ss \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " call floppyIsrhndlr \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n" @@ -166,9 +439,9 @@ - + - + void void block2Hts (int block, int *head, int *track, int *sector) @@ -195,13 +468,10 @@ - - geometry - DrvGeom::heads - DrvGeom::spt - fdcRw + + fdcRw - + int int fdc_init () @@ -212,27 +482,27 @@ - - devfs_makeNode - device_add - dInt - dPresent - fdcInit2 - fdcRead - fdcWrite - floppyIsr - device_interface::init - irqEnable - kmalloc - device_interface::major - mVec - device_interface::read - device_interface::reset - reset - setVector - device_interface::write + + devfs_makeNode + device_add + dInt + dPresent + fdcInit2 + fdcRead + fdcWrite + floppyIsr + device_interface::init + irqEnable + kmalloc + device_interface::major + mVec + device_interface::read + device_interface::reset + reset + setVector + device_interface::write - + int int fdcInit2 (struct device_node *dev) @@ -247,12 +517,12 @@ - - device_node::devInfo - device_interface::size - fdc_init + + device_node::devInfo + device_interface::size + fdc_init - + void void fdcRead (void *info, void *baseAddr, uInt32 startSector, uInt32 sectorCount) @@ -266,11 +536,11 @@ baseAddr - uInt32 + uInt32 startSector - uInt32 + uInt32 sectorCount @@ -279,28 +549,25 @@ - - fdcSpinLock - readBlock - spinLock - spinUnlock - fdc_init + + spinLock + fdc_init - - bool + + bool bool fdcRw - (int block, Int8 *blockBuffer, bool read, unsigned long numSectors) + (int block, unsigned char *blockBuffer, bool read, unsigned long numSectors) fdcRw int block - Int8 * + unsigned char * blockBuffer - bool + bool read @@ -313,40 +580,16 @@ - - block2Hts - cmdRead - cmdWrite - dg144Gap3rw - dg144Spt - dg168Gap3rw - diskChange - dmaXfer - FALSE - fdcCcr - fdcDir - fdcRw - geometry - inportByte - kprint - kprintf - motorOff - motorOn - outportByte - recalibrate - reset - seek - sendByte - DrvGeom::spt - status - tbaddr - TRUE - waitFdc - fdcRw - readBlock - writeBlock + + block2Hts + fdcDir + inportByte + motorOn + read + readBlock + writeBlock - + void void fdcWrite (void *info, void *baseAddr, uInt32 startSector, uInt32 sectorCount) @@ -360,11 +603,11 @@ baseAddr - uInt32 + uInt32 startSector - uInt32 + uInt32 sectorCount @@ -373,11 +616,11 @@ - - writeBlock - fdc_init + + writeBlock + fdc_init - + void void floppyIsrhndlr () @@ -388,13 +631,9 @@ - - done - outportByte - TRUE - x20 + - + int int getByte () @@ -405,13 +644,12 @@ - - fdcData - fdcMsr - inportByte - waitFdc + + fdcData + fdcMsr + inportByte - + void void motorOff (void) @@ -425,14 +663,10 @@ - - FALSE - motor - TRUE - fdcRw - recalibrate + + recalibrate - + void void motorOn (void) @@ -446,17 +680,12 @@ - - FALSE - fdcDor - motor - outportByte - TRUE - fdcRw - recalibrate + + fdcRw + recalibrate - - bool + + bool bool readBlock (int block, Int8 *blockBuffer, unsigned long numSectors) readBlock @@ -465,7 +694,7 @@ block - Int8 * + Int8 * blockBuffer @@ -478,12 +707,11 @@ - - fdcRw - TRUE - fdcRead + + fdcRw + TRUE - + void void recalibrate (void) @@ -497,17 +725,15 @@ - - cmdRecal - motorOff - motorOn - sendByte - TRUE - waitFdc - fdcRw - reset + + cmdRecal + motorOff + motorOn + sendByte + TRUE + waitFdc - + void void reset (void) @@ -521,24 +747,13 @@ - - cmdSpecify - diskChange - done - FALSE - fdcDor - motor - outportByte - recalibrate - seek - sendByte - TRUE - waitFdc - fdc_init - fdcRw + + fdcDor + outportByte + fdc_init - - bool + + bool bool seek (int track) seek @@ -552,20 +767,9 @@ - - cmdSeek - FALSE - fdcTrack - kprintf - sendByte - sr0 - TRUE - waitFdc - x20 - fdcRw - reset + - + void void sendByte (int Int8) @@ -580,24 +784,20 @@ - - fdcData - fdcMsr - inportByte - outportByte - fdcRw - recalibrate - reset - seek - waitFdc + + fdcData + fdcMsr + inportByte + outportByte + recalibrate - - bool + + bool bool waitFdc (bool sensei) waitFdc - bool + bool sensei @@ -606,29 +806,11 @@ - - cmdSensei - diskChange - done - FALSE - fdcDir - fdcMsr - fdcTrack - getByte - inportByte - sendByte - sr0 - statSize - status - timeOut - TRUE - fdcRw - recalibrate - reset - seek + + recalibrate - - bool + + bool bool writeBlock (int block, Int8 *blockBuffer, unsigned long numSectors) writeBlock @@ -637,7 +819,7 @@ block - Int8 * + Int8 * blockBuffer @@ -650,192 +832,10 @@ - - FALSE - fdcRw - fdcWrite - - - - - bool - bool diskChange - - diskChange - FALSE - - - - - - - - fdcRw - reset - waitFdc - - - bool - volatile bool done - - done - FALSE - - - - - - - - bcopy - floppyIsrhndlr - reset - waitFdc - - - spinLock_t - spinLock_t fdcSpinLock - - fdcSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - fdcRead - - - Int8 - volatile Int8 fdcTrack - - fdcTrack - 0xff - - - - - - - - seek - waitFdc - - - drvGeom - drvGeom geometry - - geometry - { dg144Heads,dg144Tracks,dg144Spt } - - - - - - - - block2Hts - fdcRw - - - bool - bool motor - - motor - FALSE - - - - - - - - motorOff - motorOn - reset - - - Int8 - Int8 sr0 - - sr0 - 0 - - - - - - - - seek - waitFdc - - - Int8 - Int8 statSize - - statSize - 0 - - - - - - - - waitFdc - - - Int8 - Int8 status[7] - [7] - status - { 0 } - - - - - - - - fdcRw - ne2kHandler - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit - waitFdc - - - unsigned long - unsigned long tbaddr - - tbaddr - 0x80000L - - - - - - - - fdcRw - - - int - volatile int timeOut - - timeOut - 0 - - - - - - - - waitFdc + + FALSE + fdcRw + fdcWrite @@ -843,325 +843,322 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: fdc_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<isa/fdc.h> -#include<isa/8259.h> -#include<sys/video.h> -#include<sys/gdt.h> -#include<sys/idt.h> -#include<ubixos/types.h> -#include<ubixos/spinlock.h> -#include<sys/io.h> -#include<sys/dma.h> -#include<sys/device.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<devfs/devfs.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<isa/fdc.h> +#include<isa/8259.h> +#include<sys/video.h> +#include<sys/gdt.h> +#include<sys/idt.h> +#include<ubixos/spinlock.h> +#include<sys/io.h> +#include<sys/dma.h> +#include<sys/device.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<devfs/devfs.h> + +staticstructspinLockfdcSpinLock=SPIN_LOCK_INITIALIZER; -staticspinLock_tfdcSpinLock=SPIN_LOCK_INITIALIZER; - -staticvolatilebooldone=FALSE; -staticdrvGeomgeometry={dg144Heads,dg144Tracks,dg144Spt}; -staticbooldiskChange=FALSE; -staticboolmotor=FALSE; -staticvolatileInt8fdcTrack=0xff; -staticInt8sr0=0; -staticvolatileinttimeOut=0; -staticInt8statSize=0; -staticInt8status[7]={0}; +staticvolatilebooldone=FALSE; +staticdrvGeomgeometry={dg144Heads,dg144Tracks,dg144Spt}; +staticbooldiskChange=FALSE; +staticboolmotor=FALSE; +staticvolatileInt8fdcTrack=0xff; +staticInt8sr0=0; +staticvolatileinttimeOut=0; +staticInt8statSize=0; +staticInt8status[7]={0}; + +unsignedlongtbaddr=0x80000L; -unsignedlongtbaddr=0x80000L; - -intfdcInit2(structdevice_node*dev){ -dev->devInfo->size=(1024*1450); -return(0x0); -} - -intfdc_init(){ -structdevice_interface*devInfo=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); -setVector(floppyIsr,mVec+6,(dInt+dPresent)); -irqEnable(6); -reset(); -devInfo->major=0x0; -devInfo->init=(void*)&fdcInit2; -devInfo->read=fdcRead; -devInfo->write=fdcWrite; -devInfo->reset=(void*)reset; - -device_add(0,'c',devInfo); -devfs_makeNode("fd0",'b',0x0,0x0); -return(0x0); -} - -asm( -".globlfloppyIsr\n" -"floppyIsr:\n" -"pusha\n" -"push%ss\n" -"push%ds\n" -"push%es\n" -"push%fs\n" -"push%gs\n" -"callfloppyIsrhndlr\n" -"pop%gs\n" -"pop%fs\n" -"pop%es\n" -"pop%ds\n" -"pop%ss\n" -"popa\n" -"iret\n" -); - -voidfloppyIsrhndlr(){ -done=TRUE; -outportByte(0x20,0x20); -} - -voidsendByte(intInt8){ -volatileintmsr; -inttmo; -for(tmo=0;tmo<128;tmo++){ -msr=inportByte(fdcMsr); -if((msr&0xc0)==0x80){ -outportByte(fdcData,Int8); -return; -} -inportByte(0x80); -} -} - -intgetByte(){ -volatileintmsr; -inttmo; -for(tmo=0;tmo<128;tmo++){ -msr=inportByte(fdcMsr); -if((msr&0xd0)==0xd0){ -returninportByte(fdcData); -} -inportByte(0x80); -} -return(-1); -} - -boolfdcRw(intblock,Int8*blockBuffer,boolread,unsignedlongnumSectors){ -inthead=0x0,track=0x0,sector=0x0,tries=0x0,copyCount=0x0; -unsignedchar*p_tbaddr=(char*)0x80000; -unsignedchar*p_blockbuff=blockBuffer; -//kprintf("Block:[%i]\n",block); -block2Hts(block,&head,&track,&sector); -motorOn(); -if(!read&&blockBuffer){ -/*copydatafromdatabufferintotrackbuffer*/ -for(copyCount=0;copyCount<(numSectors*512);copyCount++){ -*p_tbaddr=*p_blockbuff; -p_blockbuff++; -p_tbaddr++; -} -} -for(tries=0;tries<3;tries++){ -if(inportByte(fdcDir)&0x80){ -diskChange=TRUE; -seek(1);/*clear"diskchange"status*/ -recalibrate(); -motorOff(); -kprint("FDC:Diskchangedetected.Tryingagain.\n"); -returnfdcRw(block,blockBuffer,read,numSectors); -} -if(!seek(track)){ -motorOff(); -kprintf("FDC:Errorseekingtotrack[%i]\n",block); -returnFALSE; -} -outportByte(fdcCcr,0); -if(read){ -dmaXfer(2,tbaddr,numSectors*512,FALSE); -sendByte(cmdRead); -} -else{ -dmaXfer(2,tbaddr,numSectors*512,TRUE); -sendByte(cmdWrite); -} -sendByte(head<<2); -sendByte(track); -sendByte(head); -sendByte(sector); -sendByte(2);/*512Int8s/sector*/ -sendByte(geometry.spt); -if(geometry.spt==dg144Spt){ -sendByte(dg144Gap3rw);/*gap3sizefor1.44Mread/write*/ -} -else{ -sendByte(dg168Gap3rw);/*gap3sizefor1.68Mread/write*/ -} -sendByte(0xff);/*DTL=unused*/ -if(!waitFdc(TRUE)){ -kprint("Timedout,tryingoperationagainafterreset()\n"); -reset(); -returnfdcRw(block,blockBuffer,read,numSectors); -} -if((status[0]&0xc0)==0)break;/*worked!outtahere!*/ -recalibrate();/*oops,tryagain...*/ -} -motorOff(); -if(read&&blockBuffer){ -p_blockbuff=blockBuffer; -p_tbaddr=(char*)0x80000; -for(copyCount=0x0;copyCount<(numSectors*512);copyCount++){ -*p_blockbuff=*p_tbaddr; -p_blockbuff++; -p_tbaddr++; -} -} -return(tries!=3); -} - -voidblock2Hts(intblock,int*head,int*track,int*sector){ -*head=(block%(geometry.spt*geometry.heads))/(geometry.spt); -*track=block/(geometry.spt*geometry.heads); -*sector=block%geometry.spt+1; -} - -voidmotorOn(void){ -if(motor==FALSE){ -outportByte(fdcDor,0x1c); -motor=TRUE; -} -} - -voidmotorOff(void){ -if(motor==TRUE){ -//outportByte(fdcDor,0x0); -//outportByte(fdcDor,0x0C); -motor=FALSE; -} -} - -boolseek(inttrack){ -if(fdcTrack==track){ -return(TRUE); -} -sendByte(cmdSeek); -sendByte(0); -sendByte(track); -if(!waitFdc(TRUE)){ -kprintf("waitfdcfailed\n"); -return(FALSE); -} -if((sr0!=0x20)||(fdcTrack!=track)){ -return(FALSE); -} -else{ -return(TRUE); -} -} - -boolreadBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors){ -intresult=0x0,loop=0x0; -if(numSectors>1){ -for(loop=0;loop<numSectors;loop++){ -result=fdcRw(block+loop,blockBuffer+(loop*512),TRUE,1); -} -returnresult; -} -returnfdcRw(block,blockBuffer,TRUE,numSectors); -} - -boolwriteBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors){ -returnfdcRw(block,blockBuffer,FALSE,numSectors); -} - -boolwaitFdc(boolsensei){ -timeOut=50000; -while(!done&&timeOut); -statSize=0; -while((statSize<7)&&(inportByte(fdcMsr)&(1<<4))){ -status[(int)statSize++]=getByte(); -} +intfdcInit2(structdevice_node*dev){ +dev->devInfo->size=(1024*1450); +return(0x0); +} + +intfdc_init(){ +structdevice_interface*devInfo=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); +setVector(floppyIsr,mVec+6,(dInt+dPresent)); +irqEnable(6); +reset(); +devInfo->major=0x0; +devInfo->init=(void*)&fdcInit2; +devInfo->read=fdcRead; +devInfo->write=fdcWrite; +devInfo->reset=(void*)reset; + +device_add(0,'c',devInfo); +devfs_makeNode("fd0",'b',0x0,0x0); +return(0x0); +} + +asm( +".globlfloppyIsr\n" +"floppyIsr:\n" +"pusha\n" +"push%ss\n" +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"callfloppyIsrhndlr\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"pop%ss\n" +"popa\n" +"iret\n" +); + +voidfloppyIsrhndlr(){ +done=TRUE; +outportByte(0x20,0x20); +} + +voidsendByte(intInt8){ +volatileintmsr; +inttmo; +for(tmo=0;tmo<128;tmo++){ +msr=inportByte(fdcMsr); +if((msr&0xc0)==0x80){ +outportByte(fdcData,Int8); +return; +} +inportByte(0x80); +} +} + +intgetByte(){ +volatileintmsr; +inttmo; +for(tmo=0;tmo<128;tmo++){ +msr=inportByte(fdcMsr); +if((msr&0xd0)==0xd0){ +returninportByte(fdcData); +} +inportByte(0x80); +} +return(-1); +} + +boolfdcRw(intblock,unsignedchar*blockBuffer,boolread,unsignedlongnumSectors){ +inthead=0x0,track=0x0,sector=0x0,tries=0x0,copyCount=0x0; +unsignedchar*p_tbaddr=(unsignedchar*)0x80000; +unsignedchar*p_blockbuff=blockBuffer; +//kprintf("Block:[%i]\n",block); +block2Hts(block,&head,&track,&sector); +motorOn(); +if(!read&&blockBuffer){ +/*copydatafromdatabufferintotrackbuffer*/ +for(copyCount=0;copyCount<(numSectors*512);copyCount++){ +*p_tbaddr=*p_blockbuff; +p_blockbuff++; +p_tbaddr++; +} +} +for(tries=0;tries<3;tries++){ +if(inportByte(fdcDir)&0x80){ +diskChange=TRUE; +seek(1);/*clear"diskchange"status*/ +recalibrate(); +motorOff(); +kprint("FDC:Diskchangedetected.Tryingagain.\n"); +returnfdcRw(block,blockBuffer,read,numSectors); +} +if(!seek(track)){ +motorOff(); +kprintf("FDC:Errorseekingtotrack[%i]\n",block); +returnFALSE; +} +outportByte(fdcCcr,0); +if(read){ +dmaXfer(2,tbaddr,numSectors*512,FALSE); +sendByte(cmdRead); +} +else{ +dmaXfer(2,tbaddr,numSectors*512,TRUE); +sendByte(cmdWrite); +} +sendByte(head<<2); +sendByte(track); +sendByte(head); +sendByte(sector); +sendByte(2);/*512Int8s/sector*/ +sendByte(geometry.spt); +if(geometry.spt==dg144Spt){ +sendByte(dg144Gap3rw);/*gap3sizefor1.44Mread/write*/ +} +else{ +sendByte(dg168Gap3rw);/*gap3sizefor1.68Mread/write*/ +} +sendByte(0xff);/*DTL=unused*/ +if(!waitFdc(TRUE)){ +kprint("Timedout,tryingoperationagainafterreset()\n"); +reset(); +returnfdcRw(block,blockBuffer,read,numSectors); +} +if((status[0]&0xc0)==0) +break;/*worked!outtahere!*/ +recalibrate();/*oops,tryagain...*/ +} +motorOff(); +if(read&&blockBuffer){ +p_blockbuff=blockBuffer; +p_tbaddr=(unsignedchar*)0x80000; +for(copyCount=0x0;copyCount<(numSectors*512);copyCount++){ +*p_blockbuff=*p_tbaddr; +p_blockbuff++; +p_tbaddr++; +} +} +return(tries!=3); +} + +voidblock2Hts(intblock,int*head,int*track,int*sector){ +*head=(block%(geometry.spt*geometry.heads))/(geometry.spt); +*track=block/(geometry.spt*geometry.heads); +*sector=block%geometry.spt+1; +} + +voidmotorOn(void){ +if(motor==FALSE){ +outportByte(fdcDor,0x1c); +motor=TRUE; +} +} + +voidmotorOff(void){ +if(motor==TRUE){ +//outportByte(fdcDor,0x0); +//outportByte(fdcDor,0x0C); +motor=FALSE; +} +} + +boolseek(inttrack){ +if(fdcTrack==track){ +return(TRUE); +} +sendByte(cmdSeek); +sendByte(0); +sendByte(track); +if(!waitFdc(TRUE)){ +kprintf("waitfdcfailed\n"); +return(FALSE); +} +if((sr0!=0x20)||(fdcTrack!=track)){ +return(FALSE); +} +else{ +return(TRUE); +} +} + +boolreadBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors){ +intresult=0x0,loop=0x0; +if(numSectors>1){ +for(loop=0;loop<numSectors;loop++){ +result=fdcRw(block+loop,blockBuffer+(loop*512),TRUE,1); +} +returnresult; +} +returnfdcRw(block,blockBuffer,TRUE,numSectors); +} + +boolwriteBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors){ +returnfdcRw(block,blockBuffer,FALSE,numSectors); +} + +boolwaitFdc(boolsensei){ +timeOut=50000; +while(!done&&timeOut) +; +statSize=0; +while((statSize<7)&&(inportByte(fdcMsr)&(1<<4))){ +status[(int)statSize++]=getByte(); +} if(sensei){ -sendByte(cmdSensei); -sr0=getByte(); -fdcTrack=getByte(); -} -done=FALSE; -if(!timeOut){ -if(inportByte(fdcDir)&0x80){ -diskChange=TRUE; -} -return(FALSE); -} +sendByte(cmdSensei); +sr0=getByte(); +fdcTrack=getByte(); +} +done=FALSE; +if(!timeOut){ +if(inportByte(fdcDir)&0x80){ +diskChange=TRUE; +} +return(FALSE); +} else{ -return(TRUE); -} -} +return(TRUE); +} +} -voidrecalibrate(void){ -motorOn(); -sendByte(cmdRecal); -sendByte(0); -waitFdc(TRUE); -motorOff(); -} +voidrecalibrate(void){ +motorOn(); +sendByte(cmdRecal); +sendByte(0); +waitFdc(TRUE); +motorOff(); +} -voidreset(void){ -outportByte(fdcDor,0); -motor=FALSE; -outportByte(fdcDor,0x0c); -done=TRUE; -waitFdc(TRUE); -sendByte(cmdSpecify); -sendByte(0xdf); -sendByte(0x02); -seek(1); -recalibrate(); -diskChange=FALSE; +voidreset(void){ +outportByte(fdcDor,0); +motor=FALSE; +outportByte(fdcDor,0x0c); +done=TRUE; +waitFdc(TRUE); +sendByte(cmdSpecify); +sendByte(0xdf); +sendByte(0x02); +seek(1); +recalibrate(); +diskChange=FALSE; return; -} +} -voidfdcRead(void*info,void*baseAddr,uInt32startSector,uInt32sectorCount){ -spinLock(&fdcSpinLock); -readBlock(startSector,baseAddr,sectorCount); -spinUnlock(&fdcSpinLock); +voidfdcRead(void*info,void*baseAddr,uInt32startSector,uInt32sectorCount){ +spinLock(&fdcSpinLock); +readBlock(startSector,baseAddr,sectorCount); +spinUnlock(&fdcSpinLock); return; -} -voidfdcWrite(void*info,void*baseAddr,uInt32startSector,uInt32sectorCount){ -writeBlock(startSector,baseAddr,sectorCount); +} +voidfdcWrite(void*info,void*baseAddr,uInt32startSector,uInt32sectorCount){ +writeBlock(startSector,baseAddr,sectorCount); return; -} +} /*** -$Log: fdc_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - +$Log:fdc.c,v$ Revision1.1.1.12006/06/0112:46:12reddawg ubix2 @@ -1261,6 +1258,6 @@ ***/ - + diff --git a/doc/xml/fdc_8h.xml b/doc/xml/fdc_8h.xml index bce5fc0..106896f 100644 --- a/doc/xml/fdc_8h.xml +++ b/doc/xml/fdc_8h.xml @@ -1,55 +1,93 @@ - - - + + + fdc.h - ubixos/types.h - src/sys/include/ubixos/init.h - src/sys/isa/fdc.c + sys/types.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/fdc.c - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - + + - - - - + + + + + + - - - - - - - - - - + + + + + + + + DrvGeom - + cmdRead (0xe6) @@ -58,10 +96,9 @@ - - fdcRw + - + cmdRecal (0x07) @@ -70,10 +107,9 @@ - - recalibrate + - + cmdSeek (0x0f) @@ -82,10 +118,9 @@ - - seek + - + cmdSensei (0x08) @@ -94,10 +129,9 @@ - - waitFdc + - + cmdSpecify (0x03) @@ -106,10 +140,9 @@ - - reset + - + cmdWrite (0xc5) @@ -118,10 +151,9 @@ - - fdcRw + - + dg144Gap3rw 0x1b @@ -130,21 +162,20 @@ - - fdcRw + - + dg144Heads - 2 + 2 /* heads per drive (1.44M) */ - + - + dg144Spt 18 @@ -153,10 +184,9 @@ - - fdcRw + - + dg144Tracks 80 @@ -165,9 +195,9 @@ - + - + dg168Gap3rw 0x1c @@ -176,10 +206,9 @@ - - fdcRw + - + fdcCcr (0x3f7) @@ -188,10 +217,9 @@ - - fdcRw + - + fdcData (0x3f5) @@ -200,11 +228,9 @@ - - getByte - sendByte + - + fdcDir (0x3f7) @@ -213,11 +239,9 @@ - - fdcRw - waitFdc + - + fdcDor (0x3f2) @@ -226,11 +250,9 @@ - - motorOn - reset + - + fdcDrs (0x3f4) @@ -239,9 +261,9 @@ - + - + fdcMsr (0x3f4) @@ -250,15 +272,12 @@ - - getByte - sendByte - waitFdc + - - DrvGeom + + struct DrvGeom typedef struct DrvGeom drvGeom drvGeom @@ -268,11 +287,11 @@ - + - + void void block2Hts (int block, int *head, int *track, int *sector) @@ -299,13 +318,10 @@ - - geometry - DrvGeom::heads - DrvGeom::spt - fdcRw + + fdcRw - + int int fdc_init () @@ -316,27 +332,27 @@ - - devfs_makeNode - device_add - dInt - dPresent - fdcInit2 - fdcRead - fdcWrite - floppyIsr - device_interface::init - irqEnable - kmalloc - device_interface::major - mVec - device_interface::read - reset - device_interface::reset - setVector - device_interface::write + + devfs_makeNode + device_add + dInt + dPresent + fdcInit2 + fdcRead + fdcWrite + floppyIsr + device_interface::init + irqEnable + kmalloc + device_interface::major + mVec + device_interface::read + device_interface::reset + reset + setVector + device_interface::write - + void void fdcRead (void *info, void *, uInt32 startSector, uInt32 sectorCount) @@ -349,11 +365,11 @@ void * - uInt32 + uInt32 startSector - uInt32 + uInt32 sectorCount @@ -362,28 +378,25 @@ - - fdcSpinLock - readBlock - spinLock - spinUnlock - fdc_init + + spinLock + fdc_init - - bool + + bool bool fdcRw - (int block, Int8 *blockBuffer, bool read, unsigned long numSectors) + (int block, unsigned char *blockBuffer, bool read, unsigned long numSectors) fdcRw int block - Int8 * + unsigned char * blockBuffer - bool + bool read @@ -396,40 +409,16 @@ - - block2Hts - cmdRead - cmdWrite - dg144Gap3rw - dg144Spt - dg168Gap3rw - diskChange - dmaXfer - FALSE - fdcCcr - fdcDir - fdcRw - geometry - inportByte - kprint - kprintf - motorOff - motorOn - outportByte - recalibrate - reset - seek - sendByte - DrvGeom::spt - status - tbaddr - TRUE - waitFdc - fdcRw - readBlock - writeBlock + + block2Hts + fdcDir + inportByte + motorOn + read + readBlock + writeBlock - + void void fdcWrite (void *info, void *, uInt32 startSector, uInt32 sectorCount) @@ -442,11 +431,11 @@ void * - uInt32 + uInt32 startSector - uInt32 + uInt32 sectorCount @@ -455,11 +444,11 @@ - - writeBlock - fdc_init + + writeBlock + fdc_init - + void void floppyIsr () @@ -470,10 +459,10 @@ - - fdc_init + + fdc_init - + void void floppyIsrhndlr () @@ -484,13 +473,9 @@ - - done - outportByte - TRUE - x20 + - + int int getByte () @@ -501,13 +486,12 @@ - - fdcData - fdcMsr - inportByte - waitFdc + + fdcData + fdcMsr + inportByte - + void void motorOff (void) @@ -521,14 +505,10 @@ - - FALSE - motor - TRUE - fdcRw - recalibrate + + recalibrate - + void void motorOn (void) @@ -542,17 +522,12 @@ - - FALSE - fdcDor - motor - outportByte - TRUE - fdcRw - recalibrate + + fdcRw + recalibrate - - bool + + bool bool readBlock (int block, Int8 *blockBuffer, unsigned long numSectors) readBlock @@ -561,7 +536,7 @@ block - Int8 * + Int8 * blockBuffer @@ -574,12 +549,11 @@ - - fdcRw - TRUE - fdcRead + + fdcRw + TRUE - + void void recalibrate (void) @@ -593,17 +567,15 @@ - - cmdRecal - motorOff - motorOn - sendByte - TRUE - waitFdc - fdcRw - reset + + cmdRecal + motorOff + motorOn + sendByte + TRUE + waitFdc - + void void reset (void) @@ -617,24 +589,13 @@ - - cmdSpecify - diskChange - done - FALSE - fdcDor - motor - outportByte - recalibrate - seek - sendByte - TRUE - waitFdc - fdc_init - fdcRw + + fdcDor + outportByte + fdc_init - - bool + + bool bool seek (int track) seek @@ -648,20 +609,9 @@ - - cmdSeek - FALSE - fdcTrack - kprintf - sendByte - sr0 - TRUE - waitFdc - x20 - fdcRw - reset + - + void void sendByte (int Int8) @@ -676,24 +626,20 @@ - - fdcData - fdcMsr - inportByte - outportByte - fdcRw - recalibrate - reset - seek - waitFdc + + fdcData + fdcMsr + inportByte + outportByte + recalibrate - - bool + + bool bool waitFdc (bool sensei) waitFdc - bool + bool sensei @@ -702,29 +648,11 @@ - - cmdSensei - diskChange - done - FALSE - fdcDir - fdcMsr - fdcTrack - getByte - inportByte - sendByte - sr0 - statSize - status - timeOut - TRUE - fdcRw - recalibrate - reset - seek + + recalibrate - - bool + + bool bool writeBlock (int block, Int8 *blockBuffer, unsigned long numSectors) writeBlock @@ -733,7 +661,7 @@ block - Int8 * + Int8 * blockBuffer @@ -746,10 +674,10 @@ - - FALSE - fdcRw - fdcWrite + + FALSE + fdcRw + fdcWrite @@ -782,71 +710,68 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: fdc_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:fdc.h792016-01-1116:21:27Zreddawg$ *****************************************************************************************/ -#ifndef_FDC_H -#define_FDC_H - -#include<ubixos/types.h> - -typedefstructDrvGeom{ -Int8heads; -Int8tracks; -Int8spt; -}drvGeom; +#ifndef_FDC_H +#define_FDC_H + +#include<sys/types.h> + +typedefstructDrvGeom{ +Int8heads; +Int8tracks; +Int8spt; +}drvGeom; - -#definefdcMsr(0x3f4) -#definefdcData(0x3f5) -#definefdcDir(0x3f7) -#definefdcCcr(0x3f7) -#definefdcDor(0x3f2) -#definefdcDrs(0x3f4) - -#definecmdWrite(0xc5) -#definecmdRead(0xe6) -#definecmdSeek(0x0f) -#definecmdSensei(0x08) -#definecmdRecal(0x07) -#definecmdSpecify(0x03) - -#definedg144Heads2/*headsperdrive(1.44M)*/ -#definedg144Tracks80 -#definedg144Spt18 -#definedg144Gap3rw0x1b -#definedg168Gap3rw0x1c - - - -intfdc_init(); -voidfloppyIsr(); -voidfloppyIsrhndlr(); -voidsendByte(intInt8); -intgetByte(); -boolfdcRw(intblock,Int8*blockBuffer,boolread,unsignedlongnumSectors); -voidblock2Hts(intblock,int*head,int*track,int*sector); -voidmotorOn(void); -voidmotorOff(void); -boolseek(inttrack); -boolwaitFdc(boolsensei); -intgetByte(); -voidsendByte(intInt8); -voidrecalibrate(void); -voidreset(void); -boolwriteBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors); -boolreadBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors); -voidfdcWrite(void*info,void*,uInt32startSector,uInt32sectorCount); -voidfdcRead(void*info,void*,uInt32startSector,uInt32sectorCount); + +#definefdcMsr(0x3f4) +#definefdcData(0x3f5) +#definefdcDir(0x3f7) +#definefdcCcr(0x3f7) +#definefdcDor(0x3f2) +#definefdcDrs(0x3f4) + +#definecmdWrite(0xc5) +#definecmdRead(0xe6) +#definecmdSeek(0x0f) +#definecmdSensei(0x08) +#definecmdRecal(0x07) +#definecmdSpecify(0x03) + +#definedg144Heads2/*headsperdrive(1.44M)*/ +#definedg144Tracks80 +#definedg144Spt18 +#definedg144Gap3rw0x1b +#definedg168Gap3rw0x1c + + + +intfdc_init(); +voidfloppyIsr(); +voidfloppyIsrhndlr(); +voidsendByte(intInt8); +intgetByte(); +boolfdcRw(intblock,unsignedchar*blockBuffer,boolread,unsignedlongnumSectors); +voidblock2Hts(intblock,int*head,int*track,int*sector); +voidmotorOn(void); +voidmotorOff(void); +boolseek(inttrack); +boolwaitFdc(boolsensei); +intgetByte(); +voidsendByte(intInt8); +voidrecalibrate(void); +voidreset(void); +boolwriteBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors); +boolreadBlock(intblock,Int8*blockBuffer,unsignedlongnumSectors); +voidfdcWrite(void*info,void*,uInt32startSector,uInt32sectorCount); +voidfdcRead(void*info,void*,uInt32startSector,uInt32sectorCount); -#endif - +#endif + /*** -$Log: fdc_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - +$Log:fdc.h,v$ Revision1.1.1.12006/06/0112:46:14reddawg ubix2 @@ -869,6 +794,6 @@ END ***/ - + diff --git a/doc/xml/ffs_8c.xml b/doc/xml/ffs_8c.xml index 14ab8e0..825bf96 100644 --- a/doc/xml/ffs_8c.xml +++ b/doc/xml/ffs_8c.xml @@ -1,169 +1,447 @@ - - - + + + ffs.c - vfs/vfs.h + vfs/vfs.h ufs/ufs.h ufs/ffs.h lib/kprintf.h lib/kmalloc.h ubixos/kpanic.h - lib/string.h + string.h sys/buf.h - - - - - - - - - - - - - - - - - - - - - + - + - - - + - - - - - + + + - + - - - - + + + + + + + + - - - + - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - - + + + + - - - + - - - - + + + + - - - - - - - - - - - - + + + + - - - - + + + + + + + + - - - - - - - + - + - - - - - - + + + + - - - - + + + + - - - - - + - + - - - - - - - + - + int int ffs_read - (fileDescriptor *fd, char *data, uInt32 offset, long size) + (fileDescriptor_t *fd, char *data, uInt32 offset, long size) ffs_read - fileDescriptor * + fileDescriptor_t * fd @@ -171,7 +449,7 @@ data - uInt32 + uInt32 offset @@ -184,11 +462,11 @@ - - fileDescriptorStruct::dmadat - fs::fs_maxfilesize - kprintf - dmadat::sbbuf + + fileDescriptor::dmadat + fs::fs_maxfilesize + kprintf + dmadat::sbbuf @@ -196,30 +474,30 @@ -#include<vfs/vfs.h> +#include<vfs/vfs.h> #include<ufs/ufs.h> #include<ufs/ffs.h> #include<lib/kprintf.h> #include<lib/kmalloc.h> #include<ubixos/kpanic.h> -#include<lib/string.h> +#include<string.h> #include<sys/buf.h> -intffs_read(fileDescriptor*fd,char*data,uInt32offset,longsize){ +intffs_read(fileDescriptor_t*fd,char*data,uInt32offset,longsize){ structfs*fs; -fs=(structfs*)fd->dmadat->sbbuf; +fs=(structfs*)fd->dmadat->sbbuf; -if(offset<fd->size&&offset>=fs->fs_maxfilesize){ +if(offset<fd->size&&offset>=fs->fs_maxfilesize){ //return(EOVERFLOW); return(-1); } -kprintf("ReadingFilew/NewFunction[0x%X]\n",fs->fs_maxfilesize); +kprintf("ReadingFilew/NewFunction[0x%X]\n",fs->fs_maxfilesize); return(0x0); } - + diff --git a/doc/xml/ffs_8h.xml b/doc/xml/ffs_8h.xml index e248818..40e8d00 100644 --- a/doc/xml/ffs_8h.xml +++ b/doc/xml/ffs_8h.xml @@ -1,128 +1,420 @@ - - - + + + ffs.h - ubixos/types.h - vfs/vfs.h - sys/device.h - src/sys/ufs/ffs.c - src/sys/ufs/ufs.c + sys/types.h + vfs/vfs.h + sys/device.h + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - + - - - - + + + + - + - + - - - - + + + + - - - - - - - + - - - - + + + + - + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - - - - - + + + + + - - + + + + + + - - - - + + + + - + - - - - - + int int ffs_read - (fileDescriptor *, char *, uInt32, long) + (fileDescriptor_t *, char *, uint32_t, long) ffs_read - fileDescriptor * + fileDescriptor_t * char * - uInt32 + uint32_t long @@ -133,11 +425,7 @@ - - fileDescriptorStruct::dmadat - fs::fs_maxfilesize - kprintf - dmadat::sbbuf + @@ -170,26 +458,26 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: ffs_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:ffs.h792016-01-1116:21:27Zreddawg$ *****************************************************************************************/ -#ifndef_FFS_H -#define_FFS_H - -#include<ubixos/types.h> -#include<vfs/vfs.h> -#include<sys/device.h> +#ifndef_FFS_H +#define_FFS_H + +#include<sys/types.h> +#include<vfs/vfs.h> +#include<sys/device.h> -intffs_read(fileDescriptor*,char*,uInt32,long); +intffs_read(fileDescriptor_t*,char*,uint32_t,long); -#endif - +#endif + /*** END ***/ - + diff --git a/doc/xml/file_8c.xml b/doc/xml/file_8c.xml index 38a112b..7fbc43d 100644 --- a/doc/xml/file_8c.xml +++ b/doc/xml/file_8c.xml @@ -1,218 +1,562 @@ - - - + + + file.c - vfs/vfs.h - vfs/file.h ubixos/sched.h + vfs/vfs.h ubixos/vitals.h ubixos/kpanic.h ubixos/spinlock.h lib/kmalloc.h - lib/string.h + string.h vmm/paging.h lib/kprintf.h assert.h + sys/descrip.h - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + - + + + + + - + + + + + - + - + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fileDescriptor_t * + fileDescriptor_t* fdTable + + fdTable + = 0x0 + + + + + + + + + + struct spinLock + struct spinLock fdTable_lock + + fdTable_lock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + fileDescriptor_t * + fileDescriptor_t* vfs_fileTable + + vfs_fileTable + = 0x0 + + + + + + + + + - + int int fclose - (fileDescriptor *fd) + (fileDescriptor_t *fd) fclose - fileDescriptor * + fileDescriptor_t * fd @@ -221,37 +565,30 @@ - - assert - fileDescriptorStruct::buffer - fdTable - fdTable_lock - kfree - fileDescriptorStruct::next - NULL - vitalsStruct::openFiles - fileDescriptorStruct::prev - spinLock - spinUnlock - systemVitals - x1 - elf_loadfile - execFile - kmod_load - ldEnable - sys_exec - sysExec - sysFclose - sysMkDir - systemTask + + file::fd + spinLock + _sys_stat + dup2 + elf_load_file + execFile + fcntl + kmod_load + ldEnable + sys_close + sys_fclose + sys_fstatat + sysExec + sysMkDir + systemTask - + int int feof - (fileDescriptor *fd) + (fileDescriptor_t *fd) feof - fileDescriptor * + fileDescriptor_t * fd @@ -260,17 +597,18 @@ - - fdEof - fileDescriptorStruct::status + + file::fd + fdEof + fileDescriptor::status - + int int fgetc - (fileDescriptor *fd) + (fileDescriptor_t *fd) fgetc - fileDescriptor * + fileDescriptor_t * fd @@ -279,24 +617,25 @@ - - vfs_mountPoint::fs - fileDescriptorStruct::mp - fileDescriptorStruct::offset - fileSystem::vfsRead - sysFgetc + + file::fd + vfs_mountPoint::fs + fileDescriptor::mp + fileDescriptor::offset + fileSystem::vfsRead + sys_fgetc - - fileDescriptor * - fileDescriptor* fopen + + fileDescriptor_t * + fileDescriptor_t* fopen (const char *file, const char *flags) fopen - const char * + const char * file - const char * + const char * flags @@ -305,58 +644,57 @@ - - fileDescriptorStruct::buffer - fdOpen - fdTable - fdTable_lock - fileAppend - fileBinary - fileDescriptorStruct::fileName - fileRead - fileWrite - vfs_mountPoint::fs - kfree - kmalloc - kprintf - fileDescriptorStruct::mode - fileDescriptorStruct::mp - fileDescriptorStruct::next - NULL - fileDescriptorStruct::offset - vitalsStruct::openFiles - fileDescriptorStruct::prev - spinLock - spinUnlock - sprintf - fileDescriptorStruct::status - strcpy - strstr - strtok - systemVitals - vfs_findMount - fileSystem::vfsOpenFile - elf_loadfile - execFile - kmod_load - ldEnable - sys_exec - sys_open - sysExec - sysFopen - sysMkDir + + _current + fileDescriptor::buffer + osInfo::cwd + file + fileAppend + fileBinary + fileDescriptor::fileName + fileRead + fileWrite + vfs_mountPoint::fs + kfree + kmalloc + kprintf + memset + fileDescriptor::mode + fileDescriptor::mp + NULL + taskStruct::oInfo + spinUnlock + sprintf + strcpy + strstr + strtok + vfs_findMount + fileSystem::vfsOpenFile + _sys_stat + elf_load_file + execFile + kern_openat + kmod_load + ldEnable + sys_fopen + sys_fstatat + sys_openat + sys_statfs + sysExec + sysMkDir + tcpdump_init - + int int fputc - (int ch, fileDescriptor *fd) + (int ch, fileDescriptor_t *fd) fputc int ch - fileDescriptor * + fileDescriptor_t * fd @@ -365,31 +703,32 @@ - - vfs_mountPoint::fs - fileDescriptorStruct::mp - fileDescriptorStruct::offset - fileSystem::vfsWrite + + file::fd + vfs_mountPoint::fs + fileDescriptor::mp + fileDescriptor::offset + fileSystem::vfsWrite - - size_t + + size_t size_t fread - (void *ptr, size_t size, size_t nmemb, fileDescriptor *fd) + (void *ptr, size_t size, size_t nmemb, fileDescriptor_t *fd) fread void * ptr - size_t + size_t size - size_t + size_t nmemb - fileDescriptor * + fileDescriptor_t * fd @@ -398,28 +737,32 @@ - - assert - vfs_mountPoint::fs - fileDescriptorStruct::mp - fileDescriptorStruct::offset - fileSystem::vfsRead - elf_loadfile - execFile - kmod_load - ldEnable - read - sys_exec - sysExec - sysFread + + assert + file::fd + vfs_mountPoint::fs + fileDescriptor::mp + fileDescriptor::offset + fileSystem::vfsRead + elf_load_file + execFile + kmod_load + ldEnable + read + sys_fread + sys_getdirentries + sys_mmap + sys_pread + sys_read + sysExec - + int int fseek - (fileDescriptor *tmpFd, long offset, int whence) + (fileDescriptor_t *tmpFd, long offset, int whence) fseek - fileDescriptor * + fileDescriptor_t * tmpFd @@ -436,19 +779,18 @@ - - fileDescriptorStruct::offset - elf_loadfile - execFile - kmod_load - ldEnable - sys_exec - sysExec + + elf_load_file + execFile + kmod_load + ldEnable + sys_mmap + sysExec - - size_t + + size_t size_t fwrite - (void *ptr, int size, int nmemb, fileDescriptor *fd) + (void *ptr, int size, int nmemb, fileDescriptor_t *fd) fwrite void * @@ -463,7 +805,7 @@ nmemb - fileDescriptor * + fileDescriptor_t * fd @@ -472,21 +814,23 @@ - - vfs_mountPoint::fs - fileDescriptorStruct::mp - fileDescriptorStruct::offset - fileSystem::vfsWrite - sysFwrite + + sys_fwrite + sys_write + sysFwrite - - void - void sysChDir - (const char *path) - sysChDir + + int + int sys_chdir + (struct thread *td, struct sys_chdir_args *args) + sys_chdir - const char * - path + struct thread * + td + + + struct sys_chdir_args * + args @@ -494,25 +838,27 @@ - - _current - osInfo::cwd - taskStruct::oInfo - sprintf - strstr + + _current + osInfo::cwd + taskStruct::oInfo + sys_chdir_args::path + sprintf + strstr + thread::td_retval - - void - void sysFclose - (userFileDescriptor *userFd, int *status) - sysFclose + + int + int sys_fchdir + (struct thread *td, struct sys_fchdir_args *args) + sys_fchdir - userFileDescriptor * - userFd + struct thread * + td - int * - status + struct sys_fchdir_args * + args @@ -520,23 +866,29 @@ - - fclose - userFileDescriptorStruct::fd - NULL + + _current + osInfo::cwd + file::fd + sys_fchdir_args::fd + fileDescriptor::fileName + getfd + taskStruct::oInfo + sprintf + strstr - - void - void sysFgetc - (int *ptr, userFileDescriptor *userFd) - sysFgetc + + int + int sys_fclose + (struct thread *td, struct sys_fclose_args *args) + sys_fclose - int * - ptr + struct thread * + td - userFileDescriptor * - userFd + struct sys_fclose_args * + args @@ -544,31 +896,24 @@ - - _current - userFileDescriptorStruct::fd - fgetc - getch - sched_yield - taskStruct::term - tty_foreground + + fclose + userFileDescriptorStruct::fd + sys_fclose_args::FILE + NULL - - void - void sysFopen - (const char *file, char *flags, userFileDescriptor *userFd) - sysFopen + + int + int sys_fgetc + (struct thread *td, struct sys_fgetc_args *args) + sys_fgetc - const char * - file + struct thread * + td - char * - flags - - - userFileDescriptor * - userFd + struct sys_fgetc_args * + args @@ -576,30 +921,29 @@ - - userFileDescriptorStruct::fd - userFileDescriptorStruct::fdSize - fopen - kprintf - NULL - fileDescriptorStruct::size + + _current + userFileDescriptorStruct::fd + fgetc + sys_fgetc_args::FILE + getchar + sched_yield + thread::td_retval + taskStruct::term + tty_foreground - - void - void sysFread - (void *data, long size, userFileDescriptor *userFd) - sysFread + + int + int sys_fopen + (struct thread *td, struct sys_fopen_args *args) + sys_fopen - void * - data + struct thread * + td - long - size - - - userFileDescriptor * - userFd + struct sys_fopen_args * + args @@ -607,27 +951,29 @@ - - userFileDescriptorStruct::fd - fread - NULL + + userFileDescriptorStruct::fd + userFileDescriptorStruct::fdSize + sys_fopen_args::FILE + fopen + kprintf + sys_fopen_args::mode + NULL + sys_fopen_args::path + fileDescriptor::size - - void - void sysFseek - (userFileDescriptor *userFd, long offset, int whence) - sysFseek + + int + int sys_fread + (struct thread *td, struct sys_fread_args *args) + sys_fread - userFileDescriptor * - userFd + struct thread * + td - long - offset - - - int - whence + struct sys_fread_args * + args @@ -635,12 +981,130 @@ - - userFileDescriptorStruct::fd - NULL - fileDescriptorStruct::offset + + userFileDescriptorStruct::fd + sys_fread_args::FILE + fread + sys_fread_args::nmemb + NULL + sys_fread_args::ptr + sys_fread_args::size + thread::td_retval - + + int + int sys_fseek + (struct thread *td, struct sys_fseek_args *args) + sys_fseek + + struct thread * + td + + + struct sys_fseek_args * + args + + + + + + + + + userFileDescriptorStruct::fd + sys_fseek_args::FILE + kprintf + NULL + fileDescriptor::offset + sys_fseek_args::offset + thread::td_retval + sys_fseek_args::whence + + + int + int sys_fwrite + (struct thread *td, struct sys_fwrite_args *uap) + sys_fwrite + + struct thread * + td + + + struct sys_fwrite_args * + uap + + + + + + + + + _current + sys_fwrite_args::buf + userFileDescriptorStruct::fd + sys_fwrite_args::fd + fwrite + kprintf + sys_fwrite_args::nbytes + thread::td_retval + taskStruct::term + tty_print + + + int + int sys_lseek + (struct thread *td, struct sys_lseek_args *args) + sys_lseek + + struct thread * + td + + + struct sys_lseek_args * + args + + + + + + + + + file::fd + sys_lseek_args::fd + getfd + kprintf + fileDescriptor::offset + sys_lseek_args::offset + SEEK_CUR + SEEK_SET + thread::td_retval + sys_lseek_args::whence + + + int + int sys_rename + (struct thread *td, struct sys_rename_args *args) + sys_rename + + struct thread * + td + + + struct sys_rename_args * + args + + + + + + + + + thread::td_retval + + void void sysFwrite (char *ptr, int size, userFileDescriptor *userFd) @@ -654,7 +1118,7 @@ size - userFileDescriptor * + userFileDescriptor * userFd @@ -663,20 +1127,20 @@ - - _current - userFileDescriptorStruct::fd - fwrite - taskStruct::term - tty_print + + _current + userFileDescriptorStruct::fd + fwrite + taskStruct::term + tty_print - + void void sysMkDir (const char *path) sysMkDir - const char * + const char * path @@ -685,22 +1149,22 @@ - - _current - osInfo::cwd - fclose - fopen - vfs_mountPoint::fs - kprintf - fileDescriptorStruct::mp - NULL - taskStruct::oInfo - sprintf - strstr - strtok - fileSystem::vfsMakeDir + + _current + osInfo::cwd + fclose + fopen + vfs_mountPoint::fs + kprintf + fileDescriptor::mp + NULL + taskStruct::oInfo + sprintf + strstr + strtok + fileSystem::vfsMakeDir - + void void sysRmDir () @@ -711,15 +1175,15 @@ - + - - void - void sysUnlink + + int + int sysUnlink (const char *path, int *retVal) sysUnlink - const char * + const char * path @@ -732,16 +1196,15 @@ - - unlink + - + int int unlink (const char *node) unlink - const char * + const char * node @@ -750,48 +1213,7 @@ - - vfs_mountPoint::fs - vfs_mountPoint::mountPoint - NULL - strtok - vfs_findMount - fileSystem::vfsUnlink - sysUnlink - - - - - fileDescriptor * - fileDescriptor* fdTable - - fdTable - 0x0 - - - - - - - - fclose - fopen - - - spinLock_t - spinLock_t fdTable_lock - - fdTable_lock - SPIN_LOCK_INITIALIZER - - - - - - - - fclose - fopen + @@ -799,511 +1221,653 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: file_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vfs/vfs.h> -#include<vfs/file.h> -#include<ubixos/sched.h> -#include<ubixos/vitals.h> -#include<ubixos/kpanic.h> -#include<ubixos/spinlock.h> -#include<lib/kmalloc.h> -#include<lib/string.h> -#include<vmm/paging.h> -#include<lib/kprintf.h> -#include<assert.h> - -staticspinLock_tfdTable_lock=SPIN_LOCK_INITIALIZER; - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/sched.h> +#include<vfs/vfs.h> +#include<ubixos/vitals.h> +#include<ubixos/kpanic.h> +#include<ubixos/spinlock.h> +#include<lib/kmalloc.h> +#include<string.h> +#include<vmm/paging.h> +#include<lib/kprintf.h> +#include<assert.h> +#include<sys/descrip.h> + +staticstructspinLockfdTable_lock=SPIN_LOCK_INITIALIZER; + +fileDescriptor_t*fdTable=0x0; -fileDescriptor*fdTable=0x0; +fileDescriptor_t*vfs_fileTable=0x0; -/*USER*/ - -voidsysFwrite(char*ptr,intsize,userFileDescriptor*userFd){ -if(userFd==0x0){ -tty_print(ptr,_current->term); -} -else{ -fwrite(ptr,size,1,userFd->fd); -} -return; +intsys_fwrite(structthread*td,structsys_fwrite_args*uap){ +char*t=uap->buf; + +if(uap->fd==0x0) +tty_print((char*)uap->buf,_current->term); +else{ +#ifdefDEBUG_VFS +kprintf("uap->size:%i,FD:[0x%X],BUF:[0x%X][%c]\n",uap->nbytes,uap->fd,uap->buf,t[0]); +#endif +fwrite(uap->buf,uap->nbytes,1,uap->fd->fd); } - -voidsysFgetc(int*ptr,userFileDescriptor*userFd){ -fileDescriptor*tmpFd=0x0; -tmpFd=userFd->fd; -if(userFd->fd==0x0){ -while(1){ -if(_current->term==tty_foreground){ -if((*ptr=getch())!=0x0) -return; -sched_yield(); -} -else{ -sched_yield(); -} -/* -else{ -kprintf("WakingTask:%i\n",tty_foreground->owner); -sched_setStatus(tty_foreground->owner,READY); -kprintf("SleepingTask:%i\n",_current->id); -sched_setStatus(_current->id,WAIT); -sched_yield(); -} -*/ -} -} -else{ -ptr[0]=(int)fgetc(tmpFd); -} -} - -voidsysRmDir(){ -return; -} - -voidsysFseek(userFileDescriptor*userFd,longoffset,intwhence){ -//TODO:coredump? -if(userFd==NULL) -return; -if(userFd->fd==NULL) -return; - -userFd->fd->offset=offset+whence; -} - -voidsysChDir(constchar*path){ -if(strstr(path,":")==0x0){ -sprintf(_current->oInfo.cwd,"%s%s",_current->oInfo.cwd,path); -} -else{ -sprintf(_current->oInfo.cwd,path); -} -} - -voidsysUnlink(constchar*path,int*retVal){ -*retVal=unlink(path); -} + +td->td_retval[0]=0x0; + +return(0); +} + +/*USER*/ + +voidsysFwrite(char*ptr,intsize,userFileDescriptor*userFd){ +if(userFd==0x0){ +tty_print(ptr,_current->term); +} +else{ +fwrite(ptr,size,1,userFd->fd); +} +return; +} + +intsys_fgetc(structthread*td,structsys_fgetc_args*args){ +charc; + +if(args->FILE->fd==0x0){ + +while(1){ + +if(_current->term==tty_foreground){ +c=getchar(); + +if(c!=0x0){ +td->td_retval[0]=c; +return(0); +} + +sched_yield(); + +} +else{ +sched_yield(); +} +/* +else{ +kprintf("WakingTask:%i\n",tty_foreground->owner); +sched_setStatus(tty_foreground->owner,READY); +kprintf("SleepingTask:%i\n",_current->id); +sched_setStatus(_current->id,WAIT); +sched_yield(); +} +*/ +} +} +else{ +c=fgetc(args->FILE->fd); +td->td_retval[0]=c; +return(0); +} +} -/************************************************************************ - -Function:voidsysFopen(); -Description:OpensAFileDescriptorForAUserTask -Notes: - -************************************************************************/ -voidsysFopen(constchar*file,char*flags,userFileDescriptor*userFd){ -if(userFd==NULL) -kprintf("Error:userFd==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); -userFd->fd=fopen(file,flags); -if(userFd->fd!=0x0){ -userFd->fdSize=userFd->fd->size; -} -/*Return*/ -return; +voidsysRmDir(){ +return; +} + +intsys_fseek(structthread*td,structsys_fseek_args*args){ +kprintf("offset:%ld,whence:0x%X",args->offset,args->whence); + +//TODO:coredump? +if(args->FILE==NULL){ +td->td_retval[0]=-1; +return(-1); +} + +if(args->FILE->fd==NULL){ +td->td_retval[0]=-1; +return(-1); } - -/************************************************************************ - -Function:voidsysFread(); -Description:ReadsSIZEBytesFromTheuserFdIntoDATA -Notes: - -************************************************************************/ -voidsysFread(void*data,longsize,userFileDescriptor*userFd){ -/*TODO:coredump?*/ -if(userFd==NULL) -return; -if(userFd->fd==NULL) -return; -fread(data,size,1,userFd->fd); -return; -} - -/************************************************************************ - -Function:voidsysFclse(); -Description:ClosesAFileDescriptorForAUserTask -Notes: - -************************************************************************/ -voidsysFclose(userFileDescriptor*userFd,int*status){ -if(userFd==NULL) -{ -*status=-1; -return; -} -if(userFd->fd==NULL) -{ -*status=-1; -return; -} -*status=fclose(userFd->fd); -/*Return*/ -return; -} - - - -/*KERNEL*/ - - -size_tfread(void*ptr,size_tsize,size_tnmemb,fileDescriptor*fd){ -size_ti=0x0; + +switch(args->whence){ +case0: +args->FILE->fd->offset=args->offset+args->whence; +break; +case1: +args->FILE->fd->offset+=args->offset; +break; +default: +kprintf("seek-whence:%i",args->whence); +break; +} + +td->td_retval[0]=args->FILE->fd->offset&0xFFFFFFFF; +return(0); +} + +intsys_lseek(structthread*td,structsys_lseek_args*args){ +interror=0; +structfile*fdd=0x0; +fileDescriptor_t*fd=0x0; + +getfd(td,&fdd,args->fd); + +fd=fdd->fd; + +if(fdd==0||fdd->fd==0x0){ +error=-1; +kprintf("ERROR!"); +} + +kprintf("loffset(%i):%i:%i,whence:0x%X",sizeof(off_t),args->offset>>32,args->offset&0xFFFFFF,args->whence); + +switch(args->whence){ +caseSEEK_SET: +fd->offset=args->offset; +td->td_retval[0]=fd->offset&0xFFFFFFFF; +td->td_retval[1]=fd->offset>>32; +break; +caseSEEK_CUR: +fd->offset+=args->offset; +td->td_retval[0]=fd->offset&0xFFFFFFFF; +td->td_retval[1]=fd->offset>>32; +break; +default: +kprintf("seek-whence:%i",args->whence); +break; +} -if(fd==0x0) -return(0x0); - -if(nmemb==0x0) -nmemb=1;//TempFix - -assert(fd); -assert(fd->mp); -assert(fd->mp->fs); - -i=fd->mp->fs->vfsRead(fd,ptr,fd->offset,size*nmemb); - -fd->offset+=size*nmemb; - -//kprintf("fread:%i:%i",i,size*nmemb); +kprintf("loff:%ld",fd->offset); + +return(error); +} + +intsys_chdir(structthread*td,structsys_chdir_args*args){ +if(strstr(args->path,":")==0x0){ +sprintf(_current->oInfo.cwd,"%s%s",_current->oInfo.cwd,args->path); +} +else{ +sprintf(_current->oInfo.cwd,args->path); +} +td->td_retval[0]=0; +return(0); +} -return(i); -} - -size_tfwrite(void*ptr,intsize,intnmemb,fileDescriptor*fd){ -if(fd!=0x0){ -fd->mp->fs->vfsWrite(fd,ptr,fd->offset,size*nmemb); -fd->offset+=size*nmemb; -} -return(0x0); -} - -intfseek(fileDescriptor*tmpFd,longoffset,intwhence){ -tmpFd->offset=offset+whence; -return(tmpFd->offset); -} - -/************************************************************************ - -Function:intfeof(fileDescriptor*fd) -Description:CheckAFileDescriptorForEOFAndReturnResult -Notes: - -************************************************************************/ -intfeof(fileDescriptor*fd){ -if(fd->status==fdEof){ -return(-1); -} -return(0); -} - -/************************************************************************ - -Function:intfputc(intch,fileDescriptor*fd) -Description:ThisWillWriteCharacterToFD -Notes: - -************************************************************************/ -intfputc(intch,fileDescriptor*fd){ -if(fd!=0x0){ -ch=fd->mp->fs->vfsWrite(fd,(char*)ch,fd->offset,1); -fd->offset++; -return(ch); -} -/*ReturnNULLIfFDIsNotFound*/ -return(0x0); -} - -/************************************************************************ - -Function:intfgetc(fileDescriptor*fd) -Description:ThisWillReturnTheNextCharacterInAFDStream -Notes: - -************************************************************************/ -intfgetc(fileDescriptor*fd){ -intch=0x0; -/*IfFoundReturnNextChar*/ -if(fd!=0x0){ -fd->mp->fs->vfsRead(fd,(char*)&ch,fd->offset,1); -fd->offset++; -return(ch); -} - -/*ReturnNULLIfFDIsNotFound*/ -return(0x0); -} - -/************************************************************************ - -Function:fileDescriptor*fopen(constchar*file,contchar*flags) -Description:ThisWillOpenAFileAndReturnAFileDescriptor -Notes: - -08/05/02-JustStartedARewriteOfThisFunctionShouldWorkOutWell - -************************************************************************/ - -fileDescriptor*fopen(constchar*file,constchar*flags){ -inti=0x0; -char*path=0x0; -char*mountPoint=0x0; -charfileName[1024]; -fileDescriptor*tmpFd=0x0; - -/*AllocateMemoryForFileDescriptor*/ -if((tmpFd=(fileDescriptor*)kmalloc(sizeof(fileDescriptor)))==0x0){ -kprintf("Error:tmpFd==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); -return(NULL); -} - -strcpy(fileName,file); - -if(strstr(fileName,":")){ -mountPoint=(char*)strtok((char*)&fileName,":"); -path=strtok(NULL,"\n"); -} -else{ -path=fileName; -} - -if(path[0]=='/') -strcpy(tmpFd->fileName,path); -else -sprintf(tmpFd->fileName,"/%s",path); - -/*Findourmountpointorsetdefaulttosys*/ -if(mountPoint==0x0) -tmpFd->mp=vfs_findMount("sys"); -else -tmpFd->mp=vfs_findMount(mountPoint); - -if(tmpFd->mp==0x0){ -kprintf("MountPointBad\n"); -return(0x0); -} - -/*ThisWillSetUpTheDescriptorModes*/ -tmpFd->mode=0; -for(i=0;'\0'!=flags[i];i++){ -switch(flags[i]){ -case'w': -case'W': -tmpFd->mode|=fileWrite; -break; -case'r': -case'R': -tmpFd->mode|=fileRead; -break; -case'b': -case'B': -tmpFd->mode|=fileBinary; -break; -case'a': -case'A': -tmpFd->mode|=fileAppend; -break; -default: -kprintf("Invalidmode'%c'forfopen\n",flags[i]); -break; -} -} -/*SearchForTheFile*/ -if(tmpFd->mp->fs->vfsOpenFile(tmpFd->fileName,tmpFd)==0x1){ -/*IfTheFileIsFoundThenSetUpTheDescriptor*/ - - -/*inordertosaveresourceswewillallocatethebufferlaterwhenitisneeded*/ - -tmpFd->buffer=(char*)kmalloc(4096); -if(tmpFd->buffer==0x0) -{ -kfree(tmpFd); -kprintf("Error:tmpFd->buffer==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); -spinUnlock(&fdTable_lock); -return0x1; -} -/*SetItsStatusToOpen*/ -tmpFd->status=fdOpen; - -/*InitialFileOffsetIsZero*/ -tmpFd->offset=0; -tmpFd->prev=0x0; - -/*wedonotwanttobeinaspinlocklongerthanweneedto,so -ithasbeenmovedtohere.*/ -spinLock(&fdTable_lock); - -/*IncrementNumberOfOpenFiles*/ -systemVitals->openFiles++; - -tmpFd->next=fdTable; - -if(fdTable!=0x0) -fdTable->prev=tmpFd; - -fdTable=tmpFd; - -spinUnlock(&fdTable_lock); - -/*ReturnTheFD*/ -return(tmpFd); -} -else{ -kfree(tmpFd->buffer); -kfree(tmpFd); -spinUnlock(&fdTable_lock); -kprintf("FileNotFound?%s\n",file); -return(NULL); -} - -/*ReturnNULL*/ -return(0x0); -} - -/************************************************************************ +intsys_fchdir(structthread*td,structsys_fchdir_args*args){ +interror=0; +structfile*fdd=0x0; +fileDescriptor_t*fd=0x0; + +getfd(td,&fdd,args->fd); + +fd=fdd->fd; + +if(fdd==0||fdd->fd==0x0){ +error=-1; +} +else{ +if(strstr(fd->fileName,":")==0x0){ +sprintf(_current->oInfo.cwd,"%s%s",_current->oInfo.cwd,fd->fileName); +} +else{ +sprintf(_current->oInfo.cwd,fd->fileName); +} +} +return(error); +} + +intsys_rename(structthread*td,structsys_rename_args*args){ +td->td_retval[0]=0; +return(0); +} + +intsysUnlink(constchar*path,int*retVal){ +*retVal=0; +return(*retVal); +} + +/************************************************************************ + +Function:voidsysFopen(); +Description:OpensAFileDescriptorForAUserTask +Notes: + +************************************************************************/ +//voidsysFopen(constchar*file,char*flags,userFileDescriptor*userFd){ +intsys_fopen(structthread*td,structsys_fopen_args*args){ +kprintf("sys_fopen"); +if(args->FILE==NULL){ +kprintf("Error:userFd==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); +return(-1); +} + +args->FILE->fd=fopen(args->path,args->mode); +if(args->FILE->fd!=0x0){ +args->FILE->fdSize=args->FILE->fd->size; +} +/*Return*/ +return(0); +} + +/************************************************************************ + +Function:voidsysFread(); +Description:ReadsSIZEBytesFromTheuserFdIntoDATA +Notes: + +************************************************************************/ +intsys_fread(structthread*td,structsys_fread_args*args){ + +/*TODO:coredump?*/ +if(args->FILE==NULL) +return(-1); + +if(args->FILE->fd==NULL) +return(-1); + +td->td_retval[0]=fread(args->ptr,args->size,args->nmemb,args->FILE->fd); +return(0); +} + +/************************************************************************ + +Function:voidsysFclse(); +Description:ClosesAFileDescriptorForAUserTask +Notes: + +************************************************************************/ +intsys_fclose(structthread*td,structsys_fclose_args*args){ +if(args->FILE==NULL){ +return(-1); +} +if(args->FILE==NULL){ +return(-1); +} + +/*Return*/ +return(fclose(args->FILE->fd)); +} + +/*KERNEL*/ + +size_tfread(void*ptr,size_tsize,size_tnmemb,fileDescriptor_t*fd){ +size_ti=0x0; + +if(fd==0x0) +return(0x0); + +if(nmemb==0x0) +nmemb=1;//TempFix + +assert(fd); +assert(fd->mp); +assert(fd->mp->fs); + +i=fd->mp->fs->vfsRead(fd,ptr,fd->offset,size*nmemb); + +//fd->offset+=size*nmemb; + +return(i); +} + +size_tfwrite(void*ptr,intsize,intnmemb,fileDescriptor_t*fd){ +intres=0x0; +/* +kprintf("fd[0x%X]\m",fd); +kprintf("fd->mp[0x%X]\m",fd->mp); +kprintf("fd->mp->fs[0x%X]\m",fd->mp->fs); +*/ + +if(fd!=0x0){ +res=fd->mp->fs->vfsWrite(fd,ptr,fd->offset,size*nmemb); +fd->offset+=size*nmemb; +} +return(res); +} + +intfseek(fileDescriptor_t*tmpFd,longoffset,intwhence){ +tmpFd->offset=offset+whence; +return(tmpFd->offset); +} + +/************************************************************************ + +Function:intfeof(fileDescriptor_t*fd) +Description:CheckAFileDescriptorForEOFAndReturnResult +Notes: + +************************************************************************/ +intfeof(fileDescriptor_t*fd){ +if(fd->status==fdEof){ +return(-1); +} +return(0); +} + +/************************************************************************ + +Function:intfputc(intch,fileDescriptor_t*fd) +Description:ThisWillWriteCharacterToFD +Notes: + +************************************************************************/ +intfputc(intch,fileDescriptor_t*fd){ +if(fd!=0x0){ +ch=fd->mp->fs->vfsWrite(fd,(char*)ch,fd->offset,1); +fd->offset++; +return(ch); +} +/*ReturnNULLIfFDIsNotFound*/ +return(0x0); +} + +/************************************************************************ + +Function:intfgetc(fileDescriptor_T*fd) +Description:ThisWillReturnTheNextCharacterInAFDStream +Notes: + +************************************************************************/ +intfgetc(fileDescriptor_t*fd){ +intch=0x0; +/*IfFoundReturnNextChar*/ +if(fd!=0x0){ +fd->mp->fs->vfsRead(fd,(char*)&ch,fd->offset,1); +fd->offset++; +return(ch); +} + +/*ReturnNULLIfFDIsNotFound*/ +return(0x0); +} + +/************************************************************************ + +Function:fileDescriptor_t*fopen(constchar*file,contchar*flags) +Description:ThisWillOpenAFileAndReturnAFileDescriptor +Notes: + +08/05/02-JustStartedARewriteOfThisFunctionShouldWorkOutWell -Function:intfclose(fileDescriptor*fd); -Description:ThisWillCloseAndFreeAFileDescriptor -Notes: - -************************************************************************/ -intfclose(fileDescriptor*fd){ -fileDescriptor*tmpFd=0x0; -assert(fd); - -spinLock(&fdTable_lock); - -for(tmpFd=fdTable;tmpFd!=0x0;tmpFd=tmpFd->next){ -if(tmpFd==fd){ -if(tmpFd->prev) -tmpFd->prev->next=tmpFd->next; -if(tmpFd->next) -tmpFd->next->prev=tmpFd->prev; +************************************************************************/ + +fileDescriptor_t*fopen(constchar*file,constchar*flags){ + +inti=0x0; +char*path=0x0; +char*mountPoint=0x0; +charfileName[1024]; +fileDescriptor_t*tmpFd=0x0; + +/*AllocateMemoryForFileDescriptor*/ +if((tmpFd=(fileDescriptor_t*)kmalloc(sizeof(fileDescriptor_t)))==0x0){ +kprintf("Error:tmpFd==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); +return(NULL); +} + +memset(tmpFd,0x0,sizeof(fileDescriptor_t)); -if(tmpFd==fdTable) -fdTable=tmpFd->next; - -systemVitals->openFiles--; -spinUnlock(&fdTable_lock); -if(tmpFd->buffer!=NULL) -kfree(tmpFd->buffer); -kfree(tmpFd); -return(0x0); -} -} - -spinUnlock(&fdTable_lock); -return(0x1); -} - -/*UBU*/ +path=file; + +/*Determineifpathisrelativeorabsolute*/ +if(path[0]=="."&&path[1]=='\0') +strcpy(fileName,_current->oInfo.cwd); +else +strcpy(fileName,file); + +path=0x0; + +if(strstr(fileName,":")){ +mountPoint=(char*)strtok((char*)&fileName,":"); +path=strtok(NULL,"\n"); +} +else{ +path=fileName; +} -/************************************************************************ - -Function:voidsysMkDir(constchar*path) -Description:ThisWillCreateANewDirectory -Notes: - -************************************************************************/ -voidsysMkDir(constchar*path){ -fileDescriptor*tmpFD=0x0; -chartmpDir[1024]; -charrootPath[256]; -char*dir=0x0;//UBU*mountPoint=0x0; -char*tmp=0x0; -rootPath[0]='\0'; -dir=(char*)path; - -if(strstr(path,":")==0x0){ -sprintf(tmpDir,"%s%s",_current->oInfo.cwd,path); -dir=(char*)&tmpDir; -} -while(strstr(dir,"/")){ -if(rootPath[0]==0x0) -sprintf(rootPath,"%s/",strtok(dir,"/")); -else -sprintf(rootPath,"%s%s/",rootPath,strtok(dir,"/")); -tmp=strtok(NULL,"\n"); -dir=tmp; -} - -//kprintf("rootPath:[%s]\n",rootPath); -tmpFD=fopen(rootPath,"rb"); - -if(tmpFD->mp==0x0){ -kprintf("InvalidMountPoint\n"); -} -tmpFD->mp->fs->vfsMakeDir(dir,tmpFD); - -fclose(tmpFD); - -return; -} - - -/************************************************************************ - -Function:intunlink(constchar*node) -Description:Thiswillunlinkafile -Notes: - -************************************************************************/ - -intunlink(constchar*node){ -char*path=0x0,*mountPoint=0x0; -structvfs_mountPoint*mp=0x0; - -path=(char*)strtok((char*)node,"@"); -mountPoint=strtok(NULL,"\n"); -if(mountPoint==0x0){ -mp=vfs_findMount("sys");/*_current->oInfo.container;*/ -} -else{ -mp=vfs_findMount(mountPoint); -} -if(mp==0x0){ -//kpanic("MountPointBad"); -return(0x0); -} -mp->fs->vfsUnlink(path,mp); -return(0x0); -} - - -/*** -END -***/ - +if(path[0]=='/') +strcpy(tmpFd->fileName,path); +else +sprintf(tmpFd->fileName,"/%s",path); + +/*Findourmountpointorsetdefaulttosys*/ +if(mountPoint==0x0){ +tmpFd->mp=vfs_findMount("sys"); +} +else{ +tmpFd->mp=vfs_findMount(mountPoint); +} + +if(tmpFd->mp==0x0){ +kprintf("MountPointBad\n"); +return(0x0); +} + +/*ThisWillSetUpTheDescriptorModes*/ +tmpFd->mode=0; +for(i=0;'\0'!=flags[i];i++){ +switch(flags[i]){ +case'w': +case'W': +tmpFd->mode|=fileWrite; +break; +case'r': +case'R': +tmpFd->mode|=fileRead; +break; +case'b': +case'B': +tmpFd->mode|=fileBinary; +break; +case'a': +case'A': +tmpFd->mode|=fileAppend; +break; +default: +kprintf("Invalidmode'%c'forfopen\n",flags[i]); +break; +} +} + +/*SearchForTheFile*/ +if(tmpFd->mp->fs->vfsOpenFile(tmpFd->fileName,tmpFd)==0x1){ +/*IfTheFileIsFoundThenSetUpTheDescriptor*/ + +/*inordertosaveresourceswewillallocatethebufferlaterwhenitisneeded*/ + +tmpFd->buffer=(char*)kmalloc(4096); + +if(tmpFd->buffer==0x0){ +kfree(tmpFd); +kprintf("Error:tmpFd->buffer==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); +spinUnlock(&fdTable_lock); +return(0x0); +} + +/*SetItsStatusToOpen*/ +tmpFd->status=fdOpen; + +/*InitialFileOffsetIsZero*/ +tmpFd->offset=0; +tmpFd->prev=0x0; + +/*wedonotwanttobeinaspinlocklongerthanweneedto,so +ithasbeenmovedtohere.*/ +spinLock(&fdTable_lock); + +/*IncrementNumberOfOpenFiles*/ +systemVitals->openFiles++; + +tmpFd->next=fdTable; + +if(fdTable!=0x0) +fdTable->prev=tmpFd; + +fdTable=tmpFd; + +spinUnlock(&fdTable_lock); + +/*ReturnTheFD*/ +return(tmpFd); +} +else{ +//kprintf("Freeing"); +kfree(tmpFd->buffer); +kfree(tmpFd); +spinUnlock(&fdTable_lock); +//MrOlsen(2016-01-13)NOTE:Wedon'tneedthisrightnowkprintf("FileNotFound?%s\n",file); +return(0x0); +} + +/*ReturnNULL*/ +return(0x0); +} + +/************************************************************************ + +Function:intfclose(fileDescriptor_t*fd); +Description:ThisWillCloseAndFreeAFileDescriptor +Notes: + +************************************************************************/ +intfclose(fileDescriptor_t*fd){ +fileDescriptor_t*tmpFd=0x0; + +if(fd==0) +return(0x0); + +spinLock(&fdTable_lock); + +kprintf("[%s:%i]",__FILE__,__LINE__); + +for(tmpFd=fdTable;tmpFd!=0x0;tmpFd=tmpFd->next){ +if(tmpFd==fd){ +kprintf("DUP:[%i:0x%X]",fd->dup,fd); +if(fd->dup>0) +fd->dup--; +else{ +fd->dup=-2; +if(fd->res!=0x0) +fl_fclose(fd->res); + +if(tmpFd->prev) +tmpFd->prev->next=tmpFd->next; +if(tmpFd->next) +tmpFd->next->prev=tmpFd->prev; + +if(tmpFd==fdTable) +fdTable=tmpFd->next; + +systemVitals->openFiles--; +spinUnlock(&fdTable_lock); +if(tmpFd->buffer!=NULL) +kfree(tmpFd->buffer); +kfree(tmpFd); +return(0x0); +} +} +} + +spinUnlock(&fdTable_lock); +return(0x1); +} + +/*UBU*/ + +/************************************************************************ + +Function:voidsysMkDir(constchar*path) +Description:ThisWillCreateANewDirectory +Notes: + +************************************************************************/ +voidsysMkDir(constchar*path){ +fileDescriptor_t*tmpFD=0x0; +chartmpDir[1024]; +charrootPath[256]; +char*dir=0x0;//UBU*mountPoint=0x0; +char*tmp=0x0; +rootPath[0]='\0'; +dir=(char*)path; + +if(strstr(path,":")==0x0){ +sprintf(tmpDir,"%s%s",_current->oInfo.cwd,path); +dir=(char*)&tmpDir; +} +while(strstr(dir,"/")){ +if(rootPath[0]==0x0) +sprintf(rootPath,"%s/",strtok(dir,"/")); +else +sprintf(rootPath,"%s%s/",rootPath,strtok(dir,"/")); +tmp=strtok(NULL,"\n"); +dir=tmp; +} + +//kprintf("rootPath:[%s]\n",rootPath); +tmpFD=fopen(rootPath,"rb"); + +if(tmpFD->mp==0x0){ +kprintf("InvalidMountPoint\n"); +} +tmpFD->mp->fs->vfsMakeDir(dir,tmpFD); + +fclose(tmpFD); + +return; +} + +/************************************************************************ + +Function:intunlink(constchar*node) +Description:Thiswillunlinkafile +Notes: + +************************************************************************/ + +intunlink(constchar*node){ +char*path=0x0,*mountPoint=0x0; +structvfs_mountPoint*mp=0x0; + +path=(char*)strtok((char*)node,"@"); +mountPoint=strtok(NULL,"\n"); +if(mountPoint==0x0){ +mp=vfs_findMount("sys");/*_current->oInfo.container;*/ +} +else{ +mp=vfs_findMount(mountPoint); +} +if(mp==0x0){ +//kpanic("MountPointBad"); +return(0x0); +} +mp->fs->vfsUnlink(path,mp); +return(0x0); +} - + diff --git a/doc/xml/fork_8h.xml b/doc/xml/fork_8h.xml index 4af1db2..a29fb83 100644 --- a/doc/xml/fork_8h.xml +++ b/doc/xml/fork_8h.xml @@ -1,109 +1,243 @@ - - - + + + fork.h - ubixos/types.h + sys/types.h ubixos/sched.h - src/sys/kernel/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/net/net/shell.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + - + - + - + - + - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - + - + - - - - + + + + - - - + + + - - - - + + + + + + + + + + + + + + + + - - void - void sysFork - () + + int + int sysFork + (struct thread *, void *) sysFork + + struct thread * + + + void * + - + @@ -111,69 +245,45 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: fork_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_FORK_H -#define_FORK_H - -#include<ubixos/types.h> -#include<ubixos/sched.h> - -voidsysFork(); +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_FORK_H +#define_UBIXOS_FORK_H + +#include<sys/types.h> +#include<ubixos/sched.h> + +//voidsysFork(); +intsysFork(structthread*,void*); -#endif - -/*** -$Log: fork_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:54reddawg -nomessage - -Revision1.32004/09/1113:06:39reddawg -fork:cleanedupcommentsinforkandmadefork_copyProcessstatic - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ +#endif/*END_UBIXOS_FORK_H*/ - + diff --git a/doc/xml/fsAbstract_8h.xml b/doc/xml/fsAbstract_8h.xml index 1af34b6..3444bf9 100644 --- a/doc/xml/fsAbstract_8h.xml +++ b/doc/xml/fsAbstract_8h.xml @@ -1,180 +1,59 @@ - - - + + + fsAbstract.h - stdio.h - dirent.h - sys/types.h - device.h - file.h - src/sys/ubixfsv2/ubixfs.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vfs_abstract -#ifndefFSABSTRACT_H -#defineFSABSTRACT_H - -#include<stdio.h> -#include<dirent.h> -#include<sys/types.h> -#include<device.h> -#include"file.h" - -classvfs_abstract{ -protected: -vfs_abstract*prev; -vfs_abstract*next; -device_t*device; -public: -/*FileI/O*/ -virtualintvfs_open(constchar*,fileDescriptor*,int,...){return-1;}; -virtualintvfs_close(fileDescriptor*){return-1;}; -virtualsize_tvfs_read(fileDescriptor*,void*,off_t,size_t) -{return0;}; -virtualsize_tvfs_write(fileDescriptor*,void*,off_t,size_t) -{return0;}; - -/*DirI/O*/ -virtualintvfs_opendir(DIR*,constchar*){return-1;}; -virtualintvfs_closedir(DIR*){return-1;}; -virtualintvfs_mkdir(constchar*,mode_t){return-1;}; -virtualintvfs_rmdir(constchar*){return-1;}; -virtualintvfs_readdir(DIR*,structdirent*){return-1;}; - -/*FSFunctions*/ -virtualintvfs_init(void){return-1;}; -virtualintvfs_format(device_t*){return-1;}; -virtualvoid*vfs_mknod(constchar*,mode_t){returnNULL;}; -virtualintvfs_purge(void){return-1;}; -virtualintvfs_stop(void){return-1;}; -virtualintvfs_sync(void){return-1;}; - -/*MiscFunctions*/ -virtualintvfs_unlink(constchar*){return-1;}; -virtualintvfs_rename(constchar*,constchar*){return-1;}; - -virtual~vfs_abstract(void){}; -};//vfs_FS - -#endif//!FSABSTRACT_H +/*#ifndefFSABSTRACT_H +#defineFSABSTRACT_H + +#include<stdio.h> +#include<dirent.h> +#include<sys/types.h> +#include<device.h> +#include"file.h" + +classvfs_abstract{ +protected: +vfs_abstract*prev; +vfs_abstract*next; +device_t*device; +public: +//FileI/O +virtualintvfs_open(constchar*,fileDescriptor*,int,...){return-1;}; +virtualintvfs_close(fileDescriptor*){return-1;}; +virtualsize_tvfs_read(fileDescriptor*,void*,off_t,size_t) +{return0;}; +virtualsize_tvfs_write(fileDescriptor*,void*,off_t,size_t) +{return0;}; + +//DirI/O +virtualintvfs_opendir(DIR*,constchar*){return-1;}; +virtualintvfs_closedir(DIR*){return-1;}; +virtualintvfs_mkdir(constchar*,mode_t){return-1;}; +virtualintvfs_rmdir(constchar*){return-1;}; +virtualintvfs_readdir(DIR*,structdirent*){return-1;}; + +//FSFunctions +virtualintvfs_init(void){return-1;}; +virtualintvfs_format(device_t*){return-1;}; +virtualvoid*vfs_mknod(constchar*,mode_t){returnNULL;}; +virtualintvfs_purge(void){return-1;}; +virtualintvfs_stop(void){return-1;}; +virtualintvfs_sync(void){return-1;}; + +//MiscFunctions +virtualintvfs_unlink(constchar*){return-1;}; +virtualintvfs_rename(constchar*,constchar*){return-1;}; + +virtual~vfs_abstract(void){}; +};//vfs_FS + +#endif*///!FSABSTRACT_H - + diff --git a/doc/xml/gdt_8h.xml b/doc/xml/gdt_8h.xml index 3f65377..78e892c 100644 --- a/doc/xml/gdt_8h.xml +++ b/doc/xml/gdt_8h.xml @@ -1,452 +1,620 @@ - - - + + + gdt.h - src/sys/include/sys/idt.h - src/sys/init/main.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/mouse.c - src/sys/kernel/sched.c - src/sys/pci/lnc.c - src/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/trap.c + C:/Dev/git/UbixOS/sys/include/sys/idt.h + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/mouse.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/sys/idt.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + - + - + - + - + - + - + - + + + + + + + + + - - - - - - + + - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + descriptorTableUnion gdtDescriptor gdtGate - + dAcc - 0x100 + 0x100 /* Accessed (Data or Code) */ - + - + dBig - 0x40 + 0x40 /* Default to 32 bit mode */ - - ubixDescriptorTable + - + dBiglim - 0x80 + 0x80 /* Limit is in 4K units */ - - ubixDescriptorTable + - + dBusy - 0xB00 + 0xB00 /* Busy (TSS only) was 200 */ - + - + dCall - 0x0C00 + 0x0C00 /* 386 Call Gate */ - + - + dCode - 0x1800 + 0x1800 /* Code Segment */ - - ubixDescriptorTable + - + dConform - 0x400 + 0x400 /* Conforming (Code segments only) */ - + - + dData - 0x1000 + 0x1000 /* Data Segment */ - - ubixDescriptorTable + - + dDpl0 - 0x0000 + 0x0000 /* DPL0 or mask for DPL */ - - atkbd_init - idt_init - ne2k_init + - + dDpl1 - 0x2000 + 0x2000 /* DPL1 or mask for DPL */ - + - + dDpl2 - 0x4000 + 0x4000 /* DPL2 or mask for DPL */ - + - + dDpl3 - 0x6000 + 0x6000 /* DPL3 or mask for DPL */ - - idt_init - initLNC - mouseInit - ubixDescriptorTable + - + dEexdown - 0x400 + 0x400 /* Expand down (Data segments only) */ - + - + dInt - 0x0E00 + 0x0E00 /* 386 Interrupt Gate */ - - atkbd_init - fdc_init - idt_init - initLNC - mouseInit - ne2k_init + - + dLdt - 0x200 + 0x200 /* Local Descriptor Table (LDT) */ - - ubixDescriptorTable + - + dNpresent - 0x8000 + 0x8000 /* Not Present */ - + - + dPresent - 0x8000 + 0x8000 /* Present */ - - atkbd_init - fdc_init - idt_init - initLNC - mouseInit - ne2k_init + - + dRead - 0x200 + 0x200 /* Readable (Code segments only) */ - - ubixDescriptorTable + - + dTask - 0x500 + 0x500 /* Task gate */ - - idt_init + - + dTrap - 0x0F00 + 0x0F00 /* 386 Trap Gate */ - - idt_init + - + dTss - 0x900 + 0x900 /* Task State Segment (TSS) */ - - ubixDescriptorTable + - + dWrite - 0x200 + 0x200 /* Writable (Data segments only) */ - - ubixDescriptorTable + - + + SEL_GET_IDX + sel + (((sel)>>3) & 0x1FFF) /* Get Selector Index */ + + + + + + + + + + SEL_GET_LG + sel + ((sel)&4) /* Return Local/Global Descriptor */ + + + + + + + + + + SEL_GET_PL + sel + ((sel)&3) /* Get Priority Level Of Selector */ + + + + + + + + + + SEL_PL_KERN + 0x0 + + + + + + + + + + SEL_PL_USER + 0x3 + + + + + + + + + ubixDescriptorTable name length - union descriptorTableUnion name[length] = + union descriptorTableUnion name[length] = - + - + ubixGateDescriptor offset selector control - {gate: {(offset & 0xffff), selector, \ - (control+dPresent), (offset >> 16) }} + {.gate = {(offset & 0xffff), selector, (control+dPresent), (offset >> 16) }} - + - + ubixStandardDescriptor base limit control - {descriptor: \ - {(limit & 0xffff), \ - (base & 0xffff), \ - ((base >> 16) & 0xff), \ - ((control+dPresent) >> 8), \ - (limit >> 16), \ - ((control & 0xff) >> 4), \ - (base >> 24)}} + {.descriptor = {(limit & 0xffff), (base & 0xffff), ((base >> 16) & 0xff), ((control + dPresent) >> 8), (limit >> 16), ((control & 0xff) >> 4), (base >> 24)}} - - ubixDescriptorTable + - - gdtGate - struct gdtGate packed + + union descriptorTableUnion + struct gdtGate __attribute__ - packed + __attribute__ - + - - gdtDescriptor - struct gdtDescriptor packed + + unsigned char + unsigned short access - packed + access - + - - descriptorTableUnion - union descriptorTableUnion ubixGDT[9] - [9] + + unsigned char + unsigned char baseHigh + + baseHigh + + + + + + + + + + unsigned short + unsigned short baseLow + + baseLow + + + + + + + + + + unsigned char + unsigned char baseMed + + baseMed + + + + + + + + + + unsigned int + unsigned int granularity + + granularity + + + + + + + + + + unsigned int + unsigned int limitHigh + + limitHigh + + + + + + + + + + unsigned short + unsigned short limitLow + + limitLow + + + + + + + + + + unsigned short + unsigned short offsetHigh + + offsetHigh + + + + + + + + + + unsigned short + unsigned short offsetLow + + offsetLow + + + + + + + + + + unsigned short + unsigned short selector + + selector + + + + + + + + setTaskVector + + + union descriptorTableUnion + union descriptorTableUnion ubixGDT[11] + [11] ubixGDT @@ -454,7 +622,25 @@ - + + + + + + struct gdtDescriptor + struct gdtDescriptor __attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + @@ -462,132 +648,125 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: gdt_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_GDT_H -#define_GDT_H - -/*DescriptorDefinitions*/ -#definedCall0x0C00/*386CallGate*/ -#definedCode0x1800/*CodeSegment*/ -#definedData0x1000/*DataSegment*/ -#definedInt0x0E00/*386InterruptGate*/ -#definedLdt0x200/*LocalDescriptorTable(LDT)*/ -#definedTask0x500/*Taskgate*/ -#definedTrap0x0F00/*386TrapGate*/ -#definedTss0x900/*TaskStateSegment(TSS)*/ - -/*DescriptorOptions*/ -#definedDpl30x6000/*DPL3ormaskforDPL*/ -#definedDpl20x4000/*DPL2ormaskforDPL*/ -#definedDpl10x2000/*DPL1ormaskforDPL*/ -#definedDpl00x0000/*DPL0ormaskforDPL*/ -#definedPresent0x8000/*Present*/ -#definedNpresent0x8000/*NotPresent*/ -#definedAcc0x100/*Accessed(DataorCode)*/ -#definedWrite0x200/*Writable(Datasegmentsonly)*/ -#definedRead0x200/*Readable(Codesegmentsonly)*/ -#definedBusy0xB00/*Busy(TSSonly)was200*/ -#definedEexdown0x400/*Expanddown(Datasegmentsonly)*/ -#definedConform0x400/*Conforming(Codesegmentsonly)*/ -#definedBig0x40/*Defaultto32bitmode*/ -#definedBiglim0x80/*Limitisin4Kunits*/ - -/*GDTDescriptor*/ -structgdtDescriptor{ -unsignedshortlimitLow;/*Limit0..15*/ -unsignedshortbaseLow;/*Base0..15*/ -unsignedcharbaseMed;/*Base16..23*/ -unsignedcharaccess;/*AccessByte*/ -unsignedintlimitHigh:4;/*Limit16..19*/ -unsignedintgranularity:4;/*Granularity*/ -unsignedcharbaseHigh;/*Base24..31*/ -}__attribute__((packed)); - -structgdtGate{ -unsignedshortoffsetLow;/*Offset0..15*/ -unsignedshortselector;/*Selector*/ -unsignedshortaccess;/*AccessFlags*/ -unsignedshortoffsetHigh;/*Offset16..31*/ -}__attribute__((packed)); - -uniondescriptorTableUnion{ -structgdtDescriptordescriptor;/*Normaldescriptor*/ -structgdtGategate;/*Gatedescriptor*/ -unsignedlongdummy;/*Anyotherinfo*/ -}; - - -#defineubixDescriptorTable(name,length)uniondescriptorTableUnionname[length]= -#defineubixStandardDescriptor(base,limit,control){descriptor:\ -{(limit&0xffff),\ -(base&0xffff),\ -((base>>16)&0xff),\ -((control+dPresent)>>8),\ -(limit>>16),\ -((control&0xff)>>4),\ -(base>>24)}} -#defineubixGateDescriptor(offset,selector,control){gate:{(offset&0xffff),selector,\ -(control+dPresent),(offset>>16)}} - -externuniondescriptorTableUnionubixGDT[9]; - -#endif - -/*** -$Log: gdt_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_GDT_H_ +#define_GDT_H_ + +#defineSEL_GET_PL(sel)((sel)&3)/*GetPriorityLevelOfSelector*/ +#defineSEL_GET_LG(sel)((sel)&4)/*ReturnLocal/GlobalDescriptor*/ +#defineSEL_GET_IDX(sel)(((sel)>>3)&0x1FFF)/*GetSelectorIndex*/ + +#defineSEL_PL_KERN0x0 +#defineSEL_PL_USER0x3 + +/*DescriptorDefinitions*/ +#definedCall0x0C00/*386CallGate*/ +#definedCode0x1800/*CodeSegment*/ +#definedData0x1000/*DataSegment*/ +#definedInt0x0E00/*386InterruptGate*/ +#definedLdt0x200/*LocalDescriptorTable(LDT)*/ +#definedTask0x500/*Taskgate*/ +#definedTrap0x0F00/*386TrapGate*/ +#definedTss0x900/*TaskStateSegment(TSS)*/ + +/*DescriptorOptions*/ +#definedDpl30x6000/*DPL3ormaskforDPL*/ +#definedDpl20x4000/*DPL2ormaskforDPL*/ +#definedDpl10x2000/*DPL1ormaskforDPL*/ +#definedDpl00x0000/*DPL0ormaskforDPL*/ +#definedPresent0x8000/*Present*/ +#definedNpresent0x8000/*NotPresent*/ +#definedAcc0x100/*Accessed(DataorCode)*/ +#definedWrite0x200/*Writable(Datasegmentsonly)*/ +#definedRead0x200/*Readable(Codesegmentsonly)*/ +#definedBusy0xB00/*Busy(TSSonly)was200*/ +#definedEexdown0x400/*Expanddown(Datasegmentsonly)*/ +#definedConform0x400/*Conforming(Codesegmentsonly)*/ +#definedBig0x40/*Defaultto32bitmode*/ +#definedBiglim0x80/*Limitisin4Kunits*/ + +/*GDTDescriptor*/ +structgdtDescriptor{ +unsignedshortlimitLow;/*Limit0..15*/ +unsignedshortbaseLow;/*Base0..15*/ +unsignedcharbaseMed;/*Base16..23*/ +unsignedcharaccess;/*AccessByte*/ +unsignedintlimitHigh:4;/*Limit16..19*/ +unsignedintgranularity:4;/*Granularity*/ +unsignedcharbaseHigh;/*Base24..31*/ +}__attribute__((packed)); + +structgdtGate{ +unsignedshortoffsetLow;/*Offset0..15*/ +unsignedshortselector;/*Selector*/ +unsignedshortaccess;/*AccessFlags*/ +unsignedshortoffsetHigh;/*Offset16..31*/ +}__attribute__((packed)); + +uniondescriptorTableUnion{ +structgdtDescriptordescriptor;/*Normaldescriptor*/ +structgdtGategate;/*Gatedescriptor*/ +unsignedlongdummy;/*Anyotherinfo*/ +}; + +#defineubixDescriptorTable(name,length)uniondescriptorTableUnionname[length]= +#defineubixStandardDescriptor(base,limit,control){.descriptor={(limit&0xffff),(base&0xffff),((base>>16)&0xff),((control+dPresent)>>8),(limit>>16),((control&0xff)>>4),(base>>24)}} +#defineubixGateDescriptor(offset,selector,control){.gate={(offset&0xffff),selector,(control+dPresent),(offset>>16)}} + +externuniondescriptorTableUnionubixGDT[11]; + +#endif + +/*** +$Log:gdt.h,v$ +Revision1.1.1.12006/06/0112:46:15reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed -Revision1.22005/10/1200:13:37reddawg -Removed +Revision1.1.1.12005/09/2617:23:52reddawg +nomessage -Revision1.1.1.12005/09/2617:23:52reddawg -nomessage +Revision1.52004/08/1516:47:49reddawg +Fixed -Revision1.52004/08/1516:47:49reddawg -Fixed +Revision1.42004/07/2220:53:07reddawg +atkbd:fixedproblem -Revision1.42004/07/2220:53:07reddawg -atkbd:fixedproblem +Revision1.32004/05/2115:12:17reddawg +Cleanedup -Revision1.32004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +END +***/ - + diff --git a/doc/xml/gen__calls_8c.xml b/doc/xml/gen__calls_8c.xml index 1f6d6a7..cc9ad5c 100644 --- a/doc/xml/gen__calls_8c.xml +++ b/doc/xml/gen__calls_8c.xml @@ -1,160 +1,376 @@ - - - + + + gen_calls.c - ubixos/types.h - sys/thread.h sys/gen_calls.h - sys/kern_descrip.h + sys/thread.h + sys/gdt.h ubixos/sched.h + ubixos/endtask.h lib/kprintf.h lib/kmalloc.h string.h assert.h + sys/descrip.h + sys/video.h + sys/signal.h + ubixos/errno.h + vmm/vmm.h - - - - + + + + - - - - + + + + + + + + - - - - - - - + - - - - + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + int + int access + (struct thread *td, struct access_args *uap) + access + + struct thread * + td + + + struct access_args * + uap + + + + + + + + + kprintf + access_args::path + + int int getgid (struct thread *td, struct getgid_args *uap) @@ -173,14 +389,13 @@ - - _current - taskStruct::gid - kprintf - taskStruct::td - thread::td_retval + + _current + taskStruct::gid + kprintf + thread::td_retval - + int int getpid (struct thread *td, struct getpid_args *uap) @@ -199,14 +414,13 @@ - - _current - taskStruct::id - kprintf - taskStruct::td - thread::td_retval + + _current + taskStruct::id + kprintf + thread::td_retval - + int int gettimeofday_new (struct thread *td, struct gettimeofday_args *uap) @@ -225,10 +439,10 @@ - - kprintf + + kprintf - + int int getuid (struct thread *td, struct getuid_args *uap) @@ -247,24 +461,23 @@ - - _current - kprintf - taskStruct::td - thread::td_retval - taskStruct::uid + + _current + kprintf + thread::td_retval + taskStruct::uid - + int - int issetugid - (register struct thread *td, struct issetugid_args *uap) - issetugid + int mprotect + (struct thread *td, struct mprotect_args *uap) + mprotect - register struct thread * + struct thread * td - struct issetugid_args * + struct mprotect_args * uap @@ -273,10 +486,9 @@ - - kprintf + - + int int read (struct thread *td, struct read_args *uap) @@ -295,18 +507,19 @@ - - read_args::buf - read_args::fd - file::fd - fread - getfd - kprintf - read_args::nbyte - thread::td_retval - x1 + + read_args::buf + file::fd + read_args::fd + fread + getfd + kprintf + read_args::nbyte + thread::td_retval + dmaXfer + fdcRw - + int int readlink (struct thread *td, struct readlink_args *uap) @@ -325,14 +538,13 @@ - - readlink_args::count - kprintf - readlink_args::path - taskStruct::td - thread::td_retval + + readlink_args::count + kprintf + readlink_args::path + thread::td_retval - + int int setitimer (struct thread *td, struct setitimer_args *uap) @@ -346,24 +558,274 @@ uap -place holder for now functionality to be added later +place holder for now functionality to be added later + - + - + int - int sys_write - (struct thread *td, struct write_args *uap) - sys_write + int sys_exit + (struct thread *td, struct sys_exit_args *args) + sys_exit struct thread * td - struct write_args * + struct sys_exit_args * + args + + + + + + + + + _current + endTask + taskStruct::id + + + int + int sys_getegid + (struct thread *td, struct sys_getegid_args *args) + sys_getegid + + struct thread * + td + + + struct sys_getegid_args * + args + + + + + + + + + _current + taskStruct::gid + thread::td_retval + + + int + int sys_geteuid + (struct thread *td, struct sys_geteuid_args *args) + sys_geteuid + + struct thread * + td + + + struct sys_geteuid_args * + args + + + + + + + + + _current + thread::td_retval + taskStruct::uid + + + int + int sys_getlogin + (struct thread *thr, struct sys_getlogin_args *args) + sys_getlogin + + struct thread * + thr + + + struct sys_getlogin_args * + args + + + + + + + + + _current + memcpy + sys_getlogin_args::namebuf + sys_getlogin_args::namelen + taskStruct::username + + + int + int sys_getpgrp + (struct thread *td, struct sys_getpgrp_args *args) + sys_getpgrp + + struct thread * + td + + + struct sys_getpgrp_args * + args + + + + + + + + + _current + taskStruct::pgrp + thread::td_retval + + + int + int sys_getpid + (struct thread *td, struct sys_getpid_args *args) + sys_getpid + + struct thread * + td + + + struct sys_getpid_args * + args + + + + + + + + + _current + taskStruct::id + thread::td_retval + + + int + int sys_getppid + (struct thread *td, struct sys_getppid_args *args) + sys_getppid + + struct thread * + td + + + struct sys_getppid_args * + args + + + + + + + + + _current + taskStruct::ppid + thread::td_retval + + + int + int sys_getrlimit + (struct thread *thr, struct sys_getrlimit_args *args) + sys_getrlimit + + struct thread * + thr + + + struct sys_getrlimit_args * + args + + + + + + + + + kprintf + thread::rlim + rlimit::rlim_cur + rlimit::rlim_max + sys_getrlimit_args::rlp + sys_getrlimit_args::which + + + int + int sys_gettimeofday + (struct thread *td, struct sys_gettimeofday_args *args) + sys_gettimeofday + + struct thread * + td + + + struct sys_gettimeofday_args * + args + + + + + + + + + gettimeofday + thread::td_retval + sys_gettimeofday_args::tp + sys_gettimeofday_args::tzp + + + int + int sys_invalid + (struct thread *td, void *args) + sys_invalid + + struct thread * + td + + + void * + args + + + + + + + + + _current + thread::frame + taskStruct::id + kprintf + thread::td_retval + trapframe::tf_eax + + + int + int sys_issetugid + (register struct thread *td, struct sys_issetugid_args *uap) + sys_issetugid + + register struct thread * + td + + + struct sys_issetugid_args * uap @@ -372,16 +834,218 @@ - - write_args::buf - write_args::fd - kfree - kmalloc - kprintf - memcpy - write_args::nbyte - taskStruct::td - thread::td_retval + + thread::td_retval + + + int + int sys_setlogin + (struct thread *thr, struct sys_setlogin_args *args) + sys_setlogin + + struct thread * + thr + + + struct sys_setlogin_args * + args + + + + + + + + + _current + memcpy + sys_setlogin_args::namebuf + taskStruct::username + + + int + int sys_setpgid + (struct thread *td, struct sys_setpgid_args *args) + sys_setpgid + + struct thread * + td + + + struct sys_setpgid_args * + args + + + + + + + + + _current + taskStruct::id + sys_setpgid_args::pgid + taskStruct::pgrp + sys_setpgid_args::pid + schedFindTask + thread::td_retval + + + int + int sys_setrlimit + (struct thread *thr, struct sys_setrlimit_args *args) + sys_setrlimit + + struct thread * + thr + + + struct sys_setrlimit_args * + args + + + + + + + + + kprintf + thread::rlim + rlimit::rlim_cur + rlimit::rlim_max + sys_setrlimit_args::rlp + sys_setrlimit_args::which + + + int + int sys_sigaction + (struct thread *td, struct sys_sigaction_args *args) + sys_sigaction + + struct thread * + td + + + struct sys_sigaction_args * + args + + + + + + + + + sys_sigaction_args::act + memcpy + sys_sigaction_args::oact + sys_sigaction_args::sig + thread::sigact + thread::td_retval + + + int + int sys_sigprocmask + (struct thread *td, struct sys_sigprocmask_args *args) + sys_sigprocmask + + struct thread * + td + + + struct sys_sigprocmask_args * + args + + + + + + + + + __sigset::__bits + sys_sigprocmask_args::how + kprintf + memcpy + sys_sigprocmask_args::oset + sys_sigprocmask_args::set + SIG_BLOCK + SIG_SETMASK + SIG_UNBLOCK + thread::sigmask + thread::td_retval + + + int + int sys_sysarch + (struct thread *td, struct sys_sysarch_args *args) + sys_sysarch + + struct thread * + td + + + struct sys_sysarch_args * + args + + + + + + + + + gdtDescriptor::access + gdtDescriptor::baseHigh + gdtDescriptor::baseLow + gdtDescriptor::baseMed + dBig + dBiglim + dData + dDpl3 + dPresent + dWrite + gdtDescriptor::granularity + kprintf + gdtDescriptor::limitHigh + gdtDescriptor::limitLow + sys_sysarch_args::op + sys_sysarch_args::parms + thread::td_retval + VMM_USER_LDT + + + int + int sys_wait4 + (struct thread *td, struct sys_wait4_args *args) + sys_wait4 + + struct thread * + td + + + struct sys_wait4_args * + args + + + + + + + + + _current + taskStruct::children + ECHILD + taskStruct::id + taskStruct::last_exit + sys_wait4_args::pid + sched_setStatus + sched_yield + schedFindTask + thread::td_retval + WAIT @@ -389,161 +1053,524 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: gen__calls_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<sys/thread.h> -#include<sys/gen_calls.h> -#include<sys/kern_descrip.h> -#include<ubixos/sched.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<string.h> -#include<assert.h> - -/*returntheprocessid*/ -intgetpid(structthread*td,structgetpid_args*uap){ -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -td->td_retval[0]=_current->id; -return(0); -} - -/*returntheprocessuserid*/ -intgetuid(structthread*td,structgetuid_args*uap){ -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -td->td_retval[0]=_current->uid; -return(0); -} - -/*returntheprocessgroupid*/ -intgetgid(structthread*td,structgetgid_args*uap){ -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -td->td_retval[0]=_current->gid; -return(0); -} - -intsys_write(structthread*td,structwrite_args*uap){ -char*buffer=0x0; -char*in=0x0; - -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -kprintf("sw[%i]",uap->fd); - -if(uap->fd==2){ -kprintf("stderr:%s",uap->buf); -} - -if(uap->fd==1){ -in=(char*)uap->buf; -buffer=kmalloc(1024); -memcpy(buffer,uap->buf,uap->nbyte); -kprintf("%s",buffer); -kfree(buffer); -td->td_retval[0]=uap->nbyte; -} -else{ -kprintf("[%i]",uap->nbyte); -buffer=kmalloc(uap->nbyte); -memcpy(buffer,uap->buf,uap->nbyte); -//kprint(buffer); -kfree(buffer); -kprintf("(%i)%s",uap->fd,uap->buf); -td->td_retval[0]=uap->nbyte; -} -return(0x0); -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/gen_calls.h> +#include<sys/thread.h> +#include<sys/gdt.h> +#include<ubixos/sched.h> +#include<ubixos/endtask.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<string.h> +#include<assert.h> +#include<sys/descrip.h> +#include<sys/video.h> +#include<sys/signal.h> +#include<ubixos/errno.h> +#include<vmm/vmm.h> + +/*ExitSyscall*/ +intsys_exit(structthread*td,structsys_exit_args*args){ +//kprintf("exit(%i)",args->status); +endTask(_current->id); +return(0x0); +} + +/*returntheprocessid*/ +intgetpid(structthread*td,structgetpid_args*uap){ +#ifdefDEBUG +kprintf("[%s:%i]",__FILE__,__LINE__); +#endif +td->td_retval[0]=_current->id; +return(0); +} + +/*returntheprocessuserid*/ +intgetuid(structthread*td,structgetuid_args*uap){ +#ifdefDEBUG +kprintf("[%s:%i]",__FILE__,__LINE__); +#endif +td->td_retval[0]=_current->uid; +return(0); +} + +/*returntheprocessgroupid*/ +intgetgid(structthread*td,structgetgid_args*uap){ +#ifdefDEBUG +kprintf("[%s:%i]",__FILE__,__LINE__); +#endif +td->td_retval[0]=_current->gid; +return(0); +} + +intsys_issetugid(registerstructthread*td,structsys_issetugid_args*uap){ +td->td_retval[0]=0; +return(0); +} + +intreadlink(structthread*td,structreadlink_args*uap){ +#ifdefDEBUG +kprintf("[%s:%i]",__FILE__,__LINE__); +#endif +kprintf("readlink:[%s:%i]\n",uap->path,uap->count); +td->td_retval[0]=-1; +td->td_retval[1]=0x0; +return(0x0); +} + +intgettimeofday_new(structthread*td,structgettimeofday_args*uap){ +#ifdefDEBUG +kprintf("[%s:%i]",__FILE__,__LINE__); +#endif +return(0x0); +} -intissetugid(registerstructthread*td,structissetugid_args*uap){ -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -td->td_retval[0]=0; -return(0); -} - -intreadlink(structthread*td,structreadlink_args*uap){ -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -kprintf("readlink:[%s:%i]\n",uap->path,uap->count); -td->td_retval[0]=-1; -td->td_retval[1]=0x0; -return(0x0); -} +intread(structthread*td,structread_args*uap){ +interror=0x0; +size_tcount=0x0; +structfile*fd=0x0; + +#ifdefDEBUG +kprintf("[%s:%i]",__FILE__,__LINE__); +#endif + +error=getfd(td,&fd,uap->fd); + +if(error) +return(error); + +count=fread(uap->buf,uap->nbyte,0x1,fd->fd); +kprintf("count:%i\n",count); +td->td_retval[0]=count; -intgettimeofday_new(structthread*td,structgettimeofday_args*uap){ -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif -return(0x0); -} - -intread(structthread*td,structread_args*uap){ -interror=0x0; -size_tcount=0x0; -structfile*fd=0x0; +return(error); +} + +intsetitimer(structthread*td,structsetitimer_args*uap){ +interror=0x0; + +return(error); +} -#ifdefDEBUG -kprintf("[%s:%i]",__FILE__,__LINE__); -#endif - -error=getfd(td,&fd,uap->fd); +intaccess(structthread*td,structaccess_args*uap){ +interror=0x0; +kprintf("name:[%s]\n",uap->path); +return(error); +} -if(error) -return(error); - -count=fread(uap->buf,uap->nbyte,0x1,fd->fd); -kprintf("count:%i\n",count); -td->td_retval[0]=count; - -return(error); -} - -intsetitimer(structthread*td,structsetitimer_args*uap){ -interror=0x0; - -return(error); -} - -/*** -END -***/ +intmprotect(structthread*td,structmprotect_args*uap){ +interror=0x0; +return(error); +} + +intsys_invalid(structthread*td,void*args){ +kprintf("ISC[%i:%i]",td->frame->tf_eax,_current->id); +td->td_retval[0]=-1; +return(0); +} + +intsys_wait4(structthread*td,structsys_wait4_args*args){ +interror=0; + +if(args->pid==-1){ +if(_current->children<=0){ +td->td_retval[0]=ECHILD; +return(-1); +} + +intchildren=_current->children; + +sched_setStatus(_current->id,WAIT); +while(_current->children==children){ +sched_yield(); +} + +td->td_retval[0]=_current->last_exit; +td->td_retval[1]=0x8; +} +else{ + +kTask_t*tmpTask=schedFindTask(args->pid); + +if(tmpTask!=0x0){ +sched_setStatus(_current->id,WAIT); +while(tmpTask!=0x0){ +sched_yield(); +tmpTask=schedFindTask(args->pid); +} +td->td_retval[0]=args->pid; +} +else{ +td->td_retval[0]=-1; +error=-1; +} +} +return(error); +} + +intsys_sysarch(structthread*td,structsys_sysarch_args*args){ +void**segbase=0x0; +uint32_tbase_addr=0x0; +if(args->op==10){ +//kprintf("SETGSBASE:0x%X:0x%X",args->parms,args->parms[0]); +segbase=args->parms; +//kprintf("SGS:[0x%X:0x%X]",segbase[0],segbase[1]); +base_addr=(uint32_t)segbase[0]; +structgdtDescriptor*tmpDesc=0x0; + +tmpDesc=VMM_USER_LDT+sizeof(structgdtDescriptor);//taskLDT[1]; + +tmpDesc->limitLow=(0xFFFFF&0xFFFF); +tmpDesc->baseLow=(base_addr&0xFFFF); +tmpDesc->baseMed=((base_addr>>16)&0xFF); +tmpDesc->access=((dData+dWrite+dBig+dBiglim+dDpl3)+dPresent)>>8; +tmpDesc->limitHigh=(0xFFFFF>>16); +tmpDesc->granularity=((dData+dWrite+dBig+dBiglim+dDpl3)&0xFF)>>4; +tmpDesc->baseHigh=base_addr>>24; + +asm( +"push%eax\n" +"mov$0x18,%ax\n" +"lldt%ax\n"/*"lgdtl(loadGDT)\n"*/ +"mov$0xF,%eax\n" +"mov%eax,%gs\n" +"pop%eax\n" +); + +td->td_retval[0]=0; +} +else{ +kprintf("sysarch(%i,NULL)",args->op); +td->td_retval[0]=-1; +} +return(0); +} + +intsys_getpid(structthread*td,structsys_getpid_args*args){ +td->td_retval[0]=_current->id; +return(0); +} +intsys_geteuid(structthread*td,structsys_geteuid_args*args){ +td->td_retval[0]=_current->uid; +return(0); +} + +intsys_getegid(structthread*td,structsys_getegid_args*args){ +td->td_retval[0]=_current->gid; +return(0); +} + +intsys_getppid(structthread*td,structsys_getppid_args*args){ +td->td_retval[0]=_current->ppid; +return(0); +} + +intsys_sigprocmask(structthread*td,structsys_sigprocmask_args*args){ +td->td_retval[0]=-1; + +if(args->oset!=0x0){ +memcpy(args->oset,&td->sigmask,sizeof(sigset_t)); +td->td_retval[0]=0x0; +} + +if(args->set!=0x0){ +if(args->how==SIG_SETMASK){ +if(args->set!=0x0){ +memcpy(&td->sigmask,args->set,sizeof(sigset_t)); +td->td_retval[0]=0; +} +else{ +td->td_retval[0]=-1; +} +} +elseif(args->how==SIG_BLOCK){ +if(args->set!=0x0){ +td->sigmask.__bits[0]&=args->set->__bits[0]; +td->sigmask.__bits[1]&=args->set->__bits[1]; +td->sigmask.__bits[2]&=args->set->__bits[2]; +td->sigmask.__bits[3]&=args->set->__bits[3]; +td->td_retval[0]=0; +} +else{ +td->td_retval[0]=-1; +} +} +elseif(args->how==SIG_UNBLOCK){ +if(args->set!=0x0){ +td->sigmask.__bits[0]|=args->set->__bits[0]; +td->sigmask.__bits[1]|=args->set->__bits[1]; +td->sigmask.__bits[2]|=args->set->__bits[2]; +td->sigmask.__bits[3]|=args->set->__bits[3]; +td->td_retval[0]=0; +} +else{ +td->td_retval[0]=-1; +} +} +else{ +kprintf("SPM:0x%X",args->how); +td->td_retval[0]=-1; +} +} + +return(0); +} + +intsys_sigaction(structthread*td,structsys_sigaction_args*args){ +td->td_retval[0]=-1; + +if(args->oact!=0x0){ +memcpy(args->oact,&td->sigact[args->sig],sizeof(structsigaction)); +td->td_retval[0]=0; +} + +if(args->act!=0x0){ +//kprintf("SA:%i",args->sig); +memcpy(&td->sigact[args->sig],args->act,sizeof(structsigaction)); +td->td_retval[0]=0; +} +return(0); +} + +intsys_getpgrp(structthread*td,structsys_getpgrp_args*args){ +td->td_retval[0]=_current->pgrp; +return(0); +} + +intsys_setpgid(structthread*td,structsys_setpgid_args*args){ +pidTypepid=0x0; +pidTypepgrp=0x0; + +if(args->pid==0x0||args->pid==_current->id){ +if(args->pgid==0x0||args->pgid==_current->id){ +td->td_retval[0]=0x0; +_current->pgrp=_current->id; +} +else{ +td->td_retval[0]=-1; +} +} +else{ +kTask_t*tmpTask=schedFindTask(pid); + +if(tmpTask==0x0){ +td->td_retval[0]=-1; +} +else{ + +/*GetThePRGPWeWantToSet*/ +pgrp=(args->pgid==0)?tmpTask->pgrp:args->pgid; + +if(pgrp!=_current->pgrp||pgrp!=tmpTask->id){ +td->td_retval[0]=-1; +} +else{ +td->td_retval[0]=0x0; +tmpTask->pgrp=pgrp; +} + +} + +} + +return(0); +} + +intsys_gettimeofday(structthread*td,structsys_gettimeofday_args*args){ +gettimeofday(args->tp,args->tzp); +td->td_retval[0]=0; +return(0); +} + +intsys_getlogin(structthread*thr,structsys_getlogin_args*args){ +interror=0; + +memcpy(args->namebuf,_current->username,args->namelen); + +return(error); +} + +intsys_setlogin(structthread*thr,structsys_setlogin_args*args){ +interror=0; + +memcpy(_current->username,args->namebuf,256); + +return(error); +} + +intsys_getrlimit(structthread*thr,structsys_getrlimit_args*args){ +interror=0; + +structrlimit*rlim=0x0; + +switch(args->which){ +case0: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case1: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case2: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case3: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case4: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case5: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case6: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case7: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case8: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case9: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case10: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case11: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case12: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case13: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +case14: +args->rlp->rlim_cur=thr->rlim[args->which].rlim_cur; +args->rlp->rlim_max=thr->rlim[args->which].rlim_max; +break; +default: +error=-1; +kprintf("[getrlimit:%i]",args->which); +} + +return(error); +} + +intsys_setrlimit(structthread*thr,structsys_setrlimit_args*args){ +interror=0; + +switch(args->which){ +case0: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case1: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case2: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case3: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case4: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case5: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case6: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case7: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case8: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case9: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case10: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case11: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case12: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case13: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +case14: +thr->rlim[args->which].rlim_cur=args->rlp->rlim_cur; +thr->rlim[args->which].rlim_max=args->rlp->rlim_max; +break; +default: +error=-1; +kprintf("[setrlimit:%i]",args->which); +} + +return(error); +} - + diff --git a/doc/xml/gen__calls_8h.xml b/doc/xml/gen__calls_8h.xml index f01e7cd..cf23757 100644 --- a/doc/xml/gen__calls_8h.xml +++ b/doc/xml/gen__calls_8h.xml @@ -1,64 +1,196 @@ - - - + + + gen_calls.h sys/thread.h - sys/sysproto.h - src/sys/kernel/gen_calls.c + sys/sysproto_posix.h + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - + + + + - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - + + - + int int getgid (struct thread *, struct getgid_args *) @@ -75,9 +207,13 @@ - + + _current + taskStruct::gid + kprintf + thread::td_retval - + int int getpid (struct thread *, struct getpid_args *) @@ -94,9 +230,13 @@ - + + _current + taskStruct::id + kprintf + thread::td_retval - + int int gettimeofday_new (struct thread *, struct gettimeofday_args *) @@ -113,9 +253,10 @@ - + + kprintf - + int int getuid (struct thread *, struct getuid_args *) @@ -132,9 +273,13 @@ - + + _current + kprintf + thread::td_retval + taskStruct::uid - + int int issetugid (register struct thread *, struct issetugid_args *) @@ -143,7 +288,7 @@ register struct thread * - struct issetugid_args * + struct issetugid_args * @@ -151,9 +296,9 @@ - + - + int int read (struct thread *td, struct read_args *uap) @@ -172,9 +317,19 @@ - + + read_args::buf + file::fd + read_args::fd + fread + getfd + kprintf + read_args::nbyte + thread::td_retval + dmaXfer + fdcRw - + int int readlink (struct thread *, struct readlink_args *) @@ -191,7 +346,11 @@ - + + readlink_args::count + kprintf + readlink_args::path + thread::td_retval @@ -199,57 +358,51 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: gen__calls_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_GEN_CALLS_H -#define_GEN_CALLS_H - -#include<sys/thread.h> -#include<sys/sysproto.h> - -intread(structthread*td,structread_args*uap); - -intgetpid(structthread*,structgetpid_args*); -intissetugid(registerstructthread*,structissetugid_args*); -intreadlink(structthread*,structreadlink_args*); -intgetuid(structthread*,structgetuid_args*); -intgetgid(structthread*,structgetgid_args*); -intgettimeofday_new(structthread*,structgettimeofday_args*); - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_GEN_CALLS_H +#define_GEN_CALLS_H + +#include<sys/thread.h> +#include<sys/sysproto_posix.h> + +intread(structthread*td,structread_args*uap); + +intgetpid(structthread*,structgetpid_args*); +intissetugid(registerstructthread*,structissetugid_args*); +intreadlink(structthread*,structreadlink_args*); +intgetuid(structthread*,structgetuid_args*); +intgetgid(structthread*,structgetgid_args*); +intgettimeofday_new(structthread*,structgettimeofday_args*); + +#endif - + diff --git a/doc/xml/getfreepage_8c.xml b/doc/xml/getfreepage_8c.xml index cc77f51..e11fecd 100644 --- a/doc/xml/getfreepage_8c.xml +++ b/doc/xml/getfreepage_8c.xml @@ -1,88 +1,236 @@ - - - + + + getfreepage.c vmm/vmm.h ubixos/kpanic.h ubixos/spinlock.h - - - - + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + - + + + - - - - + + + + - - - - - - - - + + + + + + + struct spinLock + struct spinLock vmmGFPlock + + vmmGFPlock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + void * - void* vmmGetFreePage + void* vmm_getFreePage (pidType pid) - vmmGetFreePage + vmm_getFreePage - pidType + pidType pid @@ -91,35 +239,9 @@ - - KERNEL_PAGE_DEFAULT - kpanic - spinLock - spinUnlock - tablesBaseAddress - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - vmmGFPlock - x1000 - vmmCreateVirtualSpace - - - - - spinLock_t - spinLock_t vmmGFPlock - - vmmGFPlock - SPIN_LOCK_INITIALIZER - - - - - - - - vmmGetFreePage + + spinLock + vmm_createVirtualSpace @@ -127,89 +249,88 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: getfreepage_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> -#include<ubixos/kpanic.h> -#include<ubixos/spinlock.h> - -staticspinLock_tvmmGFPlock=SPIN_LOCK_INITIALIZER; - -/************************************************************************ - -Function:void*vmmGetFreePage(pidTypepid); - -Description:ReturnsAFreePageMappedToTheVMSpace - -Notes: - -07/30/02-ThisReturnsAFreePageInTheTop1GBForTheKernel - -************************************************************************/ -void* -vmmGetFreePage(pidTypepid) -{ -uInt16x=0x0,y=0x0; -uInt32*pageTableSrc=0x0; - -spinLock(&vmmGFPlock); - -/*LetsSearchForAFreePage*/ -for(x=768;x<1024;x++){ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<ubixos/kpanic.h> +#include<ubixos/spinlock.h> + +staticstructspinLockvmmGFPlock=SPIN_LOCK_INITIALIZER; + +/************************************************************************ + +Function:void*vmm_getFreePage(pidTypepid); + +Description:ReturnsAFreePageMappedToTheVMSpace + +Notes: + +07/30/02-ThisReturnsAFreePageInTheTop1GBForTheKernel + +************************************************************************/ +void*vmm_getFreePage(pidTypepid){ +uInt16x=0x0,y=0x0; +uInt32*pageTableSrc=0x0; + +spinLock(&vmmGFPlock); + +/*LetsSearchForAFreePage*/ +for(x=PD_INDEX(VMM_KERN_START);x<=PD_INDEX(VMM_KERN_END);x++){ + +/*SetPageTableAddress*/ +pageTableSrc=(uInt32*)(PT_BASE_ADDR+(0x1000*x)); -/*SetPageTableAddress*/ -pageTableSrc=(uInt32*)(tablesBaseAddress+(0x1000*x)); -for(y=0x0;y<1024;y++){ -/*LoopThroughThePageTableFindAnUnAllocatedPage*/ -if((uInt32)pageTableSrc[y]==(uInt32)0x0){ +for(y=0x0;y<1024;y++){ + +/*LoopThroughThePageTableFindAnUnAllocatedPage*/ +if((uInt32)pageTableSrc[y]==(uInt32)0x0){ + /*MapAPhysicalPageToTheVirtualPage*/ -if((vmm_remapPage(vmmFindFreePage(pid),((x*0x400000)+(y*0x1000)),KERNEL_PAGE_DEFAULT))==0x0) -kpanic("vmmRemapPage:vmmGetFreePage\n"); -/*ClearThisPageSoNoGarbageIsThere*/ -vmmClearVirtualPage((uInt32)((x*0x400000)+(y*0x1000))); -/*ReturnTheAddressOfTheNewlyAllocatePage*/ -spinUnlock(&vmmGFPlock); -return((void*)((x*0x400000)+(y*0x1000))); -} -} -} -/*IfNoFreePageWasFoundReturnNULL*/ -spinUnlock(&vmmGFPlock); -return(0x0); -} - -/*** -END -***/ - +if((vmm_remapPage(vmm_findFreePage(pid),((x*0x400000)+(y*0x1000)),KERNEL_PAGE_DEFAULT,pid,0))==0x0) +kpanic("vmmRemapPage:vmm_getFreePage\n"); + +/*ClearThisPageSoNoGarbageIsThere*/ +vmm_clearVirtualPage((uInt32)((x*0x400000)+(y*0x1000))); + +/*ReturnTheAddressOfTheNewlyAllocatePage*/ +spinUnlock(&vmmGFPlock); +return((void*)((x*0x400000)+(y*0x1000))); +} +} +} + +/*IfNoFreePageWasFoundReturnNULL*/ +spinUnlock(&vmmGFPlock); + +return(0x0); +} - + diff --git a/doc/xml/getfreevirtualpage_8c.xml b/doc/xml/getfreevirtualpage_8c.xml index cdac015..15bf2f0 100644 --- a/doc/xml/getfreevirtualpage_8c.xml +++ b/doc/xml/getfreevirtualpage_8c.xml @@ -1,148 +1,280 @@ - - - + + + getfreevirtualpage.c vmm/vmm.h ubixos/sched.h ubixos/kpanic.h ubixos/spinlock.h - lib/kprint.h + lib/kprintf.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - - - - - + + + + - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + struct spinLock + struct spinLock fvpSpinLock + + fvpSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + void * - void* vmmGetFreeVirtualPage + void* vmm_getFreeVirtualPage (pidType pid, int count, int type) - vmmGetFreeVirtualPage + vmm_getFreeVirtualPage - pidType + pidType pid @@ -159,56 +291,10 @@ - - _current - btoc - ctob - fvpSpinLock - taskStruct::id - K_PANIC - kpanic - kprintf - taskStruct::oInfo - PAGE_COW - PAGE_DEFAULT - PAGE_PRESENT - pageEntries - parentPageDirAddr - spinLock - spinUnlock - tablesBaseAddress - taskStruct::td - thread::vm_daddr - thread::vm_dsize - VM_TASK - VM_THRD - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - osInfo::vmStart - x1 - x1000 - mmap - sysExec - sysGetFreePage - vmm_pageFault - - - - - spinLock_t - spinLock_t fvpSpinLock - - fvpSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - vmmGetFreeVirtualPage + + spinLock + sys_mmap + sysGetFreePage @@ -216,171 +302,141 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: getfreevirtualpage_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> -#include<ubixos/sched.h> -#include<ubixos/kpanic.h> -#include<ubixos/spinlock.h> -#include<lib/kprint.h> - -staticspinLock_tfvpSpinLock=SPIN_LOCK_INITIALIZER; - -/************************************************************************ - -Function:void*vmmGetFreeVirtualPage(pidTypepid,intcount); -Description:ReturnsAFreePageMappedToTheVMSpace -Notes: - -08/11/02-ThisWillReturnNextAvilableFreePageOfTasksVMSpace - -************************************************************************/ -void*vmmGetFreeVirtualPage(pidTypepid,intcount,inttype){ -intx=0,y=0,c=0; -uInt32*pageTableSrc=0x0; -uInt32*pageDir=0x0; -uInt32start_page=0x0; - - -spinLock(&fvpSpinLock); - -pageDir=(uInt32*)parentPageDirAddr; - -/*LetsSearchForAFreePage*/ -if(_current->oInfo.vmStart<=0x100000) -kpanic("InvalidvmStart\n"); - -if(type==VM_THRD){ -start_page=(uint32_t)(_current->td.vm_daddr+ctob(_current->td.vm_dsize)); -} -elseif(type==VM_TASK){ -//kprintf("vmStart"); -start_page=_current->oInfo.vmStart; -} -else -K_PANIC("InvalidType"); - -//for(x=((_current->td.vm_daddr+_current->td.vm_dsize)/(1024*4096));x<1024;x++){ -for(x=(start_page/(1024*4096));x<1024;x++){ -/*SetPageTableAddress*/ -if((pageDir[x]&PAGE_PRESENT)!=PAGE_PRESENT){ -/*IfPageTableIsNonExistantThenSetItUp*/ -pageDir[x]=(uInt32)vmmFindFreePage(_current->id)|PAGE_DEFAULT; -/*AlsoAddItToVirtualSpaceSoWeCanMakeChangesLater*/ -pageTableSrc=(uInt32*)(tablesBaseAddress+(4096*767)); -pageTableSrc[x]=pageDir[x]; -y=1; -/*ReloadPageDirectory*/ -asm( -"movl%cr3,%eax\n" -"movl%eax,%cr3\n" -); -} -pageTableSrc=(uInt32*)(tablesBaseAddress+(0x1000*x)); -if(y!=0x0){ -for(y=0x0;y<pageEntries;y++){ -pageTableSrc[y]=(uInt32)0x0; -} -} -for(y=0;y<1024;y++){ -/*LoopThroughThePageTableFindAnUnAllocatedPage*/ -if((pageTableSrc[y]&PAGE_COW)==PAGE_COW){ -kprintf("PAGE_COW"); -//_current->td.vm_dsize+=btoc(0x1000); -/*HACKMEMORYLEAK*/ -//pageTableSrc[y]=0x0; -} -if((uInt32)pageTableSrc[y]==(uInt32)0x0){ -if(count>0x1){ -for(c=0;c<count;c++){ -if(y+c<1024){ -if((pageTableSrc[y+c]&PAGE_COW)==PAGE_COW){ -kprintf("PAGE-COW"); -//_current->td.vm_dsize+=btoc(0x1000); -/*HACKMEMORYLEAK*/ -//pageTableSrc[y+c]=0x0; -} - -if((uInt32)pageTableSrc[y+c]!=(uInt32)0x0){ -c=-1; -break; -} -} -} -if(c!=-1){ -for(c=0;c<count;c++){ -if((vmm_remapPage((uInt32)vmmFindFreePage(pid),((x*(1024*4096))+((y+c)*4096)),PAGE_DEFAULT))==0x0) -kpanic("vmmRemapPage:getFreeVirtualPage-1:[0x%X]\n",((x*(1024*4096))+((y+c)*4096))); -vmmClearVirtualPage((uInt32)((x*(1024*4096))+((y+c)*4096))); -} -if(type==VM_THRD) -_current->td.vm_dsize+=btoc(count*0x1000); -spinUnlock(&fvpSpinLock); -return((void*)((x*(1024*4096))+(y*4096))); -} -}else{ -/*MapAPhysicalPageToTheVirtualPage*/ - -/* -*remapPage((uInt32)vmmFindFreePage(pid),((x*(1024*4096))+(y*4096)) -*,pid); -*/ -if((vmm_remapPage((uInt32)vmmFindFreePage(pid),((x*(1024*4096))+(y*4096)),PAGE_DEFAULT))==0x0) -kpanic("vmmRemapPage:getFreeVirtualPage-2\n"); - -/*ClearThisPageSoNoGarbageIsThere*/ -vmmClearVirtualPage((uInt32)((x*(1024*4096))+(y*4096))); - -/*ReturnTheAddressOfTheNewlyAllocatePage*/ -if(type==VM_THRD){ -_current->td.vm_dsize+=btoc(count*0x1000); -kprintf("vm_dsize:[0x%X]][0x%X]\n",ctob(_current->td.vm_dsize),_current->td.vm_dsize); -} -//kprintf("(0x%X:0x%X)",_current->td.vm_dsize,vmm_getPhysicalAddr(((x*(1024*4096))+(y*4096)))); -//kprintf("(0x%X:0x%X)",_current->td.vm_dsize+_current->td.vm_daddr,((x*(1024*4096))+(y*4096))); -spinUnlock(&fvpSpinLock); -return((void*)((x*(1024*4096))+(y*4096))); -} -} -} -} -/*IfNoFreePageWasFoundReturnNULL*/ -spinUnlock(&fvpSpinLock); -return(0x0); -} - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<ubixos/sched.h> +#include<ubixos/kpanic.h> +#include<ubixos/spinlock.h> +#include<lib/kprintf.h> + +staticstructspinLockfvpSpinLock=SPIN_LOCK_INITIALIZER; + +/************************************************************************ + +Function:void*vmm_getFreeVirtualPage(pidTypepid,intcount); +Description:ReturnsAFreePageMappedToTheVMSpace +Notes: + +2016-01-21MrOlsen-I'mnot100%happywiththis,iknowIcanmakethecalculationsmuchfaster + +08/11/02-ThisWillReturnNextAvilableFreePageOfTasksVMSpace + +************************************************************************/ +void*vmm_getFreeVirtualPage(pidTypepid,intcount,inttype){ +inty=0,counter=0,pdI=0x0,ptI=0x0; + +uint32_t*pageDirectory=0x0; +uint32_t*pageTable=0x0; + +uint32_tstart_page=0x0; +uint32_tmap_from=0x0; + +spinLock(&fvpSpinLock); + +pageDirectory=(uint32_t*)PD_BASE_ADDR; + +/*LetsSearchForAFreePage*/ +if(_current->oInfo.vmStart<=0x100000) +kpanic("InvalidvmStart\n"); + +/*GetOurStartingAddress*/ +if(type==VM_THRD){ +start_page=(uint32_t)(_current->td.vm_daddr+ctob(_current->td.vm_dsize)); +} +elseif(type==VM_TASK){ +start_page=_current->oInfo.vmStart; +} +else +K_PANIC("InvalidType"); + + +/*LocateInitialPageTable*/ +keepMapping: +pdI=PD_INDEX(start_page); + +if(pdI>PD_INDEX(VMM_USER_END)){ +map_from=0x0; +gotodoneMapping; +} + +/*IfPageDirectoryIsNotYetAllocatedAllocateIt*/ +if((pageDirectory[pdI]&PAGE_PRESENT)!=PAGE_PRESENT){ +vmm_allocPageTable(pdI,pid); +} + +pageTable=(uint32_t*)(PT_BASE_ADDR+(pdI*PAGE_SIZE)); + +ptI=PT_INDEX(start_page); + +for(y=ptI;y<PT_ENTRIES&&counter<count;y++,counter++){ + +/*LoopThroughThePageTableFindAnUnAllocatedPage*/ +if((pageTable[y]&PAGE_PRESENT)==PAGE_PRESENT){ +if((pageTable[y]&PAGE_COW)==PAGE_COW) +kprintf("COWPAGENOTCLEANED!"); + +start_page+=(PAGE_SIZE*counter); +map_from=0x0; +counter=0; +gotokeepMapping; +} + +if(map_from==0x0) +map_from=start_page; +} + +if(counter<count){ +start_page+=(PAGE_SIZE*counter); +gotokeepMapping; +} + +gotPages: +if(type==VM_THRD) +_current->td.vm_dsize+=btoc(count*PAGE_SIZE); +elseif(type==VM_TASK) +_current->oInfo.vmStart=map_from+(count*PAGE_SIZE); + +//_current->oInfo.vmStart+=(count*PAGE_SIZE); + +for(counter=0;counter<count;counter++){ +if((vmm_remapPage((uint32_t)vmm_findFreePage(pid),(map_from+(counter*PAGE_SIZE)),PAGE_DEFAULT,pid,0))==0x0) +kpanic("vmmRemapPage:getFreeVirtualPage-1:(%i)[0x%X]\n",type,map_from+(counter*PAGE_SIZE)); + +bzero((map_from+(counter*PAGE_SIZE)),PAGE_SIZE); +} + +doneMapping: +spinUnlock(&fvpSpinLock); +return(map_from); +} - + diff --git a/doc/xml/getphysicaladdr_8c.xml b/doc/xml/getphysicaladdr_8c.xml index 84c9843..b837486 100644 --- a/doc/xml/getphysicaladdr_8c.xml +++ b/doc/xml/getphysicaladdr_8c.xml @@ -1,86 +1,236 @@ - - - + + + getphysicaladdr.c vmm/vmm.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + + + + + - - - - - - + + + + - - - - + + + + - - uint32_t + + uint32_t uint32_t vmm_getPhysicalAddr - (uInt32 pageAddr) + (uint32_t pageAddr) vmm_getPhysicalAddr - uInt32 + uint32_t pageAddr -Function: void *vmmGetPhysicalAddr(); Description: Returns The Physical Address Of The Virtual Page Notes: +Function: void *vmm_getPhysicalAddr(); Description: Returns The Physical Address Of The Virtual Page Notes: + - - tablesBaseAddress - x1000 - vmm_pageFault - vmmCopyVirtualSpace - vmmCreateVirtualSpace + + PT_BASE_ADDR + vmm_createVirtualSpace + + + uint32_t + uint32_t vmm_getRealAddr + (uint32_t addr) + vmm_getRealAddr + + uint32_t + addr + + + + + + + + + PT_BASE_ADDR + initLNC + lncAttach @@ -88,57 +238,71 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: getphysicaladdr_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> - -uint32_tvmm_getPhysicalAddr(uInt32pageAddr){ -intpageDirectoryIndex=0x0,pageTableIndex=0x0; -uInt32*pageTable=0x0; - -//CalculateThePageDirectoryIndex -pageDirectoryIndex=(pageAddr>>22); - -//CalculateThePageTableIndex -pageTableIndex=((pageAddr>>12)&0x3FF); - -/*SetpageTableToTheVirtualAddressOfTable*/ -pageTable=(uInt32*)(tablesBaseAddress+(0x1000*pageDirectoryIndex)); -/*ReturnThePhysicalAddressOfThePage*/ -return((uInt32)(pageTable[pageTableIndex]&0xFFFFF000)); -} - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> + +/*returnstherealaddressofpageispagealigned*/ +uint32_tvmm_getPhysicalAddr(uint32_tpageAddr){ +intpageDirectoryIndex=0x0,pageTableIndex=0x0; +uint32_t*pageTable=0x0; + +//CalculateThePageDirectoryIndex +pageDirectoryIndex=(pageAddr>>22); + +//CalculateThePageTableIndex +pageTableIndex=((pageAddr>>12)&0x3FF); + +/*SetpageTableToTheVirtualAddressOfTable*/ +pageTable=(uint32_t*)(PT_BASE_ADDR+(0x1000*pageDirectoryIndex)); + +/*ReturnThePhysicalAddressOfThePage*/ +return((uint32_t)(pageTable[pageTableIndex]&0xFFFFF000)); +} + +/*Returnstherealaddressnotpagealigned*/ +uint32_tvmm_getRealAddr(uint32_taddr){ +intpageDirectoryIndex=0x0,pageTableIndex=0x0; +uint32_t*pageTable=0x0; + +//CalculateThePageDirectoryIndex +pageDirectoryIndex=(addr>>22); + +//CalculateThePageTableIndex +pageTableIndex=((addr>>12)&0x3FF); + +/*SetpageTableToTheVirtualAddressOfTable*/ +pageTable=(uint32_t*)(PT_BASE_ADDR+(0x1000*pageDirectoryIndex)); +/*ReturnThePhysicalAddressOfThePage*/ +return((uint32_t)(pageTable[pageTableIndex]&0xFFFFF000)+(addr&0xFFF)); +} - + diff --git a/doc/xml/hd_8c.xml b/doc/xml/hd_8c.xml index 1024bb4..d485be1 100644 --- a/doc/xml/hd_8c.xml +++ b/doc/xml/hd_8c.xml @@ -1,201 +1,554 @@ - - - + + + hd.c pci/hd.h - sys/video.h - sys/device.h sys/io.h + sys/device.h lib/kmalloc.h lib/kprintf.h devfs/devfs.h string.h + fs/common/gpt.h - - - - + + + + + + - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const uuid_t + const uuid_t freebsd_ufs_uuid + + freebsd_ufs_uuid + = GPT_ENT_TYPE_FREEBSD_UFS + + + + + + + + + + static + hdC + + hdC + = 0 + + + + + + + + + - + + int + int _initHardDisk + (int hdD) + _initHardDisk + + int + hdD + + + + + + + + + name + initHardDisk + + int int hdInit (struct device_node *dev) @@ -210,31 +563,43 @@ - - device_node::devInfo - hdCmd - hdData - driveInfo::hdDev - driveInfo::hdEnable - hdHead - driveInfo::hdMask - driveInfo::hdMulti - driveInfo::hdPort - hdSecCount - driveInfo::hdSector - driveInfo::hdShift - driveInfo::hdSize - hdStat - device_interface::info - device_interface::initialized - inportByte - inportWord - kprintf - outportByte - device_interface::size - initHardDisk + + ATA_COMMAND + ATA_DATA + ATA_DRIVE + ATA_IDENTIFY + driveInfo::ata_identify + ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE + ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE + ATA_S_BUSY + ata_identify_data::command_set_enabled1 + device_node::devInfo + hdCmd + driveInfo::hdDev + driveInfo::hdEnable + hdHead + driveInfo::hdMask + driveInfo::hdMulti + driveInfo::hdPort + hdSecCount + driveInfo::hdShift + driveInfo::hdSize + device_interface::info + device_interface::initialized + inportByte + inportWord + kprintf + driveInfo::lba_high + driveInfo::lba_low + ata_identify_data::max_48bit_lba + outportByte + ata_identify_data::physical_logical_sector_info + driveInfo::sector_size + device_interface::size + ata_identify_data::total_num_sectors + ata_identify_data::words_per_logical_sector - + int int hdIoctl () @@ -245,12 +610,11 @@ - - initHardDisk + - - void - void hdRead + + int + int hdRead (struct driveInfo *hdd, void *baseAddr, uInt32 startSector, uInt32 sectorCount) hdRead @@ -262,11 +626,11 @@ baseAddr - uInt32 + uInt32 startSector - uInt32 + uInt32 sectorCount @@ -275,30 +639,29 @@ - - driveInfo::hdCalc - hdCmd - hdCylHi - hdCylLow - hdData - driveInfo::hdDev - driveInfo::hdEnable - hdHead - driveInfo::hdMulti - driveInfo::hdPort - hdSecCount - hdSecNum - driveInfo::hdShift - hdStat - inportByte - inportWord - kprintf - outportByte - driveInfo::parOffset - x20 - initHardDisk + + driveInfo::hdCalc + hdCmd + hdCylHi + hdCylLow + hdData + driveInfo::hdDev + driveInfo::hdEnable + hdHead + driveInfo::hdMulti + driveInfo::hdPort + hdSecCount + hdSecNum + driveInfo::hdShift + hdStat + inportByte + inportWord + kprintf + driveInfo::lba_start + outportByte + driveInfo::parOffset - + int int hdReset () @@ -309,10 +672,9 @@ - - initHardDisk + - + int int hdStandby () @@ -323,10 +685,9 @@ - - initHardDisk + - + int int hdStart () @@ -337,10 +698,9 @@ - - initHardDisk + - + int int hdStop () @@ -351,12 +711,11 @@ - - initHardDisk + - - void - void hdWrite + + int + int hdWrite (struct driveInfo *hdd, void *baseAddr, uInt32 startSector, uInt32 sectorCount) hdWrite @@ -368,11 +727,11 @@ baseAddr - uInt32 + uInt32 startSector - uInt32 + uInt32 sectorCount @@ -381,30 +740,29 @@ - - driveInfo::hdCalc - hdCmd - hdCylHi - hdCylLow - hdData - driveInfo::hdDev - driveInfo::hdEnable - hdHead - driveInfo::hdMulti - driveInfo::hdPort - hdSecCount - hdSecNum - driveInfo::hdShift - hdStat - inportByte - kprintf - outportByte - outportWord - driveInfo::parOffset - x30 - initHardDisk + + driveInfo::hdCalc + hdCmd + hdCylHi + hdCylLow + hdData + driveInfo::hdDev + driveInfo::hdEnable + hdHead + driveInfo::hdMulti + driveInfo::hdPort + hdSecCount + hdSecNum + driveInfo::hdShift + hdStat + inportByte + kprintf + driveInfo::lba_start + outportByte + outportWord + driveInfo::parOffset - + int int initHardDisk () @@ -415,44 +773,8 @@ - - bsd_disklabel::d_npartitions - bsd_disklabel::d_partitions - devfs_makeNode - device_add - dos_partition::dp_start - fstypenames - driveInfo::hdDev - hdInit - hdIoctl - driveInfo::hdPort - hdRead - hdReset - driveInfo::hdSize - hdStandby - hdStart - hdStop - hdWrite - device_interface::info - device_interface::init - device_interface::ioctl - kmalloc - kprintf - device_interface::major - memcpy - name - bsd_disklabel::partition::p_fstype - bsd_disklabel::partition::p_offset - bsd_disklabel::partition::p_size - driveInfo::parOffset - device_interface::read - device_interface::reset - sprintf - device_interface::standby - device_interface::start - device_interface::stop - device_interface::write - x1 + + _initHardDisk @@ -460,455 +782,594 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: hd_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<pci/hd.h> -#include<sys/video.h> -#include<sys/device.h> -#include<sys/io.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<devfs/devfs.h> -#include<string.h> - -intinitHardDisk(){ -inti=0x0; -intx=0x0; -intminor=0x0; -structdevice_interface*devInfo=0x0; -structdevice_interface*devInfo2=0x0; -structdos_partition*d=0x0; -structdriveInfo*hdd=0x0; -structdriveInfo*hdd2=0x0; -char*data=0x0; -char*data2=0x0; -charname[16]; -structbsd_disklabel*bsdd=0x0; - -hdd=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); -hdd->hdPort=0x1F0; -hdd->hdDev=0x40; -hdd->parOffset=0x0; - - -/*Allocmemoryfordevicestructureandsetitupcorrectly*/ -devInfo=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); -devInfo->read=(void*)&hdRead; -devInfo->write=(void*)&hdWrite; -devInfo->reset=(void*)&hdReset; -devInfo->init=(void*)&hdInit; -devInfo->ioctl=(void*)&hdIoctl; -devInfo->stop=(void*)&hdStop; -devInfo->start=(void*)&hdStart; -devInfo->standby=(void*)&hdStandby; -devInfo->info=hdd; - -devInfo->major=0x1; - -data=(char*)kmalloc(512); -d=(structdos_partition*)(data+0x1BE); - -data2=(char*)kmalloc(512); -bsdd=(structbsd_disklabel*)data2; - -if(device_add(0,'c',devInfo)==0x0){ -kprintf("ad0-Start:[0x0],Size:[0x%x/0x%X]\n",hdd->hdSize,hdd->hdSize*512); -devfs_makeNode("ad0",'b',0x1,0x0); -hdRead(devInfo->info,data,0x0,0x1); -for(i=0x0;i<0x4;i++){ -if(d[i].dp_type!=0x0){ -devInfo2=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); -hdd2=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); -memcpy(devInfo2,devInfo,sizeof(structdevice_interface)); -memcpy(hdd2,hdd,sizeof(structdriveInfo)); -hdd2->parOffset=d[i].dp_start; -devInfo2->info=hdd2; -minor++; -if(device_add(minor,'c',devInfo2)==0x0){ -sprintf(name,"ad0s%i",i+1); -kprintf("%s-Type:[0x%X],Start:[0x%X],Size:[0x%X]\n",name,d[i].dp_type,d[i].dp_start,d[i].dp_size); -devfs_makeNode(name,'c',0x1,minor); -if(d[i].dp_type==0xA5){ -//Whydoineedtoadd1? -hdRead(devInfo->info,data2,d[i].dp_start+1,0x1); -for(x=0;x<bsdd->d_npartitions;x++){ -if(bsdd->d_partitions[x].p_size>0){ -sprintf(name,"ad0s%i%c",i+1,'a'+x); -//NewNodes -devInfo2=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); -hdd2=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); -memcpy(devInfo2,devInfo,sizeof(structdevice_interface)); -memcpy(hdd2,hdd,sizeof(structdriveInfo)); -//hdd2->parOffset=d[i].dp_start+bsdd->d_partitions[x].p_offset; -hdd2->parOffset=bsdd->d_partitions[x].p_offset; -devInfo2->info=hdd2; -minor++; -device_add(minor,'c',devInfo2); -devfs_makeNode(name,'c',0x1,minor); -kprintf("%s-Type:[%s],Start:[0x%X],Size:[0x%X],MM:[%i:%i]\n",name,fstypenames[bsdd->d_partitions[x].p_fstype],bsdd->d_partitions[x].p_offset,bsdd->d_partitions[x].p_size,devInfo->major,minor); -} -} -} -} -} -} -} -kfree(data); -return(0x0); -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<pci/hd.h> +#include<sys/io.h> +#include<sys/device.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<devfs/devfs.h> +#include<string.h> +#include<fs/common/gpt.h> + +staticconstuuid_tfreebsd_ufs_uuid=GPT_ENT_TYPE_FREEBSD_UFS; + +statichdC=0; + +intinitHardDisk(){ +_initHardDisk(0xE0); +_initHardDisk(0xF0); +} + +int_initHardDisk(inthdD){ +inti=0x0; +intx=0x0; +intminor=0x0; +structdevice_interface*devInfo=0x0; +structdevice_interface*devInfo2=0x0; +structdos_partition*d=0x0; +structdriveInfo*hdd=0x0; +structdriveInfo*hdd2=0x0; +char*data=0x0; +char*data2=0x0; +charname[16]; +structbsd_disklabel*bsdd=0x0; + +//GPT +char*secbuf=0x0; + +hdd=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); +hdd->ata_identify=(structata_identify_data*)kmalloc(sizeof(structata_identify_data)); +hdd->hdPort=0x1F0; +hdd->hdDev=hdD;//0x40; +hdd->parOffset=0x0; +hdd->part=0x2; + +/*Allocmemoryfordevicestructureandsetitupcorrectly*/ +devInfo=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); +devInfo->read=(void*)&hdRead; +devInfo->write=(void*)&hdWrite; +devInfo->reset=(void*)&hdReset; +devInfo->init=(void*)&hdInit; +devInfo->ioctl=(void*)&hdIoctl; +devInfo->stop=(void*)&hdStop; +devInfo->start=(void*)&hdStart; +devInfo->standby=(void*)&hdStandby; +devInfo->info=hdd; + +devInfo->major=hdC+0x1; + +data=(char*)kmalloc(512); +d=(structdos_partition*)(data+0x1BE); + +data2=(char*)kmalloc(512); +bsdd=(structbsd_disklabel*)data2; + +if(device_add(0,'c',devInfo)==0x0){ +kprintf("ad%i-Start:[0x0],Size:[0x%x/0x%X]\n",hdC,hdd->hdSize,hdd->hdSize*512); +sprintf(name,"ad%ip%i",hdC,hdd->part); +devfs_makeNode(name,'b',0x1,0x0); +hdRead(devInfo->info,data,0x0,0x1); + +if(d[0].dp_type==0xEE){ +//MrOlsen(2016-01-14)DEBUG:Thiswasjusttohelpdebug +//kprintf("%s-Type:[0x%X-%s],Start:[0x%X],Size:[0x%X]\n",name,d[0].dp_type,(d[0].dp_type>=0&&d[0].dp_type<=255)?part_types[d[0].dp_type]:"Unknown",d[0].dp_start,d[0].dp_size); + +secbuf=(char*)kmalloc(65536); + +if(gptread(&freebsd_ufs_uuid,devInfo,secbuf)==-1){ +kprintf("%s:unabletoloadGPT\n","KERNEL"); +//return(-1); +} +else{ +devInfo2=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); +hdd2=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); +memcpy(devInfo2,devInfo,sizeof(structdevice_interface)); +memcpy(hdd2,hdd,sizeof(structdriveInfo)); +//hdd2->parOffset=d[i].dp_start; +devInfo2->info=hdd2; +minor++; + +if(gptfind(&freebsd_ufs_uuid,devInfo2,hdd->part)==-1){ +//MrOlsen(2016-01-11)FIX:Iamusing"1"aspartition1 +kprintf("%s:noUFSpartitionwasfound\n","KERNEL"); +//return(-1); +} + +//MrOlsen(2016-01-14)DEBUG:Thiswasjustdebuggingcode +//kprintf("[%i-%i]\n",hdd->parOffset,hdd2->parOffset); -inthdStandby(){ -return(0x0); -} - -inthdStart(){ -return(0x0); -} - -inthdStop(){ -return(0x0); -} +if(device_add(minor,'c',devInfo2)==0x0){ +sprintf(name,"ad%ip%i",hdC,hdd->part); +kprintf("%s-Type:[0x%X-%s],Start:[%i],Offset:[%i],Size:[%i],MM:[%i:%i]\n",name,d[0].dp_type,(d[0].dp_type>=0&&d[0].dp_type<=255)?part_types[d[0].dp_type]:"Unknown",hdd2->lba_start,hdd2->parOffset,hdd2->lba_end-hdd2->lba_start,devInfo->major,minor); +devfs_makeNode(name,'c',0x1,minor); +} +} + +} +else{ + +for(i=0x0;i<0x4;i++){ -inthdIoctl(){ -return(0x0); -} - -inthdReset(){ -return(0x0); -} - -inthdInit(structdevice_node*dev){ -charretVal=0x0; -longcounter=0x0; -short*tmp=0x0; -structdriveInfo*hdd=dev->devInfo->info; -for(counter=1000000;counter>=0;counter--){ -retVal=inportByte(hdd->hdPort+hdStat)&0x80; -if(!retVal)gotoready; -} -kprintf("ErrorInitializingDrive\n"); -return(1); -ready: -outportByte(hdd->hdPort+hdHead,hdd->hdDev); -outportByte(hdd->hdPort+hdCmd,0xEC); -for(counter=1000000;counter>=0;counter--){ -retVal=inportByte(hdd->hdPort+hdStat); -if((retVal&1)!=0x0){ -kprintf("ErrorDriveNotAvailable\n"); -return(1); -} -if((retVal&8)!=0x0){ -gotogo; -} -} -kprintf("TimeOutWaitingOnDrive\n"); -return(1); -go: -tmp=(short*)hdd->hdSector; -for(counter=0;counter<(512/2);counter++){ -tmp[counter]=inportWord(hdd->hdPort+hdData); -} -retVal=tmp[0x2F]&0xFF; -switch(retVal){ -case0: -hdd->hdShift=0; -hdd->hdMulti=1; -break; -case2: -hdd->hdShift=1; -hdd->hdMulti=retVal; -break; -case4: -hdd->hdShift=2; -hdd->hdMulti=retVal; -break; -case8: -hdd->hdShift=3; -hdd->hdMulti=retVal; -break; -case16: -hdd->hdShift=4; -hdd->hdMulti=retVal; -break; -case32: -hdd->hdShift=5; -hdd->hdMulti=retVal; -break; -case64: -hdd->hdShift=6; -hdd->hdMulti=retVal; -break; -default: -kprintf("ErrorBLOCKModeUnavailable:[%i]\n",retVal); -return(1); -} -outportByte(hdd->hdPort+hdSecCount,retVal); -outportByte(hdd->hdPort+hdHead,hdd->hdDev); -outportByte(hdd->hdPort+hdCmd,0xC6); -hdd->hdMask=retVal; -hdd->hdSize=(hdd->hdSector[0x7B]*256*256*256)+(hdd->hdSector[0x7A]*256*256)+(hdd->hdSector[0x79]*256)+hdd->hdSector[0x78]; -hdd->hdEnable=1; -kprintf("Drive:[0x%X/0x%X],Size:[%iSectors/%iKBytes]\n",hdd->hdPort,hdd->hdDev,hdd->hdSize,((hdd->hdSize*512)/1024)); -dev->devInfo->size=hdd->hdSize*512; -dev->devInfo->initialized=0x1; -return(0x0); -} - -voidhdWrite(structdriveInfo*hdd,void*baseAddr,uInt32startSector,uInt32sectorCount){ -longcounter=0x0; -longretVal=0x0; -shorttransactionCount=0x0; -short*tmp=(short*)baseAddr; -startSector+=hdd->parOffset; -if(hdd->hdEnable==0x0){ -kprintf("InvalidDrive\n"); -return; -} -if((sectorCount>>hdd->hdShift)==0x0){ -hdd->hdCalc=sectorCount;/*hdd->hdMask;*/ -transactionCount=1; -} -else{ -hdd->hdCalc=hdd->hdMulti; -transactionCount=sectorCount>>hdd->hdShift; -} -for(;transactionCount>0;transactionCount--){ -for(counter=1000000;counter>=0;counter--){ -retVal=inportByte(hdd->hdPort+hdStat)&0x80; -if(!retVal)gotoready; -} -kprintf("TimeOutWaitingOnDrive\n"); -return; -ready: -outportByte(hdd->hdPort+hdSecCount,hdd->hdCalc); -outportByte(hdd->hdPort+hdSecNum,(startSector&0xFF)); -retVal=startSector>>8; -outportByte(hdd->hdPort+hdCylLow,(retVal&0xFF)); -retVal>>=8; -outportByte(hdd->hdPort+hdCylHi,(retVal&0xFF)); -retVal>>=8; -retVal&=0x0F; -retVal|=(hdd->hdDev|0xA0);//TestAsPerTJ -outportByte(hdd->hdPort+hdHead,(retVal&0xFF)); -if(hdd->hdShift>0) -outportByte(hdd->hdPort+hdCmd,0xC5); -else -outportByte(hdd->hdPort+hdCmd,0x30); -for(counter=1000000;counter>=0;counter--){ -retVal=inportByte(hdd->hdPort+hdStat); -if((retVal&1)!=0x0){ -kprintf("HDWriteError\n"); -return; -} -if((retVal&8)!=0x0){ -gotogo; -} -} -kprintf("TimeOutWaitingOnDrive\n"); -return; -go: -for(counter=0;counter<(hdd->hdCalc<<8);counter++){ -outportWord(hdd->hdPort+hdData,(short)tmp[counter]); -} -tmp+=(counter+0); -startSector+=hdd->hdCalc; -} -return; -} - -voidhdRead(structdriveInfo*hdd,void*baseAddr,uInt32startSector,uInt32sectorCount){ -longcounter=0x0; -longretVal=0x0; -shorttransactionCount=0x0; -short*tmp=(short*)baseAddr; -startSector+=hdd->parOffset; - -if(hdd->hdEnable==0x0){ -kprintf("InvalidDrive\n"); -return; -} -if((sectorCount>>hdd->hdShift)==0x0){ -hdd->hdCalc=sectorCount;/*hdd->hdMask);*/ -transactionCount=1; -} -else{ -hdd->hdCalc=hdd->hdMulti; -transactionCount=sectorCount>>hdd->hdShift; -} -for(;transactionCount>0;transactionCount--){ -for(counter=1000000;counter>=0;counter--){ -retVal=inportByte(hdd->hdPort+hdStat)&0x80; -if(!retVal)gotoready; -} -kprintf("TimeOutWaitingOnDrive\n"); -return; -ready: -outportByte(hdd->hdPort+hdSecCount,hdd->hdCalc); -outportByte(hdd->hdPort+hdSecNum,(startSector&0xFF)); -retVal=startSector>>8; -outportByte(hdd->hdPort+hdCylLow,(retVal&0xFF)); -retVal>>=8; -outportByte(hdd->hdPort+hdCylHi,(retVal&0xFF)); -retVal>>=8; -retVal&=0x0F; -retVal|=(hdd->hdDev|0xA0);//TestasperTJ -//retVal|=hdd->hdDev;//retVal|=(hdd->hdDev|0xA0);//TestasperTJ -outportByte(hdd->hdPort+hdHead,(retVal&0xFF)); -if(hdd->hdShift>0) -outportByte(hdd->hdPort+hdCmd,0xC4); -else -outportByte(hdd->hdPort+hdCmd,0x20); -for(counter=1000000;counter>=0;counter--){ -retVal=inportByte(hdd->hdPort+hdStat); -if((retVal&1)!=0x0){ -kprintf("HDReadError:[%i:0x%X:%i]\n",counter,(uInt32)baseAddr,startSector); -return; -} -if((retVal&8)!=0x0){ -gotogo; -} -} -kprintf("Error:TimeOutWaitingOnDrive\n"); -return; -go: -for(counter=0;counter<(hdd->hdCalc<<8);counter++){ -tmp[counter]=inportWord(hdd->hdPort+hdData); -} -tmp+=(counter+0); -startSector+=hdd->hdCalc; -} -return; -} - -/*** -$Log: hd_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.52006/10/1215:00:26reddawg -Morechanges - -Revision1.42006/10/1014:14:01reddawg -UFSReading - -Revision1.32006/10/0902:58:05reddawg -FixingUFS - -Revision1.22006/10/0615:48:01reddawg -StartingtomakeubixosworkwithUFS2 - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:34reddawg -nomessage - -Revision1.162004/08/2622:51:19reddawg -TCAtouchedme:(ithinkhelikesmen.... - - -sched.h:kTask_taddedparentPid -endtask.c:fixedtermbacktoparentPid -exec.c:cleanedwarnings -fork.c:fixedtermtochildPid -sched.c:cleanupfordeadtasks -systemtask.c:cleanupdeadtasks -kmalloc.c:cleanedupwarnings -udp.c:cleanedupwarnings -bot.c:cleanedupwarnings -shell.c:cleanedupwarnings -tcpdump.c:tookadump -hd.c:cleanedupwarnings -ubixfs.c:stoppedprningdebuginfo - -Revision1.152004/08/1500:33:02reddawg -Wowtheidedriverworksagain - -Revision1.142004/08/1421:56:44reddawg -Addedinitializedbytetothedevicesystemtomakeiteasytoaddchilddeviceswhichuseparenthardware. - -Revision1.132004/08/0211:43:17reddawg -Fixens - -Revision1.122004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.112004/05/1923:36:52reddawg -BugFixes - -Revision1.102004/05/1915:20:06reddawg -Fixedreferenceproblemsduetochangesindrivesubsystem - -Revision1.92004/05/1915:07:59reddawg -TypodefInfoshouldofbeendevInfo - -Revision1.72004/05/1904:07:43reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.62004/04/2821:10:40reddawg -LotsOfchangestomakeitworkwithexistingos - -Revision1.52004/04/2802:37:34reddawg -Moreupdatesforusingthenewdriversubsystem - -Revision1.42004/04/2802:22:54reddawg -Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel -allaround - -Revision1.32004/04/2721:05:19reddawg -Updatingdriverstousenewmodel - -Revision1.22004/04/2622:22:33reddawg -DevFSnowusescorrectsizeofdevice - -Revision1.1.1.12004/04/1512:07:16reddawg -UbixOSv1.0 - -Revision1.122004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +//MrOlsen(2016-01-14)DEBUG:Thiswasjustdebuggingcode +//kprintf("Type:0x%X\n",d[i].dp_type); + +if(d[i].dp_type==0xEE) +kprintf("MotherfuckerJones!We'reGPT....LickMyNutsNowBitch!\n"); + +if(d[i].dp_type!=0x0){ +devInfo2=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); +hdd2=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); +memcpy(devInfo2,devInfo,sizeof(structdevice_interface)); +memcpy(hdd2,hdd,sizeof(structdriveInfo)); +hdd2->parOffset=d[i].dp_start; +devInfo2->info=hdd2; +minor++; + +if(device_add(minor,'c',devInfo2)==0x0){ +sprintf(name,"ad%is%i",hdC,i+1); +kprintf("%s-Type:[0x%X-%s],Start:[0x%X],Size:[0x%X],MM:[%i:%i]\n",name,d[i].dp_type,(d[i].dp_type>=0&&d[i].dp_type<=255)?part_types[d[i].dp_type]:"Unknown",d[i].dp_start,d[i].dp_size,devInfo->major,minor); + +devfs_makeNode(name,'c',0x1,minor); + +if(d[i].dp_type==0xA5){ +//Whydoineedtoadd1? +hdRead(devInfo->info,data2,d[i].dp_start+1,0x1); + +for(x=0;x<bsdd->d_npartitions;x++){ +if(bsdd->d_partitions[x].p_size>0){ +sprintf(name,"ad%is%i%c",hdC,i+1,'a'+x); +//NewNodes +devInfo2=(structdevice_interface*)kmalloc(sizeof(structdevice_interface)); +hdd2=(structdriveInfo*)kmalloc(sizeof(structdriveInfo)); +memcpy(devInfo2,devInfo,sizeof(structdevice_interface)); +memcpy(hdd2,hdd,sizeof(structdriveInfo)); +//hdd2->parOffset=d[i].dp_start+bsdd->d_partitions[x].p_offset; +hdd2->lba_start=d[i].dp_start; +hdd2->parOffset=bsdd->d_partitions[x].p_offset; +devInfo2->info=hdd2; +minor++; +device_add(minor,'c',devInfo2); +devfs_makeNode(name,'c',0x1,minor); +kprintf("%s-Type:[%s],Start:[0x%X],Size:[0x%X],MM:[%i:%i]\n",name,fstypenames[bsdd->d_partitions[x].p_fstype],bsdd->d_partitions[x].p_offset,bsdd->d_partitions[x].p_size,devInfo->major,minor); +} + +} + +} + +} + +} + +} +} +} +kfree(data); +hdC++; +return(0x0); +} + +inthdStandby(){ +/*NotImplemented*/ +return(0x0); +} + +inthdStart(){ +/*NotImplemented*/ +return(0x0); +} + +inthdStop(){ +/*NotImplemented*/ +return(0x0); +} + +inthdIoctl(){ +/*NotImplemented*/ +return(0x0); +} + +inthdReset(){ +/*NotImplemented*/ +return(0x0); +} + +inthdInit(structdevice_node*dev){ +u_int8_tretVal=0x0; +intcounter=0x0; +u_int16_t*tmp=0x0; +structdriveInfo*hdd=dev->devInfo->info; + +for(counter=1000000;counter>=0;counter--){ +retVal=inportByte(hdd->hdPort+ATA_COMMAND)&ATA_S_BUSY; + +if(!retVal) +gotoready; + +} + +kprintf("ErrorInitializingDrive\n"); +return(1); + +ready: + +outportByte(hdd->hdPort+ATA_DRIVE,hdd->hdDev); +outportByte(hdd->hdPort+ATA_COMMAND,ATA_IDENTIFY); + +//for(counter=1000000;counter>=0;counter--){ +for(counter=10000000;counter>=0;counter--){ +retVal=inportByte(hdd->hdPort+ATA_COMMAND); +if((retVal&1)!=0x0){ +kprintf("ErrorDriveNotAvailable\n"); +return(1); +} +if((retVal&8)!=0x0){ +gotogo; +} +} + +kprintf("TimeOutWaitingOnDrive\n"); +return(1); + +go: + +tmp=(u_int16_t*)hdd->ata_identify; + +for(counter=0;counter<256;counter++){ +tmp[counter]=inportWord(hdd->hdPort+ATA_DATA); +} + +retVal=tmp[0x2F]&0xFF; + +switch(retVal){ +case0: +hdd->hdShift=0; +hdd->hdMulti=1; +break; +case2: +hdd->hdShift=1; +hdd->hdMulti=retVal; +break; +case4: +hdd->hdShift=2; +hdd->hdMulti=retVal; +break; +case8: +hdd->hdShift=3; +hdd->hdMulti=retVal; +break; +case16: +hdd->hdShift=4; +hdd->hdMulti=retVal; +break; +case32: +hdd->hdShift=5; +hdd->hdMulti=retVal; +break; +case64: +hdd->hdShift=6; +hdd->hdMulti=retVal; +break; +case128: +hdd->hdShift=7; +hdd->hdMulti=retVal; +break; +default: +kprintf("ErrorBLOCKModeUnavailable:[%x]\n",retVal); +return(1); +} + +if(hdd->ata_identify->command_set_enabled1&ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE){ +hdd->lba_high=hdd->ata_identify->max_48bit_lba[7]<<24; +hdd->lba_high|=hdd->ata_identify->max_48bit_lba[6]<<16; +hdd->lba_high|=hdd->ata_identify->max_48bit_lba[5]<<8; +hdd->lba_high|=hdd->ata_identify->max_48bit_lba[4]; + +hdd->lba_low=hdd->ata_identify->max_48bit_lba[3]<<24; +hdd->lba_low|=hdd->ata_identify->max_48bit_lba[2]<<16; +hdd->lba_low|=hdd->ata_identify->max_48bit_lba[1]<<8; +hdd->lba_low|=hdd->ata_identify->max_48bit_lba[0]; +} +else{ +hdd->lba_high=0; +hdd->lba_low=hdd->ata_identify->total_num_sectors[3]<<24; +hdd->lba_low|=hdd->ata_identify->total_num_sectors[2]<<16; +hdd->lba_low|=hdd->ata_identify->total_num_sectors[1]<<8; +hdd->lba_low|=hdd->ata_identify->total_num_sectors[0]; +} + +//IftheATAdevicereportsitssectorsize(bit12ofWord106),thenusethatinstead. +if(hdd->ata_identify->physical_logical_sector_info&ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE){ +hdd->sector_size=hdd->ata_identify->words_per_logical_sector[3]<<24; +hdd->sector_size|=hdd->ata_identify->words_per_logical_sector[2]<<16; +hdd->sector_size|=hdd->ata_identify->words_per_logical_sector[1]<<8; +hdd->sector_size|=hdd->ata_identify->words_per_logical_sector[0]; +} +else{ +//Defaultthesectorsizeto512bytes +hdd->sector_size=512; +} + +kprintf("LBA[0x%X-0x%X],LBA_HIGH:%i,LBA_LOW:%i,SECTOR_SIZE:%i\n",hdd->ata_identify->command_set_enabled1,hdd->ata_identify->command_set_enabled1&ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE,hdd->lba_high,hdd->lba_low,hdd->sector_size); + +outportByte(hdd->hdPort+hdSecCount,retVal); +outportByte(hdd->hdPort+hdHead,hdd->hdDev); +outportByte(hdd->hdPort+hdCmd,0xC6); + +hdd->hdMask=retVal; +//hdd->hdSize=(hdd->hdSector[0x7B]*256*256*256)+(hdd->hdSector[0x7A]*256*256)+(hdd->hdSector[0x79]*256)+hdd->hdSector[0x78]; + +//MrOlsen(2016-01-11)NOTE:MustphaseouthdSize +hdd->hdSize=hdd->lba_low+hdd->lba_high; +hdd->hdEnable=1; + +kprintf("Drive:[0x%X/0x%X],Size:[%iSectors/%iMB]\n",hdd->hdPort,hdd->hdDev,hdd->hdSize,hdd->hdSize/2048); +dev->devInfo->size=hdd->hdSize*512; +dev->devInfo->initialized=0x1; +return(0x0); +} + +inthdWrite(structdriveInfo*hdd,void*baseAddr,uInt32startSector,uInt32sectorCount){ +longcounter=0x0; +longretVal=0x0; +shorttransactionCount=0x0; +short*tmp=(short*)baseAddr; +if(hdd->lba_start==0) +startSector+=hdd->parOffset; +else +startSector+=hdd->lba_start; + +if(hdd->hdEnable==0x0){ +kprintf("InvalidDrive\n"); +return(1); +} +if((sectorCount>>hdd->hdShift)==0x0){ +hdd->hdCalc=sectorCount;/*hdd->hdMask;*/ +transactionCount=1; +} +else{ +hdd->hdCalc=hdd->hdMulti; +transactionCount=sectorCount>>hdd->hdShift; +} +for(;transactionCount>0;transactionCount--){ +//for(counter=1000000;counter>=0;counter--){ +for(counter=10000000;counter>=0;counter--){ +retVal=inportByte(hdd->hdPort+hdStat)&0x80; +if(!retVal) +gotoready; +} +kprintf("TimeOutWaitingOnDrive\n"); +return(1); +ready:outportByte(hdd->hdPort+hdSecCount,hdd->hdCalc); +outportByte(hdd->hdPort+hdSecNum,(startSector&0xFF)); +retVal=startSector>>8; +outportByte(hdd->hdPort+hdCylLow,(retVal&0xFF)); +retVal>>=8; +outportByte(hdd->hdPort+hdCylHi,(retVal&0xFF)); +retVal>>=8; +retVal&=0x0F; +retVal|=(hdd->hdDev|0xA0);//TestAsPerTJ +outportByte(hdd->hdPort+hdHead,(retVal&0xFF)); +if(hdd->hdShift>0) +outportByte(hdd->hdPort+hdCmd,0xC5); +else +outportByte(hdd->hdPort+hdCmd,0x30); +//for(counter=1000000;counter>=0;counter--){ +for(counter=10000000;counter>=0;counter--){ +retVal=inportByte(hdd->hdPort+hdStat); +if((retVal&1)!=0x0){ +kprintf("HDWriteError\n"); +return(1); +} +if((retVal&8)!=0x0){ +gotogo; +} +} +kprintf("TimeOutWaitingOnDrive\n"); +return(1); +go:for(counter=0;counter<(hdd->hdCalc<<8);counter++){ +outportWord(hdd->hdPort+hdData,(short)tmp[counter]); +} +tmp+=(counter+0); +startSector+=hdd->hdCalc; +} +return(0); +} + +inthdRead(structdriveInfo*hdd,void*baseAddr,uInt32startSector,uInt32sectorCount){ +longcounter=0x0; +longretVal=0x0; +shorttransactionCount=0x0; +short*tmp=(short*)baseAddr; +startSector+=hdd->parOffset; +startSector+=hdd->lba_start; + +if(hdd->hdEnable==0x0){ +kprintf("InvalidDrive\n"); +return(1); +} +if((sectorCount>>hdd->hdShift)==0x0){ +hdd->hdCalc=sectorCount;/*hdd->hdMask);*/ +transactionCount=1; +} +else{ +hdd->hdCalc=hdd->hdMulti; +transactionCount=sectorCount>>hdd->hdShift; +} +for(;transactionCount>0;transactionCount--){ +//for(counter=1000000;counter>=0;counter--){ +for(counter=10000000;counter>=0;counter--){ +retVal=inportByte(hdd->hdPort+hdStat)&0x80; +if(!retVal) +gotoready; +} +kprintf("TimeOutWaitingOnDrive\n"); +return(1); +ready:outportByte(hdd->hdPort+hdSecCount,hdd->hdCalc); +outportByte(hdd->hdPort+hdSecNum,(startSector&0xFF)); +retVal=startSector>>8; +outportByte(hdd->hdPort+hdCylLow,(retVal&0xFF)); +retVal>>=8; +outportByte(hdd->hdPort+hdCylHi,(retVal&0xFF)); +retVal>>=8; +retVal&=0x0F; +retVal|=(hdd->hdDev|0xA0);//TestasperTJ +//retVal|=hdd->hdDev;//retVal|=(hdd->hdDev|0xA0);//TestasperTJ +outportByte(hdd->hdPort+hdHead,(retVal&0xFF)); +if(hdd->hdShift>0) +outportByte(hdd->hdPort+hdCmd,0xC4); +else +outportByte(hdd->hdPort+hdCmd,0x20); +//for(counter=1000000;counter>=0;counter--){ +for(counter=10000000;counter>=0;counter--){ +retVal=inportByte(hdd->hdPort+hdStat); +if((retVal&1)!=0x0){ +kprintf("HDReadError:[%i:0x%X:%i]\n",counter,(uInt32)baseAddr,startSector); +return(1); +} +if((retVal&8)!=0x0){ +gotogo; +} +} +kprintf("Error:TimeOutWaitingOnDrive\n"); +return(1); +go:for(counter=0;counter<(hdd->hdCalc<<8);counter++){ +tmp[counter]=inportWord(hdd->hdPort+hdData); +//kprintf("[0x%X]",tmp[counter]); +} +tmp+=(counter+0); +startSector+=hdd->hdCalc; +} +return(0); +} + +/*** +$Log:hd.c,v$ +Revision1.52006/10/1215:00:26reddawg +Morechanges + +Revision1.42006/10/1014:14:01reddawg +UFSReading + +Revision1.32006/10/0902:58:05reddawg +FixingUFS + +Revision1.22006/10/0615:48:01reddawg +StartingtomakeubixosworkwithUFS2 + +Revision1.1.1.12006/06/0112:46:16reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:34reddawg +nomessage + +Revision1.162004/08/2622:51:19reddawg +TCAtouchedme:(ithinkhelikesmen.... + + +sched.h:kTask_taddedparentPid +endtask.c:fixedtermbacktoparentPid +exec.c:cleanedwarnings +fork.c:fixedtermtochildPid +sched.c:cleanupfordeadtasks +systemtask.c:cleanupdeadtasks +kmalloc.c:cleanedupwarnings +udp.c:cleanedupwarnings +bot.c:cleanedupwarnings +shell.c:cleanedupwarnings +tcpdump.c:tookadump +hd.c:cleanedupwarnings +ubixfs.c:stoppedprningdebuginfo + +Revision1.152004/08/1500:33:02reddawg +Wowtheidedriverworksagain + +Revision1.142004/08/1421:56:44reddawg +Addedinitializedbytetothedevicesystemtomakeiteasytoaddchilddeviceswhichuseparenthardware. + +Revision1.132004/08/0211:43:17reddawg +Fixens + +Revision1.122004/07/2110:02:09reddawg +devfs:renamedfunctions +devicesystem:renamedfunctions +fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables +strol:fixeddefinition +endtask:madeitprintoutfreepagedebuginfo +kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost +ld:fixedapointerconversion +file:cleanedupafewunusedvariables +sched:broketaskdeletion +kprintf:fixedogPrintfdefinition + +Revision1.112004/05/1923:36:52reddawg +BugFixes + +Revision1.102004/05/1915:20:06reddawg +Fixedreferenceproblemsduetochangesindrivesubsystem + +Revision1.92004/05/1915:07:59reddawg +TypodefInfoshouldofbeendevInfo + +Revision1.72004/05/1904:07:43reddawg +kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen + +Revision1.62004/04/2821:10:40reddawg +LotsOfchangestomakeitworkwithexistingos + +Revision1.52004/04/2802:37:34reddawg +Moreupdatesforusingthenewdriversubsystem + +Revision1.42004/04/2802:22:54reddawg +Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel +allaround + +Revision1.32004/04/2721:05:19reddawg +Updatingdriverstousenewmodel + +Revision1.22004/04/2622:22:33reddawg +DevFSnowusescorrectsizeofdevice + +Revision1.1.1.12004/04/1512:07:16reddawg +UbixOSv1.0 + +Revision1.122004/04/1316:36:33reddawg +Changedourcopyright,itisallnowunderaBSD-Stylelicense + +END +***/ - + diff --git a/doc/xml/hd_8h.xml b/doc/xml/hd_8h.xml index 153fab8..2a0a1e0 100644 --- a/doc/xml/hd_8h.xml +++ b/doc/xml/hd_8h.xml @@ -1,168 +1,1655 @@ - - - + + + hd.h - ubixfs/ubixfs.h - src/sys/include/ubixos/init.h - src/sys/pci/hd.c + sys/types.h + ubixfs/ubixfs.h + C:/Dev/git/UbixOS/sys/fs/common/gpt.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/pci/hd.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - + - - - - + + + + - - - + - - - - + + + + - - - - - - + + + + - - - - + + + + - - - - - - - + - - - - + + + + + + + + - - - - - - - - - - - - - - - + - + - - - - + + + + - - - - + + + + - + - - - - - + - - - - - - - - - - - + - - - - - - + + - - - - + + + + + + + + + + + + - + + + - - - - + + + + + ata_identify_data bsd_disklabel bsd_disklabel::partition dos_partition driveInfo + +
ATA_IDENTIFY_DEVICE_FIELD_LENGTHS
+ The following constants define the number of bytes contained in various fields found in the IDENTIFY DEVICE data structure. + + + ATA_IDENTIFY_48_LBA_LEN + 8 + + + + + + + + + + ATA_IDENTIFY_FW_REVISION_LEN + 8 + + + + + + + + + + ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN + 30 + + + + + + + + + + ATA_IDENTIFY_MODEL_NUMBER_LEN + 40 + + + + + + + + + + ATA_IDENTIFY_SERIAL_NUMBER_LEN + 20 + + + + + + + + + + ATA_IDENTIFY_WWN_LEN + 8 + + + + + + + + + + const char *const + const char* const part_types[256] + [256] + part_types + + + + + + + + +
- + + ATA_A_4BIT + 0x00 + + + + + + + + + + ATA_A_HOB + 0x80 /* High Order Byte enable */ + + + + + + + + + + ATA_A_IDS + 0x02 /* disable interrupts */ + + + + + + + + + + ATA_A_RESET + 0x04 /* RESET controller */ + + + + + + + + + + ATA_ALTSTAT + 11 /* (R) alternate status */ + + + + + + + + + + ATA_CHECK_POWER_MODE + 0xE5 + + + + + + + + + + ATA_COMMAND + 7 /* (W) command */ + + + + + + + + + + ATA_CONTROL + 12 /* (W) control */ + + + + + + + + + + ATA_COUNT + 2 /* (W) sector count */ + + + + + + + + + + ATA_CTLOFFSET + 0x206 /* control register offset */ + + + + + + + + + + ATA_CYL_LSB + 4 /* (RW) cylinder# LSB */ + + + + + + + + + + ATA_CYL_MSB + 5 /* (RW) cylinder# MSB */ + + + + + + + + + + ATA_D_IBM + 0xa0 /* 512 byte sectors, ECC */ + + + + + + + + + + ATA_D_LBA + 0x40 /* use LBA addressing */ + + + + + + + + + + ATA_DATA + 0 /* (RW) data */ + + + + + + + + + + ATA_DATA_SET_MANAGEMENT + 0x06 + + + + + + + + + + ATA_DEVICE_RESET + 0x08 + + + + + + + + + + ATA_DOWNLOAD_MICROCODE + 0x92 + + + + + + + + + + ATA_DRIVE + 6 /* (W) Sector/Drive/Head */ + + + + + + + + + + ATA_E_ABORT + 0x04 /* command aborted */ + + + + + + + + + + ATA_E_ATAPI_SENSE_MASK + 0xf0 /* ATAPI sense key mask */ + + + + + + + + + + ATA_E_ICRC + 0x80 /* UDMA crc error */ + + + + + + + + + + ATA_E_IDNF + 0x10 /* ID not found */ + + + + + + + + + + ATA_E_ILI + 0x01 /* illegal length */ + + + + + + + + + + ATA_E_MC + 0x20 /* media changed */ + + + + + + + + + + ATA_E_MCR + 0x08 /* media change request */ + + + + + + + + + + ATA_E_NM + 0x02 /* no media */ + + + + + + + + + + ATA_E_UNC + 0x40 /* uncorrectable data */ + + + + + + + + + + ATA_ERROR + 8 /* (R) error */ + + + + + + + + + + ATA_EXECUTE_DEVICE_DIAG + 0x90 + + + + + + + + + + ATA_F_DMA + 0x01 /* enable DMA */ + + + + + + + + + + ATA_F_OVL + 0x02 /* enable overlap */ + + + + + + + + + + ATA_FEATURE + 1 /* (W) feature */ + + + + + + + + + + ATA_FLUSH_CACHE + 0xE7 + + + + + + + + + + ATA_FLUSH_CACHE_EXT + 0xEA + + + + + + + + + + ATA_I_CMD + 0x01 /* cmd (1) | data (0) */ + + + + + + + + + + ATA_I_IN + 0x02 /* read (1) | write (0) */ + + + + + + + + + + ATA_I_RELEASE + 0x04 /* released bus (1) */ + + + + + + + + + + ATA_I_TAGMASK + 0xf8 /* tag mask */ + + + + + + + + + + ATA_IDENTIFY + 0xEC + + + + + + + + + + ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE + 0x0400 + + + + + + + + + + ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE + 0x0100 + + + + + + + + + + ATA_IDLE + 0xE3 + + + + + + + + + + ATA_IDLE_IMMED + 0xE1 + + + + + + + + + + ATA_IREASON + 9 /* (R) interrupt reason */ + + + + + + + + + + ATA_MEDIA_EJECT + 0xED + + + + + + + + + + ATA_NOP + 0x00 + + + + + + + + + + ATA_PACKET + 0xA0 + + + + + + + + + + ATA_PACKET_IDENTIFY + 0xA1 + + + + + + + + + + ATA_PC98_CTLOFFSET + 0x10c /* do for PC98 devices */ + + + + + + + + + + ATA_PCCARD_CTLOFFSET + 0x0e /* do for PCCARD devices */ + + + + + + + + + + ATA_READ_BUFFER + 0xE4 + + + + + + + + + + ATA_READ_DMA + 0xC8 + + + + + + + + + + ATA_READ_DMA_EXT + 0x25 + + + + + + + + + + ATA_READ_DMA_QUEUED + 0xC7 + + + + + + + + + + ATA_READ_DMA_QUEUED_EXT + 0x26 + + + + + + + + + + ATA_READ_FPDMA + 0x60 + + + + + + + + + + ATA_READ_LOG_DMA_EXT + 0x47 + + + + + + + + + + ATA_READ_LOG_EXT + 0x2F + + + + + + + + + + ATA_READ_MULTIPLE + 0xC4 + + + + + + + + + + ATA_READ_MULTIPLE_EXT + 0x29 + + + + + + + + + + ATA_READ_SECTORS + 0x20 + + + + + + + + + + ATA_READ_SECTORS_EXT + 0x24 + + + + + + + + + + ATA_READ_STREAM_DMA_EXT + 0x2A + + + + + + + + + + ATA_READ_VERIFY_SECTORS + 0x40 + + + + + + + + + + ATA_READ_VERIFY_SECTORS_EXT + 0x42 + + + + + + + + + + ATA_S_BUSY + 0x80 /* busy */ + + + + + + + + + + ATA_S_CORR + 0x04 /* data corrected */ + + + + + + + + + + ATA_S_DMA + 0x20 /* DMA ready */ + + + + + + + + + + ATA_S_DRQ + 0x08 /* data request */ + + + + + + + + + + ATA_S_DSC + 0x10 /* drive seek completed */ + + + + + + + + + + ATA_S_DWF + 0x20 /* drive write fault */ + + + + + + + + + + ATA_S_ERROR + 0x01 /* error */ + + + + + + + + + + ATA_S_INDEX + 0x02 /* index */ + + + + + + + + + + ATA_S_READY + 0x40 /* drive ready */ + + + + + + + + + + ATA_S_SERVICE + 0x10 /* drive needs service */ + + + + + + + + + + ATA_SECTOR + 3 /* (RW) sector # */ + + + + + + + + + + ATA_SECURITY_FREEZE_LOCK + 0xF5 + + + + + + + + + + ATA_SECURITY_UNLOCK + 0xF2 + + + + + + + + + + ATA_SET_FEATURES + 0xEF + + + + + + + + + + ATA_SMART + 0xB0 + + + + + + + + + + ATA_STANDBY + 0xE2 + + + + + + + + + + ATA_STANDBY_IMMED + 0xE0 + + + + + + + + + + ATA_STATUS + 10 /* (R) status */ + + + + + + + + + + ATA_WRITE_BUFFER + 0xE8 + + + + + + + + + + ATA_WRITE_DMA + 0xCA + + + + + + + + + + ATA_WRITE_DMA_EXT + 0x35 + + + + + + + + + + ATA_WRITE_DMA_FUA + 0x3D + + + + + + + + + + ATA_WRITE_DMA_QUEUED + 0xCC + + + + + + + + + + ATA_WRITE_DMA_QUEUED_EXT + 0x36 + + + + + + + + + + ATA_WRITE_DMA_QUEUED_FUA_EXT + 0x3E + + + + + + + + + + ATA_WRITE_FPDMA + 0x61 + + + + + + + + + + ATA_WRITE_LOG_DMA_EXT + 0x57 + + + + + + + + + + ATA_WRITE_MULTIPLE + 0xC5 + + + + + + + + + + ATA_WRITE_MULTIPLE_EXT + 0x39 + + + + + + + + + + ATA_WRITE_MULTIPLE_FUA_EXT + 0xCE + + + + + + + + + + ATA_WRITE_SECTORS + 0x30 + + + + + + + + + + ATA_WRITE_SECTORS_EXT + 0x34 + + + + + + + + + + ATA_WRITE_STREAM_DMA_EXT + 0x3A + + + + + + + + + + ATA_WRITE_UNCORRECTABLE + 0x45 + + + + + + + + + hdCmd 0x7 @@ -171,12 +1658,9 @@ - - hdInit - hdRead - hdWrite + - + hdCylHi 0x5 @@ -185,11 +1669,9 @@ - - hdRead - hdWrite + - + hdCylLow 0x4 @@ -198,11 +1680,9 @@ - - hdRead - hdWrite + - + hdData 0x0 @@ -211,12 +1691,9 @@ - - hdInit - hdRead - hdWrite + - + hdError 0x1 @@ -225,9 +1702,9 @@ - + - + hdHead 0x6 @@ -236,12 +1713,9 @@ - - hdInit - hdRead - hdWrite + - + hdSecCount 0x2 @@ -250,12 +1724,9 @@ - - hdInit - hdRead - hdWrite + - + hdSecNum 0x3 @@ -264,11 +1735,9 @@ - - hdRead - hdWrite + - + hdStat 0x7 @@ -277,12 +1746,9 @@ - - hdInit - hdRead - hdWrite + - + MAXPARTITIONS 8 @@ -291,9 +1757,9 @@ - + - + NDDATA 5 @@ -302,9 +1768,9 @@ - + - + NSPARE 5 @@ -313,11 +1779,27 @@ - + + + + + + const char * + const char* fstypenames[] + [] + fstypenames + = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", "vinum", "raid", "?", "?", "?", "?", "jfs", NULL } + + + + + + + - + int int hdInit (struct device_node *dev) @@ -332,31 +1814,43 @@ - - device_node::devInfo - hdCmd - hdData - driveInfo::hdDev - driveInfo::hdEnable - hdHead - driveInfo::hdMask - driveInfo::hdMulti - driveInfo::hdPort - hdSecCount - driveInfo::hdSector - driveInfo::hdShift - driveInfo::hdSize - hdStat - device_interface::info - device_interface::initialized - inportByte - inportWord - kprintf - outportByte - device_interface::size - initHardDisk + + ATA_COMMAND + ATA_DATA + ATA_DRIVE + ATA_IDENTIFY + driveInfo::ata_identify + ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE + ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE + ATA_S_BUSY + ata_identify_data::command_set_enabled1 + device_node::devInfo + hdCmd + driveInfo::hdDev + driveInfo::hdEnable + hdHead + driveInfo::hdMask + driveInfo::hdMulti + driveInfo::hdPort + hdSecCount + driveInfo::hdShift + driveInfo::hdSize + device_interface::info + device_interface::initialized + inportByte + inportWord + kprintf + driveInfo::lba_high + driveInfo::lba_low + ata_identify_data::max_48bit_lba + outportByte + ata_identify_data::physical_logical_sector_info + driveInfo::sector_size + device_interface::size + ata_identify_data::total_num_sectors + ata_identify_data::words_per_logical_sector - + int int hdIoctl () @@ -367,12 +1861,11 @@ - - initHardDisk + - - void - void hdRead + + int + int hdRead (struct driveInfo *hdd, void *, uInt32, uInt32) hdRead @@ -383,10 +1876,10 @@ void * - uInt32 + uInt32 - uInt32 + uInt32 @@ -394,30 +1887,29 @@ - - driveInfo::hdCalc - hdCmd - hdCylHi - hdCylLow - hdData - driveInfo::hdDev - driveInfo::hdEnable - hdHead - driveInfo::hdMulti - driveInfo::hdPort - hdSecCount - hdSecNum - driveInfo::hdShift - hdStat - inportByte - inportWord - kprintf - outportByte - driveInfo::parOffset - x20 - initHardDisk + + driveInfo::hdCalc + hdCmd + hdCylHi + hdCylLow + hdData + driveInfo::hdDev + driveInfo::hdEnable + hdHead + driveInfo::hdMulti + driveInfo::hdPort + hdSecCount + hdSecNum + driveInfo::hdShift + hdStat + inportByte + inportWord + kprintf + driveInfo::lba_start + outportByte + driveInfo::parOffset - + int int hdReset () @@ -428,10 +1920,9 @@ - - initHardDisk + - + int int hdStandby () @@ -442,10 +1933,9 @@ - - initHardDisk + - + int int hdStart () @@ -456,10 +1946,9 @@ - - initHardDisk + - + int int hdStop () @@ -470,12 +1959,11 @@ - - initHardDisk + - - void - void hdWrite + + int + int hdWrite (struct driveInfo *hdd, void *, uInt32, uInt32) hdWrite @@ -486,10 +1974,10 @@ void * - uInt32 + uInt32 - uInt32 + uInt32 @@ -497,30 +1985,29 @@ - - driveInfo::hdCalc - hdCmd - hdCylHi - hdCylLow - hdData - driveInfo::hdDev - driveInfo::hdEnable - hdHead - driveInfo::hdMulti - driveInfo::hdPort - hdSecCount - hdSecNum - driveInfo::hdShift - hdStat - inportByte - kprintf - outportByte - outportWord - driveInfo::parOffset - x30 - initHardDisk + + driveInfo::hdCalc + hdCmd + hdCylHi + hdCylLow + hdData + driveInfo::hdDev + driveInfo::hdEnable + hdHead + driveInfo::hdMulti + driveInfo::hdPort + hdSecCount + hdSecNum + driveInfo::hdShift + hdStat + inportByte + kprintf + driveInfo::lba_start + outportByte + outportWord + driveInfo::parOffset - + int int initHardDisk () @@ -531,84 +2018,8 @@ - - bsd_disklabel::d_npartitions - bsd_disklabel::d_partitions - devfs_makeNode - device_add - dos_partition::dp_start - fstypenames - driveInfo::hdDev - hdInit - hdIoctl - driveInfo::hdPort - hdRead - hdReset - driveInfo::hdSize - hdStandby - hdStart - hdStop - hdWrite - device_interface::info - device_interface::init - device_interface::ioctl - kmalloc - kprintf - device_interface::major - memcpy - name - bsd_disklabel::partition::p_fstype - bsd_disklabel::partition::p_offset - bsd_disklabel::partition::p_size - driveInfo::parOffset - device_interface::read - device_interface::reset - sprintf - device_interface::standby - device_interface::start - device_interface::stop - device_interface::write - x1 - - - - - const char * - const char* fstypenames[] - [] - fstypenames - { - "unused", - "swap", - "Version 6", - "Version 7", - "System V", - "4.1BSD", - "Eighth Edition", - "4.2BSD", - "MSDOS", - "4.4LFS", - "unknown", - "HPFS", - "ISO9660", - "boot", - "vinum", - "raid", - "?", - "?", - "?", - "?", - "jfs", - NULL -} - - - - - - - - initHardDisk + + _initHardDisk @@ -616,232 +2027,488 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: hd_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_HD_H -#define_HD_H - -#include<ubixfs/ubixfs.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_PCI_HD_H_ +#define_PCI_HD_H_ + +#include<sys/types.h> +#include<ubixfs/ubixfs.h> -#definehdData0x0 -#definehdError0x1 -#definehdSecCount0x2 -#definehdSecNum0x3 -#definehdCylLow0x4 -#definehdCylHi0x5 -#definehdHead0x6 -#definehdStat0x7 -#definehdCmd0x7 - - -structdriveInfo{ -structdriveDiskLabel*diskLabel; -charhdSector[512]; -charhdEnable; -charhdDev; -charhdFlags; -charhdShift; -longhdMask; -longhdMulti; -longhdPort; -longhdSize; -longhdCalc; -longparOffset; -}; - -intinitHardDisk(); -voidhdWrite(structdriveInfo*hdd,void*,uInt32,uInt32); -voidhdRead(structdriveInfo*hdd,void*,uInt32,uInt32); -inthdReset(); -inthdIoctl(); -inthdStart(); -inthdStop(); -inthdStandby(); -inthdInit(structdevice_node*dev); - -structdos_partition{ -unsignedchardp_flag;/*bootstrapflags*/ -unsignedchardp_shd;/*startinghead*/ -unsignedchardp_ssect;/*startingsector*/ -unsignedchardp_scyl;/*startingcylinder*/ -unsignedchardp_type;/*partitiontype*/ -unsignedchardp_ehd;/*endhead*/ -unsignedchardp_esect;/*endsector*/ -unsignedchardp_ecyl;/*endcylinder*/ -uInt32dp_start;/*absolutestartingsectornumber*/ -uInt32dp_size;/*partitionsizeinsectors*/ -}; +#definehdData0x0 +#definehdError0x1 +#definehdSecCount0x2 +#definehdSecNum0x3 +#definehdCylLow0x4 +#definehdCylHi0x5 +#definehdHead0x6 +#definehdStat0x7 +#definehdCmd0x7 + +/*ATAUhm?*/ +#defineATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE0x0400 +#defineATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE0x0100 + +/*ATAregisterdefines*/ +#defineATA_DATA0/*(RW)data*/ + +#defineATA_FEATURE1/*(W)feature*/ +#defineATA_F_DMA0x01/*enableDMA*/ +#defineATA_F_OVL0x02/*enableoverlap*/ + +#defineATA_COUNT2/*(W)sectorcount*/ + +#defineATA_SECTOR3/*(RW)sector#*/ +#defineATA_CYL_LSB4/*(RW)cylinder#LSB*/ +#defineATA_CYL_MSB5/*(RW)cylinder#MSB*/ +#defineATA_DRIVE6/*(W)Sector/Drive/Head*/ +#defineATA_D_LBA0x40/*useLBAaddressing*/ +#defineATA_D_IBM0xa0/*512bytesectors,ECC*/ + +#defineATA_COMMAND7/*(W)command*/ + +#defineATA_ERROR8/*(R)error*/ +#defineATA_E_ILI0x01/*illegallength*/ +#defineATA_E_NM0x02/*nomedia*/ +#defineATA_E_ABORT0x04/*commandaborted*/ +#defineATA_E_MCR0x08/*mediachangerequest*/ +#defineATA_E_IDNF0x10/*IDnotfound*/ +#defineATA_E_MC0x20/*mediachanged*/ +#defineATA_E_UNC0x40/*uncorrectabledata*/ +#defineATA_E_ICRC0x80/*UDMAcrcerror*/ +#defineATA_E_ATAPI_SENSE_MASK0xf0/*ATAPIsensekeymask*/ + +#defineATA_IREASON9/*(R)interruptreason*/ +#defineATA_I_CMD0x01/*cmd(1)|data(0)*/ +#defineATA_I_IN0x02/*read(1)|write(0)*/ +#defineATA_I_RELEASE0x04/*releasedbus(1)*/ +#defineATA_I_TAGMASK0xf8/*tagmask*/ -#defineMAXPARTITIONS8 - -structbsd_disklabel{ -uint32_td_magic;/*themagicnumber*/ -u_int16_td_type;/*drivetype*/ -u_int16_td_subtype;/*controller/d_typespecific*/ -chard_typename[16];/*typename,e.g."eagle"*/ - -chard_packname[16];/*packidentifier*/ - -/*diskgeometry:*/ -uint32_td_secsize;/*#ofbytespersector*/ -uint32_td_nsectors;/*#ofdatasectorspertrack*/ -uint32_td_ntracks;/*#oftrackspercylinder*/ -uint32_td_ncylinders;/*#ofdatacylindersperunit*/ -uint32_td_secpercyl;/*#ofdatasectorspercylinder*/ -uint32_td_secperunit;/*#ofdatasectorsperunit*/ - -/* -*Spares(badsectorreplacements)belowarenotcountedin -*d_nsectorsord_secpercyl.Sparesectorsareassumedto -*bephysicalsectorswhichoccupyspaceattheendofeach -*trackand/orcylinder. -*/ -u_int16_td_sparespertrack;/*#ofsparesectorspertrack*/ -u_int16_td_sparespercyl;/*#ofsparesectorspercylinder*/ -/* -*Alternatecylindersincludemaintenance,replacement,configuration -*descriptionareas,etc. -*/ -uint32_td_acylinders;/*#ofalt.cylindersperunit*/ - -/*hardwarecharacteristics:*/ -/* -*d_interleave,d_trackskewandd_cylskewdescribeperturbations -*inthemediaformatusedtocompensateforaslowcontroller. -*Interleaveisphysicalsectorinterleave,setupbythe -*formatterorcontrollerwhenformatting.Wheninterleavingis -*inuse,logicallyadjacentsectorsarenotphysically -*contiguous,butinsteadareseparatedbysomenumberof -*sectors.Itisspecifiedastheratioofphysicalsectors -*traversedperlogicalsector.Thusaninterleaveof1:1 -*impliescontiguouslayout,while2:1impliesthatlogical -*sector0isseparatedbyonesectorfromlogicalsector1. -*d_trackskewistheoffsetofsector0ontrackNrelativeto -*sector0ontrackN-1onthesamecylinder.Finally,d_cylskew -*istheoffsetofsector0oncylinderNrelativetosector0 -*oncylinderN-1. -*/ -u_int16_td_rpm;/*rotationalspeed*/ -u_int16_td_interleave;/*hardwaresectorinterleave*/ -u_int16_td_trackskew;/*sector0skew,pertrack*/ -u_int16_td_cylskew;/*sector0skew,percylinder*/ -uint32_td_headswitch;/*headswitchtime,usec*/ -uint32_td_trkseek;/*track-to-trackseek,usec*/ -uint32_td_flags;/*genericflags*/ -#defineNDDATA5 -uint32_td_drivedata[NDDATA];/*drive-typespecificinformation*/ -#defineNSPARE5 -uint32_td_spare[NSPARE];/*reservedforfutureuse*/ -uint32_td_magic2;/*themagicnumber(again)*/ -u_int16_td_checksum;/*xorofdataincl.partitions*/ - -/*filesystemandpartitioninformation:*/ -u_int16_td_npartitions;/*numberofpartitionsinfollowing*/ -uint32_td_bbsize;/*sizeofbootareaatsn0,bytes*/ -uint32_td_sbsize;/*maxsizeoffssuperblock,bytes*/ -structpartition{/*thepartitiontable*/ -uint32_tp_size;/*numberofsectorsinpartition*/ -uint32_tp_offset;/*startingsector*/ -uint32_tp_fsize;/*filesystembasicfragmentsize*/ -u_int8_tp_fstype;/*filesystemtype,seebelow*/ -u_int8_tp_frag;/*filesystemfragmentsperblock*/ -u_int16_tp_cpg;/*filesystemcylinderspergroup*/ -}d_partitions[MAXPARTITIONS];/*actuallymaybemore*/ -}; - -staticconstchar*fstypenames[]={ -"unused", -"swap", -"Version6", -"Version7", -"SystemV", -"4.1BSD", -"EighthEdition", -"4.2BSD", -"MSDOS", -"4.4LFS", -"unknown", -"HPFS", -"ISO9660", -"boot", -"vinum", -"raid", -"?", -"?", -"?", -"?", -"jfs", -NULL -}; - -#endif - -/*** -$Log: hd_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.22006/10/0902:58:05reddawg -FixingUFS - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:50reddawg -nomessage - -Revision1.72004/08/1500:33:02reddawg -Wowtheidedriverworksagain - -Revision1.62004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.52004/05/2115:05:07reddawg -Cleanedup - - -END -***/ +#defineATA_STATUS10/*(R)status*/ +#defineATA_ALTSTAT11/*(R)alternatestatus*/ +#defineATA_S_ERROR0x01/*error*/ +#defineATA_S_INDEX0x02/*index*/ +#defineATA_S_CORR0x04/*datacorrected*/ +#defineATA_S_DRQ0x08/*datarequest*/ +#defineATA_S_DSC0x10/*driveseekcompleted*/ +#defineATA_S_SERVICE0x10/*driveneedsservice*/ +#defineATA_S_DWF0x20/*drivewritefault*/ +#defineATA_S_DMA0x20/*DMAready*/ +#defineATA_S_READY0x40/*driveready*/ +#defineATA_S_BUSY0x80/*busy*/ + +#defineATA_CONTROL12/*(W)control*/ + +#defineATA_CTLOFFSET0x206/*controlregisteroffset*/ +#defineATA_PCCARD_CTLOFFSET0x0e/*doforPCCARDdevices*/ +#defineATA_PC98_CTLOFFSET0x10c/*doforPC98devices*/ +#defineATA_A_IDS0x02/*disableinterrupts*/ +#defineATA_A_RESET0x04/*RESETcontroller*/ +#ifdefATA_LEGACY_SUPPORT +#defineATA_A_4BIT0x08/*4headbits:obsolete1996*/ +#else +#defineATA_A_4BIT0x00 +#endif +#defineATA_A_HOB0x80/*HighOrderByteenable*/ + +/*ATACommands*/ +#defineATA_IDENTIFY0xEC +#defineATA_CHECK_POWER_MODE0xE5 +#defineATA_STANDBY0xE2 +#defineATA_STANDBY_IMMED0xE0 +#defineATA_IDLE_IMMED0xE1 +#defineATA_IDLE0xE3 +#defineATA_FLUSH_CACHE0xE7 +#defineATA_FLUSH_CACHE_EXT0xEA +#defineATA_READ_DMA_EXT0x25 +#defineATA_READ_DMA0xC8 +#defineATA_READ_SECTORS_EXT0x24 +#defineATA_READ_SECTORS0x20 +#defineATA_WRITE_DMA_EXT0x35 +#defineATA_WRITE_DMA0xCA +#defineATA_WRITE_SECTORS_EXT0x34 +#defineATA_WRITE_SECTORS0x30 +#defineATA_WRITE_UNCORRECTABLE0x45 +#defineATA_READ_VERIFY_SECTORS0x40 +#defineATA_READ_VERIFY_SECTORS_EXT0x42 +#defineATA_READ_BUFFER0xE4 +#defineATA_WRITE_BUFFER0xE8 +#defineATA_EXECUTE_DEVICE_DIAG0x90 +#defineATA_SET_FEATURES0xEF +#defineATA_SMART0xB0 +#defineATA_PACKET_IDENTIFY0xA1 +#defineATA_PACKET0xA0 +#defineATA_READ_FPDMA0x60 +#defineATA_WRITE_FPDMA0x61 +#defineATA_READ_LOG_EXT0x2F +#defineATA_NOP0x00 +#defineATA_DEVICE_RESET0x08 +#defineATA_MEDIA_EJECT0xED +#defineATA_SECURITY_UNLOCK0xF2 +#defineATA_SECURITY_FREEZE_LOCK0xF5 +#defineATA_DATA_SET_MANAGEMENT0x06 +#defineATA_DOWNLOAD_MICROCODE0x92 +#defineATA_WRITE_STREAM_DMA_EXT0x3A +#defineATA_READ_LOG_DMA_EXT0x47 +#defineATA_READ_STREAM_DMA_EXT0x2A +#defineATA_WRITE_DMA_FUA0x3D +#defineATA_WRITE_LOG_DMA_EXT0x57 +#defineATA_READ_DMA_QUEUED0xC7 +#defineATA_READ_DMA_QUEUED_EXT0x26 +#defineATA_WRITE_DMA_QUEUED0xCC +#defineATA_WRITE_DMA_QUEUED_EXT0x36 +#defineATA_WRITE_DMA_QUEUED_FUA_EXT0x3E +#defineATA_READ_MULTIPLE0xC4 +#defineATA_READ_MULTIPLE_EXT0x29 +#defineATA_WRITE_MULTIPLE0xC5 +#defineATA_WRITE_MULTIPLE_EXT0x39 +#defineATA_WRITE_MULTIPLE_FUA_EXT0xCE + +structdriveInfo{ +structdriveDiskLabel*diskLabel; +structata_identify_data*ata_identify; +uint32_tlba_high; +uint32_tlba_low; +uint32_tsector_size; +charhdEnable; +charhdDev; +charhdFlags; +charhdShift; +longhdMask; +uint32_thdMulti; +longhdPort; +longhdSize; +longhdCalc; +longparOffset; +intpart; +longlba_start; +longlba_end; +}; + +intinitHardDisk(); +inthdWrite(structdriveInfo*hdd,void*,uInt32,uInt32); +inthdRead(structdriveInfo*hdd,void*,uInt32,uInt32); +inthdReset(); +inthdIoctl(); +inthdStart(); +inthdStop(); +inthdStandby(); +inthdInit(structdevice_node*dev); + +structdos_partition{ +unsignedchardp_flag;/*bootstrapflags*/ +unsignedchardp_shd;/*startinghead*/ +unsignedchardp_ssect;/*startingsector*/ +unsignedchardp_scyl;/*startingcylinder*/ +unsignedchardp_type;/*partitiontype*/ +unsignedchardp_ehd;/*endhead*/ +unsignedchardp_esect;/*endsector*/ +unsignedchardp_ecyl;/*endcylinder*/ +uInt32dp_start;/*absolutestartingsectornumber*/ +uInt32dp_size;/*partitionsizeinsectors*/ +}; + +#defineMAXPARTITIONS8 + +structbsd_disklabel{ +uint32_td_magic;/*themagicnumber*/ +u_int16_td_type;/*drivetype*/ +u_int16_td_subtype;/*controller/d_typespecific*/ +chard_typename[16];/*typename,e.g."eagle"*/ + +chard_packname[16];/*packidentifier*/ + +/*diskgeometry:*/ +uint32_td_secsize;/*#ofbytespersector*/ +uint32_td_nsectors;/*#ofdatasectorspertrack*/ +uint32_td_ntracks;/*#oftrackspercylinder*/ +uint32_td_ncylinders;/*#ofdatacylindersperunit*/ +uint32_td_secpercyl;/*#ofdatasectorspercylinder*/ +uint32_td_secperunit;/*#ofdatasectorsperunit*/ + +/* +*Spares(badsectorreplacements)belowarenotcountedin +*d_nsectorsord_secpercyl.Sparesectorsareassumedto +*bephysicalsectorswhichoccupyspaceattheendofeach +*trackand/orcylinder. +*/ +u_int16_td_sparespertrack;/*#ofsparesectorspertrack*/ +u_int16_td_sparespercyl;/*#ofsparesectorspercylinder*/ +/* +*Alternatecylindersincludemaintenance,replacement,configuration +*descriptionareas,etc. +*/ +uint32_td_acylinders;/*#ofalt.cylindersperunit*/ + +/*hardwarecharacteristics:*/ +/* +*d_interleave,d_trackskewandd_cylskewdescribeperturbations +*inthemediaformatusedtocompensateforaslowcontroller. +*Interleaveisphysicalsectorinterleave,setupbythe +*formatterorcontrollerwhenformatting.Wheninterleavingis +*inuse,logicallyadjacentsectorsarenotphysically +*contiguous,butinsteadareseparatedbysomenumberof +*sectors.Itisspecifiedastheratioofphysicalsectors +*traversedperlogicalsector.Thusaninterleaveof1:1 +*impliescontiguouslayout,while2:1impliesthatlogical +*sector0isseparatedbyonesectorfromlogicalsector1. +*d_trackskewistheoffsetofsector0ontrackNrelativeto +*sector0ontrackN-1onthesamecylinder.Finally,d_cylskew +*istheoffsetofsector0oncylinderNrelativetosector0 +*oncylinderN-1. +*/ +u_int16_td_rpm;/*rotationalspeed*/ +u_int16_td_interleave;/*hardwaresectorinterleave*/ +u_int16_td_trackskew;/*sector0skew,pertrack*/ +u_int16_td_cylskew;/*sector0skew,percylinder*/ +uint32_td_headswitch;/*headswitchtime,usec*/ +uint32_td_trkseek;/*track-to-trackseek,usec*/ +uint32_td_flags;/*genericflags*/ +#defineNDDATA5 +uint32_td_drivedata[NDDATA];/*drive-typespecificinformation*/ +#defineNSPARE5 +uint32_td_spare[NSPARE];/*reservedforfutureuse*/ +uint32_td_magic2;/*themagicnumber(again)*/ +u_int16_td_checksum;/*xorofdataincl.partitions*/ + +/*filesystemandpartitioninformation:*/ +u_int16_td_npartitions;/*numberofpartitionsinfollowing*/ +uint32_td_bbsize;/*sizeofbootareaatsn0,bytes*/ +uint32_td_sbsize;/*maxsizeoffssuperblock,bytes*/ +structpartition{/*thepartitiontable*/ +uint32_tp_size;/*numberofsectorsinpartition*/ +uint32_tp_offset;/*startingsector*/ +uint32_tp_fsize;/*filesystembasicfragmentsize*/ +u_int8_tp_fstype;/*filesystemtype,seebelow*/ +u_int8_tp_frag;/*filesystemfragmentsperblock*/ +u_int16_tp_cpg;/*filesystemcylinderspergroup*/ +}d_partitions[MAXPARTITIONS];/*actuallymaybemore*/ +}; + +staticconstchar*fstypenames[]={"unused","swap","Version6","Version7","SystemV","4.1BSD","EighthEdition","4.2BSD","MSDOS","4.4LFS","unknown","HPFS","ISO9660","boot","vinum","raid","?","?","?","?","jfs",NULL}; + +#defineATA_IDENTIFY_SERIAL_NUMBER_LEN20 +#defineATA_IDENTIFY_MODEL_NUMBER_LEN40 +#defineATA_IDENTIFY_FW_REVISION_LEN8 +#defineATA_IDENTIFY_48_LBA_LEN8 +#defineATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN30 +#defineATA_IDENTIFY_WWN_LEN8 + +structata_identify_data{ +u_int16_tgeneral_config_bits;//word00 +u_int16_tobsolete0;//word01(numcylinders) +u_int16_tvendor_specific_config_bits;//word02 +u_int16_tobsolete1;//word03(numheads) +u_int16_tretired1[2];//words04-05 +u_int16_tobsolete2;//word06(sectors/track) +u_int16_treserved_for_compact_flash1[2];//words07-08 +u_int16_tretired0;//word09 +u_int8_tserial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN];//word10-19 +u_int16_tretired2[2];//words20-21 +u_int16_tobsolete4;//word22 +u_int8_tfirmware_revision[ATA_IDENTIFY_FW_REVISION_LEN];//words23-26 +u_int8_tmodel_number[ATA_IDENTIFY_MODEL_NUMBER_LEN];//words27-46 +u_int16_tmax_sectors_per_multiple;//word47 +u_int16_treserved0;//word48 +u_int16_tcapabilities1;//word49 +u_int16_tcapabilities2;//word50 +u_int16_tobsolete5[2];//words51-52 +u_int16_tvalidity_bits;//word53 +u_int16_tobsolete6[5];//words54-58Usedtobe: +//currentcylinders, +//currentheads, +//currentsectors/Track, +//currentcapacity +u_int16_tcurrent_max_sectors_per_multiple;//word59 +u_int8_ttotal_num_sectors[4];//words60-61 +u_int16_tobsolete7;//word62 +u_int16_tmulti_word_dma_mode;//word63 +u_int16_tpio_modes_supported;//word64 +u_int16_tmin_multiword_dma_transfer_cycle;//word65 +u_int16_trec_min_multiword_dma_transfer_cycle;//word66 +u_int16_tmin_pio_transfer_no_flow_ctrl;//word67 +u_int16_tmin_pio_transfer_with_flow_ctrl;//word68 +u_int16_tadditional_supported;//word69 +u_int16_treserved1;//word70 +u_int16_treserved2[4];//words71-74 +u_int16_tqueue_depth;//word75 +u_int16_tserial_ata_capabilities;//word76 +u_int16_tserial_ata_reserved;//word77 +u_int16_tserial_ata_features_supported;//word78 +u_int16_tserial_ata_features_enabled;//word79 +u_int16_tmajor_version_number;//word80 +u_int16_tminor_version_number;//word81 +u_int16_tcommand_set_supported0;//word82 +u_int16_tcommand_set_supported1;//word83 +u_int16_tcommand_set_supported_extention;//word84 +u_int16_tcommand_set_enabled0;//word85 +u_int16_tcommand_set_enabled1;//word86 +u_int16_tcommand_set_default;//word87 +u_int16_tultra_dma_mode;//word88 +u_int16_tsecurity_erase_completion_time;//word89 +u_int16_tenhanced_security_erase_time;//word90 +u_int16_tcurrent_power_mgmt_value;//word91 +u_int16_tmaster_password_revision;//word92 +u_int16_thardware_reset_result;//word93 +u_int16_tcurrent_acoustic_management_value;//word94 +u_int16_tstream_min_request_size;//word95 +u_int16_tstream_transfer_time;//word96 +u_int16_tstream_access_latency;//word97 +u_int16_tstream_performance_granularity[2];//words98-99 +u_int8_tmax_48bit_lba[ATA_IDENTIFY_48_LBA_LEN];//words100-103 +u_int16_tstreaming_transfer_time;//word104 +u_int16_tmax_lba_range_entry_blocks;//word105 +u_int16_tphysical_logical_sector_info;//word106 +u_int16_tacoustic_test_interseek_delay;//word107 +u_int8_tworld_wide_name[ATA_IDENTIFY_WWN_LEN];//words108-111 +u_int8_treserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN];//words112-115 +u_int16_treserved4;//word116 +u_int8_twords_per_logical_sector[4];//words117-118 +u_int16_tcommand_set_supported2;//word119 +u_int16_treserved5[7];//words120-126 +u_int16_tremovable_media_status;//word127 +u_int16_tsecurity_status;//word128 +u_int16_tvendor_specific1[31];//words129-159 +u_int16_tcfa_power_mode1;//word160 +u_int16_treserved_for_compact_flash2[7];//words161-167 +u_int16_tdevice_nominal_form_factor;//word168 +u_int16_tdata_set_management;//word169 +u_int16_treserved_for_compact_flash3[6];//words170-175 +u_int16_tcurrent_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN];//words176-205 +u_int16_treserved6[3];//words206-208 +u_int16_tlogical_sector_alignment;//words209 +u_int16_treserved7[7];//words210-216 +u_int16_tnominal_media_rotation_rate;//word217 +u_int16_treserved8[16];//words218-233 +u_int16_tmin_num_blocks_per_microcode;//word234 +u_int16_tmax_num_blocks_per_microcode;//word235 +u_int16_treserved9[19];//words236-254 +u_int16_tintegrity_word;//word255 +}; + +/* +*Alistofpartitiontypes,probablyoutdated. +*/ +staticconstchar*constpart_types[256]={ +[0x00]="unused", +[0x01]="PrimaryDOSwith12bitFAT", +[0x02]="XENIX/filesystem", +[0x03]="XENIX/usrfilesystem", +[0x04]="PrimaryDOSwith16bitFAT(<32MB)", +[0x05]="ExtendedDOS", +[0x06]="PrimaryDOS,16bitFAT(>=32MB)", +[0x07]="NTFS,OS/2HPFS,QNX-2(16bit)orAdvancedUNIX", +[0x08]="AIXfilesystemorSplitDrive", +[0x09]="AIXbootpartitionorCoherent", +[0x0A]="OS/2BootManager,OPUSorCoherentswap", +[0x0B]="DOSorWindows95with32bitFAT", +[0x0C]="DOSorWindows95with32bitFAT(LBA)", +[0x0E]="Primary'big'DOS(>=32MB,LBA)", +[0x0F]="ExtendedDOS(LBA)", +[0x10]="OPUS", +[0x11]="OS/2BM:hiddenDOSwith12-bitFAT", +[0x12]="Compaqdiagnostics", +[0x14]="OS/2BM:hiddenDOSwith16-bitFAT(<32MB)", +[0x16]="OS/2BM:hiddenDOSwith16-bitFAT(>=32MB)", +[0x17]="OS/2BM:hiddenIFS(e.g.HPFS)", +[0x18]="ASTWindowsswapfile", +[0x1b]="ASUSRecoverypartition(NTFS)", +[0x24]="NECDOS", +[0x3C]="PartitionMagicrecovery", +[0x39]="plan9", +[0x40]="VENIX286", +[0x41]="Linux/MINIX(sharingdiskwithDRDOS)", +[0x42]="SFSorLinuxswap(sharingdiskwithDRDOS)", +[0x43]="Linuxnative(sharingdiskwithDRDOS)", +[0x4D]="QNX4.2Primary", +[0x4E]="QNX4.2Secondary", +[0x4F]="QNX4.2Tertiary", +[0x50]="DM(diskmanager)", +[0x51]="DM6Aux1(orNovell)", +[0x52]="CP/MorMicroportSysV/AT", +[0x53]="DM6Aux3", +[0x54]="DM6", +[0x55]="EZ-Drive(diskmanager)", +[0x56]="GoldenBow(diskmanager)", +[0x5c]="PriamEdisk(diskmanager)",/*accordingtoS.Widlake*/ +[0x61]="SpeedStor", +[0x63]="SystemV/386(suchasISCUNIX),GNUHURDorMach", +[0x64]="NovellNetware/2862.xx", +[0x65]="NovellNetware/3863.xx", +[0x70]="DiskSecureMulti-Boot", +[0x75]="PCIX", +[0x77]="QNX4.x", +[0x78]="QNX4.x2ndpart", +[0x79]="QNX4.x3rdpart", +[0x80]="Minixuntil1.4a", +[0x81]="Minixsince1.4b,earlyLinuxpartitionorMitacdiskmanager", +[0x82]="LinuxswaporSolarisx86", +[0x83]="Linuxnative", +[0x84]="OS/2hiddenC:drive", +[0x85]="Linuxextended", +[0x86]="NTFSvolumeset??", +[0x87]="NTFSvolumeset??", +[0x93]="Amoebafilesystem", +[0x94]="Amoebabadblocktable", +[0x9F]="BSD/OS", +[0xA0]="SuspendtoDisk", +[0xA5]="FreeBSD/NetBSD/386BSD", +[0xA6]="OpenBSD", +[0xA7]="NeXTSTEP", +[0xA9]="NetBSD", +[0xAC]="IBMJFS", +[0xAF]="HFS+", +[0xB7]="BSDIBSD/386filesystem", +[0xB8]="BSDIBSD/386swap", +[0xBE]="Solarisx86boot", +[0xBF]="Solarisx86(new)", +[0xC1]="DRDOS/secwith12-bitFAT", +[0xC4]="DRDOS/secwith16-bitFAT(<32MB)", +[0xC6]="DRDOS/secwith16-bitFAT(>=32MB)", +[0xC7]="Syrinx", +[0xDB]="CP/M,ConcurrentCP/M,ConcurrentDOSorCTOS", +[0xDE]="DELLUtilities-FATfilesystem", +[0xE1]="DOSaccessorSpeedStorwith12-bitFATextendedpartition", +[0xE3]="DOSR/OorSpeedStor", +[0xE4]="SpeedStorwith16-bitFATextendedpartition<1024cyl.", +[0xEB]="BeOSfilesystem", +[0xEE]="EFIGPT", +[0xEF]="EFISystemPartition", +[0xF1]="SpeedStor", +[0xF2]="DOS3.3+Secondary", +[0xF4]="SpeedStorlargepartition", +[0xFB]="VMwareVMFS", +[0xFE]="SpeedStor>1024cyl.orLANstep", +[0xFF]="Xenixbadblockstable",}; + +#endif - +
diff --git a/doc/xml/idt_8c.xml b/doc/xml/idt_8c.xml index 77ba41f..7e8a4fb 100644 --- a/doc/xml/idt_8c.xml +++ b/doc/xml/idt_8c.xml @@ -1,7 +1,9 @@ - - - + + + idt.c + ubixos/syscall.h + ubixos/syscall_posix.h sys/idt.h sys/gdt.h sys/io.h @@ -10,252 +12,709 @@ lib/kprintf.h lib/kmalloc.h vmm/vmm.h - ubixos/syscall.h ubixos/kpanic.h ubixos/endtask.h string.h + sys/trap.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + FP_TO_LINEAR seg off - ((void*) ((((uInt16) (seg)) << 4) + ((uInt16) (off)))) + ((void*) ((((uint16_t) (seg)) << 4) + ((uint16_t) (off)))) - - _int13 + + + + + + uint32_t + uint32_t gpfStack + + gpfStack + = 0x0 + + + + + + + + + + struct @30 + struct @30 loadidt + + loadidt + = { (256 * sizeof(union descriptorTableUnion) - 1), ubixIDT } + + + + + + + - + void - void _int0 - () - _int0 + void __alignmentCheck + (struct trapframe *) + __alignmentCheck + + struct trapframe * + frame + - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield - + void - void _int1 - () - _int1 + void __debug + (struct trapframe *) + __debug + + struct trapframe * + frame + - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield - + void - void _int10 + void __divideError + (struct trapframe *) + __divideError + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __doubleFault + (struct trapframe *) + __doubleFault + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __floatingPoint + (struct trapframe *) + __floatingPoint + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __gpf + (struct trapframe *) + __gpf + + struct trapframe * + frame + + + + + + + + + + + void + void __int6 + (struct trapframe *frame) + __int6 + + struct trapframe * + frame + + + + + + + + + + + void + void __machineCheck + (struct trapframe *) + __machineCheck + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __nmi + (struct trapframe *) + __nmi + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __security + (struct trapframe *) + __security + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __simd + (struct trapframe *) + __simd + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void __virtualization + (struct trapframe *) + __virtualization + + struct trapframe * + frame + + + + + + + + + _current + die_if_kernel + endTask + taskStruct::id + sched_yield + + + void + void _alignmentCheck + () + _alignmentCheck + + + + + + + + + + void + void _debug + () + _debug + + + + + + + + + + void + void _divideError + () + _divideError + + + + + + + + + + void + void _doubleFault + () + _doubleFault + + + + + + + + + + void + void _floatingPoint + () + _floatingPoint + + + + + + + + + + void + void _gpf + () + _gpf + + + + + + + + + + void + static void _int10 () _int10 @@ -264,17 +723,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int11 + static void _int11 () _int11 @@ -283,17 +736,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int12 + static void _int12 () _int12 @@ -302,81 +749,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int13 - () - _int13 - - - - - - - - _current - _int13 - tssStruct::cs - DEAD - tssStruct::eax - tssStruct::ebp - tssStruct::edx - EFLAG_IF - EFLAG_VM - tssStruct::eflags - tssStruct::eip - tssStruct::esp - FALSE - FP_TO_LINEAR - taskStruct::id - inportByte - inportWord - irqDisable - irqEnable - kpanic - kprintf - taskStruct::oInfo - outportByte - outportWord - tssStruct::ss - taskStruct::state - osInfo::timer - TRUE - taskStruct::tss - osInfo::v86If - _int13 - idt_init - - - void - void _int2 - () - _int2 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int3 + static void _int3 () _int3 @@ -385,17 +762,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int4 + static void _int4 () _int4 @@ -404,17 +775,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int5 + static void _int5 () _int5 @@ -423,17 +788,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int6 + static void _int6 () _int6 @@ -442,17 +801,11 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - + void - void _int7 + static void _int7 () _int7 @@ -461,43 +814,11 @@ - + - + void - void _int8 - () - _int8 - - - - - - - - _current - _int8 - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::ebp - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esp - tssStruct::fs - tssStruct::gs - taskStruct::id - tssStruct::io_map - kernelPageDirectory - kpanic - tssStruct::ss - _int8 - idt_init - - - void - void _int9 + static void _int9 () _int9 @@ -506,29 +827,16 @@ - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init + - - - asm - (".globl _int7 \n""_int7: \n"" pushl %eax \n"" clts \n"" movl _current,%eax \n"" cmpl _usedMath,%eax \n"" je mathDone \n"" call mathStateRestore \n""mathDone: \n"" popl %eax \n"" iret \n") - asm + + void + void _intNull + (struct trapframe *frame) + _intNull - ".globl _int7 \n""_int7: \n"" pushl %eax \n"" clts \n"" movl - _current - - - %eax\n""cmpl - _usedMath - - - %eax\n""je mathDone\n""call mathStateRestore\n""mathDone:\n""popl%eax\n""iret\n" + struct trapframe * + frame @@ -536,9 +844,315 @@ - + + die_if_kernel - + + void + void _machineCheck + () + _machineCheck + + + + + + + + + + void + void _nmi + () + _nmi + + + + + + + + + + void + void _security + () + _security + + + + + + + + + + void + void _simd + () + _simd + + + + + + + + + + void + void _virtualization + () + _virtualization + + + + + + + + + + + asm + (".globl _alignmentCheck \n" "_alignmentCheck: \n" " pushl $0x11 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __alignmentCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _alignmentCheck \n" "_alignmentCheck: \n" " pushl $0x11 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __alignmentCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _debug \n" "_debug: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _debug \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _debug \n" "_debug: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _debug \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _divideError \n" "_divideError: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _divideError \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _divideError \n" "_divideError: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _divideError \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _doubleFault \n" "_doubleFault: \n" " pushl $0x8 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __doubleFault \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _doubleFault \n" "_doubleFault: \n" " pushl $0x8 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __doubleFault \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _floatingPoint \n" "_floatingPoint: \n" " pushl $0x0 \n" " pushl $0x10 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __floatingPoint \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _floatingPoint \n" "_floatingPoint: \n" " pushl $0x0 \n" " pushl $0x10 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __floatingPoint \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _gpf \n" "_gpf: \n" " cli \n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __gpf \n" " add $0x4,%esp \n" " mov %esp,%eax \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " sti \n" " iret \n") + asm + + ".globl _gpf \n" "_gpf: \n" " cli \n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __gpf \n" " add + $0x4 + + + %esp \n" " mov % + esp + + + %eax \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " sti \n" " iret \n" + + + + + + + + + + + + asm + (".globl _int6 \n" "_int6: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __int6 \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _int6 \n" "_int6: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __int6 \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _int7 \n" "_int7: \n" " pushl %eax \n" " clts \n" " movl _current,%eax \n" " cmpl _usedMath,%eax \n" " je mathDone \n" " call mathStateRestore \n" "mathDone: \n" " popl %eax \n" " iret \n") + asm + + ".globl _int7 \n" "_int7: \n" " pushl %eax \n" " clts \n" " movl + _current + + + %eax \n" " cmpl + _usedMath + + + %eax \n" " je mathDone \n" " call mathStateRestore \n" "mathDone:\n" " popl %eax \n" " iret \n" + + + + + + + + + + + + asm + (".globl _machineCheck \n" "_machineCheck: \n" " pushl $0x0\n" " pushl $0x12 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __machineCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _machineCheck \n" "_machineCheck: \n" " pushl $0x0\n" " pushl $0x12 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __machineCheck \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _nmi \n" "_nmi: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _nmi \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _nmi \n" "_nmi: \n" " pushl $0x0 \n" " pushl $0x6 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _nmi \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _security \n" "_security: \n" " pushl $0x1E \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __security\n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _security \n" "_security: \n" " pushl $0x1E \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __security\n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _simd \n" "_simd: \n" " iret\n" " pushl $0x0\n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __simd \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _simd \n" "_simd: \n" " iret\n" " pushl $0x0\n" " pushl $0x13 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __simd \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl _virtualization \n" "_virtualization: \n" " pushl $0x0 \n" " pushl $0x14 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __virtualization \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl _virtualization \n" "_virtualization: \n" " pushl $0x0 \n" " pushl $0x14 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call __virtualization \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + + + asm + (".globl intNull \n" "intNull: \n" " pushl $0x0 \n" " pushl $0x0 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _intNull \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n") + asm + + ".globl intNull \n" "intNull: \n" " pushl $0x0 \n" " pushl $0x0 \n" " pushal \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " push %esp \n" " call _intNull \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " popal \n" " iret \n" + + + + + + + + + + int int idt_init () @@ -549,63 +1163,9 @@ - - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int7 - _int8 - _int9 - _sysCall - _sysCall_new - _vmm_pageFault - tssStruct::back_link - tssStruct::cr3 - tssStruct::cs - dDpl0 - dDpl3 - dInt - dPresent - tssStruct::ds - dTask - dTrap - tssStruct::ebp - tssStruct::edi - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - tssStruct::fs - tssStruct::gs - intNull - tssStruct::io_map - kernelPageDirectory - kprintf - tssStruct::ldt - loadidt - memset - setTaskVector - setVector - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - timerInt - tssStruct::trace_bitmap + - + void void intNull () @@ -616,13 +1176,9 @@ - - _current - taskStruct::id - kprintf - idt_init + - + void void mathStateRestore () @@ -633,27 +1189,27 @@ - - _current - _usedMath - taskStruct::i387 - taskStruct::usedMath + + _current + _usedMath + taskStruct::i387 + taskStruct::usedMath - + void void setTaskVector (uInt8 interrupt, uInt16 controlMajor, uInt8 selector) setTaskVector - uInt8 + uInt8 interrupt - uInt16 + uInt16 controlMajor - uInt8 + uInt8 selector @@ -662,15 +1218,10 @@ - - gdtGate::access - descriptorTableUnion::gate - gdtGate::offsetHigh - gdtGate::offsetLow - gdtGate::selector - idt_init + + selector - + void void setVector (void *handler, unsigned char interrupt, unsigned short controlMajor) @@ -693,20 +1244,12 @@ - - gdtGate::access - descriptorTableUnion::gate - gdtGate::offsetHigh - gdtGate::offsetLow - gdtGate::selector - atkbd_init - fdc_init - idt_init - initLNC - mouseInit - ne2k_init + + atkbd_init + fdc_init + initLNC - + static static ubixDescriptorTable (ubixIDT, 256) @@ -723,23 +1266,7 @@ - - - - - - struct @8 - struct @8 loadidt - - loadidt - - - - - - - - idt_init + @@ -747,473 +1274,810 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: idt_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<sys/idt.h> -#include<sys/gdt.h> -#include<sys/io.h> -#include<ubixos/sched.h> -#include<isa/8259.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<vmm/vmm.h> -#include<ubixos/syscall.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/syscall.h> +#include<ubixos/syscall_posix.h> +#include<sys/idt.h> +#include<sys/gdt.h> +#include<sys/io.h> +#include<ubixos/sched.h> +#include<isa/8259.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<vmm/vmm.h> #include<ubixos/kpanic.h> #include<ubixos/endtask.h> #include<string.h> - -#defineFP_TO_LINEAR(seg,off)((void*)((((uInt16)(seg))<<4)+((uInt16)(off)))) - -staticubixDescriptorTable(ubixIDT,256){}; - -staticstruct{ -unsignedshortlimit__attribute__((packed)); -uniondescriptorTableUnion*idt__attribute__((packed)); -}loadidt={ -(256*sizeof(uniondescriptorTableUnion)-1),ubixIDT -}; - -/************************************************************************ - -Function:intidtInit() -Description:ThisfunctionisusedtoenableourIDTsubsystem -Notes: - -02/20/2004-Approvedforquality - -************************************************************************/ -intidt_init(){ -inti=0x0; - -structtssStruct*sfTSS=(structtssStruct*)0x6200; -structtssStruct*gpfTSS=(structtssStruct*)0x4200; - -/*Setupdefaultvectortableforallpossible256interrupts*/ - -for(i=0x0;i<256;i++){ -setVector(intNull,i,dPresent+dInt+dDpl3); -} - -/*LoadtheIDTintothesystem*/ -asmvolatile( -"cli\n" -"lidt(%0)\n"/*LoadtheIDT*/ -"pushfl\n"/*CleartheNTflag*/ -"andl$0xffffbfff,(%%esp)\n" -"popfl\n" -"sti\n" -: -:"r"((char*)&loadidt) -); - -/*Setupthebasicvectorsforthereservedints*/ -setVector(_int0,0,dPresent+dInt+dDpl0); -setVector(_int1,1,dPresent+dInt+dDpl0); -setVector(_int2,2,dPresent+dInt+dDpl0); -setVector(_int3,3,dPresent+dInt+dDpl0); -setVector(_int4,4,dPresent+dInt+dDpl0); -setVector(_int5,5,dPresent+dInt+dDpl0); -setVector(_int6,6,dPresent+dInt+dDpl0); -setVector(_int7,7,dPresent+dInt+dDpl0); -setTaskVector(8,dPresent+dTask+dDpl0,0x40); -setVector(_int9,9,dPresent+dInt+dDpl0); -setVector(_int10,10,dPresent+dInt+dDpl0); -setVector(_int11,11,dPresent+dInt+dDpl0); -setVector(_int12,12,dPresent+dInt+dDpl0); -setTaskVector(13,dPresent+dTask+dDpl0,0x38); -setVector(_vmm_pageFault,14,dPresent+dInt+dDpl0); -setVector(_sysCall,128,dPresent+dTrap+dDpl3); -setVector(_sysCall_new,0x81,dPresent+dTrap+dDpl3); -//setVector(_sysCallNew,0x90,dPresent+dTrap+dDpl3); -setVector(timerInt,0x68,(dInt+dPresent+dDpl0)); - - -gpfTSS->back_link=0x0; -gpfTSS->esp0=0x0; -gpfTSS->ss0=0x0; -gpfTSS->esp1=0x0; -gpfTSS->ss1=0x0; -gpfTSS->esp2=0x0; -gpfTSS->ss2=0x0; -gpfTSS->cr3=(unsignedint)kernelPageDirectory; -gpfTSS->eip=(unsignedint)&_int13; -gpfTSS->eflags=0x206; -gpfTSS->esp=0x1D000; -gpfTSS->ebp=0x1D000; -gpfTSS->esi=0x0; -gpfTSS->edi=0x0; -gpfTSS->es=0x10; -gpfTSS->cs=0x08; -gpfTSS->ss=0x10; -gpfTSS->ds=0x10; -gpfTSS->fs=0x10; -gpfTSS->gs=0x10; -gpfTSS->ldt=0x0; -gpfTSS->trace_bitmap=0x0000; -gpfTSS->io_map=0x8000; - -memset(sfTSS,0x0,sizeof(structtssStruct)); -sfTSS->cr3=(unsignedint)kernelPageDirectory; -sfTSS->eip=(unsignedint)&_int8; -sfTSS->eflags=0x206; -sfTSS->esp=0x1C000; -sfTSS->ebp=0x1C000; -sfTSS->es=0x10; -sfTSS->cs=0x08; -sfTSS->ss=0x10; -sfTSS->ds=0x10; -sfTSS->fs=0x10; -sfTSS->gs=0x10; -sfTSS->io_map=0x8000; - -/*PrintoutinformationfortheIDT*/ -kprintf("idt0-Address:[0x%X]\n",&ubixIDT); - -/*Returnsoweknowallwentwell*/ -return(0x0); -} - - -/*SetsUpIDTVector*/ -voidsetVector(void*handler,unsignedcharinterrupt,unsignedshortcontrolMajor){ -unsignedshortcodesegment=0x08; -asmvolatile("movw%%cs,%0":"=g"(codesegment)); - -ubixIDT[interrupt].gate.offsetLow=(unsignedshort)(((unsignedlong)handler)&0xffff); -ubixIDT[interrupt].gate.selector=codesegment; -ubixIDT[interrupt].gate.access=controlMajor; -ubixIDT[interrupt].gate.offsetHigh=(unsignedshort)(((unsignedlong)handler)>>16); -} - -/************************************************************************ - -Function:voidsetTaskVector(uInt8,uInt16,uInt8); -Description:ThisFunctionSetsUpAnIDTTaskVector -Notes: - -************************************************************************/ -void -setTaskVector(uInt8interrupt,uInt16controlMajor,uInt8selector) -{ -uInt16codesegment=0x08; -asmvolatile("movw%%cs,%0":"=g"(codesegment)); - -ubixIDT[interrupt].gate.offsetLow=0x0; -ubixIDT[interrupt].gate.selector=selector; -ubixIDT[interrupt].gate.access=controlMajor; -ubixIDT[interrupt].gate.offsetHigh=0x0; -} +#include<sys/trap.h> + +#defineFP_TO_LINEAR(seg,off)((void*)((((uint16_t)(seg))<<4)+((uint16_t)(off)))) + +staticuint32_tgpfStack=0x0; + +voidintNull(); + +void_divideError(); +void__divideError(structtrapframe*); + +void_debug(); +void__debug(structtrapframe*); + +void_nmi(); +void__nmi(structtrapframe*); + +staticvoid_int3(); +staticvoid_int4(); +staticvoid_int5(); +staticvoid_int6(); +staticvoid_int7(); + +void_doubleFault(); +void__doubleFault(structtrapframe*); + +staticvoid_int9(); +staticvoid_int10(); +staticvoid_int11(); +staticvoid_int12(); + +void_gpf(); +void__gpf(structtrapframe*); + +void_floatingPoint(); +void__floatingPoint(structtrapframe*); + +void_alignmentCheck(); +void__alignmentCheck(structtrapframe*); + +void_machineCheck(); +void__machineCheck(structtrapframe*); + +void_simd(); +void__simd(structtrapframe*); + +void_virtualization(); +void__virtualization(structtrapframe*); + +void_security(); +void__security(structtrapframe*); + +staticubixDescriptorTable(ubixIDT,256){}; + +staticstruct{ +unsignedshortlimit__attribute__((packed)); +uniondescriptorTableUnion*idt__attribute__((packed)); +}loadidt={(256*sizeof(uniondescriptorTableUnion)-1),ubixIDT}; + +/************************************************************************ + +Function:intidtInit() +Description:ThisfunctionisusedtoenableourIDTsubsystem +Notes: + +02/20/2004-Approvedforquality + +************************************************************************/ +intidt_init(){ +structtssStruct*sfTSS=(structtssStruct*)0x6200; +structtssStruct*gpfTSS=(structtssStruct*)0x5200; + +/*LoadtheIDTintothesystem*/ +asmvolatile( +"cli\n" +"lidt(%0)\n"/*LoadtheIDT*/ +"pushfl\n"/*CleartheNTflag*/ +"andl$0xffffbfff,(%%esp)\n" +"popfl\n" +"sti\n" +: +:"r"((char*)&loadidt) +); + +for(inti=0;i<256;i++) +setVector(intNull,i,dPresent+dTrap+dDpl3); + +/*Setupthebasicvectorsforthereservedints*/ +setVector(_divideError,0,dPresent+dInt+dDpl0); +setVector(_debug,1,dPresent+dInt+dDpl0); +setVector(_nmi,2,dPresent+dInt+dDpl0); +setVector(_int3,3,dPresent+dInt+dDpl0); +setVector(_int4,4,dPresent+dInt+dDpl0); +setVector(_int5,5,dPresent+dInt+dDpl0); +setVector(_int6,6,dPresent+dTrap+dDpl0); +setVector(_int7,7,dPresent+dInt+dDpl0); +setVector(_doubleFault,8,dPresent+dInt+dDpl0); +//setTaskVector(8,dPresent+dTask+dDpl0,0x40); +setVector(_int9,9,dPresent+dInt+dDpl0); +setVector(_int10,10,dPresent+dInt+dDpl0); +setVector(_int11,11,dPresent+dInt+dDpl0); +setVector(_int12,12,dPresent+dInt+dDpl0); +//setVector(_gpf,13,dPresent+dInt+dDpl0); +setTaskVector(13,dPresent+dTask+dDpl0,0x38); +setVector(_vmm_pageFault,14,dPresent+dInt+dDpl0); +setVector(_floatingPoint,16,dPresent+dInt+dDpl0); +setVector(_alignmentCheck,17,dPresent+dInt+dDpl0); +setVector(_machineCheck,18,dPresent+dInt+dDpl0); +setVector(_simd,19,dPresent+dInt+dDpl0); +setVector(_virtualization,20,dPresent+dInt+dDpl0); +setVector(_security,30,dPresent+dInt+dDpl0); +setVector(_sys_call_posix,0x80,dPresent+dTrap+dDpl3); +setVector(_sys_call,0x81,dPresent+dTrap+dDpl3); +setVector(timerInt,0x68,(dInt+dPresent+dDpl0)); + +memset(gpfTSS,0x0,sizeof(structtssStruct)); + +gpfStack=0x1D000;//(uint32_t)vmm_getFreeKernelPage(sysID,1)+(PAGE_SIZE-0x4); + +gpfTSS->back_link=0x0; +gpfTSS->esp0=0x0; +gpfTSS->ss0=0x0; +gpfTSS->esp1=0x0; +gpfTSS->ss1=0x0; +gpfTSS->esp2=0x0; +gpfTSS->ss2=0x0; +gpfTSS->cr3=(unsignedint)kernelPageDirectory; +gpfTSS->eip=(unsignedint)&_gpf; +gpfTSS->eflags=0x206; +gpfTSS->esp=gpfStack;//0x1D000; +gpfTSS->ebp=0x0;//0x1D000; +gpfTSS->esi=0x0; +gpfTSS->edi=0x0; +gpfTSS->es=0x10; +gpfTSS->cs=0x08; +gpfTSS->ss=0x10; +gpfTSS->ds=0x10; +gpfTSS->fs=0x10; +gpfTSS->gs=0x10; +gpfTSS->ldt=0x0; +gpfTSS->trace_bitmap=0x0000; +gpfTSS->io_map=0x8000; - -/*NullIntteruptDescriptor*/ -voidintNull(){ -kprintf("InvalidInterrupt[%i]\n",_current->id); -/* -kpanic("InvalidInterrupt[%i]\n",_current->id); -while(1); -endTask(_current->id); -sched_yield(); -*/ -} - -void_int0(){ -kpanic("int0:Divide-by-Zero[%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int1(){ -kpanic("int1:Debugexception[%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int2(){ -kpanic("int2:unknownerror[%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int3(){ -kpanic("int3:Breakpoint[%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int4(){ -kpanic("int4:Overflow[%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int5(){ -kpanic("int5:Boundscheck[%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int6(){ -kpanic("int6:Invalidopcode![%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int8(){ -structtssStruct*sfTSS=(structtssStruct*)0x6200; -kpanic("int8:DoubleFault![%i]\n",_current->id); -sfTSS->cr3=(unsignedint)kernelPageDirectory; -sfTSS->eip=(unsignedint)&_int8; -sfTSS->eflags=0x206; -sfTSS->esp=0x1C000; -sfTSS->ebp=0x1C000; -sfTSS->es=0x10; -sfTSS->cs=0x08; -sfTSS->ss=0x10; -sfTSS->ds=0x10; -sfTSS->fs=0x10; -sfTSS->gs=0x10; -sfTSS->io_map=0x8000; -while(1); -} - -void_int9(){ -kpanic("int9:CoprocessorSegmentOverrun![%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int10(){ -kpanic("int10:InvalidTSS![%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int11(){ -kpanic("int11:SegmentNotPresent![%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int12(){ -kpanic("int12:Stack-SegmentFault![%i]\n",_current->id); -endTask(_current->id); -sched_yield(); -} - -void_int13(){ -uInt8*ip=0x0; -uInt16*stack=0x0,*ivt=0x0; -uInt32*stack32=0x0; -boolisOperand32=FALSE,isAddress32=FALSE; -structtssStruct*gpfTSS=(structtssStruct*)0x4200; - -irqDisable(0x0); - -gpfTSS->eip=(unsignedint)&_int13; -gpfTSS->esp=0x1D000; -gpfTSS->ebp=0x1D000; -gpfTSS->eflags=0x206; - -ip=FP_TO_LINEAR(_current->tss.cs,_current->tss.eip); -ivt=(uInt16*)0x0; -stack=(uInt16*)FP_TO_LINEAR(_current->tss.ss,_current->tss.esp); -stack32=(uInt32*)stack; - -gpfStart: -switch(ip[0]){ -case0xCD:/*INTn*/ -switch(ip[1]){ -case0x69: -kprintf("ExitBios[0x%X]\n",_current->id); -_current->state=DEAD; -break; -case0x20: -case0x21: -kpanic("GPFOP0x20/0x21\n"); -break; -default: -stack-=3; -_current->tss.esp=((_current->tss.esp&0xffff)-6)&0xffff; -stack[0]=(uInt16)(_current->tss.eip+2); -stack[1]=_current->tss.cs;stack[2]=(uInt16)_current->tss.eflags; -if(_current->oInfo.v86If) -stack[2]|=EFLAG_IF; -else -stack[2]&=~EFLAG_IF; -_current->tss.cs=ivt[ip[1]*2+1]&0xFFFF; -_current->tss.eip=ivt[ip[1]*2]&0xFFFF; -break; -} -break; -case0x66: -isOperand32=TRUE; -ip++; -_current->tss.eip=(uInt16)(_current->tss.eip+1); -gotogpfStart; -break; -case0x67: -isAddress32=TRUE; -ip++; -_current->tss.eip=(uInt16)(_current->tss.eip+1); -gotogpfStart; -break; -case0xF0: -_current->tss.eip=(uInt16)(_current->tss.eip+1); -kpanic("GPFOP0xF0\n"); -break; -case0x9C: -if(isOperand32==TRUE){ -_current->tss.esp=((_current->tss.esp&0xffff)-4)&0xffff; -stack32--; -stack32[0]=_current->tss.eflags&0xDFF; -if(_current->oInfo.v86If==TRUE) -stack32[0]|=EFLAG_IF; -elsestack32[0]&=~EFLAG_IF; -}else{ -_current->tss.esp=((_current->tss.esp&0xffff)-2)&0xffff; -stack--; - -stack[0]=(uInt16)_current->tss.eflags; -if(_current->oInfo.v86If==TRUE)stack[0]|=EFLAG_IF; -elsestack[0]&=~EFLAG_IF; -_current->tss.eip=(uInt16)(_current->tss.eip+1); - -} -break; -case0x9D: -if(isOperand32==TRUE){ -_current->tss.eflags=EFLAG_IF|EFLAG_VM|(stack32[0]&0xDFF); -_current->oInfo.v86If=(stack32[0]&EFLAG_IF)!=0; -_current->tss.esp=((_current->tss.esp&0xffff)+4)&0xffff; -}else{ -_current->tss.eflags=EFLAG_IF|EFLAG_VM|stack[0]; -_current->oInfo.v86If=(stack[0]&EFLAG_IF)!=0; -_current->tss.esp=((_current->tss.esp&0xffff)+2)&0xffff; -} -_current->tss.eip=(uInt16)(_current->tss.eip+1); -/*kprintf("popf[0x%X]\n",_current->id);*/ -break; -case0xFA: -_current->oInfo.v86If=FALSE; -_current->tss.eflags&=~EFLAG_IF; -_current->tss.eip=(uInt16)(_current->tss.eip+1); -_current->oInfo.timer=0x1; -break; -case0xFB: -_current->oInfo.v86If=TRUE; -_current->tss.eflags|=EFLAG_IF; -_current->tss.eip=(uInt16)(_current->tss.eip+1); -_current->oInfo.timer=0x0; -/*kprintf("sti[0x%X]\n",_current->id);*/ -break; -case0xCF: -_current->tss.eip=stack[0]; -_current->tss.cs=stack[1]; -_current->tss.eflags=EFLAG_IF|EFLAG_VM|stack[2]; -_current->oInfo.v86If=(stack[2]&EFLAG_IF)!=0; -_current->tss.esp=((_current->tss.esp&0xffff)+6)&0xffff; -/*kprintf("iret[0x%X]\n",_current->id);*/ -break; -case0xEC:/*INAL,DX*/ -_current->tss.eax=(_current->tss.eax&~0xFF)|inportByte(_current->tss.edx); -_current->tss.eip=(uInt16)(_current->tss.eip+1); -break; -case0xED:/*INAX,DX*/ -_current->tss.eax=(_current->tss.eax&~0xFFFF)|inportWord(_current->tss.edx); -_current->tss.eip=(uInt16)(_current->tss.eip+1); -break; -case0xEE:/*OUTDX,AL*/ -outportByte(_current->tss.edx,_current->tss.eax&0xFF); -_current->tss.eip=(uInt16)(_current->tss.eip+1); -break; -case0xEF: -outportWord(_current->tss.edx,_current->tss.eax); -_current->tss.eip=(uInt16)(_current->tss.eip+1); -break; -case0xF4: -_current->tss.eip=(uInt16)(_current->tss.eip+1); -break; -default:/*somethingwrong*/ -kprintf("NonHandledOpCode[0x%X:0x%X]\n",_current->id,ip[0]); -_current->state=DEAD; -break; -} -irqEnable(0); -while(1); -} - -/*Removedstatichoweverthisistheonlyplaceit'scalledfrom*/ -voidmathStateRestore(){ -if(_usedMath!=0x0){ -asm( -"fnsave%0" -: -:"m"(_usedMath->i387) -); -} -if(_current->usedMath!=0x0){ -asm( -"frstor%0" -: -:"m"(_current->i387) -); -} -else{ -asm("fninit"); -_current->usedMath=0x1; -} - -_usedMath=_current; - -//Return -} - -void_int7(); -asm( -".globl_int7\n" -"_int7:\n" -"pushl%eax\n" -"clts\n" -"movl_current,%eax\n" -"cmpl_usedMath,%eax\n" -"jemathDone\n" -"callmathStateRestore\n" -"mathDone:\n" -"popl%eax\n" -"iret\n" -); - -/*** -END -***/ +/* +memset(sfTSS,0x0,sizeof(structtssStruct)); +sfTSS->cr3=(unsignedint)kernelPageDirectory; +sfTSS->eip=(unsignedint)&__int8; +sfTSS->eflags=0x206; +sfTSS->esp=0x1C000; +sfTSS->ebp=0x1C000; +sfTSS->es=0x10; +sfTSS->cs=0x08; +sfTSS->ss=0x10; +sfTSS->ds=0x10; +sfTSS->fs=0x10; +sfTSS->gs=0x10; +sfTSS->io_map=0x8000; +*/ + +/*PrintoutinformationfortheIDT*/ +kprintf("idt0-Address:[0x%X]\n",&ubixIDT); + +/*Returnsoweknowallwentwell*/ +return(0x0); +} + +/*SetsUpIDTVector*/ +voidsetVector(void*handler,unsignedcharinterrupt,unsignedshortcontrolMajor){ +unsignedshortcodesegment=0x08; +asmvolatile("movw%%cs,%0":"=g"(codesegment)); + +ubixIDT[interrupt].gate.offsetLow=(unsignedshort)(((unsignedlong)handler)&0xffff); +ubixIDT[interrupt].gate.selector=codesegment; +ubixIDT[interrupt].gate.access=controlMajor; +ubixIDT[interrupt].gate.offsetHigh=(unsignedshort)(((unsignedlong)handler)>>16); +} + +/************************************************************************ + +Function:voidsetTaskVector(uInt8,uInt16,uInt8); +Description:ThisFunctionSetsUpAnIDTTaskVector +Notes: + +************************************************************************/ +voidsetTaskVector(uInt8interrupt,uInt16controlMajor,uInt8selector){ +uInt16codesegment=0x08; +asmvolatile("movw%%cs,%0":"=g"(codesegment)); + +ubixIDT[interrupt].gate.offsetLow=0x0; +ubixIDT[interrupt].gate.selector=selector; +ubixIDT[interrupt].gate.access=controlMajor; +ubixIDT[interrupt].gate.offsetHigh=0x0; +} + +/*NullIntteruptDescriptor*/ +void_intNull(structtrapframe*frame){ +die_if_kernel("invalidexception",frame,0x0); +} + +asm( +".globlintNull\n" +"intNull:\n" +"pushl$0x0\n" +"pushl$0x0\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call_intNull\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__divideError(structtrapframe*frame){ +die_if_kernel("Divid-by-Zero",frame,0); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_divideError\n" +"_divideError:\n" +"pushl$0x0\n" +"pushl$0x6\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call_divideError\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__debug(structtrapframe*frame){ +die_if_kernel("debug",frame,0x2); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_debug\n" +"_debug:\n" +"pushl$0x0\n" +"pushl$0x6\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call_debug\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__nmi(structtrapframe*frame){ +die_if_kernel("nmi",frame,0x2); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_nmi\n" +"_nmi:\n" +"pushl$0x0\n" +"pushl$0x6\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call_nmi\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + + +staticvoid_int3(){ +kpanic("int3:Breakpoint[%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +staticvoid_int4(){ +kpanic("int4:Overflow[%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +staticvoid_int5(){ +kpanic("int5:Boundscheck[%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +void__int6(structtrapframe*frame){ +die_if_kernel("invalid_opcode",frame,6); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_int6\n" +"_int6:\n" +"pushl$0x0\n" +"pushl$0x6\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__int6\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n"/*Exitinterrupt*/ +); + +void__doubleFault(structtrapframe*frame){ +die_if_kernel("doublefault",frame,0x8); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_doubleFault\n" +"_doubleFault:\n" +"pushl$0x8\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__doubleFault\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n"/*Exitinterrupt*/ +); + +staticvoid_int9(){ +kpanic("int9:CoprocessorSegmentOverrun![%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +staticvoid_int10(){ +kpanic("int10:InvalidTSS![%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +staticvoid_int11(){ +kpanic("int11:SegmentNotPresent![%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +staticvoid_int12(){ +kpanic("int12:Stack-SegmentFault![%i]\n",_current->id); +endTask(_current->id); +sched_yield(); +} + +void__gpf(structtrapframe*frame){ +uint8_t*ip=0x0; +uint16_t*stack=0x0,*ivt=0x0; +uint32_t*stack32=0x0; +boolisOperand32=FALSE,isAddress32=FALSE; + +structtssStruct*gpfTSS=(structtssStruct*)0x5200; + +gpfEnter: +kprintf("DF"); +ip=FP_TO_LINEAR(_current->tss.cs,_current->tss.eip); + +ivt=(uint16_t*)0x0; + +stack=(uint16_t*)FP_TO_LINEAR(_current->tss.ss,_current->tss.esp); +stack32=(uint32_t*)stack; + +gpfStart:switch(ip[0]){ +case0xCD:/*INTn*/ +switch(ip[1]){ +case0x69: +kprintf("ExitBios[0x%X]\n",_current->id); +//while(1)asm("hlt"); +_current->state=DEAD; +break; +case0x20: +case0x21: +kpanic("GPFOP0x20/0x21\n"); +break; +default: +stack-=3; +_current->tss.esp=((_current->tss.esp&0xffff)-6)&0xffff; +stack[0]=(uint16_t)(_current->tss.eip+2); +stack[1]=_current->tss.cs; +stack[2]=(uint16_t)_current->tss.eflags; +if(_current->oInfo.v86If) +stack[2]|=EFLAG_IF; +else +stack[2]&=~EFLAG_IF; + +_current->tss.cs=ivt[ip[1]*2+1]&0xFFFF; +_current->tss.eip=ivt[ip[1]*2]&0xFFFF; +break; +} +break; +case0x66: +isOperand32=TRUE; +ip++; +_current->tss.eip=(uInt16)(_current->tss.eip+1); +kprintf("0x66"); +gotogpfStart; +break; +case0x67: +isAddress32=TRUE; +ip++; +_current->tss.eip=(uInt16)(_current->tss.eip+1); +kprintf("0x67"); +gotogpfStart; +break; +case0xF0: +_current->tss.eip=(uInt16)(_current->tss.eip+1); +kpanic("GPFOP0xF0\n"); +break; +case0x9C: +if(isOperand32==TRUE){ +_current->tss.esp=((_current->tss.esp&0xffff)-4)&0xffff; +stack32--; +stack32[0]=_current->tss.eflags&0xDFF; +if(_current->oInfo.v86If==TRUE) +stack32[0]|=EFLAG_IF; +else +stack32[0]&=~EFLAG_IF; +} +else{ +_current->tss.esp=((_current->tss.esp&0xffff)-2)&0xffff; +stack--; + +stack[0]=(uInt16)_current->tss.eflags; +if(_current->oInfo.v86If==TRUE) +stack[0]|=EFLAG_IF; +else +stack[0]&=~EFLAG_IF; +_current->tss.eip=(uInt16)(_current->tss.eip+1); + +} +break; +case0x9D: +if(isOperand32==TRUE){ +_current->tss.eflags=EFLAG_IF|EFLAG_VM|(stack32[0]&0xDFF); +_current->oInfo.v86If=(stack32[0]&EFLAG_IF)!=0; +_current->tss.esp=((_current->tss.esp&0xffff)+4)&0xffff; +} +else{ +_current->tss.eflags=EFLAG_IF|EFLAG_VM|stack[0]; +_current->oInfo.v86If=(stack[0]&EFLAG_IF)!=0; +_current->tss.esp=((_current->tss.esp&0xffff)+2)&0xffff; +} +_current->tss.eip=(uInt16)(_current->tss.eip+1); +/*kprintf("popf[0x%X]\n",_current->id);*/ +break; +case0xFA: +_current->oInfo.v86If=FALSE; +_current->tss.eflags&=~EFLAG_IF; +_current->tss.eip=(uInt16)(_current->tss.eip+1); +_current->oInfo.timer=0x1; +break; +case0xFB: +_current->oInfo.v86If=TRUE; +_current->tss.eflags|=EFLAG_IF; +_current->tss.eip=(uInt16)(_current->tss.eip+1); +_current->oInfo.timer=0x0; +/*kprintf("sti[0x%X]\n",_current->id);*/ +break; +case0xCF: +_current->tss.eip=stack[0]; +_current->tss.cs=stack[1]; +_current->tss.eflags=EFLAG_IF|EFLAG_VM|stack[2]; +_current->oInfo.v86If=(stack[2]&EFLAG_IF)!=0; +_current->tss.esp=((_current->tss.esp&0xffff)+6)&0xffff; +kprintf("iret[0x%X]\n",_current->id); +break; +case0xEC:/*INAL,DX*/ +_current->tss.eax=(_current->tss.eax&~0xFF)|inportByte(_current->tss.edx); +_current->tss.eip=(uInt16)(_current->tss.eip+1); +break; +case0xED:/*INAX,DX*/ +_current->tss.eax=(_current->tss.eax&~0xFFFF)|inportWord(_current->tss.edx); +_current->tss.eip=(uInt16)(_current->tss.eip+1); +break; +case0xEE:/*OUTDX,AL*/ +outportByte(_current->tss.edx,_current->tss.eax&0xFF); +_current->tss.eip=(uInt16)(_current->tss.eip+1); +break; +case0xEF: +outportWord(_current->tss.edx,_current->tss.eax); +_current->tss.eip=(uInt16)(_current->tss.eip+1); +break; +case0xF4: +_current->tss.eip=(uInt16)(_current->tss.eip+1); +break; +default:/*somethingwrong*/ +kprintf("NonHandledOpCode[0x%X:0x%X]\n",_current->id,ip[0]); +//_current->state=DEAD; +break; +} +kprintf("RET1"); +irqEnable(0); +sched_yield(); +kprintf("RET2"); +gotogpfEnter; +} + +asm( +".globl_gpf\n" +"_gpf:\n" +"cli\n" +"pushl$0x13\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__gpf\n" +"add$0x4,%esp\n" +"mov%esp,%eax\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"sti\n" +"iret\n"/*Exitinterrupt*/ +); + + +void__floatingPoint(structtrapframe*frame){ +die_if_kernel("floatingpoint",frame,0x10); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_floatingPoint\n" +"_floatingPoint:\n" +"pushl$0x0\n" +"pushl$0x10\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__floatingPoint\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__alignmentCheck(structtrapframe*frame){ +die_if_kernel("alignmentcheck",frame,0x11); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_alignmentCheck\n" +"_alignmentCheck:\n" +"pushl$0x11\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__alignmentCheck\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__machineCheck(structtrapframe*frame){ +die_if_kernel("machinecheck",frame,0x12); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_machineCheck\n" +"_machineCheck:\n" +"pushl$0x0\n" +"pushl$0x12\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__machineCheck\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__simd(structtrapframe*frame){ +die_if_kernel("simd",frame,0x13); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_simd\n" +"_simd:\n" +"iret\n" +"pushl$0x0\n" +"pushl$0x13\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__simd\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__virtualization(structtrapframe*frame){ +die_if_kernel("virtualization",frame,0x14); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_virtualization\n" +"_virtualization:\n" +"pushl$0x0\n" +"pushl$0x14\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__virtualization\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +void__security(structtrapframe*frame){ +die_if_kernel("securityexception",frame,0x1E); +endTask(_current->id); +sched_yield(); +} + +asm( +".globl_security\n" +"_security:\n" +"pushl$0x1E\n" +"pushal\n"/*Saveallregisters*/ +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"push%esp\n" +"call__security\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"popal\n" +"iret\n" +); + +/*Removedstatichoweverthisistheonlyplaceit'scalledfrom*/ +voidmathStateRestore(){ +if(_usedMath!=0x0){ +asm( +"fnsave%0" +: +:"m"(_usedMath->i387) +); +} +if(_current->usedMath!=0x0){ +asm( +"frstor%0" +: +:"m"(_current->i387) +); +} +else{ +asm("fninit"); +_current->usedMath=0x1; +} + +_usedMath=_current; + +//Return +} + + +asm( +".globl_int7\n" +"_int7:\n" +"pushl%eax\n" +"clts\n" +"movl_current,%eax\n" +"cmpl_usedMath,%eax\n" +"jemathDone\n" +"callmathStateRestore\n" +"mathDone:\n" +"popl%eax\n" +"iret\n" +); - + diff --git a/doc/xml/idt_8h.xml b/doc/xml/idt_8h.xml index a2c75d5..543adac 100644 --- a/doc/xml/idt_8h.xml +++ b/doc/xml/idt_8h.xml @@ -1,103 +1,148 @@ - - - + + + idt.h - ubixos/types.h + sys/types.h sys/gdt.h - src/sys/include/ubixos/init.h - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/mouse.c - src/sys/isa/ne2k.c - src/sys/kernel/sched.c - src/sys/pci/lnc.c - src/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/mouse.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/sys/idt.c - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + - + EFLAG_IF 0x200 @@ -106,9 +151,9 @@ - + - + EFLAG_IOPL3 0x3000 @@ -117,9 +162,9 @@ - + - + EFLAG_TF 0x100 @@ -128,9 +173,9 @@ - + - + EFLAG_VM 0x20000 @@ -139,311 +184,11 @@ - + - - void - void _int0 - () - _int0 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int1 - () - _int1 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int10 - () - _int10 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int11 - () - _int11 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int12 - () - _int12 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int13 - () - _int13 - - - - - - - - _current - _int13 - tssStruct::cs - DEAD - tssStruct::eax - tssStruct::ebp - tssStruct::edx - EFLAG_IF - EFLAG_VM - tssStruct::eflags - tssStruct::eip - tssStruct::esp - FALSE - FP_TO_LINEAR - taskStruct::id - inportByte - inportWord - irqDisable - irqEnable - kpanic - kprintf - taskStruct::oInfo - outportByte - outportWord - tssStruct::ss - taskStruct::state - osInfo::timer - TRUE - taskStruct::tss - osInfo::v86If - _int13 - idt_init - - - void - void _int2 - () - _int2 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int3 - () - _int3 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int4 - () - _int4 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int5 - () - _int5 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int6 - () - _int6 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - - void - void _int7 - () - _int7 - - - - - - - - idt_init - - - void - void _int8 - () - _int8 - - - - - - - - _current - _int8 - tssStruct::cr3 - tssStruct::cs - tssStruct::ds - tssStruct::ebp - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esp - tssStruct::fs - tssStruct::gs - taskStruct::id - tssStruct::io_map - kernelPageDirectory - kpanic - tssStruct::ss - _int8 - idt_init - - - void - void _int9 - () - _int9 - - - - - - - - _current - endTask - taskStruct::id - kpanic - sched_yield - idt_init - - + int int idt_init () @@ -454,94 +199,23 @@ - - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int7 - _int8 - _int9 - _sysCall - _sysCall_new - _vmm_pageFault - tssStruct::back_link - tssStruct::cr3 - tssStruct::cs - dDpl0 - dDpl3 - dInt - dPresent - tssStruct::ds - dTask - dTrap - tssStruct::ebp - tssStruct::edi - tssStruct::eflags - tssStruct::eip - tssStruct::es - tssStruct::esi - tssStruct::esp - tssStruct::esp0 - tssStruct::esp1 - tssStruct::esp2 - tssStruct::fs - tssStruct::gs - intNull - tssStruct::io_map - kernelPageDirectory - kprintf - tssStruct::ldt - loadidt - memset - setTaskVector - setVector - tssStruct::ss - tssStruct::ss0 - tssStruct::ss1 - tssStruct::ss2 - timerInt - tssStruct::trace_bitmap + - - void - void intNull - () - intNull - - - - - - - - _current - taskStruct::id - kprintf - idt_init - - + void void setTaskVector (uInt8 interrupt, uInt16 controlMajor, uInt8 selector) setTaskVector - uInt8 + uInt8 interrupt - uInt16 + uInt16 controlMajor - uInt8 + uInt8 selector @@ -550,15 +224,10 @@ - - gdtGate::access - descriptorTableUnion::gate - gdtGate::offsetHigh - gdtGate::offsetLow - gdtGate::selector - idt_init + + selector - + void void setVector (void *handler, unsigned char interrupt, unsigned short controlMajor) @@ -581,20 +250,12 @@ - - gdtGate::access - descriptorTableUnion::gate - gdtGate::offsetHigh - gdtGate::offsetLow - gdtGate::selector - atkbd_init - fdc_init - idt_init - initLNC - mouseInit - ne2k_init + + atkbd_init + fdc_init + initLNC - + void void timerInt () @@ -605,7 +266,7 @@ - + @@ -613,97 +274,54 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: idt_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_IDT_H -#define_IDT_H - -#include<ubixos/types.h> -#include<sys/gdt.h> - -#defineEFLAG_TF0x100 -#defineEFLAG_IF0x200 -#defineEFLAG_IOPL30x3000 -#defineEFLAG_VM0x20000 - -intidt_init(); -voidsetVector(void*handler,unsignedcharinterrupt,unsignedshortcontrolMajor); -voidsetTaskVector(uInt8interrupt,uInt16controlMajor,uInt8selector); -voidintNull(); - -void_int0(); -void_int1(); -void_int2(); -void_int3(); -void_int4(); -void_int5(); -void_int6(); -void_int7(); -void_int8(); -void_int9(); -void_int10(); -void_int11(); -void_int12(); -void_int13(); -voidtimerInt(); - -#endif - -/*** -$Log: idt_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:52reddawg -nomessage - -Revision1.52004/09/0721:54:38reddawg -okrevertedbacktooldschedulingfornow.... - -Revision1.32004/07/0913:16:41reddawg -idt:idtInittoidt_init -AdjustedStartupRoutines - -Revision1.22004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_IDT_H +#define_IDT_H + +#include<sys/types.h> +#include<sys/gdt.h> + +#defineEFLAG_TF0x100 +#defineEFLAG_IF0x200 +#defineEFLAG_IOPL30x3000 +#defineEFLAG_VM0x20000 + +intidt_init(); +voidsetVector(void*handler,unsignedcharinterrupt,unsignedshortcontrolMajor); +voidsetTaskVector(uInt8interrupt,uInt16controlMajor,uInt8selector); + + +voidtimerInt(); + +#endif - + diff --git a/doc/xml/include_2sys_2device_8h.xml b/doc/xml/include_2sys_2device_8h.xml index c2e7532..565e8e0 100644 --- a/doc/xml/include_2sys_2device_8h.xml +++ b/doc/xml/include_2sys_2device_8h.xml @@ -1,170 +1,1232 @@ - - - + + + device.h - ubixos/types.h - src/sys/devfs/devfs.c - src/sys/include/sys/buf.h - src/sys/include/ubixfs/ubixfs.h - src/sys/include/ufs/ffs.h - src/sys/include/ufs/ufs.h - src/sys/isa/fdc.c - src/sys/pci/hd.c - src/sys/sys/device.c - src/sys/vfs/mount.c + sys/types.h + C:/Dev/git/UbixOS/sys/fs/common/gpt.c + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/include/fs/common/gpt.h + C:/Dev/git/UbixOS/sys/include/sys/buf.h + C:/Dev/git/UbixOS/sys/include/ubixfs/ubixfs.h + C:/Dev/git/UbixOS/sys/include/ufs/ffs.h + C:/Dev/git/UbixOS/sys/include/ufs/ufs.h + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/pci/hd.c + C:/Dev/git/UbixOS/sys/sys/device.c - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + - - - + + + - - + + + + + + - + - + - + + + + + + + - - - + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + - - - + + + + + + + + + + + + + - - - + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - - - - - - - - - - + + + + - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -172,7 +1234,7 @@ device_node device_resource - + int int device_add (int, char, struct device_interface *) @@ -192,26 +1254,19 @@ - - devices - deviceSpinLock - device_node::devInfo - device_interface::init - device_interface::initialized - kmalloc - kprintf - device_node::minor - device_node::next - NULL - device_node::prev - spinLock - spinUnlock - device_node::type - fdc_init - initHardDisk + + device_node::devInfo + kmalloc + kprintf + device_node::minor + NULL + device_node::prev + spinLock + device_node::type + fdc_init - - device_node * + + struct device_node * struct device_node* device_find (int major, int minor) device_find @@ -229,21 +1284,11 @@ - - devices - deviceSpinLock - device_node::devInfo - device_interface::major - device_node::minor - device_node::next - spinLock - spinUnlock - devfs_open - devfs_read - devfs_write - vfs_mount + + spinLock + vfs_mount - + int int device_remove (struct device_node *) @@ -257,14 +1302,7 @@ - - devices - deviceSpinLock - kfree - device_node::next - NULL - spinLock - spinUnlock + @@ -272,124 +1310,73 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: include_2sys_2device_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_DEVICE_H -#define_DEVICE_H - -#include<ubixos/types.h> - -structdevice_node{ -structdevice_node*prev; -structdevice_node*next; -structdevice_interface*devInfo; -structdevice_resource*devRec; -chartype; -intminor; -}; - -structdevice_resource{ -uInt8irq; -}; - -structdevice_interface{ -uInt8initialized; -uInt32size; -intmajor; -void*info; -void(*read)(void*,void*,uInt32,uInt32); -void(*write)(void*,void*,uInt32,uInt32); -void(*reset)(void*); -int(*init)(void*); -void(*ioctl)(void*); -void(*stop)(void*); -void(*start)(void*); -void(*standby)(void*); -}; - - -intdevice_add(int,char,structdevice_interface*); -structdevice_node*device_find(intmajor,intminor); -intdevice_remove(structdevice_node*); -#endif - -/*** -$Log: include_2sys_2device_8h.xml,v $ -Revision 1.4 2006/12/12 14:09:13 reddawg -Changes - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:51reddawg -nomessage - -Revision1.142004/08/1500:33:02reddawg -Wowtheidedriverworksagain - -Revision1.132004/08/1421:56:44reddawg -Addedinitializedbytetothedevicesystemtomakeiteasytoaddchilddeviceswhichuseparenthardware. - -Revision1.122004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.112004/05/2202:40:04ionix - - -fixedtypoindevice.handinitializedpreviousindevice.c:) - -Revision1.102004/05/2202:34:03ionix - - -Addedproto - -Revision1.92004/05/2115:12:17reddawg -Cleanedup - - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_DEVICE_H +#define_SYS_DEVICE_H + +#include<sys/types.h> + +structdevice_node{ +structdevice_node*prev; +structdevice_node*next; +structdevice_interface*devInfo; +structdevice_resource*devRec; +chartype; +intminor; +}; + +structdevice_resource{ +uInt8irq; +}; + +structdevice_interface{ +uInt8initialized; +uInt32size; +intmajor; +void*info; +int(*read)(void*,void*,uInt32,uInt32); +int(*write)(void*,void*,uInt32,uInt32); +void(*reset)(void*); +int(*init)(void*); +void(*ioctl)(void*); +void(*stop)(void*); +void(*start)(void*); +void(*standby)(void*); +}; + +intdevice_add(int,char,structdevice_interface*); +structdevice_node*device_find(intmajor,intminor); +intdevice_remove(structdevice_node*); + +#endif/*END_SYS_DEVICE_H*/ - + diff --git a/doc/xml/include_2ubixfs_2ubixfs_8h.xml b/doc/xml/include_2ubixfs_2ubixfs_8h.xml index 2c22d22..b3ca311 100644 --- a/doc/xml/include_2ubixfs_2ubixfs_8h.xml +++ b/doc/xml/include_2ubixfs_2ubixfs_8h.xml @@ -1,217 +1,505 @@ - - - + + + ubixfs.h - ubixos/types.h + sys/types.h vfs/vfs.h sys/device.h mpi/mpi.h ubixfs/dirCache.h - src/sys/include/pci/hd.h - src/sys/include/ubixos/init.h - src/sys/kernel/syscall.c - src/sys/ubixfs/block.c - src/sys/ubixfs/dirCache.c - src/sys/ubixfs/directory.c - src/sys/ubixfs/thread.c - src/sys/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/block.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/directory.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/thread.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/include/pci/hd.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + - - - - - - - + - - - - + + + + - - - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + - - - - - - - - - - + + - - - - + + + + + + + + + + + + - + - + - + - + - + - + - + - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -224,7 +512,7 @@ ubixDiskLabel::ubixPartitions ubixFSInfo - + blockSize 8 @@ -233,12 +521,9 @@ - - ubixfs_loadData - ubixFSmkDir - writeUbixFS + - + EOBC -1 @@ -247,10 +532,9 @@ - - writeUbixFS + - + MAXUBIXPARTITIONS 16 @@ -259,9 +543,9 @@ - + - + typeContainer 2 @@ -270,9 +554,9 @@ - + - + typeDeleted 8 @@ -281,10 +565,9 @@ - - ubixFSUnlink + - + typeDirectory 4 @@ -293,10 +576,9 @@ - - ubixFSmkDir + - + typeFile 1 @@ -305,52 +587,46 @@ - - ubixfs_cacheFind + - + UBIXDISKMAGIC - ((uInt32)0x45) + ((uInt32)0x45) /* The disk magic number */ - - ubixfs_initialize + - + UBIXFS_ALIGN size - (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES))))) + (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES))))) - - openFileUbixFS - ubixfs_loadData + - + UBIXFS_BLOCKSIZE_BYTES - blockSize*512 + blockSize*512 - - ubixfs_loadData - ubixFSmkDir + - - directoryList * + + struct directoryList * typedef struct directoryList* dirList_t dirList_t @@ -360,21 +636,21 @@ - + - + int int addDirEntry - (struct directoryEntry *dir, fileDescriptor *fd) + (struct directoryEntry *dir, fileDescriptor_t *fd) addDirEntry struct directoryEntry * dir - fileDescriptor * + fileDescriptor_t * fd @@ -383,28 +659,27 @@ - - kmalloc - kprintf - memcpy - fileDescriptor::offset - readUbixFS - fileDescriptor::size - writeUbixFS - x1000 - ubixFSmkDir + + kmalloc + kprintf + memcpy + fileDescriptor::offset + readUbixFS + fileDescriptor::size + writeUbixFS + ubixFSmkDir - + int int freeBlocks - (int block, fileDescriptor *fd) + (int block, fileDescriptor_t *fd) freeBlocks int block - fileDescriptor * + fileDescriptor_t * fd @@ -413,23 +688,25 @@ - - blockAllocationTableEntry::attributes - ubixFSInfo::blockAllocationTable - blockAllocationTableEntry::nextBlock - syncBat + + blockAllocationTableEntry::attributes + ubixFSInfo::blockAllocationTable + vfs_mountPoint::fsInfo + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + syncBat - + int int getFreeBlocks - (int count, fileDescriptor *fd) + (int count, fileDescriptor_t *fd) getFreeBlocks int count - fileDescriptor * + fileDescriptor_t * fd @@ -438,17 +715,18 @@ - - blockAllocationTableEntry::attributes - ubixFSInfo::batEntries - ubixFSInfo::blockAllocationTable - blockAllocationTableEntry::nextBlock - syncBat - x1 - ubixFSmkDir - writeUbixFS + + blockAllocationTableEntry::attributes + ubixFSInfo::batEntries + ubixFSInfo::blockAllocationTable + vfs_mountPoint::fsInfo + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + syncBat + ubixFSmkDir + writeUbixFS - + int int readFile (char *file) @@ -463,15 +741,15 @@ - + - + int int readUbixFS - (fileDescriptor *fd, char *data, uInt32, long size) + (fileDescriptor_t *fd, char *data, uInt32, long size) readUbixFS - fileDescriptor * + fileDescriptor_t * fd @@ -479,7 +757,7 @@ data - uInt32 + uInt32 long @@ -491,17 +769,23 @@ - - assert - buffer - fdEof - kpanic - NULL - fileDescriptor::size - addDirEntry - ubixfs_init + + assert + buffer + fileDescriptor::cacheNode + fdEof + vfs_mountPoint::fsInfo + cacheNode::info + kpanic + fileDescriptor::mp + NULL + cacheNode::present + fileDescriptor::size + fileDescriptor::status + addDirEntry + ubixfs_init - + void void syncBat (struct vfs_mountPoint *mp) @@ -516,20 +800,22 @@ - - ubixFSInfo::blockAllocationTable - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - vfs_mountPoint::fsInfo - device_interface::info - vfs_mountPoint::partition - ubixDiskLabel::partitions - device_interface::write - freeBlocks - getFreeBlocks + + ubixFSInfo::blockAllocationTable + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + vfs_mountPoint::fsInfo + device_interface::info + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pBatSize + ubixDiskLabel::ubixPartitions::pOffset + device_interface::write + freeBlocks + getFreeBlocks - + int int ubixfs_init () @@ -540,19 +826,13 @@ - - kpanic - NULL - openFileUbixFS - readUbixFS - ubixfs_initialize - ubixFSmkDir - ubixFSUnlink - vfsRegisterFS - writeUbixFS - x1 + + NULL + readUbixFS + ubixfs_initialize + writeUbixFS - + int int ubixfs_initialize () @@ -563,10 +843,9 @@ - - ubixfs_init + - + void void ubixfs_thread () @@ -577,10 +856,10 @@ - + - - dirList_t + + dirList_t dirList_t ubixFSLoadDir (char *) ubixFSLoadDir @@ -593,27 +872,22 @@ - - directoryList::dirCache - dirList - directoryList::dirName - kmalloc - directoryList::next - directoryList::prev - sprintf - strcmp + + directoryList::dirName + kmalloc + sprintf - + int int ubixFSmkDir - (char *dir, fileDescriptor *fd) + (char *dir, fileDescriptor_t *fd) ubixFSmkDir char * dir - fileDescriptor * + fileDescriptor_t * fd @@ -622,25 +896,34 @@ - - addDirEntry - directoryEntry::attributes - ubixFSInfo::blockAllocationTable - blockSize - directoryEntry::fileName - getFreeBlocks - kfree - kmalloc - directoryEntry::permissions - blockAllocationTableEntry::realSector - directoryEntry::size - sprintf - directoryEntry::startCluster - typeDirectory - UBIXFS_BLOCKSIZE_BYTES - ubixfs_init + + addDirEntry + directoryEntry::attributes + ubixFSInfo::blockAllocationTable + blockSize + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + directoryEntry::fileName + vfs_mountPoint::fsInfo + getFreeBlocks + device_interface::info + kfree + kmalloc + fileDescriptor::mp + vfs_mountPoint::partition + ubixDiskLabel::partitions + directoryEntry::permissions + ubixDiskLabel::ubixPartitions::pOffset + blockAllocationTableEntry::realSector + directoryEntry::size + sprintf + directoryEntry::startCluster + typeDirectory + UBIXFS_BLOCKSIZE_BYTES + device_interface::write - + void void ubixFSUnlink (char *path, struct vfs_mountPoint *mp) @@ -659,37 +942,19 @@ - - ubixFSInfo::blockAllocationTable - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - directoryEntry::fileName - vfs_mountPoint::fsInfo - device_interface::info - kmalloc - kprintf - vfs_mountPoint::partition - ubixDiskLabel::partitions - device_interface::read - ubixFSInfo::rootDir - strcmp - typeDeleted - device_interface::write - x1000 - ubixfs_init + - + int int writeFileByte - (int ch, fileDescriptor *fd, long offset) + (int ch, fileDescriptor_t *fd, long offset) writeFileByte int ch - fileDescriptor * + fileDescriptor_t * fd @@ -702,21 +967,46 @@ - - assert - ubixFSInfo::blockAllocationTable - fdOpen - fdRead - blockAllocationTableEntry::nextBlock - NULL + + assert + blockAllocationTableEntry::attributes + ubixFSInfo::batEntries + ubixFSInfo::blockAllocationTable + fileDescriptor::buffer + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + fdOpen + fdRead + fileDescriptor::fileName + directoryEntry::fileName + vfs_mountPoint::fsInfo + device_interface::info + kfree + kmalloc + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + NULL + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pBatSize + ubixDiskLabel::ubixPartitions::pOffset + device_interface::read + blockAllocationTableEntry::realSector + fileDescriptor::size + directoryEntry::size + fileDescriptor::start + fileDescriptor::status + strcmp + device_interface::write - + int int writeUbixFS - (fileDescriptor *fd, char *data, long offset, long size) + (fileDescriptor_t *fd, char *data, long offset, long size) writeUbixFS - fileDescriptor * + fileDescriptor_t * fd @@ -737,25 +1027,38 @@ - - assert - ubixFSInfo::blockAllocationTable - blockSize - EOBC - directoryEntry::fileName - getFreeBlocks - kfree - kmalloc - blockAllocationTableEntry::nextBlock - NULL - blockAllocationTableEntry::realSector - fileDescriptor::size - directoryEntry::size - directoryEntry::startCluster - strcmp - x1000 - addDirEntry - ubixfs_init + + assert + ubixFSInfo::blockAllocationTable + blockSize + fileDescriptor::buffer + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + EOBC + fileDescriptor::fileName + directoryEntry::fileName + vfs_mountPoint::fsInfo + getFreeBlocks + device_interface::info + kfree + kmalloc + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + NULL + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pOffset + device_interface::read + blockAllocationTableEntry::realSector + fileDescriptor::size + directoryEntry::size + fileDescriptor::start + directoryEntry::startCluster + strcmp + device_interface::write + addDirEntry + ubixfs_init @@ -763,213 +1066,161 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: include_2ubixfs_2ubixfs_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_UBIXFS_H -#define_UBIXFS_H - -#include<ubixos/types.h> -#include<vfs/vfs.h> -#include<sys/device.h> -#include<mpi/mpi.h> -#include<ubixfs/dirCache.h> - - -#defineUBIXFS_BLOCKSIZE_BYTESblockSize*512 -#defineUBIXFS_ALIGN(size)(size+((((size)%(UBIXFS_BLOCKSIZE_BYTES))==0)?0:((UBIXFS_BLOCKSIZE_BYTES)-((size)%(UBIXFS_BLOCKSIZE_BYTES))))) - -#defineUBIXDISKMAGIC((uInt32)0x45)/*Thediskmagicnumber*/ -#defineMAXUBIXPARTITIONS16 -#defineblockSize8 - - -#defineEOBC-1 - - -#definetypeFile1 -#definetypeContainer2 -#definetypeDirectory4 -#definetypeDeleted8 - -/*Start*/ -structdirectoryList{ -chardirName[256]; -char*dirCache; -uInt32dirBlock; -structdirectoryList*next; -structdirectoryList*prev; -}; - -typedefstructdirectoryList*dirList_t; - -dirList_tubixFSLoadDir(char*); -/*End*/ - -//PartitionInformation -structubixDiskLabel{ -uInt32magicNum; -uInt32magicNum2; -uInt16driveType; -uInt16numPartitions; -structubixPartitions{//thepartitiontable -uInt32pSize;//numberofsectorsinpartition -uInt32pOffset;//startingsector -uInt32pFsSize;//filesystembasicfragmentsize -uInt32pBatSize;//BATsize -uInt8pFsType;//filesystemtype,seebelow -uInt8pFrag;//filesystemfragmentsperblock -}partitions[MAXUBIXPARTITIONS]; -}; - - -structpartitionInformation{ -uInt32size;//SizeInSectors -uInt32startSector;//BaseSectorOfPartition -uInt32blockAllocationTable;//BaseSectorOfBAT -uInt32rootDirectory;//BaseSectorOfRootDirectory -}; - -//BlockAllocationTableEntry -structblockAllocationTableEntry{ -longattributes;//BlockAttributes -longrealSector;//RealSector -longnextBlock;//SectorOfNextBlock -longreserved;//Reserved -}; - -//UbixFSDirectoryEntry -structdirectoryEntry{ -uInt32startCluster;//StartingClusterOfFile -uInt32size;//SizeOfFile -uInt32creationDate;//DateCreated -uInt32lastModified;//DateLastModified -uInt32uid;//UIDOfOwner -uInt32gid;//GIDOfOwner -uInt16attributes;//FilesAttributes -uInt16permissions;//FilesPermissions -charfileName[256];//FileName -}; - -structbootSect{ -uInt8jmp[4]; -uInt8id[6]; -uInt16version; -uInt16tmp; -uInt16fsStart; -uInt16tmp2; -uInt32krnl_start; -uIntBytesPerSector; -uIntSectersPerTrack; -uIntTotalHeads; -uInt32TotalSectors; -uInt8code[479]; -}; - -structubixFSInfo{ -structblockAllocationTableEntry*blockAllocationTable; -structcacheNode*dirCache; -uInt32batEntries; -uInt32rootDir; -};/*ubixFSInfo*/ - -intreadFile(char*file); -intwriteFileByte(intch,fileDescriptor*fd,longoffset); -//intopenFileUbixFS(char*file,fileDescriptor*fd); -intgetFreeBlocks(intcount,fileDescriptor*fd); -//externstructubixDiskLabel*diskLabel; - -//GoodFunctions -//voidinitUbixFS(structmountPoints*mp); - -intreadUbixFS(fileDescriptor*fd,char*data,uInt32,longsize); -intwriteUbixFS(fileDescriptor*fd,char*data,longoffset,longsize); -voidsyncBat(structvfs_mountPoint*mp); -intfreeBlocks(intblock,fileDescriptor*fd); -intaddDirEntry(structdirectoryEntry*dir,fileDescriptor*fd); -voidubixFSUnlink(char*path,structvfs_mountPoint*mp); -intubixFSmkDir(char*dir,fileDescriptor*fd); +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXFS_UBIXFS_H +#define_UBIXFS_UBIXFS_H + +#include<sys/types.h> +#include<vfs/vfs.h> +#include<sys/device.h> +#include<mpi/mpi.h> +#include<ubixfs/dirCache.h> + +#defineUBIXFS_BLOCKSIZE_BYTESblockSize*512 +#defineUBIXFS_ALIGN(size)(size+((((size)%(UBIXFS_BLOCKSIZE_BYTES))==0)?0:((UBIXFS_BLOCKSIZE_BYTES)-((size)%(UBIXFS_BLOCKSIZE_BYTES))))) + +#defineUBIXDISKMAGIC((uInt32)0x45)/*Thediskmagicnumber*/ +#defineMAXUBIXPARTITIONS16 +#defineblockSize8 + +#defineEOBC-1 + +#definetypeFile1 +#definetypeContainer2 +#definetypeDirectory4 +#definetypeDeleted8 + +/*Start*/ +structdirectoryList{ +chardirName[256]; +char*dirCache; +uInt32dirBlock; +structdirectoryList*next; +structdirectoryList*prev; +}; + +typedefstructdirectoryList*dirList_t; + +dirList_tubixFSLoadDir(char*); +/*End*/ + +//PartitionInformation +structubixDiskLabel{ +uInt32magicNum; +uInt32magicNum2; +uInt16driveType; +uInt16numPartitions; +structubixPartitions{//thepartitiontable +uInt32pSize;//numberofsectorsinpartition +uInt32pOffset;//startingsector +uInt32pFsSize;//filesystembasicfragmentsize +uInt32pBatSize;//BATsize +uInt8pFsType;//filesystemtype,seebelow +uInt8pFrag;//filesystemfragmentsperblock +}partitions[MAXUBIXPARTITIONS]; +}; + +structpartitionInformation{ +uInt32size;//SizeInSectors +uInt32startSector;//BaseSectorOfPartition +uInt32blockAllocationTable;//BaseSectorOfBAT +uInt32rootDirectory;//BaseSectorOfRootDirectory +}; + +//BlockAllocationTableEntry +structblockAllocationTableEntry{ +longattributes;//BlockAttributes +longrealSector;//RealSector +longnextBlock;//SectorOfNextBlock +longreserved;//Reserved +}; + +//UbixFSDirectoryEntry +structdirectoryEntry{ +uInt32startCluster;//StartingClusterOfFile +uInt32size;//SizeOfFile +uInt32creationDate;//DateCreated +uInt32lastModified;//DateLastModified +uInt32uid;//UIDOfOwner +uInt32gid;//GIDOfOwner +uInt16attributes;//FilesAttributes +uInt16permissions;//FilesPermissions +charfileName[256];//FileName +}; + +structbootSect{ +uInt8jmp[4]; +uInt8id[6]; +uInt16version; +uInt16tmp; +uInt16fsStart; +uInt16tmp2; +uInt32krnl_start; +uIntBytesPerSector; +uIntSectersPerTrack; +uIntTotalHeads; +uInt32TotalSectors; +uInt8code[479]; +}; + +structubixFSInfo{ +structblockAllocationTableEntry*blockAllocationTable; +structcacheNode*dirCache; +uInt32batEntries; +uInt32rootDir; +}; +/*ubixFSInfo*/ + +intreadFile(char*file); +intwriteFileByte(intch,fileDescriptor_t*fd,longoffset); +//intopenFileUbixFS(char*file,fileDescriptor_t*fd); +intgetFreeBlocks(intcount,fileDescriptor_t*fd); +//externstructubixDiskLabel*diskLabel; + +//GoodFunctions +//voidinitUbixFS(structmountPoints*mp); + +intreadUbixFS(fileDescriptor_t*fd,char*data,uInt32,longsize); +intwriteUbixFS(fileDescriptor_t*fd,char*data,longoffset,longsize); +voidsyncBat(structvfs_mountPoint*mp); +intfreeBlocks(intblock,fileDescriptor_t*fd); +intaddDirEntry(structdirectoryEntry*dir,fileDescriptor_t*fd); +voidubixFSUnlink(char*path,structvfs_mountPoint*mp); +intubixFSmkDir(char*dir,fileDescriptor_t*fd); + +intubixfs_init(); +intubixfs_initialize(); +voidubixfs_thread(); -intubixfs_init(); -intubixfs_initialize(); -voidubixfs_thread(); - - -#endif - -/*** -$Log: include_2ubixfs_2ubixfs_8h.xml,v $ -Revision 1.4 2006/12/12 14:09:13 reddawg -Changes - -Revision1.22006/12/0514:10:21reddawg -WorkignDistro - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:53reddawg -nomessage - -Revision1.212004/09/1420:57:01reddawg -Bugfixes:macroproblemoveroptamultiply - -Revision1.202004/08/0117:58:39flameshadow -chg:fixedstringallocationbuginubixfs_cacheNew() - -Revision1.192004/07/2712:02:01reddawg -chg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch - -Revision1.182004/07/2309:10:06reddawg -ubixfs:cleanedupsomefunctionsplayedwiththecachingabit -vfs:renamedabunchoffunctions -cleanedupafewmiscbugs - -Revision1.172004/07/2222:37:03reddawg -CachingisworkingnowtheFSisextremelyfastbutneedstobeoptimizedtodo32bitcopiesover8bit - -Revision1.162004/07/2021:28:16flameshadow -oops - -Revision1.142004/07/2019:36:49reddawg -UBUTags - -Revision1.132004/07/1412:21:49reddawg -ubixfs:enableUbixFstoubixfs_init -ChangedStartupRoutines - -END -***/ +#endif/*END_UBIXFS_UBIXFS_H*/ - + diff --git a/doc/xml/include_2vfs_2file_8h.xml b/doc/xml/include_2vfs_2file_8h.xml index a4c50e2..d064fbf 100644 --- a/doc/xml/include_2vfs_2file_8h.xml +++ b/doc/xml/include_2vfs_2file_8h.xml @@ -1,665 +1,1319 @@ - - - + + + file.h - ubixos/types.h + sys/types.h ubixfs/dirCache.h + sys/thread.h + vfs/inode.h vfs/mount.h - src/sys/include/devfs/devfs.h - src/sys/include/sys/kern_descrip.h - src/sys/include/ubixos/sched.h - src/sys/include/ubixos/syscalls.h - src/sys/include/vfs/vfs.h - src/sys/kernel/syscall.c - src/sys/net/netif/tcpdump.c - src/sys/ubixfs/block.c - src/sys/ubixfs/directory.c - src/sys/vfs/file.c + ufs/ufs.h + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/block.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/directory.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/fs/vfs/stat.c + C:/Dev/git/UbixOS/sys/include/devfs/devfs.h + C:/Dev/git/UbixOS/sys/include/sys/descrip.h + C:/Dev/git/UbixOS/sys/include/sys/sysproto_posix.h + C:/Dev/git/UbixOS/sys/include/ubixos/sched.h + C:/Dev/git/UbixOS/sys/include/ubixos/syscalls.h + C:/Dev/git/UbixOS/sys/include/vfs/vfs.h + C:/Dev/git/UbixOS/sys/net/netif/tcpdump.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - + - + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + - - - - - - - - - - + + - - - - - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dmadat - fileDescriptorStruct + fileDescriptor + sys_fwrite_args userFileDescriptorStruct - + DEV_BSHIFT - 9 + 9 /* log2(DEV_BSIZE) */ - + - + DEV_BSIZE - (1<<DEV_BSHIFT) + (1<<DEV_BSHIFT) - + - + + MAX_OFILES + 256 + + + + + + + + + SBLOCKSIZE 8192 @@ -668,22 +1322,42 @@ - + - - SEEK_SET - 0x0 + + SEEK_CUR + 1 - - DiskFS::read - DiskFS::write + - + + SEEK_END + 2 + + + + + + + + + + SEEK_SET + 0 + + + + + + + + + VBLKSHIFT 12 @@ -692,38 +1366,36 @@ - - fsread + - + VBLKSIZE - (1 << VBLKSHIFT) + (1 << VBLKSHIFT) - - fsread + - - fileDescriptorStruct - typedef struct fileDescriptorStruct fileDescriptor + + struct fileDescriptor + typedef struct fileDescriptor fileDescriptor_t - fileDescriptor + fileDescriptor_t - + - - userFileDescriptorStruct + + struct userFileDescriptorStruct typedef struct userFileDescriptorStruct userFileDescriptor userFileDescriptor @@ -733,34 +1405,32 @@ - + + + + + + fileDescriptor_t * + fileDescriptor_t* fdTable + + fdTable + + + + + + + - - void - void chDir - (const char *path) - chDir - - const char * - path - - - - - - - - - - + int int fclose - (fileDescriptor *) + (fileDescriptor_t *) fclose - fileDescriptor * + fileDescriptor_t * @@ -768,37 +1438,30 @@ - - assert - fdTable - fdTable_lock - kfree - fileDescriptor::next - NULL - vitalsStruct::openFiles - fileDescriptor::prev - spinLock - spinUnlock - systemVitals - x1 - dev_ramDestroy - dev_ramDrive - execFile - kmod_load - ldEnable - bTree::Save - sysExec - sysFclose - sysMkDir - systemTask + + file::fd + spinLock + _sys_stat + dup2 + elf_load_file + execFile + fcntl + kmod_load + ldEnable + sys_close + sys_fclose + sys_fstatat + sysExec + sysMkDir + systemTask - + int int feof - (fileDescriptor *fd) + (fileDescriptor_t *fd) feof - fileDescriptor * + fileDescriptor_t * fd @@ -807,16 +1470,18 @@ - - fdEof + + file::fd + fdEof + fileDescriptor::status - + int int fgetc - (fileDescriptor *fd) + (fileDescriptor_t *fd) fgetc - fileDescriptor * + fileDescriptor_t * fd @@ -825,20 +1490,24 @@ - - fileDescriptor::offset - sysFgetc + + file::fd + vfs_mountPoint::fs + fileDescriptor::mp + fileDescriptor::offset + fileSystem::vfsRead + sys_fgetc - - fileDescriptor * - fileDescriptor* fopen + + fileDescriptor_t * + fileDescriptor_t* fopen (const char *, const char *) fopen - const char * + const char * - const char * + const char * @@ -846,62 +1515,65 @@ - - fdOpen - fdTable - fdTable_lock - fileAppend - fileBinary - fileRead - fileWrite - kfree - kmalloc - kprintf - fileDescriptor::next - NULL - fileDescriptor::offset - vitalsStruct::openFiles - fileDescriptor::prev - spinLock - spinUnlock - sprintf - strcpy - strstr - strtok - systemVitals - vfs_findMount - dev_ramDestroy - dev_ramDrive - DiskFS::DiskFS - execFile - kmod_load - ldEnable - bTree::Save - sys_open - sysExec - sysFopen - sysMkDir - tcpdump_init + + _current + fileDescriptor::buffer + osInfo::cwd + file + fileAppend + fileBinary + fileDescriptor::fileName + fileRead + fileWrite + vfs_mountPoint::fs + kfree + kmalloc + kprintf + memset + fileDescriptor::mode + fileDescriptor::mp + NULL + taskStruct::oInfo + spinUnlock + sprintf + strcpy + strstr + strtok + vfs_findMount + fileSystem::vfsOpenFile + _sys_stat + elf_load_file + execFile + kern_openat + kmod_load + ldEnable + sys_fopen + sys_fstatat + sys_openat + sys_statfs + sysExec + sysMkDir + tcpdump_init - - size_t + + size_t size_t fread - (void *ptr, size_t size, size_t nmemb, fileDescriptor *fd) + (void *ptr, size_t size, size_t nmemb, fileDescriptor_t *fd) fread void * ptr - size_t + size_t size - size_t + size_t nmemb - fileDescriptor * + fileDescriptor_t * fd @@ -910,25 +1582,32 @@ - - assert - fileDescriptor::offset - dev_ramDrive - execFile - kmod_load - ldEnable - DiskFS::read - read - sysExec - sysFread + + assert + file::fd + vfs_mountPoint::fs + fileDescriptor::mp + fileDescriptor::offset + fileSystem::vfsRead + elf_load_file + execFile + kmod_load + ldEnable + read + sys_fread + sys_getdirentries + sys_mmap + sys_pread + sys_read + sysExec - + int int fseek - (fileDescriptor *, long, int) + (fileDescriptor_t *, long, int) fseek - fileDescriptor * + fileDescriptor_t * long @@ -942,19 +1621,18 @@ - - fileDescriptor::offset - execFile - kmod_load - ldEnable - DiskFS::read - sysExec - DiskFS::write + + elf_load_file + execFile + kmod_load + ldEnable + sys_mmap + sysExec - - size_t + + size_t size_t fwrite - (void *ptr, int size, int nmemb, fileDescriptor *fd) + (void *ptr, int size, int nmemb, fileDescriptor_t *fd) fwrite void * @@ -969,7 +1647,7 @@ nmemb - fileDescriptor * + fileDescriptor_t * fd @@ -978,21 +1656,38 @@ - - fileDescriptor::offset - dev_ramDestroy - bTree::Save - sysFwrite - DiskFS::write + + sys_fwrite + sys_write + sysFwrite - - void - void sysChDir - (const char *path) - sysChDir + + int + int getchar + () + getchar + + + + + + + + tty_foreground + sys_fgetc + sys_pread + sys_read + + + int + int sys_fwrite + (struct thread *, struct sys_fwrite_args *) + sys_fwrite - const char * - path + struct thread * + + + struct sys_fwrite_args * @@ -1000,20 +1695,25 @@ - - _current - osInfo::cwd - taskStruct::oInfo - sprintf - strstr + + _current + sys_fwrite_args::buf + userFileDescriptorStruct::fd + sys_fwrite_args::fd + fwrite + kprintf + sys_fwrite_args::nbytes + thread::td_retval + taskStruct::term + tty_print - - void - void sysFseek + + int + int sysFseek (userFileDescriptor *, long, int) sysFseek - userFileDescriptor * + userFileDescriptor * long @@ -1027,18 +1727,15 @@ - - userFileDescriptorStruct::fd - NULL - fileDescriptorStruct::offset + - + int int unlink (const char *path) unlink - const char * + const char * path @@ -1047,22 +1744,15 @@ - - vfs_mountPoint::fs - vfs_mountPoint::mountPoint - NULL - strtok - vfs_findMount - fileSystem::vfsUnlink - sysUnlink + - + char * char* verifyDir (const char *path) verifyDir - const char * + const char * path @@ -1071,24 +1761,7 @@ - - - - - - fileDescriptor * - fileDescriptor* fdTable - - fdTable - - - - - - - - fclose - fopen + @@ -1096,101 +1769,128 @@ -/************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistofconditions,thefollowingdisclaimerandthelistofauthors. -Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowingdisclaimerandthelistofauthors -inthedocumentationand/orothermaterialsprovidedwiththedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED -WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULAR -PURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT, -INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTE -GOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORY -OFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: include_2vfs_2file_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -**************************************************************************************/ - -#ifndef_FILE_H -#define_FILE_H - -#include<ubixos/types.h> -#include<ubixfs/dirCache.h> -#include<vfs/mount.h> - -#defineSEEK_SET0x0 - -#defineVBLKSHIFT12 -#defineVBLKSIZE(1<<VBLKSHIFT) -#defineSBLOCKSIZE8192 -#defineDEV_BSHIFT9/*log2(DEV_BSIZE)*/ -#defineDEV_BSIZE(1<<DEV_BSHIFT) - -structdmadat{ -charblkbuf[VBLKSIZE];/*filesystemblocks*/ -charindbuf[VBLKSIZE];/*indirblocks*/ -charsbbuf[SBLOCKSIZE];/*superblock*/ -charsecbuf[DEV_BSIZE];/*forMBR/disklabel*/ -}; - -typedefstructfileDescriptorStruct{ -structfileDescriptorStruct*prev; -structfileDescriptorStruct*next; -structvfs_mountPoint*mp; -uInt16status; -uInt16mode; -uInt32offset; -uInt32size; -uInt16length; -uInt32start; -charfileName[512]; -char*buffer; -uInt32ino; -structcacheNode*cacheNode; -uInt32perms; -structdmadat*dmadat; -intdsk_meta; -uInt32resid; -}fileDescriptor; - - -typedefstructuserFileDescriptorStruct{ -structfileDescriptorStruct*fd; -uInt32fdSize; -}userFileDescriptor; - -externfileDescriptor*fdTable; - -fileDescriptor*fopen(constchar*,constchar*); -intfclose(fileDescriptor*); - -/*UBU*/ - - -intunlink(constchar*path); -intfeof(fileDescriptor*fd); -intfgetc(fileDescriptor*fd); -size_tfread(void*ptr,size_tsize,size_tnmemb,fileDescriptor*fd); -size_tfwrite(void*ptr,intsize,intnmemb,fileDescriptor*fd); -intfseek(fileDescriptor*,long,int); - -voidsysFseek(userFileDescriptor*,long,int); - -//Good -voidsysChDir(constchar*path); -voidchDir(constchar*path); -char*verifyDir(constchar*path); - -#endif +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_VFS_FILE_H_ +#define_VFS_FILE_H_1 + +#include<sys/types.h> + +#include<ubixfs/dirCache.h> +#include<sys/thread.h> +#include<vfs/inode.h> +#include<vfs/mount.h> +#include<ufs/ufs.h> + +/*HACK*/ +intgetchar(); + +#defineSEEK_SET0 +#defineSEEK_CUR1 +#defineSEEK_END2 + +#defineVBLKSHIFT12 +#defineVBLKSIZE(1<<VBLKSHIFT) +#defineSBLOCKSIZE8192 +#defineDEV_BSHIFT9/*log2(DEV_BSIZE)*/ +#defineDEV_BSIZE(1<<DEV_BSHIFT) + +#defineMAX_OFILES256 + +structdmadat{ +charblkbuf[VBLKSIZE];/*filesystemblocks*/ +charindbuf[VBLKSIZE];/*indirblocks*/ +charsbbuf[SBLOCKSIZE];/*superblock*/ +charsecbuf[DEV_BSIZE];/*forMBR/disklabel*/ +}; + +typedefstructfileDescriptor{ +structfileDescriptor*prev; +structfileDescriptor*next; +structvfs_mountPoint*mp; +uint32_tino; +uint16_tstatus; +uint16_tmode; +off_toffset; +uint32_tsize; +uint16_tlength; +uint32_tstart; +charfileName[512]; +char*buffer; +structcacheNode*cacheNode; +uint32_tperms; +structdmadat*dmadat; +intdsk_meta; +uint32_tresid; +structinodeinode; +intfd_type; +void*res; +intdup; +}fileDescriptor_t; + +typedefstructuserFileDescriptorStruct{ +structfileDescriptor*fd; +uint32_tfdSize; +}userFileDescriptor; + +externfileDescriptor_t*fdTable; + +fileDescriptor_t*fopen(constchar*,constchar*); +intfclose(fileDescriptor_t*); + +/*UBU*/ +structsys_fwrite_args{ +void*buf; +size_tnbytes; +size_tnmemb; +userFileDescriptor*fd; +}; + +intunlink(constchar*path); +intfeof(fileDescriptor_t*fd); +intfgetc(fileDescriptor_t*fd); +size_tfread(void*ptr,size_tsize,size_tnmemb,fileDescriptor_t*fd); +size_tfwrite(void*ptr,intsize,intnmemb,fileDescriptor_t*fd); +intfseek(fileDescriptor_t*,long,int); + +intsysFseek(userFileDescriptor*,long,int); + +//Good +//intsysChDir(constchar*path); +//voidchDir(constchar*path); +char*verifyDir(constchar*path); + +/*NewSyscall*/ +intsys_fwrite(structthread*,structsys_fwrite_args*); + +#endif - + diff --git a/doc/xml/include_2vfs_2vfs_8h.xml b/doc/xml/include_2vfs_2vfs_8h.xml index 9fe8c99..7d77fbf 100644 --- a/doc/xml/include_2vfs_2vfs_8h.xml +++ b/doc/xml/include_2vfs_2vfs_8h.xml @@ -1,649 +1,689 @@ - - - + + + vfs.h - ubixos/types.h + sys/types.h vfs/file.h vfs/mount.h - sys/sysproto.h + sys/sysproto_posix.h sys/thread.h - src/sys/devfs/devfs.c - src/sys/include/sys/buf.h - src/sys/include/ubixfs/ubixfs.h - src/sys/include/ubixos/init.h - src/sys/include/ubixos/vitals.h - src/sys/include/ufs/ffs.h - src/sys/include/ufs/ufs.h - src/sys/include/vfs/mount.h - src/sys/kernel/ld.c - src/sys/kmods/kmod.c - src/sys/ubixfs/thread.c - src/sys/ubixfs/ubixfs.c - src/sys/ufs/ffs.c - src/sys/ufs/ufs.c - src/sys/vfs/file.c - src/sys/vfs/vfs.c + net/net.h + ubixos/wait.h + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/thread.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/inode.c + C:/Dev/git/UbixOS/sys/fs/vfs/namei.c + C:/Dev/git/UbixOS/sys/fs/vfs/vfs.c + C:/Dev/git/UbixOS/sys/include/sys/buf.h + C:/Dev/git/UbixOS/sys/include/ubixfs/ubixfs.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/ubixos/vitals.h + C:/Dev/git/UbixOS/sys/include/ufs/ffs.h + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - + + + + + + + + + + + + + + + + - + - - - - + + + + - - - + - - - - - - - - - - - - + + + + - - - - - - + + + + - + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - - - - - - - - - - - + + + - - - - - - - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fileSystem + inode_operations + super_block + super_operations - + fdAvail 1 @@ -652,9 +692,9 @@ - + - + fdEof 4 @@ -663,11 +703,9 @@ - - feof - readUbixFS + - + fdOpen 2 @@ -676,11 +714,9 @@ - - fopen - writeFileByte + - + fdRead 3 @@ -689,10 +725,9 @@ - - writeFileByte + - + fileAppend 0x0008 @@ -701,10 +736,9 @@ - - fopen + - + fileBinary 0x0004 @@ -713,10 +747,9 @@ - - fopen + - + fileRead 0x0001 @@ -725,11 +758,9 @@ - - fopen - openFileUbixFS + - + fileWrite 0x0002 @@ -738,11 +769,9 @@ - - fopen - openFileUbixFS + - + maxFd 32 @@ -751,12 +780,45 @@ - + + + + MAY_EXEC + 1 + + + + + + + + + + MAY_READ + 4 + + + + + + + + + + MAY_WRITE + 2 + + + + + + + - - fileSystem * + + struct fileSystem * struct fileSystem* vfs_findFS (int) vfs_findFS @@ -769,9 +831,9 @@ - + - + int int vfs_init () @@ -782,50 +844,40 @@ - - vitalsStruct::fileSystems - kprintf - systemVitals + + vitalsStruct::fileSystems + kprintf + systemVitals - + int int vfsRegisterFS (struct fileSystem) vfsRegisterFS - struct - fileSystem + struct fileSystem newFS -register a file system +register a file system + -This registers a new filesystem into the vfs which is referenced when trying to mount a device +This registers a new filesystem into the vfs which is referenced when trying to mount a device + newFS -pointer to fileSystem structure +pointer to fileSystem structure + - + + - - vitalsStruct::fileSystems - kmalloc - kprintf - memcpy - fileSystem::next - NULL - fileSystem::prev - systemVitals - vfsFindFS - fileSystem::vfsType - x1 - devfs_init - ubixfs_init - ufs_init + + fat_init @@ -833,82 +885,132 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: include_2vfs_2vfs_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_VFS_H -#define_VFS_H - -#include<ubixos/types.h> -#include<vfs/file.h> -#include<vfs/mount.h> -#include<sys/sysproto.h> -#include<sys/thread.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ +#ifndef_VFS_VFS_H +#define_VFS_VFS_H + +#include<sys/types.h> +#include<vfs/file.h> +#include<vfs/mount.h> +#include<sys/sysproto_posix.h> +#include<sys/thread.h> +#include<net/net.h> +#include<ubixos/wait.h> -#definemaxFd32 -#definefdAvail1 -#definefdOpen2 -#definefdRead3 -#definefdEof4 - - -#definefileRead0x0001 -#definefileWrite0x0002 -#definefileBinary0x0004 -#definefileAppend0x0008 - -structfileSystem{ -structfileSystem*prev; -structfileSystem*next; -int(*vfsInitFS)(void*); -int(*vfsRead)(void*,char*,long,long); -int(*vfsWrite)(void*,char*,long,long); -int(*vfsOpenFile)(void*,void*); -int(*vfsUnlink)(char*,void*); -int(*vfsMakeDir)(char*,void*); -int(*vfsRemDir)(char*); -int(*vfsSync)(void); -intvfsType; -}; - - -/*VFSFunctions*/ -intvfs_init(); -intvfsRegisterFS(structfileSystem); -structfileSystem*vfs_findFS(int); - -#endif - -/*** -END -***/ +#defineMAY_EXEC1 +#defineMAY_WRITE2 +#defineMAY_READ4 + +#definemaxFd32 +#definefdAvail1 +#definefdOpen2 +#definefdRead3 +#definefdEof4 + +#definefileRead0x0001 +#definefileWrite0x0002 +#definefileBinary0x0004 +#definefileAppend0x0008 + +structfileSystem{ +structfileSystem*prev; +structfileSystem*next; +int(*vfsInitFS)(void*); +int(*vfsRead)(void*,char*,long,long); +int(*vfsWrite)(void*,char*,long,long); +int(*vfsOpenFile)(void*,void*); +int(*vfsUnlink)(char*,void*); +int(*vfsMakeDir)(char*,void*); +int(*vfsRemDir)(char*); +int(*vfsSync)(void); +intvfsType; +}; + +structinode_operations{ +structfile_operations*default_file_ops; +int(*create)(structinode*,constchar*,int,int,structinode**); +int(*lookup)(structinode*,constchar*,int,structinode**); +int(*link)(structinode*,structinode*,constchar*,int); +int(*unlink)(structinode*,constchar*,int); +int(*symlink)(structinode*,constchar*,int,constchar*); +int(*mkdir)(structinode*,constchar*,int,int); +int(*rmdir)(structinode*,constchar*,int); +int(*mknod)(structinode*,constchar*,int,int,int); +int(*rename)(structinode*,constchar*,int,structinode*,constchar*,int); +int(*readlink)(structinode*,char*,int); +int(*follow_link)(structinode*,structinode*,int,int,structinode**); +int(*bmap)(structinode*,int); +void(*truncate)(structinode*); +int(*permission)(structinode*,int); +}; + +/*VFSFunctions*/ +intvfs_init(); +intvfsRegisterFS(structfileSystem); +structfileSystem*vfs_findFS(int); + +structsuper_operations{ +void(*read_inode)(structinode*); +int(*notify_change)(intflags,structinode*); +void(*write_inode)(structinode*); +void(*put_inode)(structinode*); +void(*put_super)(structsuper_block*); +void(*write_super)(structsuper_block*); +void(*statfs)(structsuper_block*,structstatfs*); +int(*remount_fs)(structsuper_block*,int*,char*); +}; + +structsuper_block{ +__dev_ts_dev; +unsignedlongs_blocksize; +unsignedchars_blocksize_bits; +unsignedchars_lock; +unsignedchars_rd_only; +unsignedchars_dirt; +structsuper_operations*s_op; +unsignedlongs_flags; +unsignedlongs_magic; +unsignedlongs_time; +structinode*s_covered; +structinode*s_mounted; +structwait_queue*s_wait; +union{ +structmsdos_sb_infomsdos_sb; +/* +structfsufs1_sb; +structfsufs2_sb; +*/ +}u; +}; + +#endif - + diff --git a/doc/xml/index.xml b/doc/xml/index.xml index 466f856..081982f 100644 --- a/doc/xml/index.xml +++ b/doc/xml/index.xml @@ -1,3200 +1,11427 @@ - - + + + __siginfo + __spare1__ + __spare2__ + __spare__ + _band + _fault + _mesgq + _mqd + _overrun + _poll + _reason + _timer + _timerid + _trapno + si_addr + si_code + si_errno + si_pid + si_signo + si_status + si_uid + si_value + __sigset - __bits + __bits __timespec - tv_nsec - tv_sec + tv_nsec + tv_sec _item_t - data - Next - Previous + data + Next + Previous _list_t - First - Last + First + Last _UbixUser - gid - home - password - shell - uid - username + gid + home + password + shell + uid + username + + access_args + flags + flags_l_ + flags_r_ + path + path_l_ + path_r_ + + arp_entry + ctime + ethaddr + ipaddr + + arp_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD arpcom - ac_enaddr - ac_multicnt - ac_netgraph + ac_enaddr + ac_multicnt + ac_netgraph + + ata_identify_data + acoustic_test_interseek_delay + additional_supported + capabilities1 + capabilities2 + cfa_power_mode1 + command_set_default + command_set_enabled0 + command_set_enabled1 + command_set_supported0 + command_set_supported1 + command_set_supported2 + command_set_supported_extention + current_acoustic_management_value + current_max_sectors_per_multiple + current_media_serial_number + current_power_mgmt_value + data_set_management + device_nominal_form_factor + enhanced_security_erase_time + firmware_revision + general_config_bits + hardware_reset_result + integrity_word + logical_sector_alignment + major_version_number + master_password_revision + max_48bit_lba + max_lba_range_entry_blocks + max_num_blocks_per_microcode + max_sectors_per_multiple + min_multiword_dma_transfer_cycle + min_num_blocks_per_microcode + min_pio_transfer_no_flow_ctrl + min_pio_transfer_with_flow_ctrl + minor_version_number + model_number + multi_word_dma_mode + nominal_media_rotation_rate + obsolete0 + obsolete1 + obsolete2 + obsolete4 + obsolete5 + obsolete6 + obsolete7 + physical_logical_sector_info + pio_modes_supported + queue_depth + rec_min_multiword_dma_transfer_cycle + removable_media_status + reserved0 + reserved1 + reserved2 + reserved4 + reserved5 + reserved6 + reserved7 + reserved8 + reserved9 + reserved_for_compact_flash1 + reserved_for_compact_flash2 + reserved_for_compact_flash3 + reserved_for_wwn_extention + retired0 + retired1 + retired2 + security_erase_completion_time + security_status + serial_ata_capabilities + serial_ata_features_enabled + serial_ata_features_supported + serial_ata_reserved + serial_number + stream_access_latency + stream_min_request_size + stream_performance_granularity + stream_transfer_time + streaming_transfer_time + total_num_sectors + ultra_dma_mode + validity_bits + vendor_specific1 + vendor_specific_config_bits + words_per_logical_sector + world_wide_name + + atomic_flag + __flag blockAllocationTableEntry - attributes - nextBlock - realSector - reserved + attributes + nextBlock + realSector + reserved + + bootinfo + bi_basemem + bi_bios_dev + bi_bios_geom + bi_envp + bi_esymtab + bi_extmem + bi_fpswa + bi_hcdp + bi_kernelname + bi_kernend + bi_memdesc_size + bi_memdesc_version + bi_memmap + bi_memmap_size + bi_memsizes_valid + bi_modulep + bi_n_bios_used + bi_nfs_diskless + bi_pad + bi_size + bi_symtab + bi_systab + bi_version bootSect - BytesPerSector - code - fsStart - id - jmp - krnl_start - SectersPerTrack - tmp - tmp2 - TotalHeads - TotalSectors - version + BytesPerSector + code + fsStart + id + jmp + krnl_start + SectersPerTrack + tmp + tmp2 + TotalHeads + TotalSectors + version bsd_disklabel - d_acylinders - d_bbsize - d_checksum - d_cylskew - d_drivedata - d_flags - d_headswitch - d_interleave - d_magic - d_magic2 - d_ncylinders - d_npartitions - d_nsectors - d_ntracks - d_packname - d_partitions - d_rpm - d_sbsize - d_secpercyl - d_secperunit - d_secsize - d_spare - d_sparespercyl - d_sparespertrack - d_subtype - d_trackskew - d_trkseek - d_type - d_typename + d_acylinders + d_bbsize + d_checksum + d_cylskew + d_drivedata + d_flags + d_headswitch + d_interleave + d_magic + d_magic2 + d_ncylinders + d_npartitions + d_nsectors + d_ntracks + d_packname + d_partitions + d_rpm + d_sbsize + d_secpercyl + d_secperunit + d_secsize + d_spare + d_sparespercyl + d_sparespertrack + d_subtype + d_trackskew + d_trkseek + d_type + d_typename bsd_disklabel::partition - p_cpg - p_frag - p_fsize - p_fstype - p_offset - p_size + p_cpg + p_frag + p_fsize + p_fstype + p_offset + p_size buf cacheNode - attributes - dirty - fileListHead - fileListTail - info - name - next - parent - permissions - present - prev - size - startCluster + attributes + dirty + fileListHead + fileListTail + info + name + next + parent + permissions + present + prev + size + startCluster + + cg + cg_cgx + cg_clusteroff + cg_clustersumoff + cg_cs + cg_firstfield + cg_freeoff + cg_frotor + cg_frsum + cg_initediblk + cg_irotor + cg_iusedoff + cg_magic + cg_nclusterblks + cg_ndblk + cg_nextfreeoff + cg_niblk + cg_old_boff + cg_old_btotoff + cg_old_ncyl + cg_old_niblk + cg_old_time + cg_rotor + cg_space + cg_sparecon32 + cg_sparecon64 + cg_time + cg_unrefs close_args - fd - fd_l_ - fd_r_ + fd + fd_l_ + fd_r_ + + cluster_lookup + ClusterIdx + CurrentCluster confadd - bus - dev - enable - func - reg - rsvd + bus + dev + enable + func + reg + rsvd cpuinfo_t - apic_id - apic_ver - brand - feature - id - ident - max - ok - signature + apic_id + apic_ver + brand + feature + id + ident + max + ok + signature csum - cs_nbfree - cs_ndir - cs_nffree - cs_nifree + cs_nbfree + cs_ndir + cs_nffree + cs_nifree csum_total - cs_nbfree - cs_ndir - cs_nffree - cs_nifree - cs_numclusters - cs_spare + cs_nbfree + cs_ndir + cs_nffree + cs_nifree + cs_numclusters + cs_spare descriptorTableUnion - descriptor - dummy - gate + descriptor + dummy + gate devfs_devices - devMajor - devMinor - devName - devType - next - prev + devMajor + devMinor + devName + devType + next + prev devfs_info - deviceList + deviceList device - ioAddr - irq - mtu - net - priv + ioAddr + irq + mtu + net + priv device_interface - info - init - initialized - ioctl - major - read - reset - size - standby - start - stop - write + info + init + initialized + ioctl + major + read + reset + size + standby + start + stop + write device_node - devInfo - devRec - minor - next - prev - type + devInfo + devRec + minor + next + prev + type device_resource - irq + irq devMethodType + dhcp_msg + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + directoryEntry - attributes - creationDate - fileName - gid - lastModified - permissions - size - startCluster - uid + attributes + creationDate + fileName + gid + lastModified + permissions + size + startCluster + uid directoryList - dirBlock - dirCache - dirName - next - prev + dirBlock + dirCache + dirName + next + prev dirent - d_fileno - d_name - d_namlen - d_reclen - d_type + d_fileno + d_name + d_namlen + d_reclen + d_type + + disk_if + read_media + write_media dmadat - blkbuf - indbuf - sbbuf - secbuf + blkbuf + indbuf + sbbuf + secbuf + + dns_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 dos_partition - dp_ecyl - dp_ehd - dp_esect - dp_flag - dp_scyl - dp_shd - dp_size - dp_ssect - dp_start - dp_type + dp_ecyl + dp_ehd + dp_esect + dp_flag + dp_scyl + dp_shd + dp_size + dp_ssect + dp_start + dp_type dp_rcvhdr - dr_next - dr_rbch - dr_rbcl - dr_status + dr_next + dr_rbch + dr_rbcl + dr_status driveInfo - diskLabel - hdCalc - hdDev - hdEnable - hdFlags - hdMask - hdMulti - hdPort - hdSector - hdShift - hdSize - parOffset + ata_identify + diskLabel + hdCalc + hdDev + hdEnable + hdFlags + hdMask + hdMulti + hdPort + hdShift + hdSize + lba_end + lba_high + lba_low + lba_start + parOffset + part + sector_size driverType - devName - methods + devName + methods DrvGeom - heads - spt - tracks + heads + spt + tracks ei_device - currentPage - pingPong - rxStartPage - stopPage - tx1 - tx2 - txStartPage - word16 + currentPage + pingPong + rxStartPage + stopPage + tx1 + tx2 + txStartPage + word16 - Elf_Auxargs - base - entry - execfd - flags - pagesz - phdr - phent - phnum - trace + Elf32_Cap + c_ptr + c_tag + c_un + c_val - elfDynamic - dynPtr - dynVal + Elf32_Chdr + ch_addralign + ch_size + ch_type - elfDynSym - dynInfo - dynName - dynSize - dynValue + Elf32_Dyn + d_ptr + d_tag + d_un + d_val - elfHeader - eEhsize - eEntry - eFlags - eIdent - eMachine - ePhentsize - ePhnum - ePhoff - eShentsize - eShnum - eShoff - eShstrndx - eType - eVersion + Elf32_Ehdr + e_ehsize + e_entry + e_flags + e_ident + e_machine + e_phentsize + e_phnum + e_phoff + e_shentsize + e_shnum + e_shoff + e_shstrndx + e_type + e_version - elfPltInfo - pltInfo - pltOffset + Elf32_Lib + l_checksum + l_flags + l_name + l_time_stamp + l_version - elfProgramHeader - phAlign - phFilesz - phFlags - phMemsz - phOffset - phPaddr - phType - phVaddr + Elf32_Move + m_info + m_poffset + m_repeat + m_stride + m_value - elfSectionHeader - shAddr - shAddralign - shEntsize - shFlags - shInfo - shLink - shName - shOffset - shSize - shType + Elf32_Phdr + p_align + p_filesz + p_flags + p_memsz + p_offset + p_paddr + p_type + p_vaddr + + Elf32_Rel + r_info + r_offset + + Elf32_Rela + r_addend + r_info + r_offset + + Elf32_Shdr + sh_addr + sh_addralign + sh_entsize + sh_flags + sh_info + sh_link + sh_name + sh_offset + sh_size + sh_type + + Elf32_Sym + st_info + st_name + st_other + st_shndx + st_size + st_value + + Elf32_Syminfo + si_boundto + si_flags + + Elf32_Verdaux + vda_name + vda_next + + Elf32_Verdef + vd_aux + vd_cnt + vd_flags + vd_hash + vd_ndx + vd_next + vd_version + + Elf32_Vernaux + vna_flags + vna_hash + vna_name + vna_next + vna_other + + Elf32_Verneed + vn_aux + vn_cnt + vn_file + vn_next + vn_version + + Elf64_Cap + c_ptr + c_tag + c_un + c_val + + Elf64_Chdr + ch_addralign + ch_reserved + ch_size + ch_type + + Elf64_Dyn + d_ptr + d_tag + d_un + d_val + + Elf64_Ehdr + e_ehsize + e_entry + e_flags + e_ident + e_machine + e_phentsize + e_phnum + e_phoff + e_shentsize + e_shnum + e_shoff + e_shstrndx + e_type + e_version + + Elf64_Lib + l_checksum + l_flags + l_name + l_time_stamp + l_version + + Elf64_Move + m_info + m_poffset + m_repeat + m_stride + m_value + + Elf64_Phdr + p_align + p_filesz + p_flags + p_memsz + p_offset + p_paddr + p_type + p_vaddr + + Elf64_Rel + r_info + r_offset + + Elf64_Rela + r_addend + r_info + r_offset + + Elf64_Shdr + sh_addr + sh_addralign + sh_entsize + sh_flags + sh_info + sh_link + sh_name + sh_offset + sh_size + sh_type + + Elf64_Sym + st_info + st_name + st_other + st_shndx + st_size + st_value + + Elf64_Syminfo + si_boundto + si_flags + + Elf64_Verdaux + vda_name + vda_next + + Elf64_Verdef + vd_aux + vd_cnt + vd_flags + vd_hash + vd_ndx + vd_next + vd_version + + Elf64_Vernaux + vna_flags + vna_hash + vna_name + vna_next + vna_other + + Elf64_Verneed + vn_aux + vn_cnt + vn_file + vn_next + vn_version + + elf_file + address + buckets + chains + ctfcnt + ctfoff + ctftab + ddbstrcnt + ddbstrtab + ddbsymcnt + ddbsymtab + dynamic + got + hash + modptr + nbuckets + nchains + pcpu_base + pcpu_start + pcpu_stop + pltrel + pltrela + pltrelasize + pltrelsize + preloaded + rel + rela + relasize + relsize + strbase + strsz + strtab + symbase + symtab + typlen + typoff + + Elf_GNU_Hash_Header + gh_maskwords + gh_nbuckets + gh_shift2 + gh_symndx + + Elf_Note + n_descsz + n_namesz + n_type eth_addr - PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 eth_hdr - PACK_STRUCT_FIELD - PACK_STRUCT_FIELD - PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + + eth_vlan_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + + etharp_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S etheraddr - bytes - shorts + bytes + shorts + + ethernetif + ethaddr + + ethip_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + + fat_buffer + address + dirty + next + ptr + sector + + fat_dir_entry + Attr + CrtDate + CrtTime + CrtTimeTenth + FileSize + FstClusHI + FstClusLO + LstAccDate + Name + NTRes + WrtDate + WrtTime + + fat_list + head + tail + + fat_node + next + previous + + fatfs + cluster_begin_lba + currentsector + disk_io + fat_begin_lba + fat_buffer_head + fat_buffers + fat_sectors + fat_type + fl_lock + fl_unlock + fs_info_sector + lba_begin + next_free_cluster + num_of_fats + reserved_sectors + root_entry_count + rootdir_first_cluster + rootdir_first_sector + rootdir_sectors + sectors_per_cluster fcntl_args - arg - arg_l_ - arg_r_ - cmd - cmd_l_ - cmd_r_ - fd - fd_l_ - fd_r_ + arg + arg_l_ + arg_r_ + cmd + cmd_l_ + cmd_r_ + fd + fd_l_ + fd_r_ + + fd_set + __fds_bits file - f_flag - fd - path + data + f_flag + f_ops + f_type + fd + fd_type + socket - fileDescriptorStruct - buffer - cacheNode - dmadat - dsk_meta - fileName - ino - length - mode - mp - next - offset - perms - prev - resid - size - start - status + fileDescriptor + buffer + cacheNode + dmadat + dsk_meta + dup + fd_type + fileName + ino + inode + length + mode + mp + next + offset + perms + prev + res + resid + size + start + status + + fileOps + close + read + stat + write fileSystem - next - prev - vfsInitFS - vfsMakeDir - vfsOpenFile - vfsRead - vfsRemDir - vfsSync - vfsType - vfsUnlink - vfsWrite + next + prev + vfsInitFS + vfsMakeDir + vfsOpenFile + vfsRead + vfsRemDir + vfsSync + vfsType + vfsUnlink + vfsWrite + + freebsd6_mmap_args + addr + addr_l_ + addr_r_ + fd + fd_l_ + fd_r_ + flags + flags_l_ + flags_r_ + len + len_l_ + len_r_ + pad + pad_l_ + pad_r_ + pos + pos_l_ + pos_r_ + prot + prot_l_ + prot_r_ fs - fs_active - fs_avgfilesize - fs_avgfpdir - fs_bmask - fs_bshift - fs_bsize - fs_cblkno - fs_cgrotor - fs_cgsize - fs_clean - fs_contigdirs - fs_contigsumsize - fs_csaddr - fs_csp - fs_cssize - fs_cstotal - fs_dblkno - fs_dsize - fs_firstfield - fs_flags - fs_fmask - fs_fmod - fs_fpg - fs_frag - fs_fragshift - fs_fsbtodb - fs_fshift - fs_fsize - fs_fsmnt - fs_iblkno - fs_id - fs_inopb - fs_ipg - fs_magic - fs_maxbpg - fs_maxbsize - fs_maxcluster - fs_maxcontig - fs_maxfilesize - fs_maxsymlinklen - fs_minfree - fs_ncg - fs_nindir - fs_ocsp - fs_old_cgmask - fs_old_cgoffset - fs_old_cpc - fs_old_cpg - fs_old_csaddr - fs_old_cstotal - fs_old_dsize - fs_old_flags - fs_old_inodefmt - fs_old_interleave - fs_old_ncyl - fs_old_npsect - fs_old_nrpos - fs_old_nsect - fs_old_nspf - fs_old_postblformat - fs_old_rotdelay - fs_old_rps - fs_old_size - fs_old_spc - fs_old_time - fs_old_trackskew - fs_optim - fs_pad - fs_pendingblocks - fs_pendinginodes - fs_qbmask - fs_qfmask - fs_ronly - fs_save_cgsize - fs_sblkno - fs_sblockloc - fs_sbsize - fs_size - fs_snapinum - fs_spare1 - fs_spare2 - fs_spare5 - fs_sparecon32 - fs_sparecon64 - fs_state - fs_swuid - fs_time - fs_unused_1 - fs_volname + fs_active + fs_avgfilesize + fs_avgfilesize + fs_avgfpdir + fs_avgfpdir + fs_bmask + fs_bshift + fs_bsize + fs_cblkno + fs_cgrotor + fs_cgsize + fs_clean + fs_contigdirs + fs_contigsumsize + fs_csaddr + fs_csp + fs_cssize + fs_cstotal + fs_dblkno + fs_dsize + fs_firstfield + fs_flags + fs_fmask + fs_fmod + fs_fpg + fs_frag + fs_fragshift + fs_fsbtodb + fs_fshift + fs_fsize + fs_fsmnt + fs_iblkno + fs_id + fs_inopb + fs_inopb + fs_ipg + fs_ipg + fs_magic + fs_maxbpg + fs_maxbsize + fs_maxcluster + fs_maxcontig + fs_maxfilesize + fs_maxsymlinklen + fs_metaspace + fs_minfree + fs_mtime + fs_ncg + fs_ncg + fs_nindir + fs_ocsp + fs_old_cgmask + fs_old_cgoffset + fs_old_cpc + fs_old_cpg + fs_old_csaddr + fs_old_cstotal + fs_old_dsize + fs_old_flags + fs_old_inodefmt + fs_old_interleave + fs_old_ncyl + fs_old_npsect + fs_old_nrpos + fs_old_nsect + fs_old_nspf + fs_old_postblformat + fs_old_rotdelay + fs_old_rps + fs_old_size + fs_old_spc + fs_old_time + fs_old_trackskew + fs_optim + fs_pad + fs_pendingblocks + fs_pendinginodes + fs_pendinginodes + fs_providersize + fs_qbmask + fs_qfmask + fs_ronly + fs_save_cgsize + fs_sblkno + fs_sblockloc + fs_sbsize + fs_size + fs_snapinum + fs_snapinum + fs_spare1 + fs_spare2 + fs_spare5 + fs_sparecon32 + fs_sparecon64 + fs_state + fs_sujfree + fs_swuid + fs_time + fs_unrefs + fs_unused_1 + fs_volname - fstat_args - fd - fd_l_ - fd_r_ - sb - sb_l_ - sb_r_ + fs_dir_ent + cluster + filename + is_dir + size + + fs_dir_list_status + cluster + offset + sector + + fs_file + data + flags + index + len + pextension + + fsck_cmd + handle + size + spare + value + version + + fsid + val gdt_descr - __attribute__ - limit + limit + __attribute__ gdtDescriptor - access - baseHigh - baseLow - baseMed - granularity - limitHigh - limitLow + access + baseHigh + baseLow + baseMed + granularity + limitHigh + limitLow gdtGate - access - offsetHigh - offsetLow - selector + access + offsetHigh + offsetLow + selector getdtablesize_args - dummy + dummy getgid_args - dummy + dummy getpid_args - dummy + dummy gettimeofday_args - tp - tp_l_ - tp_r_ - tzp - tzp_l_ - tzp_r_ + tp + tp_l_ + tp_r_ + tzp + tzp_l_ + tzp_r_ getuid_args - dummy + dummy + + gpt_ent + ent_attr + ent_lba_end + ent_lba_start + ent_name + ent_type + ent_uuid + + gpt_hdr + __reserved + hdr_crc_self + hdr_crc_table + hdr_entries + hdr_entsz + hdr_lba_alt + hdr_lba_end + hdr_lba_self + hdr_lba_start + hdr_lba_table + hdr_revision + hdr_sig + hdr_size + hdr_uuid + padding hostRingEntry - buff - data - md + addr + bcnt + md + reserved + + hostRingEntry_old + buff + data + md i386_frame - cs - ds - eax - ebp - ebx - ecx - edi - edx - eip - es - esi - esp - flags - fs - gs - ss - user_esp - user_ss + cs + ds + eax + ebp + ebx + ecx + edi + edx + eip + es + esi + esp + flags + fs + gs + ss + user_esp + user_ss i387Struct - cwd - fcs - fip - foo - fos - st_space - swd - twd + cwd + fcs + fip + foo + fos + st_space + swd + twd - initBlock - ladrf - mode - padr - rdra - rlen - tdra - tlen + icmp6_echo_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + icmp6_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + icmp_echo_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + igmp_msg + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + + in6_addr + u32_addr + u8_addr + un + + in_addr + s_addr + + initBlock16 + ladrf + mode + padr + rdra + rlen + tdra + tlen + + initBlock32 + ladrf + mode + padr + rdra + res + rlen + tdra + tlen + + inode + i_atime + i_blksize + i_blocks + i_bound_by + i_bound_to + i_count + i_ctime + i_dev + i_dirt + i_flags + i_flock + i_gid + i_hash_next + i_hash_prev + i_ino + i_lock + i_mmap + i_mode + i_mount + i_mtime + i_next + i_nlink + i_op + i_pipe + i_prev + i_rdev + i_sb + i_seek + i_sem + i_size + i_socket + i_uid + i_update + i_wait + msdos_i + pipe_i + u + ufs1_i + ufs2_i + + inode_operations + bmap + create + default_file_ops + follow_link + link + lookup + mkdir + mknod + permission + readlink + rename + rmdir + symlink + truncate + unlink ioctl_args - com - com_l_ - com_r_ - data - data_l_ - data_r_ - fd - fd_l_ - fd_r_ + com + com_l_ + com_r_ + data + data_l_ + data_r_ + fd + fd_l_ + fd_r_ - issetugid_args - dummy + ip4_addr_packed + PACK_STRUCT_FIELD + + ip6_addr_packed + PACK_STRUCT_FIELD + + ip6_frag_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + ip6_hbh_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + ip6_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + + ip_globals + current_input_netif + current_ip_header_tot_len + current_iphdr_dest + current_iphdr_src + current_netif + + ip_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + + ip_pcb + local_ip + remote_ip + so_options + tos + ttl + + jblkrec + jb_blkno + jb_frags + jb_ino + jb_lbn + jb_oldfrags + jb_op + jb_unused + + jmvrec + jm_ino + jm_newoff + jm_oldoff + jm_op + jm_parent + jm_unused + + jrec + rec_jblkrec + rec_jmvrec + rec_jrefrec + rec_jsegrec + rec_jtrncrec + + jrefrec + jr_diroff + jr_ino + jr_mode + jr_nlink + jr_op + jr_parent + jr_unused + + jsegrec + jsr_blocks + jsr_cnt + jsr_crc + jsr_oldest + jsr_seq + jsr_time + + jtrncrec + jt_extsize + jt_ino + jt_op + jt_pad + jt_size kmod_struct - address - id - name - next - prev - refs + address + id + name + next + prev + refs + + lfn_cache + no_of_strings + Null + String + + lladdr_option + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 lncInfo - arpcom - bdp - initBloack - nic - nrdre - ntdre - rap - rdp - recvRing - transRings + arpcom + bufferSize + init + ioAddr + nic + nrdre + ntdre + rxBuffer + rxPtr + rxRing + txBuffer + txPtr + txRing + + lwip_cyclic_timer + handler + interval_ms mds - md0 - md1 - md2 - md3 + md0 + md1 + md2 + md3 + + mem + next + prev + used memDescriptor - baseAddr - limit - next - prev + baseAddr + limit + next + prev + + memp + next + + memp_desc + base + num + size + tab + + mld_header + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S mMap - cowCounter - pageAddr - pid - reserved - status - - mmap_args - addr - addr_l_ - addr_r_ - fd - fd_l_ - fd_r_ - flags - flags_l_ - flags_r_ - len - len_l_ - len_r_ - pad - pad_l_ - pad_r_ - pos - pos_l_ - pos_r_ - prot - prot_l_ - prot_r_ + cowCounter + pageAddr + pid + reserved + status mpi_mbox - msg - msgLast - name - next - pid - prev + msg + msgLast + name + next + pid + prev mpi_message - data - header - next - pid + data + header + next + pid - munmap_args - addr - addr_l_ - addr_r_ - len - len_l_ - len_r_ + mprotect_args + addr + addr_l_ + addr_r_ + len + len_l_ + len_r_ + prot + prot_l_ + prot_r_ + + mqtt_client_t + conn + conn_state + connect_arg + connect_cb + cyclic_tick + data_cb + inpub_arg + inpub_pkt_id + keep_alive + msg_idx + output + pend_req_queue + pkt_id_seq + pub_cb + req_list + rx_buffer + server_watchdog + + mqtt_connect_client_info_t + client_id + client_pass + client_user + keep_alive + will_msg + will_qos + will_retain + will_topic + + mqtt_request_t + arg + cb + next + pkt_id + timeout_diff + + mqtt_ringbuf_t + buf + get + put + + msdos_inode_info + i_attrs + i_binary + i_busy + i_depend + i_old + i_start + + msdos_sb_info + cluster_size + clusters + conversion + data_start + dir_entries + dir_start + fat_bits + fat_length + fat_lock + fat_start + fat_wait + fats + free_clusters + fs_gid + fs_uid + fs_umask + name_check + prev_free + quiet + + mtu_option + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + na_header + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S net - broadcast - mac + broadcast + mac + + netif + flags + hwaddr + hwaddr_len + input + linkoutput + mtu + name + next + num + state nicBuffer - buffer - length - next + buffer + length + next nicInfo - ic - ident - iobase - memMode - mode + ic + ident + iobase + memMode + mode + + ns_header + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S obreak_args - nsize - nsize_l_ - nsize_r_ + nsize + nsize_l_ + nsize_r_ ogDisplay_UbixOS - ogAlias - ogClone - ogCopyPalette - ogCreate - ogDisplay_UbixOS - ogLoadPalette - ogSetPalette - ogSetPalette - ogSetPalette - ~ogDisplay_UbixOS - FindMode - GetModeInfo - GetVESAInfo - SetMode - SetPal - activePage - modeInfo - pages - VESAInfo - visualPage + activePage + modeInfo + pages + VESAInfo + visualPage + FindMode + GetModeInfo + GetVESAInfo + SetMode + SetPal + ogAlias + ogClone + ogCopyPalette + ogCreate + ogDisplay_UbixOS + ogLoadPalette + ogSetPalette + ogSetPalette + ogSetPalette + ~ogDisplay_UbixOS + + ogDisplay_VESA + InGraphics + ModeRec + ScreenSelector + VESARec + findMode + getModeInfo + getVESAInfo + rawGetPixel + rawLine + rawSetPixel + setMode + setPal + ogAlias + ogAvail + ogClear + ogClone + ogCopyLineFrom + ogCopyLineTo + ogCopyPal + ogCreate + ogDisplay_VESA + ogGetPixel + ogGetPtr + ogHLine + ogLoadPal + ogSetPixel + ogSetRGBPalette + ogVFlip + ogVLine + ~ogDisplay_VESA ogModeInfo - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ ogVESAInfo - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - __attribute__ - - open_args - flags - flags_l_ - flags_r_ - mode - mode_l_ - mode_r_ - path - path_l_ - path_r_ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ osInfo - controlKeys - cwd - stdin - stdinSize - timer - v86If - v86Task - vmStart + controlKeys + cwd + gpf + stdin + stdinSize + timer + v86If + v86Task + vmStart + + packed_struct_test + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 partitionInformation - blockAllocationTable - rootDirectory - size - startSector + blockAllocationTable + rootDirectory + size + startSector + + pbuf + flags + len + next + payload + ref + tot_len + type + + pbuf_rom + next + payload pciConfig - base - baseClass - bist - bus - cacheLineSize - command - dev - deviceId - func - headerType - interface - irq - latencyTimer - revisionId - size - status - subClass - subsys - subsysVendor - vendorId + bar + bist + bus + cacheLineSize + capabilites + cbPointer + classCode + command + dev + deviceID + epromAddr + func + headerType + intLine + intPin + latencyTimer + maxLatency + minGrant + progIf + res1 + res2 + revisionID + status + subClass + subsysID + subsysVendorID + vendorID pipe_args - dummy + dummy + + pipe_inode_info + base + len + lock + rd_openers + readers + start + wait + wr_openers + writers + + pipeBuf + buffer + nbytes + next + offset + + pipeInfo + bCNT + headPB + rFD + rfdCNT + tailPB + wFD + wfdCNT + + prefix_option + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + + ra_header + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + rdnss_option + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S read_args - buf - buf_l_ - buf_r_ - fd - fd_l_ - fd_r_ - nbyte - nbyte_l_ - nbyte_r_ + buf + buf_l_ + buf_r_ + fd + fd_l_ + fd_r_ + nbyte + nbyte_l_ + nbyte_r_ readlink_args - buf - buf_l_ - buf_r_ - count - count_l_ - count_r_ - path - path_l_ - path_r_ + buf + buf_l_ + buf_r_ + count + count_l_ + count_r_ + path + path_l_ + path_r_ + + redirect_header + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_FLD_S + + redirected_header_option + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + + rlimit + rlim_cur + rlim_max + + route_option + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + + rs_header + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_8 sdeWindows - buf - next - pid - prev - status + buf + next + pid + prev + status + + sec_per_clus_table + sectors + sectors_per_cluster + + semaphore + sount + wait setitimer_args - itv - itv_l_ - itv_r_ - oitv - oitv_l_ - oitv_r_ - which - which_l_ - which_r_ + itv + itv_l_ + itv_r_ + oitv + oitv_l_ + oitv_r_ + which + which_l_ + which_r_ + + sFL_FILE + bytenum + file_data_address + file_data_dirty + file_data_sector + filelength + filelength_changed + filename + flags + last_fat_lookup + list_node + parentcluster + path + shortfilename + startcluster + + sigaction + __sa_handler + __sa_sigaction + __sigaction_u + sa_flags + sa_mask sigaction_args - act - act_l_ - act_r_ - oact - oact_l_ - oact_r_ - sig - sig_l_ - sig_r_ + act + act_l_ + act_r_ + oact + oact_l_ + oact_r_ + sig + sig_l_ + sig_r_ sigprocmask_args - how - how_l_ - how_r_ - oset - oset_l_ - oset_r_ - set - set_l_ - set_r_ + how + how_l_ + how_r_ + oset + oset_l_ + oset_r_ + set + set_l_ + set_r_ + + sigval + sigval_int + sigval_ptr + sival_int + sival_ptr + + spinLock + locked + next stat - __st_atimensec - __st_ctimensec - __st_mtimensec - int - st_atime - st_birthtime - st_birthtimensec - st_blksize - st_blocks - st_ctime - st_dev - st_flags - st_gen - st_gid - st_ino - st_lspare - st_mode - st_mtime - st_nlink - st_rdev - st_size - st_uid + __st_atimensec + __st_ctimensec + __st_mtimensec + int + st_atime + st_birthtime + st_birthtimensec + st_blksize + st_blocks + st_ctime + st_dev + st_flags + st_gen + st_gid + st_ino + st_lspare + st_mode + st_mtime + st_nlink + st_rdev + st_size + st_uid + + statfs + f_asyncreads + f_asyncwrites + f_bavail + f_bfree + f_blocks + f_bsize + f_charspare + f_ffree + f_files + f_flags + f_fsid + f_fstypename + f_iosize + f_mntfromname + f_mntonname + f_namemax + f_owner + f_spare + f_syncreads + f_syncwrites + f_type + f_version + + super_block + msdos_sb + s_blocksize + s_blocksize_bits + s_covered + s_dev + s_dirt + s_flags + s_lock + s_magic + s_mounted + s_op + s_rd_only + s_time + s_wait + u + + super_operations + notify_change + put_inode + put_super + read_inode + remount_fs + statfs + write_inode + write_super + + sys_access_args + amode + amode_l_ + amode_r_ + path + path_l_ + path_r_ + + sys_chdir_args + path + path_l_ + path_r_ + + sys_close_args + fd + fd_l_ + fd_r_ + + sys_dup2_args + from + from_l_ + from_r_ + to + to_l_ + to_r_ + + sys_execve_args + argv + argv_l_ + argv_r_ + envp + envp_l_ + envp_r_ + fname + fname_l_ + fname_r_ + + sys_exit_args + status + status_l_ + status_r_ + + sys_fchdir_args + fd + fd_l_ + fd_r_ + + sys_fclose_args + FILE + FILE_l_ + FILE_r_ + + sys_fcntl_args + arg + arg_l_ + arg_r_ + cmd + cmd_l_ + cmd_r_ + fd + fd_l_ + fd_r_ + + sys_fgetc_args + FILE + FILE_l_ + FILE_r_ + + sys_fopen_args + FILE + FILE_l_ + FILE_r_ + mode + mode_l_ + mode_r_ + path + path_l_ + path_r_ + + sys_fork_args + status + status_l_ + status_r_ + + sys_fread_args + FILE + FILE_l_ + FILE_r_ + nmemb + nmemb_l_ + nmemb_r_ + ptr + ptr_l_ + ptr_r_ + size + size_l_ + size_r_ + + sys_fseek_args + FILE + FILE_l_ + FILE_r_ + offset + offset_l_ + offset_r_ + whence + whence_l_ + whence_r_ + + sys_fstat_args + fd + fd_l_ + fd_r_ + sb + sb_l_ + sb_r_ + + sys_fstatat_args + buf + buf_l_ + buf_r_ + fd + fd_l_ + fd_r_ + flag + flag_l_ + flag_r_ + path + path_l_ + path_r_ + + sys_fstatfs_args + buf + buf_l_ + buf_r_ + fd + fd_l_ + fd_r_ + + sys_fwrite_args + buf + fd + nbytes + nmemb + + sys_getcwd_args + buf + buf_l_ + buf_r_ + size + size_l_ + size_r_ + + sys_getdirentries_args + basep + basep_l_ + basep_r_ + buf + buf_l_ + buf_r_ + count + count_l_ + count_r_ + fd + fd_l_ + fd_r_ + + sys_getegid_args + dummy + + sys_geteuid_args + dummy + + sys_getlogin_args + namebuf + namebuf_l_ + namebuf_r_ + namelen + namelen_l_ + namelen_r_ + + sys_getpgrp_args + dummy + + sys_getpid_args + dummy + + sys_getppid_args + dummy + + sys_getrlimit_args + rlp + rlp_l_ + rlp_r_ + which + which_l_ + which_r_ + + sys_gettimeofday_args + tp + tp_l_ + tp_r_ + tzp + tzp_l_ + tzp_r_ + + sys_ioctl_args + com + com_l_ + com_r_ + data + data_l_ + data_r_ + fd + fd_l_ + fd_r_ + + sys_issetugid_args + dummy + + sys_lseek_args + fd + fd_l_ + fd_r_ + offset + offset_l_ + offset_r_ + whence + whence_l_ + whence_r_ + + sys_lstat_args + path + path_l_ + path_r_ + sb + sb_l_ + sb_r_ + + sys_mbox + empty + full + head + lock + msgs + tail + wait_send + + sys_mmap_args + addr + addr_l_ + addr_r_ + fd + fd_l_ + fd_r_ + flags + flags_l_ + flags_r_ + len + len_l_ + len_r_ + pos + pos_l_ + pos_r_ + prot + prot_l_ + prot_r_ + + sys_mpiCreateMbox_args + name + name_l_ + name_r_ + + sys_mpiDestroyMbox_args + name + name_l_ + name_r_ + + sys_mpiFetchMessage_args + msg + msg_l_ + msg_r_ + name + name_l_ + name_r_ + + sys_mpiPostMessage_args + msg + msg_l_ + msg_r_ + name + name_l_ + name_r_ + type + type_l_ + type_r_ + + sys_munmap_args + addr + addr_l_ + addr_r_ + len + len_l_ + len_r_ + + sys_mutex + mutex + + sys_open_args + flags + flags_l_ + flags_r_ + mode + mode_l_ + mode_r_ + path + path_l_ + path_r_ + + sys_openat_args + fd + fd_l_ + fd_r_ + flag + flag_l_ + flag_r_ + mode + mode_l_ + mode_r_ + path + path_l_ + path_r_ + + sys_pipe2_args + fildes + fildes_l_ + fildes_r_ + flags + flags_l_ + flags_r_ + + sys_pread_args + buf + buf_l_ + buf_r_ + fd + fd_l_ + fd_r_ + nbyte + nbyte_l_ + nbyte_r_ + offset + offset_l_ + offset_r_ + + sys_read_args + buf + buf_l_ + buf_r_ + fd + fd_l_ + fd_r_ + nbyte + nbyte_l_ + nbyte_r_ + + sys_readlink_args + buf + buf_l_ + buf_r_ + count + count_l_ + count_r_ + path + path_l_ + path_r_ + + sys_rename_args + from + from_l_ + from_r_ + to + to_l_ + to_r_ + + sys_sde_args + cmd + cmd_l_ + cmd_r_ + ptr + ptr_l_ + ptr_r_ + + sys_select_args + ex + ex_l_ + ex_r_ + in + in_l_ + in_r_ + nd + nd_l_ + nd_r_ + ou + ou_l_ + ou_r_ + tv + tv_l_ + tv_r_ + + sys_sem + cond + mutex + signaled + + sys_sendto_args + buf + buf_l_ + buf_r_ + flags + flags_l_ + flags_r_ + len + len_l_ + len_r_ + s + s_l_ + s_r_ + to + to_l_ + to_r_ + tolen + tolen_l_ + tolen_r_ + + sys_setGID_args + gid + gid + gid_l_ + gid_r_ + + sys_setlogin_args + namebuf + namebuf_l_ + namebuf_r_ + + sys_setpgid_args + pgid + pgid_l_ + pgid_r_ + pid + pid_l_ + pid_r_ + + sys_setrlimit_args + rlp + rlp_l_ + rlp_r_ + which + which_l_ + which_r_ + + sys_setsockopt_args + level + level_l_ + level_r_ + name + name_l_ + name_r_ + s + s_l_ + s_r_ + val + val_l_ + val_r_ + valsize + valsize_l_ + valsize_r_ + + sys_setUID_args + uid + uid + uid_l_ + uid_r_ + + sys_sigaction_args + act + act_l_ + act_r_ + oact + oact_l_ + oact_r_ + sig + sig_l_ + sig_r_ + + sys_sigprocmask_args + how + how_l_ + how_r_ + oset + oset_l_ + oset_r_ + set + set_l_ + set_r_ + + sys_socket_args + domain + domain_l_ + domain_r_ + protocol + protocol_l_ + protocol_r_ + type + type_l_ + type_r_ + + sys_stat_args + path + path_l_ + path_r_ + ub + ub_l_ + ub_r_ + + sys_statfs_args + buf + buf_l_ + buf_r_ + path + path_l_ + path_r_ + + sys_sysarch_args + op + op_l_ + op_r_ + parms + parms_l_ + parms_r_ + + sys_sysctl_args + name + name_l_ + name_r_ + namelen + namelen_l_ + namelen_r_ + newlenp + newlenp_l_ + newlenp_r_ + newp + newp_l_ + newp_r_ + oldlenp + oldlenp_l_ + oldlenp_r_ + oldp + oldp_l_ + oldp_r_ + + sys_thread + name + next + timeouts + ubthread + + sys_timeouts + next + + sys_wait4_args + options + options_l_ + options_r_ + pid + pid_l_ + pid_r_ + rusage + rusage_l_ + rusage_r_ + status + status_l_ + status_r_ + + sys_write_args + buf + buf_l_ + buf_r_ + fd + fd_l_ + fd_r_ + nbyte + nbyte_l_ + nbyte_r_ + + syscall_entry + sc_args + sc_entry + sc_name + sc_status sysctl_args - name - name_l_ - name_r_ - namelen - namelen_l_ - namelen_r_ - new - new_l_ - new_r_ - newlen - newlen_l_ - newlen_r_ - old - old_l_ - old_r_ - oldlenp - oldlenp_l_ - oldlenp_r_ + name + name_l_ + name_r_ + namelen + namelen_l_ + namelen_r_ + new_l_ + new_r_ + newlen + newlen_l_ + newlen_r_ + newp + old_l_ + old_r_ + oldlenp + oldlenp_l_ + oldlenp_r_ + oldp sysctl_entry - children - id - name - next - prev - val_len - value + children + full_name + id + name + namelen + next + prev + val_len + value taskStruct - gid - i387 - id - imageFd - next - oInfo - prev - state - td - term - tss - uid - usedMath + children + counter + egid + euid + exec + files + gid + groups + i387 + id + inodes + last_exit + name + next + oInfo + parent + pgrp + ppid + prev + pwd + root + sgid + state + suid + td + term + tss + uid + usedMath + username + + tcp_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + + tcpip_api_call_data + err + sem + + tcpip_msg + api_call + api_msg + arg + cb + ctx + function + function + inp + input_fn + msg + msg + netif + p + sem + type + + termios + c_cc + c_cflag + c_iflag + c_ispeed + c_lflag + c_oflag + c_ospeed + + tftp_context + close + open + read + write + + TGfx0 + AntiAlias + BlueFieldPosition + BlueShifter + BPP + bSize + DataState + GreenFieldPosition + GreenShifter + lSize + MaxX + MaxY + Owner + RedFieldPosition + RedShifter + TransparentColor + uInt8AlphaFieldPosition + uInt8AlphaShifter + xRes + yRes + Buffer + LineOfs + pal + aaRawLine + clipLine + rawLine + ogAlias + ogArc + ogBSpline + ogCircle + ogClear + ogClone + ogCopy + ogCopyBuf + ogCreate + ogCubicBezierCurve + ogCurve + ogFillCircle + ogFillConvexPolygon + ogFillPolygon + ogFillRect + ogFillTriangle + ogGetAntiAlias + ogGetBPP + ogGetDataState + ogGetMaxX + ogGetMaxY + ogGetPal + ogGetPixel + ogGetPixFmt + ogGetTransparentColor + ogHFlip + ogHLine + ogLine + ogLoadPal + ogPolygon + ogRect + ogRGB + ogSavePal + ogScaleBuf + ogSetAntiAlias + ogSetPixel + ogSetRGBPalette + ogSetTransparentColor + ogSpline + ogTriangle + ogUnpackRGB + ogVFlip + ogVLine + TGfx0 + ~TGfx0 thread - o_files - td_retval - vm_daddr - vm_dsize + abi + frame + o_files + rlim + sigact + sigmask + td_retval + vm_daddr + vm_dsize + vm_taddr + vm_tsize + + thread_start_param + arg + function + thread timespec - tv_nsec - tv_sec + tv_nsec + tv_sec timeStruct - day - hour - min - mon - sec - year + day + hour + min + mon + sec + year timeval - tv_sec - tv_usec + tv_sec + tv_usec timezone - tz_dsttime - tz_minuteswest + tz_dsttime + tz_minuteswest + + TMode_Rec + AlphaFieldPosition + AlphaMaskSize + BankSize + BankSwitch + BitsPerPixel + BlueFieldPosition + BlueMaskSize + BytesPerLine + CharHeight + CharWidth + DirectColourMode + Granularity + GreenFieldPosition + GreenMaskSize + MemoryModel + ModeAttributes + NumberOfBanks + NumBitPlanes + NumOfImagePages + OffScreenMemOffset + OffScreenMemSize + paddington + PhysBasePtr + RedFieldPosition + RedMaskSize + Reserved + WindowAFlags + WindowASeg + WindowBFlags + WindowBSeg + WindowSize + xRes + yRes + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ tms - tms_cstime - tms_cutime - tms_stime - tms_utime + tms_cstime + tms_cutime + tms_stime + tms_utime + + TPixelFmt + AlphaFieldPosition + AlphaMaskSize + BlueFieldPosition + BlueMaskSize + BPP + GreenFieldPosition + GreenMaskSize + RedFieldPosition + RedMaskSize + + TPoint + x + y trapframe - tf_cs - tf_ds - tf_eax - tf_ebp - tf_ebx - tf_ecx - tf_edi - tf_edx - tf_eflags - tf_eip - tf_err - tf_es - tf_esi - tf_esp - tf_fs - tf_isp - tf_ss - tf_trapno + tf_cs + tf_ds + tf_eax + tf_ebp + tf_ebx + tf_ecx + tf_edi + tf_edx + tf_eflags + tf_eip + tf_err + tf_es + tf_esi + tf_esp + tf_fs + tf_gs + tf_isp + tf_ss + tf_trapno + + TRGB + blue + green + red + + TRGBA + alpha + blue + green + red + + Trie + character + e + isLeaf + + TScreen + AntiAlias + BlueFieldPosition + BlueShifter + BPP + bSize + DataState + GreenFieldPosition + GreenShifter + InGraphics + lSize + MaxX + MaxY + ModeRec + Owner + RedFieldPosition + RedShifter + TransparentColor + uInt8AlphaFieldPosition + uInt8AlphaShifter + VESARec + xRes + yRes + ogAlias + ogArc + ogBSpline + ogCircle + ogClear + ogClone + ogCopy + ogCopyBuf + ogCreate + ogCubicBezierCurve + ogCurve + ogFillCircle + ogFillConvexPolygon + ogFillPolygon + ogFillRect + ogFillTriangle + ogGetAntiAlias + ogGetBPP + ogGetDataState + ogGetMaxX + ogGetMaxY + ogGetPal + ogGetPixel + ogGetPixFmt + ogGetTransparentColor + ogHFlip + ogHLine + ogLine + ogLoadPal + ogPolygon + ogRect + ogRGB + ogSavePal + ogScaleBuf + ogSetAntiAlias + ogSetPixel + ogSetRGBPalette + ogSetTransparentColor + ogSpline + ogTriangle + ogUnpackRGB + ogVFlip + ogVLine + setupMode + TScreen + ~TScreen + Buffer + LineOfs + pal + aaRawLine + clipLine + rawLine tssStruct - back_link - back_link_reserved - cr3 - cs - cs_reserved - ds - ds_reserved - eax - ebp - ebx - ecx - edi - edx - eflags - eip - es - es_reserved - esi - esp - esp0 - esp1 - esp2 - fs - fs_reserved - gs - gs_reserved - io_map - io_space - ldt - ldt_reserved - ss - ss0 - ss0_reserved - ss1 - ss1_reserved - ss2 - ss2_reserved - ss_reserved - trace_bitmap + back_link + back_link_reserved + cr3 + cs + cs_reserved + ds + ds_reserved + eax + ebp + ebx + ecx + edi + edx + eflags + eip + es + es_reserved + esi + esp + esp0 + esp1 + esp2 + fs + fs_reserved + gs + gs_reserved + io_map + io_space + ldt + ldt_reserved + ss + ss0 + ss0_reserved + ss1 + ss1_reserved + ss2 + ss2_reserved + ss_reserved + trace_bitmap tty_termNode - owner - stdin - stdinSize - tty_buffer - tty_colour - tty_pointer - tty_x - tty_y + owner + stdin + stdinSize + tty_buffer + tty_colour + tty_pointer + tty_x + tty_y + + TVESA_Rec + Capabilities + majVersion + minVersion + OEMProductNamePtr + OEMProductRevPtr + OEMSoftwareRev + OEMStringPtr + OEMVendorNamePtr + paddington + TotalMemory + VBESignature + VideoModePtr + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ + __attribute__ ubixDiskLabel - driveType - magicNum - magicNum2 - numPartitions - partitions + driveType + magicNum + magicNum2 + numPartitions + partitions ubixDiskLabel::ubixPartitions - pBatSize - pFrag - pFsSize - pFsType - pOffset - pSize + pBatSize + pFrag + pFsSize + pFsType + pOffset + pSize ubixFSInfo - batEntries - blockAllocationTable - dirCache - rootDir + batEntries + blockAllocationTable + dirCache + rootDir ubthread - task + task ubthread_cond - id - locked + id + lock ubthread_cond_list - cond - next + cond + next ubthread_list - next - thread + next + thread ubthread_mutex - id - locked - pid + id + lock + pid ubthread_mutex_list - mutex - next + mutex + next + + ucred + pad + + udp_hdr + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD + PACK_STRUCT_FIELD ufs1_dinode - di_atime - di_atimensec - di_blocks - di_ctime - di_ctimensec - di_db - di_flags - di_gen - di_gid - di_ib - di_mode - di_mtime - di_mtimensec - di_nlink - di_size - di_spare - di_u - di_uid - oldids + di_atime + di_atimensec + di_blocks + di_ctime + di_ctimensec + di_db + di_flags + di_gen + di_gid + di_ib + di_mode + di_mtime + di_mtimensec + di_nlink + di_size + di_spare + di_u + di_uid + oldids ufs2_dinode - di_atime - di_atimensec - di_birthnsec - di_birthtime - di_blksize - di_blocks - di_ctime - di_ctimensec - di_db - di_extb - di_extsize - di_flags - di_gen - di_gid - di_ib - di_kernflags - di_mode - di_mtime - di_mtimensec - di_nlink - di_size - di_spare - di_uid + di_atime + di_atimensec + di_birthnsec + di_birthtime + di_blksize + di_blocks + di_ctime + di_ctimensec + di_db + di_extb + di_extsize + di_flags + di_gen + di_gid + di_ib + di_kernflags + di_mode + di_mtime + di_mtimensec + di_nlink + di_size + di_spare + di_uid + + ufs_args + fspec + + ufsmount + um_balloc + um_blkatoff + um_bo + um_bptrtodb + um_btime + um_candelete + um_cp + um_cred + um_dev + um_devvp + um_fs + um_fsckpid + um_fstype + um_ifree + um_itime + um_mountp + um_nindir + um_qflags + um_quotas + um_rdonly + um_savedmaxfilesize + um_seqinc + um_snapgone + um_softdep + um_trim_inflight + um_trim_tq + um_truncate + um_update + um_valloc + um_vfree + um_writesuspended + + uio + pad userFileDescriptorStruct - fd - fdSize + fd + fdSize + + uthread + __uthread_reserved + arg_mmap + arg_size + stack_size + tls_master_align + tls_master_mmap + tls_master_size + tls_mmap + uthread_flags + uthread_pointer + uthread_size + + uu + q + sl + ul + uq + + uuid + clock_seq_hi_and_reserved + clock_seq_low + node + time_hi_and_version + time_low + time_mid vfs_mountPoint - device - diskLabel - fs - fsInfo - mountPoint - next - partition - perms - prev + device + diskLabel + fs + fsInfo + mountPoint + next + partition + perms + prev vitalsStruct - dQuantum - fileSystems - font - freePages - mountPoints - openFiles - packet - packetLength - quantum - screen - sysTicks - sysUptime - timeStart + dQuantum + fileSystems + font + freePages + lastFD + mountPoints + openFiles + packet + packetLength + quantum + screen + sysTicks + sysUptime + timeStart - write_args - buf - buf_l_ - buf_r_ - fd - fd_l_ - fd_r_ - nbyte - nbyte_l_ - nbyte_r_ + wait_queue + next + task + + winsize + ws_col + ws_row + ws_xpixel + ws_ypixel + + ap-boot.S + + ap-boot.S + + bioscall.c + asm + biosCall + + bioscall.c + biosCall + + exec.c + AT_BASE + AT_ENTRY + AT_EXECFD + AT_FLAGS + AT_IGNORE + AT_NULL + AT_PAGESZ + AT_PHDR + AT_PHENT + AT_PHNUM + AUXARGS_ENTRY + STACK_ADDR + execFile + execThread + sys_exec + sysExec + + fork.c + asm + fork_copyProcess + + fork.c + __asm + fork_copyProcess + qT + sys_fork + + kpanic.c + kpanic + + kpanic.c + kpanic + + sched.c + _current + _usedMath + delList + nextID + schedulerSpinLock + taskList + sched + sched_addDelTask + sched_deleteTask + sched_getDelTask + sched_init + sched_setStatus + sched_yield + schedEndTask + schedFindTask + schedNewTask + + sched.c + _current + _usedMath + delList + need_resched + nextID + schedulerSpinLock + taskList + add_wait_queue + remove_wait_queue + sched + sched_addDelTask + sched_deleteTask + sched_getDelTask + sched_init + sched_setStatus + sched_yield + schedEndTask + schedFindTask + schedNewTask + wake_up + wake_up_interruptible + + schedyield.S + + schedyield.S + + spinlock.c + spinLock + spinLock_scheduler + spinLockInit + spinLockLocked + spinTryLock + spinUnlock + + spinlock.c + atomic_add + atomic_clear_bit + atomic_dec + atomic_inc + atomic_set_bit + atomic_xadd + barrier + cmpxchg + cpu_relax + spinLock + spinLockInit + spinTryLock + spinUnlock + + sys_call.S + + sys_call.S + + sys_call_new.S + + syscall.c + UbixUser + asm + invalidCall + InvalidSystemCall + sysAddModule + sysAuth + sysCheckPid + sysExit + sysGetCwd + sysGetDrives + sysGetFreePage + sysGetGid + sysGetpid + sysGetTime + sysGetUid + sysGetUptime + sysPasswd + sysRmModule + sysSchedYield + sysSetGid + sysSetUid + sysStartSDE + + syscall.c + UbixUser + invalidCall + sys_call + sys_getcwd + sys_sched_yield + sysAddModule + sysAuth + sysCheckPid + sysExit + sysGetDrives + sysGetFreePage + sysGetpid + sysGetTime + sysGetUptime + sysPasswd + sysRmModule + sysStartSDE + + systemtask.c + videoBuffer + systemTask + + systemtask.c + videoBuffer + systemTask + + timer.S + + timer.S + + bios16code.S + + cpu.c + + i386_exec.c + ARGV_PAGE + AT_BASE + AT_ENTRY + AT_EXECFD + AT_FLAGS + AT_IGNORE + AT_NULL + AT_PAGESZ + AT_PHDR + AT_PHENT + AT_PHNUM + AUXARGS_ENTRY + ELF_AUX + ENOEXEC + ENVP_PAGE + STACK_PAD + args_copyin + argv_count + elf_parse_dynamic + envp_count + envs_copyin + execFile + execThread + sys_exec + + memcmp.S + + memset.S + + strcmp.S + + strcpy.S + + strncmp.S + + support.S + + sys_call_posix.S + + trap.c + FIRST_TSS_ENTRY + get_seg_byte + get_seg_long + store_TR + VM_MASK + die_if_kernel + trap + + conf.c + + start.S + + start.S + + crc32.c + crc32_tab + crc32 + + gpt.c + BOOTPROG + MAXTBLENTS + bootonce + curent + gpthdr + gpttable + hdr_backup_lba + hdr_primary_lba + secbuf + table_backup + table_primary + gptbootconv + gptbootfailed + gptfind + gptread + gptread_hdr + gptread_table + gptupdate devfs.c - devfs_init - devfs_initialize - devfs_makeNode - devfs_open - devfs_read - devfs_write - devfs_len - devfsSpinLock + devfs_len + devfsSpinLock + devfs_init + devfs_initialize + devfs_makeNode + devfs_open + devfs_read + devfs_write + + example.c + main + media_init + media_read + media_write + + fat.c + _fd + _mp + fat_init + fat_initialize + media_read + media_write + mkdir_fat + open_fat + read_fat + unlink_fat + write_fat + + fat_access.c + fatfs_get_file_entry + fatfs_get_root_cluster + fatfs_init + fatfs_lba_of_cluster + fatfs_list_directory_next + fatfs_list_directory_start + fatfs_mark_file_deleted + fatfs_read_sector + fatfs_sector_read + fatfs_sector_reader + fatfs_sector_write + fatfs_sfn_exists + fatfs_show_details + fatfs_update_file_length + fatfs_write_sector + + fat_access.h + FAT_DIR_ENTRIES_PER_SECTOR + FAT_INIT_ENDIAN_ERROR + FAT_INIT_INVALID_SECTOR_SIZE + FAT_INIT_INVALID_SIGNATURE + FAT_INIT_MEDIA_ACCESS_ERROR + FAT_INIT_OK + FAT_INIT_STRUCT_PACKING + FAT_INIT_WRONG_FILESYS_TYPE + FAT_INIT_WRONG_PARTITION_TYPE + eFatType + FAT_TYPE_16 + FAT_TYPE_32 + fn_diskio_read + fn_diskio_write + tFatType + fatfs_get_file_entry + fatfs_get_root_cluster + fatfs_init + fatfs_lba_of_cluster + fatfs_list_directory_next + fatfs_list_directory_start + fatfs_mark_file_deleted + fatfs_read_sector + fatfs_sector_read + fatfs_sector_reader + fatfs_sector_write + fatfs_sfn_exists + fatfs_show_details + fatfs_update_file_length + fatfs_update_timestamps + fatfs_write_sector + + fat_cache.c + fatfs_cache_get_next_cluster + fatfs_cache_init + fatfs_cache_set_next_cluster + + fat_cache.h + fatfs_cache_get_next_cluster + fatfs_cache_init + fatfs_cache_set_next_cluster + + fat_defs.h + BPB_BYTSPERSEC + BPB_FAT32_BKBOOTSEC + BPB_FAT32_EXTFLAGS + BPB_FAT32_FATSZ32 + BPB_FAT32_FSINFO + BPB_FAT32_FSVER + BPB_FAT32_ROOTCLUS + BPB_FATSZ16 + BPB_HIDDSEC + BPB_MEDIA + BPB_NUMFATS + BPB_NUMHEADS + BPB_ROOTENTCNT + BPB_RSVDSECCNT + BPB_SECPERCLUS + BPB_SECPERTRK + BPB_TOTSEC16 + BPB_TOTSEC32 + BS_FAT32_BOOTSIG + BS_FAT32_DRVNUM + BS_FAT32_FILSYSTYPE + BS_FAT32_VOLID + BS_FAT32_VOLLAB + BS_FAT_BOOTSIG + BS_FAT_DRVNUM + BS_FAT_FILSYSTYPE + BS_FAT_VOLID + BS_FAT_VOLLAB + BS_JMPBOOT + BS_OEMNAME + FAT32_INVALID_CLUSTER + FAT32_LAST_CLUSTER + FAT32_TYPECODE1 + FAT32_TYPECODE2 + FAT_DATE_DAY_MASK + FAT_DATE_DAY_SHIFT + FAT_DATE_MONTH_MASK + FAT_DATE_MONTH_SHIFT + FAT_DATE_YEAR_MASK + FAT_DATE_YEAR_OFFSET + FAT_DATE_YEAR_SHIFT + FAT_DIR_ENTRY_SIZE + FAT_SFN_SIZE_FULL + FAT_SFN_SIZE_PARTIAL + FAT_TIME_HOURS_MASK + FAT_TIME_HOURS_SHIFT + FAT_TIME_MINUTES_MASK + FAT_TIME_MINUTES_SHIFT + FAT_TIME_SECONDS_MASK + FAT_TIME_SECONDS_SCALE + FAT_TIME_SECONDS_SHIFT + FAT_TYPE_FAT12 + FAT_TYPE_FAT16 + FAT_TYPE_FAT32 + FILE_ATTR_ARCHIVE + FILE_ATTR_DIRECTORY + FILE_ATTR_HIDDEN + FILE_ATTR_LFN_TEXT + FILE_ATTR_READ_ONLY + FILE_ATTR_SYSHID + FILE_ATTR_SYSTEM + FILE_ATTR_VOLUME_ID + FILE_HEADER_BLANK + FILE_HEADER_DELETED + FILE_TYPE_DIR + FILE_TYPE_FILE + PARTITION1_LBA_BEGIN_LOCATION + PARTITION1_SIZE_LOCATION + PARTITION1_TYPECODE_LOCATION + SIGNATURE_POSITION + SIGNATURE_VALUE + + fat_filelib.c + CHECK_FL_INIT + FL_LOCK + FL_UNLOCK + _filelib_init + _filelib_valid + _files + _free_file_list + _fs + _open_file_list + _allocate_file + _check_file_open + _create_directory + _create_file + _fl_init + _free_file + _open_directory + _open_file + _read_sectors + _write_sectors + fl_attach_locks + fl_attach_media + fl_closedir + fl_createdirectory + fl_fclose + fl_feof + fl_fflush + fl_fgetc + fl_fgetpos + fl_fgets + fl_fopen + fl_format + fl_fputc + fl_fputs + fl_fread + fl_fseek + fl_ftell + fl_fwrite + fl_init + fl_is_dir + fl_listdirectory + fl_opendir + fl_readdir + fl_remove + fl_shutdown + + fat_filelib.h + EOF + FILE_APPEND + FILE_BINARY + FILE_CREATE + FILE_ERASE + FILE_READ + FILE_WRITE + SEEK_CUR + SEEK_END + SEEK_SET + FL_DIR + fl_dirent + FL_FILE + fl_attach_locks + fl_attach_media + fl_closedir + fl_createdirectory + fl_fclose + fl_feof + fl_fflush + fl_fgetc + fl_fgetpos + fl_fgets + fl_fopen + fl_format + fl_fputc + fl_fputs + fl_fread + fl_fseek + fl_ftell + fl_fwrite + fl_init + fl_is_dir + fl_listdirectory + fl_opendir + fl_readdir + fl_remove + fl_shutdown + + fat_format.c + _cluster_size_table16 + _cluster_size_table32 + fatfs_calc_cluster_size + fatfs_create_boot_sector + fatfs_create_fsinfo_sector + fatfs_erase_fat + fatfs_erase_sectors + fatfs_format + fatfs_format_fat16 + fatfs_format_fat32 + + fat_format.h + fatfs_format + fatfs_format_fat16 + fatfs_format_fat32 + + fat_fread.c + + fat_list.h + FAT_ASSERT + FAT_INLINE + fat_list_entry + fat_list_first + fat_list_for_each + fat_list_last + fat_list_next + fat_list_prev + fat_list_init + fat_list_insert_after + fat_list_insert_before + fat_list_insert_first + fat_list_insert_last + fat_list_is_empty + fat_list_pop_head + fat_list_remove + + fat_misc.c + fatfs_entry_is_dir + fatfs_entry_is_file + fatfs_entry_lfn_exists + fatfs_entry_lfn_invalid + fatfs_entry_lfn_text + fatfs_entry_sfn_only + fatfs_filename_to_lfn + fatfs_itoa + fatfs_lfn_cache_entry + fatfs_lfn_cache_get + fatfs_lfn_cache_init + fatfs_lfn_create_sfn + fatfs_lfn_entries_required + fatfs_lfn_generate_tail + fatfs_sfn_create_entry + + fat_misc.h + GET_16BIT_WORD + GET_32BIT_WORD + MAX_LFN_ENTRY_LENGTH + MAX_LONGFILENAME_ENTRIES + SET_16BIT_WORD + SET_32BIT_WORD + fatfs_convert_from_fat_date + fatfs_convert_from_fat_time + fatfs_convert_to_fat_date + fatfs_convert_to_fat_time + fatfs_entry_is_dir + fatfs_entry_is_file + fatfs_entry_lfn_exists + fatfs_entry_lfn_invalid + fatfs_entry_lfn_text + fatfs_entry_sfn_only + fatfs_filename_to_lfn + fatfs_lfn_cache_entry + fatfs_lfn_cache_get + fatfs_lfn_cache_init + fatfs_lfn_create_sfn + fatfs_lfn_entries_required + fatfs_lfn_generate_tail + fatfs_print_sector + fatfs_sfn_create_entry + + fat_opts.h + FAT_BUFFER_SECTORS + FAT_BUFFERS + FAT_PRINTF + FAT_SECTOR_SIZE + FATFS_DIR_LIST_SUPPORT + FATFS_INC_FORMAT_SUPPORT + FATFS_INC_LFN_SUPPORT + FATFS_INC_TIME_DATE_SUPPORT + FATFS_INC_WRITE_SUPPORT + FATFS_IS_LITTLE_ENDIAN + FATFS_MAX_LONG_FILENAME + FATFS_MAX_OPEN_FILES + + fat_string.c + fatfs_compare_names + fatfs_create_path_string + fatfs_get_extension + fatfs_get_sfn_display_name + fatfs_get_substring + fatfs_split_path + fatfs_string_ends_with_slash + fatfs_total_path_levels + FileString_GetExtension + FileString_StrCmpNoCase + FileString_TrimLength + + fat_string.h + NULL + fatfs_compare_names + fatfs_create_path_string + fatfs_get_extension + fatfs_get_sfn_display_name + fatfs_get_substring + fatfs_split_path + fatfs_string_ends_with_slash + fatfs_total_path_levels + + fat_table.c + FAT16_GET_16BIT_WORD + FAT16_SET_16BIT_WORD + FAT32_GET_32BIT_WORD + FAT32_SET_32BIT_WORD + fatfs_count_free_clusters + fatfs_fat_add_cluster_to_chain + fatfs_fat_init + fatfs_fat_purge + fatfs_fat_read_sector + fatfs_fat_set_cluster + fatfs_fat_writeback + fatfs_find_blank_cluster + fatfs_find_next_cluster + fatfs_free_cluster_chain + fatfs_set_fs_info_next_free_cluster + + fat_table.h + fatfs_count_free_clusters + fatfs_fat_add_cluster_to_chain + fatfs_fat_init + fatfs_fat_purge + fatfs_fat_set_cluster + fatfs_find_blank_cluster + fatfs_find_next_cluster + fatfs_free_cluster_chain + fatfs_set_fs_info_next_free_cluster + + fat_types.h + FAT_HTONL + FAT_HTONS + NULL + STRUCT_PACK + STRUCT_PACK_BEGIN + STRUCT_PACK_END + STRUCT_PACKED + uint16 + uint32 + uint8 + + fat_write.c + fatfs_add_file_entry + fatfs_add_free_space + fatfs_allocate_free_space + fatfs_find_free_dir_offset + + fat_write.h + fatfs_add_file_entry + fatfs_add_free_space + fatfs_allocate_free_space + + block.c + freeBlocks + getFreeBlocks + syncBat + + dirCache.c + dca_spinLock + ubixfs_cacheAdd + ubixfs_cacheDelete + ubixfs_cacheFind + ubixfs_cacheNew + ubixfs_findName + + directory.c + dirList + addDirEntry + ubixFSLoadDir + ubixFSmkDir + + thread.c + mounts + ubixFS_Info + ubixfs_thread + + ubixfs.c + openFileUbixFS + readUbixFS + ubixfs_init + ubixfs_initialize + ubixfs_loadData + ubixFSUnlink + writeFileByte + writeUbixFS + + btree.cpp + + btree.h + + btreeheader.h + + device.h + + device.h + device_add + device_find + device_remove + + file.h + + file.h + DEV_BSHIFT + DEV_BSIZE + MAX_OFILES + SBLOCKSIZE + SEEK_CUR + SEEK_END + SEEK_SET + VBLKSHIFT + VBLKSIZE + fileDescriptor_t + userFileDescriptor + fdTable + fclose + feof + fgetc + fopen + fread + fseek + fwrite + getchar + sys_fwrite + sysFseek + unlink + verifyDir + + fsAbstract.h + + main.cpp + + ramdrive.cpp + + ramdrive.h + + types.h + + types.h + __CHAR_BIT + __ULONG_MAX + __USHRT_MAX + _INO_T_DECLARED + _INT16_T_DECLARED + _INT32_T_DECLARED + _INT64_T_DECLARED + _INT8_T_DECLARED + _MODE_T_DECLARED + _QUAD_HIGHWORD + _QUAD_LOWWORD + _TIME_T_DECLARED + B + CHAR_BIT + COMBINE + H + HALF_BITS + HHALF + L + LHALF + LHUP + LONG_BITS + NULL + QUAD_BITS + ULONG_MAX + USHRT_MAX + bool + FALSE + TRUE + blkcnt_t + blksize_t + caddr_t + daddr_t + digit + fflags_t + gid_t + ino_t + Int16 + int16_t + Int32 + int32_t + int64_t + Int8 + int8_t + intmax_t + mode_t + off_t + pid_t + pidType + ptrdiff_t + qshift_t + quad_t + size_t + ssize_t + time_t + u_char + u_daddr_t + u_int + u_int16_t + u_int32_t + u_int64_t + u_int8_t + u_long + u_quad_t + u_short + uid_t + uInt + uInt16 + uint16_t + uInt32 + uint32_t + uint64_t + uInt8 + uint8_t + uintfptr_t + uintmax_t + uintptr_t + uquad_t + vm_offset_t + + ubixfs.cpp + + ubixfs.h + + ubixfs.h + blockSize + EOBC + MAXUBIXPARTITIONS + typeContainer + typeDeleted + typeDirectory + typeFile + UBIXDISKMAGIC + UBIXFS_ALIGN + UBIXFS_BLOCKSIZE_BYTES + dirList_t + addDirEntry + freeBlocks + getFreeBlocks + readFile + readUbixFS + syncBat + ubixfs_init + ubixfs_initialize + ubixfs_thread + ubixFSLoadDir + ubixFSmkDir + ubixFSUnlink + writeFileByte + writeUbixFS + + vfs.cpp + + vfs.h + + vfs.h + fdAvail + fdEof + fdOpen + fdRead + fileAppend + fileBinary + fileRead + fileWrite + maxFd + MAY_EXEC + MAY_READ + MAY_WRITE + vfs_findFS + vfs_init + vfsRegisterFS + + ffs.c + ffs_read + + ufs.c + DBPERVBLK + DIP + INDIRPERVBLK + INO_TO_VBA + INO_TO_VBO + INOPB + IPERVBLK + VBLKMASK + VBLKSHIFT + VBLKSIZE + sblock_try + dskread + fsfind + fsread + lookup + ufs_init + ufs_initialize + ufs_openFile + ufs_readFile + ufs_writeFile + + file.c + fdTable + fdTable_lock + vfs_fileTable + fclose + feof + fgetc + fopen + fputc + fread + fseek + fwrite + sys_chdir + sys_fchdir + sys_fclose + sys_fgetc + sys_fopen + sys_fread + sys_fseek + sys_fwrite + sys_lseek + sys_rename + sysFwrite + sysMkDir + sysRmDir + sysUnlink + unlink + + inode.c + inode_wait + nr_free_inodes + __wait_on_inode + iput + unlock_inode + wait_on_inode + write_inode + + mount.c + vfs_addMount + vfs_findMount + vfs_mount + + namei.c + dir_namei + follow_link + lookup + namei + permission + + stat.c + _sys_stat + sys_fstat + sys_fstatat + sys_fstatfs + sys_lstat + sys_stat + sys_statfs + + vfs.c + vfs_init + vfsFindFS + vfsRegisterFS assert.h - __BEGIN_DECLS - __END_DECLS - _assert - assert - __assert + __BEGIN_DECLS + __END_DECLS + _assert + assert + __assert devfs.h - devfs_init - devfs_makeNode + devfs_init + devfs_makeNode + + fat.h + FAT_PRINTF + fat_init + + crc32.h + crc32 + + gpt.h + bcmp + bcopy + bzero + DEV_BSHIFT + DEV_BSIZE + GPT_ENT_ATTR_BOOTFAILED + GPT_ENT_ATTR_BOOTME + GPT_ENT_ATTR_BOOTONCE + GPT_ENT_ATTR_PLATFORM + GPT_ENT_TYPE_EFI + GPT_ENT_TYPE_FREEBSD + GPT_ENT_TYPE_FREEBSD_BOOT + GPT_ENT_TYPE_FREEBSD_NANDFS + GPT_ENT_TYPE_FREEBSD_SWAP + GPT_ENT_TYPE_FREEBSD_UFS + GPT_ENT_TYPE_FREEBSD_VINUM + GPT_ENT_TYPE_FREEBSD_ZFS + GPT_ENT_TYPE_MBR + GPT_ENT_TYPE_PREP_BOOT + GPT_ENT_TYPE_UNUSED + GPT_HDR_REVISION + GPT_HDR_SIG + gptbootfailed + gptfind + gptread + + msdos_fs.h + + pipe_fs.h + PIPE_BASE + PIPE_EMPTY + PIPE_END + PIPE_FREE + PIPE_FULL + PIPE_LEN + PIPE_LOCK + PIPE_MAX_RCHUNK + PIPE_MAX_WCHUNK + PIPE_RD_OPENERS + PIPE_READERS + PIPE_SIZE + PIPE_START + PIPE_WAIT + PIPE_WR_OPENERS + PIPE_WRITERS + + asmacros.h + ALIGN_TEXT + CNAME + END + ENTRY + GEN_ENTRY + MCOUNT + + atkbd.h + altKey + controlKey + ledCapslock + ledNumlock + ledScrolllock + shiftKey + atkbd_init + atkbd_isr + keyboardHandler + setLED + + atkbd.h + altKey + controlKey + ledCapslock + ledNumlock + ledScrolllock + shiftKey + atkbd_init + atkbd_isr + keyboardHandler + setLED + + cpu.h + PSL_AC + PSL_AF + PSL_C + PSL_D + PSL_I + PSL_ID + PSL_IOPL + PSL_N + PSL_NT + PSL_PF + PSL_RF + PSL_T + PSL_V + PSL_VIF + PSL_VIP + PSL_VM + PSL_Z + invlpg + load_cr0 + load_cr3 + load_cr4 + rcr0 + rcr2 + rcr3 + rcr4 + + cpu.h + BYTE_ORDER + + elf.h + + elf.h + __i386__ + elfExecutable + elfLibrary + elf_file_t + elf_load_file + elfGetPhType + elfGetRelType + elfGetShType + + limits.h + __LONG_BIT + + limits.h + LONG_BIT + + signal.h + _NSIG + NSIG + SIGABRT + SIGALRM + SIGBUS + SIGCHLD + SIGCONT + SIGFPE + SIGHUP + SIGILL + SIGINT + SIGIO + SIGIOT + SIGKILL + SIGPIPE + SIGPOLL + SIGPROF + SIGPWR + SIGQUIT + SIGSEGV + SIGSTKFLT + SIGSTOP + SIGTERM + SIGTRAP + SIGTSTP + SIGTTIN + SIGTTOU + SIGUNUSED + SIGURG + SIGUSR1 + SIGUSR2 + SIGVTALRM + SIGWINCH + SIGXCPU + SIGXFSZ + + signal.h + _SIG_BIT + _SIG_IDX + _SIG_MAXSIG + _SIG_VALID + _SIG_WORD + _SIG_WORDS + sa_handler + sa_sigaction + SIG_BLOCK + SIG_SETMASK + SIG_UNBLOCK + siginfo_t 8259.h - eoi - icw1 - icw4 - mImr - mPic - mVec - ocw3Irr - ocw3Isr - sImr - sPic - sVec - i8259_init - irqDisable - irqEnable - - atkbd.h - altKey - controlKey - ledCapslock - ledNumlock - ledScrolllock - shiftKey - atkbd_init - atkbd_isr - keyboardHandler - setLED + eoi + icw1 + icw4 + mImr + mPic + mVec + ocw3Irr + ocw3Isr + sImr + sPic + sVec + i8259_init + irqDisable + irqEnable fdc.h - cmdRead - cmdRecal - cmdSeek - cmdSensei - cmdSpecify - cmdWrite - dg144Gap3rw - dg144Heads - dg144Spt - dg144Tracks - dg168Gap3rw - fdcCcr - fdcData - fdcDir - fdcDor - fdcDrs - fdcMsr - drvGeom - block2Hts - fdc_init - fdcRead - fdcRw - fdcWrite - floppyIsr - floppyIsrhndlr - getByte - motorOff - motorOn - readBlock - recalibrate - reset - seek - sendByte - waitFdc - writeBlock + cmdRead + cmdRecal + cmdSeek + cmdSensei + cmdSpecify + cmdWrite + dg144Gap3rw + dg144Heads + dg144Spt + dg144Tracks + dg168Gap3rw + fdcCcr + fdcData + fdcDir + fdcDor + fdcDrs + fdcMsr + drvGeom + block2Hts + fdc_init + fdcRead + fdcRw + fdcWrite + floppyIsr + floppyIsrhndlr + getByte + motorOff + motorOn + readBlock + recalibrate + reset + seek + sendByte + waitFdc + writeBlock mouse.h - _MOUSE_H - mouseHandler - mouseInit - mouseISR + mouseHandler + mouseInit + mouseISR ne2k.h - DEF_ENABLED - DP_CNTR0 - DP_CNTR1 - DP_CNTR2 - DP_CURR - DP_MAR0 - DP_MAR1 - DP_MAR2 - DP_MAR3 - DP_MAR4 - DP_MAR5 - DP_MAR6 - DP_MAR7 - DP_PAGESIZE - E8390_CMD - E8390_NODMA - E8390_PAGE0 - E8390_PAGE1 - E8390_RREAD - E8390_RWRITE - E8390_RXCONFIG - E8390_RXOFF - E8390_START - E8390_STOP - E8390_TXCONFIG - E8390_TXOFF - EN0_BOUNDARY - EN0_COUNTER0 - EN0_DCFG - EN0_IMR - EN0_ISR - EN0_RCNTHI - EN0_RCNTLO - EN0_RSARHI - EN0_RSARLO - EN0_RXCR - EN0_STARTPG - EN0_STOPPG - EN0_TPSR - EN0_TXCR - EN1_CURPAG - EN1_MULT - EN1_PHYS - ENDCFG_WTS - ENISR_ALL - ether_addr - NE1SM_START_PG - NE1SM_STOP_PG - NE_BNRY - NE_CMD - NE_CURRENT - NE_DATAPORT - NE_DCR - NE_DCR_AR - NE_DCR_FT0 - NE_DCR_FT1 - NE_DCR_LS - NE_DCR_WTS - NE_IMR - NE_ISR - NE_PSTART - NE_PSTOP - NE_RBCR0 - NE_RBCR1 - NE_RCR - NE_TCR - NE_TPSR - NESM_START_PG - NESM_STOP_PG - OK - RSR_FO - RSR_PRX - startPage - stopPage - TX_1X_PAGES - TX_2X_PAGES - TX_PAGES - dp_rcvhdr_t - ether_addr_t - ne2k_init - ne2kAllocBuffer - ne2kDevInit - ne2kFreeBuffer - ne2kGetBuffer - ne2kHandler - ne2kISR - ne2kProbe - NICtoPC - NS8390_init - PCtoNIC - nicPacket - packetLength + DEF_ENABLED + DP_CNTR0 + DP_CNTR1 + DP_CNTR2 + DP_CURR + DP_MAR0 + DP_MAR1 + DP_MAR2 + DP_MAR3 + DP_MAR4 + DP_MAR5 + DP_MAR6 + DP_MAR7 + DP_PAGESIZE + E8390_CMD + E8390_NODMA + E8390_PAGE0 + E8390_PAGE1 + E8390_RREAD + E8390_RWRITE + E8390_RXCONFIG + E8390_RXOFF + E8390_START + E8390_STOP + E8390_TXCONFIG + E8390_TXOFF + EN0_BOUNDARY + EN0_COUNTER0 + EN0_DCFG + EN0_IMR + EN0_ISR + EN0_RCNTHI + EN0_RCNTLO + EN0_RSARHI + EN0_RSARLO + EN0_RXCR + EN0_STARTPG + EN0_STOPPG + EN0_TPSR + EN0_TXCR + EN1_CURPAG + EN1_MULT + EN1_PHYS + ENDCFG_WTS + ENISR_ALL + ether_addr + NE1SM_START_PG + NE1SM_STOP_PG + NE_BNRY + NE_CMD + NE_CURRENT + NE_DATAPORT + NE_DCR + NE_DCR_AR + NE_DCR_FT0 + NE_DCR_FT1 + NE_DCR_LS + NE_DCR_WTS + NE_IMR + NE_ISR + NE_PSTART + NE_PSTOP + NE_RBCR0 + NE_RBCR1 + NE_RCR + NE_TCR + NE_TPSR + NESM_START_PG + NESM_STOP_PG + OK + RSR_FO + RSR_PRX + startPage + stopPage + TX_1X_PAGES + TX_2X_PAGES + TX_PAGES + dp_rcvhdr_t + ether_addr_t + nicPacket + packetLength + ne2k_init + ne2kAllocBuffer + ne2kDevInit + ne2kFreeBuffer + ne2kGetBuffer + ne2kHandler + ne2kISR + ne2kProbe + NICtoPC + NS8390_init + PCtoNIC pit.h - PIT_TIMER - pit_init + PIT_TIMER + pit_init bioscall.h - EFLAG_IF - EFLAG_IOPL3 - EFLAG_TF - EFLAG_VM - bios16Code - biosCall + EFLAG_IF + EFLAG_IOPL3 + EFLAG_TF + EFLAG_VM + bios16Code + biosCall + + kern_trie.h + CHAR_SIZE + delete_trieNode + insert_trieNode + new_trieNode + search_trieNode kmalloc.h - MALLOC_ALIGN - MALLOC_ALIGN_SIZE - sysID - kfree - kmalloc - - kprint.h - kprintf - printOff + MALLOC_ALIGN + MALLOC_ALIGN_SIZE + sysID + kfree + kmalloc kprintf.h - kprintf - ogPrintf - ogprintOff - printOff + MAXNBUF + ogprintOff + printOff + kprintf + kvprintf + ogPrintf + sprintf libcpp.h - operator delete - operator delete[] - operator new - operator new[] - - string.h - memcmp - memcpy - memset - sprintf - strcmp - strcpy - strlen - strncmp - strncpy - strstr - strtok - strtok_r - - string.h - memcpy - memset - sprintf - strcmp - strcpy - strlen - strtol + operator delete + operator delete[] + operator new + operator new[] math.h - u_quad_t - __divdi3 - __udivdi3 - atan - sqrt + __divdi3 + __udivdi3 + atan + sqrt mpi.h - MESSAGE_LENGTH - mpi_mbox_t - mpi_message_t - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_postMessage - mpi_spam + MESSAGE_LENGTH + mpi_mbox_t + mpi_message_t + mpi_createMbox + mpi_destroyMbox + mpi_fetchMessage + mpi_postMessage + mpi_spam - arp.h - ARP_TMR_INTERVAL - ETHTYPE_ARP - ETHTYPE_IP - arp_arp_input - arp_init - arp_ip_input - arp_lookup - arp_query - arp_tmr - PACK_STRUCT_STRUCT - PACK_STRUCT_STRUCT + api.h + + fs.h + FS_FILE_FLAGS_HEADER_INCLUDED + FS_FILE_FLAGS_HEADER_PERSISTENT + FS_READ_DELAYED + FS_READ_EOF + fs_bytes_left + fs_close + fs_open + + fs.h + ACTIVECGNUM + ACTIVECGOFF + ACTIVECLEAR + ACTIVESET + AFPDIR + AVFILESIZ + BLK_NOCOPY + BLK_SNAP + blkmap + blknum + blkoff + blkroundup + blksize + blkstofrags + cg_blksfree + cg_chkmagic + cg_clustersfree + cg_clustersum + cg_inosused + CG_MAGIC + cgbase + cgdata + cgdmin + cgimin + cgmeta + cgsblock + CGSIZE + cgstart + cgtod + dbtofsb + DEFAULTOPT + dtog + dtogd + FFS_ADJ_BLKCNT + FFS_ADJ_NBFREE + FFS_ADJ_NDIR + FFS_ADJ_NFFREE + FFS_ADJ_NIFREE + FFS_ADJ_NUMCLUSTERS + FFS_ADJ_REFCNT + FFS_BLK_FREE + FFS_CMD_VERSION + FFS_DIR_FREE + FFS_FILE_FREE + FFS_MAXID + FFS_SET_BUFOUTPUT + FFS_SET_CWD + FFS_SET_DOTDOT + FFS_SET_FLAGS + FFS_SET_INODE + FFS_UNLINK + fragnum + fragoff + fragroundup + fragstoblks + freespace + FS_42INODEFMT + FS_44INODEFMT + FS_ACLS + FS_BAD_MAGIC + fs_cs + FS_DOSOFTDEP + FS_FLAGS_UPDATED + FS_GJOURNAL + FS_INDEXDIRS + FS_MAXCONTIG + FS_MULTILABEL + FS_NEEDSFSCK + FS_NFS4ACLS + FS_OKAY + FS_OPTSPACE + FS_OPTTIME + FS_SUJ + FS_TRIM + FS_UFS1_MAGIC + FS_UFS2_MAGIC + FS_UNCLEAN + fsbtodb + FSMAXSNAP + ino_to_cg + ino_to_fsba + ino_to_fsbo + INOPB + INOPF + JOP_ADDREF + JOP_FREEBLK + JOP_MVREF + JOP_NEWBLK + JOP_REMREF + JOP_SYNC + JOP_TRUNC + JREC_SIZE + lblkno + lblktosize + lfragtosize + MAXFRAG + MAXMNTLEN + MAXVOLLEN + MINBSIZE + MINCYLGRPS + MINFREE + NINDIR + NOCSPTRS + numfrags + sblksize + SBLOCK_FLOPPY + SBLOCK_PIGGY + SBLOCK_UFS1 + SBLOCK_UFS2 + SBLOCKSEARCH + SBLOCKSIZE + smalllblktosize + SUJ_FILE + SUJ_MAX + SUJ_MIN + UFSRESUME + UFSSUSPEND + around + fragtbl + inside + lbn_level + lbn_offset + + httpd.h + httpd_init + + httpd_opts.h + HTTP_IS_TAG_VOLATILE + HTTPD_DEBUG + HTTPD_DEBUG_TIMING + HTTPD_LIMIT_SENDING_TO_2MSS + HTTPD_MAX_RETRIES + HTTPD_MAX_WRITE_LEN + HTTPD_POLL_INTERVAL + HTTPD_PRECALCULATED_CHECKSUM + HTTPD_SERVER_AGENT + HTTPD_SERVER_PORT + HTTPD_TCP_PRIO + HTTPD_USE_CUSTOM_FSDATA + HTTPD_USE_MEM_POOL + LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR + LWIP_HTTPD_CGI + LWIP_HTTPD_CGI_SSI + LWIP_HTTPD_CUSTOM_FILES + LWIP_HTTPD_DYNAMIC_FILE_READ + LWIP_HTTPD_DYNAMIC_HEADERS + LWIP_HTTPD_FILE_STATE + LWIP_HTTPD_FS_ASYNC_READ + LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED + LWIP_HTTPD_MAX_CGI_PARAMETERS + LWIP_HTTPD_MAX_REQ_LENGTH + LWIP_HTTPD_MAX_REQUEST_URI_LEN + LWIP_HTTPD_MAX_TAG_INSERT_LEN + LWIP_HTTPD_MAX_TAG_NAME_LEN + LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI + LWIP_HTTPD_POST_MANUAL_WND + LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN + LWIP_HTTPD_REQ_BUFSIZE + LWIP_HTTPD_REQ_QUEUELEN + LWIP_HTTPD_SSI + LWIP_HTTPD_SSI_INCLUDE_TAG + LWIP_HTTPD_SSI_MULTIPART + LWIP_HTTPD_SSI_RAW + LWIP_HTTPD_SUPPORT_11_KEEPALIVE + LWIP_HTTPD_SUPPORT_EXTSTATUS + LWIP_HTTPD_SUPPORT_POST + LWIP_HTTPD_SUPPORT_REQUESTLIST + LWIP_HTTPD_SUPPORT_V09 + LWIP_HTTPD_TIMING + + lwiperf.h + LWIPERF_TCP_PORT_DEFAULT + lwiperf_report_type + LWIPERF_TCP_DONE_SERVER + LWIPERF_TCP_DONE_CLIENT + LWIPERF_TCP_ABORTED_LOCAL + LWIPERF_TCP_ABORTED_LOCAL_DATAERROR + LWIPERF_TCP_ABORTED_LOCAL_TXERROR + LWIPERF_TCP_ABORTED_REMOTE + lwiperf_report_fn + lwiperf_abort + lwiperf_start_tcp_server + lwiperf_start_tcp_server_default + + mdns.h + + mdns_opts.h + LWIP_MDNS_RESPONDER + MDNS_DEBUG + MDNS_MAX_SERVICES + + mdns_priv.h + + mqtt.h + MQTT_PORT + mqtt_subscribe + mqtt_unsubscribe + @1 + MQTT_DATA_FLAG_LAST + mqtt_connection_status_t + MQTT_CONNECT_ACCEPTED + MQTT_CONNECT_REFUSED_PROTOCOL_VERSION + MQTT_CONNECT_REFUSED_IDENTIFIER + MQTT_CONNECT_REFUSED_SERVER + MQTT_CONNECT_REFUSED_USERNAME_PASS + MQTT_CONNECT_REFUSED_NOT_AUTHORIZED_ + MQTT_CONNECT_DISCONNECTED + MQTT_CONNECT_TIMEOUT + mqtt_client_t + mqtt_connection_cb_t + mqtt_incoming_data_cb_t + mqtt_incoming_publish_cb_t + mqtt_request_cb_t + mqtt_client_connect + mqtt_client_is_connected + mqtt_client_new + mqtt_disconnect + mqtt_publish + mqtt_set_inpub_callback + mqtt_sub_unsub + + mqtt_opts.h + MQTT_CONNECT_TIMOUT + MQTT_CYCLIC_TIMER_INTERVAL + MQTT_OUTPUT_RINGBUF_SIZE + MQTT_REQ_MAX_IN_FLIGHT + MQTT_REQ_TIMEOUT + MQTT_VAR_HEADER_BUFFER_LEN + + netbiosns.h + netbiosns_init + netbiosns_set_name + netbiosns_stop + + netbiosns_opts.h + + snmp.h + + snmp.h + mib2_add_arp_entry + mib2_add_ip4 + mib2_add_route_ip4 + MIB2_COPY_SYSUPTIME_TO + MIB2_INIT_NETIF + mib2_netif_added + mib2_netif_removed + mib2_remove_arp_entry + mib2_remove_ip4 + mib2_remove_route_ip4 + MIB2_STATS_NETIF_ADD + MIB2_STATS_NETIF_INC + mib2_udp_bind + mib2_udp_unbind + NETIF_INIT_SNMP + snmp_add_ifinoctets + snmp_add_ifoutoctets + snmp_inc_ifindiscards + snmp_inc_ifinerrors + snmp_inc_ifinnucastpkts + snmp_inc_ifinucastpkts + snmp_inc_ifinunknownprotos + snmp_inc_ifoutdiscards + snmp_inc_ifouterrors + snmp_inc_ifoutnucastpkts + snmp_inc_ifoutucastpkts + + snmp_core.h + + snmp_mib2.h + + snmp_opts.h + LWIP_SNMP + LWIP_SNMP_V3 + LWIP_SNMP_V3_CRYPTO + LWIP_SNMP_V3_MBEDTLS + SNMP_COMMUNITY + SNMP_COMMUNITY_TRAP + SNMP_COMMUNITY_WRITE + SNMP_DEBUG + SNMP_DEVICE_ENTERPRISE_OID + SNMP_DEVICE_ENTERPRISE_OID_LEN + SNMP_LWIP_ENTERPRISE_OID + SNMP_LWIP_GETBULK_MAX_REPETITIONS + SNMP_LWIP_MIB2 + SNMP_LWIP_MIB2_SYSCONTACT + SNMP_LWIP_MIB2_SYSDESC + SNMP_LWIP_MIB2_SYSLOCATION + SNMP_LWIP_MIB2_SYSNAME + SNMP_MAX_COMMUNITY_STR_LEN + SNMP_MAX_OBJ_ID_LEN + SNMP_MAX_OCTET_STRING_LEN + SNMP_MAX_VALUE_SIZE + SNMP_MIB_DEBUG + SNMP_MIN_VALUE_SIZE + SNMP_SAFE_REQUESTS + SNMP_TRAP_DESTINATIONS + SNMP_USE_NETCONN + SNMP_USE_RAW + + snmp_scalar.h + + snmp_table.h + + snmp_threadsync.h + + snmpv3.h + + sntp.h + SNTP_OPMODE_LISTENONLY + SNTP_OPMODE_POLL + sntp_servermode_dhcp + sntp_enabled + sntp_getoperatingmode + sntp_getserver + sntp_init + sntp_setoperatingmode + sntp_setserver + sntp_stop + + sntp_opts.h + SNTP_CHECK_RESPONSE + SNTP_DEBUG + SNTP_GET_SERVERS_FROM_DHCP + SNTP_GET_SYSTEM_TIME + SNTP_MAX_SERVERS + SNTP_PORT + SNTP_RECV_TIMEOUT + SNTP_RETRY_TIMEOUT + SNTP_RETRY_TIMEOUT_EXP + SNTP_RETRY_TIMEOUT_MAX + SNTP_SERVER_DNS + SNTP_SET_SYSTEM_TIME + SNTP_STARTUP_DELAY + SNTP_STARTUP_DELAY_FUNC + SNTP_UPDATE_DELAY + + tftp_opts.h + TFTP_DEBUG + TFTP_MAX_FILENAME_LEN + TFTP_MAX_MODE_LEN + TFTP_MAX_RETRIES + TFTP_PORT + TFTP_TIMEOUT_MSECS + TFTP_TIMER_MSECS + + tftp_server.h + tftp_init + + arch.h + BIG_ENDIAN + BYTE_ORDER + LITTLE_ENDIAN + LWIP_ALIGNMENT_CAST + LWIP_CONST_CAST + LWIP_DECLARE_MEMORY_ALIGNED + LWIP_MEM_ALIGN + LWIP_MEM_ALIGN_BUFFER + LWIP_MEM_ALIGN_SIZE + LWIP_NO_INTTYPES_H + LWIP_NO_LIMITS_H + LWIP_NO_STDDEF_H + LWIP_NO_STDINT_H + LWIP_PLATFORM_ASSERT + LWIP_PLATFORM_DIAG + LWIP_PTR_NUMERIC_CAST + LWIP_UNUSED_ARG + PACK_STRUCT_BEGIN + PACK_STRUCT_END + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_STRUCT + S16_F + S32_F + SZT_F + U16_F + U32_F + X16_F + X32_F + X8_F + mem_ptr_t + s16_t + s32_t + s8_t + u16_t + u32_t + u8_t + + cc.h + LWIP_ERR_T + PACK_STRUCT_BEGIN + PACK_STRUCT_END + PACK_STRUCT_FIELD + PACK_STRUCT_STRUCT + + init.h + TCPIP_INIT_DONE + + init.h + LWIP_RC_DEVELOPMENT + LWIP_RC_RELEASE + LWIP_VERSION + LWIP_VERSION_IS_DEVELOPMENT + LWIP_VERSION_IS_RC + LWIP_VERSION_IS_RELEASE + LWIP_VERSION_MAJOR + LWIP_VERSION_MINOR + LWIP_VERSION_RC + LWIP_VERSION_REVISION + LWIP_VERSION_STRING + LWIP_VERSION_STRING_SUFFIX + LWIP_VERSTR + LWIP_VERSTR2 + lwip_init + + init.h + intFunctionPTR + init_tasks + init_tasksTotal + + lib.h + bcopy + bzero + strlen + strncmp + + perf.h + PERF_START + PERF_STOP + perf_init + perf_print + perf_print_times + + sys_arch.h + SYS_MBOX_NULL + SYS_MBOX_SIZE + SYS_SEM_NULL + sys_mbox_t + sys_mutex_t + sys_thread_t + + autoip.h + + autoip.h + ANNOUNCE_INTERVAL + ANNOUNCE_NUM + ANNOUNCE_WAIT + AUTOIP_NET + AUTOIP_RANGE_END + AUTOIP_RANGE_START + DEFEND_INTERVAL + MAX_CONFLICTS + PROBE_MAX + PROBE_MIN + PROBE_NUM + PROBE_WAIT + RATE_LIMIT_INTERVAL + autoip_state_enum_t + AUTOIP_STATE_OFF + AUTOIP_STATE_PROBING + AUTOIP_STATE_ANNOUNCING + AUTOIP_STATE_BOUND + + debug.h + LWIP_DBG_LEVEL_ALL + LWIP_DBG_LEVEL_SERIOUS + LWIP_DBG_LEVEL_SEVERE + LWIP_DBG_LEVEL_WARNING + LWIP_DBG_OFF + LWIP_DBG_ON + LWIP_DBG_FRESH + LWIP_DBG_HALT + LWIP_DBG_STATE + LWIP_DBG_TRACE + LWIP_ASSERT + LWIP_DBG_LEVEL_OFF + LWIP_DBG_MASK_LEVEL + LWIP_DEBUGF + LWIP_ERROR + LWIP_PLATFORM_ERROR + + def.h + htonl + htons + LWIP_ARRAYSIZE + lwip_htonl + lwip_htons + LWIP_MAKEU32 + LWIP_MAX + LWIP_MIN + lwip_ntohl + lwip_ntohs + ntohl + ntohs + NULL + PERF_START + PERF_STOP + PP_HTONL + PP_HTONS + PP_NTOHL + PP_NTOHS + lwip_itoa + lwip_stricmp + lwip_strnicmp + lwip_strnstr + + dhcp.h + + dhcp.h + DHCP_ACK + DHCP_BOOTREPLY + DHCP_BOOTREQUEST + DHCP_CHADDR_LEN + DHCP_CLIENT_PORT + DHCP_DECLINE + DHCP_DISCOVER + DHCP_FILE_LEN + DHCP_FILE_OFS + DHCP_HTYPE_ETH + DHCP_INFORM + DHCP_MAGIC_COOKIE + DHCP_MIN_OPTIONS_LEN + DHCP_MSG_LEN + DHCP_NAK + DHCP_OFFER + DHCP_OPTION_BOOTFILE + DHCP_OPTION_BROADCAST + DHCP_OPTION_CLIENT_ID + DHCP_OPTION_DNS_SERVER + DHCP_OPTION_END + DHCP_OPTION_HOSTNAME + DHCP_OPTION_IP_TTL + DHCP_OPTION_LEASE_TIME + DHCP_OPTION_MAX_MSG_SIZE + DHCP_OPTION_MAX_MSG_SIZE_LEN + DHCP_OPTION_MESSAGE_TYPE + DHCP_OPTION_MESSAGE_TYPE_LEN + DHCP_OPTION_MTU + DHCP_OPTION_NTP + DHCP_OPTION_OVERLOAD + DHCP_OPTION_PAD + DHCP_OPTION_PARAMETER_REQUEST_LIST + DHCP_OPTION_REQUESTED_IP + DHCP_OPTION_ROUTER + DHCP_OPTION_SERVER_ID + DHCP_OPTION_SUBNET_MASK + DHCP_OPTION_T1 + DHCP_OPTION_T2 + DHCP_OPTION_TCP_TTL + DHCP_OPTION_TFTP_SERVERNAME + DHCP_OPTION_US + DHCP_OPTIONS_LEN + DHCP_OPTIONS_OFS + DHCP_OVERLOAD_FILE + DHCP_OVERLOAD_NONE + DHCP_OVERLOAD_SNAME + DHCP_OVERLOAD_SNAME_FILE + DHCP_RELEASE + DHCP_REQUEST + DHCP_SERVER_PORT + DHCP_SNAME_LEN + DHCP_SNAME_OFS + dhcp_state_enum_t + DHCP_STATE_OFF + DHCP_STATE_REQUESTING + DHCP_STATE_INIT + DHCP_STATE_REBOOTING + DHCP_STATE_REBINDING + DHCP_STATE_RENEWING + DHCP_STATE_SELECTING + DHCP_STATE_INFORMING + DHCP_STATE_CHECKING + DHCP_STATE_PERMANENT + DHCP_STATE_BOUND + DHCP_STATE_RELEASING + DHCP_STATE_BACKING_OFF + PACK_STRUCT_STRUCT + + dhcp6.h + + dns.h + + dns.h + DNS_FLAG1_AUTHORATIVE + DNS_FLAG1_OPCODE_INVERSE + DNS_FLAG1_OPCODE_STANDARD + DNS_FLAG1_OPCODE_STATUS + DNS_FLAG1_RD + DNS_FLAG1_RESPONSE + DNS_FLAG1_TRUNC + DNS_FLAG2_ERR_MASK + DNS_FLAG2_ERR_NAME + DNS_FLAG2_ERR_NONE + DNS_FLAG2_RA + DNS_HDR_GET_OPCODE + DNS_MQUERY_IPV4_GROUP_INIT + DNS_MQUERY_IPV6_GROUP_INIT + DNS_MQUERY_PORT + DNS_RRCLASS_ANY + DNS_RRCLASS_CH + DNS_RRCLASS_CS + DNS_RRCLASS_FLUSH + DNS_RRCLASS_HS + DNS_RRCLASS_IN + DNS_RRTYPE_A + DNS_RRTYPE_AAAA + DNS_RRTYPE_ANY + DNS_RRTYPE_CNAME + DNS_RRTYPE_HINFO + DNS_RRTYPE_MB + DNS_RRTYPE_MD + DNS_RRTYPE_MF + DNS_RRTYPE_MG + DNS_RRTYPE_MINFO + DNS_RRTYPE_MR + DNS_RRTYPE_MX + DNS_RRTYPE_NS + DNS_RRTYPE_NULL + DNS_RRTYPE_PTR + DNS_RRTYPE_SOA + DNS_RRTYPE_SRV + DNS_RRTYPE_TXT + DNS_RRTYPE_WKS + DNS_SERVER_PORT + SIZEOF_DNS_HDR + PACK_STRUCT_STRUCT + + err.h + ERR_IS_FATAL + lwip_strerr + err_enum_t + ERR_OK + ERR_MEM + ERR_BUF + ERR_TIMEOUT + ERR_RTE + ERR_INPROGRESS + ERR_VAL + ERR_WOULDBLOCK + ERR_USE + ERR_ALREADY + ERR_ISCONN + ERR_CONN + ERR_IF + ERR_ABRT + ERR_RST + ERR_CLSD + ERR_ARG + err_t + err_to_errno + + errno.h + + errno.h + E2BIG + EACCES + EADDRINUSE + EADDRNOTAVAIL + EAFNOSUPPORT + EAGAIN + EALREADY + EAUTH + EBADF + EBADMSG + EBADRPC + EBUSY + ECANCELED + ECAPMODE + ECHILD + ECONNABORTED + ECONNREFUSED + ECONNRESET + EDEADLK + EDESTADDRREQ + EDOM + EDOOFUS + EDQUOT + EEXIST + EFAULT + EFBIG + EFTYPE + EHOSTDOWN + EHOSTUNREACH + EIDRM + EILSEQ + EINPROGRESS + EINTR + EINVAL + EIO + EISCONN + EISDIR + ELAST + ELOOP + EMFILE + EMLINK + EMSGSIZE + EMULTIHOP + ENAMETOOLONG + ENEEDAUTH + ENETDOWN + ENETRESET + ENETUNREACH + ENFILE + ENOATTR + ENOBUFS + ENODEV + ENOENT + ENOEXEC + ENOLCK + ENOLINK + ENOMEM + ENOMSG + ENOPROTOOPT + ENOSPC + ENOSYS + ENOTBLK + ENOTCAPABLE + ENOTCONN + ENOTDIR + ENOTEMPTY + ENOTRECOVERABLE + ENOTSOCK + ENOTSUP + ENOTTY + ENXIO + EOPNOTSUPP + EOVERFLOW + EOWNERDEAD + EPERM + EPFNOSUPPORT + EPIPE + EPROCLIM + EPROCUNAVAIL + EPROGMISMATCH + EPROGUNAVAIL + EPROTO + EPROTONOSUPPORT + EPROTOTYPE + ERANGE + EREMOTE + EROFS + ERPCMISMATCH + ESHUTDOWN + ESOCKTNOSUPPORT + ESPIPE + ESRCH + ESTALE + ETIMEDOUT + ETOOMANYREFS + ETXTBSY + EUSERS + EWOULDBLOCK + EXDEV + + errno.h + E2BIG + EACCES + EADDRINUSE + EADDRNOTAVAIL + EADV + EAFNOSUPPORT + EAGAIN + EALREADY + EBADE + EBADF + EBADFD + EBADMSG + EBADR + EBADRQC + EBADSLT + EBFONT + EBUSY + ECHILD + ECHRNG + ECOMM + ECONNABORTED + ECONNREFUSED + ECONNRESET + EDEADLK + EDEADLOCK + EDESTADDRREQ + EDOM + EDOTDOT + EDQUOT + EEXIST + EFAULT + EFBIG + EHOSTDOWN + EHOSTUNREACH + EIDRM + EILSEQ + EINPROGRESS + EINTR + EINVAL + EIO + EISCONN + EISDIR + EISNAM + EL2HLT + EL2NSYNC + EL3HLT + EL3RST + ELIBACC + ELIBBAD + ELIBEXEC + ELIBMAX + ELIBSCN + ELNRNG + ELOOP + EMEDIUMTYPE + EMFILE + EMLINK + EMSGSIZE + EMULTIHOP + ENAMETOOLONG + ENAVAIL + ENETDOWN + ENETRESET + ENETUNREACH + ENFILE + ENOANO + ENOBUFS + ENOCSI + ENODATA + ENODEV + ENOENT + ENOERR + ENOEXEC + ENOLCK + ENOLINK + ENOMEDIUM + ENOMEM + ENOMSG + ENONET + ENOPKG + ENOPROTOOPT + ENOSPC + ENOSR + ENOSTR + ENOSYS + ENOTBLK + ENOTCONN + ENOTDIR + ENOTEMPTY + ENOTNAM + ENOTSOCK + ENOTTY + ENOTUNIQ + ENXIO + EOPNOTSUPP + EOVERFLOW + EPERM + EPFNOSUPPORT + EPIPE + EPROTO + EPROTONOSUPPORT + EPROTOTYPE + ERANGE + EREMCHG + EREMOTE + EREMOTEIO + ERESTART + EROFS + ESHUTDOWN + ESOCKTNOSUPPORT + ESPIPE + ESRCH + ESRMNT + ESTALE + ESTRPIPE + ETIME + ETIMEDOUT + ETOOMANYREFS + ETXTBSY + EUCLEAN + EUNATCH + EUSERS + EWOULDBLOCK + EXDEV + EXFULL + err_t + errno + + etharp.h + + etharp.h + ETHARP_HWADDR_LEN + SIZEOF_ETHARP_HDR + etharp_hwtype + HWTYPE_ETHERNET + etharp_opcode + ARP_REQUEST + ARP_REPLY + PACK_STRUCT_STRUCT + + etharp.h + + ethip6.h + + icmp.h + icmp_port_unreach + icmp_dur_type + ICMP_DUR_NET + ICMP_DUR_HOST + ICMP_DUR_PROTO + ICMP_DUR_PORT + ICMP_DUR_FRAG + ICMP_DUR_SR + icmp_te_type + ICMP_TE_TTL + ICMP_TE_FRAG + + icmp.h + ICMP_AM + ICMP_AMR + ICMP_DUR + ICMP_ECHO + ICMP_ER + ICMP_IR + ICMP_IRQ + ICMP_PP + ICMP_RD + ICMP_SQ + ICMP_TE + ICMP_TS + ICMP_TSR + ICMPH_CODE + ICMPH_CODE_SET + ICMPH_TYPE + ICMPH_TYPE_SET + PACK_STRUCT_STRUCT + + icmp6.h + + icmp6.h + icmp6_dur_code + ICMP6_DUR_NO_ROUTE + ICMP6_DUR_PROHIBITED + ICMP6_DUR_SCOPE + ICMP6_DUR_ADDRESS + ICMP6_DUR_PORT + ICMP6_DUR_POLICY + ICMP6_DUR_REJECT_ROUTE + icmp6_pp_code + ICMP6_PP_FIELD + ICMP6_PP_HEADER + ICMP6_PP_OPTION + icmp6_te_code + ICMP6_TE_HL + ICMP6_TE_FRAG + icmp6_type + ICMP6_TYPE_DUR + ICMP6_TYPE_PTB + ICMP6_TYPE_TE + ICMP6_TYPE_PP + ICMP6_TYPE_PE1 + ICMP6_TYPE_PE2 + ICMP6_TYPE_RSV_ERR + ICMP6_TYPE_EREQ + ICMP6_TYPE_EREP + ICMP6_TYPE_MLQ + ICMP6_TYPE_MLR + ICMP6_TYPE_MLD + ICMP6_TYPE_RS + ICMP6_TYPE_RA + ICMP6_TYPE_NS + ICMP6_TYPE_NA + ICMP6_TYPE_RD + ICMP6_TYPE_MRA + ICMP6_TYPE_MRS + ICMP6_TYPE_MRT + ICMP6_TYPE_PE3 + ICMP6_TYPE_PE4 + ICMP6_TYPE_RSV_INF + PACK_STRUCT_STRUCT + + igmp.h + + igmp.h + IGMP_GROUP_DELAYING_MEMBER + IGMP_GROUP_IDLE_MEMBER + IGMP_GROUP_NON_MEMBER + IGMP_LEAVE_GROUP + IGMP_MEMB_QUERY + IGMP_MINLEN + IGMP_TTL + IGMP_V1_MEMB_REPORT + IGMP_V2_MEMB_REPORT + ROUTER_ALERT + ROUTER_ALERTLEN + PACK_STRUCT_STRUCT + + inet.h + IN6ADDR_ANY_INIT + IN6ADDR_LOOPBACK_INIT + IN_BADCLASS + IN_CLASSA + IN_CLASSA_HOST + IN_CLASSA_MAX + IN_CLASSA_NET + IN_CLASSA_NSHIFT + IN_CLASSB + IN_CLASSB_HOST + IN_CLASSB_MAX + IN_CLASSB_NET + IN_CLASSB_NSHIFT + IN_CLASSC + IN_CLASSC_HOST + IN_CLASSC_MAX + IN_CLASSC_NET + IN_CLASSC_NSHIFT + IN_CLASSD + IN_CLASSD_HOST + IN_CLASSD_MAX + IN_CLASSD_NET + IN_CLASSD_NSHIFT + IN_EXPERIMENTAL + IN_LOOPBACKNET + IN_MULTICAST + INADDR_ANY + INADDR_BROADCAST + INADDR_LOOPBACK + INADDR_NONE + INET_ADDRSTRLEN + s6_addr + in_addr_t + in6addr_any + + inet_chksum.h + FOLD_U32T + LWIP_CHKSUM_COPY_ALGORITHM + SWAP_BYTES_IN_WORD + inet_chksum + inet_chksum_pbuf + ip_chksum_pseudo + ip_chksum_pseudo_partial + + ip.h + ip_current_dest_addr + ip_current_dest_addr + ip_current_header_tot_len + ip_current_input_netif + ip_current_netif + ip_current_src_addr + ip_current_src_addr + ip_get_option + IP_PCB + IP_PCB_ADDRHINT + ip_reset_option + ip_route_get_local_ip + ip_set_option + LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX + LWIP_IP_HDRINCL + SOF_BROADCAST + SOF_INHERITED + SOF_KEEPALIVE + SOF_REUSEADDR + ip_data + + ip.h + IP_HDR_GET_VERSION + IP_PROTO_ICMP + IP_PROTO_IGMP + IP_PROTO_TCP + IP_PROTO_UDP + IP_PROTO_UDPLITE + + ip4.h + + ip4.h + IP_DF + IP_HLEN + IP_MF + IP_OFFMASK + IP_RF + IPH_CHKSUM + IPH_CHKSUM_SET + IPH_HL + IPH_ID + IPH_ID_SET + IPH_LEN + IPH_LEN_SET + IPH_OFFSET + IPH_OFFSET_SET + IPH_PROTO + IPH_PROTO_SET + IPH_TOS + IPH_TOS_SET + IPH_TTL + IPH_TTL_SET + IPH_V + IPH_VHL_SET + ip4_addr_p_t + PACK_STRUCT_STRUCT + + ip4_addr.h + + ip4_frag.h + + ip6.h + + ip6.h + IP6_FRAG_HLEN + IP6_FRAG_MORE_FLAG + IP6_FRAG_OFFSET_MASK + IP6_HBH_HLEN + IP6_HLEN + IP6_NEXTH_DESTOPTS + IP6_NEXTH_ENCAPS + IP6_NEXTH_FRAGMENT + IP6_NEXTH_HOPBYHOP + IP6_NEXTH_ICMP6 + IP6_NEXTH_NONE + IP6_NEXTH_ROUTING + IP6_NEXTH_TCP + IP6_NEXTH_UDP + IP6_NEXTH_UDPLITE + IP6_PAD1_OPTION + IP6_PADN_ALERT_OPTION + IP6_ROUTER_ALERT_OPTION + IP6_ROUTER_ALERT_VALUE_MLD + IP6H_FL + IP6H_HOPLIM + IP6H_HOPLIM_SET + IP6H_NEXTH + IP6H_NEXTH_P + IP6H_NEXTH_SET + IP6H_PLEN + IP6H_PLEN_SET + IP6H_TC + IP6H_V + IP6H_VTCFL_SET + ip6_addr_p_t + PACK_STRUCT_STRUCT + + ip6_addr.h + + ip6_frag.h + + ip_addr.h + IP46_ADDR_ANY + ip_2_ip6 + IP_ADDR6 + IP_ADDR6_HOST + ip_addr_cmp + ip_addr_copy + ip_addr_copy_from_ip6 + ip_addr_debug_print + ip_addr_debug_print_val + ip_addr_get_network + ip_addr_isany + ip_addr_isany_val + ip_addr_isbroadcast + ip_addr_islinklocal + ip_addr_isloopback + ip_addr_ismulticast + ip_addr_netcmp + IP_ADDR_PCB_VERSION_MATCH + IP_ADDR_PCB_VERSION_MATCH_EXACT + ip_addr_set + ip_addr_set_any + ip_addr_set_hton + ip_addr_set_ipaddr + ip_addr_set_loopback + ip_addr_set_zero + ip_addr_set_zero_ip6 + IP_ANY_TYPE + IP_GET_TYPE + IP_IS_ANY_TYPE_VAL + IP_IS_V4 + IP_IS_V4_VAL + IP_IS_V6 + IP_IS_V6_VAL + IP_SET_TYPE + IP_SET_TYPE_VAL + IPADDR6_INIT + IPADDR6_INIT_HOST + ipaddr_aton + ipaddr_ntoa + ipaddr_ntoa_r + IPADDR_STRLEN_MAX + lwip_ip_addr_type + IPADDR_TYPE_V4 + IPADDR_TYPE_V6 + IPADDR_TYPE_ANY + ip_addr_t + + lwipopts.h + API_LIB_DEBUG + API_MSG_DEBUG + ARP_MAXAGE + ARP_QUEUE_LEN + ARP_QUEUEING + ARP_TABLE_SIZE + AUTOIP_DEBUG + CHECKSUM_CHECK_ICMP + CHECKSUM_CHECK_ICMP6 + CHECKSUM_CHECK_IP + CHECKSUM_CHECK_TCP + CHECKSUM_CHECK_UDP + CHECKSUM_GEN_ICMP + CHECKSUM_GEN_ICMP6 + CHECKSUM_GEN_IP + CHECKSUM_GEN_TCP + CHECKSUM_GEN_UDP + DEFAULT_ACCEPTMBOX_SIZE + DEFAULT_RAW_RECVMBOX_SIZE + DEFAULT_TCP_RECVMBOX_SIZE + DEFAULT_THREAD_NAME + DEFAULT_THREAD_PRIO + DEFAULT_THREAD_STACKSIZE + DEFAULT_UDP_RECVMBOX_SIZE + DHCP_DEBUG + DHCP_DOES_ARP_CHECK + DNS_DEBUG + DNS_DOES_NAME_CHECK + DNS_LOCAL_HOSTLIST + DNS_LOCAL_HOSTLIST_IS_DYNAMIC + DNS_MAX_NAME_LENGTH + DNS_MAX_SERVERS + DNS_TABLE_SIZE + ETH_PAD_SIZE + ETHARP_DEBUG + ETHARP_STATS + ETHARP_SUPPORT_STATIC_ENTRIES + ETHARP_SUPPORT_VLAN + ETHARP_TABLE_MATCH_NETIF + ICMP6_STATS + ICMP_DEBUG + ICMP_STATS + ICMP_TTL + IGMP_DEBUG + IGMP_STATS + INET_DEBUG + IP6_DEBUG + IP6_FRAG_STATS + IP6_STATS + IP_DEBUG + IP_DEFAULT_TTL + IP_FORWARD + IP_FORWARD_ALLOW_TX_ON_RX_NETIF + IP_FRAG + IP_OPTIONS_ALLOWED + IP_REASS_DEBUG + IP_REASS_MAX_PBUFS + IP_REASS_MAXAGE + IP_REASSEMBLY + IP_SOF_BROADCAST + IP_SOF_BROADCAST_RECV + IP_STATS + IPFRAG_STATS + LINK_STATS + LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + LWIP_ARP + LWIP_AUTOIP + LWIP_BROADCAST_PING + LWIP_CALLBACK_API + LWIP_CHECKSUM_CTRL_PER_NETIF + LWIP_CHECKSUM_ON_COPY + LWIP_COMPAT_MUTEX + LWIP_COMPAT_MUTEX_ALLOWED + LWIP_COMPAT_SOCKETS + LWIP_DBG_MIN_LEVEL + LWIP_DBG_TYPES_ON + LWIP_DHCP + LWIP_DHCP_AUTOIP_COOP + LWIP_DHCP_AUTOIP_COOP_TRIES + LWIP_DHCP_BOOTP_FILE + LWIP_DHCP_GET_NTP_SRV + LWIP_DHCP_MAX_DNS_SERVERS + LWIP_DHCP_MAX_NTP_SERVERS + LWIP_DNS + LWIP_DNS_SECURE + LWIP_DNS_SUPPORT_MDNS_QUERIES + LWIP_ETHERNET + LWIP_EVENT_API + LWIP_FIONREAD_LINUXMODE + LWIP_HAVE_LOOPIF + LWIP_ICMP + LWIP_ICMP6 + LWIP_ICMP6_DATASIZE + LWIP_ICMP6_HL + LWIP_IGMP + LWIP_IPV4 + LWIP_IPV6 + LWIP_IPV6_AUTOCONFIG + LWIP_IPV6_DHCP6 + LWIP_IPV6_DUP_DETECT_ATTEMPTS + LWIP_IPV6_FORWARD + LWIP_IPV6_FRAG + LWIP_IPV6_MLD + LWIP_IPV6_NUM_ADDRESSES + LWIP_IPV6_REASS + LWIP_IPV6_SEND_ROUTER_SOLICIT + LWIP_LOOPBACK_MAX_PBUFS + LWIP_LOOPIF_MULTICAST + LWIP_MIB2_CALLBACKS + LWIP_MPU_COMPATIBLE + LWIP_MULTICAST_PING + LWIP_MULTICAST_TX_OPTIONS + LWIP_ND6_ALLOW_RA_UPDATES + LWIP_ND6_DELAY_FIRST_PROBE_TIME + LWIP_ND6_MAX_ANYCAST_DELAY_TIME + LWIP_ND6_MAX_MULTICAST_SOLICIT + LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT + LWIP_ND6_MAX_UNICAST_SOLICIT + LWIP_ND6_NUM_DESTINATIONS + LWIP_ND6_NUM_NEIGHBORS + LWIP_ND6_NUM_PREFIXES + LWIP_ND6_NUM_ROUTERS + LWIP_ND6_QUEUEING + LWIP_ND6_RDNSS_MAX_DNS_SERVERS + LWIP_ND6_REACHABLE_TIME + LWIP_ND6_RETRANS_TIMER + LWIP_ND6_TCP_REACHABILITY_HINTS + LWIP_NETBUF_RECVINFO + LWIP_NETCONN + LWIP_NETCONN_FULLDUPLEX + LWIP_NETCONN_SEM_PER_THREAD + LWIP_NETIF_API + LWIP_NETIF_HOSTNAME + LWIP_NETIF_HWADDRHINT + LWIP_NETIF_LINK_CALLBACK + LWIP_NETIF_LOOPBACK + LWIP_NETIF_LOOPBACK_MULTITHREADING + LWIP_NETIF_REMOVE_CALLBACK + LWIP_NETIF_STATUS_CALLBACK + LWIP_NETIF_TX_SINGLE_PBUF + LWIP_NUM_NETIF_CLIENT_DATA + LWIP_PERF + LWIP_POSIX_SOCKETS_IO_NAMES + LWIP_PROVIDE_ERRNO + LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS + LWIP_RAW + LWIP_SO_LINGER + LWIP_SO_RCVBUF + LWIP_SO_RCVTIMEO + LWIP_SO_SNDRCVTIMEO_NONSTANDARD + LWIP_SO_SNDTIMEO + LWIP_SOCKET + LWIP_SOCKET_OFFSET + LWIP_STATS + LWIP_STATS_DISPLAY + LWIP_TCP + LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT + LWIP_TCP_KEEPALIVE + LWIP_TCP_TIMESTAMPS + LWIP_TCPIP_CORE_LOCKING + LWIP_TCPIP_CORE_LOCKING_INPUT + LWIP_TCPIP_THREAD_ALIVE + LWIP_TCPIP_TIMEOUT + LWIP_TIMERS + LWIP_TIMERS_CUSTOM + LWIP_TIMEVAL_PRIVATE + LWIP_UDP + LWIP_UDPLITE + LWIP_WND_SCALE + MEM_ALIGNMENT + MEM_DEBUG + MEM_LIBC_MALLOC + MEM_SIZE + MEM_STATS + MEM_USE_POOLS + MEM_USE_POOLS_TRY_BIGGER_POOL + MEMCPY + MEMP_DEBUG + MEMP_MEM_MALLOC + MEMP_NUM_API_MSG + MEMP_NUM_ARP_QUEUE + MEMP_NUM_DNS_API_MSG + MEMP_NUM_FRAG_PBUF + MEMP_NUM_IGMP_GROUP + MEMP_NUM_LOCALHOSTLIST + MEMP_NUM_MLD6_GROUP + MEMP_NUM_ND6_QUEUE + MEMP_NUM_NETBUF + MEMP_NUM_NETCONN + MEMP_NUM_NETDB + MEMP_NUM_NETIFAPI_MSG + MEMP_NUM_PBUF + MEMP_NUM_RAW_PCB + MEMP_NUM_REASSDATA + MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA + MEMP_NUM_SYS_TIMEOUT + MEMP_NUM_TCP_PCB + MEMP_NUM_TCP_PCB_LISTEN + MEMP_NUM_TCP_SEG + MEMP_NUM_TCPIP_MSG_API + MEMP_NUM_TCPIP_MSG_INPKT + MEMP_NUM_UDP_PCB + MEMP_OVERFLOW_CHECK + MEMP_SANITY_CHECK + MEMP_STATS + MEMP_USE_CUSTOM_POOLS + MIB2_STATS + MLD6_STATS + ND6_STATS + NETIF_DEBUG + NO_SYS + PBUF_DEBUG + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_POOL_BUFSIZE + PBUF_POOL_SIZE + RAW_DEBUG + RAW_TTL + RECV_BUFSIZE_DEFAULT + SLIP_DEBUG + SLIPIF_THREAD_NAME + SLIPIF_THREAD_PRIO + SLIPIF_THREAD_STACKSIZE + SMEMCPY + SO_REUSE + SO_REUSE_RXTOALL + SOCKETS_DEBUG + SYS_DEBUG + SYS_LIGHTWEIGHT_PROT + SYS_STATS + TCP_CALCULATE_EFF_SEND_MSS + TCP_CWND_DEBUG + TCP_DEBUG + TCP_DEFAULT_LISTEN_BACKLOG + TCP_FR_DEBUG + TCP_INPUT_DEBUG + TCP_LISTEN_BACKLOG + TCP_MAXRTX + TCP_MSS + TCP_OOSEQ_MAX_BYTES + TCP_OOSEQ_MAX_PBUFS + TCP_OUTPUT_DEBUG + TCP_OVERSIZE + TCP_QLEN_DEBUG + TCP_QUEUE_OOSEQ + TCP_RST_DEBUG + TCP_RTO_DEBUG + TCP_SND_BUF + TCP_SND_QUEUELEN + TCP_SNDLOWAT + TCP_SNDQUEUELOWAT + TCP_STATS + TCP_SYNMAXRTX + TCP_TTL + TCP_WND + TCP_WND_DEBUG + TCP_WND_UPDATE_THRESHOLD + TCPIP_DEBUG + TCPIP_MBOX_SIZE + TCPIP_THREAD_NAME + TCPIP_THREAD_PRIO + TCPIP_THREAD_STACKSIZE + TIMERS_DEBUG + UDP_DEBUG + UDP_STATS + UDP_TTL + + mem.h + MEM_SIZE_F + mem_size_t + mem_calloc + mem_free + mem_init + mem_malloc + mem_trim + + memp.h + LWIP_MEMPOOL + LWIP_MEMPOOL + LWIP_MEMPOOL_ALLOC + LWIP_MEMPOOL_DECLARE + LWIP_MEMPOOL_FREE + LWIP_MEMPOOL_INIT + LWIP_MEMPOOL_PROTOTYPE + memp_t + MEMP_MAX + memp_pools + memp_free + memp_init + memp_malloc + + mld6.h + + mld6.h + PACK_STRUCT_STRUCT + + nd6.h + + nd6.h + LWIP_RDNSS_OPTION_MAX_SERVERS + ND6_FLAG_OVERRIDE + ND6_FLAG_ROUTER + ND6_FLAG_SOLICITED + ND6_OPTION_TYPE_MTU + ND6_OPTION_TYPE_PREFIX_INFO + ND6_OPTION_TYPE_RDNSS + ND6_OPTION_TYPE_REDIR_HDR + ND6_OPTION_TYPE_ROUTE_INFO + ND6_OPTION_TYPE_SOURCE_LLADDR + ND6_OPTION_TYPE_TARGET_LLADDR + ND6_PREFIX_FLAG_AUTONOMOUS + ND6_PREFIX_FLAG_ON_LINK + ND6_PREFIX_FLAG_ROUTER_ADDRESS + ND6_PREFIX_FLAG_SITE_PREFIX + ND6_RA_FLAG_HOME_AGENT + ND6_RA_FLAG_MANAGED_ADDR_CONFIG + ND6_RA_FLAG_OTHER_CONFIG + ND6_RA_PREFERENCE_DISABLED + ND6_RA_PREFERENCE_HIGH + ND6_RA_PREFERENCE_LOW + ND6_RA_PREFERENCE_MASK + ND6_RA_PREFERENCE_MEDIUM + PACK_STRUCT_STRUCT + + net.h + lnc_netif + net_init + + netbuf.h + + netdb.h + + netif.h + ENABLE_LOOPBACK + IF__NETIF_CHECKSUM_ENABLED + NETIF_FLAG_BROADCAST + NETIF_FLAG_ETHARP + NETIF_FLAG_ETHERNET + NETIF_FLAG_IGMP + NETIF_FLAG_LINK_UP + NETIF_FLAG_MLD6 + NETIF_FLAG_UP + netif_is_link_up + netif_is_up + NETIF_MAX_HWADDR_LEN + NETIF_SET_CHECKSUM_CTRL + NETIF_SET_HWADDRHINT + lwip_internal_netif_client_data_index + LWIP_NETIF_CLIENT_DATA_INDEX_MAX + netif_mac_filter_action + NETIF_DEL_MAC_FILTER + NETIF_ADD_MAC_FILTER + netif_init_fn + netif_input_fn + netif_linkoutput_fn + netif_status_callback_fn + netif_default + netif_list + tmpBuf + ethernetif_input + netif_add + netif_find + netif_init + netif_input + netif_remove + netif_set_default + netif_set_down + netif_set_link_down + netif_set_link_up + netif_set_up + + netifapi.h + + opt.h + API_LIB_DEBUG + API_MSG_DEBUG + ARP_MAXAGE + ARP_QUEUE_LEN + ARP_QUEUEING + ARP_TABLE_SIZE + AUTOIP_DEBUG + CHECKSUM_CHECK_ICMP + CHECKSUM_CHECK_ICMP6 + CHECKSUM_CHECK_IP + CHECKSUM_CHECK_TCP + CHECKSUM_CHECK_UDP + CHECKSUM_GEN_ICMP + CHECKSUM_GEN_ICMP6 + CHECKSUM_GEN_IP + CHECKSUM_GEN_TCP + CHECKSUM_GEN_UDP + DEFAULT_ACCEPTMBOX_SIZE + DEFAULT_RAW_RECVMBOX_SIZE + DEFAULT_TCP_RECVMBOX_SIZE + DEFAULT_THREAD_NAME + DEFAULT_THREAD_PRIO + DEFAULT_THREAD_STACKSIZE + DEFAULT_UDP_RECVMBOX_SIZE + DHCP_DEBUG + DHCP_DOES_ARP_CHECK + DNS_DEBUG + DNS_DOES_NAME_CHECK + DNS_LOCAL_HOSTLIST + DNS_LOCAL_HOSTLIST_IS_DYNAMIC + DNS_MAX_NAME_LENGTH + DNS_MAX_SERVERS + DNS_TABLE_SIZE + ETH_PAD_SIZE + ETHARP_DEBUG + ETHARP_STATS + ETHARP_SUPPORT_STATIC_ENTRIES + ETHARP_SUPPORT_VLAN + ETHARP_TABLE_MATCH_NETIF + ICMP6_STATS + ICMP_DEBUG + ICMP_STATS + ICMP_TTL + IGMP_DEBUG + IGMP_STATS + INET_DEBUG + IP6_DEBUG + IP6_FRAG_STATS + IP6_STATS + IP_DEBUG + IP_DEFAULT_TTL + IP_FORWARD + IP_FORWARD_ALLOW_TX_ON_RX_NETIF + IP_FRAG + IP_OPTIONS_ALLOWED + IP_REASS_DEBUG + IP_REASS_MAX_PBUFS + IP_REASS_MAXAGE + IP_REASSEMBLY + IP_SOF_BROADCAST + IP_SOF_BROADCAST_RECV + IP_STATS + IPFRAG_STATS + LINK_STATS + LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + LWIP_ARP + LWIP_AUTOIP + LWIP_BROADCAST_PING + LWIP_CALLBACK_API + LWIP_CHECKSUM_CTRL_PER_NETIF + LWIP_CHECKSUM_ON_COPY + LWIP_COMPAT_SOCKETS + LWIP_DBG_MIN_LEVEL + LWIP_DBG_TYPES_ON + LWIP_DHCP + LWIP_DHCP_AUTOIP_COOP + LWIP_DHCP_AUTOIP_COOP_TRIES + LWIP_DHCP_BOOTP_FILE + LWIP_DHCP_CHECK_LINK_UP + LWIP_DHCP_GET_NTP_SRV + LWIP_DHCP_MAX_DNS_SERVERS + LWIP_DHCP_MAX_NTP_SERVERS + LWIP_DNS + LWIP_DNS_SECURE + LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING + LWIP_DNS_SECURE_RAND_SRC_PORT + LWIP_DNS_SECURE_RAND_XID + LWIP_DNS_SUPPORT_MDNS_QUERIES + LWIP_ETHERNET + LWIP_EVENT_API + LWIP_FIONREAD_LINUXMODE + LWIP_HAVE_LOOPIF + LWIP_ICMP + LWIP_ICMP6 + LWIP_ICMP6_DATASIZE + LWIP_ICMP6_HL + LWIP_IGMP + LWIP_IPV4 + LWIP_IPV6 + LWIP_IPV6_AUTOCONFIG + LWIP_IPV6_DHCP6 + LWIP_IPV6_DUP_DETECT_ATTEMPTS + LWIP_IPV6_FORWARD + LWIP_IPV6_FRAG + LWIP_IPV6_MLD + LWIP_IPV6_NUM_ADDRESSES + LWIP_IPV6_REASS + LWIP_IPV6_SEND_ROUTER_SOLICIT + LWIP_LOOPBACK_MAX_PBUFS + LWIP_LOOPIF_MULTICAST + LWIP_MIB2_CALLBACKS + LWIP_MPU_COMPATIBLE + LWIP_MULTICAST_PING + LWIP_MULTICAST_TX_OPTIONS + LWIP_ND6_ALLOW_RA_UPDATES + LWIP_ND6_DELAY_FIRST_PROBE_TIME + LWIP_ND6_MAX_ANYCAST_DELAY_TIME + LWIP_ND6_MAX_MULTICAST_SOLICIT + LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT + LWIP_ND6_MAX_UNICAST_SOLICIT + LWIP_ND6_NUM_DESTINATIONS + LWIP_ND6_NUM_NEIGHBORS + LWIP_ND6_NUM_PREFIXES + LWIP_ND6_NUM_ROUTERS + LWIP_ND6_QUEUEING + LWIP_ND6_RDNSS_MAX_DNS_SERVERS + LWIP_ND6_REACHABLE_TIME + LWIP_ND6_RETRANS_TIMER + LWIP_ND6_TCP_REACHABILITY_HINTS + LWIP_NETBUF_RECVINFO + LWIP_NETCONN + LWIP_NETCONN_FULLDUPLEX + LWIP_NETCONN_SEM_PER_THREAD + LWIP_NETIF_API + LWIP_NETIF_HOSTNAME + LWIP_NETIF_HWADDRHINT + LWIP_NETIF_LINK_CALLBACK + LWIP_NETIF_LOOPBACK + LWIP_NETIF_LOOPBACK_MULTITHREADING + LWIP_NETIF_REMOVE_CALLBACK + LWIP_NETIF_STATUS_CALLBACK + LWIP_NETIF_TX_SINGLE_PBUF + LWIP_NUM_NETIF_CLIENT_DATA + LWIP_PERF + LWIP_POSIX_SOCKETS_IO_NAMES + LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS + LWIP_RAW + LWIP_SO_LINGER + LWIP_SO_RCVBUF + LWIP_SO_RCVTIMEO + LWIP_SO_SNDRCVTIMEO_NONSTANDARD + LWIP_SO_SNDTIMEO + LWIP_SOCKET + LWIP_SOCKET_OFFSET + LWIP_SOCKET_SET_ERRNO + LWIP_STATS + LWIP_STATS_DISPLAY + LWIP_TCP + LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT + LWIP_TCP_KEEPALIVE + LWIP_TCP_TIMESTAMPS + LWIP_TCPIP_CORE_LOCKING + LWIP_TCPIP_CORE_LOCKING_INPUT + LWIP_TCPIP_THREAD_ALIVE + LWIP_TCPIP_TIMEOUT + LWIP_TIMERS + LWIP_TIMERS_CUSTOM + LWIP_UDP + LWIP_UDPLITE + LWIP_WND_SCALE + MEM_ALIGNMENT + MEM_DEBUG + MEM_LIBC_MALLOC + MEM_SIZE + MEM_STATS + MEM_USE_POOLS + MEM_USE_POOLS_TRY_BIGGER_POOL + MEMCPY + MEMP_DEBUG + MEMP_MEM_MALLOC + MEMP_NUM_API_MSG + MEMP_NUM_ARP_QUEUE + MEMP_NUM_DNS_API_MSG + MEMP_NUM_FRAG_PBUF + MEMP_NUM_IGMP_GROUP + MEMP_NUM_LOCALHOSTLIST + MEMP_NUM_MLD6_GROUP + MEMP_NUM_ND6_QUEUE + MEMP_NUM_NETBUF + MEMP_NUM_NETCONN + MEMP_NUM_NETDB + MEMP_NUM_NETIFAPI_MSG + MEMP_NUM_PBUF + MEMP_NUM_RAW_PCB + MEMP_NUM_REASSDATA + MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA + MEMP_NUM_SYS_TIMEOUT + MEMP_NUM_TCP_PCB + MEMP_NUM_TCP_PCB_LISTEN + MEMP_NUM_TCP_SEG + MEMP_NUM_TCPIP_MSG_API + MEMP_NUM_TCPIP_MSG_INPKT + MEMP_NUM_UDP_PCB + MEMP_OVERFLOW_CHECK + MEMP_SANITY_CHECK + MEMP_STATS + MEMP_USE_CUSTOM_POOLS + MIB2_STATS + MLD6_STATS + ND6_STATS + NETIF_DEBUG + NO_SYS + PBUF_DEBUG + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_POOL_BUFSIZE + PBUF_POOL_SIZE + RAW_DEBUG + RAW_TTL + RECV_BUFSIZE_DEFAULT + SLIP_DEBUG + SLIPIF_THREAD_NAME + SLIPIF_THREAD_PRIO + SLIPIF_THREAD_STACKSIZE + SMEMCPY + SO_REUSE + SO_REUSE_RXTOALL + SOCKETS_DEBUG + SYS_DEBUG + SYS_LIGHTWEIGHT_PROT + SYS_STATS + TCP_CALCULATE_EFF_SEND_MSS + TCP_CWND_DEBUG + TCP_DEBUG + TCP_DEFAULT_LISTEN_BACKLOG + TCP_FR_DEBUG + TCP_INPUT_DEBUG + TCP_LISTEN_BACKLOG + TCP_MAXRTX + TCP_MSS + TCP_OOSEQ_MAX_BYTES + TCP_OOSEQ_MAX_PBUFS + TCP_OUTPUT_DEBUG + TCP_OVERSIZE + TCP_QLEN_DEBUG + TCP_QUEUE_OOSEQ + TCP_RCV_SCALE + TCP_RST_DEBUG + TCP_RTO_DEBUG + TCP_SND_BUF + TCP_SND_QUEUELEN + TCP_SNDLOWAT + TCP_SNDQUEUELOWAT + TCP_STATS + TCP_SYNMAXRTX + TCP_TTL + TCP_WND + TCP_WND_DEBUG + TCP_WND_UPDATE_THRESHOLD + TCPIP_DEBUG + TCPIP_MBOX_SIZE + TCPIP_THREAD_NAME + TCPIP_THREAD_PRIO + TCPIP_THREAD_STACKSIZE + TIMERS_DEBUG + UDP_DEBUG + UDP_STATS + UDP_TTL + + pbuf.h + LWIP_SUPPORT_CUSTOM_PBUF + PBUF_CHECK_FREE_OOSEQ + PBUF_FLAG_IS_CUSTOM + PBUF_FLAG_LLBCAST + PBUF_FLAG_LLMCAST + PBUF_FLAG_MCASTLOOP + PBUF_FLAG_PUSH + PBUF_FLAG_TCP_FIN + pbuf_init + PBUF_IP_HLEN + PBUF_POOL_FREE_OOSEQ + PBUF_TRANSPORT_HLEN + pbuf_layer + PBUF_TRANSPORT + PBUF_IP + PBUF_LINK + PBUF_RAW_TX + PBUF_RAW + pbuf_type + PBUF_RAM + PBUF_ROM + PBUF_REF + PBUF_POOL + pbuf_alloc + pbuf_cat + pbuf_chain + pbuf_clen + pbuf_coalesce + pbuf_copy + pbuf_copy_partial + pbuf_dechain + pbuf_free + pbuf_get_at + pbuf_header + pbuf_header_force + pbuf_memcmp + pbuf_memfind + pbuf_put_at + pbuf_realloc + pbuf_ref + pbuf_skip + pbuf_strstr + pbuf_take + pbuf_take_at + pbuf_try_get_at + + api_msg.h + + memp_priv.h + DECLARE_LWIP_MEMPOOL_DESC + LWIP_MEMPOOL_DECLARE_STATS_INSTANCE + LWIP_MEMPOOL_DECLARE_STATS_REFERENCE + MEMP_ALIGN_SIZE + MEMP_SIZE + memp_free_pool + memp_init_pool + memp_malloc_pool + + memp_std.h + LWIP_MALLOC_MEMPOOL + LWIP_MALLOC_MEMPOOL_END + LWIP_MALLOC_MEMPOOL_START + LWIP_PBUF_MEMPOOL + PBUF_POOL_SIZE + LWIP_MEMPOOL + MEMP_ALIGN_SIZE + + nd6_priv.h + + tcp_priv.h + + tcpip_priv.h + API_EXPR_DEREF + API_EXPR_REF + API_EXPR_REF_SEM + API_MSG_M_DEF + API_MSG_M_DEF_C + API_VAR_ALLOC + API_VAR_ALLOC_POOL + API_VAR_DECLARE + API_VAR_FREE + API_VAR_FREE_POOL + API_VAR_REF + tcpip_msg_type + TCPIP_MSG_API + TCPIP_MSG_API_CALL + TCPIP_MSG_INPKT + TCPIP_MSG_CALLBACK + TCPIP_MSG_CALLBACK_STATIC + tcpip_api_call_fn + tcpip_api_call + tcpip_send_msg_wait_sem + + ethernet.h + eth_addr_cmp + ETH_HWADDR_LEN + ETHADDR16_COPY + ETHADDR32_COPY + LL_IP4_MULTICAST_ADDR_0 + LL_IP4_MULTICAST_ADDR_1 + LL_IP4_MULTICAST_ADDR_2 + LL_IP6_MULTICAST_ADDR_0 + LL_IP6_MULTICAST_ADDR_1 + SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR + VLAN_ID + eth_type + ETHTYPE_IP + ETHTYPE_ARP + ETHTYPE_WOL + ETHTYPE_RARP + ETHTYPE_VLAN + ETHTYPE_IPV6 + ETHTYPE_PPPOEDISC + ETHTYPE_PPPOE + ETHTYPE_JUMBO + ETHTYPE_PROFINET + ETHTYPE_ETHERCAT + ETHTYPE_LLDP + ETHTYPE_SERCOS + ETHTYPE_MRP + ETHTYPE_PTP + ETHTYPE_QINQ + PACK_STRUCT_STRUCT + + ethernet.h + + tcp.h + TCP_ACK + TCP_CWR + TCP_ECE + TCP_FIN + TCP_FLAGS + TCP_HLEN + TCP_PSH + TCP_RST + TCP_SYN + TCP_URG + TCPH_FLAGS + TCPH_FLAGS_SET + TCPH_HDRLEN + TCPH_HDRLEN_FLAGS_SET + TCPH_HDRLEN_SET + TCPH_SET_FLAG + TCPH_UNSET_FLAG + PACK_STRUCT_STRUCT + + tcp.h + + udp.h + UDP_HLEN + PACK_STRUCT_STRUCT + + udp.h + + raw.h + + sio.h + sio_fd_t + sio_open + sio_read + sio_read_abort + sio_recv + sio_send + sio_tryread + sio_write + + sockets.h + + stats.h + ETHARP_STATS_DISPLAY + ETHARP_STATS_INC + ICMP6_STATS_DISPLAY + ICMP6_STATS_INC + ICMP_STATS_DISPLAY + ICMP_STATS_INC + IGMP_STATS_DISPLAY + IGMP_STATS_INC + IP6_FRAG_STATS_DISPLAY + IP6_FRAG_STATS_INC + IP6_STATS_DISPLAY + IP6_STATS_INC + IP_STATS_DISPLAY + IP_STATS_INC + IPFRAG_STATS_DISPLAY + IPFRAG_STATS_INC + LINK_STATS_DISPLAY + LINK_STATS_INC + MEM_STATS_AVAIL + MEM_STATS_DEC_USED + MEM_STATS_DISPLAY + MEM_STATS_INC + MEM_STATS_INC_USED + MEMP_STATS_DEC + MEMP_STATS_DISPLAY + MEMP_STATS_GET + MIB2_STATS_INC + MLD6_STATS_DISPLAY + MLD6_STATS_INC + ND6_STATS_DISPLAY + ND6_STATS_INC + STATS_DEC + stats_display + stats_display_igmp + stats_display_mem + stats_display_memp + stats_display_proto + stats_display_sys + STATS_INC + STATS_INC_USED + stats_init + SYS_STATS_DEC + SYS_STATS_DISPLAY + SYS_STATS_INC + SYS_STATS_INC_USED + TCP_STATS_DISPLAY + TCP_STATS_INC + UDP_STATS_DISPLAY + UDP_STATS_INC + + sys.h + LWIP_COMPAT_MUTEX + SYS_ARCH_DEC + SYS_ARCH_DECL_PROTECT + SYS_ARCH_GET + SYS_ARCH_INC + SYS_ARCH_PROTECT + SYS_ARCH_SET + SYS_ARCH_TIMEOUT + SYS_ARCH_UNPROTECT + SYS_MBOX_EMPTY + sys_mbox_fetch + sys_mbox_set_invalid_val + sys_mbox_tryfetch + sys_mbox_valid_val + sys_sem_set_invalid_val + sys_sem_valid_val + sys_sem_wait + lwip_thread_fn + sys_arch_mbox_fetch + sys_arch_mbox_tryfetch + sys_arch_sem_wait + sys_init + sys_jiffies + sys_mbox_free + sys_mbox_new + sys_mbox_post + sys_mbox_set_invalid + sys_mbox_trypost + sys_mbox_valid + sys_msleep + sys_mutex_free + sys_mutex_lock + sys_mutex_new + sys_mutex_set_invalid + sys_mutex_unlock + sys_mutex_valid + sys_now + sys_sem_free + sys_sem_new + sys_sem_set_invalid + sys_sem_signal + sys_sem_valid + sys_thread_new + + tcpip.h + LOCK_TCPIP_CORE + tcpip_callback + UNLOCK_TCPIP_CORE + tcpip_callback_fn + tcpip_init_done_fn + mem_free_callback + pbuf_free_callback + tcpip_callback_with_block + tcpip_callbackmsg_delete + tcpip_callbackmsg_new + tcpip_init + tcpip_inpkt + tcpip_input + tcpip_trycallback + + timeouts.h + LWIP_DEBUG_TIMERNAMES + lwip_cyclic_timer_handler + lwip_cyclic_timers ethernetif.h - ethernetif_init + ethernetif_init - loopif.h - loopif_init + lowpan6.h - tcpdump.h - tcpdump - tcpdump_init + lowpan6_opts.h + LOWPAN6_DEBUG + LWIP_6LOWPAN + LWIP_6LOWPAN_HW_CRC + LWIP_6LOWPAN_INFER_SHORT_ADDRESS + LWIP_6LOWPAN_IPHC + LWIP_6LOWPAN_NUM_CONTEXTS + + ccp.h + + chap-md5.h + + chap-new.h + + chap_ms.h + + eap.h + + ecp.h + + eui64.h + + fsm.h + + ipcp.h + + ipv6cp.h + + lcp.h + + magic.h + + mppe.h + + arc4.h + + des.h + + md4.h + + md5.h + + sha1.h + + ppp.h + + ppp_impl.h + + ppp_opts.h + LWIP_PPP_API + MEMP_NUM_PPP_PCB + PPP_SUPPORT + PPPOE_SUPPORT + PPPOL2TP_AUTH_SUPPORT + PPPOL2TP_SUPPORT + PPPOS_SUPPORT + + pppapi.h + + pppcrypt.h + + pppdebug.h + + pppoe.h + + pppol2tp.h + + pppos.h + + upap.h + + vj.h + + slipif.h + SLIP_RX_FROM_ISR + SLIP_RX_QUEUE + SLIP_USE_RX_THREAD + slipif_init + slipif_poll + + objgfx30.h + RadToDeg + ogDataState + ogNONE + ogOWNER + ogALIASING + Int16 + Int32 + Int8 + uInt16 + uInt32 + uInt8 + DEF_MAC_PIXFMT_16BPP + DEF_PIXFMT_15BPP + DEF_PIXFMT_16BPP + DEF_PIXFMT_24BPP + DEF_PIXFMT_32BPP + DEF_PIXFMT_8BPP + NULL_PIXFMT + + ogDisplay_VESA.h hd.h - hdCmd - hdCylHi - hdCylLow - hdData - hdError - hdHead - hdSecCount - hdSecNum - hdStat - MAXPARTITIONS - NDDATA - NSPARE - hdInit - hdIoctl - hdRead - hdReset - hdStandby - hdStart - hdStop - hdWrite - initHardDisk - fstypenames + ATA_IDENTIFY_48_LBA_LEN + ATA_IDENTIFY_FW_REVISION_LEN + ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN + ATA_IDENTIFY_MODEL_NUMBER_LEN + ATA_IDENTIFY_SERIAL_NUMBER_LEN + ATA_IDENTIFY_WWN_LEN + part_types + ATA_A_4BIT + ATA_A_HOB + ATA_A_IDS + ATA_A_RESET + ATA_ALTSTAT + ATA_CHECK_POWER_MODE + ATA_COMMAND + ATA_CONTROL + ATA_COUNT + ATA_CTLOFFSET + ATA_CYL_LSB + ATA_CYL_MSB + ATA_D_IBM + ATA_D_LBA + ATA_DATA + ATA_DATA_SET_MANAGEMENT + ATA_DEVICE_RESET + ATA_DOWNLOAD_MICROCODE + ATA_DRIVE + ATA_E_ABORT + ATA_E_ATAPI_SENSE_MASK + ATA_E_ICRC + ATA_E_IDNF + ATA_E_ILI + ATA_E_MC + ATA_E_MCR + ATA_E_NM + ATA_E_UNC + ATA_ERROR + ATA_EXECUTE_DEVICE_DIAG + ATA_F_DMA + ATA_F_OVL + ATA_FEATURE + ATA_FLUSH_CACHE + ATA_FLUSH_CACHE_EXT + ATA_I_CMD + ATA_I_IN + ATA_I_RELEASE + ATA_I_TAGMASK + ATA_IDENTIFY + ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE + ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE + ATA_IDLE + ATA_IDLE_IMMED + ATA_IREASON + ATA_MEDIA_EJECT + ATA_NOP + ATA_PACKET + ATA_PACKET_IDENTIFY + ATA_PC98_CTLOFFSET + ATA_PCCARD_CTLOFFSET + ATA_READ_BUFFER + ATA_READ_DMA + ATA_READ_DMA_EXT + ATA_READ_DMA_QUEUED + ATA_READ_DMA_QUEUED_EXT + ATA_READ_FPDMA + ATA_READ_LOG_DMA_EXT + ATA_READ_LOG_EXT + ATA_READ_MULTIPLE + ATA_READ_MULTIPLE_EXT + ATA_READ_SECTORS + ATA_READ_SECTORS_EXT + ATA_READ_STREAM_DMA_EXT + ATA_READ_VERIFY_SECTORS + ATA_READ_VERIFY_SECTORS_EXT + ATA_S_BUSY + ATA_S_CORR + ATA_S_DMA + ATA_S_DRQ + ATA_S_DSC + ATA_S_DWF + ATA_S_ERROR + ATA_S_INDEX + ATA_S_READY + ATA_S_SERVICE + ATA_SECTOR + ATA_SECURITY_FREEZE_LOCK + ATA_SECURITY_UNLOCK + ATA_SET_FEATURES + ATA_SMART + ATA_STANDBY + ATA_STANDBY_IMMED + ATA_STATUS + ATA_WRITE_BUFFER + ATA_WRITE_DMA + ATA_WRITE_DMA_EXT + ATA_WRITE_DMA_FUA + ATA_WRITE_DMA_QUEUED + ATA_WRITE_DMA_QUEUED_EXT + ATA_WRITE_DMA_QUEUED_FUA_EXT + ATA_WRITE_FPDMA + ATA_WRITE_LOG_DMA_EXT + ATA_WRITE_MULTIPLE + ATA_WRITE_MULTIPLE_EXT + ATA_WRITE_MULTIPLE_FUA_EXT + ATA_WRITE_SECTORS + ATA_WRITE_SECTORS_EXT + ATA_WRITE_STREAM_DMA_EXT + ATA_WRITE_UNCORRECTABLE + hdCmd + hdCylHi + hdCylLow + hdData + hdError + hdHead + hdSecCount + hdSecNum + hdStat + MAXPARTITIONS + NDDATA + NSPARE + fstypenames + hdInit + hdIoctl + hdRead + hdReset + hdStandby + hdStart + hdStop + hdWrite + initHardDisk lnc.h - Am79C960 - Am79C961 - Am79C961A - Am79C965 - Am79C970 - Am79C970A - Am79C971 - Am79C972 - Am79C973 - Am79C978 - AMD_MASK - BABL - C_LANCE - CERR - CSR0 - CSR1 - CSR2 - CSR3 - CSR88 - CSR89 - DMA_FIXED - DMA_MBUF - ERR - ETHER_ADDR_LEN - IDON - INEA - INIT - INTR - LANCE - MEM_SLEW - MERR - MISS - NDESC - NE2100 - NE2100_IOSIZE - NORMAL - NRDRE - NTDRE - PART_MASK - PCnet_32 - PCNET_BDP - PCnet_FAST - PCnet_FASTplus - PCnet_Home - PCnet_ISA - PCnet_ISA_II - PCnet_ISAplus - PCnet_PCI - PCnet_PCI_II - PCNET_RAP - PCNET_RDP - PCNET_RESET - PCNET_VSW - RECVBUFSIZE - RINT - RXON - SHMEM - STOP - STRT - TDMD - TINT - TRANSBUFSIZE - TXON - UNKNOWN - _lncInt - initLNC - lanceProbe - lncAttach - lncInt - probe - readBcr - readCsr - writeBcr - writeCsr - lnc + Am79C960 + Am79C961 + Am79C961A + Am79C965 + Am79C970 + Am79C970A + Am79C971 + Am79C972 + Am79C973 + Am79C978 + AMD_MASK + BABL + BCR18 + BCR18_DWIO + BCR20 + BDP + BDP32 + C_LANCE + CERR + CSR0 + CSR0_STOP + CSR1 + CSR15 + CSR15_DRTY + CSR15_DXMTFCS + CSR15_PROM + CSR2 + CSR3 + CSR58 + CSR88 + CSR89 + DMA_FIXED + DMA_MBUF + ERR + ETHER_ADDR_LEN + IDON + INEA + INIT + INTR + LANCE + MEM_SLEW + MERR + MISS + MODE_16 + MODE_32 + MODE_INVALID + NDESC + NE2100 + NE2100_IOSIZE + NORMAL + NRDRE + NTDRE + PART_MASK + PCnet_32 + PCnet_FAST + PCnet_FASTplus + PCnet_Home + PCnet_ISA + PCnet_ISA_II + PCnet_ISAplus + PCnet_PCI + PCnet_PCI_II + PCNET_VSW + RAP + RAP32 + RDP + RDP32 + RECVBUFSIZE + RESET + RESET32 + RINT + RXON + SHMEM + STRT + TDMD + TINT + TRANSBUFSIZE + TXON + UNKNOWN + lnc + _lncInt + initLNC + lanceProbe + lnc_driverOwnsRX + lnc_getMode + lnc_INT + lnc_isr + lnc_probe + lnc_readBCR + lnc_readBCR32 + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + lnc_rxINT + lnc_sendPacket + lnc_switchDWord + lnc_txINT + lnc_writeBCR + lnc_writeBCR32 + lnc_writeCSR + lnc_writeCSR32 + lncAttach + lncInt + probe pci.h - countof - pci_init - pciProbe - pciRead - pciWrite + countof + pci_init + pciProbe + pciRead + pciWrite ogDisplay_UbixOS.h sde.h - drawWindow - killWindow - registerWindow - windowReady - sdeThread - sysSDE - windows + drawWindow + killWindow + registerWindow + windowReady + windows + sdeThread + sysSDE stdarg.h - vaArg - vaEnd - vaStart - vaList - vsprintf + __va_copy + va_arg + va_end + va_start + va_list + vsprintf + + string.h + bcd2bin + bin2bcd + hex2ascii + tolower + toupper + bcd2bin_data + bin2bcd_data + hex2ascii_data + memcmp + memcpy + memset + sprintf + strcmp + strcpy + strlen + strncmp + strncpy + strstr + strtok + strtok_r + + strings.h + bcopy + bzero + + _null.h + NULL + + _sigset.h + _SIG_BIT + _SIG_IDX + _SIG_MAXSIG + _SIG_VALID + _SIG_WORD + _SIG_WORDS + __sigset_t + + _timespec.h + _TIME_T_DECLARED + time_t + + _timeval.h + _SUSECONDS_T_DECLARED + _TIME_T_DECLARED + suseconds_t + time_t _types.h - __blkcnt_t - __blksize_t - __clock_t - __dev_t - __fflags_t - __gid_t - __ino_t - __int16_t - __int32_t - __int64_t - __int8_t - __mode_t - __nlink_t - __ssize_t - __time_t - __uid_t - __uint16_t - __uint32_t - __uint64_t - __uint8_t + ___wchar_t + __blkcnt_t + __blksize_t + __char16_t + __char32_t + __clock_t + __dev_t + __fflags_t + __gid_t + __ino_t + __int16_t + __int32_t + __int64_t + __int8_t + __int_fast16_t + __int_fast32_t + __int_fast64_t + __int_fast8_t + __int_least16_t + __int_least32_t + __int_least64_t + __int_least8_t + __intmax_t + __intptr_t + __mode_t + __nlink_t + __pid_t + __ptrdiff_t + __rlim_t + __size_t + __ssize_t + __suseconds_t + __time_t + __uid_t + __uint16_t + __uint32_t + __uint64_t + __uint8_t + __uint_fast16_t + __uint_fast32_t + __uint_fast64_t + __uint_fast8_t + __uint_least16_t + __uint_least32_t + __uint_least64_t + __uint_least8_t + __uintfptr_t + __uintmax_t + __uintptr_t + + bootinfo.h + bi_endcommon + N_BIOS_GEOM buf.h cdefs.h - __dead2 - _CDRES_H + __alignof + __alloc_align + __alloc_size + __always_inline + __arg_type_tag + __asserts_exclusive + __asserts_shared + __BEGIN_DECLS + __BSD_VISIBLE + __CONCAT + __const + __containerof + __COPYRIGHT + __datatype_type_tag + __dead2 + __DECONST + __DEQUALIFY + __DEVOLATILE + __END_DECLS + __exported + __EXT1_VISIBLE + __fastcall + __FBSDID + __format_arg + __func__ + __GLOBL + __GLOBL1 + __GNUC_PREREQ__ + __guarded_by + __has_attribute + __has_builtin + __has_extension + __has_feature + __has_include + __hidden + __IDSTRING + __inline + __ISO_C_VISIBLE + __lock_annotate + __lockable + __locks_exclusive + __locks_shared + __malloc_like + __min_size + __no_lock_analysis + __noinline + __nonnull + __nonnull_all + __null_sentinel + __NULLABILITY_PRAGMA_POP + __NULLABILITY_PRAGMA_PUSH + __offsetof + __P + __POSIX_VISIBLE + __predict_false + __predict_true + __printf0like + __printflike + __pt_guarded_by + __pure + __pure2 + __rangeof + __RCSID + __RCSID_SOURCE + __requires_exclusive + __requires_shared + __requires_unlocked + __restrict + __result_use_check + __returns_twice + __scanflike + __SCCSID + __signed + __strfmonlike + __strftimelike + __STRING + __trylocks_exclusive + __trylocks_shared + __unlocks + __unreachable + __unused + __volatile + __weak_symbol + __XSI_VISIBLE + _Alignas + _Alignof + _Atomic + _Nonnull + _Noreturn + _Null_unspecified + _Nullable + _Static_assert + _Thread_local + const + inline + signed + volatile - device.h - device_add - device_find - device_remove + descrip.h + MAX_FILES + fo_close_t + fo_rdwr_t + fo_stat_t + mode_t + nlink_t + close + falloc + fcntl + fstat + getdtablesize + getfd + int_kern_openat + ioctl device.old.h dma.h - _dmaXfer - dmaXfer + _dmaXfer + dmaXfer driver.h - devMethod + devMethod + + elf32.h + ELF32_M_INFO + ELF32_M_SIZE + ELF32_M_SYM + ELF32_R_INFO + ELF32_R_SYM + ELF32_R_TYPE + ELF32_ST_BIND + ELF32_ST_INFO + ELF32_ST_TYPE + ELF32_ST_VISIBILITY + Elf32_Addr + Elf32_Half + Elf32_Hashelt + Elf32_Lword + Elf32_Nhdr + Elf32_Off + Elf32_Size + Elf32_Ssize + Elf32_Sword + Elf32_Versym + Elf32_Word + + elf64.h + ELF64_M_INFO + ELF64_M_SIZE + ELF64_M_SYM + ELF64_R_INFO + ELF64_R_SYM + ELF64_R_TYPE + ELF64_R_TYPE_DATA + ELF64_R_TYPE_ID + ELF64_R_TYPE_INFO + ELF64_ST_BIND + ELF64_ST_INFO + ELF64_ST_TYPE + ELF64_ST_VISIBILITY + Elf64_Addr + Elf64_Half + Elf64_Hashelt + Elf64_Lword + Elf64_Nhdr + Elf64_Off + Elf64_Size + Elf64_Ssize + Elf64_Sword + Elf64_Sxword + Elf64_Versym + Elf64_Word + Elf64_Xword + + elf_common.h + CA_SUNW_HW_1 + CA_SUNW_NULL + CA_SUNW_SF_1 + DF_1_BIND_NOW + DF_1_GLOBAL + DF_1_INTERPOSE + DF_1_LOADFLTR + DF_1_NODEFLIB + DF_1_NODELETE + DF_1_NOOPEN + DF_1_ORIGIN + DF_BIND_NOW + DF_ORIGIN + DF_STATIC_TLS + DF_SYMBOLIC + DF_TEXTREL + DT_ADDRRNGHI + DT_ADDRRNGLO + DT_ARM_PREEMPTMAP + DT_ARM_SYMTABSZ + DT_AUDIT + DT_AUXILIARY + DT_BIND_NOW + DT_CHECKSUM + DT_CONFIG + DT_DEBUG + DT_DEPAUDIT + DT_DEPRECATED_SPARC_REGISTER + DT_ENCODING + DT_FEATURE + DT_FEATURE_1 + DT_FILTER + DT_FINI + DT_FINI_ARRAY + DT_FINI_ARRAYSZ + DT_FLAGS + DT_FLAGS_1 + DT_GNU_CONFLICT + DT_GNU_CONFLICTSZ + DT_GNU_HASH + DT_GNU_LIBLIST + DT_GNU_LIBLISTSZ + DT_GNU_PRELINKED + DT_HASH + DT_HIOS + DT_HIPROC + DT_INIT + DT_INIT_ARRAY + DT_INIT_ARRAYSZ + DT_JMPREL + DT_LOOS + DT_LOPROC + DT_MAXPOSTAGS + DT_MIPS_AUX_DYNAMIC + DT_MIPS_BASE_ADDRESS + DT_MIPS_COMPACT_SIZE + DT_MIPS_CONFLICT + DT_MIPS_CONFLICTNO + DT_MIPS_CXX_FLAGS + DT_MIPS_DELTA_CLASS + DT_MIPS_DELTA_CLASS_NO + DT_MIPS_DELTA_CLASSSYM + DT_MIPS_DELTA_CLASSSYM_NO + DT_MIPS_DELTA_INSTANCE + DT_MIPS_DELTA_INSTANCE_NO + DT_MIPS_DELTA_RELOC + DT_MIPS_DELTA_RELOC_NO + DT_MIPS_DELTA_SYM + DT_MIPS_DELTA_SYM_NO + DT_MIPS_DYNSTR_ALIGN + DT_MIPS_FLAGS + DT_MIPS_GOTSYM + DT_MIPS_GP_VALUE + DT_MIPS_HIDDEN_GOTIDX + DT_MIPS_HIPAGENO + DT_MIPS_ICHECKSUM + DT_MIPS_INTERFACE + DT_MIPS_INTERFACE_SIZE + DT_MIPS_IVERSION + DT_MIPS_LIBLIST + DT_MIPS_LIBLISTNO + DT_MIPS_LOCAL_GOTIDX + DT_MIPS_LOCAL_GOTNO + DT_MIPS_LOCALPAGE_GOTIDX + DT_MIPS_OPTIONS + DT_MIPS_PERF_SUFFIX + DT_MIPS_PIXIE_INIT + DT_MIPS_PLTGOT + DT_MIPS_PROTECTED_GOTIDX + DT_MIPS_RLD_MAP + DT_MIPS_RLD_OBJ_UPDATE + DT_MIPS_RLD_TEXT_RESOLVE_ADDR + DT_MIPS_RLD_VERSION + DT_MIPS_RWPLT + DT_MIPS_SYMBOL_LIB + DT_MIPS_SYMTABNO + DT_MIPS_TIME_STAMP + DT_MIPS_UNREFEXTNO + DT_MOVEENT + DT_MOVESZ + DT_MOVETAB + DT_NEEDED + DT_NULL + DT_PLTGOT + DT_PLTPAD + DT_PLTPADSZ + DT_PLTREL + DT_PLTRELSZ + DT_POSFLAG_1 + DT_PPC64_GLINK + DT_PPC64_OPD + DT_PPC64_OPDSZ + DT_PPC64_TLSOPT + DT_PPC_GOT + DT_PPC_TLSOPT + DT_PREINIT_ARRAY + DT_PREINIT_ARRAYSZ + DT_REL + DT_RELA + DT_RELACOUNT + DT_RELAENT + DT_RELASZ + DT_RELCOUNT + DT_RELENT + DT_RELSZ + DT_RPATH + DT_RUNPATH + DT_SONAME + DT_SPARC_REGISTER + DT_STRSZ + DT_STRTAB + DT_SUNW_AUXILIARY + DT_SUNW_CAP + DT_SUNW_FILTER + DT_SUNW_RTLDINF + DT_SYMBOLIC + DT_SYMENT + DT_SYMINENT + DT_SYMINFO + DT_SYMINSZ + DT_SYMTAB + DT_TEXTREL + DT_TLSDESC_GOT + DT_TLSDESC_PLT + DT_USED + DT_VALRNGHI + DT_VALRNGLO + DT_VERDEF + DT_VERDEFNUM + DT_VERNEED + DT_VERNEEDNUM + DT_VERSYM + EF_ARM_ALIGN8 + EF_ARM_APCS_26 + EF_ARM_APCS_FLOAT + EF_ARM_BE8 + EF_ARM_DYNSYMSUSESEGIDX + EF_ARM_EABI_UNKNOWN + EF_ARM_EABI_VER1 + EF_ARM_EABI_VER2 + EF_ARM_EABI_VER3 + EF_ARM_EABI_VER4 + EF_ARM_EABI_VER5 + EF_ARM_EABIMASK + EF_ARM_HASENTRY + EF_ARM_INTERWORK + EF_ARM_LE8 + EF_ARM_MAPSYMSFIRST + EF_ARM_MAVERICK_FLOAT + EF_ARM_NEW_ABI + EF_ARM_OLD_ABI + EF_ARM_PIC + EF_ARM_RELEXEC + EF_ARM_SOFT_FLOAT + EF_ARM_SYMSARESORTED + EF_ARM_VFP_FLOAT + EF_MIPS_ABI2 + EF_MIPS_ARCH + EF_MIPS_ARCH_ASE + EF_MIPS_ARCH_ASE_M16 + EF_MIPS_ARCH_ASE_MDMX + EF_MIPS_CPIC + EF_MIPS_NOREORDER + EF_MIPS_OPTIONS_FIRST + EF_MIPS_PIC + EF_MIPS_UCODE + EF_PPC_EMB + EF_PPC_RELOCATABLE + EF_PPC_RELOCATABLE_LIB + EF_SPARC_32PLUS + EF_SPARC_EXT_MASK + EF_SPARC_HAL_R1 + EF_SPARC_SUN_US1 + EF_SPARC_SUN_US3 + EF_SPARCV9_MM + EF_SPARCV9_PSO + EF_SPARCV9_RMO + EF_SPARCV9_TSO + EI_ABIVERSION + EI_CLASS + EI_DATA + EI_MAG0 + EI_MAG1 + EI_MAG2 + EI_MAG3 + EI_NIDENT + EI_OSABI + EI_PAD + EI_VERSION + ELFCLASS32 + ELFCLASS64 + ELFCLASSNONE + ELFCOMPRESS_HIOS + ELFCOMPRESS_HIPROC + ELFCOMPRESS_LOOS + ELFCOMPRESS_LOPROC + ELFCOMPRESS_ZLIB + ELFDATA2LSB + ELFDATA2MSB + ELFDATANONE + ELFMAG + ELFMAG0 + ELFMAG1 + ELFMAG2 + ELFMAG3 + ELFOSABI_86OPEN + ELFOSABI_AIX + ELFOSABI_ARM + ELFOSABI_ARM_AEABI + ELFOSABI_AROS + ELFOSABI_CLOUDABI + ELFOSABI_FENIXOS + ELFOSABI_FREEBSD + ELFOSABI_GNU + ELFOSABI_HPUX + ELFOSABI_HURD + ELFOSABI_IRIX + ELFOSABI_LINUX + ELFOSABI_MODESTO + ELFOSABI_MONTEREY + ELFOSABI_NETBSD + ELFOSABI_NONE + ELFOSABI_NSK + ELFOSABI_OPENBSD + ELFOSABI_OPENVMS + ELFOSABI_SOLARIS + ELFOSABI_STANDALONE + ELFOSABI_SYSV + ELFOSABI_TRU64 + ELFOSABI_UBIXOS + EM_386 + EM_486 + EM_68HC05 + EM_68HC08 + EM_68HC11 + EM_68HC12 + EM_68HC16 + EM_68K + EM_860 + EM_88K + EM_960 + EM_AARCH64 + EM_ALPHA + EM_ALPHA_STD + EM_AMD64 + EM_ARC + EM_ARC_A5 + EM_ARCA + EM_ARM + EM_AVR + EM_BLACKFIN + EM_COLDFIRE + EM_CR + EM_CRIS + EM_D10V + EM_D30V + EM_F2MC16 + EM_FIREPATH + EM_FR20 + EM_FR30 + EM_FX66 + EM_H8_300 + EM_H8_300H + EM_H8_500 + EM_H8S + EM_HUANY + EM_IA_64 + EM_IAMCU + EM_IP2K + EM_JAVELIN + EM_M32 + EM_M32R + EM_MAX + EM_ME16 + EM_MIPS + EM_MIPS_RS3_LE + EM_MIPS_RS4_BE + EM_MIPS_X + EM_MMA + EM_MMIX + EM_MN10200 + EM_MN10300 + EM_MSP430 + EM_NCPU + EM_NDR1 + EM_NONE + EM_NS32K + EM_OPENRISC + EM_PARISC + EM_PCP + EM_PDSP + EM_PJ + EM_PPC + EM_PPC64 + EM_PRISM + EM_RCE + EM_RH32 + EM_RISCV + EM_S370 + EM_S390 + EM_SE_C33 + EM_SEP + EM_SH + EM_SNP1K + EM_SPARC + EM_SPARC32PLUS + EM_SPARCV9 + EM_ST100 + EM_ST19 + EM_ST200 + EM_ST7 + EM_ST9PLUS + EM_STARCORE + EM_SVX + EM_TINYJ + EM_TMM_GPP + EM_TPC + EM_TRICORE + EM_UNICORE + EM_V800 + EM_V850 + EM_VAX + EM_VIDEOCORE + EM_VPP500 + EM_X86_64 + EM_XTENSA + EM_ZSP + ET_CORE + ET_DYN + ET_EXEC + ET_HIOS + ET_HIPROC + ET_LOOS + ET_LOPROC + ET_NONE + ET_REL + EV_CURRENT + EV_NONE + GRP_COMDAT + IS_ELF + LL_DELAY_LOAD + LL_DELTA + LL_EXACT_MATCH + LL_EXPORTS + LL_IGNORE_INT_VER + LL_NONE + LL_REQUIRE_MINOR + NT_FPREGSET + NT_FREEBSD_ABI_TAG + NT_FREEBSD_ARCH_TAG + NT_FREEBSD_NOINIT_TAG + NT_PPC_VMX + NT_PROCSTAT_AUXV + NT_PROCSTAT_FILES + NT_PROCSTAT_GROUPS + NT_PROCSTAT_OSREL + NT_PROCSTAT_PROC + NT_PROCSTAT_PSSTRINGS + NT_PROCSTAT_RLIMIT + NT_PROCSTAT_UMASK + NT_PROCSTAT_VMMAP + NT_PRPSINFO + NT_PRSTATUS + NT_THRMISC + NT_X86_XSTATE + ODK_EXCEPTIONS + ODK_FILL + ODK_GP_GROUP + ODK_HWAND + ODK_HWOR + ODK_HWPATCH + ODK_IDENT + ODK_NULL + ODK_PAD + ODK_PAGESIZE + ODK_REGINFO + ODK_TAGS + OEX_DISMISS + OEX_FPU_MAX + OEX_FPU_MIN + OEX_PAGE0 + OEX_PRECISEFP + OEX_SMM + OGP_GROUP + OGP_SELF + OHW_R10KLDL + OHW_R4KEOP + OHW_R5KCVTL + OHW_R5KEOP + OHW_R8KPFETCH + OHWA0_R4KEOP_CHECKED + OHWA0_R4KEOP_CLEAN + OHWO0_FIXADE + OLD_EI_BRAND + OPAD_POSTFIX + OPAD_PREFIX + OPAD_SYMBOL + PF_MASKOS + PF_MASKPROC + PF_R + PF_W + PF_X + PN_XNUM + PT_ARM_ARCHEXT + PT_ARM_EXIDX + PT_DUMP_DELTA + PT_DYNAMIC + PT_GNU_EH_FRAME + PT_GNU_RELRO + PT_GNU_STACK + PT_HIOS + PT_HIPROC + PT_HISUNW + PT_INTERP + PT_LOAD + PT_LOOS + PT_LOPROC + PT_LOSUNW + PT_NOTE + PT_NULL + PT_PHDR + PT_SHLIB + PT_SUNW_UNWIND + PT_SUNWBSS + PT_SUNWCAP + PT_SUNWDTRACE + PT_SUNWSTACK + PT_TLS + R_386_32 + R_386_COPY + R_386_GLOB_DAT + R_386_GOT32 + R_386_GOTOFF + R_386_GOTPC + R_386_IRELATIVE + R_386_JMP_SLOT + R_386_NONE + R_386_PC32 + R_386_PLT32 + R_386_RELATIVE + R_386_TLS_DTPMOD32 + R_386_TLS_DTPOFF32 + R_386_TLS_GD + R_386_TLS_GD_32 + R_386_TLS_GD_CALL + R_386_TLS_GD_POP + R_386_TLS_GD_PUSH + R_386_TLS_GOTIE + R_386_TLS_IE + R_386_TLS_IE_32 + R_386_TLS_LDM + R_386_TLS_LDM_32 + R_386_TLS_LDM_CALL + R_386_TLS_LDM_POP + R_386_TLS_LDM_PUSH + R_386_TLS_LDO_32 + R_386_TLS_LE + R_386_TLS_LE_32 + R_386_TLS_TPOFF + R_386_TLS_TPOFF32 + R_AARCH64_ABS16 + R_AARCH64_ABS32 + R_AARCH64_ABS64 + R_AARCH64_COPY + R_AARCH64_GLOB_DAT + R_AARCH64_IRELATIVE + R_AARCH64_JUMP_SLOT + R_AARCH64_NONE + R_AARCH64_PREL16 + R_AARCH64_PREL32 + R_AARCH64_PREL64 + R_AARCH64_RELATIVE + R_AARCH64_TLS_DTPMOD64 + R_AARCH64_TLS_DTPREL64 + R_AARCH64_TLS_TPREL64 + R_AARCH64_TLSDESC + R_ARM_ABS12 + R_ARM_ABS16 + R_ARM_ABS32 + R_ARM_ABS8 + R_ARM_AMP_VCALL9 + R_ARM_COPY + R_ARM_GLOB_DAT + R_ARM_GNU_VTENTRY + R_ARM_GNU_VTINHERIT + R_ARM_GOT32 + R_ARM_GOTOFF + R_ARM_GOTPC + R_ARM_JUMP_SLOT + R_ARM_NONE + R_ARM_PC13 + R_ARM_PC24 + R_ARM_PLT32 + R_ARM_RABS32 + R_ARM_RBASE + R_ARM_REL32 + R_ARM_RELATIVE + R_ARM_RPC24 + R_ARM_RREL32 + R_ARM_RSBREL32 + R_ARM_SBREL32 + R_ARM_SWI24 + R_ARM_THM_ABS5 + R_ARM_THM_PC22 + R_ARM_THM_PC8 + R_ARM_THM_RPC22 + R_ARM_THM_SWI8 + R_ARM_THM_XPC22 + R_ARM_TLS_DTPMOD32 + R_ARM_TLS_DTPOFF32 + R_ARM_TLS_TPOFF32 + R_ARM_XPC25 + R_IA_64_DIR32LSB + R_IA_64_DIR32MSB + R_IA_64_DIR64LSB + R_IA_64_DIR64MSB + R_IA_64_DTPMOD64LSB + R_IA_64_DTPMOD64MSB + R_IA_64_DTPREL14 + R_IA_64_DTPREL22 + R_IA_64_DTPREL32LSB + R_IA_64_DTPREL32MSB + R_IA_64_DTPREL64I + R_IA_64_DTPREL64LSB + R_IA_64_DTPREL64MSB + R_IA_64_FPTR32LSB + R_IA_64_FPTR32MSB + R_IA_64_FPTR64I + R_IA_64_FPTR64LSB + R_IA_64_FPTR64MSB + R_IA_64_GPREL22 + R_IA_64_GPREL32LSB + R_IA_64_GPREL32MSB + R_IA_64_GPREL64I + R_IA_64_GPREL64LSB + R_IA_64_GPREL64MSB + R_IA_64_IMM14 + R_IA_64_IMM22 + R_IA_64_IMM64 + R_IA_64_IPLTLSB + R_IA_64_IPLTMSB + R_IA_64_LDXMOV + R_IA_64_LTOFF22 + R_IA_64_LTOFF22X + R_IA_64_LTOFF64I + R_IA_64_LTOFF_DTPMOD22 + R_IA_64_LTOFF_DTPREL22 + R_IA_64_LTOFF_FPTR22 + R_IA_64_LTOFF_FPTR32LSB + R_IA_64_LTOFF_FPTR32MSB + R_IA_64_LTOFF_FPTR64I + R_IA_64_LTOFF_FPTR64LSB + R_IA_64_LTOFF_FPTR64MSB + R_IA_64_LTOFF_TPREL22 + R_IA_64_LTV32LSB + R_IA_64_LTV32MSB + R_IA_64_LTV64LSB + R_IA_64_LTV64MSB + R_IA_64_NONE + R_IA_64_PCREL21B + R_IA_64_PCREL21BI + R_IA_64_PCREL21F + R_IA_64_PCREL21M + R_IA_64_PCREL22 + R_IA_64_PCREL32LSB + R_IA_64_PCREL32MSB + R_IA_64_PCREL60B + R_IA_64_PCREL64I + R_IA_64_PCREL64LSB + R_IA_64_PCREL64MSB + R_IA_64_PLTOFF22 + R_IA_64_PLTOFF64I + R_IA_64_PLTOFF64LSB + R_IA_64_PLTOFF64MSB + R_IA_64_REL32LSB + R_IA_64_REL32MSB + R_IA_64_REL64LSB + R_IA_64_REL64MSB + R_IA_64_SECREL32LSB + R_IA_64_SECREL32MSB + R_IA_64_SECREL64LSB + R_IA_64_SECREL64MSB + R_IA_64_SEGREL32LSB + R_IA_64_SEGREL32MSB + R_IA_64_SEGREL64LSB + R_IA_64_SEGREL64MSB + R_IA_64_SUB + R_IA_64_TPREL14 + R_IA_64_TPREL22 + R_IA_64_TPREL64I + R_IA_64_TPREL64LSB + R_IA_64_TPREL64MSB + R_MIPS_16 + R_MIPS_26 + R_MIPS_32 + R_MIPS_64 + R_MIPS_CALL16 + R_MIPS_CALLHI16 + R_MIPS_CALLLO16 + R_MIPS_GOT16 + R_MIPS_GOT_DISP + R_MIPS_GOT_HI16 + R_MIPS_GOT_LO16 + R_MIPS_GOT_OFST + R_MIPS_GOT_PAGE + R_MIPS_GPREL16 + R_MIPS_GPREL32 + R_MIPS_HI16 + R_MIPS_JALR + R_MIPS_LITERAL + R_MIPS_LO16 + R_MIPS_NONE + R_MIPS_PC16 + R_MIPS_REL32 + R_MIPS_SUB + R_MIPS_TLS_GD + R_PPC64_ADDR16_HIGHER + R_PPC64_ADDR16_HIGHERA + R_PPC64_ADDR16_HIGHEST + R_PPC64_ADDR16_HIGHESTA + R_PPC64_ADDR64 + R_PPC64_DTPMOD64 + R_PPC64_DTPREL64 + R_PPC64_PLT64 + R_PPC64_PLTREL64 + R_PPC64_REL64 + R_PPC64_TOC + R_PPC64_TOC16 + R_PPC64_TOC16_HA + R_PPC64_TOC16_HI + R_PPC64_TOC16_LO + R_PPC64_TPREL64 + R_PPC64_UADDR64 + R_PPC_ADDR14 + R_PPC_ADDR14_BRNTAKEN + R_PPC_ADDR14_BRTAKEN + R_PPC_ADDR16 + R_PPC_ADDR16_HA + R_PPC_ADDR16_HI + R_PPC_ADDR16_LO + R_PPC_ADDR24 + R_PPC_ADDR32 + R_PPC_COPY + R_PPC_DTPMOD32 + R_PPC_DTPREL16 + R_PPC_DTPREL16_HA + R_PPC_DTPREL16_HI + R_PPC_DTPREL16_LO + R_PPC_DTPREL32 + R_PPC_EMB_BIT_FLD + R_PPC_EMB_MRKREF + R_PPC_EMB_NADDR16 + R_PPC_EMB_NADDR16_HA + R_PPC_EMB_NADDR16_HI + R_PPC_EMB_NADDR16_LO + R_PPC_EMB_NADDR32 + R_PPC_EMB_RELSDA + R_PPC_EMB_RELSEC16 + R_PPC_EMB_RELST_HA + R_PPC_EMB_RELST_HI + R_PPC_EMB_RELST_LO + R_PPC_EMB_SDA21 + R_PPC_EMB_SDA2I16 + R_PPC_EMB_SDA2REL + R_PPC_EMB_SDAI16 + R_PPC_GLOB_DAT + R_PPC_GOT16 + R_PPC_GOT16_HA + R_PPC_GOT16_HI + R_PPC_GOT16_LO + R_PPC_GOT_TLSGD16 + R_PPC_GOT_TLSGD16_HA + R_PPC_GOT_TLSGD16_HI + R_PPC_GOT_TLSGD16_LO + R_PPC_GOT_TLSLD16 + R_PPC_GOT_TLSLD16_HA + R_PPC_GOT_TLSLD16_HI + R_PPC_GOT_TLSLD16_LO + R_PPC_GOT_TPREL16 + R_PPC_GOT_TPREL16_HA + R_PPC_GOT_TPREL16_HI + R_PPC_GOT_TPREL16_LO + R_PPC_JMP_SLOT + R_PPC_LOCAL24PC + R_PPC_NONE + R_PPC_PLT16_HA + R_PPC_PLT16_HI + R_PPC_PLT16_LO + R_PPC_PLT32 + R_PPC_PLTREL24 + R_PPC_PLTREL32 + R_PPC_REL14 + R_PPC_REL14_BRNTAKEN + R_PPC_REL14_BRTAKEN + R_PPC_REL24 + R_PPC_REL32 + R_PPC_RELATIVE + R_PPC_SDAREL16 + R_PPC_SECTOFF + R_PPC_SECTOFF_HA + R_PPC_SECTOFF_HI + R_PPC_SECTOFF_LO + R_PPC_TLS + R_PPC_TPREL16 + R_PPC_TPREL16_HA + R_PPC_TPREL16_HI + R_PPC_TPREL16_LO + R_PPC_TPREL32 + R_PPC_UADDR16 + R_PPC_UADDR32 + R_RISCV_32 + R_RISCV_64 + R_RISCV_ADD16 + R_RISCV_ADD32 + R_RISCV_ADD64 + R_RISCV_ADD8 + R_RISCV_ALIGN + R_RISCV_BRANCH + R_RISCV_CALL + R_RISCV_CALL_PLT + R_RISCV_COPY + R_RISCV_GNU_VTENTRY + R_RISCV_GNU_VTINHERIT + R_RISCV_GOT_HI20 + R_RISCV_HI20 + R_RISCV_JAL + R_RISCV_JUMP_SLOT + R_RISCV_LO12_I + R_RISCV_LO12_S + R_RISCV_NONE + R_RISCV_PCREL_HI20 + R_RISCV_PCREL_LO12_I + R_RISCV_PCREL_LO12_S + R_RISCV_RELATIVE + R_RISCV_RVC_BRANCH + R_RISCV_RVC_JUMP + R_RISCV_SUB16 + R_RISCV_SUB32 + R_RISCV_SUB64 + R_RISCV_SUB8 + R_RISCV_TLS_DTPMOD32 + R_RISCV_TLS_DTPMOD64 + R_RISCV_TLS_DTPREL32 + R_RISCV_TLS_DTPREL64 + R_RISCV_TLS_GD_HI20 + R_RISCV_TLS_GOT_HI20 + R_RISCV_TLS_TPREL32 + R_RISCV_TLS_TPREL64 + R_RISCV_TPREL_ADD + R_RISCV_TPREL_HI20 + R_RISCV_TPREL_LO12_I + R_RISCV_TPREL_LO12_S + R_SPARC_10 + R_SPARC_11 + R_SPARC_13 + R_SPARC_16 + R_SPARC_22 + R_SPARC_32 + R_SPARC_5 + R_SPARC_6 + R_SPARC_64 + R_SPARC_7 + R_SPARC_8 + R_SPARC_COPY + R_SPARC_DISP16 + R_SPARC_DISP32 + R_SPARC_DISP64 + R_SPARC_DISP8 + R_SPARC_GLOB_DAT + R_SPARC_GLOB_JMP + R_SPARC_GOT10 + R_SPARC_GOT13 + R_SPARC_GOT22 + R_SPARC_H44 + R_SPARC_HH22 + R_SPARC_HI22 + R_SPARC_HIPLT22 + R_SPARC_HIX22 + R_SPARC_HM10 + R_SPARC_JMP_SLOT + R_SPARC_L44 + R_SPARC_LM22 + R_SPARC_LO10 + R_SPARC_LOPLT10 + R_SPARC_LOX10 + R_SPARC_M44 + R_SPARC_NONE + R_SPARC_OLO10 + R_SPARC_PC10 + R_SPARC_PC22 + R_SPARC_PC_HH22 + R_SPARC_PC_HM10 + R_SPARC_PC_LM22 + R_SPARC_PCPLT10 + R_SPARC_PCPLT22 + R_SPARC_PCPLT32 + R_SPARC_PLT32 + R_SPARC_PLT64 + R_SPARC_REGISTER + R_SPARC_RELATIVE + R_SPARC_TLS_DTPMOD32 + R_SPARC_TLS_DTPMOD64 + R_SPARC_TLS_DTPOFF32 + R_SPARC_TLS_DTPOFF64 + R_SPARC_TLS_GD_ADD + R_SPARC_TLS_GD_CALL + R_SPARC_TLS_GD_HI22 + R_SPARC_TLS_GD_LO10 + R_SPARC_TLS_IE_ADD + R_SPARC_TLS_IE_HI22 + R_SPARC_TLS_IE_LD + R_SPARC_TLS_IE_LDX + R_SPARC_TLS_IE_LO10 + R_SPARC_TLS_LDM_ADD + R_SPARC_TLS_LDM_CALL + R_SPARC_TLS_LDM_HI22 + R_SPARC_TLS_LDM_LO10 + R_SPARC_TLS_LDO_ADD + R_SPARC_TLS_LDO_HIX22 + R_SPARC_TLS_LDO_LOX10 + R_SPARC_TLS_LE_HIX22 + R_SPARC_TLS_LE_LOX10 + R_SPARC_TLS_TPOFF32 + R_SPARC_TLS_TPOFF64 + R_SPARC_UA16 + R_SPARC_UA32 + R_SPARC_UA64 + R_SPARC_WDISP16 + R_SPARC_WDISP19 + R_SPARC_WDISP22 + R_SPARC_WDISP30 + R_SPARC_WPLT30 + R_X86_64_16 + R_X86_64_32 + R_X86_64_32S + R_X86_64_64 + R_X86_64_8 + R_X86_64_COPY + R_X86_64_DTPMOD64 + R_X86_64_DTPOFF32 + R_X86_64_DTPOFF64 + R_X86_64_GLOB_DAT + R_X86_64_GOT32 + R_X86_64_GOT64 + R_X86_64_GOTOFF64 + R_X86_64_GOTPC32 + R_X86_64_GOTPC32_TLSDESC + R_X86_64_GOTPC64 + R_X86_64_GOTPCREL + R_X86_64_GOTPCREL64 + R_X86_64_GOTPLT64 + R_X86_64_GOTTPOFF + R_X86_64_IRELATIVE + R_X86_64_JMP_SLOT + R_X86_64_NONE + R_X86_64_PC16 + R_X86_64_PC32 + R_X86_64_PC64 + R_X86_64_PC8 + R_X86_64_PLT32 + R_X86_64_PLTOFF64 + R_X86_64_RELATIVE + R_X86_64_SIZE32 + R_X86_64_SIZE64 + R_X86_64_TLSDESC + R_X86_64_TLSDESC_CALL + R_X86_64_TLSGD + R_X86_64_TLSLD + R_X86_64_TPOFF32 + R_X86_64_TPOFF64 + SELFMAG + SHF_ALLOC + SHF_COMPRESSED + SHF_EXECINSTR + SHF_GROUP + SHF_INFO_LINK + SHF_LINK_ORDER + SHF_MASKOS + SHF_MASKPROC + SHF_MERGE + SHF_OS_NONCONFORMING + SHF_STRINGS + SHF_TLS + SHF_WRITE + SHN_ABS + SHN_COMMON + SHN_FBSD_CACHED + SHN_HIOS + SHN_HIPROC + SHN_HIRESERVE + SHN_LOOS + SHN_LOPROC + SHN_LORESERVE + SHN_UNDEF + SHN_XINDEX + SHT_AMD64_UNWIND + SHT_ARM_ATTRIBUTES + SHT_ARM_DEBUGOVERLAY + SHT_ARM_EXIDX + SHT_ARM_OVERLAYSECTION + SHT_ARM_PREEMPTMAP + SHT_DYNAMIC + SHT_DYNSYM + SHT_FINI_ARRAY + SHT_GNU_ATTRIBUTES + SHT_GNU_HASH + SHT_GNU_LIBLIST + SHT_GNU_verdef + SHT_GNU_verneed + SHT_GNU_versym + SHT_GROUP + SHT_HASH + SHT_HIOS + SHT_HIPROC + SHT_HISUNW + SHT_HIUSER + SHT_INIT_ARRAY + SHT_LOOS + SHT_LOPROC + SHT_LOSUNW + SHT_LOUSER + SHT_MIPS_ABIFLAGS + SHT_MIPS_CONFLICT + SHT_MIPS_CONTENT + SHT_MIPS_DEBUG + SHT_MIPS_DELTACLASS + SHT_MIPS_DELTADECL + SHT_MIPS_DELTAINST + SHT_MIPS_DELTASYM + SHT_MIPS_DWARF + SHT_MIPS_EH_REGION + SHT_MIPS_EVENTS + SHT_MIPS_GPTAB + SHT_MIPS_IFACE + SHT_MIPS_LIBLIST + SHT_MIPS_MSYM + SHT_MIPS_OPTIONS + SHT_MIPS_PACKAGE + SHT_MIPS_PACKSYM + SHT_MIPS_PDR_EXCEPTION + SHT_MIPS_PIXIE + SHT_MIPS_REGINFO + SHT_MIPS_RELD + SHT_MIPS_SYMBOL_LIB + SHT_MIPS_TRANSLATE + SHT_MIPS_UCODE + SHT_MIPS_WHIRL + SHT_MIPS_XLATE + SHT_MIPS_XLATE_DEBUG + SHT_MIPS_XLATE_OLD + SHT_NOBITS + SHT_NOTE + SHT_NULL + SHT_PREINIT_ARRAY + SHT_PROGBITS + SHT_REL + SHT_RELA + SHT_SHLIB + SHT_SPARC_GOTDATA + SHT_STRTAB + SHT_SUNW_ANNOTATE + SHT_SUNW_cap + SHT_SUNW_COMDAT + SHT_SUNW_DEBUG + SHT_SUNW_DEBUGSTR + SHT_SUNW_dof + SHT_SUNW_move + SHT_SUNW_SIGNATURE + SHT_SUNW_syminfo + SHT_SUNW_verdef + SHT_SUNW_verneed + SHT_SUNW_versym + SHT_SYMTAB + SHT_SYMTAB_SHNDX + SHT_X86_64_UNWIND + SHTORDERED + STB_GLOBAL + STB_GNU_UNIQUE + STB_HIOS + STB_HIPROC + STB_LOCAL + STB_LOOS + STB_LOPROC + STB_WEAK + STN_UNDEF + STT_COMMON + STT_FILE + STT_FUNC + STT_GNU_IFUNC + STT_HIOS + STT_HIPROC + STT_LOOS + STT_LOPROC + STT_NOTYPE + STT_NUM + STT_OBJECT + STT_SECTION + STT_SPARC_REGISTER + STT_TLS + STV_DEFAULT + STV_ELIMINATE + STV_EXPORTED + STV_HIDDEN + STV_INTERNAL + STV_PROTECTED + STV_SINGLETON + SYMINFO_BT_EXTERN + SYMINFO_BT_LOWRESERVE + SYMINFO_BT_NONE + SYMINFO_BT_PARENT + SYMINFO_BT_SELF + SYMINFO_CURRENT + SYMINFO_FLG_AUXILIARY + SYMINFO_FLG_COPY + SYMINFO_FLG_DIRECT + SYMINFO_FLG_DIRECTBIND + SYMINFO_FLG_FILTER + SYMINFO_FLG_LAZYLOAD + SYMINFO_FLG_NOEXTDIRECT + SYMINFO_FLG_PASSTHRU + SYMINFO_NONE + SYMINFO_NUM + VER_DEF_CURRENT + VER_DEF_IDX + VER_FLG_BASE + VER_FLG_WEAK + VER_NDX + VER_NDX_GIVEN + VER_NDX_GLOBAL + VER_NDX_HIDDEN + VER_NDX_LOCAL + VER_NEED_CURRENT + VER_NEED_HIDDEN + VER_NEED_IDX + VER_NEED_WEAK + VERSYM_HIDDEN + VERSYM_VERSION + + elf_generic.h + __elfN + __ElfN + __ELFN + __ElfType + ELF_CLASS + ELF_DATA + ELF_R_INFO + ELF_R_SYM + ELF_R_TYPE + ELF_ST_BIND + ELF_ST_INFO + ELF_ST_TYPE + ELF_ST_VISIBILITY + Addr + Dyn + Ehdr + Half + Hashelt + Off + Phdr + Rel + Rela + Shdr + Size + Ssize + Sword + Sym + Verdaux + Verdef + Vernaux + Verneed + Versym + Word + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + __CONCAT + + fcntl.h + AT_FDCWD + F_DUPFD + F_GETFD + F_GETFL + F_GETLK + F_GETOWN + F_SETFD + F_SETFL + F_SETLK + F_SETLKW + F_SETOWN + FAPPEND + FASYNC + FCNTLFLAGS + FEXEC + FFLAGS + FFSYNC + FHASLOCK + FMASK + FNDELAY + FNONBLOCK + FPOSIXSHM + FREAD + FWRITE + O_ACCMODE + O_APPEND + O_ASYNC + O_CREAT + O_DIRECT + O_DIRECTORY + O_EXCL + O_EXEC + O_EXLOCK + O_FSYNC + O_NDELAY + O_NOFOLLOW + O_NONBLOCK + O_RDONLY + O_RDWR + O_SHLOCK + O_SYNC + O_TRUNC + O_WRONLY + OFLAGS gdt.h - dAcc - dBig - dBiglim - dBusy - dCall - dCode - dConform - dData - dDpl0 - dDpl1 - dDpl2 - dDpl3 - dEexdown - dInt - dLdt - dNpresent - dPresent - dRead - dTask - dTrap - dTss - dWrite - ubixDescriptorTable - ubixGateDescriptor - ubixStandardDescriptor - packed - packed - ubixGDT + dAcc + dBig + dBiglim + dBusy + dCall + dCode + dConform + dData + dDpl0 + dDpl1 + dDpl2 + dDpl3 + dEexdown + dInt + dLdt + dNpresent + dPresent + dRead + dTask + dTrap + dTss + dWrite + SEL_GET_IDX + SEL_GET_LG + SEL_GET_PL + SEL_PL_KERN + SEL_PL_USER + ubixDescriptorTable + ubixGateDescriptor + ubixStandardDescriptor + __attribute__ + access + baseHigh + baseLow + baseMed + granularity + limitHigh + limitLow + offsetHigh + offsetLow + selector + ubixGDT + __attribute__ gen_calls.h - getgid - getpid - gettimeofday_new - getuid - issetugid - read - readlink + getgid + getpid + gettimeofday_new + getuid + issetugid + read + readlink idt.h - EFLAG_IF - EFLAG_IOPL3 - EFLAG_TF - EFLAG_VM - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int7 - _int8 - _int9 - idt_init - intNull - setTaskVector - setVector - timerInt + EFLAG_IF + EFLAG_IOPL3 + EFLAG_TF + EFLAG_VM + idt_init + setTaskVector + setVector + timerInt io.h - inportByte - inportDWord - inportWord - outportByte - outportByteP - outportDWord - outportWord + inportByte + inportDWord + inportWord + outportByte + outportByteP + outportDWord + outportWord - kern_descrip.h - F_DUPFD - F_GETFD - F_GETFL - F_GETLK - F_GETOWN - F_SETFD - F_SETFL - F_SETLK - F_SETLKW - F_SETOWN - FAPPEND - FASYNC - FCNTLFLAGS - FFLAGS - FFSYNC - FHASLOCK - FNDELAY - FNONBLOCK - FPOSIXSHM - FREAD - FWRITE - O_ACCMODE - O_APPEND - O_ASYNC - O_CREAT - O_DIRECT - O_EXCL - O_EXLOCK - O_FSYNC - O_NDELAY - O_NOFOLLOW - O_NONBLOCK - O_RDONLY - O_RDWR - O_SHLOCK - O_SYNC - O_TRUNC - O_WRONLY - OFLAGS - mode_t - nlink_t - close - falloc - fcntl - fstat - getdtablesize - getfd - ioctl + ioctl.h + _IO + _IOC + _IOR + _IOW + _IOWINT + _IOWR + IOC_DIRMASK + IOC_IN + IOC_INOUT + IOC_OUT + IOC_VOID + IOCBASECMD + IOCGROUP + IOCPARM_IVAL + IOCPARM_LEN + IOCPARM_MASK + IOCPARM_MAX + IOCPARM_SHIFT + NCCS + TIOCGETA + TIOCGWINSZ + cc_t + speed_t + tcflag_t kern_sig.h - sigaction - sigprocmask + sigaction + sigprocmask kern_sysctl.h - CTL_DEBUG - CTL_HW - CTL_KERN - CTL_KERN_OPENFILES - CTL_MACHDEP - CTL_MAXNAME - CTL_NET - CTL_P1003_1B - CTL_UBIX - CTL_UNSPEC - CTL_USER - CTL_VFS - CTL_VM - EINVAL - kern_sysctl - sysctl_add - sysctl_init - sysctl_enabled + CTL_DEBUG + CTL_HW + CTL_KERN + CTL_KERN_OPENFILES + CTL_MACHDEP + CTL_MAXNAME + CTL_NET + CTL_P1003_1B + CTL_UBIX + CTL_UNSPEC + CTL_USER + CTL_VFS + CTL_VM + EINVAL + sysctl_enabled + kern_sysctl + sysctl_add + sysctl_init pipe.h - pipe + pipe - signal.h - _SIG_BIT - _SIG_IDX - _SIG_MAXSIG - _SIG_VALID - _SIG_WORD - _SIG_WORDS - _SIGNALL_H - __sigset_t - sigset_t + resource.h + _RLIM_T_DECLARED + RLIM_NLIMITS + RLIMIT_AS + RLIMIT_CORE + RLIMIT_CPU + RLIMIT_DATA + RLIMIT_FSIZE + RLIMIT_KQUEUES + RLIMIT_MEMLOCK + RLIMIT_NOFILE + RLIMIT_NPROC + RLIMIT_NPTS + RLIMIT_RSS + RLIMIT_SBSIZE + RLIMIT_STACK + RLIMIT_SWAP + RLIMIT_UMTXP + RLIMIT_VMEM + rlim_t + rlimit_ident + + select.h + __fdset_mask + _howmany + _NFDBITS + _SELECT_DECLARED + _SIGSET_T_DECLARED + FD_CLR + FD_COPY + FD_ISSET + FD_SET + FD_SETSIZE + FD_ZERO + fds_bits + NFDBITS + __fd_mask + fd_mask + fd_set + sigset_t + pselect + select + + stdatomic.h + __ATOMIC_ACQ_REL + __ATOMIC_ACQUIRE + __atomic_apply_stride + __ATOMIC_CONSUME + __ATOMIC_RELAXED + __ATOMIC_RELEASE + __ATOMIC_SEQ_CST + atomic_compare_exchange_strong + atomic_compare_exchange_strong_explicit + atomic_compare_exchange_weak + atomic_compare_exchange_weak_explicit + atomic_exchange + atomic_exchange_explicit + atomic_fetch_add + atomic_fetch_add_explicit + atomic_fetch_and + atomic_fetch_and_explicit + atomic_fetch_or + atomic_fetch_or_explicit + atomic_fetch_sub + atomic_fetch_sub_explicit + atomic_fetch_xor + atomic_fetch_xor_explicit + ATOMIC_FLAG_INIT + atomic_init + atomic_is_lock_free + atomic_load + atomic_load_explicit + atomic_store + atomic_store_explicit + ATOMIC_VAR_INIT + memory_order + memory_order_relaxed + memory_order_consume + memory_order_acquire + memory_order_release + memory_order_acq_rel + memory_order_seq_cst + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + _Atomic + atomic_flag_clear + atomic_flag_clear_explicit + atomic_flag_test_and_set + atomic_flag_test_and_set_explicit + atomic_signal_fence + atomic_thread_fence sysproto.h - PAD_ - PADL_ - PADR_ - register_t - setitimer - sys_open - sys_write + PAD_ + PADL_ + PADR_ + register_t + sys_invalid + sys_mpiCreateMbox + sys_mpiDestroyMbox + sys_mpiFetchMessage + sys_mpiPostMessage + + sysproto_posix.h + PAD_ + PADL_ + PADR_ + register_t + access + fstatfs + mprotect + setitimer + sys_access + sys_chdir + sys_close + sys_dup2 + sys_execve + sys_exit + sys_fchdir + sys_fclose + sys_fcntl + sys_fgetc + sys_fopen + sys_fork + sys_fread + sys_fseek + sys_fstat + sys_fstatat + sys_fstatfs + sys_getcwd + sys_getdirentries + sys_getegid + sys_geteuid + sys_getGID + sys_getlogin + sys_getpgrp + sys_getpid + sys_getppid + sys_getrlimit + sys_gettimeofday + sys_getUID + sys_invalid + sys_ioctl + sys_issetugid + sys_lseek + sys_lstat + sys_mmap + sys_munmap + sys_open + sys_openat + sys_pipe2 + sys_pread + sys_read + sys_readlink + sys_rename + sys_sched_yield + sys_select + sys_sendto + sys_setGID + sys_setlogin + sys_setpgid + sys_setpgrp + sys_setrlimit + sys_setsockopt + sys_setUID + sys_sigaction + sys_sigprocmask + sys_socket + sys_stat + sys_statfs + sys_sysarch + sys_sysctl + sys_wait4 + sys_write thread.h - O_FILES + O_FILES trap.h + die_if_kernel + trap tss.h + uuid.h + _UUID_NODE_LEN + uuid_t + uuidgen + video.h - defaultColor - backSpace - clearScreen - kprint - printColor + defaultColor + printColor + backSpace + clearScreen + kprint dirCache.h - ubixfs_cacheAdd - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew + ubixfs_cacheAdd + ubixfs_cacheDelete + ubixfs_cacheFind + ubixfs_cacheNew - ubixfs.h - blockSize - EOBC - MAXUBIXPARTITIONS - typeContainer - typeDeleted - typeDirectory - typeFile - UBIXDISKMAGIC - UBIXFS_ALIGN - UBIXFS_BLOCKSIZE_BYTES - dirList_t - addDirEntry - freeBlocks - getFreeBlocks - readFile - readUbixFS - syncBat - ubixfs_init - ubixfs_initialize - ubixfs_thread - ubixFSLoadDir - ubixFSmkDir - ubixFSUnlink - writeFileByte - writeUbixFS - - elf.h - ELF32_R_INFO - ELF32_R_SYM - ELF32_R_TYPE - elfExecutable - elfLibrary - EM_386 - EM_68K - EM_860 - EM_88K - EM_M32 - EM_MIPS - EM_NONE - EM_SPARC - ET_CORE - ET_DYN - ET_EXEC - ET_HIPROC - ET_LOPROC - ET_NONE - ET_REL - EV_CURRENT - EV_NONE - PT_DYNAMIC - PT_GNU_EH_FRAME - PT_GNU_RELRO - PT_GNU_STACK - PT_HIOS - PT_HIPROC - PT_INTERP - PT_LOAD - PT_LOOS - PT_LOPROC - PT_NOTE - PT_NULL - PT_PAX_FLAGS - PT_PHDR - PT_SHLIB - R_386_32 - R_386_COPY - R_386_GLOB_DAT - R_386_GOT32 - R_386_GOTOFF - R_386_GOTPC - R_386_JMP_SLOT - R_386_NONE - R_386_PC32 - R_386_PLT32 - R_386_RELATIVE - elf_loadfile - elfGetPhType - elfGetRelType - elfGetShType + access.h + sys_getEUID + sys_getGID + sys_getUID + sys_setGID + sys_setUID endtask.h - endTask + endTask exec.h - execFile - execThread - sys_exec + execFile + execThread + sys_exec fork.h - sysFork - - init.h - intFunctionPTR - init_tasks - init_tasksTotal + sysFork kmod.h - LD_START - kmod_t - kmod_add - kmod_load + LD_START + kmod_t + kmod_add + kmod_load kpanic.h - K_PANIC - kpanic + K_PANIC + kpanic ld.h - LD_START - ldEnable + LD_START + ldEnable lists.h - IN - STATUS_FAILURE - STATUS_SUCCESS - Item_t - List_t - CreateItem - DestroyItemList - DestroyItemsInList - GetFirstItem - GetLastItem - InitializeList - InsertItemAtFront - InsertItemBetweenItems - InsertItemListBetweenItems - RemoveItem - RemoveItemListBetweenItems + IN + STATUS_FAILURE + STATUS_SUCCESS + Item_t + List_t + CreateItem + DestroyItemList + DestroyItemsInList + GetFirstItem + GetLastItem + InitializeList + InsertItemAtFront + InsertItemBetweenItems + InsertItemListBetweenItems + RemoveItem + RemoveItemListBetweenItems sched.h - kTask_t - tState - PLACEHOLDER - DEAD - NEW - READY - RUNNING - IDLE - FORK - WAIT - sched - sched_addDelTask - sched_deleteTask - sched_getDelTask - sched_init - sched_setStatus - sched_yield - schedEndTask - schedFindTask - schedNewTask - _current - _usedMath + NO_GROUP + NR_GROUPS + tState + PLACEHOLDER + DEAD + NEW + READY + RUNNING + IDLE + FORK + WAIT + UNINTERRUPTIBLE + INTERRUPTIBLE + kTask_t + _current + _usedMath + sched + sched_addDelTask + sched_deleteTask + sched_getDelTask + sched_init + sched_setStatus + sched_yield + schedEndTask + schedFindTask + schedNewTask sem.h + semID_t + sys_sem_t + sem_close + sem_destroy + sem_getvalue + sem_init + sem_open + sem_post + sem_timedwait + sem_trywait + sem_unlink + sem_wait smp.h - apicMagic - cpuid - cpuidDetect - cpuInfo - getEflags - setEflags - smpInit + apicMagic + cpuid + cpuidDetect + cpuInfo + getEflags + setEflags + smpInit spinlock.h - SPIN_LOCK_INITIALIZER - spinLock_t - spinLock - spinLock_scheduler - spinLockInit - spinLockLocked - spinTryLock - spinUnlock - Master + LLOCK_FLAG + LOCKED + SPIN_LOCK_INITIALIZER + UNLOCKED + spinLock_t + Master + atomic_bitsetandtest + spinLock + spinLock_scheduler + spinLockInit + spinLockLocked + spinTryLock + spinUnlock + xchg_16 + xchg_32 + xchg_64 static.h - static_constructors + static_constructors syscall.h - _sysCall - _sysCall_new - invalidCall + _sys_call + invalidCall + invalidCallINT + sys_call + + syscall_posix.h + _sys_call_posix + sys_call_posix syscalls.h - functionPTR - sysAddModule - sysAuth - sysChDir - sysCheckPid - sysExec - sysExit - sysFclose - sysFgetc - sysFopen - sysFork - sysFread - sysFseek - sysFwrite - sysGetCwd - sysGetDrives - sysGetFreePage - sysGetGid - sysGetpid - sysGetTime - sysGetUid - sysGetUptime - sysMkDir - sysMpiCreateMbox - sysMpiDestroyMbox - sysMpiFetchMessage - sysMpiPostMessage - sysMpiSpam - sysPasswd - sysRmDir - sysRmModule - sysSchedYield - sysSDE - sysSetGid - sysSetUid - sysStartSDE - sysUnlink - systemCalls - totalCalls + ARG_COUNT + EJUSTRETURN + ERESTART + PSL_C + SYSCALL_DUMMY + SYSCALL_INVALID + SYSCALL_NOTIMP + SYSCALL_VALID + SYSCALLS_MAX + functionPTR + sys_call_t + systemCalls + systemCalls_posix + totalCalls + totalCalls_posix + sysAddModule + sysAuth + sysChDir + sysCheckPid + sysExec + sysExit + sysFclose + sysFgetc + sysFopen + sysFseek + sysGetCwd + sysGetDrives + sysGetFreePage + sysGetpid + sysGetTime + sysGetUptime + sysMkDir + sysMpiCreateMbox + sysMpiDestroyMbox + sysMpiFetchMessage + sysMpiPostMessage + sysMpiSpam + sysPasswd + sysRmDir + sysRmModule + sysStartSDE + sysUnlink syscalls_new.h - EJUSTRETURN - ERESTART - invalid_call - PSL_C - functionPTR - __sysctl - close - fcntl - fstat - getdtablesize - getgid - getpid - gettimeofday_new - getuid - ioctl - issetugid - mmap - munmap - obreak - pipe - read - readlink - sigaction - sigprocmask - sysExit - systemCalls_new - totalCalls_new + EJUSTRETURN + ERESTART + invalid_call + PSL_C + functionPTR + systemCalls_new + totalCalls_new + __sysctl + close + fcntl + fstat + getdtablesize + getgid + getpid + gettimeofday_new + getuid + ioctl + issetugid + mmap + munmap + obreak + pipe + read + readlink + sigaction + sigprocmask + sysExit systemtask.h - systemTask + systemTask time.h - BCD_TO_BIN - DAY - HOUR - MINUTE - YEAR - suseconds_t - time_t - gettimeofday - time_init - timeMake + BCD_TO_BIN + DAY + HOUR + MINUTE + YEAR + suseconds_t + gettimeofday + time_init + timeMake times.h - clock_t + _CLOCK_T_DECLARED + clock_t tty.h - TTY_MAX_TERMS - tty_term - tty_change - tty_find - tty_init - tty_print - tty_foreground - - types.h - NULL - blkcnt_t - blksize_t - caddr_t - fflags_t - gid_t - ino_t - Int16 - int16_t - Int32 - int32_t - int64_t - Int8 - int8_t - off_t - pid_t - pidType - quad_t - size_t - ssize_t - time_t - u_char - u_int - u_int16_t - uint32_t - u_int64_t - u_int8_t - u_long - u_short - uid_t - uInt - uInt16 - uInt32 - uInt8 - vm_offset_t - bool - FALSE - TRUE + TTY_MAX_TERMS + tty_term + tty_foreground + tty_change + tty_find + tty_init + tty_print ubthread.h - ETIMEDOUT - LOCKED - UNLOCKED - ubthread_cond_t - ubthread_mutex_t - ubthread_t - ubthread_cond_destroy - ubthread_cond_init - ubthread_cond_signal - ubthread_cond_timedwait - ubthread_cond_wait - ubthread_create - ubthread_mutex_destroy - ubthread_mutex_init - ubthread_mutex_lock - ubthread_mutex_unlock - ubthread_self + LOCKED + UNLOCKED + ubthread_cond_t + ubthread_mutex_t + ubthread_t + ubthread_cond_broadcast + ubthread_cond_destroy + ubthread_cond_init + ubthread_cond_signal + ubthread_cond_timedwait + ubthread_cond_wait + ubthread_create + ubthread_mutex_destroy + ubthread_mutex_init + ubthread_mutex_lock + ubthread_mutex_unlock + ubthread_self + + uthread.h vitals.h - vitalsNode - vitals_init - systemVitals + vitalsNode + systemVitals + vitals_lock + vitals_init + + wait.h + cli + nop + restore_flags + save_flags + sti ffs.h - ffs_read + ffs_read ufs.h - blkoff - cgbase - cgdmin - cgimin - cgsblock - cgstart - cgtod - dbtofsb - DEV_BSHIFT - DEV_BSIZE - DT_DIR - DT_REG - fragroundup - FS_UFS1_MAGIC - FS_UFS2_MAGIC - fsbtodb - FSMAXSNAP - ino_to_cg - ino_to_fsba - ino_to_fsbo - lblkno - MAXBSIZE - MAXMNTLEN - MAXNAMLEN - MAXVOLLEN - NDADDR - NIADDR - NINDIR - NOCSPTRS - NXADDR - ROOTINO - sblksize - SBLOCK_FLOPPY - SBLOCK_PIGGY - SBLOCK_UFS1 - SBLOCK_UFS2 - SBLOCKSEARCH - SBLOCKSIZE - daddr_t - ufs1_daddr_t - ufs2_daddr_t - ufs_lbn_t - ufs_time_t - ufs_init - ufs_initialize + blkoff + cgbase + cgdmin + cgimin + cgsblock + cgstart + cgtod + dbtofsb + DEV_BSHIFT + DEV_BSIZE + DT_DIR + DT_REG + fragroundup + FS_UFS1_MAGIC + FS_UFS2_MAGIC + fsbtodb + FSMAXSNAP + ino_to_cg + ino_to_fsba + ino_to_fsbo + lblkno + MAXBSIZE + MAXMNTLEN + MAXNAMLEN + MAXVOLLEN + NDADDR + NIADDR + NINDIR + NOCSPTRS + NXADDR + ROOTINO + sblksize + SBLOCK_FLOPPY + SBLOCK_PIGGY + SBLOCK_UFS1 + SBLOCK_UFS2 + SBLOCKSEARCH + SBLOCKSIZE + ufs1_daddr_t + ufs2_daddr_t + ufs_lbn_t + ufs_time_t + ufs_init + ufs_initialize - file.h - DEV_BSHIFT - DEV_BSIZE - SBLOCKSIZE - SEEK_SET - VBLKSHIFT - VBLKSIZE - fileDescriptor - userFileDescriptor - chDir - fclose - feof - fgetc - fopen - fread - fseek - fwrite - sysChDir - sysFseek - unlink - verifyDir - fdTable + ufs_extern.h + BA_CLRBUF + BA_METAONLY + BA_SEQMASK + BA_SEQMAX + BA_SEQSHIFT + BA_UNMAPPED + ufs_fifoops + ufs_root + ufs_vnodeops + ffs_snapgone + softdep_change_directoryentry_offset + softdep_change_linkcnt + softdep_revert_create + softdep_revert_link + softdep_revert_mkdir + softdep_revert_rmdir + softdep_setup_create + softdep_setup_directory_add + softdep_setup_directory_change + softdep_setup_dotdot_link + softdep_setup_link + softdep_setup_mkdir + softdep_setup_remove + softdep_setup_rmdir + softdep_setup_unlink + softdep_slowdown + SYSCTL_DECL + ufs_bmap + ufs_bmaparray + ufs_checkpath + ufs_dirbad + ufs_dirbadentry + ufs_dirempty + ufs_direnter + ufs_dirremove + ufs_dirrewrite + ufs_extread + ufs_extwrite + ufs_fhtovp + ufs_getlbns + ufs_inactive + ufs_init + ufs_itimes + ufs_lookup + ufs_lookup_ino + ufs_makedirentry + ufs_prepare_reclaim + ufs_readdir + ufs_reclaim + ufs_uninit + ufs_vinit + + ufsmount.h + blkptrtodb + is_sequential + MNINDIR + QTF_64BIT + QTF_CLOSING + QTF_OPENING + UFS1 + UFS2 + UFS_BALLOC + UFS_BLKATOFF + UFS_IFREE + UFS_LOCK + UFS_MTX + UFS_RDONLY + UFS_SNAPGONE + UFS_TRUNCATE + UFS_UNLOCK + UFS_UPDATE + UFS_VALLOC + UFS_VFREE + UFSTOVFS + VFSTOUFS + + inode.h mount.h - vfs_addMount - vfs_findMount - vfs_mount + MFSNAMELEN + MNAMELEN + fsid_t + vfs_addMount + vfs_findMount + vfs_mount - vfs.h - fdAvail - fdEof - fdOpen - fdRead - fileAppend - fileBinary - fileRead - fileWrite - maxFd - vfs_findFS - vfs_init - vfsRegisterFS + stat.h + STAT_FOLLOW + STAT_LSTAT + STAT_NO_FOLLOW paging.h - btoc - ctob - KERNEL_PAGE_DEFAULT - PAGE_COW - PAGE_DEFAULT - PAGE_MASK - PAGE_PRESENT - PAGE_SHIFT - PAGE_SIZE - PAGE_STACK - PAGE_USER - PAGE_WIRED - PAGE_WRITE - pageEntries - pageLength - pageSize - parentPageDirAddr - round_page - tablesBaseAddress - trunc_page - VM_TASK - VM_THRD - _vmm_pageFault - mmap - munmap - obreak - vmm_getFreeMallocPage - vmm_getPhysicalAddr - vmm_pageFault - vmm_pagingInit - vmm_remapPage - vmm_setPageAttributes - vmmClearVirtualPage - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - vmmMapFromTask - vmmUnmapPage - vmmUnmapPages - kernelPageDirectory + btoc + ctob + KERNEL_PAGE_DEFAULT + PAGE_ + PAGE_ACCESSED + PAGE_CACHE_DISABLED + PAGE_COW + PAGE_DEFAULT + PAGE_DIRTY + PAGE_GLOBAL + PAGE_MASK + PAGE_PRESENT + PAGE_SHIFT + PAGE_SIZE + PAGE_STACK + PAGE_USER + PAGE_WIRED + PAGE_WRITE + PAGE_WRITE_THROUGH + PD_BASE_ADDR + PD_BASE_ADDR2 + PD_ENTRIES + PD_INDEX + PD_OFFSET + PT_BASE_ADDR + PT_ENTRIES + PT_INDEX + round_page + trunc_page + VM_TASK + VM_THRD + kernelPageDirectory + _vmm_pageFault + mmap + munmap + obreak + vmm_cleanVirtualSpace + vmm_copyVirtualSpace + vmm_createVirtualSpace + vmm_getFreeKernelPage + vmm_getFreeMallocPage + vmm_getFreePage + vmm_getFreeVirtualPage + vmm_getPhysicalAddr + vmm_getRealAddr + vmm_mapFromTask + vmm_pageFault + vmm_pagingInit + vmm_remapPage + vmm_setPageAttributes + vmmClearVirtualPage vmm.h - memAvail - memNotavail - vmmID - vmmMemoryMapAddr - adjustCowCounter - countMemory - freePage - vmm_init - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit - numPages - vmmMemoryMap + memAvail + memNotavail + STACK_ADDR + VMM_KERN_CODE_END + VMM_KERN_CODE_START + VMM_KERN_END + VMM_KERN_STACK_END + VMM_KERN_STACK_START + VMM_KERN_START + VMM_MMAP_ADDR_PMODE + VMM_MMAP_ADDR_RMODE + VMM_PAGE_DIR + VMM_PAGE_DIRS + VMM_USER_END + VMM_USER_LDT + VMM_USER_START + vmmID + unmapFlags_t + VMM_FREE + VMM_KEEP + numPages + pdSpinLock + vmmMemoryMap + adjustCowCounter + countMemory + freePage + vmm_allocPageTable + vmm_findFreePage + vmm_freeProcessPages + vmm_init + vmm_memMapInit + vmm_unmapPage + vmm_unmapPages main.c - B_ADAPTOR - B_ADAPTORMASK - B_ADAPTORSHIFT - B_CONTROLLER - B_CONTROLLERMASK - B_CONTROLLERSHIFT - B_PARTITION - B_PARTITIONMASK - B_PARTITIONSHIFT - B_SLICE - B_SLICEMASK - B_SLICESHIFT - B_TYPE - B_TYPEMASK - B_TYPESHIFT - B_UNIT - B_UNITMASK - B_UNITSHIFT - kmain - ubixDescriptorTable - loadGDT - - start.S - lgdtl - movl - movl - $kStack - _start - eax - eax - eax - eax - eax - eax - eax - eax - edi - esp - esp - start_next - x08 - x18 - x20 - x2000 + B_ADAPTOR + B_ADAPTORMASK + B_ADAPTORSHIFT + B_CONTROLLER + B_CONTROLLERMASK + B_CONTROLLERSHIFT + B_PARTITION + B_PARTITIONMASK + B_PARTITIONSHIFT + B_SLICE + B_SLICEMASK + B_SLICESHIFT + B_TYPE + B_TYPEMASK + B_TYPESHIFT + B_UNIT + B_UNITMASK + B_UNITSHIFT + _bootdev + _boothowto + _bootinfo + _kernelname + argv_init + envp_init + loadGDT + kmain + ubixDescriptorTable static.c - static_constructors + static_constructors 8259.c - i8259_init - irqDisable - irqEnable - irqMask + irqMask + i8259_init + irqDisable + irqDisable_old + irqEnable + irqEnable_old atkbd.c - asm - atkbd_init - atkbd_scan - getch - keyboardHandler - setLED - atkbdSpinLock - controlKeys - keyboardMap - keyMap - ledStatus - stdinBuffer - stdinSize + atkbdSpinLock + controlKeys + keyboardMap + keyMap + ledStatus + stdinBuffer + stdinSize + asm + atkbd_init + atkbd_scan + getchar + keyboardHandler + setLED fdc.c - asm - block2Hts - fdc_init - fdcInit2 - fdcRead - fdcRw - fdcWrite - floppyIsrhndlr - getByte - motorOff - motorOn - readBlock - recalibrate - reset - seek - sendByte - waitFdc - writeBlock - diskChange - done - fdcSpinLock - fdcTrack - geometry - motor - sr0 - statSize - status - tbaddr - timeOut + diskChange + done + fdcSpinLock + fdcTrack + geometry + motor + sr0 + statSize + status + tbaddr + timeOut + asm + block2Hts + fdc_init + fdcInit2 + fdcRead + fdcRw + fdcWrite + floppyIsrhndlr + getByte + motorOff + motorOn + readBlock + recalibrate + reset + seek + sendByte + waitFdc + writeBlock mouse.c - asm - kbdRead - kbdWrite - kbdWriteRead - mouseHandler - mouseInit + asm + kbdRead + kbdWrite + kbdWriteRead + mouseHandler + mouseInit ne2k.c - asm - dp_pkt2user - dp_recv - getblock - ne2k_init - ne2kAllocBuffer - ne2kFreeBuffer - ne2kGetBuffer - ne2kHandler - NICtoPC - PCtoNIC - mDev - ne2k_spinLock - ne2kBuffer + mDev + ne2k_spinLock + ne2kBuffer + asm + dp_pkt2user + dp_recv + getblock + ne2k_init + ne2kAllocBuffer + ne2kFreeBuffer + ne2kGetBuffer + ne2kHandler + NICtoPC + PCtoNIC pit.c - pit_init + pit_init rs232.c - rs232Init + rs232Init - ap-boot.S - xchgl - al - al - al - al - al - ap_spl - ap_trampoline_32 - ap_trampoline_epoint - ap_trampoline_start - ap_trampoline_start - ap_trampoline_start - ap_trampoline_start - ap_trampoline_start - ax - ax - ax - ax - ax - ax - ax - ax - cmp - cr0 - eax - ebx - ebx - mov - x08 - x1 - x10 - x1000 - x30 - x31 - x31 - x33 - xe9 - xe9 - xe9 - xe9 - xe9 + access.c + in_group_p + sys_getEUID + sys_getGID + sys_getUID + sys_setGID + sys_setUID - bioscall.c - asm - biosCall + descrip.c + kern_files + close + dup2 + falloc + fcntl + fdestroy + fstat + getdtablesize + getfd + ioctl + sys_dup2 + sys_fcntl + sys_ioctl + sys_select - elf.c - elf_loadfile - elfGetPhType - elfGetRelType - elfGetShType - elfPhType - elfRelType - elfShType - elfType - elfTypeName - id - id - id - id - phTypeName - relTypeName - shTypeName + elf.c + elfPhType + elfRelType + elfShType + elfType + elfTypeName + id + phTypeName + relTypeName + shTypeName + elf_load_file + elfGetPhType + elfGetRelType + elfGetShType + + elf.c endtask.c - endTask + endTask - exec.c - STACK_ADDR - execFile - execThread - sys_exec - sysExec - - fork.c - asm - fork_copyProcess + execve.c + sys_execve gen_calls.c - getgid - getpid - gettimeofday_new - getuid - issetugid - read - readlink - setitimer - sys_write + access + getgid + getpid + gettimeofday_new + getuid + mprotect + read + readlink + setitimer + sys_exit + sys_getegid + sys_geteuid + sys_getlogin + sys_getpgrp + sys_getpid + sys_getppid + sys_getrlimit + sys_gettimeofday + sys_invalid + sys_issetugid + sys_setlogin + sys_setpgid + sys_setrlimit + sys_sigaction + sys_sigprocmask + sys_sysarch + sys_wait4 - kern_descrip.c - close - falloc - fcntl - fstat - getdtablesize - getfd - ioctl + kern_execve.c + kern_execve + + kern_pipe.c + sys_pipe2 kern_sig.c - sigaction - sigprocmask + sigaction + sigprocmask kern_sysctl.c - __sysctl - def_ctls - sysctl_add - sysctl_find - sysctl_init - ctls - - kpanic.c - kpanic + ctls + sysctl_headTrie + __sysctl + def_ctls + sys_sysctl + sysctl_add + sysctl_find + sysctl_findMib + sysctl_init ld.c - ldEnable + ldEnable pipe.c - pipe - - sched.c - sched - sched_addDelTask - sched_deleteTask - sched_getDelTask - sched_init - sched_setStatus - sched_yield - schedEndTask - schedFindTask - schedNewTask - _current - _usedMath - delList - nextID - schedulerSpinLock - taskList - - schedyield.S - sched_yield_new + pipe sem.c + sem_close + sem_destroy + sem_getvalue + sem_init + sem_open + sem_post + sem_timedwait + sem_trywait + sem_unlink + sem_wait + + signal.c + sys_sigaction + sys_sigprocmask smp.c - ap_trampoline_end - ap_trampoline_start - apicMagic - apicRead - apicWrite - asm - c_ap_boot - cpu0_thread - cpu1_thread - cpu2_thread - cpu3_thread - cpuidDetect - cpuInfo - GDT_fixer - getDr3 - getEflags - kernel_function - setDr3 - setEflags - smpInit - bkl - cpuinfo - cpuInfoLock - cpus - initSpinLock - vram + bkl + cpuinfo + cpuInfoLock + cpus + initSpinLock + vram + ap_trampoline_end + ap_trampoline_start + apicMagic + apicRead + apicWrite + asm + c_ap_boot + cpu0_thread + cpu1_thread + cpu2_thread + cpu3_thread + cpuidDetect + cpuInfo + GDT_fixer + getDr3 + getEflags + kernel_function + setDr3 + setEflags + smpInit - spinlock.c - spinLock - spinLock_scheduler - spinLockInit - spinLockLocked - spinTryLock - spinUnlock + syscall_posix.c + Master + invalidCall_posix + sys_call_posix - sys_call.S - _sysCall + syscalls.c + systemCalls + totalCalls - sys_call_new.S - FAKE_MCOUNT - _sysCall_new - addl - eax - eax - eax - invalidSysCall - x10 - - syscall.c - UbixUser - asm - fuword - invalidCall - InvalidSystemCall - sdeTestThread - sysAddModule - sysAuth - sysCheckPid - sysExit - sysGetCwd - sysGetDrives - sysGetFreePage - sysGetGid - sysGetpid - sysGetTime - sysGetUid - sysGetUptime - sysPasswd - sysRmModule - sysSchedYield - sysSetGid - sysSetUid - sysStartSDE - - syscall_new.c - syscall - Master - - systemtask.c - systemTask - videoBuffer + syscalls_posix.c + systemCalls_posix + totalCalls_posix time.c - gettimeofday - time_init - timeCmosRead - timeMake - month - - timer.S - incl - al - edx - edx - movl - systemVitals - timerInt - x20 + month + gettimeofday + time_init + timeCmosRead + timeMake tty.c - tty_change - tty_find - tty_init - tty_print - terms - tty_foreground - tty_spinLock + terms + tty_foreground + tty_spinLock + tty_change + tty_find + tty_init + tty_print ubthread.c - ubthread_cond_destroy - ubthread_cond_init - ubthread_cond_signal - ubthread_cond_timedwait - ubthread_cond_wait - ubthread_create - ubthread_mutex_destroy - ubthread_mutex_init - ubthread_mutex_lock - ubthread_mutex_unlock - ubthread_self - conds - mutex + conds + mutex + ubthread_cond_broadcast + ubthread_cond_destroy + ubthread_cond_init + ubthread_cond_signal + ubthread_cond_timedwait + ubthread_cond_wait + ubthread_create + ubthread_mutex_destroy + ubthread_mutex_init + ubthread_mutex_lock + ubthread_mutex_unlock + ubthread_self + + vfs_calls.c + kern_openat + sys_access + sys_close + sys_getdirentries + sys_open + sys_openat + sys_pread + sys_read + sys_readlink + sys_write vitals.c - vitals_init - systemVitals + systemVitals + vitals_lock + vitals_init kmod.c - kmod_add - kmod_load - List + List + kmod_add + kmod_load assert.c - __assert + __assert atan.c - atan - - bcopy.c - TLOOP - TLOOP1 - wmask - wsize - uintptr_t - word - bcopy + atan divdi3.c - __divdi3 - __udivdi3 + __divdi3 + __udivdi3 + + kern_trie.c + delete_trieNode + haveChildren + insert_trieNode + new_trieNode + search_trieNode kmalloc.c - getEmptyDesc - insertFreeDesc - kfree - kmalloc - mergeMemBlocks - emptyDescSpinLock - emptyKernDesc - freeKernDesc - mallocSpinLock - usedKernDesc + emptyDescSpinLock + emptyKernDesc + freeKernDesc + mallocSpinLock + usedKernDesc + getEmptyDesc + insertFreeDesc + kfree + kmalloc kprintf.c - kprintf - sprintf - ogprintOff - printOff + PCHAR + ogprintOff + printOff + __qdivrem + __shl + __umoddi3 + imax + kprintf + ksprintn + kvprintf + sprintf libcpp.cc - __cxa_atexit - __cxa_pure_virtual - __dso_handle - __pure_virtual - operator delete - operator delete[] - operator new - operator new[] - - memcpy.c - MEMCOPY - - memset.c - VAL - WIDEVAL - wmask - wsize - memset + __cxa_atexit + __cxa_pure_virtual + __dso_handle + __pure_virtual + operator delete + operator delete[] + operator new + operator new[] net.c - in_addr_t - bcopy - bzero - htonl - htons - inet_aton + _IN_ADDR_T_DECLARED + in_addr_t ogprintf.cc - ogPrintf - screenCol - screenRow + screenCol + screenRow + ogPrintf sqrt.c - sqrt - - strcpy.S - movb - movl - addl - addl - al - al - al - al - al - al - al - al - al - al - al - al - al - al - al - al - align - L1 - strcpy + sqrt string.c - memcmp - memcpyold - strcmp - strncmp - strncpy - strstr + bcd2bin_data + bin2bcd_data + hex2ascii_data - strlen.S - leal - eax - movl - strlen + strlen.c + LONGPTR_MASK + testbyte + strlen + + strncpy.c + strncpy + + strstr.c + strstr strtok.c - strtok - strtok_r + strtok + strtok_r strtol.c - LONG_MAX - LONG_MIN - strtol + LONG_MAX + LONG_MIN + strtol vsprintf.c - do_div - is_digit - LEFT - PLUS - SIGN - SMALL - SPACE - SPECIAL - ZEROPAD - number - skip_atoi - vsprintf + do_div + is_digit + LEFT + PLUS + SIGN + SMALL + SPACE + SPECIAL + ZEROPAD + number + skip_atoi + vsprintf message.c - sysMpiCreateMbox - sysMpiDestroyMbox - sysMpiFetchMessage - sysMpiPostMessage - sysMpiSpam + sysMpiCreateMbox + sysMpiDestroyMbox + sysMpiFetchMessage + sysMpiPostMessage + sysMpiSpam + + mpi_syscalls.c + sys_mpiCreateMbox + sys_mpiDestroyMbox + sys_mpiFetchMessage + sys_mpiPostMessage system.c - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_findMbox - mpi_postMessage - mpi_spam - mboxList - mpiSpinLock + mboxList + mpiSpinLock + mpi_createMbox + mpi_destroyMbox + mpi_fetchMessage + mpi_findMbox + mpi_postMessage + mpi_spam + + api_lib.c + + api_msg.c + + err.c + err_to_errno_table + errno + err_to_errno + + netbuf.c + + netdb.c + + netifapi.c + + sockets.c + + tcpip.c + TCPIP_MBOX_FETCH + TCPIP_MSG_VAR_ALLOC + TCPIP_MSG_VAR_DECLARE + TCPIP_MSG_VAR_FREE + TCPIP_MSG_VAR_REF + mbox + tcpip_init_done + tcpip_init_done_arg + mem_free_callback + pbuf_free_callback + pbuf_free_int + tcpip_api_call + tcpip_callback_with_block + tcpip_callbackmsg_delete + tcpip_callbackmsg_new + tcpip_init + tcpip_inpkt + tcpip_input + tcpip_send_msg_wait_sem + tcpip_thread + tcpip_trycallback + + def.c + lwip_htonl + lwip_htons + lwip_itoa + lwip_stricmp + lwip_strnicmp + lwip_strnstr + + dns.c + + inet_chksum.c + LWIP_CHKSUM + LWIP_CHKSUM_ALGORITHM + inet_chksum + inet_chksum_pbuf + inet_cksum_pseudo_base + inet_cksum_pseudo_partial_base + ip_chksum_pseudo + ip_chksum_pseudo_partial + lwip_standard_chksum + + init.c + LWIP_DISABLE_MEMP_SANITY_CHECKS + LWIP_DISABLE_TCP_SANITY_CHECKS + PACKED_STRUCT_TEST_EXPECTED_SIZE + PACK_STRUCT_STRUCT + lwip_init + + init.c + lnc_netif + lnc_thread + net_init + shell_thread + + ip.c + + autoip.c + + dhcp.c + + etharp.c + + icmp.c + + igmp.c + + ip4.c + + ip4_addr.c + + ip4_frag.c + + dhcp6.c + + ethip6.c + + icmp6.c + + inet6.c + + ip6.c + + ip6_addr.c + + ip6_frag.c + + mld6.c + + nd6.c + + mem.c + LWIP_MEM_ALLOC_DECL_PROTECT + LWIP_MEM_ALLOC_PROTECT + LWIP_MEM_ALLOC_UNPROTECT + LWIP_MEM_FREE_DECL_PROTECT + LWIP_MEM_FREE_PROTECT + LWIP_MEM_FREE_UNPROTECT + LWIP_RAM_HEAP_POINTER + MEM_SIZE_ALIGNED + MIN_SIZE + MIN_SIZE_ALIGNED + SIZEOF_STRUCT_MEM + lfree + mem_mutex + ram + ram_end + LWIP_DECLARE_MEMORY_ALIGNED + mem_calloc + mem_free + mem_init + mem_malloc + mem_trim + plug_holes + + memp.c + LWIP_MEMPOOL + LWIP_MEMPOOL + memp_pools + do_memp_free_pool + do_memp_malloc_pool + memp_free + memp_free_pool + memp_init + memp_init_pool + memp_malloc + memp_malloc_pool + + netif.c + NETIF_LINK_CALLBACK + NETIF_REPORT_TYPE_IPV4 + NETIF_REPORT_TYPE_IPV6 + NETIF_STATUS_CALLBACK + netif_default + netif_list + netif_num + netif_add + netif_find + netif_init + netif_input + netif_issue_reports + netif_remove + netif_set_default + netif_set_down + netif_set_link_down + netif_set_link_up + netif_set_up + + pbuf.c + PBUF_POOL_BUFSIZE_ALIGNED + PBUF_POOL_IS_EMPTY + SIZEOF_STRUCT_PBUF + pbuf_alloc + pbuf_cat + pbuf_chain + pbuf_clen + pbuf_coalesce + pbuf_copy + pbuf_copy_partial + pbuf_dechain + pbuf_free + pbuf_get_at + pbuf_header + pbuf_header_force + pbuf_header_impl + pbuf_memcmp + pbuf_memfind + pbuf_put_at + pbuf_realloc + pbuf_ref + pbuf_skip + pbuf_skip_const + pbuf_strstr + pbuf_take + pbuf_take_at + pbuf_try_get_at + + raw.c + + stats.c + + sys.c + sys_msleep + + tcp.c + + tcp_in.c + + tcp_out.c + + timeouts.c + HANDLER + lwip_cyclic_timers + tcp_timer_needed + + udp.c + + bot.c + bot_init + bot_thread + + shell.c + ECLOSED + ESUCCESS + ESYNTAX + ETOOFEW + ETOOMANY + NCONNS + buffer + prompt + sendstr + shell_main + shell_thread + + shell.h + shell_init + + sys_arch.c + ERR_NOT_READY + ERR_TIMED_OUT + INFINITE_TIME + netThreadSpinlock + starttime + threads + cond_wait + current_thread + sys_arch_mbox_fetch + sys_arch_mbox_tryfetch + sys_arch_sem_wait + sys_arch_timeouts + sys_init + sys_mbox_free + sys_mbox_new + sys_mbox_post + sys_mbox_set_invalid + sys_mbox_trypost + sys_mbox_valid + sys_mutex_free + sys_mutex_lock + sys_mutex_new + sys_mutex_unlock + sys_now + sys_sem_free + sys_sem_free_internal + sys_sem_new + sys_sem_set_invalid + sys_sem_signal + sys_sem_valid + sys_sendto + sys_setsockopt + sys_socket + sys_thread_new + sys_unix_now + + udpecho.c + udpecho_init + udpecho_thread + + udpecho.h + udpecho_init + + arp.c + ARP_MAXAGE + ARP_REPLY + ARP_REQUEST + ARPH_HWLEN + ARPH_HWLEN_SET + ARPH_PROTOLEN + ARPH_PROTOLEN_SET + HWTYPE_ETHERNET + arp_table + ctime + PACK_STRUCT_STRUCT + add_arp_entry + arp_arp_input + arp_init + arp_ip_input + arp_lookup + arp_query + arp_tmr + + ethernet.c + + ethernetif.c + IFNAME0 + IFNAME1 + tmpBuf + ethernetif_init + ethernetif_input + low_level_init + low_level_input + low_level_output + + loopif.c + loopif_init + loopif_output + + tcpdump.c + file + tcpdump + tcpdump_init hd.c - hdInit - hdIoctl - hdRead - hdReset - hdStandby - hdStart - hdStop - hdWrite - initHardDisk + freebsd_ufs_uuid + hdC + _initHardDisk + hdInit + hdIoctl + hdRead + hdReset + hdStandby + hdStart + hdStop + hdWrite + initHardDisk lnc.c - asm - initLNC - lanceProbe - lncAttach - lncInt - probe - readBcr - readCsr - writeBcr - writeCsr - icIdent - lnc - nicIdent + icIdent + lnc + lnc_netif + nicIdent + tmpBuf + asm + initLNC + lanceProbe + lnc_driverOwnsRX + lnc_driverOwnsTX + lnc_getMode + lnc_INT + lnc_nextRxPtr + lnc_nextTxPtr + lnc_probe + lnc_readBCR + lnc_readBCR32 + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + lnc_rxINT + lnc_sendPacket + lnc_switchDWord + lnc_thread + lnc_txINT + lnc_writeBCR + lnc_writeBCR32 + lnc_writeCSR + lnc_writeCSR32 + lncAttach + lncInt pci.c - pci_init - pciProbe - pciRead - pciWrite - baseClass - interface - name - pciClasses - subClass + baseClass + interface + name + pciClasses + subClass + pci_init + pciProbe + pciRead + pciWrite + + colours.cc + sdeTestThread + sdeTestThreadOld + + main.cc + sdeTestThread + sdeThread + + ogDisplay_UbixOS.cc + initVESAMode + + sde.cc + windows + sysSDE device.c - device_add - device_find - device_remove - devices - deviceSpinLock + devices + deviceSpinLock + device_add + device_find + device_remove dma.c - highByte - lowByte - _dmaXfer - dmaXfer - addrPort - clearReg - countPort - maskReg - modeReg - pagePort + highByte + lowByte + addrPort + clearReg + countPort + maskReg + modeReg + pagePort + _dmaXfer + dmaXfer idt.c - FP_TO_LINEAR - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int7 - _int8 - _int9 - asm - idt_init - intNull - mathStateRestore - setTaskVector - setVector - ubixDescriptorTable - loadidt + FP_TO_LINEAR + gpfStack + loadidt + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __gpf + __int6 + __machineCheck + __nmi + __security + __simd + __virtualization + _alignmentCheck + _debug + _divideError + _doubleFault + _floatingPoint + _gpf + _int10 + _int11 + _int12 + _int3 + _int4 + _int5 + _int6 + _int7 + _int9 + _intNull + _machineCheck + _nmi + _security + _simd + _virtualization + asm + asm + asm + asm + asm + asm + asm + asm + asm + asm + asm + asm + asm + asm + idt_init + intNull + mathStateRestore + setTaskVector + setVector + ubixDescriptorTable io.c - inportByte - inportDWord - inportWord - outportByte - outportByteP - outportDWord - outportWord + inportByte + inportDWord + inportWord + outportByte + outportByteP + outportDWord + outportWord video.c - backSpace - clearScreen - kprint - printColor - videoBuffer - - block.c - freeBlocks - getFreeBlocks - syncBat - - dirCache.c - ubixfs_cacheAdd - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_findName - dca_spinLock - - directory.c - addDirEntry - ubixFSLoadDir - ubixFSmkDir - dirList - - thread.c - ubixfs_thread - mounts - ubixFS_Info - - ubixfs.c - openFileUbixFS - readUbixFS - ubixfs_init - ubixfs_initialize - ubixfs_loadData - ubixFSUnlink - writeFileByte - writeUbixFS - - ffs.c - ffs_read - - ufs.c - DBPERVBLK - DIP - INDIRPERVBLK - INO_TO_VBA - INO_TO_VBO - INOPB - IPERVBLK - VBLKMASK - VBLKSHIFT - VBLKSIZE - dskread - fsfind - fsread - lookup - ufs_init - ufs_initialize - ufs_openFile - ufs_readFile - ufs_writeFile - sblock_try - - file.c - fclose - feof - fgetc - fopen - fputc - fread - fseek - fwrite - sysChDir - sysFclose - sysFgetc - sysFopen - sysFread - sysFseek - sysFwrite - sysMkDir - sysRmDir - sysUnlink - unlink - fdTable - fdTable_lock - - mount.c - vfs_addMount - vfs_findMount - vfs_mount - - vfs.c - sys_open - vfs_init - vfsFindFS - vfsRegisterFS + printColor + videoBuffer + backSpace + clearScreen + kprint copyvirtualspace.c - vmmCopyVirtualSpace - cvsSpinLock + cvsSpinLock + vmm_copyVirtualSpace createvirtualspace.c - vmmCreateVirtualSpace + vmm_createVirtualSpace + + freevirtualpage.c + vmm_freeVirtualPage getfreepage.c - vmmGetFreePage - vmmGFPlock + vmmGFPlock + vmm_getFreePage getfreevirtualpage.c - vmmGetFreeVirtualPage - fvpSpinLock + fvpSpinLock + vmm_getFreeVirtualPage getphysicaladdr.c - vmm_getPhysicalAddr + vmm_getPhysicalAddr + vmm_getRealAddr page_fault.S - movl - _vmm_pageFault - cr2 - xC pagefault.c - vmm_pageFault - pageFaultSpinLock + pageFaultSpinLock + vmm_pageFault paging.c - mmap - munmap - obreak - vmm_cleanVirtualSpace - vmm_getFreeMallocPage - vmm_pagingInit - vmm_remapPage - vmmClearVirtualPage - vmmGetFreeKernelPage - vmmMapFromTask - fkpSpinLock - kernelPageDirectory - rmpSpinLock + fkpSpinLock + kernelPageDirectory + rmpSpinLock + obreak + vmm_cleanVirtualSpace + vmm_clearVirtualPage + vmm_getFreeKernelPage + vmm_getFreeMallocPage + vmm_mapFromTask + vmm_pagingInit + vmm_remapPage setpageattributes.c - vmm_setPageAttributes + vmm_setPageAttributes unmappage.c - vmmUnmapPage - vmmUnmapPages + vmm_unmapPage + vmm_unmapPages + + vmm_allocpagetable.c + vmm_allocPageTable vmm_init.c - vmm_init + pdSpinLock + vmm_init vmm_memory.c - adjustCowCounter - countMemory - freePage - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit - freePages - numPages - vmmCowSpinLock - vmmMemoryMap - vmmSpinLock + freePages + numPages + vmmMemoryMap + vmmSpinLock + adjustCowCounter + countMemory + freePage + vmm_findFreePage + vmm_freeProcessPages + vmm_memMapInit - src/sys/include/devfs/ + vmm_mmap.c + EINVAL + MAP_ALIGNED + MAP_ALIGNED_SUPER + MAP_ALIGNMENT_MASK + MAP_ALIGNMENT_SHIFT + MAP_ANON + MAP_FILE + MAP_FIXED + MAP_HASSEMAPHORE + MAP_NORESERVE + MAP_NOSYNC + MAP_PRIVATE + MAP_RENAME + MAP_RESERVED0080 + MAP_RESERVED0100 + MAP_SHARED + MAP_STACK + NBBY + PROT_EXEC + PROT_NONE + PROT_READ + PROT_WRITE + __vm_size_t + vm_size_t + freebsd6_mmap + sys_mmap + sys_munmap - src/sys/devfs/ + httpd_opts + HTTP_IS_TAG_VOLATILE + HTTPD_DEBUG + HTTPD_DEBUG_TIMING + HTTPD_LIMIT_SENDING_TO_2MSS + HTTPD_MAX_RETRIES + HTTPD_MAX_WRITE_LEN + HTTPD_POLL_INTERVAL + HTTPD_PRECALCULATED_CHECKSUM + HTTPD_SERVER_AGENT + HTTPD_SERVER_PORT + HTTPD_TCP_PRIO + HTTPD_USE_CUSTOM_FSDATA + HTTPD_USE_MEM_POOL + LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR + LWIP_HTTPD_CGI + LWIP_HTTPD_CGI_SSI + LWIP_HTTPD_CUSTOM_FILES + LWIP_HTTPD_DYNAMIC_FILE_READ + LWIP_HTTPD_DYNAMIC_HEADERS + LWIP_HTTPD_FILE_STATE + LWIP_HTTPD_FS_ASYNC_READ + LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED + LWIP_HTTPD_MAX_CGI_PARAMETERS + LWIP_HTTPD_MAX_REQ_LENGTH + LWIP_HTTPD_MAX_REQUEST_URI_LEN + LWIP_HTTPD_MAX_TAG_INSERT_LEN + LWIP_HTTPD_MAX_TAG_NAME_LEN + LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI + LWIP_HTTPD_POST_MANUAL_WND + LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN + LWIP_HTTPD_REQ_BUFSIZE + LWIP_HTTPD_REQ_QUEUELEN + LWIP_HTTPD_SSI + LWIP_HTTPD_SSI_INCLUDE_TAG + LWIP_HTTPD_SSI_MULTIPART + LWIP_HTTPD_SSI_RAW + LWIP_HTTPD_SUPPORT_11_KEEPALIVE + LWIP_HTTPD_SUPPORT_EXTSTATUS + LWIP_HTTPD_SUPPORT_POST + LWIP_HTTPD_SUPPORT_REQUESTLIST + LWIP_HTTPD_SUPPORT_V09 + LWIP_HTTPD_TIMING - src/sys/include/ + mdns_opts + LWIP_MDNS_RESPONDER + MDNS_DEBUG + MDNS_MAX_SERVICES - src/sys/init/ + mqtt_opts + MQTT_CONNECT_TIMOUT + MQTT_CYCLIC_TIMER_INTERVAL + MQTT_OUTPUT_RINGBUF_SIZE + MQTT_REQ_MAX_IN_FLIGHT + MQTT_REQ_TIMEOUT + MQTT_VAR_HEADER_BUFFER_LEN - src/sys/isa/ + netbiosns_opts - src/sys/include/isa/ + snmp_opts + LWIP_SNMP + SNMP_COMMUNITY + SNMP_COMMUNITY_TRAP + SNMP_COMMUNITY_WRITE + SNMP_DEBUG + SNMP_DEVICE_ENTERPRISE_OID + SNMP_DEVICE_ENTERPRISE_OID_LEN + SNMP_LWIP_ENTERPRISE_OID + SNMP_LWIP_GETBULK_MAX_REPETITIONS + SNMP_LWIP_MIB2 + SNMP_LWIP_MIB2_SYSCONTACT + SNMP_LWIP_MIB2_SYSDESC + SNMP_LWIP_MIB2_SYSLOCATION + SNMP_LWIP_MIB2_SYSNAME + SNMP_MAX_COMMUNITY_STR_LEN + SNMP_MAX_OBJ_ID_LEN + SNMP_MAX_OCTET_STRING_LEN + SNMP_MAX_VALUE_SIZE + SNMP_MIB_DEBUG + SNMP_MIN_VALUE_SIZE + SNMP_SAFE_REQUESTS + SNMP_TRAP_DESTINATIONS + SNMP_USE_NETCONN + SNMP_USE_RAW - src/sys/kernel/ + sntp_opts + SNTP_CHECK_RESPONSE + SNTP_DEBUG + SNTP_GET_SERVERS_FROM_DHCP + SNTP_GET_SYSTEM_TIME + SNTP_MAX_SERVERS + SNTP_PORT + SNTP_RECV_TIMEOUT + SNTP_RETRY_TIMEOUT + SNTP_RETRY_TIMEOUT_EXP + SNTP_RETRY_TIMEOUT_MAX + SNTP_SERVER_DNS + SNTP_SET_SYSTEM_TIME + SNTP_STARTUP_DELAY + SNTP_STARTUP_DELAY_FUNC + SNTP_UPDATE_DELAY - src/sys/kmods/ + tftp_opts + TFTP_DEBUG + TFTP_MAX_FILENAME_LEN + TFTP_MAX_MODE_LEN + TFTP_MAX_RETRIES + TFTP_PORT + TFTP_TIMEOUT_MSECS + TFTP_TIMER_MSECS - src/sys/lib/ + compiler_abstraction + mem_ptr_t + s16_t + s32_t + s8_t + u16_t + u32_t + u8_t + BYTE_ORDER + LWIP_ALIGNMENT_CAST + LWIP_CONST_CAST + LWIP_DECLARE_MEMORY_ALIGNED + LWIP_MEM_ALIGN + LWIP_MEM_ALIGN_BUFFER + LWIP_MEM_ALIGN_SIZE + LWIP_NO_INTTYPES_H + LWIP_NO_LIMITS_H + LWIP_NO_STDDEF_H + LWIP_NO_STDINT_H + LWIP_PLATFORM_ASSERT + LWIP_PLATFORM_DIAG + LWIP_PTR_NUMERIC_CAST + LWIP_UNUSED_ARG + PACK_STRUCT_BEGIN + PACK_STRUCT_END + PACK_STRUCT_FIELD + PACK_STRUCT_FLD_8 + PACK_STRUCT_FLD_S + PACK_STRUCT_STRUCT + S16_F + S32_F + SZT_F + U16_F + U32_F + X16_F + X32_F + X8_F - src/sys/include/lib/ + debugging_levels + LWIP_DBG_LEVEL_ALL + LWIP_DBG_LEVEL_WARNING + LWIP_DBG_LEVEL_SERIOUS + LWIP_DBG_LEVEL_SEVERE + LWIP_DBG_ON + LWIP_DBG_OFF + LWIP_DBG_TRACE + LWIP_DBG_STATE + LWIP_DBG_FRESH + LWIP_DBG_HALT + LWIP_DBG_LEVEL_OFF + LWIP_DBG_MASK_LEVEL - src/sys/mpi/ + lwip_assertions - src/sys/include/mpi/ + infrastructure_errors + err_enum_t + ERR_OK + ERR_MEM + ERR_BUF + ERR_TIMEOUT + ERR_RTE + ERR_INPROGRESS + ERR_VAL + ERR_WOULDBLOCK + ERR_USE + ERR_ALREADY + ERR_ISCONN + ERR_CONN + ERR_IF + ERR_ABRT + ERR_RST + ERR_CLSD + ERR_ARG + err_t + ERR_IS_FATAL - src/sys/include/netif/ + lwip_version + LWIP_RC_DEVELOPMENT + LWIP_RC_RELEASE + LWIP_VERSION + LWIP_VERSION_IS_DEVELOPMENT + LWIP_VERSION_IS_RC + LWIP_VERSION_IS_RELEASE + LWIP_VERSION_MAJOR + LWIP_VERSION_MINOR + LWIP_VERSION_RC + LWIP_VERSION_REVISION + LWIP_VERSION_STRING + LWIP_VERSION_STRING_SUFFIX + LWIP_VERSTR + LWIP_VERSTR2 - src/sys/pci/ + netif_flags + NETIF_FLAG_BROADCAST + NETIF_FLAG_ETHARP + NETIF_FLAG_ETHERNET + NETIF_FLAG_IGMP + NETIF_FLAG_LINK_UP + NETIF_FLAG_MLD6 + NETIF_FLAG_UP - src/sys/include/pci/ + lwip_opts - src/sys/include/sde/ + lwip_opts_debug - src/ + lwip_opts_infrastructure - src/sys/sys/ + lwip_opts_callback - src/sys/include/sys/ + lwip_opts_threadsafe_apis - src/sys/ + lwip_opts_mem + LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + MEM_ALIGNMENT + MEM_LIBC_MALLOC + MEM_SIZE + MEM_USE_POOLS + MEM_USE_POOLS_TRY_BIGGER_POOL + MEMP_MEM_MALLOC + MEMP_OVERFLOW_CHECK + MEMP_SANITY_CHECK + MEMP_USE_CUSTOM_POOLS - src/sys/ubixfs/ + lwip_opts_memp + MEMP_NUM_API_MSG + MEMP_NUM_ARP_QUEUE + MEMP_NUM_DNS_API_MSG + MEMP_NUM_FRAG_PBUF + MEMP_NUM_IGMP_GROUP + MEMP_NUM_LOCALHOSTLIST + MEMP_NUM_NETBUF + MEMP_NUM_NETCONN + MEMP_NUM_NETDB + MEMP_NUM_NETIFAPI_MSG + MEMP_NUM_PBUF + MEMP_NUM_RAW_PCB + MEMP_NUM_REASSDATA + MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA + MEMP_NUM_SYS_TIMEOUT + MEMP_NUM_TCP_PCB + MEMP_NUM_TCP_PCB_LISTEN + MEMP_NUM_TCP_SEG + MEMP_NUM_TCPIP_MSG_API + MEMP_NUM_TCPIP_MSG_INPKT + MEMP_NUM_UDP_PCB + PBUF_POOL_SIZE - src/sys/include/ubixfs/ + lwip_opts_arp + ARP_MAXAGE + ARP_QUEUE_LEN + ARP_QUEUEING + ARP_TABLE_SIZE + ETH_PAD_SIZE + ETHARP_SUPPORT_STATIC_ENTRIES + ETHARP_SUPPORT_VLAN + ETHARP_TABLE_MATCH_NETIF + LWIP_ARP + LWIP_ETHERNET - src/sys/include/ubixos/ + lwip_opts_ipv4 + IP_DEFAULT_TTL + IP_FORWARD + IP_FORWARD_ALLOW_TX_ON_RX_NETIF + IP_FRAG + IP_OPTIONS_ALLOWED + IP_REASS_MAX_PBUFS + IP_REASS_MAXAGE + IP_REASSEMBLY + IP_SOF_BROADCAST + IP_SOF_BROADCAST_RECV + LWIP_IPV4 + LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS - src/sys/ufs/ + lwip_opts_icmp + ICMP_TTL + LWIP_BROADCAST_PING + LWIP_ICMP + LWIP_MULTICAST_PING - src/sys/include/ufs/ + lwip_opts_raw + LWIP_RAW + RAW_TTL - src/sys/vfs/ + lwip_opts_dhcp + DHCP_DOES_ARP_CHECK + LWIP_DHCP + LWIP_DHCP_BOOTP_FILE + LWIP_DHCP_CHECK_LINK_UP + LWIP_DHCP_GET_NTP_SRV + LWIP_DHCP_MAX_DNS_SERVERS + LWIP_DHCP_MAX_NTP_SERVERS - src/sys/include/vfs/ + lwip_opts_autoip + LWIP_AUTOIP + LWIP_DHCP_AUTOIP_COOP + LWIP_DHCP_AUTOIP_COOP_TRIES - src/sys/vmm/ + lwip_opts_mib2 + LWIP_MIB2_CALLBACKS - src/sys/include/vmm/ + lwip_opts_igmp + LWIP_IGMP + LWIP_MULTICAST_TX_OPTIONS + + lwip_opts_dns + DNS_DOES_NAME_CHECK + DNS_LOCAL_HOSTLIST + DNS_LOCAL_HOSTLIST_IS_DYNAMIC + DNS_MAX_NAME_LENGTH + DNS_MAX_SERVERS + DNS_TABLE_SIZE + LWIP_DNS + LWIP_DNS_SECURE + LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING + LWIP_DNS_SECURE_RAND_SRC_PORT + LWIP_DNS_SECURE_RAND_XID + LWIP_DNS_SUPPORT_MDNS_QUERIES + + lwip_opts_udp + LWIP_NETBUF_RECVINFO + LWIP_UDP + LWIP_UDPLITE + UDP_TTL + + lwip_opts_tcp + LWIP_CALLBACK_API + LWIP_EVENT_API + LWIP_TCP + LWIP_TCP_TIMESTAMPS + LWIP_WND_SCALE + TCP_CALCULATE_EFF_SEND_MSS + TCP_DEFAULT_LISTEN_BACKLOG + TCP_LISTEN_BACKLOG + TCP_MAXRTX + TCP_MSS + TCP_OOSEQ_MAX_BYTES + TCP_OOSEQ_MAX_PBUFS + TCP_OVERSIZE + TCP_QUEUE_OOSEQ + TCP_RCV_SCALE + TCP_SND_BUF + TCP_SND_QUEUELEN + TCP_SNDLOWAT + TCP_SNDQUEUELOWAT + TCP_SYNMAXRTX + TCP_TTL + TCP_WND + TCP_WND_UPDATE_THRESHOLD + + lwip_opts_pbuf + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_POOL_BUFSIZE + + lwip_opts_netif + LWIP_NETIF_API + LWIP_NETIF_HOSTNAME + LWIP_NETIF_HWADDRHINT + LWIP_NETIF_LINK_CALLBACK + LWIP_NETIF_REMOVE_CALLBACK + LWIP_NETIF_STATUS_CALLBACK + LWIP_NETIF_TX_SINGLE_PBUF + LWIP_NUM_NETIF_CLIENT_DATA + + lwip_opts_loop + LWIP_HAVE_LOOPIF + LWIP_LOOPBACK_MAX_PBUFS + LWIP_LOOPIF_MULTICAST + LWIP_NETIF_LOOPBACK + LWIP_NETIF_LOOPBACK_MULTITHREADING + + lwip_opts_thread + DEFAULT_ACCEPTMBOX_SIZE + DEFAULT_RAW_RECVMBOX_SIZE + DEFAULT_TCP_RECVMBOX_SIZE + DEFAULT_THREAD_NAME + DEFAULT_THREAD_PRIO + DEFAULT_THREAD_STACKSIZE + DEFAULT_UDP_RECVMBOX_SIZE + LWIP_TCPIP_THREAD_ALIVE + SLIPIF_THREAD_NAME + SLIPIF_THREAD_PRIO + SLIPIF_THREAD_STACKSIZE + TCPIP_MBOX_SIZE + TCPIP_THREAD_NAME + TCPIP_THREAD_PRIO + TCPIP_THREAD_STACKSIZE + + lwip_opts_netconn + LWIP_NETCONN + LWIP_NETCONN_FULLDUPLEX + LWIP_NETCONN_SEM_PER_THREAD + LWIP_TCPIP_TIMEOUT + + lwip_opts_socket + LWIP_COMPAT_SOCKETS + LWIP_FIONREAD_LINUXMODE + LWIP_POSIX_SOCKETS_IO_NAMES + LWIP_SO_LINGER + LWIP_SO_RCVBUF + LWIP_SO_RCVTIMEO + LWIP_SO_SNDRCVTIMEO_NONSTANDARD + LWIP_SO_SNDTIMEO + LWIP_SOCKET + LWIP_SOCKET_OFFSET + LWIP_SOCKET_SET_ERRNO + LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT + LWIP_TCP_KEEPALIVE + RECV_BUFSIZE_DEFAULT + SO_REUSE + SO_REUSE_RXTOALL + + lwip_opts_stats + ETHARP_STATS + ICMP6_STATS + ICMP_STATS + IGMP_STATS + IP6_FRAG_STATS + IP6_STATS + IP_STATS + IPFRAG_STATS + LINK_STATS + LWIP_STATS + LWIP_STATS_DISPLAY + MEM_STATS + MEMP_STATS + MIB2_STATS + MLD6_STATS + ND6_STATS + SYS_STATS + TCP_STATS + UDP_STATS + + lwip_opts_checksum + CHECKSUM_CHECK_ICMP + CHECKSUM_CHECK_ICMP6 + CHECKSUM_CHECK_IP + CHECKSUM_CHECK_TCP + CHECKSUM_CHECK_UDP + CHECKSUM_GEN_ICMP + CHECKSUM_GEN_ICMP6 + CHECKSUM_GEN_IP + CHECKSUM_GEN_TCP + CHECKSUM_GEN_UDP + LWIP_CHECKSUM_CTRL_PER_NETIF + LWIP_CHECKSUM_ON_COPY + + lwip_opts_ipv6 + LWIP_IPV6 + LWIP_IPV6_AUTOCONFIG + LWIP_IPV6_DUP_DETECT_ATTEMPTS + LWIP_IPV6_FORWARD + LWIP_IPV6_FRAG + LWIP_IPV6_NUM_ADDRESSES + LWIP_IPV6_REASS + LWIP_IPV6_SEND_ROUTER_SOLICIT + + lwip_opts_icmp6 + LWIP_ICMP6 + LWIP_ICMP6_DATASIZE + LWIP_ICMP6_HL + + lwip_opts_mld6 + LWIP_IPV6_MLD + MEMP_NUM_MLD6_GROUP + + lwip_opts_nd6 + LWIP_ND6_ALLOW_RA_UPDATES + LWIP_ND6_DELAY_FIRST_PROBE_TIME + LWIP_ND6_MAX_ANYCAST_DELAY_TIME + LWIP_ND6_MAX_MULTICAST_SOLICIT + LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT + LWIP_ND6_MAX_UNICAST_SOLICIT + LWIP_ND6_NUM_DESTINATIONS + LWIP_ND6_NUM_NEIGHBORS + LWIP_ND6_NUM_PREFIXES + LWIP_ND6_NUM_ROUTERS + LWIP_ND6_QUEUEING + LWIP_ND6_RDNSS_MAX_DNS_SERVERS + LWIP_ND6_REACHABLE_TIME + LWIP_ND6_RETRANS_TIMER + LWIP_ND6_TCP_REACHABILITY_HINTS + MEMP_NUM_ND6_QUEUE + + lwip_opts_hooks + + lwip_opts_debugmsg + API_LIB_DEBUG + API_MSG_DEBUG + AUTOIP_DEBUG + DHCP_DEBUG + DNS_DEBUG + ETHARP_DEBUG + ICMP_DEBUG + IGMP_DEBUG + INET_DEBUG + IP6_DEBUG + IP_DEBUG + IP_REASS_DEBUG + LWIP_DBG_MIN_LEVEL + LWIP_DBG_TYPES_ON + MEM_DEBUG + MEMP_DEBUG + NETIF_DEBUG + PBUF_DEBUG + RAW_DEBUG + SLIP_DEBUG + SOCKETS_DEBUG + SYS_DEBUG + TCP_CWND_DEBUG + TCP_DEBUG + TCP_FR_DEBUG + TCP_INPUT_DEBUG + TCP_OUTPUT_DEBUG + TCP_QLEN_DEBUG + TCP_RST_DEBUG + TCP_RTO_DEBUG + TCP_WND_DEBUG + TCPIP_DEBUG + TIMERS_DEBUG + UDP_DEBUG + + lwip_opts_perf + LWIP_PERF + + netif_mib2 + + netconn + + netconn_common + + netconn_tcp + + netconn_udp + + netbuf + + netdbapi + + netifapi + + netifapi_netif + + socket + + sys_nonstandard + lwip_itoa + lwip_stricmp + lwip_strnicmp + lwip_strnstr + + dns + + ip + + ip4 + + ip6 + + ipaddr + lwip_ip_addr_type + IPADDR_TYPE_V4 + IPADDR_TYPE_V6 + IPADDR_TYPE_ANY + + ip4addr + + ip6addr + + autoip + + dhcp4 + + igmp + + mld6 + + mempool + LWIP_MEMPOOL_ALLOC + LWIP_MEMPOOL_DECLARE + LWIP_MEMPOOL_FREE + LWIP_MEMPOOL_INIT + LWIP_MEMPOOL_PROTOTYPE + + netif + netif_add + netif_find + netif_remove + netif_set_default + netif_set_down + netif_set_link_down + netif_set_link_up + netif_set_up + netif_is_up + + netif_ip4 + + netif_ip6 + + netif_cd + + pbuf + pbuf_layer + PBUF_TRANSPORT + PBUF_IP + PBUF_LINK + PBUF_RAW_TX + PBUF_RAW + pbuf_type + PBUF_RAM + PBUF_ROM + PBUF_REF + PBUF_POOL + pbuf_alloc + pbuf_cat + pbuf_chain + pbuf_coalesce + pbuf_copy + pbuf_copy_partial + pbuf_free + pbuf_get_at + pbuf_memcmp + pbuf_memfind + pbuf_put_at + pbuf_realloc + pbuf_ref + pbuf_skip + pbuf_take + pbuf_take_at + pbuf_try_get_at + + raw_raw + + sys_layer + + sys_os + + sys_sem + sys_arch_sem_wait + sys_sem_free + sys_sem_new + sys_sem_set_invalid + sys_sem_signal + sys_sem_valid + + sys_mutex + sys_mutex_free + sys_mutex_lock + sys_mutex_new + sys_mutex_set_invalid + sys_mutex_unlock + sys_mutex_valid + + sys_mbox + sys_arch_mbox_fetch + sys_arch_mbox_tryfetch + sys_mbox_free + sys_mbox_new + sys_mbox_post + sys_mbox_set_invalid + sys_mbox_trypost + sys_mbox_valid + + sys_time + sys_now + + sys_prot + + sys_misc + sys_msleep + sys_thread_new + + tcp_raw + + udp_raw + + ethernet + eth_type + ETHTYPE_IP + ETHTYPE_ARP + ETHTYPE_WOL + ETHTYPE_RARP + ETHTYPE_VLAN + ETHTYPE_IPV6 + ETHTYPE_PPPOEDISC + ETHTYPE_PPPOE + ETHTYPE_JUMBO + ETHTYPE_PROFINET + ETHTYPE_ETHERCAT + ETHTYPE_LLDP + ETHTYPE_SERCOS + ETHTYPE_MRP + ETHTYPE_PTP + ETHTYPE_QINQ + + todo + + C:/Dev/git/UbixOS/sys/net/api + + C:/Dev/git/UbixOS/sys/include/net/apps + + C:/Dev/git/UbixOS/sys/arch + + C:/Dev/git/UbixOS/sys/include/net/arch + + C:/Dev/git/UbixOS/sys/boot/arm + + C:/Dev/git/UbixOS/sys/arch/armv6 + + C:/Dev/git/UbixOS/sys/boot + + C: + + C:/Dev/git/UbixOS/sys/include/fs/common + + C:/Dev/git/UbixOS/sys/fs/common + + C:/Dev/git/UbixOS/sys/net/core + + C:/Dev + + C:/Dev/git/UbixOS/sys/fs/devfs + + C:/Dev/git/UbixOS/sys/include/devfs + + C:/Dev/git/UbixOS/sys/fs/fat + + C:/Dev/git/UbixOS/sys/include/fat + + C:/Dev/git/UbixOS/sys/include/ufs/ffs + + C:/Dev/git/UbixOS/sys/include/fs + + C:/Dev/git/UbixOS/sys/fs + + C:/Dev/git + + C:/Dev/git/UbixOS/sys/arch/i386 + + C:/Dev/git/UbixOS/sys/include/i386 + + C:/Dev/git/UbixOS/sys/include + + C:/Dev/git/UbixOS/sys/init + + C:/Dev/git/UbixOS/sys/net/core/ipv4 + + C:/Dev/git/UbixOS/sys/net/core/ipv6 + + C:/Dev/git/UbixOS/sys/isa + + C:/Dev/git/UbixOS/sys/include/isa + + C:/Dev/git/UbixOS/sys/kernel + + C:/Dev/git/UbixOS/sys/kmods + + C:/Dev/git/UbixOS/sys/include/lib + + C:/Dev/git/UbixOS/sys/lib + + C:/Dev/git/UbixOS/sys/include/mpi + + C:/Dev/git/UbixOS/sys/mpi + + C:/Dev/git/UbixOS/sys/include/net + + C:/Dev/git/UbixOS/sys/net + + C:/Dev/git/UbixOS/sys/net/net + + C:/Dev/git/UbixOS/sys/include/netif + + C:/Dev/git/UbixOS/sys/net/netif + + C:/Dev/git/UbixOS/sys/include/objgfx + + C:/Dev/git/UbixOS/sys/pci + + C:/Dev/git/UbixOS/sys/include/pci + + C:/Dev/git/UbixOS/sys/include/netif/ppp/polarssl + + C:/Dev/git/UbixOS/sys/include/netif/ppp + + C:/Dev/git/UbixOS/sys/include/net/priv + + C:/Dev/git/UbixOS/sys/include/net/prot + + C:/Dev/git/UbixOS/sys/sde + + C:/Dev/git/UbixOS/sys/include/sde + + C:/Dev/git/UbixOS/sys/sys + + C:/Dev/git/UbixOS/sys + + C:/Dev/git/UbixOS/sys/include/sys + + C:/Dev/git/UbixOS/sys/fs/ubixfs + + C:/Dev/git/UbixOS/sys/include/ubixfs + + C:/Dev/git/UbixOS/sys/fs/ubixfsv2 + + C:/Dev/git/UbixOS + + C:/Dev/git/UbixOS/sys/include/ubixos + + C:/Dev/git/UbixOS/sys/boot/arm/uboot + + C:/Dev/git/UbixOS/sys/include/ufs + + C:/Dev/git/UbixOS/sys/fs/ufs + + C:/Dev/git/UbixOS/sys/include/ufs/ufs + + C:/Dev/git/UbixOS/sys/fs/vfs + + C:/Dev/git/UbixOS/sys/include/vfs + + C:/Dev/git/UbixOS/sys/include/vmm + + C:/Dev/git/UbixOS/sys/vmm diff --git a/doc/xml/index.xsd b/doc/xml/index.xsd index d7ab2a9..04cb2f1 100644 --- a/doc/xml/index.xsd +++ b/doc/xml/index.xsd @@ -41,6 +41,7 @@ + diff --git a/doc/xml/io_8c.xml b/doc/xml/io_8c.xml index 8254e7e..92a258a 100644 --- a/doc/xml/io_8c.xml +++ b/doc/xml/io_8c.xml @@ -1,22 +1,22 @@ - - - + + + io.c sys/io.h - - - - - - - + + + + + + + - + unsigned char unsigned char inportByte (unsigned int port) @@ -26,48 +26,43 @@ port -input one byte from specified port +input one byte from specified port + port -address of port for reading +address of port for reading + -returns unsigned char value - +returns unsigned char value + + + - - _int13 - atkbd_scan - backSpace - countMemory - dp_recv - fdcRw - getByte - hdInit - hdRead - hdWrite - initLNC - kbdRead - kbdWrite - keyboardHandler - kprint - ne2k_init - ne2kHandler - pciRead - PCtoNIC - sendByte - setLED - systemTask - timeCmosRead - tty_init - waitFdc + + backSpace + countMemory + fdcRw + getByte + hdInit + hdRead + hdWrite + initLNC + irqDisable + irqEnable + kprint + pciRead + PCtoNIC + sendByte + setLED + systemTask - + unsigned long unsigned long inportDWord (unsigned int port) @@ -77,24 +72,32 @@ port -input one double word from specified port +input one double word from specified port + port -address of port for reading +address of port for reading + -returns unsigned double word value - +returns unsigned double word value + + + - - pciRead + + lnc_readBCR32 + lnc_readCSR32 + lnc_reset32 + lnc_switchDWord + pciRead - + unsigned short unsigned short inportWord (unsigned int port) @@ -104,33 +107,37 @@ port -input one word from specified port +input one word from specified port + port -address of port for reading +address of port for reading + -returns unsigned short value - +returns unsigned short value + + + - - _int13 - getblock - hdInit - hdRead - lanceProbe - lncInt - NICtoPC - pciRead - readBcr - readCsr + + hdInit + hdRead + lanceProbe + lnc_readBCR + lnc_readCSR + lnc_reset + lnc_switchDWord + lncInt + NICtoPC + pciRead - + void void outportByte (unsigned int port, unsigned char value) @@ -144,66 +151,55 @@ value -outputut one byte to specified port +outputut one byte to specified port + port -address of port for writing +address of port for writing + value -byte to output to port +byte to output to port + - + + - - _dmaXfer - _int13 - atkbd_scan - backSpace - c_ap_boot - clearScreen - countMemory - dp_recv - fdcRw - floppyIsrhndlr - getblock - hdInit - hdRead - hdWrite - i8259_init - irqDisable - irqEnable - kbdWrite - keyboardHandler - kprint - lncInt - motorOn - mouseHandler - mouseInit - ne2k_init - ne2kHandler - NICtoPC - pciWrite - PCtoNIC - pit_init - reset - sendByte - setLED - systemTask - tty_change - tty_init - tty_print + + _dmaXfer + backSpace + countMemory + hdInit + hdRead + hdWrite + i8259_init + irqDisable + irqEnable + kprint + lncInt + mouseHandler + NICtoPC + ogDisplay_UbixOS::ogSetPalette + pciWrite + PCtoNIC + pit_init + reset + sendByte + setLED + ogDisplay_UbixOS::SetPal + systemTask - + void void outportByteP (unsigned int port, unsigned char value) @@ -217,31 +213,35 @@ value -outputut one byte to specified port with a delay +outputut one byte to specified port with a delay + port -address of port for writing +address of port for writing + value -byte to output to port +byte to output to port + - + + - - pit_init - timeCmosRead + + PCtoNIC + pit_init - + void void outportDWord (unsigned int port, unsigned long value) @@ -255,31 +255,40 @@ value -outputut one double word to specified port +outputut one double word to specified port + port -address of port for writing +address of port for writing + value -double word to output to port +double word to output to port + - + + - - pciRead - pciWrite + + lnc_readBCR32 + lnc_readCSR32 + lnc_switchDWord + lnc_writeBCR32 + lnc_writeCSR32 + pciRead + pciWrite - + void void outportWord (unsigned int port, unsigned short value) @@ -293,36 +302,39 @@ value -outputut one word to specified port +outputut one word to specified port + port -address of port for writing +address of port for writing + value -word to output to port +word to output to port + - + + - - _int13 - hdWrite - lncInt - pciWrite - PCtoNIC - readBcr - readCsr - writeBcr - writeCsr + + hdWrite + lnc_readBCR + lnc_readCSR + lnc_writeBCR + lnc_writeCSR + lncInt + pciWrite + PCtoNIC @@ -330,104 +342,99 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: io_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<sys/io.h> - -unsignedcharinportByte(unsignedintport){ -unsignedcharretVal; -asmvolatile( -"inb%%dx,%%al" -:"=a"(retVal) -:"d"(port) -); -return(retVal); -} - -unsignedshortinportWord(unsignedintport){ -unsignedshortretVal; -asmvolatile( -"inw%%dx,%%ax" -:"=a"(retVal) -:"d"(port) -); -return(retVal); -} - -voidoutportByte(unsignedintport,unsignedcharvalue){ -asmvolatile( -"outb%%al,%%dx" -: -:"d"(port),"a"(value) -); -} - -voidoutportByteP(unsignedintport,unsignedcharvalue){ -asmvolatile( -"outb%%al,%%dx\n" -"outb%%al,$0x80\n" -: -:"d"(port),"a"(value) -); -} - -voidoutportWord(unsignedintport,unsignedshortvalue){ -asmvolatile( -"outw%%ax,%%dx" -: -:"d"(port),"a"(value) -); -} - -voidoutportDWord(unsignedintport,unsignedlongvalue){ -asmvolatile( -"outl%%eax,%%dx" -: -:"d"(port),"a"(value) -); -} - -unsignedlonginportDWord(unsignedintport){ -unsignedlongretVal; -asmvolatile( -"inl%%dx,%%eax" -:"=a"(retVal) -:"d"(port) -); -return(retVal); -} - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/io.h> + +unsignedcharinportByte(unsignedintport){ +unsignedcharretVal; +asmvolatile( +"inb%%dx,%%al" +:"=a"(retVal) +:"d"(port) +); +return(retVal); +} + +unsignedshortinportWord(unsignedintport){ +unsignedshortretVal; +asmvolatile( +"inw%%dx,%%ax" +:"=a"(retVal) +:"d"(port) +); +return(retVal); +} + +voidoutportByte(unsignedintport,unsignedcharvalue){ +asmvolatile( +"outb%%al,%%dx" +: +:"d"(port),"a"(value) +); +} + +voidoutportByteP(unsignedintport,unsignedcharvalue){ +asmvolatile( +"outb%%al,%%dx\n" +"outb%%al,$0x80\n" +: +:"d"(port),"a"(value) +); +} + +voidoutportWord(unsignedintport,unsignedshortvalue){ +asmvolatile( +"outw%%ax,%%dx" +: +:"d"(port),"a"(value) +); +} + +voidoutportDWord(unsignedintport,unsignedlongvalue){ +asmvolatile( +"outl%%eax,%%dx" +: +:"d"(port),"a"(value) +); +} + +unsignedlonginportDWord(unsignedintport){ +unsignedlongretVal; +asmvolatile( +"inl%%dx,%%eax" +:"=a"(retVal) +:"d"(port) +); +return(retVal); +} - + diff --git a/doc/xml/io_8h.xml b/doc/xml/io_8h.xml index 4616e6b..f5179cc 100644 --- a/doc/xml/io_8h.xml +++ b/doc/xml/io_8h.xml @@ -1,435 +1,2036 @@ - - - + + + io.h - src/sys/include/ubixos/time.h - src/sys/isa/8259.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/mouse.c - src/sys/isa/ne2k.c - src/sys/isa/pit.c - src/sys/kernel/smp.c - src/sys/kernel/systemtask.c - src/sys/kernel/tty.c - src/sys/pci/hd.c - src/sys/pci/lnc.c - src/sys/pci/pci.c - src/sys/sys/dma.c - src/sys/sys/idt.c - src/sys/sys/io.c - src/sys/sys/video.c - src/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/include/ubixos/time.h + C:/Dev/git/UbixOS/sys/isa/8259.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/mouse.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/isa/pit.c + C:/Dev/git/UbixOS/sys/kernel/smp.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/pci/hd.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/pci/pci.c + C:/Dev/git/UbixOS/sys/sde/ogDisplay_UbixOS.cc + C:/Dev/git/UbixOS/sys/sys/dma.c + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/sys/io.c + C:/Dev/git/UbixOS/sys/sys/video.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + - - - + + + - - - + + + + + + + + + - - + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + unsigned char unsigned char inportByte (unsigned int) inportByte - unsigned - int + unsigned int port -input one byte from specified port +input one byte from specified port + port -address of port for reading +address of port for reading + -returns unsigned char value - +returns unsigned char value + + + - - _int13 - atkbd_scan - backSpace - countMemory - dp_recv - fdcRw - getByte - hdInit - hdRead - hdWrite - initLNC - kbdRead - kbdWrite - keyboardHandler - kprint - ne2k_init - ne2kHandler - pciRead - PCtoNIC - sendByte - setLED - systemTask - timeCmosRead - tty_init - waitFdc + + backSpace + countMemory + fdcRw + getByte + hdInit + hdRead + hdWrite + initLNC + irqDisable + irqEnable + kprint + pciRead + PCtoNIC + sendByte + setLED + systemTask - + unsigned long unsigned long inportDWord (unsigned int) inportDWord - unsigned - int + unsigned int port -input one double word from specified port +input one double word from specified port + port -address of port for reading +address of port for reading + -returns unsigned double word value - +returns unsigned double word value + + + - - pciRead + + lnc_readBCR32 + lnc_readCSR32 + lnc_reset32 + lnc_switchDWord + pciRead - + unsigned short unsigned short inportWord (unsigned int) inportWord - unsigned - int + unsigned int port -input one word from specified port +input one word from specified port + port -address of port for reading +address of port for reading + -returns unsigned short value - +returns unsigned short value + + + - - _int13 - getblock - hdInit - hdRead - lanceProbe - lncInt - NICtoPC - pciRead - readBcr - readCsr + + hdInit + hdRead + lanceProbe + lnc_readBCR + lnc_readCSR + lnc_reset + lnc_switchDWord + lncInt + NICtoPC + pciRead - + void void outportByte (unsigned int, unsigned char) outportByte - unsigned - int + unsigned int port - unsigned - char + unsigned char value -outputut one byte to specified port +outputut one byte to specified port + port -address of port for writing +address of port for writing + value -byte to output to port +byte to output to port + - + + - - _dmaXfer - _int13 - atkbd_scan - backSpace - c_ap_boot - clearScreen - countMemory - dp_recv - fdcRw - floppyIsrhndlr - getblock - hdInit - hdRead - hdWrite - i8259_init - irqDisable - irqEnable - kbdWrite - keyboardHandler - kprint - lncInt - motorOn - mouseHandler - mouseInit - ne2k_init - ne2kHandler - NICtoPC - pciWrite - PCtoNIC - pit_init - reset - sendByte - setLED - systemTask - tty_change - tty_init - tty_print + + _dmaXfer + backSpace + countMemory + hdInit + hdRead + hdWrite + i8259_init + irqDisable + irqEnable + kprint + lncInt + mouseHandler + NICtoPC + ogDisplay_UbixOS::ogSetPalette + pciWrite + PCtoNIC + pit_init + reset + sendByte + setLED + ogDisplay_UbixOS::SetPal + systemTask - + void void outportByteP (unsigned int port, unsigned char value) @@ -443,31 +2044,35 @@ value -outputut one byte to specified port with a delay +outputut one byte to specified port with a delay + port -address of port for writing +address of port for writing + value -byte to output to port +byte to output to port + - + + - - pit_init - timeCmosRead + + PCtoNIC + pit_init - + void void outportDWord (unsigned int port, unsigned long value) @@ -481,76 +2086,86 @@ value -outputut one double word to specified port +outputut one double word to specified port + port -address of port for writing +address of port for writing + value -double word to output to port +double word to output to port + - + + - - pciRead - pciWrite + + lnc_readBCR32 + lnc_readCSR32 + lnc_switchDWord + lnc_writeBCR32 + lnc_writeCSR32 + pciRead + pciWrite - + void void outportWord (unsigned int, unsigned short) outportWord - unsigned - int + unsigned int port - unsigned - short + unsigned short value -outputut one word to specified port +outputut one word to specified port + port -address of port for writing +address of port for writing + value -word to output to port +word to output to port + - + + - - _int13 - hdWrite - lncInt - pciWrite - PCtoNIC - readBcr - readCsr - writeBcr - writeCsr + + hdWrite + lnc_readBCR + lnc_readCSR + lnc_writeBCR + lnc_writeCSR + lncInt + pciWrite + PCtoNIC @@ -558,53 +2173,50 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: io_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_IO_H -#define_IO_H - -unsignedcharinportByte(unsignedint); -unsignedshortinportWord(unsignedint); -unsignedlonginportDWord(unsignedint); -voidoutportByte(unsignedint,unsignedchar); -voidoutportByteP(unsignedintport,unsignedcharvalue); -voidoutportWord(unsignedint,unsignedshort); -voidoutportDWord(unsignedintport,unsignedlongvalue); +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_IO_H_ +#define_IO_H_ + +unsignedcharinportByte(unsignedint); +unsignedshortinportWord(unsignedint); +unsignedlonginportDWord(unsignedint); + +voidoutportByte(unsignedint,unsignedchar); +voidoutportByteP(unsignedintport,unsignedcharvalue); +voidoutportWord(unsignedint,unsignedshort); +voidoutportDWord(unsignedintport,unsignedlongvalue); -#endif - +#endif + /*** -$Log: io_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - +$Log:io.h,v$ Revision1.1.1.12006/06/0112:46:15reddawg ubix2 @@ -624,6 +2236,6 @@ END ***/ - + diff --git a/doc/xml/kern__sig_8c.xml b/doc/xml/kern__sig_8c.xml index 261fe4a..37b3e34 100644 --- a/doc/xml/kern__sig_8c.xml +++ b/doc/xml/kern__sig_8c.xml @@ -1,149 +1,262 @@ - - - + + + kern_sig.c - ubixos/types.h - sys/sysproto.h - sys/thread.h sys/kern_sig.h + sys/sysproto_posix.h + sys/thread.h lib/kprintf.h ubixos/endtask.h lib/kmalloc.h assert.h - - - - + + + + + + - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + int int sigaction (struct thread *td, register struct sigaction_args *uap) @@ -162,9 +275,9 @@ - + - + int int sigprocmask (register struct thread *td, struct sigprocmask_args *uap) @@ -183,7 +296,7 @@ - + @@ -191,59 +304,55 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kern__sig_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<sys/sysproto.h> -#include<sys/thread.h> -#include<sys/kern_sig.h> -#include<lib/kprintf.h> -#include<ubixos/endtask.h> -#include<lib/kmalloc.h> -#include<assert.h> - -intsigaction(structthread*td,registerstructsigaction_args*uap){ -return(0x0); -} - -intsigprocmask(registerstructthread*td,structsigprocmask_args*uap){ -return(0x0); -} - - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/kern_sig.h> +#include<sys/sysproto_posix.h> +#include<sys/thread.h> +#include<lib/kprintf.h> +#include<ubixos/endtask.h> +#include<lib/kmalloc.h> +#include<assert.h> + +intsigaction(structthread*td,registerstructsigaction_args*uap){ +return(0x0); +} + +intsigprocmask(registerstructthread*td,structsigprocmask_args*uap){ +return(0x0); +} + +/*** +END +***/ -/*** -END -***/ - - + diff --git a/doc/xml/kern__sig_8h.xml b/doc/xml/kern__sig_8h.xml index ee0dfb0..04c2f6c 100644 --- a/doc/xml/kern__sig_8h.xml +++ b/doc/xml/kern__sig_8h.xml @@ -1,64 +1,196 @@ - - - + + + kern_sig.h sys/thread.h - sys/sysproto.h - src/sys/kernel/kern_sig.c + sys/sysproto_posix.h + C:/Dev/git/UbixOS/sys/kernel/kern_sig.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - + + + + - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - + int int sigaction (struct thread *, struct sigaction_args *) @@ -75,9 +207,9 @@ - + - + int int sigprocmask (struct thread *, struct sigprocmask_args *) @@ -94,7 +226,7 @@ - + @@ -102,51 +234,45 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kern__sig_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_KERN_SIG_H -#define_KERN_SIG_H - -#include<sys/thread.h> -#include<sys/sysproto.h> - -intsigaction(structthread*,structsigaction_args*); -intsigprocmask(structthread*,structsigprocmask_args*); - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_KERN_SIG_H +#define_KERN_SIG_H + +#include<sys/thread.h> +#include<sys/sysproto_posix.h> + +intsigaction(structthread*,structsigaction_args*); +intsigprocmask(structthread*,structsigprocmask_args*); + +#endif/*END_KERN_SIG_H*/ - + diff --git a/doc/xml/kern__sysctl_8c.xml b/doc/xml/kern__sysctl_8c.xml index ade2742..09486fb 100644 --- a/doc/xml/kern__sysctl_8c.xml +++ b/doc/xml/kern__sysctl_8c.xml @@ -1,165 +1,332 @@ - - - + + + kern_sysctl.c - ubixos/types.h - sys/sysproto.h - sys/thread.h sys/kern_sysctl.h + sys/sysproto_posix.h + sys/thread.h ubixos/endtask.h ubixos/kpanic.h lib/kprintf.h lib/kmalloc.h assert.h string.h + ubixos/errno.h + lib/kern_trie.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - + + + + + + + struct sysctl_entry * + struct sysctl_entry* ctls + + ctls + = 0x0 + + + + + + + + + + struct Trie * + struct Trie* sysctl_headTrie + + sysctl_headTrie + = 0x0 + + + + + + + + + - + int int __sysctl (struct thread *td, struct sysctl_args *uap) @@ -178,25 +345,9 @@ - - _current - ctls - endTask - taskStruct::id - K_PANIC - kprintf - memcpy - sysctl_args::name - sysctl_args::namelen - sysctl_args::newlen - sysctl_args::old - sysctl_args::oldlenp - sysctl_find - thread::td_retval - sysctl_entry::val_len - sysctl_entry::value + - + void static void def_ctls () @@ -207,13 +358,30 @@ - - CTL_MAXNAME - name - sysctl_add - sysctl_init + - + + int + int sys_sysctl + (struct thread *td, struct sys_sysctl_args *args) + sys_sysctl + + struct thread * + td + + + struct sys_sysctl_args * + args + + + + + + + + + + int int sysctl_add (int *name, int namelen, char *str_name, void *buf, int buf_size) @@ -244,22 +412,9 @@ - - sysctl_entry::children - sysctl_entry::id - kmalloc - kprintf - memcpy - sysctl_entry::name - sysctl_entry::next - sysctl_entry::prev - sprintf - sysctl_find - sysctl_entry::val_len - sysctl_entry::value - def_ctls + - + struct sysctl_entry * static struct sysctl_entry * sysctl_find (int *, int) @@ -278,15 +433,30 @@ - - sysctl_entry::children - ctls - sysctl_entry::id - sysctl_entry::next - __sysctl - sysctl_add + - + + struct sysctl_entry * + static struct sysctl_entry * sysctl_findMib + (char *name, int namelen) + sysctl_findMib + + char * + name + + + int + namelen + + + + + + + + + + int int sysctl_init () @@ -297,47 +467,7 @@ - - sysctl_entry::children - CTL_DEBUG - CTL_HW - CTL_KERN - CTL_MACHDEP - CTL_NET - CTL_P1003_1B - CTL_UBIX - CTL_UNSPEC - CTL_USER - CTL_VFS - CTL_VM - ctls - def_ctls - sysctl_entry::id - kmalloc - kprintf - sysctl_entry::name - sysctl_entry::next - sysctl_entry::prev - sprintf - - - - - struct sysctl_entry * - struct sysctl_entry* ctls - - ctls - 0x0 - - - - - - - - __sysctl - sysctl_find - sysctl_init + @@ -345,260 +475,493 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kern__sysctl_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<sys/sysproto.h> -#include<sys/thread.h> -#include<sys/kern_sysctl.h> -#include<ubixos/endtask.h> -#include<ubixos/kpanic.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<assert.h> -#include<string.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/kern_sysctl.h> +#include<sys/sysproto_posix.h> +#include<sys/thread.h> +#include<ubixos/endtask.h> +#include<ubixos/kpanic.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<assert.h> +#include<string.h> +#include<ubixos/errno.h> +#include<lib/kern_trie.h> -staticstructsysctl_entry*ctls=0x0; +staticstructsysctl_entry*ctls=0x0; -staticstructsysctl_entry*sysctl_find(int*,int); - -/*Thisisacheatfornow*/ -staticvoiddef_ctls(){ -intname[CTL_MAXNAME],name_len; -uInt32page_val=0x1000; -name[0]=6; -name[1]=7; -name_len=2; -sysctl_add(name,name_len,"page_size",&page_val,sizeof(uInt32)); -/*ClockRate*/ -name[0]=1; -name[1]=12; -page_val=0x3E8; -sysctl_add(name,name_len,"page_size",&page_val,sizeof(uInt32)); -/*UserStack*/ -name[0]=1; -name[1]=33; -page_val=0xCBE8000; -sysctl_add(name,name_len,"page_size",&page_val,sizeof(uInt32)); -} - -intsysctl_init(){ -structsysctl_entry*tmpCtl=0x0; -if(ctls!=0x0){ -kprintf("sysctlalreadyInitialized\n"); -while(1); -} - -ctls=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -ctls->prev=0x0; -ctls->id=CTL_UNSPEC; -ctls->children=0x0; -sprintf(ctls->name,"unspec"); - -tmpCtl=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->prev=ctls; -tmpCtl->id=CTL_KERN; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"kern"); -ctls->next=tmpCtl; - -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_VM; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"vm"); - -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_VFS; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"vfs"); +staticstructsysctl_entry*sysctl_find(int*,int); +staticstructsysctl_entry*sysctl_findMib(char*name,intnamelen); + +structTrie*sysctl_headTrie=0x0; + +/*Thisisacheatfornow*/ +staticvoiddef_ctls(){ +intname[CTL_MAXNAME],name_len; +uint32_tpage_val=0x1000; +int32_tusPage_val=0x0; +name[0]=6; +name[1]=7; +name_len=2; +sysctl_add(name,name_len,"pagesizes",&page_val,sizeof(uint32_t)); + +/*ClockRate*/ +name[0]=1; +name[1]=12; +page_val=0x3E8; +sysctl_add(name,name_len,"page_size",&page_val,sizeof(uInt32)); + +/*KERN:OSRelease*/ +name[0]=1; +name[1]=24; +page_val=101000; +sysctl_add(name,name_len,"kern.osreldate",&page_val,sizeof(uInt32)); + +/*KERN:UserStack*/ +name[0]=1; +name[1]=33; +page_val=0xCBE8000; +sysctl_add(name,name_len,"page_size",&page_val,sizeof(uInt32)); + +/*KERN:ARND*/ +name[0]=1; +name[1]=37; +page_val=0x1; +sysctl_add(name,name_len,"kern_arnd",&page_val,sizeof(uint32_t)); + +/*HW:NCPU*/ +name[0]=6; +name[1]=3; +page_val=0x1; +sysctl_add(name,name_len,"hw.ncpu",&page_val,sizeof(uint32_t)); + +name[0]=9; +name[1]=20; +page_val=0x4000; +sysctl_add(name,name_len,"p1003_1b.pagesize",&page_val,sizeof(uint32_t)); + +/*XXX1,1*/ +name[0]=1; +name[1]=1; +chars11[4]="UBIX"; +sysctl_add(name,name_len,"kern.ostype",&s11,4); -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_NET; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"net"); - -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_DEBUG; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"debug"); - -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_HW; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"hw"); - -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_MACHDEP; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"machdep"); - -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_USER; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"user"); +/*XXX1,10*/ +name[0]=1; +name[1]=10; +chars110[16]="devel.ubixos.com"; +sysctl_add(name,name_len,"kern.hostname",&s110,16); + +/*XXX1,2*/ +name[0]=1; +name[1]=2; +chars12[11]="1.0-RELEASE"; +sysctl_add(name,name_len,"kern.hostname",&s12,11); + +/*XXX1,4*/ +name[0]=1; +name[1]=4; +chars14[18]="UbixOS1.0-RELEASE"; +sysctl_add(name,name_len,"kern.hostname",&s14,18); + +/*XXX6,1*/ +name[0]=6; +name[1]=1; +chars61[4]="i386"; +sysctl_add(name,name_len,"kern.hostname",&s61,4); + +/*XXX6,2147482988*/ +name[0]=6; +name[1]=2147482988; +page_val=4096; +sysctl_add(name,name_len,"hw.pagesizes",&page_val,sizeof(u_int32_t)); + +name[0]=2; +name[1]=12; +page_val=0; +sysctl_add(name,name_len,"vm.overcommit",&page_val,sizeof(u_int32_t)); -tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_P1003_1B; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"p1003_1b"); - -tmpCtl->next=(structsysctl_enctry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->next->prev=tmpCtl; -tmpCtl=tmpCtl->next; -tmpCtl->id=CTL_UBIX; -tmpCtl->children=0x0; -sprintf(tmpCtl->name,"ubix"); - -def_ctls(); - -return(0x0); -} - -int__sysctl(structthread*td,structsysctl_args*uap){ -structsysctl_entry*tmpCtl=0x0; -inti=0; +name[0]=1; +name[1]=18; +usPage_val=1023; +sysctl_add(name,name_len,"kern.ngroups",&page_val,sizeof(int32_t)); + +/*XXX6,1*/ +name[0]=2; +name[1]=134516822; +chars62[2]="\0"; +sysctl_add(name,name_len,"kern.msgbuf",&s62,1); + +} + +intsysctl_init(){ + +structsysctl_entry*tmpCtl=0x0; + +if(ctls!=0x0){ +kprintf("sysctlalreadyInitialized\n"); +while(1) +; +} -if(ctls==0x0) -K_PANIC("sysctlnotinitialized"); +/*InitializeHeadTrie*/ +sysctl_headTrie=(structTrie*)kmalloc(sizeof(structTrie)); -if(uap->newlen<0){ -kprintf("ChangingNotsupportedyet.\n"); -endTask(_current->id); -} - -tmpCtl=sysctl_find(uap->name,uap->namelen); -if(tmpCtl==0x0){ -kprintf("InvalidCTL\n"); -for(i=0x0;i<uap->namelen;i++) -kprintf("(%i)",uap->name[i]); -kprintf("\n"); -endTask(_current->id); -} - -if((uint32_t)uap->oldlenp<tmpCtl->val_len) -memcpy(uap->old,tmpCtl->value,(uInt32)uap->oldlenp); -else -memcpy(uap->old,tmpCtl->value,tmpCtl->val_len); - -td->td_retval[0]=0x0; - -return(0x0); -} +ctls=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +ctls->prev=0x0; +ctls->id=CTL_UNSPEC; +ctls->children=0x0; +sprintf(ctls->name,"unspec"); + +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->prev=ctls; +tmpCtl->id=CTL_KERN; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"kern"); +ctls->next=tmpCtl; +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_VM; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"vm"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); -staticstructsysctl_entry*sysctl_find(int*name,intnamelen){ -inti=0x0; -structsysctl_entry*tmpCtl=0x0; -structsysctl_entry*lCtl=ctls; - -/*LoopNameLen*/ -for(i=0x0;i<namelen;i++){ -for(tmpCtl=lCtl;tmpCtl!=0x0;tmpCtl=tmpCtl->next){ -//kprintf("ctlName:[%s],ctlId;[%i]\n",tmpCtl->name,tmpCtl->id); -if(tmpCtl->id==name[i]){ -if((i+1)==namelen){ -return(tmpCtl); -} -lCtl=tmpCtl->children; -break; -} -} -} -return(0x0); -} - -intsysctl_add(int*name,intnamelen,char*str_name,void*buf,intbuf_size){ -structsysctl_entry*tmpCtl=0x0; -structsysctl_entry*newCtl=0x0; - -/*Checkifitexists*/ -tmpCtl=sysctl_find(name,namelen); -if(tmpCtl!=0x0){ -kprintf("NodeExists!\n"); -while(1); -} +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_VFS; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"vfs"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_NET; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"net"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_DEBUG; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"debug"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_HW; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"hw"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); -/*GetParentNode*/ -tmpCtl=sysctl_find(name,namelen-1); -if(tmpCtl==0x0){ -kprintf("ParentNodeNonExistant\n"); -return(-1); -} -if(tmpCtl->children==0x0){ -tmpCtl->children=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -tmpCtl->children->children=0x0; -tmpCtl->children->prev=0x0; -tmpCtl->children->next=0x0; -tmpCtl->children->id=name[namelen-1]; -sprintf(tmpCtl->children->name,str_name); -tmpCtl->children->value=(void*)kmalloc(buf_size); -memcpy(tmpCtl->children->value,buf,buf_size); -tmpCtl->children->val_len=buf_size; -} -else{ -newCtl=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); -newCtl->prev=0x0; -newCtl->next=tmpCtl->children; -newCtl->children=0x0; -newCtl->id=name[namelen-1]; -sprintf(newCtl->name,str_name); -newCtl->value=(void*)kmalloc(buf_size); -memcpy(newCtl->value,buf,buf_size); -newCtl->val_len=buf_size; -tmpCtl->children->prev=newCtl; -tmpCtl->children=newCtl; -} - -return(0x0); -} +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_MACHDEP; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"machdep"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_USER; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"user"); +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_P1003_1B; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"p1003_1b"); + +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); + +tmpCtl->next=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +tmpCtl->next->prev=tmpCtl; +tmpCtl=tmpCtl->next; +tmpCtl->id=CTL_UBIX; +tmpCtl->children=0x0; +sprintf(tmpCtl->name,"ubix"); + +insert_trieNode(&sysctl_headTrie,ctls->name,ctls); - -/*** -END -***/ +def_ctls(); + +return(0x0); +} + +int__sysctl(structthread*td,structsysctl_args*uap){ +structsysctl_entry*tmpCtl=0x0; +inti=0; + +if(ctls==0x0) +K_PANIC("sysctlnotinitialized"); + +if(uap->newlen<0){ +kprintf("ChangingNotsupportedyet.\n"); +endTask(_current->id); +} + +tmpCtl=sysctl_find(uap->name,uap->namelen); +if(tmpCtl==0x0){ +kprintf("InvalidCTL\n"); +for(i=0x0;i<uap->namelen;i++) +kprintf("(%i)",uap->name[i]); +kprintf("\n"); +endTask(_current->id); +} + +if((uint32_t)uap->oldlenp<tmpCtl->val_len) +memcpy(uap->oldp,tmpCtl->value,(uInt32)uap->oldlenp); +else +memcpy(uap->oldp,tmpCtl->value,tmpCtl->val_len); + +td->td_retval[0]=0x0; + +return(0x0); +} + +intsys_sysctl(structthread*td,structsys_sysctl_args*args){ +structsysctl_entry*tmpCtl=0x0; +structTrie*tmpTrie=0x0; +inti=0; + +if(ctls==0x0) +K_PANIC("sysctlnotinitialized"); + +if(args->newlenp<0){ +kprintf("ChangingNotsupportedyet.\n"); +endTask(_current->id); +} + +/*XXX-Handlesearchbyname*/ +if(args->namelen==2&&args->name[0]==0&&args->name[1]==3){ + +tmpTrie=search_trieNode(sysctl_headTrie,args->newp); + +if(tmpTrie!=0x0){ +tmpCtl=(structsysctl_entry*)tmpTrie->e; + +//kprintf("<FT:%s:%i>\n",tmpCtl->name,tmpCtl->namelen); + +//tmpCtl=sysctl_findMib(args->newp,args->namelen); +*args->oldlenp=tmpCtl->namelen*4; +u_int32_t*oldp=args->oldp; + +for(i=0;i<tmpCtl->namelen;i++) +oldp[i]=tmpCtl->full_name[i]; + +td->td_retval[0]=0;/*XXX-VeryBadneedtostorenameleninthestruct*/ + +return(0x0); +} +else{ + +#ifdefDEBUG_SYSCTL +kprintf("%s:%i>name_to_mib:%s\n",__FILE__,__LINE__,args->newp); +#endif + +td->td_retval[0]=ENOENT; +return(-1); +} +} +else{ +tmpCtl=sysctl_find(args->name,args->namelen); +} + +if(tmpCtl==0x0){ +kprintf("InvalidCTL(%i):",args->namelen); +for(i=0x0;i<args->namelen;i++) +kprintf("(%i)",(int)args->name[i]); +kprintf("\n"); +td->td_retval[0]=-1; +return(-1); +} +/* +else{ +kprintf("ValidCTL(%i):",args->namelen); +for(i=0x0;i<args->namelen;i++) +kprintf("(%i)",(int)args->name[i]); +kprintf("\n"); +} + +kprintf("{%i:%i}\n",args->oldlenp,tmpCtl->val_len); + +*/ + +if((uint32_t)args->oldlenp<tmpCtl->val_len) +memcpy(args->oldp,tmpCtl->value,(uInt32)args->oldlenp); +else +memcpy(args->oldp,tmpCtl->value,tmpCtl->val_len); + +td->td_retval[0]=0x0; + +return(0x0); +} + +staticstructsysctl_entry*sysctl_find(int*name,intnamelen){ +inti=0x0; +structsysctl_entry*tmpCtl=0x0; +structsysctl_entry*lCtl=ctls; + +/*LoopNameLen*/ +for(i=0x0;i<namelen;i++){ +for(tmpCtl=lCtl;tmpCtl!=0x0;tmpCtl=tmpCtl->next){ +//kprintf("ctlName:[%s],ctlId;[%i]\n",tmpCtl->name,tmpCtl->id); +if(tmpCtl->id==name[i]){ +if((i+1)==namelen){ +return(tmpCtl); +} +lCtl=tmpCtl->children; +break; +} +} +} +return(0x0); +} + + +staticstructsysctl_entry*sysctl_findMib(char*name,intnamelen){ +inti=0x0; +structsysctl_entry*tmpCtl=0x0; +structsysctl_entry*lCtl=ctls; + +char*mib=(char*)strtok((char*)name,"."); + + +kprintf("FMIB:%s",mib); + +lCtl=(structsysctl_entry*)search_trieNode(sysctl_headTrie,mib)->e; +kprintf("FT:%s",lCtl->name); + +/*LoopNameLen*/ +for(i=0x0;i<namelen;i++){ +for(tmpCtl=lCtl;tmpCtl!=0x0;tmpCtl=tmpCtl->next){ +if(strcmp(mib,tmpCtl->name)==0x0){ +kprintf("ctlName:[%s],ctlId:[%i]",tmpCtl->name,tmpCtl->id); +if((i+1)==namelen){ +return(tmpCtl); +} +mib=strtok(NULL,"\n"); +kprintf("SMIB:%s",mib); +lCtl=tmpCtl->children; +break; +} +} +} +return(0x0); +} + + +intsysctl_add(int*name,intnamelen,char*str_name,void*buf,intbuf_size){ +structsysctl_entry*tmpCtl=0x0; +structsysctl_entry*newCtl=0x0; +inti=0; + +/*Checkifitexists*/ +tmpCtl=sysctl_find(name,namelen); +if(tmpCtl!=0x0){ +kprintf("NodeExists![%s]\n",str_name); +while(1) +; +} + +/*GetParentNode*/ +tmpCtl=sysctl_find(name,namelen-1); +if(tmpCtl==0x0){ +kprintf("ParentNodeNonExistant\n"); +return(-1); +} +if(tmpCtl->children==0x0){ +tmpCtl->children=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +memset(tmpCtl->children,0x0,sizeof(structsysctl_entry)); +tmpCtl->children->children=0x0; +tmpCtl->children->prev=0x0; +tmpCtl->children->next=0x0; +tmpCtl->children->id=name[namelen-1]; +for(i=0;i<namelen;i++) +tmpCtl->children->full_name[i]=name[i]; + +tmpCtl->children->namelen=namelen; + +sprintf(tmpCtl->children->name,str_name); + +insert_trieNode(&sysctl_headTrie,tmpCtl->children->name,tmpCtl->children); + +tmpCtl->children->value=(void*)kmalloc(buf_size); +memcpy(tmpCtl->children->value,buf,buf_size); +tmpCtl->children->val_len=buf_size; +} +else{ +newCtl=(structsysctl_entry*)kmalloc(sizeof(structsysctl_entry)); +memset(newCtl,0x0,sizeof(structsysctl_entry)); +newCtl->prev=0x0; +newCtl->next=tmpCtl->children; +newCtl->children=0x0; +newCtl->id=name[namelen-1]; + +for(i=0;i<namelen;i++) +newCtl->full_name[i]=name[i]; + +newCtl->namelen=namelen; + +sprintf(newCtl->name,str_name); + +insert_trieNode(&sysctl_headTrie,newCtl->name,newCtl); + +newCtl->value=(void*)kmalloc(buf_size); +memcpy(newCtl->value,buf,buf_size); +newCtl->val_len=buf_size; +tmpCtl->children->prev=newCtl; +tmpCtl->children=newCtl; +} + +return(0x0); +} + +/*** +END +***/ - + diff --git a/doc/xml/kern__sysctl_8h.xml b/doc/xml/kern__sysctl_8h.xml index 1197fb3..a5a1d32 100644 --- a/doc/xml/kern__sysctl_8h.xml +++ b/doc/xml/kern__sysctl_8h.xml @@ -1,253 +1,395 @@ - - - + + + kern_sysctl.h - sys/sysproto.h + sys/sysproto_posix.h sys/thread.h - src/sys/include/ubixos/init.h - src/sys/kernel/kern_sysctl.c - src/sys/vmm/copyvirtualspace.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/ufs/ufs/ufs_extern.h + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/vmm/copyvirtualspace.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - + + + + - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + sysctl_entry - + CTL_DEBUG - 5 + 5 /* debugging parameters */ - - sysctl_init + - + CTL_HW - 6 + 6 /* generic cpu/io */ - - sysctl_init + - + CTL_KERN - 1 + 1 /* "high kernel": proc, limits */ - - sysctl_init + - + CTL_KERN_OPENFILES - 1 + 1 /* kernel openfiles */ - + - + CTL_MACHDEP - 7 + 7 /* machine dependent */ - - sysctl_init + - + CTL_MAXNAME - 24 + 24 /* largest number of components supported */ - - def_ctls + - + CTL_NET - 4 + 4 /* network, see socket.h */ - - sysctl_init + - + CTL_P1003_1B - 9 + 9 /* POSIX 1003.1B */ - - sysctl_init + - + CTL_UBIX - 10 + 10 /* ubixos */ - - sysctl_init + - + CTL_UNSPEC - 0 + 0 /* unused */ - - sysctl_init + - + CTL_USER - 8 + 8 /* user-level */ - - sysctl_init + - + CTL_VFS - 3 + 3 /* filesystem, mount type is next */ - - sysctl_init + - + CTL_VM - 2 + 2 /* virtual memory */ - - sysctl_init + - + EINVAL - -1 + -1 /* */ - + + + + + + bool + bool sysctl_enabled + + sysctl_enabled + + + + + + + - + int int kern_sysctl (int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval, int flags) @@ -257,7 +399,7 @@ name - u_int + u_int namelen @@ -265,7 +407,7 @@ old - size_t * + size_t * oldlenp @@ -273,11 +415,11 @@ new - size_t + size_t newlen - size_t * + size_t * retval @@ -290,9 +432,9 @@ - + - + int int sysctl_add (int *, int, char *, void *, int) @@ -318,22 +460,9 @@ - - sysctl_entry::children - sysctl_entry::id - kmalloc - kprintf - memcpy - sysctl_entry::name - sysctl_entry::next - sysctl_entry::prev - sprintf - sysctl_find - sysctl_entry::val_len - sysctl_entry::value - def_ctls + - + int int sysctl_init () @@ -344,43 +473,7 @@ - - sysctl_entry::children - CTL_DEBUG - CTL_HW - CTL_KERN - CTL_MACHDEP - CTL_NET - CTL_P1003_1B - CTL_UBIX - CTL_UNSPEC - CTL_USER - CTL_VFS - CTL_VM - ctls - def_ctls - sysctl_entry::id - kmalloc - kprintf - sysctl_entry::name - sysctl_entry::next - sysctl_entry::prev - sprintf - - - - - bool - bool sysctl_enabled - - sysctl_enabled - - - - - - - + @@ -388,84 +481,80 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kern__sysctl_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_KERNSYSCTL_H -#define_KERNSYSCTL_H - -#include<sys/sysproto.h> -#include<sys/thread.h> - -#defineCTL_MAXNAME24/*largestnumberofcomponentssupported*/ - -/* -*Top-levelidentifiers -*/ -#defineCTL_UNSPEC0/*unused*/ -#defineCTL_KERN1/*"highkernel":proc,limits*/ -#defineCTL_VM2/*virtualmemory*/ -#defineCTL_VFS3/*filesystem,mounttypeisnext*/ -#defineCTL_NET4/*network,seesocket.h*/ -#defineCTL_DEBUG5/*debuggingparameters*/ -#defineCTL_HW6/*genericcpu/io*/ -#defineCTL_MACHDEP7/*machinedependent*/ -#defineCTL_USER8/*user-level*/ -#defineCTL_P1003_1B9/*POSIX1003.1B*/ -#defineCTL_UBIX10/*ubixos*/ - -#defineCTL_KERN_OPENFILES1/*kernelopenfiles*/ - -#defineEINVAL-1/**/ - -structsysctl_entry{ -structsysctl_entry*prev; -structsysctl_entry*next; -structsysctl_entry*children; -charname[32]; -intid; -void*value; -intval_len; -}; - -intkern_sysctl(int*name,u_intnamelen,void*old,size_t*oldlenp,void*new,size_tnewlen,size_t*retval,intflags); -intsysctl_add(int*,int,char*,void*,int); -intsysctl_init(); - -externboolsysctl_enabled; -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_KERN_SYSCTL_H +#define_SYS_KERN_SYSCTL_H + +#include<sys/sysproto_posix.h> +#include<sys/thread.h> + +#defineCTL_MAXNAME24/*largestnumberofcomponentssupported*/ + +/* +*Top-levelidentifiers +*/ +#defineCTL_UNSPEC0/*unused*/ +#defineCTL_KERN1/*"highkernel":proc,limits*/ +#defineCTL_VM2/*virtualmemory*/ +#defineCTL_VFS3/*filesystem,mounttypeisnext*/ +#defineCTL_NET4/*network,seesocket.h*/ +#defineCTL_DEBUG5/*debuggingparameters*/ +#defineCTL_HW6/*genericcpu/io*/ +#defineCTL_MACHDEP7/*machinedependent*/ +#defineCTL_USER8/*user-level*/ +#defineCTL_P1003_1B9/*POSIX1003.1B*/ +#defineCTL_UBIX10/*ubixos*/ + +#defineCTL_KERN_OPENFILES1/*kernelopenfiles*/ + +#defineEINVAL-1/**/ + +structsysctl_entry{ +structsysctl_entry*prev; +structsysctl_entry*next; +structsysctl_entry*children; +charname[32]; +intid; +void*value; +intval_len; +intfull_name[CTL_MAXNAME]; +intnamelen; +}; + +intkern_sysctl(int*name,u_intnamelen,void*old,size_t*oldlenp,void*new,size_tnewlen,size_t*retval,intflags); +intsysctl_add(int*,int,char*,void*,int); +intsysctl_init(); + +externboolsysctl_enabled; +#endif/*END_SYS_KERN_SYSCTL_H*/ - + diff --git a/doc/xml/kmalloc_8c.xml b/doc/xml/kmalloc_8c.xml index 347534b..98f4623 100644 --- a/doc/xml/kmalloc_8c.xml +++ b/doc/xml/kmalloc_8c.xml @@ -1,6 +1,6 @@ - - - + + + kmalloc.c lib/kmalloc.h lib/kprintf.h @@ -10,158 +10,357 @@ vmm/vmm.h string.h assert.h + sys/types.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - + + + + + + + struct spinLock + struct spinLock emptyDescSpinLock + + emptyDescSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + struct memDescriptor * + struct memDescriptor* emptyKernDesc + + emptyKernDesc + = 0x0 + + + + + + + + + + struct memDescriptor * + struct memDescriptor* freeKernDesc + + freeKernDesc + = 0x0 + + + + + + + + + + struct spinLock + struct spinLock mallocSpinLock + + mallocSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + struct memDescriptor * + struct memDescriptor* usedKernDesc + + usedKernDesc + = 0x0 + + + + + + + + + - + void * static void* getEmptyDesc () @@ -172,20 +371,9 @@ - - emptyDescSpinLock - emptyKernDesc - kpanic - memset - memDescriptor::next - memDescriptor::prev - spinLock - spinUnlock - vmm_getFreeMallocPage - x1 - kmalloc + - + int static int insertFreeDesc (struct memDescriptor *freeDesc) @@ -200,17 +388,9 @@ - - assert - freeKernDesc - kpanic - memDescriptor::limit - memDescriptor::next - memDescriptor::prev - kfree - kmalloc + - + void void kfree (void *baseAddr) @@ -225,50 +405,42 @@ - - assert - memDescriptor::baseAddr - insertFreeDesc - kprintf - memDescriptor::limit - mallocSpinLock - memset - memDescriptor::next - memDescriptor::prev - spinLock - spinUnlock - usedKernDesc - close - device_remove - elf_loadfile - execFile - fclose - fopen - kmod_load - ldEnable - mpi_destroyMbox - mpi_fetchMessage - ne2kFreeBuffer - operator delete - operator delete[] - sys_exec - sys_write - sysExec - systemTask - ubixfs_cacheDelete - ubixFSmkDir - ubthread_cond_destroy - ubthread_mutex_destroy - vfs_mount - writeUbixFS + + assert + memDescriptor::baseAddr + close + elf_load_file + execFile + falloc + fdestroy + fopen + kmod_load + ldEnable + ne2kFreeBuffer + operator delete + operator delete[] + pciProbe + sdeThread + sem_destroy + sys_read + sys_write + sysExec + systemTask + ubixfs_cacheDelete + ubixFSmkDir + ubthread_cond_destroy + ubthread_mutex_destroy + vfs_mount + writeFileByte + writeUbixFS - + void * void* kmalloc (uInt32 len) kmalloc - uInt32 + uInt32 len @@ -277,168 +449,49 @@ - - assert - memDescriptor::baseAddr - freeKernDesc - getEmptyDesc - insertFreeDesc - kprintf - memDescriptor::limit - MALLOC_ALIGN - mallocSpinLock - memDescriptor::next - memDescriptor::prev - spinLock - spinUnlock - usedKernDesc - addDirEntry - biosCall - devfs_initialize - devfs_makeNode - device_add - elf_loadfile - execFile - falloc - fdc_init - fopen - initHardDisk - initLNC - kmain - kmod_add - kmod_load - ldEnable - lncAttach - mpi_createMbox - mpi_postMessage - mpi_spam - ne2k_init - ne2kAllocBuffer - openFileUbixFS - operator new - operator new[] - sched_init - schedNewTask - sys_exec - sys_write - sysctl_add - sysctl_init - sysExec - tty_init - ubixfs_cacheNew - ubixfs_initialize - ubixFSLoadDir - ubixFSmkDir - ubixFSUnlink - ubthread_cond_init - ubthread_create - ubthread_mutex_init - ufs_openFile - vfs_mount - vfsRegisterFS - vitals_init - writeUbixFS - - - void - static void mergeMemBlocks - () - mergeMemBlocks - - - - - - - - memDescriptor::baseAddr - emptyKernDesc - freeKernDesc - memDescriptor::limit - memDescriptor::next - memDescriptor::prev - - - - - spinLock_t - spinLock_t emptyDescSpinLock - - emptyDescSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - getEmptyDesc - - - struct memDescriptor * - struct memDescriptor* emptyKernDesc - - emptyKernDesc - 0x0 - - - - - - - - getEmptyDesc - mergeMemBlocks - - - struct memDescriptor * - struct memDescriptor* freeKernDesc - - freeKernDesc - 0x0 - - - - - - - - insertFreeDesc - kmalloc - mergeMemBlocks - - - spinLock_t - spinLock_t mallocSpinLock - - mallocSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - kfree - kmalloc - - - struct memDescriptor * - struct memDescriptor* usedKernDesc - - usedKernDesc - 0x0 - - - - - - - - kfree - kmalloc + + spinLock + addDirEntry + biosCall + device_add + dup2 + elf_load_file + execFile + falloc + fcntl + fdc_init + fopen + initLNC + kmod_add + kmod_load + ldEnable + lnc_rxINT + lnc_thread + lncAttach + new_trieNode + operator new + operator new[] + pciProbe + schedNewTask + sem_init + shell_thread + sys_fork + sys_pipe2 + sys_sem_new + sys_thread_new + sys_write + sysExec + sysSDE + ubixfs_cacheNew + ubixfs_initialize + ubixFSLoadDir + ubixFSmkDir + ubthread_cond_init + ubthread_mutex_init + vfs_mount + vitals_init + writeFileByte + writeUbixFS @@ -446,562 +499,555 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kmalloc_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<ubixos/kpanic.h> -#include<ubixos/sched.h> -#include<ubixos/spinlock.h> -#include<vmm/vmm.h> -#include<string.h> -#include<assert.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<ubixos/kpanic.h> +#include<ubixos/sched.h> +#include<ubixos/spinlock.h> +#include<vmm/vmm.h> +#include<string.h> +#include<assert.h> +#include<sys/types.h> /* Setupthreedescriptortables: - -kernDesc-Theinusedescriptortable + +kernDesc-Theinusedescriptortable freeKernDesc-Thefreedescriptortable(descriptorswithmemorybackingjustnotinuse) emptyKernDesc-Theemptydescriptortable(descriptorswithoutamemorybacking) - -*/ -staticstructmemDescriptor*usedKernDesc=0x0; -staticstructmemDescriptor*freeKernDesc=0x0; -staticstructmemDescriptor*emptyKernDesc=0x0; + +*/ +staticstructmemDescriptor*usedKernDesc=0x0; +staticstructmemDescriptor*freeKernDesc=0x0; +staticstructmemDescriptor*emptyKernDesc=0x0; /* Setupourspinlockssowedonotcorruptlinkedlistsifwehavere-entrancy -*/ -staticspinLock_tmallocSpinLock=SPIN_LOCK_INITIALIZER; -staticspinLock_temptyDescSpinLock=SPIN_LOCK_INITIALIZER; +*/ +staticstructspinLockmallocSpinLock=SPIN_LOCK_INITIALIZER; +staticstructspinLockemptyDescSpinLock=SPIN_LOCK_INITIALIZER; /************************************************************************ -Function:void*getEmptyDesc() -Description:FindAnEmptyDescriptor +Function:void*getEmptyDesc() +Description:FindAnEmptyDescriptor -Notes: +Notes: -02/17/03-IsThisEfficient? +02/17/03-IsThisEfficient? -************************************************************************/ -staticvoid*getEmptyDesc(){ +************************************************************************/ +staticvoid*getEmptyDesc(){ inti=0x0; structmemDescriptor*tmpDesc=0x0; -spinLock(&emptyDescSpinLock); - -tmpDesc=emptyKernDesc; - +spinLock(&emptyDescSpinLock); + +tmpDesc=emptyKernDesc; + if(tmpDesc!=0x0){ -emptyKernDesc=tmpDesc->next; -if(emptyKernDesc!=0x0) -emptyKernDesc->prev=0x0; - - -tmpDesc->next=0x0; -tmpDesc->prev=0x0; -spinUnlock(&emptyDescSpinLock); -return(tmpDesc); -} -if((emptyKernDesc=(structmemDescriptor*)vmm_getFreeMallocPage(4))==0x0) -kpanic("Error:vmmGetFreeKernelPagereturnedNULL\n"); - -/*zerooutthememorysoweknowthereisnogarbage*/ -memset(emptyKernDesc,0x0,0x4000); - -emptyKernDesc[0].next=&emptyKernDesc[1]; - -for(i=0x1;i<((0x4000/sizeof(structmemDescriptor)));i++){ -if(i+1<(0x4000/sizeof(structmemDescriptor))) -emptyKernDesc[i].next=&emptyKernDesc[i+1]; -else -emptyKernDesc[i].next=0x0; -emptyKernDesc[i].prev=&emptyKernDesc[i-1]; -} - -tmpDesc=&emptyKernDesc[0]; - -emptyKernDesc=tmpDesc->next; -emptyKernDesc->prev=0x0; -tmpDesc->next=0x0; -tmpDesc->prev=0x0; -spinUnlock(&emptyDescSpinLock); -return(tmpDesc); -} - -/************************************************************************ - -Function:voidinsertFreeDesc(structmemDescriptor*freeDesc) -Description:ThisFunctionInsertsAFreeDescriptorOnTheListWhichIs -KeptInSizeOrder - -Notes: - -02/17/03-ThisWasInspiredByTCA'sGreatWisdom- -"[20:20:59]<TCA>Youshouldjustinsertitinorder" - -************************************************************************/ -staticintinsertFreeDesc(structmemDescriptor*freeDesc){ -structmemDescriptor*tmpDesc=0x0; -assert(freeDesc); - -if(freeDesc->limit<=0x0) -kpanic("InsertingDescriptorwithnolimit\n"); - -if(freeKernDesc!=0x0){ - -#if0 -freeDesc->next=freeKernDesc; -freeDesc->prev=0x0; -freeKernDesc->prev=freeDesc; -freeKernDesc=freeDesc; -#endif - -for(tmpDesc=freeKernDesc;tmpDesc!=0x0;tmpDesc=tmpDesc->next){ -if(freeDesc->limit<=tmpDesc->limit){ - -freeDesc->prev=tmpDesc->prev; -if(tmpDesc->prev!=0x0) -tmpDesc->prev->next=freeDesc; - - -tmpDesc->prev=freeDesc; -freeDesc->next=tmpDesc; - -if(tmpDesc==freeKernDesc) -freeKernDesc=freeDesc; -return(0x0); -} -if(tmpDesc->next==0x0){ -tmpDesc->next=freeDesc; -freeDesc->prev=tmpDesc; -freeDesc->next=0x0; -return(0x0); -} -} -kpanic("didntInsert\n"); -return(0x0); -} -else{ -freeDesc->prev=0x0; -freeDesc->next=0x0; -freeKernDesc=freeDesc; -return(0x0); -} - -return(0x1); -} - -/************************************************************************ - -Function:voidmergeMemBlocks() -Description:ThisFunctionWillMergeFreeBlocksAndFreePages +emptyKernDesc=tmpDesc->next; +if(emptyKernDesc!=0x0) +emptyKernDesc->prev=0x0; + +tmpDesc->next=0x0; +tmpDesc->prev=0x0; +spinUnlock(&emptyDescSpinLock); +return(tmpDesc); +} +if((emptyKernDesc=(structmemDescriptor*)vmm_getFreeMallocPage(4))==0x0) +kpanic("Error:vmmGetFreeKernelPagereturnedNULL\n"); + +/*zerooutthememorysoweknowthereisnogarbage*/ +memset(emptyKernDesc,0x0,0x4000); + +emptyKernDesc[0].next=&emptyKernDesc[1]; + +for(i=0x1;i<((0x4000/sizeof(structmemDescriptor)));i++){ +if(i+1<(0x4000/sizeof(structmemDescriptor))) +emptyKernDesc[i].next=&emptyKernDesc[i+1]; +else +emptyKernDesc[i].next=0x0; +emptyKernDesc[i].prev=&emptyKernDesc[i-1]; +} + +tmpDesc=&emptyKernDesc[0]; + +emptyKernDesc=tmpDesc->next; +emptyKernDesc->prev=0x0; +tmpDesc->next=0x0; +tmpDesc->prev=0x0; +spinUnlock(&emptyDescSpinLock); +return(tmpDesc); +} + +/************************************************************************ + +Function:voidinsertFreeDesc(structmemDescriptor*freeDesc) +Description:ThisFunctionInsertsAFreeDescriptorOnTheListWhichIs +KeptInSizeOrder + +Notes: + +02/17/03-ThisWasInspiredByTCA'sGreatWisdom- +"[20:20:59]<TCA>Youshouldjustinsertitinorder" + +************************************************************************/ +staticintinsertFreeDesc(structmemDescriptor*freeDesc){ +structmemDescriptor*tmpDesc=0x0; +assert(freeDesc); + +if(freeDesc->limit<=0x0) +kpanic("InsertingDescriptorwithnolimit\n"); + +if(freeKernDesc!=0x0){ + +#if0 +freeDesc->next=freeKernDesc; +freeDesc->prev=0x0; +freeKernDesc->prev=freeDesc; +freeKernDesc=freeDesc; +#endif + +for(tmpDesc=freeKernDesc;tmpDesc!=0x0;tmpDesc=tmpDesc->next){ +if(freeDesc->limit<=tmpDesc->limit){ + +freeDesc->prev=tmpDesc->prev; +if(tmpDesc->prev!=0x0) +tmpDesc->prev->next=freeDesc; + +tmpDesc->prev=freeDesc; +freeDesc->next=tmpDesc; + +if(tmpDesc==freeKernDesc) +freeKernDesc=freeDesc; +return(0x0); +} +if(tmpDesc->next==0x0){ +tmpDesc->next=freeDesc; +freeDesc->prev=tmpDesc; +freeDesc->next=0x0; +return(0x0); +} +} +kpanic("didntInsert\n"); +return(0x0); +} +else{ +freeDesc->prev=0x0; +freeDesc->next=0x0; +freeKernDesc=freeDesc; +return(0x0); +} + +return(0x1); +} + +/************************************************************************ + +Function:voidmergeMemBlocks() +Description:ThisFunctionWillMergeFreeBlocksAndFreePages + +Notes: -Notes: +03/05/03-WeHaveAProblemItSeemsTheFirstBlockIsLimit0x0 -03/05/03-WeHaveAProblemItSeemsTheFirstBlockIsLimit0x0 - -************************************************************************/ -staticvoidmergeMemBlocks(){ -structmemDescriptor*tmpDesc1=0x0; -structmemDescriptor*tmpDesc2=0x0; -uInt32baseAddr=0x0; - -return; - -//LoopTheFreeDescriptorsSeeIfWeCanMergeThem -mergeStart: -for(tmpDesc1=freeKernDesc;tmpDesc1!=0x0;tmpDesc1=tmpDesc1->next){ -/* -CompareTheBaseAddrWithTheOtherDescriptorsIfYouFindTheOne -ThatYouAreLookingForLetsMergeThem -*/ -if(tmpDesc1->limit!=0x0){ -baseAddr=(uInt32)tmpDesc1->baseAddr+(uInt32)tmpDesc1->limit; -for(tmpDesc2=freeKernDesc;tmpDesc2;tmpDesc2=tmpDesc2->next){ -if((uInt32)tmpDesc2->baseAddr==baseAddr){ -tmpDesc1->limit+=tmpDesc2->limit; -tmpDesc2->baseAddr=0x0; -tmpDesc2->limit=0x0; -if(tmpDesc2->prev){ -tmpDesc2->prev->next=tmpDesc2->next; -} -if(tmpDesc2->next){ -tmpDesc2->next->prev=tmpDesc2->prev; -} -tmpDesc2->prev=0x0; -tmpDesc2->next=emptyKernDesc; -emptyKernDesc->prev=tmpDesc2; -emptyKernDesc=tmpDesc2; -if(tmpDesc1->prev){ -tmpDesc1->prev->next=tmpDesc1->next; -} -if(tmpDesc1->next){ -tmpDesc1->next->prev=tmpDesc1->prev; -} -tmpDesc1->prev=0x0; -tmpDesc1->next=0x0; -kprintf("mergememBlocks:[%i]\n",tmpDesc1->limit); -insertFreeDesc(tmpDesc1); -//tmpDesc1=freeKernDesc; -gotomergeStart; -break; -} -} -} -} -return; -} - - -/************************************************************************ - -Function:void*kmalloc(uInt32len) -Description:AllocateKernelMemory - -Notes: +************************************************************************/ +#ifdef_IGNORE +staticvoidmergeMemBlocks(){ +structmemDescriptor*tmpDesc1=0x0; +structmemDescriptor*tmpDesc2=0x0; +uInt32baseAddr=0x0; + +return; + +//LoopTheFreeDescriptorsSeeIfWeCanMergeThem +mergeStart:for(tmpDesc1=freeKernDesc;tmpDesc1!=0x0;tmpDesc1=tmpDesc1->next){ +/* +CompareTheBaseAddrWithTheOtherDescriptorsIfYouFindTheOne +ThatYouAreLookingForLetsMergeThem +*/ +if(tmpDesc1->limit!=0x0){ +baseAddr=(uInt32)tmpDesc1->baseAddr+(uInt32)tmpDesc1->limit; +for(tmpDesc2=freeKernDesc;tmpDesc2;tmpDesc2=tmpDesc2->next){ +if((uInt32)tmpDesc2->baseAddr==baseAddr){ +tmpDesc1->limit+=tmpDesc2->limit; +tmpDesc2->baseAddr=0x0; +tmpDesc2->limit=0x0; +if(tmpDesc2->prev){ +tmpDesc2->prev->next=tmpDesc2->next; +} +if(tmpDesc2->next){ +tmpDesc2->next->prev=tmpDesc2->prev; +} +tmpDesc2->prev=0x0; +tmpDesc2->next=emptyKernDesc; +emptyKernDesc->prev=tmpDesc2; +emptyKernDesc=tmpDesc2; +if(tmpDesc1->prev){ +tmpDesc1->prev->next=tmpDesc1->next; +} +if(tmpDesc1->next){ +tmpDesc1->next->prev=tmpDesc1->prev; +} +tmpDesc1->prev=0x0; +tmpDesc1->next=0x0; +kprintf("mergememBlocks:[%i]\n",tmpDesc1->limit); +insertFreeDesc(tmpDesc1); +//tmpDesc1=freeKernDesc; +gotomergeStart; +break; +} +} +} +} +return; +} +#endif + +/************************************************************************ + +Function:void*kmalloc(uInt32len) +Description:AllocateKernelMemory + +Notes: + +02/17/03-DoIStillNeedToPassInThePid? -02/17/03-DoIStillNeedToPassInThePid? - -************************************************************************/ -void*kmalloc(uInt32len){ -structmemDescriptor*tmpDesc1=0x0; -structmemDescriptor*tmpDesc2=0x0; -char*buf=0x0; -inti=0x0; -uInt16pages=0x0; +************************************************************************/ +void*kmalloc(uInt32len){ +structmemDescriptor*tmpDesc1=0x0; +structmemDescriptor*tmpDesc2=0x0; +char*buf=0x0; +inti=0x0; +uInt16pages=0x0; + +spinLock(&mallocSpinLock); - -spinLock(&mallocSpinLock); - -len=MALLOC_ALIGN(len); - - -if(len==0x0){ -spinUnlock(&mallocSpinLock); -kprintf("kmalloc:len=0!\n"); -return(0x0); -} -for(tmpDesc1=freeKernDesc;tmpDesc1!=0x0;tmpDesc1=tmpDesc1->next){ -assert(tmpDesc1); -if(tmpDesc1->limit>=len){ -if(tmpDesc1->prev!=0x0) -tmpDesc1->prev->next=tmpDesc1->next; -if(tmpDesc1->next!=0x0) -tmpDesc1->next->prev=tmpDesc1->prev; - -if(tmpDesc1==freeKernDesc) -freeKernDesc=tmpDesc1->next; - -tmpDesc1->prev=0x0; -tmpDesc1->next=usedKernDesc; -if(usedKernDesc!=0x0) -usedKernDesc->prev=tmpDesc1; -usedKernDesc=tmpDesc1; -if(tmpDesc1->limit>len){ -tmpDesc2=getEmptyDesc(); -assert(tmpDesc2); -tmpDesc2->limit=tmpDesc1->limit-len; -tmpDesc1->limit=len; -tmpDesc2->baseAddr=tmpDesc1->baseAddr+len; -tmpDesc2->next=0x0; -tmpDesc2->prev=0x0; -insertFreeDesc(tmpDesc2); -} -buf=(char*)tmpDesc1->baseAddr; -for(i=0;i<tmpDesc1->limit;i++){ -(char)buf[i]=(char)0x0; -} -spinUnlock(&mallocSpinLock); -//kprintf("m1[%i:%i:0x%X]",tmpDesc1->limit,len,tmpDesc1->baseAddr); -assert(tmpDesc1->baseAddr); -return(tmpDesc1->baseAddr); -} -} -tmpDesc1=getEmptyDesc(); -//kprintf("noemptydesc\n"); -if(tmpDesc1!=0x0){ -pages=((len+4095)/4096); -tmpDesc1->baseAddr=(structmemDescriptor*)vmm_getFreeMallocPage(pages); -tmpDesc1->limit=len; -tmpDesc1->next=usedKernDesc; -tmpDesc1->prev=0x0; -if(usedKernDesc!=0x0) -usedKernDesc->prev=tmpDesc1; -usedKernDesc=tmpDesc1; - -if(((pages*4096)-len)>0x0){ -tmpDesc2=getEmptyDesc(); -assert(tmpDesc2); -tmpDesc2->baseAddr=tmpDesc1->baseAddr+tmpDesc1->limit; -tmpDesc2->limit=((pages*4096)-len); -tmpDesc2->prev=0x0; -tmpDesc2->next=0x0; -if(tmpDesc2->limit<=0x0) -kprintf("kmalloc-2tmpDesc2:[%i]\n",tmpDesc2->limit); -insertFreeDesc(tmpDesc2); -} - -buf=(char*)tmpDesc1->baseAddr; -for(i=0;i<tmpDesc1->limit;i++){ -(char)buf[i]=(char)0x0; -} -spinUnlock(&mallocSpinLock); -//kprintf("baseAddr2[0x%X:0x%X]",tmpDesc1,tmpDesc1->baseAddr); -//kprintf("m2[%i:%i:0x%X]",tmpDesc1->limit,len,tmpDesc1->baseAddr); -assert(tmpDesc1->baseAddr); -return(tmpDesc1->baseAddr); -} -//ReturnNullIfUnableToMalloc -spinUnlock(&mallocSpinLock); -//kprintf("baseAddr3[0x0]"); -return(0x0); -} - -/************************************************************************ - -Function:voidkfree(void*baseAddr) -Description:ThisWillFindTheDescriptorAndFreeIt +len=MALLOC_ALIGN(len); + +if(len==0x0){ +spinUnlock(&mallocSpinLock); +kprintf("kmalloc:len=0!\n"); +return(0x0); +} +for(tmpDesc1=freeKernDesc;tmpDesc1!=0x0;tmpDesc1=tmpDesc1->next){ +assert(tmpDesc1); +if(tmpDesc1->limit>=len){ +if(tmpDesc1->prev!=0x0) +tmpDesc1->prev->next=tmpDesc1->next; +if(tmpDesc1->next!=0x0) +tmpDesc1->next->prev=tmpDesc1->prev; + +if(tmpDesc1==freeKernDesc) +freeKernDesc=tmpDesc1->next; + +tmpDesc1->prev=0x0; +tmpDesc1->next=usedKernDesc; +if(usedKernDesc!=0x0) +usedKernDesc->prev=tmpDesc1; +usedKernDesc=tmpDesc1; +if(tmpDesc1->limit>len){ +tmpDesc2=getEmptyDesc(); +assert(tmpDesc2); +tmpDesc2->limit=tmpDesc1->limit-len; +tmpDesc1->limit=len; +tmpDesc2->baseAddr=tmpDesc1->baseAddr+len; +tmpDesc2->next=0x0; +tmpDesc2->prev=0x0; +insertFreeDesc(tmpDesc2); +} +buf=(char*)tmpDesc1->baseAddr; +for(i=0;i<tmpDesc1->limit;i++){ +buf[i]=(char)0x0; +} +spinUnlock(&mallocSpinLock); +//kprintf("m1[%i:%i:0x%X]",tmpDesc1->limit,len,tmpDesc1->baseAddr); +assert(tmpDesc1->baseAddr); +return(tmpDesc1->baseAddr); +} +} +tmpDesc1=getEmptyDesc(); +//kprintf("noemptydesc\n"); +if(tmpDesc1!=0x0){ +pages=((len+4095)/4096); +tmpDesc1->baseAddr=(structmemDescriptor*)vmm_getFreeMallocPage(pages); +tmpDesc1->limit=len; +tmpDesc1->next=usedKernDesc; +tmpDesc1->prev=0x0; +if(usedKernDesc!=0x0) +usedKernDesc->prev=tmpDesc1; +usedKernDesc=tmpDesc1; + +if(((pages*4096)-len)>0x0){ +tmpDesc2=getEmptyDesc(); +assert(tmpDesc2); +tmpDesc2->baseAddr=tmpDesc1->baseAddr+tmpDesc1->limit; +tmpDesc2->limit=((pages*4096)-len); +tmpDesc2->prev=0x0; +tmpDesc2->next=0x0; +if(tmpDesc2->limit<=0x0) +kprintf("kmalloc-2tmpDesc2:[%i]\n",tmpDesc2->limit); +insertFreeDesc(tmpDesc2); +} + +buf=(char*)tmpDesc1->baseAddr; +for(i=0;i<tmpDesc1->limit;i++){ +buf[i]=(char)0x0; +} +spinUnlock(&mallocSpinLock); +//kprintf("baseAddr2[0x%X:0x%X]",tmpDesc1,tmpDesc1->baseAddr); +//kprintf("m2[%i:%i:0x%X]",tmpDesc1->limit,len,tmpDesc1->baseAddr); +assert(tmpDesc1->baseAddr); +return(tmpDesc1->baseAddr); +} +//ReturnNullIfUnableToMalloc +spinUnlock(&mallocSpinLock); +//kprintf("baseAddr3[0x0]"); +return(0x0); +} + +/************************************************************************ + +Function:voidkfree(void*baseAddr) +Description:ThisWillFindTheDescriptorAndFreeIt + +Notes: + +02/17/03-IneedToMakeItJoinDescriptors -Notes: - -02/17/03-IneedToMakeItJoinDescriptors - -************************************************************************/ -voidkfree(void*baseAddr){ -structmemDescriptor*tmpDesc=0x0; +************************************************************************/ +voidkfree(void*baseAddr){ +structmemDescriptor*tmpDesc=0x0; + +if(baseAddr==0x0) +return; +assert(baseAddr); -if(baseAddr==0x0)return; -assert(baseAddr); +assert(usedKernDesc); +spinLock(&mallocSpinLock); -assert(usedKernDesc); -spinLock(&mallocSpinLock); - -for(tmpDesc=usedKernDesc;tmpDesc!=0x0;tmpDesc=tmpDesc->next){ - -if(tmpDesc->baseAddr==baseAddr){ -memset(tmpDesc->baseAddr,0xBE,tmpDesc->limit); - -if(usedKernDesc==tmpDesc) -usedKernDesc=tmpDesc->next; +for(tmpDesc=usedKernDesc;tmpDesc!=0x0;tmpDesc=tmpDesc->next){ + +if(tmpDesc->baseAddr==baseAddr){ +memset(tmpDesc->baseAddr,0xBE,tmpDesc->limit); + +if(usedKernDesc==tmpDesc) +usedKernDesc=tmpDesc->next; + +if(tmpDesc->prev!=0x0) +tmpDesc->prev->next=tmpDesc->next; -if(tmpDesc->prev!=0x0) -tmpDesc->prev->next=tmpDesc->next; +if(tmpDesc->next!=0x0) +tmpDesc->next->prev=tmpDesc->prev; -if(tmpDesc->next!=0x0) -tmpDesc->next->prev=tmpDesc->prev; +tmpDesc->next=0x0; +tmpDesc->prev=0x0; - -tmpDesc->next=0x0; -tmpDesc->prev=0x0; - -if(tmpDesc->limit<=0x0) -kprintf("kfreetmpDesc1:[%i]\n",tmpDesc->limit); -//kprintf("{0x%X}",tmpDesc->baseAddr); -insertFreeDesc(tmpDesc); - -//mergeMemBlocks(); -spinUnlock(&mallocSpinLock); -return; -} -} -spinUnlock(&mallocSpinLock); -kprintf("Kernel:ErrorFreeingDescriptor![0x%X]\n",(uInt32)baseAddr); -return; -} - -/*** -$Log: kmalloc_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.32006/12/0514:10:21reddawg -WorkignDistro - -Revision1.22006/10/0615:48:01reddawg -StartingtomakeubixosworkwithUFS2 - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.42006/06/0112:42:09reddawg -Gettingbacktothebasics - -Revision1.32006/06/0103:58:33reddawg -wonderingaboutthisstuffhere - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:11reddawg -nomessage +if(tmpDesc->limit<=0x0) +kprintf("kfreetmpDesc1:[%i]\n",tmpDesc->limit); +//kprintf("{0x%X}",tmpDesc->baseAddr); +insertFreeDesc(tmpDesc); + +//mergeMemBlocks(); +spinUnlock(&mallocSpinLock); +return; +} +} +spinUnlock(&mallocSpinLock); +kprintf("Kernel:ErrorFreeingDescriptor![0x%X]\n",(uInt32)baseAddr); +return; +} + +/*** +$Log:kmalloc.c,v$ +Revision1.32006/12/0514:10:21reddawg +WorkignDistro + +Revision1.22006/10/0615:48:01reddawg +StartingtomakeubixosworkwithUFS2 + +Revision1.1.1.12006/06/0112:46:16reddawg +ubix2 + +Revision1.42006/06/0112:42:09reddawg +Gettingbacktothebasics + +Revision1.32006/06/0103:58:33reddawg +wonderingaboutthisstuffhere + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:11reddawg +nomessage + +Revision1.352005/08/0418:32:59fsdfs + +addederrorreporting -Revision1.352005/08/0418:32:59fsdfs - -addederrorreporting - -Revision1.342005/08/0418:23:41reddawg -BUG:Asserthasissuesthatmustbelookedinto +Revision1.342005/08/0418:23:41reddawg +BUG:Asserthasissuesthatmustbelookedinto + +Revision1.332005/08/0417:11:11fsdfs + +---------------------------------------- -Revision1.332005/08/0417:11:11fsdfs +------------------- ----------------------------------------- - -------------------- - -Revision1.322004/09/2821:50:04reddawg -kmalloc:nowwhenwekfreememoryisfilledwith0xBEsoitiseasytodebugifwecontinuetousefree'dmemory - -Revision1.312004/09/1916:17:25reddawg -fixedmemoryleakwenowlosenomemory.... - -Revision1.302004/09/1421:51:24reddawg -Debuginfo - -Revision1.292004/09/1123:39:31reddawg -oktimeforbed - -Revision1.282004/09/1123:21:26reddawg -runnowdoyougetfegfaultswithBB? - -Revision1.272004/09/1122:49:28reddawg -patlookatlines276-285doesthemathseemright? - -Revision1.262004/09/1122:33:13reddawg -minorchanges - -Revision1.252004/09/1112:11:11reddawg -CleaninguptheVFSmorechangestofollow... - -Revision1.242004/09/0823:19:58reddawg -hmm - -Revision1.232004/09/0615:13:25reddawg -LastcommitbeforeFreeBSD6.0 +Revision1.322004/09/2821:50:04reddawg +kmalloc:nowwhenwekfreememoryisfilledwith0xBEsoitiseasytodebugifwecontinuetousefree'dmemory + +Revision1.312004/09/1916:17:25reddawg +fixedmemoryleakwenowlosenomemory.... + +Revision1.302004/09/1421:51:24reddawg +Debuginfo + +Revision1.292004/09/1123:39:31reddawg +oktimeforbed + +Revision1.282004/09/1123:21:26reddawg +runnowdoyougetfegfaultswithBB? + +Revision1.272004/09/1122:49:28reddawg +patlookatlines276-285doesthemathseemright? + +Revision1.262004/09/1122:33:13reddawg +minorchanges + +Revision1.252004/09/1112:11:11reddawg +CleaninguptheVFSmorechangestofollow... + +Revision1.242004/09/0823:19:58reddawg +hmm + +Revision1.232004/09/0615:13:25reddawg +LastcommitbeforeFreeBSD6.0 + +Revision1.222004/08/2622:51:18reddawg +TCAtouchedme:(ithinkhelikesmen.... + -Revision1.222004/08/2622:51:18reddawg -TCAtouchedme:(ithinkhelikesmen.... - - -sched.h:kTask_taddedparentPid -endtask.c:fixedtermbacktoparentPid -exec.c:cleanedwarnings -fork.c:fixedtermtochildPid -sched.c:cleanupfordeadtasks -systemtask.c:cleanupdeadtasks -kmalloc.c:cleanedupwarnings -udp.c:cleanedupwarnings -bot.c:cleanedupwarnings -shell.c:cleanedupwarnings -tcpdump.c:tookadump -hd.c:cleanedupwarnings -ubixfs.c:stoppedprningdebuginfo - -Revision1.212004/07/2815:05:43reddawg -Major: -Pagesnowhavestrictsecurityenforcement. -Manynulldereferenceshavebeenresolved. -Whenappsloadedpermissionssetforpagesrwandro - -Revision1.202004/07/2800:17:05reddawg -Major: -Disconnectedpage0x0fromthesystem...Unfortunatelythisbrokemanythings -allofwhichhavebeenfixed.ThiswasgoodbecausenothingdeferencesNULL -anymore. - -Thingsaffected: -malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file - -Revision1.192004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.182004/07/2616:52:45reddawg -herewego - -Revision1.172004/07/2423:04:44reddawg -Changes...markletmeknowifyoufaultatpid185whenyoutypestress - -Revision1.162004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.152004/07/2023:20:50reddawg -kmalloc:forgottoremoveanassert - -Revision1.142004/07/2023:18:11reddawg -Mademallocalittlemorerobustbutwehaveaseriousmemoryleaksomewhere - -Revision1.132004/07/2022:29:55reddawg -assert:remadeassert - -Revision1.122004/07/2018:58:24reddawg -Fewfixes - -Revision1.112004/07/1805:24:15reddawg -Fixens - -Revision1.102004/07/1718:00:47reddawg -kmalloc:addedassert() - -Revision1.92004/07/1715:54:52reddawg -kmalloc:addedassert() -bioscall:fixedsomepotentialproblembynotmaking16bitcode -paging:addedassert() - -Revision1.82004/06/1714:50:32reddawg -kmalloc:convertedsomevariablestostatic - -Revision1.72004/06/1702:54:54flameshadow -chg:fixedcast +sched.h:kTask_taddedparentPid +endtask.c:fixedtermbacktoparentPid +exec.c:cleanedwarnings +fork.c:fixedtermtochildPid +sched.c:cleanupfordeadtasks +systemtask.c:cleanupdeadtasks +kmalloc.c:cleanedupwarnings +udp.c:cleanedupwarnings +bot.c:cleanedupwarnings +shell.c:cleanedupwarnings +tcpdump.c:tookadump +hd.c:cleanedupwarnings +ubixfs.c:stoppedprningdebuginfo + +Revision1.212004/07/2815:05:43reddawg +Major: +Pagesnowhavestrictsecurityenforcement. +Manynulldereferenceshavebeenresolved. +Whenappsloadedpermissionssetforpagesrwandro + +Revision1.202004/07/2800:17:05reddawg +Major: +Disconnectedpage0x0fromthesystem...Unfortunatelythisbrokemanythings +allofwhichhavebeenfixed.ThiswasgoodbecausenothingdeferencesNULL +anymore. + +Thingsaffected: +malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file + +Revision1.192004/07/2619:15:49reddawg +testcode,fixesandthelike + +Revision1.182004/07/2616:52:45reddawg +herewego + +Revision1.172004/07/2423:04:44reddawg +Changes...markletmeknowifyoufaultatpid185whenyoutypestress + +Revision1.162004/07/2110:02:09reddawg +devfs:renamedfunctions +devicesystem:renamedfunctions +fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables +strol:fixeddefinition +endtask:madeitprintoutfreepagedebuginfo +kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost +ld:fixedapointerconversion +file:cleanedupafewunusedvariables +sched:broketaskdeletion +kprintf:fixedogPrintfdefinition + +Revision1.152004/07/2023:20:50reddawg +kmalloc:forgottoremoveanassert + +Revision1.142004/07/2023:18:11reddawg +Mademallocalittlemorerobustbutwehaveaseriousmemoryleaksomewhere + +Revision1.132004/07/2022:29:55reddawg +assert:remadeassert + +Revision1.122004/07/2018:58:24reddawg +Fewfixes + +Revision1.112004/07/1805:24:15reddawg +Fixens + +Revision1.102004/07/1718:00:47reddawg +kmalloc:addedassert() + +Revision1.92004/07/1715:54:52reddawg +kmalloc:addedassert() +bioscall:fixedsomepotentialproblembynotmaking16bitcode +paging:addedassert() + +Revision1.82004/06/1714:50:32reddawg +kmalloc:convertedsomevariablestostatic + +Revision1.72004/06/1702:54:54flameshadow +chg:fixedcast + +Revision1.62004/05/2611:56:51reddawg +kmalloc:fixedmemrgeMemBlockshopefullyitwillpreventfuturesegfaultissues +bynothavinganymoreoverlappingblocks -Revision1.62004/05/2611:56:51reddawg -kmalloc:fixedmemrgeMemBlockshopefullyitwillpreventfuturesegfaultissues -bynothavinganymoreoverlappingblocks +Revision1.52004/05/2514:01:14reddawg +ImplimentedBetterSpinlockingNoMoreIssuesWithKMALLOCwhichactually +wascausingbizzareproblems -Revision1.52004/05/2514:01:14reddawg -ImplimentedBetterSpinlockingNoMoreIssuesWithKMALLOCwhichactually -wascausingbizzareproblems - -END -***/ - +END +***/ + - + diff --git a/doc/xml/kmalloc_8h.xml b/doc/xml/kmalloc_8h.xml index 6798d39..97bbc9b 100644 --- a/doc/xml/kmalloc_8h.xml +++ b/doc/xml/kmalloc_8h.xml @@ -1,307 +1,435 @@ - - - + + + kmalloc.h - ubixos/types.h - src/sys/devfs/devfs.c - src/sys/init/main.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/ne2k.c - src/sys/kernel/bioscall.c - src/sys/kernel/elf.c - src/sys/kernel/exec.c - src/sys/kernel/gen_calls.c - src/sys/kernel/kern_descrip.c - src/sys/kernel/kern_sig.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/ld.c - src/sys/kernel/sched.c - src/sys/kernel/syscall.c - src/sys/kernel/systemtask.c - src/sys/kernel/tty.c - src/sys/kernel/ubthread.c - src/sys/kernel/vitals.c - src/sys/kmods/kmod.c - src/sys/lib/kmalloc.c - src/sys/lib/libcpp.cc - src/sys/mpi/system.c - src/sys/pci/hd.c - src/sys/pci/lnc.c - src/sys/sys/device.c - src/sys/sys/idt.c - src/sys/ubixfs/dirCache.c - src/sys/ubixfs/directory.c - src/sys/ubixfs/ubixfs.c - src/sys/ufs/ffs.c - src/sys/ufs/ufs.c - src/sys/vfs/file.c - src/sys/vfs/mount.c - src/sys/vfs/vfs.c - src/sys/vmm/paging.c - src/sys/vmm/vmm_memory.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/directory.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/fs/vfs/vfs.c + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/descrip.c + C:/Dev/git/UbixOS/sys/kernel/elf.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_sig.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/sem.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/kernel/vitals.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/kern_trie.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/lib/libcpp.cc + C:/Dev/git/UbixOS/sys/mpi/system.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/pci/hd.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/main.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc + C:/Dev/git/UbixOS/sys/sys/device.c + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + memDescriptor - + MALLOC_ALIGN size - (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE))))) + (size + ((((size) % (MALLOC_ALIGN_SIZE)) == 0)? 0 : ((MALLOC_ALIGN_SIZE) - ((size) % (MALLOC_ALIGN_SIZE))))) - - kmalloc + - + MALLOC_ALIGN_SIZE 32 @@ -310,9 +438,9 @@ - + - + sysID -2 @@ -321,14 +449,11 @@ - - vmm_getFreeMallocPage - vmm_pagingInit - vmmFindFreePage + - + void void kfree (void *baseAddr) @@ -343,50 +468,42 @@ - - assert - memDescriptor::baseAddr - insertFreeDesc - kprintf - memDescriptor::limit - mallocSpinLock - memset - memDescriptor::next - memDescriptor::prev - spinLock - spinUnlock - usedKernDesc - close - device_remove - elf_loadfile - execFile - fclose - fopen - kmod_load - ldEnable - mpi_destroyMbox - mpi_fetchMessage - ne2kFreeBuffer - operator delete - operator delete[] - sys_exec - sys_write - sysExec - systemTask - ubixfs_cacheDelete - ubixFSmkDir - ubthread_cond_destroy - ubthread_mutex_destroy - vfs_mount - writeUbixFS + + assert + memDescriptor::baseAddr + close + elf_load_file + execFile + falloc + fdestroy + fopen + kmod_load + ldEnable + ne2kFreeBuffer + operator delete + operator delete[] + pciProbe + sdeThread + sem_destroy + sys_read + sys_write + sysExec + systemTask + ubixfs_cacheDelete + ubixFSmkDir + ubthread_cond_destroy + ubthread_mutex_destroy + vfs_mount + writeFileByte + writeUbixFS - + void * void* kmalloc (uInt32 len) kmalloc - uInt32 + uInt32 len @@ -395,67 +512,49 @@ - - assert - memDescriptor::baseAddr - freeKernDesc - getEmptyDesc - insertFreeDesc - kprintf - memDescriptor::limit - MALLOC_ALIGN - mallocSpinLock - memDescriptor::next - memDescriptor::prev - spinLock - spinUnlock - usedKernDesc - addDirEntry - biosCall - devfs_initialize - devfs_makeNode - device_add - elf_loadfile - execFile - falloc - fdc_init - fopen - initHardDisk - initLNC - kmain - kmod_add - kmod_load - ldEnable - lncAttach - mpi_createMbox - mpi_postMessage - mpi_spam - ne2k_init - ne2kAllocBuffer - openFileUbixFS - operator new - operator new[] - sched_init - schedNewTask - sys_exec - sys_write - sysctl_add - sysctl_init - sysExec - tty_init - ubixfs_cacheNew - ubixfs_initialize - ubixFSLoadDir - ubixFSmkDir - ubixFSUnlink - ubthread_cond_init - ubthread_create - ubthread_mutex_init - ufs_openFile - vfs_mount - vfsRegisterFS - vitals_init - writeUbixFS + + spinLock + addDirEntry + biosCall + device_add + dup2 + elf_load_file + execFile + falloc + fcntl + fdc_init + fopen + initLNC + kmod_add + kmod_load + ldEnable + lnc_rxINT + lnc_thread + lncAttach + new_trieNode + operator new + operator new[] + pciProbe + schedNewTask + sem_init + shell_thread + sys_fork + sys_pipe2 + sys_sem_new + sys_thread_new + sys_write + sysExec + sysSDE + ubixfs_cacheNew + ubixfs_initialize + ubixFSLoadDir + ubixFSmkDir + ubthread_cond_init + ubthread_mutex_init + vfs_mount + vitals_init + writeFileByte + writeUbixFS @@ -463,107 +562,103 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kmalloc_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_KMALLOC_H -#define_KMALLOC_H - -#include<ubixos/types.h> - -#ifdef__cplusplus -extern"C"{ -#endif - -#definesysID-2 -#defineMALLOC_ALIGN_SIZE32 -#defineMALLOC_ALIGN(size)(size+((((size)%(MALLOC_ALIGN_SIZE))==0)?0:((MALLOC_ALIGN_SIZE)-((size)%(MALLOC_ALIGN_SIZE))))) - -structmemDescriptor{ -structmemDescriptor*prev;//4 -structmemDescriptor*next;//4 -void*baseAddr;//4 -uInt32limit;//4 -/*uInt8status;//1*/ -/*charreserved[11];//11*/ -}; - -voidkfree(void*baseAddr); -void*kmalloc(uInt32len); - -#ifdef__cplusplus -} -#endif - -#endif - -/*** -$Log: kmalloc_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:40reddawg -nomessage - -Revision1.72004/09/1420:57:01reddawg -Bugfixes:macroproblemoveroptamultiply - -Revision1.62004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.52004/07/1902:08:27reddawg -Cleanedouttherestofdebugingcodealsotemporarilydisabledtheipstacktoimproveboottime - -Revision1.42004/07/1805:24:15reddawg -Fixens - -Revision1.32004/05/2115:00:27reddawg -Cleanedup - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_LIB_KMALLOC_H +#define_LIB_KMALLOC_H + +#include<sys/types.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +#definesysID-2 +#defineMALLOC_ALIGN_SIZE32 +#defineMALLOC_ALIGN(size)(size+((((size)%(MALLOC_ALIGN_SIZE))==0)?0:((MALLOC_ALIGN_SIZE)-((size)%(MALLOC_ALIGN_SIZE))))) + +structmemDescriptor{ +structmemDescriptor*prev;//4 +structmemDescriptor*next;//4 +void*baseAddr;//4 +uInt32limit;//4 +/*uInt8status;//1*/ +/*charreserved[11];//11*/ +}; + +voidkfree(void*baseAddr); +void*kmalloc(uInt32len); + +#ifdef__cplusplus +} +#endif + +#endif + +/*** +$Log:kmalloc.h,v$ +Revision1.1.1.12006/06/0112:46:13reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:40reddawg +nomessage + +Revision1.72004/09/1420:57:01reddawg +Bugfixes:macroproblemoveroptamultiply + +Revision1.62004/07/2110:02:09reddawg +devfs:renamedfunctions +devicesystem:renamedfunctions +fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables +strol:fixeddefinition +endtask:madeitprintoutfreepagedebuginfo +kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost +ld:fixedapointerconversion +file:cleanedupafewunusedvariables +sched:broketaskdeletion +kprintf:fixedogPrintfdefinition + +Revision1.52004/07/1902:08:27reddawg +Cleanedouttherestofdebugingcodealsotemporarilydisabledtheipstacktoimproveboottime + +Revision1.42004/07/1805:24:15reddawg +Fixens + +Revision1.32004/05/2115:00:27reddawg +Cleanedup + +END +***/ - + diff --git a/doc/xml/kmod_8c.xml b/doc/xml/kmod_8c.xml index 1aff0d4..edea4be 100644 --- a/doc/xml/kmod_8c.xml +++ b/doc/xml/kmod_8c.xml @@ -1,224 +1,573 @@ - - - + + + kmod.c - ubixos/types.h + sys/types.h ubixos/kmod.h ubixos/sched.h - ubixos/elf.h + sys/elf.h ubixos/kpanic.h ubixos/lists.h ubixos/spinlock.h lib/kprintf.h lib/kmalloc.h - vfs/vfs.h + vfs/vfs.h vmm/vmm.h string.h assert.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + - - - - + + + + + + - - - + + + + + - + - + - + - + - - - - + + + + + + + + + + + + - - - - + + + + - + - + + + + + - - - - + + + + - - - - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + - + + + + + - + + + + + - + - - - - + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + + + + + - + + + + + - - - - + + + + - - - - - + + + + + + + + + + List_t * + List_t* List + + List + = 0x0 + + + + + + + + kmod_add + + - - uInt32 + + uInt32 uInt32 kmod_add (const char *kmod_file, const char *name) kmod_add - const char * + const char * kmod_file - const char * + const char * name @@ -227,24 +576,24 @@ - - CreateItem - _item_t::data - InitializeList - InsertItemAtFront - kmalloc - kmod_load - kprintf - List - NULL + + CreateItem + _item_t::data + InitializeList + InsertItemAtFront + kmalloc + kmod_load + kprintf + List + NULL - - uInt32 + + uInt32 uInt32 kmod_load (const char *kmod_file) kmod_load - const char * + const char * kmod_file @@ -253,62 +602,34 @@ - - _current - assert - elfHeader::eEntry - ELF32_R_SYM - ELF32_R_TYPE - elfGetRelType - elfHeader::ePhnum - elfHeader::ePhoff - elfHeader::eShnum - elfHeader::eShoff - elfHeader::eShstrndx - fclose - fopen - fread - fseek - taskStruct::id - kfree - kmalloc - kpanic - kprintf - LD_START - memset - PAGE_DEFAULT - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - PT_DYNAMIC - PT_GNU_STACK - PT_LOAD - PT_PAX_FLAGS - R_386_32 - R_386_PC32 - R_386_RELATIVE - elfSectionHeader::shSize - strcmp - vmm_remapPage - vmmFindFreePage - x1000 - kmod_add - - - - - List_t * - List_t* List - - List - 0x0 - - - - - - - - kmod_add + + _current + assert + ELF32_R_SYM + ELF32_R_TYPE + elfGetRelType + fclose + fopen + fread + fseek + taskStruct::id + kfree + kmalloc + kpanic + kprintf + LD_START + memset + PAGE_DEFAULT + PT_DYNAMIC + PT_GNU_STACK + PT_LOAD + R_386_32 + R_386_PC32 + R_386_RELATIVE + strcmp + vmm_findFreePage + vmm_remapPage + kmod_add @@ -316,222 +637,218 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kmod_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<ubixos/kmod.h> -#include<ubixos/sched.h> -#include<ubixos/elf.h> -#include<ubixos/kpanic.h> -#include<ubixos/lists.h> -#include<ubixos/spinlock.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<vfs/vfs.h> -#include<vmm/vmm.h> -#include<string.h> -#include<assert.h> - -List_t*List=0x0; - -uInt32kmod_add(constchar*kmod_file,constchar*name) -{ -uInt32addr=0x0; -Item_t*tmp; -kmod_t*kmods; - - -addr=kmod_load(kmod_file); -if(addr==0x0) -return0x0; - -if(List==0x0) -{ -List=InitializeList(); -} - -tmp=CreateItem(); -InsertItemAtFront(List,tmp); -kmods=kmalloc(sizeof*kmods); -tmp->data=kmods; -if(kmods==NULL) -{ -kprintf("kmod_add:unabletoallocatememory!\n"); -return0x0; -} - -return0x0; -} - -uInt32kmod_load(constchar*kmod_file){ -inti=0x0; -intx=0x0; -intrel=0x0; -intsym=0x0; -char*newLoc=0x0; -char*shStr=0x0; -char*dynStr=0x0; -uInt32*reMap=0x0; -fileDescriptor*kmod_fd=0x0; -elfHeader*binaryHeader=0x0; -elfProgramHeader*programHeader=0x0; -elfSectionHeader*sectionHeader=0x0; -elfDynSym*relSymTab=0x0; -elfPltInfo*elfRel=0x0; - -/*Openkernelmodule*/ -kmod_fd=fopen(kmod_file,"rb"); -if(kmod_fd==0x0){ -kprintf("Cannotopen%s\n",kmod_file); -return0x0; -} - -/*loadmoduleheader*/ -fseek(kmod_fd,0x0,0x0); -binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)); -if(binaryHeader==0x0) -{ -kprintf("kmod:outofmemory\n"); -return0x0; -} - -assert(binaryHeader); -fread(binaryHeader,sizeof(elfHeader),1,kmod_fd); - -programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum); -assert(programHeader); -fseek(kmod_fd,binaryHeader->ePhoff,0); -fread(programHeader,sizeof(elfSectionHeader),binaryHeader->ePhnum,kmod_fd); - -sectionHeader=(elfSectionHeader*)kmalloc(sizeof(elfSectionHeader)*binaryHeader->eShnum); -assert(sectionHeader); -fseek(kmod_fd,binaryHeader->eShoff,0); -fread(sectionHeader,sizeof(elfSectionHeader),binaryHeader->eShnum,kmod_fd); - -shStr=(char*)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); -fseek(kmod_fd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); -fread(shStr,sectionHeader[binaryHeader->eShstrndx].shSize,1,kmod_fd); - -for(i=0;i<binaryHeader->ePhnum;i++){ -switch(programHeader[i].phType){ -casePT_LOAD: -casePT_DYNAMIC: -newLoc=(char*)programHeader[i].phVaddr+LD_START; -/* -AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect -Settingssoithelpsusinthefuture -*/ -for(x=0;x<((programHeader[i].phMemsz)+4095);x+=0x1000){ -/*maker/worro*/ -if((vmm_remapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x+LD_START),PAGE_DEFAULT))==0x0) -kpanic("vmmRemapPage:ld\n"); -memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x+LD_START),0x0,0x1000); -} -/*NowLoadSectionToMemory*/ -fseek(kmod_fd,programHeader[i].phOffset,0x0); -fread(newLoc,programHeader[i].phFilesz,1,kmod_fd); -break; -casePT_GNU_STACK: -/*Tellsusifthestackshouldbeexecutable.Failsafetoexecutable -untilweaddchecking*/ -break; -casePT_PAX_FLAGS: -/*Notsure...*/ -break; -default: -kprintf("UnhandledHeader:%08x\n",programHeader[i].phType); -break; -} -} - -for(i=0x0;i<binaryHeader->eShnum;i++){ -switch(sectionHeader[i].shType){ -case3: -if(!strcmp((shStr+sectionHeader[i].shName),".dynstr")){ -dynStr=(char*)kmalloc(sectionHeader[i].shSize); -fseek(kmod_fd,sectionHeader[i].shOffset,0x0); -fread(dynStr,sectionHeader[i].shSize,1,kmod_fd); -} -break; -case9: -elfRel=(elfPltInfo*)kmalloc(sectionHeader[i].shSize); -fseek(kmod_fd,sectionHeader[i].shOffset,0x0); -fread(elfRel,sectionHeader[i].shSize,1,kmod_fd); - -for(x=0x0;x<sectionHeader[i].shSize/sizeof(elfPltInfo);x++){ -rel=ELF32_R_SYM(elfRel[x].pltInfo); -reMap=(uInt32*)((uInt32)LD_START+elfRel[x].pltOffset); -switch(ELF32_R_TYPE(elfRel[x].pltInfo)){ -caseR_386_32: -*reMap+=((uInt32)LD_START+relSymTab[rel].dynValue); -break; -caseR_386_PC32: -*reMap+=((uInt32)LD_START+relSymTab[rel].dynValue)-(uInt32)reMap; -break; -caseR_386_RELATIVE: -*reMap+=(uInt32)LD_START; -break; -default: -kprintf("[0x%X][0x%X](%i)[%s]\n",elfRel[x].pltOffset,elfRel[x].pltInfo,rel,elfGetRelType(ELF32_R_TYPE(elfRel[x].pltInfo))); -kprintf("relTab[%s][0x%X][0x%X]\n",dynStr+relSymTab[rel].dynName,relSymTab[rel].dynValue,relSymTab[rel].dynName); -break; -} -} -kfree(elfRel); -break; -case11: -relSymTab=(elfDynSym*)kmalloc(sectionHeader[i].shSize); -fseek(kmod_fd,sectionHeader[i].shOffset,0x0); -fread(relSymTab,sectionHeader[i].shSize,1,kmod_fd); -sym=i; -break; -} -} - -i=binaryHeader->eEntry+LD_START; - -kfree(dynStr); -kfree(shStr); -kfree(relSymTab); -kfree(sectionHeader); -kfree(programHeader); -kfree(binaryHeader); -fclose(kmod_fd); - -return((uInt32)i); -} - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/types.h> +#include<ubixos/kmod.h> +#include<ubixos/sched.h> +#include<sys/elf.h> +#include<ubixos/kpanic.h> +#include<ubixos/lists.h> +#include<ubixos/spinlock.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<vfs/vfs.h> +#include<vmm/vmm.h> +#include<string.h> +#include<assert.h> + +List_t*List=0x0; + +uInt32kmod_add(constchar*kmod_file,constchar*name){ +uInt32addr=0x0; +Item_t*tmp; +kmod_t*kmods; + +addr=kmod_load(kmod_file); +if(addr==0x0) +return0x0; + +if(List==0x0){ +List=InitializeList(); +} + +tmp=CreateItem(); +InsertItemAtFront(List,tmp); +kmods=kmalloc(sizeof*kmods); +tmp->data=kmods; +if(kmods==NULL){ +kprintf("kmod_add:unabletoallocatememory!\n"); +return0x0; +} + +return0x0; +} + +uInt32kmod_load(constchar*kmod_file){ +inti=0x0; +intx=0x0; +intrel=0x0; +intsym=0x0; +char*newLoc=0x0; +char*shStr=0x0; +char*dynStr=0x0; +uInt32*reMap=0x0; +fileDescriptor*kmod_fd=0x0; +elfHeader*binaryHeader=0x0; +elfProgramHeader*programHeader=0x0; +elfSectionHeader*sectionHeader=0x0; +elfDynSym*relSymTab=0x0; +elfPltInfo*elfRel=0x0; + +/*Openkernelmodule*/ +kmod_fd=fopen(kmod_file,"rb"); +if(kmod_fd==0x0){ +kprintf("Cannotopen%s\n",kmod_file); +return0x0; +} + +/*loadmoduleheader*/ +fseek(kmod_fd,0x0,0x0); +binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)); +if(binaryHeader==0x0){ +kprintf("kmod:outofmemory\n"); +return0x0; +} + +assert(binaryHeader); +fread(binaryHeader,sizeof(elfHeader),1,kmod_fd); + +programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum); +assert(programHeader); +fseek(kmod_fd,binaryHeader->ePhoff,0); +fread(programHeader,sizeof(elfSectionHeader),binaryHeader->ePhnum,kmod_fd); + +sectionHeader=(elfSectionHeader*)kmalloc(sizeof(elfSectionHeader)*binaryHeader->eShnum); +assert(sectionHeader); +fseek(kmod_fd,binaryHeader->eShoff,0); +fread(sectionHeader,sizeof(elfSectionHeader),binaryHeader->eShnum,kmod_fd); + +shStr=(char*)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); +fseek(kmod_fd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); +fread(shStr,sectionHeader[binaryHeader->eShstrndx].shSize,1,kmod_fd); + +for(i=0;i<binaryHeader->ePhnum;i++){ +switch(programHeader[i].phType){ +casePT_LOAD: +casePT_DYNAMIC: +newLoc=(char*)programHeader[i].phVaddr+LD_START; +/* +AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect +Settingssoithelpsusinthefuture +*/ +for(x=0;x<((programHeader[i].phMemsz)+4095);x+=0x1000){ +/*maker/worro*/ +if((vmm_remapPage(vmm_findFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x+LD_START),PAGE_DEFAULT))==0x0) +kpanic("vmmRemapPage:ld\n"); +memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x+LD_START),0x0,0x1000); +} +/*NowLoadSectionToMemory*/ +fseek(kmod_fd,programHeader[i].phOffset,0x0); +fread(newLoc,programHeader[i].phFilesz,1,kmod_fd); +break; +casePT_GNU_STACK: +/*Tellsusifthestackshouldbeexecutable.Failsafetoexecutable +untilweaddchecking*/ +break; +#ifdef_IGNORE +casePT_PAX_FLAGS: +/*Notsure...*/ +break; +#endif +default: +kprintf("UnhandledHeader:%08x\n",programHeader[i].phType); +break; +} +} + +for(i=0x0;i<binaryHeader->eShnum;i++){ +switch(sectionHeader[i].shType){ +case3: +if(!strcmp((shStr+sectionHeader[i].shName),".dynstr")){ +dynStr=(char*)kmalloc(sectionHeader[i].shSize); +fseek(kmod_fd,sectionHeader[i].shOffset,0x0); +fread(dynStr,sectionHeader[i].shSize,1,kmod_fd); +} +break; +case9: +elfRel=(elfPltInfo*)kmalloc(sectionHeader[i].shSize); +fseek(kmod_fd,sectionHeader[i].shOffset,0x0); +fread(elfRel,sectionHeader[i].shSize,1,kmod_fd); + +for(x=0x0;x<sectionHeader[i].shSize/sizeof(elfPltInfo);x++){ +rel=ELF32_R_SYM(elfRel[x].pltInfo); +reMap=(uInt32*)((uInt32)LD_START+elfRel[x].pltOffset); +switch(ELF32_R_TYPE(elfRel[x].pltInfo)){ +caseR_386_32: +*reMap+=((uInt32)LD_START+relSymTab[rel].dynValue); +break; +caseR_386_PC32: +*reMap+=((uInt32)LD_START+relSymTab[rel].dynValue)-(uInt32)reMap; +break; +caseR_386_RELATIVE: +*reMap+=(uInt32)LD_START; +break; +default: +kprintf("[0x%X][0x%X](%i)[%s]\n",elfRel[x].pltOffset,elfRel[x].pltInfo,rel,elfGetRelType(ELF32_R_TYPE(elfRel[x].pltInfo))); +kprintf("relTab[%s][0x%X][0x%X]\n",dynStr+relSymTab[rel].dynName,relSymTab[rel].dynValue,relSymTab[rel].dynName); +break; +} +} +kfree(elfRel); +break; +case11: +relSymTab=(elfDynSym*)kmalloc(sectionHeader[i].shSize); +fseek(kmod_fd,sectionHeader[i].shOffset,0x0); +fread(relSymTab,sectionHeader[i].shSize,1,kmod_fd); +sym=i; +break; +} +} + +i=binaryHeader->eEntry+LD_START; + +kfree(dynStr); +kfree(shStr); +kfree(relSymTab); +kfree(sectionHeader); +kfree(programHeader); +kfree(binaryHeader); +fclose(kmod_fd); + +return((uInt32)i); +} + +/*** +END +***/ - + diff --git a/doc/xml/kmod_8h.xml b/doc/xml/kmod_8h.xml index 0e6af68..6c73f73 100644 --- a/doc/xml/kmod_8h.xml +++ b/doc/xml/kmod_8h.xml @@ -1,42 +1,80 @@ - - - + + + kmod.h - ubixos/types.h - src/sys/kmods/kmod.c + sys/types.h + C:/Dev/git/UbixOS/sys/kmods/kmod.c - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - + + - - - - + + + + kmod_struct - + LD_START 0x1000000 @@ -45,14 +83,12 @@ - - kmod_load - ldEnable + - - kmod_struct + + struct kmod_struct typedef struct kmod_struct kmod_t kmod_t @@ -62,20 +98,20 @@ - + - - uInt32 + + uInt32 uInt32 kmod_add (const char *, const char *name) kmod_add - const char * + const char * - const char * + const char * name @@ -84,24 +120,24 @@ - - CreateItem - _item_t::data - InitializeList - InsertItemAtFront - kmalloc - kmod_load - kprintf - List - NULL + + CreateItem + _item_t::data + InitializeList + InsertItemAtFront + kmalloc + kmod_load + kprintf + List + NULL - - uInt32 + + uInt32 uInt32 kmod_load (const char *) kmod_load - const char * + const char * @@ -109,45 +145,34 @@ - - _current - assert - elfHeader::eEntry - ELF32_R_SYM - ELF32_R_TYPE - elfGetRelType - elfHeader::ePhnum - elfHeader::ePhoff - elfHeader::eShnum - elfHeader::eShoff - elfHeader::eShstrndx - fclose - fopen - fread - fseek - taskStruct::id - kfree - kmalloc - kpanic - kprintf - LD_START - memset - PAGE_DEFAULT - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - PT_DYNAMIC - PT_GNU_STACK - PT_LOAD - PT_PAX_FLAGS - R_386_32 - R_386_PC32 - R_386_RELATIVE - elfSectionHeader::shSize - strcmp - vmm_remapPage - vmmFindFreePage - x1000 - kmod_add + + _current + assert + ELF32_R_SYM + ELF32_R_TYPE + elfGetRelType + fclose + fopen + fread + fseek + taskStruct::id + kfree + kmalloc + kpanic + kprintf + LD_START + memset + PAGE_DEFAULT + PT_DYNAMIC + PT_GNU_STACK + PT_LOAD + R_386_32 + R_386_PC32 + R_386_RELATIVE + strcmp + vmm_findFreePage + vmm_remapPage + kmod_add @@ -155,90 +180,55 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kmod_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_KMOD_H -#define_KMOD_H - -#include<ubixos/types.h> - -#defineLD_START0x1000000 - -typedefstructkmod_struct{ -structkmod_struct*next; -structkmod_struct*prev; -uInt16id; -uInt16refs; -uInt32address; -charname[128]; -}kmod_t; - - -uInt32kmod_load(constchar*); -uInt32kmod_add(constchar*,constchar*name); - -#endif - -/*** -$Log: kmod_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:55reddawg -nomessage - -Revision1.52005/08/0420:35:19fsdfs - -variousupdates.mostlykprints,tabbingcodetolookcleaner - -Revision1.42004/09/2620:46:13reddawg -oktimeforbedaddedkmod_addkeepsmoduleslistednow - -Revision1.32004/09/2620:40:51reddawg -AddedbaseAddrtothekmod_t - -Revision1.22004/09/2620:39:19reddawg -Addedkmodstructtypekmod_t - -Revision1.12004/09/2007:33:10reddawg -Startofkernelmoduleswillmakeitmuchmoreflexable-Thesemodulescanbeeitherinkernelthreadsorsystemservices... - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_KMOD_H +#define_UBIXOS_KMOD_H + +#include<sys/types.h> + +#defineLD_START0x1000000 + +typedefstructkmod_struct{ +structkmod_struct*next; +structkmod_struct*prev; +uInt16id; +uInt16refs; +uInt32address; +charname[128]; +}kmod_t; + +uInt32kmod_load(constchar*); +uInt32kmod_add(constchar*,constchar*name); + +#endif - + diff --git a/doc/xml/kpanic_8h.xml b/doc/xml/kpanic_8h.xml index 0fa2110..5ebfaba 100644 --- a/doc/xml/kpanic_8h.xml +++ b/doc/xml/kpanic_8h.xml @@ -1,350 +1,1940 @@ - - - + + + kpanic.h - src/sys/devfs/devfs.c - src/sys/init/main.c - src/sys/isa/atkbd.c - src/sys/isa/ne2k.c - src/sys/kernel/elf.c - src/sys/kernel/exec.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/kpanic.c - src/sys/kernel/ld.c - src/sys/kernel/sched.c - src/sys/kernel/smp.c - src/sys/kernel/systemtask.c - src/sys/kernel/tty.c - src/sys/kernel/vitals.c - src/sys/kmods/kmod.c - src/sys/lib/assert.c - src/sys/lib/kmalloc.c - src/sys/lib/kprintf.c - src/sys/sys/idt.c - src/sys/ubixfs/thread.c - src/sys/ubixfs/ubixfs.c - src/sys/ufs/ffs.c - src/sys/ufs/ufs.c - src/sys/vfs/file.c - src/sys/vfs/mount.c - src/sys/vmm/copyvirtualspace.c - src/sys/vmm/getfreepage.c - src/sys/vmm/getfreevirtualpage.c - src/sys/vmm/pagefault.c - src/sys/vmm/paging.c - src/sys/vmm/setpageattributes.c - src/sys/vmm/vmm_init.c - src/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/kpanic.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/kpanic.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/thread.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/include/net/arch.h + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/elf.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/sem.c + C:/Dev/git/UbixOS/sys/kernel/smp.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/kernel/vitals.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/assert.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/lib/kprintf.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/net/netif/tcpdump.c + C:/Dev/git/UbixOS/sys/sde/ogDisplay_UbixOS.cc + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/copyvirtualspace.c + C:/Dev/git/UbixOS/sys/vmm/getfreepage.c + C:/Dev/git/UbixOS/sys/vmm/getfreevirtualpage.c + C:/Dev/git/UbixOS/sys/vmm/pagefault.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/setpageattributes.c + C:/Dev/git/UbixOS/sys/vmm/vmm_init.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/vmm/vmm_mmap.c - - - + + + - - - - + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + K_PANIC msg - kpanic("Error: (%s), File: %s, Line: %i\n",msg ,__FILE__,__LINE__); + kpanic("Error: (%s), File: %s, Line: %i\n",msg ,__FILE__,__LINE__); - - __assert - __sysctl - devfs_initialize - elf_loadfile - execFile - keyboardHandler - ldEnable - obreak - sys_exec - sysExec - vmm_getFreeMallocPage - vmm_init - vmm_pagingInit - vmm_remapPage - vmmGetFreeKernelPage - vmmGetFreeVirtualPage - vmmMapFromTask + - + void void kpanic (const char *fmt,...) kpanic - const char * + const char * fmt ... -print panic message and halt system +print panic message and halt system + fmt -panic message +panic message + - + + - - irqDisable - kprintf - NULL - tty_foreground - vaEnd - vaStart - vsprintf - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int8 - _int9 - cpuidDetect - cpuInfo - dp_recv - execFile - execThread - getEmptyDesc - insertFreeDesc - kmain - kmod_load - PCtoNIC - readUbixFS - sched_init - schedNewTask - sysExec - systemTask - tty_change - tty_init - ubixfs_init - ubixfs_thread - ufs_init - vitals_init - vmm_pageFault - vmm_setPageAttributes - vmmCopyVirtualSpace - vmmFindFreePage - vmmGetFreePage - vmmGetFreeVirtualPage + + irqDisable + kprintf + NULL + tty_foreground + va_end + va_start + vsprintf + cpuidDetect + cpuInfo + execFile + execThread + fat_init + kmod_load + lnc_sendPacket + PCtoNIC + readUbixFS + schedNewTask + ogDisplay_UbixOS::SetMode + sys_call + sys_call_posix + sys_mmap + sysExec + systemTask + tcpdump_init + tty_change + ubthread_mutex_lock + ubthread_mutex_unlock + vitals_init + vmm_allocPageTable + vmm_findFreePage + vmm_getFreeKernelPage + vmm_remapPage + vmm_setPageAttributes @@ -352,49 +1942,43 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kpanic_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_KPANIC_H -#define_KPANIC_H - -#defineK_PANIC(msg)kpanic("Error:(%s),File:%s,Line:%i\n",msg,__FILE__,__LINE__); - -voidkpanic(constchar*fmt,...); - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_KPANIC_H +#define_SYS_KPANIC_H + +#defineK_PANIC(msg)kpanic("Error:(%s),File:%s,Line:%i\n",msg,__FILE__,__LINE__); + +voidkpanic(constchar*fmt,...); + +#endif/*END_SYS_KPANIC_H*/ - + diff --git a/doc/xml/kprintf_8c.xml b/doc/xml/kprintf_8c.xml index 3a67ba5..09871e1 100644 --- a/doc/xml/kprintf_8c.xml +++ b/doc/xml/kprintf_8c.xml @@ -1,63 +1,272 @@ - - - + + + kprintf.c lib/kprintf.h + string.h sys/video.h ubixos/kpanic.h - stdarg.h - - - - - - - - - - - - - - + + + + - + - - - - + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + + uu + + + PCHAR + c + {int cc=(c); if (func) (*func)(cc,arg); else *d++ = cc; retval++; } + + + + + + + + + + + + int + int ogprintOff + + ogprintOff + = 0x1 + + + + + + + + kprintf + sdeThread + systemTask + + + int + int printOff + + printOff + = 0x0 + + + + + + + + kprintf + sdeThread + ogDisplay_UbixOS::SetMode + systemTask + + - + + u_quad_t + u_quad_t __qdivrem + (u_quad_t uq, u_quad_t vq, u_quad_t *arq) + __qdivrem + + u_quad_t + uq + + + u_quad_t + vq + + + u_quad_t * + arq + + + + + + + + + B + COMBINE + H + HHALF + L + LHALF + uu::q + uu::ul + uu::uq + __umoddi3 + + + void + static void __shl + (register digit *p, register int len, register int sh) + __shl + + register digit * + p + + + register int + len + + + register int + sh + + + + + + + + + + + u_quad_t + u_quad_t __umoddi3 + (u_quad_t a, u_quad_t b) + __umoddi3 + + u_quad_t + a + + + u_quad_t + b + + + + + + + + + __qdivrem + + + __inline int + static __inline int imax + (int a, int b) + imax + + int + a + + + int + b + + + + + + + + + + int int kprintf (const char *fmt,...) kprintf - const char * + const char * fmt @@ -69,14 +278,182 @@ - - kprint - printOff - vaEnd - vaStart - vsprintf + + kprint + kvprintf + NULL + ogPrintf + ogprintOff + printOff + va_end + va_start + __assert + access + addDirEntry + apicMagic + arp_arp_input + biosCall + close + device_add + die_if_kernel + dup2 + execFile + fat_initialize + fcntl + fdestroy + ffs_read + fopen + fork_copyProcess + freebsd6_mmap + fstat + getdtablesize + getfd + getgid + getpid + gettimeofday_new + getuid + hdInit + hdRead + hdWrite + i8259_init + initLNC + invalidCall + invalidCall_posix + InvalidSystemCall + kern_openat + kmod_add + kmod_load + kpanic + ldEnable + lnc_INT + lnc_switchDWord + lncAttach + lncInt + mouseHandler + open_fat + pci_init + pciProbe + pit_init + qT + read + read_fat + readlink + sdeThread + sem_init + sys_call + sys_call_posix + sys_close + sys_fopen + sys_fseek + sys_fwrite + sys_getrlimit + sys_invalid + sys_ioctl + sys_lseek + sys_mpiPostMessage + sys_open + sys_openat + sys_pread + sys_read + sys_readlink + sys_sem_new + sys_setrlimit + sys_setsockopt + sys_sigprocmask + sys_socket + sys_sysarch + sys_write + sysAuth + sysExec + sysMkDir + sysPasswd + sysSDE + systemTask + ubixfs_initialize + ubthread_mutex_lock + ubthread_mutex_unlock + ufs_writeFile + vfs_init + vfs_mount + vitals_init + vmm_pageFault + vmm_pagingInit + write_fat - + + char * + static char * ksprintn + (char *nbuf, uintmax_t num, int base, int *lenp, int upper) + ksprintn + + char * + nbuf + + + uintmax_t + num + + + int + base + + + int * + lenp + + + int + upper + + + + + + + + + + + int + int kvprintf + (const char *fmt, void(*func)(int, void *), void *arg, int radix, va_list ap) + kvprintf + + const char * + fmt + + + void(*)(int, void *) + func + + + void * + arg + + + int + radix + + + va_list + ap + + + + + + + + + MAXNBUF + NULL + PCHAR + uu::q + va_arg + kprintf + sprintf + + int int sprintf (char *buf, const char *fmt,...) @@ -86,7 +463,7 @@ buf - const char * + const char * fmt @@ -98,40 +475,22 @@ - - vaEnd - vaStart - vsprintf - - - - - int - int ogprintOff - - ogprintOff - 0x1 - - - - - - - - - - int - int printOff - - printOff - 0x0 - - - - - - - + + kvprintf + NULL + va_end + va_start + fopen + sys_chdir + sys_fchdir + sys_fstatfs + sys_getcwd + sys_statfs + sysGetCwd + sysMkDir + ubixFSLoadDir + ubixFSmkDir + vfs_mount @@ -139,70 +498,689 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kprintf_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<lib/kprintf.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<lib/kprintf.h> +#include<string.h> #include<sys/video.h> #include<ubixos/kpanic.h> -#include<stdarg.h> - -intprintOff=0x0; -intogprintOff=0x1; - -intkprintf(constchar*fmt,...){ -charbuf[512]; -vaListargs; -inti=0x0; -vaStart(args,fmt); -i=vsprintf(buf,fmt,args); -vaEnd(args); -if(printOff==0x0) -kprint(buf); - -return(i); -} - -intsprintf(char*buf,constchar*fmt,...){ -vaListargs; -inti; -vaStart(args,fmt); -i=vsprintf(buf,fmt,args); -vaEnd(args); -return(i); -} - -/*** -END -***/ + +staticchar*ksprintn(char*nbuf,uintmax_tnum,intbase,int*lenp,intupper); + +static__inlineintimax(inta,intb){ +return(a>b?a:b); +} + +unionuu{ +quad_tq;/*asa(signed)quad*/ +quad_tuq;/*asanunsignedquad*/ +longsl[2];/*astwosignedlongs*/ +u_longul[2];/*astwounsignedlongs*/ +}; + +staticvoid__shl(registerdigit*p,registerintlen,registerintsh){ +registerinti; + +for(i=0;i<len;i++) +p[i]=LHALF(p[i]<<sh)|(p[i+1]>>(HALF_BITS-sh)); + +p[i]=LHALF(p[i]<<sh); +} + +u_quad_t__qdivrem(u_quad_tuq,u_quad_tvq,u_quad_t*arq){ +unionuutmp; +digit*u,*v,*q; +registerdigitv1,v2; +u_longqhat,rhat,t; +intm,n,d,j,i; +digituspace[5],vspace[5],qspace[5]; +/* +*Takecareofspecialcases:dividebyzero,andu<v. +*/ +if(vq==0){ +/*dividebyzero.*/ +staticconstvolatileunsignedintzero=0; + +tmp.ul[H]=tmp.ul[L]=1/zero; +if(arq) +*arq=uq; +return(tmp.q); +} +if(uq<vq){ +if(arq) +*arq=uq; +return(0); +} +u=&uspace[0]; +v=&vspace[0]; +q=&qspace[0]; + +/* +*BreakdividendanddivisorintodigitsinbaseB,then +*countleadingzerostodeterminemandn.Whendone,we +*willhave: +*u=(u[1]u[2]...u[m+n])subB +*v=(v[1]v[2]...v[n])subB +*v[1]!=0 +*1<n<=4(ifn=1,weuseadifferentdivisionalgorithm) +*m>=0(otherwiseu<v,whichwealreadychecked) +*m+n=4 +*andthus +*m=4-n<=2 +*/ +tmp.uq=uq; +u[0]=0; +u[1]=HHALF(tmp.ul[H]); +u[2]=LHALF(tmp.ul[H]); +u[3]=HHALF(tmp.ul[L]); +u[4]=LHALF(tmp.ul[L]); +tmp.uq=vq; +v[1]=HHALF(tmp.ul[H]); +v[2]=LHALF(tmp.ul[H]); +v[3]=HHALF(tmp.ul[L]); +v[4]=LHALF(tmp.ul[L]); +for(n=4;v[1]==0;v++){ +if(--n==1){ +u_longrbj;/*r*B+u[j](notrootboyjim)*/ +digitq1,q2,q3,q4; + +/* +*Changeofplan,perexercise16. +*r=0; +*forj=1..4: +*q[j]=floor((r*B+u[j])/v), +*r=(r*B+u[j])%v; +*Weunrollthiscompletelyhere. +*/ +t=v[2];/*nonzero,bydefinition*/ +q1=u[1]/t; +rbj=COMBINE(u[1]%t,u[2]); +q2=rbj/t; +rbj=COMBINE(rbj%t,u[3]); +q3=rbj/t; +rbj=COMBINE(rbj%t,u[4]); +q4=rbj/t; +if(arq) +*arq=rbj%t; +tmp.ul[H]=COMBINE(q1,q2); +tmp.ul[L]=COMBINE(q3,q4); +return(tmp.q); +} +} +/* +*Byadjustingqoncewedeterminem,wecanguaranteethat +*thereisacompletefour-digitquotientat&qspace[1]when +*wefinallystop. +*/ +for(m=4-n;u[1]==0;u++) +m--; +for(i=4-m;--i>=0;) +q[i]=0; +q+=4-m; + +/* +*HerewerunProgramD,translatedfromMIXtoCandacquiring +*afewminorchanges. +* +*D1:choosemultiplier1<<dtoensurev[1]>=B/2. +*/ +d=0; +for(t=v[1];t<B/2;t<<=1) +d++; +if(d>0){ +__shl(&u[0],m+n,d);/*u<<=d*/ +__shl(&v[1],n-1,d);/*v<<=d*/ +} +/* +*D2:j=0. +*/ +j=0; +v1=v[1];/*forD3--notethatv[1..n]areconstant*/ +v2=v[2];/*forD3*/ +do{ +registerdigituj0,uj1,uj2; + +/* +*D3:Calculateqhat(\^q,inTeXnotation). +*Letqhat=min((u[j]*B+u[j+1])/v[1],B-1),and +*letrhat=(u[j]*B+u[j+1])modv[1]. +*Whilerhat<Bandv[2]*qhat>rhat*B+u[j+2], +*decrementqhatandincreaserhatcorrespondingly. +*Notethatifrhat>=B,v[2]*qhat<rhat*B. +*/ +uj0=u[j+0];/*forD3only--notethatu[j+...]change*/ +uj1=u[j+1];/*forD3only*/ +uj2=u[j+2];/*forD3only*/ +if(uj0==v1){ +qhat=B; +rhat=uj1; +gotoqhat_too_big; +} +else{ +u_longnn=COMBINE(uj0,uj1); +qhat=nn/v1; +rhat=nn%v1; +} +while(v2*qhat>COMBINE(rhat,uj2)){ +qhat_too_big:qhat--; +if((rhat+=v1)>=B) +break; +} +/* +*D4:Multiplyandsubtract. +*Thevariable`t'holdsanyborrowsacrosstheloop. +*Wesplitthisupsothatwedonotrequirev[0]=0, +*andtoeliminateafinalspecialcase. +*/ +for(t=0,i=n;i>0;i--){ +t=u[i+j]-v[i]*qhat-t; +u[i+j]=LHALF(t); +t=(B-HHALF(t))&(B-1); +} +t=u[j]-t; +u[j]=LHALF(t); +/* +*D5:testremainder. +*ThereisaborrowifandonlyifHHALF(t)isnonzero; +*inthat(rare)case,qhatwastoolarge(byexactly1). +*Fixitbyaddingv[1..n]tou[j..j+n]. +*/ +if(HHALF(t)){ +qhat--; +for(t=0,i=n;i>0;i--){/*D6:addback.*/ +t+=u[i+j]+v[i]; +u[i+j]=LHALF(t); +t=HHALF(t); +} +u[j]=LHALF(u[j]+t); +} +q[j]=qhat; +}while(++j<=m);/*D7:looponj.*/ + +/* +*Ifcallerwantstheremainder,wehavetocalculateitas +*u[m..m+n]>>d(thisisatmostndigitsandthusfitsin +*u[m+1..m+n],butwemayneedmoresourcedigits). +*/ +if(arq){ +if(d){ +for(i=m+n;i>m;--i) +u[i]=(u[i]>>d)|LHALF(u[i-1]<<(HALF_BITS-d)); +u[i]=0; +} +tmp.ul[H]=COMBINE(uspace[1],uspace[2]); +tmp.ul[L]=COMBINE(uspace[3],uspace[4]); +*arq=tmp.q; +} + +tmp.ul[H]=COMBINE(qspace[1],qspace[2]); +tmp.ul[L]=COMBINE(qspace[3],qspace[4]); +return(tmp.q); +} + +u_quad_t__umoddi3(a,b) +u_quad_ta,b;{ +u_quad_tr; + +(void)__qdivrem(a,b,&r); +return(r); +} + +intprintOff=0x0; +intogprintOff=0x1; + +intkprintf(constchar*fmt,...){ +va_listap; +intretval; +charbuf[512]; + +va_start(ap,fmt); + +retval=kvprintf(fmt,NULL,&buf,10,ap); +buf[retval]='\0'; +va_end(ap); + +if(printOff==0x0) +kprint(buf); +if(ogprintOff==0x0) +ogPrintf(buf); + +return(retval); +} + +intsprintf(char*buf,constchar*fmt,...){ +va_listargs; +inti; +va_start(args,fmt); +/*i=vsprintf(buf,fmt,args);*/ +i=kvprintf(fmt,NULL,buf,10,args); +va_end(args); +return(i); +} + +/* +*Scaleddownversionofprintf(3). +* +*Twoadditionalformats: +* +*Theformat%bissupportedtodecodeerrorregisters. +*Itsusageis: +* +*printf("reg=%b\n",regval,"<base><arg>*"); +* +*where<base>istheoutputbaseexpressedasacontrolcharacter,e.g. +*\10givesoctal;\20giveshex.Eachargisasequenceofcharacters, +*thefirstofwhichgivesthebitnumbertobeinspected(origin1),and +*thenextcharacters(uptoacontrolcharacter,i.e.acharacter<=32), +*givethenameoftheregister.Thus: +* +*kvprintf("reg=%b\n",3,"\10\2BITTWO\1BITONE\n"); +* +*wouldproduceoutput: +* +*reg=3<BITTWO,BITONE> +* +*XXX:%D--Hexdump,takespointerandseparatorstring: +*("%6D",ptr,":")->XX:XX:XX:XX:XX:XX +*("%*D",len,ptr,""->XXXXXXXX... +*/ + +intkvprintf(constchar*fmt,void(*func)(int,void*),void*arg,intradix,va_listap){ +#definePCHAR(c){intcc=(c);if(func)(*func)(cc,arg);else*d++=cc;retval++;} +charnbuf[MAXNBUF]; +char*d; +constchar*p,*percent,*q; +u_char*up; +intch,n; +uintmax_tnum; +intbase,lflag,qflag,tmp,width,ladjust,sharpflag,neg,sign,dot; +intcflag,hflag,jflag,tflag,zflag; +intdwidth,upper; +charpadc; +intstop=0,retval=0; + +num=0; +if(!func) +d=(char*)arg; +else +d=NULL; + +if(fmt==NULL) +fmt="(fmtnull)\n"; + +if(radix<2||radix>36) +radix=10; + +for(;;){ +padc=''; +width=0; +while((ch=(u_char)*fmt++)!='%'||stop){ +if(ch=='\0') +return(retval); +PCHAR(ch); +} +percent=fmt-1; +qflag=0; +lflag=0; +ladjust=0; +sharpflag=0; +neg=0; +sign=0; +dot=0; +dwidth=0; +upper=0; +cflag=0; +hflag=0; +jflag=0; +tflag=0; +zflag=0; +reswitch:switch(ch=(u_char)*fmt++){ +case'.': +dot=1; +gotoreswitch; +case'#': +sharpflag=1; +gotoreswitch; +case'+': +sign=1; +gotoreswitch; +case'-': +ladjust=1; +gotoreswitch; +case'%': +PCHAR(ch) +; +break; +case'*': +if(!dot){ +width=va_arg(ap,int); +if(width<0){ +ladjust=!ladjust; +width=-width; +} +} +else{ +dwidth=va_arg(ap,int); +} +gotoreswitch; +case'0': +if(!dot){ +padc='0'; +gotoreswitch; +} +case'1': +case'2': +case'3': +case'4': +case'5': +case'6': +case'7': +case'8': +case'9': +for(n=0;;++fmt){ +n=n*10+ch-'0'; +ch=*fmt; +if(ch<'0'||ch>'9') +break; +} +if(dot) +dwidth=n; +else +width=n; +gotoreswitch; +case'b': +num=(u_int)va_arg(ap,int); +p=va_arg(ap,char*); +for(q=ksprintn(nbuf,num,*p++,NULL,0);*q;) +PCHAR(*q--) +; + +if(num==0) +break; + +for(tmp=0;*p;){ +n=*p++; +if(num&(1<<(n-1))){ +PCHAR(tmp?',':'<'); +for(;(n=*p)>'';++p) +PCHAR(n); +tmp=1; +} +else +for(;*p>'';++p) +continue; +} +if(tmp) +PCHAR('>') +; +break; +case'c': +PCHAR(va_arg(ap,int)) +; +break; +case'D': +up=va_arg(ap,u_char*); +p=va_arg(ap,char*); +if(!width) +width=16; +while(width--){ +PCHAR(hex2ascii(*up>>4)); +PCHAR(hex2ascii(*up&0x0f)); +up++; +if(width) +for(q=p;*q;q++) +PCHAR(*q); +} +break; +case'd': +case'i': +base=10; +sign=1; +gotohandle_sign; +case'h': +if(hflag){ +hflag=0; +cflag=1; +} +else +hflag=1; +gotoreswitch; +case'j': +jflag=1; +gotoreswitch; +case'l': +if(lflag){ +lflag=0; +qflag=1; +} +else +lflag=1; +gotoreswitch; +case'n': +if(jflag) +*(va_arg(ap,intmax_t*))=retval; +elseif(qflag) +*(va_arg(ap,quad_t*))=retval; +elseif(lflag) +*(va_arg(ap,long*))=retval; +elseif(zflag) +*(va_arg(ap,size_t*))=retval; +elseif(hflag) +*(va_arg(ap,short*))=retval; +elseif(cflag) +*(va_arg(ap,char*))=retval; +else +*(va_arg(ap,int*))=retval; +break; +case'o': +base=8; +gotohandle_nosign; +case'p': +base=16; +sharpflag=(width==0); +sign=0; +num=(uintptr_t)va_arg(ap,void*); +gotonumber; +case'q': +qflag=1; +gotoreswitch; +case'r': +base=radix; +if(sign) +gotohandle_sign; +gotohandle_nosign; +case's': +p=va_arg(ap,char*); +if(p==NULL) +p="(null)"; +if(!dot) +n=strlen(p); +else +for(n=0;n<dwidth&&p[n];n++) +continue; + +width-=n; + +if(!ladjust&&width>0) +while(width--) +PCHAR(padc) +; +while(n--) +PCHAR(*p++) +; +if(ladjust&&width>0) +while(width--) +PCHAR(padc) +; +break; +case't': +tflag=1; +gotoreswitch; +case'u': +base=10; +gotohandle_nosign; +case'X': +upper=1; +case'x': +base=16; +gotohandle_nosign; +case'y': +base=16; +sign=1; +gotohandle_sign; +case'z': +zflag=1; +gotoreswitch; +handle_nosign:sign=0; +if(jflag) +num=va_arg(ap,uintmax_t); +elseif(qflag) +num=va_arg(ap,u_quad_t); +elseif(tflag) +num=va_arg(ap,ptrdiff_t); +elseif(lflag) +num=va_arg(ap,u_long); +elseif(zflag) +num=va_arg(ap,size_t); +elseif(hflag) +num=(u_short)va_arg(ap,int); +elseif(cflag) +num=(u_char)va_arg(ap,int); +else +num=va_arg(ap,u_int); +gotonumber; +handle_sign:if(jflag) +num=va_arg(ap,intmax_t); +elseif(qflag) +num=va_arg(ap,quad_t); +elseif(tflag) +num=va_arg(ap,ptrdiff_t); +elseif(lflag) +num=va_arg(ap,long); +elseif(zflag) +num=va_arg(ap,ssize_t); +elseif(hflag) +num=(short)va_arg(ap,int); +elseif(cflag) +num=(char)va_arg(ap,int); +else +num=va_arg(ap,int); +number:if(sign&&(intmax_t)num<0){ +neg=1; +num=-(intmax_t)num; +} +p=ksprintn(nbuf,num,base,&n,upper); +tmp=0; +if(sharpflag&&num!=0){ +if(base==8) +tmp++; +elseif(base==16) +tmp+=2; +} +if(neg) +tmp++; + +if(!ladjust&&padc=='0') +dwidth=width-tmp; +width-=tmp+imax(dwidth,n); +dwidth-=n; +if(!ladjust) +while(width-->0) +PCHAR('') +; +if(neg) +PCHAR('-') +; +if(sharpflag&&num!=0){ +if(base==8){ +PCHAR('0'); +} +elseif(base==16){ +PCHAR('0'); +PCHAR('x'); +} +} +while(dwidth-->0) +PCHAR('0') +; + +while(*p) +PCHAR(*p--) +; + +if(ladjust) +while(width-->0) +PCHAR('') +; + +break; +default: +while(percent<fmt) +PCHAR(*percent++) +; +/* +*Sinceweignoreaformattingargumentitisno +*longersafetoobeytheremainingformatting +*argumentsastheargumentswillnolongermatch +*theformatspecs. +*/ +stop=1; +break; +} +} +#undefPCHAR +return(0); +} + +staticchar*ksprintn(char*nbuf,uintmax_tnum,intbase,int*lenp,intupper){ +char*p,c; + +p=nbuf; +*p='\0'; + +do{ +c=hex2ascii(num%base); +*++p=upper?toupper(c):c; +}while(num/=base); + +if(lenp) +*lenp=p-nbuf; + +return(p); +} + +/*** +END +***/ + - + diff --git a/doc/xml/kprintf_8h.xml b/doc/xml/kprintf_8h.xml index 552b307..a8bb546 100644 --- a/doc/xml/kprintf_8h.xml +++ b/doc/xml/kprintf_8h.xml @@ -1,384 +1,2109 @@ - - - + + + kprintf.h - ubixos/types.h - src/sys/devfs/devfs.c - src/sys/init/main.c - src/sys/init/static.c - src/sys/isa/8259.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/mouse.c - src/sys/isa/ne2k.c - src/sys/isa/pit.c - src/sys/kernel/endtask.c - src/sys/kernel/exec.c - src/sys/kernel/gen_calls.c - src/sys/kernel/kern_descrip.c - src/sys/kernel/kern_sig.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/kpanic.c - src/sys/kernel/ld.c - src/sys/kernel/pipe.c - src/sys/kernel/sched.c - src/sys/kernel/smp.c - src/sys/kernel/syscall.c - src/sys/kernel/syscall_new.c - src/sys/kernel/systemtask.c - src/sys/kernel/time.c - src/sys/kernel/tty.c - src/sys/kernel/ubthread.c - src/sys/kernel/vitals.c - src/sys/kmods/kmod.c - src/sys/lib/assert.c - src/sys/lib/kmalloc.c - src/sys/lib/kprintf.c - src/sys/lib/net.c - src/sys/pci/hd.c - src/sys/pci/lnc.c - src/sys/pci/pci.c - src/sys/sys/device.c - src/sys/sys/idt.c - src/sys/ubixfs/dirCache.c - src/sys/ubixfs/directory.c - src/sys/ubixfs/thread.c - src/sys/ubixfs/ubixfs.c - src/sys/ufs/ffs.c - src/sys/ufs/ufs.c - src/sys/vfs/file.c - src/sys/vfs/mount.c - src/sys/vfs/vfs.c - src/sys/vmm/pagefault.c - src/sys/vmm/paging.c - src/sys/vmm/vmm_memory.c + sys/types.h + stdarg.h + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/kpanic.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/kpanic.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/trap.c + C:/Dev/git/UbixOS/sys/fs/common/gpt.c + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/directory.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/thread.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/fs/vfs/stat.c + C:/Dev/git/UbixOS/sys/fs/vfs/vfs.c + C:/Dev/git/UbixOS/sys/include/net/arch.h + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/isa/8259.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/mouse.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/isa/pit.c + C:/Dev/git/UbixOS/sys/kernel/descrip.c + C:/Dev/git/UbixOS/sys/kernel/elf.c + C:/Dev/git/UbixOS/sys/kernel/endtask.c + C:/Dev/git/UbixOS/sys/kernel/execve.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_sig.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/pipe.c + C:/Dev/git/UbixOS/sys/kernel/signal.c + C:/Dev/git/UbixOS/sys/kernel/smp.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/kernel/time.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/kernel/vitals.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/assert.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/lib/kprintf.c + C:/Dev/git/UbixOS/sys/lib/net.c + C:/Dev/git/UbixOS/sys/net/api/sockets.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/net/net/udpecho.c + C:/Dev/git/UbixOS/sys/net/netif/arp.c + C:/Dev/git/UbixOS/sys/pci/hd.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/pci/pci.c + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/main.cc + C:/Dev/git/UbixOS/sys/sde/ogDisplay_UbixOS.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc + C:/Dev/git/UbixOS/sys/sys/device.c + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/getfreevirtualpage.c + C:/Dev/git/UbixOS/sys/vmm/pagefault.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/vmm/vmm_mmap.c - - - - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + + + - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MAXNBUF + 512 + + + + + + + + + + + + int + int ogprintOff + + ogprintOff + + + + + + + + kprintf + sdeThread + systemTask + + + int + int printOff + + printOff + + + + + + + + kprintf + sdeThread + ogDisplay_UbixOS::SetMode + systemTask + + - + int int kprintf - (const char *fmt,...) + (const char *,...) kprintf - const char * - fmt + const char * ... @@ -389,14 +2114,149 @@ - - kprint - printOff - vaEnd - vaStart - vsprintf + + kprint + kvprintf + NULL + ogPrintf + ogprintOff + printOff + va_end + va_start + __assert + access + addDirEntry + apicMagic + arp_arp_input + biosCall + close + device_add + die_if_kernel + dup2 + execFile + fat_initialize + fcntl + fdestroy + ffs_read + fopen + fork_copyProcess + freebsd6_mmap + fstat + getdtablesize + getfd + getgid + getpid + gettimeofday_new + getuid + hdInit + hdRead + hdWrite + i8259_init + initLNC + invalidCall + invalidCall_posix + InvalidSystemCall + kern_openat + kmod_add + kmod_load + kpanic + ldEnable + lnc_INT + lnc_switchDWord + lncAttach + lncInt + mouseHandler + open_fat + pci_init + pciProbe + pit_init + qT + read + read_fat + readlink + sdeThread + sem_init + sys_call + sys_call_posix + sys_close + sys_fopen + sys_fseek + sys_fwrite + sys_getrlimit + sys_invalid + sys_ioctl + sys_lseek + sys_mpiPostMessage + sys_open + sys_openat + sys_pread + sys_read + sys_readlink + sys_sem_new + sys_setrlimit + sys_setsockopt + sys_sigprocmask + sys_socket + sys_sysarch + sys_write + sysAuth + sysExec + sysMkDir + sysPasswd + sysSDE + systemTask + ubixfs_initialize + ubthread_mutex_lock + ubthread_mutex_unlock + ufs_writeFile + vfs_init + vfs_mount + vitals_init + vmm_pageFault + vmm_pagingInit + write_fat - + + int + int kvprintf + (char const *fmt, void(*func)(int, void *), void *arg, int radix, va_list ap) + kvprintf + + char const * + fmt + + + void(*)(int, void *) + func + + + void * + arg + + + int + radix + + + va_list + ap + + + + + + + + + MAXNBUF + NULL + PCHAR + uu::q + va_arg + kprintf + sprintf + + int int ogPrintf (char *) @@ -410,38 +2270,46 @@ - - vitalsStruct::font - vitalsStruct::screen - systemVitals + + vitalsStruct::font + vitalsStruct::screen + systemVitals + kprintf - - - + int - int ogprintOff - - ogprintOff + int sprintf + (char *buf, const char *fmt,...) + sprintf + + char * + buf + + + const char * + fmt + + + ... + - - - - int - int printOff - - printOff - - - - - - - + + fopen + sys_chdir + sys_fchdir + sys_fstatfs + sys_getcwd + sys_statfs + sysGetCwd + sysMkDir + ubixFSLoadDir + ubixFSmkDir + vfs_mount @@ -449,69 +2317,70 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: kprintf_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_KPRINTF_H -#define_KPRINTF_H - -#include<ubixos/types.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_KPRINTF_H +#define_KPRINTF_H + +#include<sys/types.h> +#include<stdarg.h> -intkprintf(constchar*fmt,...); -intogPrintf(char*); - -externintprintOff; -externintogprintOff; - -#endif - -/*** -$Log: kprintf_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:51 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:40reddawg -nomessage - -Revision1.22004/05/2115:00:27reddawg -Cleanedup - +#defineMAXNBUF512 + +intkprintf(constchar*,...); +intsprintf(char*buf,constchar*fmt,...); +intkvprintf(charconst*fmt,void(*func)(int,void*),void*arg,intradix,va_listap); +intogPrintf(char*); + +externintprintOff; +externintogprintOff; + +#endif + +/*** +$Log:kprintf.h,v$ +Revision1.1.1.12006/06/0112:46:13reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:40reddawg +nomessage -END -***/ +Revision1.22004/05/2115:00:27reddawg +Cleanedup + + +END +***/ - + diff --git a/doc/xml/ld_8c.xml b/doc/xml/ld_8c.xml index 28364a5..771f350 100644 --- a/doc/xml/ld_8c.xml +++ b/doc/xml/ld_8c.xml @@ -1,247 +1,576 @@ - - - + + + ld.c - ubixos/types.h ubixos/ld.h ubixos/sched.h - ubixos/elf.h + sys/elf.h ubixos/kpanic.h lib/kprintf.h lib/kmalloc.h - vfs/vfs.h + vfs/vfs.h vmm/vmm.h string.h assert.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - + + + + - - - - + + + + - - - - + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + + + + + - + + + + + - - - - + + + + - - - - - + + + + + + + - - uInt32 - uInt32 ldEnable - () + + uint32_t + uint32_t ldEnable + (const char *interp) ldEnable + + const char * + interp + - - _current - assert - elfHeader::eEntry - ELF32_R_SYM - ELF32_R_TYPE - elfGetRelType - elfHeader::ePhnum - elfHeader::ePhoff - elfHeader::eShnum - elfHeader::eShoff - elfHeader::eShstrndx - fclose - fopen - fread - fseek - taskStruct::id - K_PANIC - kfree - kmalloc - kprintf - LD_START - memset - PAGE_DEFAULT - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - PT_DYNAMIC - PT_GNU_STACK - PT_LOAD - PT_PAX_FLAGS - R_386_32 - R_386_PC32 - R_386_RELATIVE - elfSectionHeader::shSize - strcmp - vmm_remapPage - vmmFindFreePage - x1000 - sysExec + + _current + assert + ELF32_R_SYM + ELF32_R_TYPE + elfGetRelType + fclose + fopen + fread + fseek + taskStruct::id + K_PANIC + kfree + kmalloc + kprintf + LD_START + memset + PAGE_DEFAULT + PT_DYNAMIC + PT_GNU_STACK + PT_LOAD + R_386_32 + R_386_NONE + R_386_PC32 + R_386_RELATIVE + SHT_DYNAMIC + SHT_DYNSYM + SHT_HASH + SHT_PROGBITS + SHT_REL + SHT_STRTAB + SHT_SYMTAB + strcmp + vmm_findFreePage + vmm_remapPage @@ -249,188 +578,201 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ld_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<ubixos/ld.h> -#include<ubixos/sched.h> -#include<ubixos/elf.h> -#include<ubixos/kpanic.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<vfs/vfs.h> -#include<vmm/vmm.h> -#include<string.h> -#include<assert.h> - -uInt32ldEnable(){ -inti=0x0; -intx=0x0; -intrel=0x0; -intsym=0x0; -char*newLoc=0x0; -char*shStr=0x0; -char*dynStr=0x0; -uInt32*reMap=0x0; -fileDescriptor*ldFd=0x0; -elfHeader*binaryHeader=0x0; -elfProgramHeader*programHeader=0x0; -elfSectionHeader*sectionHeader=0x0; -elfDynSym*relSymTab=0x0; -elfPltInfo*elfRel=0x0; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/ld.h> +#include<ubixos/sched.h> +#include<sys/elf.h> +#include<ubixos/kpanic.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<vfs/vfs.h> +#include<vmm/vmm.h> +#include<string.h> +#include<assert.h> + +uint32_tldEnable(constchar*interp){ +inti=0x0; +intx=0x0; +intrel=0x0; +intsym=0x0; +char*newLoc=0x0; +char*shStr=0x0; +char*dynStr=0x0; +uint32_t*reMap=0x0; +fileDescriptor_t*ldFd=0x0; +Elf_Ehdr*binaryHeader=0x0; +Elf_Phdr*programHeader=0x0; +Elf_Shdr*sectionHeader=0x0; +Elf_Sym*relSymTab=0x0; +Elf_Rel*elfRel=0x0; +Elf_Rela*elfRela=0x0; +Elf_Addraddr; /*Openourdynamiclinker*/ -ldFd=fopen("sys:/lib/ld.so","rb"); +ldFd=fopen(interp,"rb"); if(ldFd==0x0){ -kprintf("Cannotopenld.so\n"); -} - -fseek(ldFd,0x0,0x0); -binaryHeader=(elfHeader*)kmalloc(sizeof(elfHeader)); -assert(binaryHeader); -fread(binaryHeader,sizeof(elfHeader),1,ldFd); +ldFd=fopen("sys:/libexec/ld.so","rb"); +if(ldFd==0x0) +return(0x0); +} + +fseek(ldFd,0x0,0x0); +binaryHeader=(Elf32_Ehdr*)kmalloc(sizeof(Elf32_Ehdr)); -programHeader=(elfProgramHeader*)kmalloc(sizeof(elfProgramHeader)*binaryHeader->ePhnum); -assert(programHeader); -fseek(ldFd,binaryHeader->ePhoff,0); -fread(programHeader,sizeof(elfSectionHeader),binaryHeader->ePhnum,ldFd); - -sectionHeader=(elfSectionHeader*)kmalloc(sizeof(elfSectionHeader)*binaryHeader->eShnum); -assert(sectionHeader); -fseek(ldFd,binaryHeader->eShoff,0); -fread(sectionHeader,sizeof(elfSectionHeader),binaryHeader->eShnum,ldFd); - -shStr=(char*)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); -fseek(ldFd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); -fread(shStr,sectionHeader[binaryHeader->eShstrndx].shSize,1,ldFd); +assert(binaryHeader); +fread(binaryHeader,sizeof(Elf32_Ehdr),1,ldFd); + +programHeader=(Elf_Phdr*)kmalloc(sizeof(Elf_Phdr)*binaryHeader->e_phnum); +assert(programHeader); + +fseek(ldFd,binaryHeader->e_phoff,0); +fread(programHeader,sizeof(Elf_Shdr),binaryHeader->e_phnum,ldFd); + +sectionHeader=(Elf_Shdr*)kmalloc(sizeof(Elf_Shdr)*binaryHeader->e_shnum); +assert(sectionHeader); +fseek(ldFd,binaryHeader->e_shoff,0); +fread(sectionHeader,sizeof(Elf_Shdr),binaryHeader->e_shnum,ldFd); -for(i=0x0;i<binaryHeader->ePhnum;i++){ -switch(programHeader[i].phType){ -casePT_LOAD: -newLoc=(char*)programHeader[i].phVaddr+LD_START; -/* -AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect -Settingssoithelpsusinthefuture -*/ -for(x=0;x<(programHeader[i].phMemsz);x+=0x1000){ -/*maker/worro*/ -if((vmm_remapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr&0xFFFFF000)+x+LD_START),PAGE_DEFAULT))==0x0) -K_PANIC("vmmRemapPage:ld"); -memset((void*)((programHeader[i].phVaddr&0xFFFFF000)+x+LD_START),0x0,0x1000); -} -/*NowLoadSectionToMemory*/ -fseek(ldFd,programHeader[i].phOffset,0x0); -fread(newLoc,programHeader[i].phFilesz,1,ldFd); - -break; -casePT_DYNAMIC: -/*NowLoadSectionToMemory*/ -fseek(ldFd,programHeader[i].phOffset,0x0); -fread(newLoc,programHeader[i].phFilesz,1,ldFd); -break; -casePT_GNU_STACK: -/*Tellsusifthestackshouldbeexecutable.Failsafetoexecutable -untilweaddchecking*/ -break; -casePT_PAX_FLAGS: -/*Notsure...*/ -break; -default: -kprintf("UnhandledHeader(kernel):%08x\n",programHeader[i].phType); -break; -} +shStr=(char*)kmalloc(sectionHeader[binaryHeader->e_shstrndx].sh_size); +fseek(ldFd,sectionHeader[binaryHeader->e_shstrndx].sh_offset,0); +fread(shStr,sectionHeader[binaryHeader->e_shstrndx].sh_size,1,ldFd); + +for(i=0x0;i<binaryHeader->e_phnum;i++){ +switch(programHeader[i].p_type){ +casePT_LOAD: +newLoc=(char*)programHeader[i].p_vaddr+LD_START; +/* +AllocateMemoryImGoingToHaveToMakeThisLoadMemoryWithCorrect +Settingssoithelpsusinthefuture +*/ +for(x=0;x<(programHeader[i].p_memsz);x+=0x1000){ +/*maker/worro*/ +if((vmm_remapPage(vmm_findFreePage(_current->id),((programHeader[i].p_vaddr&0xFFFFF000)+x+LD_START),PAGE_DEFAULT,_current->id,0))==0x0) +K_PANIC("vmmRemapPage:ld"); +memset((void*)((programHeader[i].p_vaddr&0xFFFFF000)+x+LD_START),0x0,0x1000); +} +/*NowLoadSectionToMemory*/ +fseek(ldFd,programHeader[i].p_offset,0x0); +fread(newLoc,programHeader[i].p_filesz,1,ldFd); + +break; +casePT_DYNAMIC: +/*NowLoadSectionToMemory*/ +//fseek(ldFd,programHeader[i].p_offset,0x0); +//fread(newLoc,programHeader[i].p_filesz,1,ldFd); +break; +casePT_GNU_STACK: +/*Tellsusifthestackshouldbeexecutable.Failsafetoexecutable +untilweaddchecking*/ +break; +default: +kprintf("UnhandledHeader(kernel):%08x\n",programHeader[i].p_type); +break; } - -for(i=0x0;i<binaryHeader->eShnum;i++){ -switch(sectionHeader[i].shType){ -case3: -if(!strcmp((shStr+sectionHeader[i].shName),".dynstr")){ -dynStr=(char*)kmalloc(sectionHeader[i].shSize); -fseek(ldFd,sectionHeader[i].shOffset,0x0); -fread(dynStr,sectionHeader[i].shSize,1,ldFd); -} -break; -case9: -elfRel=(elfPltInfo*)kmalloc(sectionHeader[i].shSize); -fseek(ldFd,sectionHeader[i].shOffset,0x0); -fread(elfRel,sectionHeader[i].shSize,1,ldFd); - -for(x=0x0;x<sectionHeader[i].shSize/sizeof(elfPltInfo);x++){ -rel=ELF32_R_SYM(elfRel[x].pltInfo); -reMap=(uInt32*)((uInt32)LD_START+elfRel[x].pltOffset); -switch(ELF32_R_TYPE(elfRel[x].pltInfo)){ -caseR_386_32: -*reMap+=((uInt32)LD_START+relSymTab[rel].dynValue); -break; -caseR_386_PC32: -*reMap+=((uInt32)LD_START+relSymTab[rel].dynValue)-(uInt32)reMap; -break; -caseR_386_RELATIVE: -*reMap+=(uInt32)LD_START; -break; -default: -kprintf("[0x%X][0x%X](%i)[%s]\n",elfRel[x].pltOffset,elfRel[x].pltInfo,rel,elfGetRelType(ELF32_R_TYPE(elfRel[x].pltInfo))); -kprintf("relTab[%s][0x%X][0x%X]\n",dynStr+relSymTab[rel].dynName,relSymTab[rel].dynValue,relSymTab[rel].dynName); -break; -} -} -kfree(elfRel); -break; -case11: -relSymTab=(elfDynSym*)kmalloc(sectionHeader[i].shSize); -fseek(ldFd,sectionHeader[i].shOffset,0x0); -fread(relSymTab,sectionHeader[i].shSize,1,ldFd); -sym=i; -break; -} -} - -i=binaryHeader->eEntry+LD_START; - -kfree(dynStr); -kfree(shStr); -kfree(relSymTab); -kfree(sectionHeader); -kfree(programHeader); -kfree(binaryHeader); -fclose(ldFd); - -return((uInt32)i); -} - -/*** -END -***/ - +} + +for(i=0x0;i<binaryHeader->e_shnum;i++){ +switch(sectionHeader[i].sh_type){ +caseSHT_STRTAB: +if(!strcmp((shStr+sectionHeader[i].sh_name),".dynstr")){ +dynStr=(char*)kmalloc(sectionHeader[i].sh_size); +//fseek(ldFd,sectionHeader[i].sh_offset,0x0); +//fread(dynStr,sectionHeader[i].sh_size,1,ldFd); +} +break; +caseSHT_REL: +elfRel=(Elf_Rel*)kmalloc(sectionHeader[i].sh_size); +//fseek(ldFd,sectionHeader[i].sh_offset,0x0); +//fread(elfRel,sectionHeader[i].sh_size,1,ldFd); + +for(x=0x0;x<sectionHeader[i].sh_size/sizeof(Elf_Rel);x++){ +rel=ELF32_R_SYM(elfRel[x].r_info); +reMap=(uint32_t*)((uint32_t)LD_START+elfRel[x].r_offset); +switch(ELF32_R_TYPE(elfRel[x].r_info)){ +caseR_386_32: +*reMap+=((uint32_t)LD_START+relSymTab[rel].st_value); +break; +caseR_386_PC32: +*reMap+=((uint32_t)LD_START+relSymTab[rel].st_value)-(uint32_t)reMap; +break; +caseR_386_RELATIVE: +*reMap+=(uint32_t)LD_START; +break; +caseR_386_NONE: +break; +default: +kprintf("[0x%X][0x%X](%i)[%s]\n",elfRel[x].r_offset,elfRel[x].r_info,rel,elfGetRelType(ELF32_R_TYPE(elfRel[x].r_info))); +kprintf("relTab[%s][0x%X][0x%X]\n",dynStr+relSymTab[rel].st_name,relSymTab[rel].st_value,relSymTab[rel].st_name); +break; +} +} +kfree(elfRel); +break; +caseSHT_DYNSYM: +relSymTab=(Elf_Sym*)kmalloc(sectionHeader[i].sh_size); +fseek(ldFd,sectionHeader[i].sh_offset,0x0); +fread(relSymTab,sectionHeader[i].sh_size,1,ldFd); +sym=i; +break; +caseSHT_PROGBITS: +//kprintf("PROGBITS"); +break; +caseSHT_HASH: +//kprintf("HASH"); +break; +caseSHT_DYNAMIC: +//kprintf("DYNAMIC"); +break; +caseSHT_SYMTAB: +//kprintf("SYMTAB"); +break; +default: +//kprintf("Invalid:%i]",sectionHeader[i].sh_type); +break; +} +} + +i=binaryHeader->e_entry+LD_START; + +kfree(dynStr); +kfree(shStr); +kfree(relSymTab); +kfree(sectionHeader); +kfree(programHeader); +kfree(binaryHeader); +fclose(ldFd); + +return((uint32_t)i); +} - + diff --git a/doc/xml/ld_8h.xml b/doc/xml/ld_8h.xml index 10cf61c..5b1aecd 100644 --- a/doc/xml/ld_8h.xml +++ b/doc/xml/ld_8h.xml @@ -1,62 +1,107 @@ - - - + + + ld.h - ubixos/types.h - src/sys/kernel/exec.c - src/sys/kernel/ld.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/kernel/ld.c - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + - + LD_START - 0x1000000 + 0xAAA00000 - + - - uInt32 + + uInt32 uInt32 ldEnable () ldEnable @@ -66,45 +111,8 @@ - - _current - assert - elfHeader::eEntry - ELF32_R_SYM - ELF32_R_TYPE - elfGetRelType - elfHeader::ePhnum - elfHeader::ePhoff - elfHeader::eShnum - elfHeader::eShoff - elfHeader::eShstrndx - fclose - fopen - fread - fseek - taskStruct::id - K_PANIC - kfree - kmalloc - kprintf - LD_START - memset - PAGE_DEFAULT - elfProgramHeader::phMemsz - elfProgramHeader::phVaddr - PT_DYNAMIC - PT_GNU_STACK - PT_LOAD - PT_PAX_FLAGS - R_386_32 - R_386_PC32 - R_386_RELATIVE - elfSectionHeader::shSize - strcmp - vmm_remapPage - vmmFindFreePage - x1000 - sysExec + + sysExec @@ -112,84 +120,45 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ld_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_LD_H -#define_LD_H - -#include<ubixos/types.h> - -#defineLD_START0x1000000 - -uInt32ldEnable(); - -#endif - -/*** -$Log: ld_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:55reddawg -nomessage - -Revision1.102004/06/1712:20:32reddawg -Trythisnowsolarwind - -Revision1.92004/06/1702:19:29reddawg -Cleaningoutdeadcode - -Revision1.82004/06/1617:32:14reddawg -RemovedDeadLDCodenowpartofld.so - -Revision1.72004/06/1617:04:13reddawg -ld.so:restofthecommit - -Revision1.42004/06/1303:05:15reddawg -wenowhaveadynamiclinker - -Revision1.32004/06/1201:27:26reddawg -sharedobjects:yeswealmostfullysupportsharedobjects - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_LD_H +#define_UBIXOS_LD_H + +#include<sys/types.h> + +#defineLD_START0xAAA00000//0x1000000 + +uInt32ldEnable(); + +#endif/*END_UBIXOS_LD_H*/ - + diff --git a/doc/xml/lib_8h.xml b/doc/xml/lib_8h.xml index c6169dc..d53938e 100644 --- a/doc/xml/lib_8h.xml +++ b/doc/xml/lib_8h.xml @@ -1,166 +1,15 @@ - - - + + + lib.h - src/sys/include/net/def.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + void void bcopy (const void *src, void *dest, int len) bcopy - const void * + const void * src @@ -177,13 +26,9 @@ - - memcpy - loopif_output - low_level_input - low_level_output + - + void void bzero (void *data, int n) @@ -202,16 +47,15 @@ - - memset + - + int int strlen (const char *str) strlen - const char * + const char * str @@ -220,19 +64,32 @@ - + + fatfs_filename_to_lfn + fatfs_get_substring + fatfs_lfn_create_sfn + fatfs_lfn_entries_required + fatfs_split_path + fl_fputs + lwip_strnstr + pbuf_strstr + strstr + sys_fstatat + sys_getcwd + sysExec + ubixfs_cacheNew - + int int strncmp (const char *str1, const char *str2, int len) strncmp - const char * + const char * str1 - const char * + const char * str2 @@ -245,7 +102,12 @@ - + + fatfs_mark_file_deleted + fatfs_sfn_exists + fatfs_update_file_length + lwip_strnstr + strstr @@ -253,54 +115,20 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: lib_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__ARCH_LIB_H__ -#define__ARCH_LIB_H__ - -#ifndef_STRING_H_ -#ifndef_STRING_H -intstrlen(constchar*str); -intstrncmp(constchar*str1,constchar*str2,intlen); -voidbcopy(constvoid*src,void*dest,intlen); -voidbzero(void*data,intn); -#endif/*_STRING_H*/ -#endif/*_STRING_H_*/ - -#endif/*__ARCH_LIB_H__*/ +#ifndef__ARCH_LIB_H__ +#define__ARCH_LIB_H__ + +#ifndef_STRING_H_ +#ifndef_STRING_H +intstrlen(constchar*str); +intstrncmp(constchar*str1,constchar*str2,intlen); +voidbcopy(constvoid*src,void*dest,intlen); +voidbzero(void*data,intn); +#endif/*_STRING_H*/ +#endif/*_STRING_H_*/ + +#endif - + diff --git a/doc/xml/libcpp_8cc.xml b/doc/xml/libcpp_8cc.xml index f06ffc4..de2277f 100644 --- a/doc/xml/libcpp_8cc.xml +++ b/doc/xml/libcpp_8cc.xml @@ -1,52 +1,90 @@ - - - + + + libcpp.cc lib/kmalloc.h sys/video.h lib/libcpp.h - - - - + + + + - - - - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - - - - - + + + + - + int int __cxa_atexit (void(*func)(void *), void *arg, void *d) @@ -69,9 +107,9 @@ - + - + void void __cxa_pure_virtual () @@ -82,9 +120,9 @@ - + - + void void __dso_handle () @@ -95,9 +133,9 @@ - + - + void void __pure_virtual () @@ -108,9 +146,9 @@ - + - + void void operator delete (void *ptr) @@ -125,10 +163,10 @@ - - kfree + + kfree - + void void operator delete[] (void *ptr) @@ -143,10 +181,10 @@ - - kfree + + kfree - + void * void* operator new (unsigned size) @@ -161,10 +199,10 @@ - - kmalloc + + kmalloc - + void * void* operator new[] (unsigned size) @@ -179,8 +217,8 @@ - - kmalloc + + kmalloc @@ -188,110 +226,83 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: libcpp_8cc.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -extern"C" -{ -#include<lib/kmalloc.h> -#include<sys/video.h> -void__pure_virtual(){while(1);} - -void__cxa_pure_virtual(){while(1);} - -/*Don'tplanonexitingthekernel...sodonothing.*/ -int__cxa_atexit(void(*func)(void*),void*arg,void*d){return0;} - -void__dso_handle(){while(1);} -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +extern"C"{ + +#include<lib/kmalloc.h> +#include<sys/video.h> + +void__pure_virtual(){ +while(1) +asm("nop"); +} + +void__cxa_pure_virtual(){ +while(1) +asm("nop"); +} -#include<lib/libcpp.h> - -void*operator new[](unsignedsize) -{ -returnkmalloc(size); -} - -voidoperator delete[](void*ptr) -{ -kfree(ptr); - -return; -} +/*Don'tplanonexitingthekernel...sodonothing.*/ +int__cxa_atexit(void(*func)(void*),void*arg,void*d){ +return0; +} + +void__dso_handle(){ +while(1) +asm("nop"); +} + +} + +#include<lib/libcpp.h> -void*operator new(unsignedsize) -{ -void*ptr=kmalloc(size); -returnptr; -} - -voidoperator delete(void*ptr) -{ -kfree(ptr); -return; -} - -/*** -$Log: libcpp_8cc.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:12reddawg -nomessage - -Revision1.52004/09/0822:04:10apwillia -Addedcallingofstaticconstructors,commentedouttty_printfinkprintf(duetodeadlock) - -Revision1.42004/07/2022:58:33reddawg -retiringtothelaptopforthenightmustsyncinworktoresumefromthere - -Revision1.32004/07/0212:28:24reddawg -Changesfornewlibc,someonepleasetestthatthekernelstillworks - -Revision1.22004/05/1904:07:43reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.1.1.12004/04/1512:07:10reddawg -UbixOSv1.0 - -Revision1.22004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +void*operatornew[](unsignedsize){ +returnkmalloc(size); +} + +voidoperatordelete[](void*ptr){ +kfree(ptr); + +return; +} + +void*operatornew(unsignedsize){ +void*ptr=kmalloc(size); +returnptr; +} + +voidoperatordelete(void*ptr){ +kfree(ptr); +return; +} - + diff --git a/doc/xml/libcpp_8h.xml b/doc/xml/libcpp_8h.xml index cfdd7bf..0e57d51 100644 --- a/doc/xml/libcpp_8h.xml +++ b/doc/xml/libcpp_8h.xml @@ -1,41 +1,79 @@ - - - + + + libcpp.h - ubixos/types.h - src/sys/lib/libcpp.cc + sys/types.h + C:/Dev/git/UbixOS/sys/lib/libcpp.cc - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + - - - - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + - + void void operator delete (void *ptr) @@ -50,10 +88,10 @@ - - kfree + + kfree - + void void operator delete[] (void *ptr) @@ -68,10 +106,10 @@ - - kfree + + kfree - + void * void* operator new (unsigned size) @@ -86,10 +124,10 @@ - - kmalloc + + kmalloc - + void * void* operator new[] (unsigned size) @@ -104,8 +142,8 @@ - - kmalloc + + kmalloc @@ -113,68 +151,46 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: libcpp_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef__LIBCPP_H -#define__LIBCPP_H - -#include<ubixos/types.h> - -void*operator new(unsignedsize); -voidoperator delete(void*ptr); -void*operator new[](unsignedsize); -voidoperator delete[](void*ptr); - -#endif - -/*** -$Log: libcpp_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:40reddawg -nomessage - -Revision1.22004/05/2115:00:27reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef__LIBCPP_H +#define__LIBCPP_H + +#include<sys/types.h> + +void*operatornew(unsignedsize); +voidoperatordelete(void*ptr); +void*operatornew[](unsignedsize); +voidoperatordelete[](void*ptr); + +#endif - + diff --git a/doc/xml/lists_8h.xml b/doc/xml/lists_8h.xml index 9ed0f86..2aabf36 100644 --- a/doc/xml/lists_8h.xml +++ b/doc/xml/lists_8h.xml @@ -1,24 +1,24 @@ - - - + + + lists.h - src/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c - - - - - - - - + + + + + + + + _item_t _list_t - + IN @@ -26,9 +26,9 @@ - + - + STATUS_FAILURE -1 @@ -37,9 +37,9 @@ - + - + STATUS_SUCCESS 0 @@ -48,12 +48,12 @@ - + - - _item_t + + struct _item_t typedef struct _item_t Item_t Item_t @@ -63,10 +63,10 @@ - + - - _list_t + + struct _list_t typedef struct _list_t List_t List_t @@ -76,12 +76,12 @@ - + - - Item_t * + + Item_t * Item_t* CreateItem () CreateItem @@ -91,16 +91,16 @@ - - kmod_add + + kmod_add - + int int DestroyItemList (List_t *ItemList) DestroyItemList - List_t * + List_t * ItemList @@ -109,15 +109,15 @@ - + - + int int DestroyItemsInList (List_t *ItemList) DestroyItemsInList - List_t * + List_t * ItemList @@ -126,15 +126,15 @@ - + - - Item_t * + + Item_t * Item_t* GetFirstItem (List_t *kItem) GetFirstItem - List_t * + List_t * kItem @@ -143,15 +143,15 @@ - + - - Item_t * + + Item_t * Item_t* GetLastItem (List_t *kItem) GetLastItem - List_t * + List_t * kItem @@ -160,10 +160,10 @@ - + - - List_t * + + List_t * List_t* InitializeList () InitializeList @@ -173,20 +173,20 @@ - - kmod_add + + kmod_add - + int int InsertItemAtFront (List_t *TList, Item_t *kItem) InsertItemAtFront - List_t * + List_t * TList - Item_t * + Item_t * kItem @@ -195,28 +195,28 @@ - - kmod_add + + kmod_add - + int int InsertItemBetweenItems (List_t *TList, Item_t *Previous, Item_t *Next, Item_t *Insert) InsertItemBetweenItems - List_t * + List_t * TList - Item_t * + Item_t * Previous - Item_t * + Item_t * Next - Item_t * + Item_t * Insert @@ -225,23 +225,23 @@ - + - + void void InsertItemListBetweenItems (Item_t *Previous, Item_t *Next, List_t *Insert) InsertItemListBetweenItems - Item_t * + Item_t * Previous - Item_t * + Item_t * Next - List_t * + List_t * Insert @@ -250,19 +250,19 @@ - + - + int int RemoveItem (List_t *TList, Item_t *kItem) RemoveItem - List_t * + List_t * TList - Item_t * + Item_t * kItem @@ -271,19 +271,19 @@ - + - - List_t * + + List_t * List_t* RemoveItemListBetweenItems (Item_t *Previous, Item_t *Next) RemoveItemListBetweenItems - Item_t * + Item_t * Previous - Item_t * + Item_t * Next @@ -292,7 +292,7 @@ - + @@ -300,58 +300,76 @@ -#defineIN -#defineSTATUS_FAILURE-1 -#defineSTATUS_SUCCESS0 - -typedefstruct_item_tItem_t; -typedefstruct_list_tList_t; -struct_item_t -{ -Item_t*Previous; -Item_t*Next; -void*data; -}; - -struct_list_t -{ -Item_t*First; -Item_t*Last; -}; - -List_t* -InitializeList(); -Item_t* -CreateItem(); -int -InsertItemAtFront(INList_t*TList, -INItem_t*kItem); -int -InsertItemBetweenItems(INList_t*TList, -INItem_t*Previous, -INItem_t*Next, -INItem_t*Insert); -int -RemoveItem(INList_t*TList, -INItem_t*kItem); -int -DestroyItemsInList(INList_t*ItemList); -int -DestroyItemList(INList_t*ItemList); -Item_t* -GetFirstItem(INList_t*kItem); - -Item_t* -GetLastItem(INList_t*kItem); -List_t* -RemoveItemListBetweenItems(INItem_t*Previous, -INItem_t*Next); - -void -InsertItemListBetweenItems(INItem_t*Previous, -INItem_t*Next, -INList_t*Insert); +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#defineIN +#defineSTATUS_FAILURE-1 +#defineSTATUS_SUCCESS0 + +typedefstruct_item_tItem_t; +typedefstruct_list_tList_t; +struct_item_t{ +Item_t*Previous; +Item_t*Next; +void*data; +}; + +struct_list_t{ +Item_t*First; +Item_t*Last; +}; + +List_t* +InitializeList(); +Item_t* +CreateItem(); +int +InsertItemAtFront(INList_t*TList,INItem_t*kItem); +int +InsertItemBetweenItems(INList_t*TList,INItem_t*Previous,INItem_t*Next,INItem_t*Insert); +int +RemoveItem(INList_t*TList,INItem_t*kItem); +int +DestroyItemsInList(INList_t*ItemList); +int +DestroyItemList(INList_t*ItemList); +Item_t* +GetFirstItem(INList_t*kItem); + +Item_t* +GetLastItem(INList_t*kItem); +List_t* +RemoveItemListBetweenItems(INItem_t*Previous,INItem_t*Next); + +void +InsertItemListBetweenItems(INItem_t*Previous,INItem_t*Next,INList_t*Insert); - + diff --git a/doc/xml/lnc_8c.xml b/doc/xml/lnc_8c.xml index 467b8b4..c26e327 100644 --- a/doc/xml/lnc_8c.xml +++ b/doc/xml/lnc_8c.xml @@ -1,104 +1,455 @@ - - - + + + lnc.c pci/lnc.h sys/io.h - ubixos/types.h + sys/types.h sys/idt.h sys/gdt.h lib/kmalloc.h lib/kprintf.h sys/video.h isa/8259.h + net/net.h + net/netif.h + ubixos/spinlock.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - + + + - - - - - - - + + + - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + const char *const + const char* const icIdent[] + [] + icIdent + = { "Unknown", "LANCE", "C-LANCE", "PCnet-ISA", "PCnet-ISA+", "PCnet-ISA II", "PCnet-32 VL-Bus", "PCnet-PCI", "PCnet-PCI II", "PCnet-FAST", "PCnet-FAST+", "PCnet-Home", } + + + + + + + + + + struct lncInfo * + struct lncInfo* lnc + + lnc + = 0x0 + + + + + + + + initLNC + lanceProbe + lnc_driverOwnsRX + lnc_driverOwnsTX + lnc_getMode + lnc_INT + lnc_nextRxPtr + lnc_nextTxPtr + lnc_probe + lnc_readBCR + lnc_readBCR32 + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + lnc_rxINT + lnc_sendPacket + lnc_switchDWord + lnc_thread + lnc_writeBCR + lnc_writeBCR32 + lnc_writeCSR + lnc_writeCSR32 + lncAttach + lncInt + + + struct netif + struct netif lnc_netif + + lnc_netif + + + + + + + + lnc_thread + + + const char *const + const char* const nicIdent[] + [] + nicIdent + = { "Unknown", "BICC", "NE2100", "DEPCA", "CNET98S" } + + + + + + + + + + struct nicBuffer * + struct nicBuffer* tmpBuf + + tmpBuf + + + + + + + + lnc_rxINT + lnc_thread + ne2kAllocBuffer + ne2kGetBuffer + + - + asm - (".global _lncInt \n""_lncInt : \n"" pusha \n"" pushw %ds \n"" pushw %es \n"" pushw %ss \n"" pushw %ss \n"" popw %ds \n"" popw %es \n"" call lncInt \n"" popw %es \n"" popw %ds \n"" popa \n"" iret \n") + (".globl lnc_isr \n" "lnc_isr: \n" " pusha \n" " push %ss \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " call lnc_INT \n" " mov $0xA0,%dx \n" " mov $0x20,%ax \n" " outb %al,%dx \n" " mov $0x20,%dx \n" " mov $0x20,%ax \n" " outb %al,%dx \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n") asm - ".global _lncInt \n""_lncInt : \n"" pusha \n"" pushw %ds \n"" pushw %es \n"" pushw %ss \n"" pushw %ss \n"" popw %ds \n"" popw %es \n"" call lncInt \n"" popw %es \n"" popw %ds \n"" popa \n"" iret \n" + ".globl lnc_isr \n" "lnc_isr: \n" " pusha \n" " push %ss \n" " push %ds \n" " push %es \n" " push %fs \n" " push %gs \n" " call lnc_INT \n" " mov + $0xA0 + + + %dx \n" " mov + $0x20 + + + %ax \n" " outb % + al + + + %dx \n" " mov + $0x20 + + + %dx \n" " mov + $0x20 + + + %ax \n" " outb % + al + + + %dx \n" " pop %gs \n" " pop %fs \n" " pop %es \n" " pop %ds \n" " pop %ss \n" " popa \n" " iret \n" @@ -106,11 +457,11 @@ - + - - void - void initLNC + + int + int initLNC () initLNC @@ -119,50 +470,65 @@ - - _lncInt - arpcom::ac_enaddr - lncInfo::arpcom - lncInfo::bdp - CSR0 - CSR3 - dDpl3 - dInt - DMA_FIXED - dPresent - ETHER_ADDR_LEN - nicInfo::ic - nicInfo::ident - IDON - INEA - INIT - inportByte - kmalloc - kprintf - lnc - lncAttach - nicInfo::memMode - mVec - NE2100 - lncInfo::nic - NRDRE - lncInfo::nrdre - NTDRE - lncInfo::ntdre - PCnet_32 - PCNET_BDP - PCNET_RAP - PCNET_RDP - probe - lncInfo::rap - lncInfo::rdp - readCsr - setVector - STRT - writeCsr - x1000 + + arpcom::ac_enaddr + lncInfo::arpcom + lncInfo::bufferSize + CSR0 + CSR1 + CSR2 + CSR3 + dDpl3 + dInt + DMA_FIXED + dPresent + ETHER_ADDR_LEN + nicInfo::ic + nicInfo::ident + IDON + INEA + lncInfo::init + INIT + inportByte + lncInfo::ioAddr + irqEnable + kmalloc + kprintf + lnc + lnc_getMode + lnc_isr + lnc_probe + lnc_readBCR32 + lnc_readCSR32 + lnc_switchDWord + lnc_writeBCR32 + lnc_writeCSR32 + lncAttach + nicInfo::memMode + memset + initBlock32::mode + MODE_16 + MODE_32 + NE2100 + lncInfo::nic + lncInfo::nrdre + NRDRE + lncInfo::ntdre + NTDRE + initBlock32::padr + PCnet_32 + initBlock32::rdra + initBlock32::rlen + lncInfo::rxRing + setVector + STRT + sVec + initBlock32::tdra + initBlock32::tlen + lncInfo::txRing + vmm_getRealAddr - + int int lanceProbe (struct lncInfo *lnc) @@ -177,22 +543,632 @@ - - C_LANCE - CSR0 - CSR3 - INEA - inportWord - LANCE - lnc - lncInfo::rdp - readCsr - STOP - UNKNOWN - writeCsr - probe + + C_LANCE + CSR0 + CSR0_STOP + CSR3 + INEA + inportWord + lncInfo::ioAddr + LANCE + lnc + lnc_readCSR + lnc_writeCSR + RDP + UNKNOWN + lnc_probe - + + int + int lnc_driverOwnsRX + (struct lncInfo *lnc) + lnc_driverOwnsRX + + struct lncInfo * + lnc + + + + + + + + + lnc + hostRingEntry::md + lncInfo::rxPtr + lncInfo::rxRing + lnc_rxINT + lnc_thread + + + int + int lnc_driverOwnsTX + (struct lncInfo *lnc) + lnc_driverOwnsTX + + struct lncInfo * + lnc + + + + + + + + + lnc + hostRingEntry::md + lncInfo::txPtr + lncInfo::txRing + lnc_sendPacket + + + int + int lnc_getMode + (struct lncInfo *lnc) + lnc_getMode + + struct lncInfo * + lnc + + + + + + + + + CSR0 + CSR0_STOP + lnc + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + MODE_16 + MODE_32 + MODE_INVALID + initLNC + + + void + void lnc_INT + () + lnc_INT + + + + + + + + CSR0 + ERR + kprintf + lnc + lnc_writeCSR32 + RINT + TINT + + + int + int lnc_nextRxPtr + (struct lncInfo *lnc) + lnc_nextRxPtr + + struct lncInfo * + lnc + + + + + + + + + lnc + NDESC + lncInfo::nrdre + lncInfo::rxPtr + lnc_rxINT + lnc_thread + + + int + int lnc_nextTxPtr + (struct lncInfo *lnc) + lnc_nextTxPtr + + struct lncInfo * + lnc + + + + + + + + + lnc + NDESC + lncInfo::ntdre + lncInfo::txPtr + lnc_sendPacket + + + int + int lnc_probe + (struct lncInfo *lnc) + lnc_probe + + struct lncInfo * + lnc + + + + + + + + + Am79C960 + Am79C961 + Am79C961A + Am79C965 + Am79C970 + Am79C970A + Am79C971 + Am79C972 + Am79C973 + Am79C978 + AMD_MASK + CSR88 + CSR89 + lanceProbe + lnc + lnc_readCSR + PART_MASK + PCnet_32 + PCnet_FAST + PCnet_FASTplus + PCnet_Home + PCnet_ISA + PCnet_ISA_II + PCnet_ISAplus + PCnet_PCI + PCnet_PCI_II + initLNC + + + uint16_t + uint16_t lnc_readBCR + (struct lncInfo *lnc, uint16_t port) + lnc_readBCR + + struct lncInfo * + lnc + + + uint16_t + port + + + + + + + + + BDP + inportWord + lncInfo::ioAddr + lnc + outportWord + RAP + + + uint32_t + uint32_t lnc_readBCR32 + (struct lncInfo *lnc, uint32_t port) + lnc_readBCR32 + + struct lncInfo * + lnc + + + uint32_t + port + + + + + + + + + BDP32 + inportDWord + lncInfo::ioAddr + lnc + outportDWord + RAP32 + initLNC + lnc_switchDWord + + + uint16_t + uint16_t lnc_readCSR + (struct lncInfo *lnc, uint16_t port) + lnc_readCSR + + struct lncInfo * + lnc + + + uint16_t + port + + + + + + + + + inportWord + lncInfo::ioAddr + lnc + outportWord + RAP + RDP + lanceProbe + lnc_getMode + lnc_probe + + + uint32_t + uint32_t lnc_readCSR32 + (struct lncInfo *lnc, uint32_t port) + lnc_readCSR32 + + struct lncInfo * + lnc + + + uint32_t + port + + + + + + + + + inportDWord + lncInfo::ioAddr + lnc + outportDWord + RAP32 + RDP32 + initLNC + lnc_getMode + lnc_switchDWord + + + void + void lnc_reset + (struct lncInfo *lnc) + lnc_reset + + struct lncInfo * + lnc + + + + + + + + + inportWord + lncInfo::ioAddr + lnc + RESET + lnc_getMode + + + void + void lnc_reset32 + (struct lncInfo *lnc) + lnc_reset32 + + struct lncInfo * + lnc + + + + + + + + + inportDWord + lncInfo::ioAddr + lnc + RESET32 + lnc_getMode + + + void + void lnc_rxINT + () + lnc_rxINT + + + + + + + + nicBuffer::buffer + lncInfo::bufferSize + kmalloc + nicBuffer::length + lnc + lnc_driverOwnsRX + lnc_nextRxPtr + hostRingEntry::md + memset + lncInfo::rxBuffer + lncInfo::rxPtr + lncInfo::rxRing + tmpBuf + + + int + int lnc_sendPacket + (struct lncInfo *lnc, void *packet, size_t len, uint8_t *dest) + lnc_sendPacket + + struct lncInfo * + lnc + + + void * + packet + + + size_t + len + + + uint8_t * + dest + + + + + + + + + hostRingEntry::bcnt + lncInfo::bufferSize + kpanic + lnc + lnc_driverOwnsTX + lnc_nextTxPtr + hostRingEntry::md + memcpy + lncInfo::txBuffer + lncInfo::txPtr + lncInfo::txRing + + + int + int lnc_switchDWord + (struct lncInfo *lnc) + lnc_switchDWord + + struct lncInfo * + lnc + + + + + + + + + BCR18 + BCR18_DWIO + CSR58 + inportDWord + inportWord + lncInfo::ioAddr + kprintf + lnc + lnc_readBCR32 + lnc_readCSR32 + lnc_writeCSR32 + outportDWord + RDP + RESET + RESET32 + initLNC + + + void + void lnc_thread + () + lnc_thread + + + + + + + + nicBuffer::buffer + lncInfo::bufferSize + ethernetif_input + kmalloc + nicBuffer::length + lnc + lnc_driverOwnsRX + lnc_netif + lnc_nextRxPtr + hostRingEntry::md + memset + lncInfo::rxBuffer + lncInfo::rxPtr + lncInfo::rxRing + sched_yield + tmpBuf + net_init + + + void + void lnc_txINT + () + lnc_txINT + + + + + + + + + + void + void lnc_writeBCR + (struct lncInfo *lnc, uint16_t port, uint16_t val) + lnc_writeBCR + + struct lncInfo * + lnc + + + uint16_t + port + + + uint16_t + val + + + + + + + + + BDP + lncInfo::ioAddr + lnc + outportWord + RAP + + + void + void lnc_writeBCR32 + (struct lncInfo *lnc, uint32_t port, uint32_t val) + lnc_writeBCR32 + + struct lncInfo * + lnc + + + uint32_t + port + + + uint32_t + val + + + + + + + + + BDP32 + lncInfo::ioAddr + lnc + outportDWord + RAP32 + initLNC + + + void + void lnc_writeCSR + (struct lncInfo *lnc, uint16_t port, uint16_t val) + lnc_writeCSR + + struct lncInfo * + lnc + + + uint16_t + port + + + uint16_t + val + + + + + + + + + lncInfo::ioAddr + lnc + outportWord + RAP + RDP + lanceProbe + + + void + void lnc_writeCSR32 + (struct lncInfo *lnc, uint32_t port, uint32_t val) + lnc_writeCSR32 + + struct lncInfo * + lnc + + + uint32_t + port + + + uint32_t + val + + + + + + + + + lncInfo::ioAddr + lnc + outportDWord + RAP32 + RDP32 + initLNC + lnc_INT + lnc_switchDWord + + int int lncAttach (struct lncInfo *lnc, int unit) @@ -211,35 +1187,35 @@ - - arpcom::ac_enaddr - lncInfo::arpcom - C_LANCE - DMA_FIXED - nicInfo::ic - icIdent - nicInfo::ident - kmalloc - kprintf - LANCE - lnc - MEM_SLEW - nicInfo::memMode - nicInfo::mode - NDESC - lncInfo::nic - nicIdent - NORMAL - lncInfo::nrdre - lncInfo::ntdre - PCnet_32 - RECVBUFSIZE - lncInfo::recvRing - SHMEM - TRANSBUFSIZE - initLNC + + hostRingEntry::addr + hostRingEntry::bcnt + lncInfo::bufferSize + C_LANCE + nicInfo::ic + kmalloc + kprintf + LANCE + lnc + hostRingEntry::md + nicInfo::memMode + memset + nicInfo::mode + NDESC + lncInfo::nic + NORMAL + lncInfo::nrdre + lncInfo::ntdre + PCnet_32 + lncInfo::rxBuffer + lncInfo::rxRing + SHMEM + lncInfo::txBuffer + lncInfo::txRing + vmm_getRealAddr + initLNC - + void void lncInt () @@ -250,249 +1226,18 @@ - - ERR - inportWord - INTR - kprintf - lnc - outportByte - outportWord - lncInfo::rdp - RINT - TINT - x20 - - - int - int probe - (struct lncInfo *lnc) - probe - - struct lncInfo * - lnc - - - - - - - - - Am79C960 - Am79C961 - Am79C961A - Am79C965 - Am79C970 - Am79C970A - Am79C971 - Am79C972 - Am79C973 - Am79C978 - AMD_MASK - CSR88 - CSR89 - lanceProbe - lnc - PART_MASK - PCnet_32 - PCnet_FAST - PCnet_FASTplus - PCnet_Home - PCnet_ISA - PCnet_ISA_II - PCnet_ISAplus - PCnet_PCI - PCnet_PCI_II - readCsr - initLNC - - - uInt16 - uInt16 readBcr - (struct lncInfo *sc, uInt16 port) - readBcr - - struct lncInfo * - sc - - - uInt16 - port - - - - - - - - - lncInfo::bdp - inportWord - outportWord - lncInfo::rap - - - uInt16 - uInt16 readCsr - (struct lncInfo *lnc, uInt16 port) - readCsr - - struct lncInfo * - lnc - - - uInt16 - port - - - - - - - - - inportWord - lnc - outportWord - lncInfo::rap - lncInfo::rdp - initLNC - lanceProbe - probe - - - void - void writeBcr - (struct lncInfo *lnc, uInt16 port, uInt16 val) - writeBcr - - struct lncInfo * - lnc - - - uInt16 - port - - - uInt16 - val - - - - - - - - - lncInfo::bdp - lnc - outportWord - lncInfo::rap - - - void - void writeCsr - (struct lncInfo *lnc, uInt16 port, uInt16 val) - writeCsr - - struct lncInfo * - lnc - - - uInt16 - port - - - uInt16 - val - - - - - - - - - lnc - outportWord - lncInfo::rap - lncInfo::rdp - initLNC - lanceProbe - - - - - char const *const - char const* const icIdent[] - [] - icIdent - { - "Unknown", - "LANCE", - "C-LANCE", - "PCnet-ISA", - "PCnet-ISA+", - "PCnet-ISA II", - "PCnet-32 VL-Bus", - "PCnet-PCI", - "PCnet-PCI II", - "PCnet-FAST", - "PCnet-FAST+", - "PCnet-Home", - } - - - - - - - - lncAttach - - - lncInfo * - struct lncInfo* lnc - - lnc - 0x0 - - - - - - - - initLNC - lanceProbe - lncAttach - lncInt - probe - readCsr - writeBcr - writeCsr - - - char const *const - char const* const nicIdent[] - [] - nicIdent - { - "Unknown", - "BICC", - "NE2100", - "DEPCA", - "CNET98S", - } - - - - - - - - lncAttach + + ERR + inportWord + INTR + lncInfo::ioAddr + kprintf + lnc + outportByte + outportWord + RDP + RINT + TINT @@ -500,323 +1245,616 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Log: lnc_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:35reddawg -nomessage - -Revision1.1.1.12004/04/1512:07:15reddawg -UbixOSv1.0 - -Revision1.42004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - - - -$Id: lnc_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<pci/lnc.h> +#include<sys/io.h> +#include<sys/types.h> +#include<sys/idt.h> +#include<sys/gdt.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<sys/video.h> +#include<isa/8259.h> +#include<net/net.h> +#include<net/netif.h> +#include<ubixos/spinlock.h> + +structnetiflnc_netif; + +structlncInfo*lnc=0x0; + +//staticstructspinLocklnc_intSpinLock=SPIN_LOCK_INITIALIZER; -#include<pci/lnc.h> -#include<sys/io.h> -#include<ubixos/types.h> -#include<sys/idt.h> -#include<sys/gdt.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<sys/video.h> -#include<isa/8259.h> - -structlncInfo*lnc=0x0; - -staticcharconst*constnicIdent[]={ -"Unknown", -"BICC", -"NE2100", -"DEPCA", -"CNET98S",/*PC-98*/ -}; - -staticcharconst*consticIdent[]={ -"Unknown", -"LANCE", -"C-LANCE", -"PCnet-ISA", -"PCnet-ISA+", -"PCnet-ISAII", -"PCnet-32VL-Bus", -"PCnet-PCI", -"PCnet-PCIII", -"PCnet-FAST", -"PCnet-FAST+", -"PCnet-Home", -}; - -voidwriteCsr(structlncInfo*lnc,uInt16port,uInt16val){ -outportWord(lnc->rap,port); -outportWord(lnc->rdp,val); -} - -uInt16readCsr(structlncInfo*lnc,uInt16port){ -outportWord(lnc->rap,port); -return(inportWord(lnc->rdp)); -} - -voidwriteBcr(structlncInfo*lnc,uInt16port,uInt16val){ -outportWord(lnc->rap,port); -outportWord(lnc->bdp,val); -} - -uInt16readBcr(structlncInfo*sc,uInt16port){ -outportWord(sc->rap,port); -return(inportWord(sc->bdp)); -} - - -voidinitLNC(){ -inti=0x0; -lnc=kmalloc(sizeof(structlncInfo),-2); - -lnc->rap=0x1000+PCNET_RAP; -lnc->rdp=0x1000+PCNET_RDP; -lnc->bdp=0x1000+PCNET_BDP; - -lnc->nic.ic=probe(lnc); -if((lnc->nic.ic>0)&&(lnc->nic.ic>=PCnet_32)){ -lnc->nic.ident=NE2100; -lnc->nic.memMode=DMA_FIXED; - -lnc->nrdre=NRDRE; -lnc->ntdre=NTDRE; - -/*ExtractMACaddressfromPROM*/ -for(i=0;i<ETHER_ADDR_LEN;i++){ -lnc->arpcom.ac_enaddr[i]=inportByte(0x1000+i); -kprintf("[0x%X]",lnc->arpcom.ac_enaddr[i]); -} -} -else{ -kprintf("LNCInitError\n"); -return; -} -lncAttach(lnc,0); -writeCsr(lnc,CSR3,0); -writeCsr(lnc,CSR0,INIT); -for(i=0;i<1000;i++) -if(readCsr(lnc,CSR0)&IDON) -break; +staticconstchar*constnicIdent[]={"Unknown","BICC","NE2100","DEPCA","CNET98S"}; + +staticconstchar*consticIdent[]={"Unknown","LANCE","C-LANCE","PCnet-ISA","PCnet-ISA+","PCnet-ISAII","PCnet-32VL-Bus","PCnet-PCI","PCnet-PCIII","PCnet-FAST","PCnet-FAST+","PCnet-Home",}; + +structnicBuffer*tmpBuf; + +voidlnc_writeCSR(structlncInfo*lnc,uint16_tport,uint16_tval){ +outportWord(lnc->ioAddr+RAP,port); +outportWord(lnc->ioAddr+RDP,val); +} + +voidlnc_writeCSR32(structlncInfo*lnc,uint32_tport,uint32_tval){ +outportDWord(lnc->ioAddr+RAP32,port); +outportDWord(lnc->ioAddr+RDP32,val); +} + +uint16_tlnc_readCSR(structlncInfo*lnc,uint16_tport){ +outportWord(lnc->ioAddr+RAP,port); +return(inportWord(lnc->ioAddr+RDP)); +} + +uint32_tlnc_readCSR32(structlncInfo*lnc,uint32_tport){ +outportDWord(lnc->ioAddr+RAP32,port); +return(inportDWord(lnc->ioAddr+RDP32)); +} + +voidlnc_writeBCR(structlncInfo*lnc,uint16_tport,uint16_tval){ +outportWord(lnc->ioAddr+RAP,port); +outportWord(lnc->ioAddr+BDP,val); +} + +voidlnc_writeBCR32(structlncInfo*lnc,uint32_tport,uint32_tval){ +outportDWord(lnc->ioAddr+RAP32,port); +outportDWord(lnc->ioAddr+BDP32,val); +} + +uint16_tlnc_readBCR(structlncInfo*lnc,uint16_tport){ +outportWord(lnc->ioAddr+RAP,port); +return(inportWord(lnc->ioAddr+BDP)); +} + +uint32_tlnc_readBCR32(structlncInfo*lnc,uint32_tport){ +outportDWord(lnc->ioAddr+RAP32,port); +return(inportDWord(lnc->ioAddr+BDP32)); +} + +intinitLNC(){ +inti=0x0; + +chardata[64]="abcDEFghiJKLmnoPQRstuVWXyz"; + +lnc=kmalloc(sizeof(structlncInfo)); +memset(lnc,0x0,sizeof(structlncInfo)); + +lnc->bufferSize=1548; +lnc->ioAddr=0xD020; + +lnc->nic.ic=lnc_probe(lnc); + +//kprintf("ID:%i\n",lnc->nic.ic); + +if((lnc->nic.ic>0)&&(lnc->nic.ic>=PCnet_32)){ +lnc->nic.ident=NE2100; +lnc->nic.memMode=DMA_FIXED; + +lnc->nrdre=NRDRE; +lnc->ntdre=NTDRE; + +/*ExtractMACaddressfromPROM*/ +for(i=0;i<ETHER_ADDR_LEN;i++){ +lnc->arpcom.ac_enaddr[i]=inportByte(lnc->ioAddr+i); +kprintf("[0x%X]",lnc->arpcom.ac_enaddr[i]); +} +} +else{ +kprintf("LNCInitError\n"); +return(-1); +} + +lncAttach(lnc,0); + +i=lnc_getMode(lnc); +if(i==MODE_16) +kprintf("16Bit"); +elseif(i==MODE_32) +kprintf("32Bit"); +else +kprintf("InvalidMode:[%i]",i); -if(readCsr(lnc,CSR0)&IDON){ -writeCsr(lnc,CSR0,STRT|INEA); -setVector(_lncInt,mVec+9,(dInt+dPresent+dDpl3)); -enableIrq(9); -/* -*sc->arpcom.ac_if.if_flags|=IFF_RUNNING; -*sc->arpcom.ac_if.if_flags&=~IFF_OACTIVE; -*lnc_start(&sc->arpcom.ac_if); -*/ -} -else{ -kprintf("LNCinitError\n"); -return; -} -return; -} - -intprobe(structlncInfo*lnc){ -uInt32chipId=0x0; -inttype=0x0; - -if((type=lanceProbe(lnc))){ -chipId=readCsr(lnc,CSR89); -chipId<<=16; -chipId|=readCsr(lnc,CSR88); -if(chipId&AMD_MASK){ -chipId>>=12; -switch(chipId&PART_MASK){ -caseAm79C960: -return(PCnet_ISA); -caseAm79C961: -return(PCnet_ISAplus); -caseAm79C961A: -return(PCnet_ISA_II); -caseAm79C965: -return(PCnet_32); -caseAm79C970: -return(PCnet_PCI); -caseAm79C970A: -return(PCnet_PCI_II); -caseAm79C971: -return(PCnet_FAST); -caseAm79C972: -caseAm79C973: -return(PCnet_FASTplus); -caseAm79C978: -return(PCnet_Home); -default: -break; -} -} -} -return(type); -} - -intlanceProbe(structlncInfo*lnc){ -writeCsr(lnc,CSR0,STOP); -if((inportWord(lnc->rdp)&STOP)&&!(readCsr(lnc,CSR3))){ -writeCsr(lnc,CSR0,INEA); -if(readCsr(lnc,CSR0)&INEA){ -return(C_LANCE); -} -else{ -return(LANCE); -} -} -else{ -return(UNKNOWN); -} -} - -voidlncInt(){ -uInt16csr0=0x0; -while((csr0=inportWord(lnc->rdp))&INTR){ -outportWord(lnc->rdp,csr0); -kprintf("CSR0:[0x%X]\n",csr0); -if(csr0&ERR){ -kprintf("Error:[0x%X]\n",csr0); -} -if(csr0&RINT){ -kprintf("RINT\n"); -} -if(csr0&TINT){ -kprintf("TINT\n"); -} -} -kprintf("Finished!!!\n"); -outportByte(0x20,0x20); -return; -} - -asm( -".global_lncInt\n" -"_lncInt:\n" - -"pusha\n"/*Saveallregisters*/ -"pushw%ds\n"/*Setupthedatasegment*/ -"pushw%es\n" -"pushw%ss\n"/*Notethatssisalwaysvalid*/ -"pushw%ss\n" -"popw%ds\n" -"popw%es\n" -"calllncInt\n" -"popw%es\n" -"popw%ds\n"/*Restoreregisters*/ -"popa\n" -"iret\n"/*Exitinterrupt*/ -); - -intlncAttach(structlncInfo*lnc,intunit){ -intlncMemSize=0x0; - -lncMemSize=((NDESC(lnc->nrdre)+NDESC(lnc->ntdre))*sizeof(structhostRingEntry)); - -if(lnc->nic.memMode!=SHMEM) -lncMemSize+=sizeof(structinitBlock)+(sizeof(structmds)*(NDESC(lnc->nrdre)+NDESC(lnc->ntdre)))+MEM_SLEW; +lnc_switchDWord(lnc); + +uint32_tiW=0; + +iW=lnc_readBCR32(lnc,0x2); +iW|=0x2; +lnc_writeBCR32(lnc,0x2,iW); +//kprintf("BCR2:[0x%X]",lnc_readBCR32(lnc,0x2)); + +lnc->init.mode=0x0; + +lnc->init.padr[0]=lnc->arpcom.ac_enaddr[0]; +lnc->init.padr[1]=lnc->arpcom.ac_enaddr[1]; +lnc->init.padr[2]=lnc->arpcom.ac_enaddr[2]; +lnc->init.padr[3]=lnc->arpcom.ac_enaddr[3]; +lnc->init.padr[4]=lnc->arpcom.ac_enaddr[4]; +lnc->init.padr[5]=lnc->arpcom.ac_enaddr[5]; + +lnc->init.rdra=(uint32_t)vmm_getRealAddr(lnc->rxRing); +lnc->init.rlen=3<<4; +//kprintf("VirtAddr:0x%X,RealAddr:0x%X",lnc->rxRing,vmm_getRealAddr(lnc->rxRing)); + +lnc->init.tdra=(uint32_t)vmm_getRealAddr(lnc->txRing); +lnc->init.tlen=3<<4; +//kprintf("VirtAddr:0x%X,RealAddr:0x%X",lnc->txRing,vmm_getRealAddr(lnc->txRing)); + +//kprintf("VirtAddr:0x%X,RealAddr:0x%X",&lnc->init,vmm_getRealAddr(&lnc->init)); + +iW=vmm_getRealAddr(&lnc->init); + +lnc_writeCSR32(lnc,CSR1,iW&0xFFFF); +lnc_writeCSR32(lnc,CSR2,(iW>>16)&0xFFFF); + +lnc_writeCSR32(lnc,CSR3,0); +lnc_writeCSR32(lnc,CSR0,INIT); + +for(i=0;i<1000;i++) +if(lnc_readCSR32(lnc,CSR0)&IDON) +break; + +if(lnc_readCSR32(lnc,CSR0)&IDON){ +setVector(&lnc_isr,sVec+0x1,(dInt+dPresent+dDpl3)); +irqEnable(2); +//irqEnable(0x9); +lnc_writeCSR32(lnc,CSR0,STRT|INEA); +} +else{ +kprintf("LNC:initError\n"); +return(-1); +} + +return(0); +} + +intlnc_probe(structlncInfo*lnc){ + +uInt32chipId=0x0; +inttype=0x0; + +if((type=lanceProbe(lnc))){ +//kprintf("Type:[0x%X]",type); +chipId=lnc_readCSR(lnc,CSR89); +chipId<<=16; +chipId|=lnc_readCSR(lnc,CSR88); +if(chipId&AMD_MASK){ +chipId>>=12; +switch(chipId&PART_MASK){ +caseAm79C960: +return(PCnet_ISA); +caseAm79C961: +return(PCnet_ISAplus); +caseAm79C961A: +return(PCnet_ISA_II); +caseAm79C965: +return(PCnet_32); +caseAm79C970: +return(PCnet_PCI); +caseAm79C970A: +return(PCnet_PCI_II); +caseAm79C971: +return(PCnet_FAST); +caseAm79C972: +caseAm79C973: +return(PCnet_FASTplus); +caseAm79C978: +return(PCnet_Home); +default: +break; +} +} +} +return(type); +} + +intlanceProbe(structlncInfo*lnc){ +uInt16inW=0; + +lnc_writeCSR(lnc,CSR0,CSR0_STOP); + +inW=inportWord(lnc->ioAddr+RDP); + +if((inW&CSR0_STOP)&&!(lnc_readCSR(lnc,CSR3))){ + +lnc_writeCSR(lnc,CSR0,INEA); + +if(lnc_readCSR(lnc,CSR0)&INEA){ +return(C_LANCE); +} +else{ +return(LANCE); +} +} +else{ +return(UNKNOWN); +} +} -if(lnc->nic.memMode==DMA_FIXED) -lncMemSize+=(NDESC(lnc->nrdre)*RECVBUFSIZE)+(NDESC(lnc->ntdre)*TRANSBUFSIZE); +voidlnc_INT(){ +uint16_tcsr0=0x0; -if(lnc->nic.memMode!=SHMEM){ -if(lnc->nic.ic<PCnet_32){ -/*ISAbasedcards*/ -kprintf("ISABoard\n"); -/*sc->recv_ring=contigmalloc(lnc_mem_size,M_DEVBUF,M_NOWAIT,0ul,0xfffffful,4ul,0x1000000);*/ -} -else{ -/* -*Fornowitstillneedstobebelow16MBbecausethe -*descriptor'scanonlyhold16bitaddresses. -*/ -/*sc->recv_ring=contigmalloc(lnc_mem_size,M_DEVBUF,M_NOWAIT,0ul,0xfffffful,4ul,0x1000000);*/ -lnc->recvRing=kmalloc(lncMemSize,-2); -kprintf("PCIBoard\n"); -} -} - -if(!lnc->recvRing){ -kprintf("lnc%d:Couldn'tallocatememoryforNIC\n",unit); -return(0); -} - -lnc->nic.mode=NORMAL; +//kprintf("\nINTR\n"); +//while((csr0=lnc_readCSR32(lnc,CSR0))&INTR){ +//kprintf("CSR0:[0x%X]\n",csr0); +if(csr0&ERR){ +kprintf("Error:[0x%X]\n",csr0); +} +if(csr0&RINT){ +asm("nop"); +//lnc_rxINT(); +} +if(csr0&TINT){ +asm("nop"); +//kprintf("TINT"); +//lnc_txINT(); +} +//kprintf("CSR0.1:[0x%X]\n",lnc_readCSR32(lnc,CSR0)); +//} +lnc_writeCSR32(lnc,CSR0,0x7940);//csr0); +//kprintf("INTDONE"); +} + +voidlnc_thread(){ +inti=0; -/*Fillinarpcomstructureentries*/ -/* -lnc->arpcom.ac_if.if_softc=sc; -lnc->arpcom.ac_if.if_name=lncdriver.name; -lnc->arpcom.ac_if.if_unit=unit; -lnc->arpcom.ac_if.if_mtu=ETHERMTU; -lnc->arpcom.ac_if.if_flags=IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; -lnc->arpcom.ac_if.if_timer=0; -lnc->arpcom.ac_if.if_output=ether_output; -lnc->arpcom.ac_if.if_start=lnc_start; -lnc->arpcom.ac_if.if_ioctl=lnc_ioctl; -lnc->arpcom.ac_if.if_watchdog=lnc_watchdog; -lnc->arpcom.ac_if.if_init=lnc_init; -lnc->arpcom.ac_if.if_type=IFT_ETHER; -lnc->arpcom.ac_if.if_addrlen=ETHER_ADDR_LEN; -lnc->arpcom.ac_if.if_hdrlen=ETHER_HDR_LEN; -lnc->arpcom.ac_if.if_snd.ifq_maxlen=IFQ_MAXLEN; -*/ -/*ether_ifattach(&sc->arpcom.ac_if,ETHER_BPF_SUPPORTED);*/ +if(tmpBuf==0x0){ +tmpBuf=(structnicBuffer*)kmalloc(sizeof(structnicBuffer)); +memset(tmpBuf,0x0,sizeof(structnicBuffer)); +} +else{ +memset(tmpBuf,0x0,sizeof(structnicBuffer)); +} + +while(1){ +while(lnc_driverOwnsRX(lnc)){ +//uint16_tplen=0+(uint16_t)lnc->rxRing[lnc->rxPtr].md[2]; +intplen=(lnc->rxRing[lnc->rxPtr].md[2]&0x0fff)-4; +/* +if(plen>0) +kprintf("plen.0:[0x%X]",plen); +*/ + +tmpBuf->length=plen; +tmpBuf->buffer=(void*)(lnc->rxBuffer+(lnc->rxPtr*lnc->bufferSize));//(char*)kmalloc(length); -kprintf("lnc%d:",unit); -if(lnc->nic.ic==LANCE||lnc->nic.ic==C_LANCE) -kprintf("%s(%s)",nicIdent[lnc->nic.ident],icIdent[lnc->nic.ic]); -else -kprintf("%s",icIdent[lnc->nic.ic]); -kprintf("address0x%X\n",lnc->arpcom.ac_enaddr); -return(1); -} - -/*** -END -***/ - +//kprintf("RINT2\n"); +ethernetif_input(&lnc_netif); +//kprintf("RINT3\n"); +//kprintf("RINT-LOOP[%i][0x%X][0x%X]",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); +lnc->rxRing[lnc->rxPtr].md[1]=0x80; +//kprintf("RINT-LOOP[%i][0x%X][0x%X]",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); +lnc_nextRxPtr(lnc); +//kprintf("RINT-LOOP[%i][0x%X][0x%X]\n",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); +} +//kprintf("RINT-DONE[%i][0x%X]\n",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1]); + +sched_yield(); +} +} + +voidlnc_rxINT(){ +inti=0; + +if(tmpBuf==0x0){ +tmpBuf=(structnicBuffer*)kmalloc(sizeof(structnicBuffer)); +memset(tmpBuf,0x0,sizeof(structnicBuffer)); +} +else{ +memset(tmpBuf,0x0,sizeof(structnicBuffer)); +} + +while(lnc_driverOwnsRX(lnc)){ +//uint16_tplen=0+(uint16_t)lnc->rxRing[lnc->rxPtr].md[2]; +intplen=(lnc->rxRing[lnc->rxPtr].md[2]&0x0fff)-4; +/* +if(plen>0) +kprintf("plen.0:[0x%X]",plen); +*/ + +tmpBuf->length=plen; +tmpBuf->buffer=(void*)(lnc->rxBuffer+(lnc->rxPtr*lnc->bufferSize));//(char*)kmalloc(length); + +//kprintf("RINT2\n"); +//ethernetif_input(netif_default); +//kprintf("RINT3\n"); +//kprintf("RINT-LOOP[%i][0x%X][0x%X]",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); +lnc->rxRing[lnc->rxPtr].md[1]=0x80; +//kprintf("RINT-LOOP[%i][0x%X][0x%X]",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); +lnc_nextRxPtr(lnc); +//kprintf("RINT-LOOP[%i][0x%X][0x%X]\n",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1],plen); +} +//kprintf("RINT-DONE[%i][0x%X]\n",lnc->rxPtr,lnc->rxRing[lnc->rxPtr].md[1]); +//while(1); + +} + +voidlnc_txINT(){ +uint16_tstatus=0x0; + +kprintf("TINT\n"); +status=lnc->txRing[lnc->txPtr].md[1]+(lnc->txRing[lnc->txPtr].md[1]<<16); +kprintf("Status:[0x%X]\n",status); + +while(!lnc_driverOwnsTX(lnc)){ +status=lnc->txRing[lnc->txPtr].md[1]+(lnc->txRing[lnc->txPtr].md[1]<<16); +kprintf("md[1]:0x%X(%i)[0x%X]\n",lnc->txRing[lnc->txPtr].md[1],lnc->txPtr,status); +lnc->txRing[lnc->txPtr].md[1]=0x0; +lnc_nextTxPtr(lnc); +} +kprintf("TINT-DONE\n"); +} + +voidlncInt(){ +while(1){ +kprintf("Finished!!!\n"); +} +outportByte(0x20,0x20); +return; +uInt16csr0=0x0; +while((csr0=inportWord(lnc->ioAddr+RDP))&INTR){ +outportWord(lnc->ioAddr+RDP,csr0); +kprintf("CSR0:[0x%X]\n",csr0); +if(csr0&ERR){ +kprintf("Error:[0x%X]\n",csr0); +} +if(csr0&RINT){ +kprintf("RINT\n"); +} +if(csr0&TINT){ +kprintf("TINT\n"); +} +outportWord(lnc->ioAddr+RDP,csr0); +kprintf("CSR0:[0x%X]\n",csr0); +} +kprintf("Finished!!!\n"); +return; +} + +asm( +".globllnc_isr\n" +"lnc_isr:\n" +"pusha\n"/*Saveallregisters*/ +"push%ss\n" +"push%ds\n" +"push%es\n" +"push%fs\n" +"push%gs\n" +"calllnc_INT\n" +"mov$0xA0,%dx\n" +"mov$0x20,%ax\n" +"outb%al,%dx\n" +"mov$0x20,%dx\n" +"mov$0x20,%ax\n" +"outb%al,%dx\n" +"pop%gs\n" +"pop%fs\n" +"pop%es\n" +"pop%ds\n" +"pop%ss\n" +"popa\n" +"iret\n"/*Exitinterrupt*/ +); + +intlncAttach(structlncInfo*lnc,intunit){ +inti=0; +uint32_tlncSize=0x0; +uint16_tbcnt=0x0; + +/*InitializerxRing*/ +lncSize=(NDESC(lnc->nrdre)*sizeof(structhostRingEntry)); +//kprintf("rxRingSize:[%i]",lncSize); +lnc->rxRing=kmalloc(lncSize); + +if(!lnc->rxRing){ +kprintf("lnc%d:Couldn'tallocatememoryforrxRing\n",unit); +return(-1); +} + +memset(lnc->rxRing,0x0,lncSize); + +/*InitializerxBuffer*/ +lncSize=(NDESC(lnc->nrdre)*lnc->bufferSize); +//kprintf("rxBufferSize:[%i]\n",lncSize); +lnc->rxBuffer=kmalloc(lncSize); +if(!lnc->rxBuffer){ +kprintf("lnc%d:Couldn'tallocatememoryforrXBuffer\n",unit); +return(-1); +} +memset(lnc->rxBuffer,0x0,lncSize); + +/*SetuptheRXRing*/ +for(i=0;i<NDESC(lnc->nrdre);i++){ +lnc->rxRing[i].addr=(uint32_t)vmm_getRealAddr((uint32_t)lnc->rxBuffer+(i*lnc->bufferSize)); +bcnt=(uint16_t)(-lnc->bufferSize); +bcnt&=0x0FFF; +bcnt|=0xF000; +//kprintf("rxR[%i].addr=0x%X,BCNT0x%X",i,lnc->rxRing[i].addr,bcnt); +lnc->rxRing[i].bcnt=bcnt; +lnc->rxRing[i].md[1]=0x80; +} + +/*InitializetxRing*/ +lncSize=(NDESC(lnc->ntdre)*sizeof(structhostRingEntry)); +//kprintf("txRingSize:[%i]",lncSize); +lnc->txRing=kmalloc(lncSize); + +if(!lnc->txRing){ +kprintf("lnc%d:Couldn'tallocatememoryfortxRing\n",unit); +return(-1); +} + +memset(lnc->txRing,0x0,lncSize); + +/*InitializetxBuffer*/ +lncSize=(NDESC(lnc->ntdre)*lnc->bufferSize); +//kprintf("txBufferSize:[%i]\n",lncSize); +lnc->txBuffer=kmalloc(lncSize); +if(!lnc->txBuffer){ +kprintf("lnc%d:Couldn'tallocatememoryfortxBuffer\n",unit); +return(-1); +} +memset(lnc->txBuffer,0x0,lncSize); + +/*SetuptheTXRing*/ +for(i=0;i<NDESC(lnc->ntdre);i++){ +lnc->txRing[i].addr=(uint32_t)vmm_getRealAddr((uint32_t)lnc->txBuffer+(i*lnc->bufferSize)); +bcnt=(uint16_t)(-lnc->bufferSize); +bcnt&=0x0FFF; +bcnt|=0xF000; +//kprintf("txR[%i].addr=0x%X,BCNT0x%X",i,lnc->txRing[i].addr,bcnt); +lnc->txRing[i].bcnt=bcnt; +} + +/*MrOlsen2017-12-16 +if(lnc->nic.memMode!=SHMEM) +lncMemSize+=sizeof(structinitBlock)+(sizeof(structmds)*(NDESC(lnc->nrdre)+NDESC(lnc->ntdre)))+MEM_SLEW; +if(lnc->nic.memMode==DMA_FIXED) +lncMemSize+=(NDESC(lnc->nrdre)*RECVBUFSIZE)+(NDESC(lnc->ntdre)*TRANSBUFSIZE); +*/ + +if(lnc->nic.memMode!=SHMEM) +if(lnc->nic.ic<PCnet_32) +kprintf("ISABoard\n"); +else +kprintf("PCIBoard\n"); + +lnc->nic.mode=NORMAL; + +kprintf("lnc%d:",unit); +if(lnc->nic.ic==LANCE||lnc->nic.ic==C_LANCE) +kprintf("%s(%s)",nicIdent[lnc->nic.ident],icIdent[lnc->nic.ic]); +else +kprintf("%s",icIdent[lnc->nic.ic]); + +kprintf("address%x:%x:%x:%x:%x:%x\n",lnc->arpcom.ac_enaddr[0],lnc->arpcom.ac_enaddr[1],lnc->arpcom.ac_enaddr[2],lnc->arpcom.ac_enaddr[3],lnc->arpcom.ac_enaddr[4],lnc->arpcom.ac_enaddr[5]); +return(1); +} + +intlnc_driverOwnsTX(structlncInfo*lnc){ +return(lnc->txRing[lnc->txPtr].md[1]&0x80)==0; +} + +intlnc_driverOwnsRX(structlncInfo*lnc){ +return(lnc->rxRing[lnc->rxPtr].md[1]&0x80)==0; +} + +intlnc_nextTxPtr(structlncInfo*lnc){ +intret=lnc->txPtr+1; + +if(ret==NDESC(lnc->ntdre)){ +ret=0; +} + +lnc->txPtr=ret; + +return(0); +} + +intlnc_nextRxPtr(structlncInfo*lnc){ +intret=lnc->rxPtr+1; + +if(ret==NDESC(lnc->nrdre)){ +ret=0; +} + +lnc->rxPtr=ret; + +return(0); +} + +intlnc_sendPacket(structlncInfo*lnc,void*packet,size_tlen,uint8_t*dest){ +//kprintf("SENDPACKET1![%i]\n",lnc->txPtr); +if(!lnc_driverOwnsTX(lnc)){ +kpanic("NOTXBUFFERS"); +return(0); +} + +//kprintf("SENDPACKET2![%i]\n",lnc->txPtr); + +memcpy((void*)(lnc->txBuffer+(lnc->txPtr*lnc->bufferSize)),packet,len); + +lnc->txRing[lnc->txPtr].md[1]|=0x2; +lnc->txRing[lnc->txPtr].md[1]|=0x1; + +uint16_tbcnt=(uint16_t)(-len); +bcnt&=0xFFF; +bcnt|=0xF000; +lnc->txRing[lnc->txPtr].bcnt=bcnt; + +lnc->txRing[lnc->txPtr].md[1]|=0x80; + +lnc_nextTxPtr(lnc); + +//kprintf("SENDPACKET3![%i]\n",lnc->txPtr); +return(len); +} + +intlnc_getMode(structlncInfo*lnc){ +lnc_reset32(lnc); +if(lnc_readCSR32(lnc,CSR0)==CSR0_STOP) +returnMODE_32; + +lnc_reset(lnc); +if(lnc_readCSR(lnc,CSR0)==CSR0_STOP) +returnMODE_16; + +return(MODE_INVALID); +} + +voidlnc_reset(structlncInfo*lnc){ +inportWord(lnc->ioAddr+RESET); +} + +voidlnc_reset32(structlncInfo*lnc){ +inportDWord(lnc->ioAddr+RESET32); +} + +intlnc_switchDWord(structlncInfo*lnc){ +inportDWord(lnc->ioAddr+RESET32); +inportWord(lnc->ioAddr+RESET); +outportDWord(lnc->ioAddr+RDP,0); + +/*adwordwritetoRDPsetscontrollerinto32-bitI/Omode*/ +if(!(lnc_readBCR32(lnc,BCR18)&BCR18_DWIO)){ +kprintf("CannotSwithcTo32Bit"); +} +uint32_t_csr58=lnc_readCSR32(lnc,CSR58); +_csr58&=0xFFF0; +_csr58|=2; +lnc_writeCSR32(lnc,CSR58,_csr58); + +return(0); + +} - + diff --git a/doc/xml/lnc_8h.xml b/doc/xml/lnc_8h.xml index 4428204..c7ff35e 100644 --- a/doc/xml/lnc_8h.xml +++ b/doc/xml/lnc_8h.xml @@ -1,47 +1,107 @@ - - - + + + lnc.h - ubixos/types.h - src/sys/pci/lnc.c + sys/types.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c + C:/Dev/git/UbixOS/sys/pci/lnc.c - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - - - + + + + + + + + + + + + + + + + + + arpcom hostRingEntry - initBlock + hostRingEntry_old + initBlock16 + initBlock32 lncInfo mds nicInfo - + Am79C960 0x0003 @@ -50,10 +110,9 @@ - - probe + - + Am79C961 0x2260 @@ -62,10 +121,9 @@ - - probe + - + Am79C961A 0x2261 @@ -74,10 +132,9 @@ - - probe + - + Am79C965 0x2430 @@ -86,10 +143,9 @@ - - probe + - + Am79C970 0x0242 @@ -98,10 +154,9 @@ - - probe + - + Am79C970A 0x2621 @@ -110,10 +165,9 @@ - - probe + - + Am79C971 0x2623 @@ -122,10 +176,9 @@ - - probe + - + Am79C972 0x2624 @@ -134,10 +187,9 @@ - - probe + - + Am79C973 0x2625 @@ -146,10 +198,9 @@ - - probe + - + Am79C978 0x2626 @@ -158,10 +209,9 @@ - - probe + - + AMD_MASK 0x003 @@ -170,10 +220,9 @@ - - probe + - + BABL 0x4000 @@ -182,22 +231,75 @@ - + - - C_LANCE - 2 + + BCR18 + 18 - - lanceProbe - lncAttach + - + + BCR18_DWIO + 0x0080 + + + + + + + + + + BCR20 + 0x0014 + + + + + + + + + + BDP + 0x16 + + + + + + + + + + BDP32 + 0x1C + + + + + + + + + + C_LANCE + 2 /* Am79C90 */ + + + + + + + + + CERR 0x2000 @@ -206,9 +308,9 @@ - + - + CSR0 0x0000 @@ -217,11 +319,20 @@ - - initLNC - lanceProbe + - + + CSR0_STOP + 0x0004 + + + + + + + + + CSR1 1 @@ -230,9 +341,53 @@ - + - + + CSR15 + 15 + + + + + + + + + + CSR15_DRTY + 0x0020 + + + + + + + + + + CSR15_DXMTFCS + 0x0008 + + + + + + + + + + CSR15_PROM + 0x8000 + + + + + + + + + CSR2 2 @@ -241,9 +396,9 @@ - + - + CSR3 3 @@ -252,11 +407,20 @@ - - initLNC - lanceProbe + - + + CSR58 + 0x003A + + + + + + + + + CSR88 88 @@ -265,10 +429,9 @@ - - probe + - + CSR89 89 @@ -277,10 +440,9 @@ - - probe + - + DMA_FIXED 1 @@ -289,11 +451,9 @@ - - initLNC - lncAttach + - + DMA_MBUF 2 @@ -302,9 +462,9 @@ - + - + ERR 0x8000 @@ -313,10 +473,9 @@ - - lncInt + - + ETHER_ADDR_LEN 6 @@ -325,10 +484,9 @@ - - initLNC + - + IDON 0x0100 @@ -337,10 +495,9 @@ - - initLNC + - + INEA 0x0040 @@ -349,11 +506,9 @@ - - initLNC - lanceProbe + - + INIT 0x0001 @@ -362,10 +517,9 @@ - - initLNC + - + INTR 0x0080 @@ -374,23 +528,20 @@ - - lncInt + - + LANCE - 1 + 1 /* Am7990 */ - - lanceProbe - lncAttach + - + MEM_SLEW 8 @@ -399,10 +550,9 @@ - - lncAttach + - + MERR 0x0800 @@ -411,9 +561,9 @@ - + - + MISS 0x1000 @@ -422,9 +572,42 @@ - + - + + MODE_16 + 0 + + + + + + + + + + MODE_32 + 1 + + + + + + + + + + MODE_INVALID + 3 + + + + + + + + + NDESC len2 (1 << len2) @@ -434,10 +617,9 @@ - - lncAttach + - + NE2100 2 @@ -446,10 +628,9 @@ - - initLNC + - + NE2100_IOSIZE 24 @@ -458,9 +639,9 @@ - + - + NORMAL 0 @@ -469,10 +650,9 @@ - - lncAttach + - + NRDRE 3 @@ -481,10 +661,9 @@ - - initLNC + - + NTDRE 3 @@ -493,10 +672,9 @@ - - initLNC + - + PART_MASK 0xffff @@ -505,167 +683,108 @@ - - probe + - + PCnet_32 - 6 + 6 /* Am79C965 */ - - initLNC - lncAttach - probe + - - PCNET_BDP - 0x16 - - - - - - - - initLNC - - + PCnet_FAST - 9 + 9 /* Am79C971 */ - - probe + - + PCnet_FASTplus - 10 + 10 /* Am79C972 */ - - probe + - + PCnet_Home - 11 + 11 /* Am79C978 */ - - probe + - + PCnet_ISA - 3 + 3 /* Am79C960 */ - - probe + - + PCnet_ISA_II - 5 + 5 /* Am79C961A */ - - probe + - + PCnet_ISAplus - 4 + 4 /* Am79C961 */ - - probe + - + PCnet_PCI - 7 + 7 /* Am79C970 */ - - probe + - + PCnet_PCI_II - 8 + 8 /* Am79C970A */ - - probe + - - PCNET_RAP - 0x12 - - - - - - - - initLNC - - - PCNET_RDP - 0x10 - - - - - - - - initLNC - - - PCNET_RESET - 0x14 - - - - - - - - - + PCNET_VSW 0x18 @@ -674,9 +793,53 @@ - + - + + RAP + 0x12 + + + + + + + + + + RAP32 + 0x14 + + + + + + + + + + RDP + 0x10 + + + + + + + + + + RDP32 + 0x10 + + + + + + + + + RECVBUFSIZE 1518 @@ -685,10 +848,31 @@ - - lncAttach + - + + RESET + 0x14 + + + + + + + + + + RESET32 + 0x18 + + + + + + + + + RINT 0x0400 @@ -697,10 +881,9 @@ - - lncInt + - + RXON 0x0020 @@ -709,9 +892,9 @@ - + - + SHMEM 4 @@ -720,22 +903,9 @@ - - lncAttach + - - STOP - 0x0004 - - - - - - - - lanceProbe - - + STRT 0x0002 @@ -744,10 +914,9 @@ - - initLNC + - + TDMD 0x0008 @@ -756,9 +925,9 @@ - + - + TINT 0x0200 @@ -767,10 +936,9 @@ - - lncInt + - + TRANSBUFSIZE 1518 @@ -779,10 +947,9 @@ - - lncAttach + - + TXON 0x0010 @@ -791,23 +958,62 @@ - + - + UNKNOWN - 0 + 0 /* Unknown */ - - lanceProbe + + + + + + struct lncInfo * + struct lncInfo* lnc + + lnc + + + + + + + + initLNC + lanceProbe + lnc_driverOwnsRX + lnc_driverOwnsTX + lnc_getMode + lnc_INT + lnc_nextRxPtr + lnc_nextTxPtr + lnc_probe + lnc_readBCR + lnc_readBCR32 + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + lnc_rxINT + lnc_sendPacket + lnc_switchDWord + lnc_thread + lnc_writeBCR + lnc_writeBCR32 + lnc_writeCSR + lnc_writeCSR32 + lncAttach + lncInt - + void void _lncInt () @@ -818,12 +1024,11 @@ - - initLNC + - - void - void initLNC + + int + int initLNC () initLNC @@ -832,50 +1037,65 @@ - - _lncInt - arpcom::ac_enaddr - lncInfo::arpcom - lncInfo::bdp - CSR0 - CSR3 - dDpl3 - dInt - DMA_FIXED - dPresent - ETHER_ADDR_LEN - nicInfo::ic - nicInfo::ident - IDON - INEA - INIT - inportByte - kmalloc - kprintf - lnc - lncAttach - nicInfo::memMode - mVec - NE2100 - lncInfo::nic - lncInfo::nrdre - NRDRE - lncInfo::ntdre - NTDRE - PCnet_32 - PCNET_BDP - PCNET_RAP - PCNET_RDP - probe - lncInfo::rap - lncInfo::rdp - readCsr - setVector - STRT - writeCsr - x1000 + + arpcom::ac_enaddr + lncInfo::arpcom + lncInfo::bufferSize + CSR0 + CSR1 + CSR2 + CSR3 + dDpl3 + dInt + DMA_FIXED + dPresent + ETHER_ADDR_LEN + nicInfo::ic + nicInfo::ident + IDON + INEA + lncInfo::init + INIT + inportByte + lncInfo::ioAddr + irqEnable + kmalloc + kprintf + lnc + lnc_getMode + lnc_isr + lnc_probe + lnc_readBCR32 + lnc_readCSR32 + lnc_switchDWord + lnc_writeBCR32 + lnc_writeCSR32 + lncAttach + nicInfo::memMode + memset + initBlock32::mode + MODE_16 + MODE_32 + NE2100 + lncInfo::nic + lncInfo::nrdre + NRDRE + lncInfo::ntdre + NTDRE + initBlock32::padr + PCnet_32 + initBlock32::rdra + initBlock32::rlen + lncInfo::rxRing + setVector + STRT + sVec + initBlock32::tdra + initBlock32::tlen + lncInfo::txRing + vmm_getRealAddr - + int int lanceProbe (struct lncInfo *lnc) @@ -890,22 +1110,523 @@ - - C_LANCE - CSR0 - CSR3 - INEA - inportWord - LANCE - lnc - lncInfo::rdp - readCsr - STOP - UNKNOWN - writeCsr - probe + + C_LANCE + CSR0 + CSR0_STOP + CSR3 + INEA + inportWord + lncInfo::ioAddr + LANCE + lnc + lnc_readCSR + lnc_writeCSR + RDP + UNKNOWN + lnc_probe - + + int + int lnc_driverOwnsRX + (struct lncInfo *) + lnc_driverOwnsRX + + struct lncInfo * + + + + + + + + + lnc + hostRingEntry::md + lncInfo::rxPtr + lncInfo::rxRing + lnc_rxINT + lnc_thread + + + int + int lnc_getMode + (struct lncInfo *) + lnc_getMode + + struct lncInfo * + + + + + + + + + CSR0 + CSR0_STOP + lnc + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + MODE_16 + MODE_32 + MODE_INVALID + initLNC + + + void + void lnc_INT + () + lnc_INT + + + + + + + + CSR0 + ERR + kprintf + lnc + lnc_writeCSR32 + RINT + TINT + + + void + void lnc_isr + () + lnc_isr + + + + + + + + initLNC + + + int + int lnc_probe + (struct lncInfo *) + lnc_probe + + struct lncInfo * + + + + + + + + + Am79C960 + Am79C961 + Am79C961A + Am79C965 + Am79C970 + Am79C970A + Am79C971 + Am79C972 + Am79C973 + Am79C978 + AMD_MASK + CSR88 + CSR89 + lanceProbe + lnc + lnc_readCSR + PART_MASK + PCnet_32 + PCnet_FAST + PCnet_FASTplus + PCnet_Home + PCnet_ISA + PCnet_ISA_II + PCnet_ISAplus + PCnet_PCI + PCnet_PCI_II + initLNC + + + uint16_t + uint16_t lnc_readBCR + (struct lncInfo *, uint16_t) + lnc_readBCR + + struct lncInfo * + + + uint16_t + + + + + + + + + BDP + inportWord + lncInfo::ioAddr + lnc + outportWord + RAP + + + uint32_t + uint32_t lnc_readBCR32 + (struct lncInfo *, uint32_t) + lnc_readBCR32 + + struct lncInfo * + + + uint32_t + + + + + + + + + BDP32 + inportDWord + lncInfo::ioAddr + lnc + outportDWord + RAP32 + initLNC + lnc_switchDWord + + + uint16_t + uint16_t lnc_readCSR + (struct lncInfo *, uint16_t) + lnc_readCSR + + struct lncInfo * + + + uint16_t + + + + + + + + + inportWord + lncInfo::ioAddr + lnc + outportWord + RAP + RDP + lanceProbe + lnc_getMode + lnc_probe + + + uint32_t + uint32_t lnc_readCSR32 + (struct lncInfo *, uint32_t) + lnc_readCSR32 + + struct lncInfo * + + + uint32_t + + + + + + + + + inportDWord + lncInfo::ioAddr + lnc + outportDWord + RAP32 + RDP32 + initLNC + lnc_getMode + lnc_switchDWord + + + void + void lnc_reset + (struct lncInfo *) + lnc_reset + + struct lncInfo * + + + + + + + + + inportWord + lncInfo::ioAddr + lnc + RESET + lnc_getMode + + + void + void lnc_reset32 + (struct lncInfo *) + lnc_reset32 + + struct lncInfo * + + + + + + + + + inportDWord + lncInfo::ioAddr + lnc + RESET32 + lnc_getMode + + + void + void lnc_rxINT + () + lnc_rxINT + + + + + + + + nicBuffer::buffer + lncInfo::bufferSize + kmalloc + nicBuffer::length + lnc + lnc_driverOwnsRX + lnc_nextRxPtr + hostRingEntry::md + memset + lncInfo::rxBuffer + lncInfo::rxPtr + lncInfo::rxRing + tmpBuf + + + int + int lnc_sendPacket + (struct lncInfo *lnc, void *packet, size_t len, uInt8 *dest) + lnc_sendPacket + + struct lncInfo * + lnc + + + void * + packet + + + size_t + len + + + uInt8 * + dest + + + + + + + + + hostRingEntry::bcnt + lncInfo::bufferSize + kpanic + lnc + lnc_driverOwnsTX + lnc_nextTxPtr + hostRingEntry::md + memcpy + lncInfo::txBuffer + lncInfo::txPtr + lncInfo::txRing + + + int + int lnc_switchDWord + (struct lncInfo *) + lnc_switchDWord + + struct lncInfo * + + + + + + + + + BCR18 + BCR18_DWIO + CSR58 + inportDWord + inportWord + lncInfo::ioAddr + kprintf + lnc + lnc_readBCR32 + lnc_readCSR32 + lnc_writeCSR32 + outportDWord + RDP + RESET + RESET32 + initLNC + + + void + void lnc_txINT + () + lnc_txINT + + + + + + + + + + void + void lnc_writeBCR + (struct lncInfo *, uint16_t, uint16_t) + lnc_writeBCR + + struct lncInfo * + + + uint16_t + + + uint16_t + + + + + + + + + BDP + lncInfo::ioAddr + lnc + outportWord + RAP + + + void + void lnc_writeBCR32 + (struct lncInfo *, uint32_t, uint32_t) + lnc_writeBCR32 + + struct lncInfo * + + + uint32_t + + + uint32_t + + + + + + + + + BDP32 + lncInfo::ioAddr + lnc + outportDWord + RAP32 + initLNC + + + void + void lnc_writeCSR + (struct lncInfo *, uint16_t, uint16_t) + lnc_writeCSR + + struct lncInfo * + + + uint16_t + + + uint16_t + + + + + + + + + lncInfo::ioAddr + lnc + outportWord + RAP + RDP + lanceProbe + + + void + void lnc_writeCSR32 + (struct lncInfo *, uint32_t, uint32_t) + lnc_writeCSR32 + + struct lncInfo * + + + uint32_t + + + uint32_t + + + + + + + + + lncInfo::ioAddr + lnc + outportDWord + RAP32 + RDP32 + initLNC + lnc_INT + lnc_switchDWord + + int int lncAttach (struct lncInfo *lnc, int unit) @@ -924,35 +1645,35 @@ - - arpcom::ac_enaddr - lncInfo::arpcom - C_LANCE - DMA_FIXED - nicInfo::ic - icIdent - nicInfo::ident - kmalloc - kprintf - LANCE - lnc - MEM_SLEW - nicInfo::memMode - nicInfo::mode - NDESC - lncInfo::nic - nicIdent - NORMAL - lncInfo::nrdre - lncInfo::ntdre - PCnet_32 - RECVBUFSIZE - lncInfo::recvRing - SHMEM - TRANSBUFSIZE - initLNC + + hostRingEntry::addr + hostRingEntry::bcnt + lncInfo::bufferSize + C_LANCE + nicInfo::ic + kmalloc + kprintf + LANCE + lnc + hostRingEntry::md + nicInfo::memMode + memset + nicInfo::mode + NDESC + lncInfo::nic + NORMAL + lncInfo::nrdre + lncInfo::ntdre + PCnet_32 + lncInfo::rxBuffer + lncInfo::rxRing + SHMEM + lncInfo::txBuffer + lncInfo::txRing + vmm_getRealAddr + initLNC - + void void lncInt () @@ -963,20 +1684,20 @@ - - ERR - inportWord - INTR - kprintf - lnc - outportByte - outportWord - lncInfo::rdp - RINT - TINT - x20 + + ERR + inportWord + INTR + lncInfo::ioAddr + kprintf + lnc + outportByte + outportWord + RDP + RINT + TINT - + int int probe (struct lncInfo *lnc) @@ -991,171 +1712,7 @@ - - Am79C960 - Am79C961 - Am79C961A - Am79C965 - Am79C970 - Am79C970A - Am79C971 - Am79C972 - Am79C973 - Am79C978 - AMD_MASK - CSR88 - CSR89 - lanceProbe - lnc - PART_MASK - PCnet_32 - PCnet_FAST - PCnet_FASTplus - PCnet_Home - PCnet_ISA - PCnet_ISA_II - PCnet_ISAplus - PCnet_PCI - PCnet_PCI_II - readCsr - initLNC - - - uInt16 - uInt16 readBcr - (struct lncInfo *lnc, uInt16 port) - readBcr - - struct lncInfo * - lnc - - - uInt16 - port - - - - - - - - - lncInfo::bdp - inportWord - outportWord - lncInfo::rap - - - uInt16 - uInt16 readCsr - (struct lncInfo *lnc, uInt16 port) - readCsr - - struct lncInfo * - lnc - - - uInt16 - port - - - - - - - - - inportWord - lnc - outportWord - lncInfo::rap - lncInfo::rdp - initLNC - lanceProbe - probe - - - void - void writeBcr - (struct lncInfo *lnc, uInt16 port, uInt16 val) - writeBcr - - struct lncInfo * - lnc - - - uInt16 - port - - - uInt16 - val - - - - - - - - - lncInfo::bdp - lnc - outportWord - lncInfo::rap - - - void - void writeCsr - (struct lncInfo *lnc, uInt16 port, uInt16 val) - writeCsr - - struct lncInfo * - lnc - - - uInt16 - port - - - uInt16 - val - - - - - - - - - lnc - outportWord - lncInfo::rap - lncInfo::rdp - initLNC - lanceProbe - - - - - lncInfo * - struct lncInfo* lnc - - lnc - - - - - - - - initLNC - lanceProbe - lncAttach - lncInt - probe - readCsr - writeBcr - writeCsr + @@ -1163,213 +1720,264 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: lnc_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_LNC_H -#define_LNC_H - -#include<ubixos/types.h> - -#defineNDESC(len2)(1<<len2) -#defineNORMAL0 -#defineMEM_SLEW8 -#defineTRANSBUFSIZE1518 -#defineRECVBUFSIZE1518 -#defineNRDRE3 -#defineNTDRE3 -#defineETHER_ADDR_LEN6 -#defineNE2100_IOSIZE24 -#definePCNET_RDP0x10/*RegisterDataPort*/ -#definePCNET_RAP0x12/*RegisterAddressPort*/ -#definePCNET_RESET0x14 -#definePCNET_BDP0x16 -#definePCNET_VSW0x18 -#defineNE21002 - -/*mem_modevalues*/ -#defineDMA_FIXED1 -#defineDMA_MBUF2 -#defineSHMEM4 - - -/**********ChipTypes**********/ -#defineUNKNOWN0/*Unknown*/ -#defineLANCE1/*Am7990*/ -#defineC_LANCE2/*Am79C90*/ -#definePCnet_ISA3/*Am79C960*/ -#definePCnet_ISAplus4/*Am79C961*/ -#definePCnet_ISA_II5/*Am79C961A*/ -#definePCnet_326/*Am79C965*/ -#definePCnet_PCI7/*Am79C970*/ -#definePCnet_PCI_II8/*Am79C970A*/ -#definePCnet_FAST9/*Am79C971*/ -#definePCnet_FASTplus10/*Am79C972*/ -#definePCnet_Home11/*Am79C978*/ - -/********AM7990Specifics**************/ -#defineCSR00x0000 -#defineCSR11 -#defineCSR22 -#defineCSR33 -#defineCSR8888 -#defineCSR8989 - -#defineERR0x8000 -#defineBABL0x4000 -#defineCERR0x2000 -#defineMISS0x1000 -#defineMERR0x0800 -#defineRINT0x0400 -#defineTINT0x0200 -#defineIDON0x0100 -#defineINTR0x0080 -#defineINEA0x0040 -#defineRXON0x0020 -#defineTXON0x0010 -#defineTDMD0x0008 -#defineSTOP0x0004 -#defineSTRT0x0002 -#defineINIT0x0001 - - -/*CSR88-89:ChipIDmasks*/ -#defineAMD_MASK0x003 -#definePART_MASK0xffff -#defineAm79C9600x0003 -#defineAm79C9610x2260 -#defineAm79C961A0x2261 -#defineAm79C9650x2430 -#defineAm79C9700x0242 -#defineAm79C970A0x2621 -#defineAm79C9710x2623 -#defineAm79C9720x2624 -#defineAm79C9730x2625 -#defineAm79C9780x2626 - -/**********Structs**********/ - - - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_PCI_LNC_H +#define_PCI_LNC_H + +#include<sys/types.h> + +//TEMPCOMMENTFRESH +#defineRDP0x10//RegisterDataPort16Bit +#defineRDP320x10//RegisterDataPort32Bit +#defineRAP0x12//RegisterAddressPort16Bit +#defineRAP320x14//RegisterAddressPort32Bit +#defineRESET0x14//ResetPort16Bit +#defineRESET320x18//ResetPort32Bit +#defineBDP0x16//16Bit +#defineBDP320x1C//32Bit + +//BCR18 +#defineBCR1818 +#defineBCR18_DWIO0x0080 + +//BCR20 +#defineBCR200x0014 + +//Modes +#defineMODE_160 +#defineMODE_321 +#defineMODE_INVALID3 + +//CSR0 +#defineCSR00x0000 +#defineCSR0_STOP0x0004 + +//CSR15 +#defineCSR1515 +#defineCSR15_DXMTFCS0x0008 +#defineCSR15_DRTY0x0020 +#defineCSR15_PROM0x8000 + +//CSR58 +#defineCSR580x003A + +structmds{ +uint16_tmd0; +uint16_tmd1; +shortmd2; +uint16_tmd3; +}; + +structhostRingEntry_old{ +structmds*md; +union{ +//structmbuf*mbuf; +char*data; +}buff; +}; + +structhostRingEntry{ +uint32_taddr; +uint16_tbcnt; +uint8_tmd[6]; +uint32_treserved; +}; + +structarpcom{ +//structifnetac_if;/*network-visibleinterface*/ +uint8_tac_enaddr[6];/*ethernethardwareaddress*/ +intac_multicnt;/*lengthofac_multiaddrslist*/ +void*ac_netgraph;/*ng_ether(4)netgraphnodeinfo*/ +}; + +structnicInfo{ +intident;/*Typeofcard*/ +intic;/*Typeofic,Am7990,Am79C960etc.*/ +intmemMode; +intiobase; +intmode;/*Modesettingatinitialization*/ +}; + +structinitBlock16{ +uint16_tmode;//Moderegister +uint8_tpadr[6];//Ethernetaddress +uint8_tladrf[8];//Logicaladdressfilter(multicast) +uint16_trdra;//Loworderpointertoreceivering +uint16_trlen;//Highorderpointerandno.rings +uint16_ttdra;//Loworderpointertotransmitring +uint16_ttlen;//Highorderpointerandnorings +}; -structinitBlock{ -uInt16mode;/*Moderegister*/ -uInt8padr[6];/*Ethernetaddress*/ -uInt8ladrf[8];/*Logicaladdressfilter(multicast)*/ -uInt16rdra;/*Loworderpointertoreceivering*/ -uInt16rlen;/*Highorderpointerandno.rings*/ -uInt16tdra;/*Loworderpointertotransmitring*/ -uInt16tlen;/*Highorderpointerandnorings*/ -}; - -structmds{ -uInt16md0; -uInt16md1; -shortmd2; -uInt16md3; -}; - -structhostRingEntry{ -structmds*md; -union{ -//structmbuf*mbuf; -char*data; -}buff; -}; - -structarpcom{ -//structifnetac_if;/*network-visibleinterface*/ -uInt8ac_enaddr[6];/*ethernethardwareaddress*/ -intac_multicnt;/*lengthofac_multiaddrslist*/ -void*ac_netgraph;/*ng_ether(4)netgraphnodeinfo*/ -}; - -structnicInfo{ -intident;/*Typeofcard*/ -intic;/*Typeofic,Am7990,Am79C960etc.*/ -intmemMode; -intiobase; -intmode;/*Modesettingatinitialization*/ -}; +structinitBlock32{ +uint16_tmode; +uint8_trlen; +uint8_ttlen; +uint8_tpadr[6]; +uint16_tres; +uint8_tladrf[8]; +uint32_trdra; +uint32_ttdra; +}; + +structlncInfo{ +structarpcomarpcom; +structnicInfonic; +structhostRingEntry*rxRing; +char*rxBuffer; +structhostRingEntry*txRing; +char*txBuffer; +structinitBlock32init; +unsignedintioAddr; +intnrdre; +intntdre; +intbufferSize; +inttxPtr; +intrxPtr; +}; + +/*Functions*/ +voidlnc_writeCSR(structlncInfo*,uint16_t,uint16_t); +voidlnc_writeCSR32(structlncInfo*,uint32_t,uint32_t); + +uint16_tlnc_readCSR(structlncInfo*,uint16_t); +uint32_tlnc_readCSR32(structlncInfo*,uint32_t); + +voidlnc_writeBCR(structlncInfo*,uint16_t,uint16_t); +voidlnc_writeBCR32(structlncInfo*,uint32_t,uint32_t); + +uint16_tlnc_readBCR(structlncInfo*,uint16_t); +uint32_tlnc_readBCR32(structlncInfo*,uint32_t); -structlncInfo{ -structarpcomarpcom; -structnicInfonic; -structhostRingEntry*recvRing; -structhostRingEntry*transRings; -structinitBlock*initBloack; -intrap; -intrdp; -intbdp; -intnrdre; -intntdre; -}; +voidlnc_reset(structlncInfo*); +voidlnc_reset32(structlncInfo*); + +intlnc_probe(structlncInfo*); + +intlnc_switchDWord(structlncInfo*); + +intlnc_getMode(structlncInfo*); + +voidlnc_isr(); +intlnc_driverOwnsRX(structlncInfo*); +intlnc_driverOwnsRX(structlncInfo*); -externstructlncInfo*lnc; - -voidwriteCsr(structlncInfo*lnc,uInt16port,uInt16val); -uInt16readCsr(structlncInfo*lnc,uInt16port); -voidwriteBcr(structlncInfo*lnc,uInt16port,uInt16val); -uInt16readBcr(structlncInfo*lnc,uInt16port); - -voidinitLNC(); -intprobe(structlncInfo*lnc); -intlanceProbe(structlncInfo*lnc); -intlncAttach(structlncInfo*lnc,intunit); - - -voidlncInt(); -void_lncInt(); +voidlnc_INT(); +voidlnc_rxINT(); +voidlnc_txINT(); + +//OLD + +#defineNDESC(len2)(1<<len2) +#defineNORMAL0 +#defineMEM_SLEW8 +#defineTRANSBUFSIZE1518 +#defineRECVBUFSIZE1518 +#defineNRDRE3 +#defineNTDRE3 +#defineETHER_ADDR_LEN6 +#defineNE2100_IOSIZE24 -#endif - -/*** -$Log: lnc_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:50reddawg -nomessage - -Revision1.22004/05/2115:05:07reddawg -Cleanedup - - -END -***/ +#definePCNET_VSW0x18 +#defineNE21002 + +/*mem_modevalues*/ +#defineDMA_FIXED1 +#defineDMA_MBUF2 +#defineSHMEM4 + +/**********ChipTypes**********/ +#defineUNKNOWN0/*Unknown*/ +#defineLANCE1/*Am7990*/ +#defineC_LANCE2/*Am79C90*/ +#definePCnet_ISA3/*Am79C960*/ +#definePCnet_ISAplus4/*Am79C961*/ +#definePCnet_ISA_II5/*Am79C961A*/ +#definePCnet_326/*Am79C965*/ +#definePCnet_PCI7/*Am79C970*/ +#definePCnet_PCI_II8/*Am79C970A*/ +#definePCnet_FAST9/*Am79C971*/ +#definePCnet_FASTplus10/*Am79C972*/ +#definePCnet_Home11/*Am79C978*/ + +/********AM7990Specifics**************/ +#defineCSR11 +#defineCSR22 +#defineCSR33 +#defineCSR8888 +#defineCSR8989 + +#defineERR0x8000 +#defineBABL0x4000 +#defineCERR0x2000 +#defineMISS0x1000 +#defineMERR0x0800 +#defineRINT0x0400 +#defineTINT0x0200 +#defineIDON0x0100 +#defineINTR0x0080 +#defineINEA0x0040 +#defineRXON0x0020 +#defineTXON0x0010 +#defineTDMD0x0008 + +#defineSTRT0x0002 +#defineINIT0x0001 + +/*CSR88-89:ChipIDmasks*/ +#defineAMD_MASK0x003 +#definePART_MASK0xffff +#defineAm79C9600x0003 +#defineAm79C9610x2260 +#defineAm79C961A0x2261 +#defineAm79C9650x2430 +#defineAm79C9700x0242 +#defineAm79C970A0x2621 +#defineAm79C9710x2623 +#defineAm79C9720x2624 +#defineAm79C9730x2625 +#defineAm79C9780x2626 + +externstructlncInfo*lnc; + +intinitLNC(); +intprobe(structlncInfo*lnc); +intlanceProbe(structlncInfo*lnc); +intlncAttach(structlncInfo*lnc,intunit); + +voidlncInt(); +void_lncInt(); + +intlnc_sendPacket(structlncInfo*lnc,void*packet,size_tlen,uInt8*dest); + +#endif - + diff --git a/doc/xml/loopif_8c.xml b/doc/xml/loopif_8c.xml index 3e9cea0..08fcc34 100644 --- a/doc/xml/loopif_8c.xml +++ b/doc/xml/loopif_8c.xml @@ -1,218 +1,173 @@ - - - + + + loopif.c net/debug.h net/mem.h net/opt.h - netif/loopif.h - netif/tcpdump.h + netif/loopif.h + netif/tcpdump.h net/tcp.h - net/ipv4/ip.h + net/ipv4/ip.h - - - - + + + + + + + + - + - + - + - + - + + + - - - + + + - - - - + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - + + + + - - - + + + + + - - - + + - + - - - - - - - - - - - - - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void loopif_init (struct netif *netif) @@ -227,14 +182,11 @@ - - loopif_output - netif::name - netif::output - netMainThread + + netif::name - - err_t + + err_t static err_t loopif_output (struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) loopif_output @@ -247,7 +199,7 @@ p - struct ip_addr * + struct ip_addr * ipaddr @@ -256,21 +208,7 @@ - - bcopy - ERR_MEM - ERR_OK - netif::input - pbuf::len - pbuf::next - NULL - pbuf::payload - pbuf_alloc - PBUF_RAM - PBUF_RAW - tcpdump - pbuf::tot_len - loopif_init + @@ -310,49 +248,49 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: loopif_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:loopif.c542016-01-1101:29:55Zreddawg$ */ #include"net/debug.h" #include"net/mem.h" #include"net/opt.h" -#include"netif/loopif.h" -#include"netif/tcpdump.h" +#include"netif/loopif.h" +#include"netif/tcpdump.h" #include"net/tcp.h" -#include"net/ipv4/ip.h" +#include"net/ipv4/ip.h" /*-----------------------------------------------------------------------------------*/ -staticerr_t -loopif_output(structnetif*netif,structpbuf*p, -structip_addr*ipaddr) +staticerr_t +loopif_output(structnetif*netif,structpbuf*p, +structip_addr*ipaddr) { structpbuf*q,*r; char*ptr; -#ifdefLWIP_DEBUG -tcpdump(p); -#endif/*LWIP_DEBUG*/ +#ifdefLWIP_DEBUG +tcpdump(p); +#endif/*LWIP_DEBUG*/ -r=pbuf_alloc(PBUF_RAW,p->tot_len,PBUF_RAM); -if(r!=NULL){ -ptr=r->payload; +r=pbuf_alloc(PBUF_RAW,p->tot_len,PBUF_RAM); +if(r!=NULL){ +ptr=r->payload; -for(q=p;q!=NULL;q=q->next){ -bcopy(q->payload,ptr,q->len); -ptr+=q->len; +for(q=p;q!=NULL;q=q->next){ +bcopy(q->payload,ptr,q->len); +ptr+=q->len; } -netif->input(r,netif); -returnERR_OK; +netif->input(r,netif); +returnERR_OK; } -returnERR_MEM; +returnERR_MEM; } /*-----------------------------------------------------------------------------------*/ void -loopif_init(structnetif*netif) +loopif_init(structnetif*netif) { -netif->name[0]='l'; -netif->name[1]='o'; -netif->output=loopif_output; +netif->name[0]='l'; +netif->name[1]='o'; +netif->output=loopif_output; } /*-----------------------------------------------------------------------------------*/ @@ -363,6 +301,6 @@ - + diff --git a/doc/xml/lwipopts_8h.xml b/doc/xml/lwipopts_8h.xml index 33b2e64..4658beb 100644 --- a/doc/xml/lwipopts_8h.xml +++ b/doc/xml/lwipopts_8h.xml @@ -1,283 +1,1615 @@ - - - + + + lwipopts.h - src/sys/include/net/memp.h - src/sys/include/net/opt.h + C:/Dev/git/UbixOS/sys/include/net/opt.h - - + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + + + - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + - - - + + + - - - - + + + + + + + + - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + - - - - + + + + - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + + + + + + + + + - - - - + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + API_LIB_DEBUG + LWIP_DBG_OFF + + + + + + + + + + API_MSG_DEBUG + LWIP_DBG_OFF + + + + + + + + + + ARP_MAXAGE + 300 + + + + + + + + + + ARP_QUEUE_LEN + 3 + + + + + + + + + + ARP_QUEUEING + 0 + + + + + + + + + ARP_TABLE_SIZE 10 @@ -286,14 +1618,21 @@ - - add_arp_entry - arp_init - arp_lookup - arp_tmr + - - DHCP_DOES_ARP_CHECK + + AUTOIP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + CHECKSUM_CHECK_ICMP 1 @@ -301,20 +1640,472 @@ - + - - ICMP_STATS + + CHECKSUM_CHECK_ICMP6 + 1 - + - + + CHECKSUM_CHECK_IP + 1 + + + + + + + + + + CHECKSUM_CHECK_TCP + 1 + + + + + + + + + + CHECKSUM_CHECK_UDP + 1 + + + + + + + + + + CHECKSUM_GEN_ICMP + 1 + + + + + + + + + + CHECKSUM_GEN_ICMP6 + 1 + + + + + + + + + + CHECKSUM_GEN_IP + 1 + + + + + + + + + + CHECKSUM_GEN_TCP + 1 + + + + + + + + + + CHECKSUM_GEN_UDP + 1 + + + + + + + + + + DEFAULT_ACCEPTMBOX_SIZE + 0 + + + + + + + + + + DEFAULT_RAW_RECVMBOX_SIZE + 0 + + + + + + + + + + DEFAULT_TCP_RECVMBOX_SIZE + 0 + + + + + + + + + + DEFAULT_THREAD_NAME + "lwIP" + + + + + + + + + + DEFAULT_THREAD_PRIO + 1 + + + + + + + + + + DEFAULT_THREAD_STACKSIZE + 0 + + + + + + + + + + DEFAULT_UDP_RECVMBOX_SIZE + 0 + + + + + + + + + + DHCP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + DHCP_DOES_ARP_CHECK + ((LWIP_DHCP) && (LWIP_ARP)) + + + + + + + + + + DNS_DEBUG + LWIP_DBG_OFF + + + + + + + + + + DNS_DOES_NAME_CHECK + 1 + + + + + + + + + + DNS_LOCAL_HOSTLIST + 0 + + + + + + + + + + DNS_LOCAL_HOSTLIST_IS_DYNAMIC + 0 + + + + + + + + + + DNS_MAX_NAME_LENGTH + 256 + + + + + + + + + + DNS_MAX_SERVERS + 2 + + + + + + + + + + DNS_TABLE_SIZE + 4 + + + + + + + + + + ETH_PAD_SIZE + 0 + + + + + + + + + + ETHARP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + ETHARP_STATS + (LWIP_ARP) + + + + + + + + + + ETHARP_SUPPORT_STATIC_ENTRIES + 0 + + + + + + + + + + ETHARP_SUPPORT_VLAN + 0 + + + + + + + + + + ETHARP_TABLE_MATCH_NETIF + 0 + + + + + + + + + + ICMP6_STATS + (LWIP_IPV6 && LWIP_ICMP6) + + + + + + + + + + ICMP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + ICMP_STATS + 1 + + + + + + + + + ICMP_TTL + (IP_DEFAULT_TTL) + + + + + + + + + + IGMP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + IGMP_STATS + (LWIP_IGMP) + + + + + + + + + + INET_DEBUG + LWIP_DBG_OFF + + + + + + + + + + IP6_DEBUG + LWIP_DBG_OFF + + + + + + + + + + IP6_FRAG_STATS + (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS)) + + + + + + + + + + IP6_STATS + (LWIP_IPV6) + + + + + + + + + + IP_DEBUG + LWIP_DBG_ON + + + + + + + + + + IP_DEFAULT_TTL 255 @@ -322,10 +2113,32 @@ - + - + IP_FORWARD + 0 + + + + + + + + + + IP_FORWARD_ALLOW_TX_ON_RX_NETIF + 0 + + + + + + + + + + IP_FRAG 1 @@ -333,10 +2146,10 @@ - + - - IP_OPTIONS + + IP_OPTIONS_ALLOWED 1 @@ -344,29 +2157,241 @@ - + - + + IP_REASS_DEBUG + LWIP_DBG_OFF + + + + + + + + + + IP_REASS_MAX_PBUFS + 10 + + + + + + + + + + IP_REASS_MAXAGE + 3 + + + + + + + + + + IP_REASSEMBLY + 1 + + + + + + + + + + IP_SOF_BROADCAST + 0 + + + + + + + + + + IP_SOF_BROADCAST_RECV + 0 + + + + + + + + + IP_STATS + 1 - + - + + IPFRAG_STATS + (IP_REASSEMBLY || IP_FRAG) + + + + + + + + + LINK_STATS + 1 - + - + + LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + 0 + + + + + + + + + + LWIP_ARP + 1 + + + + + + + + + + LWIP_AUTOIP + 0 + + + + + + + + + + LWIP_BROADCAST_PING + 1 + + + + + + + + + + LWIP_CALLBACK_API + 1 + + + + + + + + + + LWIP_CHECKSUM_CTRL_PER_NETIF + 0 + + + + + + + + + + LWIP_CHECKSUM_ON_COPY + 0 + + + + + + + + + + LWIP_COMPAT_MUTEX + 0 + + + + + + + + + + LWIP_COMPAT_MUTEX_ALLOWED + 1 + + + + + + + + + + LWIP_COMPAT_SOCKETS + 1 + + + + + + + + + + LWIP_DBG_MIN_LEVEL + LWIP_DBG_LEVEL_ALL + +#define LWIP_HOOK_ND6_GET_GW(netif, dest) + + + + + + + + + LWIP_DBG_TYPES_ON + LWIP_DBG_ON + + + + + + + + + LWIP_DHCP 0 @@ -375,9 +2400,867 @@ - + - + + LWIP_DHCP_AUTOIP_COOP + 0 + + + + + + + + + + LWIP_DHCP_AUTOIP_COOP_TRIES + 9 + + + + + + + + + + LWIP_DHCP_BOOTP_FILE + 0 + + + + + + + + + + LWIP_DHCP_GET_NTP_SRV + 0 + + + + + + + + + + LWIP_DHCP_MAX_DNS_SERVERS + DNS_MAX_SERVERS + + + + + + + + + + LWIP_DHCP_MAX_NTP_SERVERS + 1 + + + + + + + + + + LWIP_DNS + 0 + + + + + + + + + + LWIP_DNS_SECURE + (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) + + + + + + + + + + LWIP_DNS_SUPPORT_MDNS_QUERIES + 0 + + + + + + + + + + LWIP_ETHERNET + LWIP_ARP + + + + + + + + + + LWIP_EVENT_API + 0 + + + + + + + + + + LWIP_FIONREAD_LINUXMODE + 0 + + + + + + + + + + LWIP_HAVE_LOOPIF + LWIP_NETIF_LOOPBACK + + + + + + + + + + LWIP_ICMP + 1 + + + + + + + + + + LWIP_ICMP6 + (LWIP_IPV6) + + + + + + + + + + LWIP_ICMP6_DATASIZE + 8 + + + + + + + + + + LWIP_ICMP6_HL + 255 + + + + + + + + + + LWIP_IGMP + 0 + + + + + + + + + + LWIP_IPV4 + 1 + + + + + + + + + + LWIP_IPV6 + 0 + + + + + + + + + + LWIP_IPV6_AUTOCONFIG + (LWIP_IPV6) + + + + + + + + + + LWIP_IPV6_DHCP6 + 0 + + + + + + + + + + LWIP_IPV6_DUP_DETECT_ATTEMPTS + 1 + + + + + + + + + + LWIP_IPV6_FORWARD + 0 + + + + + + + + + + LWIP_IPV6_FRAG + 0 + + + + + + + + + + LWIP_IPV6_MLD + (LWIP_IPV6) + + + + + + + + + + LWIP_IPV6_NUM_ADDRESSES + 3 + + + + + + + + + + LWIP_IPV6_REASS + (LWIP_IPV6) + + + + + + + + + + LWIP_IPV6_SEND_ROUTER_SOLICIT + 1 + + + + + + + + + + LWIP_LOOPBACK_MAX_PBUFS + 0 + + + + + + + + + + LWIP_LOOPIF_MULTICAST + 0 + + + + + + + + + + LWIP_MIB2_CALLBACKS + 0 + + + + + + + + + + LWIP_MPU_COMPATIBLE + 0 + + + + + + + + + + LWIP_MULTICAST_PING + 0 + + + + + + + + + + LWIP_MULTICAST_TX_OPTIONS + (LWIP_IGMP && LWIP_UDP) + + + + + + + + + + LWIP_ND6_ALLOW_RA_UPDATES + 1 + + + + + + + + + + LWIP_ND6_DELAY_FIRST_PROBE_TIME + 5000 + + + + + + + + + + LWIP_ND6_MAX_ANYCAST_DELAY_TIME + 1000 + + + + + + + + + + LWIP_ND6_MAX_MULTICAST_SOLICIT + 3 + + + + + + + + + + LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT + 3 + + + + + + + + + + LWIP_ND6_MAX_UNICAST_SOLICIT + 3 + + + + + + + + + + LWIP_ND6_NUM_DESTINATIONS + 10 + + + + + + + + + + LWIP_ND6_NUM_NEIGHBORS + 10 + + + + + + + + + + LWIP_ND6_NUM_PREFIXES + 5 + + + + + + + + + + LWIP_ND6_NUM_ROUTERS + 3 + + + + + + + + + + LWIP_ND6_QUEUEING + (LWIP_IPV6) + + + + + + + + + + LWIP_ND6_RDNSS_MAX_DNS_SERVERS + 0 + + + + + + + + + + LWIP_ND6_REACHABLE_TIME + 30000 + + + + + + + + + + LWIP_ND6_RETRANS_TIMER + 1000 + + + + + + + + + + LWIP_ND6_TCP_REACHABILITY_HINTS + 1 + + + + + + + + + + LWIP_NETBUF_RECVINFO + 0 + + + + + + + + + + LWIP_NETCONN + 1 + + + + + + + + + + LWIP_NETCONN_FULLDUPLEX + 0 + + + + + + + + + + LWIP_NETCONN_SEM_PER_THREAD + 0 + + + + + + + + + + LWIP_NETIF_API + 0 + + + + + + + + + + LWIP_NETIF_HOSTNAME + 0 + + + + + + + + + + LWIP_NETIF_HWADDRHINT + 0 + + + + + + + + + + LWIP_NETIF_LINK_CALLBACK + 0 + + + + + + + + + + LWIP_NETIF_LOOPBACK + 1 + + + + + + + + + + LWIP_NETIF_LOOPBACK_MULTITHREADING + (!NO_SYS) + + + + + + + + + + LWIP_NETIF_REMOVE_CALLBACK + 0 + + + + + + + + + + LWIP_NETIF_STATUS_CALLBACK + 0 + + + + + + + + + + LWIP_NETIF_TX_SINGLE_PBUF + 0 + + + + + + + + + + LWIP_NUM_NETIF_CLIENT_DATA + 0 + + + + + + + + + + LWIP_PERF + 0 + + + + + + + + + + LWIP_POSIX_SOCKETS_IO_NAMES + 1 + + + + + + + + + + LWIP_PROVIDE_ERRNO + 1 + + + + + + + + + + LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS + 0 + + + + + + + + + + LWIP_RAW + 1 + + + + + + + + + + LWIP_SO_LINGER + 0 + + + + + + + + + + LWIP_SO_RCVBUF + 0 + + + + + + + + + + LWIP_SO_RCVTIMEO + 1 + + + + + + + + + + LWIP_SO_SNDRCVTIMEO_NONSTANDARD + 0 + + + + + + + + + + LWIP_SO_SNDTIMEO + 1 + + + + + + + + + + LWIP_SOCKET + 1 + + + + + + + + + + LWIP_SOCKET_OFFSET + 0 + + + + + + + + + + LWIP_STATS + 1 + + + + + + + + + + LWIP_STATS_DISPLAY + 0 + + + + + + + + + LWIP_TCP 1 @@ -386,9 +3269,119 @@ - + - + + LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT + 20000 + + + + + + + + + + LWIP_TCP_KEEPALIVE + 0 + + + + + + + + + + LWIP_TCP_TIMESTAMPS + 1 + + + + + + + + + + LWIP_TCPIP_CORE_LOCKING + 1 + + + + + + + + + + LWIP_TCPIP_CORE_LOCKING_INPUT + 1 + + + + + + + + + + LWIP_TCPIP_THREAD_ALIVE + + + + + + + + + + + LWIP_TCPIP_TIMEOUT + 1 + + + + + + + + + + LWIP_TIMERS + 1 + + + + + + + + + + LWIP_TIMERS_CUSTOM + 0 + + + + + + + + + + LWIP_TIMEVAL_PRIVATE + 0 + + + + + + + + + LWIP_UDP 1 @@ -397,21 +3390,32 @@ - + - - MEM_ALIGNMENT - 2 + + LWIP_UDPLITE + 0 - + - - MEM_RECLAIM + + LWIP_WND_SCALE + 0 + + + + + + + + + + MEM_ALIGNMENT 1 @@ -419,31 +3423,156 @@ - + - + + MEM_DEBUG + LWIP_DBG_OFF + + + + + + + + + + MEM_LIBC_MALLOC + 0 + + + + + + + + + MEM_SIZE - 1000 + 1600 - + - + MEM_STATS + ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0)) - + - + + MEM_USE_POOLS + 0 + + + + + + + + + + MEM_USE_POOLS_TRY_BIGGER_POOL + 0 + + + + + + + + + + MEMCPY + dst + src + len + memcpy(dst,src,len) + + + + + + + + + + MEMP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + MEMP_MEM_MALLOC + 0 + + + + + + + + + MEMP_NUM_API_MSG + MEMP_NUM_TCPIP_MSG_API + + + + + + + + + + MEMP_NUM_ARP_QUEUE + 30 + + + + + + + + + + MEMP_NUM_DNS_API_MSG + MEMP_NUM_TCPIP_MSG_API + + + + + + + + + + MEMP_NUM_FRAG_PBUF + 15 + + + + + + + + + + MEMP_NUM_IGMP_GROUP 8 @@ -451,9 +3580,42 @@ - + - + + MEMP_NUM_LOCALHOSTLIST + 1 + + + + + + + + + + MEMP_NUM_MLD6_GROUP + 4 + + + + + + + + + + MEMP_NUM_ND6_QUEUE + 20 + + + + + + + + + MEMP_NUM_NETBUF 2 @@ -462,9 +3624,9 @@ - + - + MEMP_NUM_NETCONN 4 @@ -473,31 +3635,86 @@ - + - + + MEMP_NUM_NETDB + 1 + + + + + + + + + + MEMP_NUM_NETIFAPI_MSG + MEMP_NUM_TCPIP_MSG_API + + + + + + + + + MEMP_NUM_PBUF - 8 + 16 - + - + + MEMP_NUM_RAW_PCB + 4 + + + + + + + + + + MEMP_NUM_REASSDATA + 5 + + + + + + + + + + MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA + MEMP_NUM_TCPIP_MSG_API + + + + + + + + + MEMP_NUM_SYS_TIMEOUT - 3 + (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (PPP_SUPPORT*6*MEMP_NUM_PPP_PCB) + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) - + - + MEMP_NUM_TCP_PCB 5 @@ -506,9 +3723,9 @@ - + - + MEMP_NUM_TCP_PCB_LISTEN 8 @@ -517,10 +3734,21 @@ - + - + MEMP_NUM_TCP_SEG + 16 + + + + + + + + + + MEMP_NUM_TCPIP_MSG_API 8 @@ -528,10 +3756,10 @@ - + - - MEMP_NUM_TCPIP_MSG + + MEMP_NUM_TCPIP_MSG_INPKT 8 @@ -539,9 +3767,9 @@ - + - + MEMP_NUM_UDP_PCB 4 @@ -550,31 +3778,153 @@ - + - - MEMP_RECLAIM - 1 + + MEMP_OVERFLOW_CHECK + 0 - + - + + MEMP_SANITY_CHECK + 0 + + + + + + + + + MEMP_STATS + (MEMP_MEM_MALLOC == 0) - + - + + MEMP_USE_CUSTOM_POOLS + 0 + + + + + + + + + + MIB2_STATS + 0 + + + + + + + + + + MLD6_STATS + (LWIP_IPV6 && LWIP_IPV6_MLD) + + + + + + + + + + ND6_STATS + (LWIP_IPV6) + + + + + + + + + + NETIF_DEBUG + LWIP_DBG_OFF + + + + + + + + + + NO_SYS + 0 + + + + + + + + + + PBUF_DEBUG + LWIP_DBG_OFF + + + + + + + + + + PBUF_LINK_ENCAPSULATION_HLEN + 0u + + + + + + + + + PBUF_LINK_HLEN + (14 + ETH_PAD_SIZE) + + + + + + + + + + PBUF_POOL_BUFSIZE + LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN) + + + + + + + + + + PBUF_POOL_SIZE 16 @@ -582,61 +3932,243 @@ - + - - PBUF_POOL_BUFSIZE - 128 + + RAW_DEBUG + LWIP_DBG_OFF - + - - PBUF_POOL_SIZE - 6 + + RAW_TTL + (IP_DEFAULT_TTL) - + - - PBUF_STATS + + RECV_BUFSIZE_DEFAULT + INT_MAX - + - - STATS + + SLIP_DEBUG + LWIP_DBG_OFF - + - + + SLIPIF_THREAD_NAME + "slipif_loop" + + + + + + + + + + SLIPIF_THREAD_PRIO + 1 + + + + + + + + + + SLIPIF_THREAD_STACKSIZE + 0 + + + + + + + + + + SMEMCPY + dst + src + len + memcpy(dst,src,len) + + + + + + + + + + SO_REUSE + 0 + + + + + + + + + + SO_REUSE_RXTOALL + 0 + + + + + + + + + + SOCKETS_DEBUG + LWIP_DBG_OFF + + + + + + + + + + SYS_DEBUG + LWIP_DBG_OFF + + + + + + + + + + SYS_LIGHTWEIGHT_PROT + 0 + + + + + + + + + SYS_STATS + (NO_SYS == 0) - + - + + TCP_CALCULATE_EFF_SEND_MSS + 1 + + + + + + + + + + TCP_CWND_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_DEFAULT_LISTEN_BACKLOG + 0xff + + + + + + + + + + TCP_FR_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_INPUT_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_LISTEN_BACKLOG + 0 + + + + + + + + + TCP_MAXRTX 12 @@ -645,21 +4177,252 @@ - + - + TCP_MSS - 128 + 536 - + - + + TCP_OOSEQ_MAX_BYTES + 0 + + + + + + + + + + TCP_OOSEQ_MAX_PBUFS + 0 + + + + + + + + + + TCP_OUTPUT_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_OVERSIZE + TCP_MSS + + + + + + + + + + TCP_QLEN_DEBUG + LWIP_DBG_OFF + + + + + + + + + TCP_QUEUE_OOSEQ + (LWIP_TCP) + + + + + + + + + + TCP_RST_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_RTO_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_SND_BUF + (2 * TCP_MSS) + + + + + + + + + + TCP_SND_QUEUELEN + ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS)) + + + + + + + + + + TCP_SNDLOWAT + LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) + + + + + + + + + + TCP_SNDQUEUELOWAT + LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5) + + + + + + + + + + TCP_STATS + (LWIP_TCP) + + + + + + + + + + TCP_SYNMAXRTX + 6 + + + + + + + + + + TCP_TTL + (IP_DEFAULT_TTL) + + + + + + + + + + TCP_WND + (4 * TCP_MSS) + + + + + + + + + + TCP_WND_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCP_WND_UPDATE_THRESHOLD + LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4)) + + + + + + + + + + TCPIP_DEBUG + LWIP_DBG_OFF + + + + + + + + + + TCPIP_MBOX_SIZE + 6 + + + + + + + + + + TCPIP_THREAD_NAME + "tcpip_thread" + + + + + + + + + + TCPIP_THREAD_PRIO 1 @@ -667,93 +4430,62 @@ - + - - TCP_SND_BUF - 256 + + TCPIP_THREAD_STACKSIZE + 0 - + - - TCP_SND_QUEUELEN - 4 * TCP_SND_BUF/TCP_MSS + + TIMERS_DEBUG + LWIP_DBG_OFF - + - - TCP_STATS + + UDP_DEBUG + LWIP_DBG_OFF - + - - TCP_SYNMAXRTX - 4 - - - - - - - - - - TCP_TTL - 255 - - - - - - - - - - TCP_WND - 1024 - - - - - - - - - + UDP_STATS + (LWIP_UDP) - + - + UDP_TTL - 255 + (IP_DEFAULT_TTL) - + @@ -762,180 +4494,502 @@ /* -*Copyright(c)2001,SwedishInstituteofComputerScience. +*Copyright(c)2001-2003SwedishInstituteofComputerScience. *Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: lwipopts_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIPOPTS_H__ -#define__LWIPOPTS_H__ - -/*----------Memoryoptions----------*/ -/*MEM_ALIGNMENT:shouldbesettothealignmentoftheCPUforwhich -lwIPiscompiled.4bytealignment->defineMEM_ALIGNMENTto4,2 -bytealignment->defineMEM_ALIGNMENTto2.*/ -#defineMEM_ALIGNMENT2 - -/*MEM_SIZE:thesizeoftheheapmemory.Iftheapplicationwillsend -alotofdatathatneedstobecopied,thisshouldbesethigh.*/ -#defineMEM_SIZE1000 - -/*MEMP_NUM_PBUF:thenumberofmempstructpbufs.Iftheapplication -sendsalotofdataoutofROM(orotherstaticmemory),this -shouldbesethigh.*/ -#defineMEMP_NUM_PBUF8 -/*MEMP_NUM_UDP_PCB:thenumberofUDPprotocolcontrolblocks.One -peractiveUDP"connection".*/ -#defineMEMP_NUM_UDP_PCB4 -/*MEMP_NUM_TCP_PCB:thenumberofsimulatenouslyactiveTCP -connections.*/ -#defineMEMP_NUM_TCP_PCB5 -/*MEMP_NUM_TCP_PCB_LISTEN:thenumberoflisteningTCP -connections.*/ -#defineMEMP_NUM_TCP_PCB_LISTEN8 -/*MEMP_NUM_TCP_SEG:thenumberofsimultaneouslyqueuedTCP -segments.*/ -#defineMEMP_NUM_TCP_SEG8 -/*MEMP_NUM_SYS_TIMEOUT:thenumberofsimulateouslyactive -timeouts.*/ -#defineMEMP_NUM_SYS_TIMEOUT3 - - -/*ThefollowingfourareusedonlywiththesequentialAPIandcanbe -setto0iftheapplicationonlywillusetherawAPI.*/ -/*MEMP_NUM_NETBUF:thenumberofstructnetbufs.*/ -#defineMEMP_NUM_NETBUF2 -/*MEMP_NUM_NETCONN:thenumberofstructnetconns.*/ -#defineMEMP_NUM_NETCONN4 -/*MEMP_NUM_APIMSG:thenumberofstructapi_msg,usedfor -communicationbetweentheTCP/IPstackandthesequential -programs.*/ -#defineMEMP_NUM_API_MSG8 -/*MEMP_NUM_TCPIPMSG:thenumberofstructtcpip_msg,whichisused -forsequentialAPIcommunicationandincomingpackets.Usedin -src/api/tcpip.c.*/ -#defineMEMP_NUM_TCPIP_MSG8 - -/*Thesetwocontrolisreclaimerfunctionsshouldbecompiled -in.Shouldalwaysbeturnedon(1).*/ -#defineMEM_RECLAIM1 -#defineMEMP_RECLAIM1 - -/*----------Pbufoptions----------*/ -/*PBUF_POOL_SIZE:thenumberofbuffersinthepbufpool.*/ -#definePBUF_POOL_SIZE6 - -/*PBUF_POOL_BUFSIZE:thesizeofeachpbufinthepbufpool.*/ -#definePBUF_POOL_BUFSIZE128 - -/*PBUF_LINK_HLEN:thenumberofbytesthatshouldbeallocatedfora -linklevelheader.*/ -#definePBUF_LINK_HLEN16 - -/*----------TCPoptions----------*/ -#defineLWIP_TCP1 -#defineTCP_TTL255 - -/*ControlsifTCPshouldqueuesegmentsthatarriveoutof -order.Defineto0ifyourdeviceislowonmemory.*/ -#defineTCP_QUEUE_OOSEQ1 - -/*TCPMaximumsegmentsize.*/ -#defineTCP_MSS128 - -/*TCPsenderbufferspace(bytes).*/ -#defineTCP_SND_BUF256 - -/*TCPsenderbufferspace(pbufs).Thismustbeatleast=2* -TCP_SND_BUF/TCP_MSSforthingstowork.*/ -#defineTCP_SND_QUEUELEN4*TCP_SND_BUF/TCP_MSS - -/*TCPreceivewindow.*/ -#defineTCP_WND1024 - -/*Maximumnumberofretransmissionsofdatasegments.*/ -#defineTCP_MAXRTX12 - -/*MaximumnumberofretransmissionsofSYNsegments.*/ -#defineTCP_SYNMAXRTX4 - -/*----------ARPoptions----------*/ -#defineARP_TABLE_SIZE10 - -/*----------IPoptions----------*/ -/*DefineIP_FORWARDto1ifyouwishtohavetheabilitytoforward -IPpacketsacrossnetworkinterfaces.IfyouaregoingtorunlwIP -onadevicewithonlyonenetworkinterface,definethisto0.*/ -#defineIP_FORWARD1 - -/*Ifdefinedto1,IPoptionsareallowed(butnotparsed).If -definedto0,allpacketswithIPoptionsaredropped.*/ -#defineIP_OPTIONS1 - -/*----------ICMPoptions----------*/ -#defineICMP_TTL255 - - -/*----------DHCPoptions----------*/ -/*DefineLWIP_DHCPto1ifyouwantDHCPconfigurationof -interfaces.DHCPisnotimplementedinlwIP0.5.1,however,so -turningthisondoescurrentlynotwork.*/ -#defineLWIP_DHCP0 - -/*1ifyouwanttodoanARPcheckontheofferedaddress -(recommended).*/ -#defineDHCP_DOES_ARP_CHECK1 - -/*----------UDPoptions----------*/ -#defineLWIP_UDP1 -#defineUDP_TTL255 - - -/*----------Statisticsoptions----------*/ -#defineSTATS - -#ifdefSTATS -#defineLINK_STATS -#defineIP_STATS -#defineICMP_STATS -#defineUDP_STATS -#defineTCP_STATS -#defineMEM_STATS -#defineMEMP_STATS -#definePBUF_STATS -#defineSYS_STATS -#endif/*STATS*/ +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:SimonGoldschmidt +* +*/ + +#ifndefLWIP_HDR_LWIPOPTS_H +#defineLWIP_HDR_LWIPOPTS_H + +/*NEVERSetTo1,1WillRemoveOSAbstraction*/ +#defineNO_SYS0 + +/*TimerSettings*/ +#defineLWIP_TIMERS1 +#defineLWIP_TIMERS_CUSTOM0 + +#defineMEMCPY(dst,src,len)memcpy(dst,src,len) +#defineSMEMCPY(dst,src,len)memcpy(dst,src,len) + +/*CorelockingandMPU*/ +#defineLWIP_MPU_COMPATIBLE0 +#defineLWIP_TCPIP_CORE_LOCKING1 +#defineLWIP_TCPIP_CORE_LOCKING_INPUT1 +#defineSYS_LIGHTWEIGHT_PROT0 + + +#defineLWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT0 +#defineMEM_ALIGNMENT1 +#defineMEM_LIBC_MALLOC0 +#defineMEM_SIZE1600 +#defineMEM_USE_POOLS0 +#defineMEM_USE_POOLS_TRY_BIGGER_POOL0 + +#defineMEMP_MEM_MALLOC0 +#defineMEMP_SANITY_CHECK0 +#defineMEMP_USE_CUSTOM_POOLS0 +#defineMEMP_OVERFLOW_CHECK0 + +#defineMEMP_NUM_API_MSGMEMP_NUM_TCPIP_MSG_API +#defineMEMP_NUM_ARP_QUEUE30 +#defineMEMP_NUM_DNS_API_MSGMEMP_NUM_TCPIP_MSG_API +#defineMEMP_NUM_FRAG_PBUF15 +#defineMEMP_NUM_IGMP_GROUP8 +#defineMEMP_NUM_LOCALHOSTLIST1 +#defineMEMP_NUM_NETBUF2 +#defineMEMP_NUM_NETCONN4 +#defineMEMP_NUM_NETDB1 +#defineMEMP_NUM_NETIFAPI_MSGMEMP_NUM_TCPIP_MSG_API +#defineMEMP_NUM_PBUF16 +#defineMEMP_NUM_RAW_PCB4 +#defineMEMP_NUM_REASSDATA5 +#defineMEMP_NUM_SOCKET_SETGETSOCKOPT_DATAMEMP_NUM_TCPIP_MSG_API +#defineMEMP_NUM_TCP_PCB5 +#defineMEMP_NUM_TCP_PCB_LISTEN8 +#defineMEMP_NUM_TCP_SEG16 +#defineMEMP_NUM_TCPIP_MSG_API8 +#defineMEMP_NUM_TCPIP_MSG_INPKT8 +#defineMEMP_NUM_UDP_PCB4 +#definePBUF_POOL_SIZE16 + +#defineMEMP_NUM_SYS_TIMEOUT(LWIP_TCP+IP_REASSEMBLY+LWIP_ARP+(2*LWIP_DHCP)+LWIP_AUTOIP+LWIP_IGMP+LWIP_DNS+(PPP_SUPPORT*6*MEMP_NUM_PPP_PCB)+(LWIP_IPV6?(1+LWIP_IPV6_REASS+LWIP_IPV6_MLD):0)) + +#defineLWIP_ARP1 + +#defineARP_TABLE_SIZE10 + +#defineARP_MAXAGE300 + +#defineARP_QUEUEING0 + +#defineARP_QUEUE_LEN3 + +#defineETHARP_SUPPORT_VLAN0 + +#defineLWIP_ETHERNETLWIP_ARP + +#defineETH_PAD_SIZE0 + +#defineETHARP_SUPPORT_STATIC_ENTRIES0 + +#defineETHARP_TABLE_MATCH_NETIF0 + +#defineLWIP_IPV41 + +#defineIP_FORWARD0 + +#defineIP_REASSEMBLY1 + +#defineIP_FRAG1 + +#defineIP_OPTIONS_ALLOWED1 + +#defineIP_REASS_MAXAGE3 + +#defineIP_REASS_MAX_PBUFS10 + +#defineIP_DEFAULT_TTL255 + +#defineIP_SOF_BROADCAST0 + +#defineIP_SOF_BROADCAST_RECV0 + +#defineIP_FORWARD_ALLOW_TX_ON_RX_NETIF0 + +#defineLWIP_RANDOMIZE_INITIAL_LOCAL_PORTS0 + +#defineLWIP_ICMP1 + +#defineICMP_TTL(IP_DEFAULT_TTL) + +#defineLWIP_BROADCAST_PING1 + +#defineLWIP_MULTICAST_PING0 + +#defineLWIP_RAW1 + +#defineRAW_TTL(IP_DEFAULT_TTL) + +#defineLWIP_DHCP0 +#defineDHCP_DOES_ARP_CHECK((LWIP_DHCP)&&(LWIP_ARP)) +#defineLWIP_DHCP_BOOTP_FILE0 +#defineLWIP_DHCP_GET_NTP_SRV0 +#defineLWIP_DHCP_MAX_NTP_SERVERS1 +#defineLWIP_DHCP_MAX_DNS_SERVERSDNS_MAX_SERVERS +#defineLWIP_AUTOIP0 +#defineLWIP_DHCP_AUTOIP_COOP0 +#defineLWIP_DHCP_AUTOIP_COOP_TRIES9 +#defineLWIP_MIB2_CALLBACKS0 +#defineLWIP_IGMP0 +#defineLWIP_MULTICAST_TX_OPTIONS(LWIP_IGMP&&LWIP_UDP) +#defineLWIP_DNS0 +#defineDNS_TABLE_SIZE4 +#defineDNS_MAX_NAME_LENGTH256 +#defineDNS_MAX_SERVERS2 +#defineDNS_DOES_NAME_CHECK1 +#defineLWIP_DNS_SECURE(LWIP_DNS_SECURE_RAND_XID|LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING|LWIP_DNS_SECURE_RAND_SRC_PORT) +#defineDNS_LOCAL_HOSTLIST0 +#defineDNS_LOCAL_HOSTLIST_IS_DYNAMIC0 +#defineLWIP_DNS_SUPPORT_MDNS_QUERIES0 +#defineLWIP_UDP1 +#defineLWIP_UDPLITE0 +#defineUDP_TTL(IP_DEFAULT_TTL) +#defineLWIP_NETBUF_RECVINFO0 +#defineLWIP_TCP1 +#defineTCP_TTL(IP_DEFAULT_TTL) +#defineTCP_WND(4*TCP_MSS) -#endif/*__LWIPOPTS_H__*/ +#defineTCP_MAXRTX12 + +#defineTCP_SYNMAXRTX6 + +#defineTCP_QUEUE_OOSEQ(LWIP_TCP) + +#defineTCP_MSS536 + +#defineTCP_CALCULATE_EFF_SEND_MSS1 + +#defineTCP_SND_BUF(2*TCP_MSS) + +#defineTCP_SND_QUEUELEN((4*(TCP_SND_BUF)+(TCP_MSS-1))/(TCP_MSS)) + +#defineTCP_SNDLOWATLWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2),(2*TCP_MSS)+1),(TCP_SND_BUF)-1) + +#defineTCP_SNDQUEUELOWATLWIP_MAX(((TCP_SND_QUEUELEN)/2),5) + +#defineTCP_OOSEQ_MAX_BYTES0 + +#defineTCP_OOSEQ_MAX_PBUFS0 + +#defineTCP_LISTEN_BACKLOG0 + +#defineTCP_DEFAULT_LISTEN_BACKLOG0xff + +#defineTCP_OVERSIZETCP_MSS + +#defineLWIP_TCP_TIMESTAMPS1 + +#defineTCP_WND_UPDATE_THRESHOLDLWIP_MIN((TCP_WND/4),(TCP_MSS*4)) + +#defineLWIP_EVENT_API0 +#defineLWIP_WND_SCALE0 + +#definePBUF_LINK_HLEN(14+ETH_PAD_SIZE) + +#definePBUF_LINK_ENCAPSULATION_HLEN0u + +#definePBUF_POOL_BUFSIZELWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + +#defineLWIP_NETIF_HOSTNAME0 + +#defineLWIP_NETIF_API0 + +#defineLWIP_NETIF_STATUS_CALLBACK0 + +#defineLWIP_NETIF_LINK_CALLBACK0 + +#defineLWIP_NETIF_REMOVE_CALLBACK0 + +#defineLWIP_NETIF_HWADDRHINT0 + +#defineLWIP_NETIF_TX_SINGLE_PBUF0 + +#defineLWIP_NUM_NETIF_CLIENT_DATA0 + +#defineLWIP_HAVE_LOOPIFLWIP_NETIF_LOOPBACK + +#defineLWIP_LOOPIF_MULTICAST0 + +#defineLWIP_NETIF_LOOPBACK1 + +#defineLWIP_LOOPBACK_MAX_PBUFS0 + +#defineLWIP_NETIF_LOOPBACK_MULTITHREADING(!NO_SYS) + +#defineTCPIP_THREAD_NAME"tcpip_thread" + +#defineTCPIP_THREAD_STACKSIZE0 + +#defineTCPIP_THREAD_PRIO1 + +#defineTCPIP_MBOX_SIZE6 + +#defineLWIP_TCPIP_THREAD_ALIVE() + +#defineSLIPIF_THREAD_NAME"slipif_loop" + +#defineSLIPIF_THREAD_STACKSIZE0 + +#defineSLIPIF_THREAD_PRIO1 + +#defineDEFAULT_THREAD_NAME"lwIP" + +#defineDEFAULT_THREAD_STACKSIZE0 + +#defineDEFAULT_THREAD_PRIO1 + +#defineDEFAULT_RAW_RECVMBOX_SIZE0 + +#defineDEFAULT_UDP_RECVMBOX_SIZE0 + +#defineDEFAULT_TCP_RECVMBOX_SIZE0 + +#defineDEFAULT_ACCEPTMBOX_SIZE0 + +#defineLWIP_NETCONN1 + +#defineLWIP_TCPIP_TIMEOUT1 + +#defineLWIP_NETCONN_SEM_PER_THREAD0 + +#defineLWIP_NETCONN_FULLDUPLEX0 + +#defineLWIP_SOCKET1 + +#defineLWIP_COMPAT_SOCKETS1 + +#defineLWIP_POSIX_SOCKETS_IO_NAMES1 + +#defineLWIP_SOCKET_OFFSET0 + +#defineLWIP_TCP_KEEPALIVE0 + +#defineLWIP_SO_SNDTIMEO1 + +#defineLWIP_SO_RCVTIMEO1 + +#defineLWIP_SO_SNDRCVTIMEO_NONSTANDARD0 + +#defineLWIP_SO_RCVBUF0 + +#defineLWIP_SO_LINGER0 + +#defineRECV_BUFSIZE_DEFAULTINT_MAX + +#defineLWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT20000 + +#defineSO_REUSE0 + +#defineSO_REUSE_RXTOALL0 + +#defineLWIP_FIONREAD_LINUXMODE0 + +#defineLWIP_STATS1 + +#defineLWIP_STATS_DISPLAY0 + +#defineLINK_STATS1 + +#defineETHARP_STATS(LWIP_ARP) + +#defineIP_STATS1 + +#defineIPFRAG_STATS(IP_REASSEMBLY||IP_FRAG) + +#defineICMP_STATS1 + +#defineIGMP_STATS(LWIP_IGMP) + +#defineUDP_STATS(LWIP_UDP) + +#defineTCP_STATS(LWIP_TCP) + +#defineMEM_STATS((MEM_LIBC_MALLOC==0)&&(MEM_USE_POOLS==0)) + +#defineMEMP_STATS(MEMP_MEM_MALLOC==0) + +#defineSYS_STATS(NO_SYS==0) + +#defineIP6_STATS(LWIP_IPV6) + +#defineICMP6_STATS(LWIP_IPV6&&LWIP_ICMP6) + +#defineIP6_FRAG_STATS(LWIP_IPV6&&(LWIP_IPV6_FRAG||LWIP_IPV6_REASS)) + +#defineMLD6_STATS(LWIP_IPV6&&LWIP_IPV6_MLD) + +#defineND6_STATS(LWIP_IPV6) + +#defineMIB2_STATS0 + +#defineLWIP_CHECKSUM_CTRL_PER_NETIF0 + +#defineCHECKSUM_GEN_IP1 + +#defineCHECKSUM_GEN_UDP1 + +#defineCHECKSUM_GEN_TCP1 + +#defineCHECKSUM_GEN_ICMP1 + +#defineCHECKSUM_GEN_ICMP61 + +#defineCHECKSUM_CHECK_IP1 +#defineCHECKSUM_CHECK_UDP1 + +#defineCHECKSUM_CHECK_TCP1 +#defineCHECKSUM_CHECK_ICMP1 +#defineCHECKSUM_CHECK_ICMP61 +#defineLWIP_CHECKSUM_ON_COPY0 +#defineLWIP_IPV60 +#defineLWIP_IPV6_NUM_ADDRESSES3 +#defineLWIP_IPV6_FORWARD0 +#defineLWIP_IPV6_FRAG0 +#defineLWIP_IPV6_REASS(LWIP_IPV6) +#defineLWIP_IPV6_SEND_ROUTER_SOLICIT1 +#defineLWIP_IPV6_AUTOCONFIG(LWIP_IPV6) +#defineLWIP_IPV6_DUP_DETECT_ATTEMPTS1 +#defineLWIP_ICMP6(LWIP_IPV6) +#defineLWIP_ICMP6_DATASIZE8 +#defineLWIP_ICMP6_HL255 +#defineLWIP_IPV6_MLD(LWIP_IPV6) +#defineMEMP_NUM_MLD6_GROUP4 +#defineLWIP_ND6_QUEUEING(LWIP_IPV6) +#defineMEMP_NUM_ND6_QUEUE20 +#defineLWIP_ND6_NUM_NEIGHBORS10 +#defineLWIP_ND6_NUM_DESTINATIONS10 +#defineLWIP_ND6_NUM_PREFIXES5 +#defineLWIP_ND6_NUM_ROUTERS3 +#defineLWIP_ND6_MAX_MULTICAST_SOLICIT3 +#defineLWIP_ND6_MAX_UNICAST_SOLICIT3 +#defineLWIP_ND6_MAX_ANYCAST_DELAY_TIME1000 +#defineLWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT3 +#defineLWIP_ND6_REACHABLE_TIME30000 +#defineLWIP_ND6_RETRANS_TIMER1000 + +#defineLWIP_ND6_DELAY_FIRST_PROBE_TIME5000 + +#defineLWIP_ND6_ALLOW_RA_UPDATES1 + +#defineLWIP_ND6_TCP_REACHABILITY_HINTS1 + +#defineLWIP_ND6_RDNSS_MAX_DNS_SERVERS0 + +#defineLWIP_IPV6_DHCP60 + +//#defineLWIP_HOOK_FILENAME"path/to/my/lwip_hooks.h" + +//#defineLWIP_HOOK_TCP_ISN(local_ip,local_port,remote_ip,remote_port) + +//#defineLWIP_HOOK_IP4_INPUT(pbuf,input_netif) + +//#defineLWIP_HOOK_IP4_ROUTE() + +//#defineLWIP_HOOK_IP4_ROUTE_SRC(dest,src) + +//#defineLWIP_HOOK_ETHARP_GET_GW(netif,dest) + +//#defineLWIP_HOOK_IP6_INPUT(pbuf,input_netif) + +//#defineLWIP_HOOK_IP6_ROUTE(src,dest) + + +//#defineLWIP_HOOK_VLAN_CHECK(netif,eth_hdr,vlan_hdr) + +//#defineLWIP_HOOK_VLAN_SET(netif,p,src,dst,eth_type) + +//#defineLWIP_HOOK_MEMP_AVAILABLE(memp_t_type) + +//#defineLWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf,netif) + +#defineLWIP_DBG_MIN_LEVELLWIP_DBG_LEVEL_ALL +#defineLWIP_DBG_TYPES_ONLWIP_DBG_ON + +#defineETHARP_DEBUGLWIP_DBG_OFF + +#defineNETIF_DEBUGLWIP_DBG_OFF + +#definePBUF_DEBUGLWIP_DBG_OFF + +#defineAPI_LIB_DEBUGLWIP_DBG_OFF + +#defineAPI_MSG_DEBUGLWIP_DBG_OFF + +#defineSOCKETS_DEBUGLWIP_DBG_OFF + +#defineICMP_DEBUGLWIP_DBG_OFF + +#defineIGMP_DEBUGLWIP_DBG_OFF + +#defineINET_DEBUGLWIP_DBG_OFF + +#defineIP_DEBUGLWIP_DBG_ON + +#defineIP_REASS_DEBUGLWIP_DBG_OFF + +#defineRAW_DEBUGLWIP_DBG_OFF + +#defineMEM_DEBUGLWIP_DBG_OFF + +#defineMEMP_DEBUGLWIP_DBG_OFF + +#defineSYS_DEBUGLWIP_DBG_OFF + +#defineTIMERS_DEBUGLWIP_DBG_OFF + +#defineTCP_DEBUGLWIP_DBG_OFF + +#defineTCP_INPUT_DEBUGLWIP_DBG_OFF + +#defineTCP_FR_DEBUGLWIP_DBG_OFF + +#defineTCP_RTO_DEBUGLWIP_DBG_OFF + +#defineTCP_CWND_DEBUGLWIP_DBG_OFF + +#defineTCP_WND_DEBUGLWIP_DBG_OFF + +#defineTCP_OUTPUT_DEBUGLWIP_DBG_OFF + +#defineTCP_RST_DEBUGLWIP_DBG_OFF + +#defineTCP_QLEN_DEBUGLWIP_DBG_OFF + +#defineUDP_DEBUGLWIP_DBG_OFF +#defineTCPIP_DEBUGLWIP_DBG_OFF +#defineSLIP_DEBUGLWIP_DBG_OFF +#defineDHCP_DEBUGLWIP_DBG_OFF +#defineAUTOIP_DEBUGLWIP_DBG_OFF +#defineDNS_DEBUGLWIP_DBG_OFF +#defineIP6_DEBUGLWIP_DBG_OFF +#defineLWIP_PERF0 + +//#defineTCP_RCV_SCALE0 +//#definePBUF_POOL_SIZE400/*pbuftestsneed~200KByte*/ +#defineLWIP_COMPAT_MUTEX0 +#defineLWIP_COMPAT_MUTEX_ALLOWED1 +#defineLWIP_TIMEVAL_PRIVATE0 +#defineLWIP_CALLBACK_API1 +#defineLWIP_PROVIDE_ERRNO1 +#endif - + diff --git a/doc/xml/main_8c.xml b/doc/xml/main_8c.xml index 138f9c8..d389d1f 100644 --- a/doc/xml/main_8c.xml +++ b/doc/xml/main_8c.xml @@ -1,397 +1,711 @@ - - - + + + main.c - ubixos/init.h + ubixos/init.h sys/gdt.h sys/video.h sys/tss.h + sys/bootinfo.h ubixos/exec.h ubixos/kpanic.h ubixos/systemtask.h vfs/mount.h lib/kprintf.h lib/kmalloc.h + sde/sde.h - + + + + + + + - + - - - + - - - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + B_ADAPTOR val - (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK) + (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK) - - kmain + - + B_ADAPTORMASK 0x0f @@ -400,9 +714,9 @@ - + - + B_ADAPTORSHIFT 24 @@ -411,22 +725,21 @@ - + - + B_CONTROLLER val - (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK) + (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK) - - kmain + - + B_CONTROLLERMASK 0xf @@ -435,9 +748,9 @@ - + - + B_CONTROLLERSHIFT 20 @@ -446,22 +759,21 @@ - + - + B_PARTITION val - (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) + (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) - - kmain + - + B_PARTITIONMASK 0xff @@ -470,9 +782,9 @@ - + - + B_PARTITIONSHIFT 8 @@ -481,22 +793,21 @@ - + - + B_SLICE val - (((val)>>B_SLICESHIFT) & B_SLICEMASK) + (((val)>>B_SLICESHIFT) & B_SLICEMASK) - - kmain + - + B_SLICEMASK 0xff @@ -505,9 +816,9 @@ - + - + B_SLICESHIFT 20 @@ -516,22 +827,21 @@ - + - + B_TYPE val - (((val) >> B_TYPESHIFT) & B_TYPEMASK) + (((val) >> B_TYPESHIFT) & B_TYPEMASK) - - kmain + - + B_TYPEMASK 0xff @@ -540,9 +850,9 @@ - + - + B_TYPESHIFT 0 @@ -551,22 +861,21 @@ - + - + B_UNIT val - (((val) >> B_UNITSHIFT) & B_UNITMASK) + (((val) >> B_UNITSHIFT) & B_UNITMASK) - - kmain + - + B_UNITMASK 0xf @@ -575,9 +884,9 @@ - + - + B_UNITSHIFT 16 @@ -586,69 +895,152 @@ - + + + + + + u_long + u_long _bootdev + + _bootdev + + + + + + + + + + u_long + u_long _boothowto + + _boothowto + + + + + + + + + + struct bootinfo + struct bootinfo _bootinfo + + _bootinfo + + + + + + + + + + char + char _kernelname[512] + [512] + _kernelname + + + + + + + + + + char * + char* argv_init[2] + [2] + argv_init + = { + "init", + 0x0, } + + + + + + + + + + char * + char* envp_init[6] + [6] + envp_init + = { + "HOME=/", + "PWD=/", + "PATH=/bin:/sbin:/usr/bin:/usr/sbin", + "USER=root", + "GROUP=admin", + 0x0, } + + + + + + + + + + struct @24 + struct @24 loadGDT + + loadGDT + = { (11 * sizeof(union descriptorTableUnion) - 1), ubixGDT } + + + + + + + - + int int kmain - (uInt32 rootdev) + (uint32_t rootdev) kmain - uInt32 + uint32_t rootdev -This is the entry point into the os where all of the kernels sub systems are started up. +This is the entry point into the os where all of the kernels sub systems are started up. + rootdev -address of root device structure +address of root device structure + - + + - - B_ADAPTOR - B_CONTROLLER - B_PARTITION - B_SLICE - B_TYPE - B_UNIT - clearScreen - execFile - execThread - vitalsStruct::freePages - init_tasks - init_tasksTotal - irqEnable - kmalloc - kpanic - kprint - kprintf - NULL - systemTask - systemVitals - vfs_mount - vmmMemoryMap - x1 - x2000 + - + ubixDescriptorTable - (ubixGDT, 9) + (ubixGDT, 11) ubixDescriptorTable - ubixGDT + ubixGDT - 9 + 11 @@ -656,32 +1048,19 @@ - - dBig - dBiglim - dCode - dData - dDpl3 - dLdt - dRead - dTss - dWrite - ubixStandardDescriptor - - - - - @2 - struct @2 loadGDT - - loadGDT - - - - - - - + + dBig + dBiglim + dCode + dData + dDpl0 + dDpl3 + dLdt + dRead + dTss + dWrite + ubixStandardDescriptor + VMM_USER_LDT @@ -689,158 +1068,207 @@ -/***************************************************************************************** -Copyright(c)2002-2004,2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: main_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/init.h> -#include<sys/gdt.h> -#include<sys/video.h> -#include<sys/tss.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/init.h> +#include<sys/gdt.h> +#include<sys/video.h> +#include<sys/tss.h> +#include<sys/bootinfo.h> #include<ubixos/exec.h> #include<ubixos/kpanic.h> #include<ubixos/systemtask.h> #include<vfs/mount.h> #include<lib/kprintf.h> #include<lib/kmalloc.h> - -#defineB_ADAPTORSHIFT24 -#defineB_ADAPTORMASK0x0f -#defineB_ADAPTOR(val)(((val)>>B_ADAPTORSHIFT)&B_ADAPTORMASK) -#defineB_CONTROLLERSHIFT20 -#defineB_CONTROLLERMASK0xf -#defineB_CONTROLLER(val)(((val)>>B_CONTROLLERSHIFT)&B_CONTROLLERMASK) -#defineB_SLICESHIFT20 -#defineB_SLICEMASK0xff -#defineB_SLICE(val)(((val)>>B_SLICESHIFT)&B_SLICEMASK) -#defineB_UNITSHIFT16 -#defineB_UNITMASK0xf -#defineB_UNIT(val)(((val)>>B_UNITSHIFT)&B_UNITMASK) -#defineB_PARTITIONSHIFT8 -#defineB_PARTITIONMASK0xff -#defineB_PARTITION(val)(((val)>>B_PARTITIONSHIFT)&B_PARTITIONMASK) -#defineB_TYPESHIFT0 -#defineB_TYPEMASK0xff -#defineB_TYPE(val)(((val)>>B_TYPESHIFT)&B_TYPEMASK) - - -/***************************************************************************************** -Desc:TheKernelsDescriptortable: -0x00-DummyEntry -0x08-Ring0CS -0x10-Ring0DS -0x18-DummyLDT -0x20-SchedulerTSS -0x28-Ring3CS -0x30-Ring3DS -0x38-GPFTSS -0x40-StackFaultTSS - -Notes: - -*****************************************************************************************/ -ubixDescriptorTable(ubixGDT,9){ -{dummy:0}, -ubixStandardDescriptor(0x0000,0xFFFFF,(dCode+dRead+dBig+dBiglim)), -ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim)), -ubixStandardDescriptor(0x0000,0xFFFFF,(dLdt)), -ubixStandardDescriptor(0x4200,(sizeof(structtssStruct)),(dTss+dDpl3)), -ubixStandardDescriptor(0x0000,0xFFFFF,(dCode+dWrite+dBig+dBiglim+dDpl3)), -ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim+dDpl3)), -ubixStandardDescriptor(0x4200,(sizeof(structtssStruct)),(dTss)), -ubixStandardDescriptor(0x6200,(sizeof(structtssStruct)),(dTss)), -}; -struct{ -unsignedshortlimit__attribute__((packed)); -uniondescriptorTableUnion*gdt__attribute__((packed)); -}loadGDT={(9*sizeof(uniondescriptorTableUnion)-1),ubixGDT}; - -intkmain(uInt32rootdev){ -/*Setupcounterforstartuproutine*/ -inti=0x0; -uInt32*sysTask=0x0; - -/*DoAClearScreenJustToMakeTheTEXTBufferNiceAndEmpty*/ -clearScreen(); -kprint("AAA"); -kprint("BBB"); -kprintf("TEST"); -/*Modifysrc/sys/include/ubixos/init.htoaddastartuproutine*/ -for(i=0x0;i<init_tasksTotal;i++){ -if(init_tasks[i]()!=0x0){ -kpanic("Error:InitializingSystem.\n"); -} -} - -/*NewRootMountPoint*/ -//Old2new10 -kprintf("[0xX][0x%X:0x%X:0x%X:0x%X:0x%X:0x%X]\n",B_ADAPTOR(rootdev),B_CONTROLLER(rootdev),B_SLICE(rootdev),B_UNIT(rootdev),B_PARTITION(rootdev),B_TYPE(rootdev)); -if(vfs_mount(0x1,B_PARTITION(rootdev)+2,0x0,0xAA,"sys","rw")!=0x0){ -kprintf("ProblemMountingsysMountPoint\n"); -} - -/*Doourmounting*/ -/* -if(vfs_mount(0x0,0x0,0x0,0x0,"sys","rw")!=0x0){ -kprintf("ProblemMountingsysMountPoint\n"); -} -if(vfs_mount(0x0,0x0,0x1,0x0,"tmp","rw")!=0x0){ -kprintf("ProblemMountingtmpMountPoint\n"); -} -*/ - -/*Initializethesystem*/ -kprintf("FreePages:[%i]\n",systemVitals->freePages); - -kprintf("MemoryMap:[0x%X]\n",vmmMemoryMap); -kprintf("StartingOS\n"); - -sysTask=kmalloc(0x2000); -if(sysTask==NULL) -kprintf("OS:Unabletoallocatememory\n"); +#include<sde/sde.h> + +#defineB_ADAPTORSHIFT24 +#defineB_ADAPTORMASK0x0f +#defineB_ADAPTOR(val)(((val)>>B_ADAPTORSHIFT)&B_ADAPTORMASK) +#defineB_CONTROLLERSHIFT20 +#defineB_CONTROLLERMASK0xf +#defineB_CONTROLLER(val)(((val)>>B_CONTROLLERSHIFT)&B_CONTROLLERMASK) +/* +*Constantsforconvertingboot-styledevicenumbertotype, +*adaptor(uba,mba,etc),unitnumberandpartitionnumber. +*Type(==majordevicenumber)isinthelowbyte +*forbackwardcompatibility.Exceptforthatofthe"magic +*number",eachmaskappliestotheshiftedvalue. +*Format: +*(4)(8)(4)(8)(8) +*-------------------------------- +*|MA|SLICE|UN|PART|TYPE| +*-------------------------------- +*/ +#defineB_SLICESHIFT20 +#defineB_SLICEMASK0xff +#defineB_SLICE(val)(((val)>>B_SLICESHIFT)&B_SLICEMASK) +#defineB_UNITSHIFT16 +#defineB_UNITMASK0xf +#defineB_UNIT(val)(((val)>>B_UNITSHIFT)&B_UNITMASK) +#defineB_PARTITIONSHIFT8 +#defineB_PARTITIONMASK0xff +#defineB_PARTITION(val)(((val)>>B_PARTITIONSHIFT)&B_PARTITIONMASK) +#defineB_TYPESHIFT0 +#defineB_TYPEMASK0xff +#defineB_TYPE(val)(((val)>>B_TYPESHIFT)&B_TYPEMASK) + + +/***************************************************************************************** +Desc:TheKernelsDescriptortable: +0-0x00-DummyEntry +1-0x08-Ring0CS +2-0x10-Ring0DS +3-0x18-LDT +4-0x20-SchedulerTSS +5-0x28-Ring3CS +6-0x30-Ring3DS +7-0x38-GPFTSS +8-0x40-StackFaultTSS +9-0x48-SMPPrivateData +10-0x50-USER%GS(Stack!) + +Notes: + +MrOlsen:test + +*****************************************************************************************/ +ubixDescriptorTable(ubixGDT,11){ +{.dummy=0}, +ubixStandardDescriptor(0x0000,0xFFFFF,(dCode+dRead+dBig+dBiglim)), +ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim)), +ubixStandardDescriptor(VMM_USER_LDT,0xFFFFF,(dLdt)), +ubixStandardDescriptor(0x4200,(sizeof(structtssStruct)),(dTss+dDpl3)), +ubixStandardDescriptor(0x0000,0xFFFFF,(dCode+dRead+dBig+dBiglim+dDpl3)), +ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim+dDpl3)), +ubixStandardDescriptor(0x5200,(sizeof(structtssStruct)),(dTss+dDpl3)), +ubixStandardDescriptor(0x6200,(sizeof(structtssStruct)),(dTss)), +ubixStandardDescriptor(0x0000,0xFFFFF,(dData+dWrite+dBig+dBiglim+dDpl0)), +ubixStandardDescriptor(0xBFC00000,0xFFFFF,(dData+dWrite+dBig+dBiglim+dDpl3)), +}; + +struct{ +unsignedshortlimit__attribute__((packed)); +uniondescriptorTableUnion*gdt__attribute__((packed)); +}loadGDT={(11*sizeof(uniondescriptorTableUnion)-1),ubixGDT}; + +staticchar*argv_init[2]={ +"init", +0x0,};/*ARGVForInitialProcess*/ + +staticchar*envp_init[6]={ +"HOME=/", +"PWD=/", +"PATH=/bin:/sbin:/usr/bin:/usr/sbin", +"USER=root", +"GROUP=admin", +0x0,};/*ENVPForInitialProcess*/ + +structbootinfo_bootinfo; +char_kernelname[512]; +u_long_bootdev; +u_long_boothowto; + +intkmain(uint32_trootdev){ +/*Setupcounterforstartuproutine*/ +inti=0x0; + +/*DoAClearScreenJustToMakeTheTEXTBufferNiceAndEmpty*/ +clearScreen(); -execThread(systemTask,(uInt32)sysTask+0x2000,0x0); - -execFile("sys:/bin/init",0x0,0x0,0x0);/*OSInitializer*/ - -irqEnable(0x0); - -while(0x1) -asm("hlt");/*Keephaultinguntiltheschedulerreacts*/ - -/*Returntostarthoweverweshouldnevergetthisfar*/ -return(0x0); -} - -/*** -END -***/ +/*Modifysrc/sys/include/ubixos/init.htoaddastartuproutine*/ +for(i=0x0;i<init_tasksTotal;i++){ +if(init_tasks[i]()!=0x0) +kpanic("Error:InitializingSystemTask[%i].\n",i); +} + +/*NewRootMountPoint*/ +/*Old2new10*/ +kprintf("[0x%X][0x%X:0x%X:0x%X:0x%X:0x%X:0x%X]\n",B_ADAPTOR(rootdev),B_CONTROLLER(rootdev),B_SLICE(rootdev),B_UNIT(rootdev),B_PARTITION(rootdev),B_TYPE(rootdev)); +/*if(vfs_mount(B_UNIT(_bootdev),B_PARTITION(_bootdev),0x0,0xAA,"sys","rw")!=0x0){*/ + +if(vfs_mount(0x1,0x2,0x0,0xAA,"sys2","rw")!=0x0){//UFSFS +kprintf("ProblemMountingsys2MountPoint\n"); +} +else +kprintf("Mountedsys2\n"); + + +if(vfs_mount(0x2,0x1,0x1,0xFA,"sys","rw")!=0x0){//FATFS +kprintf("ProblemMountingsysMountPoint\n"); +} +else +kprintf("Mountedsys\n"); + +/*Doourmounting*/ +/* +if(vfs_mount(0x0,0x0,0x0,0x0,"sys","rw")!=0x0){ +kprintf("ProblemMountingsysMountPoint\n"); +} +if(vfs_mount(0x0,0x0,0x1,0x0,"tmp","rw")!=0x0){ +kprintf("ProblemMountingtmpMountPoint\n"); +} +*/ + +/*Initializethesystem*/ +kprintf("FreePages:[%i]\n",systemVitals->freePages); +kprintf("MemoryMap:[0x%X]\n",vmmMemoryMap); +kprintf("StartingOS\n"); + + +/*kprintf("SDEThreadStart![0x%X]\n",&sdeThread);*/ +/*execThread(&sdeThread,0x2000,0x0);*/ + +kprintf("KernelName:[%s],BootHowTo[0x%X],BootDev:[0x%X]\n",_kernelname,_boothowto,_bootdev); +kprintf("B_TYPE(0x%X),B_SLICE(0x%X),B_UNIT(0x%X),B_PARTITION(0x%X)\n",B_TYPE(_bootdev),B_SLICE(_bootdev),B_UNIT(_bootdev),B_PARTITION(_bootdev)); +kprintf("_bootinfo.bi_version:0x%X\n",_bootinfo.bi_version); +kprintf("_bootinfo.bi_size:0x%X\n",_bootinfo.bi_size); +kprintf("_bootinfo.bi_bios_dev:0x%X\n",_bootinfo.bi_bios_dev); + +execThread(systemTask,0x2000,0x0); + +execFile("sys:/bin/init",argv_init,envp_init,0x0);/*OSInitializer*/ + +//execFile("fat:/bin/init",argv_init,envp_init,0x0); + +irqEnable(0x0); + +while(0x1) +asm("hlt"); + +/*Keephaultinguntiltheschedulerreacts*/ + +/*Returntostarthoweverweshouldnevergetthisfar*/ +return(0x0); +} - + diff --git a/doc/xml/main_8cpp.xml b/doc/xml/main_8cpp.xml index a08cf94..9a80ab2 100644 --- a/doc/xml/main_8cpp.xml +++ b/doc/xml/main_8cpp.xml @@ -1,236 +1,80 @@ - - - + + + main.cpp - iostream - vector - stdlib.h - vfs.h - btree.h - ubixfs.h - device.h - ramdrive.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int - int main - (void) - main - - void - - - - - - - - - dev_ramDestroy - dev_ramDrive - bTree::GetFirstNode - bTree::Insert - memset - name - NULL - bTree::Save - strcpy - UbixFS::vfs_format - UbixFS::vfs_init - UbixFS::vfs_mkdir - UbixFS::vfs_stop - - -#include<iostream> -#include<vector> -#include<stdlib.h> -#include"vfs.h" -#include"btree.h" -#include"ubixfs.h" -#include"device.h" -#include"ramdrive.h" -usingnamespacestd; - -int -main(void){ - -device_t*ramDrive=dev_ramDrive(); -UbixFS*fs=newUbixFS(ramDrive); -fs->vfs_format(ramDrive); -fs->vfs_init(); -fs->vfs_mkdir("/testdir",0); -fs->vfs_stop(); -dev_ramDestroy(); - -#if0 -inti=0; -ubixfsInode*inode=(ubixfsInode*)malloc(sizeof(ubixfsInode)); -memset(inode,0,sizeof(ubixfsInode)); -strcpy(inode->name,"50"); -bTree*tree=newbTree(".",inode); - -for(i=0;i<100;i++){ -//while(tree->Verify()){ -//if(i%1000==0)cout<<"-_-i="<<i<<"-_-"<<endl; -inode=(ubixfsInode*)malloc(sizeof(ubixfsInode)); -if(inode==NULL)break; -memset(inode,0,sizeof(ubixfsInode)); -for(intk=0;k<(random()%100)+5;k++){ -//for(intk=0;k<100;k++){ -inode->name[k]=(char)((random()%26)+'a'); -}//fork -//tree->Insert(inode); -if(!tree->Insert(inode->name,inode))cout<<"Insert("<<inode->name<<")failed"<<endl; -//++i; -}//fori -//cout<<"imadeitto:"<<i<<endl; - -i=0; -ubixfsInode*tmpInode=tmpInode=tree->GetFirstNode(); -if(tmpInode==NULL)cout<<"GetFirstNode()returnsnull"<<endl; -while(tmpInode!=NULL){ -//cout<<"node["<<i++<<"]:"<<tmpInode->name<<endl; -cout<<tmpInode->name<<endl; -tmpInode=tmpInode->next.iPtr; -}//while - - -//tree->Info(); -tree->Save("tree.dat"); -free(inode); -deletetree; -#endif -cout<<"sizeof(bNode):"<<sizeof(structbNode)<<endl; -cout<<"sizeof(ubixfsInode):"<<sizeof(structubixfsInode)<<endl; -cout<<"sizeof(diskSuperBlock):"<<sizeof(structdiskSuperBlock)<<endl; -cout<<"sizeof(bTreeHeader):"<<sizeof(structbTreeHeader)<<endl; -return0; -} +/* +#include<iostream> +#include<vector> +#include<stdlib.h> +#include"vfs.h" +#include"btree.h" +#include"ubixfs.h" +#include"device.h" +#include"ramdrive.h" +usingnamespacestd; + +int +main(void){ + +device_t*ramDrive=dev_ramDrive(); +UbixFS*fs=newUbixFS(ramDrive); +fs->vfs_format(ramDrive); +fs->vfs_init(); +fs->vfs_mkdir("/testdir",0); +fs->vfs_stop(); +dev_ramDestroy(); + +#if0 +inti=0; +ubixfsInode*inode=(ubixfsInode*)malloc(sizeof(ubixfsInode)); +memset(inode,0,sizeof(ubixfsInode)); +strcpy(inode->name,"50"); +bTree*tree=newbTree(".",inode); + +for(i=0;i<100;i++){ +//while(tree->Verify()){ +//if(i%1000==0)cout<<"-_-i="<<i<<"-_-"<<endl; +inode=(ubixfsInode*)malloc(sizeof(ubixfsInode)); +if(inode==NULL)break; +memset(inode,0,sizeof(ubixfsInode)); +for(intk=0;k<(random()%100)+5;k++){ +//for(intk=0;k<100;k++){ +inode->name[k]=(char)((random()%26)+'a'); +}//fork +//tree->Insert(inode); +if(!tree->Insert(inode->name,inode))cout<<"Insert("<<inode->name<<")failed"<<endl; +//++i; +}//fori +//cout<<"imadeitto:"<<i<<endl; + +i=0; +ubixfsInode*tmpInode=tmpInode=tree->GetFirstNode(); +if(tmpInode==NULL)cout<<"GetFirstNode()returnsnull"<<endl; +while(tmpInode!=NULL){ +//cout<<"node["<<i++<<"]:"<<tmpInode->name<<endl; +cout<<tmpInode->name<<endl; +tmpInode=tmpInode->next.iPtr; +}//while + + +//tree->Info(); +tree->Save("tree.dat"); +free(inode); +deletetree; +#endif +cout<<"sizeof(bNode):"<<sizeof(structbNode)<<endl; +cout<<"sizeof(ubixfsInode):"<<sizeof(structubixfsInode)<<endl; +cout<<"sizeof(diskSuperBlock):"<<sizeof(structdiskSuperBlock)<<endl; +cout<<"sizeof(bTreeHeader):"<<sizeof(structbTreeHeader)<<endl; +return0; +} +*/ - + diff --git a/doc/xml/math_8h.xml b/doc/xml/math_8h.xml index d7ca186..6387253 100644 --- a/doc/xml/math_8h.xml +++ b/doc/xml/math_8h.xml @@ -1,73 +1,96 @@ - - - + + + math.h - ubixos/types.h - src/sys/lib/atan.c - src/sys/lib/divdi3.c + sys/types.h + C:/Dev/git/UbixOS/sys/lib/atan.c + C:/Dev/git/UbixOS/sys/lib/divdi3.c - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - + + + + + + + + + + - - + + - - - - - - - - - - - unsigned long long int - typedef unsigned long long int u_quad_t - - u_quad_t - - - - - - - - - - - quad_t + + quad_t quad_t __divdi3 (quad_t a, quad_t b) __divdi3 - quad_t + quad_t a - quad_t + quad_t b @@ -76,19 +99,19 @@ - + - - u_quad_t + + u_quad_t u_quad_t __udivdi3 (u_quad_t a, u_quad_t b) __udivdi3 - u_quad_t + u_quad_t a - u_quad_t + u_quad_t b @@ -97,9 +120,9 @@ - + - + double double atan (double x) @@ -114,9 +137,9 @@ - + - + double double sqrt (double x) @@ -131,7 +154,7 @@ - + @@ -139,74 +162,70 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: math_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef__MATH_H -#define__MATH_H - -#include<ubixos/types.h> - -//typedeflonglongintquad_t; -typedefunsignedlonglongintu_quad_t; - -doubleatan(doublex); -doublesqrt(doublex); -u_quad_t__udivdi3(u_quad_ta,u_quad_tb); -quad_t__divdi3(quad_ta,quad_tb); - -#endif - -/*** -$Log: math_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.22006/10/3120:41:16reddawg -Includes - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:38reddawg -nomessage - -Revision1.22004/05/2115:22:35reddawg -Cleanedup +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef__MATH_H +#define__MATH_H + +#include<sys/types.h> + +//typedeflonglongintquad_t; +//typedefunsignedlonglongintu_quad_t; + +doubleatan(doublex); +doublesqrt(doublex); +u_quad_t__udivdi3(u_quad_ta,u_quad_tb); +quad_t__divdi3(quad_ta,quad_tb); + +#endif + +/*** +$Log:math.h,v$ +Revision1.22006/10/3120:41:16reddawg +Includes + +Revision1.1.1.12006/06/0112:46:13reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:38reddawg +nomessage + +Revision1.22004/05/2115:22:35reddawg +Cleanedup + - -END -***/ +END +***/ - + diff --git a/doc/xml/mem_8h.xml b/doc/xml/mem_8h.xml index 92e990f..1944a54 100644 --- a/doc/xml/mem_8h.xml +++ b/doc/xml/mem_8h.xml @@ -1,227 +1,722 @@ - - - + + + mem.h - ubixos/types.h - net/debug.h - net/opt.h - net/arch.h - src/sys/include/net/tcp.h - src/sys/net/net/bot.c - src/sys/net/net/init.c - src/sys/net/net/shell.c - src/sys/net/netif/ethernetif.c - src/sys/net/netif/loopif.c + net/opt.h + C:/Dev/git/UbixOS/sys/include/net/priv/memp_priv.h + C:/Dev/git/UbixOS/sys/include/net/stats.h + C:/Dev/git/UbixOS/sys/net/api/tcpip.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/mem.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c + C:/Dev/git/UbixOS/sys/net/netif/loopif.c - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + - + + + + + + + + + + + + + - - - - + + + + - - - - - + - + + + + + + + + + + + + + - + + + - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + + + + + + + + + - - + + + + + + - - - - - - - - - - - - - + + + - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - + - - - - - - - + - - - + + + - - - - + + + + + + + + - + - + - + - + - + + + + + + + + + + + + + + + + + - - - + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - MEM_ALIGN - addr - (void *)MEM_ALIGN_SIZE((uInt32)addr) + + MEM_SIZE_F + U16_F - - - - MEM_ALIGN_SIZE - size - (size + \ - ((((size) % (MEM_ALIGNMENT)) == 0)? 0 : \ - ((MEM_ALIGNMENT) - ((size) % (MEM_ALIGNMENT))))) - - - - - - - - - - mem_register_reclaim - f - arg - - - - - - - + - - uInt16 - typedef uInt16 mem_size_t + + u16_t + typedef u16_t mem_size_t mem_size_t @@ -230,11 +725,56 @@ - + - + + void * + void* mem_calloc + (mem_size_t count, mem_size_t size) + mem_calloc + + mem_size_t + count + + + mem_size_t + size + + + + +Contiguously allocates enough space for count objects that are size bytes of memory each and returns a pointer to the allocated memory. +The allocated memory is filled with bytes of value zero. + + +count + + +number of objects to allocate + + + + +size + + +size of the objects to allocate + + + +pointer to allocated memory / NULL pointer if there is an error + + + + + + + mem_malloc + memset + + void void mem_free (void *mem) @@ -242,16 +782,38 @@ void * mem + rmem +Put a struct mem back on the heap + + +rmem + + +is the data portion of a struct mem as returned by a previous call to mem_malloc() + + + + - + + LWIP_ASSERT + LWIP_DBG_LEVEL_SERIOUS + LWIP_DBG_TRACE + LWIP_DEBUGF + LWIP_MEM_FREE_DECL_PROTECT + MEM_ALIGNMENT + MEM_DEBUG + NULL + mem_free_callback + pbuf_free - + void void mem_init (void) @@ -262,176 +824,192 @@ +Zero the heap and initialize start, end and lowest-free - - net_init + + LWIP_ASSERT + MEM_ALIGNMENT + SIZEOF_STRUCT_MEM + lwip_init - + void * void* mem_malloc (mem_size_t size) mem_malloc - mem_size_t + mem_size_t size +Allocate a block of memory with a minimum of 'size' bytes. + + +size + + +is the minimum size of the requested block in bytes. + + + +pointer to allocated memory or NULL if no free memory was found. + +Note that the returned value will always be aligned (as defined by MEM_ALIGNMENT). - - ethernetif_init + + LWIP_MEM_ALIGN_SIZE + LWIP_MEM_ALLOC_DECL_PROTECT + MEM_SIZE_ALIGNED + MIN_SIZE_ALIGNED + NULL + sys_mutex_lock + ethernetif_init + mem_calloc + pbuf_alloc - + void * - void* mem_malloc2 - (mem_size_t size) - mem_malloc2 - - mem_size_t - size - - - - - - - - - - - void * - void* mem_realloc + void* mem_trim (void *mem, mem_size_t size) - mem_realloc + mem_trim void * mem + rmem - mem_size_t + mem_size_t size + newsize +Shrink memory returned by mem_malloc(). + + +rmem + + +pointer to memory allocated by mem_malloc the is to be shrinked + + + + +newsize + + +required size after shrinking (needs to be smaller than or equal to the previous size) + + + +for compatibility reasons: is always == rmem, at the moment or NULL if newsize is > old size, in which case rmem is NOT touched or freed! + + - - - - void * - void* mem_reallocm - (void *mem, mem_size_t size) - mem_reallocm - - void * - mem - - - mem_size_t - size - - - - - - - - + + LWIP_ASSERT + LWIP_MEM_ALIGN_SIZE + LWIP_MEM_FREE_DECL_PROTECT + MEM_SIZE_ALIGNED + MIN_SIZE_ALIGNED + NULL + pbuf_realloc +Heap API -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: mem_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_MEM_H__ -#define__LWIP_MEM_H__ - -#include<ubixos/types.h> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_MEM_H +#defineLWIP_HDR_MEM_H -#include"net/debug.h" -#include"net/opt.h" -#include"net/arch.h" - -#ifMEM_SIZE>64000l -typedefuInt32mem_size_t; -#else -typedefuInt16mem_size_t; -#endif/*MEM_SIZE>64000*/ +#include<net/opt.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifMEM_LIBC_MALLOC + +#include<net/arch.h> - -voidmem_init(void); +typedefsize_tmem_size_t; +#defineMEM_SIZE_FSZT_F -void*mem_malloc(mem_size_tsize); -void*mem_malloc2(mem_size_tsize); -voidmem_free(void*mem); -void*mem_realloc(void*mem,mem_size_tsize); -void*mem_reallocm(void*mem,mem_size_tsize); - -#ifdefMEM_PERF -voidmem_perf_start(void); -voidmem_perf_init(char*fname); -#endif/*MEM_PERF*/ - -#ifdefMEM_RECLAIM -typedefmem_size_t(*mem_reclaim_func)(void*arg,mem_size_tsize); -voidmem_register_reclaim(mem_reclaim_funcf,void*arg); -voidmem_reclaim(unsignedintsize); -#else -#definemem_register_reclaim(f,arg) -#endif/*MEM_RECLAIM*/ +#elifMEM_USE_POOLS + +typedefu16_tmem_size_t; +#defineMEM_SIZE_FU16_F + +#else + +/*MEM_SIZEwouldhavetobealigned,butusing64000hereinsteadof +*65535leavessomeroomforalignment... +*/ +#ifMEM_SIZE>64000L +typedefu32_tmem_size_t; +#defineMEM_SIZE_FU32_F +#else +typedefu16_tmem_size_t; +#defineMEM_SIZE_FU16_F +#endif/*MEM_SIZE>64000*/ +#endif - -#defineMEM_ALIGN_SIZE(size)(size+\ -((((size)%(MEM_ALIGNMENT))==0)?0:\ -((MEM_ALIGNMENT)-((size)%(MEM_ALIGNMENT))))) - -#defineMEM_ALIGN(addr)(void*)MEM_ALIGN_SIZE((uInt32)addr) - -#endif/*__LWIP_MEM_H__*/ - +voidmem_init(void); +void*mem_trim(void*mem,mem_size_tsize); +void*mem_malloc(mem_size_tsize); +void*mem_calloc(mem_size_tcount,mem_size_tsize); +voidmem_free(void*mem); + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_MEM_H*/ - + diff --git a/doc/xml/memp_8h.xml b/doc/xml/memp_8h.xml index b97b5be..dc7124a 100644 --- a/doc/xml/memp_8h.xml +++ b/doc/xml/memp_8h.xml @@ -1,195 +1,828 @@ - - - + + + memp.h - ubixos/types.h - net/debug.h - net/arch/cc.h - net/lwipopts.h - src/sys/include/net/stats.h - src/sys/net/api/api_lib.c - src/sys/net/api/api_msg.c - src/sys/net/api/tcpip.c - src/sys/net/net/init.c + net/opt.h + net/priv/memp_std.h + net/priv/memp_priv.h + net/stats.h + C:/Dev/git/UbixOS/sys/include/net/stats.h + C:/Dev/git/UbixOS/sys/net/api/tcpip.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/core/timeouts.c + C:/Dev/git/UbixOS/sys/net/net/init.c - - - - + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - + - + + + - - - + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - memp_register_reclaim - t - f - arg + + LWIP_MEMPOOL + name + num + size + desc - + + + + LWIP_MEMPOOL + name + num + size + desc + MEMP_##name, + + + + + + + + + + LWIP_MEMPOOL_ALLOC + name + memp_malloc_pool(&memp_ ## name) + + + +Allocate from a private memory pool + + + + + + + LWIP_MEMPOOL_DECLARE + name + num + size + desc + LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_ ## name ## _base, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))); \ + \ + LWIP_MEMPOOL_DECLARE_STATS_INSTANCE(memp_stats_ ## name) \ + \ + static struct memp *memp_tab_ ## name; \ + \ + const struct memp_desc memp_ ## name = { \ + DECLARE_LWIP_MEMPOOL_DESC(desc) \ + LWIP_MEMPOOL_DECLARE_STATS_REFERENCE(memp_stats_ ## name) \ + LWIP_MEM_ALIGN_SIZE(size), \ + (num), \ + memp_memory_ ## name ## _base, \ + &memp_tab_ ## name \ + }; + + + +Declare a private memory pool Private mempools example: .h: only when pool is used in multiple .c files: LWIP_MEMPOOL_PROTOTYPE(my_private_pool); .c: +in global variables section: LWIP_MEMPOOL_DECLARE(my_private_pool, 10, sizeof(foo), "Some description") +call ONCE before using pool (e.g. in some init() function): LWIP_MEMPOOL_INIT(my_private_pool); +allocate: void* my_new_mem = LWIP_MEMPOOL_ALLOC(my_private_pool); +free: LWIP_MEMPOOL_FREE(my_private_pool, my_new_mem); + + +To relocate a pool, declare it as extern in cc.h. Example for GCC: extern u8_t attribute((section(".onchip_mem"))) memp_memory_my_private_pool[]; + + + + + + + LWIP_MEMPOOL_FREE + name + x + memp_free_pool(&memp_ ## name, (x)) + + + +Free element from a private memory pool + + + + + + + LWIP_MEMPOOL_INIT + name + memp_init_pool(&memp_ ## name) + + + +Initialize a private memory pool + + + + + + + LWIP_MEMPOOL_PROTOTYPE + name + extern const struct memp_desc memp_ ## name + + + +Declare prototype for private memory pool if it is used in multiple files + + + + - + + memp_t - - MEMP_PBUF - - - - - - - MEMP_UDP_PCB - - - - - - - MEMP_TCP_PCB - - - - - - - MEMP_TCP_PCB_LISTEN - - - - - - - MEMP_TCP_SEG - - - - - - - MEMP_NETBUF - - - - - - - MEMP_NETCONN - - - - - - - MEMP_API_MSG - - - - - - - MEMP_TCPIP_MSG - - - - - - - MEMP_SYS_TIMEOUT - - - - - - + MEMP_MAX @@ -199,20 +832,38 @@ +Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end - + + + + + + const struct memp_desc *const + const struct memp_desc* const memp_pools[MEMP_MAX] + [MEMP_MAX] + memp_pools + + + + + + + + memp_free + memp_init - + void void memp_free (memp_t type, void *mem) memp_free - memp_t + memp_t type @@ -222,48 +873,38 @@ +Put an element back into its pool. + + +type + + +the pool where to put mem + + + + +mem + + +the memp element to free + + + + - - accept_function - netconn_delete - tcpip_apimsg + + LWIP_ERROR + MEMP_MAX + memp_pools + NULL + memp_desc::tab + pbuf_free + tcpip_callbackmsg_delete - - void - void memp_freep - (memp_t type, void *mem) - memp_freep - - memp_t - type - - - void * - mem - - - - - - - - - netbuf_chain - netbuf_delete - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_new - netconn_recv - netconn_send - netconn_write - tcpip_thread - - + void void memp_init (void) @@ -274,188 +915,181 @@ +Initializes lwIP built-in pools. Related functions: memp_malloc, memp_free +Carves out memp_memory into linked lists for each pool-type. - - net_init + + LWIP_ARRAYSIZE + memp_init_pool + memp_pools + lwip_init - + void * void* memp_malloc (memp_t type) memp_malloc - memp_t + memp_t type +Get an element from a specific pool. + + +type + + +the pool to get an element from + + + +a pointer to the allocated memory or a NULL pointer on error + + - - - - void * - void* memp_malloc2 - (memp_t type) - memp_malloc2 - - memp_t - type - - - - - - - - - - - void * - void* memp_mallocp - (memp_t type) - memp_mallocp - - memp_t - type - - - - - - - - - accept_function - netbuf_new - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_new - netconn_recv - netconn_send - netconn_write - recv_udp - tcpip_apimsg - tcpip_input - - - void * - void* memp_realloc - (memp_t fromtype, memp_t totype, void *mem) - memp_realloc - - memp_t - fromtype - - - memp_t - totype - - - void * - mem - - - - - - - - + + LWIP_ERROR + MEMP_MAX + NULL + pbuf_alloc + tcpip_callbackmsg_new +Memory pool API -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: memp_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -#ifndef__LWIP_MEMP_H__ -#define__LWIP_MEMP_H__ - -#include<ubixos/types.h> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ + +#ifndefLWIP_HDR_MEMP_H +#defineLWIP_HDR_MEMP_H -#include"net/debug.h" -#include"net/arch/cc.h" -#include"net/lwipopts.h" - -typedefenum{ -MEMP_PBUF, -MEMP_UDP_PCB, -MEMP_TCP_PCB, -MEMP_TCP_PCB_LISTEN, -MEMP_TCP_SEG, - -MEMP_NETBUF, -MEMP_NETCONN, -MEMP_API_MSG, -MEMP_TCPIP_MSG, - -MEMP_SYS_TIMEOUT, - -MEMP_MAX -}memp_t; - -voidmemp_init(void); - -void*memp_malloc(memp_ttype); -void*memp_mallocp(memp_ttype); -void*memp_malloc2(memp_ttype); -void*memp_realloc(memp_tfromtype,memp_ttotype,void*mem); -voidmemp_free(memp_ttype,void*mem); -voidmemp_freep(memp_ttype,void*mem); +#include<net/opt.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +/*runoncewithemptydefinitiontohandleallcustomincludesinlwippools.h*/ +#defineLWIP_MEMPOOL(name,num,size,desc) +#include<net/priv/memp_std.h> + +typedefenum{ +#defineLWIP_MEMPOOL(name,num,size,desc)MEMP_##name, +#include<net/priv/memp_std.h> +MEMP_MAX +}memp_t; + +#include<net/priv/memp_priv.h> +#include<net/stats.h> + +externconststructmemp_desc*constmemp_pools[MEMP_MAX]; + +#defineLWIP_MEMPOOL_PROTOTYPE(name)externconststructmemp_descmemp_##name + +#ifMEMP_MEM_MALLOC -#ifMEMP_RECLAIM -typedefuInt8(*memp_reclaim_func)(void*arg,memp_ttype); -voidmemp_register_reclaim(memp_ttype,memp_reclaim_funcf,void*arg); -#else -#definememp_register_reclaim(t,f,arg) -#endif/*MEMP_RECLAIM*/ - -#endif/*__LWIP_MEMP_H__*/ - +#defineLWIP_MEMPOOL_DECLARE(name,num,size,desc)\ +LWIP_MEMPOOL_DECLARE_STATS_INSTANCE(memp_stats_##name)\ +conststructmemp_descmemp_##name={\ +DECLARE_LWIP_MEMPOOL_DESC(desc)\ +LWIP_MEMPOOL_DECLARE_STATS_REFERENCE(memp_stats_##name)\ +LWIP_MEM_ALIGN_SIZE(size)\ +}; + +#else/*MEMP_MEM_MALLOC*/ + +#defineLWIP_MEMPOOL_DECLARE(name,num,size,desc)\ +LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_##name##_base,((num)*(MEMP_SIZE+MEMP_ALIGN_SIZE(size))));\ +\ +LWIP_MEMPOOL_DECLARE_STATS_INSTANCE(memp_stats_##name)\ +\ +staticstructmemp*memp_tab_##name;\ +\ +conststructmemp_descmemp_##name={\ +DECLARE_LWIP_MEMPOOL_DESC(desc)\ +LWIP_MEMPOOL_DECLARE_STATS_REFERENCE(memp_stats_##name)\ +LWIP_MEM_ALIGN_SIZE(size),\ +(num),\ +memp_memory_##name##_base,\ +&memp_tab_##name\ +}; + +#endif/*MEMP_MEM_MALLOC*/ + +#defineLWIP_MEMPOOL_INIT(name)memp_init_pool(&memp_##name) + +#defineLWIP_MEMPOOL_ALLOC(name)memp_malloc_pool(&memp_##name) + +#defineLWIP_MEMPOOL_FREE(name,x)memp_free_pool(&memp_##name,(x)) + +#ifMEM_USE_POOLS + +structmemp_malloc_helper +{ +memp_tpoolnr; +#ifMEMP_OVERFLOW_CHECK||(LWIP_STATS&&MEM_STATS) +u16_tsize; +#endif/*MEMP_OVERFLOW_CHECK||(LWIP_STATS&&MEM_STATS)*/ +}; +#endif/*MEM_USE_POOLS*/ + +voidmemp_init(void); + +#ifMEMP_OVERFLOW_CHECK +void*memp_malloc_fn(memp_ttype,constchar*file,constintline); +#definememp_malloc(t)memp_malloc_fn((t),__FILE__,__LINE__) +#else +void*memp_malloc(memp_ttype); +#endif +voidmemp_free(memp_ttype,void*mem); + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_MEMP_H*/ - + diff --git a/doc/xml/message_8c.xml b/doc/xml/message_8c.xml index 31d0c67..2ddc454 100644 --- a/doc/xml/message_8c.xml +++ b/doc/xml/message_8c.xml @@ -1,96 +1,210 @@ - - - + + + message.c mpi/mpi.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + - + - + - + - + - - - - - - - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - + - + - - - - + + + + - + void void sysMpiCreateMbox (uInt32 *status, char *name) sysMpiCreateMbox - uInt32 * + uInt32 * status @@ -103,16 +217,15 @@ - - mpi_createMbox + - + void void sysMpiDestroyMbox (uInt32 *status, char *name) sysMpiDestroyMbox - uInt32 * + uInt32 * status @@ -125,10 +238,9 @@ - - mpi_destroyMbox + - + void void sysMpiFetchMessage (char *name, mpi_message_t *msg, uInt32 *status) @@ -138,11 +250,11 @@ name - mpi_message_t * + mpi_message_t * msg - uInt32 * + uInt32 * status @@ -151,10 +263,9 @@ - - mpi_fetchMessage + - + void void sysMpiPostMessage (char *name, uInt32 *type, mpi_message_t *data) @@ -164,11 +275,11 @@ name - uInt32 * + uInt32 * type - mpi_message_t * + mpi_message_t * data @@ -177,16 +288,17 @@ - - mpi_postMessage + + mpi_postMessage + name - + void void sysMpiSpam (uInt32 type, void *data, uInt32 *status) sysMpiSpam - uInt32 + uInt32 type @@ -194,7 +306,7 @@ data - uInt32 * + uInt32 * status @@ -203,8 +315,7 @@ - - mpi_spam + @@ -212,91 +323,87 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: message_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<mpi/mpi.h> - -voidsysMpiCreateMbox(uInt32*status,char*name){ -if(status&&name) -*status=mpi_createMbox(name); -return; -} - -voidsysMpiDestroyMbox(uInt32*status,char*name){ -if(status&&name) -*status=mpi_destroyMbox(name); -return; -} - -voidsysMpiPostMessage(char*name,uInt32*type,mpi_message_t*data){ -if(type&&name&&data) -*type=mpi_postMessage(name,*type,data); -return; -} - -voidsysMpiFetchMessage(char*name,mpi_message_t*msg,uInt32*status){ -if(status&&name&&msg) -*status=mpi_fetchMessage(name,msg); -return; -} - -voidsysMpiSpam(uInt32type,void*data,uInt32*status){ -if(status&&data) -*status=mpi_spam(type,data); -return; -} - -/*** -$Log: message_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:14reddawg -nomessage - -Revision1.122004/08/1411:23:02reddawg -Changes - -Revision1.112004/07/2817:07:25reddawg -MPI:movedthesyscalls - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<mpi/mpi.h> + +voidsysMpiCreateMbox(uInt32*status,char*name){ +if(status&&name) +*status=mpi_createMbox(name); +return; +} + +voidsysMpiDestroyMbox(uInt32*status,char*name){ +if(status&&name) +*status=mpi_destroyMbox(name); +return; +} + +voidsysMpiPostMessage(char*name,uInt32*type,mpi_message_t*data){ +if(type&&name&&data) +*type=mpi_postMessage(name,*type,data); +return; +} + +voidsysMpiFetchMessage(char*name,mpi_message_t*msg,uInt32*status){ +if(status&&name&&msg) +*status=mpi_fetchMessage(name,msg); +return; +} + +voidsysMpiSpam(uInt32type,void*data,uInt32*status){ +if(status&&data) +*status=mpi_spam(type,data); +return; +} + +/*** +$Log:message.c,v$ +Revision1.1.1.12006/06/0112:46:16reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:14reddawg +nomessage + +Revision1.122004/08/1411:23:02reddawg +Changes + +Revision1.112004/07/2817:07:25reddawg +MPI:movedthesyscalls + +END +***/ + - + diff --git a/doc/xml/mount_8c.xml b/doc/xml/mount_8c.xml index a70817c..b98c3d4 100644 --- a/doc/xml/mount_8c.xml +++ b/doc/xml/mount_8c.xml @@ -1,186 +1,436 @@ - - - + + + mount.c vfs/mount.h ubixos/vitals.h ubixos/kpanic.h lib/kmalloc.h lib/kprintf.h - lib/string.h - sys/device.h + string.h + sys/device.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + int int vfs_addMount (struct vfs_mountPoint *mp) @@ -195,15 +445,15 @@ - - vitalsStruct::mountPoints - vfs_mountPoint::next - vfs_mountPoint::prev - systemVitals - vfs_mount + + vitalsStruct::mountPoints + vfs_mountPoint::next + vfs_mountPoint::prev + systemVitals + vfs_mount - - vfs_mountPoint * + + struct vfs_mountPoint * struct vfs_mountPoint* vfs_findMount (char *mountPoint) vfs_findMount @@ -217,18 +467,16 @@ - - vfs_mountPoint::mountPoint - vitalsStruct::mountPoints - vfs_mountPoint::next - NULL - strcmp - systemVitals - devfs_makeNode - fopen - unlink + + vfs_mountPoint::mountPoint + vitalsStruct::mountPoints + vfs_mountPoint::next + NULL + strcmp + systemVitals + fopen - + int int vfs_mount (int major, int minor, int partition, int vfsType, char *mountPoint, char *perms) @@ -263,24 +511,23 @@ - - vfs_mountPoint::device - device_find - vfs_mountPoint::fs - kfree - kmalloc - kprintf - vfs_mountPoint::mountPoint - NULL - vfs_mountPoint::partition - vfs_mountPoint::perms - sprintf - vfs_addMount - vfsFindFS - fileSystem::vfsInitFS - x1 - devfs_init - kmain + + vfs_mountPoint::device + device_find + vfs_mountPoint::fs + kfree + kmalloc + kprintf + device_node::minor + vfs_mountPoint::mountPoint + NULL + vfs_mountPoint::partition + vfs_mountPoint::perms + sprintf + vfs_addMount + vfsFindFS + fileSystem::vfsInitFS + fileSystem::vfsType @@ -288,154 +535,153 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: mount_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vfs/mount.h> -#include<ubixos/vitals.h> -#include<ubixos/kpanic.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<lib/string.h> -#include<sys/device.h> - -/************************************************************************ - -Function:mount(intdriveId,intpartition,intfsType,char*mountPoint,char*perms) - -Description:mountaddsamountpointandreturns0ifsuccessful1ifitfails - -Notes: - -************************************************************************/ -intvfs_mount(intmajor,intminor,intpartition,intvfsType,char*mountPoint,char*perms){ -structvfs_mountPoint*mp=0x0; -structdevice_node*device=0x0; - -/*AllocateMemoryForMountPoint*/ -if((mp=(structvfs_mountPoint*)kmalloc(sizeof(structvfs_mountPoint)))==NULL) -kprintf("vfs_mount:failedtoallocatemp\n"); - -/*CopyMountPointIntoBuffer*/ -sprintf(mp->mountPoint,mountPoint); - -/*SetPointerToPhysicalDrive*/ -device=device_find(major,minor); - -/*SetUpMpDefaults*/ -mp->device=device; -mp->fs=vfsFindFS(vfsType); -mp->partition=partition; -mp->perms=*perms; - -if(mp->fs==0x0){ -/*sysErr(systemErr,"FileSystemType:%iNotFound\n",fsType);*/ -kprintf("FileSystemType:%iNotFound\n",vfsType); -return(0x1); -} -/*Whatisthisfor?10/6/2006*/ -/* -if(device!=0x0){ -mp->diskLabel=(structubixDiskLabel*)kmalloc(512); -mp->device->devInfo->read(mp->device->devInfo->info,mp->diskLabel,1,1); -kprintf("READINGSECTOR"); -} -*/ - -/*AddMountpointIfItFailsFreeAndReturn*/ -if(vfs_addMount(mp)!=0x0){ -kfree(mp); -return(0x1); -} - -/*InitializeTheFileSystemIfItFailsReturn*/ -if(mp->fs->vfsInitFS(mp)==0x0){ -kfree(mp); -return(0x1); -} -/*Return*/ -return(0x0); -} - -/************************************************************************ - -Function:vfs_addMount(structvfs_mountPoint*mp) - -Description:Thisfunctionaddsamountpointtothesystem - -Notes: - -************************************************************************/ -intvfs_addMount(structvfs_mountPoint*mp){ - -/*IfThereAreNoExistingMountsMakeItTheFirst*/ -if(systemVitals->mountPoints==0x0){ -mp->prev=0x0; -mp->next=0x0; -systemVitals->mountPoints=mp; -} -else{ -mp->next=systemVitals->mountPoints; -systemVitals->mountPoints->prev=mp; -mp->prev=0x0; -systemVitals->mountPoints=mp; -} -/*Return*/ -return(0x0); -} - -/************************************************************************ - -Function:vfs_findMount(char*mountPoint) - -Description:Thisfunctionfindsaparticularmountpoint - -Notes: - -************************************************************************/ -structvfs_mountPoint*vfs_findMount(char*mountPoint){ -structvfs_mountPoint*tmpMp=0x0; - -for(tmpMp=systemVitals->mountPoints;tmpMp;tmpMp=tmpMp->next){ -if(strcmp(tmpMp->mountPoint,mountPoint)==0x0){ -return(tmpMp); -} -} -/*ReturnNULLIfMountPointNotFound*/ -returnNULL; -} - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vfs/mount.h> +#include<ubixos/vitals.h> +#include<ubixos/kpanic.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<string.h> +#include<sys/device.h> + +/************************************************************************ + +Function:mount(intdriveId,intpartition,intfsType,char*mountPoint,char*perms) + +Description:mountaddsamountpointandreturns0ifsuccessful1ifitfails + +Notes: + +************************************************************************/ +intvfs_mount(intmajor,intminor,intpartition,intvfsType,char*mountPoint,char*perms){ +structvfs_mountPoint*mp=0x0; +structdevice_node*device=0x0; + +/*AllocateMemoryForMountPoint*/ +if((mp=(structvfs_mountPoint*)kmalloc(sizeof(structvfs_mountPoint)))==NULL) +kprintf("vfs_mount:failedtoallocatemp\n"); + +/*CopyMountPointIntoBuffer*/ +sprintf(mp->mountPoint,mountPoint); + +/*SetPointerToPhysicalDrive*/ +device=device_find(major,minor); + +/*SetUpMpDefaults*/ +mp->device=device; +mp->fs=(structfileSystem*)vfsFindFS(vfsType); +mp->partition=partition; +mp->perms=*perms; + +if(mp->fs==0x0){ +/*sysErr(systemErr,"FileSystemType:%iNotFound\n",fsType);*/ +kprintf("FileSystemType:%iNotFound\n",vfsType); +return(0x1); +} +/*Whatisthisfor?10/6/2006*/ +/* +if(device!=0x0){ +mp->diskLabel=(structubixDiskLabel*)kmalloc(512); +mp->device->devInfo->read(mp->device->devInfo->info,mp->diskLabel,1,1); +kprintf("READINGSECTOR"); +} +*/ + +/*AddMountpointIfItFailsFreeAndReturn*/ +if(vfs_addMount(mp)!=0x0){ +kfree(mp); +return(0x1); +} + +/*InitializeTheFileSystemIfItFailsReturn*/ +if(mp->fs->vfsInitFS(mp)==0x0){ +kfree(mp); +return(0x1); +} +/*Return*/ +return(0x0); +} + +/************************************************************************ + +Function:vfs_addMount(structvfs_mountPoint*mp) + +Description:Thisfunctionaddsamountpointtothesystem + +Notes: + +************************************************************************/ +intvfs_addMount(structvfs_mountPoint*mp){ + +/*IfThereAreNoExistingMountsMakeItTheFirst*/ +if(systemVitals->mountPoints==0x0){ +mp->prev=0x0; +mp->next=0x0; +systemVitals->mountPoints=mp; +} +else{ +mp->next=systemVitals->mountPoints; +systemVitals->mountPoints->prev=mp; +mp->prev=0x0; +systemVitals->mountPoints=mp; +} +/*Return*/ +return(0x0); +} + +/************************************************************************ + +Function:vfs_findMount(char*mountPoint) + +Description:Thisfunctionfindsaparticularmountpoint + +Notes: + +************************************************************************/ +structvfs_mountPoint*vfs_findMount(char*mountPoint){ +structvfs_mountPoint*tmpMp=0x0; + +for(tmpMp=systemVitals->mountPoints;tmpMp;tmpMp=tmpMp->next){ +if(strcmp(tmpMp->mountPoint,mountPoint)==0x0){ +return(tmpMp); +} +} +/*ReturnNULLIfMountPointNotFound*/ +returnNULL; +} + +/*** +END +***/ + - + diff --git a/doc/xml/mount_8h.xml b/doc/xml/mount_8h.xml index 512f270..78c1f08 100644 --- a/doc/xml/mount_8h.xml +++ b/doc/xml/mount_8h.xml @@ -1,556 +1,1243 @@ - - - + + + mount.h - ubixos/types.h - src/sys/include/vfs/file.h - src/sys/include/vfs/vfs.h - src/sys/init/main.c - src/sys/kernel/sched.c - src/sys/ubixfs/block.c - src/sys/ubixfs/directory.c - src/sys/vfs/mount.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/block.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/directory.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/include/ufs/ffs/fs.h + C:/Dev/git/UbixOS/sys/include/vfs/file.h + C:/Dev/git/UbixOS/sys/include/vfs/vfs.h + C:/Dev/git/UbixOS/sys/init/main.c - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + - - - - - - + + - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + + + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fsid + statfs vfs_mountPoint + + + MFSNAMELEN + 16 /* length of type name including null */ + + + + + + + + + + MNAMELEN + 88 /* size of on/from name bufs */ + + + + + + + + + + + + struct fsid + typedef struct fsid fsid_t + + fsid_t + + + + + + + + + - + int int vfs_addMount (struct vfs_mountPoint *mp) @@ -565,15 +1252,15 @@ - - vitalsStruct::mountPoints - vfs_mountPoint::next - vfs_mountPoint::prev - systemVitals - vfs_mount + + vitalsStruct::mountPoints + vfs_mountPoint::next + vfs_mountPoint::prev + systemVitals + vfs_mount - - vfs_mountPoint * + + struct vfs_mountPoint * struct vfs_mountPoint* vfs_findMount (char *mountPoint) vfs_findMount @@ -587,18 +1274,16 @@ - - vfs_mountPoint::mountPoint - vitalsStruct::mountPoints - vfs_mountPoint::next - NULL - strcmp - systemVitals - devfs_makeNode - fopen - unlink + + vfs_mountPoint::mountPoint + vitalsStruct::mountPoints + vfs_mountPoint::next + NULL + strcmp + systemVitals + fopen - + int int vfs_mount (int major, int minor, int partition, int fsType, char *mountPoint, char *perms) @@ -633,24 +1318,23 @@ - - vfs_mountPoint::device - device_find - vfs_mountPoint::fs - kfree - kmalloc - kprintf - vfs_mountPoint::mountPoint - NULL - vfs_mountPoint::partition - vfs_mountPoint::perms - sprintf - vfs_addMount - vfsFindFS - fileSystem::vfsInitFS - x1 - devfs_init - kmain + + vfs_mountPoint::device + device_find + vfs_mountPoint::fs + kfree + kmalloc + kprintf + device_node::minor + vfs_mountPoint::mountPoint + NULL + vfs_mountPoint::partition + vfs_mountPoint::perms + sprintf + vfs_addMount + vfsFindFS + fileSystem::vfsInitFS + fileSystem::vfsType @@ -658,62 +1342,93 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: mount_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_MOUNT_H -#define_MOUNT_H - -#include<ubixos/types.h> - -structvfs_mountPoint{ -structvfs_mountPoint*prev; -structvfs_mountPoint*next; -structfileSystem*fs; -structdevice_node*device; -structubixDiskLabel*diskLabel; -void*fsInfo; -intpartition; -charmountPoint[1024]; -charperms; -}; - -intvfs_mount(intmajor,intminor,intpartition,intfsType,char*mountPoint,char*perms); -intvfs_addMount(structvfs_mountPoint*mp); -structvfs_mountPoint*vfs_findMount(char*mountPoint); - -#endif - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_MOUNT_H +#define_MOUNT_H + +#include<sys/types.h> + +#defineMFSNAMELEN16/*lengthoftypenameincludingnull*/ +#defineMNAMELEN88/*sizeofon/fromnamebufs*/ + +typedefstructfsid{ +int32_tval[2]; +}fsid_t;/*filesystemidtype*/ + +structstatfs{ +uint32_tf_version;/*structureversionnumber*/ +uint32_tf_type;/*typeoffilesystem*/ +u_int64_tf_flags;/*copyofmountexportedflags*/ +u_int64_tf_bsize;/*filesystemfragmentsize*/ +u_int64_tf_iosize;/*optimaltransferblocksize*/ +u_int64_tf_blocks;/*totaldatablocksinfilesystem*/ +u_int64_tf_bfree;/*freeblocksinfilesystem*/ +int64_tf_bavail;/*freeblocksavailtonon-superuser*/ +u_int64_tf_files;/*totalfilenodesinfilesystem*/ +int64_tf_ffree;/*freenodesavailtonon-superuser*/ +u_int64_tf_syncwrites;/*countofsyncwritessincemount*/ +u_int64_tf_asyncwrites;/*countofasyncwritessincemount*/ +u_int64_tf_syncreads;/*countofsyncreadssincemount*/ +u_int64_tf_asyncreads;/*countofasyncreadssincemount*/ +u_int64_tf_spare[10];/*unusedspare*/ +uint32_tf_namemax;/*maximumfilenamelength*/ +uid_tf_owner;/*userthatmountedthefilesystem*/ +fsid_tf_fsid;/*filesystemid*/ +charf_charspare[80];/*sparestringspace*/ +charf_fstypename[MFSNAMELEN];/*filesystemtypename*/ +charf_mntfromname[MNAMELEN];/*mountedfilesystem*/ +charf_mntonname[MNAMELEN];/*directoryonwhichmounted*/ +}; + +structvfs_mountPoint{ +structvfs_mountPoint*prev; +structvfs_mountPoint*next; +structfileSystem*fs; +structdevice_node*device; +structubixDiskLabel*diskLabel; +void*fsInfo; +intpartition; +charmountPoint[1024]; +charperms; +}; + +intvfs_mount(intmajor,intminor,intpartition,intfsType,char*mountPoint,char*perms); +intvfs_addMount(structvfs_mountPoint*mp); +structvfs_mountPoint*vfs_findMount(char*mountPoint); + +#endif + +/*** +END +***/ - + diff --git a/doc/xml/mouse_8c.xml b/doc/xml/mouse_8c.xml index ba4e260..2bcc232 100644 --- a/doc/xml/mouse_8c.xml +++ b/doc/xml/mouse_8c.xml @@ -1,6 +1,6 @@ - - - + + + mouse.c isa/mouse.h isa/8259.h @@ -8,77 +8,118 @@ sys/gdt.h sys/io.h lib/kprintf.h - ubixos/types.h - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + - - - - + + + + - + - + - + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + asm - (".globl mouseISR \n""mouseISR: \n"" pusha \n"" call mouseHandler \n"" popa \n"" iret \n") + (".globl mouseISR \n" "mouseISR: \n" " pusha \n" " call mouseHandler \n" " popa \n" " iret \n") asm - ".globl mouseISR \n""mouseISR: \n"" pusha \n"" call mouseHandler \n"" popa \n"" iret \n" + ".globl mouseISR \n" "mouseISR: \n" " pusha \n" " call mouseHandler \n" " popa \n" " iret \n" @@ -86,10 +127,10 @@ - + - - uInt8 + + uInt8 static uInt8 kbdRead () kbdRead @@ -99,22 +140,19 @@ - - inportByte - kbdWriteRead - mouseInit + - + void static void kbdWrite (uInt16 port, uInt8 data) kbdWrite - uInt16 + uInt16 port - uInt8 + uInt8 data @@ -123,27 +161,23 @@ - - inportByte - outportByte - kbdWriteRead - mouseInit + - - uInt8 + + uInt8 static uInt8 kbdWriteRead (uInt16 port, uInt8 data, const char *expect) kbdWriteRead - uInt16 + uInt16 port - uInt8 + uInt8 data - const char * + const char * expect @@ -152,12 +186,9 @@ - - kbdRead - kbdWrite - mouseInit + - + void void mouseHandler () @@ -168,14 +199,14 @@ - - eoi - kprintf - mPic - outportByte - sPic + + eoi + kprintf + mPic + outportByte + sPic - + int int mouseInit () @@ -186,22 +217,7 @@ - - dDpl3 - dInt - dPresent - eoi - irqEnable - kbdRead - kbdWrite - kbdWriteRead - kprintf - mouseISR - mPic - mVec - outportByte - setVector - sPic + @@ -209,182 +225,169 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: mouse_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<isa/mouse.h> -#include<isa/8259.h> -#include<sys/idt.h> -#include<sys/gdt.h> -#include<sys/io.h> -#include<lib/kprintf.h> -#include<ubixos/types.h> - -staticuInt8kbdRead(){ -unsignedlongTimeout; -uInt8Stat,Data; - -for(Timeout=50000L;Timeout!=0;Timeout--){ -Stat=inportByte(0x64); - -/*loopuntil8042outputbufferfull*/ -if((Stat&0x01)!=0) -{ -Data=inportByte(0x60); - -/*loopifparityerrororreceivetimeout*/ -if((Stat&0xC0)==0) -returnData; -} -} - -return-1; -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<isa/mouse.h> +#include<isa/8259.h> +#include<sys/idt.h> +#include<sys/gdt.h> +#include<sys/io.h> +#include<lib/kprintf.h> + +staticuInt8kbdRead(){ +unsignedlongTimeout; +uInt8Stat,Data; + +for(Timeout=50000L;Timeout!=0;Timeout--){ +Stat=inportByte(0x64); + +/*loopuntil8042outputbufferfull*/ +if((Stat&0x01)!=0){ +Data=inportByte(0x60); + +/*loopifparityerrororreceivetimeout*/ +if((Stat&0xC0)==0) +returnData; +} +} +return-1; +} + +staticvoidkbdWrite(uInt16port,uInt8data){ +uInt32timeout; +uInt8stat; -staticvoidkbdWrite(uInt16port,uInt8data){ -uInt32timeout; -uInt8stat; - -for(timeout=500000L;timeout!=0;timeout--) -{ -stat=inportByte(0x64); - -if((stat&0x02)==0) -break; -} - -if(timeout!=0) -outportByte(port,data); -} - -staticuInt8kbdWriteRead(uInt16port,uInt8data,constchar*expect) -{ -intRetVal; - -kbdWrite(port,data); -for(;*expect;expect++) -{ -RetVal=kbdRead(); -if((uInt8)*expect!=RetVal) -{ -returnRetVal; -} -} - -return0; -} - - - -intmouseInit(){ -staticuInt8s1[]={0xF3,0xC8,0xF3,0x64,0xF3,0x50,0}; -staticuInt8s2[]={0xF6,0xE6,0xF4,0xF3,0x64,0xE8,0x03,0}; -constuInt8*ch; -Int8cmd=0x0; - -kbdWrite(0x64,0xA8); -for(ch=s1;*ch;ch++){ -kbdWrite(0x64,0xD4); -kbdWriteRead(0x60,*ch,"\xFA"); -} -for(ch=s2;*ch;ch++){ -kbdWrite(0x64,0xD4); -kbdWriteRead(0x60,*ch,"\xFA"); -} -kbdWrite(0x64,0xD4); -if(kbdWriteRead(0x60,0xF2,"\xFA")!=0x0){ -kprintf("ErrorWithMouse\n"); -} -cmd=kbdRead(); -kprintf("CMD:[0x%X]\n",cmd); -kbdWrite(0x64,0xD4); -kbdWriteRead(0x60,0xF4,"\xFA"); +for(timeout=500000L;timeout!=0;timeout--){ +stat=inportByte(0x64); + +if((stat&0x02)==0) +break; +} + +if(timeout!=0) +outportByte(port,data); +} + +staticuInt8kbdWriteRead(uInt16port,uInt8data,constchar*expect){ +intRetVal; + +kbdWrite(port,data); +for(;*expect;expect++){ +RetVal=kbdRead(); +if((uInt8)*expect!=RetVal){ +returnRetVal; +} +} + +return0; +} + +intmouseInit(){ +staticuInt8s1[]={0xF3,0xC8,0xF3,0x64,0xF3,0x50,0}; +staticuInt8s2[]={0xF6,0xE6,0xF4,0xF3,0x64,0xE8,0x03,0}; +constuInt8*ch; +Int8cmd=0x0; + +kbdWrite(0x64,0xA8); +for(ch=s1;*ch;ch++){ +kbdWrite(0x64,0xD4); +kbdWriteRead(0x60,*ch,"\xFA"); +} +for(ch=s2;*ch;ch++){ +kbdWrite(0x64,0xD4); +kbdWriteRead(0x60,*ch,"\xFA"); +} +kbdWrite(0x64,0xD4); +if(kbdWriteRead(0x60,0xF2,"\xFA")!=0x0){ +kprintf("ErrorWithMouse\n"); +} +cmd=kbdRead(); +kprintf("CMD:[0x%X]\n",cmd); +kbdWrite(0x64,0xD4); +kbdWriteRead(0x60,0xF4,"\xFA"); + +setVector(&mouseISR,mVec+12,dPresent+dInt+dDpl3); + +outportByte(mPic,eoi); +outportByte(sPic,eoi); +irqEnable(12); +outportByte(mPic,eoi); +outportByte(sPic,eoi); + +kprintf("psm0-Address:[0x%X]\n",&mouseISR); -setVector(&mouseISR,mVec+12,dPresent+dInt+dDpl3); - -outportByte(mPic,eoi); -outportByte(sPic,eoi); -irqEnable(12); -outportByte(mPic,eoi); -outportByte(sPic,eoi); - -kprintf("psm0-Address:[0x%X]\n",&mouseISR); - -/*Returnsoweknoweverythingwentwell*/ -return(0x0); -} - -asm( -".globlmouseISR\n" -"mouseISR:\n" -"pusha\n"/*Saveallregisters*/ -"callmouseHandler\n" -"popa\n" -"iret\n"/*Exitinterrupt*/ -); - -voidmouseHandler(){ -kprintf("MOUSE!!!\n"); - -outportByte(mPic,eoi); -outportByte(sPic,eoi); -/*Return*/ -return; -} - -/*** -$Log: mouse_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:12reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:02reddawg -nomessage - -Revision1.32004/09/0721:54:38reddawg -okrevertedbacktooldschedulingfornow.... - -Revision1.22004/09/0615:13:25reddawg -LastcommitbeforeFreeBSD6.0 - -Revision1.12004/06/0410:20:53reddawg -mousedrive:fixedafewbugsworksabitbetternow - -END -***/ - +/*Returnsoweknoweverythingwentwell*/ +return(0x0); +} + +asm( +".globlmouseISR\n" +"mouseISR:\n" +"pusha\n"/*Saveallregisters*/ +"callmouseHandler\n" +"popa\n" +"iret\n"/*Exitinterrupt*/ +); + +voidmouseHandler(){ +kprintf("MOUSE!!!\n"); + +outportByte(mPic,eoi); +outportByte(sPic,eoi); +/*Return*/ +return; +} + +/*** +$Log:mouse.c,v$ +Revision1.1.1.12006/06/0112:46:12reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:02reddawg +nomessage + +Revision1.32004/09/0721:54:38reddawg +okrevertedbacktooldschedulingfornow.... + +Revision1.22004/09/0615:13:25reddawg +LastcommitbeforeFreeBSD6.0 + +Revision1.12004/06/0410:20:53reddawg +mousedrive:fixedafewbugsworksabitbetternow + +END +***/ + - + diff --git a/doc/xml/mouse_8h.xml b/doc/xml/mouse_8h.xml index 6397580..6f33448 100644 --- a/doc/xml/mouse_8h.xml +++ b/doc/xml/mouse_8h.xml @@ -1,34 +1,22 @@ - - - + + + mouse.h - src/sys/isa/mouse.c + C:/Dev/git/UbixOS/sys/isa/mouse.c - - - - + + + + - - + + - - - _MOUSE_H - - - - - - - - - - + void void mouseHandler () @@ -39,14 +27,14 @@ - - eoi - kprintf - mPic - outportByte - sPic + + eoi + kprintf + mPic + outportByte + sPic - + int int mouseInit () @@ -57,24 +45,9 @@ - - dDpl3 - dInt - dPresent - eoi - irqEnable - kbdRead - kbdWrite - kbdWriteRead - kprintf - mouseISR - mPic - mVec - outportByte - setVector - sPic + - + void void mouseISR () @@ -85,8 +58,7 @@ - - mouseInit + @@ -94,64 +66,60 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: mouse_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_MOUE_H -#define_MOUSE_H - -intmouseInit(); -voidmouseISR(); -voidmouseHandler(); - -#endif - -/*** -$Log: mouse_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:39reddawg -nomessage - -Revision1.12004/06/0410:20:53reddawg -mousedrive:fixedafewbugsworksabitbetternow - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_ISA_MOUSE_H +#define_ISA_MOUSE_H + +intmouseInit(); +voidmouseISR(); +voidmouseHandler(); + +#endif + +/*** +$Log:mouse.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:39reddawg +nomessage + +Revision1.12004/06/0410:20:53reddawg +mousedrive:fixedafewbugsworksabitbetternow + +END +***/ - + diff --git a/doc/xml/mpi_8h.xml b/doc/xml/mpi_8h.xml index a311fd8..186563c 100644 --- a/doc/xml/mpi_8h.xml +++ b/doc/xml/mpi_8h.xml @@ -1,186 +1,320 @@ - - - + + + mpi.h - ubixos/types.h + sys/types.h ubixos/sched.h - src/sys/include/ubixfs/ubixfs.h - src/sys/kernel/syscall.c - src/sys/kernel/systemtask.c - src/sys/mpi/message.c - src/sys/mpi/system.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/include/ubixfs/ubixfs.h + C:/Dev/git/UbixOS/sys/mpi/message.c + C:/Dev/git/UbixOS/sys/mpi/mpi_syscalls.c + C:/Dev/git/UbixOS/sys/mpi/system.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + - + - + - + - + - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - + - + - - - - + + + + - - - - - - + + - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + - + - + - + - + - + - - - + - - - + + + - - - - + + + + - + + + + + + + + + + + + + - - + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mpi_mbox mpi_message - + MESSAGE_LENGTH 248 @@ -189,15 +323,12 @@ - - mpi_fetchMessage - mpi_postMessage - mpi_spam + - - mpi_mbox + + struct mpi_mbox typedef struct mpi_mbox mpi_mbox_t mpi_mbox_t @@ -207,10 +338,10 @@ - + - - mpi_message + + struct mpi_message typedef struct mpi_message mpi_message_t mpi_message_t @@ -220,11 +351,11 @@ - + - + int int mpi_createMbox (char *) @@ -238,25 +369,11 @@ - - _current - taskStruct::id - kmalloc - mboxList - mpi_findMbox - mpiSpinLock - mpi_mbox::name - mpi_mbox::next - mpi_mbox::pid - mpi_mbox::prev - spinLock - spinUnlock - sprintf - sysMpiCreateMbox - systemTask - ubixfs_thread + + sys_mpiCreateMbox + systemTask - + int int mpi_destroyMbox (char *) @@ -270,22 +387,10 @@ - - _current - taskStruct::id - kfree - mboxList - mpiSpinLock - mpi_mbox::name - mpi_mbox::next - mpi_mbox::pid - mpi_mbox::prev - spinLock - spinUnlock - strcmp - sysMpiDestroyMbox + + sys_mpiDestroyMbox - + int int mpi_fetchMessage (char *, mpi_message_t *) @@ -294,7 +399,7 @@ char * - mpi_message_t * + mpi_message_t * @@ -302,27 +407,11 @@ - - _current - mpi_message::data - mpi_message::header - taskStruct::id - kfree - memcpy - MESSAGE_LENGTH - mpi_findMbox - mpiSpinLock - mpi_mbox::msg - mpi_message::next - mpi_mbox::pid - mpi_message::pid - spinLock - spinUnlock - sysMpiFetchMessage - systemTask - ubixfs_thread + + sys_mpiFetchMessage + systemTask - + int int mpi_postMessage (char *, uInt32, mpi_message_t *) @@ -331,10 +420,10 @@ char * - uInt32 + uInt32 - mpi_message_t * + mpi_message_t * @@ -342,32 +431,17 @@ - - _current - mpi_message::data - mpi_message::header - taskStruct::id - kmalloc - memcpy - MESSAGE_LENGTH - mpi_findMbox - mpiSpinLock - mpi_mbox::msg - mpi_mbox::msgLast - mpi_message::next - mpi_message::pid - spinLock - spinUnlock - x1 - sysMpiPostMessage + + sys_mpiPostMessage + sysMpiPostMessage - + int int mpi_spam (uInt32, void *) mpi_spam - uInt32 + uInt32 void * @@ -378,21 +452,7 @@ - - mpi_message::data - mpi_message::header - kmalloc - mboxList - memcpy - MESSAGE_LENGTH - mpiSpinLock - mpi_mbox::msg - mpi_mbox::msgLast - mpi_mbox::next - mpi_message::next - spinLock - spinUnlock - sysMpiSpam + @@ -400,113 +460,69 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: mpi_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_MPI_H -#define_MPI_H - -#include<ubixos/types.h> -#include<ubixos/sched.h> - -#defineMESSAGE_LENGTH248 - -structmpi_message{ -chardata[MESSAGE_LENGTH]; -uInt32header; -pidTypepid; -structmpi_message*next; -}; - -structmpi_mbox{ -structmpi_mbox*next; -structmpi_mbox*prev; -structmpi_message*msg; -structmpi_message*msgLast; -charname[64]; -pidTypepid; -}; - -typedefstructmpi_mboxmpi_mbox_t; -typedefstructmpi_messagempi_message_t; - - -intmpi_createMbox(char*); -intmpi_destroyMbox(char*); -intmpi_postMessage(char*,uInt32,mpi_message_t*); -intmpi_fetchMessage(char*,mpi_message_t*); -intmpi_spam(uInt32,void*); - -#endif - -/*** -$Log: mpi_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:42reddawg -nomessage - -Revision1.82004/08/1411:23:02reddawg -Changes - -Revision1.72004/05/2803:52:56reddawg -mpi:tookafewsuggestionsfromTCA - -Revision1.62004/05/2518:33:11reddawg -Wenowuse128bytemessagesIcanincreaselater - -Revision1.52004/05/2518:29:57reddawg -Wenowlockontoapid - -Revision1.42004/05/2516:52:22reddawg -WenowhavempiDestroyMbox(char*)Thiswillofcoursedestroyamailbox - -Revision1.32004/05/2516:28:21reddawg -MadempiFindMbox()static - -Revision1.22004/05/2515:42:19reddawg -EnabledmpiSpam(); - -Revision1.12004/05/2514:07:01reddawg -Sorrywecan'tforgettheheadersfiles - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_MPI_MPI_H +#define_MPI_MPI_H + +#include<sys/types.h> +#include<ubixos/sched.h> + +#defineMESSAGE_LENGTH248 + +structmpi_message{ +chardata[MESSAGE_LENGTH]; +uInt32header; +pidTypepid; +structmpi_message*next; +}; + +structmpi_mbox{ +structmpi_mbox*next; +structmpi_mbox*prev; +structmpi_message*msg; +structmpi_message*msgLast; +charname[64]; +pidTypepid; +}; + +typedefstructmpi_mboxmpi_mbox_t; +typedefstructmpi_messagempi_message_t; + +intmpi_createMbox(char*); +intmpi_destroyMbox(char*); +intmpi_postMessage(char*,uInt32,mpi_message_t*); +intmpi_fetchMessage(char*,mpi_message_t*); +intmpi_spam(uInt32,void*); + +#endif - + diff --git a/doc/xml/ne2k_8c.xml b/doc/xml/ne2k_8c.xml index 825e9df..95dd08a 100644 --- a/doc/xml/ne2k_8c.xml +++ b/doc/xml/ne2k_8c.xml @@ -1,8 +1,9 @@ - - - + + + ne2k.c isa/ne2k.h + net/netif.h isa/8259.h sys/device.old.h sys/io.h @@ -15,229 +16,525 @@ ubixos/spinlock.h assert.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + struct device * + struct device* mDev + + mDev + = 0x0 + + + + + + + + + + struct spinLock + struct spinLock ne2k_spinLock + + ne2k_spinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + struct nicBuffer * + struct nicBuffer* ne2kBuffer + + ne2kBuffer + = 0x0 + + + + + + + + + - + asm - (".globl ne2kISR \n""ne2kISR: \n"" pusha \n"" call ne2kHandler \n"" popa \n"" iret \n") + (".globl ne2kISR \n" "ne2kISR: \n" " pusha \n" " call ne2kHandler \n" " popa \n" " iret \n") asm - ".globl ne2kISR \n""ne2kISR: \n"" pusha \n"" call ne2kHandler \n"" popa \n"" iret \n" + ".globl ne2kISR \n" "ne2kISR: \n" " pusha \n" " call ne2kHandler \n" " popa \n" " iret \n" @@ -245,9 +542,9 @@ - + - + int static int dp_pkt2user (struct device *dev, int page, int length) @@ -270,17 +567,9 @@ - - nicBuffer::buffer - DP_PAGESIZE - kprintf - ne2kAllocBuffer - NICtoPC - OK - stopPage - dp_recv + - + int static int dp_recv (struct device *) @@ -295,25 +584,9 @@ - - dp_pkt2user - getblock - inportByte - device::ioAddr - kpanic - kprintf - NE_BNRY - NE_CMD - NE_CURRENT - OK - outportByte - RSR_FO - RSR_PRX - startPage - stopPage - ne2kHandler + - + void static void getblock (struct device *dev, int page, size_t offset, size_t size, void *dst) @@ -327,11 +600,11 @@ page - size_t + size_t offset - size_t + size_t size @@ -344,23 +617,9 @@ - - DP_PAGESIZE - E8390_RREAD - E8390_START - EN0_ISR - EN0_RSARHI - EN0_RSARLO - inportWord - device::ioAddr - NE_CMD - NE_DATAPORT - NE_RBCR0 - NE_RBCR1 - outportByte - dp_recv + - + int int ne2k_init () @@ -371,50 +630,10 @@ - - dDpl0 - dInt - DP_CNTR0 - DP_CNTR1 - DP_CNTR2 - DP_CURR - DP_MAR0 - DP_MAR1 - DP_MAR2 - DP_MAR3 - DP_MAR4 - DP_MAR5 - DP_MAR6 - DP_MAR7 - dPresent - inportByte - device::ioAddr - device::irq - irqEnable - kmalloc - kprintf - mDev - mVec - ne2kISR - NE_BNRY - NE_CMD - NE_DCR - NE_IMR - NE_ISR - NE_PSTART - NE_PSTOP - NE_RBCR0 - NE_RBCR1 - NE_RCR - NE_TCR - outportByte - setVector - startPage - stopPage - x20 + - - nicBuffer * + + struct nicBuffer * struct nicBuffer* ne2kAllocBuffer (int length) ne2kAllocBuffer @@ -428,18 +647,11 @@ - - nicBuffer::buffer - kmalloc - nicBuffer::length - ne2k_spinLock - ne2kBuffer - nicBuffer::next - spinLock - spinUnlock - dp_pkt2user + + spinLock + tmpBuf - + void void ne2kFreeBuffer (struct nicBuffer *buf) @@ -454,12 +666,11 @@ - - nicBuffer::buffer - kfree + + kfree - - nicBuffer * + + struct nicBuffer * struct nicBuffer* ne2kGetBuffer () ne2kGetBuffer @@ -469,13 +680,10 @@ - - ne2k_spinLock - ne2kBuffer - nicBuffer::next - x1 + + tmpBuf - + void void ne2kHandler () @@ -486,24 +694,9 @@ - - dp_recv - eoi - inportByte - device::ioAddr - irqDisable - irqEnable - kprintf - mDev - mPic - NE_IMR - NE_ISR - NE_TPSR - outportByte - sPic - status + - + int int NICtoPC (struct device *dev, void *packet, int length, int nic_addr) @@ -530,20 +723,19 @@ - - assert - EN0_ISR - EN0_RCNTHI - EN0_RCNTLO - EN0_RSARHI - EN0_RSARLO - inportWord - device::ioAddr - NE_DATAPORT - outportByte - dp_pkt2user + + assert + EN0_ISR + EN0_RCNTHI + EN0_RCNTLO + EN0_RSARHI + EN0_RSARLO + inportWord + device::ioAddr + NE_DATAPORT + outportByte - + int int PCtoNIC (struct device *dev, void *packet, int length) @@ -566,71 +758,23 @@ - - assert - E8390_RWRITE - E8390_START - EN0_ISR - EN0_RCNTHI - EN0_RCNTLO - EN0_RSARHI - EN0_RSARLO - inportByte - device::ioAddr - kpanic - NE_DATAPORT - outportByte - outportWord - - - - - struct device * - struct device* mDev - - mDev - 0x0 - - - - - - - - ne2k_init - ne2kHandler - - - spinLock_t - spinLock_t ne2k_spinLock - - ne2k_spinLock - SPIN_LOCK_INITIALIZER - - - - - - - - ne2kAllocBuffer - ne2kGetBuffer - - - struct nicBuffer * - struct nicBuffer* ne2kBuffer - - ne2kBuffer - 0x0 - - - - - - - - ne2kAllocBuffer - ne2kGetBuffer + + assert + E8390_RWRITE + E8390_START + EN0_ISR + EN0_RCNTHI + EN0_RCNTLO + EN0_RSARHI + EN0_RSARLO + EN0_TPSR + inportByte + device::ioAddr + kpanic + NE_DATAPORT + outportByte + outportByteP + outportWord @@ -638,36 +782,36 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ne2k_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<isa/ne2k.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<isa/ne2k.h> +#include<net/netif.h> #include<isa/8259.h> #include<sys/device.old.h> #include<sys/io.h> @@ -680,387 +824,385 @@ #include<ubixos/spinlock.h> #include<assert.h> - -staticspinLock_tne2k_spinLock=SPIN_LOCK_INITIALIZER; - -staticintdp_pkt2user(structdevice*dev,intpage,intlength); -staticvoidgetblock(structdevice*dev,intpage,size_toffset,size_tsize,void*dst); -staticintdp_recv(structdevice*); - -staticstructnicBuffer*ne2kBuffer=0x0; -staticstructdevice*mDev=0x0; - -asm( -".globlne2kISR\n" -"ne2kISR:\n" -"pusha\n"/*Saveallregisters*/ -"callne2kHandler\n" -"popa\n" -"iret\n"/*Exitinterrupt*/ -); - -/************************************************************************ - -Function:intne2kInit(uInt32ioAddr) -Description:ThisFunctionWillInitializeTheProgrammableTimer - -Notes: - -************************************************************************/ -intne2k_init(){ -mDev=(structdevice*)kmalloc(sizeof(structdevice)); -mDev->ioAddr=0x280; -mDev->irq=10; -setVector(&ne2kISR,mVec+10,dPresent+dInt+dDpl0); -irqEnable(10); -//kprintf("ne0-irq:%i,ioAddr:0x%XMAC:%X:%X:%X:%X:%X:%X\n",dev->irq,dev->ioAddr,dev->net->mac[0]&0xFF,dev->net->mac[1]&0xFF,dev->net->mac[2]&0xFF,dev->net->mac[3]&0xFF,dev->net->mac[4]&0xFF,dev->net->mac[5]&0xFF); - -outportByte(mDev->ioAddr+NE_CMD,0x21);//stopmode -outportByte(mDev->ioAddr+NE_DCR,0x29);//0x29dataconfigreg -outportByte(mDev->ioAddr+NE_RBCR0,0x00);//LOWbytecount(remote) -outportByte(mDev->ioAddr+NE_RBCR1,0x00);//HIGHbytecount(remote) -outportByte(mDev->ioAddr+NE_RCR,0x3C);//receiveconfigreg -outportByte(mDev->ioAddr+NE_TCR,0x02);//LOOPmode(temp) -outportByte(mDev->ioAddr+NE_PSTART,startPage);//0x26PAGEstart -outportByte(mDev->ioAddr+NE_BNRY,startPage);//0x26BOUNDARY -outportByte(mDev->ioAddr+NE_PSTOP,stopPage);//0x40PAGEstop -outportByte(mDev->ioAddr+NE_ISR,0xFF);//interruptstatusreg -outportByte(mDev->ioAddr+NE_IMR,0x0B); -outportByte(mDev->ioAddr+NE_CMD,0x61);//PAGE1regs - -outportByte(mDev->ioAddr+DP_MAR0,0xFF); -outportByte(mDev->ioAddr+DP_MAR1,0xFF); -outportByte(mDev->ioAddr+DP_MAR2,0xFF); -outportByte(mDev->ioAddr+DP_MAR3,0xFF); -outportByte(mDev->ioAddr+DP_MAR4,0xFF); -outportByte(mDev->ioAddr+DP_MAR5,0xFF); -outportByte(mDev->ioAddr+DP_MAR6,0xFF); -outportByte(mDev->ioAddr+DP_MAR7,0xFF); -outportByte(mDev->ioAddr+DP_CURR,startPage+1); -outportByte(mDev->ioAddr+NE_CMD,0x20); -inportByte(mDev->ioAddr+DP_CNTR0);/*resetcountersbyreading*/ -inportByte(mDev->ioAddr+DP_CNTR1); -inportByte(mDev->ioAddr+DP_CNTR2); - -outportByte(mDev->ioAddr+NE_TCR,0x00); - -outportByte(mDev->ioAddr+NE_CMD,0x0); -outportByte(mDev->ioAddr+NE_DCR,0x29); - -kprintf("Initialized"); -/*Returnsoweknoweverythingwentwell*/ -return(0x0); -} - -intPCtoNIC(structdevice*dev,void*packet,intlength){ -inti=0x0; -uInt16*packet16=(uInt16*)packet; -uInt8*packet8=(uInt8*)packet; -uInt8word16=0x1; - -if((inportByte(dev->ioAddr)&0x04)==0x04){ -kpanic("DeviceNotReady\n"); -} - -assert(length); -if((word16==1)&&(length&0x01)){ -length++; -} - -outportByte(dev->ioAddr+EN0_RCNTLO,(length&0xFF)); -outportByte(dev->ioAddr+EN0_RCNTHI,(length>>8)); - -outportByte(dev->ioAddr+EN0_RSARLO,0x0); -outportByte(dev->ioAddr+EN0_RSARHI,0x41); - -outportByte(dev->ioAddr,E8390_RWRITE+E8390_START); - -if(word16!=0x0){ -for(i=0;i<length/2;i++){ -outportWord(dev->ioAddr+NE_DATAPORT,packet16[i]); -} -} -else{ -for(i=0;i<length;i++){ -outportByte(dev->ioAddr+NE_DATAPORT,packet8[i]); -} -} - -for(i=0;i<=100;i++){ -if((inportByte(dev->ioAddr+EN0_ISR)&0x40)==0x40){ -break; -} -} - -outportByte(dev->ioAddr+EN0_ISR,0x40); -outportByte(dev->ioAddr+EN0_TPSR,0x41);//ei_local->txStartPage); -outportByte(dev->ioAddr+0x05,(length&0xFF)); -outportByte(dev->ioAddr+0x06,(length>>8)); -outportByteP(dev->ioAddr,0x26); -//kprintf("SENT\n"); -return(length); -} - -intNICtoPC(structdevice*dev,void*packet,intlength,intnic_addr){ -inti=0x0; -uInt16*packet16=(uInt16*)packet; - -assert(length); - -if(length&0x01) -length++; - - +staticstructspinLockne2k_spinLock=SPIN_LOCK_INITIALIZER; + +staticintdp_pkt2user(structdevice*dev,intpage,intlength); +staticvoidgetblock(structdevice*dev,intpage,size_toffset,size_tsize,void*dst); +staticintdp_recv(structdevice*); + +staticstructnicBuffer*ne2kBuffer=0x0; +staticstructdevice*mDev=0x0; + +asm( +".globlne2kISR\n" +"ne2kISR:\n" +"pusha\n"/*Saveallregisters*/ +"callne2kHandler\n" +"popa\n" +"iret\n"/*Exitinterrupt*/ +); + +/************************************************************************ + +Function:intne2kInit(uInt32ioAddr) +Description:ThisFunctionWillInitializeTheProgrammableTimer + +Notes: + +************************************************************************/ +intne2k_init(){ +mDev=(structdevice*)kmalloc(sizeof(structdevice)); +mDev->ioAddr=0x280; +mDev->irq=10; +setVector(&ne2kISR,mVec+10,dPresent+dInt+dDpl0); +irqEnable(10); +//kprintf("ne0-irq:%i,ioAddr:0x%XMAC:%X:%X:%X:%X:%X:%X\n",dev->irq,dev->ioAddr,dev->net->mac[0]&0xFF,dev->net->mac[1]&0xFF,dev->net->mac[2]&0xFF,dev->net->mac[3]&0xFF,dev->net->mac[4]&0xFF,dev->net->mac[5]&0xFF); + +outportByte(mDev->ioAddr+NE_CMD,0x21);//stopmode +outportByte(mDev->ioAddr+NE_DCR,0x29);//0x29dataconfigreg +outportByte(mDev->ioAddr+NE_RBCR0,0x00);//LOWbytecount(remote) +outportByte(mDev->ioAddr+NE_RBCR1,0x00);//HIGHbytecount(remote) +outportByte(mDev->ioAddr+NE_RCR,0x3C);//receiveconfigreg +outportByte(mDev->ioAddr+NE_TCR,0x02);//LOOPmode(temp) +outportByte(mDev->ioAddr+NE_PSTART,startPage);//0x26PAGEstart +outportByte(mDev->ioAddr+NE_BNRY,startPage);//0x26BOUNDARY +outportByte(mDev->ioAddr+NE_PSTOP,stopPage);//0x40PAGEstop +outportByte(mDev->ioAddr+NE_ISR,0xFF);//interruptstatusreg +outportByte(mDev->ioAddr+NE_IMR,0x0B); +outportByte(mDev->ioAddr+NE_CMD,0x61);//PAGE1regs + +outportByte(mDev->ioAddr+DP_MAR0,0xFF); +outportByte(mDev->ioAddr+DP_MAR1,0xFF); +outportByte(mDev->ioAddr+DP_MAR2,0xFF); +outportByte(mDev->ioAddr+DP_MAR3,0xFF); +outportByte(mDev->ioAddr+DP_MAR4,0xFF); +outportByte(mDev->ioAddr+DP_MAR5,0xFF); +outportByte(mDev->ioAddr+DP_MAR6,0xFF); +outportByte(mDev->ioAddr+DP_MAR7,0xFF); +outportByte(mDev->ioAddr+DP_CURR,startPage+1); +outportByte(mDev->ioAddr+NE_CMD,0x20); +inportByte(mDev->ioAddr+DP_CNTR0);/*resetcountersbyreading*/ +inportByte(mDev->ioAddr+DP_CNTR1); +inportByte(mDev->ioAddr+DP_CNTR2); + +outportByte(mDev->ioAddr+NE_TCR,0x00); + +outportByte(mDev->ioAddr+NE_CMD,0x0); +outportByte(mDev->ioAddr+NE_DCR,0x29); + +kprintf("Initialized"); +/*Returnsoweknoweverythingwentwell*/ +return(0x0); +} + +intPCtoNIC(structdevice*dev,void*packet,intlength){ +inti=0x0; +uInt16*packet16=(uInt16*)packet; +uInt8*packet8=(uInt8*)packet; +uInt8word16=0x1; + +if((inportByte(dev->ioAddr)&0x04)==0x04){ +kpanic("DeviceNotReady\n"); +} + +assert(length); +if((word16==1)&&(length&0x01)){ +length++; +} + +outportByte(dev->ioAddr+EN0_RCNTLO,(length&0xFF)); +outportByte(dev->ioAddr+EN0_RCNTHI,(length>>8)); + +outportByte(dev->ioAddr+EN0_RSARLO,0x0); +outportByte(dev->ioAddr+EN0_RSARHI,0x41); + +outportByte(dev->ioAddr,E8390_RWRITE+E8390_START); + +if(word16!=0x0){ +for(i=0;i<length/2;i++){ +outportWord(dev->ioAddr+NE_DATAPORT,packet16[i]); +} +} +else{ +for(i=0;i<length;i++){ +outportByte(dev->ioAddr+NE_DATAPORT,packet8[i]); +} +} + +for(i=0;i<=100;i++){ +if((inportByte(dev->ioAddr+EN0_ISR)&0x40)==0x40){ +break; +} +} + +outportByte(dev->ioAddr+EN0_ISR,0x40); +outportByte(dev->ioAddr+EN0_TPSR,0x41);//ei_local->txStartPage); +outportByte(dev->ioAddr+0x05,(length&0xFF)); +outportByte(dev->ioAddr+0x06,(length>>8)); +outportByteP(dev->ioAddr,0x26); +//kprintf("SENT\n"); +return(length); +} + +intNICtoPC(structdevice*dev,void*packet,intlength,intnic_addr){ +inti=0x0; +uInt16*packet16=(uInt16*)packet; + +assert(length); + +if(length&0x01) +length++; + +outportByte(dev->ioAddr+EN0_RCNTLO,(length&0xFF)); +outportByte(dev->ioAddr+EN0_RCNTHI,(length>>8)); -outportByte(dev->ioAddr+EN0_RCNTLO,(length&0xFF)); -outportByte(dev->ioAddr+EN0_RCNTHI,(length>>8)); +outportByte(dev->ioAddr+EN0_RSARLO,nic_addr&0xFF); +outportByte(dev->ioAddr+EN0_RSARHI,nic_addr>>8); -outportByte(dev->ioAddr+EN0_RSARLO,nic_addr&0xFF); -outportByte(dev->ioAddr+EN0_RSARHI,nic_addr>>8); - -outportByte(dev->ioAddr,0x0A); - -for(i=0;i<length/2;i++){ -packet16[i]=inportWord(dev->ioAddr+NE_DATAPORT); -} - -outportByte(dev->ioAddr+EN0_ISR,0x40); -return(length); -} - -voidne2kHandler(){ -uInt16isr=0x0; -uInt16status=0x0; - -irqDisable(10); -outportByte(mPic,eoi); -outportByte(sPic,eoi); - -asm("sti"); - -isr=inportByte(mDev->ioAddr+NE_ISR); - -if((isr&0x02)==0x02){ -outportByte(mDev->ioAddr+NE_ISR,0x0A); -status=inportByte(0x280+NE_TPSR); -} -if((isr&0x01)==0x01){ -if(dp_recv(mDev)){ -kprintf("ErrorGettingPacket\n"); -} -outportByte(mDev->ioAddr+NE_ISR,0x05); -} - -outportByte(mDev->ioAddr+NE_IMR,0x0); -outportByte(mDev->ioAddr+NE_IMR,0x0B); - -asm("cli"); -irqEnable(10); +outportByte(dev->ioAddr,0x0A); + +for(i=0;i<length/2;i++){ +packet16[i]=inportWord(dev->ioAddr+NE_DATAPORT); +} + +outportByte(dev->ioAddr+EN0_ISR,0x40); +return(length); +} + +voidne2kHandler(){ +uInt16isr=0x0; +uInt16status=0x0; + +irqDisable(10); +outportByte(mPic,eoi); +outportByte(sPic,eoi); + +asm("sti"); + +isr=inportByte(mDev->ioAddr+NE_ISR); + +if((isr&0x02)==0x02){ +outportByte(mDev->ioAddr+NE_ISR,0x0A); +status=inportByte(0x280+NE_TPSR); +} +if((isr&0x01)==0x01){ +if(dp_recv(mDev)){ +kprintf("ErrorGettingPacket\n"); +} +outportByte(mDev->ioAddr+NE_ISR,0x05); +} + +outportByte(mDev->ioAddr+NE_IMR,0x0); +outportByte(mDev->ioAddr+NE_IMR,0x0B); + +asm("cli"); +irqEnable(10); + +return; +} -return; -} - -staticintdp_recv(structdevice*dev){ -dp_rcvhdr_theader; -unsignedintpageno=0x0,curr=0x0,next=0x0; -intpacket_processed=0x0,r=0x0; -uInt16eth_type=0x0; - -uInt32length=0x0; - -pageno=inportByte(dev->ioAddr+NE_BNRY)+1; -if(pageno==stopPage)pageno=startPage; - -do{ -outportByte(dev->ioAddr+NE_CMD,0x40); -curr=inportByte(dev->ioAddr+NE_CURRENT); -outportByte(dev->ioAddr,0x0); -if(curr==pageno)break; -getblock(dev,pageno,(size_t)0,sizeof(header),&header); -getblock(dev,pageno,sizeof(header)+2*sizeof(ether_addr_t),sizeof(eth_type),&eth_type); - -length=(header.dr_rbcl|(header.dr_rbch<<8))-sizeof(dp_rcvhdr_t); -next=header.dr_next; - -//kprintf("length:[0x%X:0x%X:0x%X]\n",header.dr_next,header.dr_status,length); - -if(length<60||length>1514){ -kprintf("dp8390:packetwithstrangelengtharrived:%d\n",length); -next=curr; -} -elseif(next<startPage||next>=stopPage){ -kprintf("dp8390:strangenextpage\n"); -next=curr; -} -elseif(header.dr_status&RSR_FO){ -kpanic("dp8390:fifooverrun,resettingreceivebuffer\n"); -next=curr; -} -elseif(header.dr_status&RSR_PRX){ -r=dp_pkt2user(dev,pageno,length); -if(r!=OK){ -kprintf("FRUIT"); -return(0x0); -} - -packet_processed=0x1; -} -if(next==startPage) -outportByte(dev->ioAddr+NE_BNRY,stopPage-1); -else -outportByte(dev->ioAddr+NE_BNRY,next-1); - -pageno=next; - -}while(packet_processed==0x0); -return(0x0); -} - -staticvoidgetblock(structdevice*dev,intpage,size_toffset,size_tsize,void*dst){ -uInt16*ha=0x0; -inti=0x0; - -ha=(uInt16*)dst; -offset=page*DP_PAGESIZE+offset; -outportByte(dev->ioAddr+NE_RBCR0,size&0xFF); -outportByte(dev->ioAddr+NE_RBCR1,size>>8); -outportByte(dev->ioAddr+EN0_RSARLO,offset&0xFF); -outportByte(dev->ioAddr+EN0_RSARHI,offset>>8); -outportByte(dev->ioAddr+NE_CMD,E8390_RREAD|E8390_START); - -size/=2; -for(i=0;i<size;i++) -ha[i]=inportWord(dev->ioAddr+NE_DATAPORT); -outportByte(dev->ioAddr+EN0_ISR,0x40); -} - -staticintdp_pkt2user(structdevice*dev,intpage,intlength){ -intlast=0x0; -structnicBuffer*tmpBuf=0x0; - -last=page+(length-1)/DP_PAGESIZE; +staticintdp_recv(structdevice*dev){ +dp_rcvhdr_theader; +unsignedintpageno=0x0,curr=0x0,next=0x0; +intpacket_processed=0x0,r=0x0; +uInt16eth_type=0x0; + +uInt32length=0x0; + +pageno=inportByte(dev->ioAddr+NE_BNRY)+1; +if(pageno==stopPage) +pageno=startPage; + +do{ +outportByte(dev->ioAddr+NE_CMD,0x40); +curr=inportByte(dev->ioAddr+NE_CURRENT); +outportByte(dev->ioAddr,0x0); +if(curr==pageno) +break; +getblock(dev,pageno,(size_t)0,sizeof(header),&header); +getblock(dev,pageno,sizeof(header)+2*sizeof(ether_addr_t),sizeof(eth_type),&eth_type); + +length=(header.dr_rbcl|(header.dr_rbch<<8))-sizeof(dp_rcvhdr_t); +next=header.dr_next; + +//kprintf("length:[0x%X:0x%X:0x%X]\n",header.dr_next,header.dr_status,length); + +if(length<60||length>1514){ +kprintf("dp8390:packetwithstrangelengtharrived:%d\n",length); +next=curr; +} +elseif(next<startPage||next>=stopPage){ +kprintf("dp8390:strangenextpage\n"); +next=curr; +} +elseif(header.dr_status&RSR_FO){ +kpanic("dp8390:fifooverrun,resettingreceivebuffer\n"); +next=curr; +} +elseif(header.dr_status&RSR_PRX){ +r=dp_pkt2user(dev,pageno,length); +if(r!=OK){ +kprintf("FRUIT"); +return(0x0); +} + +packet_processed=0x1; +} +if(next==startPage) +outportByte(dev->ioAddr+NE_BNRY,stopPage-1); +else +outportByte(dev->ioAddr+NE_BNRY,next-1); + +pageno=next; + +}while(packet_processed==0x0); +return(0x0); +} + +staticvoidgetblock(structdevice*dev,intpage,size_toffset,size_tsize,void*dst){ +uInt16*ha=0x0; +inti=0x0; + +ha=(uInt16*)dst; +offset=page*DP_PAGESIZE+offset; +outportByte(dev->ioAddr+NE_RBCR0,size&0xFF); +outportByte(dev->ioAddr+NE_RBCR1,size>>8); +outportByte(dev->ioAddr+EN0_RSARLO,offset&0xFF); +outportByte(dev->ioAddr+EN0_RSARHI,offset>>8); +outportByte(dev->ioAddr+NE_CMD,E8390_RREAD|E8390_START); + +size/=2; +for(i=0;i<size;i++) +ha[i]=inportWord(dev->ioAddr+NE_DATAPORT); +outportByte(dev->ioAddr+EN0_ISR,0x40); +} + +staticintdp_pkt2user(structdevice*dev,intpage,intlength){ +intlast=0x0; + +structnicBuffer*tBuf=0x0; + +last=page+(length-1)/DP_PAGESIZE; -if(last>=stopPage){ -kprintf("FOOKSTOPPAGE!!!"); -} +if(last>=stopPage){ +kprintf("FOOKSTOPPAGE!!!"); +} else{ -tmpBuf=ne2kAllocBuffer(length); -NICtoPC(dev,tmpBuf->buffer,length,page*DP_PAGESIZE+sizeof(dp_rcvhdr_t)); -} -return(OK); -} - -structnicBuffer*ne2kAllocBuffer(intlength){ -structnicBuffer*tmpBuf=0x0; - -spinLock(&ne2k_spinLock); - -if(ne2kBuffer==0x0){ -ne2kBuffer=(structnicBuffer*)kmalloc(sizeof(structnicBuffer)); -ne2kBuffer->next=0x0; -ne2kBuffer->length=length; -ne2kBuffer->buffer=(char*)kmalloc(length); -spinUnlock(&ne2k_spinLock); -return(ne2kBuffer); -} +tBuf=ne2kAllocBuffer(length); +NICtoPC(dev,tBuf->buffer,length,page*DP_PAGESIZE+sizeof(dp_rcvhdr_t)); +} +return(OK); +} + +structnicBuffer*ne2kAllocBuffer(intlength){ +structnicBuffer*tmpBuf=0x0; + +spinLock(&ne2k_spinLock); + +if(ne2kBuffer==0x0){ +ne2kBuffer=(structnicBuffer*)kmalloc(sizeof(structnicBuffer)); +ne2kBuffer->next=0x0; +ne2kBuffer->length=length; +ne2kBuffer->buffer=(char*)kmalloc(length); +spinUnlock(&ne2k_spinLock); +return(ne2kBuffer); +} else{ -for(tmpBuf=ne2kBuffer;tmpBuf->next!=0x0;tmpBuf=tmpBuf->next); - -tmpBuf->next=(structnicBuffer*)kmalloc(sizeof(structnicBuffer)); -tmpBuf=tmpBuf->next; -tmpBuf->next=0x0; -tmpBuf->length=length; -tmpBuf->buffer=(char*)kmalloc(length); -spinUnlock(&ne2k_spinLock); -return(tmpBuf); -} -spinUnlock(&ne2k_spinLock); -return(0x0); -} - -structnicBuffer*ne2kGetBuffer(){ -structnicBuffer*tmpBuf=0x0; - -if(ne2k_spinLock==0x1) -return(0x0); - -tmpBuf=ne2kBuffer; -if(ne2kBuffer!=0x0) -ne2kBuffer=ne2kBuffer->next; -return(tmpBuf); -} - -voidne2kFreeBuffer(structnicBuffer*buf){ -kfree(buf->buffer); -kfree(buf); -return; -} - -/*** - -$Log: ne2k_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:12reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:02reddawg -nomessage - -Revision1.242004/09/2821:47:56reddawg -Fixeddeadlocknowsafetouseinbochs - -Revision1.232004/09/1622:35:28reddawg -DemoRelease - -Revision1.222004/09/1521:25:33reddawg -Fixens - -Revision1.212004/09/1119:15:37reddawg -hereyougoirq10io240foryourne2knic - -Revision1.202004/09/0722:26:04reddawg -syncedin - -Revision1.192004/09/0721:54:38reddawg -okrevertedbacktooldschedulingfornow.... - -Revision1.182004/09/0615:13:25reddawg -LastcommitbeforeFreeBSD6.0 - -Revision1.172004/08/0120:40:45reddawg -Netrelatedfixes - -Revision1.162004/07/2822:23:02reddawg -makesureitstillworksbeforeIgotobed - -Revision1.152004/07/1717:04:47reddawg -ne2k:addedasserthopefullyitwillhelpmesolvethisdmasize0randomerror - -Revision1.142004/07/1412:03:50reddawg -ne2k:ne2kInittone2k_init -ChangedStartupRoutines - -Revision1.132004/06/0410:19:42reddawg -notes:wecompileagain,thankg-danywaysiwasabouttocry - -Revision1.122004/05/2112:48:22reddawg -Cleanedup - -Revision1.112004/05/1904:07:42reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.102004/05/1002:23:24reddawg -MinorChangesToSourceCodeToPrepareItForOpenSourceRelease - -END -***/ - +for(tmpBuf=ne2kBuffer;tmpBuf->next!=0x0;tmpBuf=tmpBuf->next) +; + +tmpBuf->next=(structnicBuffer*)kmalloc(sizeof(structnicBuffer)); +tmpBuf=tmpBuf->next; +tmpBuf->next=0x0; +tmpBuf->length=length; +tmpBuf->buffer=(char*)kmalloc(length); +spinUnlock(&ne2k_spinLock); +return(tmpBuf); +} +spinUnlock(&ne2k_spinLock); +return(0x0); +} + +structnicBuffer*ne2kGetBuffer(){ +structnicBuffer*tmpBuf=0x0; + +if(ne2k_spinLock==0x1) +return(0x0); + +tmpBuf=ne2kBuffer; +if(ne2kBuffer!=0x0) +ne2kBuffer=ne2kBuffer->next; +return(tmpBuf); +} + +voidne2kFreeBuffer(structnicBuffer*buf){ +kfree(buf->buffer); +kfree(buf); +return; +} + +/*** + +$Log:ne2k.c,v$ +Revision1.1.1.12006/06/0112:46:12reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:02reddawg +nomessage + +Revision1.242004/09/2821:47:56reddawg +Fixeddeadlocknowsafetouseinbochs + +Revision1.232004/09/1622:35:28reddawg +DemoRelease + +Revision1.222004/09/1521:25:33reddawg +Fixens + +Revision1.212004/09/1119:15:37reddawg +hereyougoirq10io240foryourne2knic + +Revision1.202004/09/0722:26:04reddawg +syncedin + +Revision1.192004/09/0721:54:38reddawg +okrevertedbacktooldschedulingfornow.... + +Revision1.182004/09/0615:13:25reddawg +LastcommitbeforeFreeBSD6.0 + +Revision1.172004/08/0120:40:45reddawg +Netrelatedfixes + +Revision1.162004/07/2822:23:02reddawg +makesureitstillworksbeforeIgotobed + +Revision1.152004/07/1717:04:47reddawg +ne2k:addedasserthopefullyitwillhelpmesolvethisdmasize0randomerror + +Revision1.142004/07/1412:03:50reddawg +ne2k:ne2kInittone2k_init +ChangedStartupRoutines + +Revision1.132004/06/0410:19:42reddawg +notes:wecompileagain,thankg-danywaysiwasabouttocry + +Revision1.122004/05/2112:48:22reddawg +Cleanedup + +Revision1.112004/05/1904:07:42reddawg +kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen + +Revision1.102004/05/1002:23:24reddawg +MinorChangesToSourceCodeToPrepareItForOpenSourceRelease + +END +***/ + - + diff --git a/doc/xml/ne2k_8h.xml b/doc/xml/ne2k_8h.xml index e672b00..e5fa3dc 100644 --- a/doc/xml/ne2k_8h.xml +++ b/doc/xml/ne2k_8h.xml @@ -1,66 +1,103 @@ - - - + + + ne2k.h - ubixos/types.h + sys/types.h sys/device.old.h - src/sys/include/ubixos/init.h - src/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/ne2k.c - + - + - - - - + + + + - + + + + + + + - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + - - + + + + + + + + + + - - - - + + + + dp_rcvhdr etheraddr - nicBuffer - + DEF_ENABLED 0x200 @@ -69,153 +106,141 @@ - + - + DP_CNTR0 - 0xD + 0xD /* Tally Counter 0 */ - - ne2k_init + - + DP_CNTR1 - 0xE + 0xE /* Tally Counter 1 */ - - ne2k_init + - + DP_CNTR2 - 0xF + 0xF /* Tally Counter 2 */ - - ne2k_init + - + DP_CURR - 0x7 + 0x7 /* Current Page Register */ - - ne2k_init + - + DP_MAR0 - 0x8 + 0x8 /* Multicast Address Register 0 */ - - ne2k_init + - + DP_MAR1 - 0x9 + 0x9 /* Multicast Address Register 1 */ - - ne2k_init + - + DP_MAR2 - 0xA + 0xA /* Multicast Address Register 2 */ - - ne2k_init + - + DP_MAR3 - 0xB + 0xB /* Multicast Address Register 3 */ - - ne2k_init + - + DP_MAR4 - 0xC + 0xC /* Multicast Address Register 4 */ - - ne2k_init + - + DP_MAR5 - 0xD + 0xD /* Multicast Address Register 5 */ - - ne2k_init + - + DP_MAR6 - 0xE + 0xE /* Multicast Address Register 6 */ - - ne2k_init + - + DP_MAR7 - 0xF + 0xF /* Multicast Address Register 7 */ - - ne2k_init + - + DP_PAGESIZE 256 @@ -224,11 +249,9 @@ - - dp_pkt2user - getblock + - + E8390_CMD 0x00 @@ -237,9 +260,9 @@ - + - + E8390_NODMA 0x20 @@ -248,9 +271,9 @@ - + - + E8390_PAGE0 0x00 @@ -259,9 +282,9 @@ - + - + E8390_PAGE1 0x40 @@ -270,9 +293,9 @@ - + - + E8390_RREAD 0x08 @@ -281,10 +304,9 @@ - - getblock + - + E8390_RWRITE 0x10 @@ -293,10 +315,9 @@ - - PCtoNIC + - + E8390_RXCONFIG 0x04 @@ -305,9 +326,9 @@ - + - + E8390_RXOFF 0x20 @@ -316,9 +337,9 @@ - + - + E8390_START 0x02 @@ -327,11 +348,9 @@ - - getblock - PCtoNIC + - + E8390_STOP 0x01 @@ -340,9 +359,9 @@ - + - + E8390_TXCONFIG 0x00 @@ -351,9 +370,9 @@ - + - + E8390_TXOFF 0x00 @@ -362,9 +381,9 @@ - + - + EN0_BOUNDARY 0x03 @@ -373,9 +392,9 @@ - + - + EN0_COUNTER0 0x0d @@ -384,9 +403,9 @@ - + - + EN0_DCFG 0x0e @@ -395,9 +414,9 @@ - + - + EN0_IMR 0x0f @@ -406,9 +425,9 @@ - + - + EN0_ISR 0x07 @@ -417,12 +436,9 @@ - - getblock - NICtoPC - PCtoNIC + - + EN0_RCNTHI 0x0b @@ -431,11 +447,9 @@ - - NICtoPC - PCtoNIC + - + EN0_RCNTLO 0x0a @@ -444,11 +458,9 @@ - - NICtoPC - PCtoNIC + - + EN0_RSARHI 0x09 @@ -457,12 +469,9 @@ - - getblock - NICtoPC - PCtoNIC + - + EN0_RSARLO 0x08 @@ -471,12 +480,9 @@ - - getblock - NICtoPC - PCtoNIC + - + EN0_RXCR 0x0c @@ -485,9 +491,9 @@ - + - + EN0_STARTPG 0x01 @@ -496,9 +502,9 @@ - + - + EN0_STOPPG 0x02 @@ -507,9 +513,9 @@ - + - + EN0_TPSR 0x04 @@ -518,9 +524,9 @@ - + - + EN0_TXCR 0x0D @@ -529,9 +535,9 @@ - + - + EN1_CURPAG 0x07 @@ -540,9 +546,9 @@ - + - + EN1_MULT 0x08 @@ -551,9 +557,9 @@ - + - + EN1_PHYS 0x01 @@ -562,9 +568,9 @@ - + - + ENDCFG_WTS 0x01 @@ -573,9 +579,9 @@ - + - + ENISR_ALL 0x3f @@ -584,20 +590,20 @@ - + - + ether_addr - ether_addr_t + ether_addr_t - + - + NE1SM_START_PG 0x20 @@ -606,9 +612,9 @@ - + - + NE1SM_STOP_PG 0x40 @@ -617,9 +623,9 @@ - + - + NE_BNRY 0x03 @@ -628,11 +634,9 @@ - - dp_recv - ne2k_init + - + NE_CMD 0x00 @@ -641,12 +645,9 @@ - - dp_recv - getblock - ne2k_init + - + NE_CURRENT 0x07 @@ -655,10 +656,9 @@ - - dp_recv + - + NE_DATAPORT 0x10 @@ -667,12 +667,9 @@ - - getblock - NICtoPC - PCtoNIC + - + NE_DCR 0x0E @@ -681,10 +678,9 @@ - - ne2k_init + - + NE_DCR_AR 0x10 @@ -693,9 +689,9 @@ - + - + NE_DCR_FT0 0x20 @@ -704,9 +700,9 @@ - + - + NE_DCR_FT1 0x40 @@ -715,9 +711,9 @@ - + - + NE_DCR_LS 0x08 @@ -726,9 +722,9 @@ - + - + NE_DCR_WTS 0x01 @@ -737,9 +733,9 @@ - + - + NE_IMR 0x0F @@ -748,11 +744,9 @@ - - ne2k_init - ne2kHandler + - + NE_ISR 0x07 @@ -761,11 +755,9 @@ - - ne2k_init - ne2kHandler + - + NE_PSTART 0x01 @@ -774,10 +766,9 @@ - - ne2k_init + - + NE_PSTOP 0x02 @@ -786,10 +777,9 @@ - - ne2k_init + - + NE_RBCR0 0x0A @@ -798,11 +788,9 @@ - - getblock - ne2k_init + - + NE_RBCR1 0x0B @@ -811,11 +799,9 @@ - - getblock - ne2k_init + - + NE_RCR 0x0C @@ -824,10 +810,9 @@ - - ne2k_init + - + NE_TCR 0x0D @@ -836,10 +821,9 @@ - - ne2k_init + - + NE_TPSR 0x04 @@ -848,10 +832,9 @@ - - ne2kHandler + - + NESM_START_PG 0x40 @@ -860,9 +843,9 @@ - + - + NESM_STOP_PG 0x80 @@ -871,9 +854,9 @@ - + - + OK 0 @@ -882,11 +865,9 @@ - - dp_pkt2user - dp_recv + - + RSR_FO 0x08 @@ -895,10 +876,9 @@ - - dp_recv + - + RSR_PRX 0x01 @@ -907,10 +887,9 @@ - - dp_recv + - + startPage 0x4C @@ -919,11 +898,9 @@ - - dp_recv - ne2k_init + - + stopPage 0x80 @@ -932,12 +909,9 @@ - - dp_pkt2user - dp_recv - ne2k_init + - + TX_1X_PAGES 6 @@ -946,9 +920,9 @@ - + - + TX_2X_PAGES 12 @@ -957,23 +931,23 @@ - + - + TX_PAGES - (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES) + (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES) - + - - dp_rcvhdr + + struct dp_rcvhdr typedef struct dp_rcvhdr dp_rcvhdr_t dp_rcvhdr_t @@ -983,10 +957,10 @@ - + - - etheraddr + + union etheraddr typedef union etheraddr ether_addr_t ether_addr_t @@ -996,11 +970,39 @@ - + + + + + + char * + char* nicPacket + + nicPacket + + + + + + + + + + uInt32 + uInt32 packetLength + + packetLength + + + + + + + - + int int ne2k_init () @@ -1011,50 +1013,10 @@ - - dDpl0 - dInt - DP_CNTR0 - DP_CNTR1 - DP_CNTR2 - DP_CURR - DP_MAR0 - DP_MAR1 - DP_MAR2 - DP_MAR3 - DP_MAR4 - DP_MAR5 - DP_MAR6 - DP_MAR7 - dPresent - inportByte - device::ioAddr - device::irq - irqEnable - kmalloc - kprintf - mDev - mVec - ne2kISR - NE_BNRY - NE_CMD - NE_DCR - NE_IMR - NE_ISR - NE_PSTART - NE_PSTOP - NE_RBCR0 - NE_RBCR1 - NE_RCR - NE_TCR - outportByte - setVector - startPage - stopPage - x20 + - - nicBuffer * + + struct nicBuffer * struct nicBuffer* ne2kAllocBuffer (int) ne2kAllocBuffer @@ -1067,18 +1029,11 @@ - - nicBuffer::buffer - kmalloc - nicBuffer::length - ne2k_spinLock - ne2kBuffer - nicBuffer::next - spinLock - spinUnlock - dp_pkt2user + + spinLock + tmpBuf - + int int ne2kDevInit (struct device *) @@ -1092,9 +1047,9 @@ - + - + void void ne2kFreeBuffer (struct nicBuffer *) @@ -1108,12 +1063,11 @@ - - nicBuffer::buffer - kfree + + kfree - - nicBuffer * + + struct nicBuffer * struct nicBuffer* ne2kGetBuffer () ne2kGetBuffer @@ -1123,13 +1077,10 @@ - - ne2k_spinLock - ne2kBuffer - nicBuffer::next - x1 + + tmpBuf - + void void ne2kHandler () @@ -1140,24 +1091,9 @@ - - dp_recv - eoi - inportByte - device::ioAddr - irqDisable - irqEnable - kprintf - mDev - mPic - NE_IMR - NE_ISR - NE_TPSR - outportByte - sPic - status + - + void void ne2kISR () @@ -1168,10 +1104,9 @@ - - ne2k_init + - + int int ne2kProbe (int, struct device *) @@ -1188,9 +1123,9 @@ - + - + int int NICtoPC (struct device *dev, void *packet, int length, int nic_addr) @@ -1217,20 +1152,19 @@ - - assert - EN0_ISR - EN0_RCNTHI - EN0_RCNTLO - EN0_RSARHI - EN0_RSARLO - inportWord - device::ioAddr - NE_DATAPORT - outportByte - dp_pkt2user + + assert + EN0_ISR + EN0_RCNTHI + EN0_RCNTLO + EN0_RSARHI + EN0_RSARLO + inportWord + device::ioAddr + NE_DATAPORT + outportByte - + void void NS8390_init (struct device *dev, int startp) @@ -1249,9 +1183,9 @@ - + - + int int PCtoNIC (struct device *dev, void *packet, int length) @@ -1274,49 +1208,23 @@ - - assert - E8390_RWRITE - E8390_START - EN0_ISR - EN0_RCNTHI - EN0_RCNTLO - EN0_RSARHI - EN0_RSARLO - inportByte - device::ioAddr - kpanic - NE_DATAPORT - outportByte - outportWord - - - - - char * - char* nicPacket - - nicPacket - - - - - - - - - - uInt32 - uInt32 packetLength - - packetLength - - - - - - - + + assert + E8390_RWRITE + E8390_START + EN0_ISR + EN0_RCNTHI + EN0_RCNTLO + EN0_RSARHI + EN0_RSARLO + EN0_TPSR + inportByte + device::ioAddr + kpanic + NE_DATAPORT + outportByte + outportByteP + outportWord @@ -1324,207 +1232,197 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ne2k_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_NE2K_H -#define_NE2K_H - -#include<ubixos/types.h> -#include<sys/device.old.h> - -#defineether_addrether_addr_t -typedefstructdp_rcvhdr -{ -uInt8dr_status;/*Copyofrsr*/ -uInt8dr_next;/*Pointertonextpacket*/ -uInt8dr_rbcl;/*ReceiveByteCountLow*/ -uInt8dr_rbch;/*ReceiveByteCountHigh*/ -}dp_rcvhdr_t; - -typedefunionetheraddr{ -unsignedcharbytes[6];/*byteordersafeinitialization*/ -unsignedshortshorts[3];/*force2-bytealignment*/ -}ether_addr; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_ISA_NE2K_H +#define_ISA_NE2K_H + +#include<sys/types.h> +#include<sys/device.old.h> + +#defineether_addrether_addr_t +typedefstructdp_rcvhdr +{ +uInt8dr_status;/*Copyofrsr*/ +uInt8dr_next;/*Pointertonextpacket*/ +uInt8dr_rbcl;/*ReceiveByteCountLow*/ +uInt8dr_rbch;/*ReceiveByteCountHigh*/ +}dp_rcvhdr_t; + +typedefunionetheraddr{ +unsignedcharbytes[6];/*byteordersafeinitialization*/ +unsignedshortshorts[3];/*force2-bytealignment*/ +}ether_addr; + - -structnicBuffer{ -structnicBuffer*next; -intlength; -char*buffer; -}; +#defineRSR_FO0x08 +#defineRSR_PRX0x01 +#defineDEF_ENABLED0x200 + +#defineOK0 + -#defineRSR_FO0x08 -#defineRSR_PRX0x01 -#defineDEF_ENABLED0x200 - -#defineOK0 - - -#definestartPage0x4C -#definestopPage0x80 - - -#defineNE_CMD0x00 -#defineNE_PSTART0x01 -#defineNE_PSTOP0x02 -#defineNE_BNRY0x03 -#defineNE_TPSR0x04 -#defineNE_ISR0x07 -#defineNE_CURRENT0x07 -#defineNE_RBCR00x0A -#defineNE_RBCR10x0B -#defineNE_RCR0x0C -#defineNE_TCR0x0D -#defineNE_DCR0x0E -#defineNE_IMR0x0F - +#definestartPage0x4C +#definestopPage0x80 + + +#defineNE_CMD0x00 +#defineNE_PSTART0x01 +#defineNE_PSTOP0x02 +#defineNE_BNRY0x03 +#defineNE_TPSR0x04 +#defineNE_ISR0x07 +#defineNE_CURRENT0x07 +#defineNE_RBCR00x0A +#defineNE_RBCR10x0B +#defineNE_RCR0x0C +#defineNE_TCR0x0D +#defineNE_DCR0x0E +#defineNE_IMR0x0F + + +#defineNE_DCR_WTS0x01 +#defineNE_DCR_LS0x08 +#defineNE_DCR_AR0x10 +#defineNE_DCR_FT10x40 +#defineNE_DCR_FT00x20 + -#defineNE_DCR_WTS0x01 -#defineNE_DCR_LS0x08 -#defineNE_DCR_AR0x10 -#defineNE_DCR_FT10x40 -#defineNE_DCR_FT00x20 - - - -#defineE8390_STOP0x01 -#defineE8390_NODMA0x20 -#defineE8390_PAGE00x00 -#defineE8390_PAGE10x40 -#defineE8390_CMD0x00 -#defineE8390_START0x02 -#defineE8390_RREAD0x08 -#defineE8390_RWRITE0x10 -#defineE8390_RXOFF0x20 -#defineE8390_TXOFF0x00 -#defineE8390_RXCONFIG0x04 -#defineE8390_TXCONFIG0x00 - -#defineEN0_COUNTER00x0d -#defineEN0_DCFG0x0e -#defineEN0_RCNTLO0x0a -#defineEN0_RCNTHI0x0b -#defineEN0_ISR0x07 -#defineEN0_IMR0x0f -#defineEN0_RSARLO0x08 -#defineEN0_RSARHI0x09 -#defineEN0_TPSR0x04 -#defineEN0_RXCR0x0c -#defineEN0_TXCR0x0D -#defineEN0_STARTPG0x01 -#defineEN0_STOPPG0x02 -#defineEN0_BOUNDARY0x03 - -#defineEN1_PHYS0x01 -#defineEN1_CURPAG0x07 -#defineEN1_MULT0x08 - -#defineNE1SM_START_PG0x20 -#defineNE1SM_STOP_PG0x40 -#defineNESM_START_PG0x40 -#defineNESM_STOP_PG0x80 - -#defineENISR_ALL0x3f - -#defineENDCFG_WTS0x01 - -#defineNE_DATAPORT0x10 - -#defineTX_2X_PAGES12 -#defineTX_1X_PAGES6 -#defineTX_PAGES(dev->priv->pingPong?TX_2X_PAGES:TX_1X_PAGES) - - -#defineDP_CURR0x7/*CurrentPageRegister*/ -#defineDP_MAR00x8/*MulticastAddressRegister0*/ -#defineDP_MAR10x9/*MulticastAddressRegister1*/ -#defineDP_MAR20xA/*MulticastAddressRegister2*/ -#defineDP_MAR30xB/*MulticastAddressRegister3*/ -#defineDP_MAR40xC/*MulticastAddressRegister4*/ -#defineDP_MAR50xD/*MulticastAddressRegister5*/ -#defineDP_MAR60xE/*MulticastAddressRegister6*/ -#defineDP_MAR70xF/*MulticastAddressRegister7*/ + +#defineE8390_STOP0x01 +#defineE8390_NODMA0x20 +#defineE8390_PAGE00x00 +#defineE8390_PAGE10x40 +#defineE8390_CMD0x00 +#defineE8390_START0x02 +#defineE8390_RREAD0x08 +#defineE8390_RWRITE0x10 +#defineE8390_RXOFF0x20 +#defineE8390_TXOFF0x00 +#defineE8390_RXCONFIG0x04 +#defineE8390_TXCONFIG0x00 + +#defineEN0_COUNTER00x0d +#defineEN0_DCFG0x0e +#defineEN0_RCNTLO0x0a +#defineEN0_RCNTHI0x0b +#defineEN0_ISR0x07 +#defineEN0_IMR0x0f +#defineEN0_RSARLO0x08 +#defineEN0_RSARHI0x09 +#defineEN0_TPSR0x04 +#defineEN0_RXCR0x0c +#defineEN0_TXCR0x0D +#defineEN0_STARTPG0x01 +#defineEN0_STOPPG0x02 +#defineEN0_BOUNDARY0x03 + +#defineEN1_PHYS0x01 +#defineEN1_CURPAG0x07 +#defineEN1_MULT0x08 + +#defineNE1SM_START_PG0x20 +#defineNE1SM_STOP_PG0x40 +#defineNESM_START_PG0x40 +#defineNESM_STOP_PG0x80 + +#defineENISR_ALL0x3f + +#defineENDCFG_WTS0x01 + +#defineNE_DATAPORT0x10 + +#defineTX_2X_PAGES12 +#defineTX_1X_PAGES6 +#defineTX_PAGES(dev->priv->pingPong?TX_2X_PAGES:TX_1X_PAGES) + + +#defineDP_CURR0x7/*CurrentPageRegister*/ +#defineDP_MAR00x8/*MulticastAddressRegister0*/ +#defineDP_MAR10x9/*MulticastAddressRegister1*/ +#defineDP_MAR20xA/*MulticastAddressRegister2*/ +#defineDP_MAR30xB/*MulticastAddressRegister3*/ +#defineDP_MAR40xC/*MulticastAddressRegister4*/ +#defineDP_MAR50xD/*MulticastAddressRegister5*/ +#defineDP_MAR60xE/*MulticastAddressRegister6*/ +#defineDP_MAR70xF/*MulticastAddressRegister7*/ + +#defineDP_CNTR00xD/*TallyCounter0*/ +#defineDP_CNTR10xE/*TallyCounter1*/ +#defineDP_CNTR20xF/*TallyCounter2*/ + + +#defineDP_PAGESIZE256 -#defineDP_CNTR00xD/*TallyCounter0*/ -#defineDP_CNTR10xE/*TallyCounter1*/ -#defineDP_CNTR20xF/*TallyCounter2*/ +externchar*nicPacket; +externuInt32packetLength; + - -#defineDP_PAGESIZE256 - -externchar*nicPacket; -externuInt32packetLength; - - -intne2k_init(); -intne2kProbe(int,structdevice*); -intne2kDevInit(structdevice*); -voidNS8390_init(structdevice*dev,intstartp); - -voidne2kISR(); -voidne2kHandler(); +intne2k_init(); +intne2kProbe(int,structdevice*); +intne2kDevInit(structdevice*); +voidNS8390_init(structdevice*dev,intstartp); + +voidne2kISR(); +voidne2kHandler(); + +intNICtoPC(structdevice*dev,void*packet,intlength,intnic_addr); +intPCtoNIC(structdevice*dev,void*packet,intlength); + +structnicBuffer*ne2kAllocBuffer(int); +structnicBuffer*ne2kGetBuffer(); +voidne2kFreeBuffer(structnicBuffer*); -intNICtoPC(structdevice*dev,void*packet,intlength,intnic_addr); -intPCtoNIC(structdevice*dev,void*packet,intlength); - -structnicBuffer*ne2kAllocBuffer(int); -structnicBuffer*ne2kGetBuffer(); -voidne2kFreeBuffer(structnicBuffer*); - -#endif - -/*** -$Log: ne2k_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed +#endif + +/*** +$Log:ne2k.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:39reddawg +nomessage + +Revision1.62004/07/1412:03:49reddawg +ne2k:ne2kInittone2k_init +ChangedStartupRoutines -Revision1.1.1.12005/09/2617:23:39reddawg -nomessage +Revision1.52004/05/2114:57:16reddawg +Cleanedup -Revision1.62004/07/1412:03:49reddawg -ne2k:ne2kInittone2k_init -ChangedStartupRoutines - -Revision1.52004/05/2114:57:16reddawg -Cleanedup - - -END -***/ + +END +***/ - + diff --git a/doc/xml/net_2arch_2init_8h.xml b/doc/xml/net_2arch_2init_8h.xml index 890609f..88f846a 100644 --- a/doc/xml/net_2arch_2init_8h.xml +++ b/doc/xml/net_2arch_2init_8h.xml @@ -1,19 +1,19 @@ - - - + + + init.h - + TCPIP_INIT_DONE arg - sys_sem_signal(*(sys_sem_t *)arg) + sys_sem_signal(*(sys_sem_t *)arg) - + @@ -21,51 +21,13 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: net_2arch_2init_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__ARCH_INIT_H__ -#define__ARCH_INIT_H__ - -#defineTCPIP_INIT_DONE(arg)sys_sem_signal(*(sys_sem_t*)arg) - -#endif/*__ARCH_INIT_H__*/ - - - - +#ifndef__ARCH_INIT_H__ +#define__ARCH_INIT_H__ + +#defineTCPIP_INIT_DONE(arg)sys_sem_signal(*(sys_sem_t*)arg) + +#endif - + diff --git a/doc/xml/net_8c.xml b/doc/xml/net_8c.xml index e632400..eb93d91 100644 --- a/doc/xml/net_8c.xml +++ b/doc/xml/net_8c.xml @@ -1,53 +1,227 @@ - - - + + + net.c - ubixos/types.h - net/sockets.h + sys/types.h + net/inet.h + net/sockets.h string.h lib/kprintf.h - - - - - - - - - - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + _IN_ADDR_T_DECLARED + + + + + + + + + - - uInt32 + + uInt32 typedef uInt32 in_addr_t in_addr_t @@ -57,117 +231,7 @@ - - - - - - void - void bcopy - (const void *src, void *dest, int len) - bcopy - - const void * - src - - - void * - dest - - - int - len - - - - - - - - - memcpy - - - void - void bzero - (void *data, int n) - bzero - - void * - data - - - int - n - - - - - - - - - memset - - - uInt32 - uInt32 htonl - (uInt32 n) - htonl - - uInt32 - n - - - - - - - - - inet_aton - - - uInt32 - uInt32 htons - (uInt32 n) - htons - - uInt32 - n - - - - - - - - - - - int - int inet_aton - (char *cp, struct in_addr *addr) const - inet_aton - - char * - cp - - - struct in_addr * - addr - - - - - - - - - htonl - kprintf - NULL - strtol + @@ -175,224 +239,172 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Log: net_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:12reddawg -nomessage - -Revision1.62004/07/2110:02:09reddawg -devfs:renamedfunctions -devicesystem:renamedfunctions -fdc:fixedafewpotentialbugsandcleanedupsomeunusedvariables -strol:fixeddefinition -endtask:madeitprintoutfreepagedebuginfo -kmalloc:fixedahugememoryleakwehadsomeunhandleddescriptorinsertionsosomedescriptorswerelost -ld:fixedapointerconversion -file:cleanedupafewunusedvariables -sched:broketaskdeletion -kprintf:fixedogPrintfdefinition - -Revision1.52004/06/2823:12:58reddawg -fileformatnowcontainer:/path/to/file - -Revision1.42004/06/1703:14:59flameshadow -chg:addedmissing#includeforkprintf() - -Revision1.32004/05/2022:54:02reddawg -CleanedUpWarrnings - -Revision1.22004/04/3014:16:04reddawg -FixedallthedatatypestobeconsistantuInt8,uInt16,uInt32,Int8,Int16,Int32 - -Revision1.1.1.12004/04/1512:07:10reddawg -UbixOSv1.0 - -Revision1.82004/04/1321:29:52reddawg -Wenowhavesocketsworking.Lotsoffunctionalitytobeaddedtocontinually -improveontheexistinglayersnowitscleanuptimetogetthingsinabetter -workingorder. - -Revision1.72004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - - - -$Id: net_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<net/sockets.h> -#include<string.h> - -#include"lib/kprintf.h" - -#ifndef_IN_ADDR_T_DECLARED -typedefuInt32in_addr_t; -#define_IN_ADDR_T_DECLARED -#endif - -uInt32htonl(uInt32n){ -uInt32retVal=0x0; -retVal+=((n&0xff)<<24); -retVal+=((n&0xff00)<<8); -retVal+=((n&0xff0000)>>8); -retVal+=((n&0xff000000)>>24); -return(retVal); -} - -uInt32htons(uInt32n){ -uInt32retVal=0x0; -retVal=(((n&0xff)<<8)|((n&0xff00)>>8)); -return(retVal); -} - -voidbcopy(constvoid*src,void*dest,intlen){ -memcpy(dest,src,len); -} - -voidbzero(void*data,intn){ -memset(data,0,n); -} - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/types.h> +#include<net/inet.h> +#include<net/sockets.h> +#include<string.h> + +#include"lib/kprintf.h" + +#ifndef_IN_ADDR_T_DECLARED +typedefuInt32in_addr_t; +#define_IN_ADDR_T_DECLARED +#endif + +/* +uInt32htonl(uInt32n){ +uInt32retVal=0x0; +retVal+=((n&0xff)<<24); +retVal+=((n&0xff00)<<8); +retVal+=((n&0xff0000)>>8); +retVal+=((n&0xff000000)>>24); +return(retVal); +} +*/ + +/* +uInt32htons(uInt32n){ +uInt32retVal=0x0; +retVal=(((n&0xff)<<8)|((n&0xff00)>>8)); +return(retVal); +} +*/ + + +#ifdef_INET_ATON +intinet_aton(cp,addr) +constchar*cp; +structin_addr*addr; +{ +uInt32parts[4]; +in_addr_tval; +char*c; +char*endptr; +intgotend,n; + +c=(char*)cp; +n=0; +/* +*Runthroughthestring,grabbingnumbersuntil +*theendofthestring,orsomeerror +*/ +gotend=0; +while(!gotend){ +//errno=0; +val=strtol(c,&endptr,0); +kprintf("VAL:[%x]",val); + +//if(errno==ERANGE)/*Failcompletelyifitoverflowed.*/ +//return(0); + +/* +*Ifthewholestringisinvalid,endptrwillequal +*c..thiswaywecanmakesuresomeonehasn't +*gone'.12'orsomethingwhichwouldgetpast +*thenextcheck. +*/ +if(endptr==c) +return(0); +parts[n]=val; +c=endptr; + +/*Checkthenextcharacterpastthepreviousnumber'send*/ +switch(*c){ +case'.': +/*Makesureweonlydo3dots..*/ +if(n==3)/*Whoops.Quit.*/ +return(0); +n++; +c++; +break; + +case'\0': +gotend=1; +break; -intinet_aton(cp,addr) -constchar*cp; -structin_addr*addr; -{ -uInt32parts[4]; -in_addr_tval; -char*c; -char*endptr; -intgotend,n; +default: +/* +if(isspace((unsignedchar)*c)){ +gotend=1; +break; +}else +*/ +return(0);/*Invalidcharacter,sofail*/ +} -c=(char*)cp; -n=0; -/* -*Runthroughthestring,grabbingnumbersuntil -*theendofthestring,orsomeerror -*/ -gotend=0; -while(!gotend){ -//errno=0; -val=strtol(c,&endptr,0); -kprintf("VAL:[%x]",val); - -//if(errno==ERANGE)/*Failcompletelyifitoverflowed.*/ -//return(0); - -/* -*Ifthewholestringisinvalid,endptrwillequal -*c..thiswaywecanmakesuresomeonehasn't -*gone'.12'orsomethingwhichwouldgetpast -*thenextcheck. -*/ -if(endptr==c) -return(0); -parts[n]=val; -c=endptr; +} + +/* +*Concocttheaddressaccordingto +*thenumberofpartsspecified. +*/ + +switch(n){ +case0:/*a--32bits*/ +/* +*Nothingisnecessaryhere.Overflowcheckingwas +*alreadydoneinstrtoul(). +*/ +break; +case1:/*a.b--8.24bits*/ +if(val>0xffffff||parts[0]>0xff) +return(0); +val|=parts[0]<<24; +break; + +case2:/*a.b.c--8.8.16bits*/ +if(val>0xffff||parts[0]>0xff||parts[1]>0xff) +return(0); +val|=(parts[0]<<24)|(parts[1]<<16); +break; -/*Checkthenextcharacterpastthepreviousnumber'send*/ -switch(*c){ -case'.': -/*Makesureweonlydo3dots..*/ -if(n==3)/*Whoops.Quit.*/ -return(0); -n++; -c++; -break; - -case'\0': -gotend=1; -break; +case3:/*a.b.c.d--8.8.8.8bits*/ +if(val>0xff||parts[0]>0xff||parts[1]>0xff|| +parts[2]>0xff) +return(0); +val|=(parts[0]<<24)|(parts[1]<<16)|(parts[2]<<8); +break; +} + +if(addr!=NULL) +addr->s_addr=htonl(val); +return(1); +} +#endif -default: -/* -if(isspace((unsignedchar)*c)){ -gotend=1; -break; -}else -*/ -return(0);/*Invalidcharacter,sofail*/ -} - -} - -/* -*Concocttheaddressaccordingto -*thenumberofpartsspecified. -*/ - -switch(n){ -case0:/*a--32bits*/ -/* -*Nothingisnecessaryhere.Overflowcheckingwas -*alreadydoneinstrtoul(). -*/ -break; -case1:/*a.b--8.24bits*/ -if(val>0xffffff||parts[0]>0xff) -return(0); -val|=parts[0]<<24; -break; - -case2:/*a.b.c--8.8.16bits*/ -if(val>0xffff||parts[0]>0xff||parts[1]>0xff) -return(0); -val|=(parts[0]<<24)|(parts[1]<<16); -break; - -case3:/*a.b.c.d--8.8.8.8bits*/ -if(val>0xff||parts[0]>0xff||parts[1]>0xff|| -parts[2]>0xff) -return(0); -val|=(parts[0]<<24)|(parts[1]<<16)|(parts[2]<<8); -break; -} - -if(addr!=NULL) -addr->s_addr=htonl(val); -return(1); -} - -/*** -END -***/ - +/*** +END +***/ + - + diff --git a/doc/xml/net_8h.xml b/doc/xml/net_8h.xml index 56ab109..65f706a 100644 --- a/doc/xml/net_8h.xml +++ b/doc/xml/net_8h.xml @@ -1,47 +1,565 @@ - - - + + + net.h - ubixos/types.h - src/sys/include/ubixos/init.h + sys/types.h + net/netif.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/vfs/vfs.h + C:/Dev/git/UbixOS/sys/pci/lnc.c - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + - - + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + struct netif + struct netif lnc_netif + + lnc_netif + + + + + + + + lnc_thread + net_init + + - + int int net_init () @@ -52,13 +570,19 @@ - - mem_init - memp_init - netMainThread - pbuf_init - sys_init - sys_thread_new + + ethernetif_init + lnc_netif + lnc_thread + netif_add + netif_set_default + netif_set_link_up + netif_set_up + NULL + shell_thread + sys_thread_new + tcpip_init + tcpip_input @@ -85,24 +609,22 @@ OFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: net_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:net.h792016-01-1116:21:27Zreddawg$ **************************************************************************************/ -#ifndef_NET_H -#define_NET_H - -#include<ubixos/types.h> - -intnet_init(); - -#endif - -/*** -END -***/ - +#ifndef_NET_H +#define_NET_H + +#include<sys/types.h> +#include<net/netif.h> + +externstructnetiflnc_netif; + +intnet_init(); + +#endif - + diff --git a/doc/xml/netif_8h.xml b/doc/xml/netif_8h.xml index c88d404..032e7e1 100644 --- a/doc/xml/netif_8h.xml +++ b/doc/xml/netif_8h.xml @@ -1,351 +1,1353 @@ - - - + + + netif.h - net/opt.h - net/err.h - net/ipv4/ip_addr.h - net/ipv4/inet.h - net/pbuf.h - src/sys/include/net/ipv4/icmp.h - src/sys/include/net/ipv4/ip.h - src/sys/include/netif/arp.h - src/sys/include/netif/ethernetif.h - src/sys/include/netif/loopif.h + net/opt.h + net/err.h + net/ip_addr.h + net/def.h + net/pbuf.h + net/stats.h + C:/Dev/git/UbixOS/sys/include/net/icmp.h + C:/Dev/git/UbixOS/sys/include/net/icmp6.h + C:/Dev/git/UbixOS/sys/include/net/igmp.h + C:/Dev/git/UbixOS/sys/include/net/ip.h + C:/Dev/git/UbixOS/sys/include/net/ip4_frag.h + C:/Dev/git/UbixOS/sys/include/net/ip6_frag.h + C:/Dev/git/UbixOS/sys/include/net/net.h + C:/Dev/git/UbixOS/sys/include/net/tcpip.h + C:/Dev/git/UbixOS/sys/include/netif/ethernet.h + C:/Dev/git/UbixOS/sys/include/netif/slipif.h + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/pci/lnc.c - - - - + + + + + + + + + + + + + + + + - - - - - - - + - - - - - - - - + + + + + + - - - - - - - - + + + + - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - - - + + + + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - + + + + - + - + - - - - - - - - - + - - - + + + - - - - - - - - - - - - - + + + - - - + + + - - - - - - - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - - + + + - - - + + + - - - + + + - - - - - + + + - - - + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + netif + nicBuffer + + + ENABLE_LOOPBACK + (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) + + + + + + + + + + IF__NETIF_CHECKSUM_ENABLED + netif + chksumflag + + + + + + + + + + NETIF_FLAG_BROADCAST + 0x02U + + + +If set, the netif has broadcast capability. Set by the netif driver in its init function. + + + + + + + NETIF_FLAG_ETHARP + 0x08U + + + +If set, the netif is an ethernet device using ARP. Set by the netif driver in its init function. Used to check input packet types and use of DHCP. + + + + + + + NETIF_FLAG_ETHERNET + 0x10U + + + +If set, the netif is an ethernet device. It might not use ARP or TCP/IP if it is used for PPPoE only. + + + + + + + NETIF_FLAG_IGMP + 0x20U + + + +If set, the netif has IGMP capability. Set by the netif driver in its init function. + + + + + + + NETIF_FLAG_LINK_UP + 0x04U + + + +If set, the interface has an active link (set by the network interface driver). Either set by the netif driver in its init function (if the link is up at that time) or at a later point once the link comes up (if link detection is supported by the hardware). + + + + + + + NETIF_FLAG_MLD6 + 0x40U + + + +If set, the netif has MLD6 capability. Set by the netif driver in its init function. + + + + + + + NETIF_FLAG_UP + 0x01U + + + +Whether the network interface is 'up'. This is a software flag used to control whether this network interface is enabled and processes traffic. It must be set by the startup code before this netif can be used (also for dhcp/autoip). + + + + + + + netif_is_link_up + netif + (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) + + + +Ask if a link is up + + + + + + + netif_is_up + netif + (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) + + + +Ask if an interface is up + + + + + + + NETIF_MAX_HWADDR_LEN + 6U + + + +Must be the maximum of all used hardware address lengths across all types of interfaces in use. This does not have to be changed, normally. + + + + + + + NETIF_SET_CHECKSUM_CTRL + netif + chksumflags + + + + + + + + + + NETIF_SET_HWADDRHINT + netif + hint + + + + + + + + + + + + + lwip_internal_netif_client_data_index + + LWIP_NETIF_CLIENT_DATA_INDEX_MAX + + + + + + + + + + + + + + + + netif_mac_filter_action + + NETIF_DEL_MAC_FILTER + = 0 + + + +Delete a filter entry + + + + NETIF_ADD_MAC_FILTER + = 1 + + + +Add a filter entry + + + + + +MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function. + + + + + + + + + err_t(* + typedef err_t(* netif_init_fn) (struct netif *netif) + )(struct netif *netif) + netif_init_fn + + + +Function prototype for netif init functions. Set up flags and output/linkoutput callback functions in this function. + + +netif + + +The netif to initialize + + + + + + + + + + + err_t(* + typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp) + )(struct pbuf *p, struct netif *inp) + netif_input_fn + + + +Function prototype for netif->input functions. This function is saved as 'input' callback function in the netif struct. Call it when a packet has been received. + + +p + + +The received packet, copied into a pbuf + + + + +inp + + +The netif which received the packet + + + + + + + + + + + err_t(* + typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p) + )(struct netif *netif, struct pbuf *p) + netif_linkoutput_fn + + + +Function prototype for netif->linkoutput functions. Only used for ethernet netifs. This function is called by ARP when a packet shall be sent. + + +netif + + +The netif which shall send a packet + + + + +p + + +The packet to send (raw ethernet packet) + + + + + + + + + + + void(* + typedef void(* netif_status_callback_fn) (struct netif *netif) + )(struct netif *netif) + netif_status_callback_fn + + + +Function prototype for netif status- or link-callback functions. + + + + + + + + + struct netif * + struct netif* netif_default + + netif_default + + + +The default network interface. + + + + + netif_remove + netif_set_default + + + struct netif * + struct netif* netif_list + + netif_list + + + +The list of network interfaces. + + + + + netif_find + netif_remove + + + struct nicBuffer * + struct nicBuffer* tmpBuf + + tmpBuf + + + + + + + + lnc_rxINT + lnc_thread + ne2kAllocBuffer + ne2kGetBuffer + + - - netif * + + void + void ethernetif_input + (struct netif *) + ethernetif_input + + struct netif * + netif + + + + +This function should be called when a packet is ready to be read from the interface. It uses the function low_level_input() that should handle the actual reception of bytes from the network interface. Then the type of the received packet is determined and the appropriate input function is called. + + +netif + + +the lwip network interface structure for this ethernetif + + + + + + + + + netif::state + lnc_thread + + + struct netif * struct netif* netif_add - (struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw, void(*init)(struct netif *netif), err_t(*input)(struct pbuf *p, struct netif *netif)) + (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input) netif_add - struct ip_addr * - ipaddr + struct netif * + netif - struct ip_addr * - netmask + void * + state - struct ip_addr * - gw - - - void(*)(struct netif *netif) + netif_init_fn init - err_t(*)(struct pbuf *p, struct netif *netif) + netif_input_fn input +Add a network interface to the list of lwIP netifs. + + +netif + + +a pre-allocated netif structure + + + + +ipaddr + + +IP address for the new netif + + + + +netmask + + +network mask for the new netif + + + + +gw + + +default gateway IP address for the new netif + + + + +state + + +opaque data passed to the new netif + + + + +init + + +callback function that initializes the interface + + + + +input + + +callback function that is called to pass ingress packets up in the protocol layer stack. +It is recommended to use a function that passes the input directly to the stack (netif_input(), NO_SYS=1 mode) or via sending a message to TCPIP thread (tcpip_input(), NO_SYS=0 mode). +These functions use netif flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET to decide whether to forward to ethernet_input() or ip_input(). In other words, the functions only work when the netif driver is implemented correctly! +Most members of struct netif should be be initialized by the netif init function = netif driver (init parameter of this function). +IPv6: Don't forget to call netif_create_ip6_linklocal_address() after setting the MAC address in struct netif.hwaddr (IPv6 requires a link-local address). + + + +netif, or NULL if failed. + + - - netMainThread + + netif::flags + ip_addr_set_zero_ip6 + LWIP_ASSERT + LWIP_IPV6_NUM_ADDRESSES + LWIP_ND6_MAX_MULTICAST_SOLICIT + memset + NETIF_SET_CHECKSUM_CTRL + NULL + netif::num + netif::state + net_init + netif_init - - netif * + + struct netif * struct netif* netif_find - (char *name) + (const char *name) netif_find - char * + const char * name +Find a network interface by searching for its name + + +name + + +the name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0') + + + + + + + + + netif::num + name + NULL + netif_list + netif::next + netif::name + LWIP_DEBUGF + NETIF_DEBUG + + + void + void netif_init + (void) + netif_init + + void + + + + - + + IP_ADDR6_HOST + netif_add + netif_set_link_up + netif_set_up + NULL + tcpip_input + lwip_init - - void - void netif_init - () - netif_init + + err_t + err_t netif_input + (struct pbuf *p, struct netif *inp) + netif_input + + struct pbuf * + p + + + struct netif * + inp + +Forwards a received packet for input processing with ethernet_input() or ip_input() depending on netif flags. Don't call directly, pass to netif_add() and call netif->input(). Only works if the netif driver correctly sets NETIF_FLAG_ETHARP and/or NETIF_FLAG_ETHERNET flag! - - netMainThread + + netif::flags + NETIF_FLAG_ETHARP + NETIF_FLAG_ETHERNET - + + void + void netif_remove + (struct netif *netif) + netif_remove + + struct netif * + netif + + + + +Remove a network interface from the list of lwIP netifs. + + +netif + + +the network interface to remove + + + + + + + + + NULL + netif::flags + NETIF_FLAG_IGMP + LWIP_IPV6_NUM_ADDRESSES + netif_is_up + netif_set_down + mib2_remove_ip4 + netif_default + netif_set_default + netif_list + netif::next + mib2_netif_removed + LWIP_DEBUGF + NETIF_DEBUG + + void void netif_set_default (struct netif *netif) @@ -357,209 +1359,507 @@ +Set a network interface as the default network interface (used to output all packets for which no specific route is found) + + +netif + + +the default network interface + + + + - - netMainThread + + LWIP_DEBUGF + mib2_add_route_ip4 + mib2_remove_route_ip4 + netif::name + NETIF_DEBUG + netif_default + NULL + net_init + netif_remove - + void - void netif_set_gw - (struct netif *netif, struct ip_addr *gw) - netif_set_gw + void netif_set_down + (struct netif *netif) + netif_set_down struct netif * netif - - struct ip_addr * - gw - +Bring an interface down, disabling any traffic processing. - + + netif::flags + NETIF_FLAG_UP + MIB2_COPY_SYSUPTIME_TO + NETIF_FLAG_ETHARP + NETIF_STATUS_CALLBACK + netif_remove - + void - void netif_set_ipaddr - (struct netif *netif, struct ip_addr *ipaddr) - netif_set_ipaddr + void netif_set_link_down + (struct netif *netif) + netif_set_link_down struct netif * netif - - struct ip_addr * - ipaddr - +Called by a driver when its link goes down - + + netif::flags + NETIF_FLAG_LINK_UP + NETIF_LINK_CALLBACK - + void - void netif_set_netmask - (struct netif *netif, struct ip_addr *netmast) - netif_set_netmask + void netif_set_link_up + (struct netif *netif) + netif_set_link_up struct netif * netif + + + +Called by a driver when its link goes up + + + + + netif::flags + NETIF_FLAG_LINK_UP + NETIF_FLAG_UP + net_init + netif_init + + + void + void netif_set_up + (struct netif *netif) + netif_set_up - struct ip_addr * - netmast + struct netif * + netif +Bring an interface up, available for processing traffic. - - - - - - netif * - struct netif* netif_default - - netif_default - - - - - - - - - - netif * - struct netif* netif_list - - netif_list - - - - - - - + + netif::flags + MIB2_COPY_SYSUPTIME_TO + NETIF_FLAG_LINK_UP + NETIF_FLAG_UP + NETIF_STATUS_CALLBACK + net_init + netif_init +netif API (to be used from TCPIP thread) -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: netif_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_NETIF_H__ -#define__LWIP_NETIF_H__ - -#include"net/opt.h" + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_NETIF_H +#defineLWIP_HDR_NETIF_H -#include"net/err.h" +#include<net/opt.h> -#include"net/ipv4/ip_addr.h" -#include"net/ipv4/inet.h" - -#include"net/pbuf.h" - +#defineENABLE_LOOPBACK(LWIP_NETIF_LOOPBACK||LWIP_HAVE_LOOPIF) + +#include<net/err.h> + +#include<net/ip_addr.h> -structnetif{ -structnetif*next; -uInt8num; -structip_addrip_addr; -structip_addrnetmask;/*netmaskinnetworkbyteorder*/ -structip_addrgw; -charhwaddr[6]; - -/*Thisfunctioniscalledbythenetworkdevicedriver -whenitwantstopassapackettotheTCP/IPstack.*/ -err_t(*input)(structpbuf*p,structnetif*inp); +#include<net/def.h> +#include<net/pbuf.h> +#include<net/stats.h> + +structnicBuffer{ +structnicBuffer*next; +intlength; +char*buffer; +}; + +externstructnicBuffer*tmpBuf; -/*Thefollowingtwofieldsshouldbefilledinbythe -initializationfunctionforthedevicedriver.*/ - -charname[2]; -/*ThisfunctioniscalledbytheIPmodulewhenitwants -tosendapacketontheinterface.*/ -err_t(*output)(structnetif*netif,structpbuf*p,structip_addr*ipaddr); -err_t(*linkoutput)(structnetif*netif,structpbuf*p); - -/*Thisfieldcanbesetbuthedevicedriverandcouldpoint -tostateinformationforthedevice.*/ -void*state; -}; +#ifdef__cplusplus +extern"C"{ +#endif + +/*Throughoutthisfile,IPaddressesareexpectedtobein +*thesamebyteorderasinIP_PCB.*/ + +#ifndefNETIF_MAX_HWADDR_LEN +#defineNETIF_MAX_HWADDR_LEN6U +#endif -/*Thelistofnetworkinterfaces.*/ -externstructnetif*netif_list; -externstructnetif*netif_default; - - -/*netif_init()mustbecalledfirst.*/ -voidnetif_init(); - -structnetif*netif_add(structip_addr*ipaddr,structip_addr*netmask, -structip_addr*gw, -void(*init)(structnetif*netif), -err_t(*input)(structpbuf*p,structnetif*netif)); - -/*Returnsanetworkinterfacegivenitsname.Thenameisoftheform -"et0",wherethefirsttwolettersarethe"name"fieldinthe -netifstructure,andthedigitisinthenumfieldinthesame -structure.*/ -structnetif*netif_find(char*name); - -voidnetif_set_default(structnetif*netif); - -voidnetif_set_ipaddr(structnetif*netif,structip_addr*ipaddr); -voidnetif_set_netmask(structnetif*netif,structip_addr*netmast); -voidnetif_set_gw(structnetif*netif,structip_addr*gw); - -#endif/*__LWIP_NETIF_H__*/ +#defineNETIF_FLAG_UP0x01U + +#defineNETIF_FLAG_BROADCAST0x02U + +#defineNETIF_FLAG_LINK_UP0x04U + +#defineNETIF_FLAG_ETHARP0x08U + +#defineNETIF_FLAG_ETHERNET0x10U + +#defineNETIF_FLAG_IGMP0x20U + +#defineNETIF_FLAG_MLD60x40U + +enumlwip_internal_netif_client_data_index +{ +#ifLWIP_DHCP +LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, +#endif +#ifLWIP_AUTOIP +LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, +#endif +#ifLWIP_IGMP +LWIP_NETIF_CLIENT_DATA_INDEX_IGMP, +#endif +#ifLWIP_IPV6_MLD +LWIP_NETIF_CLIENT_DATA_INDEX_MLD6, +#endif +LWIP_NETIF_CLIENT_DATA_INDEX_MAX +}; + +#ifLWIP_CHECKSUM_CTRL_PER_NETIF +#defineNETIF_CHECKSUM_GEN_IP0x0001 +#defineNETIF_CHECKSUM_GEN_UDP0x0002 +#defineNETIF_CHECKSUM_GEN_TCP0x0004 +#defineNETIF_CHECKSUM_GEN_ICMP0x0008 +#defineNETIF_CHECKSUM_GEN_ICMP60x0010 +#defineNETIF_CHECKSUM_CHECK_IP0x0100 +#defineNETIF_CHECKSUM_CHECK_UDP0x0200 +#defineNETIF_CHECKSUM_CHECK_TCP0x0400 +#defineNETIF_CHECKSUM_CHECK_ICMP0x0800 +#defineNETIF_CHECKSUM_CHECK_ICMP60x1000 +#defineNETIF_CHECKSUM_ENABLE_ALL0xFFFF +#defineNETIF_CHECKSUM_DISABLE_ALL0x0000 +#endif/*LWIP_CHECKSUM_CTRL_PER_NETIF*/ + +structnetif; + +enumnetif_mac_filter_action{ +NETIF_DEL_MAC_FILTER=0, +NETIF_ADD_MAC_FILTER=1 +}; + +typedeferr_t(*netif_init_fn)(structnetif*netif); +typedeferr_t(*netif_input_fn)(structpbuf*p,structnetif*inp); + +#ifLWIP_IPV4 + +typedeferr_t(*netif_output_fn)(structnetif*netif,structpbuf*p, +constip4_addr_t*ipaddr); +#endif/*LWIP_IPV4*/ + +#ifLWIP_IPV6 + +typedeferr_t(*netif_output_ip6_fn)(structnetif*netif,structpbuf*p, +constip6_addr_t*ipaddr); +#endif/*LWIP_IPV6*/ + +typedeferr_t(*netif_linkoutput_fn)(structnetif*netif,structpbuf*p); +typedefvoid(*netif_status_callback_fn)(structnetif*netif); +#ifLWIP_IPV4&&LWIP_IGMP + +typedeferr_t(*netif_igmp_mac_filter_fn)(structnetif*netif, +constip4_addr_t*group,enumnetif_mac_filter_actionaction); +#endif/*LWIP_IPV4&&LWIP_IGMP*/ +#ifLWIP_IPV6&&LWIP_IPV6_MLD + +typedeferr_t(*netif_mld_mac_filter_fn)(structnetif*netif, +constip6_addr_t*group,enumnetif_mac_filter_actionaction); +#endif/*LWIP_IPV6&&LWIP_IPV6_MLD*/ + +#ifLWIP_DHCP||LWIP_AUTOIP||LWIP_IGMP||LWIP_IPV6_MLD||(LWIP_NUM_NETIF_CLIENT_DATA>0) +u8_tnetif_alloc_client_data_id(void); +#definenetif_set_client_data(netif,id,data)netif_get_client_data(netif,id)=(data) + +#definenetif_get_client_data(netif,id)(netif)->client_data[(id)] +#endif/*LWIP_DHCP||LWIP_AUTOIP||(LWIP_NUM_NETIF_CLIENT_DATA>0)*/ + +structnetif{ +structnetif*next; + +#ifLWIP_IPV4 + +ip_addr_tip_addr; +ip_addr_tnetmask; +ip_addr_tgw; +#endif/*LWIP_IPV4*/ +#ifLWIP_IPV6 + +ip_addr_tip6_addr[LWIP_IPV6_NUM_ADDRESSES]; +u8_tip6_addr_state[LWIP_IPV6_NUM_ADDRESSES]; +#endif/*LWIP_IPV6*/ + +netif_input_fninput; +#ifLWIP_IPV4 + +netif_output_fnoutput; +#endif/*LWIP_IPV4*/ + +netif_linkoutput_fnlinkoutput; +#ifLWIP_IPV6 + +netif_output_ip6_fnoutput_ip6; +#endif/*LWIP_IPV6*/ +#ifLWIP_NETIF_STATUS_CALLBACK + +netif_status_callback_fnstatus_callback; +#endif/*LWIP_NETIF_STATUS_CALLBACK*/ +#ifLWIP_NETIF_LINK_CALLBACK + +netif_status_callback_fnlink_callback; +#endif/*LWIP_NETIF_LINK_CALLBACK*/ +#ifLWIP_NETIF_REMOVE_CALLBACK + +netif_status_callback_fnremove_callback; +#endif/*LWIP_NETIF_REMOVE_CALLBACK*/ + +void*state; +#ifdefnetif_get_client_data +void*client_data[LWIP_NETIF_CLIENT_DATA_INDEX_MAX+LWIP_NUM_NETIF_CLIENT_DATA]; +#endif +#ifLWIP_IPV6_AUTOCONFIG + +u8_tip6_autoconfig_enabled; +#endif/*LWIP_IPV6_AUTOCONFIG*/ +#ifLWIP_IPV6_SEND_ROUTER_SOLICIT + +u8_trs_count; +#endif/*LWIP_IPV6_SEND_ROUTER_SOLICIT*/ +#ifLWIP_NETIF_HOSTNAME +/*thehostnameforthisnetif,NULLisavalidvalue*/ +constchar*hostname; +#endif/*LWIP_NETIF_HOSTNAME*/ +#ifLWIP_CHECKSUM_CTRL_PER_NETIF +u16_tchksum_flags; +#endif/*LWIP_CHECKSUM_CTRL_PER_NETIF*/ + +u16_tmtu; +u8_thwaddr_len; +u8_thwaddr[NETIF_MAX_HWADDR_LEN]; +u8_tflags; +charname[2]; +u8_tnum; +#ifMIB2_STATS + +u8_tlink_type; +u32_tlink_speed; +u32_tts; +structstats_mib2_netif_ctrsmib2_counters; +#endif/*MIB2_STATS*/ +#ifLWIP_IPV4&&LWIP_IGMP + +netif_igmp_mac_filter_fnigmp_mac_filter; +#endif/*LWIP_IPV4&&LWIP_IGMP*/ +#ifLWIP_IPV6&&LWIP_IPV6_MLD + +netif_mld_mac_filter_fnmld_mac_filter; +#endif/*LWIP_IPV6&&LWIP_IPV6_MLD*/ +#ifLWIP_NETIF_HWADDRHINT +u8_t*addr_hint; +#endif/*LWIP_NETIF_HWADDRHINT*/ +#ifENABLE_LOOPBACK +/*Listofpacketstobequeuedforourselves.*/ +structpbuf*loop_first; +structpbuf*loop_last; +#ifLWIP_LOOPBACK_MAX_PBUFS +u16_tloop_cnt_current; +#endif/*LWIP_LOOPBACK_MAX_PBUFS*/ +#endif/*ENABLE_LOOPBACK*/ +}; + +#ifLWIP_CHECKSUM_CTRL_PER_NETIF +#defineNETIF_SET_CHECKSUM_CTRL(netif,chksumflags)do{\ +(netif)->chksum_flags=chksumflags;}while(0) +#defineIF__NETIF_CHECKSUM_ENABLED(netif,chksumflag)if(((netif)==NULL)||(((netif)->chksum_flags&(chksumflag))!=0)) +#else/*LWIP_CHECKSUM_CTRL_PER_NETIF*/ +#defineNETIF_SET_CHECKSUM_CTRL(netif,chksumflags) +#defineIF__NETIF_CHECKSUM_ENABLED(netif,chksumflag) +#endif/*LWIP_CHECKSUM_CTRL_PER_NETIF*/ + +externstructnetif*netif_list; +externstructnetif*netif_default; + +voidnetif_init(void); + +structnetif*netif_add(structnetif*netif, +#ifLWIP_IPV4 +constip4_addr_t*ipaddr,constip4_addr_t*netmask,constip4_addr_t*gw, +#endif/*LWIP_IPV4*/ +void*state,netif_init_fninit,netif_input_fninput); +#ifLWIP_IPV4 +voidnetif_set_addr(structnetif*netif,constip4_addr_t*ipaddr,constip4_addr_t*netmask, +constip4_addr_t*gw); +#endif/*LWIP_IPV4*/ +voidnetif_remove(structnetif*netif); + +/*Returnsanetworkinterfacegivenitsname.Thenameisoftheform +"et0",wherethefirsttwolettersarethe"name"fieldinthe +netifstructure,andthedigitisinthenumfieldinthesame +structure.*/ +structnetif*netif_find(constchar*name); + +voidnetif_set_default(structnetif*netif); + +#ifLWIP_IPV4 +voidnetif_set_ipaddr(structnetif*netif,constip4_addr_t*ipaddr); +voidnetif_set_netmask(structnetif*netif,constip4_addr_t*netmask); +voidnetif_set_gw(structnetif*netif,constip4_addr_t*gw); +#definenetif_ip4_addr(netif)((constip4_addr_t*)ip_2_ip4(&((netif)->ip_addr))) + +#definenetif_ip4_netmask(netif)((constip4_addr_t*)ip_2_ip4(&((netif)->netmask))) + +#definenetif_ip4_gw(netif)((constip4_addr_t*)ip_2_ip4(&((netif)->gw))) + +#definenetif_ip_addr4(netif)((constip_addr_t*)&((netif)->ip_addr)) + +#definenetif_ip_netmask4(netif)((constip_addr_t*)&((netif)->netmask)) + +#definenetif_ip_gw4(netif)((constip_addr_t*)&((netif)->gw)) +#endif/*LWIP_IPV4*/ + +voidnetif_set_up(structnetif*netif); +voidnetif_set_down(structnetif*netif); +#definenetif_is_up(netif)(((netif)->flags&NETIF_FLAG_UP)?(u8_t)1:(u8_t)0) + +#ifLWIP_NETIF_STATUS_CALLBACK +voidnetif_set_status_callback(structnetif*netif,netif_status_callback_fnstatus_callback); +#endif/*LWIP_NETIF_STATUS_CALLBACK*/ +#ifLWIP_NETIF_REMOVE_CALLBACK +voidnetif_set_remove_callback(structnetif*netif,netif_status_callback_fnremove_callback); +#endif/*LWIP_NETIF_REMOVE_CALLBACK*/ + +voidnetif_set_link_up(structnetif*netif); +voidnetif_set_link_down(structnetif*netif); +#definenetif_is_link_up(netif)(((netif)->flags&NETIF_FLAG_LINK_UP)?(u8_t)1:(u8_t)0) + +#ifLWIP_NETIF_LINK_CALLBACK +voidnetif_set_link_callback(structnetif*netif,netif_status_callback_fnlink_callback); +#endif/*LWIP_NETIF_LINK_CALLBACK*/ + +#ifLWIP_NETIF_HOSTNAME + +#definenetif_set_hostname(netif,name)do{if((netif)!=NULL){(netif)->hostname=name;}}while(0) + +#definenetif_get_hostname(netif)(((netif)!=NULL)?((netif)->hostname):NULL) +#endif/*LWIP_NETIF_HOSTNAME*/ + +#ifLWIP_IGMP + +#definenetif_set_igmp_mac_filter(netif,function)do{if((netif)!=NULL){(netif)->igmp_mac_filter=function;}}while(0) +#definenetif_get_igmp_mac_filter(netif)(((netif)!=NULL)?((netif)->igmp_mac_filter):NULL) +#endif/*LWIP_IGMP*/ + +#ifLWIP_IPV6&&LWIP_IPV6_MLD + +#definenetif_set_mld_mac_filter(netif,function)do{if((netif)!=NULL){(netif)->mld_mac_filter=function;}}while(0) +#definenetif_get_mld_mac_filter(netif)(((netif)!=NULL)?((netif)->mld_mac_filter):NULL) +#definenetif_mld_mac_filter(netif,addr,action)do{if((netif)&&(netif)->mld_mac_filter){(netif)->mld_mac_filter((netif),(addr),(action));}}while(0) +#endif/*LWIP_IPV6&&LWIP_IPV6_MLD*/ + +#ifENABLE_LOOPBACK +err_tnetif_loop_output(structnetif*netif,structpbuf*p); +voidnetif_poll(structnetif*netif); +#if!LWIP_NETIF_LOOPBACK_MULTITHREADING +voidnetif_poll_all(void); +#endif/*!LWIP_NETIF_LOOPBACK_MULTITHREADING*/ +#endif/*ENABLE_LOOPBACK*/ + +err_tnetif_input(structpbuf*p,structnetif*inp); + +#ifLWIP_IPV6 + +#definenetif_ip_addr6(netif,i)((constip_addr_t*)(&((netif)->ip6_addr[i]))) + +#definenetif_ip6_addr(netif,i)((constip6_addr_t*)ip_2_ip6(&((netif)->ip6_addr[i]))) +voidnetif_ip6_addr_set(structnetif*netif,s8_taddr_idx,constip6_addr_t*addr6); +voidnetif_ip6_addr_set_parts(structnetif*netif,s8_taddr_idx,u32_ti0,u32_ti1,u32_ti2,u32_ti3); +#definenetif_ip6_addr_state(netif,i)((netif)->ip6_addr_state[i]) +voidnetif_ip6_addr_set_state(structnetif*netif,s8_taddr_idx,u8_tstate); +s8_tnetif_get_ip6_addr_match(structnetif*netif,constip6_addr_t*ip6addr); +voidnetif_create_ip6_linklocal_address(structnetif*netif,u8_tfrom_mac_48bit); +err_tnetif_add_ip6_address(structnetif*netif,constip6_addr_t*ip6addr,s8_t*chosen_idx); +#definenetif_set_ip6_autoconfig_enabled(netif,action)do{if(netif){(netif)->ip6_autoconfig_enabled=(action);}}while(0) +#endif/*LWIP_IPV6*/ + +#ifLWIP_NETIF_HWADDRHINT +#defineNETIF_SET_HWADDRHINT(netif,hint)((netif)->addr_hint=(hint)) +#else/*LWIP_NETIF_HWADDRHINT*/ +#defineNETIF_SET_HWADDRHINT(netif,hint) +#endif/*LWIP_NETIF_HWADDRHINT*/ + +#ifdef__cplusplus +} +#endif + +/*MrOlsen2017-12-17LWIP*/ +voidethernetif_input(structnetif*); + +#endif/*LWIP_HDR_NETIF_H*/ - + diff --git a/doc/xml/ogDisplay__UbixOS_8h.xml b/doc/xml/ogDisplay__UbixOS_8h.xml index dfd2cfe..1aac08e 100644 --- a/doc/xml/ogDisplay__UbixOS_8h.xml +++ b/doc/xml/ogDisplay__UbixOS_8h.xml @@ -1,29 +1,108 @@ - - - + + + ogDisplay_UbixOS.h + sys/types.h objgfx40/objgfx40.h - src/sys/lib/ogprintf.cc + C:/Dev/git/UbixOS/sys/lib/ogprintf.cc + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/main.cc + C:/Dev/git/UbixOS/sys/sde/ogDisplay_UbixOS.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35,94 +114,123 @@ -#ifndefOGDISPLAY_UBIXOS_H -#defineOGDISPLAY_UBIXOS_H - -#include<objgfx40/objgfx40.h> - -structogModeInfo{ -uInt16modeAttributes__attribute__((packed)); -uInt8windowAFlags__attribute__((packed)); -uInt8windowBFlags__attribute__((packed)); -uInt16granularity__attribute__((packed)); -uInt16windowSize__attribute__((packed)); -uInt16windowASeg__attribute__((packed)); -uInt16windowBSeg__attribute__((packed)); -void*bankSwitch__attribute__((packed)); -uInt16bytesPerLine__attribute__((packed)); -uInt16xRes__attribute__((packed)); -uInt16yRes__attribute__((packed)); -uInt8charWidth__attribute__((packed)); -uInt8charHeight__attribute__((packed)); -uInt8numBitPlanes__attribute__((packed)); -uInt8bitsPerPixel__attribute__((packed)); -uInt8numberOfBanks__attribute__((packed)); -uInt8memoryModel__attribute__((packed)); -uInt8bankSize__attribute__((packed)); -uInt8numOfImagePages__attribute__((packed)); -uInt8reserved__attribute__((packed)); -//Directcolourfields(requiredforDirect/6andYUV/7memorymodels -uInt8redMaskSize__attribute__((packed)); -uInt8redFieldPosition__attribute__((packed)); -uInt8greenMaskSize__attribute__((packed)); -uInt8greenFieldPosition__attribute__((packed)); -uInt8blueMaskSize__attribute__((packed)); -uInt8blueFieldPosition__attribute__((packed)); -uInt8alphaMaskSize__attribute__((packed)); -uInt8alphaFieldPosition__attribute__((packed)); -uInt8directColourMode__attribute__((packed)); -//VESA2.0specificfields -uInt32physBasePtr__attribute__((packed)); -void*offScreenMemOffset__attribute__((packed)); -uInt16offScreenMemSize__attribute__((packed)); -uInt8paddington[461]__attribute__((packed)); -}; - -structogVESAInfo{ -charVBESignature[4]__attribute__((packed)); -uInt8minVersion__attribute__((packed)); -uInt8majVersion__attribute__((packed)); -uInt32OEMStringPtr__attribute__((packed)); -uInt32capabilities__attribute__((packed)); -uInt32videoModePtr__attribute__((packed)); -uInt16totalMemory__attribute__((packed)); -//VESA2.0specificfields -uInt16OEMSoftwareRev__attribute__((packed)); -uInt32OEMVendorNamePtr__attribute__((packed)); -uInt32OEMProductNamePtr__attribute__((packed)); -uInt32OEMProductRevPtr__attribute__((packed)); -uInt8paddington[474]__attribute__((packed)); -}; - - -classogDisplay_UbixOS:publicogSurface{ -protected: -void*pages[2]; -uInt32activePage; -uInt32visualPage; -ogVESAInfo*VESAInfo; -ogModeInfo*modeInfo; - -uInt16FindMode(uInt32,uInt32,uInt32); -voidGetModeInfo(uInt16); -voidGetVESAInfo(void); -voidSetMode(uInt16); -voidSetPal(void); -public: -ogDisplay_UbixOS(void); -virtualboologAlias(ogSurface&,uInt32,uInt32,uInt32,uInt32); -virtualboologClone(ogSurface&); -virtualvoidogCopyPalette(ogSurface&); -virtualboologCreate(uInt32,uInt32,ogPixelFmt); -virtualboologLoadPalette(constchar*); -virtualvoidogSetPalette(constogRGBA8[]); -virtualvoidogSetPalette(uInt8,uInt8,uInt8,uInt8); -virtualvoidogSetPalette(uInt8,uInt8,uInt8,uInt8,uInt8); -virtual~ogDisplay_UbixOS(void); -};//ogDisplay_UbixOS - -#endif +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndefOGDISPLAY_UBIXOS_H +#defineOGDISPLAY_UBIXOS_H + +#include<sys/types.h> +#include<objgfx40/objgfx40.h> + +structogModeInfo{ +uint16_tmodeAttributes__attribute__((packed)); +uint8_twindowAFlags__attribute__((packed)); +uint8_twindowBFlags__attribute__((packed)); +uint16_tgranularity__attribute__((packed)); +uint16_twindowSize__attribute__((packed)); +uint16_twindowASeg__attribute__((packed)); +uint16_twindowBSeg__attribute__((packed)); +void*bankSwitch__attribute__((packed)); +uint16_tbytesPerLine__attribute__((packed)); +uint16_txRes__attribute__((packed)); +uint16_tyRes__attribute__((packed)); +uint8_tcharWidth__attribute__((packed)); +uint8_tcharHeight__attribute__((packed)); +uint8_tnumBitPlanes__attribute__((packed)); +uint8_tbitsPerPixel__attribute__((packed)); +uint8_tnumberOfBanks__attribute__((packed)); +uint8_tmemoryModel__attribute__((packed)); +uint8_tbankSize__attribute__((packed)); +uint8_tnumOfImagePages__attribute__((packed)); +uint8_treserved__attribute__((packed)); +//Directcolourfields(requiredforDirect/6andYUV/7memorymodels +uint8_tredMaskSize__attribute__((packed)); +uint8_tredFieldPosition__attribute__((packed)); +uint8_tgreenMaskSize__attribute__((packed)); +uint8_tgreenFieldPosition__attribute__((packed)); +uint8_tblueMaskSize__attribute__((packed)); +uint8_tblueFieldPosition__attribute__((packed)); +uint8_talphaMaskSize__attribute__((packed)); +uint8_talphaFieldPosition__attribute__((packed)); +uint8_tdirectColourMode__attribute__((packed)); +//VESA2.0specificfields +uint32_tphysBasePtr__attribute__((packed)); +void*offScreenMemOffset__attribute__((packed)); +uint16_toffScreenMemSize__attribute__((packed)); +uint8_tpaddington[461]__attribute__((packed)); +}; + +structogVESAInfo{ +charVBESignature[4]__attribute__((packed)); +uint8_tminVersion__attribute__((packed)); +uint8_tmajVersion__attribute__((packed)); +uint32_tOEMStringPtr__attribute__((packed)); +uint32_tcapabilities__attribute__((packed)); +uint32_tvideoModePtr__attribute__((packed)); +uint16_ttotalMemory__attribute__((packed)); +//VESA2.0specificfields +uint16_tOEMSoftwareRev__attribute__((packed)); +uint32_tOEMVendorNamePtr__attribute__((packed)); +uint32_tOEMProductNamePtr__attribute__((packed)); +uint32_tOEMProductRevPtr__attribute__((packed)); +uint8_tpaddington[474]__attribute__((packed)); +}; + +classogDisplay_UbixOS:publicogSurface{ +protected: +void*pages[2]; +uint32_tactivePage; +uint32_tvisualPage; +ogVESAInfo*VESAInfo; +ogModeInfo*modeInfo; + +uint16_tFindMode(uint32_t,uint32_t,uint32_t); +voidGetModeInfo(uint16_t); +voidGetVESAInfo(void); +voidSetMode(uint16_t); +voidSetPal(void); +public: +ogDisplay_UbixOS(void); +virtualboologAlias(ogSurface&,uint32_t,uint32_t,uint32_t,uint32_t); +virtualboologClone(ogSurface&); +virtualvoidogCopyPalette(ogSurface&); +virtualboologCreate(uint32_t,uint32_t,ogPixelFmt); +virtualboologLoadPalette(constchar*); +virtualvoidogSetPalette(constogRGBA8[]); +virtualvoidogSetPalette(uint8_t,uint8_t,uint8_t,uint8_t); +virtualvoidogSetPalette(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t); +virtual~ogDisplay_UbixOS(void); +}; +//ogDisplay_UbixOS + +#endif - + diff --git a/doc/xml/ogDisplay__VESA_8h.xml b/doc/xml/ogDisplay__VESA_8h.xml index 27e7048..e32b6e2 100644 --- a/doc/xml/ogDisplay__VESA_8h.xml +++ b/doc/xml/ogDisplay__VESA_8h.xml @@ -1,17 +1,68 @@ - - - + + + ogDisplay_VESA.h - objgfx30.h + sys/types.h + objgfx40/objgfx40.h - - - - + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ogDisplay_VESA @@ -22,102 +73,132 @@ -#ifndefOGDISPLAY_VESA_H -#defineOGDISPLAY_VESA_H - -#include"objgfx30.h" - -structTMode_Rec{ -uInt16ModeAttributes__attribute__((packed)); -uInt8WindowAFlags__attribute__((packed)); -uInt8WindowBFlags__attribute__((packed)); -uInt16Granularity__attribute__((packed)); -uInt16WindowSize__attribute__((packed)); -uInt16WindowASeg__attribute__((packed)); -uInt16WindowBSeg__attribute__((packed)); -void*BankSwitch__attribute__((packed)); -uInt16BytesPerLine__attribute__((packed)); -uInt16xRes__attribute__((packed)); -uInt16yRes__attribute__((packed)); -uInt8CharWidth__attribute__((packed)); -uInt8CharHeight__attribute__((packed)); -uInt8NumBitPlanes__attribute__((packed)); -uInt8BitsPerPixel__attribute__((packed)); -uInt8NumberOfBanks__attribute__((packed)); -uInt8MemoryModel__attribute__((packed)); -uInt8BankSize__attribute__((packed)); -uInt8NumOfImagePages__attribute__((packed)); -uInt8Reserved__attribute__((packed)); -//Directcolourfields(requiredforDirect/6andYUV/7memorymodels -uInt8RedMaskSize__attribute__((packed)); -uInt8RedFieldPosition__attribute__((packed)); -uInt8GreenMaskSize__attribute__((packed)); -uInt8GreenFieldPosition__attribute__((packed)); -uInt8BlueMaskSize__attribute__((packed)); -uInt8BlueFieldPosition__attribute__((packed)); -uInt8AlphaMaskSize__attribute__((packed)); -uInt8AlphaFieldPosition__attribute__((packed)); -uInt8DirectColourMode__attribute__((packed)); -//VESA2.0specificfields -uInt32physBasePtr__attribute__((packed)); -void*OffScreenMemOffset__attribute__((packed)); -uInt16OffScreenMemSize__attribute__((packed)); -uInt8paddington[461]__attribute__((packed)); -}; - -structTVESA_Rec{ -charVBESignature[4]__attribute__((packed)); -uInt8minVersion__attribute__((packed)); -uInt8majVersion__attribute__((packed)); -uInt32OEMStringPtr__attribute__((packed)); -uInt32Capabilities__attribute__((packed)); -uInt32VideoModePtr__attribute__((packed)); -uInt16TotalMemory__attribute__((packed)); -//VESA2.0specificfields -uInt16OEMSoftwareRev__attribute__((packed)); -uInt32OEMVendorNamePtr__attribute__((packed)); -uInt32OEMProductNamePtr__attribute__((packed)); -uInt32OEMProductRevPtr__attribute__((packed)); -uInt8paddington[474]__attribute__((packed)); -}; - -classogDisplay_VESA:publicogSurface{ -protected: -uInt16ScreenSelector; -TVESA_Rec*VESARec; -TMode_Rec*ModeRec; -boolInGraphics; -uInt16findMode(uInt32,uInt32,uInt32); -voidgetModeInfo(uInt16); -voidgetVESAInfo(void); -voidsetMode(uInt16); -virtualuInt32rawGetPixel(uInt32,uInt32); -virtualvoidrawSetPixel(uInt32,uInt32,uInt32); -virtualvoidrawLine(uInt32,uInt32,uInt32,uInt32,uInt32); -voidsetPal(void); -public: -ogDisplay_VESA(void); -virtualboologAvail(void); -virtualboologAlias(ogSurface&,uInt32,uInt32,uInt32,uInt32); -virtualvoidogClear(uInt32); -virtualboologClone(ogSurface&); -virtualvoidogCopyLineTo(uInt32,uInt32,constvoid*,uInt32); -virtualvoidogCopyLineFrom(uInt32,uInt32,void*,uInt32); -virtualvoidogCopyPal(ogSurface&); -virtualboologCreate(uInt32,uInt32,ogPixelFmt); -virtualuInt32ogGetPixel(int32,int32); -virtualvoid*ogGetPtr(uInt32,uInt32); -virtualvoidogHLine(int32,int32,int32,uInt32); -virtualboologLoadPal(constchar*); -virtualvoidogSetPixel(int32,int32,uInt32); -virtualvoidogSetRGBPalette(uInt8,uInt8,uInt8,uInt8); -virtualvoidogVFlip(void); -virtualvoidogVLine(int32,int32,int32,uInt32); -virtual~ogDisplay_VESA(void); -};//ogDisplay_VESA - -#endif +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_OBJGFX_OGDISPLAY_VESA_H +#define_OBJGFX_OGDISPLAY_VESA_H + +#include<sys/types.h> +#include<objgfx40/objgfx40.h> + +structTMode_Rec{ +uInt16ModeAttributes__attribute__((packed)); +uInt8WindowAFlags__attribute__((packed)); +uInt8WindowBFlags__attribute__((packed)); +uInt16Granularity__attribute__((packed)); +uInt16WindowSize__attribute__((packed)); +uInt16WindowASeg__attribute__((packed)); +uInt16WindowBSeg__attribute__((packed)); +void*BankSwitch__attribute__((packed)); +uInt16BytesPerLine__attribute__((packed)); +uInt16xRes__attribute__((packed)); +uInt16yRes__attribute__((packed)); +uInt8CharWidth__attribute__((packed)); +uInt8CharHeight__attribute__((packed)); +uInt8NumBitPlanes__attribute__((packed)); +uInt8BitsPerPixel__attribute__((packed)); +uInt8NumberOfBanks__attribute__((packed)); +uInt8MemoryModel__attribute__((packed)); +uInt8BankSize__attribute__((packed)); +uInt8NumOfImagePages__attribute__((packed)); +uInt8Reserved__attribute__((packed)); +//Directcolourfields(requiredforDirect/6andYUV/7memorymodels +uInt8RedMaskSize__attribute__((packed)); +uInt8RedFieldPosition__attribute__((packed)); +uInt8GreenMaskSize__attribute__((packed)); +uInt8GreenFieldPosition__attribute__((packed)); +uInt8BlueMaskSize__attribute__((packed)); +uInt8BlueFieldPosition__attribute__((packed)); +uInt8AlphaMaskSize__attribute__((packed)); +uInt8AlphaFieldPosition__attribute__((packed)); +uInt8DirectColourMode__attribute__((packed)); +//VESA2.0specificfields +uInt32physBasePtr__attribute__((packed)); +void*OffScreenMemOffset__attribute__((packed)); +uInt16OffScreenMemSize__attribute__((packed)); +uInt8paddington[461]__attribute__((packed)); +}; + +structTVESA_Rec{ +charVBESignature[4]__attribute__((packed)); +uInt8minVersion__attribute__((packed)); +uInt8majVersion__attribute__((packed)); +uInt32OEMStringPtr__attribute__((packed)); +uInt32Capabilities__attribute__((packed)); +uInt32VideoModePtr__attribute__((packed)); +uInt16TotalMemory__attribute__((packed)); +//VESA2.0specificfields +uInt16OEMSoftwareRev__attribute__((packed)); +uInt32OEMVendorNamePtr__attribute__((packed)); +uInt32OEMProductNamePtr__attribute__((packed)); +uInt32OEMProductRevPtr__attribute__((packed)); +uInt8paddington[474]__attribute__((packed)); +}; + +classogDisplay_VESA:publicogSurface{ +protected: +uInt16ScreenSelector; +TVESA_Rec*VESARec; +TMode_Rec*ModeRec; +boolInGraphics; +uInt16findMode(uInt32,uInt32,uInt32); +voidgetModeInfo(uInt16); +voidgetVESAInfo(void); +voidsetMode(uInt16); +virtualuInt32rawGetPixel(uInt32,uInt32); +virtualvoidrawSetPixel(uInt32,uInt32,uInt32); +virtualvoidrawLine(uInt32,uInt32,uInt32,uInt32,uInt32); +voidsetPal(void); +public: +ogDisplay_VESA(void); +virtualboologAvail(void); +virtualboologAlias(ogSurface&,uInt32,uInt32,uInt32,uInt32); +virtualvoidogClear(uInt32); +virtualboologClone(ogSurface&); +virtualvoidogCopyLineTo(uInt32,uInt32,constvoid*,uInt32); +virtualvoidogCopyLineFrom(uInt32,uInt32,void*,uInt32); +virtualvoidogCopyPal(ogSurface&); +virtualboologCreate(uInt32,uInt32,ogPixelFmt); +virtualuInt32ogGetPixel(int32,int32); +virtualvoid*ogGetPtr(uInt32,uInt32); +virtualvoidogHLine(int32,int32,int32,uInt32); +virtualboologLoadPal(constchar*); +virtualvoidogSetPixel(int32,int32,uInt32); +virtualvoidogSetRGBPalette(uInt8,uInt8,uInt8,uInt8); +virtualvoidogVFlip(void); +virtualvoidogVLine(int32,int32,int32,uInt32); +virtual~ogDisplay_VESA(void); +}; +//ogDisplay_VESA + +#endif - + diff --git a/doc/xml/ogprintf_8cc.xml b/doc/xml/ogprintf_8cc.xml index 238804f..bec01b1 100644 --- a/doc/xml/ogprintf_8cc.xml +++ b/doc/xml/ogprintf_8cc.xml @@ -1,168 +1,458 @@ - - - + + + ogprintf.cc objgfx40/objgfx40.h objgfx40/ogFont.h sde/ogDisplay_UbixOS.h ubixos/vitals.h - - - - + + + + + + - - - - + + + + - + - + - - - + - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + int + int screenCol + + screenCol + = 0x1 + + + + + + + + + + int + int screenRow + + screenRow + = 0x0 + + + + + + + + + - + int int ogPrintf - (char *s) + (char *ch) ogPrintf char * - s + ch @@ -170,40 +460,11 @@ - - vitalsStruct::font - vitalsStruct::screen - systemVitals - - - - - int - int screenCol - - screenCol - 0x1 - - - - - - - - - - int - int screenRow - - screenRow - 0x0 - - - - - - - + + vitalsStruct::font + vitalsStruct::screen + systemVitals + kprintf @@ -211,134 +472,89 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ogprintf_8cc.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<objgfx40/objgfx40.h> -#include<objgfx40/ogFont.h> -#include<sde/ogDisplay_UbixOS.h> - -extern"C"{ - -#include<ubixos/vitals.h> - - -staticintscreenRow=0x0; -staticintscreenCol=0x1; - -intogPrintf(char*s){ -inti=0x0; -intbufHeight; -ogSurface*screen=(ogDisplay_UbixOS*)systemVitals->screen; -ogBitFont*font=(ogBitFont*)systemVitals->font; - - -while('\0'!=s[i]){ -switch(s[i]){ -case'\t': -screenCol+=3; -break; -case'\b': -if(screenCol>0)--screenCol; -case'\n': -screenCol=0; - -bufHeight=((screen->ogGetMaxY()+1)/font->GetHeight())-1; -if(screenRow<bufHeight) -++screenRow; -else{ -screen->ogCopyBuf(0,0, -*screen, -0,font->GetHeight(), -screen->ogGetMaxX(),screen->ogGetMaxY()); -screen->ogFillRect(0,bufHeight*font->GetHeight()+1, -screen->ogGetMaxX(),screen->ogGetMaxY(), -screen->ogPack(122,140,163)); -} -break; -default: -font->PutChar(*screen, -screenCol*font->GetWidth(), -screenRow*font->GetHeight(), -s[i]); -break; -}/*switch*/ -++screenCol; -++i; -}/*while*/ - -return0; -}//ogPrintf - -} - -/*** -$Log: ogprintf_8cc.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:13reddawg -nomessage - -Revision1.72004/07/2022:58:33reddawg -retiringtothelaptopforthenightmustsyncinworktoresumefromthere - -Revision1.62004/07/1714:24:22reddawg -compile:changestothewaywelinkthekernelshouldpreventfutureerrors - -Revision1.52004/05/2323:30:34reddawg -Fixens - -Revision1.42004/05/2301:40:19reddawg -Spinlock - -Revision1.32004/05/1917:09:50flameshadow -chg:Undidpreviousrenaming.ThisnowrestoresmeastheEOOUIAD. - -Revision1.22004/04/2612:56:01reddawg -Madesrc/sys/sdeCopyandMaketheogPixelFormat.cpp - -Revision1.1.1.12004/04/1512:07:10reddawg -UbixOSv1.0 - -Revision1.192004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +extern"C"{ + +#include<objgfx40/objgfx40.h> +#include<objgfx40/ogFont.h> +#include<sde/ogDisplay_UbixOS.h> + +#include<ubixos/vitals.h> + +staticintscreenRow=0x0; +staticintscreenCol=0x1; + +intogPrintf(char*ch){ +inti=0x0; +intbufHeight; + +ogSurface*screen=(ogDisplay_UbixOS*)systemVitals->screen; +ogBitFont*font=(ogBitFont*)systemVitals->font; + +char*s=0; +s=ch; + +while('\0'!=s[i]){ +switch(s[i]){ +case'\t': +screenCol+=3; +break; +case'\b': +if(screenCol>0) +--screenCol; +case'\n': +screenCol=0; + +bufHeight=((screen->ogGetMaxY()+1)/font->GetHeight())-1; +if(screenRow<bufHeight) +++screenRow; +else{ +screen->ogCopyBuf(0,0,*screen,0,font->GetHeight(),screen->ogGetMaxX(),screen->ogGetMaxY()); +screen->ogFillRect(0,bufHeight*font->GetHeight()+1,screen->ogGetMaxX(),screen->ogGetMaxY(),screen->ogPack(122,140,163)); +} +break; +default: +font->PutChar(*screen,screenCol*font->GetWidth(),screenRow*font->GetHeight(),s[i]); +break; +}/*switch*/ + +++screenCol; +++i; + +}/*while*/ + +return0; +}//ogPrintf + +} - + diff --git a/doc/xml/opt_8h.xml b/doc/xml/opt_8h.xml index 0db103e..10beee1 100644 --- a/doc/xml/opt_8h.xml +++ b/doc/xml/opt_8h.xml @@ -1,330 +1,4748 @@ - - - + + + opt.h - net/lwipopts.h - src/sys/include/net/api.h - src/sys/include/net/api_msg.h - src/sys/include/net/ipv4/icmp.h - src/sys/include/net/ipv4/inet.h - src/sys/include/net/ipv6/inet.h - src/sys/include/net/mem.h - src/sys/include/net/netif.h - src/sys/include/net/stats.h - src/sys/include/net/tcp.h - src/sys/net/api/tcpip.c - src/sys/net/net/sys_arch.c - src/sys/net/netif/ethernetif.c - src/sys/net/netif/loopif.c + net/lwipopts.h + net/debug.h + C:/Dev/git/UbixOS/sys/include/net/api.h + C:/Dev/git/UbixOS/sys/include/net/autoip.h + C:/Dev/git/UbixOS/sys/include/net/debug.h + C:/Dev/git/UbixOS/sys/include/net/def.h + C:/Dev/git/UbixOS/sys/include/net/dhcp.h + C:/Dev/git/UbixOS/sys/include/net/dhcp6.h + C:/Dev/git/UbixOS/sys/include/net/dns.h + C:/Dev/git/UbixOS/sys/include/net/err.h + C:/Dev/git/UbixOS/sys/include/net/errno.h + C:/Dev/git/UbixOS/sys/include/net/etharp.h + C:/Dev/git/UbixOS/sys/include/net/ethip6.h + C:/Dev/git/UbixOS/sys/include/net/icmp.h + C:/Dev/git/UbixOS/sys/include/net/icmp6.h + C:/Dev/git/UbixOS/sys/include/net/igmp.h + C:/Dev/git/UbixOS/sys/include/net/inet.h + C:/Dev/git/UbixOS/sys/include/net/inet_chksum.h + C:/Dev/git/UbixOS/sys/include/net/init.h + C:/Dev/git/UbixOS/sys/include/net/ip.h + C:/Dev/git/UbixOS/sys/include/net/ip4.h + C:/Dev/git/UbixOS/sys/include/net/ip4_addr.h + C:/Dev/git/UbixOS/sys/include/net/ip4_frag.h + C:/Dev/git/UbixOS/sys/include/net/ip6.h + C:/Dev/git/UbixOS/sys/include/net/ip6_addr.h + C:/Dev/git/UbixOS/sys/include/net/ip6_frag.h + C:/Dev/git/UbixOS/sys/include/net/ip_addr.h + C:/Dev/git/UbixOS/sys/include/net/mem.h + C:/Dev/git/UbixOS/sys/include/net/memp.h + C:/Dev/git/UbixOS/sys/include/net/mld6.h + C:/Dev/git/UbixOS/sys/include/net/nd6.h + C:/Dev/git/UbixOS/sys/include/net/netbuf.h + C:/Dev/git/UbixOS/sys/include/net/netdb.h + C:/Dev/git/UbixOS/sys/include/net/netif.h + C:/Dev/git/UbixOS/sys/include/net/netifapi.h + C:/Dev/git/UbixOS/sys/include/net/pbuf.h + C:/Dev/git/UbixOS/sys/include/net/priv/api_msg.h + C:/Dev/git/UbixOS/sys/include/net/priv/memp_priv.h + C:/Dev/git/UbixOS/sys/include/net/priv/nd6_priv.h + C:/Dev/git/UbixOS/sys/include/net/priv/tcp_priv.h + C:/Dev/git/UbixOS/sys/include/net/priv/tcpip_priv.h + C:/Dev/git/UbixOS/sys/include/net/prot/dhcp.h + C:/Dev/git/UbixOS/sys/include/net/raw.h + C:/Dev/git/UbixOS/sys/include/net/sio.h + C:/Dev/git/UbixOS/sys/include/net/snmp.h + C:/Dev/git/UbixOS/sys/include/net/sockets.h + C:/Dev/git/UbixOS/sys/include/net/stats.h + C:/Dev/git/UbixOS/sys/include/net/sys.h + C:/Dev/git/UbixOS/sys/include/net/tcp.h + C:/Dev/git/UbixOS/sys/include/net/tcpip.h + C:/Dev/git/UbixOS/sys/include/net/timeouts.h + C:/Dev/git/UbixOS/sys/include/net/udp.h + C:/Dev/git/UbixOS/sys/include/netif/ethernet.h + C:/Dev/git/UbixOS/sys/include/netif/lowpan6_opts.h + C:/Dev/git/UbixOS/sys/include/netif/ppp/ppp_opts.h + C:/Dev/git/UbixOS/sys/include/netif/slipif.h + C:/Dev/git/UbixOS/sys/net/api/api_lib.c + C:/Dev/git/UbixOS/sys/net/api/api_msg.c + C:/Dev/git/UbixOS/sys/net/api/netbuf.c + C:/Dev/git/UbixOS/sys/net/api/sockets.c + C:/Dev/git/UbixOS/sys/net/api/tcpip.c + C:/Dev/git/UbixOS/sys/net/core/def.c + C:/Dev/git/UbixOS/sys/net/core/dns.c + C:/Dev/git/UbixOS/sys/net/core/inet_chksum.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/ip.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/autoip.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/dhcp.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/etharp.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/icmp.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/igmp.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/ip4.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/ip4_addr.c + C:/Dev/git/UbixOS/sys/net/core/ipv4/ip4_frag.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/dhcp6.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ethip6.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/icmp6.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/inet6.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_addr.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/mld6.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/nd6.c + C:/Dev/git/UbixOS/sys/net/core/mem.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/core/raw.c + C:/Dev/git/UbixOS/sys/net/core/stats.c + C:/Dev/git/UbixOS/sys/net/core/sys.c + C:/Dev/git/UbixOS/sys/net/core/tcp.c + C:/Dev/git/UbixOS/sys/net/core/tcp_in.c + C:/Dev/git/UbixOS/sys/net/core/tcp_out.c + C:/Dev/git/UbixOS/sys/net/core/timeouts.c + C:/Dev/git/UbixOS/sys/net/core/udp.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/net/netif/ethernet.c + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c + C:/Dev/git/UbixOS/sys/net/netif/loopif.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + - + - + - - - - - - - - - + + + - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + - - - - + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + API_LIB_DEBUG + LWIP_DBG_OFF + + + +API_LIB_DEBUG: Enable debugging in api_lib.c. + + + + + + + API_MSG_DEBUG + LWIP_DBG_OFF + + + +API_MSG_DEBUG: Enable debugging in api_msg.c. + + + + + + + ARP_MAXAGE + 300 + + + +the time an ARP entry stays valid after its last update, for ARP_TMR_INTERVAL = 1000, this is (60 * 5) seconds = 5 minutes. + + + + + + + ARP_QUEUE_LEN + 3 + + + +The maximum number of packets which may be queued for each unresolved address by other network layers. Defaults to 3, 0 means disabled. Old packets are dropped, new packets are queued. + + + + + + + ARP_QUEUEING + 0 + + + +ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address resolution. By default, only the most recent packet is queued per IP address. This is sufficient for most protocols and mainly reduces TCP connection startup time. Set this to 1 if you know your application sends more than one packet in a row to an IP address that is not in the ARP cache. + + + + + + + ARP_TABLE_SIZE + 10 + + + +ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached. + + + + + + + AUTOIP_DEBUG + LWIP_DBG_OFF + + + +AUTOIP_DEBUG: Enable debugging in autoip.c. + + + + + + + CHECKSUM_CHECK_ICMP + 1 + + + +CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets. + + + + + + + CHECKSUM_CHECK_ICMP6 + 1 + + + +CHECKSUM_CHECK_ICMP6==1: Check checksums in software for incoming ICMPv6 packets + + + + + + + CHECKSUM_CHECK_IP + 1 + + + +CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. + + + + + + + CHECKSUM_CHECK_TCP + 1 + + + +CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets. + + + + + + + CHECKSUM_CHECK_UDP + 1 + + + +CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. + + + + + + + CHECKSUM_GEN_ICMP + 1 + + + +CHECKSUM_GEN_ICMP==1: Generate checksums in software for outgoing ICMP packets. + + + + + + + CHECKSUM_GEN_ICMP6 + 1 + + + +CHECKSUM_GEN_ICMP6==1: Generate checksums in software for outgoing ICMP6 packets. + + + + + + + CHECKSUM_GEN_IP + 1 + + + +CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets. + + + + + + + CHECKSUM_GEN_TCP + 1 + + + +CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. + + + + + + + CHECKSUM_GEN_UDP + 1 + + + +CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. + + + + + + + DEFAULT_ACCEPTMBOX_SIZE + 0 + + + +DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the acceptmbox is created. + + + + + + + DEFAULT_RAW_RECVMBOX_SIZE + 0 + + + +DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a NETCONN_RAW. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the recvmbox is created. + + + + + + + DEFAULT_TCP_RECVMBOX_SIZE + 0 + + + +DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a NETCONN_TCP. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the recvmbox is created. + + + + + + + DEFAULT_THREAD_NAME + "lwIP" + + + +DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread. + + + + + + + DEFAULT_THREAD_PRIO + 1 + + + +DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created. + + + + + + + DEFAULT_THREAD_STACKSIZE + 0 + + + +DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created. + + + + + + + DEFAULT_UDP_RECVMBOX_SIZE + 0 + + + +DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a NETCONN_UDP. The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when the recvmbox is created. + + + + + + + DHCP_DEBUG + LWIP_DBG_OFF + + + +DHCP_DEBUG: Enable debugging in dhcp.c. + + + + + + + DHCP_DOES_ARP_CHECK + ((LWIP_DHCP) && (LWIP_ARP)) + + + +DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. + + + + + + + DNS_DEBUG + LWIP_DBG_OFF + + + +DNS_DEBUG: Enable debugging for DNS. + + + + + + + DNS_DOES_NAME_CHECK + 1 + + + +DNS do a name checking between the query and the response. + + + + + + + DNS_LOCAL_HOSTLIST + 0 + + + +DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, you have to define an initializer: #define DNS_LOCAL_HOSTLIST_INIT {DNS_LOCAL_HOSTLIST_ELEM("host_ip4", IPADDR4_INIT_BYTES(1,2,3,4)), \ DNS_LOCAL_HOSTLIST_ELEM("host_ip6", IPADDR6_INIT_HOST(123, 234, 345, 456)} +Instead, you can also use an external function: #define DNS_LOOKUP_LOCAL_EXTERN(x) extern err_t my_lookup_function(const char *name, ip_addr_t *addr, u8_t dns_addrtype) that looks up the IP address and returns ERR_OK if found (LWIP_DNS_ADDRTYPE_xxx is passed in dns_addrtype). + + + + + + + DNS_LOCAL_HOSTLIST_IS_DYNAMIC + 0 + + + +If this is turned on, the local host-list can be dynamically changed at runtime. + + + + + + + DNS_MAX_NAME_LENGTH + 256 + + + +DNS maximum host name length supported in the name table. + + + + + + + DNS_MAX_SERVERS + 2 + + + +The maximum of DNS servers The first server can be initialized automatically by defining DNS_SERVER_ADDRESS(ipaddr), where 'ipaddr' is an 'ip_addr_t*' + + + + + + + DNS_TABLE_SIZE + 4 + + + +DNS maximum number of entries to maintain locally. + + + + + + + ETH_PAD_SIZE + 0 + + + +ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure alignment of payload after that header. Since the header is 14 bytes long, without this padding e.g. addresses in the IP header will not be aligned on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms. + + + + + + + ETHARP_DEBUG + LWIP_DBG_OFF + + + +ETHARP_DEBUG: Enable debugging in etharp.c. + + + + + + + ETHARP_STATS + (LWIP_ARP) + + + +ETHARP_STATS==1: Enable etharp stats. + + + + + + + ETHARP_SUPPORT_STATIC_ENTRIES + 0 + + + +ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table entries (using etharp_add_static_entry/etharp_remove_static_entry). + + + + + + + ETHARP_SUPPORT_VLAN + 0 + + + +ETHARP_SUPPORT_VLAN==1: support receiving and sending ethernet packets with VLAN header. See the description of LWIP_HOOK_VLAN_CHECK and LWIP_HOOK_VLAN_SET hooks to check/set VLAN headers. Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check. If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted. If ETHARP_VLAN_CHECK is not defined, all traffic is accepted. Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan) that returns 1 to accept a packet or 0 to drop a packet. + + + + + + + ETHARP_TABLE_MATCH_NETIF + 0 + + + +ETHARP_TABLE_MATCH_NETIF==1: Match netif for ARP table entries. If disabled, duplicate IP address on multiple netifs are not supported (but this should only occur for AutoIP). + + + + + + + ICMP6_STATS + (LWIP_IPV6 && LWIP_ICMP6) + + + +ICMP6_STATS==1: Enable ICMP for IPv6 stats. + + + + + + + ICMP_DEBUG + LWIP_DBG_OFF + + + +ICMP_DEBUG: Enable debugging in icmp.c. + + + + + + + ICMP_STATS + 1 + + + +ICMP_STATS==1: Enable ICMP stats. + + + + + + ICMP_TTL + (IP_DEFAULT_TTL) + + + +ICMP_TTL: Default value for Time-To-Live used by ICMP packets. + + + + + + + IGMP_DEBUG + LWIP_DBG_OFF + + + +IGMP_DEBUG: Enable debugging in igmp.c. + + + + + + + IGMP_STATS + (LWIP_IGMP) + + + +IGMP_STATS==1: Enable IGMP stats. + + + + + + + INET_DEBUG + LWIP_DBG_OFF + + + +INET_DEBUG: Enable debugging in inet.c. + + + + + + + IP6_DEBUG + LWIP_DBG_OFF + + + +IP6_DEBUG: Enable debugging for IPv6. + + + + + + + IP6_FRAG_STATS + (LWIP_IPV6 && (LWIP_IPV6_FRAG || LWIP_IPV6_REASS)) + + + +IP6_FRAG_STATS==1: Enable IPv6 fragmentation stats. + + + + + + + IP6_STATS + (LWIP_IPV6) + + + +IP6_STATS==1: Enable IPv6 stats. + + + + + + + IP_DEBUG + LWIP_DBG_OFF + + + +IP_DEBUG: Enable debugging for IP. + + + + + + + IP_DEFAULT_TTL 255 +IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers. + + + + + + + IP_FORWARD + 0 + + + +IP_FORWARD==1: Enables the ability to forward IP packets across network interfaces. If you are going to run lwIP on a device with only one network interface, define this to 0. + + + + + + + IP_FORWARD_ALLOW_TX_ON_RX_NETIF + 0 + + + +IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1: allow ip_forward() to send packets back out on the netif where it was received. This should only be used for wireless networks. ATTENTION: When this is 1, make sure your netif driver correctly marks incoming link-layer-broadcast/multicast packets as such using the corresponding pbuf flags! + + + + + + + IP_FRAG + 1 + + + +IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note that this option does not affect incoming packet sizes, which can be controlled via IP_REASSEMBLY. + + + + + + + IP_OPTIONS_ALLOWED + 1 + + + +IP_OPTIONS_ALLOWED: Defines the behavior for IP options. IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped. IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed). + + + + + + + IP_REASS_DEBUG + LWIP_DBG_OFF + + + +IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass. + + + + + + + IP_REASS_MAX_PBUFS + 10 + + + +IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. Since the received pbufs are enqueued, be sure to configure PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive packets even if the maximum amount of fragments is enqueued for reassembly! + + + + + + + IP_REASS_MAXAGE + 3 + + + +IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived in this time, the whole packet is discarded. + + + + + + + IP_REASSEMBLY + 1 + + + +IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that this option does not affect outgoing packet sizes, which can be controlled via IP_FRAG. + + + + + + + IP_SOF_BROADCAST + 0 + + + +IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast filter per pcb on udp and raw send operations. To enable broadcast filter on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1. + + + + + + + IP_SOF_BROADCAST_RECV + 0 + + + +IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast filter on recv operations. + + + + + + + IP_STATS + 1 + + + +IP_STATS==1: Enable IP stats. + + + + + + + IPFRAG_STATS + (IP_REASSEMBLY || IP_FRAG) + + + +IPFRAG_STATS==1: Enable IP fragmentation stats. Default is on if using either frag or reass. + + + + + + + LINK_STATS + 1 + + + +LINK_STATS==1: Enable link stats. + + + + + + + LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + 0 + + + +Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from interrupt context (or another context that doesn't allow waiting for a semaphore). If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs with each loop so that mem_free can run. +ATTENTION: As you can see from the above description, this leads to dis-/ enabling interrupts often, which can be slow! Also, on low memory, mem_malloc can need longer. +If you don't want that, at least for NO_SYS=0, you can still use the following functions to enqueue a deallocation call which then runs in the tcpip_thread context: +pbuf_free_callback(p); +mem_free_callback(m); + + + + + + + + + LWIP_ARP + 1 + + + +LWIP_ARP==1: Enable ARP functionality. + + + + + + + LWIP_AUTOIP + 0 + + + +LWIP_AUTOIP==1: Enable AUTOIP module. + + + + + + + LWIP_BROADCAST_PING + 0 + + + +LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only) + + + + + + + LWIP_CALLBACK_API + 1 + + + - + - + + LWIP_CHECKSUM_CTRL_PER_NETIF + 0 + + + +LWIP_CHECKSUM_CTRL_PER_NETIF==1: Checksum generation/check can be enabled/disabled per netif. ATTENTION: if enabled, the CHECKSUM_GEN_* and CHECKSUM_CHECK_* defines must be enabled! + + + + + + + LWIP_CHECKSUM_ON_COPY + 0 + + + +LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from application buffers to pbufs. + + + + + + + LWIP_COMPAT_SOCKETS + 1 + + + +LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names through defines. LWIP_COMPAT_SOCKETS==2: Same as ==1 but correctly named functions are created. While this helps code completion, it might conflict with existing libraries. (only used if you use sockets.c) + + + + + + + LWIP_DBG_MIN_LEVEL + LWIP_DBG_LEVEL_ALL + + + +LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is compared against this value. If it is smaller, then debugging messages are written. LWIP_DBG_MIN_LEVEL and LWIP_DBG_TYPES_ON values + + + + + + + + + LWIP_DBG_TYPES_ON + LWIP_DBG_ON + + + +LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable debug messages of certain types. LWIP_DBG_MIN_LEVEL and LWIP_DBG_TYPES_ON values + + + + + + + + + LWIP_DHCP + 0 + + + +LWIP_DHCP==1: Enable DHCP module. + + + + + + + LWIP_DHCP_AUTOIP_COOP + 0 + + + +LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on the same interface at the same time. + + + + + + + LWIP_DHCP_AUTOIP_COOP_TRIES + 9 + + + +LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes that should be sent before falling back on AUTOIP (the DHCP client keeps running in this case). This can be set as low as 1 to get an AutoIP address very quickly, but you should be prepared to handle a changing IP address when DHCP overrides AutoIP. + + + + + + + LWIP_DHCP_BOOTP_FILE + 0 + + + +LWIP_DHCP_BOOTP_FILE==1: Store offered_si_addr and boot_file_name. + + + + + + + LWIP_DHCP_CHECK_LINK_UP + 0 + + + +LWIP_DHCP_CHECK_LINK_UP==1: dhcp_start() only really starts if the netif has NETIF_FLAG_LINK_UP set in its flags. As this is only an optimization and netif drivers might not set this flag, the default is off. If enabled, netif_set_link_up() must be called to continue dhcp starting. + + + + + + + LWIP_DHCP_GET_NTP_SRV + 0 + + + +LWIP_DHCP_GETS_NTP==1: Request NTP servers with discover/select. For each response packet, an callback is called, which has to be provided by the port: void dhcp_set_ntp_servers(u8_t num_ntp_servers, ip_addr_t* ntp_server_addrs); + + + + + + + LWIP_DHCP_MAX_DNS_SERVERS + DNS_MAX_SERVERS + + + +LWIP_DHCP_MAX_DNS_SERVERS > 0: Request DNS servers with discover/select. DHCP servers received in the response are passed to DNS via dns_setserver() (up to the maximum limit defined here). + + + + + + + LWIP_DHCP_MAX_NTP_SERVERS + 1 + + + +The maximum of NTP servers requested + + + + + + + LWIP_DNS + 0 + + + +LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS transport. + + + + + + + LWIP_DNS_SECURE + (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) + + + +LWIP_DNS_SECURE: controls the security level of the DNS implementation Use all DNS security features by default. This is overridable but should only be needed by very small targets or when using against non standard DNS servers. + + + + + + + LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING + 2 + + + + + + + + + + LWIP_DNS_SECURE_RAND_SRC_PORT + 4 + + + + + + + + + + LWIP_DNS_SECURE_RAND_XID + 1 + + + + + + + + + + LWIP_DNS_SUPPORT_MDNS_QUERIES + 0 + + + +Set this to 1 to enable querying ".local" names via mDNS using a One-Shot Multicast DNS Query + + + + + + + LWIP_ETHERNET + LWIP_ARP + + + +LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled + + + + + + + LWIP_EVENT_API + 0 + + + +LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1. LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all events (accept, sent, etc) that happen in the system. LWIP_CALLBACK_API==1: The PCB callback function is called directly for the event. This is the default. + + + + + + + LWIP_FIONREAD_LINUXMODE + 0 + + + +LWIP_FIONREAD_LINUXMODE==0 (default): ioctl/FIONREAD returns the amount of pending data in the network buffer. This is the way windows does it. It's the default for lwIP since it is smaller. LWIP_FIONREAD_LINUXMODE==1: ioctl/FIONREAD returns the size of the next pending datagram in bytes. This is the way linux does it. This code is only here for compatibility. + + + + + + + LWIP_HAVE_LOOPIF + LWIP_NETIF_LOOPBACK + + + +LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1). This is only needed when no real netifs are available. If at least one other netif is available, loopback traffic uses this netif. + + + + + + + LWIP_ICMP + 1 + + + +LWIP_ICMP==1: Enable ICMP module inside the IP stack. Be careful, disable that make your product non-compliant to RFC1122 + + + + + + + LWIP_ICMP6 + (LWIP_IPV6) + + + +LWIP_ICMP6==1: Enable ICMPv6 (mandatory per RFC) + + + + + + + LWIP_ICMP6_DATASIZE + 8 + + + +LWIP_ICMP6_DATASIZE: bytes from original packet to send back in ICMPv6 error messages. + + + + + + + LWIP_ICMP6_HL + 255 + + + +LWIP_ICMP6_HL: default hop limit for ICMPv6 messages + + + + + + + LWIP_IGMP + 0 + + + +LWIP_IGMP==1: Turn on IGMP module. + + + + + + + LWIP_IPV4 + 1 + + + +LWIP_IPV4==1: Enable IPv4 + + + + + + + LWIP_IPV6 + 0 + + + +LWIP_IPV6==1: Enable IPv6 + + + + + + + LWIP_IPV6_AUTOCONFIG + (LWIP_IPV6) + + + +LWIP_IPV6_AUTOCONFIG==1: Enable stateless address autoconfiguration as per RFC 4862. + + + + + + + LWIP_IPV6_DHCP6 + 0 + + + +LWIP_IPV6_DHCP6==1: enable DHCPv6 stateful address autoconfiguration. + + + + + + + LWIP_IPV6_DUP_DETECT_ATTEMPTS + 1 + + + +LWIP_IPV6_DUP_DETECT_ATTEMPTS=[0..7]: Number of duplicate address detection attempts. + + + + + + + LWIP_IPV6_FORWARD + 0 + + + +LWIP_IPV6_FORWARD==1: Forward IPv6 packets across netifs + + + + + + + LWIP_IPV6_FRAG + 0 + + + +LWIP_IPV6_FRAG==1: Fragment outgoing IPv6 packets that are too big. + + + + + + + LWIP_IPV6_MLD + (LWIP_IPV6) + + + +LWIP_IPV6_MLD==1: Enable multicast listener discovery protocol. If LWIP_IPV6 is enabled but this setting is disabled, the MAC layer must indiscriminately pass all inbound IPv6 multicast traffic to lwIP. + + + + + + + LWIP_IPV6_NUM_ADDRESSES + 3 + + + +LWIP_IPV6_NUM_ADDRESSES: Number of IPv6 addresses per netif. + + + + + + + LWIP_IPV6_REASS + (LWIP_IPV6) + + + +LWIP_IPV6_REASS==1: reassemble incoming IPv6 packets that fragmented + + + + + + + LWIP_IPV6_SEND_ROUTER_SOLICIT + 1 + + + +LWIP_IPV6_SEND_ROUTER_SOLICIT==1: Send router solicitation messages during network startup. + + + + + + + LWIP_LOOPBACK_MAX_PBUFS + 0 + + + +LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback sending for each netif (0 = disabled) + + + + + + + LWIP_LOOPIF_MULTICAST + 0 + + + +LWIP_LOOPIF_MULTICAST==1: Support multicast/IGMP on loop interface (127.0.0.1). + + + + + + + LWIP_MIB2_CALLBACKS + 0 + + + +LWIP_MIB2_CALLBACKS==1: Turn on SNMP MIB2 callbacks. Turn this on to get callbacks needed to implement MIB2. Usually MIB2_STATS should be enabled, too. + + + + + + + LWIP_MPU_COMPATIBLE + 0 + + + +LWIP_MPU_COMPATIBLE: enables special memory management mechanism which makes lwip able to work on MPU (Memory Protection Unit) system by not passing stack-pointers to other threads (this decreases performance as memory is allocated from pools instead of keeping it on the stack) + + + + + + + LWIP_MULTICAST_PING + 0 + + + +LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only) + + + + + + + LWIP_MULTICAST_TX_OPTIONS + (LWIP_IGMP && LWIP_UDP) + + + +LWIP_MULTICAST_TX_OPTIONS==1: Enable multicast TX support like the socket options IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP + + + + + + + LWIP_ND6_ALLOW_RA_UPDATES + 1 + + + +LWIP_ND6_ALLOW_RA_UPDATES==1: Allow Router Advertisement messages to update Reachable time and retransmission timers, and netif MTU. + + + + + + + LWIP_ND6_DELAY_FIRST_PROBE_TIME + 5000 + + + +LWIP_ND6_DELAY_FIRST_PROBE_TIME: Delay before first unicast neighbor solicitation message is sent, during neighbor reachability detection. + + + + + + + LWIP_ND6_MAX_ANYCAST_DELAY_TIME + 1000 + + + +Unused: See ND RFC (time in milliseconds). + + + + + + + LWIP_ND6_MAX_MULTICAST_SOLICIT + 3 + + + +LWIP_ND6_MAX_MULTICAST_SOLICIT: max number of multicast solicit messages to send (neighbor solicit and router solicit) + + + + + + + LWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT + 3 + + + +Unused: See ND RFC + + + + + + + LWIP_ND6_MAX_UNICAST_SOLICIT + 3 + + + +LWIP_ND6_MAX_UNICAST_SOLICIT: max number of unicast neighbor solicitation messages to send during neighbor reachability detection. + + + + + + + LWIP_ND6_NUM_DESTINATIONS + 10 + + + +LWIP_ND6_NUM_DESTINATIONS: number of entries in IPv6 destination cache + + + + + + + LWIP_ND6_NUM_NEIGHBORS + 10 + + + +LWIP_ND6_NUM_NEIGHBORS: Number of entries in IPv6 neighbor cache + + + + + + + LWIP_ND6_NUM_PREFIXES + 5 + + + +LWIP_ND6_NUM_PREFIXES: number of entries in IPv6 on-link prefixes cache + + + + + + + LWIP_ND6_NUM_ROUTERS + 3 + + + +LWIP_ND6_NUM_ROUTERS: number of entries in IPv6 default router cache + + + + + + + LWIP_ND6_QUEUEING + (LWIP_IPV6) + + + +LWIP_ND6_QUEUEING==1: queue outgoing IPv6 packets while MAC address is being resolved. + + + + + + + LWIP_ND6_RDNSS_MAX_DNS_SERVERS + 0 + + + +LWIP_ND6_RDNSS_MAX_DNS_SERVERS > 0: Use IPv6 Router Advertisement Recursive DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS servers to the DNS module. + + + + + + + LWIP_ND6_REACHABLE_TIME + 30000 + + + +LWIP_ND6_REACHABLE_TIME: default neighbor reachable time (in milliseconds). May be updated by router advertisement messages. + + + + + + + LWIP_ND6_RETRANS_TIMER + 1000 + + + +LWIP_ND6_RETRANS_TIMER: default retransmission timer for solicitation messages + + + + + + + LWIP_ND6_TCP_REACHABILITY_HINTS + 1 + + + +LWIP_ND6_TCP_REACHABILITY_HINTS==1: Allow TCP to provide Neighbor Discovery with reachability hints for connected destinations. This helps avoid sending unicast neighbor solicitation messages. + + + + + + + LWIP_NETBUF_RECVINFO + 0 + + + +LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf. + + + + + + + LWIP_NETCONN + 1 + + + +LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) + + + + + + + LWIP_NETCONN_FULLDUPLEX + 0 + + + +LWIP_NETCONN_FULLDUPLEX==1: Enable code that allows reading from one thread, writing from a 2nd thread and closing from a 3rd thread at the same time. ATTENTION: This is currently really alpha! Some requirements: +LWIP_NETCONN_SEM_PER_THREAD==1 is required to use one socket/netconn from multiple threads at once +sys_mbox_free() has to unblock receive tasks waiting on recvmbox/acceptmbox and prevent a task pending on this during/after deletion + + + + + + + + + LWIP_NETCONN_SEM_PER_THREAD + 0 + + + +LWIP_NETCONN_SEM_PER_THREAD==1: Use one (thread-local) semaphore per thread calling socket/netconn functions instead of allocating one semaphore per netconn (and per select etc.) ATTENTION: a thread-local semaphore for API calls is needed: +LWIP_NETCONN_THREAD_SEM_GET() returning a sys_sem_t* +LWIP_NETCONN_THREAD_SEM_ALLOC() creating the semaphore +LWIP_NETCONN_THREAD_SEM_FREE() freeing the semaphore The latter 2 can be invoked up by calling netconn_thread_init()/netconn_thread_cleanup(). Ports may call these for threads created with sys_thread_new(). + + + + + + + + + LWIP_NETIF_API + 0 + + + +LWIP_NETIF_API==1: Support netif api (in netifapi.c) + + + + + + + LWIP_NETIF_HOSTNAME + 0 + + + +LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname field. + + + + + + + LWIP_NETIF_HWADDRHINT + 0 + + + +LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table indices) in struct netif. TCP and UDP can make use of this to prevent scanning the ARP table for every sent packet. While this is faster for big ARP tables or many concurrent connections, it might be counterproductive if you have a tiny ARP table or if there never are concurrent connections. + + + + + + + LWIP_NETIF_LINK_CALLBACK + 0 + + + +LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface whenever the link changes (i.e., link down) + + + + + + + LWIP_NETIF_LOOPBACK + 0 + + + +LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP address equal to the netif IP address, looping them back up the stack. + + + + + + + LWIP_NETIF_LOOPBACK_MULTITHREADING + (!NO_SYS) + + + +LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in the system, as netifs must change how they behave depending on this setting for the LWIP_NETIF_LOOPBACK option to work. Setting this is needed to avoid reentering non-reentrant functions like tcp_input(). LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a multithreaded environment like tcpip.c. In this case, netif->input() is called directly. LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. The packets are put on a list and netif_poll() must be called in the main application loop. + + + + + + + LWIP_NETIF_REMOVE_CALLBACK + 0 + + + +LWIP_NETIF_REMOVE_CALLBACK==1: Support a callback function that is called when a netif has been removed + + + + + + + LWIP_NETIF_STATUS_CALLBACK + 0 + + + +LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface changes its up/down status (i.e., due to DHCP IP acquisition) + + + + + + + LWIP_NETIF_TX_SINGLE_PBUF + 0 + + + +LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data to be sent into one single pbuf. This is for compatibility with DMA-enabled MACs that do not support scatter-gather. Beware that this might involve CPU-memcpy before transmitting that would not be needed without this flag! Use this only if you need to! +Todo: TCP and IP-frag do not work with this, yet: + + + + + + + + LWIP_NUM_NETIF_CLIENT_DATA + 0 + + + +LWIP_NUM_NETIF_CLIENT_DATA: Number of clients that may store data in client_data member array of struct netif. + + + + + + + LWIP_PERF + 0 + + + +LWIP_PERF: Enable performance testing for lwIP (if enabled, arch/perf.h is included) + + + + + + + LWIP_POSIX_SOCKETS_IO_NAMES + 1 + + + +LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names. Disable this option if you use a POSIX operating system that uses the same names (read, write & close). (only used if you use sockets.c) + + + + + + + LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS + 0 + + + +LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: randomize the local port for the first local TCP/UDP pcb (default==0). This can prevent creating predictable port numbers after booting a device. + + + + + + + LWIP_RAW + 0 + + + +LWIP_RAW==1: Enable application layer to hook into the IP layer itself. + + + + + + + LWIP_SO_LINGER + 0 + + + +LWIP_SO_LINGER==1: Enable SO_LINGER processing. + + + + + + + LWIP_SO_RCVBUF + 0 + + + +LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. + + + + + + + LWIP_SO_RCVTIMEO + 0 + + + +LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and SO_RCVTIMEO processing. + + + + + + + LWIP_SO_SNDRCVTIMEO_NONSTANDARD + 0 + + + +LWIP_SO_SNDRCVTIMEO_NONSTANDARD==1: SO_RCVTIMEO/SO_SNDTIMEO take an int (milliseconds, much like winsock does) instead of a struct timeval (default). + + + + + + + LWIP_SO_SNDTIMEO + 0 + + + +LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and SO_SNDTIMEO processing. + + + + + + + LWIP_SOCKET + 1 + + + +LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) + + + + + + + LWIP_SOCKET_OFFSET + 0 + + + +LWIP_SOCKET_OFFSET==n: Increases the file descriptor number created by LwIP with n. This can be useful when there are multiple APIs which create file descriptors. When they all start with a different offset and you won't make them overlap you can re implement read/write/close/ioctl/fnctl to send the requested action to the right library (sharing select will need more work though). + + + + + + + LWIP_SOCKET_SET_ERRNO + 1 + + + + + + + + + + LWIP_STATS + 1 + + + +LWIP_STATS==1: Enable statistics collection in lwip_stats. + + + + + + + LWIP_STATS_DISPLAY + 0 + + + +LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. + + + + + + LWIP_TCP 1 +LWIP_TCP==1: Turn on TCP. - + - + + LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT + 20000 + + + +By default, TCP socket/netconn close waits 20 seconds max to send the FIN + + + + + + + LWIP_TCP_KEEPALIVE + 0 + + + +LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set in seconds. (does not require sockets.c, and will affect tcp.c) + + + + + + + LWIP_TCP_TIMESTAMPS + 0 + + + +LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option. The timestamp option is currently only used to help remote hosts, it is not really used locally. Therefore, it is only enabled when a TS option is received in the initial SYN packet from a remote host. + + + + + + + LWIP_TCPIP_CORE_LOCKING + 1 + + + +LWIP_TCPIP_CORE_LOCKING Creates a global mutex that is held during TCPIP thread operations. Can be locked by client code to perform lwIP operations without changing into TCPIP thread using callbacks. See LOCK_TCPIP_CORE() and UNLOCK_TCPIP_CORE(). Your system should provide mutexes supporting priority inversion to use this. + + + + + + + LWIP_TCPIP_CORE_LOCKING_INPUT + 0 + + + +LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled, this lets tcpip_input() grab the mutex for input packets as well, instead of allocating a message and passing it to tcpip_thread. +ATTENTION: this does not work when tcpip_input() is called from interrupt context! + + + + + + + LWIP_TCPIP_THREAD_ALIVE + + + + +Define this to something that triggers a watchdog. This is called from tcpip_thread after processing a message. + + + + + + + LWIP_TCPIP_TIMEOUT + 0 + + + +LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout to create timers running in tcpip_thread from another thread. + + + + + + + LWIP_TIMERS + 1 + + + +LWIP_TIMERS==0: Drop support for sys_timeout and lwip-internal cyclic timers. (the array of lwip-internal cyclic timers is still provided) (check NO_SYS_NO_TIMERS for compatibility to old versions) + + + + + + + LWIP_TIMERS_CUSTOM + 0 + + + +LWIP_TIMERS_CUSTOM==1: Provide your own timer implementation. Function prototypes in timeouts.h and the array of lwip-internal cyclic timers are still included, but the implementation is not. The following functions will be required: sys_timeouts_init(), sys_timeout(), sys_untimeout(), sys_timeouts_mbox_fetch() + + + + + + LWIP_UDP 1 +LWIP_UDP==1: Turn on UDP. - + - + + LWIP_UDPLITE + 0 + + + +LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP) + + + + + + + LWIP_WND_SCALE + 0 + + + +LWIP_WND_SCALE and TCP_RCV_SCALE: Set LWIP_WND_SCALE to 1 to enable window scaling. Set TCP_RCV_SCALE to the desired scaling factor (shift count in the range of [0..14]). When LWIP_WND_SCALE is enabled but TCP_RCV_SCALE is 0, we can use a large send window while having a small receive window only. + + + + + + MEM_ALIGNMENT 1 +MEM_ALIGNMENT: should be set to the alignment of the CPU 4 byte alignment -> #define MEM_ALIGNMENT 4 2 byte alignment -> #define MEM_ALIGNMENT 2 - + - + + MEM_DEBUG + LWIP_DBG_OFF + + + +MEM_DEBUG: Enable debugging in mem.c. + + + + + + + MEM_LIBC_MALLOC + 0 + + + +MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library instead of the lwip internal allocator. Can save code size if you already use it. + + + + + + + MEM_SIZE + 1600 + + + +MEM_SIZE: the size of the heap memory. If the application will send a lot of data that needs to be copied, this should be set high. + + + + + + + MEM_STATS + ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0)) + + + +MEM_STATS==1: Enable mem.c stats. + + + + + + + MEM_USE_POOLS + 0 + + + +MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set of memory pools of various sizes. When mem_malloc is called, an element of the smallest pool that can provide the length needed is returned. To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled. + + + + + + + MEM_USE_POOLS_TRY_BIGGER_POOL + 0 + + + +MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more reliable. + + + + + + + MEMCPY + dst + src + len + memcpy(dst,src,len) + + + +MEMCPY: override this if you have a faster implementation at hand than the one included in your C library + + + + + + + MEMP_DEBUG + LWIP_DBG_OFF + + + +MEMP_DEBUG: Enable debugging in memp.c. + + + + + + + MEMP_MEM_MALLOC + 0 + + + +MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution speed (heap alloc can be much slower than pool alloc) and usage from interrupts (especially if your netif driver allocates PBUF_POOL pbufs for received frames from interrupt)! ATTENTION: Currently, this uses the heap for ALL pools (also for private pools, not only for internal pools defined in memp_std.h)! + + + + + + + MEMP_NUM_API_MSG + MEMP_NUM_TCPIP_MSG_API + + + +MEMP_NUM_API_MSG: the number of concurrently active calls to various socket, netconn, and tcpip functions + + + + + + + MEMP_NUM_ARP_QUEUE + 30 + + + +MEMP_NUM_ARP_QUEUE: the number of simultaneously queued outgoing packets (pbufs) that are waiting for an ARP request (to resolve their destination address) to finish. (requires the ARP_QUEUEING option) + + + + + + + MEMP_NUM_DNS_API_MSG + MEMP_NUM_TCPIP_MSG_API + + + +MEMP_NUM_DNS_API_MSG: the number of concurrently active calls to netconn_gethostbyname + + + + + + + MEMP_NUM_FRAG_PBUF + 15 + + + +MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent (fragments, not whole packets!). This is only used with LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1 with DMA-enabled MACs where the packet is not yet sent when netif->output returns. + + + + + + + MEMP_NUM_IGMP_GROUP + 8 + + + +MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces can be members at the same time (one per netif - allsystems group -, plus one per netif membership). (requires the LWIP_IGMP option) + + + + + + + MEMP_NUM_LOCALHOSTLIST + 1 + + + +MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1. + + + + + + + MEMP_NUM_MLD6_GROUP + 4 + + + +MEMP_NUM_MLD6_GROUP: Max number of IPv6 multicast groups that can be joined. There must be enough groups so that each netif can join the solicited-node multicast group for each of its local addresses, plus one for MDNS if applicable, plus any number of groups to be joined on UDP sockets. + + + + + + + MEMP_NUM_ND6_QUEUE + 20 + + + +MEMP_NUM_ND6_QUEUE: Max number of IPv6 packets to queue during MAC resolution. + + + + + + + MEMP_NUM_NETBUF + 2 + + + +MEMP_NUM_NETBUF: the number of struct netbufs. (only needed if you use the sequential API, like api_lib.c) + + + + + + + MEMP_NUM_NETCONN + 4 + + + +MEMP_NUM_NETCONN: the number of struct netconns. (only needed if you use the sequential API, like api_lib.c) + + + + + + + MEMP_NUM_NETDB + 1 + + + +MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls (before freeing the corresponding memory using lwip_freeaddrinfo()). + + + + + + + MEMP_NUM_NETIFAPI_MSG + MEMP_NUM_TCPIP_MSG_API + + + +MEMP_NUM_NETIFAPI_MSG: the number of concurrently active calls to the netifapi functions + + + + + + + MEMP_NUM_PBUF + 16 + + + +MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). If the application sends a lot of data out of ROM (or other static memory), this should be set high. + + + + + + + MEMP_NUM_RAW_PCB + 4 + + + +MEMP_NUM_RAW_PCB: Number of raw connection PCBs (requires the LWIP_RAW option) + + + + + + + MEMP_NUM_REASSDATA + 5 + + + +MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for reassembly (whole packets, not fragments!) + + + + + + + MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA + MEMP_NUM_TCPIP_MSG_API + + + +MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA: the number of concurrently active calls to getsockopt/setsockopt + + + + + + + MEMP_NUM_SYS_TIMEOUT + (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (PPP_SUPPORT*6*MEMP_NUM_PPP_PCB) + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0)) + + + +MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts. The default number of timeouts is calculated here for all enabled modules. The formula expects settings to be either '0' or '1'. + + + + + + + MEMP_NUM_TCP_PCB + 5 + + + +MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections. (requires the LWIP_TCP option) + + + + + + + MEMP_NUM_TCP_PCB_LISTEN + 8 + + + +MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. (requires the LWIP_TCP option) + + + + + + + MEMP_NUM_TCP_SEG + 16 + + + +MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. (requires the LWIP_TCP option) + + + + + + + MEMP_NUM_TCPIP_MSG_API + 8 + + + +MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used for callback/timeout API communication. (only needed if you use tcpip.c) + + + + + + + MEMP_NUM_TCPIP_MSG_INPKT + 8 + + + +MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used for incoming packets. (only needed if you use tcpip.c) + + + + + + + MEMP_NUM_UDP_PCB + 4 + + + +MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One per active UDP "connection". (requires the LWIP_UDP option) + + + + + + + MEMP_OVERFLOW_CHECK + 0 + + + +MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable amount of bytes before and after each memp element in every pool and fills it with a prominent default value. MEMP_OVERFLOW_CHECK == 0 no checking MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time memp_malloc() or memp_free() is called (useful but slow!) + + + + + + + MEMP_SANITY_CHECK + 0 + + + +MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make sure that there are no cycles in the linked lists. + + + + + + + MEMP_STATS + (MEMP_MEM_MALLOC == 0) + + + +MEMP_STATS==1: Enable memp.c pool stats. + + + + + + + MEMP_USE_CUSTOM_POOLS + 0 + + + +MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h that defines additional pools beyond the "standard" ones required by lwIP. If you set this to 1, you must have lwippools.h in your include path somewhere. + + + + + + + MIB2_STATS + 0 + + + +MIB2_STATS==1: Stats for SNMP MIB2. + + + + + + + MLD6_STATS + (LWIP_IPV6 && LWIP_IPV6_MLD) + + + +MLD6_STATS==1: Enable MLD for IPv6 stats. + + + + + + + ND6_STATS + (LWIP_IPV6) + + + +ND6_STATS==1: Enable Neighbor discovery for IPv6 stats. + + + + + + + NETIF_DEBUG + LWIP_DBG_OFF + + + +NETIF_DEBUG: Enable debugging in netif.c. + + + + + + + NO_SYS + 0 + + + +NO_SYS==1: Use lwIP without OS-awareness (no thread, semaphores, mutexes or mboxes). This means threaded APIs cannot be used (socket, netconn, i.e. everything in the 'api' folder), only the callback-style raw API is available (and you have to watch out for yourself that you don't access lwIP functions/structures from more than one context at a time!) + + + + + + + PBUF_DEBUG + LWIP_DBG_OFF + + + +PBUF_DEBUG: Enable debugging in pbuf.c. + + + + + + + PBUF_LINK_ENCAPSULATION_HLEN + 0u + + + +PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated for an additional encapsulation header before ethernet headers (e.g. 802.11) + + + + + + PBUF_LINK_HLEN + (14 + ETH_PAD_SIZE) + + + +PBUF_LINK_HLEN: the number of bytes that should be allocated for a link level header. The default is 14, the standard value for Ethernet. + + + + + + + PBUF_POOL_BUFSIZE + LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + + + +PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is designed to accommodate single full size TCP frame in one pbuf, including TCP_MSS, IP header, and link header. + + + + + + + PBUF_POOL_SIZE + 16 + + + +PBUF_POOL_SIZE: the number of buffers in the pbuf pool. + + + + + + + RAW_DEBUG + LWIP_DBG_OFF + + + +RAW_DEBUG: Enable debugging in raw.c. + + + + + + + RAW_TTL + (IP_DEFAULT_TTL) + + + +LWIP_RAW==1: Enable application layer to hook into the IP layer itself. + + + + + + + RECV_BUFSIZE_DEFAULT + INT_MAX + + + +If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize. + + + + + + + SLIP_DEBUG + LWIP_DBG_OFF + + + +SLIP_DEBUG: Enable debugging in slipif.c. + + + + + + + SLIPIF_THREAD_NAME + "slipif_loop" + + + +SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread. + + + + + + + SLIPIF_THREAD_PRIO + 1 + + + +SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created. + + + + + + + SLIPIF_THREAD_STACKSIZE + 0 + + + +SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created. + + + + + + + SMEMCPY + dst + src + len + memcpy(dst,src,len) + + + +SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a call to memcpy() if the length is known at compile time and is small. + + + + + + + SO_REUSE + 0 + + + +SO_REUSE==1: Enable SO_REUSEADDR option. + + + + + + + SO_REUSE_RXTOALL + 0 + + + +SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets to all local matches if SO_REUSEADDR is turned on. WARNING: Adds a memcpy for every packet if passing to more than one pcb! + + + + + + + SOCKETS_DEBUG + LWIP_DBG_OFF + + + +SOCKETS_DEBUG: Enable debugging in sockets.c. + + + + + + + SYS_DEBUG + LWIP_DBG_OFF + + + +SYS_DEBUG: Enable debugging in sys.c. + + + + + + + SYS_LIGHTWEIGHT_PROT + 1 + + + +SYS_LIGHTWEIGHT_PROT==1: enable inter-task protection (and task-vs-interrupt protection) for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation. ATTENTION: This is required when using lwIP from more than one context! If you disable this, you must be sure what you are doing! + + + + + + + SYS_STATS + (NO_SYS == 0) + + + +SYS_STATS==1: Enable system stats (sem and mbox counts, etc). + + + + + + + TCP_CALCULATE_EFF_SEND_MSS + 1 + + + +TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which reflects the available reassembly buffer size at the remote host) and the largest size permitted by the IP layer" (RFC 1122) Setting this to 1 enables code that checks TCP_MSS against the MTU of the netif used for a connection and limits the MSS if it would be too big otherwise. + + + + + + + TCP_CWND_DEBUG + LWIP_DBG_OFF + + + +TCP_CWND_DEBUG: Enable debugging for TCP congestion window. + + + + + + + TCP_DEBUG + LWIP_DBG_OFF + + + +TCP_DEBUG: Enable debugging for TCP. + + + + + + + TCP_DEFAULT_LISTEN_BACKLOG + 0xff + + + +The maximum allowed backlog for TCP listen netconns. This backlog is used unless another is explicitly specified. 0xff is the maximum (u8_t). + + + + + + + TCP_FR_DEBUG + LWIP_DBG_OFF + + + +TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit. + + + + + + + TCP_INPUT_DEBUG + LWIP_DBG_OFF + + + +TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug. + + + + + + + TCP_LISTEN_BACKLOG + 0 + + + +TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb. + + + + + + + TCP_MAXRTX + 12 + + + +TCP_MAXRTX: Maximum number of retransmissions of data segments. + + + + + + + TCP_MSS + 536 + + + +TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default, you might want to increase this.) For the receive side, this MSS is advertised to the remote side when opening a connection. For the transmit size, this MSS sets an upper limit on the MSS advertised by the remote host. + + + + + + + TCP_OOSEQ_MAX_BYTES + 0 + + + +TCP_OOSEQ_MAX_BYTES: The maximum number of bytes queued on ooseq per pcb. Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1. + + + + + + + TCP_OOSEQ_MAX_PBUFS + 0 + + + +TCP_OOSEQ_MAX_PBUFS: The maximum number of pbufs queued on ooseq per pcb. Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1. + + + + + + + TCP_OUTPUT_DEBUG + LWIP_DBG_OFF + + + +TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions. + + + + + + + TCP_OVERSIZE + TCP_MSS + + + +TCP_OVERSIZE: The maximum number of bytes that tcp_write may allocate ahead of time in an attempt to create shorter pbuf chains for transmission. The meaningful range is 0 to TCP_MSS. Some suggested values are: +0: Disable oversized allocation. Each tcp_write() allocates a new pbuf (old behaviour). 1: Allocate size-aligned pbufs with minimal excess. Use this if your scatter-gather DMA requires aligned fragments. 128: Limit the pbuf/memory overhead to 20%. TCP_MSS: Try to create unfragmented TCP packets. TCP_MSS/4: Try to create 4 fragments or less per TCP packet. + + + + + + + TCP_QLEN_DEBUG + LWIP_DBG_OFF + + + +TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths. + + + + + + + TCP_QUEUE_OOSEQ + (LWIP_TCP) + + + +TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order. Define to 0 if your device is low on memory. + + + + + + + TCP_RCV_SCALE 0 @@ -332,95 +4750,259 @@ - + - - PBUF_POOL_BUFSIZE - 128 + + TCP_RST_DEBUG + LWIP_DBG_OFF +TCP_RST_DEBUG: Enable debugging for TCP with the RST message. - + - - PBUF_POOL_SIZE - 16 + + TCP_RTO_DEBUG + LWIP_DBG_OFF +TCP_RTO_DEBUG: Enable debugging in TCP for retransmit timeout. - + - - TCP_MAXRTX - 12 + + TCP_SND_BUF + (2 * TCP_MSS) +TCP_SND_BUF: TCP sender buffer space (bytes). To achieve good performance, this should be at least 2 * TCP_MSS. - + - - TCP_MSS - 128 + + TCP_SND_QUEUELEN + ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS)) +TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. - + - + + TCP_SNDLOWAT + LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) + + + +TCP_SNDLOWAT: TCP writable space (bytes). This must be less than TCP_SND_BUF. It is the amount of space which must be available in the TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT). + + + + + + + TCP_SNDQUEUELOWAT + LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5) + + + +TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be less than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below this number, select returns writable (combined with TCP_SNDLOWAT). + + + + + + + TCP_STATS + (LWIP_TCP) + + + +TCP_STATS==1: Enable TCP stats. Default is on if TCP enabled, otherwise off. + + + + + + TCP_SYNMAXRTX 6 +TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments. - + - + TCP_TTL - 255 + (IP_DEFAULT_TTL) +TCP_TTL: Default Time-To-Live value. - + - + TCP_WND - 2048 + (4 * TCP_MSS) +TCP_WND: The size of a TCP window. This must be at least (2 * TCP_MSS) for things to work well. ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size with scaling applied. Maximum window value in the TCP header will be TCP_WND >> TCP_RCV_SCALE - + - - UDP_TTL - 255 + + TCP_WND_DEBUG + LWIP_DBG_OFF +TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating. - + + + + TCP_WND_UPDATE_THRESHOLD + LWIP_MIN((TCP_WND / 4), (TCP_MSS * 4)) + + + +TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an explicit window update + + + + + + + TCPIP_DEBUG + LWIP_DBG_OFF + + + +TCPIP_DEBUG: Enable debugging in tcpip.c. + + + + + + + TCPIP_MBOX_SIZE + 0 + + + +TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages The queue size value itself is platform-dependent, but is passed to sys_mbox_new() when tcpip_init is called. + + + + + + + TCPIP_THREAD_NAME + "tcpip_thread" + + + +TCPIP_THREAD_NAME: The name assigned to the main tcpip thread. + + + + + + + TCPIP_THREAD_PRIO + 1 + + + +TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created. + + + + + + + TCPIP_THREAD_STACKSIZE + 0 + + + +TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created. + + + + + + + TIMERS_DEBUG + LWIP_DBG_OFF + + + +TIMERS_DEBUG: Enable debugging in timers.c. + + + + + + + UDP_DEBUG + LWIP_DBG_OFF + + + +UDP_DEBUG: Enable debugging in UDP. + + + + + + + UDP_STATS + (LWIP_UDP) + + + +UDP_STATS==1: Enable UDP stats. Default is on if UDP enabled, otherwise off. + + + + + + + UDP_TTL + (IP_DEFAULT_TTL) + + + +UDP_TTL: Default Time-To-Live value. + + + + @@ -429,103 +5011,1363 @@ /* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. * -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. * -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: opt_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_OPT_H__ -#define__LWIP_OPT_H__ - -#include"net/lwipopts.h" - -/*Definesomehandydefaultvaluesforconfigurationparameters.*/ - -#ifndefICMP_TTL -#defineICMP_TTL255 -#endif - -#ifndefUDP_TTL -#defineUDP_TTL255 -#endif - -#ifndefTCP_TTL -#defineTCP_TTL255 -#endif - -#ifndefTCP_MSS -#defineTCP_MSS128/*A*very*conservativedefault.*/ -#endif - -#ifndefTCP_WND -#defineTCP_WND2048 -#endif - -#ifndefTCP_MAXRTX -#defineTCP_MAXRTX12 -#endif - -#ifndefTCP_SYNMAXRTX -#defineTCP_SYNMAXRTX6 -#endif - -#ifndefMEM_ALIGNMENT -#defineMEM_ALIGNMENT1 -#endif - -#ifndefPBUF_POOL_SIZE -#definePBUF_POOL_SIZE16 -#endif - -#ifndefPBUF_POOL_BUFSIZE -#definePBUF_POOL_BUFSIZE128 -#endif - -#ifndefPBUF_LINK_HLEN -#definePBUF_LINK_HLEN0 -#endif - -#ifndefLWIP_UDP -#defineLWIP_UDP1 -#endif - -#ifndefLWIP_TCP -#defineLWIP_TCP1 -#endif - -#endif/*__LWIP_OPT_H__*/ - - - +*Author:AdamDunkels<adam@sics.se> +* +*/ + +/* +*NOTE:||defined__DOXYGEN__isaworkaroundfordoxygenbug- +*withoutthis,doxygendoesnotseetheactual#define +*/ + +#if!definedLWIP_HDR_OPT_H +#defineLWIP_HDR_OPT_H + +/* +*Includeuserdefinedoptionsfirst.Anythingnotdefinedinthesefiles +*willbesettostandardvalues.Overrideanythingyoudon'tlike! +*/ +#include<net/lwipopts.h> +#include<net/debug.h> + +#if!definedNO_SYS +#defineNO_SYS0 +#endif + +#if!definedLWIP_TIMERS +#ifdefNO_SYS_NO_TIMERS +#defineLWIP_TIMERS(!NO_SYS||(NO_SYS&&!NO_SYS_NO_TIMERS)) +#else +#defineLWIP_TIMERS1 +#endif +#endif + +#if!definedLWIP_TIMERS_CUSTOM +#defineLWIP_TIMERS_CUSTOM0 +#endif + +#if!definedMEMCPY +#defineMEMCPY(dst,src,len)memcpy(dst,src,len) +#endif + +#if!definedSMEMCPY +#defineSMEMCPY(dst,src,len)memcpy(dst,src,len) +#endif + +/* +------------------------------------ +-----------Corelocking----------- +------------------------------------ +*/ +#if!definedLWIP_MPU_COMPATIBLE +#defineLWIP_MPU_COMPATIBLE0 +#endif + +#if!definedLWIP_TCPIP_CORE_LOCKING +#defineLWIP_TCPIP_CORE_LOCKING1 +#endif + +#if!definedLWIP_TCPIP_CORE_LOCKING_INPUT||defined__DOXYGEN__ +#defineLWIP_TCPIP_CORE_LOCKING_INPUT0 +#endif + +#if!definedSYS_LIGHTWEIGHT_PROT||defined__DOXYGEN__ +#defineSYS_LIGHTWEIGHT_PROT1 +#endif + +/* +------------------------------------ +----------Memoryoptions---------- +------------------------------------ +*/ +#if!definedMEM_LIBC_MALLOC||defined__DOXYGEN__ +#defineMEM_LIBC_MALLOC0 +#endif + +#if!definedMEMP_MEM_MALLOC||defined__DOXYGEN__ +#defineMEMP_MEM_MALLOC0 +#endif + +#if!definedMEM_ALIGNMENT||defined__DOXYGEN__ +#defineMEM_ALIGNMENT1 +#endif + +#if!definedMEM_SIZE||defined__DOXYGEN__ +#defineMEM_SIZE1600 +#endif + +#if!definedMEMP_OVERFLOW_CHECK||defined__DOXYGEN__ +#defineMEMP_OVERFLOW_CHECK0 +#endif + +#if!definedMEMP_SANITY_CHECK||defined__DOXYGEN__ +#defineMEMP_SANITY_CHECK0 +#endif + +#if!definedMEM_USE_POOLS||defined__DOXYGEN__ +#defineMEM_USE_POOLS0 +#endif + +#if!definedMEM_USE_POOLS_TRY_BIGGER_POOL||defined__DOXYGEN__ +#defineMEM_USE_POOLS_TRY_BIGGER_POOL0 +#endif + +#if!definedMEMP_USE_CUSTOM_POOLS||defined__DOXYGEN__ +#defineMEMP_USE_CUSTOM_POOLS0 +#endif + +#if!definedLWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT||defined__DOXYGEN__ +#defineLWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT0 +#endif + +/* +------------------------------------------------ +----------InternalMemoryPoolSizes---------- +------------------------------------------------ +*/ +#if!definedMEMP_NUM_PBUF||defined__DOXYGEN__ +#defineMEMP_NUM_PBUF16 +#endif + +#if!definedMEMP_NUM_RAW_PCB||defined__DOXYGEN__ +#defineMEMP_NUM_RAW_PCB4 +#endif + +#if!definedMEMP_NUM_UDP_PCB||defined__DOXYGEN__ +#defineMEMP_NUM_UDP_PCB4 +#endif + +#if!definedMEMP_NUM_TCP_PCB||defined__DOXYGEN__ +#defineMEMP_NUM_TCP_PCB5 +#endif + +#if!definedMEMP_NUM_TCP_PCB_LISTEN||defined__DOXYGEN__ +#defineMEMP_NUM_TCP_PCB_LISTEN8 +#endif + +#if!definedMEMP_NUM_TCP_SEG||defined__DOXYGEN__ +#defineMEMP_NUM_TCP_SEG16 +#endif + +#if!definedMEMP_NUM_REASSDATA||defined__DOXYGEN__ +#defineMEMP_NUM_REASSDATA5 +#endif + +#if!definedMEMP_NUM_FRAG_PBUF||defined__DOXYGEN__ +#defineMEMP_NUM_FRAG_PBUF15 +#endif + +#if!definedMEMP_NUM_ARP_QUEUE||defined__DOXYGEN__ +#defineMEMP_NUM_ARP_QUEUE30 +#endif + +#if!definedMEMP_NUM_IGMP_GROUP||defined__DOXYGEN__ +#defineMEMP_NUM_IGMP_GROUP8 +#endif + +#if!definedMEMP_NUM_SYS_TIMEOUT||defined__DOXYGEN__ +#defineMEMP_NUM_SYS_TIMEOUT(LWIP_TCP+IP_REASSEMBLY+LWIP_ARP+(2*LWIP_DHCP)+LWIP_AUTOIP+LWIP_IGMP+LWIP_DNS+(PPP_SUPPORT*6*MEMP_NUM_PPP_PCB)+(LWIP_IPV6?(1+LWIP_IPV6_REASS+LWIP_IPV6_MLD):0)) +#endif + +#if!definedMEMP_NUM_NETBUF||defined__DOXYGEN__ +#defineMEMP_NUM_NETBUF2 +#endif + +#if!definedMEMP_NUM_NETCONN||defined__DOXYGEN__ +#defineMEMP_NUM_NETCONN4 +#endif + +#if!definedMEMP_NUM_TCPIP_MSG_API||defined__DOXYGEN__ +#defineMEMP_NUM_TCPIP_MSG_API8 +#endif + +#if!definedMEMP_NUM_TCPIP_MSG_INPKT||defined__DOXYGEN__ +#defineMEMP_NUM_TCPIP_MSG_INPKT8 +#endif + +#if!definedMEMP_NUM_NETDB||defined__DOXYGEN__ +#defineMEMP_NUM_NETDB1 +#endif + +#if!definedMEMP_NUM_LOCALHOSTLIST||defined__DOXYGEN__ +#defineMEMP_NUM_LOCALHOSTLIST1 +#endif + +#if!definedPBUF_POOL_SIZE||defined__DOXYGEN__ +#definePBUF_POOL_SIZE16 +#endif + +#if!definedMEMP_NUM_API_MSG||defined__DOXYGEN__ +#defineMEMP_NUM_API_MSGMEMP_NUM_TCPIP_MSG_API +#endif + +#if!definedMEMP_NUM_DNS_API_MSG||defined__DOXYGEN__ +#defineMEMP_NUM_DNS_API_MSGMEMP_NUM_TCPIP_MSG_API +#endif + +#if!definedMEMP_NUM_SOCKET_SETGETSOCKOPT_DATA||defined__DOXYGEN__ +#defineMEMP_NUM_SOCKET_SETGETSOCKOPT_DATAMEMP_NUM_TCPIP_MSG_API +#endif + +#if!definedMEMP_NUM_NETIFAPI_MSG||defined__DOXYGEN__ +#defineMEMP_NUM_NETIFAPI_MSGMEMP_NUM_TCPIP_MSG_API +#endif + +/* +--------------------------------- +----------ARPoptions---------- +--------------------------------- +*/ +#if!definedLWIP_ARP||defined__DOXYGEN__ +#defineLWIP_ARP1 +#endif + +#if!definedARP_TABLE_SIZE||defined__DOXYGEN__ +#defineARP_TABLE_SIZE10 +#endif + +#if!definedARP_MAXAGE||defined__DOXYGEN__ +#defineARP_MAXAGE300 +#endif + +#if!definedARP_QUEUEING||defined__DOXYGEN__ +#defineARP_QUEUEING0 +#endif + +#if!definedARP_QUEUE_LEN||defined__DOXYGEN__ +#defineARP_QUEUE_LEN3 +#endif + +#if!definedETHARP_SUPPORT_VLAN||defined__DOXYGEN__ +#defineETHARP_SUPPORT_VLAN0 +#endif + +#if!definedLWIP_ETHERNET||defined__DOXYGEN__ +#defineLWIP_ETHERNETLWIP_ARP +#endif + +#if!definedETH_PAD_SIZE||defined__DOXYGEN__ +#defineETH_PAD_SIZE0 +#endif + +#if!definedETHARP_SUPPORT_STATIC_ENTRIES||defined__DOXYGEN__ +#defineETHARP_SUPPORT_STATIC_ENTRIES0 +#endif + +#if!definedETHARP_TABLE_MATCH_NETIF||defined__DOXYGEN__ +#defineETHARP_TABLE_MATCH_NETIF0 +#endif + +/* +-------------------------------- +----------IPoptions---------- +-------------------------------- +*/ +#if!definedLWIP_IPV4||defined__DOXYGEN__ +#defineLWIP_IPV41 +#endif + +#if!definedIP_FORWARD||defined__DOXYGEN__ +#defineIP_FORWARD0 +#endif + +#if!definedIP_REASSEMBLY||defined__DOXYGEN__ +#defineIP_REASSEMBLY1 +#endif + +#if!definedIP_FRAG||defined__DOXYGEN__ +#defineIP_FRAG1 +#endif + +#if!LWIP_IPV4 +/*disableIPv4extensionswhenIPv4isdisabled*/ +#undefIP_FORWARD +#defineIP_FORWARD0 +#undefIP_REASSEMBLY +#defineIP_REASSEMBLY0 +#undefIP_FRAG +#defineIP_FRAG0 +#endif/*!LWIP_IPV4*/ + +#if!definedIP_OPTIONS_ALLOWED||defined__DOXYGEN__ +#defineIP_OPTIONS_ALLOWED1 +#endif + +#if!definedIP_REASS_MAXAGE||defined__DOXYGEN__ +#defineIP_REASS_MAXAGE3 +#endif + +#if!definedIP_REASS_MAX_PBUFS||defined__DOXYGEN__ +#defineIP_REASS_MAX_PBUFS10 +#endif + +#if!definedIP_DEFAULT_TTL||defined__DOXYGEN__ +#defineIP_DEFAULT_TTL255 +#endif + +#if!definedIP_SOF_BROADCAST||defined__DOXYGEN__ +#defineIP_SOF_BROADCAST0 +#endif + +#if!definedIP_SOF_BROADCAST_RECV||defined__DOXYGEN__ +#defineIP_SOF_BROADCAST_RECV0 +#endif + +#if!definedIP_FORWARD_ALLOW_TX_ON_RX_NETIF||defined__DOXYGEN__ +#defineIP_FORWARD_ALLOW_TX_ON_RX_NETIF0 +#endif + +#if!definedLWIP_RANDOMIZE_INITIAL_LOCAL_PORTS||defined__DOXYGEN__ +#defineLWIP_RANDOMIZE_INITIAL_LOCAL_PORTS0 +#endif + +/* +---------------------------------- +----------ICMPoptions---------- +---------------------------------- +*/ +#if!definedLWIP_ICMP||defined__DOXYGEN__ +#defineLWIP_ICMP1 +#endif + +#if!definedICMP_TTL||defined__DOXYGEN__ +#defineICMP_TTL(IP_DEFAULT_TTL) +#endif + +#if!definedLWIP_BROADCAST_PING||defined__DOXYGEN__ +#defineLWIP_BROADCAST_PING0 +#endif + +#if!definedLWIP_MULTICAST_PING||defined__DOXYGEN__ +#defineLWIP_MULTICAST_PING0 +#endif + +/* +--------------------------------- +----------RAWoptions---------- +--------------------------------- +*/ +#if!definedLWIP_RAW||defined__DOXYGEN__ +#defineLWIP_RAW0 +#endif + +#if!definedRAW_TTL||defined__DOXYGEN__ +#defineRAW_TTL(IP_DEFAULT_TTL) +#endif + +/* +---------------------------------- +----------DHCPoptions---------- +---------------------------------- +*/ +#if!definedLWIP_DHCP||defined__DOXYGEN__ +#defineLWIP_DHCP0 +#endif +#if!LWIP_IPV4 +/*disableDHCPwhenIPv4isdisabled*/ +#undefLWIP_DHCP +#defineLWIP_DHCP0 +#endif/*!LWIP_IPV4*/ + +#if!definedDHCP_DOES_ARP_CHECK||defined__DOXYGEN__ +#defineDHCP_DOES_ARP_CHECK((LWIP_DHCP)&&(LWIP_ARP)) +#endif + +#if!definedLWIP_DHCP_CHECK_LINK_UP +#defineLWIP_DHCP_CHECK_LINK_UP0 +#endif + +#if!definedLWIP_DHCP_BOOTP_FILE||defined__DOXYGEN__ +#defineLWIP_DHCP_BOOTP_FILE0 +#endif + +#if!definedLWIP_DHCP_GET_NTP_SRV||defined__DOXYGEN__ +#defineLWIP_DHCP_GET_NTP_SRV0 +#endif + +#if!definedLWIP_DHCP_MAX_NTP_SERVERS||defined__DOXYGEN__ +#defineLWIP_DHCP_MAX_NTP_SERVERS1 +#endif + +#if!definedLWIP_DHCP_MAX_DNS_SERVERS||defined__DOXYGEN__ +#defineLWIP_DHCP_MAX_DNS_SERVERSDNS_MAX_SERVERS +#endif + +/* +------------------------------------ +----------AUTOIPoptions---------- +------------------------------------ +*/ +#if!definedLWIP_AUTOIP||defined__DOXYGEN__ +#defineLWIP_AUTOIP0 +#endif +#if!LWIP_IPV4 +/*disableAUTOIPwhenIPv4isdisabled*/ +#undefLWIP_AUTOIP +#defineLWIP_AUTOIP0 +#endif/*!LWIP_IPV4*/ + +#if!definedLWIP_DHCP_AUTOIP_COOP||defined__DOXYGEN__ +#defineLWIP_DHCP_AUTOIP_COOP0 +#endif + +#if!definedLWIP_DHCP_AUTOIP_COOP_TRIES||defined__DOXYGEN__ +#defineLWIP_DHCP_AUTOIP_COOP_TRIES9 +#endif + +/* +---------------------------------- +-----SNMPMIB2support----- +---------------------------------- +*/ +#if!definedLWIP_MIB2_CALLBACKS||defined__DOXYGEN__ +#defineLWIP_MIB2_CALLBACKS0 +#endif + +/* +---------------------------------- +-----Multicast/IGMPoptions----- +---------------------------------- +*/ +#if!definedLWIP_IGMP||defined__DOXYGEN__ +#defineLWIP_IGMP0 +#endif +#if!LWIP_IPV4 +#undefLWIP_IGMP +#defineLWIP_IGMP0 +#endif + +#if!definedLWIP_MULTICAST_TX_OPTIONS||defined__DOXYGEN__ +#defineLWIP_MULTICAST_TX_OPTIONS(LWIP_IGMP&&LWIP_UDP) +#endif + +/* +---------------------------------- +----------DNSoptions----------- +---------------------------------- +*/ +#if!definedLWIP_DNS||defined__DOXYGEN__ +#defineLWIP_DNS0 +#endif + +#if!definedDNS_TABLE_SIZE||defined__DOXYGEN__ +#defineDNS_TABLE_SIZE4 +#endif + +#if!definedDNS_MAX_NAME_LENGTH||defined__DOXYGEN__ +#defineDNS_MAX_NAME_LENGTH256 +#endif + +#if!definedDNS_MAX_SERVERS||defined__DOXYGEN__ +#defineDNS_MAX_SERVERS2 +#endif + +#if!definedDNS_DOES_NAME_CHECK||defined__DOXYGEN__ +#defineDNS_DOES_NAME_CHECK1 +#endif + +#if!definedLWIP_DNS_SECURE||defined__DOXYGEN__ +#defineLWIP_DNS_SECURE(LWIP_DNS_SECURE_RAND_XID|LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING|LWIP_DNS_SECURE_RAND_SRC_PORT) +#endif + +/*AlistofDNSsecurityfeaturesfollows*/ +#defineLWIP_DNS_SECURE_RAND_XID1 +#defineLWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING2 +#defineLWIP_DNS_SECURE_RAND_SRC_PORT4 + +#if!definedDNS_LOCAL_HOSTLIST||defined__DOXYGEN__ +#defineDNS_LOCAL_HOSTLIST0 +#endif/*DNS_LOCAL_HOSTLIST*/ + +#if!definedDNS_LOCAL_HOSTLIST_IS_DYNAMIC||defined__DOXYGEN__ +#defineDNS_LOCAL_HOSTLIST_IS_DYNAMIC0 +#endif/*DNS_LOCAL_HOSTLIST_IS_DYNAMIC*/ + +#if!definedLWIP_DNS_SUPPORT_MDNS_QUERIES||defined__DOXYGEN__ +#defineLWIP_DNS_SUPPORT_MDNS_QUERIES0 +#endif + +/* +--------------------------------- +----------UDPoptions---------- +--------------------------------- +*/ +#if!definedLWIP_UDP||defined__DOXYGEN__ +#defineLWIP_UDP1 +#endif + +#if!definedLWIP_UDPLITE||defined__DOXYGEN__ +#defineLWIP_UDPLITE0 +#endif + +#if!definedUDP_TTL||defined__DOXYGEN__ +#defineUDP_TTL(IP_DEFAULT_TTL) +#endif + +#if!definedLWIP_NETBUF_RECVINFO||defined__DOXYGEN__ +#defineLWIP_NETBUF_RECVINFO0 +#endif + +/* +--------------------------------- +----------TCPoptions---------- +--------------------------------- +*/ +#if!definedLWIP_TCP||defined__DOXYGEN__ +#defineLWIP_TCP1 +#endif + +#if!definedTCP_TTL||defined__DOXYGEN__ +#defineTCP_TTL(IP_DEFAULT_TTL) +#endif + +#if!definedTCP_WND||defined__DOXYGEN__ +#defineTCP_WND(4*TCP_MSS) +#endif + +#if!definedTCP_MAXRTX||defined__DOXYGEN__ +#defineTCP_MAXRTX12 +#endif + +#if!definedTCP_SYNMAXRTX||defined__DOXYGEN__ +#defineTCP_SYNMAXRTX6 +#endif + +#if!definedTCP_QUEUE_OOSEQ||defined__DOXYGEN__ +#defineTCP_QUEUE_OOSEQ(LWIP_TCP) +#endif + +#if!definedTCP_MSS||defined__DOXYGEN__ +#defineTCP_MSS536 +#endif + +#if!definedTCP_CALCULATE_EFF_SEND_MSS||defined__DOXYGEN__ +#defineTCP_CALCULATE_EFF_SEND_MSS1 +#endif + +#if!definedTCP_SND_BUF||defined__DOXYGEN__ +#defineTCP_SND_BUF(2*TCP_MSS) +#endif + +#if!definedTCP_SND_QUEUELEN||defined__DOXYGEN__ +#defineTCP_SND_QUEUELEN((4*(TCP_SND_BUF)+(TCP_MSS-1))/(TCP_MSS)) +#endif + +#if!definedTCP_SNDLOWAT||defined__DOXYGEN__ +#defineTCP_SNDLOWATLWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2),(2*TCP_MSS)+1),(TCP_SND_BUF)-1) +#endif + +#if!definedTCP_SNDQUEUELOWAT||defined__DOXYGEN__ +#defineTCP_SNDQUEUELOWATLWIP_MAX(((TCP_SND_QUEUELEN)/2),5) +#endif + +#if!definedTCP_OOSEQ_MAX_BYTES||defined__DOXYGEN__ +#defineTCP_OOSEQ_MAX_BYTES0 +#endif + +#if!definedTCP_OOSEQ_MAX_PBUFS||defined__DOXYGEN__ +#defineTCP_OOSEQ_MAX_PBUFS0 +#endif + +#if!definedTCP_LISTEN_BACKLOG||defined__DOXYGEN__ +#defineTCP_LISTEN_BACKLOG0 +#endif + +#if!definedTCP_DEFAULT_LISTEN_BACKLOG||defined__DOXYGEN__ +#defineTCP_DEFAULT_LISTEN_BACKLOG0xff +#endif + +#if!definedTCP_OVERSIZE||defined__DOXYGEN__ +#defineTCP_OVERSIZETCP_MSS +#endif + +#if!definedLWIP_TCP_TIMESTAMPS||defined__DOXYGEN__ +#defineLWIP_TCP_TIMESTAMPS0 +#endif + +#if!definedTCP_WND_UPDATE_THRESHOLD||defined__DOXYGEN__ +#defineTCP_WND_UPDATE_THRESHOLDLWIP_MIN((TCP_WND/4),(TCP_MSS*4)) +#endif + +#if!defined(LWIP_EVENT_API)&&!defined(LWIP_CALLBACK_API)||defined__DOXYGEN__ +#defineLWIP_EVENT_API0 +#defineLWIP_CALLBACK_API1 +#else +#ifndefLWIP_EVENT_API +#defineLWIP_EVENT_API0 +#endif +#ifndefLWIP_CALLBACK_API +#defineLWIP_CALLBACK_API0 +#endif +#endif + +#if!definedLWIP_WND_SCALE||defined__DOXYGEN__ +#defineLWIP_WND_SCALE0 +#defineTCP_RCV_SCALE0 +#endif + +/* +---------------------------------- +----------Pbufoptions---------- +---------------------------------- +*/ +#if!definedPBUF_LINK_HLEN||defined__DOXYGEN__ +#ifdefinedLWIP_HOOK_VLAN_SET&&!defined__DOXYGEN__ +#definePBUF_LINK_HLEN(18+ETH_PAD_SIZE) +#else/*LWIP_HOOK_VLAN_SET*/ +#definePBUF_LINK_HLEN(14+ETH_PAD_SIZE) +#endif/*LWIP_HOOK_VLAN_SET*/ +#endif + +#if!definedPBUF_LINK_ENCAPSULATION_HLEN||defined__DOXYGEN__ +#definePBUF_LINK_ENCAPSULATION_HLEN0u +#endif + +#if!definedPBUF_POOL_BUFSIZE||defined__DOXYGEN__ +#definePBUF_POOL_BUFSIZELWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) +#endif + +/* +------------------------------------------------ +----------NetworkInterfacesoptions---------- +------------------------------------------------ +*/ +#if!definedLWIP_NETIF_HOSTNAME||defined__DOXYGEN__ +#defineLWIP_NETIF_HOSTNAME0 +#endif + +#if!definedLWIP_NETIF_API||defined__DOXYGEN__ +#defineLWIP_NETIF_API0 +#endif + +#if!definedLWIP_NETIF_STATUS_CALLBACK||defined__DOXYGEN__ +#defineLWIP_NETIF_STATUS_CALLBACK0 +#endif + +#if!definedLWIP_NETIF_LINK_CALLBACK||defined__DOXYGEN__ +#defineLWIP_NETIF_LINK_CALLBACK0 +#endif + +#if!definedLWIP_NETIF_REMOVE_CALLBACK||defined__DOXYGEN__ +#defineLWIP_NETIF_REMOVE_CALLBACK0 +#endif + +#if!definedLWIP_NETIF_HWADDRHINT||defined__DOXYGEN__ +#defineLWIP_NETIF_HWADDRHINT0 +#endif + +#if!definedLWIP_NETIF_TX_SINGLE_PBUF||defined__DOXYGEN__ +#defineLWIP_NETIF_TX_SINGLE_PBUF0 +#endif/*LWIP_NETIF_TX_SINGLE_PBUF*/ + +#if!definedLWIP_NUM_NETIF_CLIENT_DATA||defined__DOXYGEN__ +#defineLWIP_NUM_NETIF_CLIENT_DATA0 +#endif + +/* +------------------------------------ +----------LOOPIFoptions---------- +------------------------------------ +*/ +#if!definedLWIP_HAVE_LOOPIF||defined__DOXYGEN__ +#defineLWIP_HAVE_LOOPIFLWIP_NETIF_LOOPBACK +#endif + +#if!definedLWIP_LOOPIF_MULTICAST||defined__DOXYGEN__ +#defineLWIP_LOOPIF_MULTICAST0 +#endif + +#if!definedLWIP_NETIF_LOOPBACK||defined__DOXYGEN__ +#defineLWIP_NETIF_LOOPBACK0 +#endif + +#if!definedLWIP_LOOPBACK_MAX_PBUFS||defined__DOXYGEN__ +#defineLWIP_LOOPBACK_MAX_PBUFS0 +#endif + +#if!definedLWIP_NETIF_LOOPBACK_MULTITHREADING||defined__DOXYGEN__ +#defineLWIP_NETIF_LOOPBACK_MULTITHREADING(!NO_SYS) +#endif + +/* +------------------------------------ +----------Threadoptions---------- +------------------------------------ +*/ +#if!definedTCPIP_THREAD_NAME||defined__DOXYGEN__ +#defineTCPIP_THREAD_NAME"tcpip_thread" +#endif + +#if!definedTCPIP_THREAD_STACKSIZE||defined__DOXYGEN__ +#defineTCPIP_THREAD_STACKSIZE0 +#endif + +#if!definedTCPIP_THREAD_PRIO||defined__DOXYGEN__ +#defineTCPIP_THREAD_PRIO1 +#endif + +#if!definedTCPIP_MBOX_SIZE||defined__DOXYGEN__ +#defineTCPIP_MBOX_SIZE0 +#endif + +#if!definedLWIP_TCPIP_THREAD_ALIVE||defined__DOXYGEN__ +#defineLWIP_TCPIP_THREAD_ALIVE() +#endif + +#if!definedSLIPIF_THREAD_NAME||defined__DOXYGEN__ +#defineSLIPIF_THREAD_NAME"slipif_loop" +#endif + +#if!definedSLIPIF_THREAD_STACKSIZE||defined__DOXYGEN__ +#defineSLIPIF_THREAD_STACKSIZE0 +#endif + +#if!definedSLIPIF_THREAD_PRIO||defined__DOXYGEN__ +#defineSLIPIF_THREAD_PRIO1 +#endif + +#if!definedDEFAULT_THREAD_NAME||defined__DOXYGEN__ +#defineDEFAULT_THREAD_NAME"lwIP" +#endif + +#if!definedDEFAULT_THREAD_STACKSIZE||defined__DOXYGEN__ +#defineDEFAULT_THREAD_STACKSIZE0 +#endif + +#if!definedDEFAULT_THREAD_PRIO||defined__DOXYGEN__ +#defineDEFAULT_THREAD_PRIO1 +#endif + +#if!definedDEFAULT_RAW_RECVMBOX_SIZE||defined__DOXYGEN__ +#defineDEFAULT_RAW_RECVMBOX_SIZE0 +#endif + +#if!definedDEFAULT_UDP_RECVMBOX_SIZE||defined__DOXYGEN__ +#defineDEFAULT_UDP_RECVMBOX_SIZE0 +#endif + +#if!definedDEFAULT_TCP_RECVMBOX_SIZE||defined__DOXYGEN__ +#defineDEFAULT_TCP_RECVMBOX_SIZE0 +#endif + +#if!definedDEFAULT_ACCEPTMBOX_SIZE||defined__DOXYGEN__ +#defineDEFAULT_ACCEPTMBOX_SIZE0 +#endif + +/* +---------------------------------------------- +----------Sequentiallayeroptions---------- +---------------------------------------------- +*/ +#if!definedLWIP_NETCONN||defined__DOXYGEN__ +#defineLWIP_NETCONN1 +#endif + +#if!definedLWIP_TCPIP_TIMEOUT||defined__DOXYGEN__ +#defineLWIP_TCPIP_TIMEOUT0 +#endif + +#if!definedLWIP_NETCONN_SEM_PER_THREAD||defined__DOXYGEN__ +#defineLWIP_NETCONN_SEM_PER_THREAD0 +#endif + +#if!definedLWIP_NETCONN_FULLDUPLEX||defined__DOXYGEN__ +#defineLWIP_NETCONN_FULLDUPLEX0 +#endif + +/* +------------------------------------ +----------Socketoptions---------- +------------------------------------ +*/ +#if!definedLWIP_SOCKET||defined__DOXYGEN__ +#defineLWIP_SOCKET1 +#endif + +/*LWIP_SOCKET_SET_ERRNO==1:Seterrnowhensocketfunctionscannotcomplete +*successfully,asrequiredbyPOSIX.DefaultisPOSIX-compliant. +*/ +#if!definedLWIP_SOCKET_SET_ERRNO||defined__DOXYGEN__ +#defineLWIP_SOCKET_SET_ERRNO1 +#endif + +#if!definedLWIP_COMPAT_SOCKETS||defined__DOXYGEN__ +#defineLWIP_COMPAT_SOCKETS1 +#endif + +#if!definedLWIP_POSIX_SOCKETS_IO_NAMES||defined__DOXYGEN__ +#defineLWIP_POSIX_SOCKETS_IO_NAMES1 +#endif + +#if!definedLWIP_SOCKET_OFFSET||defined__DOXYGEN__ +#defineLWIP_SOCKET_OFFSET0 +#endif + +#if!definedLWIP_TCP_KEEPALIVE||defined__DOXYGEN__ +#defineLWIP_TCP_KEEPALIVE0 +#endif + +#if!definedLWIP_SO_SNDTIMEO||defined__DOXYGEN__ +#defineLWIP_SO_SNDTIMEO0 +#endif + +#if!definedLWIP_SO_RCVTIMEO||defined__DOXYGEN__ +#defineLWIP_SO_RCVTIMEO0 +#endif + +#if!definedLWIP_SO_SNDRCVTIMEO_NONSTANDARD||defined__DOXYGEN__ +#defineLWIP_SO_SNDRCVTIMEO_NONSTANDARD0 +#endif + +#if!definedLWIP_SO_RCVBUF||defined__DOXYGEN__ +#defineLWIP_SO_RCVBUF0 +#endif + +#if!definedLWIP_SO_LINGER||defined__DOXYGEN__ +#defineLWIP_SO_LINGER0 +#endif + +#if!definedRECV_BUFSIZE_DEFAULT||defined__DOXYGEN__ +#defineRECV_BUFSIZE_DEFAULTINT_MAX +#endif + +#if!definedLWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT||defined__DOXYGEN__ +#defineLWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT20000 +#endif + +#if!definedSO_REUSE||defined__DOXYGEN__ +#defineSO_REUSE0 +#endif + +#if!definedSO_REUSE_RXTOALL||defined__DOXYGEN__ +#defineSO_REUSE_RXTOALL0 +#endif + +#if!definedLWIP_FIONREAD_LINUXMODE||defined__DOXYGEN__ +#defineLWIP_FIONREAD_LINUXMODE0 +#endif + +/* +---------------------------------------- +----------Statisticsoptions---------- +---------------------------------------- +*/ +#if!definedLWIP_STATS||defined__DOXYGEN__ +#defineLWIP_STATS1 +#endif + +#ifLWIP_STATS + +#if!definedLWIP_STATS_DISPLAY||defined__DOXYGEN__ +#defineLWIP_STATS_DISPLAY0 +#endif + +#if!definedLINK_STATS||defined__DOXYGEN__ +#defineLINK_STATS1 +#endif + +#if!definedETHARP_STATS||defined__DOXYGEN__ +#defineETHARP_STATS(LWIP_ARP) +#endif + +#if!definedIP_STATS||defined__DOXYGEN__ +#defineIP_STATS1 +#endif + +#if!definedIPFRAG_STATS||defined__DOXYGEN__ +#defineIPFRAG_STATS(IP_REASSEMBLY||IP_FRAG) +#endif + +#if!definedICMP_STATS||defined__DOXYGEN__ +#defineICMP_STATS1 +#endif + +#if!definedIGMP_STATS||defined__DOXYGEN__ +#defineIGMP_STATS(LWIP_IGMP) +#endif + +#if!definedUDP_STATS||defined__DOXYGEN__ +#defineUDP_STATS(LWIP_UDP) +#endif + +#if!definedTCP_STATS||defined__DOXYGEN__ +#defineTCP_STATS(LWIP_TCP) +#endif + +#if!definedMEM_STATS||defined__DOXYGEN__ +#defineMEM_STATS((MEM_LIBC_MALLOC==0)&&(MEM_USE_POOLS==0)) +#endif + +#if!definedMEMP_STATS||defined__DOXYGEN__ +#defineMEMP_STATS(MEMP_MEM_MALLOC==0) +#endif + +#if!definedSYS_STATS||defined__DOXYGEN__ +#defineSYS_STATS(NO_SYS==0) +#endif + +#if!definedIP6_STATS||defined__DOXYGEN__ +#defineIP6_STATS(LWIP_IPV6) +#endif + +#if!definedICMP6_STATS||defined__DOXYGEN__ +#defineICMP6_STATS(LWIP_IPV6&&LWIP_ICMP6) +#endif + +#if!definedIP6_FRAG_STATS||defined__DOXYGEN__ +#defineIP6_FRAG_STATS(LWIP_IPV6&&(LWIP_IPV6_FRAG||LWIP_IPV6_REASS)) +#endif + +#if!definedMLD6_STATS||defined__DOXYGEN__ +#defineMLD6_STATS(LWIP_IPV6&&LWIP_IPV6_MLD) +#endif + +#if!definedND6_STATS||defined__DOXYGEN__ +#defineND6_STATS(LWIP_IPV6) +#endif + +#if!definedMIB2_STATS||defined__DOXYGEN__ +#defineMIB2_STATS0 +#endif + +#else + +#defineLINK_STATS0 +#defineETHARP_STATS0 +#defineIP_STATS0 +#defineIPFRAG_STATS0 +#defineICMP_STATS0 +#defineIGMP_STATS0 +#defineUDP_STATS0 +#defineTCP_STATS0 +#defineMEM_STATS0 +#defineMEMP_STATS0 +#defineSYS_STATS0 +#defineLWIP_STATS_DISPLAY0 +#defineIP6_STATS0 +#defineICMP6_STATS0 +#defineIP6_FRAG_STATS0 +#defineMLD6_STATS0 +#defineND6_STATS0 +#defineMIB2_STATS0 + +#endif/*LWIP_STATS*/ + +/* +-------------------------------------- +----------Checksumoptions---------- +-------------------------------------- +*/ +#if!definedLWIP_CHECKSUM_CTRL_PER_NETIF||defined__DOXYGEN__ +#defineLWIP_CHECKSUM_CTRL_PER_NETIF0 +#endif + +#if!definedCHECKSUM_GEN_IP||defined__DOXYGEN__ +#defineCHECKSUM_GEN_IP1 +#endif + +#if!definedCHECKSUM_GEN_UDP||defined__DOXYGEN__ +#defineCHECKSUM_GEN_UDP1 +#endif + +#if!definedCHECKSUM_GEN_TCP||defined__DOXYGEN__ +#defineCHECKSUM_GEN_TCP1 +#endif + +#if!definedCHECKSUM_GEN_ICMP||defined__DOXYGEN__ +#defineCHECKSUM_GEN_ICMP1 +#endif + +#if!definedCHECKSUM_GEN_ICMP6||defined__DOXYGEN__ +#defineCHECKSUM_GEN_ICMP61 +#endif + +#if!definedCHECKSUM_CHECK_IP||defined__DOXYGEN__ +#defineCHECKSUM_CHECK_IP1 +#endif + +#if!definedCHECKSUM_CHECK_UDP||defined__DOXYGEN__ +#defineCHECKSUM_CHECK_UDP1 +#endif + +#if!definedCHECKSUM_CHECK_TCP||defined__DOXYGEN__ +#defineCHECKSUM_CHECK_TCP1 +#endif + +#if!definedCHECKSUM_CHECK_ICMP||defined__DOXYGEN__ +#defineCHECKSUM_CHECK_ICMP1 +#endif + +#if!definedCHECKSUM_CHECK_ICMP6||defined__DOXYGEN__ +#defineCHECKSUM_CHECK_ICMP61 +#endif + +#if!definedLWIP_CHECKSUM_ON_COPY||defined__DOXYGEN__ +#defineLWIP_CHECKSUM_ON_COPY0 +#endif + +/* +--------------------------------------- +----------IPv6options--------------- +--------------------------------------- +*/ +#if!definedLWIP_IPV6||defined__DOXYGEN__ +#defineLWIP_IPV60 +#endif + +#if!definedLWIP_IPV6_NUM_ADDRESSES||defined__DOXYGEN__ +#defineLWIP_IPV6_NUM_ADDRESSES3 +#endif + +#if!definedLWIP_IPV6_FORWARD||defined__DOXYGEN__ +#defineLWIP_IPV6_FORWARD0 +#endif + +#if!definedLWIP_IPV6_FRAG||defined__DOXYGEN__ +#defineLWIP_IPV6_FRAG0 +#endif + +#if!definedLWIP_IPV6_REASS||defined__DOXYGEN__ +#defineLWIP_IPV6_REASS(LWIP_IPV6) +#endif + +#if!definedLWIP_IPV6_SEND_ROUTER_SOLICIT||defined__DOXYGEN__ +#defineLWIP_IPV6_SEND_ROUTER_SOLICIT1 +#endif + +#if!definedLWIP_IPV6_AUTOCONFIG||defined__DOXYGEN__ +#defineLWIP_IPV6_AUTOCONFIG(LWIP_IPV6) +#endif + +#if!definedLWIP_IPV6_DUP_DETECT_ATTEMPTS||defined__DOXYGEN__ +#defineLWIP_IPV6_DUP_DETECT_ATTEMPTS1 +#endif + +#if!definedLWIP_ICMP6||defined__DOXYGEN__ +#defineLWIP_ICMP6(LWIP_IPV6) +#endif + +#if!definedLWIP_ICMP6_DATASIZE||defined__DOXYGEN__ +#defineLWIP_ICMP6_DATASIZE8 +#endif + +#if!definedLWIP_ICMP6_HL||defined__DOXYGEN__ +#defineLWIP_ICMP6_HL255 +#endif + +#if!definedLWIP_IPV6_MLD||defined__DOXYGEN__ +#defineLWIP_IPV6_MLD(LWIP_IPV6) +#endif + +#if!definedMEMP_NUM_MLD6_GROUP||defined__DOXYGEN__ +#defineMEMP_NUM_MLD6_GROUP4 +#endif + +#if!definedLWIP_ND6_QUEUEING||defined__DOXYGEN__ +#defineLWIP_ND6_QUEUEING(LWIP_IPV6) +#endif + +#if!definedMEMP_NUM_ND6_QUEUE||defined__DOXYGEN__ +#defineMEMP_NUM_ND6_QUEUE20 +#endif + +#if!definedLWIP_ND6_NUM_NEIGHBORS||defined__DOXYGEN__ +#defineLWIP_ND6_NUM_NEIGHBORS10 +#endif + +#if!definedLWIP_ND6_NUM_DESTINATIONS||defined__DOXYGEN__ +#defineLWIP_ND6_NUM_DESTINATIONS10 +#endif + +#if!definedLWIP_ND6_NUM_PREFIXES||defined__DOXYGEN__ +#defineLWIP_ND6_NUM_PREFIXES5 +#endif + +#if!definedLWIP_ND6_NUM_ROUTERS||defined__DOXYGEN__ +#defineLWIP_ND6_NUM_ROUTERS3 +#endif + +#if!definedLWIP_ND6_MAX_MULTICAST_SOLICIT||defined__DOXYGEN__ +#defineLWIP_ND6_MAX_MULTICAST_SOLICIT3 +#endif + +#if!definedLWIP_ND6_MAX_UNICAST_SOLICIT||defined__DOXYGEN__ +#defineLWIP_ND6_MAX_UNICAST_SOLICIT3 +#endif + +#if!definedLWIP_ND6_MAX_ANYCAST_DELAY_TIME||defined__DOXYGEN__ +#defineLWIP_ND6_MAX_ANYCAST_DELAY_TIME1000 +#endif + +#if!definedLWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT||defined__DOXYGEN__ +#defineLWIP_ND6_MAX_NEIGHBOR_ADVERTISEMENT3 +#endif + +#if!definedLWIP_ND6_REACHABLE_TIME||defined__DOXYGEN__ +#defineLWIP_ND6_REACHABLE_TIME30000 +#endif + +#if!definedLWIP_ND6_RETRANS_TIMER||defined__DOXYGEN__ +#defineLWIP_ND6_RETRANS_TIMER1000 +#endif + +#if!definedLWIP_ND6_DELAY_FIRST_PROBE_TIME||defined__DOXYGEN__ +#defineLWIP_ND6_DELAY_FIRST_PROBE_TIME5000 +#endif + +#if!definedLWIP_ND6_ALLOW_RA_UPDATES||defined__DOXYGEN__ +#defineLWIP_ND6_ALLOW_RA_UPDATES1 +#endif + +#if!definedLWIP_ND6_TCP_REACHABILITY_HINTS||defined__DOXYGEN__ +#defineLWIP_ND6_TCP_REACHABILITY_HINTS1 +#endif + +#if!definedLWIP_ND6_RDNSS_MAX_DNS_SERVERS||defined__DOXYGEN__ +#defineLWIP_ND6_RDNSS_MAX_DNS_SERVERS0 +#endif + +#if!definedLWIP_IPV6_DHCP6||defined__DOXYGEN__ +#defineLWIP_IPV6_DHCP60 +#endif + +/* +--------------------------------------- +----------Hookoptions--------------- +--------------------------------------- +*/ + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_FILENAME"path/to/my/lwip_hooks.h" +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_TCP_ISN(local_ip,local_port,remote_ip,remote_port) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_IP4_INPUT(pbuf,input_netif) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_IP4_ROUTE() +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_IP4_ROUTE_SRC(dest,src) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_ETHARP_GET_GW(netif,dest) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_IP6_INPUT(pbuf,input_netif) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_IP6_ROUTE(src,dest) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_ND6_GET_GW(netif,dest) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_VLAN_CHECK(netif,eth_hdr,vlan_hdr) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_VLAN_SET(netif,p,src,dst,eth_type) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_MEMP_AVAILABLE(memp_t_type) +#endif + +#ifdef__DOXYGEN__ +#defineLWIP_HOOK_UNKNOWN_ETH_PROTOCOL(pbuf,netif) +#endif + +/* +--------------------------------------- +----------Debuggingoptions---------- +--------------------------------------- +*/ +#if!definedLWIP_DBG_MIN_LEVEL||defined__DOXYGEN__ +#defineLWIP_DBG_MIN_LEVELLWIP_DBG_LEVEL_ALL +#endif + +#if!definedLWIP_DBG_TYPES_ON||defined__DOXYGEN__ +#defineLWIP_DBG_TYPES_ONLWIP_DBG_ON +#endif + +#if!definedETHARP_DEBUG||defined__DOXYGEN__ +#defineETHARP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedNETIF_DEBUG||defined__DOXYGEN__ +#defineNETIF_DEBUGLWIP_DBG_OFF +#endif + +#if!definedPBUF_DEBUG||defined__DOXYGEN__ +#definePBUF_DEBUGLWIP_DBG_OFF +#endif + +#if!definedAPI_LIB_DEBUG||defined__DOXYGEN__ +#defineAPI_LIB_DEBUGLWIP_DBG_OFF +#endif + +#if!definedAPI_MSG_DEBUG||defined__DOXYGEN__ +#defineAPI_MSG_DEBUGLWIP_DBG_OFF +#endif + +#if!definedSOCKETS_DEBUG||defined__DOXYGEN__ +#defineSOCKETS_DEBUGLWIP_DBG_OFF +#endif + +#if!definedICMP_DEBUG||defined__DOXYGEN__ +#defineICMP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedIGMP_DEBUG||defined__DOXYGEN__ +#defineIGMP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedINET_DEBUG||defined__DOXYGEN__ +#defineINET_DEBUGLWIP_DBG_OFF +#endif + +#if!definedIP_DEBUG||defined__DOXYGEN__ +#defineIP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedIP_REASS_DEBUG||defined__DOXYGEN__ +#defineIP_REASS_DEBUGLWIP_DBG_OFF +#endif + +#if!definedRAW_DEBUG||defined__DOXYGEN__ +#defineRAW_DEBUGLWIP_DBG_OFF +#endif + +#if!definedMEM_DEBUG||defined__DOXYGEN__ +#defineMEM_DEBUGLWIP_DBG_OFF +#endif + +#if!definedMEMP_DEBUG||defined__DOXYGEN__ +#defineMEMP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedSYS_DEBUG||defined__DOXYGEN__ +#defineSYS_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTIMERS_DEBUG||defined__DOXYGEN__ +#defineTIMERS_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_DEBUG||defined__DOXYGEN__ +#defineTCP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_INPUT_DEBUG||defined__DOXYGEN__ +#defineTCP_INPUT_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_FR_DEBUG||defined__DOXYGEN__ +#defineTCP_FR_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_RTO_DEBUG||defined__DOXYGEN__ +#defineTCP_RTO_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_CWND_DEBUG||defined__DOXYGEN__ +#defineTCP_CWND_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_WND_DEBUG||defined__DOXYGEN__ +#defineTCP_WND_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_OUTPUT_DEBUG||defined__DOXYGEN__ +#defineTCP_OUTPUT_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_RST_DEBUG||defined__DOXYGEN__ +#defineTCP_RST_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCP_QLEN_DEBUG||defined__DOXYGEN__ +#defineTCP_QLEN_DEBUGLWIP_DBG_OFF +#endif + +#if!definedUDP_DEBUG||defined__DOXYGEN__ +#defineUDP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedTCPIP_DEBUG||defined__DOXYGEN__ +#defineTCPIP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedSLIP_DEBUG||defined__DOXYGEN__ +#defineSLIP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedDHCP_DEBUG||defined__DOXYGEN__ +#defineDHCP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedAUTOIP_DEBUG||defined__DOXYGEN__ +#defineAUTOIP_DEBUGLWIP_DBG_OFF +#endif + +#if!definedDNS_DEBUG||defined__DOXYGEN__ +#defineDNS_DEBUGLWIP_DBG_OFF +#endif + +#if!definedIP6_DEBUG||defined__DOXYGEN__ +#defineIP6_DEBUGLWIP_DBG_OFF +#endif + +/* +-------------------------------------------------- +----------Performancetrackingoptions---------- +-------------------------------------------------- +*/ +#if!definedLWIP_PERF||defined__DOXYGEN__ +#defineLWIP_PERF0 +#endif + +#endif/*LWIP_HDR_OPT_H*/ - + diff --git a/doc/xml/page__fault_8S.xml b/doc/xml/page__fault_8S.xml index 61b60d5..439f4cf 100644 --- a/doc/xml/page__fault_8S.xml +++ b/doc/xml/page__fault_8S.xml @@ -1,135 +1,132 @@ - - - + + + page_fault.S - - - globl _vmm_pageFault text code32 esp - globl _vmm_pageFault text code32 esp movl - (%esp) - movl - - % - esp - - - - - - - - - - - - - globl _vmm_pageFault text code32 - globl _vmm_pageFault text code32 _vmm_pageFault - - _vmm_pageFault - - - - - - - - idt_init - vmm_pagingInit - - - globl _vmm_pageFault text code32 esp eax pushl ebx ebx pushl ecx pushl edx push ebx push eax movl - globl _vmm_pageFault text code32 esp eax pushl ebx ebx pushl ecx pushl edx push ebx push eax movl cr2 - - cr2 - - - - - - - - - - globl _vmm_pageFault text code32 esp eax pushl ebx ebx pushl ecx pushl edx push ebx push eax movl eax pushl eax sti call vmm_pageFault addl - globl _vmm_pageFault text code32 esp eax pushl ebx ebx pushl ecx pushl edx push ebx push eax movl eax pushl eax sti call vmm_pageFault addl xC - - xC - - - - - - - - - -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: page__fault_8S.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -/* -Pagefaultwrapperthiswillaquiresomevaluesweneedforlateruse -*/ - -.globl_vmm_pageFault -.text -.code32 -_vmm_pageFault: -xchgl%eax,(%esp)/*SaveEAX*/ -movl4(%esp),%eax/*MoveEIPintoEAXtouselater*/ -pushl%ebx/*SaveEBX*/ -movl20(%esp),%ebx/*SaveESPforring3touselater*/ -pushl%ecx/*SaveECX,EDX*/ -pushl%edx -push%ebx/*PushESP*/ -push%eax/*PushEIP*/ -movl%cr2,%eax/*Pushthefaultedaddress*/ -pushl%eax -sti/*Turninterruptsbackonwearenowentrantsafe*/ -callvmm_pageFault/*Callourpagefaulthandler*/ -addl$0xC,%esp/*Adjustthestacktocompensateforpushedvalues*/ -popl%edx/*RestoreEAX,EBX,ECX,EDX*/ -popl%ecx -popl%ebx -popl%eax -iret/*Returnfromtheinterrupt*/ - - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +/* +Pagefaultwrapperthiswillaquiresomevaluesweneedforlateruse +*/ + +.globl_vmm_pageFault2 +.text +.code32 +_vmm_pageFault2: +xchgl%eax,(%esp)/*SaveEAX*/ +movl4(%esp),%eax/*MoveEIPintoEAXtouselater*/ +pushl%ebx/*SaveEBX*/ +movl20(%esp),%ebx/*SaveESPforring3touselater*/ +pushl%ecx/*SaveECX,EDX*/ +pushl%edx +push%ebx/*PushESP*/ +push%eax/*PushEIP*/ +movl%cr2,%eax/*Pushthefaultedaddress*/ +pushl%eax +sti/*Turninterruptsbackonwearenowentrantsafe*/ +callvmm_pageFault/*Callourpagefaulthandler*/ +addl$0xC,%esp/*Adjustthestacktocompensateforpushedvalues*/ +popl%edx/*RestoreEAX,EBX,ECX,EDX*/ +popl%ecx +popl%ebx +popl%eax +iret/*Returnfromtheinterrupt*/ + +.globl_vmm_pageFault +.text +.code32 + +_B4: +_B3: +nop + +_ast: + +_astRet: + +_vmm_pageFault: +pushl$0xC +pushal +push%ds +push%es +push%fs +push%gs +mov$0x10,%eax +mov%eax,%ds +mov%eax,%es +mov%eax,%fs +cld +push%esp +calltrap +notyet: +pushl%eax +sti +callvmm_pageFault +/*callsyscall*/ +add$0x4,%esp +cmpb$0x13,0x38(%esp) +je_B4 +testl$0x2000,0x3c(%esp)/*TestIfVM*/ +jz_notVM +jmp_isVM +_notVM: +testb$0x3,0x38(%esp)/*SeeIfWe'reInUserCS(GDTEntry5)*/ +jz_popFS +cli +mov%fs:0x0,%eax +testl$0x10800,0x80(%eax)/*DocumentThis*/ +je_popFS +sti +push%esp +call_ast +add$0x4,%esp +jmp_astRet +_isVM: +hlt + +_popFS: +pop%gs +pop%fs +pop%es +pop%ds +popa +add$0x8,%esp +iret + +/*** +END +***/ - + diff --git a/doc/xml/pagefault_8c.xml b/doc/xml/pagefault_8c.xml index afe13f7..5266f9c 100644 --- a/doc/xml/pagefault_8c.xml +++ b/doc/xml/pagefault_8c.xml @@ -1,205 +1,303 @@ - - - + + + pagefault.c vmm/vmm.h ubixos/sched.h ubixos/kpanic.h ubixos/spinlock.h lib/kprintf.h + sys/trap.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - - - - - + + + + - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - void - void vmm_pageFault - (uInt32 memAddr, uInt32 eip, uInt32 esp) - vmm_pageFault - - uInt32 - memAddr - - - uInt32 - eip - - - uInt32 - esp - - - - - - - - - _current - adjustCowCounter - endTask - taskStruct::id - kpanic - kprintf - PAGE_COW - PAGE_DEFAULT - pageEntries - pageFaultSpinLock - parentPageDirAddr - spinLock - spinUnlock - tablesBaseAddress - taskStruct::td - thread::vm_daddr - thread::vm_dsize - vmm_getPhysicalAddr - vmmFindFreePage - vmmGetFreeVirtualPage - vmmUnmapPage - x1 - x1000 - - - - spinLock_t - spinLock_t pageFaultSpinLock + + struct spinLock + struct spinLock pageFaultSpinLock pageFaultSpinLock - SPIN_LOCK_INITIALIZER + = SPIN_LOCK_INITIALIZER - - vmm_pageFault + + + + + + void + void vmm_pageFault + (struct trapframe *frame, uint32_t cr2) + vmm_pageFault + + struct trapframe * + frame + + + uint32_t + cr2 + + + + + + + + + _current + taskStruct::id + kprintf + spinLock + trapframe::tf_eip + trapframe::tf_err + trapframe::tf_esp @@ -207,224 +305,155 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pagefault_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> -#include<ubixos/sched.h> -#include<ubixos/kpanic.h> -#include<ubixos/spinlock.h> -#include<lib/kprintf.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<ubixos/sched.h> +#include<ubixos/kpanic.h> +#include<ubixos/spinlock.h> +#include<lib/kprintf.h> +#include<sys/trap.h> -staticspinLock_tpageFaultSpinLock=SPIN_LOCK_INITIALIZER; +staticstructspinLockpageFaultSpinLock=SPIN_LOCK_INITIALIZER; /***************************************************************************************** Function:voidvmm_pageFault(uInt32memAddr,uInt32eip,uInt32esp); Description:Thisisthepagefaulthandler,itwillhandleCOWandtrapallother -exceptionsandsegfaultthethread. +exceptionsandsegfaultthethread. Notes: - -07/30/02-FixedCOWHoweverINeedToThinkOfAWayToImpliment -APagingSystemAlsoStartToAddSecurityLevels - -07/27/04-Addedspinlockingtoensurethatwearethreadsafe.Iknowthatspininga -cpuisawasteofresourcesbutfornowitpreventserrors. + +07/30/02-FixedCOWHoweverINeedToThinkOfAWayToImpliment +APagingSystemAlsoStartToAddSecurityLevels + +07/27/04-Addedspinlockingtoensurethatwearethreadsafe.Iknowthatspininga +cpuisawasteofresourcesbutfornowitpreventserrors. -*****************************************************************************************/ -voidvmm_pageFault(uInt32memAddr,uInt32eip,uInt32esp){ -uInt32i=0x0,pageTableIndex=0x0,pageDirectoryIndex=0x0; -uInt32*pageDir=0x0,*pageTable=0x0; -uInt32*src=0x0,*dst=0x0; - -/*Trytoaquirelockotherwisespintillwedo*/ -spinLock(&pageFaultSpinLock); - -/*Setpagedirpointertotheaddressofthevisablepagedirectory*/ -pageDir=(uInt32*)parentPageDirAddr; - -/*UBU-Thisisatemppanicfor0x0readwritelateronIwillhandlethisdifferently*/ -if(memAddr==0x0){ -kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X]\n",memAddr,esp,_current->id,eip); -kpanic("ErrorWeWroteTo0x0\n"); -} - -/*CalculateThePageDirectoryIndex*/ -pageDirectoryIndex=(memAddr>>22); - -/*CalculateThePageTableIndex*/ -pageTableIndex=((memAddr>>12)&0x3FF); - -/*UBU-Thisisatemporaryroutineforhandlingaccesstoapageofanonexistantpagetable*/ -if(pageDir[pageDirectoryIndex]==0x0){ -kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X],NotAValidPageTable\n",memAddr,esp,_current->id,eip); -spinUnlock(&pageFaultSpinLock); -endTask(_current->id); -} -else{ -/*SetpageTableToPointToVirtualAddressOfPageTable*/ -pageTable=(uInt32*)(tablesBaseAddress+(0x1000*pageDirectoryIndex)); - -/*TestifthisisaCOWonpage*/ -if(((uInt32)pageTable[pageTableIndex]&PAGE_COW)==PAGE_COW){ -/*SetSrcToBaseAddressOfPageToCopy*/ -src=(uInt32*)(memAddr&0xFFFFF000); -/*AllocateAFreePageForDestination*/ -/*USEvmInfo*/ -dst=(uInt32*)vmmGetFreeVirtualPage(_current->id,1,0x1); -/*CopyMemory*/ -for(i=0;i<pageEntries;i++){ -dst[i]=src[i]; -} -/*AdjustTheCOWCounterForPhysicalPage*/ -adjustCowCounter(((uInt32)pageTable[pageTableIndex]&0xFFFFF000),-1); -/*RemapInNewPage*/ -pageTable[pageTableIndex]=(uInt32)(vmm_getPhysicalAddr((uInt32)dst)|(memAddr&0xFFF)); -/*UnlinkFromMemoryMapAllocatedPage*/ -vmmUnmapPage((uInt32)dst,1); -} -elseif(pageTable[pageTableIndex]!=0x0){ -kprintf("Securityfailedpagetablenotuserpermission\n"); -kprintf("pageTable:[0x%X:0x%X:0x%X:0x%X]\n",pageTable[pageTableIndex],pageTableIndex,pageDirectoryIndex,eip); -kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X]NonMapped\n",memAddr,esp,_current->id,eip); -spinUnlock(&pageFaultSpinLock); -endTask(_current->id); -} -elseif(memAddr<(_current->td.vm_dsize+_current->td.vm_daddr)){ -pageTable[pageTableIndex]=(uInt32)vmmFindFreePage(_current->id)|PAGE_DEFAULT; -} -else{ -spinUnlock(&pageFaultSpinLock); -/*NeedToCreateARoutineForAttemptingToAccessNonMappedMemory*/ -kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X]NonMapped\n",memAddr,esp,_current->id,eip); -kprintf("OutOfStackSpace:[0x%X]\n",memAddr&0xFF0000); -spinUnlock(&pageFaultSpinLock); -endTask(_current->id); -} -} -asmvolatile( -"movl%cr3,%eax\n" -"movl%eax,%cr3\n" -); - -/*Releasethespinlock*/ -spinUnlock(&pageFaultSpinLock); -return; -} - -/*** -$Log: pagefault_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.62006/12/0514:10:21reddawg -WorkignDistro - -Revision1.52006/12/0105:12:35reddawg -We'realmostthere...:) - -Revision1.42006/11/2113:25:49reddawg -Ahandfulofchanges;) - -Revision1.32006/11/0619:10:12reddawg -LotsOfUpdates...Stillhavingissueswithbrk(); - -Revision1.22006/10/3120:44:19reddawg -Lotsofchanges - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:38reddawg -Removed - -Revision1.1.1.12005/09/2617:24:52reddawg -nomessage - -Revision1.142004/08/2522:02:41reddawg -taskswitching-WenowareusingsoftwareswitchingtobeconsistantwiththerestoftheworldbecauseallofthisopensourcefreaksgavemeahardtimeaboutsomethingIliked.Theredoesn'tseemtobeanygaininperformancebutitisworkingfineandflawlessly - -Revision1.132004/08/2405:24:37reddawg -TCAIsABONER!!!! - -Revision1.122004/08/1411:23:03reddawg -Changes - -Revision1.112004/07/2815:05:43reddawg -Major: -Pagesnowhavestrictsecurityenforcement. -Manynulldereferenceshavebeenresolved. -Whenappsloadedpermissionssetforpagesrwandro - -Revision1.102004/07/2800:22:56reddawg -bah - -Revision1.92004/07/2800:17:05reddawg -Major: -Disconnectedpage0x0fromthesystem...Unfortunatelythisbrokemanythings -allofwhichhavebeenfixed.ThiswasgoodbecausenothingdeferencesNULL -anymore. - -Thingsaffected: -malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file - -Revision1.82004/07/2707:09:38reddawg -Putinatestfor0x0 - -Revision1.72004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.62004/07/2423:04:44reddawg -Changes...markletmeknowifyoufaultatpid185whenyoutypestress - -Revision1.52004/07/2420:00:51reddawg -Lotsofchangestothevmmsubsystem....Pagefaultshavebeenadjusttonowbeblockingonaperthreadbasisnotsystemwide.Thishasresultedinnomoredeadlocks..alsotheadditionofperthreadlockinghasremovedsegfaultsasaresultofCOWinwhichtwotasksfaultthesameCOWpageandtrytomodifyit. - -Revision1.42004/07/2417:47:28reddawg -vmm_pageFault:deadlockresolvedthankstoaproppersolutionsuggestedbygeist - -Revision1.32004/07/1902:05:26reddawg -vmmPageFault:hadapotentialmemoryleakhereforonepageitwasstillusingsysIDoncertainCOWscenarios - -Revision1.22004/06/1022:23:56reddawg -Volatiles - -Revision1.1.1.12004/04/1512:06:52reddawg -UbixOSv1.0 - -Revision1.42004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +*****************************************************************************************/ +/*voidvmm_pageFault(uInt32memAddr,uInt32eip,uInt32esp){*/ +voidvmm_pageFault(structtrapframe*frame,uint32_tcr2){ +uInt32i=0x0,pageTableIndex=0x0,pageDirectoryIndex=0x0; +uInt32*pageDir=0x0,*pageTable=0x0; +uInt32*src=0x0,*dst=0x0; + +uint32_tesp=frame->tf_esp; +uint32_teip=frame->tf_eip; +uint32_tmemAddr=cr2; + +//MrOlsen2017-12-15- +kprintf("CR2:[0x%X],EIP:0x%X,ERR:0x%X,PID:%i\n",cr2,frame->tf_eip,frame->tf_err,_current->id); + +/*Trytoaquirelockotherwisespintillwedo*/ +spinLock(&pageFaultSpinLock); + +/*Setpagedirpointertotheaddressofthevisablepagedirectory*/ +pageDir=(uint32_t*)PD_BASE_ADDR; + +/*UBU-Thisisatemppanicfor0x0readwritelateronIwillhandlethisdifferently*/ +if(memAddr==0x0){ +kprintf("SegfaultAtAddress:[0x%X],ESP:[0x%X],PID:[%i],EIP:[0x%X]\n",memAddr,esp,_current->id,eip); +kpanic("ErrorWeWroteTo0x0\n"); +} + +/*CalculateThePageDirectoryIndex*/ +pageDirectoryIndex=PD_INDEX(memAddr); + +/*CalculateThePageTableIndex*/ +pageTableIndex=PT_INDEX(memAddr); + +/*UBU-Thisisatemporaryroutineforhandlingaccesstoapageofanonexistantpagetable*/ +if(pageDir[pageDirectoryIndex]==0x0){ +kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X],NotAValidPageTable\n",memAddr,esp,_current->id,eip); +spinUnlock(&pageFaultSpinLock); +endTask(_current->id); +} +else{ +/*SetpageTableToPointToVirtualAddressOfPageTable*/ +pageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*pageDirectoryIndex)); + +/*TestifthisisaCOWonpage*/ +if(((uint32_t)pageTable[pageTableIndex]&PAGE_COW)==PAGE_COW){ +/*SetSrcToBaseAddressOfPageToCopy*/ +src=(uInt32*)(memAddr&0xFFFFF000); +/*AllocateAFreePageForDestination*/ +/*USEvmInfo*/ +dst=(uInt32*)vmm_getFreeVirtualPage(_current->id,1,0x1); +/*CopyMemory*/ +for(i=0;i<PD_ENTRIES;i++){ +dst[i]=src[i]; +} +/*AdjustTheCOWCounterForPhysicalPage*/ +adjustCowCounter(((uInt32)pageTable[pageTableIndex]&0xFFFFF000),-1); +/*RemapInNewPage*/ +pageTable[pageTableIndex]=(uInt32)(vmm_getPhysicalAddr((uInt32)dst)|(memAddr&0xFFF)); +/*UnlinkFromMemoryMapAllocatedPage*/ +vmm_unmapPage((uInt32)dst,1); +} +elseif(pageTable[pageTableIndex]!=0x0){ +kprintf("Securityfailedpagetablenotuserpermission\n"); +kprintf("pageDir:[0x%X]\n",pageDir[pageDirectoryIndex]); +kprintf("pageTable:[0x%X:0x%X:0x%X:0x%X]\n",pageTable[pageTableIndex],pageTableIndex,pageDirectoryIndex,eip); +kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X]NonMapped.\n",memAddr,esp,_current->id,eip); +kpanic("SITHEREFORNOW"); +die_if_kernel("SEGFAULT",frame,0xC); +spinUnlock(&pageFaultSpinLock); +endTask(_current->id); +} +elseif(memAddr<(_current->td.vm_dsize+_current->td.vm_daddr)){ +kprintf("THISISBAD"); +die_if_kernel("SEGFAULT",frame,0xC); +pageTable[pageTableIndex]=(uInt32)vmm_findFreePage(_current->id)|PAGE_DEFAULT; +} +else{ +spinUnlock(&pageFaultSpinLock); +/*NeedToCreateARoutineForAttemptingToAccessNonMappedMemory*/ +kprintf("pageDir:[0x%X]\n",pageDir[pageDirectoryIndex]); +kprintf("pageTable:[0x%X:0x%X:0x%X:0x%X]\n",pageTable[pageTableIndex],pageTableIndex,pageDirectoryIndex,eip); +kprintf("SegfaultAtAddress:[0x%X][0x%X][%i][0x%X]NonMapped!\n",memAddr,esp,_current->id,eip); +die_if_kernel("SEGFAULT",frame,0xC); +kpanic("SITHEREFORNOW"); +kprintf("OutOfStackSpace:[0x%X]\n",memAddr&0xFF0000); +endTask(_current->id); +} +} +asmvolatile( +"movl%cr3,%eax\n" +"movl%eax,%cr3\n" +); + +/*Releasethespinlock*/ +spinUnlock(&pageFaultSpinLock); +kprintf("CR2-RET"); +return; +} - + diff --git a/doc/xml/paging_8c.xml b/doc/xml/paging_8c.xml index 1c77ec7..6383439 100644 --- a/doc/xml/paging_8c.xml +++ b/doc/xml/paging_8c.xml @@ -1,227 +1,568 @@ - - - + + + paging.c + sys/types.h vmm/vmm.h lib/kprintf.h lib/kmalloc.h - ubixos/types.h ubixos/kpanic.h ubixos/sched.h ubixos/spinlock.h string.h assert.h + sys/descrip.h + ubixos/vitals.h - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - - - - + + + + + + + + + + + + + struct spinLock + struct spinLock fkpSpinLock + + fkpSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + uint32_t * + uint32_t* kernelPageDirectory + + kernelPageDirectory + = 0x0 + + + + + + + + biosCall + execFile + execThread + vmm_pagingInit + + + struct spinLock + struct spinLock rmpSpinLock + + rmpSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - - int - int mmap - (struct thread *td, struct mmap_args *uap) - mmap - - struct thread * - td - - - struct mmap_args * - uap - - - - - - - - - _current - mmap_args::addr - mmap_args::fd - mmap_args::flags - taskStruct::id - kprintf - mmap_args::len - mmap_args::pad - mmap_args::pos - mmap_args::prot - thread::td_retval - VM_TASK - vmmGetFreeVirtualPage - x1000 - - - int - int munmap - (struct thread *td, struct munmap_args *uap) - munmap - - struct thread * - td - - - struct munmap_args * - uap - - - - - - - - - kprintf - - + int int obreak (struct thread *td, struct obreak_args *uap) @@ -240,28 +581,15 @@ - - _current - btoc - ctob - taskStruct::id - K_PANIC - kprintf - obreak_args::nsize - PAGE_DEFAULT - round_page - thread::vm_daddr - thread::vm_dsize - vmm_remapPage - vmmFindFreePage + - + int int vmm_cleanVirtualSpace (uint32_t addr) vmm_cleanVirtualSpace - uint32_t + uint32_t addr @@ -270,23 +598,39 @@ - - kprintf - PAGE_COW - PAGE_PRESENT - PAGE_STACK - parentPageDirAddr - tablesBaseAddress - x1000 - sysExec + + sysExec - - void * - void* vmm_getFreeMallocPage - (uInt16 count) - vmm_getFreeMallocPage + + int + int vmm_clearVirtualPage + (uint32_t pageAddr) + vmm_clearVirtualPage - uInt16 + uint32_t + pageAddr + + + + + + + + + PD_ENTRIES + vmm_getFreeKernelPage + + + void * + void* vmm_getFreeKernelPage + (pidType pid, uint16_t count) + vmm_getFreeKernelPage + + pidType + pid + + + uint16_t count @@ -295,21 +639,73 @@ - - fkpSpinLock - K_PANIC - KERNEL_PAGE_DEFAULT - spinLock - spinUnlock - sysID - tablesBaseAddress - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - x1000 - getEmptyDesc + + K_PANIC + KERNEL_PAGE_DEFAULT + kpanic + PAGE_PRESENT + PAGE_SIZE + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + pdSpinLock + PT_BASE_ADDR + PT_ENTRIES + spinLock + spinUnlock + vmm_allocPageTable + vmm_clearVirtualPage + vmm_findFreePage + VMM_KERN_END + VMM_KERN_START + vmm_remapPage + biosCall + execThread - + + void * + void* vmm_getFreeMallocPage + (uInt16 count) + vmm_getFreeMallocPage + + uInt16 + count + + + + + + + + + + + void * + void* vmm_mapFromTask + (pidType pid, void *ptr, uint32_t size) + vmm_mapFromTask + + pidType + pid + + + void * + ptr + + + uint32_t + size + + + + + + + + + sdeThread + + int int vmm_pagingInit () @@ -320,114 +716,56 @@ - - _vmm_pageFault - K_PANIC - KERNEL_PAGE_DEFAULT - kernelPageDirectory - kprintf - memset - numPages - pageEntries - sysID - vmm_remapPage - vmmFindFreePage - vmmMemoryMap - vmmMemoryMapAddr - x1 - x1000 - vmm_init + + _vmm_pageFault + bzero + K_PANIC + KERNEL_PAGE_DEFAULT + kernelPageDirectory + kprintf + numPages + PAGE_DEFAULT + PAGE_GLOBAL + PAGE_SIZE + PAGE_STACK + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + PT_BASE_ADDR + sysID + vmm_findFreePage + VMM_KERN_END + VMM_KERN_START + VMM_MMAP_ADDR_PMODE + VMM_MMAP_ADDR_RMODE + vmm_remapPage + vmmMemoryMap + vmm_init - + int int vmm_remapPage - (uInt32 source, uInt32 dest, uInt16 perms) + (uint32_t source, uint32_t dest, uint16_t perms, pidType pid, int haveLock) vmm_remapPage - uInt32 + uint32_t source - uInt32 + uint32_t dest - uInt16 + uint16_t perms - - - - - - - - _current - freePage - taskStruct::id - K_PANIC - KERNEL_PAGE_DEFAULT - kprintf - PAGE_COW - PAGE_DEFAULT - PAGE_PRESENT - PAGE_STACK - pageEntries - parentPageDirAddr - rmpSpinLock - spinLock - spinUnlock - tablesBaseAddress - vmmFindFreePage - x1000 - elf_loadfile - execFile - kmod_load - ldEnable - obreak - sys_exec - sysExec - vmm_getFreeMallocPage - vmm_pagingInit - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - vmmMapFromTask - - - int - int vmmClearVirtualPage - (uInt32 pageAddr) - vmmClearVirtualPage - uInt32 - pageAddr - - - - - - - - - pageEntries - vmm_getFreeMallocPage - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - - - void * - void* vmmGetFreeKernelPage - (pidType pid, uInt16 count) - vmmGetFreeKernelPage - - pidType + pidType pid - uInt16 - count + int + haveLock @@ -435,106 +773,23 @@ - - fkpSpinLock - K_PANIC - KERNEL_PAGE_DEFAULT - spinLock - spinUnlock - tablesBaseAddress - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - vmmCopyVirtualSpace - - - void * - void* vmmMapFromTask - (pidType pid, void *ptr, uInt32 size) - vmmMapFromTask - - pidType - pid - - - void * - ptr - - - uInt32 - size - - - - - - - - - _current - tssStruct::cr3 - K_PANIC - KERNEL_PAGE_DEFAULT - taskStruct::oInfo - schedFindTask - tablesBaseAddress - taskStruct::tss - vmm_remapPage - vmmUnmapPage - osInfo::vmStart - x1000 - - - - - spinLock_t - spinLock_t fkpSpinLock - - fkpSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - vmm_getFreeMallocPage - vmmGetFreeKernelPage - - - uInt32 * - uInt32* kernelPageDirectory - - kernelPageDirectory - 0x0 - - - - - - - - _int8 - execFile - execThread - idt_init - vmm_pagingInit - - - spinLock_t - spinLock_t rmpSpinLock - - rmpSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - vmm_remapPage + + K_PANIC + kpanic + spinLock + sysID + VMM_USER_END + VMM_USER_START + elf_load_file + execFile + freebsd6_mmap + kmod_load + ldEnable + ogDisplay_UbixOS::SetMode + sys_mmap + sysExec + vmm_getFreeKernelPage + vmm_pagingInit @@ -542,571 +797,650 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: paging_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/types.h> #include<vmm/vmm.h> #include<lib/kprintf.h> #include<lib/kmalloc.h> -#include<ubixos/types.h> -#include<ubixos/kpanic.h> -#include<ubixos/sched.h> -#include<ubixos/spinlock.h> -#include<string.h> -#include<assert.h> - -uInt32*kernelPageDirectory=0x0; - +#include<ubixos/kpanic.h> +#include<ubixos/sched.h> +#include<ubixos/spinlock.h> +#include<string.h> +#include<assert.h> +#include<sys/descrip.h> +#include<ubixos/vitals.h> + +uint32_t*kernelPageDirectory=0x0;//PointerToKernelPageDirectory -staticspinLock_tfkpSpinLock=SPIN_LOCK_INITIALIZER; -staticspinLock_trmpSpinLock=SPIN_LOCK_INITIALIZER; - +staticstructspinLockfkpSpinLock=SPIN_LOCK_INITIALIZER; + +staticstructspinLockrmpSpinLock=SPIN_LOCK_INITIALIZER; /***************************************************************************************** Function:intvmm_pagingInit(); Description:ThisFunctionWillInitializeTheOperatingSystemsPaging -Abilities. +Abilities. Notes: -02/20/2004-LookedOverCodeAndHaveApprovedItsQuality -07/28/3004-Allpagesaresetforring-0onlynomoreuseraccessable +02/20/2004-LookedOverCodeAndHaveApprovedItsQuality +07/28/3004-Allpagesaresetforring-0onlynomoreuseraccessable -*****************************************************************************************/ - -intvmm_pagingInit(){ -uInt32i=0x0; -uInt32*pageTable=0x0; +*****************************************************************************************/ + +intvmm_pagingInit(){ +uint32_ti=0x0; +uint32_t*pageTable=0x0; /*AllocateAPageOfMemoryForKernelsPageDirectory*/ -kernelPageDirectory=(uInt32*)vmmFindFreePage(sysID); -if(kernelPageDirectory==0x0){ -K_PANIC("Error:vmmFindFreePageFailed"); -return(0x1); -}/*endif*/ - +kernelPageDirectory=(uint32_t*)vmm_findFreePage(sysID); + +if(kernelPageDirectory==0x0){ +K_PANIC("Error:vmm_findFreePageFailed"); +}/*endif*/ + /*ClearTheMemoryToEnsureThereIsNoGarbage*/ -for(i=0;i<pageEntries;i++){ -(uInt32)kernelPageDirectory[i]=(uInt32)0x0; -}/*endfor*/ - -/*Allocateapageforthefirst4MBofmemory*/ -if((pageTable=(uInt32*)vmmFindFreePage(sysID))==0x0) -K_PANIC("Error:vmmFindFreePageFailed"); -kernelPageDirectory[0]=(uInt32)((uInt32)(pageTable)|KERNEL_PAGE_DEFAULT); - -/*MakeSureThePageTableIsClean*/ -memset(pageTable,0x0,0x1000); - -/* -*Mapthefirst1MBofMemorytothekernelMMspacebecauseourkernelstarts -*at0x30000 -*Donotmappageataddress0x0thisisreservedfornull... -*/ -for(i=0x1;i<(pageEntries/0x4);i++){ -pageTable[i]=(uInt32)((i*0x1000)|KERNEL_PAGE_DEFAULT); -}/*endfor*/ - -/* -*Createpagetablesforthetop1GBofVMspace.Thisspaceissetaside -*forkernelspaceandwillbesharedwitheachprocess -*/ -for(i=768;i<pageEntries;i++){ -if((pageTable=(uInt32*)vmmFindFreePage(sysID))==0x0) -K_PANIC("Error:vmmFindFreePageFailed"); - -/*MakeSureThePageTableIsClean*/ -memset(pageTable,0x0,0x1000); - -/*MapInThePageDirectory*/ -kernelPageDirectory[i]=(uInt32)((uInt32)(pageTable)|KERNEL_PAGE_DEFAULT); -}/*endfor*/ - -/*SetUpMemoryToBeAllTheAllocatedPageDirectories*/ -if((pageTable=(uInt32*)vmmFindFreePage(sysID))==0x0) -K_PANIC("Error:vmmFindFreePageFailed"); - -/*CleanPageTable*/ -memset(pageTable,0x0,0x1000); - -kernelPageDirectory[767]=((uInt32)pageTable|KERNEL_PAGE_DEFAULT); -for(i=0;i<pageEntries;i++){ -pageTable[i]=kernelPageDirectory[i]; -}/*endfor*/ - -/*AlsoSetUpPageDirectoryToBeTheTheFirstPageIn0xE0400000*/ -pageTable=(uInt32*)(kernelPageDirectory[0]&0xFFFFF000); -pageTable[256]=(uInt32)((uInt32)(kernelPageDirectory)|KERNEL_PAGE_DEFAULT); - -/*NowLetsTurnOnPagingWithThisInitialPageTable*/ -asmvolatile( -"movl%0,%%eax\n" -"movl%%eax,%%cr3\n" -"movl%%cr0,%%eax\n" -"orl$0x80010000,%%eax\n"/*Turnonmemoryprotection*/ -"movl%%eax,%%cr0\n" -: -:"d"((uInt32*)(kernelPageDirectory)) -); +bzero(kernelPageDirectory,PAGE_SIZE); + +/*Allocateapageforthefirst4MBofmemory*/ +if((pageTable=(uint32_t*)vmm_findFreePage(sysID))==0x0) +K_PANIC("Error:vmm_findFreePageFailed"); + +/*MakeSureThePageTableIsClean*/ +bzero(pageTable,PAGE_SIZE); + +kernelPageDirectory[0]=(uint32_t)((uint32_t)(pageTable)|PAGE_DEFAULT); + +/* +*Mapthefirst1MBofMemorytothekernelMMspacebecauseourkernelstarts +*at0x30000 +*Donotmappageataddress0x0thisisreservedfornull... +*/ + +/*MrOlsen(2016-01-15)NOTE:I'mMappingItForNowUntilICanFigureOutWhyFS:0x0*/ +for(i=0x0;i<(PD_ENTRIES/0x4);i++){ +pageTable[i]=(uint32_t)((i*0x1000)|PAGE_DEFAULT);//FIXME:ThisistempbecauseofbioscallKERNEL_PAGE_DEFAULT);//MrOlsen2018-01-14PAGE_DEFAULT +}/*endfor*/ + +/*Allocateapageforthesecond4MBofmemory*/ +if((pageTable=(uint32_t*)vmm_findFreePage(sysID))==0x0) +K_PANIC("Error:vmm_findFreePageFailed"); + +/*MakeSureThePageTableIsClean*/ +bzero(pageTable,PAGE_SIZE); + +kernelPageDirectory[1]=(uint32_t)((uint32_t)(pageTable)|PAGE_DEFAULT); + +/* +*Createpagetablesforthetop1GBofVMspace.Thisspaceissetaside +*forkernelspaceandwillbesharedwitheachprocess +*/ + +for(i=PD_INDEX(VMM_KERN_START);i<=PD_INDEX(VMM_KERN_END);i++){ +if((pageTable=(uint32_t*)vmm_findFreePage(sysID))==0x0) +K_PANIC("Error:vmm_findFreePageFailed"); + +/*MakeSureThePageTableIsClean*/ +bzero(pageTable,PAGE_SIZE); + +/*MapInThePageDirectory*/ +kernelPageDirectory[i]=(uint32_t)((uint32_t)(pageTable)|KERNEL_PAGE_DEFAULT|PAGE_GLOBAL); +}/*endfor*/ + +kernelPageDirectory[1023]=(uint32_t)((uint32_t)(pageTable)|KERNEL_PAGE_DEFAULT); +pageTable=(uint32_t*)(kernelPageDirectory[1023]&0xFFFFF000); + +pageTable[1023]=(vmm_findFreePage(sysID)|KERNEL_PAGE_DEFAULT|PAGE_STACK); +pageTable[1022]=(vmm_findFreePage(sysID)|KERNEL_PAGE_DEFAULT|PAGE_STACK); + +/* +*MapPageTablesIntoVMSpace +*TheFirstPageTable(4MB)MapsToAllPageDirectories +*/ +if(kernelPageDirectory[PD_INDEX(PT_BASE_ADDR)]==0){ +if((pageTable=(uint32_t*)vmm_findFreePage(sysID))==0x0) +K_PANIC("Error:vmm_findFreePageFailed"); + +bzero(pageTable,PAGE_SIZE); -/*RemapTheMemoryList*/ -for(i=0x101000;i<=(0x101000+(numPages*sizeof(mMap)));i+=0x1000){ -if((vmm_remapPage(i,(vmmMemoryMapAddr+(i-0x101000)),KERNEL_PAGE_DEFAULT))==0x0) -K_PANIC("vmmRemapPagefailed\n"); -} -/*SetNewAddressForMemoryMapSinceItsRelocation*/ -vmmMemoryMap=(mMap*)vmmMemoryMapAddr; - -/*Printinformationonpaging*/ -kprintf("paging0-Address:[0x%X],PagingISRAddress:[0x%X]\n",kernelPageDirectory,&_vmm_pageFault); - -/*Returnsoweknoweverythingwentwell*/ -return(0x0); -}/*END*/ - -/***************************************************************************************** -Function:intvmmRemapPage(PhysicalSource,VirtualDestination) - -Description:ThisFunctionWillRemapAPhysicalPageIntoVirtualSpace - -Notes: -07/29/02-RewroteThisToWorkWithOurNewPagingSystem -07/30/02-ChangedAddressOfPageTablesAndPageDirectory -07/28/04-Ifperms==0x0settoPAGE_DEFAULT - -*****************************************************************************************/ -intvmm_remapPage(uInt32source,uInt32dest,uInt16perms) -{ -uInt16destPageDirectoryIndex=0x0,destPageTableIndex=0x0; -uInt32*pageDir=0x0,*pageTable=0x0; -shorti=0x0; - -if(source==0x0) -K_PANIC("source==0x0"); -if(dest==0x0) -K_PANIC("dest==0x0"); - -spinLock(&rmpSpinLock); -if(perms==0x0) -perms=KERNEL_PAGE_DEFAULT; - -/* -*SetPointerpageDirectoryToPointToTheVirtualMappingOfThePage -*Directory -*/ -pageDir=(uInt32*)parentPageDirAddr; -/*CheckToSeeIfPageTableExists*/ -if(dest==0x0) -return(0x0); - -/*GetIndexIntoThePageDirectory*/ -destPageDirectoryIndex=(dest/0x400000); - -if((pageDir[destPageDirectoryIndex]&PAGE_PRESENT)!=PAGE_PRESENT){ -/*IfPageTableIsNonExistantThenSetItUp*/ -/*UBUWhydoesthepagetableneedtobeuserwritable?*/ -pageDir[destPageDirectoryIndex]=(uInt32)vmmFindFreePage(_current->id)|PAGE_DEFAULT; - -/*AlsoAddItToVirtualSpaceSoWeCanMakeChangesLater*/ -pageTable=(uInt32*)(tablesBaseAddress+0x2FF000); -pageTable[destPageDirectoryIndex]=pageDir[destPageDirectoryIndex]; -/*ReloadPageDirectory*/ -asmvolatile( -"push%eax\n" -"mov%cr3,%eax\n" -"mov%eax,%cr3\n" -"pop%eax\n" -); -pageTable=(uInt32*)(tablesBaseAddress+(0x1000*destPageDirectoryIndex)); -for(i=0x0;i<pageEntries;i++) -pageTable[i]=0x0; -} -/*SetAddressToPageTable*/ -pageTable=(uInt32*)(tablesBaseAddress+(0x1000*destPageDirectoryIndex)); - -/*GetTheIndexToThePageTable*/ -destPageTableIndex=((dest-(destPageDirectoryIndex*0x400000))/0x1000); - - -/*IfThePageIsMappedInFreeItBeforeWeRemap*/ -if((pageTable[destPageTableIndex]&PAGE_PRESENT)==PAGE_PRESENT){ -if((pageTable[destPageTableIndex]&PAGE_STACK)==PAGE_STACK) -kprintf("StackPage:[0x%X]\n",dest); - -if((pageTable[destPageTableIndex]&PAGE_COW)!=PAGE_COW){ -kprintf("PageNOTCOW\n"); -kprintf("PagePresent:[0x%X][0x%X]",dest,pageTable[destPageTableIndex]); -source=0x0; -gotormDone; -} -/*ClearThePageFirstForSecurityReasons*/ -freePage(((uInt32)pageTable[destPageTableIndex]&0xFFFFF000)); -} -/*SetTheSourceAddressInTheDestination*/ -pageTable[destPageTableIndex]=(uInt32)(source|perms); -/*ReloadThePageTable;*/ -asmvolatile( -"push%eax\n" -"movl%cr3,%eax\n" -"movl%eax,%cr3\n" -"pop%eax\n" -); - -rmDone: -/*Return*/ -spinUnlock(&rmpSpinLock); -return(source); -} - -/************************************************************************ - -Function:void*vmmGetFreeKernelPage(pidTypepid); -Description:ReturnsAFreePageMappedToTheVMSpace -Notes: - -07/30/02-ThisReturnsAFreePageInTheTop1GBForTheKernel - -************************************************************************/ -void* -vmmGetFreeKernelPage(pidTypepid,uInt16count) -{ -intx=0,y=0,c=0; -uInt32*pageTableSrc=0x0; +kernelPageDirectory[PD_INDEX(PT_BASE_ADDR)]=(uint32_t)((uint32_t)(pageTable)|KERNEL_PAGE_DEFAULT); +} + +pageTable=(uint32_t*)(kernelPageDirectory[PD_INDEX(PT_BASE_ADDR)]&0xFFFFF000); + +for(i=0;i<PD_ENTRIES;i++){ +pageTable[i]=kernelPageDirectory[i]; +}/*endfor*/ + +/* +*MapPageDirectoryIntoVMSpace +*FirstPageAfterPageTables +*/ +if(kernelPageDirectory[PD_INDEX(PD_BASE_ADDR)]==0){ +if((pageTable=(uint32_t*)vmm_findFreePage(sysID))==0x0) +K_PANIC("Error:vmm_findFreePageFailed"); + +bzero(pageTable,PAGE_SIZE); + +kernelPageDirectory[PD_INDEX(PD_BASE_ADDR)]=(uint32_t)((uint32_t)(pageTable)|KERNEL_PAGE_DEFAULT); +} + +pageTable=(uint32_t*)(kernelPageDirectory[PD_INDEX(PD_BASE_ADDR)]&0xFFFFF000); +pageTable[0]=(uint32_t)((uint32_t)(kernelPageDirectory)|KERNEL_PAGE_DEFAULT); + +/*AllocateNewStackSpace*/ +if((pageTable=(uint32_t*)vmm_findFreePage(sysID))==0x0) +K_PANIC("ERROR:vmm_findFreePageFailed"); + +/*NowLetsTurnOnPagingWithThisInitialPageTable*/ +asmvolatile( +"movl%0,%%eax\n" +"movl%%eax,%%cr3\n" +"movl%%cr0,%%eax\n" +"orl$0x80010000,%%eax\n"/*Turnonmemoryprotection*/ +"movl%%eax,%%cr0\n" +: +:"d"((uint32_t*)(kernelPageDirectory)) +); + +/*RemapTheMemoryList*/ +for(i=VMM_MMAP_ADDR_RMODE;i<=(0x101000+(numPages*sizeof(mMap)));i+=0x1000){ +if((vmm_remapPage(i,(VMM_MMAP_ADDR_PMODE+(i-0x101000)),PAGE_DEFAULT,sysID,0))==0x0) +K_PANIC("vmmRemapPagefailed\n"); +} + +/*SetNewAddressForMemoryMapSinceItsRelocation*/ +vmmMemoryMap=(mMap*)VMM_MMAP_ADDR_PMODE; + +/*Printinformationonpaging*/ +kprintf("paging0-Address:[0x%X],PagingISRAddress:[0x%X]\n",kernelPageDirectory,&_vmm_pageFault); + +/*Returnsoweknoweverythingwentwell*/ +return(0x0); +}/*END*/ + +/***************************************************************************************** +Function:intvmmRemapPage(PhysicalSource,VirtualDestination) + +Description:ThisFunctionWillRemapAPhysicalPageIntoVirtualSpace + +Notes: +07/29/02-RewroteThisToWorkWithOurNewPagingSystem +07/30/02-ChangedAddressOfPageTablesAndPageDirectory +07/28/04-Ifperms==0x0settoPAGE_DEFAULT + +*****************************************************************************************/ +intvmm_remapPage(uint32_tsource,uint32_tdest,uint16_tperms,pidTypepid,inthaveLock){ + +uint16_tdestPageDirectoryIndex=0x0,destPageTableIndex=0x0; +uint32_t*pageDir=0x0,*pageTable=0x0; + +shorti=0x0; + +if(pid<sysID) +kpanic("InvalidPID%i",pid); + +if(source==0x0) +K_PANIC("source==0x0"); + +if(dest==0x0) +K_PANIC("dest==0x0"); + +if(haveLock==0){ +if(dest>=VMM_USER_START&&dest<=VMM_USER_END) +spinLock(&rmpSpinLock); +else +spinLock(&pdSpinLock); +} + +if(perms==0x0) +perms=KERNEL_PAGE_DEFAULT; + +/*SetPointerpageDirectoryToPointToTheVirtualMappingOfThePageDirectory*/ +pageDir=(uint32_t*)PD_BASE_ADDR; + +/*GetIndexIntoThePageDirectory*/ +destPageDirectoryIndex=PD_INDEX(dest); + +if((pageDir[destPageDirectoryIndex]&PAGE_PRESENT)!=PAGE_PRESENT){ +//kprintf("[NpdI:0x%X]",destPageDirectoryIndex); +vmm_allocPageTable(destPageDirectoryIndex,pid); +} + +/*SetAddressToPageTable*/ +pageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*destPageDirectoryIndex)); + +/*GetTheIndexToThePageTable*/ +destPageTableIndex=PT_INDEX(dest); + +/*IfThePageIsMappedInFreeItBeforeWeRemap*/ +if((pageTable[destPageTableIndex]&PAGE_PRESENT)==PAGE_PRESENT){ +kpanic("APageIsAlreadyMappedHere:0x%X:0x%X",dest,destPageTableIndex); + +if((pageTable[destPageTableIndex]&PAGE_STACK)==PAGE_STACK) +kprintf("StackPage:[0x%X]\n",dest); + +if((pageTable[destPageTableIndex]&PAGE_COW)!=PAGE_COW){ +kprintf("PageNOTCOW\n"); +kprintf("PagePresent:[0x%X][0x%X]",dest,pageTable[destPageTableIndex]); +source=0x0; +gotormDone; +} -spinLock(&fkpSpinLock); -/*LetsSearchForAFreePage*/ -for(x=768;x<1024;x++){ -/*SetPageTableAddress*/ -pageTableSrc=(uInt32*)(tablesBaseAddress+(4096*x)); -for(y=0;y<1024;y++){ -/*LoopThroughThePageTableFindAnUnAllocatedPage*/ -if((uInt32)pageTableSrc[y]==(uInt32)0x0){ -if(count>1){ -for(c=0;c<count;c++){ -if(y+c<1024){ -if((uInt32)pageTableSrc[y+c]!=(uInt32)0x0){ -c=-1; -break; -} -} -} -if(c!=-1){ -for(c=0;c<count;c++){ -if((vmm_remapPage((uInt32)vmmFindFreePage(pid),((x*(1024*4096))+((y+c)*4096)),KERNEL_PAGE_DEFAULT))==0x0) -K_PANIC("vmmRemapPagefailed:gfkp-1\n"); -vmmClearVirtualPage((uInt32)((x*(1024*4096))+((y+c)*4096))); -} -spinUnlock(&fkpSpinLock); -return((void*)((x*(1024*4096))+(y*4096))); -} -}else{ -/*MapAPhysicalPageToTheVirtualPage*/ - -if((vmm_remapPage((uInt32)vmmFindFreePage(pid),((x*(1024*4096))+(y*4096)),KERNEL_PAGE_DEFAULT))==0x0) -K_PANIC("vmmRemapPagefailed:gfkp-2\n"); -/*ClearThisPageSoNoGarbageIsThere*/ -vmmClearVirtualPage((uInt32)((x*(1024*4096))+(y*4096))); -/*ReturnTheAddressOfTheNewlyAllocatePage*/ -spinUnlock(&fkpSpinLock); -return((void*)((x*(1024*4096))+(y*4096))); -} -} -} -} -/*IfNoFreePageWasFoundReturnNULL*/ -spinUnlock(&fkpSpinLock); -return(0x0); -} +/*ClearThePageFirstForSecurityReasons*/ +freePage(((uint32_t)pageTable[destPageTableIndex]&0xFFFFF000)); + +} + +/*SetTheSourceAddressInTheDestination*/ +pageTable[destPageTableIndex]=(uint32_t)(source|perms); + +/*ReloadThePageTable;*/ +rmDone:asmvolatile( +"push%eax\n" +"movl%cr3,%eax\n" +"movl%eax,%cr3\n" +"pop%eax\n" +); + +/*Return*/ +if(haveLock==0x0){ +if(dest>=VMM_USER_START&&dest<=VMM_USER_END) +spinUnlock(&rmpSpinLock); +else +spinUnlock(&pdSpinLock); +} + +return(source); +} + +/************************************************************************ + +Function:void*vmm_getFreeKernelPage(pidTypepid,uint16_tcount); +Description:ReturnsAFreePageMappedToTheVMSpace +Notes: + +07/30/02-ThisReturnsAFreePageInTheKernelSpace + +***********************************************************************/ +void*vmm_getFreeKernelPage(pidTypepid,uint16_tcount){ +intpdI=0x0,ptI=0x0,c=0,lc=0; + +uint32_t*pageDirectory=PD_BASE_ADDR; + +uint32_t*pageTable=0x0; + +uint32_tstartAddress=0x0; - -/************************************************************************ - -Function:voidvmmClearVirtualPage(uInt32pageAddr); - -Description:ThisWillNullOutAPageOfMemory - -Notes: - -************************************************************************/ -int -vmmClearVirtualPage(uInt32pageAddr) -{ -uInt32*src=0x0; -intcounter=0x0; +/*LockThePageDir&TablesForAllSinceKernelSpaceIsShared*/ +spinLock(&pdSpinLock); + +/*LetsSearchForAFreePage*/ +for(pdI=PD_INDEX(VMM_KERN_START);pdI<=PD_INDEX(VMM_KERN_END);pdI++){ + +if((pageDirectory[pdI]&PAGE_PRESENT)!=PAGE_PRESENT) +if(vmm_allocPageTable(pdI,pid)==-1) +kpanic("FailedToAllocatePageDir:0x%X",pdI); + +/*SetPageTableAddress*/ +pageTable=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*pdI)); + +/*LoopThroughThePageTableForAFreePage*/ +for(ptI=0;ptI<PT_ENTRIES;ptI++){ -/*SetSourcePointerToVirtualPageAddress*/ -src=(uInt32*)pageAddr; - -/*ClearOutThePage*/ -for(counter=0x0;counter<pageEntries;counter++){ -(uInt32)src[counter]=(uInt32)0x0; -} - -/*Return*/ -return(0x0); -} - +/*CheckForUnalocatedPage*/ +if((pageTable[ptI]&PAGE_PRESENT)!=PAGE_PRESENT){ +if(startAddress==0x0) +startAddress=((pdI*(PD_ENTRIES*PAGE_SIZE))+(ptI*PAGE_SIZE)); +c++; +}else{ +startAddress=0x0; +c=0; +} + +if(c==count) +gotogotPages; -void*vmmMapFromTask(pidTypepid,void*ptr,uInt32size){ -kTask_t*child=0x0; -uInt32i=0x0,x=0x0,y=0x0,count=((size+4095)/0x1000),c=0x0; -uInt16dI=0x0,tI=0x0; -uInt32baseAddr=0x0,offset=0x0; -uInt32*childPageDir=(uInt32*)0x5A00000; -uInt32*childPageTable=0x0; -uInt32*pageTableSrc=0x0; -offset=(uInt32)ptr&0xFFF; -baseAddr=(uInt32)ptr&0xFFFFF000; -child=schedFindTask(pid); -//CalculateThePageTableIndexAndPageDirectoryIndex -dI=(baseAddr/(1024*4096)); -tI=((baseAddr-(dI*(1024*4096)))/4096); -if(vmm_remapPage(child->tss.cr3,0x5A00000,KERNEL_PAGE_DEFAULT)==0x0) -K_PANIC("vmmFailed"); - -for(i=0;i<0x1000;i++){ -if(vmm_remapPage(childPageDir[i],0x5A01000+(i*0x1000),KERNEL_PAGE_DEFAULT)==0x0) -K_PANIC("ReturnedNULL"); -} -for(x=(_current->oInfo.vmStart/(1024*4096));x<1024;x++){ -pageTableSrc=(uInt32*)(tablesBaseAddress+(4096*x)); -for(y=0;y<1024;y++){ -//LoopThroughThePageTableFindAnUnAllocatedPage -if((uInt32)pageTableSrc[y]==(uInt32)0x0){ -if(count>1){ -for(c=0;((c<count)&&(y+c<1024));c++){ -if((uInt32)pageTableSrc[y+c]!=(uInt32)0x0){ -c=-1; -break; -} -} -if(c!=-1){ -for(c=0;c<count;c++){ -if((tI+c)>=0x1000){ -dI++; -tI=0-c; -} -childPageTable=(uInt32*)(0x5A01000+(0x1000*dI)); -if(vmm_remapPage(childPageTable[tI+c],((x*(1024*4096))+((y+c)*4096)),KERNEL_PAGE_DEFAULT)==0x0) -K_PANIC("remap==NULL"); -} -vmmUnmapPage(0x5A00000,1); -for(i=0;i<0x1000;i++){ -vmmUnmapPage((0x5A01000+(i*0x1000)),1); -} -return((void*)((x*(1024*4096))+(y*4096)+offset)); -} -} -else{ -//MapAPhysicalPageToTheVirtualPage -childPageTable=(uInt32*)(0x5A01000+(0x1000*dI)); -if(vmm_remapPage(childPageTable[tI],((x*(1024*4096))+(y*4096)),KERNEL_PAGE_DEFAULT)==0x0) -K_PANIC("remapFailed"); - -//ReturnTheAddressOfTheMappedInMemory -vmmUnmapPage(0x5A00000,1); -for(i=0;i<0x1000;i++){ -vmmUnmapPage((0x5A01000+(i*0x1000)),1); -} -return((void*)((x*(1024*4096))+(y*4096)+offset)); -} -} -} -} -return(0x0); -} - -void*vmm_getFreeMallocPage(uInt16count){ -uInt16x=0x0,y=0x0; -intc=0x0; -uInt32*pageTableSrc=0x0; - -spinLock(&fkpSpinLock); -/*LetsSearchForAFreePage*/ -for(x=960;x<1024;x++){ -/*SetPageTableAddress*/ -pageTableSrc=(uInt32*)(tablesBaseAddress+(0x1000*x)); -for(y=0;y<1024;y++){ -/*LoopThroughThePageTableFindAnUnAllocatedPage*/ -if((uInt32)pageTableSrc[y]==(uInt32)0x0){ +} +} + +startAddress=0x0; +gotonoPagesAvail; + +gotPages:for(c=0;c<count;c++){ +if((vmm_remapPage((uint32_t)vmm_findFreePage(pid),(startAddress+(PAGE_SIZE*c)),KERNEL_PAGE_DEFAULT,pid,1))==0x0) +K_PANIC("vmmRemapPagefailed:gfkp-1\n"); + +vmm_clearVirtualPage((uint32_t)(startAddress+(PAGE_SIZE*c))); + +} + +noPagesAvail:spinUnlock(&pdSpinLock); + +return(startAddress); +} + +/************************************************************************ + +Function:voidvmm_clearVirtualPage(uint32_tpageAddr); + +Description:ThisWillNullOutAPageOfMemory + +Notes: + +************************************************************************/ +intvmm_clearVirtualPage(uint32_tpageAddr){ +uint32_t*src=0x0; +intcounter=0x0; + +/*SetSourcePointerToVirtualPageAddress*/ +src=(uint32_t*)pageAddr; + +/*ClearOutThePage*/ +for(counter=0x0;counter<PD_ENTRIES;counter++){ +src[counter]=(uint32_t)0x0; +} + +/*Return*/ +return(0x0); +} + +void*vmm_mapFromTask(pidTypepid,void*ptr,uint32_tsize){ +kTask_t*child=0x0; +uint32_ti=0x0,x=0x0,y=0x0,count=((size+4095)/0x1000),c=0x0; +uInt32dI=0x0,tI=0x0; +uint32_tbaseAddr=0x0,offset=0x0; +uint32_t*childPageDir=(uint32_t*)0x5A00000; +uint32_t*childPageTable=0x0; +uint32_t*pageTableSrc=0x0; +offset=(uint32_t)ptr&0xFFF; +baseAddr=(uint32_t)ptr&0xFFFFF000; +child=schedFindTask(pid); +//CalculateThePageTableIndexAndPageDirectoryIndex +dI=(baseAddr/(1024*4096)); +tI=((baseAddr-(dI*(1024*4096)))/4096); + +kprintf("cr3:0x%X\n",child->tss.cr3); +if(vmm_remapPage(child->tss.cr3,0x5A00000,KERNEL_PAGE_DEFAULT,_current->id,0)==0x0) +K_PANIC("vmm_remapPage:Failed"); + +for(i=0;i<PD_ENTRIES;i++){ + +if((childPageDir[i]&PAGE_PRESENT)==PAGE_PRESENT){ +//kprintf("mapping:0x%X\n",i); +if(vmm_remapPage(childPageDir[i],0x5A01000+(i*0x1000),KERNEL_PAGE_DEFAULT,_current->id,0)==0x0) +K_PANIC("ReturnedNULL"); +} +} +kprintf("mappingcompleted\n"); +//for(x=(_current->oInfo.vmStart/(1024*4096));x<1024;x++){ +for(x=PD_INDEX(VMM_KERN_START);x<PD_INDEX(VMM_KERN_END);x++){ +//kpanic("v_mFT"); +pageTableSrc=(uint32_t*)(PT_BASE_ADDR+(4096*x)); + +for(y=0;y<1024;y++){ + +//LoopThroughThePageTableFindAnUnAllocatedPage +if((uint32_t)pageTableSrc[y]==(uint32_t)0x0){ + if(count>1){ -for(c=0;c<count;c++){ -if(y+c<1024){ -if((uInt32)pageTableSrc[y+c]!=(uInt32)0x0){ -c=-1; -break; -} -} -} -if(c!=-1){ -for(c=0;c<count;c++){ -if(vmm_remapPage((uInt32)vmmFindFreePage(sysID),((x*0x400000)+((y+c)*0x1000)),KERNEL_PAGE_DEFAULT)==0x0) -K_PANIC("remapFailed"); - -vmmClearVirtualPage((uInt32)((x*0x400000)+((y+c)*0x1000))); -} -spinUnlock(&fkpSpinLock); -return((void*)((x*0x400000)+(y*0x1000))); -} -} -else{ -/*MapAPhysicalPageToTheVirtualPage*/ -if(vmm_remapPage((uInt32)vmmFindFreePage(sysID),((x*0x400000)+(y*0x1000)),KERNEL_PAGE_DEFAULT)==0x0) -K_PANIC("Failed"); - -/*ClearThisPageSoNoGarbageIsThere*/ -vmmClearVirtualPage((uInt32)((x*0x400000)+(y*0x1000))); -/*ReturnTheAddressOfTheNewlyAllocatePage*/ -spinUnlock(&fkpSpinLock); -return((void*)((x*0x400000)+(y*0x1000))); -} -} -} -} -/*IfNoFreePageWasFoundReturnNULL*/ -spinUnlock(&fkpSpinLock); -return(0x0); -} - -intmmap(structthread*td,structmmap_args*uap){ -vm_offset_taddr=0x0; + +for(c=0;((c<count)&&(y+c<1024));c++){ + +if((uint32_t)pageTableSrc[y+c]!=(uint32_t)0x0){ + +c=-1; +break; + +} + +} + +if(c!=-1){ + +for(c=0;c<count;c++){ + +if((tI+c)>=0x1000){ + +dI++; +tI=0-c; + +} + +if((childPageDir[dI]&PAGE_PRESENT)==PAGE_PRESENT){ +//kprintf("dI:0x%X\n",dI); +childPageTable=(uint32_t*)(0x5A01000+(0x1000*dI)); + +if((childPageTable[tI+c]&PAGE_PRESENT)==PAGE_PRESENT){ +if(vmm_remapPage(childPageTable[tI+c],((x*(1024*4096))+((y+c)*4096)),KERNEL_PAGE_DEFAULT,_current->id,0)==0x0) +K_PANIC("remap==NULL"); +} +} + +} + +vmm_unmapPage(0x5A00000,1); + +for(i=0;i<0x1000;i++){ +vmm_unmapPage((0x5A01000+(i*0x1000)),1); +} -addr=(vm_offset_t)uap->addr; +return((void*)((x*(1024*4096))+(y*4096)+offset)); -#ifdefDEBUG -if(uap->addr!=0x0){ -kprintf("Addresshintsarenotsupportedyet.\n"); -} -kprintf("uap->flags:[0x%X]\n",uap->flags); -kprintf("uap->addr:[0x%X]\n",uap->addr); -kprintf("uap->len:[0x%X]\n",uap->len); -kprintf("uap->prot:[0x%X]\n",uap->prot); -kprintf("uap->fd:[%i]\n",uap->fd); -kprintf("uap->pad:[0x%X]\n",uap->pad); -kprintf("uap->pos:[0x%X]\n",uap->pos); -#endif - -if(uap->fd==-1) -td->td_retval[0]=vmmGetFreeVirtualPage(_current->id,uap->len/0x1000,VM_TASK); -else -td->td_retval[0]=0x0; -return(0x0); -} - -intobreak(structthread*td,structobreak_args*uap){ -uint32_ti=0x0; -vm_offset_told=0x0; -vm_offset_tbase=0x0; -vm_offset_tnew=0x0; - -#ifdefDEBUG -kprintf("vm_offset_t:[%i]\n",sizeof(vm_offset_t)); -kprintf("nsize:[0x%X]\n",uap->nsize); -kprintf("vm_daddr:[0x%X]\n",td->vm_daddr); -kprintf("vm_dsize:[0x%X]\n",td->vm_dsize); -kprintf("total:[0x%X]\n",td->vm_daddr+td->vm_dsize); -#endif - -new=round_page((vm_offset_t)uap->nsize); - -base=round_page((vm_offset_t)td->vm_daddr); - -old=base+ctob(td->vm_dsize); +} + +}else{ + +//MapAPhysicalPageToTheVirtualPage +childPageTable=(uint32_t*)(0x5A01000+(0x1000*dI)); +if((childPageDir[dI]&PAGE_PRESENT)==PAGE_PRESENT){ +//kprintf("eDI:0x%X",dI); +if((childPageTable[tI]&PAGE_PRESENT)==PAGE_PRESENT){ +if(vmm_remapPage(childPageTable[tI],((x*(1024*4096))+(y*4096)),KERNEL_PAGE_DEFAULT,_current->id,0)==0x0) +K_PANIC("remapFailed"); +} +} + +//ReturnTheAddressOfTheMappedInMemory +vmm_unmapPage(0x5A00000,1); + +for(i=0;i<0x1000;i++){ +vmm_unmapPage((0x5A01000+(i*0x1000)),1); +} + +return((void*)((x*(1024*4096))+(y*4096)+offset)); + +} + +} + +} + +} + +return(0x0); +} + +void*vmm_getFreeMallocPage(uInt16count){ +uInt16x=0x0,y=0x0; +intc=0x0; +uint32_t*pageTableSrc=0x0; +uint32_t*pageDirectory=0x0; -if(new<base) -K_PANIC("EINVAL"); - -if(new>old){ -for(i=old;i<new;i+=0x1000){ -if(vmm_remapPage(vmmFindFreePage(_current->id),i,PAGE_DEFAULT)==0x0) -K_PANIC("remapFailed"); -} -td->vm_dsize+=btoc(new-old); -} -elseif(new<old){ -K_PANIC("new<old"); -td->vm_dsize-=btoc(old-new); -} - -return(0x0); -} - -intmunmap(structthread*td,structmunmap_args*uap){ -/*HACK*/ -kprintf("munmap"); -return(0x0); -} - -intvmm_cleanVirtualSpace(uint32_taddr){ -intx=0x0; -inty=0x0; -uint32_t*pageTableSrc=0x0; -uint32_t*pageDir=0x0; - -pageDir=(uInt32*)parentPageDirAddr; - -#ifdefDEBUG -kprintf("CVS:[0x%X]\n",addr); -#endif - -for(x=(addr/(1024*4096));x<770;x++){ -if((pageDir[x]&PAGE_PRESENT)==PAGE_PRESENT){ -pageTableSrc=(uInt32*)(tablesBaseAddress+(0x1000*x)); -for(y=0;y<1024;y++){ -if(pageTableSrc[y]!=0x0){ -if((pageTableSrc[y]&PAGE_COW)==PAGE_COW){ -//kprintf("COWi*"); -pageTableSrc[y]=0x0; -} -elseif((pageTableSrc[y]&PAGE_STACK)==PAGE_STACK){ -//pageTableSrc[y]=0x0; -//kprintf("STACK:(%i:%i)",x,y); -} -else{ -//kprintf("+"); -} -} -} -} -} -asm( -"movl%cr3,%eax\n" -"movl%eax,%cr3\n" -); -return(0x0); -} - -/*** -END -***/ - +pageDirectory=(uint32_t*)PD_BASE_ADDR; + +spinLock(&fkpSpinLock); + +/*LetsSearchForAFreePage*/ +for(x=PD_INDEX(VMM_KERN_START);x<=PD_INDEX(VMM_KERN_END);x++){ +if((pageDirectory[x]&PAGE_PRESENT)!=PAGE_PRESENT)/*IfPageDirectoryIsNotYetAllocatedAllocateIt*/ +vmm_allocPageTable(x,sysID); + +pageTableSrc=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*x)); + +for(y=0;y<1024;y++){ +/*LoopThroughThePageTableFindAnUnAllocatedPage*/ +if((uint32_t)pageTableSrc[y]==(uint32_t)0x0){ +if(count>1){ +for(c=0;c<count;c++){ +if(y+c<1024){ +if((uint32_t)pageTableSrc[y+c]!=(uint32_t)0x0){ +c=-1; +break; +} +} +} +if(c!=-1){ +for(c=0;c<count;c++){ +if(vmm_remapPage((uint32_t)vmm_findFreePage(sysID),((x*0x400000)+((y+c)*0x1000)),KERNEL_PAGE_DEFAULT,sysID,0)==0x0) +K_PANIC("remapFailed"); + +vmm_clearVirtualPage((uint32_t)((x*0x400000)+((y+c)*0x1000))); +} +spinUnlock(&fkpSpinLock); +return((void*)((x*(PAGE_SIZE*PD_ENTRIES))+(y*PAGE_SIZE))); +} +}else{ +/*MapAPhysicalPageToTheVirtualPage*/ +if(vmm_remapPage((uint32_t)vmm_findFreePage(sysID),((x*0x400000)+(y*0x1000)),KERNEL_PAGE_DEFAULT,sysID,0)==0x0) +K_PANIC("Failed"); + +/*ClearThisPageSoNoGarbageIsThere*/ +vmm_clearVirtualPage((uint32_t)((x*0x400000)+(y*0x1000))); +/*ReturnTheAddressOfTheNewlyAllocatePage*/ +spinUnlock(&fkpSpinLock); +return((void*)((x*(PAGE_SIZE*PD_ENTRIES))+(y*PAGE_SIZE))); +} +} +} +} +/*IfNoFreePageWasFoundReturnNULL*/ +spinUnlock(&fkpSpinLock); +return(0x0); +} + +intobreak(structthread*td,structobreak_args*uap){ +uint32_ti=0x0; +vm_offset_told=0x0; +vm_offset_tbase=0x0; +vm_offset_tnew=0x0; + +/* +#ifdef_VMM_DEBUG +*/ +kprintf("vm_offset_t:[%i]\n",sizeof(vm_offset_t)); +kprintf("nsize:[0x%X]\n",uap->nsize); +kprintf("vm_daddr:[0x%X]\n",td->vm_daddr); +kprintf("vm_dsize:[0x%X]\n",td->vm_dsize); +kprintf("total:[0x%X]\n",td->vm_daddr+td->vm_dsize); +/* +#endif +*/ + +new=round_page((vm_offset_t)uap->nsize); + +base=round_page((vm_offset_t)td->vm_daddr); + +old=base+ctob(td->vm_dsize); + +if(new<base) +K_PANIC("EINVAL"); + +if(new>old){ +for(i=old;i<new;i+=0x1000){ +if(vmm_remapPage(vmm_findFreePage(_current->id),i,PAGE_DEFAULT,_current->id,0)==0x0) +K_PANIC("remapFailed"); +} +td->vm_dsize+=btoc(new-old); +}elseif(new<old){ +K_PANIC("new<old"); +td->vm_dsize-=btoc(old-new); +} + +return(0x0); +} + +intvmm_cleanVirtualSpace(uint32_taddr){ +intx=0x0; +inty=0x0; + +uint32_t*pageTableSrc=0x0; +uint32_t*pageDir=0x0; + +pageDir=(uint32_t*)PD_BASE_ADDR; + +for(x=(addr/(PD_ENTRIES*PAGE_SIZE));x<=PD_INDEX(VMM_USER_END);x++){ +if((pageDir[x]&PAGE_PRESENT)==PAGE_PRESENT){ +pageTableSrc=(uint32_t*)(PT_BASE_ADDR+(PAGE_SIZE*x)); + +for(y=0;y<PT_ENTRIES;y++){ +if((pageTableSrc[y]&PAGE_PRESENT)==PAGE_PRESENT){ +if((pageTableSrc[y]&PAGE_COW)==PAGE_COW){ +adjustCowCounter(((uint32_t)pageTableSrc[y]&0xFFFFF000),-1); +pageTableSrc[y]=0x0; +} +/* +elseif((pageTableSrc[y]&PAGE_STACK)==PAGE_STACK){ +//TODO:Weneedtofixthissowecancleanthestack! +//kprintf("PageStack!:0x%X",(x*0x400000)+(y*0x1000)); +//pageTableSrc[y]=0x0; +//MrOlsen(2016-01-18)NOTE:WHatshouldIDoHere?kprintf("STACK:(%i:%i)",x,y); +} +*/ +else{ +/* +intvmmMemoryMapIndex=((pageTableSrc[y]&0xFFFFF000)/4096); +vmmMemoryMap[vmmMemoryMapIndex].cowCounter=0x0; +vmmMemoryMap[vmmMemoryMapIndex].pid=vmmID; +vmmMemoryMap[vmmMemoryMapIndex].status=memAvail; +systemVitals->freePages++; +*/ +pageTableSrc[y]=0x0; +} +} +} +} +} + +asm( +"movl%cr3,%eax\n" +"movl%eax,%cr3\n" +); + +#ifdefVMM_DEBUG +kprintf("Here!?"); +#endif + +return(0x0); +} - + diff --git a/doc/xml/paging_8h.xml b/doc/xml/paging_8h.xml index 64c9101..fa4135e 100644 --- a/doc/xml/paging_8h.xml +++ b/doc/xml/paging_8h.xml @@ -1,270 +1,512 @@ - - - + + + paging.h - ubixos/types.h - sys/sysproto.h + sys/types.h + sys/sysproto_posix.h sys/thread.h - src/sys/include/vmm/vmm.h - src/sys/vfs/file.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/include/vmm/vmm.h + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/vmm/copyvirtualspace.c + C:/Dev/git/UbixOS/sys/vmm/vmm_allocpagetable.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + + - - - + + + - - - + + + - - - + + + - - + + + + + + - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + btoc x - (((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT) + (((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT) - - obreak - vmmGetFreeVirtualPage + - + ctob x - ((x)<<PAGE_SHIFT) + ((x)<<PAGE_SHIFT) - - obreak - vmmGetFreeVirtualPage + - + KERNEL_PAGE_DEFAULT - (PAGE_PRESENT|PAGE_WRITE) + (PAGE_PRESENT|PAGE_WRITE) - - execFile - vmm_getFreeMallocPage - vmm_pagingInit - vmm_remapPage - vmmGetFreeKernelPage - vmmGetFreePage - vmmMapFromTask + - + + PAGE_ + 0x00000100 + + + + + + + + + + PAGE_ACCESSED + 0x00000020 + + + + + + + + + + PAGE_CACHE_DISABLED + 0x00000010 + + + + + + + + + PAGE_COW 0x00000200 @@ -273,49 +515,53 @@ - - vmm_cleanVirtualSpace - vmm_pageFault - vmm_remapPage - vmmCopyVirtualSpace - vmmFreeProcessPages - vmmGetFreeVirtualPage + - + PAGE_DEFAULT - (PAGE_PRESENT|PAGE_WRITE|PAGE_USER) + (PAGE_PRESENT|PAGE_WRITE|PAGE_USER) - - elf_loadfile - execFile - kmod_load - ldEnable - obreak - sys_exec - sysExec - vmm_pageFault - vmm_remapPage - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmGetFreeVirtualPage + - + + PAGE_DIRTY + 0x00000040 + + + + + + + + + + PAGE_GLOBAL + 0x00000080 + + + + + + + + + PAGE_MASK - (PAGE_SIZE-1) + (PAGE_SIZE-1) - + - + PAGE_PRESENT 0x00000001 @@ -324,16 +570,9 @@ - - elf_loadfile - execFile - sys_exec - sysExec - vmm_cleanVirtualSpace - vmm_remapPage - vmmGetFreeVirtualPage + - + PAGE_SHIFT 12 @@ -342,23 +581,20 @@ - - sys_exec - sysExec + - + PAGE_SIZE - (1<<PAGE_SHIFT) + 0x1000 - - sysExec + - + PAGE_STACK 0x00000400 @@ -367,13 +603,9 @@ - - execFile - vmm_cleanVirtualSpace - vmm_remapPage - vmmCopyVirtualSpace + - + PAGE_USER 0x00000004 @@ -382,24 +614,20 @@ - - elf_loadfile - execFile - sys_exec - sysExec + - + PAGE_WIRED - 0x00000600 + 0x00000800 - + - + PAGE_WRITE 0x00000002 @@ -408,123 +636,135 @@ - + - - pageEntries - (pageSize/4) + + PAGE_WRITE_THROUGH + 0x00000008 - - vmm_pageFault - vmm_pagingInit - vmm_remapPage - vmmClearVirtualPage - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmFreeProcessPages - vmmGetFreeVirtualPage + - - pageLength - 0x00000400 + + PD_BASE_ADDR + 0xC0400000 - + - - pageSize - 4096 + + PD_BASE_ADDR2 + ((PAGE_SIZE << 0xA) + VMM_KERN_START) - + - - parentPageDirAddr - 0x100000 + + PD_ENTRIES + (PAGE_SIZE/4) - - vmm_cleanVirtualSpace - vmm_pageFault - vmm_remapPage - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmFreeProcessPages - vmmGetFreeVirtualPage + - + + PD_INDEX + v_addr + (v_addr >> 22) + + + + + + + + + + PD_OFFSET + v_addr + (v_addr >> 0xA) + + + + + + + + + + PT_BASE_ADDR + 0xC0000000 + + + + + + + + + + PT_ENTRIES + (PAGE_SIZE/4) + + + + + + + + + + PT_INDEX + v_addr + ((v_addr >> 12) & 0x03FF) + + + + + + + + + round_page x - (((x) + PAGE_MASK) & ~PAGE_MASK) + (((x) + PAGE_MASK) & ~PAGE_MASK) - - obreak - sys_exec - sysExec + - - tablesBaseAddress - 0xBFC00000 - - - - - - - - vmm_cleanVirtualSpace - vmm_getFreeMallocPage - vmm_getPhysicalAddr - vmm_pageFault - vmm_remapPage - vmm_setPageAttributes - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmFreeProcessPages - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - vmmMapFromTask - vmmUnmapPage - vmmUnmapPages - - + trunc_page x - ((x) & ~PAGE_MASK) + ((x) & ~PAGE_MASK) - - sys_exec - sysExec + - + VM_TASK 1 @@ -533,13 +773,9 @@ - - mmap - sysExec - sysGetFreePage - vmmGetFreeVirtualPage + - + VM_THRD 0 @@ -548,13 +784,30 @@ - - sysGetFreePage - vmmGetFreeVirtualPage + + + + + + uint32_t * + uint32_t* kernelPageDirectory + + kernelPageDirectory + + + + + + + + biosCall + execFile + execThread + vmm_pagingInit - + void void _vmm_pageFault () @@ -565,18 +818,19 @@ - + + vmm_pagingInit - + int int mmap - (struct thread *, struct mmap_args *) + (struct thread *, struct sys_mmap_args *) mmap struct thread * - struct mmap_args * + struct sys_mmap_args * @@ -584,32 +838,18 @@ - - _current - mmap_args::addr - mmap_args::fd - mmap_args::flags - taskStruct::id - kprintf - mmap_args::len - mmap_args::pad - mmap_args::pos - mmap_args::prot - thread::td_retval - VM_TASK - vmmGetFreeVirtualPage - x1000 + - + int int munmap - (struct thread *, struct munmap_args *) + (struct thread *, struct sys_munmap_args *) munmap struct thread * - struct munmap_args * + struct sys_munmap_args * @@ -617,10 +857,9 @@ - - kprintf + - + int int obreak (struct thread *, struct obreak_args *) @@ -637,28 +876,86 @@ - - _current - btoc - ctob - taskStruct::id - K_PANIC - kprintf - obreak_args::nsize - PAGE_DEFAULT - round_page - thread::vm_daddr - thread::vm_dsize - vmm_remapPage - vmmFindFreePage + - - void * - void* vmm_getFreeMallocPage - (uInt16 count) - vmm_getFreeMallocPage + + int + int vmm_cleanVirtualSpace + (uint32_t) + vmm_cleanVirtualSpace - uInt16 + uint32_t + + + + + + + + + sysExec + + + void * + void* vmm_copyVirtualSpace + (pidType) + vmm_copyVirtualSpace + + pidType + + + + + + + + + spinLock + fork_copyProcess + sys_fork + + + void * + void* vmm_createVirtualSpace + (pidType) + vmm_createVirtualSpace + + pidType + + + + + + + + + adjustCowCounter + bzero + KERNEL_PAGE_DEFAULT + PAGE_COW + PAGE_PRESENT + PAGE_SIZE + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + PT_BASE_ADDR + PT_ENTRIES + vmm_getFreePage + vmm_getPhysicalAddr + VMM_KERN_START + vmm_unmapPage + + + void * + void* vmm_getFreeKernelPage + (pidType pid, uint16_t count) + vmm_getFreeKernelPage + + pidType + pid + + + uint16_t count @@ -667,55 +964,37 @@ - - fkpSpinLock - K_PANIC - KERNEL_PAGE_DEFAULT - spinLock - spinUnlock - sysID - tablesBaseAddress - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - x1000 - getEmptyDesc + + K_PANIC + KERNEL_PAGE_DEFAULT + kpanic + PAGE_PRESENT + PAGE_SIZE + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + pdSpinLock + PT_BASE_ADDR + PT_ENTRIES + spinLock + spinUnlock + vmm_allocPageTable + vmm_clearVirtualPage + vmm_findFreePage + VMM_KERN_END + VMM_KERN_START + vmm_remapPage + biosCall + execThread - - uInt32 - uInt32 vmm_getPhysicalAddr - (uInt32) - vmm_getPhysicalAddr + + void * + void* vmm_getFreeMallocPage + (uint16_t count) + vmm_getFreeMallocPage - uInt32 - pageAddr - - - - -Function: void *vmmGetPhysicalAddr(); Description: Returns The Physical Address Of The Virtual Page Notes: - - - - tablesBaseAddress - x1000 - vmm_pageFault - vmmCopyVirtualSpace - vmmCreateVirtualSpace - - - void - void vmm_pageFault - (uInt32, uInt32, uInt32) - vmm_pageFault - - uInt32 - - - uInt32 - - - uInt32 + uint16_t + count @@ -723,32 +1002,143 @@ - - _current - adjustCowCounter - endTask - taskStruct::id - kpanic - kprintf - PAGE_COW - PAGE_DEFAULT - pageEntries - pageFaultSpinLock - parentPageDirAddr - spinLock - spinUnlock - tablesBaseAddress - taskStruct::td - thread::vm_daddr - thread::vm_dsize - vmm_getPhysicalAddr - vmmFindFreePage - vmmGetFreeVirtualPage - vmmUnmapPage - x1 - x1000 + - + + void * + void* vmm_getFreePage + (pidType) + vmm_getFreePage + + pidType + + + + + + + + + spinLock + vmm_createVirtualSpace + + + void * + void * vmm_getFreeVirtualPage + (pidType, int, int) + vmm_getFreeVirtualPage + + pidType + pid + + + int + count + + + int + type + + + + + + + + + spinLock + sys_mmap + sysGetFreePage + + + uint32_t + uint32_t vmm_getPhysicalAddr + (uint32_t) + vmm_getPhysicalAddr + + uint32_t + pageAddr + + + + +Function: void *vmm_getPhysicalAddr(); Description: Returns The Physical Address Of The Virtual Page Notes: + + + + + PT_BASE_ADDR + vmm_createVirtualSpace + + + uint32_t + uint32_t vmm_getRealAddr + (uint32_t) + vmm_getRealAddr + + uint32_t + + + + + + + + + PT_BASE_ADDR + initLNC + lncAttach + + + void * + void* vmm_mapFromTask + (pidType, void *, uint32_t) + vmm_mapFromTask + + pidType + + + void * + + + uint32_t + + + + + + + + + sdeThread + + + void + void vmm_pageFault + (struct trapframe *, uint32_t) + vmm_pageFault + + struct trapframe * + + + uint32_t + + + + + + + + + _current + taskStruct::id + kprintf + spinLock + trapframe::tf_eip + trapframe::tf_err + trapframe::tf_esp + + int int vmm_pagingInit () @@ -759,37 +1149,52 @@ - - _vmm_pageFault - K_PANIC - KERNEL_PAGE_DEFAULT - kernelPageDirectory - kprintf - memset - numPages - pageEntries - sysID - vmm_remapPage - vmmFindFreePage - vmmMemoryMap - vmmMemoryMapAddr - x1 - x1000 - vmm_init + + _vmm_pageFault + bzero + K_PANIC + KERNEL_PAGE_DEFAULT + kernelPageDirectory + kprintf + numPages + PAGE_DEFAULT + PAGE_GLOBAL + PAGE_SIZE + PAGE_STACK + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + PT_BASE_ADDR + sysID + vmm_findFreePage + VMM_KERN_END + VMM_KERN_START + VMM_MMAP_ADDR_PMODE + VMM_MMAP_ADDR_RMODE + vmm_remapPage + vmmMemoryMap + vmm_init - + int int vmm_remapPage - (uInt32, uInt32, uInt16) + (uint32_t, uint32_t, uint16_t, pidType, int haveLock) vmm_remapPage - uInt32 + uint32_t - uInt32 + uint32_t - uInt16 + uint16_t + + + pidType + + + int + haveLock @@ -797,49 +1202,34 @@ - - _current - freePage - taskStruct::id - K_PANIC - KERNEL_PAGE_DEFAULT - kprintf - PAGE_COW - PAGE_DEFAULT - PAGE_PRESENT - PAGE_STACK - pageEntries - parentPageDirAddr - rmpSpinLock - spinLock - spinUnlock - tablesBaseAddress - vmmFindFreePage - x1000 - elf_loadfile - execFile - kmod_load - ldEnable - obreak - sys_exec - sysExec - vmm_getFreeMallocPage - vmm_pagingInit - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - vmmMapFromTask + + K_PANIC + kpanic + spinLock + sysID + VMM_USER_END + VMM_USER_START + elf_load_file + execFile + freebsd6_mmap + kmod_load + ldEnable + ogDisplay_UbixOS::SetMode + sys_mmap + sysExec + vmm_getFreeKernelPage + vmm_pagingInit - + int int vmm_setPageAttributes - (uInt32, uInt16) + (uint32_t, uint16_t) vmm_setPageAttributes - uInt32 + uint32_t - uInt16 + uint16_t @@ -847,22 +1237,20 @@ - - kpanic - tablesBaseAddress - x1000 - elf_loadfile - execFile - sys_exec - sysExec + + kpanic + PT_BASE_ADDR + elf_load_file + execFile + sysExec - + int int vmmClearVirtualPage - (uInt32 pageAddr) + (uint32_t pageAddr) vmmClearVirtualPage - uInt32 + uint32_t pageAddr @@ -871,281 +1259,7 @@ - - pageEntries - vmm_getFreeMallocPage - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - - - void * - void* vmmCopyVirtualSpace - (pidType) - vmmCopyVirtualSpace - - pidType - - - - - - - - - adjustCowCounter - cvsSpinLock - kpanic - memset - PAGE_COW - PAGE_DEFAULT - PAGE_STACK - pageEntries - parentPageDirAddr - spinLock - spinUnlock - tablesBaseAddress - vmm_getPhysicalAddr - vmmGetFreeKernelPage - vmmUnmapPage - x1 - x1000 - fork_copyProcess - - - void * - void* vmmCreateVirtualSpace - (pidType) - vmmCreateVirtualSpace - - pidType - - - - - - - - - PAGE_DEFAULT - pageEntries - parentPageDirAddr - tablesBaseAddress - vmm_getPhysicalAddr - vmmGetFreePage - vmmUnmapPage - execFile - - - void * - void* vmmGetFreeKernelPage - (pidType pid, uInt16 count) - vmmGetFreeKernelPage - - pidType - pid - - - uInt16 - count - - - - - - - - - fkpSpinLock - K_PANIC - KERNEL_PAGE_DEFAULT - spinLock - spinUnlock - tablesBaseAddress - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - vmmCopyVirtualSpace - - - void * - void* vmmGetFreePage - (pidType) - vmmGetFreePage - - pidType - - - - - - - - - KERNEL_PAGE_DEFAULT - kpanic - spinLock - spinUnlock - tablesBaseAddress - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - vmmGFPlock - x1000 - vmmCreateVirtualSpace - - - void * - void* vmmGetFreeVirtualPage - (pidType, int, int) - vmmGetFreeVirtualPage - - pidType - - - int - - - int - - - - - - - - - _current - btoc - ctob - fvpSpinLock - taskStruct::id - K_PANIC - kpanic - kprintf - taskStruct::oInfo - PAGE_COW - PAGE_DEFAULT - PAGE_PRESENT - pageEntries - parentPageDirAddr - spinLock - spinUnlock - tablesBaseAddress - taskStruct::td - thread::vm_daddr - thread::vm_dsize - VM_TASK - VM_THRD - vmm_remapPage - vmmClearVirtualPage - vmmFindFreePage - osInfo::vmStart - x1 - x1000 - mmap - sysExec - sysGetFreePage - vmm_pageFault - - - void * - void* vmmMapFromTask - (pidType, void *, uInt32) - vmmMapFromTask - - pidType - - - void * - - - uInt32 - - - - - - - - - _current - tssStruct::cr3 - K_PANIC - KERNEL_PAGE_DEFAULT - taskStruct::oInfo - schedFindTask - tablesBaseAddress - taskStruct::tss - vmm_remapPage - vmmUnmapPage - osInfo::vmStart - x1000 - - - void - void vmmUnmapPage - (uInt32, int) - vmmUnmapPage - - uInt32 - - - int - - - - - - - - - tablesBaseAddress - x1000 - vmm_pageFault - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmMapFromTask - - - void - void vmmUnmapPages - (void *, uInt32) - vmmUnmapPages - - void * - - - uInt32 - - - - - - - - - tablesBaseAddress - - - - - uInt32 * - uInt32* kernelPageDirectory - - kernelPageDirectory - - - - - - - - _int8 - execFile - execThread - idt_init - vmm_pagingInit + @@ -1153,102 +1267,111 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: paging_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_PAGING_H -#define_PAGING_H - -#include<ubixos/types.h> -#include<sys/sysproto.h> -#include<sys/thread.h> - -#defineVM_THRD0 -#defineVM_TASK1 - -#definepageLength0x00000400 -#definepageSize4096 -#definepageEntries(pageSize/4) -#definetablesBaseAddress0xBFC00000 -#defineparentPageDirAddr0x100000 - -#definePAGE_COW0x00000200 -#definePAGE_STACK0x00000400 -#definePAGE_WIRED0x00000600 -#definePAGE_PRESENT0x00000001 -#definePAGE_WRITE0x00000002 -#definePAGE_USER0x00000004 -#definePAGE_DEFAULT(PAGE_PRESENT|PAGE_WRITE|PAGE_USER) -#defineKERNEL_PAGE_DEFAULT(PAGE_PRESENT|PAGE_WRITE) - -#definePAGE_SHIFT12/*LOG2(PAGE_SIZE)*/ -#definePAGE_SIZE(1<<PAGE_SHIFT)/*bytes/page*/ -#definePAGE_MASK(PAGE_SIZE-1) - -#definetrunc_page(x)((x)&~PAGE_MASK) -#defineround_page(x)(((x)+PAGE_MASK)&~PAGE_MASK) -#definectob(x)((x)<<PAGE_SHIFT) -#definebtoc(x)(((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT) - - -intvmmClearVirtualPage(uInt32pageAddr); - -voidvmmUnmapPage(uInt32,int); -voidvmmUnmapPages(void*,uInt32); -void*vmmMapFromTask(pidType,void*,uInt32); -void*vmmCopyVirtualSpace(pidType); -void*vmmGetFreePage(pidType); -void*vmmGetFreeKernelPage(pidTypepid,uInt16count); -void*vmmCreateVirtualSpace(pidType); -void*vmmGetFreeVirtualPage(pidType,int,int); - -uInt32vmm_getPhysicalAddr(uInt32); -intvmm_setPageAttributes(uInt32,uInt16); -intvmm_remapPage(uInt32,uInt32,uInt16); -intvmm_pagingInit(); -void*vmm_getFreeMallocPage(uInt16count); -voidvmm_pageFault(uInt32,uInt32,uInt32); -void_vmm_pageFault(); -intmmap(structthread*,structmmap_args*); -intobreak(structthread*,structobreak_args*); -intmunmap(structthread*,structmunmap_args*); - - -externuInt32*kernelPageDirectory; - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_VMM_PAGING_H_ +#define_VMM_PAGING_H_ + +#include<sys/types.h> +#include<sys/sysproto_posix.h> +#include<sys/thread.h> + +#definePAGE_SHIFT12//PageShift +#definePAGE_SIZE0x1000//PageSize +#definePAGE_MASK(PAGE_SIZE-1)//PageMask + +#definePD_INDEX(v_addr)(v_addr>>22)//CalcPageDirectoryIndex +#definePD_OFFSET(v_addr)(v_addr>>0xA)//CalcPageDirectoryOFfset +#definePT_INDEX(v_addr)((v_addr>>12)&0x03FF)//CalcPageTableOffset +#definePD_BASE_ADDR2((PAGE_SIZE<<0xA)+VMM_KERN_START)//FindOutWhatThisWasFor + +#definePD_BASE_ADDR0xC0400000//PageDirectoryAddressableBaseAddress +#definePT_BASE_ADDR0xC0000000//PageTableAddressableBaseAddress + +#definePD_ENTRIES(PAGE_SIZE/4)//ReturnPageDirectoryEntries +#definePT_ENTRIES(PAGE_SIZE/4)//ReturnPageTableEntries + +#defineVM_THRD0//Thread +#defineVM_TASK1//Task + +//PageFlags +#definePAGE_PRESENT0x00000001 +#definePAGE_WRITE0x00000002 +#definePAGE_USER0x00000004 +#definePAGE_WRITE_THROUGH0x00000008 +#definePAGE_CACHE_DISABLED0x00000010 +#definePAGE_ACCESSED0x00000020 +#definePAGE_DIRTY0x00000040 +#definePAGE_GLOBAL0x00000080 +#definePAGE_0x00000100 +#definePAGE_COW0x00000200 +#definePAGE_STACK0x00000400 +#definePAGE_WIRED0x00000800 + +#definePAGE_DEFAULT(PAGE_PRESENT|PAGE_WRITE|PAGE_USER) +#defineKERNEL_PAGE_DEFAULT(PAGE_PRESENT|PAGE_WRITE) + +#definetrunc_page(x)((x)&~PAGE_MASK) +#defineround_page(x)(((x)+PAGE_MASK)&~PAGE_MASK) + +#definectob(x)((x)<<PAGE_SHIFT) +#definebtoc(x)(((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT) + +intvmmClearVirtualPage(uint32_tpageAddr); + +void*vmm_mapFromTask(pidType,void*,uint32_t); +void*vmm_copyVirtualSpace(pidType); +void*vmm_getFreePage(pidType); +void*vmm_getFreeKernelPage(pidTypepid,uint16_tcount); +void*vmm_createVirtualSpace(pidType); +void*vmm_getFreeVirtualPage(pidType,int,int); + +uint32_tvmm_getPhysicalAddr(uint32_t); +uint32_tvmm_getRealAddr(uint32_t); +intvmm_setPageAttributes(uint32_t,uint16_t); +intvmm_remapPage(uint32_t,uint32_t,uint16_t,pidType,inthaveLock); +intvmm_pagingInit(); +void*vmm_getFreeMallocPage(uint16_tcount); +//voidvmm_pageFault(uint32_t,uint32_t,uint32_t); +voidvmm_pageFault(structtrapframe*,uint32_t); +void_vmm_pageFault(); +intmmap(structthread*,structsys_mmap_args*); +intobreak(structthread*,structobreak_args*); +intmunmap(structthread*,structsys_munmap_args*); + +intvmm_cleanVirtualSpace(uint32_t); +void*vmm_getFreeVirtualPage(pidTypepid,intcount,inttype); + +externuint32_t*kernelPageDirectory; + +#endif - + diff --git a/doc/xml/pbuf_8h.xml b/doc/xml/pbuf_8h.xml index 649532a..3410a65 100644 --- a/doc/xml/pbuf_8h.xml +++ b/doc/xml/pbuf_8h.xml @@ -1,321 +1,777 @@ - - - + + + pbuf.h - net/debug.h - net/arch.h - src/sys/include/net/api.h - src/sys/include/net/api_msg.h - src/sys/include/net/ipv4/icmp.h - src/sys/include/net/ipv4/inet.h - src/sys/include/net/ipv4/ip.h - src/sys/include/net/ipv6/inet.h - src/sys/include/net/netif.h - src/sys/include/net/tcp.h - src/sys/include/net/tcpip.h - src/sys/include/net/udp.h - src/sys/include/netif/arp.h - src/sys/include/netif/tcpdump.h - src/sys/net/api/tcpip.c - src/sys/net/netif/ethernetif.c + net/opt.h + net/err.h + C:/Dev/git/UbixOS/sys/include/net/icmp.h + C:/Dev/git/UbixOS/sys/include/net/icmp6.h + C:/Dev/git/UbixOS/sys/include/net/igmp.h + C:/Dev/git/UbixOS/sys/include/net/inet_chksum.h + C:/Dev/git/UbixOS/sys/include/net/ip.h + C:/Dev/git/UbixOS/sys/include/net/ip4_frag.h + C:/Dev/git/UbixOS/sys/include/net/ip6_frag.h + C:/Dev/git/UbixOS/sys/include/net/netif.h + C:/Dev/git/UbixOS/sys/include/netif/ethernet.h + C:/Dev/git/UbixOS/sys/net/api/tcpip.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/core/timeouts.c + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + - - - - + + + + - + - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - + + + + - + - + - - - - - - - - - + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + pbuf + pbuf_rom - - PBUF_FLAG_POOL - 0x02 + + LWIP_SUPPORT_CUSTOM_PBUF + ((IP_FRAG && !LWIP_NETIF_TX_SINGLE_PBUF) || (LWIP_IPV6 && LWIP_IPV6_FRAG)) + + + +LWIP_SUPPORT_CUSTOM_PBUF==1: Custom pbufs behave much like their pbuf type but they are allocated by external code (initialised by calling pbuf_alloced_custom()) and when pbuf_free gives up their last reference, they are freed by calling pbuf_custom->custom_free_function(). Currently, the pbuf_custom code is only needed for one specific configuration of IP_FRAG, unless required by external driver/application code. + + + + + + + PBUF_CHECK_FREE_OOSEQ + - + - - PBUF_FLAG_RAM - 0x00 + + PBUF_FLAG_IS_CUSTOM + 0x02U + + + +indicates this is a custom pbuf: pbuf_free calls pbuf_custom->custom_free_function() when the last reference is released (plus custom PBUF_RAM cannot be trimmed) + + + + + + + PBUF_FLAG_LLBCAST + 0x08U + + + +indicates this pbuf was received as link-level broadcast + + + + + + + PBUF_FLAG_LLMCAST + 0x10U + + + +indicates this pbuf was received as link-level multicast + + + + + + + PBUF_FLAG_MCASTLOOP + 0x04U + + + +indicates this pbuf is UDP multicast to be looped back + + + + + + + PBUF_FLAG_PUSH + 0x01U + + + +indicates this packet's data should be immediately passed to the application + + + + + + + PBUF_FLAG_TCP_FIN + 0x20U + + + +indicates this pbuf includes a TCP FIN flag + + + + + + + pbuf_init + - + - - PBUF_FLAG_ROM - 0x01 - - - - - - - - - + PBUF_IP_HLEN 20 @@ -324,9 +780,21 @@ - + - + + PBUF_POOL_FREE_OOSEQ + 1 + + + +Define this to 0 to prevent freeing ooseq pbufs when the PBUF_POOL is empty + + + + + + PBUF_TRANSPORT_HLEN 20 @@ -335,154 +803,522 @@ - + - - pbuf_flag - - PBUF_RAM - - - - - - - PBUF_ROM - - - - - - - PBUF_POOL - - - - - - - - - - - - - - + + pbuf_layer - + PBUF_TRANSPORT +Includes spare room for transport layer header, e.g. UDP header. Use this if you intend to pass the pbuf to functions like udp_send(). - + PBUF_IP +Includes spare room for IP header. Use this if you intend to pass the pbuf to functions like raw_send(). - + PBUF_LINK +Includes spare room for link layer header (ethernet header). Use this if you intend to pass the pbuf to functions like ethernet_output(). PBUF_LINK_HLEN + + - + + PBUF_RAW_TX + + + +Includes spare room for additional encapsulation header before ethernet headers (e.g. 802.11). Use this if you intend to pass the pbuf to functions like netif->linkoutput(). PBUF_LINK_ENCAPSULATION_HLEN + + + + + PBUF_RAW +Use this for input packets in a netif driver when calling netif->input() in the most common case - ethernet-layer netif driver. +Enumeration of pbuf layers - + + + + + pbuf_type + + PBUF_RAM + + + +pbuf data is stored in RAM, used for TX mostly, struct pbuf and its payload are allocated in one piece of contiguous memory (so the first payload byte can be calculated from struct pbuf). pbuf_alloc() allocates PBUF_RAM pbufs as unchained pbufs (although that might change in future versions). This should be used for all OUTGOING packets (TX). + + + + PBUF_ROM + + + +pbuf data is stored in ROM, i.e. struct pbuf and its payload are located in totally different memory areas. Since it points to ROM, payload does not have to be copied when queued for transmission. + + + + PBUF_REF + + + +pbuf comes from the pbuf pool. Much like PBUF_ROM but payload might change so it has to be duplicated when queued before transmitting, depending on who has a 'ref' to it. + + + + PBUF_POOL + + + +pbuf payload refers to RAM. This one comes from a pool and should be used for RX. Payload can be chained (scatter-gather RX) but like PBUF_RAM, struct pbuf and its payload are allocated in one piece of contiguous memory (so the first payload byte can be calculated from struct pbuf). Don't use this for TX, if the pool becomes empty e.g. because of TCP queuing, you are unable to receive TCP acks! + + + + + +Enumeration of pbuf types + + + + - - pbuf * + + struct pbuf * struct pbuf* pbuf_alloc - (pbuf_layer l, uInt16 size, pbuf_flag flag) + (pbuf_layer l, u16_t length, pbuf_type type) pbuf_alloc - pbuf_layer + pbuf_layer l + layer - uInt16 - size + u16_t + length - pbuf_flag - flag + pbuf_type + type +Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type). +The actual memory allocated for the pbuf is determined by the layer at which the pbuf is allocated and the requested size (from the size parameter). + + +layer + + +flag to define header size + + + + +length + + +size of the pbuf's payload + + + + +type + + +this parameter decides how and where the pbuf should be allocated as follows: + + + + +PBUF_RAM: buffer memory for pbuf is allocated as one large chunk. This includes protocol headers as well. +PBUF_ROM: no buffer memory is allocated for the pbuf, even for protocol headers. Additional headers must be prepended by allocating another pbuf and chain in to the front of the ROM pbuf. It is assumed that the memory used is really similar to ROM in that it is immutable and will not be changed. Memory which is dynamic should generally not be attached to PBUF_ROM pbufs. Use PBUF_REF instead. +PBUF_REF: no buffer memory is allocated for the pbuf, even for protocol headers. It is assumed that the pbuf is only being used in a single thread. If the pbuf gets queued, then pbuf_take should be called to copy the buffer. +PBUF_POOL: the pbuf is allocated as a pbuf chain, with pbufs from the pbuf pool that is allocated during pbuf_init(). + + +the allocated pbuf. If multiple pbufs where allocated, this is the first pbuf of a pbuf chain. + + - - arp_query - ethernetif_output - loopif_output - low_level_input - netbuf_alloc - netbuf_ref + + pbuf::flags + pbuf::len + LWIP_ASSERT + LWIP_DBG_LEVEL_SERIOUS + LWIP_DBG_TRACE + LWIP_DEBUGF + LWIP_MEM_ALIGN + LWIP_MEM_ALIGN_SIZE + LWIP_MIN + MEM_ALIGNMENT + mem_malloc + memp_malloc + pbuf::next + NULL + pbuf::payload + PBUF_DEBUG + pbuf_free + PBUF_IP + PBUF_IP_HLEN + PBUF_LINK + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_POOL + PBUF_POOL_BUFSIZE_ALIGNED + PBUF_POOL_IS_EMPTY + PBUF_RAM + PBUF_RAW + PBUF_RAW_TX + PBUF_REF + PBUF_ROM + PBUF_TRANSPORT + PBUF_TRANSPORT_HLEN + pbuf::ref + SIZEOF_STRUCT_PBUF + pbuf::tot_len + pbuf::type + U16_F + pbuf_coalesce + arp_query - + + void + void pbuf_cat + (struct pbuf *head, struct pbuf *tail) + pbuf_cat + + struct pbuf * + head + h + + + struct pbuf * + tail + t + + + + +Concatenate two pbufs (each may be a pbuf chain) and take over the caller's reference of the tail pbuf. +The caller MAY NOT reference the tail pbuf afterwards. Use pbuf_chain() for that purpose. + +pbuf_chain() + + + + + + + LWIP_ERROR + NULL + pbuf::next + pbuf::tot_len + LWIP_ASSERT + pbuf::len + pbuf_chain + + void void pbuf_chain - (struct pbuf *h, struct pbuf *t) + (struct pbuf *head, struct pbuf *tail) pbuf_chain struct pbuf * - h + head + h struct pbuf * - t + tail + t +Chain two pbufs (or pbuf chains) together. +The caller MUST call pbuf_free(t) once it has stopped using it. Use pbuf_cat() instead if you no longer use t. + + +h + + +head pbuf (chain) + + + + +t + + +tail pbuf (chain) + + + +The pbufs MUST belong to the same packet. + +MAY NOT be called on a packet queue. + +The ->tot_len fields of all pbufs of the head chain are adjusted. The ->next field of the last pbuf of the head chain is adjusted. The ->ref field of the first pbuf of the tail chain is adjusted. - - ethernetif_output - netbuf_chain + + pbuf_cat + pbuf_ref + LWIP_DEBUGF + PBUF_DEBUG + LWIP_DBG_TRACE - - uInt8 - uInt8 pbuf_clen - (struct pbuf *p) + + u16_t + u16_t pbuf_clen + (const struct pbuf *p) pbuf_clen - struct pbuf * + const struct pbuf * p +Count number of pbufs in a chain + + +p + + +first pbuf of chain + + + +the number of pbufs in a chain + + - + + pbuf::next + NULL - - pbuf * + + struct pbuf * + struct pbuf* pbuf_coalesce + (struct pbuf *p, pbuf_layer layer) + pbuf_coalesce + + struct pbuf * + p + + + pbuf_layer + layer + + + + +Creates a single pbuf out of a queue of pbufs. +: Either the source pbuf 'p' is freed by this function or the original pbuf 'p' is returned, therefore the caller has to check the result! + + + +p + + +the source pbuf + + + + +layer + + +pbuf_layer of the new pbuf + + + +a new, single pbuf (p->next is NULL) or the old pbuf if allocation fails + + + + + + + pbuf::next + NULL + pbuf_alloc + pbuf::tot_len + PBUF_RAM + pbuf_copy + LWIP_UNUSED_ARG + LWIP_ASSERT + ERR_OK + pbuf_free + + + err_t + err_t pbuf_copy + (struct pbuf *p_to, const struct pbuf *p_from) + pbuf_copy + + struct pbuf * + p_to + + + const struct pbuf * + p_from + + + + +Create PBUF_RAM copies of pbufs. +Used to queue packets on behalf of the lwIP stack, such as ARP based queueing. +You MUST explicitly use p = pbuf_take(p); + +Only one packet is copied, no packet queue! + + + +p_to + + +pbuf destination of the copy + + + + +p_from + + +pbuf source of the copy + + + +ERR_OK if pbuf was copied ERR_ARG if one of the pbufs is NULL or p_to is not big enough to hold p_from + + + + + + + pbuf::len + LWIP_DEBUGF + PBUF_DEBUG + LWIP_DBG_TRACE + LWIP_ERROR + NULL + ERR_ARG + MEMCPY + LWIP_ASSERT + ERR_VAL + ERR_OK + pbuf_coalesce + + + u16_t + u16_t pbuf_copy_partial + (const struct pbuf *p, void *dataptr, u16_t len, u16_t offset) + pbuf_copy_partial + + const struct pbuf * + p + buf + + + void * + dataptr + + + u16_t + len + + + u16_t + offset + + + + +Copy (part of) the contents of a packet buffer to an application supplied buffer. + + +buf + + +the pbuf from which to copy data + + + + +dataptr + + +the application supplied buffer + + + + +len + + +length of data to copy (dataptr must be big enough). No more than buf->tot_len will be copied, irrespective of len + + + + +offset + + +offset into the packet buffer from where to begin copying len bytes + + + +the number of bytes copied, or 0 on failure + + + + + + + LWIP_ERROR + NULL + pbuf::len + pbuf::next + MEMCPY + pbuf::payload + + + struct pbuf * struct pbuf* pbuf_dechain (struct pbuf *p) pbuf_dechain @@ -493,14 +1329,38 @@ +Dechains the first pbuf from its succeeding pbufs in the chain. +Makes p->tot_len field equal to p->len. + +p + + +pbuf to dechain + + + +remainder of the pbuf chain, or NULL if it was de-allocated. + +May not be called on a packet queue. + + - + + pbuf::len + LWIP_ASSERT + LWIP_DBG_TRACE + LWIP_DEBUGF + pbuf::next + NULL + PBUF_DEBUG + pbuf_free + pbuf::tot_len - - uInt8 - uInt8 pbuf_free + + u8_t + u8_t pbuf_free (struct pbuf *p) pbuf_free @@ -510,84 +1370,437 @@ +Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain or queue. +Decrements the pbuf reference count. If it reaches zero, the pbuf is deallocated. +For a pbuf chain, this is repeated for each pbuf in the chain, up to the first pbuf which has a non-zero reference count after decrementing. So, when all reference counts are one, the whole chain is free'd. + + +p + + +The pbuf (chain) to be dereferenced. + + + +the number of pbufs that were de-allocated from the head of the chain. + +MUST NOT be called on a packet queue (Not verified to work yet). + +the reference counter of a pbuf equals the number of pointers that refer to the pbuf (or into the pbuf). + + +examples: +Assuming existing chains a->b->c with the following reference counts, calling pbuf_free(a) results in: +1->2->3 becomes ...1->3 3->3->3 becomes 2->3->3 1->1->2 becomes ......1 2->1->1 becomes 1->1->1 1->1->1 becomes ....... + - - arp_arp_input - ethernetif_input - ethernetif_output - netbuf_alloc - netbuf_delete - netbuf_free - netbuf_ref - netconn_delete - recv_tcp - recv_udp - tcpip_input + + _current + taskStruct::id + LWIP_ASSERT + LWIP_DBG_LEVEL_SERIOUS + LWIP_DBG_TRACE + LWIP_DEBUGF + mem_free + memp_free + pbuf::next + NULL + PBUF_DEBUG + PBUF_FLAG_IS_CUSTOM + PBUF_POOL + PBUF_RAM + PBUF_REF + PBUF_ROM + PERF_START + PERF_STOP + pbuf::ref + SYS_ARCH_DECL_PROTECT + SYS_ARCH_PROTECT + SYS_ARCH_UNPROTECT + pbuf::type + U16_F + pbuf_alloc + pbuf_realloc + pbuf_dechain + pbuf_coalesce + arp_arp_input - - uInt8 - uInt8 pbuf_header - (struct pbuf *p, Int16 header_size) + + u8_t + u8_t pbuf_get_at + (const struct pbuf *p, u16_t offset) + pbuf_get_at + + const struct pbuf * + p + + + u16_t + offset + + + + +Get one byte from the specified position in a pbuf WARNING: returns zero for offset >= p->tot_len + + +p + + +pbuf to parse + + + + +offset + + +offset into p of the byte to return + + + +byte at an offset into p OR ZERO IF 'offset' >= p->tot_len + + + + + + + pbuf_try_get_at + pbuf_memcmp + + + u8_t + u8_t pbuf_header + (struct pbuf *p, s16_t header_size) pbuf_header struct pbuf * p - Int16 + s16_t header_size + header_size_increment +Adjusts the payload pointer to hide or reveal headers in the payload. +Adjusts the ->payload pointer so that space for a header (dis)appears in the pbuf payload. +The ->payload, ->tot_len and ->len fields are adjusted. + + +p + + +pbuf to change the header size. + + + + +header_size_increment + + +Number of bytes to increment header size which increases the size of the pbuf. New space is on the front. (Using a negative value decreases the header size.) If hdr_size_inc is 0, this function does nothing and returns successful. + + + +PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so the call will fail. A check is made that the increase in header size does not move the payload pointer in front of the start of the buffer. non-zero on failure, zero on success. + + - - ethernetif_input - ethernetif_output + - - void - void pbuf_init - (void) - pbuf_init + + u8_t + u8_t pbuf_header_force + (struct pbuf *p, s16_t header_size) + pbuf_header_force - void + struct pbuf * + p + + + s16_t + header_size + header_size_increment +Same as pbuf_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX. - - net_init + - + + u16_t + u16_t pbuf_memcmp + (const struct pbuf *p, u16_t offset, const void *s2, u16_t n) + pbuf_memcmp + + const struct pbuf * + p + + + u16_t + offset + + + const void * + s2 + + + u16_t + n + + + + +Compare pbuf contents at specified offset with memory s2, both of length n + + +p + + +pbuf to compare + + + + +offset + + +offset into p at which to start comparing + + + + +s2 + + +buffer to compare + + + + +n + + +length of buffer to compare + + + +zero if equal, nonzero otherwise (0xffff if p is too short, diffoffset+1 otherwise) + + + + + + + pbuf::tot_len + NULL + pbuf::len + pbuf::next + pbuf_get_at + pbuf_memfind + + + u16_t + u16_t pbuf_memfind + (const struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset) + pbuf_memfind + + const struct pbuf * + p + + + const void * + mem + + + u16_t + mem_len + + + u16_t + start_offset + + + + +Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset. + + +p + + +pbuf to search, maximum length is 0xFFFE since 0xFFFF is used as return value 'not found' + + + + +mem + + +search for the contents of this buffer + + + + +mem_len + + +length of 'mem' + + + + +start_offset + + +offset into p at which to start searching + + + +0xFFFF if substr was not found in p or the index where it was found + + + + + + + pbuf::tot_len + pbuf_memcmp + pbuf_strstr + + + void + void pbuf_put_at + (struct pbuf *p, u16_t offset, u8_t data) + pbuf_put_at + + struct pbuf * + p + + + u16_t + offset + + + u8_t + data + + + + +Put one byte to the specified position in a pbuf WARNING: silently ignores offset >= p->tot_len + + +p + + +pbuf to fill + + + + +offset + + +offset into p of the byte to write + + + + +data + + +byte to write at an offset into p + + + + + + + + + pbuf_skip + NULL + pbuf::len + pbuf::payload + + void void pbuf_realloc - (struct pbuf *p, uInt16 size) + (struct pbuf *p, u16_t size) pbuf_realloc struct pbuf * p - uInt16 + u16_t size + new_len +Shrink a pbuf chain to a desired length. + + +p + + +pbuf to shrink. + + + + +new_len + + +desired new length of pbuf chain + + + +Depending on the desired length, the first few pbufs in a chain might be skipped and left unchanged. The new last pbuf in the chain will be resized, and any remaining pbufs will be freed. +If the pbuf is ROM/REF, only the ->tot_len and ->len fields are adjusted. + +May not be called on a packet queue. + +Despite its name, pbuf_realloc cannot grow the size of a pbuf (chain). + + - + + LWIP_ASSERT + NULL + pbuf::type + PBUF_POOL + PBUF_ROM + PBUF_RAM + PBUF_REF + pbuf::tot_len + pbuf::len + pbuf::next + LWIP_SUPPORT_CUSTOM_PBUF + pbuf::flags + PBUF_FLAG_IS_CUSTOM + mem_trim + pbuf::payload + pbuf_free - + void void pbuf_ref (struct pbuf *p) @@ -599,170 +1812,499 @@ +Increment the reference count of the pbuf. + + +p + + +pbuf to increase reference counter of + + + + - + + NULL + SYS_ARCH_INC + pbuf::ref + LWIP_ASSERT + pbuf_chain + + + struct pbuf * + struct pbuf* pbuf_skip + (struct pbuf *in, u16_t in_offset, u16_t *out_offset) + pbuf_skip + + struct pbuf * + in + + + u16_t + in_offset + + + u16_t * + out_offset + + + + +Skip a number of bytes at the start of a pbuf + + +in + + +input pbuf + + + + +in_offset + + +offset to skip + + + + +out_offset + + +resulting offset in the returned pbuf + + + +the pbuf in the queue where the offset is + + + + + + + pbuf_take_at + pbuf_put_at + + + u16_t + u16_t pbuf_strstr + (const struct pbuf *p, const char *substr) + pbuf_strstr + + const struct pbuf * + p + + + const char * + substr + + + + +Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to strstr(), this one does not stop at the first \0 in the pbuf/source string! + + +p + + +pbuf to search, maximum length is 0xFFFE since 0xFFFF is used as return value 'not found' + + + + +substr + + +string to search for in p, maximum length is 0xFFFE + + + +0xFFFF if substr was not found in p or the index where it was found + + + + + + + NULL + pbuf_memfind + strlen + pbuf::tot_len + + + err_t + err_t pbuf_take + (struct pbuf *buf, const void *dataptr, u16_t len) + pbuf_take + + struct pbuf * + buf + + + const void * + dataptr + + + u16_t + len + + + + +Copy application supplied data into a pbuf. This function can only be used to copy the equivalent of buf->tot_len data. + + +buf + + +pbuf to fill with data + + + + +dataptr + + +application supplied data buffer + + + + +len + + +length of the application supplied data buffer + + + +ERR_OK if successful, ERR_MEM if the pbuf is not big enough + + + + + + + pbuf::len + LWIP_ERROR + NULL + ERR_ARG + ERR_MEM + pbuf::next + LWIP_ASSERT + MEMCPY + pbuf::payload + ERR_OK + pbuf_take_at + + + err_t + err_t pbuf_take_at + (struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset) + pbuf_take_at + + struct pbuf * + buf + + + const void * + dataptr + + + u16_t + len + + + u16_t + offset + + + + +Same as pbuf_take() but puts data at an offset + + +buf + + +pbuf to fill with data + + + + +dataptr + + +application supplied data buffer + + + + +len + + +length of the application supplied data buffer + + + + +offset + + +offset in pbuf where to copy dataptr to + + + +ERR_OK if successful, ERR_MEM if the pbuf is not big enough + + + + + + + pbuf_skip + NULL + pbuf::tot_len + pbuf::len + LWIP_MIN + MEMCPY + pbuf::payload + pbuf_take + pbuf::next + ERR_OK + ERR_MEM + + + int + int pbuf_try_get_at + (const struct pbuf *p, u16_t offset) + pbuf_try_get_at + + const struct pbuf * + p + + + u16_t + offset + + + + +Get one byte from the specified position in a pbuf + + +p + + +pbuf to parse + + + + +offset + + +offset into p of the byte to return + + + +byte at an offset into p [0..0xFF] OR negative if 'offset' >= p->tot_len + + + + + + + pbuf_get_at +pbuf API -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: pbuf_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -/*-----------------------------------------------------------------------------------*/ -#ifndef__LWIP_PBUF_H__ -#define__LWIP_PBUF_H__ - -#include"net/debug.h" -#include"net/arch.h" - - -#definePBUF_TRANSPORT_HLEN20 -#definePBUF_IP_HLEN20 - -typedefenum{ -PBUF_TRANSPORT, -PBUF_IP, -PBUF_LINK, -PBUF_RAW -}pbuf_layer; - -typedefenum{ -PBUF_RAM, -PBUF_ROM, -PBUF_POOL -}pbuf_flag; - -/*Definitionsforthepbufflagfield(thesearenottheflagsthat -arepassedtopbuf_alloc()).*/ -#definePBUF_FLAG_RAM0x00/*FlagsthatpbufdataisstoredinRAM.*/ -#definePBUF_FLAG_ROM0x01/*FlagsthatpbufdataisstoredinROM.*/ -#definePBUF_FLAG_POOL0x02/*Flagsthatthepbufcomesfromthe -pbufpool.*/ - -structpbuf{ -structpbuf*next; - -/*high4bits,flags,low4bitsreferencecount*/ -uInt8flags,ref; -void*payload; - -/*Totallengthofbuffer+additionallychainedbuffers.*/ -uInt16tot_len; -/*Lengthofthisbuffer.*/ -uInt16len; - -}; - -/*pbuf_init(): - -Initializesthepbufmodule.Thenumparameterdetermineshowmany -pbufsthatshouldbeallocatedtothepbufpool,andthesize -parameterspecifiesthesizeofthedataallocatedtothose.*/ -voidpbuf_init(void); - -/*pbuf_alloc(): - -Allocatesapbufatprotocollayerl.Theactualmemoryallocated -forthepbufisdeterminedbythelayeratwhichthepbufis -allocatedandtherequestedsize(fromthesizeparameter).The -flagparameterdecideshowandwherethepbufshouldbeallocated -asfollows: - -*PBUF_RAM:buffermemoryforpbufisallocatedasonelarge -chunk.Thisincludesprotocolheadersaswell. - -*RBUF_ROM:nobuffermemoryisallocatedforthepbuf,evenfor -protocolheaders.Additionalheadersmustbe -prependedbyallocatinganotherpbufandchaininto -thefrontoftheROMpbuf. - -*PBUF_ROOL:thepbufisallocatedasapbufchain,withpbufsfrom -thepbufpoolthatisallocatedduringpbuf_init().*/ -structpbuf*pbuf_alloc(pbuf_layerl,uInt16size,pbuf_flagflag); - -/*pbuf_realloc(): - -Shrinksthepbuftothesizegivenbythesizeparameter. -*/ -voidpbuf_realloc(structpbuf*p,uInt16size); - -/*pbuf_header(): - -Triestomovethep->payloadpointerheader_sizenumberofbytes -upwardwithinthepbuf.Thereturnvalueisnon-zeroifit -fails.Ifso,anadditionalpbufshouldbeallocatedfortheheader -anditshouldbechainedtothefront.*/ -uInt8pbuf_header(structpbuf*p,Int16header_size); - -/*pbuf_ref(): - -Incrementsthereferencecountofthepbufp. -*/ -voidpbuf_ref(structpbuf*p); + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ + +#ifndefLWIP_HDR_PBUF_H +#defineLWIP_HDR_PBUF_H + +#include<net/opt.h> +#include<net/err.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifndefLWIP_SUPPORT_CUSTOM_PBUF +#defineLWIP_SUPPORT_CUSTOM_PBUF((IP_FRAG&&!LWIP_NETIF_TX_SINGLE_PBUF)||(LWIP_IPV6&&LWIP_IPV6_FRAG)) +#endif + +/*@todo:Weneedamechanismtopreventwastingmemoryineverypbuf +(TCPvs.UDP,IPv4vs.IPv6:UDP/IPv4packetsmaywasteupto28bytes)*/ + +#definePBUF_TRANSPORT_HLEN20 +#ifLWIP_IPV6 +#definePBUF_IP_HLEN40 +#else +#definePBUF_IP_HLEN20 +#endif + +typedefenum{ +PBUF_TRANSPORT, +PBUF_IP, +PBUF_LINK, +PBUF_RAW_TX, +PBUF_RAW +}pbuf_layer; + +typedefenum{ +PBUF_RAM, +PBUF_ROM, +PBUF_REF, +PBUF_POOL +}pbuf_type; + -/*pbuf_free(): - -Decrementsthereferencecountanddeallocatesthepbufifthe -referencecountiszero.Ifthepbufisachainallpbufsinthe -chainaredeallocated.*/ -uInt8pbuf_free(structpbuf*p); - -/*pbuf_clen(): - -Returnsthelengthofthepbufchain.*/ -uInt8pbuf_clen(structpbuf*p); +#definePBUF_FLAG_PUSH0x01U + +#definePBUF_FLAG_IS_CUSTOM0x02U + +#definePBUF_FLAG_MCASTLOOP0x04U + +#definePBUF_FLAG_LLBCAST0x08U + +#definePBUF_FLAG_LLMCAST0x10U -/*pbuf_chain(): - -Chainspbuftontheendofpbufh.Pbufhwillhaveit'stot_len -fieldadjustedaccordingly.Pbuftshouldnobeusedanymoreafter -acalltothisfunction,sincepbuftisnowapartofpbufh.*/ -voidpbuf_chain(structpbuf*h,structpbuf*t); +#definePBUF_FLAG_TCP_FIN0x20U + +structpbuf{ +structpbuf*next; -/*pbuf_dechain(): - -Picksoffthefirstpbuffromthepbufchainp.Returnsthetailof -thepbufchainorNULLifthepbufpwasnotchained.*/ -structpbuf*pbuf_dechain(structpbuf*p); - -#endif/*__LWIP_PBUF_H__*/ +void*payload; + +u16_ttot_len; + +u16_tlen; + +u8_t/*pbuf_type*/type; + +u8_tflags; + +u16_tref; +}; + + +structpbuf_rom{ +structpbuf*next; + +constvoid*payload; +}; + +#ifLWIP_SUPPORT_CUSTOM_PBUF + +typedefvoid(*pbuf_free_custom_fn)(structpbuf*p); + +structpbuf_custom{ +structpbufpbuf; +pbuf_free_custom_fncustom_free_function; +}; +#endif/*LWIP_SUPPORT_CUSTOM_PBUF*/ + +#ifndefPBUF_POOL_FREE_OOSEQ +#definePBUF_POOL_FREE_OOSEQ1 +#endif/*PBUF_POOL_FREE_OOSEQ*/ +#ifLWIP_TCP&&TCP_QUEUE_OOSEQ&&NO_SYS&&PBUF_POOL_FREE_OOSEQ +externvolatileu8_tpbuf_free_ooseq_pending; +voidpbuf_free_ooseq(void); +#definePBUF_CHECK_FREE_OOSEQ()do{if(pbuf_free_ooseq_pending){\ +/*pbuf_alloc()reportedPBUF_POOLtobeempty->trytofreesome\ +ooseqqueuedpbufsnow*/\ +pbuf_free_ooseq();}}while(0) +#else/*LWIP_TCP&&TCP_QUEUE_OOSEQ&&NO_SYS&&PBUF_POOL_FREE_OOSEQ*/ +/*OtherwisedeclareanemptyPBUF_CHECK_FREE_OOSEQ*/ +#definePBUF_CHECK_FREE_OOSEQ() +#endif/*LWIP_TCP&&TCP_QUEUE_OOSEQ&&NO_SYS&&PBUF_POOL_FREE_OOSEQ*/ + +/*Initializesthepbufmodule.Thiscallisemptyfornow,butmaynotbeinfuture.*/ +#definepbuf_init() + +structpbuf*pbuf_alloc(pbuf_layerl,u16_tlength,pbuf_typetype); +#ifLWIP_SUPPORT_CUSTOM_PBUF +structpbuf*pbuf_alloced_custom(pbuf_layerl,u16_tlength,pbuf_typetype, +structpbuf_custom*p,void*payload_mem, +u16_tpayload_mem_len); +#endif/*LWIP_SUPPORT_CUSTOM_PBUF*/ +voidpbuf_realloc(structpbuf*p,u16_tsize); +u8_tpbuf_header(structpbuf*p,s16_theader_size); +u8_tpbuf_header_force(structpbuf*p,s16_theader_size); +voidpbuf_ref(structpbuf*p); +u8_tpbuf_free(structpbuf*p); +u16_tpbuf_clen(conststructpbuf*p); +voidpbuf_cat(structpbuf*head,structpbuf*tail); +voidpbuf_chain(structpbuf*head,structpbuf*tail); +structpbuf*pbuf_dechain(structpbuf*p); +err_tpbuf_copy(structpbuf*p_to,conststructpbuf*p_from); +u16_tpbuf_copy_partial(conststructpbuf*p,void*dataptr,u16_tlen,u16_toffset); +err_tpbuf_take(structpbuf*buf,constvoid*dataptr,u16_tlen); +err_tpbuf_take_at(structpbuf*buf,constvoid*dataptr,u16_tlen,u16_toffset); +structpbuf*pbuf_skip(structpbuf*in,u16_tin_offset,u16_t*out_offset); +structpbuf*pbuf_coalesce(structpbuf*p,pbuf_layerlayer); +#ifLWIP_CHECKSUM_ON_COPY +err_tpbuf_fill_chksum(structpbuf*p,u16_tstart_offset,constvoid*dataptr, +u16_tlen,u16_t*chksum); +#endif/*LWIP_CHECKSUM_ON_COPY*/ +#ifLWIP_TCP&&TCP_QUEUE_OOSEQ&&LWIP_WND_SCALE +voidpbuf_split_64k(structpbuf*p,structpbuf**rest); +#endif/*LWIP_TCP&&TCP_QUEUE_OOSEQ&&LWIP_WND_SCALE*/ + +u8_tpbuf_get_at(conststructpbuf*p,u16_toffset); +intpbuf_try_get_at(conststructpbuf*p,u16_toffset); +voidpbuf_put_at(structpbuf*p,u16_toffset,u8_tdata); +u16_tpbuf_memcmp(conststructpbuf*p,u16_toffset,constvoid*s2,u16_tn); +u16_tpbuf_memfind(conststructpbuf*p,constvoid*mem,u16_tmem_len,u16_tstart_offset); +u16_tpbuf_strstr(conststructpbuf*p,constchar*substr); + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_PBUF_H*/ - + diff --git a/doc/xml/pci_8c.xml b/doc/xml/pci_8c.xml index fca846e..0b78e8b 100644 --- a/doc/xml/pci_8c.xml +++ b/doc/xml/pci_8c.xml @@ -1,53 +1,169 @@ - - - + + + pci.c pci/pci.h sys/io.h - ubixos/types.h lib/kprintf.h - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + uInt8 + uInt8 baseClass + + baseClass + + + + + + + + + + uInt8 + uInt8 interface + + interface + + + + + + + + + + const char * + const char* name + + name + + + + + + + + _initHardDisk + fatfs_format + lookup + netif_find + pci_init + sysMpiPostMessage + ubixfs_cacheNew + + + const struct @29 + const struct @29 pciClasses[] + [] + pciClasses + + + + + + + + pci_init + + + uInt8 + uInt8 subClass + + subClass + + + + + + + + + - + int int pci_init () @@ -58,25 +174,26 @@ - - pciConfig::baseClass - confadd::bus - countof - confadd::dev - confadd::func - pciConfig::interface - pciConfig::irq - kprintf - name - pciClasses - pciProbe - pciConfig::subClass - TRUE + + pciConfig::bus + pciConfig::classCode + countof + pciConfig::dev + pciConfig::func + pciConfig::intLine + pciConfig::intPin + kprintf + name + pciClasses + pciProbe + pciConfig::progIf + pciConfig::subClass + pciConfig::vendorID - - bool - bool pciProbe - (int bus, int dev, int func, struct pciConfig *cfg) + + uint32_t + uint32_t pciProbe + (int bus, int dev, int func) pciProbe int @@ -90,46 +207,40 @@ int func - - struct pciConfig * - cfg - - - pciConfig::base - pciConfig::baseClass - pciConfig::bist - pciConfig::bus - pciConfig::cacheLineSize - pciConfig::command - pciConfig::dev - pciConfig::deviceId - FALSE - pciConfig::func - pciConfig::headerType - pciConfig::interface - pciConfig::irq - kprintf - pciConfig::latencyTimer - pciRead - pciWrite - pciConfig::size - pciConfig::status - pciConfig::subClass - pciConfig::subsys - pciConfig::subsysVendor - TRUE - pciConfig::vendorId - x10 - pci_init + + pciConfig::bar + pciConfig::bist + pciConfig::bus + pciConfig::cacheLineSize + pciConfig::classCode + pciConfig::command + pciConfig::dev + pciConfig::deviceID + pciConfig::func + pciConfig::headerType + pciConfig::intLine + pciConfig::intPin + kfree + kmalloc + kprintf + pciConfig::latencyTimer + memset + pciRead + pciWrite + pciConfig::progIf + pciConfig::status + pciConfig::subClass + pciConfig::vendorID + pci_init - - uInt32 + + uInt32 uInt32 pciRead (int bus, int dev, int func, int reg, int bytes) pciRead @@ -159,14 +270,19 @@ - - inportByte - inportDWord - inportWord - outportDWord - pciProbe + + confadd::bus + confadd::dev + confadd::enable + confadd::func + inportByte + inportDWord + inportWord + outportDWord + confadd::reg + pciProbe - + void void pciWrite (int bus, int dev, int func, int reg, uInt32 v, int bytes) @@ -188,7 +304,7 @@ reg - uInt32 + uInt32 v @@ -201,83 +317,16 @@ - - outportByte - outportDWord - outportWord - pciProbe - - - - - uInt8 - uInt8 baseClass - - baseClass - - - - - - - - - - uInt8 - uInt8 interface - - interface - - - - - - - - - - const char * - const char* name - - name - - - - - - - - def_ctls - initHardDisk - lookup - pci_init - - - @7 - struct @7 pciClasses[] - [] - pciClasses - - - - - - - - pci_init - - - uInt8 - uInt8 subClass - - subClass - - - - - - - + + confadd::bus + confadd::dev + confadd::enable + confadd::func + outportByte + outportDWord + outportWord + confadd::reg + pciProbe @@ -285,351 +334,276 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pci_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<pci/pci.h> -#include<sys/io.h> -#include<ubixos/types.h> -#include<lib/kprintf.h> - -conststruct{ -uInt8baseClass; -uInt8subClass; -uInt8interface; -constchar*name; -}pciClasses[]={ -{0x00,0x00,0x00,"Undefined"}, -{0x00,0x01,0x00,"VGA"}, +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<pci/pci.h> +#include<sys/io.h> +#include<lib/kprintf.h> + +conststruct{ +uInt8baseClass; +uInt8subClass; +uInt8interface; +constchar*name; +}pciClasses[]={{0x00,0x00,0x00,"Undefined"},{0x00,0x01,0x00,"VGA"}, + +{0x01,0x00,0x00,"SCSI"},{0x01,0x01,0x00,"IDE"},{0x01,0x01,0x8A,"IDE"},{0x01,0x02,0x00,"Floppy"},{0x01,0x03,0x00,"IPI"},{0x01,0x04,0x00,"RAID"},{0x01,0x80,0x00,"Other"}, + +{0x02,0x00,0x00,"Ethernet"},{0x02,0x01,0x00,"TokenRing"},{0x02,0x02,0x00,"FDDI"},{0x02,0x03,0x00,"ATM"},{0x02,0x04,0x00,"ISDN"},{0x02,0x80,0x00,"Other"}, -{0x01,0x00,0x00,"SCSI"}, -{0x01,0x01,0x00,"IDE"}, -{0x01,0x01,0x8A,"IDE"}, -{0x01,0x02,0x00,"Floppy"}, -{0x01,0x03,0x00,"IPI"}, -{0x01,0x04,0x00,"RAID"}, -{0x01,0x80,0x00,"Other"}, +{0x03,0x00,0x00,"VGA"},{0x03,0x00,0x01,"VGA+8514"},{0x03,0x01,0x00,"XGA"},{0x03,0x02,0x00,"3D"},{0x03,0x80,0x00,"VGAOther"}, + +{0x04,0x00,0x00,"Video"},{0x04,0x01,0x00,"Audio"},{0x04,0x02,0x00,"Telephony"},{0x04,0x80,0x00,"Other"}, + +{0x05,0x00,0x00,"RAM"},{0x05,0x01,0x00,"Flash"},{0x05,0x80,0x00,"Other"}, + +{0x06,0x00,0x00,"PCItoHOST"},{0x06,0x01,0x00,"PCItoISA"},{0x06,0x02,0x00,"PCItoEISA"},{0x06,0x03,0x00,"PCItoMCA"},{0x06,0x04,0x00,"PCItoPCI"},{0x06,0x04,0x01,"PCItoPCI(SubtractiveDecode)"},{0x06,0x05,0x00,"PCItoPCMCIA"},{0x06,0x06,0x00,"PCItoNuBUS"},{0x06,0x07,0x00,"PCItoCardbus"},{0x06,0x08,0x00,"PCItoRACEway"},{0x06,0x09,0x00,"PCItoPCI"},{0x06,0x0A,0x00,"PCItoInfiBand"},{0x06,0x80,0x00,"PCItoOther"}, -{0x02,0x00,0x00,"Ethernet"}, -{0x02,0x01,0x00,"TokenRing"}, -{0x02,0x02,0x00,"FDDI"}, -{0x02,0x03,0x00,"ATM"}, -{0x02,0x04,0x00,"ISDN"}, -{0x02,0x80,0x00,"Other"}, - -{0x03,0x00,0x00,"VGA"}, -{0x03,0x00,0x01,"VGA+8514"}, -{0x03,0x01,0x00,"XGA"}, -{0x03,0x02,0x00,"3D"}, -{0x03,0x80,0x00,"VGAOther"}, - -{0x04,0x00,0x00,"Video"}, -{0x04,0x01,0x00,"Audio"}, -{0x04,0x02,0x00,"Telephony"}, -{0x04,0x80,0x00,"Other"}, +{0x07,0x00,0x00,"Serial"},{0x07,0x00,0x01,"Serial-16450"},{0x07,0x00,0x02,"Serial-16550"},{0x07,0x00,0x03,"Serial-16650"},{0x07,0x00,0x04,"Serial-16750"},{0x07,0x00,0x05,"Serial-16850"},{0x07,0x00,0x06,"Serial-16950"},{0x07,0x01,0x00,"Parallel"},{0x07,0x01,0x01,"Parallel-BiDir"},{0x07,0x01,0x02,"Parallel-ECP"},{0x07,0x01,0x03,"Parallel-IEEE1284"},{0x07,0x01,0xFE,"Parallel-IEEE1284Target"},{0x07,0x02,0x00,"MultiportSerial"},{0x07,0x03,0x00,"HayesCompatibleModem"},{0x07,0x03,0x01,"HayesCompatibleModem,16450"},{0x07,0x03,0x02,"HayesCompatibleModem,16550"},{0x07,0x03,0x03,"HayesCompatibleModem,16650"},{0x07,0x03,0x04,"HayesCompatibleModem,16750"},{0x07,0x80,0x00,"Other"}, + +{0x08,0x00,0x00,"PIC"},{0x08,0x00,0x01,"ISAPIC"},{0x08,0x00,0x02,"EISAPIC"},{0x08,0x00,0x10,"I/OAPIC"},{0x08,0x00,0x20,"I/O(x)APIC"},{0x08,0x01,0x00,"DMA"},{0x08,0x01,0x01,"ISADMA"},{0x08,0x01,0x02,"EISADMA"},{0x08,0x02,0x00,"Timer"},{0x08,0x02,0x01,"ISATimer"},{0x08,0x02,0x02,"EISATimer"},{0x08,0x03,0x00,"RTC"},{0x08,0x03,0x00,"ISARTC"},{0x08,0x03,0x00,"Hot-Plug"},{0x08,0x80,0x00,"Other"}, + +{0x09,0x00,0x00,"Keyboard"},{0x09,0x01,0x00,"Pen"},{0x09,0x02,0x00,"Mouse"},{0x09,0x03,0x00,"Scanner"},{0x09,0x04,0x00,"GamePort"},{0x09,0x80,0x00,"Other"}, + +{0x0a,0x00,0x00,"Generic"},{0x0a,0x80,0x00,"Other"}, + +{0x0b,0x00,0x00,"386"},{0x0b,0x01,0x00,"486"},{0x0b,0x02,0x00,"Pentium"},{0x0b,0x03,0x00,"PentiumPro"},{0x0b,0x10,0x00,"DECAlpha"},{0x0b,0x20,0x00,"PowerPC"},{0x0b,0x30,0x00,"MIPS"},{0x0b,0x40,0x00,"Coprocessor"},{0x0b,0x80,0x00,"Other"}, + +{0x0c,0x00,0x00,"FireWire"},{0x0c,0x00,0x10,"OHCIFireWire"},{0x0c,0x01,0x00,"Access.bus"},{0x0c,0x02,0x00,"SSA"},{0x0c,0x03,0x00,"USB(UHCI)"},{0x0c,0x03,0x10,"USB(OHCI)"},{0x0c,0x03,0x80,"USB"},{0x0c,0x03,0xFE,"USBDevice"},{0x0c,0x04,0x00,"Fiber"},{0x0c,0x05,0x00,"SMBusController"},{0x0c,0x06,0x00,"InfiniBand"},{0x0c,0x80,0x00,"Other"}, + +{0x0d,0x00,0x00,"iRDA"},{0x0d,0x01,0x00,"ConsumerIR"},{0x0d,0x10,0x00,"RF"},{0x0d,0x80,0x00,"Other"}, + +{0x0e,0x00,0x00,"I2O"},{0x0e,0x80,0x00,"Other"}, + +{0x0f,0x01,0x00,"TV"},{0x0f,0x02,0x00,"Audio"},{0x0f,0x03,0x00,"Voice"},{0x0f,0x04,0x00,"Data"},{0x0f,0x80,0x00,"Other"}, -{0x05,0x00,0x00,"RAM"}, -{0x05,0x01,0x00,"Flash"}, -{0x05,0x80,0x00,"Other"}, - -{0x06,0x00,0x00,"PCItoHOST"}, -{0x06,0x01,0x00,"PCItoISA"}, -{0x06,0x02,0x00,"PCItoEISA"}, -{0x06,0x03,0x00,"PCItoMCA"}, -{0x06,0x04,0x00,"PCItoPCI"}, -{0x06,0x04,0x01,"PCItoPCI(SubtractiveDecode)"}, -{0x06,0x05,0x00,"PCItoPCMCIA"}, -{0x06,0x06,0x00,"PCItoNuBUS"}, -{0x06,0x07,0x00,"PCItoCardbus"}, -{0x06,0x08,0x00,"PCItoRACEway"}, -{0x06,0x09,0x00,"PCItoPCI"}, -{0x06,0x0A,0x00,"PCItoInfiBand"}, -{0x06,0x80,0x00,"PCItoOther"}, - -{0x07,0x00,0x00,"Serial"}, -{0x07,0x00,0x01,"Serial-16450"}, -{0x07,0x00,0x02,"Serial-16550"}, -{0x07,0x00,0x03,"Serial-16650"}, -{0x07,0x00,0x04,"Serial-16750"}, -{0x07,0x00,0x05,"Serial-16850"}, -{0x07,0x00,0x06,"Serial-16950"}, -{0x07,0x01,0x00,"Parallel"}, -{0x07,0x01,0x01,"Parallel-BiDir"}, -{0x07,0x01,0x02,"Parallel-ECP"}, -{0x07,0x01,0x03,"Parallel-IEEE1284"}, -{0x07,0x01,0xFE,"Parallel-IEEE1284Target"}, -{0x07,0x02,0x00,"MultiportSerial"}, -{0x07,0x03,0x00,"HayesCompatibleModem"}, -{0x07,0x03,0x01,"HayesCompatibleModem,16450"}, -{0x07,0x03,0x02,"HayesCompatibleModem,16550"}, -{0x07,0x03,0x03,"HayesCompatibleModem,16650"}, -{0x07,0x03,0x04,"HayesCompatibleModem,16750"}, -{0x07,0x80,0x00,"Other"}, +{0x10,0x00,0x00,"Network"},{0x10,0x10,0x00,"Entertainment"},{0x10,0x80,0x00,"Other"}, + +{0x11,0x00,0x00,"DPIOModules"},{0x11,0x01,0x00,"PerformanceCounters"},{0x11,0x10,0x00,"CommSync,Time+FrequencyMeasurement"},{0x11,0x80,0x00,"Other"}, + +}; + +uInt32pciRead(intbus,intdev,intfunc,intreg,intbytes){ +uInt16base; + +union{ +structconfaddc; +uInt32n; +}u; + +u.n=0; +u.c.enable=1; +u.c.rsvd=0; +u.c.bus=bus; +u.c.dev=dev; +u.c.func=func; +u.c.reg=reg&0xFC; + +outportDWord(0xCF8,u.n); + +base=0xCFC+(reg&0x03); + +switch(bytes){ +case1: +return(inportByte(base)); +case2: +return(inportWord(base)); +case4: +return(inportDWord(base)); +default: +return0; +} +} -{0x08,0x00,0x00,"PIC"}, -{0x08,0x00,0x01,"ISAPIC"}, -{0x08,0x00,0x02,"EISAPIC"}, -{0x08,0x00,0x10,"I/OAPIC"}, -{0x08,0x00,0x20,"I/O(x)APIC"}, -{0x08,0x01,0x00,"DMA"}, -{0x08,0x01,0x01,"ISADMA"}, -{0x08,0x01,0x02,"EISADMA"}, -{0x08,0x02,0x00,"Timer"}, -{0x08,0x02,0x01,"ISATimer"}, -{0x08,0x02,0x02,"EISATimer"}, -{0x08,0x03,0x00,"RTC"}, -{0x08,0x03,0x00,"ISARTC"}, -{0x08,0x03,0x00,"Hot-Plug"}, -{0x08,0x80,0x00,"Other"}, +voidpciWrite(intbus,intdev,intfunc,intreg,uInt32v,intbytes){ +uInt16base; + +union{ +structconfaddc; +uInt32n; +}u; + +u.n=0; +u.c.enable=1; +u.c.rsvd=0; +u.c.bus=bus; +u.c.dev=dev; +u.c.func=func; +u.c.reg=reg&0xFC; -{0x09,0x00,0x00,"Keyboard"}, -{0x09,0x01,0x00,"Pen"}, -{0x09,0x02,0x00,"Mouse"}, -{0x09,0x03,0x00,"Scanner"}, -{0x09,0x04,0x00,"GamePort"}, -{0x09,0x80,0x00,"Other"}, - -{0x0a,0x00,0x00,"Generic"}, -{0x0a,0x80,0x00,"Other"}, - -{0x0b,0x00,0x00,"386"}, -{0x0b,0x01,0x00,"486"}, -{0x0b,0x02,0x00,"Pentium"}, -{0x0b,0x03,0x00,"PentiumPro"}, -{0x0b,0x10,0x00,"DECAlpha"}, -{0x0b,0x20,0x00,"PowerPC"}, -{0x0b,0x30,0x00,"MIPS"}, -{0x0b,0x40,0x00,"Coprocessor"}, -{0x0b,0x80,0x00,"Other"}, +base=0xCFC+(reg&0x03); +outportDWord(0xCF8,u.n); +switch(bytes){ +case1: +outportByte(base,(uInt8)v); +break; +case2: +outportWord(base,(uInt16)v); +break; +case4: +outportDWord(base,v); +break; +} +} + +uint32_tpciProbe(intbus,intdev,intfunc){ +structpciConfig*cfg=0x0; +uint32_tv; +inti; -{0x0c,0x00,0x00,"FireWire"}, -{0x0c,0x00,0x10,"OHCIFireWire"}, -{0x0c,0x01,0x00,"Access.bus"}, -{0x0c,0x02,0x00,"SSA"}, -{0x0c,0x03,0x00,"USB(UHCI)"}, -{0x0c,0x03,0x10,"USB(OHCI)"}, -{0x0c,0x03,0x80,"USB"}, -{0x0c,0x03,0xFE,"USBDevice"}, -{0x0c,0x04,0x00,"Fiber"}, -{0x0c,0x05,0x00,"SMBusController"}, -{0x0c,0x06,0x00,"InfiniBand"}, -{0x0c,0x80,0x00,"Other"}, - -{0x0d,0x00,0x00,"iRDA"}, -{0x0d,0x01,0x00,"ConsumerIR"}, -{0x0d,0x10,0x00,"RF"}, -{0x0d,0x80,0x00,"Other"}, +cfg=kmalloc(sizeof(structpciConfig)); +memset(cfg,0x0,sizeof(structpciConfig)); + +uint32_t*word=(uint32_t*)cfg; + +for(i=0;i<4;i++){ +word[i]=pciRead(bus,dev,func,4*i,4); + +/*ThisisTEMPORARY*/ +if(cfg->vendorID==0x1022&&i==1){ +kprintf("gotit:0x%X",word[i]); +word[i]&=0xffff0000; +word[i]|=0x5;//0x1//0x5; +pciWrite(bus,dev,func,4*i,word[i],4); +kprintf("setit:0x%X\n",word[i]); +} +} -{0x0e,0x00,0x00,"I2O"}, -{0x0e,0x80,0x00,"Other"}, - -{0x0f,0x01,0x00,"TV"}, -{0x0f,0x02,0x00,"Audio"}, -{0x0f,0x03,0x00,"Voice"}, -{0x0f,0x04,0x00,"Data"}, -{0x0f,0x80,0x00,"Other"}, - -{0x10,0x00,0x00,"Network"}, -{0x10,0x10,0x00,"Entertainment"}, -{0x10,0x80,0x00,"Other"}, - -{0x11,0x00,0x00,"DPIOModules"}, -{0x11,0x01,0x00,"PerformanceCounters"}, -{0x11,0x10,0x00,"CommSync,Time+FrequencyMeasurement"}, -{0x11,0x80,0x00,"Other"}, - -}; - -uInt32pciRead(intbus,intdev,intfunc,intreg,intbytes){ -uInt16base; - -union{ -structconfaddc; -uInt32n; -}u; - -u.n=0; -u.c.enable=1; -u.c.rsvd=0; -u.c.bus=bus; -u.c.dev=dev; -u.c.func=func; -u.c.reg=reg&0xFC; - -outportDWord(0xCF8,u.n); - -base=0xCFC+(reg&0x03); - -switch(bytes){ -case1:return(inportByte(base)); -case2:return(inportWord(base)); -case4:return(inportDWord(base)); -default:return0; -} -} - -voidpciWrite(intbus,intdev,intfunc,intreg,uInt32v,intbytes){ -uInt16base; - -union{ -structconfaddc; -uInt32n; -}u; - -u.n=0; -u.c.enable=1; -u.c.rsvd=0; -u.c.bus=bus; -u.c.dev=dev; -u.c.func=func; -u.c.reg=reg&0xFC; - -base=0xCFC+(reg&0x03); -outportDWord(0xCF8,u.n); -switch(bytes){ -case1:outportByte(base,(uInt8)v);break; -case2:outportWord(base,(uInt16)v);break; -case4:outportDWord(base,v);break; -} -} - - -boolpciProbe(intbus,intdev,intfunc,structpciConfig*cfg){ -uInt32*word=(uInt32*)cfg; -uInt32v; -inti; -for(i=0;i<4;i++){ -word[i]=pciRead(bus,dev,func,4*i,4); -} -if(cfg->vendorId==0xffff)returnFALSE; -if(cfg->vendorId==0x0)returnFALSE;/*QuickHack*/ - -cfg->bus=bus; -cfg->dev=dev; -cfg->func=func; -cfg->subsysVendor=pciRead(bus,dev,func,0x2c,2); -cfg->subsys=pciRead(bus,dev,func,0x2e,2); -kprintf("DeviceInfo:/bus/pci/%d/%d/%d\n",bus,dev,func); -kprintf("*Vendor:%XDevice:%XClass/SubClass/Interface%X/%X/%X\n",cfg->vendorId,cfg->deviceId,cfg->baseClass,cfg->subClass,cfg->interface); -kprintf("*Status:%XCommand:%XBIST/Type/Lat/CLS:%X/%X/%X/%X\n",cfg->status,cfg->command,cfg->bist,cfg->headerType,cfg->latencyTimer,cfg->cacheLineSize); -switch(cfg->headerType&0x7F){ -case0:/*normaldevice*/ -for(i=0;i<6;i++){ -v=pciRead(bus,dev,func,i*4+0x10,4); -if(v){ -intv2; -pciWrite(bus,dev,func,i*4+0x10,0xffffffff,4); -v2=pciRead(bus,dev,func,i*4+0x10,4)&0xfffffff0; -pciWrite(bus,dev,func,i*4+0x10,v,4); -v2=1+~v2; -if(v&1){ -cfg->base[i]=v&0xffff; -cfg->size[i]=v2&0xffff; -} -else{ -cfg->base[i]=v; -cfg->size[i]=v2; -} -} -else{ -cfg->base[i]=0; -cfg->size[i]=0; -} -} -v=pciRead(bus,dev,func,0x3c,1); -cfg->irq=(v==0xff?0:v); -break; -case1: -kprintf("*PCI<->PCIBridge\n"); -break; -default: -kprintf("*UnknownHeaderType\n"); -break; -} - -return(TRUE); -} - -intpci_init(){ -uInt16bus,dev,func; -inti=0x0; -structpciConfigpcfg; -for(bus=0x0;bus<0x2;bus++){/*255*/ -for(dev=0;dev<32;dev++){ -for(func=0;func<8;func++){ -if(pciProbe(bus,dev,func,&pcfg)==TRUE){ -/*kprintf("*Vendor:%XDevice:%XClass/SubClass/Interface%X/%X/%X\n",pcfg.vendorId,pcfg.deviceId,pcfg.baseClass,pcfg.subClass,pcfg.interface);*/ -for(i=0x0;i<countof(pciClasses);i++){ -if(pcfg.baseClass==pciClasses[i].baseClass&&pcfg.subClass==pciClasses[i].subClass&&pcfg.interface==pciClasses[i].interface){ -kprintf("PCIDevice:%s@IRQ:0x%X\n",pciClasses[i].name,pcfg.irq); -break; -} -} -} -} -} -} -return(0x0); -} - -/*** -$Log: pci_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:36reddawg -nomessage - -Revision1.42004/08/2017:49:13reddawg -Tinyfixens - -Revision1.32004/08/2016:49:11reddawg -PCIUpdates-MoretofollowasPCIsystemgetsrevamped - -Revision1.22004/07/0911:58:19reddawg -UpdatingDriverRoutines - -Revision1.1.1.12004/04/1512:07:16reddawg -UbixOSv1.0 - -Revision1.52004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +if(cfg->vendorID==0xffff){ +kfree(cfg); +return0x0; +} + +if(cfg->vendorID==0x0){ +kfree(cfg); +return0x0; +} + +cfg->bus=bus; +cfg->dev=dev; +cfg->func=func; + +/* +if(cfg->vendorID==0x1022) +pciWrite(bus,dev,func,0x3C,0x5,1); +*/ + +switch(cfg->headerType&0x7F){ +case0x0:/*normaldevice*/ +for(i=4;i<=16;i++){ +word[i]=pciRead(bus,dev,func,4*i,4); +} +if(cfg->vendorID==0x1022){ +kprintf("DeviceInfo:/bus/pci/%d/%d/%d\n",bus,dev,func); +kprintf("*Vendor:%XDevice:%XClass/SubClass/Interface%X/%X/%X\n",cfg->vendorID,cfg->deviceID,cfg->classCode,cfg->subClass,cfg->progIf); +kprintf("*Status:%XCommand:%XBIST/Type/Lat/CLS:%X/%X/%X/%X\n",cfg->status,cfg->command,cfg->bist,cfg->headerType,cfg->latencyTimer,cfg->cacheLineSize); +kprintf("*IRQ:0x%X.0x%X,BAR[0]:0x%X\n",cfg->intLine,cfg->intPin,cfg->bar[0]); +} +break; +case0x1: +kprintf("*PCI<->PCIBridge\n"); +break; +case0x2: +kprintf("*PCI<->CardBusBridge\n"); +break; +default: +kprintf("*UnknownHeaderType\n"); +break; + +} + +/* +switch(cfg->headerType&0x7F){ +case0://normaldevice +for(i=0;i<6;i++){ +v=pciRead(bus,dev,func,i*4+0x10,4); +if(v){ +intv2; +pciWrite(bus,dev,func,i*4+0x10,0xffffffff,4); +v2=pciRead(bus,dev,func,i*4+0x10,4)&0xfffffff0; +pciWrite(bus,dev,func,i*4+0x10,v,4); +v2=1+~v2; +if(v&1){ +cfg->base[i]=v&0xffff; +cfg->size[i]=v2&0xffff; +} +else{ +cfg->base[i]=v; +cfg->size[i]=v2; +} +} +else{ +cfg->base[i]=0; +cfg->size[i]=0; +} +} +v=pciRead(bus,dev,func,0x3c,1); +cfg->irq=(v==0xff?0:v); +v=pciRead(bus,dev,func,0x40,1); +cfg->irqLine=(v==0xff?0:v); +break; +case1: + + +} +*/ + +return((uint32_t)cfg); +} + +intpci_init(){ +uint16_tbus,dev,func; + +inti=0x0; + +structpciConfig*pcfg; + +for(bus=0x0;bus<0x2;bus++){ +for(dev=0;dev<32;dev++){ +for(func=0;func<8;func++){ +pcfg=(structpciConfig*)pciProbe(bus,dev,func); +if(pcfg!=0x0){ +for(i=0x0;i<countof(pciClasses);i++){ +if(pcfg->classCode==pciClasses[i].baseClass&&pcfg->subClass==pciClasses[i].subClass&&pcfg->progIf==pciClasses[i].interface){ +if(pcfg->vendorID==0x1022){ +kprintf("PCIDevice:%s@IRQ:0x%X.0x%X\n",pciClasses[i].name,pcfg->intPin,pcfg->intLine); +} +break; +} +} +} +} +} +} +return(0x0); +} - + diff --git a/doc/xml/pci_8h.xml b/doc/xml/pci_8h.xml index 3a115ac..f7d61b5 100644 --- a/doc/xml/pci_8h.xml +++ b/doc/xml/pci_8h.xml @@ -1,56 +1,94 @@ - - - + + + pci.h - ubixos/types.h - src/sys/include/ubixos/init.h - src/sys/pci/pci.c + sys/types.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/pci/pci.c - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + confadd pciConfig - + countof a (sizeof(a) / sizeof(a[0])) @@ -60,12 +98,11 @@ - - pci_init + - + int int pci_init () @@ -76,25 +113,26 @@ - - pciConfig::baseClass - confadd::bus - countof - confadd::dev - confadd::func - pciConfig::interface - pciConfig::irq - kprintf - name - pciClasses - pciProbe - pciConfig::subClass - TRUE + + pciConfig::bus + pciConfig::classCode + countof + pciConfig::dev + pciConfig::func + pciConfig::intLine + pciConfig::intPin + kprintf + name + pciClasses + pciProbe + pciConfig::progIf + pciConfig::subClass + pciConfig::vendorID - - bool - bool pciProbe - (int bus, int dev, int func, struct pciConfig *cfg) + + uint32_t + uint32_t pciProbe + (int bus, int dev, int func) pciProbe int @@ -108,46 +146,40 @@ int func - - struct pciConfig * - cfg - - - pciConfig::base - pciConfig::baseClass - pciConfig::bist - pciConfig::bus - pciConfig::cacheLineSize - pciConfig::command - pciConfig::dev - pciConfig::deviceId - FALSE - pciConfig::func - pciConfig::headerType - pciConfig::interface - pciConfig::irq - kprintf - pciConfig::latencyTimer - pciRead - pciWrite - pciConfig::size - pciConfig::status - pciConfig::subClass - pciConfig::subsys - pciConfig::subsysVendor - TRUE - pciConfig::vendorId - x10 - pci_init + + pciConfig::bar + pciConfig::bist + pciConfig::bus + pciConfig::cacheLineSize + pciConfig::classCode + pciConfig::command + pciConfig::dev + pciConfig::deviceID + pciConfig::func + pciConfig::headerType + pciConfig::intLine + pciConfig::intPin + kfree + kmalloc + kprintf + pciConfig::latencyTimer + memset + pciRead + pciWrite + pciConfig::progIf + pciConfig::status + pciConfig::subClass + pciConfig::vendorID + pci_init - - uInt32 + + uInt32 uInt32 pciRead (int bus, int dev, int func, int reg, int bytes) pciRead @@ -177,14 +209,19 @@ - - inportByte - inportDWord - inportWord - outportDWord - pciProbe + + confadd::bus + confadd::dev + confadd::enable + confadd::func + inportByte + inportDWord + inportWord + outportDWord + confadd::reg + pciProbe - + void void pciWrite (int bus, int dev, int func, int reg, uInt32 v, int bytes) @@ -206,7 +243,7 @@ reg - uInt32 + uInt32 v @@ -219,11 +256,16 @@ - - outportByte - outportDWord - outportWord - pciProbe + + confadd::bus + confadd::dev + confadd::enable + confadd::func + outportByte + outportDWord + outportWord + confadd::reg + pciProbe @@ -231,117 +273,113 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pci_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_PCI_H -#define_PCI_H - -#include<ubixos/types.h> - - -structpciConfig{ -uInt16vendorId; -uInt16deviceId; - -uInt16command; -uInt16status; - -uInt8revisionId; -uInt8interface; -uInt8subClass; -uInt8baseClass; - -uInt8cacheLineSize; -uInt8latencyTimer; -uInt8headerType; -uInt8bist; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_PCI_H +#define_PCI_H + +#include<sys/types.h> + +structpciConfig{ +uint16_tvendorID; +uint16_tdeviceID; + +uint16_tcommand; +uint16_tstatus; + +uint8_trevisionID; +uint8_tprogIf; +uint8_tsubClass; +uint8_tclassCode; + +uint8_tcacheLineSize; +uint8_tlatencyTimer; +uint8_theaderType; +uint8_tbist; + +uint32_tbar[6]; -/*deviceinfo*/ -uInt8bus; -uInt8dev; -uInt8func; -uInt8irq; - -/*baseregisters*/ -uInt32base[6]; -uInt32size[6]; +uint32_tcbPointer; + +uint16_tsubsysVendorID; +uint16_tsubsysID; + +uint32_tepromAddr; + +uint16_tcapabilites; +uint16_tres1; -uInt16subsysVendor; -uInt16subsys; - -}; - -structconfadd{ -uInt8reg:8; -uInt8func:3; -uInt8dev:5; -uInt8bus:8; -uInt8rsvd:7; -uInt8enable:1; -}; - -#definecountof(a)(sizeof(a)/sizeof(a[0])) - -intpci_init(); - - -boolpciProbe(intbus,intdev,intfunc,structpciConfig*cfg); -uInt32pciRead(intbus,intdev,intfunc,intreg,intbytes); -voidpciWrite(intbus,intdev,intfunc,intreg,uInt32v,intbytes); - -#endif - -/*** -$Log: pci_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:51reddawg -nomessage - -Revision1.32004/08/2016:49:11reddawg -PCIUpdates-MoretofollowasPCIsystemgetsrevamped - -Revision1.22004/05/2115:05:07reddawg -Cleanedup - - -END -***/ +uint32_tres2; + +uint8_tintLine; +uint8_tintPin; +uint8_tminGrant; +uint8_tmaxLatency; + +/*deviceinfo*/ +//uint8_tbus; +//uint8_tdev; +//uint8_tfunc; +//uint8_tirq; +//uint8_tirqLine; +/*baseregisters*/ +//uInt32base[6]; +//uInt32size[6]; +//uint16_tsubsysVendor; +//uint16_tsubsys; +/*DeviceInfo*/ +//Movethistoanottherstructeventually +uint8_tbus; +uint8_tdev; +uint8_tfunc; + +}; + +structconfadd{ +uint8_treg:8; +uint8_tfunc:3; +uint8_tdev:5; +uint8_tbus:8; +uint8_trsvd:7; +uint8_tenable:1; +}; + +#definecountof(a)(sizeof(a)/sizeof(a[0])) + +intpci_init(); + +uint32_tpciProbe(intbus,intdev,intfunc); +uInt32pciRead(intbus,intdev,intfunc,intreg,intbytes); +voidpciWrite(intbus,intdev,intfunc,intreg,uInt32v,intbytes); + +#endif - + diff --git a/doc/xml/perf_8h.xml b/doc/xml/perf_8h.xml index a203cc9..da5cde2 100644 --- a/doc/xml/perf_8h.xml +++ b/doc/xml/perf_8h.xml @@ -1,59 +1,97 @@ - - - + + + perf.h ubixos/times.h - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - + + + + - + PERF_START + /* null definition */ - + - + PERF_STOP x + /* null definition */ - + - + void void perf_init (char *fname) @@ -68,9 +106,9 @@ - + - + void void perf_print (unsigned long c1l, unsigned long c1h, unsigned long c2l, unsigned long c2h, char *key) @@ -101,9 +139,9 @@ - + - + void void perf_print_times (struct tms *start, struct tms *end, char *key) @@ -126,7 +164,7 @@ - + @@ -134,73 +172,39 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: perf_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__ARCH_PERF_H__ -#define__ARCH_PERF_H__ - -#include<ubixos/times.h> - -#ifdefPERF -#definePERF_START{\ -unsignedlong__c1l,__c1h,__c2l,__c2h;\ -__asm__(".byte0x0f,0x31":"=a"(__c1l),"=d"(__c1h)) -#definePERF_STOP(x)__asm__(".byte0x0f,0x31":"=a"(__c2l),"=d"(__c2h));\ -perf_print(__c1l,__c1h,__c2l,__c2h,x);} - -/*#definePERF_STARTdo{\ -structtms__perf_start,__perf_end;\ -times(&__perf_start) -#definePERF_STOP(x)times(&__perf_end);\ -perf_print_times(&__perf_start,&__perf_end,x);\ -}while(0)*/ -#else/*PERF*/ -#definePERF_START/*nulldefinition*/ -#definePERF_STOP(x)/*nulldefinition*/ -#endif/*PERF*/ - -voidperf_print(unsignedlongc1l,unsignedlongc1h, -unsignedlongc2l,unsignedlongc2h, -char*key); - -voidperf_print_times(structtms*start,structtms*end,char*key); - -voidperf_init(char*fname); - -#endif/*__ARCH_PERF_H__*/ +#ifndef__ARCH_PERF_H__ +#define__ARCH_PERF_H__ + +#include<ubixos/times.h> + +#ifdefPERF +#definePERF_START{\ +unsignedlong__c1l,__c1h,__c2l,__c2h;\ +__asm__(".byte0x0f,0x31":"=a"(__c1l),"=d"(__c1h)) +#definePERF_STOP(x)__asm__(".byte0x0f,0x31":"=a"(__c2l),"=d"(__c2h));\ +perf_print(__c1l,__c1h,__c2l,__c2h,x);} + +/*#definePERF_STARTdo{\ +structtms__perf_start,__perf_end;\ +times(&__perf_start) +#definePERF_STOP(x)times(&__perf_end);\ +perf_print_times(&__perf_start,&__perf_end,x);\ +}while(0)*/ +#else/*PERF*/ +#definePERF_START/*nulldefinition*/ +#definePERF_STOP(x)/*nulldefinition*/ +#endif/*PERF*/ + +voidperf_print(unsignedlongc1l,unsignedlongc1h, +unsignedlongc2l,unsignedlongc2h, +char*key); + +voidperf_print_times(structtms*start,structtms*end,char*key); + +voidperf_init(char*fname); + +#endif - + diff --git a/doc/xml/pipe_8c.xml b/doc/xml/pipe_8c.xml index 03a03bd..82c5a1c 100644 --- a/doc/xml/pipe_8c.xml +++ b/doc/xml/pipe_8c.xml @@ -1,116 +1,243 @@ - - - + + + pipe.c - ubixos/types.h - sys/sysproto.h - sys/thread.h sys/pipe.h - sys/kern_descrip.h + sys/sysproto_posix.h + sys/thread.h lib/kprintf.h assert.h + sys/descrip.h - - - - + + + + + + + + + + - - - - + + + + - + - + - + - - - - - + - - - - - + + + - - - - - - - - - - - - - - - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - + int int pipe (struct thread *td, struct pipe_args *uap) @@ -126,16 +253,17 @@ -HACK +HACK + - - file::f_flag - falloc - file::fd - FREAD - FWRITE - thread::td_retval + + file::f_flag + falloc + file::fd + FREAD + FWRITE + thread::td_retval @@ -143,60 +271,58 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pipe_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<sys/sysproto.h> -#include<sys/thread.h> -#include<sys/pipe.h> -#include<sys/kern_descrip.h> -#include<lib/kprintf.h> -#include<assert.h> - -intpipe(structthread*td,structpipe_args*uap){ -structfile*rf,*wf; -intfd=0x0; -falloc(td,&rf,&fd); -rf->f_flag=FREAD|FWRITE; -td->td_retval[0]=fd; -falloc(td,&wf,&fd); -wf->f_flag=FREAD|FWRITE; -td->td_retval[1]=fd; -return(0x0); -} - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/pipe.h> +#include<sys/sysproto_posix.h> +#include<sys/thread.h> +#include<lib/kprintf.h> +#include<assert.h> +#include<sys/descrip.h> + +intpipe(structthread*td,structpipe_args*uap){ +structfile*rf,*wf; +intfd=0x0; +falloc(td,&rf,&fd); +rf->f_flag=FREAD|FWRITE; +td->td_retval[0]=fd; +falloc(td,&wf,&fd); +wf->f_flag=FREAD|FWRITE; +td->td_retval[1]=fd; +return(0x0); +} + +/*** +END +***/ + - + diff --git a/doc/xml/pipe_8h.xml b/doc/xml/pipe_8h.xml index 2b97ffc..8bf80e0 100644 --- a/doc/xml/pipe_8h.xml +++ b/doc/xml/pipe_8h.xml @@ -1,64 +1,212 @@ - - - + + + pipe.h sys/thread.h - sys/sysproto.h - src/sys/kernel/pipe.c + sys/sysproto_posix.h + C:/Dev/git/UbixOS/sys/kernel/kern_pipe.c + C:/Dev/git/UbixOS/sys/kernel/pipe.c + C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - + + + + - - - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + pipeBuf + pipeInfo - + int int pipe (struct thread *, struct pipe_args *) @@ -74,10 +222,17 @@ -HACK +HACK + - + + file::f_flag + falloc + file::fd + FREAD + FWRITE + thread::td_retval @@ -85,50 +240,62 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pipe_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_PIPE_H -#define_PIPE_H - -#include<sys/thread.h> -#include<sys/sysproto.h> - -intpipe(structthread*,structpipe_args*); - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_PIPE_H +#define_SYS_PIPE_H + +#include<sys/thread.h> +#include<sys/sysproto_posix.h> + +intpipe(structthread*,structpipe_args*); + +structpipeBuf{ +structpipeBuf*next; +char*buffer; +size_tnbytes; +off_toffset; + +}; + +structpipeInfo{ +intrFD; +intrfdCNT; +intwFD; +intwfdCNT; +intbCNT; +structpipeBuf*headPB; +structpipeBuf*tailPB; +}; + +#endif/*END_SYS_PIPE_H*/ - + diff --git a/doc/xml/pit_8c.xml b/doc/xml/pit_8c.xml index 6fea745..9947676 100644 --- a/doc/xml/pit_8c.xml +++ b/doc/xml/pit_8c.xml @@ -1,48 +1,92 @@ - - - + + + pit.c isa/pit.h sys/io.h lib/kprintf.h - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + int int pit_init () @@ -53,11 +97,11 @@ - - kprintf - outportByte - outportByteP - PIT_TIMER + + kprintf + outportByte + outportByteP + PIT_TIMER @@ -65,118 +109,114 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pit_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<isa/pit.h> -#include<sys/io.h> -#include<lib/kprintf.h> - -/***************************************************************************************** - -Function:intpitInit() - -Description:ThisFunctionWillInitializeTheProgrammableTimer - -Notes: - -0040r/wPITcounter0,counterdivisor(XT,AT,PS/2) -0041r/wPITcounter1,RAMrefreshcounter(XT,AT) -0042r/wPITcounter2,cassette&speaker(XT,AT,PS/2) -0043r/wPITmodeport,controlwordregisterforcounters0-2 - -bit7-6=00counter0select -=01counter1select(notPS/2) -=10counter2select -bit5-4=00counterlatchcommand -=01read/writecounterbits0-7only -=10read/writecounterbits8-15only -=11read/writecounterbits0-7first,then8-15 -bit3-1=000mode0select -=001mode1select-programmableoneshot -=x10mode2select-rategenerator -=x11mode3select-squarewavegenerator -=100mode4select-softwaretriggeredstrobe -=101mode5select-hardwaretriggeredstrobe -bit0=0binarycounter16bits -=1BCDcounter - -*****************************************************************************************/ -intpit_init(){ -outportByteP(0x43,0x36); -outportByteP(0x40,((1193180/PIT_TIMER)&0xFF)); -outportByte(0x40,(((1193180/PIT_TIMER)>>8)&0xFF)); - -/*PrintoutinformationonthePIT*/ -kprintf("pit0-Port[0x%X],TimerHz:[%iHz]\n",0x43,PIT_TIMER); - -/*Returnsoweknoweverythingwentwell*/ -return(0x0); -} - -/*** -$Log: pit_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:12reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:03reddawg -nomessage - -Revision1.72004/07/1604:06:32reddawg -Tuneupsthisstuffshouldofbeentakencareofmonthsago - -Revision1.62004/07/1601:08:58reddawg -Whewweworkonceagain - -Revision1.52004/07/0913:29:15reddawg -pit:pitInittopit_init -Adjustedinitializationroutines - -Revision1.42004/05/2112:48:22reddawg -Cleanedup - -Revision1.32004/05/2022:51:09reddawg -CleanedUpWarnings - -Revision1.22004/05/1002:23:24reddawg -MinorChangesToSourceCodeToPrepareItForOpenSourceRelease - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<isa/pit.h> +#include<sys/io.h> +#include<lib/kprintf.h> + +/***************************************************************************************** + +Function:intpitInit() + +Description:ThisFunctionWillInitializeTheProgrammableTimer + +Notes: + +0040r/wPITcounter0,counterdivisor(XT,AT,PS/2) +0041r/wPITcounter1,RAMrefreshcounter(XT,AT) +0042r/wPITcounter2,cassette&speaker(XT,AT,PS/2) +0043r/wPITmodeport,controlwordregisterforcounters0-2 + +bit7-6=00counter0select +=01counter1select(notPS/2) +=10counter2select +bit5-4=00counterlatchcommand +=01read/writecounterbits0-7only +=10read/writecounterbits8-15only +=11read/writecounterbits0-7first,then8-15 +bit3-1=000mode0select +=001mode1select-programmableoneshot +=x10mode2select-rategenerator +=x11mode3select-squarewavegenerator +=100mode4select-softwaretriggeredstrobe +=101mode5select-hardwaretriggeredstrobe +bit0=0binarycounter16bits +=1BCDcounter + +*****************************************************************************************/ +intpit_init(){ +outportByteP(0x43,0x36); +outportByteP(0x40,((1193180/PIT_TIMER)&0xFF)); +outportByte(0x40,(((1193180/PIT_TIMER)>>8)&0xFF)); + +/*PrintoutinformationonthePIT*/ +kprintf("pit0-Port[0x%X],TimerHz:[%iHz]\n",0x43,PIT_TIMER); + +/*Returnsoweknoweverythingwentwell*/ +return(0x0); +} + +/*** +$Log:pit.c,v$ +Revision1.1.1.12006/06/0112:46:12reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:03reddawg +nomessage + +Revision1.72004/07/1604:06:32reddawg +Tuneupsthisstuffshouldofbeentakencareofmonthsago + +Revision1.62004/07/1601:08:58reddawg +Whewweworkonceagain + +Revision1.52004/07/0913:29:15reddawg +pit:pitInittopit_init +Adjustedinitializationroutines + +Revision1.42004/05/2112:48:22reddawg +Cleanedup + +Revision1.32004/05/2022:51:09reddawg +CleanedUpWarnings + +Revision1.22004/05/1002:23:24reddawg +MinorChangesToSourceCodeToPrepareItForOpenSourceRelease + +END +***/ + - + diff --git a/doc/xml/pit_8h.xml b/doc/xml/pit_8h.xml index 6097912..e90a6af 100644 --- a/doc/xml/pit_8h.xml +++ b/doc/xml/pit_8h.xml @@ -1,35 +1,35 @@ - - - + + + pit.h - src/sys/include/ubixos/init.h - src/sys/isa/pit.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/pit.c - - - - - - + + - - - - + + + + - + - - - - + + + + + + + + - + PIT_TIMER 200 @@ -38,12 +38,11 @@ - - pit_init + - + int int pit_init () @@ -54,11 +53,11 @@ - - kprintf - outportByte - outportByteP - PIT_TIMER + + kprintf + outportByte + outportByteP + PIT_TIMER @@ -66,78 +65,74 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: pit_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_PIT_H -#define_PIT_H - -#definePIT_TIMER200 - -intpit_init(); - -#endif - -/*** -$Log: pit_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:40reddawg -nomessage - -Revision1.62004/08/1411:23:02reddawg -Changes - -Revision1.52004/07/1604:06:32reddawg -Tuneupsthisstuffshouldofbeentakencareofmonthsago - -Revision1.42004/07/1601:08:58reddawg -Whewweworkonceagain - -Revision1.32004/07/0913:29:15reddawg -pit:pitInittopit_init -Adjustedinitializationroutines - -Revision1.22004/05/2114:57:16reddawg -Cleanedup - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_ISA_PIT_H +#define_ISA_PIT_H + +#definePIT_TIMER200 + +intpit_init(); + +#endif + +/*** +$Log:pit.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed + +Revision1.1.1.12005/09/2617:23:40reddawg +nomessage + +Revision1.62004/08/1411:23:02reddawg +Changes + +Revision1.52004/07/1604:06:32reddawg +Tuneupsthisstuffshouldofbeentakencareofmonthsago + +Revision1.42004/07/1601:08:58reddawg +Whewweworkonceagain + +Revision1.32004/07/0913:29:15reddawg +pit:pitInittopit_init +Adjustedinitializationroutines + +Revision1.22004/05/2114:57:16reddawg +Cleanedup + +END +***/ + - + diff --git a/doc/xml/ramdrive_8cpp.xml b/doc/xml/ramdrive_8cpp.xml index 658af3f..678cf25 100644 --- a/doc/xml/ramdrive_8cpp.xml +++ b/doc/xml/ramdrive_8cpp.xml @@ -1,222 +1,7 @@ - - - + + + ramdrive.cpp - stdlib.h - stdio.h - string.h - assert.h - device.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RAM_DRIVE_SIZE - 1024*1024*100 - - - - - - - - dev_ramDestroy - dev_ramDrive - - - - - int - int dev_ramDestroy - (void) - dev_ramDestroy - - void - - - - - - - - - fclose - fopen - fwrite - ram_data - RAM_DRIVE_SIZE - main - - - device_t * - device_t* dev_ramDrive - (void) - dev_ramDrive - - void - - - - - - - - - fclose - fopen - fread - device_t::major - ram_data - RAM_DRIVE_SIZE - ramDrive_read - ramDrive_write - device_t::read - device_t::sectors - device_t::write - main - - - int - static int ramDrive_read - (device_t *dev, void *ptr, off_t offset, size_t length) - ramDrive_read - - device_t * - dev - - - void * - ptr - - - off_t - offset - - - size_t - length - - - - - - - - - assert - memcpy - ram_data - dev_ramDrive - - - int - static int ramDrive_write - (device_t *dev, void *ptr, off_t offset, size_t length) - ramDrive_write - - device_t * - dev - - - void * - ptr - - - off_t - offset - - - size_t - length - - - - - - - - - assert - memcpy - ram_data - dev_ramDrive - - - - - char * - char* ram_data - - ram_data - 0x0 - - - - - - - - dev_ramDestroy - dev_ramDrive - ramDrive_read - ramDrive_write - - @@ -247,95 +32,92 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: ramdrive_8cpp.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:ramdrive.cpp542016-01-1101:29:55Zreddawg$ *****************************************************************************************/ - -#include<stdlib.h> -#include<stdio.h> -#include<string.h> -#include<assert.h> -#include"device.h" - - -staticchar*ram_data=0x0; - -#defineRAM_DRIVE_SIZE1024*1024*100 - -static -int -ramDrive_read(device_t*dev,void*ptr,off_toffset,size_tlength){ -char*data=ram_data+(offset*512); -assert(ram_data); -assert(offset+length<=dev->sectors); -memcpy(ptr,data,length*512); - -return(length); -} - -static -int -ramDrive_write(device_t*dev,void*ptr,off_toffset,size_tlength){ -char*data=ram_data+(offset*512); -assert(ram_data); - -assert(offset+length<=dev->sectors); - -memcpy(data,ptr,length*512); - -return(length); -} - -device_t* -dev_ramDrive(void){ -device_t*ramDrive=0x0; - -FILE*ramDisk; - -ramDisk=fopen("./ram.dsk","rb"); - -ramDrive=(device_t*)malloc(sizeof(device_t)); - -ram_data=(char*)malloc(RAM_DRIVE_SIZE); - -if(ramDisk!=0x0){ -printf("LoadedRamDisk\n"); -fread(ram_data,RAM_DRIVE_SIZE,1,ramDisk); -fclose(ramDisk); -} - -ramDrive->major=0x1; -ramDrive->sectors=RAM_DRIVE_SIZE/512; - -ramDrive->read=ramDrive_read; -ramDrive->write=ramDrive_write; - -printf("leavingdev_ramDrive()\n"); -return(ramDrive); - -}//dev_ramDrive - -int -dev_ramDestroy(void){ -printf("dev_ramDestroy()\n"); -FILE*ramDisk; - -ramDisk=fopen("./ram.dsk","wb"); - -fwrite(ram_data,RAM_DRIVE_SIZE,1,ramDisk); - -fclose(ramDisk); - -printf("SavedRamDisk\n"); - -return(0x0); -}//dev_ramDestroy - +/* +#include<stdlib.h> +#include<stdio.h> +#include<string.h> +#include<assert.h> +#include"device.h" + + +staticchar*ram_data=0x0; + +#defineRAM_DRIVE_SIZE1024*1024*100 + +static +int +ramDrive_read(device_t*dev,void*ptr,off_toffset,size_tlength){ +char*data=ram_data+(offset*512); +assert(ram_data); +assert(offset+length<=dev->sectors); +memcpy(ptr,data,length*512); + +return(length); +} + +static +int +ramDrive_write(device_t*dev,void*ptr,off_toffset,size_tlength){ +char*data=ram_data+(offset*512); +assert(ram_data); + +assert(offset+length<=dev->sectors); + +memcpy(data,ptr,length*512); + +return(length); +} + +device_t* +dev_ramDrive(void){ +device_t*ramDrive=0x0; + +FILE*ramDisk; + +ramDisk=fopen("./ram.dsk","rb"); + +ramDrive=(device_t*)malloc(sizeof(device_t)); + +ram_data=(char*)malloc(RAM_DRIVE_SIZE); + +if(ramDisk!=0x0){ +printf("LoadedRamDisk\n"); +fread(ram_data,RAM_DRIVE_SIZE,1,ramDisk); +fclose(ramDisk); +} + +ramDrive->major=0x1; +ramDrive->sectors=RAM_DRIVE_SIZE/512; + +ramDrive->read=ramDrive_read; +ramDrive->write=ramDrive_write; + +printf("leavingdev_ramDrive()\n"); +return(ramDrive); + +}//dev_ramDrive + +int +dev_ramDestroy(void){ +printf("dev_ramDestroy()\n"); +FILE*ramDisk; + +ramDisk=fopen("./ram.dsk","wb"); + +fwrite(ram_data,RAM_DRIVE_SIZE,1,ramDisk); + +fclose(ramDisk); + +printf("SavedRamDisk\n"); + +return(0x0); +}//dev_ramDestroy +*/ /*** -$Log: ramdrive_8cpp.xml,v $ -Revision 1.4 2006/12/12 14:09:15 reddawg -Changes - +$Log:ramdrive.cpp,v$ Revision1.1.1.12006/06/0112:46:15reddawg ubix2 @@ -405,6 +187,6 @@ ***/ - + diff --git a/doc/xml/ramdrive_8h.xml b/doc/xml/ramdrive_8h.xml index 764b212..7bf38a7 100644 --- a/doc/xml/ramdrive_8h.xml +++ b/doc/xml/ramdrive_8h.xml @@ -1,90 +1,7 @@ - - - + + + ramdrive.h - device.h - src/sys/ubixfsv2/main.cpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int - int dev_ramDestroy - () - dev_ramDestroy - - - - - - - - fclose - fopen - fwrite - ram_data - RAM_DRIVE_SIZE - main - - - device_t * - device_t* dev_ramDrive - () - dev_ramDrive - - - - - - - - fclose - fopen - fread - device_t::major - ram_data - RAM_DRIVE_SIZE - ramDrive_read - ramDrive_write - device_t::read - device_t::sectors - device_t::write - main - - @@ -115,47 +32,45 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: ramdrive_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:ramdrive.h542016-01-1101:29:55Zreddawg$ *****************************************************************************************/ - -#ifndef__RAMDRIVE_H_ -#define__RAMDRIVE_H_ - -#include<device.h> - -intdev_ramDestroy(); -device_t*dev_ramDrive(); - -#endif - -/*** -$Log: ramdrive_8h.xml,v $ -Revision 1.4 2006/12/12 14:09:15 reddawg -Changes - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:38reddawg -Removed - -Revision1.1.1.12005/09/2617:24:45reddawg -nomessage - -Revision1.12004/09/1315:21:26flameshadow -add:ramdrive.h -chg:renameddevice_t.sizetosectors -chg:made#defineforsizeoframdisk -chg:calculatedsectorsoframdiskandstoredinthedevice_tstruct - -Revision1.12004/08/1321:47:49reddawg -Fixed - -END -***/ - +/* +#ifndef__RAMDRIVE_H_ +#define__RAMDRIVE_H_ + +#include<device.h> + +intdev_ramDestroy(); +device_t*dev_ramDrive(); + +#endif +*/ + +/*** +$Log:ramdrive.h,v$ +Revision1.1.1.12006/06/0112:46:15reddawg +ubix2 + +Revision1.22005/10/1200:13:38reddawg +Removed + +Revision1.1.1.12005/09/2617:24:45reddawg +nomessage + +Revision1.12004/09/1315:21:26flameshadow +add:ramdrive.h +chg:renameddevice_t.sizetosectors +chg:made#defineforsizeoframdisk +chg:calculatedsectorsoframdiskandstoredinthedevice_tstruct + +Revision1.12004/08/1321:47:49reddawg +Fixed + +END +***/ + - + diff --git a/doc/xml/rs232_8c.xml b/doc/xml/rs232_8c.xml index ce01969..b0421f5 100644 --- a/doc/xml/rs232_8c.xml +++ b/doc/xml/rs232_8c.xml @@ -1,9 +1,9 @@ - - - + + + rs232.c - + void void rs232Init () @@ -14,7 +14,7 @@ - + @@ -22,62 +22,58 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: rs232_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -voidrs232Init(){ -return; -} - -/*** - -$Log: rs232_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:12reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:03reddawg -nomessage - -Revision1.22004/05/1002:23:24reddawg -MinorChangesToSourceCodeToPrepareItForOpenSourceRelease +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +voidrs232Init(){ +return; +} + +/*** + +$Log:rs232.c,v$ +Revision1.1.1.12006/06/0112:46:12reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:03reddawg +nomessage + +Revision1.22004/05/1002:23:24reddawg +MinorChangesToSourceCodeToPrepareItForOpenSourceRelease + - -END -***/ - +END +***/ + - + diff --git a/doc/xml/sched_8h.xml b/doc/xml/sched_8h.xml index 64e533f..c59f942 100644 --- a/doc/xml/sched_8h.xml +++ b/doc/xml/sched_8h.xml @@ -1,487 +1,1004 @@ - - - + + + sched.h - ubixos/types.h + sys/types.h + vfs/file.h ubixos/tty.h - vfs/file.h sys/tss.h sys/thread.h - src/sys/include/mpi/mpi.h - src/sys/include/ubixos/elf.h - src/sys/include/ubixos/endtask.h - src/sys/include/ubixos/exec.h - src/sys/include/ubixos/fork.h - src/sys/include/ubixos/init.h - src/sys/include/ubixos/syscalls.h - src/sys/include/ubixos/ubthread.h - src/sys/isa/atkbd.c - src/sys/kernel/bioscall.c - src/sys/kernel/endtask.c - src/sys/kernel/fork.c - src/sys/kernel/gen_calls.c - src/sys/kernel/ld.c - src/sys/kernel/sched.c - src/sys/kernel/spinlock.c - src/sys/kernel/syscall.c - src/sys/kernel/syscall_new.c - src/sys/kernel/systemtask.c - src/sys/kernel/ubthread.c - src/sys/kmods/kmod.c - src/sys/lib/kmalloc.c - src/sys/sys/idt.c - src/sys/ubixfs/ubixfs.c - src/sys/vfs/file.c - src/sys/vmm/getfreevirtualpage.c - src/sys/vmm/pagefault.c - src/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/spinlock.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/spinlock.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/trap.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/inode.c + C:/Dev/git/UbixOS/sys/fs/vfs/namei.c + C:/Dev/git/UbixOS/sys/include/mpi/mpi.h + C:/Dev/git/UbixOS/sys/include/ubixos/endtask.h + C:/Dev/git/UbixOS/sys/include/ubixos/exec.h + C:/Dev/git/UbixOS/sys/include/ubixos/fork.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/ubixos/syscalls.h + C:/Dev/git/UbixOS/sys/include/ubixos/ubthread.h + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/kernel/elf.c + C:/Dev/git/UbixOS/sys/kernel/endtask.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/getfreevirtualpage.c + C:/Dev/git/UbixOS/sys/vmm/pagefault.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_mmap.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - + + + + + + + + - + - + - + - + - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - + - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + - - - - - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + osInfo taskStruct + + + NO_GROUP + -1 + + + + + + + + + + NR_GROUPS + 32 + + + + + + + + + + + + + tState + + PLACEHOLDER + = -2 + + + + + + + DEAD + = -1 + + + + + + + NEW + = 0 + + + + + + + READY + = 1 + + + + + + + RUNNING + = 2 + + + + + + + IDLE + = 3 + + + + + + + FORK + = 4 + + + + + + + WAIT + = 5 + + + + + + + UNINTERRUPTIBLE + = 6 + + + + + + + INTERRUPTIBLE + = 7 + + + + + + + + + + + + + + - - taskStruct + + struct taskStruct typedef struct taskStruct kTask_t kTask_t @@ -491,87 +1008,111 @@ - + - - - tState - - PLACEHOLDER - -2 - - - - - - - DEAD - -1 - - - - - - - NEW - 0 - - - - - - - READY - 1 - - - - - - - RUNNING - 2 - - - - - - - IDLE - 3 - - - - - - - FORK - 4 - - - - - - - WAIT - 5 - - - - - + + + kTask_t * + kTask_t* _current + + _current - + + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __machineCheck + __nmi + __security + __simd + __virtualization + biosCall + elf_load_file + execFile + fopen + fork_copyProcess + freebsd6_mmap + fstat + getgid + getpid + getuid + in_group_p + invalidCall + invalidCall_posix + kmod_load + ldEnable + lookup + mathStateRestore + pbuf_free + permission + schedEndTask + sys_call + sys_call_posix + sys_chdir + sys_exit + sys_fchdir + sys_fgetc + sys_fork + sys_fwrite + sys_getcwd + sys_getegid + sys_getEUID + sys_geteuid + sys_getGID + sys_getlogin + sys_getpgrp + sys_getpid + sys_getppid + sys_getUID + sys_invalid + sys_mmap + sys_pread + sys_read + sys_setGID + sys_setlogin + sys_setpgid + sys_setUID + sys_wait4 + sysExec + sysFwrite + sysGetCwd + sysGetFreePage + sysGetGid + sysGetpid + sysGetUid + sysMkDir + sysPasswd + sysSDE + ubthread_mutex_lock + ubthread_mutex_unlock + ubthread_self + vmm_pageFault + + + kTask_t * + kTask_t* _usedMath + + _usedMath + + + + + + + + mathStateRestore - + void void sched () @@ -582,27 +1123,17 @@ - - _current - DEAD - FORK - taskStruct::id - taskStruct::next - READY - sched_addDelTask - sched_deleteTask - schedulerSpinLock - spinTryLock - taskStruct::state - sched_yield + + spinTryLock + sched_yield - + int int sched_addDelTask (kTask_t *) sched_addDelTask - kTask_t * + kTask_t * @@ -610,19 +1141,16 @@ - - delList - taskStruct::next - taskStruct::prev - sched + + taskStruct::next - + int int sched_deleteTask (pidType) sched_deleteTask - pidType + pidType @@ -630,15 +1158,10 @@ - - taskStruct::id - taskStruct::next - taskStruct::prev - taskList - sched + - - kTask_t * + + kTask_t * kTask_t* sched_getDelTask () sched_getDelTask @@ -648,12 +1171,10 @@ - - delList - taskStruct::next - systemTask + + systemTask - + int int sched_init () @@ -664,24 +1185,18 @@ - - taskStruct::id - kmalloc - kpanic - kprintf - nextID - taskList + - + int int sched_setStatus (pidType, tState) sched_setStatus - pidType + pidType - tState + tState @@ -689,15 +1204,15 @@ - - schedFindTask - taskStruct::state - x1 - endTask - execFile - execThread + + schedFindTask + taskStruct::state + endTask + execFile + execThread + sys_wait4 - + void void sched_yield () @@ -708,36 +1223,44 @@ - - sched - _int0 - _int1 - _int10 - _int11 - _int12 - _int2 - _int3 - _int4 - _int5 - _int6 - _int9 - endTask - fork_copyProcess - schedEndTask - spinLock - sysFgetc - sysSchedYield - systemTask - ubthread_cond_timedwait - ubthread_cond_wait + + sched + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __machineCheck + __nmi + __security + __simd + __virtualization + biosCall + endTask + fork_copyProcess + lnc_thread + schedEndTask + sdeTestThread + sdeThread + spinLock + sys_fgetc + sys_fork + sys_pread + sys_read + sys_sched_yield + sys_wait4 + sysSchedYield + systemTask + ubthread_cond_timedwait + ubthread_cond_wait - + void void schedEndTask (pidType pid) schedEndTask - pidType + pidType pid @@ -746,19 +1269,19 @@ - - _current - endTask - taskStruct::id - sched_yield + + _current + endTask + taskStruct::id + sched_yield - - kTask_t * + + kTask_t * kTask_t* schedFindTask (uInt32 id) schedFindTask - uInt32 + uInt32 id @@ -767,17 +1290,15 @@ - - taskStruct::id - taskStruct::next - taskList - sched_setStatus - sysCheckPid - systemTask - vmmMapFromTask + + sched_setStatus + sys_setpgid + sys_wait4 + sysCheckPid + systemTask - - kTask_t * + + kTask_t * kTask_t* schedNewTask () schedNewTask @@ -787,114 +1308,23 @@ - - file::f_flag - taskStruct::id - kmalloc - kpanic - memset - NEW - taskStruct::next - nextID - thread::o_files - taskStruct::prev - schedulerSpinLock - spinLock - spinUnlock - taskStruct::state - taskList - taskStruct::td - taskStruct::usedMath - biosCall - execFile - execThread - - - - - kTask_t * - kTask_t* _current - - _current - - - - - - - - __sysctl - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int8 - _int9 - biosCall - elf_loadfile - endTask - execFile - fork_copyProcess - fstat - getgid - getpid - getuid - intNull - kmod_load - ldEnable - mathStateRestore - mmap - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_postMessage - obreak - sched - schedEndTask - sys_exec - syscall - sysChDir - sysExec - sysExit - sysFgetc - sysFwrite - sysGetCwd - sysGetFreePage - sysGetGid - sysGetpid - sysGetUid - sysMkDir - sysPasswd - sysSetGid - sysSetUid - ubthread_mutex_lock - ubthread_mutex_unlock - ubthread_self - vmm_pageFault - vmm_remapPage - vmmGetFreeVirtualPage - vmmMapFromTask - - - kTask_t * - kTask_t* _usedMath - - _usedMath - - - - - - - - mathStateRestore + + file::f_flag + kmalloc + kpanic + memcpy + memset + NEW + thread::o_files + spinLock + taskStruct::state + taskStruct::td + taskStruct::usedMath + taskStruct::username + biosCall + execFile + execThread + sys_fork @@ -902,190 +1332,121 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sched_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SCHED_H -#define_SCHED_H - -#include<ubixos/types.h> -//#include<ubixos/elf.h> -#include<ubixos/tty.h> -#include<vfs/file.h> -#include<sys/tss.h> -#include<sys/thread.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_SCHED_H +#define_UBIXOS_SCHED_H + +#ifdef__cplusplus +extern"C"{ +#endif + +#include<sys/types.h> +#include<vfs/file.h> +#include<ubixos/tty.h> - -typedefenum{PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4,WAIT=5}tState; +#include<sys/tss.h> +#include<sys/thread.h> -structosInfo{ -uInt8timer; -uInt8v86Task; -boolv86If; -uInt32vmStart; -uInt32stdinSize; -uInt32controlKeys; -char*stdin; -charcwd[1024];/*currentworkingdir*/ -}; - -typedefstructtaskStruct{ -pidTypeid; -structtaskStruct*prev; -structtaskStruct*next; -structtssStructtss; -structi387Structi387; -structosInfooInfo; -fileDescriptor*imageFd; -tStatestate; -uInt32gid; -uInt32uid; -uInt16usedMath; -tty_term*term; -structthreadtd; -}kTask_t; - - -intsched_init(); -intsched_setStatus(pidType,tState); -intsched_deleteTask(pidType); -intsched_addDelTask(kTask_t*); -kTask_t*sched_getDelTask(); -voidsched_yield(); -voidsched(); - -voidschedEndTask(pidTypepid); -kTask_t*schedNewTask(); -kTask_t*schedFindTask(uInt32id); - -externkTask_t*_current; -externkTask_t*_usedMath; - - -#endif - -/*** -$Log: sched_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.32006/12/1515:43:46reddawg -Changes - -Revision1.22006/10/2716:42:42reddawg -Testing - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:55reddawg -nomessage - -Revision1.302004/09/1122:21:11reddawg -oInfo.cwdisnowanarraynolongerapointer.. - -Revision1.292004/09/0823:19:58reddawg -hmm - -Revision1.282004/09/0822:16:02reddawg -Fixens - -Revision1.272004/09/0821:19:32reddawg -Allgoodnow - -Revision1.262004/09/0721:54:38reddawg -okrevertedbacktooldschedulingfornow.... - -Revision1.202004/08/0912:58:05reddawg -letmeknowwhenyougotthesurce - -Revision1.192004/08/0622:43:04reddawg -ok - -Revision1.182004/08/0622:32:16reddawg -UbixWorksAgain - -Revision1.162004/08/0408:17:57reddawg -tty:wehaveprimativettystryf1-f5soitiseasiertouseanddebug -ubixos - -Revision1.152004/07/2921:32:16reddawg -Myquicklunchsbreaksworthofupdates.... - -Revision1.142004/07/2117:15:02reddawg -removedgarbage - -Revision1.132004/07/2114:43:14flameshadow -add:addedcwc(currentworkingcontainer)totheosInfostrut - -Revision1.122004/07/1902:32:21reddawg -sched:wenowsettaskstatustodeadwhichthenmakestheschedulerdosomecleanitcouldbesomeminoroverheadbutifeelthisisourmostefficientapproachrightnowtopreventcorruptionofthequeues - -Revision1.112004/07/1902:08:27reddawg -Cleanedouttherestofdebugingcodealsotemporarilydisabledtheipstacktoimproveboottime - -Revision1.102004/07/1805:24:15reddawg -Fixens - -Revision1.92004/07/0913:23:20reddawg -sched:schedInittosched_init -Adjustedinitializationroutines - -Revision1.82004/06/2214:02:14solar -AddedthePLACEHOLDERstateforatask - -Revision1.72004/06/1813:01:47solar -AddedniceandtimeSlicememberstothekTask_ttype - -Revision1.62004/06/1702:12:57reddawg -CleanedOutDeadCode - -Revision1.52004/06/1614:04:51reddawg -Renamedatypedef - -Revision1.42004/06/1412:20:54reddawg -notes:manybugsrepairedandldworks100%now. - -Revision1.32004/05/2115:49:13reddawg -Theosdoesbetterhousekeepingnowwhenataskisexited - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ - +#defineNO_GROUP-1 +#defineNR_GROUPS32 + +typedefenum{ +PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4,WAIT=5,UNINTERRUPTIBLE=6,INTERRUPTIBLE=7 +}tState; + +structosInfo{ +uInt8timer; +uInt8v86Task; +boolv86If; +uInt32vmStart; +uInt32stdinSize; +uInt32controlKeys; +char*stdin; +charcwd[1024];/*currentworkingdir*/ +uint8_tgpf; +}; + +typedefstructtaskStruct{ +pidTypeid; +charname[256]; +structtaskStruct*prev; +structtaskStruct*next; +structtssStructtss; +structi387Structi387; +structosInfooInfo; +//fileDescriptor*imageFd; +fileDescriptor_t*files[MAX_OFILES]; +tStatestate; +uint32_tuid,gid; +uint16_teuid,suid; +uint16_tegid,sgid; +uInt16usedMath; +tty_term*term; +structthreadtd; +struct{ +structinode*pwd; +structinode*root; +structinode*exec; +}inodes; +uint32_tcounter; +uint16_tgroups[NR_GROUPS]; +pidTypeppid; +uint32_tpgrp; +uint32_tchildren;//HackforWAIT +uint32_tlast_exit;//HackForWAIT +structtaskStruct*parent; +charusername[256]; +}kTask_t; + +intsched_init(); +intsched_setStatus(pidType,tState); +intsched_deleteTask(pidType); +intsched_addDelTask(kTask_t*); +kTask_t*sched_getDelTask(); +voidsched_yield(); +voidsched(); + +voidschedEndTask(pidTypepid); +kTask_t*schedNewTask(); +kTask_t*schedFindTask(uInt32id); + +externkTask_t*_current; +externkTask_t*_usedMath; + +#ifdef__cplusplus +} +#endif + + +#endif - + diff --git a/doc/xml/sde_8h.xml b/doc/xml/sde_8h.xml index fe3299a..e59db0d 100644 --- a/doc/xml/sde_8h.xml +++ b/doc/xml/sde_8h.xml @@ -1,42 +1,167 @@ - - - + + + sde.h - ubixos/types.h - src/sys/kernel/systemtask.c + sys/types.h + sys/sysproto.h + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/kernel/syscalls.c + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/main.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sdeWindows - + drawWindow 3 @@ -45,9 +170,9 @@ - + - + killWindow 4 @@ -56,9 +181,9 @@ - + - + registerWindow 1 @@ -67,9 +192,9 @@ - + - + windowReady 2 @@ -78,11 +203,28 @@ - + + + + + + struct sdeWindows * + struct sdeWindows* windows + + windows + + + + + + + + sdeThread + sysSDE - + void void sdeThread () @@ -93,20 +235,44 @@ - + + sdeWindows::buf + drawWindow + execThread + vitalsStruct::font + kfree + killWindow + kprintf + sdeWindows::next + ogprintOff + sdeWindows::pid + sdeWindows::prev + printOff + registerWindow + sched_yield + vitalsStruct::screen + sdeTestThread + sdeWindows::status + systemVitals + VMM_KEEP + vmm_mapFromTask + vmm_unmapPages + windowReady + windows + systemTask - - void - void sysSDE - (uInt32 cmd, void *ptr) + + int + int sysSDE + (struct thread *td, struct sys_sde_args *args) sysSDE - uInt32 - cmd + struct thread * + td - void * - ptr + struct sys_sde_args * + args @@ -114,22 +280,23 @@ - - - - - - sdeWindows * - struct sdeWindows* windows - - windows - - - - - - - + + _current + sys_sde_args::cmd + drawWindow + taskStruct::id + killWindow + kmalloc + kprintf + sdeWindows::next + sdeWindows::prev + sys_sde_args::ptr + registerWindow + vitalsStruct::screen + systemVitals + thread::td_retval + windowReady + windows @@ -137,62 +304,69 @@ -/************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistofconditions,thefollowingdisclaimerandthelistofauthors. -Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowingdisclaimerandthelistofauthors -inthedocumentationand/orothermaterialsprovidedwiththedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED -WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULAR -PURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT, -INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTE -GOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORY -OFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sde_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -**************************************************************************************/ - -#ifndef_SDE_H -#define_SDE_H - -#include<ubixos/types.h> - -#defineregisterWindow1 -#definewindowReady2 -#definedrawWindow3 -#definekillWindow4 - -#ifdef__cplusplus -extern"C" -#endif -voidsdeThread(); - -#ifdef__cplusplus -extern"C" -#endif -voidsysSDE(uInt32cmd,void*ptr); - -structsdeWindows{ -structsdeWindows*next; -structsdeWindows*prev; -void*buf; -pidTypepid; -uInt8status; -}; - -externstructsdeWindows*windows; - -#endif - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ +#ifndef_SDE_SDE_H +#define_SDE_SDE_H + +#include<sys/types.h> +#include<sys/sysproto.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +#defineregisterWindow1 +#definewindowReady2 +#definedrawWindow3 +#definekillWindow4 + +voidsdeThread(); + +//voidsysSDE(uint32_tcmd,void*ptr); +intsysSDE(structthread*td,structsys_sde_args*args); + +structsdeWindows{ +structsdeWindows*next; +structsdeWindows*prev; +void*buf; +pidTypepid; +uint8_tstatus; +}; + +externstructsdeWindows*windows; + +#ifdef__cplusplus +} +#endif + +#endif - + diff --git a/doc/xml/sem_8c.xml b/doc/xml/sem_8c.xml index 7ab5348..42bf7b6 100644 --- a/doc/xml/sem_8c.xml +++ b/doc/xml/sem_8c.xml @@ -1,61 +1,583 @@ - - - + + + sem.c ubixos/sem.h + sys/types.h + ubixos/errno.h + ubixos/time.h + ubixos/kpanic.h + lib/kmalloc.h - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + int + int sem_close + (semID_t id) + sem_close + + semID_t + id + + + + + + + + + + + err_t + err_t sem_destroy + (sys_sem_t **sem) + sem_destroy + + sys_sem_t ** + sem + + + + + + + + + sys_sem::cond + EINVAL + ENOERR + kfree + sys_sem::mutex + NULL + ubthread_cond_destroy + ubthread_mutex_destroy + sys_sem_free + + + int + int sem_getvalue + (semID_t id, int *val) + sem_getvalue + + semID_t + id + + + int * + val + + + + + + + + + + + err_t + err_t sem_init + (sys_sem_t **sem, uint8_t count) + sem_init + + sys_sem_t ** + sem + + + uint8_t + count + + + + + + + + + sys_sem::cond + ENOERR + kmalloc + kprintf + sys_sem::mutex + NULL + sys_sem::signaled + ubthread_cond_init + ubthread_mutex_init + sys_sem_new + + + int + int sem_open + (semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value) + sem_open + + semID_t * + id + + + const char * + name + + + int + oflag + + + mode_t + mode + + + unsigned int + value + + + + + + + + + + + int + int sem_post + (semID_t id) + sem_post + + semID_t + id + + + + + + + + + + + int + int sem_timedwait + (semID_t id, const struct timespec *ts) + sem_timedwait + + semID_t + id + + + const struct timespec * + ts + + + + + + + + + + + int + int sem_trywait + (semID_t id) + sem_trywait + + semID_t + id + + + + + + + + + + + int + int sem_unlink + (const char *name) + sem_unlink + + const char * + name + + + + + + + + + + + int + int sem_wait + (semID_t id) + sem_wait + + semID_t + id + + + + + + + + + + -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sem_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/sem.h> - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/sem.h> +#include<sys/types.h> +#include<ubixos/errno.h> +#include<ubixos/time.h> +#include<ubixos/kpanic.h> +#include<lib/kmalloc.h> +intsem_close(semID_tid){ +return(0); +} + +intsem_post(semID_tid){ +return(0); +} + +intsem_wait(semID_tid){ +return(0); +} + +intsem_trywait(semID_tid){ +return(0); +} + +intsem_timedwait(semID_tid,conststructtimespec*ts){ +return(0); +} + +err_tsem_init(sys_sem_t**sem,uint8_tcount){ +sys_sem_t*newSem=0x0; + +if(*sem!=0){ +//kpanic("UHOH!"); +kprintf("UHOH!"); +} + +newSem=kmalloc(sizeof(structsys_sem)); +newSem->signaled=count; + +ubthread_cond_init(&(newSem->cond),NULL); +ubthread_mutex_init(&(newSem->mutex),NULL); + +*sem=newSem; + +return(ENOERR); +} + +intsem_open(semID_t*id,constchar*name,intoflag,mode_tmode,unsignedintvalue){ +return(0); +} + +intsem_unlink(constchar*name){ +return(0); +} + +intsem_getvalue(semID_tid,int*val){ +return(0); +} + +err_tsem_destroy(sys_sem_t**sem){ +if(*sem==NULL) +return(EINVAL); + +sys_sem_t*d_sem=*sem; + +ubthread_cond_destroy(&(d_sem->cond)); +ubthread_mutex_destroy(&(d_sem->mutex)); + +kfree(sem); +*sem=0x0; + +return(ENOERR); +} + - + diff --git a/doc/xml/sem_8h.xml b/doc/xml/sem_8h.xml index 7cf36cc..1bc6fb4 100644 --- a/doc/xml/sem_8h.xml +++ b/doc/xml/sem_8h.xml @@ -1,80 +1,687 @@ - - - + + + sem.h - src/sys/kernel/sem.c - - - - - - - - - + sys/types.h + ubixos/errno.h + ubixos/ubthread.h + C:/Dev/git/UbixOS/sys/include/net/arch/sys_arch.h + C:/Dev/git/UbixOS/sys/kernel/sem.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sys_sem + + + uint32_t + typedef uint32_t semID_t + + semID_t + + + + + + + + + + struct sys_sem + typedef struct sys_sem sys_sem_t + + sys_sem_t + + + + + + + + + + + + int + int sem_close + (semID_t id) + sem_close + + semID_t + id + + + + + + + + + + + int + int sem_destroy + (sys_sem_t **) + sem_destroy + + sys_sem_t ** + + + + + + + + + sys_sem::cond + EINVAL + ENOERR + kfree + sys_sem::mutex + NULL + ubthread_cond_destroy + ubthread_mutex_destroy + sys_sem_free + + + int + int sem_getvalue + (semID_t id, int *val) + sem_getvalue + + semID_t + id + + + int * + val + + + + + + + + + + + int + int sem_init + (sys_sem_t **, uint8_t) + sem_init + + sys_sem_t ** + + + uint8_t + + + + + + + + + sys_sem::cond + ENOERR + kmalloc + kprintf + sys_sem::mutex + NULL + sys_sem::signaled + ubthread_cond_init + ubthread_mutex_init + sys_sem_new + + + int + int sem_open + (semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value) + sem_open + + semID_t * + id + + + const char * + name + + + int + oflag + + + mode_t + mode + + + unsigned int + value + + + + + + + + + + + int + int sem_post + (semID_t id) + sem_post + + semID_t + id + + + + + + + + + + + int + int sem_timedwait + (semID_t id, const struct timespec *) + sem_timedwait + + semID_t + id + + + const struct timespec * + + + + + + + + + + + int + int sem_trywait + (semID_t id) + sem_trywait + + semID_t + id + + + + + + + + + + + int + int sem_unlink + (const char *name) + sem_unlink + + const char * + name + + + + + + + + + + + int + int sem_wait + (semID_t id) + sem_wait + + semID_t + id + + + + + + + + + + -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sem_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SEM_H -#define_SEM_H - -#endif - -/*** -$Log: sem_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:55reddawg -nomessage - -Revision1.12004/07/2018:58:24reddawg -Fewfixes - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_SEM_H +#define_UBIXOS_SEM_H + +#include<sys/types.h> +#include<ubixos/errno.h> +#include<ubixos/ubthread.h> + +structsys_sem{ +uint32_tsignaled; +ubthread_cond_tcond; +ubthread_mutex_tmutex; +}; + +typedefstructsys_semsys_sem_t; + +typedefuint32_tsemID_t; +structtimespec; + +intsem_close(semID_tid); +intsem_post(semID_tid); +intsem_wait(semID_tid); +intsem_trywait(semID_tid); +intsem_timedwait(semID_tid,conststructtimespec*); +intsem_init(sys_sem_t**,uint8_t); +intsem_open(semID_t*id,constchar*name,intoflag,mode_tmode,unsignedintvalue); +intsem_unlink(constchar*name); +intsem_getvalue(semID_tid,int*val); +intsem_destroy(sys_sem_t**); + +#endif/*END_UBIXOS_SEM_H*/ - + diff --git a/doc/xml/setpageattributes_8c.xml b/doc/xml/setpageattributes_8c.xml index 6b6c73a..087b683 100644 --- a/doc/xml/setpageattributes_8c.xml +++ b/doc/xml/setpageattributes_8c.xml @@ -1,83 +1,215 @@ - - - + + + setpageattributes.c vmm/vmm.h ubixos/kpanic.h - - - - + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + - + + + - - - - - - + + + + - - - - + + + + - + int int vmm_setPageAttributes - (uInt32 memAddr, uInt16 attributes) + (uint32_t memAddr, uint16_t attributes) vmm_setPageAttributes - uInt32 + uint32_t memAddr - uInt16 + uint16_t attributes @@ -86,14 +218,12 @@ - - kpanic - tablesBaseAddress - x1000 - elf_loadfile - execFile - sys_exec - sysExec + + kpanic + PT_BASE_ADDR + elf_load_file + execFile + sysExec @@ -101,111 +231,74 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: setpageattributes_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> -#include<ubixos/kpanic.h> - -/************************************************************************ - -Function:voidvmmSetPageAttributes(uInt32pageAddr,intattributes; -Description:ThisFunctionWillSetThePageAttributesSuchAs -AReadOnlyPage,StackPage,COWPage,ETC. -Notes: - -************************************************************************/ -intvmm_setPageAttributes(uInt32memAddr,uInt16attributes){ -uInt16directoryIndex=0x0,tableIndex=0x0; -uInt32*pageTable=0x0; - -/*CalculateThePageDirectoryIndex*/ -directoryIndex=(memAddr>>22); - -/*CalculateThePageTableIndex*/ -tableIndex=((memAddr>>12)&0x3FF); - -/*SetTablePointer*/ -if((pageTable=(uInt32*)(tablesBaseAddress+(0x1000*directoryIndex)))==0x0) -kpanic("Error:pageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); - -/*SetAttributeIfPageIsMapped*/ -if(pageTable[tableIndex]!=0x0) -pageTable[tableIndex]=((pageTable[tableIndex]&0xFFFFF000)|attributes); - -/*ReloadThePageTable;*/ -asmvolatile( -"push%eax\n" -"movl%cr3,%eax\n" -"movl%eax,%cr3\n" -"pop%eax\n" -); -/*Return*/ -return(0x0); -} - -/*** -$Log: setpageattributes_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:38reddawg -Removed - -Revision1.1.1.12005/09/2617:24:53reddawg -nomessage - -Revision1.42004/07/2815:05:43reddawg -Major: -Pagesnowhavestrictsecurityenforcement. -Manynulldereferenceshavebeenresolved. -Whenappsloadedpermissionssetforpagesrwandro - -Revision1.32004/07/2022:29:55reddawg -assert:remadeassert - -Revision1.22004/06/1022:23:56reddawg -Volatiles - -Revision1.1.1.12004/04/1512:06:53reddawg -UbixOSv1.0 - -Revision1.62004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<ubixos/kpanic.h> + +/************************************************************************ + +Function:voidvmm_setPageAttributes(uInt32pageAddr,intattributes; +Description:ThisFunctionWillSetThePageAttributesSuchAs +AReadOnlyPage,StackPage,COWPage,ETC. +Notes: + +************************************************************************/ +intvmm_setPageAttributes(uint32_tmemAddr,uint16_tattributes){ +uint16_tdirectoryIndex=0x0,tableIndex=0x0; +uint32_t*pageTable=0x0; + +/*CalculateThePageDirectoryIndex*/ +directoryIndex=(memAddr>>22); + +/*CalculateThePageTableIndex*/ +tableIndex=((memAddr>>12)&0x3FF); + +/*SetTablePointer*/ +if((pageTable=(uint32_t*)(PT_BASE_ADDR+(0x1000*directoryIndex)))==0x0) +kpanic("Error:pageTable==NULL,File:%s,Line:%i\n",__FILE__,__LINE__); + +/*SetAttributeIfPageIsMapped*/ +if(pageTable[tableIndex]!=0x0) +pageTable[tableIndex]=((pageTable[tableIndex]&0xFFFFF000)|attributes); + +/*ReloadThePageTable;*/ +asmvolatile( +"push%eax\n" +"movl%cr3,%eax\n" +"movl%eax,%cr3\n" +"pop%eax\n" +); +/*Return*/ +return(0x0); +} - + diff --git a/doc/xml/shell_8c.xml b/doc/xml/shell_8c.xml index 0f13c51..9c89e90 100644 --- a/doc/xml/shell_8c.xml +++ b/doc/xml/shell_8c.xml @@ -1,6 +1,6 @@ - - - + + + shell.c lib/kmalloc.h ubixos/fork.h @@ -8,377 +8,363 @@ net/mem.h net/debug.h net/def.h - net/api.h + net/api.h net/stats.h lib/kprintf.h - - - - + + + + + + - - - - - - - - - - - - - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + ECLOSED -4 @@ -387,9 +373,9 @@ - + - + ESUCCESS 0 @@ -398,9 +384,9 @@ - + - + ESYNTAX -1 @@ -409,9 +395,9 @@ - + - + ETOOFEW -2 @@ -420,9 +406,9 @@ - + - + ETOOMANY -3 @@ -431,9 +417,9 @@ - + - + NCONNS 10 @@ -442,17 +428,44 @@ - + + + + + + char * + char* buffer + + buffer + = 0x0 + + + + + + + + fatfs_filename_to_lfn + fl_fread + fl_fwrite + lwip_strnstr + media_read + media_write + readUbixFS + ogDisplay_UbixOS::SetMode + shell_thread + sys_write + udpecho_thread - + void static void prompt (struct netconn *conn) prompt - struct netconn * + struct netconn * conn @@ -461,21 +474,19 @@ - - sendstr - shell_main + - + void static void sendstr (const char *str, struct netconn *conn) sendstr - const char * + const char * str - struct netconn * + struct netconn * conn @@ -484,40 +495,15 @@ - - NETCONN_NOCOPY - netconn_write - strlen - prompt - shell_main + - - void - void shell_init - (void) - shell_init - - void - - - - - - - - - NULL - shell_thread - sys_thread_new - netMainThread - - + void static void shell_main (struct netconn *conn) shell_main - struct netconn * + struct netconn * conn @@ -526,22 +512,11 @@ - - buffer - kprintf - netbuf_copy - netbuf_delete - netbuf_len - netconn_close - netconn_recv - prompt - sendstr - strcmp - shell_thread + - + void - static void shell_thread + void shell_thread (void *arg) shell_thread @@ -554,39 +529,10 @@ - - buffer - kmalloc - kprintf - netconn_accept - netconn_bind - netconn_listen - netconn_new - NETCONN_TCP - NULL - shell_main - shell_init - - - - - char * - char* buffer - - buffer - 0x0 - - - - - - - - readUbixFS - shell_main - shell_thread - sys_write - udpecho_thread + + buffer + kmalloc + net_init @@ -626,7 +572,7 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: shell_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:shell.c542016-01-1101:29:55Zreddawg$ */ #include<lib/kmalloc.h> @@ -636,86 +582,75 @@ #include"net/mem.h" #include"net/debug.h" #include"net/def.h" -#include"net/api.h" +#include<net/api.h> #include"net/stats.h" #include"lib/kprintf.h" -char*buffer=0x0; +char*buffer=0x0; -#defineESUCCESS0 -#defineESYNTAX-1 -#defineETOOFEW-2 -#defineETOOMANY-3 -#defineECLOSED-4 - -#defineNCONNS10 -//UBUstaticstructnetconn*conns[NCONNS]; +#defineESUCCESS0 +#defineESYNTAX-1 +#defineETOOFEW-2 +#defineETOOMANY-3 +#defineECLOSED-4 + +#defineNCONNS10 +//UBUstaticstructnetconn*conns[NCONNS]; -staticvoidsendstr(constchar*str,structnetconn*conn){ -netconn_write(conn,(void*)str,strlen(str),NETCONN_NOCOPY); -} +staticvoidsendstr(constchar*str,structnetconn*conn){ +netconn_write(conn,(void*)str,strlen(str),NETCONN_COPY); +} -staticvoidprompt(structnetconn*conn){ -sendstr("uBixCube:@sys>",conn); -} +staticvoidprompt(structnetconn*conn){ +sendstr("uBixCube:@sys>",conn); +} -staticvoidshell_main(structnetconn*conn){ -structnetbuf*buf=0x0; -uInt32len; -//UBUinti; -//UBUcharbufr[1500]; -prompt(conn); -while(1){ -buf=netconn_recv(conn); -if(buf!=0x0) -netbuf_copy(buf,buffer,1024); -len=netbuf_len(buf); -netbuf_delete(buf); -buffer[len-2]='\0'; -kprintf("Buffer:[%s:%i]\n",buffer,len); -if(!strcmp(buffer,"quit")){ -netconn_close(conn); -break; -} -elseif(!strcmp(buffer,"ls")){ -sendstr("no\nfiles\nhere\n",conn); -} -elseif(!strcmp(buffer,"uname")){ -sendstr("UbixOSv1.0reddawg@devel.ubixos.com:/ubix.elf\n",conn); -} -prompt(conn); -} +staticvoidshell_main(structnetconn*conn){ +structnetbuf*buf=0x0; +uInt32len; +uInt32err=0; +//UBUinti; +//UBUcharbufr[1500]; +buf=kmalloc(1500); +prompt(conn); +while(1){ +err=netconn_recv(conn,&buf); +if(buf!=0x0) +netbuf_copy(buf,buffer,1024); +len=netbuf_len(buf); +netbuf_delete(buf); +buffer[len-2]='\0'; +if(!strcmp(buffer,"quit")){ +netconn_close(conn); +break; +} +elseif(!strcmp(buffer,"ls")){ +sendstr("no\nfiles\nhere\n",conn); +} +elseif(!strcmp(buffer,"uname")){ +sendstr("UbixOSv1.0reddawg@devel.ubixos.com:/ubix.elf\n",conn); +} +prompt(conn); } - -staticvoidshell_thread(void*arg){ -structnetconn*conn=0x0,*newconn=0x0; - -buffer=(char*)kmalloc(1024); - -conn=netconn_new(NETCONN_TCP); -netconn_bind(conn,NULL,23); -netconn_listen(conn); - -while(1){ -kprintf("1"); -newconn=netconn_accept(conn); -kprintf("2"); -shell_main(newconn); -kprintf("3"); -//netconn_delete(newconn); -kprintf("4"); -} -} - -voidshell_init(void){ -sys_thread_new(shell_thread,NULL); -} - -/*** -END -***/ - +} + +voidshell_thread(void*arg){ +structnetconn*conn=0x0,*newconn=0x0; + +buffer=(char*)kmalloc(1024); + +conn=netconn_new(NETCONN_TCP); + +netconn_bind(conn,IP4_ADDR_ANY,23); +netconn_listen(conn); + +while(1){ +netconn_accept(conn,&newconn); +shell_main(newconn); +//netconn_delete(newconn); +} +} - + diff --git a/doc/xml/shell_8h.xml b/doc/xml/shell_8h.xml index 814819a..f63e9ac 100644 --- a/doc/xml/shell_8h.xml +++ b/doc/xml/shell_8h.xml @@ -1,9 +1,9 @@ - - - + + + shell.h - + void void shell_init (void) @@ -17,11 +17,7 @@ - - NULL - shell_thread - sys_thread_new - netMainThread + @@ -61,15 +57,15 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: shell_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:shell.h542016-01-1101:29:55Zreddawg$ */ -#ifndef__SHELL_H__ -#define__SHELL_H__ - -voidshell_init(void); +#ifndef__SHELL_H__ +#define__SHELL_H__ + +voidshell_init(void); -#endif/*__SHELL_H__*/ +#endif/*__SHELL_H__*/ - + diff --git a/doc/xml/smp_8c.xml b/doc/xml/smp_8c.xml index 978eb4a..4dbcd5a 100644 --- a/doc/xml/smp_8c.xml +++ b/doc/xml/smp_8c.xml @@ -1,76 +1,206 @@ - - - + + + smp.c ubixos/smp.h ubixos/spinlock.h ubixos/kpanic.h lib/kprintf.h - lib/string.h + lib/string.h sys/io.h - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gdt_descr + + + struct spinLock + struct spinLock bkl + + bkl + = SPIN_LOCK_INITIALIZER + + + + + + + + + + struct cpuinfo_t + struct cpuinfo_t cpuinfo[8] + [8] + cpuinfo + + + + + + + + + + struct spinLock + struct spinLock cpuInfoLock + + cpuInfoLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + uInt32 + uInt32 cpus + + cpus + = 0 + + + + + + + + + + struct spinLock + struct spinLock initSpinLock + + initSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + uInt8 * + uInt8* vram + + vram + = (uInt8 *)0xB8000 + + + + + + + + cpu0_thread + cpu1_thread + cpu2_thread + cpu3_thread + + - + void void ap_trampoline_end () @@ -81,10 +211,10 @@ - - apicMagic + + apicMagic - + void void ap_trampoline_start () @@ -95,9 +225,10 @@ - + + apicMagic - + void void apicMagic (void) @@ -111,16 +242,13 @@ - - ap_trampoline_end - ap_trampoline_start - apicRead - apicWrite - kprintf - memcpy - smpInit + + ap_trampoline_end + ap_trampoline_start + kprintf + memcpy - + unsigned int static unsigned int apicRead (address) @@ -134,11 +262,9 @@ - - apicMagic - cpuInfo + - + void static void apicWrite (unsigned int address, unsigned int data) @@ -157,42 +283,41 @@ - - apicMagic + - + asm - (".globl cpuid \n""cpuid: \n"" pushl %ebx \n"" pushl %edi \n"" movl 12(%esp),%eax \n"" movl 16(%esp),%edi \n"" cpuid \n"" movl %eax,0(%edi) \n"" movl %ebx,4(%edi) \n"" movl %ecx,8(%edi) \n"" movl %edx,12(%edi) \n"" popl %edi \n"" popl %ebx \n"" ret \n") + (".globl cpuid \n" "cpuid: \n" " pushl %ebx \n" " pushl %edi \n" " movl 12(%esp),%eax \n" " movl 16(%esp),%edi \n" " cpuid \n" " movl %eax,0(%edi) \n" " movl %ebx,4(%edi) \n" " movl %ecx,8(%edi) \n" " movl %edx,12(%edi) \n" " popl %edi \n" " popl %ebx \n" " ret \n") asm - ".globl cpuid \n""cpuid: \n"" pushl %ebx \n"" pushl %edi \n"" movl + ".globl cpuid \n" "cpuid: \n" " pushl %ebx \n" " pushl %edi \n" " movl 12 - (%esp) + %esp - %eax\n""movl + %eax \n" " movl 16 - (%esp) + %esp - %edi\n""cpuid\n""movl% + %edi \n" " cpuid \n" " movl % eax - 0(%edi)\n""movl% + 0(%edi) \n" " movl % ebx - 4(%edi)\n""movl% + 4(%edi) \n" " movl % ecx - 8(%edi)\n""movl% + 8(%edi) \n" " movl % edx - 12(%edi)\n""popl%edi\n""popl%ebx\n""ret\n" + 12(%edi) \n" " popl %edi \n" " popl %ebx \n" " ret \n" @@ -200,9 +325,9 @@ - + - + void void c_ap_boot (void) @@ -216,17 +341,10 @@ - - cpu1_thread - cpu2_thread - cpu3_thread - cpuInfo - initSpinLock - outportByte - spinLockLocked - xe9 + + spinLockLocked - + void void cpu0_thread (void) @@ -240,11 +358,11 @@ - - kernel_function - vram + + kernel_function + vram - + void void cpu1_thread (void) @@ -258,12 +376,11 @@ - - kernel_function - vram - c_ap_boot + + kernel_function + vram - + void void cpu2_thread (void) @@ -277,12 +394,11 @@ - - kernel_function - vram - c_ap_boot + + kernel_function + vram - + void void cpu3_thread (void) @@ -296,12 +412,11 @@ - - kernel_function - vram - c_ap_boot + + kernel_function + vram - + void void cpuidDetect () @@ -312,14 +427,13 @@ - - getEflags - kpanic - setEflags - smpInit + + getEflags + kpanic + setEflags - - uInt8 + + uInt8 uInt8 cpuInfo () cpuInfo @@ -329,33 +443,13 @@ - - cpuinfo_t::apic_id - cpuinfo_t::apic_ver - apicRead - cpuinfo_t::brand - cpuid - cpuinfo - cpuInfoLock - cpus - cpuinfo_t::feature - getEflags - cpuinfo_t::id - cpuinfo_t::ident - kpanic - cpuinfo_t::max - cpuinfo_t::ok - setDr3 - setEflags - cpuinfo_t::signature - spinLock - spinUnlock - x20 - x30 - c_ap_boot - smpInit + + getEflags + kpanic + setEflags + spinLock - + void static void GDT_fixer () @@ -366,12 +460,10 @@ - - gdt_descr::limit - smpInit + - - __inline__ uInt32 + + __inline__ uInt32 static __inline__ uInt32 getDr3 (void) getDr3 @@ -384,11 +476,10 @@ - - kernel_function + - - uInt32 + + uInt32 uInt32 getEflags () getEflags @@ -398,12 +489,12 @@ - - cpuidDetect - cpuInfo + + cpuidDetect + cpuInfo - - uInt8 + + uInt8 uInt8 kernel_function (void) kernel_function @@ -416,17 +507,14 @@ - - getDr3 - cpuinfo_t::id - spinLock - spinUnlock - cpu0_thread - cpu1_thread - cpu2_thread - cpu3_thread + + spinLock + cpu0_thread + cpu1_thread + cpu2_thread + cpu3_thread - + __inline__ void static __inline__ void setDr3 (void *dr3) @@ -441,16 +529,15 @@ - - cpuInfo + - + void void setEflags (uInt32 eflags) setEflags - uInt32 + uInt32 eflags @@ -459,11 +546,11 @@ - - cpuidDetect - cpuInfo + + cpuidDetect + cpuInfo - + void void smpInit () @@ -474,108 +561,8 @@ - - apicMagic - cpuidDetect - cpuInfo - GDT_fixer - initSpinLock - spinLock - spinUnlock - - - - - spinLock_t - spinLock_t bkl - - bkl - SPIN_LOCK_INITIALIZER - - - - - - - - - - cpuinfo_t - struct cpuinfo_t cpuinfo[8] - [8] - cpuinfo - - - - - - - - cpuInfo - - - spinLock_t - spinLock_t cpuInfoLock - - cpuInfoLock - SPIN_LOCK_INITIALIZER - - - - - - - - cpuInfo - - - uInt32 - uInt32 cpus - - cpus - 0 - - - - - - - - cpuInfo - - - spinLock_t - spinLock_t initSpinLock - - initSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - c_ap_boot - smpInit - - - uInt8 * - uInt8* vram - - vram - (uInt8 *)0xB8000 - - - - - - - - cpu0_thread - cpu1_thread - cpu2_thread - cpu3_thread + + spinLock @@ -583,298 +570,299 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: smp_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/smp.h> -#include<ubixos/spinlock.h> -#include<ubixos/kpanic.h> -#include<lib/kprintf.h> -#include<lib/string.h> -#include<sys/io.h> - -staticspinLock_tinitSpinLock=SPIN_LOCK_INITIALIZER; -staticspinLock_tcpuInfoLock=SPIN_LOCK_INITIALIZER; -staticuInt32cpus=0; -structcpuinfo_tcpuinfo[8]; - -uInt8kernel_function(void); -uInt8*vram=(uInt8*)0xB8000; - -staticinlineunsignedintapicRead(address){ -return*(volatileunsignedint*)(0xFEE00000+address); -} - -staticinlinevoidapicWrite(unsignedintaddress,unsignedintdata){ -*(volatileunsignedint*)(0xFEE00000+address)=data; -} - -static__inline__voidsetDr3(void*dr3){ -registeruInt32value=(uInt32)dr3; -__asm____volatile__("mov%0,%%dr3"::"r"(value)); -} - -static__inline__uInt32getDr3(void){ -registeruInt32value; -__asm____volatile__("mov%%dr3,%0":"=r"(value)); -returnvalue; -} - -structgdt_descr{ -uInt16limit; -uInt32*base__attribute__((packed)); -}; - -staticvoidGDT_fixer(){ -structgdt_descrgdt_descr; -uInt32*gdt=(uInt32*)0x20000;//128KB - -gdt[0]=0; -gdt[1]=0; -gdt[2]=0x0000ffff;//seg0x8--DPL04GBcode -gdt[3]=0x00cf9a00; -gdt[4]=0x0000ffff;//seg0x10--DPL04GBdata -gdt[5]=0x00cf9200; -gdt[6]=0x0000ffff;//seg0x1b--DPL34GBcode -gdt[7]=0x00cffa00; -gdt[8]=0x0000ffff;//seg0x23--DPL34GBdata -gdt[9]=0x00cff200; - -gdt_descr.limit=32*4; -gdt_descr.base=gdt; - -/* -asm("lgdt%0;"::"m"(gdt_descr)); -__asm____volatile__("ljmp%0,$1f;1:"::"i"(0x08)); -__asm____volatile__("movw%w0,%%ds"::"r"(0x10)); -__asm____volatile__("movw%w0,%%es"::"r"(0x10)); -__asm____volatile__("movw%w0,%%ss"::"r"(0x10)); -*/ -} - - -voidcpu0_thread(void){ -for(;;){ -vram[40+640]=kernel_function(); -vram[42+640]++; -} -} -voidcpu1_thread(void){ -for(;;){ -vram[60+640]=kernel_function(); -vram[62+640]++; -} -} -voidcpu2_thread(void){ -for(;;){ -vram[80+640]=kernel_function(); -vram[82+640]++; -} -} -voidcpu3_thread(void){ -for(;;){ -vram[100+640]=kernel_function(); -vram[102+640]++; -} -} - -staticspinLock_tbkl=SPIN_LOCK_INITIALIZER; -uInt8kernel_function(void){ -structcpuinfo_t*cpu; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/smp.h> +#include<ubixos/spinlock.h> +#include<ubixos/kpanic.h> +#include<lib/kprintf.h> +#include<lib/string.h> +#include<sys/io.h> + +staticstructspinLockinitSpinLock=SPIN_LOCK_INITIALIZER; +staticstructspinLockcpuInfoLock=SPIN_LOCK_INITIALIZER; +staticuInt32cpus=0; +structcpuinfo_tcpuinfo[8]; + +uInt8kernel_function(void); +uInt8*vram=(uInt8*)0xB8000; + +staticinlineunsignedintapicRead(address){ +return*(volatileunsignedint*)(0xFEE00000+address); +} + +staticinlinevoidapicWrite(unsignedintaddress,unsignedintdata){ +*(volatileunsignedint*)(0xFEE00000+address)=data; +} + +static__inline__voidsetDr3(void*dr3){ +registeruInt32value=(uInt32)dr3; +__asm____volatile__("mov%0,%%dr3"::"r"(value)); +} + +static__inline__uInt32getDr3(void){ +registeruInt32value; +__asm____volatile__("mov%%dr3,%0":"=r"(value)); +returnvalue; +} + +structgdt_descr{ +uInt16limit; +uInt32*base__attribute__((packed)); +}; + +staticvoidGDT_fixer(){ +structgdt_descrgdt_descr; +uInt32*gdt=(uInt32*)0x20000;//128KB + +gdt[0]=0; +gdt[1]=0; +gdt[2]=0x0000ffff;//seg0x8--DPL04GBcode +gdt[3]=0x00cf9a00; +gdt[4]=0x0000ffff;//seg0x10--DPL04GBdata +gdt[5]=0x00cf9200; +gdt[6]=0x0000ffff;//seg0x1b--DPL34GBcode +gdt[7]=0x00cffa00; +gdt[8]=0x0000ffff;//seg0x23--DPL34GBdata +gdt[9]=0x00cff200; + +gdt_descr.limit=32*4; +gdt_descr.base=gdt; + +/* +asm("lgdt%0;"::"m"(gdt_descr)); +__asm____volatile__("ljmp%0,$1f;1:"::"i"(0x08)); +__asm____volatile__("movw%w0,%%ds"::"r"(0x10)); +__asm____volatile__("movw%w0,%%es"::"r"(0x10)); +__asm____volatile__("movw%w0,%%ss"::"r"(0x10)); +*/ +} + +voidcpu0_thread(void){ +for(;;){ +vram[40+640]=kernel_function(); +vram[42+640]++; +} +} +voidcpu1_thread(void){ +for(;;){ +vram[60+640]=kernel_function(); +vram[62+640]++; +} +} +voidcpu2_thread(void){ +for(;;){ +vram[80+640]=kernel_function(); +vram[82+640]++; +} +} +voidcpu3_thread(void){ +for(;;){ +vram[100+640]=kernel_function(); +vram[102+640]++; +} +} + +staticstructspinLockbkl=SPIN_LOCK_INITIALIZER; +uInt8kernel_function(void){ +structcpuinfo_t*cpu; + +spinLock(&bkl); -spinLock(&bkl); +cpu=(structcpuinfo_t*)getDr3(); - -cpu=(structcpuinfo_t*)getDr3(); - -spinUnlock(&bkl); +spinUnlock(&bkl); + +return('0'+cpu->id); +} -return('0'+cpu->id); -} - +voidc_ap_boot(void){ + +while(spinLockLocked(&initSpinLock)); -voidc_ap_boot(void){ - -while(spinLockLocked(&initSpinLock)); - -switch(cpuInfo()){ -case1: -cpu1_thread(); -break; -case2: -cpu2_thread(); -break; -case3: -cpu3_thread(); -break; -} - -outportByte(0xe9,'5'); - -for(;;){ -asm("nop"); -} -} - - -voidsmpInit(){ -spinLock(&initSpinLock); -GDT_fixer(); -cpuidDetect(); -cpuInfo(); -apicMagic(); -spinUnlock(&initSpinLock); - -//cpu0_thread(); - -} - -voidcpuidDetect(){ -if(!(getEflags()&(1<<21))){ -setEflags(getEflags()|(1<<21)); -if(!(getEflags()&(1<<21))){ -kpanic("CPUdoesn'tsupportCPUID,getanewermachine\n"); -} -} -} - -uInt8cpuInfo(){ -uInt32data[4],i; - -if(!(getEflags()&(1<<21))){//Ifthecpuidbitineflagsnotset.. -setEflags(getEflags()|(1<<21));//..tryandsetittoseeifitcomeson.. -if(!(getEflags()&(1<<21))){//Itdidn't..ThisCPUsuck -kpanic("CPUdoesn'tsupportCPUID,getanewermachine\n"); -} -} +switch(cpuInfo()){ +case1: +cpu1_thread(); +break; +case2: +cpu2_thread(); +break; +case3: +cpu3_thread(); +break; +} + +outportByte(0xe9,'5'); + +for(;;){ +asm("nop"); +} +} + +voidsmpInit(){ +spinLock(&initSpinLock); +GDT_fixer(); +cpuidDetect(); +cpuInfo(); +apicMagic(); +spinUnlock(&initSpinLock); + +//cpu0_thread(); + +} + +voidcpuidDetect(){ +if(!(getEflags()&(1<<21))){ +setEflags(getEflags()|(1<<21)); +if(!(getEflags()&(1<<21))){ +kpanic("CPUdoesn'tsupportCPUID,getanewermachine\n"); +} +} +} + +uInt8cpuInfo(){ +uInt32data[4],i; + +if(!(getEflags()&(1<<21))){//Ifthecpuidbitineflagsnotset.. +setEflags(getEflags()|(1<<21));//..tryandsetittoseeifitcomeson.. +if(!(getEflags()&(1<<21))){//Itdidn't..ThisCPUsuck +kpanic("CPUdoesn'tsupportCPUID,getanewermachine\n"); +} +} + +spinLock(&cpuInfoLock); +cpuinfo[cpus].ok=1; +cpuinfo[cpus].apic_id=apicRead(0x20)>>24; +cpuinfo[cpus].apic_ver=apicRead(0x30)&0xFF; -spinLock(&cpuInfoLock); -cpuinfo[cpus].ok=1; -cpuinfo[cpus].apic_id=apicRead(0x20)>>24; -cpuinfo[cpus].apic_ver=apicRead(0x30)&0xFF; - -cpuid(0,data); -*(uInt32*)&cpuinfo[cpus].ident[0]=data[1]; -*(uInt32*)&cpuinfo[cpus].ident[4]=data[3]; -*(uInt32*)&cpuinfo[cpus].ident[8]=data[2]; -cpuinfo[cpus].ident[17]=0; -cpuinfo[cpus].max=data[0]; - -cpuid(1,data); -cpuinfo[cpus].signature=data[0]; -cpuinfo[cpus].feature=data[3]; +cpuid(0,data); +*(uInt32*)&cpuinfo[cpus].ident[0]=data[1]; +*(uInt32*)&cpuinfo[cpus].ident[4]=data[3]; +*(uInt32*)&cpuinfo[cpus].ident[8]=data[2]; +cpuinfo[cpus].ident[17]=0; +cpuinfo[cpus].max=data[0]; + +cpuid(1,data); +cpuinfo[cpus].signature=data[0]; +cpuinfo[cpus].feature=data[3]; + +cpuid(0x80000000,data); +if(data[0]>=0x80000004){ +for(i=0;i<3;i++){ +cpuid(0x80000002+i,data); -cpuid(0x80000000,data); -if(data[0]>=0x80000004){ -for(i=0;i<3;i++){ -cpuid(0x80000002+i,data); - -*(unsignedint*)&cpuinfo[cpus].brand[16*i+0]=data[0]; -*(unsignedint*)&cpuinfo[cpus].brand[16*i+4]=data[1]; -*(unsignedint*)&cpuinfo[cpus].brand[16*i+8]=data[2]; -*(unsignedint*)&cpuinfo[cpus].brand[16*i+12]=data[3]; -} -cpuinfo[cpus].brand[48]=0; -}else{ -cpuinfo[cpus].brand[0]=0; -} - -setDr3(&cpuinfo[cpus]);//DR3alwayspointstothecpu-structforthatCPU(shouldbethread-structofcurrentthread) -cpuinfo[cpus].id=cpus; +*(unsignedint*)&cpuinfo[cpus].brand[16*i+0]=data[0]; +*(unsignedint*)&cpuinfo[cpus].brand[16*i+4]=data[1]; +*(unsignedint*)&cpuinfo[cpus].brand[16*i+8]=data[2]; +*(unsignedint*)&cpuinfo[cpus].brand[16*i+12]=data[3]; +} +cpuinfo[cpus].brand[48]=0; +} +else{ +cpuinfo[cpus].brand[0]=0; +} + +setDr3(&cpuinfo[cpus]);//DR3alwayspointstothecpu-structforthatCPU(shouldbethread-structofcurrentthread) +cpuinfo[cpus].id=cpus; + +cpus++; + +spinUnlock(&cpuInfoLock); -cpus++; - -spinUnlock(&cpuInfoLock); - -return(cpus-1); -} - -externvoidap_trampoline_start(),ap_trampoline_end(); -voidapicMagic(void){ -uInt32tmp; - -kprintf("Copying%ubytesfrom0x%xto0x00\n",ap_trampoline_end-ap_trampoline_start,ap_trampoline_start); -memcpy(0x0,(char*)ap_trampoline_start,ap_trampoline_end-ap_trampoline_start); -apicWrite(0x280,0); -apicRead(0x280); - -apicWrite(0x300,0x000C4500);//INITIPItoallCPUs -for(tmp=0;tmp<800000;tmp++)asm("nop");//Sleepalittle(shouldbe10ms) -apicWrite(0x300,0x000C4600);//INITSIPItoallCPUs -for(tmp=0;tmp<800000;tmp++)asm("nop");//Sleepalittle(shouldbe200ms) -apicWrite(0x300,0x000C4600);//SecondINITSIPI -for(tmp=0;tmp<800000;tmp++)asm("nop");//Sleepalittle(shouldbe200ms) -} - - - -uInt32getEflags(){ -uInt32eflags=0x0; -asm( -"pushfl\n" -"popl%%eax\n" -:"=a"(eflags) -); -return(eflags); -} - -voidsetEflags(uInt32eflags){ -asm( -"pushl%%eax\n" -"popfl\n" -: -:"a"(eflags) -); -} - -asm( -".globlcpuid\n" -"cpuid:\n" -"pushl%ebx\n" -"pushl%edi\n" -"movl12(%esp),%eax\n" -"movl16(%esp),%edi\n" -"cpuid\n" -"movl%eax,0(%edi)\n" -"movl%ebx,4(%edi)\n" -"movl%ecx,8(%edi)\n" -"movl%edx,12(%edi)\n" -"popl%edi\n" -"popl%ebx\n" -"ret\n" -); - -/*** -END -***/ - +return(cpus-1); +} + +externvoidap_trampoline_start(), +ap_trampoline_end(); +voidapicMagic(void){ +uInt32tmp; + +kprintf("Copying%ubytesfrom0x%xto0x00\n",ap_trampoline_end-ap_trampoline_start,ap_trampoline_start); +memcpy(0x0,(char*)ap_trampoline_start,ap_trampoline_end-ap_trampoline_start); +apicWrite(0x280,0); +apicRead(0x280); + +apicWrite(0x300,0x000C4500);//INITIPItoallCPUs +for(tmp=0;tmp<800000;tmp++) +asm("nop"); +//Sleepalittle(shouldbe10ms) +apicWrite(0x300,0x000C4600);//INITSIPItoallCPUs +for(tmp=0;tmp<800000;tmp++) +asm("nop"); +//Sleepalittle(shouldbe200ms) +apicWrite(0x300,0x000C4600);//SecondINITSIPI +for(tmp=0;tmp<800000;tmp++) +asm("nop"); +//Sleepalittle(shouldbe200ms) +} + +uInt32getEflags(){ +uInt32eflags=0x0; +asm( +"pushfl\n" +"popl%%eax\n" +:"=a"(eflags) +); +return(eflags); +} + +voidsetEflags(uInt32eflags){ +asm( +"pushl%%eax\n" +"popfl\n" +: +:"a"(eflags) +); +} + +asm( +".globlcpuid\n" +"cpuid:\n" +"pushl%ebx\n" +"pushl%edi\n" +"movl12(%esp),%eax\n" +"movl16(%esp),%edi\n" +"cpuid\n" +"movl%eax,0(%edi)\n" +"movl%ebx,4(%edi)\n" +"movl%ecx,8(%edi)\n" +"movl%edx,12(%edi)\n" +"popl%edi\n" +"popl%ebx\n" +"ret\n" +); + +/*** +END +***/ + - + diff --git a/doc/xml/smp_8h.xml b/doc/xml/smp_8h.xml index 292e5bf..4af59b0 100644 --- a/doc/xml/smp_8h.xml +++ b/doc/xml/smp_8h.xml @@ -1,42 +1,80 @@ - - - + + + smp.h - ubixos/types.h - src/sys/kernel/smp.c + sys/types.h + C:/Dev/git/UbixOS/sys/kernel/smp.c - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + - - - - - - + + + + - - + + + + + + + + + + + + + + + + cpuinfo_t - + void void apicMagic () @@ -47,25 +85,22 @@ - - ap_trampoline_end - ap_trampoline_start - apicRead - apicWrite - kprintf - memcpy - smpInit + + ap_trampoline_end + ap_trampoline_start + kprintf + memcpy - + void void cpuid (uInt32, uInt32 *) cpuid - uInt32 + uInt32 - uInt32 * + uInt32 * @@ -73,10 +108,9 @@ - - cpuInfo + - + void void cpuidDetect () @@ -87,14 +121,13 @@ - - getEflags - kpanic - setEflags - smpInit + + getEflags + kpanic + setEflags - - uInt8 + + uInt8 uInt8 cpuInfo () cpuInfo @@ -104,34 +137,14 @@ - - cpuinfo_t::apic_id - cpuinfo_t::apic_ver - apicRead - cpuinfo_t::brand - cpuid - cpuinfo - cpuInfoLock - cpus - cpuinfo_t::feature - getEflags - cpuinfo_t::id - cpuinfo_t::ident - kpanic - cpuinfo_t::max - cpuinfo_t::ok - setDr3 - setEflags - cpuinfo_t::signature - spinLock - spinUnlock - x20 - x30 - c_ap_boot - smpInit + + getEflags + kpanic + setEflags + spinLock - - uInt32 + + uInt32 uInt32 getEflags () getEflags @@ -141,17 +154,17 @@ - - cpuidDetect - cpuInfo + + cpuidDetect + cpuInfo - + void void setEflags (uInt32) setEflags - uInt32 + uInt32 @@ -159,11 +172,11 @@ - - cpuidDetect - cpuInfo + + cpuidDetect + cpuInfo - + void void smpInit () @@ -174,14 +187,8 @@ - - apicMagic - cpuidDetect - cpuInfo - GDT_fixer - initSpinLock - spinLock - spinUnlock + + spinLock @@ -189,83 +196,60 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: smp_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SMP_H -#define_SMP_H - -#include<ubixos/types.h> - -structcpuinfo_t{ -uInt8id; -uInt8ok;//1=Ok,0=Bad -uInt8apic_id,apic_ver; -uInt32signature;//Family,Model,Stepping -uInt32feature; -uInt32max; -charbrand[49];//Brandname -charident[17]; -}; - - -voidsmpInit(); -voidcpuidDetect(); -uInt8cpuInfo(); -uInt32getEflags(); -voidsetEflags(uInt32); -voidcpuid(uInt32,uInt32*); -voidapicMagic(); - -#endif - -/*** -$Log: smp_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:56reddawg -nomessage - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_SMP_H +#define_UBIXOS_SMP_H + +#include<sys/types.h> + +structcpuinfo_t{ +uInt8id; +uInt8ok;//1=Ok,0=Bad +uInt8apic_id,apic_ver; +uInt32signature;//Family,Model,Stepping +uInt32feature; +uInt32max; +charbrand[49];//Brandname +charident[17]; +}; + +voidsmpInit(); +voidcpuidDetect(); +uInt8cpuInfo(); +uInt32getEflags(); +voidsetEflags(uInt32); +voidcpuid(uInt32,uInt32*); +voidapicMagic(); + +#endif - + diff --git a/doc/xml/sockets_8c.xml b/doc/xml/sockets_8c.xml index 8b580a0..f8775be 100644 --- a/doc/xml/sockets_8c.xml +++ b/doc/xml/sockets_8c.xml @@ -1,1202 +1,2847 @@ - - - + + + sockets.c - ubixos/types.h - net/debug.h - net/api.h - net/sockets.h + lib/kprintf.h + net/opt.h - - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - lwip_socket - - - NUM_SOCKETS - 10 - - - - - - - - alloc_socket - get_socket - - - - - int - static int alloc_socket - (struct netconn *newconn) - alloc_socket - - struct netconn * - newconn - - - - - - - - - lwip_socket::conn - lwip_socket::lastdata - lwip_socket::lastoffset - NULL - NUM_SOCKETS - sockets - lwip_accept - lwip_socket - - - struct lwip_socket * - static struct lwip_socket* get_socket - (int s) - get_socket - - int - s - - - - - - - - - lwip_socket::conn - NULL - NUM_SOCKETS - sockets - lwip_accept - lwip_bind - lwip_close - lwip_connect - lwip_listen - lwip_recvfrom - lwip_send - lwip_sendto - lwip_write - - - int - int lwip_accept - (int s, struct sockaddr *addr, int *addrlen) - lwip_accept - - int - s - - - struct sockaddr * - addr - - - int * - addrlen - - - - - - - - - ip_addr::addr - alloc_socket - lwip_socket::conn - get_socket - netconn_accept - netconn_delete - netconn_peer - NULL - - - int - int lwip_bind - (int s, struct sockaddr *name, int namelen) - lwip_bind - - int - s - - - struct sockaddr * - name - - - int - namelen - - - - - - - - - ip_addr::addr - lwip_socket::conn - ERR_OK - get_socket - name - netconn_bind - ntohs - NULL - - - int - int lwip_close - (int s) - lwip_close - - int - s - - - - - - - - - lwip_socket::conn - DEBUGF - get_socket - lwip_socket::lastdata - lwip_socket::lastoffset - netbuf_delete - netconn_delete - NULL - SOCKETS_DEBUG - - - int - int lwip_connect - (int s, struct sockaddr *name, int namelen) - lwip_connect - - int - s - - - struct sockaddr * - name - - - int - namelen - - - - - - - - - ip_addr::addr - lwip_socket::conn - ERR_OK - get_socket - name - netconn_connect - ntohs - NULL - - - int - int lwip_listen - (int s, int backlog) - lwip_listen - - int - s - - - int - backlog - - - - - - - - - lwip_socket::conn - ERR_OK - get_socket - netconn_listen - NULL - - - int - int lwip_read - (int s, void *mem, int len) - lwip_read - - int - s - - - void * - mem - - - int - len - - - - - - - - - lwip_recv - - - int - int lwip_recv - (int s, void *mem, int len, unsigned int flags) - lwip_recv - - int - s - - - void * - mem - - - int - len - - - unsigned int - flags - - - - - - - - - lwip_recvfrom - NULL - lwip_read - - - int - int lwip_recvfrom - (int s, void *mem, int len, unsigned int flags, struct sockaddr *from, int *fromlen) - lwip_recvfrom - - int - s - - - void * - mem - - - int - len - - - unsigned int - flags - - - struct sockaddr * - from - - - int * - fromlen - - - - - - - - - ip_addr::addr - lwip_socket::conn - get_socket - htons - lwip_socket::lastdata - lwip_socket::lastoffset - netbuf_copy_partial - netbuf_delete - netbuf_fromaddr - netbuf_fromport - netbuf_len - netconn_recv - NETCONN_TCP - netconn_type - NULL - lwip_recv - - - int - int lwip_send - (int s, void *data, int size, unsigned int flags) - lwip_send - - int - s - - - void * - data - - - int - size - - - unsigned int - flags - - - - - - - - - lwip_socket::conn - DEBUGF - netbuf::err - ERR_ARG - ERR_OK - get_socket - netbuf_delete - netbuf_new - netbuf_ref - NETCONN_COPY - netconn_send - NETCONN_TCP - netconn_type - NETCONN_UDP - netconn_write - NULL - SOCKETS_DEBUG - lwip_sendto - lwip_write - - - int - int lwip_sendto - (int s, void *data, int size, unsigned int flags, struct sockaddr *to, int tolen) - lwip_sendto - - int - s - - - void * - data - - - int - size - - - unsigned int - flags - - - struct sockaddr * - to - - - int - tolen - - - - - - - - - ip_addr::addr - lwip_socket::conn - get_socket - lwip_send - netconn_connect - netconn_peer - NULL - - - int - int lwip_socket - (int domain, int type, int protocol) - lwip_socket - - int - domain - - - int - type - - - int - protocol - - - - - - - - - alloc_socket - DEBUGF - netconn_delete - netconn_new - NETCONN_TCP - NETCONN_UDP - NULL - SOCK_DGRAM - SOCK_STREAM - SOCKETS_DEBUG - - - int - int lwip_write - (int s, void *data, int size) - lwip_write - - int - s - - - void * - data - - - int - size - - - - - - - - - lwip_socket::conn - DEBUGF - ERR_ARG - ERR_OK - get_socket - lwip_send - NETCONN_COPY - NETCONN_TCP - netconn_type - NETCONN_UDP - netconn_write - NULL - SOCKETS_DEBUG - - - - - struct lwip_socket - struct lwip_socket sockets[NUM_SOCKETS] - [NUM_SOCKETS] - sockets - - - - - - - - alloc_socket - get_socket - - +Sockets BSD-Like API module -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. * -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: sockets_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -#include<ubixos/types.h> - -#include"net/debug.h" -#include"net/api.h" - -#include"net/sockets.h" - -#defineNUM_SOCKETS10 - -structlwip_socket{ -structnetconn*conn; -structnetbuf*lastdata; -uInt16lastoffset; -}; - -staticstructlwip_socketsockets[NUM_SOCKETS]; - -/*-----------------------------------------------------------------------------------*/ -staticstructlwip_socket* -get_socket(ints) -{ -structlwip_socket*sock; - -if(s>NUM_SOCKETS){ -/*errno=EBADF;*/ -returnNULL; -} - -sock=&sockets[s]; - -if(sock->conn==NULL){ -/*errno=EBADF;*/ -returnNULL; -} -returnsock; -} -/*-----------------------------------------------------------------------------------*/ -staticint -alloc_socket(structnetconn*newconn) -{ -inti; - -/*allocateanewsocketidentifier*/ -for(i=0;i<NUM_SOCKETS;++i){ -if(sockets[i].conn==NULL){ -sockets[i].conn=newconn; -sockets[i].lastdata=NULL; -sockets[i].lastoffset=0; -returni; -} -} -return-1; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_accept(ints,structsockaddr*addr,int*addrlen) -{ -structlwip_socket*sock; -structnetconn*newconn; -structip_addr*naddr; -uInt16port; -intnewsock; - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -newconn=netconn_accept(sock->conn); - -/*gettheIPaddressandportoftheremotehost*/ -netconn_peer(newconn,&naddr,&port); - -((structsockaddr_in*)addr)->sin_addr.s_addr=naddr->addr; -((structsockaddr_in*)addr)->sin_port=port; - -newsock=alloc_socket(newconn); -if(newsock==-1){ -netconn_delete(newconn); -/*errno=ENOBUFS;*/ -} -returnnewsock; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_bind(ints,structsockaddr*name,intnamelen) -{ -structlwip_socket*sock; -structip_addrremote_addr; -uInt16remote_port; -err_terr; - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -remote_addr.addr=((structsockaddr_in*)name)->sin_addr.s_addr; -remote_port=((structsockaddr_in*)name)->sin_port; - -err=netconn_bind(sock->conn,&remote_addr,ntohs(remote_port)); - -if(err!=ERR_OK){ -/*errno=...*/ -return-1; -} - -return0; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_close(ints) -{ -structlwip_socket*sock; - -DEBUGF(SOCKETS_DEBUG,("close:socket%d\n",s)); -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - - -netconn_delete(sock->conn); -if(sock->lastdata!=NULL){ -netbuf_delete(sock->lastdata); -} -sock->lastdata=NULL; -sock->lastoffset=0; -sock->conn=NULL; -return0; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_connect(ints,structsockaddr*name,intnamelen) -{ -structlwip_socket*sock; -structip_addrremote_addr; -uInt16remote_port; -err_terr; - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -remote_addr.addr=((structsockaddr_in*)name)->sin_addr.s_addr; -remote_port=((structsockaddr_in*)name)->sin_port; - -err=netconn_connect(sock->conn,&remote_addr,ntohs(remote_port)); - -if(err!=ERR_OK){ -/*errno=...*/ -return-1; -} +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*ImprovedbyMarcBoucher<marc@mbsi.ca>andDavidHaas<dhaas@alum.rpi.edu> +* +*/ + +#include<lib/kprintf.h> +#include<net/opt.h> + +#ifLWIP_SOCKET/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include<net/sockets.h> +#include<net/api.h> +#include<net/sys.h> +#include<net/igmp.h> +#include<net/inet.h> +#include<net/tcp.h> +#include<net/raw.h> +#include<net/udp.h> +#include<net/memp.h> +#include<net/pbuf.h> +#include<net/priv/tcpip_priv.h> +#ifLWIP_CHECKSUM_ON_COPY +#include<net/inet_chksum.h> +#endif + +#include<string.h> + +/*IfthenetconnAPIisnotrequiredpublicly,thenweincludethenecessary +filesheretogettheimplementation*/ +#if!LWIP_NETCONN +#undefLWIP_NETCONN +#defineLWIP_NETCONN1 +#include"api_msg.c" +#include"api_lib.c" +#include"netbuf.c" +#undefLWIP_NETCONN +#defineLWIP_NETCONN0 +#endif + +#ifLWIP_IPV4 +#defineIP4ADDR_PORT_TO_SOCKADDR(sin,ipaddr,port)do{\ +(sin)->sin_len=sizeof(structsockaddr_in);\ +(sin)->sin_family=AF_INET;\ +(sin)->sin_port=lwip_htons((port));\ +inet_addr_from_ip4addr(&(sin)->sin_addr,ipaddr);\ +memset((sin)->sin_zero,0,SIN_ZERO_LEN);}while(0) +#defineSOCKADDR4_TO_IP4ADDR_PORT(sin,ipaddr,port)do{\ +inet_addr_to_ip4addr(ip_2_ip4(ipaddr),&((sin)->sin_addr));\ +(port)=lwip_ntohs((sin)->sin_port);}while(0) +#endif/*LWIP_IPV4*/ + +#ifLWIP_IPV6 +#defineIP6ADDR_PORT_TO_SOCKADDR(sin6,ipaddr,port)do{\ +(sin6)->sin6_len=sizeof(structsockaddr_in6);\ +(sin6)->sin6_family=AF_INET6;\ +(sin6)->sin6_port=lwip_htons((port));\ +(sin6)->sin6_flowinfo=0;\ +inet6_addr_from_ip6addr(&(sin6)->sin6_addr,ipaddr);\ +(sin6)->sin6_scope_id=0;}while(0) +#defineSOCKADDR6_TO_IP6ADDR_PORT(sin6,ipaddr,port)do{\ +inet6_addr_to_ip6addr(ip_2_ip6(ipaddr),&((sin6)->sin6_addr));\ +(port)=lwip_ntohs((sin6)->sin6_port);}while(0) +#endif/*LWIP_IPV6*/ + +#ifLWIP_IPV4&&LWIP_IPV6 +staticvoidsockaddr_to_ipaddr_port(conststructsockaddr*sockaddr,ip_addr_t*ipaddr,u16_t*port); + +#defineIS_SOCK_ADDR_LEN_VALID(namelen)(((namelen)==sizeof(structsockaddr_in))||\ +((namelen)==sizeof(structsockaddr_in6))) +#defineIS_SOCK_ADDR_TYPE_VALID(name)(((name)->sa_family==AF_INET)||\ +((name)->sa_family==AF_INET6)) +#defineSOCK_ADDR_TYPE_MATCH(name,sock)\ +((((name)->sa_family==AF_INET)&&!(NETCONNTYPE_ISIPV6((sock)->conn->type)))||\ +(((name)->sa_family==AF_INET6)&&(NETCONNTYPE_ISIPV6((sock)->conn->type)))) +#defineIPADDR_PORT_TO_SOCKADDR(sockaddr,ipaddr,port)do{\ +if(IP_IS_V6(ipaddr)){\ +IP6ADDR_PORT_TO_SOCKADDR((structsockaddr_in6*)(void*)(sockaddr),ip_2_ip6(ipaddr),port);\ +}else{\ +IP4ADDR_PORT_TO_SOCKADDR((structsockaddr_in*)(void*)(sockaddr),ip_2_ip4(ipaddr),port);\ +}}while(0) +#defineSOCKADDR_TO_IPADDR_PORT(sockaddr,ipaddr,port)sockaddr_to_ipaddr_port(sockaddr,ipaddr,&(port)) +#defineDOMAIN_TO_NETCONN_TYPE(domain,type)(((domain)==AF_INET)?\ +(type):(enumnetconn_type)((type)|NETCONN_TYPE_IPV6)) +#elifLWIP_IPV6/*LWIP_IPV4&&LWIP_IPV6*/ +#defineIS_SOCK_ADDR_LEN_VALID(namelen)((namelen)==sizeof(structsockaddr_in6)) +#defineIS_SOCK_ADDR_TYPE_VALID(name)((name)->sa_family==AF_INET6) +#defineSOCK_ADDR_TYPE_MATCH(name,sock)1 +#defineIPADDR_PORT_TO_SOCKADDR(sockaddr,ipaddr,port)\ +IP6ADDR_PORT_TO_SOCKADDR((structsockaddr_in6*)(void*)(sockaddr),ip_2_ip6(ipaddr),port) +#defineSOCKADDR_TO_IPADDR_PORT(sockaddr,ipaddr,port)\ +SOCKADDR6_TO_IP6ADDR_PORT((conststructsockaddr_in6*)(constvoid*)(sockaddr),ipaddr,port) +#defineDOMAIN_TO_NETCONN_TYPE(domain,netconn_type)(netconn_type) +#else/*->LWIP_IPV4:LWIP_IPV4&&LWIP_IPV6*/ +#defineIS_SOCK_ADDR_LEN_VALID(namelen)((namelen)==sizeof(structsockaddr_in)) +#defineIS_SOCK_ADDR_TYPE_VALID(name)((name)->sa_family==AF_INET) +#defineSOCK_ADDR_TYPE_MATCH(name,sock)1 +#defineIPADDR_PORT_TO_SOCKADDR(sockaddr,ipaddr,port)\ +IP4ADDR_PORT_TO_SOCKADDR((structsockaddr_in*)(void*)(sockaddr),ip_2_ip4(ipaddr),port) +#defineSOCKADDR_TO_IPADDR_PORT(sockaddr,ipaddr,port)\ +SOCKADDR4_TO_IP4ADDR_PORT((conststructsockaddr_in*)(constvoid*)(sockaddr),ipaddr,port) +#defineDOMAIN_TO_NETCONN_TYPE(domain,netconn_type)(netconn_type) +#endif/*LWIP_IPV6*/ + +#defineIS_SOCK_ADDR_TYPE_VALID_OR_UNSPEC(name)(((name)->sa_family==AF_UNSPEC)||\ +IS_SOCK_ADDR_TYPE_VALID(name)) +#defineSOCK_ADDR_TYPE_MATCH_OR_UNSPEC(name,sock)(((name)->sa_family==AF_UNSPEC)||\ +SOCK_ADDR_TYPE_MATCH(name,sock)) +#defineIS_SOCK_ADDR_ALIGNED(name)((((mem_ptr_t)(name))%4)==0) + + +#defineLWIP_SOCKOPT_CHECK_OPTLEN(optlen,opttype)do{if((optlen)<sizeof(opttype)){returnEINVAL;}}while(0) +#defineLWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,optlen,opttype)do{\ +LWIP_SOCKOPT_CHECK_OPTLEN(optlen,opttype);\ +if((sock)->conn==NULL){returnEINVAL;}}while(0) +#defineLWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,optlen,opttype)do{\ +LWIP_SOCKOPT_CHECK_OPTLEN(optlen,opttype);\ +if(((sock)->conn==NULL)||((sock)->conn->pcb.tcp==NULL)){returnEINVAL;}}while(0) +#defineLWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,opttype,netconntype)do{\ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,optlen,opttype);\ +if(NETCONNTYPE_GROUP(netconn_type((sock)->conn))!=netconntype){returnENOPROTOOPT;}}while(0) + + +#defineLWIP_SETGETSOCKOPT_DATA_VAR_REF(name)API_VAR_REF(name) +#defineLWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(name)API_VAR_DECLARE(structlwip_setgetsockopt_data,name) +#defineLWIP_SETGETSOCKOPT_DATA_VAR_FREE(name)API_VAR_FREE(MEMP_SOCKET_SETGETSOCKOPT_DATA,name) +#ifLWIP_MPU_COMPATIBLE +#defineLWIP_SETGETSOCKOPT_DATA_VAR_ALLOC(name,sock)do{\ +name=(structlwip_setgetsockopt_data*)memp_malloc(MEMP_SOCKET_SETGETSOCKOPT_DATA);\ +if(name==NULL){\ +sock_set_errno(sock,ENOMEM);\ +return-1;\ +}}while(0) +#else/*LWIP_MPU_COMPATIBLE*/ +#defineLWIP_SETGETSOCKOPT_DATA_VAR_ALLOC(name,sock) +#endif/*LWIP_MPU_COMPATIBLE*/ + +#ifLWIP_SO_SNDRCVTIMEO_NONSTANDARD +#defineLWIP_SO_SNDRCVTIMEO_OPTTYPEint +#defineLWIP_SO_SNDRCVTIMEO_SET(optval,val)(*(int*)(optval)=(val)) +#defineLWIP_SO_SNDRCVTIMEO_GET_MS(optval)((s32_t)*(constint*)(optval)) +#else +#defineLWIP_SO_SNDRCVTIMEO_OPTTYPEstructtimeval +#defineLWIP_SO_SNDRCVTIMEO_SET(optval,val)do{\ +s32_tloc=(val);\ +((structtimeval*)(optval))->tv_sec=(loc)/1000U;\ +((structtimeval*)(optval))->tv_usec=((loc)%1000U)*1000U;}while(0) +#defineLWIP_SO_SNDRCVTIMEO_GET_MS(optval)((((conststructtimeval*)(optval))->tv_sec*1000U)+(((conststructtimeval*)(optval))->tv_usec/1000U)) +#endif -return0; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_listen(ints,intbacklog) -{ -structlwip_socket*sock; -err_terr; - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -err=netconn_listen(sock->conn); - -if(err!=ERR_OK){ -/*errno=...*/ -return-1; -} - -return0; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_recvfrom(ints,void*mem,intlen,unsignedintflags, -structsockaddr*from,int*fromlen) -{ -structlwip_socket*sock; -structnetbuf*buf; -uInt16buflen,copylen; -structip_addr*addr; -uInt16port; - - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -/*Checkifthereisdataleftfromthelastrecvoperation.*/ -if(sock->lastdata!=NULL){ -buf=sock->lastdata; -}else{ -/*Nodatawasleftfromthepreviousoperation,sowetrytoget -somefromthenetwork.*/ -buf=netconn_recv(sock->conn); - -if(buf==NULL){ -/*Weshouldreallydosomeerrorcheckinghere.*/ -return0; -} -} - -buflen=netbuf_len(buf); - -buflen-=sock->lastoffset; - -if(len>buflen){ -copylen=buflen; -}else{ -copylen=len; -} - -/*copythecontentsofthereceivedbufferinto -thesuppliedmemorypointermem*/ -netbuf_copy_partial(buf,mem,copylen,sock->lastoffset); - -/*IfthisisaTCPsocket,checkifthereisdataleftinthe -buffer.Ifso,itshouldbesavedinthesockstructurefornext -timearound.*/ -if(netconn_type(sock->conn)==NETCONN_TCP&&buflen-copylen>0){ -sock->lastdata=buf; -sock->lastoffset=buflen-copylen; -}else{ -sock->lastdata=NULL; -sock->lastoffset=0; -netbuf_delete(buf); -} - -/*Checktoseefromwherethedatawas.*/ -if(from!=NULL&&fromlen!=NULL){ -addr=netbuf_fromaddr(buf); -port=htons(netbuf_fromport(buf)); -((structsockaddr_in*)from)->sin_addr.s_addr=addr->addr; -((structsockaddr_in*)from)->sin_port=port; -*fromlen=sizeof(structsockaddr_in); -} +#defineNUM_SOCKETSMEMP_NUM_NETCONN + +#ifndefSELWAIT_T +#defineSELWAIT_Tu8_t +#endif + +structlwip_sock{ +structnetconn*conn; +void*lastdata; +u16_tlastoffset; +s16_trcvevent; +u16_tsendevent; +u16_terrevent; +u8_terr; +SELWAIT_Tselect_waiting; +}; + +#ifLWIP_NETCONN_SEM_PER_THREAD +#defineSELECT_SEM_Tsys_sem_t* +#defineSELECT_SEM_PTR(sem)(sem) +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +#defineSELECT_SEM_Tsys_sem_t +#defineSELECT_SEM_PTR(sem)(&(sem)) +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +structlwip_select_cb{ +structlwip_select_cb*next; +structlwip_select_cb*prev; +fd_set*readset; +fd_set*writeset; +fd_set*exceptset; +intsem_signalled; +SELECT_SEM_Tsem; +}; + +unionsockaddr_aligned{ +structsockaddrsa; +#ifLWIP_IPV6 +structsockaddr_in6sin6; +#endif/*LWIP_IPV6*/ +#ifLWIP_IPV4 +structsockaddr_insin; +#endif/*LWIP_IPV4*/ +}; + +#ifLWIP_IGMP +/*DefinethenumberofIPv4multicastmemberships,defaultisonepersocket*/ +#ifndefLWIP_SOCKET_MAX_MEMBERSHIPS +#defineLWIP_SOCKET_MAX_MEMBERSHIPSNUM_SOCKETS +#endif + +/*ThisistokeeptrackofIP_ADD_MEMBERSHIPcallstodropthemembershipwhen +asocketisclosed*/ +structlwip_socket_multicast_pair{ +structlwip_sock*sock; +ip4_addr_tif_addr; +ip4_addr_tmulti_addr; +}; + +structlwip_socket_multicast_pairsocket_ipv4_multicast_memberships[LWIP_SOCKET_MAX_MEMBERSHIPS]; - -/*ifthelengthofthereceiveddataislargerthan -len,thisdataisdiscardedandwereturnlen. -otherwisewereturntheactuallengthofthereceived -data*/ -if(len>copylen){ -returncopylen; -}else{ -returnlen; -} -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_read(ints,void*mem,intlen) -{ -returnlwip_recv(s,mem,len,0); -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_recv(ints,void*mem,intlen,unsignedintflags) -{ -returnlwip_recvfrom(s,mem,len,flags,NULL,NULL); -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_send(ints,void*data,intsize,unsignedintflags) -{ -structlwip_socket*sock; -structnetbuf*buf; -err_terr; - -DEBUGF(SOCKETS_DEBUG,("send:socket%d,size%d\n",s,size)); - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -switch(netconn_type(sock->conn)){ -caseNETCONN_UDP: -/*createabuffer*/ -buf=netbuf_new(); - -if(buf==NULL){ -/*errno=ENOBUFS;*/ -return-1; -} - -/*makethebufferpointtothedatathatshould -besent*/ -netbuf_ref(buf,data,size); - -/*sendthedata*/ -err=netconn_send(sock->conn,buf); - -/*deallocatedthebuffer*/ -netbuf_delete(buf); -break; -caseNETCONN_TCP: -err=netconn_write(sock->conn,data,size,NETCONN_COPY); -break; -default: -err=ERR_ARG; -break; -} -if(err!=ERR_OK){ -/*errno=...*/ -return-1; -} - -returnsize; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_sendto(ints,void*data,intsize,unsignedintflags, -structsockaddr*to,inttolen) -{ -structlwip_socket*sock; -structip_addrremote_addr,*addr; -uInt16remote_port,port; -intret; - -sock=get_socket(s); -if(sock==NULL){ -return-1; -} - -/*getthepeerifcurrentlyconnected*/ -netconn_peer(sock->conn,&addr,&port); - -remote_addr.addr=((structsockaddr_in*)to)->sin_addr.s_addr; -remote_port=((structsockaddr_in*)to)->sin_port; -netconn_connect(sock->conn,&remote_addr,remote_port); - -ret=lwip_send(s,data,size,flags); - -/*resettheremoteaddressandportnumber -oftheconnection*/ -netconn_connect(sock->conn,addr,port); -returnret; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_socket(intdomain,inttype,intprotocol) -{ -structnetconn*conn; -inti; - -/*createanetconn*/ -switch(type){ -caseSOCK_DGRAM: -conn=netconn_new(NETCONN_UDP); -break; -caseSOCK_STREAM: -conn=netconn_new(NETCONN_TCP); -break; -default: -/*errno=...*/ -return-1; -} - -if(conn==NULL){ -DEBUGF(SOCKETS_DEBUG,("socket:couldnotcreatenetconn.\n")); -/*errno=ENOBUFS;*/ -return-1; -} +staticintlwip_socket_register_membership(ints,constip4_addr_t*if_addr,constip4_addr_t*multi_addr); +staticvoidlwip_socket_unregister_membership(ints,constip4_addr_t*if_addr,constip4_addr_t*multi_addr); +staticvoidlwip_socket_drop_registered_memberships(ints); +#endif/*LWIP_IGMP*/ + +staticstructlwip_socksockets[NUM_SOCKETS]; +staticstructlwip_select_cb*select_cb_list; +staticvolatileintselect_cb_ctr; + +#ifLWIP_SOCKET_SET_ERRNO +#ifndefset_errno +#defineset_errno(err)do{if(err){errno=(err);}}while(0) +#endif +#else/*LWIP_SOCKET_SET_ERRNO*/ +#defineset_errno(err) +#endif/*LWIP_SOCKET_SET_ERRNO*/ + +#definesock_set_errno(sk,e)do{\ +constintsockerr=(e);\ +sk->err=(u8_t)sockerr;\ +set_errno(sockerr);\ +}while(0) + +/*Forwarddeclarationofsomefunctions*/ +staticvoidevent_callback(structnetconn*conn,enumnetconn_evtevt,u16_tlen); +#if!LWIP_TCPIP_CORE_LOCKING +staticvoidlwip_getsockopt_callback(void*arg); +staticvoidlwip_setsockopt_callback(void*arg); +#endif +staticu8_tlwip_getsockopt_impl(ints,intlevel,intoptname,void*optval,socklen_t*optlen); +staticu8_tlwip_setsockopt_impl(ints,intlevel,intoptname,constvoid*optval,socklen_toptlen); + +#ifLWIP_IPV4&&LWIP_IPV6 +staticvoid +sockaddr_to_ipaddr_port(conststructsockaddr*sockaddr,ip_addr_t*ipaddr,u16_t*port) +{ +if((sockaddr->sa_family)==AF_INET6){ +SOCKADDR6_TO_IP6ADDR_PORT((conststructsockaddr_in6*)(constvoid*)(sockaddr),ipaddr,*port); +ipaddr->type=IPADDR_TYPE_V6; +}else{ +SOCKADDR4_TO_IP4ADDR_PORT((conststructsockaddr_in*)(constvoid*)(sockaddr),ipaddr,*port); +ipaddr->type=IPADDR_TYPE_V4; +} +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +void +lwip_socket_thread_init(void) +{ +netconn_thread_init(); +} + +void +lwip_socket_thread_cleanup(void) +{ +netconn_thread_cleanup(); +} + +staticstructlwip_sock* +get_socket(ints) +{ +structlwip_sock*sock; + +s-=LWIP_SOCKET_OFFSET; + +if((s<0)||(s>=NUM_SOCKETS)){ +LWIP_DEBUGF(SOCKETS_DEBUG,("get_socket(%d):invalid\n",s+LWIP_SOCKET_OFFSET)); +set_errno(EBADF); +returnNULL; +} + +sock=&sockets[s]; + +if(!sock->conn){ +LWIP_DEBUGF(SOCKETS_DEBUG,("get_socket(%d):notactive\n",s+LWIP_SOCKET_OFFSET)); +set_errno(EBADF); +returnNULL; +} + +returnsock; +} + +staticstructlwip_sock* +tryget_socket(ints) +{ +s-=LWIP_SOCKET_OFFSET; +if((s<0)||(s>=NUM_SOCKETS)){ +returnNULL; +} +if(!sockets[s].conn){ +returnNULL; +} +return&sockets[s]; +} + +staticint +alloc_socket(structnetconn*newconn,intaccepted) +{ +inti; +SYS_ARCH_DECL_PROTECT(lev); -i=alloc_socket(conn); - -if(i==-1){ -/*errno=ENOBUFS;*/ -netconn_delete(conn); -} -returni; -} -/*-----------------------------------------------------------------------------------*/ -int -lwip_write(ints,void*data,intsize) -{ -structlwip_socket*sock; -err_terr; - -DEBUGF(SOCKETS_DEBUG,("write:socket%d,size%d\n",s,size)); - -sock=get_socket(s); -if(sock==NULL){ -return-1; +/*allocateanewsocketidentifier*/ +for(i=0;i<NUM_SOCKETS;++i){ +/*Protectsocketarray*/ +SYS_ARCH_PROTECT(lev); +if(!sockets[i].conn&&(sockets[i].select_waiting==0)){ +sockets[i].conn=newconn; +/*Thesocketisnotyetknowntoanyone,sononeedtoprotect +afterhavingmarkeditasused.*/ +SYS_ARCH_UNPROTECT(lev); +sockets[i].lastdata=NULL; +sockets[i].lastoffset=0; +sockets[i].rcvevent=0; +/*TCPsendbufisempty,butthesocketisnotyetwritableuntilconnected +*(unlessithasbeencreatedbyaccept()).*/ +sockets[i].sendevent=(NETCONNTYPE_GROUP(newconn->type)==NETCONN_TCP?(accepted!=0):1); +sockets[i].errevent=0; +sockets[i].err=0; +returni+LWIP_SOCKET_OFFSET; +} +SYS_ARCH_UNPROTECT(lev); } - -switch(netconn_type(sock->conn)){ -caseNETCONN_UDP: -returnlwip_send(s,data,size,0); - -caseNETCONN_TCP: -err=netconn_write(sock->conn,data,size,NETCONN_COPY); -break; -default: -err=ERR_ARG; -break; -} -if(err!=ERR_OK){ -/*errno=...*/ -return-1; -} -returnsize; -} -/*-----------------------------------------------------------------------------------*/ +return-1; +} + +staticvoid +free_socket(structlwip_sock*sock,intis_tcp) +{ +void*lastdata; + +lastdata=sock->lastdata; +sock->lastdata=NULL; +sock->lastoffset=0; +sock->err=0; + +/*Protectsocketarray*/ +SYS_ARCH_SET(sock->conn,NULL); +/*don'tuse'sock'afterthisline,asanothertaskmighthaveallocatedit*/ + +if(lastdata!=NULL){ +if(is_tcp){ +pbuf_free((structpbuf*)lastdata); +}else{ +netbuf_delete((structnetbuf*)lastdata); +} +} +} + +/*Belowthis,thewell-knownsocketfunctionsareimplemented. +*Usegoogle.comoropengroup.orgtogetagooddescription:-) +* +*Exceptionsaredocumented! +*/ + +int +lwip_accept(ints,structsockaddr*addr,socklen_t*addrlen) +{ +structlwip_sock*sock,*nsock; +structnetconn*newconn; +ip_addr_tnaddr; +u16_tport=0; +intnewsock; +err_terr; +SYS_ARCH_DECL_PROTECT(lev); + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_accept(%d)...\n",s)); +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(netconn_is_nonblocking(sock->conn)&&(sock->rcvevent<=0)){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_accept(%d):returningEWOULDBLOCK\n",s)); +set_errno(EWOULDBLOCK); +return-1; +} + +/*waitforanewconnection*/ +err=netconn_accept(sock->conn,&newconn); +if(err!=ERR_OK){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_accept(%d):netconn_aceptfailed,err=%d\n",s,err)); +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_TCP){ +sock_set_errno(sock,EOPNOTSUPP); +}elseif(err==ERR_CLSD){ +sock_set_errno(sock,EINVAL); +}else{ +sock_set_errno(sock,err_to_errno(err)); +} +return-1; +} +LWIP_ASSERT("newconn!=NULL",newconn!=NULL); + +newsock=alloc_socket(newconn,1); +if(newsock==-1){ +netconn_delete(newconn); +sock_set_errno(sock,ENFILE); +return-1; +} +LWIP_ASSERT("invalidsocketindex",(newsock>=LWIP_SOCKET_OFFSET)&&(newsock<NUM_SOCKETS+LWIP_SOCKET_OFFSET)); +LWIP_ASSERT("newconn->callback==event_callback",newconn->callback==event_callback); +nsock=&sockets[newsock-LWIP_SOCKET_OFFSET]; + +/*Seeevent_callback:Ifdatacomesinrightawayafteranaccept,even +*thoughtheservertaskmightnothavecreatedanewsocketyet. +*Inthatcase,newconn->socketiscounteddown(newconn->socket--), +*sonsock->rcveventis>=1here! +*/ +SYS_ARCH_PROTECT(lev); +nsock->rcvevent+=(s16_t)(-1-newconn->socket); +newconn->socket=newsock; +SYS_ARCH_UNPROTECT(lev); + +/*NotethatPOSIXonlyrequiresustocheckaddrisnon-NULL.addrlenmust +*notbeNULLifaddrisvalid. +*/ +if(addr!=NULL){ +unionsockaddr_alignedtempaddr; +/*gettheIPaddressandportoftheremotehost*/ +err=netconn_peer(newconn,&naddr,&port); +if(err!=ERR_OK){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_accept(%d):netconn_peerfailed,err=%d\n",s,err)); +netconn_delete(newconn); +free_socket(nsock,1); +sock_set_errno(sock,err_to_errno(err)); +return-1; +} +LWIP_ASSERT("addrvalidbutaddrlenNULL",addrlen!=NULL); + +IPADDR_PORT_TO_SOCKADDR(&tempaddr,&naddr,port); +if(*addrlen>tempaddr.sa.sa_len){ +*addrlen=tempaddr.sa.sa_len; +} +MEMCPY(addr,&tempaddr,*addrlen); + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_accept(%d)returningnewsock=%daddr=",s,newsock)); +ip_addr_debug_print_val(SOCKETS_DEBUG,naddr); +LWIP_DEBUGF(SOCKETS_DEBUG,("port=%"U16_F"\n",port)); +}else{ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_accept(%d)returningnewsock=%d",s,newsock)); +} + +sock_set_errno(sock,0); +returnnewsock; +} + +int +lwip_bind(ints,conststructsockaddr*name,socklen_tnamelen) +{ +structlwip_sock*sock; +ip_addr_tlocal_addr; +u16_tlocal_port; +err_terr; + +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(!SOCK_ADDR_TYPE_MATCH(name,sock)){ +/*sockaddrdoesnotmatchsockettype(IPv4/IPv6)*/ +sock_set_errno(sock,err_to_errno(ERR_VAL)); +return-1; +} + +/*checksize,familyandalignmentof'name'*/ +LWIP_ERROR("lwip_bind:invalidaddress",(IS_SOCK_ADDR_LEN_VALID(namelen)&& +IS_SOCK_ADDR_TYPE_VALID(name)&&IS_SOCK_ADDR_ALIGNED(name)), +sock_set_errno(sock,err_to_errno(ERR_ARG));return-1;); +LWIP_UNUSED_ARG(namelen); + +SOCKADDR_TO_IPADDR_PORT(name,&local_addr,local_port); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_bind(%d,addr=",s)); +ip_addr_debug_print_val(SOCKETS_DEBUG,local_addr); +LWIP_DEBUGF(SOCKETS_DEBUG,("port=%"U16_F")\n",local_port)); + +#ifLWIP_IPV4&&LWIP_IPV6 +/*Dual-stack:UnmapIPv4mappedIPv6addresses*/ +if(IP_IS_V6_VAL(local_addr)&&ip6_addr_isipv4mappedipv6(ip_2_ip6(&local_addr))){ +unmap_ipv4_mapped_ipv6(ip_2_ip4(&local_addr),ip_2_ip6(&local_addr)); +IP_SET_TYPE_VAL(local_addr,IPADDR_TYPE_V4); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +err=netconn_bind(sock->conn,&local_addr,local_port); + +if(err!=ERR_OK){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_bind(%d)failed,err=%d\n",s,err)); +sock_set_errno(sock,err_to_errno(err)); +return-1; +} + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_bind(%d)succeeded\n",s)); +sock_set_errno(sock,0); +return0; +} + +int +lwip_close(ints) +{ +structlwip_sock*sock; +intis_tcp=0; +err_terr; + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_close(%d)\n",s)); + +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(sock->conn!=NULL){ +is_tcp=NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP; +}else{ +LWIP_ASSERT("sock->lastdata==NULL",sock->lastdata==NULL); +} + +#ifLWIP_IGMP +/*dropallpossiblyjoinedIGMPmemberships*/ +lwip_socket_drop_registered_memberships(s); +#endif/*LWIP_IGMP*/ + +err=netconn_delete(sock->conn); +if(err!=ERR_OK){ +sock_set_errno(sock,err_to_errno(err)); +return-1; +} + +free_socket(sock,is_tcp); +set_errno(0); +return0; +} + +int +lwip_connect(ints,conststructsockaddr*name,socklen_tnamelen) +{ +structlwip_sock*sock; +err_terr; + +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(!SOCK_ADDR_TYPE_MATCH_OR_UNSPEC(name,sock)){ +/*sockaddrdoesnotmatchsockettype(IPv4/IPv6)*/ +sock_set_errno(sock,err_to_errno(ERR_VAL)); +return-1; +} + +LWIP_UNUSED_ARG(namelen); +if(name->sa_family==AF_UNSPEC){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_connect(%d,AF_UNSPEC)\n",s)); +err=netconn_disconnect(sock->conn); +}else{ +ip_addr_tremote_addr; +u16_tremote_port; + +/*checksize,familyandalignmentof'name'*/ +LWIP_ERROR("lwip_connect:invalidaddress",IS_SOCK_ADDR_LEN_VALID(namelen)&& +IS_SOCK_ADDR_TYPE_VALID_OR_UNSPEC(name)&&IS_SOCK_ADDR_ALIGNED(name), +sock_set_errno(sock,err_to_errno(ERR_ARG));return-1;); + +SOCKADDR_TO_IPADDR_PORT(name,&remote_addr,remote_port); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_connect(%d,addr=",s)); +ip_addr_debug_print_val(SOCKETS_DEBUG,remote_addr); +LWIP_DEBUGF(SOCKETS_DEBUG,("port=%"U16_F")\n",remote_port)); + +#ifLWIP_IPV4&&LWIP_IPV6 +/*Dual-stack:UnmapIPv4mappedIPv6addresses*/ +if(IP_IS_V6_VAL(remote_addr)&&ip6_addr_isipv4mappedipv6(ip_2_ip6(&remote_addr))){ +unmap_ipv4_mapped_ipv6(ip_2_ip4(&remote_addr),ip_2_ip6(&remote_addr)); +IP_SET_TYPE_VAL(remote_addr,IPADDR_TYPE_V4); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +err=netconn_connect(sock->conn,&remote_addr,remote_port); +} + +if(err!=ERR_OK){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_connect(%d)failed,err=%d\n",s,err)); +sock_set_errno(sock,err_to_errno(err)); +return-1; +} + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_connect(%d)succeeded\n",s)); +sock_set_errno(sock,0); +return0; +} + +int +lwip_listen(ints,intbacklog) +{ +structlwip_sock*sock; +err_terr; + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_listen(%d,backlog=%d)\n",s,backlog)); + +sock=get_socket(s); +if(!sock){ +return-1; +} + +/*limitthe"backlog"parametertofitinanu8_t*/ +backlog=LWIP_MIN(LWIP_MAX(backlog,0),0xff); + +err=netconn_listen_with_backlog(sock->conn,(u8_t)backlog); + +if(err!=ERR_OK){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_listen(%d)failed,err=%d\n",s,err)); +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_TCP){ +sock_set_errno(sock,EOPNOTSUPP); +return-1; +} +sock_set_errno(sock,err_to_errno(err)); +return-1; +} + +sock_set_errno(sock,0); +return0; +} + +int +lwip_recvfrom(ints,void*mem,size_tlen,intflags, +structsockaddr*from,socklen_t*fromlen) +{ +structlwip_sock*sock; +void*buf=NULL; +structpbuf*p; +u16_tbuflen,copylen; +intoff=0; +u8_tdone=0; +err_terr; + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom(%d,%p,%"SZT_F",0x%x,..)\n",s,mem,len,flags)); +sock=get_socket(s); +if(!sock){ +return-1; +} + +do{ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom:topwhilesock->lastdata=%p\n",sock->lastdata)); +/*Checkifthereisdataleftfromthelastrecvoperation.*/ +if(sock->lastdata){ +buf=sock->lastdata; +}else{ +/*Ifthisisnon-blockingcall,thencheckfirst*/ +if(((flags&MSG_DONTWAIT)||netconn_is_nonblocking(sock->conn))&& +(sock->rcvevent<=0)){ +if(off>0){ +/*alreadyreceiveddata,returnthat*/ +sock_set_errno(sock,0); +returnoff; +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom(%d):returningEWOULDBLOCK\n",s)); +set_errno(EWOULDBLOCK); +return-1; +} + +/*Nodatawasleftfromthepreviousoperation,sowetrytoget +somefromthenetwork.*/ +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +err=netconn_recv_tcp_pbuf(sock->conn,(structpbuf**)&buf); +}else{ +err=netconn_recv(sock->conn,(structnetbuf**)&buf); +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom:netconn_recverr=%d,netbuf=%p\n", +err,buf)); + +if(err!=ERR_OK){ +if(off>0){ +if(err==ERR_CLSD){ +/*closedbutalreadyreceiveddata,ensureselectgetstheFIN,too*/ +event_callback(sock->conn,NETCONN_EVT_RCVPLUS,0); +} +/*alreadyreceiveddata,returnthat*/ +sock_set_errno(sock,0); +returnoff; +} +/*Weshouldreallydosomeerrorcheckinghere.*/ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom(%d):buf==NULL,erroris\"%s\"!\n", +s,lwip_strerr(err))); +sock_set_errno(sock,err_to_errno(err)); +if(err==ERR_CLSD){ +return0; +}else{ +return-1; +} +} +LWIP_ASSERT("buf!=NULL",buf!=NULL); +sock->lastdata=buf; +} + +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +p=(structpbuf*)buf; +}else{ +p=((structnetbuf*)buf)->p; +} +buflen=p->tot_len; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom:buflen=%"U16_F"len=%"SZT_F"off=%dsock->lastoffset=%"U16_F"\n", +buflen,len,off,sock->lastoffset)); + +buflen-=sock->lastoffset; + +if(len>buflen){ +copylen=buflen; +}else{ +copylen=(u16_t)len; +} + +/*copythecontentsofthereceivedbufferinto +thesuppliedmemorypointermem*/ +pbuf_copy_partial(p,(u8_t*)mem+off,copylen,sock->lastoffset); + +off+=copylen; + +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +LWIP_ASSERT("invalidcopylen,lenwouldunderflow",len>=copylen); +len-=copylen; +if((len<=0)|| +(p->flags&PBUF_FLAG_PUSH)|| +(sock->rcvevent<=0)|| +((flags&MSG_PEEK)!=0)){ +done=1; +} +}else{ +done=1; +} + +/*Checktoseefromwherethedatawas.*/ +if(done){ +#if!SOCKETS_DEBUG +if(from&&fromlen) +#endif/*!SOCKETS_DEBUG*/ +{ +u16_tport; +ip_addr_ttmpaddr; +ip_addr_t*fromaddr; +unionsockaddr_alignedsaddr; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom(%d):addr=",s)); +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +fromaddr=&tmpaddr; +netconn_getaddr(sock->conn,fromaddr,&port,0); +}else{ +port=netbuf_fromport((structnetbuf*)buf); +fromaddr=netbuf_fromaddr((structnetbuf*)buf); +} + +#ifLWIP_IPV4&&LWIP_IPV6 +/*Dual-stack:MapIPv4addressestoIPv4mappedIPv6*/ +if(NETCONNTYPE_ISIPV6(netconn_type(sock->conn))&&IP_IS_V4(fromaddr)){ +ip4_2_ipv4_mapped_ipv6(ip_2_ip6(fromaddr),ip_2_ip4(fromaddr)); +IP_SET_TYPE(fromaddr,IPADDR_TYPE_V6); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +IPADDR_PORT_TO_SOCKADDR(&saddr,fromaddr,port); +ip_addr_debug_print(SOCKETS_DEBUG,fromaddr); +LWIP_DEBUGF(SOCKETS_DEBUG,("port=%"U16_F"len=%d\n",port,off)); +#ifSOCKETS_DEBUG +if(from&&fromlen) +#endif/*SOCKETS_DEBUG*/ +{ +if(*fromlen>saddr.sa.sa_len){ +*fromlen=saddr.sa.sa_len; +} +MEMCPY(from,&saddr,*fromlen); +} +} +} + +/*Ifwedon'tpeektheincomingmessage...*/ +if((flags&MSG_PEEK)==0){ +/*IfthisisaTCPsocket,checkifthereisdataleftinthe +buffer.Ifso,itshouldbesavedinthesockstructurefornext +timearound.*/ +if((NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP)&&(buflen-copylen>0)){ +sock->lastdata=buf; +sock->lastoffset+=copylen; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom:lastdatanownetbuf=%p\n",buf)); +}else{ +sock->lastdata=NULL; +sock->lastoffset=0; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_recvfrom:deletingnetbuf=%p\n",buf)); +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +pbuf_free((structpbuf*)buf); +}else{ +netbuf_delete((structnetbuf*)buf); +} +buf=NULL; +} +} +}while(!done); + +sock_set_errno(sock,0); +returnoff; +} + +int +lwip_read(ints,void*mem,size_tlen) +{ +returnlwip_recvfrom(s,mem,len,0,NULL,NULL); +} + +int +lwip_recv(ints,void*mem,size_tlen,intflags) +{ +returnlwip_recvfrom(s,mem,len,flags,NULL,NULL); +} + +int +lwip_send(ints,constvoid*data,size_tsize,intflags) +{ +structlwip_sock*sock; +err_terr; +u8_twrite_flags; +size_twritten; + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_send(%d,data=%p,size=%"SZT_F",flags=0x%x)\n", +s,data,size,flags)); + +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_TCP){ +#if(LWIP_UDP||LWIP_RAW) +returnlwip_sendto(s,data,size,flags,NULL,0); +#else/*(LWIP_UDP||LWIP_RAW)*/ +sock_set_errno(sock,err_to_errno(ERR_ARG)); +return-1; +#endif/*(LWIP_UDP||LWIP_RAW)*/ +} + +write_flags=NETCONN_COPY| +((flags&MSG_MORE)?NETCONN_MORE:0)| +((flags&MSG_DONTWAIT)?NETCONN_DONTBLOCK:0); +written=0; +err=netconn_write_partly(sock->conn,data,size,write_flags,&written); + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_send(%d)err=%dwritten=%"SZT_F"\n",s,err,written)); +sock_set_errno(sock,err_to_errno(err)); +return(err==ERR_OK?(int)written:-1); +} + +int +lwip_sendmsg(ints,conststructmsghdr*msg,intflags) +{ +structlwip_sock*sock; +inti; +#ifLWIP_TCP +u8_twrite_flags; +size_twritten; +#endif +intsize=0; +err_terr=ERR_OK; + +sock=get_socket(s); +if(!sock){ +return-1; +} + +LWIP_ERROR("lwip_sendmsg:invalidmsghdr",msg!=NULL, +sock_set_errno(sock,err_to_errno(ERR_ARG));return-1;); + +LWIP_UNUSED_ARG(msg->msg_control); +LWIP_UNUSED_ARG(msg->msg_controllen); +LWIP_UNUSED_ARG(msg->msg_flags); +LWIP_ERROR("lwip_sendmsg:invalidmsghdriov",(msg->msg_iov!=NULL&&msg->msg_iovlen!=0), +sock_set_errno(sock,err_to_errno(ERR_ARG));return-1;); + +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +#ifLWIP_TCP +write_flags=NETCONN_COPY| +((flags&MSG_MORE)?NETCONN_MORE:0)| +((flags&MSG_DONTWAIT)?NETCONN_DONTBLOCK:0); + +for(i=0;i<msg->msg_iovlen;i++){ +u8_tapiflags=write_flags; +if(i+1<msg->msg_iovlen){ +apiflags|=NETCONN_MORE; +} +written=0; +err=netconn_write_partly(sock->conn,msg->msg_iov[i].iov_base,msg->msg_iov[i].iov_len,write_flags,&written); +if(err==ERR_OK){ +size+=written; +/*checkthattheentireIOvectorwasaccepected,ifnotreturnapartialwrite*/ +if(written!=msg->msg_iov[i].iov_len) +break; +} +/*noneofthisIOvectorwasaccepted,butpreviouswas,returnpartialwriteandconcealERR_WOULDBLOCK*/ +elseif(err==ERR_WOULDBLOCK&&size>0){ +err=ERR_OK; +/*letERR_WOULDBLOCKpersistonthenetconnsincewearereturningERR_OK*/ +break; +}else{ +size=-1; +break; +} +} +sock_set_errno(sock,err_to_errno(err)); +returnsize; +#else/*LWIP_TCP*/ +sock_set_errno(sock,err_to_errno(ERR_ARG)); +return-1; +#endif/*LWIP_TCP*/ +} +/*else,UDPandRAWNETCONNs*/ +#ifLWIP_UDP||LWIP_RAW +{ +structnetbuf*chain_buf; + +LWIP_UNUSED_ARG(flags); +LWIP_ERROR("lwip_sendmsg:invalidmsghdrname",(((msg->msg_name==NULL)&&(msg->msg_namelen==0))|| +IS_SOCK_ADDR_LEN_VALID(msg->msg_namelen)), +sock_set_errno(sock,err_to_errno(ERR_ARG));return-1;); + +/*initializechainbufferwithdestination*/ +chain_buf=netbuf_new(); +if(!chain_buf){ +sock_set_errno(sock,err_to_errno(ERR_MEM)); +return-1; +} +if(msg->msg_name){ +u16_tremote_port; +SOCKADDR_TO_IPADDR_PORT((conststructsockaddr*)msg->msg_name,&chain_buf->addr,remote_port); +netbuf_fromport(chain_buf)=remote_port; +} +#ifLWIP_NETIF_TX_SINGLE_PBUF +for(i=0;i<msg->msg_iovlen;i++){ +size+=msg->msg_iov[i].iov_len; +} +/*Allocateanewnetbufandcopythedataintoit.*/ +if(netbuf_alloc(chain_buf,(u16_t)size)==NULL){ +err=ERR_MEM; +}else{ +/*flattentheIOvectors*/ +size_toffset=0; +for(i=0;i<msg->msg_iovlen;i++){ +MEMCPY(&((u8_t*)chain_buf->p->payload)[offset],msg->msg_iov[i].iov_base,msg->msg_iov[i].iov_len); +offset+=msg->msg_iov[i].iov_len; +} +#ifLWIP_CHECKSUM_ON_COPY +{ +/*ThiscanbeimprovedbyusingLWIP_CHKSUM_COPY()andaggregatingthechecksumforeachIOvector*/ +u16_tchksum=~inet_chksum_pbuf(chain_buf->p); +netbuf_set_chksum(chain_buf,chksum); +} +#endif/*LWIP_CHECKSUM_ON_COPY*/ +err=ERR_OK; +} +#else/*LWIP_NETIF_TX_SINGLE_PBUF*/ +/*createachainednetbuffromtheIOvectors.NOTE:weassembleapbufchain +manuallytoavoidhavingtoallocate,chain,anddeleteanetbufforeachiov*/ +for(i=0;i<msg->msg_iovlen;i++){ +structpbuf*p=pbuf_alloc(PBUF_TRANSPORT,0,PBUF_REF); +if(p==NULL){ +err=ERR_MEM;/*letnetbuf_delete()cleanupchain_buf*/ +break; +} +p->payload=msg->msg_iov[i].iov_base; +LWIP_ASSERT("iov_len<u16_t",msg->msg_iov[i].iov_len<=0xFFFF); +p->len=p->tot_len=(u16_t)msg->msg_iov[i].iov_len; +/*netbufempty,addnewpbuf*/ +if(chain_buf->p==NULL){ +chain_buf->p=chain_buf->ptr=p; +/*addpbuftoexistingpbufchain*/ +}else{ +pbuf_cat(chain_buf->p,p); +} +} +/*savesizeoftotalchain*/ +if(err==ERR_OK){ +size=netbuf_len(chain_buf); +} +#endif/*LWIP_NETIF_TX_SINGLE_PBUF*/ + +if(err==ERR_OK){ +#ifLWIP_IPV4&&LWIP_IPV6 +/*Dual-stack:UnmapIPv4mappedIPv6addresses*/ +if(IP_IS_V6_VAL(chain_buf->addr)&&ip6_addr_isipv4mappedipv6(ip_2_ip6(&chain_buf->addr))){ +unmap_ipv4_mapped_ipv6(ip_2_ip4(&chain_buf->addr),ip_2_ip6(&chain_buf->addr)); +IP_SET_TYPE_VAL(chain_buf->addr,IPADDR_TYPE_V4); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +/*sendthedata*/ +err=netconn_send(sock->conn,chain_buf); +} + +/*deallocatedthebuffer*/ +netbuf_delete(chain_buf); + +sock_set_errno(sock,err_to_errno(err)); +return(err==ERR_OK?size:-1); +} +#else/*LWIP_UDP||LWIP_RAW*/ +sock_set_errno(sock,err_to_errno(ERR_ARG)); +return-1; +#endif/*LWIP_UDP||LWIP_RAW*/ +} + +int +lwip_sendto(ints,constvoid*data,size_tsize,intflags, +conststructsockaddr*to,socklen_ttolen) +{ +structlwip_sock*sock; +err_terr; +u16_tshort_size; +u16_tremote_port; +structnetbufbuf; + +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))==NETCONN_TCP){ +#ifLWIP_TCP +returnlwip_send(s,data,size,flags); +#else/*LWIP_TCP*/ +LWIP_UNUSED_ARG(flags); +sock_set_errno(sock,err_to_errno(ERR_ARG)); +return-1; +#endif/*LWIP_TCP*/ +} + +/*@todo:splitintomultiplesendto's?*/ +LWIP_ASSERT("lwip_sendto:sizemustfitinu16_t",size<=0xffff); +short_size=(u16_t)size; +LWIP_ERROR("lwip_sendto:invalidaddress",(((to==NULL)&&(tolen==0))|| +(IS_SOCK_ADDR_LEN_VALID(tolen)&& +IS_SOCK_ADDR_TYPE_VALID(to)&&IS_SOCK_ADDR_ALIGNED(to))), +sock_set_errno(sock,err_to_errno(ERR_ARG));return-1;); +LWIP_UNUSED_ARG(tolen); + +/*initializeabuffer*/ +buf.p=buf.ptr=NULL; +#ifLWIP_CHECKSUM_ON_COPY +buf.flags=0; +#endif/*LWIP_CHECKSUM_ON_COPY*/ +if(to){ +SOCKADDR_TO_IPADDR_PORT(to,&buf.addr,remote_port); +}else{ +remote_port=0; +ip_addr_set_any(NETCONNTYPE_ISIPV6(netconn_type(sock->conn)),&buf.addr); +} +netbuf_fromport(&buf)=remote_port; + + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_sendto(%d,data=%p,short_size=%"U16_F",flags=0x%xto=", +s,data,short_size,flags)); +ip_addr_debug_print(SOCKETS_DEBUG,&buf.addr); +LWIP_DEBUGF(SOCKETS_DEBUG,("port=%"U16_F"\n",remote_port)); + +/*makethebufferpointtothedatathatshouldbesent*/ +#ifLWIP_NETIF_TX_SINGLE_PBUF +/*Allocateanewnetbufandcopythedataintoit.*/ +if(netbuf_alloc(&buf,short_size)==NULL){ +err=ERR_MEM; +}else{ +#ifLWIP_CHECKSUM_ON_COPY +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_RAW){ +u16_tchksum=LWIP_CHKSUM_COPY(buf.p->payload,data,short_size); +netbuf_set_chksum(&buf,chksum); +}else +#endif/*LWIP_CHECKSUM_ON_COPY*/ +{ +MEMCPY(buf.p->payload,data,short_size); +} +err=ERR_OK; +} +#else/*LWIP_NETIF_TX_SINGLE_PBUF*/ +err=netbuf_ref(&buf,data,short_size); +#endif/*LWIP_NETIF_TX_SINGLE_PBUF*/ +if(err==ERR_OK){ +#ifLWIP_IPV4&&LWIP_IPV6 +/*Dual-stack:UnmapIPv4mappedIPv6addresses*/ +if(IP_IS_V6_VAL(buf.addr)&&ip6_addr_isipv4mappedipv6(ip_2_ip6(&buf.addr))){ +unmap_ipv4_mapped_ipv6(ip_2_ip4(&buf.addr),ip_2_ip6(&buf.addr)); +IP_SET_TYPE_VAL(buf.addr,IPADDR_TYPE_V4); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +/*sendthedata*/ +err=netconn_send(sock->conn,&buf); +} + +/*deallocatedthebuffer*/ +netbuf_free(&buf); + +sock_set_errno(sock,err_to_errno(err)); +return(err==ERR_OK?short_size:-1); +} + +int +lwip_socket(intdomain,inttype,intprotocol) +{ +structnetconn*conn; +inti; + +LWIP_UNUSED_ARG(domain);/*@todo:checkthis*/ + +/*createanetconn*/ +switch(type){ +caseSOCK_RAW: +conn=netconn_new_with_proto_and_callback(DOMAIN_TO_NETCONN_TYPE(domain,NETCONN_RAW), +(u8_t)protocol,event_callback); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_socket(%s,SOCK_RAW,%d)=", +domain==PF_INET?"PF_INET":"UNKNOWN",protocol)); +break; +caseSOCK_DGRAM: +conn=netconn_new_with_callback(DOMAIN_TO_NETCONN_TYPE(domain, +((protocol==IPPROTO_UDPLITE)?NETCONN_UDPLITE:NETCONN_UDP)), +event_callback); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_socket(%s,SOCK_DGRAM,%d)=", +domain==PF_INET?"PF_INET":"UNKNOWN",protocol)); +break; +caseSOCK_STREAM: +conn=netconn_new_with_callback(DOMAIN_TO_NETCONN_TYPE(domain,NETCONN_TCP),event_callback); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_socket(%s,SOCK_STREAM,%d)=", +domain==PF_INET?"PF_INET":"UNKNOWN",protocol)); +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_socket(%d,%d/UNKNOWN,%d)=-1\n", +domain,type,protocol)); +set_errno(EINVAL); +return-1; +} + +if(!conn){ +LWIP_DEBUGF(SOCKETS_DEBUG,("-1/ENOBUFS(couldnotcreatenetconn)\n")); +set_errno(ENOBUFS); +return-1; +} + +i=alloc_socket(conn,0); + +if(i==-1){ +netconn_delete(conn); +set_errno(ENFILE); +return-1; +} +conn->socket=i; +LWIP_DEBUGF(SOCKETS_DEBUG,("%d\n",i)); +set_errno(0); +returni; +} + +int +lwip_write(ints,constvoid*data,size_tsize) +{ +returnlwip_send(s,data,size,0); +} + +int +lwip_writev(ints,conststructiovec*iov,intiovcnt) +{ +structmsghdrmsg; + +msg.msg_name=NULL; +msg.msg_namelen=0; +/*Hack:wehavetocastvianumbertocastfrom'const'pointertonon-const. +Blametheopengroupstandardforthisinconsistency.*/ +msg.msg_iov=LWIP_CONST_CAST(structiovec*,iov); +msg.msg_iovlen=iovcnt; +msg.msg_control=NULL; +msg.msg_controllen=0; +msg.msg_flags=0; +returnlwip_sendmsg(s,&msg,0); +} + +staticint +lwip_selscan(intmaxfdp1,fd_set*readset_in,fd_set*writeset_in,fd_set*exceptset_in, +fd_set*readset_out,fd_set*writeset_out,fd_set*exceptset_out) +{ +inti,nready=0; +fd_setlreadset,lwriteset,lexceptset; +structlwip_sock*sock; +SYS_ARCH_DECL_PROTECT(lev); + +FD_ZERO(&lreadset); +FD_ZERO(&lwriteset); +FD_ZERO(&lexceptset); + +/*Gothrougheachsocketineachlisttocountnumberofsocketswhich +currentlymatch*/ +for(i=LWIP_SOCKET_OFFSET;i<maxfdp1;i++){ +/*ifthisFDisnotintheset,continue*/ +if(!(readset_in&&FD_ISSET(i,readset_in))&& +!(writeset_in&&FD_ISSET(i,writeset_in))&& +!(exceptset_in&&FD_ISSET(i,exceptset_in))){ +continue; +} +/*Firstgetthesocket'sstatus(protected)...*/ +SYS_ARCH_PROTECT(lev); +sock=tryget_socket(i); +if(sock!=NULL){ +void*lastdata=sock->lastdata; +s16_trcvevent=sock->rcvevent; +u16_tsendevent=sock->sendevent; +u16_terrevent=sock->errevent; +SYS_ARCH_UNPROTECT(lev); + +/*...thenexamineit:*/ +/*Seeifnetconnofthissocketisreadyforread*/ +if(readset_in&&FD_ISSET(i,readset_in)&&((lastdata!=NULL)||(rcvevent>0))){ +FD_SET(i,&lreadset); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_selscan:fd=%dreadyforreading\n",i)); +nready++; +} +/*Seeifnetconnofthissocketisreadyforwrite*/ +if(writeset_in&&FD_ISSET(i,writeset_in)&&(sendevent!=0)){ +FD_SET(i,&lwriteset); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_selscan:fd=%dreadyforwriting\n",i)); +nready++; +} +/*Seeifnetconnofthissockethadanerror*/ +if(exceptset_in&&FD_ISSET(i,exceptset_in)&&(errevent!=0)){ +FD_SET(i,&lexceptset); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_selscan:fd=%dreadyforexception\n",i)); +nready++; +} +}else{ +SYS_ARCH_UNPROTECT(lev); +/*continueontonextFDinlist*/ +} +} +/*copylocalsetstotheonesprovidedasarguments*/ +*readset_out=lreadset; +*writeset_out=lwriteset; +*exceptset_out=lexceptset; + +LWIP_ASSERT("nready>=0",nready>=0); +returnnready; +} + +intlwip_select(intmaxfdp1,fd_set*readset,fd_set*writeset,fd_set*exceptset,structtimeval*timeout){ +u32_twaitres=0; +intnready; +fd_setlreadset,lwriteset,lexceptset; +u32_tmsectimeout; +structlwip_select_cbselect_cb; +inti; +intmaxfdp2; +#ifLWIP_NETCONN_SEM_PER_THREAD +intwaited=0; +#endif +SYS_ARCH_DECL_PROTECT(lev); + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_select(%d,%p,%p,%p,tvsec=%"S32_F"tvusec=%"S32_F")\n", +maxfdp1,(void*)readset,(void*)writeset,(void*)exceptset, +timeout?(s32_t)timeout->tv_sec:(s32_t)-1, +timeout?(s32_t)timeout->tv_usec:(s32_t)-1)); + +/*Gothrougheachsocketineachlisttocountnumberofsocketswhich +currentlymatch*/ +nready=lwip_selscan(maxfdp1,readset,writeset,exceptset,&lreadset,&lwriteset,&lexceptset); + +/*Ifwedon'thaveanycurrentevents,thensuspendifwearesupposedto*/ +if(!nready){ +if(timeout&&timeout->tv_sec==0&&timeout->tv_usec==0){ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_select:notimeout,returning0\n")); +/*ThisisOKasthelocalfdsetsareemptyandnreadyiszero, +orwewouldhavereturnedearlier.*/ +gotoreturn_copy_fdsets; +} + +/*Noneready:addoursemaphoretolist: +Wedon'tactuallyneedanydynamicmemory.Ourentryonthe +listisonlyvalidwhileweareinthisfunction,soit'sok +touselocalvariables.*/ + +select_cb.next=NULL; +select_cb.prev=NULL; +select_cb.readset=readset; +select_cb.writeset=writeset; +select_cb.exceptset=exceptset; +select_cb.sem_signalled=0; +#ifLWIP_NETCONN_SEM_PER_THREAD +select_cb.sem=LWIP_NETCONN_THREAD_SEM_GET(); +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +if(sys_sem_new(&select_cb.sem,0)!=ERR_OK){ +/*failedtocreatesemaphore*/ +set_errno(ENOMEM); +return-1; +} +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +/*Protecttheselect_cb_list*/ +SYS_ARCH_PROTECT(lev); + +/*Putthisselect_cbontopoflist*/ +select_cb.next=select_cb_list; +if(select_cb_list!=NULL){ +select_cb_list->prev=&select_cb; +} +select_cb_list=&select_cb; +/*Increasingthiscountertellsevent_callbackthatthelisthaschanged.*/ +select_cb_ctr++; + +/*Nowwecansafelyunprotect*/ +SYS_ARCH_UNPROTECT(lev); + +/*Increaseselect_waitingforeachsocketweareinterestedin*/ +maxfdp2=maxfdp1; +for(i=LWIP_SOCKET_OFFSET;i<maxfdp1;i++){ +if((readset&&FD_ISSET(i,readset))|| +(writeset&&FD_ISSET(i,writeset))|| +(exceptset&&FD_ISSET(i,exceptset))){ +structlwip_sock*sock; +SYS_ARCH_PROTECT(lev); +sock=tryget_socket(i); +if(sock!=NULL){ +sock->select_waiting++; +LWIP_ASSERT("sock->select_waiting>0",sock->select_waiting>0); +}else{ +/*Notavalidsocket*/ +nready=-1; +maxfdp2=i; +SYS_ARCH_UNPROTECT(lev); +break; +} +SYS_ARCH_UNPROTECT(lev); +} +} + +if(nready>=0){ +/*Calllwip_selscanagain:therecouldhavebeeneventsbetween +thelastscan(withoutusonthelist)andputtingusonthelist!*/ +nready=lwip_selscan(maxfdp1,readset,writeset,exceptset,&lreadset,&lwriteset,&lexceptset); +if(!nready){ +/*Stillnoneready,justwaittobewoken*/ +if(timeout==0){ +/*Waitforever*/ +msectimeout=0; +}else{ +msectimeout=((timeout->tv_sec*1000)+((timeout->tv_usec+500)/1000)); +if(msectimeout==0){ +/*Wait1msatleast(0meanswaitforever)*/ +msectimeout=1; +} +} + +waitres=sys_arch_sem_wait(SELECT_SEM_PTR(select_cb.sem),msectimeout); +#ifLWIP_NETCONN_SEM_PER_THREAD +waited=1; +#endif +} +} + +/*Decreaseselect_waitingforeachsocketweareinterestedin*/ +for(i=LWIP_SOCKET_OFFSET;i<maxfdp2;i++){ +if((readset&&FD_ISSET(i,readset))|| +(writeset&&FD_ISSET(i,writeset))|| +(exceptset&&FD_ISSET(i,exceptset))){ +structlwip_sock*sock; +SYS_ARCH_PROTECT(lev); +sock=tryget_socket(i); +if(sock!=NULL){ +/*fornow,handleselect_waiting==0...*/ +LWIP_ASSERT("sock->select_waiting>0",sock->select_waiting>0); +if(sock->select_waiting>0){ +sock->select_waiting--; +} +}else{ +/*Notavalidsocket*/ +nready=-1; +} +SYS_ARCH_UNPROTECT(lev); +} +} +/*Takeusoffthelist*/ +SYS_ARCH_PROTECT(lev); +if(select_cb.next!=NULL){ +select_cb.next->prev=select_cb.prev; +} +if(select_cb_list==&select_cb){ +LWIP_ASSERT("select_cb.prev==NULL",select_cb.prev==NULL); +select_cb_list=select_cb.next; +}else{ +LWIP_ASSERT("select_cb.prev!=NULL",select_cb.prev!=NULL); +select_cb.prev->next=select_cb.next; +} +/*Increasingthiscountertellsevent_callbackthatthelisthaschanged.*/ +select_cb_ctr++; +SYS_ARCH_UNPROTECT(lev); + +#ifLWIP_NETCONN_SEM_PER_THREAD +if(select_cb.sem_signalled&&(!waited||(waitres==SYS_ARCH_TIMEOUT))){ +/*don'tleavethethread-localsemaphoresignalled*/ +sys_arch_sem_wait(select_cb.sem,1); +} +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +sys_sem_free(&select_cb.sem); +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +if(nready<0){ +/*Thishappenswhenasocketgotclosedwhilewaiting*/ +set_errno(EBADF); +return-1; +} + +if(waitres==SYS_ARCH_TIMEOUT){ +/*Timeout*/ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_select:timeoutexpired\n")); +/*ThisisOKasthelocalfdsetsareemptyandnreadyiszero, +orwewouldhavereturnedearlier.*/ +gotoreturn_copy_fdsets; +} + +/*Seewhat'sset*/ +nready=lwip_selscan(maxfdp1,readset,writeset,exceptset,&lreadset,&lwriteset,&lexceptset); +} + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_select:nready=%d\n",nready)); +return_copy_fdsets: +set_errno(0); +if(readset){ +*readset=lreadset; +} +if(writeset){ +*writeset=lwriteset; +} +if(exceptset){ +*exceptset=lexceptset; +} +returnnready; +} + +staticvoid +event_callback(structnetconn*conn,enumnetconn_evtevt,u16_tlen) +{ +ints; +structlwip_sock*sock; +structlwip_select_cb*scb; +intlast_select_cb_ctr; +SYS_ARCH_DECL_PROTECT(lev); + +LWIP_UNUSED_ARG(len); + +/*Getsocket*/ +if(conn){ +s=conn->socket; +if(s<0){ +/*Datacomesinrightawayafteranaccept,eventhough +*theservertaskmightnothavecreatedanewsocketyet. +*Justcountdown(orup)ifthat'sthecaseandwe +*willusethedatalater.Notethatonlyreceiveevents +*canhappenbeforethenewsocketissetup.*/ +SYS_ARCH_PROTECT(lev); +if(conn->socket<0){ +if(evt==NETCONN_EVT_RCVPLUS){ +conn->socket--; +} +SYS_ARCH_UNPROTECT(lev); +return; +} +s=conn->socket; +SYS_ARCH_UNPROTECT(lev); +} + +sock=get_socket(s); +if(!sock){ +return; +} +}else{ +return; +} + +SYS_ARCH_PROTECT(lev); +/*Seteventasrequired*/ +switch(evt){ +caseNETCONN_EVT_RCVPLUS: +sock->rcvevent++; +break; +caseNETCONN_EVT_RCVMINUS: +sock->rcvevent--; +break; +caseNETCONN_EVT_SENDPLUS: +sock->sendevent=1; +break; +caseNETCONN_EVT_SENDMINUS: +sock->sendevent=0; +break; +caseNETCONN_EVT_ERROR: +sock->errevent=1; +break; +default: +LWIP_ASSERT("unknownevent",0); +break; +} + +if(sock->select_waiting==0){ +/*nooneiswaitingforthissocket,noneedtocheckselect_cb_list*/ +SYS_ARCH_UNPROTECT(lev); +return; +} + +/*Nowdecideifanyoneiswaitingforthissocket*/ +/*NOTE:Thiscodegoesthroughtheselect_cb_listlistmultipletimes +ONLYIFaselectwasactuallywaiting.Wegothroughthelistthenumber +ofwaitingselectcalls+1.Thislistisexpectedtobesmall.*/ + +/*Atthispoint,SYS_ARCHisstillprotected!*/ +again: +for(scb=select_cb_list;scb!=NULL;scb=scb->next){ +/*rememberthestateofselect_cb_listtodetectchanges*/ +last_select_cb_ctr=select_cb_ctr; +if(scb->sem_signalled==0){ +/*semaphorenotsignalledyet*/ +intdo_signal=0; +/*Testthisselectcallforoursocket*/ +if(sock->rcvevent>0){ +if(scb->readset&&FD_ISSET(s,scb->readset)){ +do_signal=1; +} +} +if(sock->sendevent!=0){ +if(!do_signal&&scb->writeset&&FD_ISSET(s,scb->writeset)){ +do_signal=1; +} +} +if(sock->errevent!=0){ +if(!do_signal&&scb->exceptset&&FD_ISSET(s,scb->exceptset)){ +do_signal=1; +} +} +if(do_signal){ +scb->sem_signalled=1; +/*Don'tcallSYS_ARCH_UNPROTECT()beforesignalingthesemaphore,asthismight +leadtotheselectthreadtakingitselfoffthelist,invalidatingthesemaphore.*/ +sys_sem_signal(SELECT_SEM_PTR(scb->sem)); +} +} +/*unlockinterruptswitheachstep*/ +SYS_ARCH_UNPROTECT(lev); +/*thismakessureinterruptprotectiontimeisshort*/ +SYS_ARCH_PROTECT(lev); +if(last_select_cb_ctr!=select_cb_ctr){ +/*someonehaschangedselect_cb_list,restartatthebeginning*/ +gotoagain; +} +} +SYS_ARCH_UNPROTECT(lev); +} + +int +lwip_shutdown(ints,inthow) +{ +structlwip_sock*sock; +err_terr; +u8_tshut_rx=0,shut_tx=0; + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_shutdown(%d,how=%d)\n",s,how)); + +sock=get_socket(s); +if(!sock){ +return-1; +} + +if(sock->conn!=NULL){ +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_TCP){ +sock_set_errno(sock,EOPNOTSUPP); +return-1; +} +}else{ +sock_set_errno(sock,ENOTCONN); +return-1; +} + +if(how==SHUT_RD){ +shut_rx=1; +}elseif(how==SHUT_WR){ +shut_tx=1; +}elseif(how==SHUT_RDWR){ +shut_rx=1; +shut_tx=1; +}else{ +sock_set_errno(sock,EINVAL); +return-1; +} +err=netconn_shutdown(sock->conn,shut_rx,shut_tx); + +sock_set_errno(sock,err_to_errno(err)); +return(err==ERR_OK?0:-1); +} + +staticint +lwip_getaddrname(ints,structsockaddr*name,socklen_t*namelen,u8_tlocal) +{ +structlwip_sock*sock; +unionsockaddr_alignedsaddr; +ip_addr_tnaddr; +u16_tport; +err_terr; + +sock=get_socket(s); +if(!sock){ +return-1; +} + +/*gettheIPaddressandport*/ +err=netconn_getaddr(sock->conn,&naddr,&port,local); +if(err!=ERR_OK){ +sock_set_errno(sock,err_to_errno(err)); +return-1; +} + +#ifLWIP_IPV4&&LWIP_IPV6 +/*Dual-stack:MapIPv4addressestoIPv4mappedIPv6*/ +if(NETCONNTYPE_ISIPV6(netconn_type(sock->conn))&& +IP_IS_V4_VAL(naddr)){ +ip4_2_ipv4_mapped_ipv6(ip_2_ip6(&naddr),ip_2_ip4(&naddr)); +IP_SET_TYPE_VAL(naddr,IPADDR_TYPE_V6); +} +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +IPADDR_PORT_TO_SOCKADDR(&saddr,&naddr,port); + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getaddrname(%d,addr=",s)); +ip_addr_debug_print_val(SOCKETS_DEBUG,naddr); +LWIP_DEBUGF(SOCKETS_DEBUG,("port=%"U16_F")\n",port)); + +if(*namelen>saddr.sa.sa_len){ +*namelen=saddr.sa.sa_len; +} +MEMCPY(name,&saddr,*namelen); + +sock_set_errno(sock,0); +return0; +} + +int +lwip_getpeername(ints,structsockaddr*name,socklen_t*namelen) +{ +returnlwip_getaddrname(s,name,namelen,0); +} + +int +lwip_getsockname(ints,structsockaddr*name,socklen_t*namelen) +{ +returnlwip_getaddrname(s,name,namelen,1); +} + +int +lwip_getsockopt(ints,intlevel,intoptname,void*optval,socklen_t*optlen) +{ +u8_terr; +structlwip_sock*sock=get_socket(s); +#if!LWIP_TCPIP_CORE_LOCKING +LWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(data); +#endif/*!LWIP_TCPIP_CORE_LOCKING*/ + +if(!sock){ +return-1; +} + +if((NULL==optval)||(NULL==optlen)){ +sock_set_errno(sock,EFAULT); +return-1; +} + +#ifLWIP_TCPIP_CORE_LOCKING +/*core-lockingcanjustcallthe-implfunction*/ +LOCK_TCPIP_CORE(); +err=lwip_getsockopt_impl(s,level,optname,optval,optlen); +UNLOCK_TCPIP_CORE(); + +#else/*LWIP_TCPIP_CORE_LOCKING*/ + +#ifLWIP_MPU_COMPATIBLE +/*MPU_COMPATIBLEcopiestheoptvaldata,socheckformaxsizehere*/ +if(*optlen>LWIP_SETGETSOCKOPT_MAXOPTLEN){ +sock_set_errno(sock,ENOBUFS); +return-1; +} +#endif/*LWIP_MPU_COMPATIBLE*/ + +LWIP_SETGETSOCKOPT_DATA_VAR_ALLOC(data,sock); +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).s=s; +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).level=level; +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optname=optname; +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optlen=*optlen; +#if!LWIP_MPU_COMPATIBLE +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optval.p=optval; +#endif/*!LWIP_MPU_COMPATIBLE*/ +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).err=0; +#ifLWIP_NETCONN_SEM_PER_THREAD +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).completed_sem=LWIP_NETCONN_THREAD_SEM_GET(); +#else +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).completed_sem=&sock->conn->op_completed; +#endif +err=tcpip_callback(lwip_getsockopt_callback,&LWIP_SETGETSOCKOPT_DATA_VAR_REF(data)); +if(err!=ERR_OK){ +LWIP_SETGETSOCKOPT_DATA_VAR_FREE(data); +sock_set_errno(sock,err_to_errno(err)); +return-1; +} +sys_arch_sem_wait((sys_sem_t*)(LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).completed_sem),0); + +/*writebackoptlenandoptval*/ +*optlen=LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optlen; +#ifLWIP_MPU_COMPATIBLE +MEMCPY(optval,LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optval, +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optlen); +#endif/*LWIP_MPU_COMPATIBLE*/ + +/*maybelwip_getsockopt_internalhaschangederr*/ +err=LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).err; +LWIP_SETGETSOCKOPT_DATA_VAR_FREE(data); +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +sock_set_errno(sock,err); +returnerr?-1:0; +} + +#if!LWIP_TCPIP_CORE_LOCKING + +staticvoid +lwip_getsockopt_callback(void*arg) +{ +structlwip_setgetsockopt_data*data; +LWIP_ASSERT("arg!=NULL",arg!=NULL); +data=(structlwip_setgetsockopt_data*)arg; + +data->err=lwip_getsockopt_impl(data->s,data->level,data->optname, +#ifLWIP_MPU_COMPATIBLE +data->optval, +#else/*LWIP_MPU_COMPATIBLE*/ +data->optval.p, +#endif/*LWIP_MPU_COMPATIBLE*/ +&data->optlen); + +sys_sem_signal((sys_sem_t*)(data->completed_sem)); +} +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +staticu8_t +lwip_getsockopt_impl(ints,intlevel,intoptname,void*optval,socklen_t*optlen) +{ +u8_terr=0; +structlwip_sock*sock=tryget_socket(s); +if(!sock){ +returnEBADF; +} + +switch(level){ + +/*Level:SOL_SOCKET*/ +caseSOL_SOCKET: +switch(optname){ + +#ifLWIP_TCP +caseSO_ACCEPTCONN: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,int); +if(NETCONNTYPE_GROUP(sock->conn->type)!=NETCONN_TCP){ +returnENOPROTOOPT; +} +if((sock->conn->pcb.tcp!=NULL)&&(sock->conn->pcb.tcp->state==LISTEN)){ +*(int*)optval=1; +}else{ +*(int*)optval=0; +} +break; +#endif/*LWIP_TCP*/ + +/*Theoptionflags*/ +caseSO_BROADCAST: +caseSO_KEEPALIVE: +#ifSO_REUSE +caseSO_REUSEADDR: +#endif/*SO_REUSE*/ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,int); +*(int*)optval=ip_get_option(sock->conn->pcb.ip,optname); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,SOL_SOCKET,optname=0x%x,..)=%s\n", +s,optname,(*(int*)optval?"on":"off"))); +break; + +caseSO_TYPE: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,*optlen,int); +switch(NETCONNTYPE_GROUP(netconn_type(sock->conn))){ +caseNETCONN_RAW: +*(int*)optval=SOCK_RAW; +break; +caseNETCONN_TCP: +*(int*)optval=SOCK_STREAM; +break; +caseNETCONN_UDP: +*(int*)optval=SOCK_DGRAM; +break; +default:/*unrecognizedsockettype*/ +*(int*)optval=netconn_type(sock->conn); +LWIP_DEBUGF(SOCKETS_DEBUG, +("lwip_getsockopt(%d,SOL_SOCKET,SO_TYPE):unrecognizedsockettype%d\n", +s,*(int*)optval)); +}/*switch(netconn_type(sock->conn))*/ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,SOL_SOCKET,SO_TYPE)=%d\n", +s,*(int*)optval)); +break; + +caseSO_ERROR: +LWIP_SOCKOPT_CHECK_OPTLEN(*optlen,int); +/*onlyoverwriteERR_OKortemporaryerrors*/ +if(((sock->err==0)||(sock->err==EINPROGRESS))&&(sock->conn!=NULL)){ +sock_set_errno(sock,err_to_errno(sock->conn->last_err)); +} +*(int*)optval=(sock->err==0xFF?(int)-1:(int)sock->err); +sock->err=0; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,SOL_SOCKET,SO_ERROR)=%d\n", +s,*(int*)optval)); +break; + +#ifLWIP_SO_SNDTIMEO +caseSO_SNDTIMEO: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,*optlen,LWIP_SO_SNDRCVTIMEO_OPTTYPE); +LWIP_SO_SNDRCVTIMEO_SET(optval,netconn_get_sendtimeout(sock->conn)); +break; +#endif/*LWIP_SO_SNDTIMEO*/ +#ifLWIP_SO_RCVTIMEO +caseSO_RCVTIMEO: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,*optlen,LWIP_SO_SNDRCVTIMEO_OPTTYPE); +LWIP_SO_SNDRCVTIMEO_SET(optval,netconn_get_recvtimeout(sock->conn)); +break; +#endif/*LWIP_SO_RCVTIMEO*/ +#ifLWIP_SO_RCVBUF +caseSO_RCVBUF: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,*optlen,int); +*(int*)optval=netconn_get_recvbufsize(sock->conn); +break; +#endif/*LWIP_SO_RCVBUF*/ +#ifLWIP_SO_LINGER +caseSO_LINGER: +{ +s16_tconn_linger; +structlinger*linger=(structlinger*)optval; +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,*optlen,structlinger); +conn_linger=sock->conn->linger; +if(conn_linger>=0){ +linger->l_onoff=1; +linger->l_linger=(int)conn_linger; +}else{ +linger->l_onoff=0; +linger->l_linger=0; +} +} +break; +#endif/*LWIP_SO_LINGER*/ +#ifLWIP_UDP +caseSO_NO_CHECK: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,*optlen,int,NETCONN_UDP); +#ifLWIP_UDPLITE +if((udp_flags(sock->conn->pcb.udp)&UDP_FLAGS_UDPLITE)!=0){ +/*thisflagisonlyavailableforUDP,notforUDPlite*/ +returnEAFNOSUPPORT; +} +#endif/*LWIP_UDPLITE*/ +*(int*)optval=(udp_flags(sock->conn->pcb.udp)&UDP_FLAGS_NOCHKSUM)?1:0; +break; +#endif/*LWIP_UDP*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,SOL_SOCKET,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; + +/*Level:IPPROTO_IP*/ +caseIPPROTO_IP: +switch(optname){ +caseIP_TTL: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,int); +*(int*)optval=sock->conn->pcb.ip->ttl; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IP,IP_TTL)=%d\n", +s,*(int*)optval)); +break; +caseIP_TOS: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,int); +*(int*)optval=sock->conn->pcb.ip->tos; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IP,IP_TOS)=%d\n", +s,*(int*)optval)); +break; +#ifLWIP_MULTICAST_TX_OPTIONS +caseIP_MULTICAST_TTL: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,u8_t); +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_UDP){ +returnENOPROTOOPT; +} +*(u8_t*)optval=udp_get_multicast_ttl(sock->conn->pcb.udp); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IP,IP_MULTICAST_TTL)=%d\n", +s,*(int*)optval)); +break; +caseIP_MULTICAST_IF: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,structin_addr); +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_UDP){ +returnENOPROTOOPT; +} +inet_addr_from_ip4addr((structin_addr*)optval,udp_get_multicast_netif_addr(sock->conn->pcb.udp)); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IP,IP_MULTICAST_IF)=0x%"X32_F"\n", +s,*(u32_t*)optval)); +break; +caseIP_MULTICAST_LOOP: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,u8_t); +if((sock->conn->pcb.udp->flags&UDP_FLAGS_MULTICAST_LOOP)!=0){ +*(u8_t*)optval=1; +}else{ +*(u8_t*)optval=0; +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IP,IP_MULTICAST_LOOP)=%d\n", +s,*(int*)optval)); +break; +#endif/*LWIP_MULTICAST_TX_OPTIONS*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IP,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; + +#ifLWIP_TCP +/*Level:IPPROTO_TCP*/ +caseIPPROTO_TCP: +/*Specialcase:allIPPROTO_TCPoptiontakeanint*/ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,*optlen,int,NETCONN_TCP); +if(sock->conn->pcb.tcp->state==LISTEN){ +returnEINVAL; +} +switch(optname){ +caseTCP_NODELAY: +*(int*)optval=tcp_nagle_disabled(sock->conn->pcb.tcp); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_TCP,TCP_NODELAY)=%s\n", +s,(*(int*)optval)?"on":"off")); +break; +caseTCP_KEEPALIVE: +*(int*)optval=(int)sock->conn->pcb.tcp->keep_idle; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_TCP,TCP_KEEPALIVE)=%d\n", +s,*(int*)optval)); +break; + +#ifLWIP_TCP_KEEPALIVE +caseTCP_KEEPIDLE: +*(int*)optval=(int)(sock->conn->pcb.tcp->keep_idle/1000); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_TCP,TCP_KEEPIDLE)=%d\n", +s,*(int*)optval)); +break; +caseTCP_KEEPINTVL: +*(int*)optval=(int)(sock->conn->pcb.tcp->keep_intvl/1000); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_TCP,TCP_KEEPINTVL)=%d\n", +s,*(int*)optval)); +break; +caseTCP_KEEPCNT: +*(int*)optval=(int)sock->conn->pcb.tcp->keep_cnt; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_TCP,TCP_KEEPCNT)=%d\n", +s,*(int*)optval)); +break; +#endif/*LWIP_TCP_KEEPALIVE*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_TCP,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +#endif/*LWIP_TCP*/ + +#ifLWIP_IPV6 +/*Level:IPPROTO_IPV6*/ +caseIPPROTO_IPV6: +switch(optname){ +caseIPV6_V6ONLY: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,*optlen,int); +*(int*)optval=(netconn_get_ipv6only(sock->conn)?1:0); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IPV6,IPV6_V6ONLY)=%d\n", +s,*(int*)optval)); +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_IPV6,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +#endif/*LWIP_IPV6*/ + +#ifLWIP_UDP&&LWIP_UDPLITE +/*Level:IPPROTO_UDPLITE*/ +caseIPPROTO_UDPLITE: +/*Specialcase:allIPPROTO_UDPLITEoptiontakeanint*/ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,*optlen,int); +/*IfthisisnoUDPlitesocket,ignoreanyoptions.*/ +if(!NETCONNTYPE_ISUDPLITE(netconn_type(sock->conn))){ +returnENOPROTOOPT; +} +switch(optname){ +caseUDPLITE_SEND_CSCOV: +*(int*)optval=sock->conn->pcb.udp->chksum_len_tx; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_UDPLITE,UDPLITE_SEND_CSCOV)=%d\n", +s,(*(int*)optval))); +break; +caseUDPLITE_RECV_CSCOV: +*(int*)optval=sock->conn->pcb.udp->chksum_len_rx; +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_UDPLITE,UDPLITE_RECV_CSCOV)=%d\n", +s,(*(int*)optval))); +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_UDPLITE,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +#endif/*LWIP_UDP*/ +/*Level:IPPROTO_RAW*/ +caseIPPROTO_RAW: +switch(optname){ +#ifLWIP_IPV6&&LWIP_RAW +caseIPV6_CHECKSUM: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,*optlen,int,NETCONN_RAW); +if(sock->conn->pcb.raw->chksum_reqd==0){ +*(int*)optval=-1; +}else{ +*(int*)optval=sock->conn->pcb.raw->chksum_offset; +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_RAW,IPV6_CHECKSUM)=%d\n", +s,(*(int*)optval))); +break; +#endif/*LWIP_IPV6&&LWIP_RAW*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,IPPROTO_RAW,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_getsockopt(%d,level=0x%x,UNIMPL:optname=0x%x,..)\n", +s,level,optname)); +err=ENOPROTOOPT; +break; +}/*switch(level)*/ + +returnerr; +} + +int +lwip_setsockopt(ints,intlevel,intoptname,constvoid*optval,socklen_toptlen) +{ +u8_terr=0; +structlwip_sock*sock=get_socket(s); +#if!LWIP_TCPIP_CORE_LOCKING +kprintf("%s:%i:%i",__FILE__,__LINE__,err); +LWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(data); +#endif/*!LWIP_TCPIP_CORE_LOCKING*/ + +if(!sock){ +return-1; +} + +if(NULL==optval){ +sock_set_errno(sock,EFAULT); +return-1; +} + +#ifLWIP_TCPIP_CORE_LOCKING +kprintf("%s:%i:%i",__FILE__,__LINE__,err); +/*core-lockingcanjustcallthe-implfunction*/ +LOCK_TCPIP_CORE(); +err=lwip_setsockopt_impl(s,level,optname,optval,optlen); +UNLOCK_TCPIP_CORE(); + +kprintf("%s:%i:%i",__FILE__,__LINE__,err); +#else/*LWIP_TCPIP_CORE_LOCKING*/ + +#ifLWIP_MPU_COMPATIBLE +kprintf("%s:%i:%i",__FILE__,__LINE__,err); +/*MPU_COMPATIBLEcopiestheoptvaldata,socheckformaxsizehere*/ +if(optlen>LWIP_SETGETSOCKOPT_MAXOPTLEN){ +sock_set_errno(sock,ENOBUFS); +kprintf("%s:%i:%i",__FILE__,__LINE__,err); +return-1; +} +kprintf("%s:%i:%i",__FILE__,__LINE__,err); +#endif/*LWIP_MPU_COMPATIBLE*/ + +LWIP_SETGETSOCKOPT_DATA_VAR_ALLOC(data,sock); +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).s=s; +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).level=level; +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optname=optname; +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optlen=optlen; +#ifLWIP_MPU_COMPATIBLE +MEMCPY(LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optval,optval,optlen); +#else/*LWIP_MPU_COMPATIBLE*/ +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).optval.pc=(constvoid*)optval; +#endif/*LWIP_MPU_COMPATIBLE*/ +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).err=0; +#ifLWIP_NETCONN_SEM_PER_THREAD +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).completed_sem=LWIP_NETCONN_THREAD_SEM_GET(); +#else +LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).completed_sem=&sock->conn->op_completed; +#endif +err=tcpip_callback(lwip_setsockopt_callback,&LWIP_SETGETSOCKOPT_DATA_VAR_REF(data)); +if(err!=ERR_OK){ +LWIP_SETGETSOCKOPT_DATA_VAR_FREE(data); +sock_set_errno(sock,err_to_errno(err)); +return-1; +} +sys_arch_sem_wait((sys_sem_t*)(LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).completed_sem),0); + +/*maybelwip_getsockopt_internalhaschangederr*/ +err=LWIP_SETGETSOCKOPT_DATA_VAR_REF(data).err; +LWIP_SETGETSOCKOPT_DATA_VAR_FREE(data); +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +kprintf("%s:%i:%i",__FILE__,__LINE__,err); + +sock_set_errno(sock,err); +returnerr?-1:0; +} + +#if!LWIP_TCPIP_CORE_LOCKING + +staticvoid +lwip_setsockopt_callback(void*arg) +{ +structlwip_setgetsockopt_data*data; +LWIP_ASSERT("arg!=NULL",arg!=NULL); +data=(structlwip_setgetsockopt_data*)arg; + +data->err=lwip_setsockopt_impl(data->s,data->level,data->optname, +#ifLWIP_MPU_COMPATIBLE +data->optval, +#else/*LWIP_MPU_COMPATIBLE*/ +data->optval.pc, +#endif/*LWIP_MPU_COMPATIBLE*/ +data->optlen); + +sys_sem_signal((sys_sem_t*)(data->completed_sem)); +} +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +staticu8_t +lwip_setsockopt_impl(ints,intlevel,intoptname,constvoid*optval,socklen_toptlen) +{ +u8_terr=0; +structlwip_sock*sock=tryget_socket(s); +if(!sock){ +returnEBADF; +} + +switch(level){ + +/*Level:SOL_SOCKET*/ +caseSOL_SOCKET: +switch(optname){ + +/*SO_ACCEPTCONNisget-only*/ + +/*Theoptionflags*/ +caseSO_BROADCAST: +caseSO_KEEPALIVE: +#ifSO_REUSE +caseSO_REUSEADDR: +#endif/*SO_REUSE*/ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,optlen,int); +if(*(constint*)optval){ +ip_set_option(sock->conn->pcb.ip,optname); +}else{ +ip_reset_option(sock->conn->pcb.ip,optname); +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,SOL_SOCKET,optname=0x%x,..)->%s\n", +s,optname,(*(constint*)optval?"on":"off"))); +break; + +/*SO_TYPEisget-only*/ +/*SO_ERRORisget-only*/ + +#ifLWIP_SO_SNDTIMEO +caseSO_SNDTIMEO: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,optlen,LWIP_SO_SNDRCVTIMEO_OPTTYPE); +netconn_set_sendtimeout(sock->conn,LWIP_SO_SNDRCVTIMEO_GET_MS(optval)); +break; +#endif/*LWIP_SO_SNDTIMEO*/ +#ifLWIP_SO_RCVTIMEO +caseSO_RCVTIMEO: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,optlen,LWIP_SO_SNDRCVTIMEO_OPTTYPE); +netconn_set_recvtimeout(sock->conn,(int)LWIP_SO_SNDRCVTIMEO_GET_MS(optval)); +break; +#endif/*LWIP_SO_RCVTIMEO*/ +#ifLWIP_SO_RCVBUF +caseSO_RCVBUF: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,optlen,int); +netconn_set_recvbufsize(sock->conn,*(constint*)optval); +break; +#endif/*LWIP_SO_RCVBUF*/ +#ifLWIP_SO_LINGER +caseSO_LINGER: +{ +conststructlinger*linger=(conststructlinger*)optval; +LWIP_SOCKOPT_CHECK_OPTLEN_CONN(sock,optlen,structlinger); +if(linger->l_onoff){ +intlingersec=linger->l_linger; +if(lingersec<0){ +returnEINVAL; +} +if(lingersec>0xFFFF){ +lingersec=0xFFFF; +} +sock->conn->linger=(s16_t)lingersec; +}else{ +sock->conn->linger=-1; +} +} +break; +#endif/*LWIP_SO_LINGER*/ +#ifLWIP_UDP +caseSO_NO_CHECK: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,int,NETCONN_UDP); +#ifLWIP_UDPLITE +if((udp_flags(sock->conn->pcb.udp)&UDP_FLAGS_UDPLITE)!=0){ +/*thisflagisonlyavailableforUDP,notforUDPlite*/ +returnEAFNOSUPPORT; +} +#endif/*LWIP_UDPLITE*/ +if(*(constint*)optval){ +udp_setflags(sock->conn->pcb.udp,udp_flags(sock->conn->pcb.udp)|UDP_FLAGS_NOCHKSUM); +}else{ +udp_setflags(sock->conn->pcb.udp,udp_flags(sock->conn->pcb.udp)&~UDP_FLAGS_NOCHKSUM); +} +break; +#endif/*LWIP_UDP*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,SOL_SOCKET,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; + +/*Level:IPPROTO_IP*/ +caseIPPROTO_IP: +switch(optname){ +caseIP_TTL: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,optlen,int); +sock->conn->pcb.ip->ttl=(u8_t)(*(constint*)optval); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_IP,IP_TTL,..)->%d\n", +s,sock->conn->pcb.ip->ttl)); +break; +caseIP_TOS: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,optlen,int); +sock->conn->pcb.ip->tos=(u8_t)(*(constint*)optval); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_IP,IP_TOS,..)->%d\n", +s,sock->conn->pcb.ip->tos)); +break; +#ifLWIP_MULTICAST_TX_OPTIONS +caseIP_MULTICAST_TTL: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,u8_t,NETCONN_UDP); +udp_set_multicast_ttl(sock->conn->pcb.udp,(u8_t)(*(constu8_t*)optval)); +break; +caseIP_MULTICAST_IF: +{ +ip4_addr_tif_addr; +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,structin_addr,NETCONN_UDP); +inet_addr_to_ip4addr(&if_addr,(conststructin_addr*)optval); +udp_set_multicast_netif_addr(sock->conn->pcb.udp,&if_addr); +} +break; +caseIP_MULTICAST_LOOP: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,u8_t,NETCONN_UDP); +if(*(constu8_t*)optval){ +udp_setflags(sock->conn->pcb.udp,udp_flags(sock->conn->pcb.udp)|UDP_FLAGS_MULTICAST_LOOP); +}else{ +udp_setflags(sock->conn->pcb.udp,udp_flags(sock->conn->pcb.udp)&~UDP_FLAGS_MULTICAST_LOOP); +} +break; +#endif/*LWIP_MULTICAST_TX_OPTIONS*/ +#ifLWIP_IGMP +caseIP_ADD_MEMBERSHIP: +caseIP_DROP_MEMBERSHIP: +{ +/*IfthisisaTCPoraRAWsocket,ignoretheseoptions.*/ +/*@todo:assignmembershiptothissocketsothatitisdroppedwhenclosingthesocket*/ +err_tigmp_err; +conststructip_mreq*imr=(conststructip_mreq*)optval; +ip4_addr_tif_addr; +ip4_addr_tmulti_addr; +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,structip_mreq,NETCONN_UDP); +inet_addr_to_ip4addr(&if_addr,&imr->imr_interface); +inet_addr_to_ip4addr(&multi_addr,&imr->imr_multiaddr); +if(optname==IP_ADD_MEMBERSHIP){ +if(!lwip_socket_register_membership(s,&if_addr,&multi_addr)){ +/*cannottrackmembership(outofmemory)*/ +err=ENOMEM; +igmp_err=ERR_OK; +}else{ +igmp_err=igmp_joingroup(&if_addr,&multi_addr); +} +}else{ +igmp_err=igmp_leavegroup(&if_addr,&multi_addr); +lwip_socket_unregister_membership(s,&if_addr,&multi_addr); +} +if(igmp_err!=ERR_OK){ +err=EADDRNOTAVAIL; +} +} +break; +#endif/*LWIP_IGMP*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_IP,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; + +#ifLWIP_TCP +/*Level:IPPROTO_TCP*/ +caseIPPROTO_TCP: +/*Specialcase:allIPPROTO_TCPoptiontakeanint*/ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,int,NETCONN_TCP); +if(sock->conn->pcb.tcp->state==LISTEN){ +returnEINVAL; +} +switch(optname){ +caseTCP_NODELAY: +if(*(constint*)optval){ +tcp_nagle_disable(sock->conn->pcb.tcp); +}else{ +tcp_nagle_enable(sock->conn->pcb.tcp); +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_TCP,TCP_NODELAY)->%s\n", +s,(*(constint*)optval)?"on":"off")); +break; +caseTCP_KEEPALIVE: +sock->conn->pcb.tcp->keep_idle=(u32_t)(*(constint*)optval); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_TCP,TCP_KEEPALIVE)->%"U32_F"\n", +s,sock->conn->pcb.tcp->keep_idle)); +break; + +#ifLWIP_TCP_KEEPALIVE +caseTCP_KEEPIDLE: +sock->conn->pcb.tcp->keep_idle=1000*(u32_t)(*(constint*)optval); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_TCP,TCP_KEEPIDLE)->%"U32_F"\n", +s,sock->conn->pcb.tcp->keep_idle)); +break; +caseTCP_KEEPINTVL: +sock->conn->pcb.tcp->keep_intvl=1000*(u32_t)(*(constint*)optval); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_TCP,TCP_KEEPINTVL)->%"U32_F"\n", +s,sock->conn->pcb.tcp->keep_intvl)); +break; +caseTCP_KEEPCNT: +sock->conn->pcb.tcp->keep_cnt=(u32_t)(*(constint*)optval); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_TCP,TCP_KEEPCNT)->%"U32_F"\n", +s,sock->conn->pcb.tcp->keep_cnt)); +break; +#endif/*LWIP_TCP_KEEPALIVE*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_TCP,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +#endif/*LWIP_TCP*/ + +#ifLWIP_IPV6 +/*Level:IPPROTO_IPV6*/ +caseIPPROTO_IPV6: +switch(optname){ +caseIPV6_V6ONLY: +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,int,NETCONN_TCP); +if(*(constint*)optval){ +netconn_set_ipv6only(sock->conn,1); +}else{ +netconn_set_ipv6only(sock->conn,0); +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_IPV6,IPV6_V6ONLY,..)->%d\n", +s,(netconn_get_ipv6only(sock->conn)?1:0))); +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_IPV6,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +#endif/*LWIP_IPV6*/ + +#ifLWIP_UDP&&LWIP_UDPLITE +/*Level:IPPROTO_UDPLITE*/ +caseIPPROTO_UDPLITE: +/*Specialcase:allIPPROTO_UDPLITEoptiontakeanint*/ +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock,optlen,int); +/*IfthisisnoUDPlitesocket,ignoreanyoptions.*/ +if(!NETCONNTYPE_ISUDPLITE(netconn_type(sock->conn))){ +returnENOPROTOOPT; +} +switch(optname){ +caseUDPLITE_SEND_CSCOV: +if((*(constint*)optval!=0)&&((*(constint*)optval<8)||(*(constint*)optval>0xffff))){ +/*don'tallowillegalvalues!*/ +sock->conn->pcb.udp->chksum_len_tx=8; +}else{ +sock->conn->pcb.udp->chksum_len_tx=(u16_t)*(constint*)optval; +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_UDPLITE,UDPLITE_SEND_CSCOV)->%d\n", +s,(*(constint*)optval))); +break; +caseUDPLITE_RECV_CSCOV: +if((*(constint*)optval!=0)&&((*(constint*)optval<8)||(*(constint*)optval>0xffff))){ +/*don'tallowillegalvalues!*/ +sock->conn->pcb.udp->chksum_len_rx=8; +}else{ +sock->conn->pcb.udp->chksum_len_rx=(u16_t)*(constint*)optval; +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_UDPLITE,UDPLITE_RECV_CSCOV)->%d\n", +s,(*(constint*)optval))); +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_UDPLITE,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +#endif/*LWIP_UDP*/ +/*Level:IPPROTO_RAW*/ +caseIPPROTO_RAW: +switch(optname){ +#ifLWIP_IPV6&&LWIP_RAW +caseIPV6_CHECKSUM: +/*ItshouldnotbepossibletodisablethechecksumgenerationwithICMPv6 +*asperRFC3542chapter3.1*/ +if(sock->conn->pcb.raw->protocol==IPPROTO_ICMPV6){ +returnEINVAL; +} + +LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock,optlen,int,NETCONN_RAW); +if(*(constint*)optval<0){ +sock->conn->pcb.raw->chksum_reqd=0; +}elseif(*(constint*)optval&1){ +/*PerRFC3542,oddoffsetsarenotallowed*/ +returnEINVAL; +}else{ +sock->conn->pcb.raw->chksum_reqd=1; +sock->conn->pcb.raw->chksum_offset=(u16_t)*(constint*)optval; +} +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_RAW,IPV6_CHECKSUM,..)->%d\n", +s,sock->conn->pcb.raw->chksum_reqd)); +break; +#endif/*LWIP_IPV6&&LWIP_RAW*/ +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,IPPROTO_RAW,UNIMPL:optname=0x%x,..)\n", +s,optname)); +err=ENOPROTOOPT; +break; +}/*switch(optname)*/ +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_setsockopt(%d,level=0x%x,UNIMPL:optname=0x%x,..)\n", +s,level,optname)); +err=ENOPROTOOPT; +break; +}/*switch(level)*/ + +returnerr; +} + +int +lwip_ioctl(ints,longcmd,void*argp) +{ +structlwip_sock*sock=get_socket(s); +u8_tval; +#ifLWIP_SO_RCVBUF +u16_tbuflen=0; +intrecv_avail; +#endif/*LWIP_SO_RCVBUF*/ + +if(!sock){ +return-1; +} + +switch(cmd){ +#ifLWIP_SO_RCVBUF||LWIP_FIONREAD_LINUXMODE +caseFIONREAD: +if(!argp){ +sock_set_errno(sock,EINVAL); +return-1; +} +#ifLWIP_FIONREAD_LINUXMODE +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_TCP){ +structpbuf*p; +if(sock->lastdata){ +p=((structnetbuf*)sock->lastdata)->p; +*((int*)argp)=p->tot_len-sock->lastoffset; +}else{ +structnetbuf*rxbuf; +err_terr; +if(sock->rcvevent<=0){ +*((int*)argp)=0; +}else{ +err=netconn_recv(sock->conn,&rxbuf); +if(err!=ERR_OK){ +*((int*)argp)=0; +}else{ +sock->lastdata=rxbuf; +sock->lastoffset=0; +*((int*)argp)=rxbuf->p->tot_len; +} +} +} +return0; +} +#endif/*LWIP_FIONREAD_LINUXMODE*/ + +#ifLWIP_SO_RCVBUF +/*wecomehereifeitherLWIP_FIONREAD_LINUXMODE==0orthisisaTCPsocket*/ +SYS_ARCH_GET(sock->conn->recv_avail,recv_avail); +if(recv_avail<0){ +recv_avail=0; +} +*((int*)argp)=recv_avail; + +/*Checkifthereisdataleftfromthelastrecvoperation./maq041215*/ +if(sock->lastdata){ +structpbuf*p=(structpbuf*)sock->lastdata; +if(NETCONNTYPE_GROUP(netconn_type(sock->conn))!=NETCONN_TCP){ +p=((structnetbuf*)p)->p; +} +buflen=p->tot_len; +buflen-=sock->lastoffset; + +*((int*)argp)+=buflen; +} + +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_ioctl(%d,FIONREAD,%p)=%"U16_F"\n",s,argp,*((u16_t*)argp))); +sock_set_errno(sock,0); +return0; +#else/*LWIP_SO_RCVBUF*/ +break; +#endif/*LWIP_SO_RCVBUF*/ +#endif/*LWIP_SO_RCVBUF||LWIP_FIONREAD_LINUXMODE*/ + +case(long)FIONBIO: +val=0; +if(argp&&*(u32_t*)argp){ +val=1; +} +netconn_set_nonblocking(sock->conn,val); +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_ioctl(%d,FIONBIO,%d)\n",s,val)); +sock_set_errno(sock,0); +return0; + +default: +break; +}/*switch(cmd)*/ +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_ioctl(%d,UNIMPL:0x%lx,%p)\n",s,cmd,argp)); +sock_set_errno(sock,ENOSYS);/*notyetimplemented*/ +return-1; +} + +int +lwip_fcntl(ints,intcmd,intval) +{ +structlwip_sock*sock=get_socket(s); +intret=-1; + +if(!sock){ +return-1; +} + +switch(cmd){ +caseF_GETFL: +ret=netconn_is_nonblocking(sock->conn)?O_NONBLOCK:0; +sock_set_errno(sock,0); +break; +caseF_SETFL: +if((val&~O_NONBLOCK)==0){ +/*onlyO_NONBLOCK,allotherbitsarezero*/ +netconn_set_nonblocking(sock->conn,val&O_NONBLOCK); +ret=0; +sock_set_errno(sock,0); +}else{ +sock_set_errno(sock,ENOSYS);/*notyetimplemented*/ +} +break; +default: +LWIP_DEBUGF(SOCKETS_DEBUG,("lwip_fcntl(%d,UNIMPL:%d,%d)\n",s,cmd,val)); +sock_set_errno(sock,ENOSYS);/*notyetimplemented*/ +break; +} +returnret; +} + +#ifLWIP_IGMP + +staticint +lwip_socket_register_membership(ints,constip4_addr_t*if_addr,constip4_addr_t*multi_addr) +{ +structlwip_sock*sock=get_socket(s); +inti; + +if(!sock){ +return0; +} + +for(i=0;i<LWIP_SOCKET_MAX_MEMBERSHIPS;i++){ +if(socket_ipv4_multicast_memberships[i].sock==NULL){ +socket_ipv4_multicast_memberships[i].sock=sock; +ip4_addr_copy(socket_ipv4_multicast_memberships[i].if_addr,*if_addr); +ip4_addr_copy(socket_ipv4_multicast_memberships[i].multi_addr,*multi_addr); +return1; +} +} +return0; +} + +staticvoid +lwip_socket_unregister_membership(ints,constip4_addr_t*if_addr,constip4_addr_t*multi_addr) +{ +structlwip_sock*sock=get_socket(s); +inti; + +if(!sock){ +return; +} + +for(i=0;i<LWIP_SOCKET_MAX_MEMBERSHIPS;i++){ +if((socket_ipv4_multicast_memberships[i].sock==sock)&& +ip4_addr_cmp(&socket_ipv4_multicast_memberships[i].if_addr,if_addr)&& +ip4_addr_cmp(&socket_ipv4_multicast_memberships[i].multi_addr,multi_addr)){ +socket_ipv4_multicast_memberships[i].sock=NULL; +ip4_addr_set_zero(&socket_ipv4_multicast_memberships[i].if_addr); +ip4_addr_set_zero(&socket_ipv4_multicast_memberships[i].multi_addr); +return; +} +} +} + +staticvoid +lwip_socket_drop_registered_memberships(ints) +{ +structlwip_sock*sock=get_socket(s); +inti; + +if(!sock){ +return; +} + +for(i=0;i<LWIP_SOCKET_MAX_MEMBERSHIPS;i++){ +if(socket_ipv4_multicast_memberships[i].sock==sock){ +ip_addr_tmulti_addr,if_addr; +ip_addr_copy_from_ip4(multi_addr,socket_ipv4_multicast_memberships[i].multi_addr); +ip_addr_copy_from_ip4(if_addr,socket_ipv4_multicast_memberships[i].if_addr); +socket_ipv4_multicast_memberships[i].sock=NULL; +ip4_addr_set_zero(&socket_ipv4_multicast_memberships[i].if_addr); +ip4_addr_set_zero(&socket_ipv4_multicast_memberships[i].multi_addr); + +netconn_join_leave_group(sock->conn,&multi_addr,&if_addr,NETCONN_LEAVE); +} +} +} +#endif/*LWIP_IGMP*/ +#endif/*LWIP_SOCKET*/ - + diff --git a/doc/xml/sockets_8h.xml b/doc/xml/sockets_8h.xml index b1f1a70..b703729 100644 --- a/doc/xml/sockets_8h.xml +++ b/doc/xml/sockets_8h.xml @@ -1,680 +1,743 @@ - - - + + + sockets.h - ubixos/types.h - src/sys/lib/net.c - src/sys/net/api/sockets.c + net/opt.h + C:/Dev/git/UbixOS/sys/lib/net.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/memp.c - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - in_addr - sockaddr - sockaddr_in - - - AF_INET - 2 - - - - - - - - - - INADDR_ANY - 0 - - - - - - - - - - INADDR_BROADCAST - 0xffffffff - - - - - - - - - - IPPROTO_TCP - 6 - - - - - - - - - - IPPROTO_UDP - 17 - - - - - - - - - - PF_INET - AF_INET - - - - - - - - - - SOCK_DGRAM - 2 - - - - - - - - lwip_socket - - - SOCK_STREAM - 1 - - - - - - - - lwip_socket - - - - - int - int lwip_accept - (int s, struct sockaddr *addr, int *addrlen) - lwip_accept - - int - s - - - struct sockaddr * - addr - - - int * - addrlen - - - - - - - - - ip_addr::addr - alloc_socket - lwip_socket::conn - get_socket - netconn_accept - netconn_delete - netconn_peer - NULL - - - int - int lwip_bind - (int s, struct sockaddr *name, int namelen) - lwip_bind - - int - s - - - struct sockaddr * - name - - - int - namelen - - - - - - - - - ip_addr::addr - lwip_socket::conn - ERR_OK - get_socket - name - netconn_bind - ntohs - NULL - - - int - int lwip_close - (int s) - lwip_close - - int - s - - - - - - - - - lwip_socket::conn - DEBUGF - get_socket - lwip_socket::lastdata - lwip_socket::lastoffset - netbuf_delete - netconn_delete - NULL - SOCKETS_DEBUG - - - int - int lwip_connect - (int s, struct sockaddr *name, int namelen) - lwip_connect - - int - s - - - struct sockaddr * - name - - - int - namelen - - - - - - - - - ip_addr::addr - lwip_socket::conn - ERR_OK - get_socket - name - netconn_connect - ntohs - NULL - - - int - int lwip_listen - (int s, int backlog) - lwip_listen - - int - s - - - int - backlog - - - - - - - - - lwip_socket::conn - ERR_OK - get_socket - netconn_listen - NULL - - - int - int lwip_read - (int s, void *mem, int len) - lwip_read - - int - s - - - void * - mem - - - int - len - - - - - - - - - lwip_recv - - - int - int lwip_recv - (int s, void *mem, int len, unsigned int flags) - lwip_recv - - int - s - - - void * - mem - - - int - len - - - unsigned int - flags - - - - - - - - - lwip_recvfrom - NULL - lwip_read - - - int - int lwip_recvfrom - (int s, void *mem, int len, unsigned int flags, struct sockaddr *from, int *fromlen) - lwip_recvfrom - - int - s - - - void * - mem - - - int - len - - - unsigned int - flags - - - struct sockaddr * - from - - - int * - fromlen - - - - - - - - - ip_addr::addr - lwip_socket::conn - get_socket - htons - lwip_socket::lastdata - lwip_socket::lastoffset - netbuf_copy_partial - netbuf_delete - netbuf_fromaddr - netbuf_fromport - netbuf_len - netconn_recv - NETCONN_TCP - netconn_type - NULL - lwip_recv - - - int - int lwip_send - (int s, void *dataptr, int size, unsigned int flags) - lwip_send - - int - s - - - void * - dataptr - - - int - size - - - unsigned int - flags - - - - - - - - - lwip_socket::conn - DEBUGF - netbuf::err - ERR_ARG - ERR_OK - get_socket - netbuf_delete - netbuf_new - netbuf_ref - NETCONN_COPY - netconn_send - NETCONN_TCP - netconn_type - NETCONN_UDP - netconn_write - NULL - SOCKETS_DEBUG - lwip_sendto - lwip_write - - - int - int lwip_sendto - (int s, void *dataptr, int size, unsigned int flags, struct sockaddr *to, int tolen) - lwip_sendto - - int - s - - - void * - dataptr - - - int - size - - - unsigned int - flags - - - struct sockaddr * - to - - - int - tolen - - - - - - - - - ip_addr::addr - lwip_socket::conn - get_socket - lwip_send - netconn_connect - netconn_peer - NULL - - - int - int lwip_socket - (int domain, int type, int protocol) - lwip_socket - - int - domain - - - int - type - - - int - protocol - - - - - - - - - alloc_socket - DEBUGF - netconn_delete - netconn_new - NETCONN_TCP - NETCONN_UDP - NULL - SOCK_DGRAM - SOCK_STREAM - SOCKETS_DEBUG - - - int - int lwip_write - (int s, void *dataptr, int size) - lwip_write - - int - s - - - void * - dataptr - - - int - size - - - - - - - - - lwip_socket::conn - DEBUGF - ERR_ARG - ERR_OK - get_socket - lwip_send - NETCONN_COPY - NETCONN_TCP - netconn_type - NETCONN_UDP - netconn_write - NULL - SOCKETS_DEBUG - - +Socket API (to be used from non-TCPIP threads) -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: sockets_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - - -#ifndef__LWIP_SOCKETS_H__ -#define__LWIP_SOCKETS_H__ - -#include<ubixos/types.h> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ + + +#ifndefLWIP_HDR_SOCKETS_H +#defineLWIP_HDR_SOCKETS_H -structin_addr{ -uInt32s_addr; -}; +#include<net/opt.h> + +#ifLWIP_SOCKET/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ - -structsockaddr_in{ -uInt8sin_len; -uInt8sin_family; -uInt16sin_port; -structin_addrsin_addr; -charsin_zero[8]; -}; +#include<net/ip_addr.h> +#include<net/err.h> +#include<net/inet.h> +#include<net/errno.h> + +#ifdef__cplusplus +extern"C"{ +#endif -structsockaddr{ -uInt8sa_len; -uInt8sa_family; -charsa_data[14]; -}; - -#defineSOCK_STREAM1 -#defineSOCK_DGRAM2 - -#defineAF_INET2 -#definePF_INETAF_INET - -#defineIPPROTO_TCP6 -#defineIPPROTO_UDP17 - -#defineINADDR_ANY0 -#defineINADDR_BROADCAST0xffffffff - -intlwip_accept(ints,structsockaddr*addr,int*addrlen); -intlwip_bind(ints,structsockaddr*name,intnamelen); -intlwip_close(ints); -intlwip_connect(ints,structsockaddr*name,intnamelen); -intlwip_listen(ints,intbacklog); -intlwip_recv(ints,void*mem,intlen,unsignedintflags); -intlwip_read(ints,void*mem,intlen); -intlwip_recvfrom(ints,void*mem,intlen,unsignedintflags, -structsockaddr*from,int*fromlen); -intlwip_send(ints,void*dataptr,intsize,unsignedintflags); -intlwip_sendto(ints,void*dataptr,intsize,unsignedintflags, -structsockaddr*to,inttolen); -intlwip_socket(intdomain,inttype,intprotocol); -intlwip_write(ints,void*dataptr,intsize); - -#ifdefLWIP_COMPAT_SOCKETS -#defineaccept(a,b,c)lwip_accept(a,b,c) -#definebind(a,b,c)lwip_bind(a,b,c) -#defineclose(s)lwip_close(s) -#defineconnect(a,b,c)lwip_connect(a,b,c) -#definelisten(a,b)lwip_listen(a,b) -#definerecv(a,b,c,d)lwip_recv(a,b,c,d) -#defineread(a,b,c)lwip_read(a,b,c) -#definerecvfrom(a,b,c,d,e,f)lwip_recvfrom(a,b,c,d,e,f) -#definesend(a,b,c,d)lwip_send(a,b,c,d) -#definesendto(a,b,c,d,e,f)lwip_sendto(a,b,c,d,e,f) -#definesocket(a,b,c)lwip_socket(a,b,c) -#definewrite(a,b,c)lwip_write(a,b,c) -#endif/*LWIP_NO_COMPAT_SOCKETS*/ - -#endif/*__LWIP_SOCKETS_H__*/ +/*Ifyourportalreadytypedef'ssa_family_t,defineSA_FAMILY_T_DEFINED +topreventthiscodefromredefiningit.*/ +#if!defined(sa_family_t)&&!defined(SA_FAMILY_T_DEFINED) +typedefu8_tsa_family_t; +#endif +/*Ifyourportalreadytypedef'sin_port_t,defineIN_PORT_T_DEFINED +topreventthiscodefromredefiningit.*/ +#if!defined(in_port_t)&&!defined(IN_PORT_T_DEFINED) +typedefu16_tin_port_t; +#endif + +#ifLWIP_IPV4 +/*membersareinnetworkbyteorder*/ +structsockaddr_in{ +u8_tsin_len; +sa_family_tsin_family; +in_port_tsin_port; +structin_addrsin_addr; +#defineSIN_ZERO_LEN8 +charsin_zero[SIN_ZERO_LEN]; +}; +#endif/*LWIP_IPV4*/ + +#ifLWIP_IPV6 +structsockaddr_in6{ +u8_tsin6_len;/*lengthofthisstructure*/ +sa_family_tsin6_family;/*AF_INET6*/ +in_port_tsin6_port;/*Transportlayerport#*/ +u32_tsin6_flowinfo;/*IPv6flowinformation*/ +structin6_addrsin6_addr;/*IPv6address*/ +u32_tsin6_scope_id;/*Setofinterfacesforscope*/ +}; +#endif/*LWIP_IPV6*/ + +structsockaddr{ +u8_tsa_len; +sa_family_tsa_family; +charsa_data[14]; +}; + +structsockaddr_storage{ +u8_ts2_len; +sa_family_tss_family; +chars2_data1[2]; +u32_ts2_data2[3]; +#ifLWIP_IPV6 +u32_ts2_data3[3]; +#endif/*LWIP_IPV6*/ +}; +/*Ifyourportalreadytypedef'ssocklen_t,defineSOCKLEN_T_DEFINED +topreventthiscodefromredefiningit.*/ +#if!defined(socklen_t)&&!defined(SOCKLEN_T_DEFINED) +typedefu32_tsocklen_t; +#endif + +structlwip_sock; + +#if!LWIP_TCPIP_CORE_LOCKING + +#defineLWIP_SETGETSOCKOPT_MAXOPTLEN16 + +structlwip_setgetsockopt_data{ +ints; +intlevel; +intoptname; +#ifLWIP_MPU_COMPATIBLE +u8_toptval[LWIP_SETGETSOCKOPT_MAXOPTLEN]; +#else +union{ +void*p; +constvoid*pc; +}optval; +#endif + +socklen_toptlen; +err_terr; +void*completed_sem; +}; +#endif/*!LWIP_TCPIP_CORE_LOCKING*/ + +#if!defined(iovec) +structiovec{ +void*iov_base; +size_tiov_len; +}; +#endif + +structmsghdr{ +void*msg_name; +socklen_tmsg_namelen; +structiovec*msg_iov; +intmsg_iovlen; +void*msg_control; +socklen_tmsg_controllen; +intmsg_flags; +}; + +/*Socketprotocoltypes(TCP/UDP/RAW)*/ +#defineSOCK_STREAM1 +#defineSOCK_DGRAM2 +#defineSOCK_RAW3 + +/* +*Optionflagsper-socket.ThesemustmatchtheSOF_flagsinip.h(checkedininit.c) +*/ +#defineSO_REUSEADDR0x0004/*Allowlocaladdressreuse*/ +#defineSO_KEEPALIVE0x0008/*keepconnectionsalive*/ +#defineSO_BROADCAST0x0020/*permittosendandtoreceivebroadcastmessages(seeIP_SOF_BROADCASToption)*/ + + +/* +*Additionaloptions,notkeptinso_options. +*/ +#defineSO_DEBUG0x0001/*Unimplemented:turnondebugginginforecording*/ +#defineSO_ACCEPTCONN0x0002/*sockethashadlisten()*/ +#defineSO_DONTROUTE0x0010/*Unimplemented:justuseinterfaceaddresses*/ +#defineSO_USELOOPBACK0x0040/*Unimplemented:bypasshardwarewhenpossible*/ +#defineSO_LINGER0x0080/*lingeroncloseifdatapresent*/ +#defineSO_DONTLINGER((int)(~SO_LINGER)) +#defineSO_OOBINLINE0x0100/*Unimplemented:leavereceivedOOBdatainline*/ +#defineSO_REUSEPORT0x0200/*Unimplemented:allowlocaladdress&portreuse*/ +#defineSO_SNDBUF0x1001/*Unimplemented:sendbuffersize*/ +#defineSO_RCVBUF0x1002/*receivebuffersize*/ +#defineSO_SNDLOWAT0x1003/*Unimplemented:sendlow-watermark*/ +#defineSO_RCVLOWAT0x1004/*Unimplemented:receivelow-watermark*/ +#defineSO_SNDTIMEO0x1005/*sendtimeout*/ +#defineSO_RCVTIMEO0x1006/*receivetimeout*/ +#defineSO_ERROR0x1007/*geterrorstatusandclear*/ +#defineSO_TYPE0x1008/*getsockettype*/ +#defineSO_CONTIMEO0x1009/*Unimplemented:connecttimeout*/ +#defineSO_NO_CHECK0x100a/*don'tcreateUDPchecksum*/ + + +/* +*Structureusedformanipulatinglingeroption. +*/ +structlinger{ +intl_onoff;/*optionon/off*/ +intl_linger;/*lingertimeinseconds*/ +}; + +/* +*Levelnumberfor(get/set)sockopt()toapplytosocketitself. +*/ +#defineSOL_SOCKET0xfff/*optionsforsocketlevel*/ + + +#defineAF_UNSPEC0 +#defineAF_INET2 +#ifLWIP_IPV6 +#defineAF_INET610 +#else/*LWIP_IPV6*/ +#defineAF_INET6AF_UNSPEC +#endif/*LWIP_IPV6*/ +#definePF_INETAF_INET +#definePF_INET6AF_INET6 +#definePF_UNSPECAF_UNSPEC + +#defineIPPROTO_IP0 +#defineIPPROTO_ICMP1 +#defineIPPROTO_TCP6 +#defineIPPROTO_UDP17 +#ifLWIP_IPV6 +#defineIPPROTO_IPV641 +#defineIPPROTO_ICMPV658 +#endif/*LWIP_IPV6*/ +#defineIPPROTO_UDPLITE136 +#defineIPPROTO_RAW255 + +/*Flagswecanusewithsendandrecv.*/ +#defineMSG_PEEK0x01/*Peeksatanincomingmessage*/ +#defineMSG_WAITALL0x02/*Unimplemented:Requeststhatthefunctionblockuntilthefullamountofdatarequestedcanbereturned*/ +#defineMSG_OOB0x04/*Unimplemented:Requestsout-of-banddata.Thesignificanceandsemanticsofout-of-banddataareprotocol-specific*/ +#defineMSG_DONTWAIT0x08/*Nonblockingi/oforthisoperationonly*/ +#defineMSG_MORE0x10/*Senderwillsendmore*/ + + +/* +*OptionsforlevelIPPROTO_IP +*/ +#defineIP_TOS1 +#defineIP_TTL2 + +#ifLWIP_TCP +/* +*OptionsforlevelIPPROTO_TCP +*/ +#defineTCP_NODELAY0x01/*don'tdelaysendtocoalescepackets*/ +#defineTCP_KEEPALIVE0x02/*sendKEEPALIVEprobeswhenidleforpcb->keep_idlemilliseconds*/ +#defineTCP_KEEPIDLE0x03/*setpcb->keep_idle-SameasTCP_KEEPALIVE,butusesecondsforget/setsockopt*/ +#defineTCP_KEEPINTVL0x04/*setpcb->keep_intvl-Usesecondsforget/setsockopt*/ +#defineTCP_KEEPCNT0x05/*setpcb->keep_cnt-Usenumberofprobessentforget/setsockopt*/ +#endif/*LWIP_TCP*/ + +#ifLWIP_IPV6 +/* +*OptionsforlevelIPPROTO_IPV6 +*/ +#defineIPV6_CHECKSUM7/*RFC3542:calculateandinserttheICMPv6checksumforrawsockets.*/ +#defineIPV6_V6ONLY27/*RFC3493:booleancontroltorestrictAF_INET6socketstoIPv6communicationsonly.*/ +#endif/*LWIP_IPV6*/ + +#ifLWIP_UDP&&LWIP_UDPLITE +/* +*OptionsforlevelIPPROTO_UDPLITE +*/ +#defineUDPLITE_SEND_CSCOV0x01/*senderchecksumcoverage*/ +#defineUDPLITE_RECV_CSCOV0x02/*minimalreceiverchecksumcoverage*/ +#endif/*LWIP_UDP&&LWIP_UDPLITE*/ + + +#ifLWIP_MULTICAST_TX_OPTIONS +/* +*OptionsandtypesforUDPmulticasttraffichandling +*/ +#defineIP_MULTICAST_TTL5 +#defineIP_MULTICAST_IF6 +#defineIP_MULTICAST_LOOP7 +#endif/*LWIP_MULTICAST_TX_OPTIONS*/ + +#ifLWIP_IGMP +/* +*Optionsandtypesrelatedtomulticastmembership +*/ +#defineIP_ADD_MEMBERSHIP3 +#defineIP_DROP_MEMBERSHIP4 + +typedefstructip_mreq{ +structin_addrimr_multiaddr;/*IPmulticastaddressofgroup*/ +structin_addrimr_interface;/*localIPaddressofinterface*/ +}ip_mreq; +#endif/*LWIP_IGMP*/ + +/* +*TheTypeofServiceprovidesanindicationoftheabstract +*parametersofthequalityofservicedesired.Theseparametersare +*tobeusedtoguidetheselectionoftheactualserviceparameters +*whentransmittingadatagramthroughaparticularnetwork.Several +*networksofferserviceprecedence,whichsomehowtreatshigh +*precedencetrafficasmoreimportantthanothertraffic(generally +*byacceptingonlytrafficaboveacertainprecedenceattimeofhigh +*load).Themajorchoiceisathreewaytradeoffbetweenlow-delay, +*high-reliability,andhigh-throughput. +*TheuseoftheDelay,Throughput,andReliabilityindicationsmay +*increasethecost(insomesense)oftheservice.Inmanynetworks +*betterperformanceforoneoftheseparametersiscoupledwithworse +*performanceonanother.Exceptforveryunusualcasesatmosttwo +*ofthesethreeindicationsshouldbeset. +*/ +#defineIPTOS_TOS_MASK0x1E +#defineIPTOS_TOS(tos)((tos)&IPTOS_TOS_MASK) +#defineIPTOS_LOWDELAY0x10 +#defineIPTOS_THROUGHPUT0x08 +#defineIPTOS_RELIABILITY0x04 +#defineIPTOS_LOWCOST0x02 +#defineIPTOS_MINCOSTIPTOS_LOWCOST + +/* +*TheNetworkControlprecedencedesignationisintendedtobeused +*withinanetworkonly.Theactualuseandcontrolofthat +*designationisuptoeachnetwork.TheInternetworkControl +*designationisintendedforusebygatewaycontroloriginatorsonly. +*Iftheactualuseoftheseprecedencedesignationsisofconcernto +*aparticularnetwork,itistheresponsibilityofthatnetworkto +*controltheaccessto,anduseof,thoseprecedencedesignations. +*/ +#defineIPTOS_PREC_MASK0xe0 +#defineIPTOS_PREC(tos)((tos)&IPTOS_PREC_MASK) +#defineIPTOS_PREC_NETCONTROL0xe0 +#defineIPTOS_PREC_INTERNETCONTROL0xc0 +#defineIPTOS_PREC_CRITIC_ECP0xa0 +#defineIPTOS_PREC_FLASHOVERRIDE0x80 +#defineIPTOS_PREC_FLASH0x60 +#defineIPTOS_PREC_IMMEDIATE0x40 +#defineIPTOS_PREC_PRIORITY0x20 +#defineIPTOS_PREC_ROUTINE0x00 + + +/* +*Commandsforioctlsocket(),takenfromtheBSDfilefcntl.h. +*lwip_ioctlonlysupportsFIONREADandFIONBIO,fornow +* +*Ioctl'shavethecommandencodedinthelowerword, +*andthesizeofanyinoroutparametersintheupper +*word.Thehigh2bitsoftheupperwordareused +*toencodethein/outstatusoftheparameter;fornow +*werestrictparameterstoatmost128bytes. +*/ +#if!defined(FIONREAD)||!defined(FIONBIO) +#defineIOCPARM_MASK0x7fU/*parametersmustbe<128bytes*/ +#defineIOC_VOID0x20000000UL/*noparameters*/ +#defineIOC_OUT0x40000000UL/*copyoutparameters*/ +#defineIOC_IN0x80000000UL/*copyinparameters*/ +#defineIOC_INOUT(IOC_IN|IOC_OUT) +/*0x20000000distinguishesnew& +oldioctl's*/ +#define_IO(x,y)(IOC_VOID|((x)<<8)|(y)) + +#define_IOR(x,y,t)(IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) + +#define_IOW(x,y,t)(IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) +#endif/*!defined(FIONREAD)||!defined(FIONBIO)*/ + +#ifndefFIONREAD +#defineFIONREAD_IOR('f',127,unsignedlong)/*get#bytestoread*/ +#endif +#ifndefFIONBIO +#defineFIONBIO_IOW('f',126,unsignedlong)/*set/clearnon-blockingi/o*/ +#endif + +/*SocketI/OControls:unimplemented*/ +#ifndefSIOCSHIWAT +#defineSIOCSHIWAT_IOW('s',0,unsignedlong)/*sethighwatermark*/ +#defineSIOCGHIWAT_IOR('s',1,unsignedlong)/*gethighwatermark*/ +#defineSIOCSLOWAT_IOW('s',2,unsignedlong)/*setlowwatermark*/ +#defineSIOCGLOWAT_IOR('s',3,unsignedlong)/*getlowwatermark*/ +#defineSIOCATMARK_IOR('s',7,unsignedlong)/*atoobmark?*/ +#endif + +/*commandsforfnctl*/ +#ifndefF_GETFL +#defineF_GETFL3 +#endif +#ifndefF_SETFL +#defineF_SETFL4 +#endif + +/*Filestatusflagsandfileaccessmodesforfnctl, +thesearebitsinanint.*/ +#ifndefO_NONBLOCK +#defineO_NONBLOCK1/*nonblockingI/O*/ +#endif +#ifndefO_NDELAY +#defineO_NDELAY1/*sameasO_NONBLOCK,forcompatibility*/ +#endif + +#ifndefSHUT_RD +#defineSHUT_RD0 +#defineSHUT_WR1 +#defineSHUT_RDWR2 +#endif + +/*FD_SETusedforlwip_select*/ +#ifndefFD_SET +#undefFD_SETSIZE +/*MakeFD_SETSIZEmatchNUM_SOCKETSinsocket.c*/ +#defineFD_SETSIZEMEMP_NUM_NETCONN +#defineFDSETSAFESET(n,code)do{\ +if(((n)-LWIP_SOCKET_OFFSET<MEMP_NUM_NETCONN)&&(((int)(n)-LWIP_SOCKET_OFFSET)>=0)){\ +code;}}while(0) +#defineFDSETSAFEGET(n,code)(((n)-LWIP_SOCKET_OFFSET<MEMP_NUM_NETCONN)&&(((int)(n)-LWIP_SOCKET_OFFSET)>=0)?\ +(code):0) +#defineFD_SET(n,p)FDSETSAFESET(n,(p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8]|=(1<<(((n)-LWIP_SOCKET_OFFSET)&7))) +#defineFD_CLR(n,p)FDSETSAFESET(n,(p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8]&=~(1<<(((n)-LWIP_SOCKET_OFFSET)&7))) +#defineFD_ISSET(n,p)FDSETSAFEGET(n,(p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8]&(1<<(((n)-LWIP_SOCKET_OFFSET)&7))) +#defineFD_ZERO(p)memset((void*)(p),0,sizeof(*(p))) + +typedefstructfd_set +{ +unsignedcharfd_bits[(FD_SETSIZE+7)/8]; +}fd_set; + +#elifLWIP_SOCKET_OFFSET +#errorLWIP_SOCKET_OFFSETdoesnotworkwithexternalFD_SET! +#elifFD_SETSIZE<MEMP_NUM_NETCONN +#error"externalFD_SETSIZEtoosmallfornumberofsockets" +#endif/*FD_SET*/ + +#ifndefLWIP_TIMEVAL_PRIVATE +#defineLWIP_TIMEVAL_PRIVATE1 +#endif + +#ifLWIP_TIMEVAL_PRIVATE +structtimeval{ +longtv_sec;/*seconds*/ +longtv_usec;/*andmicroseconds*/ +}; +#endif/*LWIP_TIMEVAL_PRIVATE*/ + +#definelwip_socket_init()/*Compatibilitydefine,noinitneeded.*/ +voidlwip_socket_thread_init(void);/*LWIP_NETCONN_SEM_PER_THREAD==1:initializethread-localsemaphore*/ +voidlwip_socket_thread_cleanup(void);/*LWIP_NETCONN_SEM_PER_THREAD==1:destroythread-localsemaphore*/ + +#ifLWIP_COMPAT_SOCKETS==2 +/*Thishelpscodeparsers/codecompletionbynothavingtheCOMPATfunctionsasdefines*/ +#definelwip_acceptaccept +#definelwip_bindbind +#definelwip_shutdownshutdown +#definelwip_getpeernamegetpeername +#definelwip_getsocknamegetsockname +#definelwip_setsockoptsetsockopt +#definelwip_getsockoptgetsockopt +#definelwip_closeclosesocket +#definelwip_connectconnect +#definelwip_listenlisten +#definelwip_recvrecv +#definelwip_recvfromrecvfrom +#definelwip_sendsend +#definelwip_sendmsgsendmsg +#definelwip_sendtosendto +#definelwip_socketsocket +#definelwip_selectselect +#definelwip_ioctlsocketioctl + +#ifLWIP_POSIX_SOCKETS_IO_NAMES +#definelwip_readread +#definelwip_writewrite +#definelwip_writevwritev +#undeflwip_close +#definelwip_closeclose +#defineclosesocket(s)close(s) +#definelwip_fcntlfcntl +#definelwip_ioctlioctl +#endif/*LWIP_POSIX_SOCKETS_IO_NAMES*/ +#endif/*LWIP_COMPAT_SOCKETS==2*/ + +intlwip_accept(ints,structsockaddr*addr,socklen_t*addrlen); +intlwip_bind(ints,conststructsockaddr*name,socklen_tnamelen); +intlwip_shutdown(ints,inthow); +intlwip_getpeername(ints,structsockaddr*name,socklen_t*namelen); +intlwip_getsockname(ints,structsockaddr*name,socklen_t*namelen); +intlwip_getsockopt(ints,intlevel,intoptname,void*optval,socklen_t*optlen); +intlwip_setsockopt(ints,intlevel,intoptname,constvoid*optval,socklen_toptlen); +intlwip_close(ints); +intlwip_connect(ints,conststructsockaddr*name,socklen_tnamelen); +intlwip_listen(ints,intbacklog); +intlwip_recv(ints,void*mem,size_tlen,intflags); +intlwip_read(ints,void*mem,size_tlen); +intlwip_recvfrom(ints,void*mem,size_tlen,intflags, +structsockaddr*from,socklen_t*fromlen); +intlwip_send(ints,constvoid*dataptr,size_tsize,intflags); +intlwip_sendmsg(ints,conststructmsghdr*message,intflags); +intlwip_sendto(ints,constvoid*dataptr,size_tsize,intflags, +conststructsockaddr*to,socklen_ttolen); +intlwip_socket(intdomain,inttype,intprotocol); +intlwip_write(ints,constvoid*dataptr,size_tsize); +intlwip_writev(ints,conststructiovec*iov,intiovcnt); +intlwip_select(intmaxfdp1,fd_set*readset,fd_set*writeset,fd_set*exceptset,structtimeval*timeout); +intlwip_ioctl(ints,longcmd,void*argp); +intlwip_fcntl(ints,intcmd,intval); + +#ifLWIP_COMPAT_SOCKETS +#ifLWIP_COMPAT_SOCKETS!=2 + +#defineaccept(s,addr,addrlen)lwip_accept(s,addr,addrlen) + +#definebind(s,name,namelen)lwip_bind(s,name,namelen) + +#defineshutdown(s,how)lwip_shutdown(s,how) + +#definegetpeername(s,name,namelen)lwip_getpeername(s,name,namelen) + +#definegetsockname(s,name,namelen)lwip_getsockname(s,name,namelen) + +#definesetsockopt(s,level,optname,opval,optlen)lwip_setsockopt(s,level,optname,opval,optlen) + +#definegetsockopt(s,level,optname,opval,optlen)lwip_getsockopt(s,level,optname,opval,optlen) + +#defineclosesocket(s)lwip_close(s) + +#defineconnect(s,name,namelen)lwip_connect(s,name,namelen) + +#definelisten(s,backlog)lwip_listen(s,backlog) + +#definerecv(s,mem,len,flags)lwip_recv(s,mem,len,flags) + +#definerecvfrom(s,mem,len,flags,from,fromlen)lwip_recvfrom(s,mem,len,flags,from,fromlen) + +#definesend(s,dataptr,size,flags)lwip_send(s,dataptr,size,flags) + +#definesendmsg(s,message,flags)lwip_sendmsg(s,message,flags) + +#definesendto(s,dataptr,size,flags,to,tolen)lwip_sendto(s,dataptr,size,flags,to,tolen) + +#definesocket(domain,type,protocol)lwip_socket(domain,type,protocol) + +#defineselect(maxfdp1,readset,writeset,exceptset,timeout)lwip_select(maxfdp1,readset,writeset,exceptset,timeout) + +#defineioctlsocket(s,cmd,argp)lwip_ioctl(s,cmd,argp) + +#ifLWIP_POSIX_SOCKETS_IO_NAMES + +#defineread(s,mem,len)lwip_read(s,mem,len) + +#definewrite(s,dataptr,len)lwip_write(s,dataptr,len) + +#definewritev(s,iov,iovcnt)lwip_writev(s,iov,iovcnt) + +#defineclose(s)lwip_close(s) + +#definefcntl(s,cmd,val)lwip_fcntl(s,cmd,val) + +#defineioctl(s,cmd,argp)lwip_ioctl(s,cmd,argp) +#endif/*LWIP_POSIX_SOCKETS_IO_NAMES*/ +#endif/*LWIP_COMPAT_SOCKETS!=2*/ + +#ifLWIP_IPV4&&LWIP_IPV6 + +#defineinet_ntop(af,src,dst,size)\ +(((af)==AF_INET6)?ip6addr_ntoa_r((constip6_addr_t*)(src),(dst),(size))\ +:(((af)==AF_INET)?ip4addr_ntoa_r((constip4_addr_t*)(src),(dst),(size)):NULL)) + +#defineinet_pton(af,src,dst)\ +(((af)==AF_INET6)?ip6addr_aton((src),(ip6_addr_t*)(dst))\ +:(((af)==AF_INET)?ip4addr_aton((src),(ip4_addr_t*)(dst)):0)) +#elifLWIP_IPV4/*LWIP_IPV4&&LWIP_IPV6*/ +#defineinet_ntop(af,src,dst,size)\ +(((af)==AF_INET)?ip4addr_ntoa_r((constip4_addr_t*)(src),(dst),(size)):NULL) +#defineinet_pton(af,src,dst)\ +(((af)==AF_INET)?ip4addr_aton((src),(ip4_addr_t*)(dst)):0) +#else/*LWIP_IPV4&&LWIP_IPV6*/ +#defineinet_ntop(af,src,dst,size)\ +(((af)==AF_INET6)?ip6addr_ntoa_r((constip6_addr_t*)(src),(dst),(size)):NULL) +#defineinet_pton(af,src,dst)\ +(((af)==AF_INET6)?ip6addr_aton((src),(ip6_addr_t*)(dst)):0) +#endif/*LWIP_IPV4&&LWIP_IPV6*/ + +#endif/*LWIP_COMPAT_SOCKETS*/ + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_SOCKET*/ + +#endif/*LWIP_HDR_SOCKETS_H*/ - + diff --git a/doc/xml/spinlock_8h.xml b/doc/xml/spinlock_8h.xml index ee7729b..b26d406 100644 --- a/doc/xml/spinlock_8h.xml +++ b/doc/xml/spinlock_8h.xml @@ -1,196 +1,441 @@ - - - + + + spinlock.h - ubixos/types.h - src/sys/devfs/devfs.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/isa/ne2k.c - src/sys/kernel/sched.c - src/sys/kernel/smp.c - src/sys/kernel/spinlock.c - src/sys/kernel/syscall_new.c - src/sys/kernel/tty.c - src/sys/kernel/ubthread.c - src/sys/kmods/kmod.c - src/sys/lib/kmalloc.c - src/sys/mpi/system.c - src/sys/sys/device.c - src/sys/sys/video.c - src/sys/ubixfs/dirCache.c - src/sys/vfs/file.c - src/sys/vmm/copyvirtualspace.c - src/sys/vmm/getfreepage.c - src/sys/vmm/getfreevirtualpage.c - src/sys/vmm/pagefault.c - src/sys/vmm/paging.c - src/sys/vmm/vmm_memory.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/spinlock.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/spinlock.c + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/include/ubixos/vitals.h + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/smp.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/mpi/system.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/sys/device.c + C:/Dev/git/UbixOS/sys/sys/video.c + C:/Dev/git/UbixOS/sys/vmm/copyvirtualspace.c + C:/Dev/git/UbixOS/sys/vmm/getfreepage.c + C:/Dev/git/UbixOS/sys/vmm/getfreevirtualpage.c + C:/Dev/git/UbixOS/sys/vmm/pagefault.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_allocpagetable.c + C:/Dev/git/UbixOS/sys/vmm/vmm_init.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/vmm/vmm_mmap.c - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + spinLock - + + LLOCK_FLAG + 1 + + + + + + + + + + LOCKED + 1 + + + + + + + + + SPIN_LOCK_INITIALIZER + {NULL, 0} + + + + + + + + + + UNLOCKED 0 @@ -198,14 +443,13 @@ - - spinLockInit + - - int - typedef volatile int spinLock_t + + struct spinLock * + typedef struct spinLock* spinLock_t spinLock_t @@ -214,191 +458,13 @@ - - - - - - void - void spinLock - (spinLock_t *) - spinLock - - spinLock_t * - - - - - - - - - sched_yield - spinTryLock - adjustCowCounter - cpuInfo - devfs_makeNode - devfs_open - device_add - device_find - device_remove - fclose - fdcRead - fopen - freePage - getEmptyDesc - kernel_function - kfree - kmalloc - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_postMessage - mpi_spam - ne2kAllocBuffer - schedNewTask - smpInit - tty_print - ubixfs_cacheAdd - ubixfs_cacheFind - vmm_getFreeMallocPage - vmm_pageFault - vmm_remapPage - vmmCopyVirtualSpace - vmmFindFreePage - vmmFreeProcessPages - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage - - - void - void spinLock_scheduler - (spinLock_t *) - spinLock_scheduler - - spinLock_t * - - - - - - - - - spinTryLock - - - void - void spinLockInit - (spinLock_t *) - spinLockInit - - spinLock_t * - - - - - - - - - SPIN_LOCK_INITIALIZER - - - int - int spinLockLocked - (spinLock_t *) - spinLockLocked - - spinLock_t * - - - - - - - - - c_ap_boot - - - int - int spinTryLock - (spinLock_t *) - spinTryLock - - spinLock_t * - - - - - - - - - keyboardHandler - sched - spinLock - spinLock_scheduler - - - void - void spinUnlock - (spinLock_t *) - spinUnlock - - spinLock_t * - - - - - - - - - adjustCowCounter - cpuInfo - devfs_makeNode - devfs_open - device_add - device_find - device_remove - fclose - fdcRead - fopen - freePage - getEmptyDesc - kernel_function - keyboardHandler - kfree - kmalloc - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_postMessage - mpi_spam - ne2kAllocBuffer - schedNewTask - smpInit - tty_print - ubixfs_cacheAdd - ubixfs_cacheFind - vmm_getFreeMallocPage - vmm_pageFault - vmm_remapPage - vmmCopyVirtualSpace - vmmFindFreePage - vmmFreeProcessPages - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage + - - spinLock_t - spinLock_t Master + + struct spinLock + struct spinLock Master Master @@ -407,7 +473,199 @@ - + + + + + + char + static char atomic_bitsetandtest + (void *ptr, int x) + atomic_bitsetandtest + + void * + ptr + + + int + x + + + + + + + + + + + void + void spinLock + (spinLock_t) + spinLock + + spinLock_t + + + + + + + + + + + void + void spinLock_scheduler + (spinLock_t *) + spinLock_scheduler + + spinLock_t * + + + + + + + + + spinTryLock + + + void + void spinLockInit + (spinLock_t) + spinLockInit + + spinLock_t + + + + + + + + + memset + + + int + int spinLockLocked + (spinLock_t *) + spinLockLocked + + spinLock_t * + + + + + + + + + c_ap_boot + + + int + int spinTryLock + (spinLock_t) + spinTryLock + + spinLock_t + + + + + + + + + cmpxchg + LLOCK_FLAG + LOCKED + spinLock::locked + NULL + + + void + void spinUnlock + (spinLock_t) + spinUnlock + + spinLock_t + + + + + + + + + barrier + spinLock::locked + + + unsigned short + static unsigned short xchg_16 + (volatile uint32_t *ptr, uint16_t x) + xchg_16 + + volatile uint32_t * + ptr + + + uint16_t + x + + + + + + + + + + + unsigned + static unsigned xchg_32 + (volatile uint32_t *ptr, uint32_t x) + xchg_32 + + volatile uint32_t * + ptr + + + uint32_t + x + + + + + + + + + + + u_long + static u_long xchg_64 + (volatile uint32_t *ptr, u_long x) + xchg_64 + + volatile uint32_t * + ptr + + + u_long + x + + + + + + + + @@ -415,62 +673,103 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: spinlock_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SPINLOCK_H -#define_SPINLOCK_H - -#include<ubixos/types.h> - -#defineSPIN_LOCK_INITIALIZER0 - -typedefvolatileintspinLock_t; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_SPINLOCK_H +#define_UBIXOS_SPINLOCK_H + +#include<sys/types.h> + +#defineLOCKED1 +#defineUNLOCKED0 +#defineSPIN_LOCK_INITIALIZER{NULL,0} +#defineLLOCK_FLAG1 -externspinLock_tMaster; +//typedefvolatileintspinLock_t; -voidspinLockInit(spinLock_t*); -voidspinUnlock(spinLock_t*); -intspinTryLock(spinLock_t*); -voidspinLock(spinLock_t*); +structspinLock{ +structspinLock*next; +uint32_tlocked; +}; -voidspinLock_scheduler(spinLock_t*);/*Onlyusethisspinlockinthesched.*/ +typedefstructspinLock*spinLock_t; -intspinLockLocked(spinLock_t*); +externstructspinLockMaster; -#endif - -/*** -END -***/ - +voidspinLockInit(spinLock_t); +voidspinUnlock(spinLock_t); +intspinTryLock(spinLock_t); +voidspinLock(spinLock_t); + +voidspinLock_scheduler(spinLock_t*);/*Onlyusethisspinlockinthesched.*/ + +intspinLockLocked(spinLock_t*); + +/*Atomicexchange(ofvarioussizes)*/ +staticinlineu_longxchg_64(volatileuint32_t*ptr,u_longx){ +__asm____volatile__("xchgq%1,%0" +:"+r"(x), +"+m"(*ptr)); + +returnx; +} + +staticinlineunsignedxchg_32(volatileuint32_t*ptr,uint32_tx){ +__asm____volatile__("xchgl%1,%0" +:"+r"(x), +"+m"(*ptr)); + +returnx; +} + +staticinlineunsignedshortxchg_16(volatileuint32_t*ptr,uint16_tx){ +__asm____volatile__("xchgw%1,%0" +:"+r"(x), +"+m"(*ptr)); + +returnx; +} + +/*Testandsetabit*/ +staticinlinecharatomic_bitsetandtest(void*ptr,intx){ +charout; +__asm____volatile__("lock;bts%2,%1\n" +"sbb%0,%0\n" +:"=r"(out),"=m"(*(volatilelonglong*)ptr) +:"Ir"(x) +:"memory"); + +returnout; +} + +#endif - + diff --git a/doc/xml/sqrt_8c.xml b/doc/xml/sqrt_8c.xml index f759bb5..9ffc789 100644 --- a/doc/xml/sqrt_8c.xml +++ b/doc/xml/sqrt_8c.xml @@ -1,9 +1,9 @@ - - - + + + sqrt.c - + double double sqrt (double x) @@ -18,7 +18,7 @@ - + @@ -26,66 +26,62 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sqrt_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -doublesqrt(doublex){ -return(x);/*QuickHack*/ -} - -/*** -$Log: sqrt_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:13reddawg -nomessage - -Revision1.22004/05/1903:46:32reddawg -AFewQuickHacksToMakeThingsWork - -Revision1.1.1.12004/04/1512:07:11reddawg -UbixOSv1.0 - -Revision1.22004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +doublesqrt(doublex){ +return(x);/*QuickHack*/ +} + +/*** +$Log:sqrt.c,v$ +Revision1.1.1.12006/06/0112:46:16reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:13reddawg +nomessage + +Revision1.22004/05/1903:46:32reddawg +AFewQuickHacksToMakeThingsWork + +Revision1.1.1.12004/04/1512:07:11reddawg +UbixOSv1.0 + +Revision1.22004/04/1316:36:33reddawg +Changedourcopyright,itisallnowunderaBSD-Stylelicense + +END +***/ + - + diff --git a/doc/xml/static_8c.xml b/doc/xml/static_8c.xml index 1457be1..764756d 100644 --- a/doc/xml/static_8c.xml +++ b/doc/xml/static_8c.xml @@ -1,34 +1,9 @@ - - - + + + static.c - lib/kprintf.h - - - - - - - - - - - - - - - - - - - - - - - - - + int int static_constructors (void) @@ -37,12 +12,12 @@ void -Sets up the ctors. + - + @@ -50,56 +25,53 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: static_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<lib/kprintf.h> - -intstatic_constructors(void){ -externvoid(*__ctor_list)(); -void(**l_ctor)()=&__ctor_list; -intl_ctorCount=*(int*)l_ctor; - -//kprintf("Callingstaticconstructors\n"); -l_ctor++; -while(l_ctorCount){ -(*l_ctor)(); -l_ctorCount--; -l_ctor++; -} -return(0x0); -} - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +//XXXSetupthectors +intstatic_constructors(void){ +externvoid(*__ctor_list)(); + +void(**l_ctor)()=&__ctor_list; + +intl_ctorCount=*(int*)l_ctor; + +l_ctor++; + +while(l_ctorCount){ +(*l_ctor)(); +l_ctorCount--; +l_ctor++; +} + +return(0x0); +} - + diff --git a/doc/xml/static_8h.xml b/doc/xml/static_8h.xml index 89f327d..a7be21f 100644 --- a/doc/xml/static_8h.xml +++ b/doc/xml/static_8h.xml @@ -1,28 +1,28 @@ - - - + + + static.h - src/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h - - + + - - - - + + + + - - - - + + + + - + int int static_constructors (void) @@ -31,12 +31,12 @@ void -Sets up the ctors. + - + @@ -44,13 +44,41 @@ -#ifndef_UBIXOS_STATIC_H -#define_UBIXOS_STATIC_H - -intstatic_constructors(void); - -#endif +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_STATIC_H +#define_UBIXOS_STATIC_H + +intstatic_constructors(void); + +#endif - + diff --git a/doc/xml/stats_8h.xml b/doc/xml/stats_8h.xml index 77f0b6f..3625d50 100644 --- a/doc/xml/stats_8h.xml +++ b/doc/xml/stats_8h.xml @@ -1,225 +1,1707 @@ - - - + + + stats.h - net/opt.h - net/arch/cc.h - net/memp.h - src/sys/net/net/bot.c - src/sys/net/net/shell.c - src/sys/net/net/sys_arch.c + net/opt.h + net/mem.h + net/memp.h + C:/Dev/git/UbixOS/sys/include/net/memp.h + C:/Dev/git/UbixOS/sys/include/net/netif.h + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c + C:/Dev/git/UbixOS/sys/net/core/mem.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c - - - - + + + + + + + + + + + + + + + + - - - + - - - - + + + + + + + + + + + + - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - + - + + + + + + + + + + + + + - + + + - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - + - + + + - - - + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - void - void stats_init - (void) - stats_init - - void - + + + ETHARP_STATS_DISPLAY + - + + + + ETHARP_STATS_INC + x + + + + + + + + + + ICMP6_STATS_DISPLAY + + + + + + + + + + + ICMP6_STATS_INC + x + + + + + + + + + + ICMP_STATS_DISPLAY + + + + + + + + + + + ICMP_STATS_INC + x + + + + + + + + + + IGMP_STATS_DISPLAY + + + + + + + + + + + IGMP_STATS_INC + x + + + + + + + + + + IP6_FRAG_STATS_DISPLAY + + + + + + + + + + + IP6_FRAG_STATS_INC + x + + + + + + + + + + IP6_STATS_DISPLAY + + + + + + + + + + + IP6_STATS_INC + x + + + + + + + + + + IP_STATS_DISPLAY + + + + + + + + + + + IP_STATS_INC + x + + + + + + + + + + IPFRAG_STATS_DISPLAY + + + + + + + + + + + IPFRAG_STATS_INC + x + + + + + + + + + + LINK_STATS_DISPLAY + + + + + + + + + + + LINK_STATS_INC + x + + + + + + + + + + MEM_STATS_AVAIL + x + y + + + + + + + + + + MEM_STATS_DEC_USED + x + y + + + + + + + + + + MEM_STATS_DISPLAY + + + + + + + + + + + MEM_STATS_INC + x + + + + + + + + + + MEM_STATS_INC_USED + x + y + + + + + + + + + + MEMP_STATS_DEC + x + i + + + + + + + + + + MEMP_STATS_DISPLAY + i + + + + + + + + + + MEMP_STATS_GET + x + i + 0 + + + + + + + + + + MIB2_STATS_INC + x + + + + + + + + + + MLD6_STATS_DISPLAY + + + + + + + + + + + MLD6_STATS_INC + x + + + + + + + + + + ND6_STATS_DISPLAY + + + + + + + + + + + ND6_STATS_INC + x + + + + + + + + + + STATS_DEC + x + + + + + + + + + + stats_display + + + + + + + + + + + stats_display_igmp + igmp + name + + + + + + + + + + stats_display_mem + mem + name + + + + + + + + + + stats_display_memp + mem + index + + + + + + + + + + stats_display_proto + proto + name + + + + + + + + + + stats_display_sys + sys + + + + + + + + + + STATS_INC + x + + + + + + + + + + STATS_INC_USED + x + + + + + + + + + + stats_init + + + + + + + + + + + SYS_STATS_DEC + x + + + + + + + + + + SYS_STATS_DISPLAY + + + + + + + + + + + SYS_STATS_INC + x + + + + + + + + + + SYS_STATS_INC_USED + x + + + + + + + + + + TCP_STATS_DISPLAY + + + + + + + + + + + TCP_STATS_INC + x + + + + + + + + + + UDP_STATS_DISPLAY + + + + + + + + + + + UDP_STATS_INC + x + + + + + + + +Statistics API (to be used from TCPIP thread) -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: stats_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_STATS_H__ -#define__LWIP_STATS_H__ - -#include"net/opt.h" -#include"net/arch/cc.h" - -#include"net/memp.h" - -#ifdefSTATS - -structstats_proto{ -uInt16xmit;/*Transmittedpackets.*/ -uInt16rexmit;/*Retransmittedpackets.*/ -uInt16recv;/*Receivedpackets.*/ -uInt16fw;/*Forwardedpackets.*/ -uInt16drop;/*Droppedpackets.*/ -uInt16chkerr;/*Checksumerror.*/ -uInt16lenerr;/*Invalidlengtherror.*/ -uInt16memerr;/*Outofmemoryerror.*/ -uInt16rterr;/*Routingerror.*/ -uInt16proterr;/*Protocolerror.*/ -uInt16opterr;/*Errorinoptions.*/ -uInt16err;/*Miscerror.*/ -uInt16cachehit; -}; - -structstats_mem{ -uInt16avail; -uInt16used; -uInt16max; -uInt16err; -uInt16reclaimed; -}; - -structstats_pbuf{ -uInt16avail; -uInt16used; -uInt16max; -uInt16err; -uInt16reclaimed; - -uInt16alloc_locked; -uInt16refresh_locked; -}; - -structstats_syselem{ -uInt16used; -uInt16max; -uInt16err; -}; - -structstats_sys{ -structstats_syselemsem; -structstats_syselemmbox; -}; - -structstats_{ -structstats_protolink; -structstats_protoip; -structstats_protoicmp; -structstats_protoudp; -structstats_prototcp; -structstats_pbufpbuf; -structstats_memmem; -structstats_memmemp[MEMP_MAX]; -structstats_syssys; -}; - -externstructstats_stats; - -#endif/*STATS*/ - -voidstats_init(void); -#endif/*__LWIP_STATS_H__*/ - - - - + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_STATS_H +#defineLWIP_HDR_STATS_H + +#include<net/opt.h> + +#include<net/mem.h> +#include<net/memp.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifLWIP_STATS + +#ifndefLWIP_STATS_LARGE +#defineLWIP_STATS_LARGE0 +#endif + +#ifLWIP_STATS_LARGE +#defineSTAT_COUNTERu32_t +#defineSTAT_COUNTER_FU32_F +#else +#defineSTAT_COUNTERu16_t +#defineSTAT_COUNTER_FU16_F +#endif + +structstats_proto{ +STAT_COUNTERxmit;/*Transmittedpackets.*/ +STAT_COUNTERrecv;/*Receivedpackets.*/ +STAT_COUNTERfw;/*Forwardedpackets.*/ +STAT_COUNTERdrop;/*Droppedpackets.*/ +STAT_COUNTERchkerr;/*Checksumerror.*/ +STAT_COUNTERlenerr;/*Invalidlengtherror.*/ +STAT_COUNTERmemerr;/*Outofmemoryerror.*/ +STAT_COUNTERrterr;/*Routingerror.*/ +STAT_COUNTERproterr;/*Protocolerror.*/ +STAT_COUNTERopterr;/*Errorinoptions.*/ +STAT_COUNTERerr;/*Miscerror.*/ +STAT_COUNTERcachehit; +}; + +structstats_igmp{ +STAT_COUNTERxmit;/*Transmittedpackets.*/ +STAT_COUNTERrecv;/*Receivedpackets.*/ +STAT_COUNTERdrop;/*Droppedpackets.*/ +STAT_COUNTERchkerr;/*Checksumerror.*/ +STAT_COUNTERlenerr;/*Invalidlengtherror.*/ +STAT_COUNTERmemerr;/*Outofmemoryerror.*/ +STAT_COUNTERproterr;/*Protocolerror.*/ +STAT_COUNTERrx_v1;/*Receivedv1frames.*/ +STAT_COUNTERrx_group;/*Receivedgroup-specificqueries.*/ +STAT_COUNTERrx_general;/*Receivedgeneralqueries.*/ +STAT_COUNTERrx_report;/*Receivedreports.*/ +STAT_COUNTERtx_join;/*Sentjoins.*/ +STAT_COUNTERtx_leave;/*Sentleaves.*/ +STAT_COUNTERtx_report;/*Sentreports.*/ +}; + +structstats_mem{ +#ifdefined(LWIP_DEBUG)||LWIP_STATS_DISPLAY +constchar*name; +#endif/*defined(LWIP_DEBUG)||LWIP_STATS_DISPLAY*/ +STAT_COUNTERerr; +mem_size_tavail; +mem_size_tused; +mem_size_tmax; +STAT_COUNTERillegal; +}; + +structstats_syselem{ +STAT_COUNTERused; +STAT_COUNTERmax; +STAT_COUNTERerr; +}; + +structstats_sys{ +structstats_syselemsem; +structstats_syselemmutex; +structstats_syselemmbox; +}; + +structstats_mib2{ +/*IP*/ +u32_tipinhdrerrors; +u32_tipinaddrerrors; +u32_tipinunknownprotos; +u32_tipindiscards; +u32_tipindelivers; +u32_tipoutrequests; +u32_tipoutdiscards; +u32_tipoutnoroutes; +u32_tipreasmoks; +u32_tipreasmfails; +u32_tipfragoks; +u32_tipfragfails; +u32_tipfragcreates; +u32_tipreasmreqds; +u32_tipforwdatagrams; +u32_tipinreceives; + +/*TCP*/ +u32_ttcpactiveopens; +u32_ttcppassiveopens; +u32_ttcpattemptfails; +u32_ttcpestabresets; +u32_ttcpoutsegs; +u32_ttcpretranssegs; +u32_ttcpinsegs; +u32_ttcpinerrs; +u32_ttcpoutrsts; + +/*UDP*/ +u32_tudpindatagrams; +u32_tudpnoports; +u32_tudpinerrors; +u32_tudpoutdatagrams; + +/*ICMP*/ +u32_ticmpinmsgs; +u32_ticmpinerrors; +u32_ticmpindestunreachs; +u32_ticmpintimeexcds; +u32_ticmpinparmprobs; +u32_ticmpinsrcquenchs; +u32_ticmpinredirects; +u32_ticmpinechos; +u32_ticmpinechoreps; +u32_ticmpintimestamps; +u32_ticmpintimestampreps; +u32_ticmpinaddrmasks; +u32_ticmpinaddrmaskreps; +u32_ticmpoutmsgs; +u32_ticmpouterrors; +u32_ticmpoutdestunreachs; +u32_ticmpouttimeexcds; +u32_ticmpoutechos;/*canbeincrementedbyuserapplication('ping')*/ +u32_ticmpoutechoreps; +}; + +structstats_mib2_netif_ctrs{ +u32_tifinoctets; +u32_tifinucastpkts; +u32_tifinnucastpkts; +u32_tifindiscards; +u32_tifinerrors; +u32_tifinunknownprotos; +u32_tifoutoctets; +u32_tifoutucastpkts; +u32_tifoutnucastpkts; +u32_tifoutdiscards; +u32_tifouterrors; +}; + +structstats_{ +#ifLINK_STATS + +structstats_protolink; +#endif +#ifETHARP_STATS + +structstats_protoetharp; +#endif +#ifIPFRAG_STATS + +structstats_protoip_frag; +#endif +#ifIP_STATS + +structstats_protoip; +#endif +#ifICMP_STATS + +structstats_protoicmp; +#endif +#ifIGMP_STATS + +structstats_igmpigmp; +#endif +#ifUDP_STATS + +structstats_protoudp; +#endif +#ifTCP_STATS + +structstats_prototcp; +#endif +#ifMEM_STATS + +structstats_memmem; +#endif +#ifMEMP_STATS + +structstats_mem*memp[MEMP_MAX]; +#endif +#ifSYS_STATS + +structstats_syssys; +#endif +#ifIP6_STATS + +structstats_protoip6; +#endif +#ifICMP6_STATS + +structstats_protoicmp6; +#endif +#ifIP6_FRAG_STATS + +structstats_protoip6_frag; +#endif +#ifMLD6_STATS + +structstats_igmpmld6; +#endif +#ifND6_STATS + +structstats_protond6; +#endif +#ifMIB2_STATS + +structstats_mib2mib2; +#endif +}; + +externstructstats_lwip_stats; + +voidstats_init(void); + +#defineSTATS_INC(x)++lwip_stats.x +#defineSTATS_DEC(x)--lwip_stats.x +#defineSTATS_INC_USED(x,y)do{lwip_stats.x.used+=y;\ +if(lwip_stats.x.max<lwip_stats.x.used){\ +lwip_stats.x.max=lwip_stats.x.used;\ +}\ +}while(0) +#defineSTATS_GET(x)lwip_stats.x +#else/*LWIP_STATS*/ +#definestats_init() +#defineSTATS_INC(x) +#defineSTATS_DEC(x) +#defineSTATS_INC_USED(x) +#endif/*LWIP_STATS*/ + +#ifTCP_STATS +#defineTCP_STATS_INC(x)STATS_INC(x) +#defineTCP_STATS_DISPLAY()stats_display_proto(&lwip_stats.tcp,"TCP") +#else +#defineTCP_STATS_INC(x) +#defineTCP_STATS_DISPLAY() +#endif + +#ifUDP_STATS +#defineUDP_STATS_INC(x)STATS_INC(x) +#defineUDP_STATS_DISPLAY()stats_display_proto(&lwip_stats.udp,"UDP") +#else +#defineUDP_STATS_INC(x) +#defineUDP_STATS_DISPLAY() +#endif + +#ifICMP_STATS +#defineICMP_STATS_INC(x)STATS_INC(x) +#defineICMP_STATS_DISPLAY()stats_display_proto(&lwip_stats.icmp,"ICMP") +#else +#defineICMP_STATS_INC(x) +#defineICMP_STATS_DISPLAY() +#endif + +#ifIGMP_STATS +#defineIGMP_STATS_INC(x)STATS_INC(x) +#defineIGMP_STATS_DISPLAY()stats_display_igmp(&lwip_stats.igmp,"IGMP") +#else +#defineIGMP_STATS_INC(x) +#defineIGMP_STATS_DISPLAY() +#endif + +#ifIP_STATS +#defineIP_STATS_INC(x)STATS_INC(x) +#defineIP_STATS_DISPLAY()stats_display_proto(&lwip_stats.ip,"IP") +#else +#defineIP_STATS_INC(x) +#defineIP_STATS_DISPLAY() +#endif + +#ifIPFRAG_STATS +#defineIPFRAG_STATS_INC(x)STATS_INC(x) +#defineIPFRAG_STATS_DISPLAY()stats_display_proto(&lwip_stats.ip_frag,"IP_FRAG") +#else +#defineIPFRAG_STATS_INC(x) +#defineIPFRAG_STATS_DISPLAY() +#endif + +#ifETHARP_STATS +#defineETHARP_STATS_INC(x)STATS_INC(x) +#defineETHARP_STATS_DISPLAY()stats_display_proto(&lwip_stats.etharp,"ETHARP") +#else +#defineETHARP_STATS_INC(x) +#defineETHARP_STATS_DISPLAY() +#endif + +#ifLINK_STATS +#defineLINK_STATS_INC(x)STATS_INC(x) +#defineLINK_STATS_DISPLAY()stats_display_proto(&lwip_stats.link,"LINK") +#else +#defineLINK_STATS_INC(x) +#defineLINK_STATS_DISPLAY() +#endif + +#ifMEM_STATS +#defineMEM_STATS_AVAIL(x,y)lwip_stats.mem.x=y +#defineMEM_STATS_INC(x)SYS_ARCH_INC(lwip_stats.mem.x,1) +#defineMEM_STATS_INC_USED(x,y)SYS_ARCH_INC(lwip_stats.mem.x,y) +#defineMEM_STATS_DEC_USED(x,y)SYS_ARCH_DEC(lwip_stats.mem.x,y) +#defineMEM_STATS_DISPLAY()stats_display_mem(&lwip_stats.mem,"HEAP") +#else +#defineMEM_STATS_AVAIL(x,y) +#defineMEM_STATS_INC(x) +#defineMEM_STATS_INC_USED(x,y) +#defineMEM_STATS_DEC_USED(x,y) +#defineMEM_STATS_DISPLAY() +#endif + +#ifMEMP_STATS +#defineMEMP_STATS_DEC(x,i)STATS_DEC(memp[i]->x) +#defineMEMP_STATS_DISPLAY(i)stats_display_memp(lwip_stats.memp[i],i) +#defineMEMP_STATS_GET(x,i)STATS_GET(memp[i]->x) +#else +#defineMEMP_STATS_DEC(x,i) +#defineMEMP_STATS_DISPLAY(i) +#defineMEMP_STATS_GET(x,i)0 +#endif + +#ifSYS_STATS +#defineSYS_STATS_INC(x)STATS_INC(sys.x) +#defineSYS_STATS_DEC(x)STATS_DEC(sys.x) +#defineSYS_STATS_INC_USED(x)STATS_INC_USED(sys.x,1) +#defineSYS_STATS_DISPLAY()stats_display_sys(&lwip_stats.sys) +#else +#defineSYS_STATS_INC(x) +#defineSYS_STATS_DEC(x) +#defineSYS_STATS_INC_USED(x) +#defineSYS_STATS_DISPLAY() +#endif + +#ifIP6_STATS +#defineIP6_STATS_INC(x)STATS_INC(x) +#defineIP6_STATS_DISPLAY()stats_display_proto(&lwip_stats.ip6,"IPv6") +#else +#defineIP6_STATS_INC(x) +#defineIP6_STATS_DISPLAY() +#endif + +#ifICMP6_STATS +#defineICMP6_STATS_INC(x)STATS_INC(x) +#defineICMP6_STATS_DISPLAY()stats_display_proto(&lwip_stats.icmp6,"ICMPv6") +#else +#defineICMP6_STATS_INC(x) +#defineICMP6_STATS_DISPLAY() +#endif + +#ifIP6_FRAG_STATS +#defineIP6_FRAG_STATS_INC(x)STATS_INC(x) +#defineIP6_FRAG_STATS_DISPLAY()stats_display_proto(&lwip_stats.ip6_frag,"IPv6FRAG") +#else +#defineIP6_FRAG_STATS_INC(x) +#defineIP6_FRAG_STATS_DISPLAY() +#endif + +#ifMLD6_STATS +#defineMLD6_STATS_INC(x)STATS_INC(x) +#defineMLD6_STATS_DISPLAY()stats_display_igmp(&lwip_stats.mld6,"MLDv1") +#else +#defineMLD6_STATS_INC(x) +#defineMLD6_STATS_DISPLAY() +#endif + +#ifND6_STATS +#defineND6_STATS_INC(x)STATS_INC(x) +#defineND6_STATS_DISPLAY()stats_display_proto(&lwip_stats.nd6,"ND") +#else +#defineND6_STATS_INC(x) +#defineND6_STATS_DISPLAY() +#endif + +#ifMIB2_STATS +#defineMIB2_STATS_INC(x)STATS_INC(x) +#else +#defineMIB2_STATS_INC(x) +#endif + +/*Displayofstatistics*/ +#ifLWIP_STATS_DISPLAY +voidstats_display(void); +voidstats_display_proto(structstats_proto*proto,constchar*name); +voidstats_display_igmp(structstats_igmp*igmp,constchar*name); +voidstats_display_mem(structstats_mem*mem,constchar*name); +voidstats_display_memp(structstats_mem*mem,intindex); +voidstats_display_sys(structstats_sys*sys); +#else/*LWIP_STATS_DISPLAY*/ +#definestats_display() +#definestats_display_proto(proto,name) +#definestats_display_igmp(igmp,name) +#definestats_display_mem(mem,name) +#definestats_display_memp(mem,index) +#definestats_display_sys(sys) +#endif/*LWIP_STATS_DISPLAY*/ + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_HDR_STATS_H*/ - + diff --git a/doc/xml/stdarg_8h.xml b/doc/xml/stdarg_8h.xml index e7293b5..1d22b3c 100644 --- a/doc/xml/stdarg_8h.xml +++ b/doc/xml/stdarg_8h.xml @@ -1,116 +1,2017 @@ - - - + + + stdarg.h - src/sys/kernel/kpanic.c - src/sys/lib/kprintf.c - src/sys/lib/vsprintf.c + C:/Dev/git/UbixOS/sys/arch/armv6/kpanic.c + C:/Dev/git/UbixOS/sys/arch/i386/kpanic.c + C:/Dev/git/UbixOS/sys/include/lib/kprintf.h + C:/Dev/git/UbixOS/sys/lib/vsprintf.c - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - vaArg + + __va_copy + dest + src + __builtin_va_copy((dest), (src)) + + + + + + + + + + va_arg ap type - ((ap)[0] += \ - ((sizeof(type) + sizeof(int) - 1) & ~(sizeof(int) - 1)), \ - (*(type *) ((ap)[0] \ - - ((sizeof(type) + sizeof(int) - 1) & ~(sizeof(int) - 1)) ))) + __builtin_va_arg((ap), type) - - vsprintf + - - vaEnd + + va_end ap - ((ap)[0] = 0, (void) 0) + __builtin_va_end(ap) - - kpanic - kprintf - sprintf + - - vaStart + + va_start ap - parm - ((ap)[0] = (char *) &parm \ - + ((sizeof(parm) + sizeof(int) - 1) & ~(sizeof(int) - 1)), (void) 0) + last + __builtin_va_start((ap), (last)) - - kpanic - kprintf - sprintf + - + char * - typedef char* vaList[1] - [1] - vaList + typedef char* va_list + + va_list - + - + int int vsprintf - (char *buf, const char *fmt, vaList args) + (char *buf, const char *fmt, va_list args) vsprintf char * buf - const char * + const char * fmt - vaList + va_list args @@ -119,22 +2020,14 @@ - - is_digit - LEFT - number - PLUS - SIGN - skip_atoi - SMALL - SPACE - SPECIAL - strlen - vaArg - ZEROPAD - kpanic - kprintf - sprintf + + is_digit + LEFT + PLUS + SPACE + SPECIAL + ZEROPAD + kpanic @@ -142,76 +2035,80 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: stdarg_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_STDARG_H -#define_STDARG_H - -typedefchar*vaList[1]; - -#definevaStart(ap,parm)((ap)[0]=(char*)&parm\ -+((sizeof(parm)+sizeof(int)-1)&~(sizeof(int)-1)),(void)0) - -#definevaArg(ap,type)((ap)[0]+=\ -((sizeof(type)+sizeof(int)-1)&~(sizeof(int)-1)),\ -(*(type*)((ap)[0]\ --((sizeof(type)+sizeof(int)-1)&~(sizeof(int)-1))))) - -#definevaEnd(ap)((ap)[0]=0,(void)0) - - -intvsprintf(char*buf,constchar*fmt,vaListargs); - -#endif - -/*** -$Log: stdarg_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:36reddawg -Removed - -Revision1.1.1.12005/09/2617:23:38reddawg -nomessage - -Revision1.22004/05/2115:22:35reddawg -Cleanedup - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_STDARG_H +#define_STDARG_H + +typedefchar*va_list; + +/* +#define__va_size(type)(((sizeof(type)+sizeof(int)-1)/sizeof(int))*sizeof(int)) +#defineva_start(ap,last)((ap)=(va_list)&(last)+__va_size(last)) +#defineva_arg(ap,type)(*(type*)((ap)+=__va_size(type),(ap)-__va_size(type))) +#defineva_end(ap)(ap=(va_list)0) +*/ + +#defineva_start(ap,last)\ +__builtin_va_start((ap),(last)) + +#defineva_arg(ap,type)\ +__builtin_va_arg((ap),type) + +#define__va_copy(dest,src)\ +__builtin_va_copy((dest),(src)) + +#defineva_end(ap)\ +__builtin_va_end(ap) + +intvsprintf(char*buf,constchar*fmt,va_listargs); + +#endif + +/*** +$Log:stdarg.h,v$ +Revision1.1.1.12006/06/0112:46:13reddawg +ubix2 + +Revision1.22005/10/1200:13:36reddawg +Removed -END -***/ +Revision1.1.1.12005/09/2617:23:38reddawg +nomessage + +Revision1.22004/05/2115:22:35reddawg +Cleanedup + + +END +***/ - + diff --git a/doc/xml/string_8c.xml b/doc/xml/string_8c.xml index cacce50..048e768 100644 --- a/doc/xml/string_8c.xml +++ b/doc/xml/string_8c.xml @@ -1,181 +1,120 @@ - - - + + + string.c - lib/string.h + string.h - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + - - - int - int memcmp - (const void *dst, const void *src, size_t length) - memcmp - - const void * - dst - - - const void * - src - - - size_t - length - + + + const u_char + const u_char bcd2bin_data[] + [] + bcd2bin_data + = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 } - + - - void * - void* memcpyold - (const void *dst, const void *src, size_t length) - memcpyold - - const void * - dst - - - const void * - src - - - size_t - length - + + const u_char + const u_char bin2bcd_data[] + [] + bin2bcd_data + = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 } - + - - int - int strcmp - (const char *str1, const char *str2) - strcmp - - const char * - str1 - - - const char * - str2 - + + const char + const char hex2ascii_data[] + [] + hex2ascii_data + = "0123456789abcdefghijklmnopqrstuvwxyz" - - - - int - int strncmp - (const char *a, const char *b, size_t c) - strncmp - - const char * - a - - - const char * - b - - - size_t - c - - - - - - - - - strstr - - - void - void strncpy - (char *dest, const char *src, size_t size) - strncpy - - char * - dest - - - const char * - src - - - size_t - size - - - - - - - - - - - char * - char* strstr - (const char *s, char *find) - strstr - - const char * - s - - - char * - find - - - - - - - - - NULL - strlen - strncmp - fopen - sysChDir - sysMkDir + @@ -183,190 +122,43 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: string_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<lib/string.h> - -intstrcmp(constchar*str1,constchar*str2){ -while((*str1==*str2)&&(*str1!=0x0)&&(*str2!=0x0)){ -str1++; -str2++; -} -if(*str1==*str2){ -return(0); -} -elseif(*str1>*str2){ -return(1); -} -else{ -return(-1); -} -} - -intstrncmp(constchar*a,constchar*b,size_tc){ -inti=0; -while(i<c){ -if((a[i]!=b[i])||(a[i]=='\0')||(b[i]=='\0')) -returna[i]-b[i]; -i++; -} -return0; -} - - - -void*memcpyold(constvoid*dst,constvoid*src,size_tlength){ -//size_tx=length>>2; -//size_ty=length;//&0xf; -size_ti; -/* -for(i=0;i<x;i++){ -((unsignedlong*)dst)[i]=((unsignedlong*)src)[i]; -} -*/ -/* -for(i=0;i<y;i++){ -((char*)dst)[length-y+i]=((char*)src)[length-y+i]; -} -*/ -for(i=0x0;i<length;i++) -((char*)dst)[i]=((char*)src)[i]; - -return((void*)dst); -} - -intmemcmp(constvoid*dst,constvoid*src,size_tlength) -{ -size_tx=length>>2; -size_ty=length&0xf; -size_ti; - -for(i=0;i<x;i++) -{ -if(((unsignedlong*)dst)[i]>((unsignedlong*)src)[i]) -return1; -if(((unsignedlong*)dst)[i]<((unsignedlong*)src)[i]) -return-1; -} - -for(i=0;i<y;i++) -{ -if(((char*)dst)[length-y+i]>((char*)src)[length-y+i]) -return1; -if(((char*)dst)[length-y+i]<((char*)src)[length-y+i]) -return-1; -} - -return0; -} - -voidstrncpy(char*dest,constchar*src,size_tsize) -{ -if(size==0) -return; -do -{ -*dest=*src; -dest++;src++; -size--; -} -while(('\0'!=*(src-1))&&(size)); -} - -char*strstr(constchar*s,char*find){ -charc,sc; -size_tlen; - -if((c=*find++)!=0){ -len=strlen(find); -do{ -do{ -if((sc=*s++)==0) -return(NULL); -}while(sc!=c); -}while(strncmp(s,find,len)!=0); -s--; -} -return((char*)s); -} - - -/*** -$Log: string_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.32006/12/1214:09:18reddawg -Changes - -Revision1.22006/12/0514:10:21reddawg -WorkignDistro - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:13reddawg -nomessage - -Revision1.62004/07/2815:05:43reddawg -Major: -Pagesnowhavestrictsecurityenforcement. -Manynulldereferenceshavebeenresolved. -Whenappsloadedpermissionssetforpagesrwandro - -Revision1.52004/07/2018:42:41flameshadow -add:strcpy() -chg:modifieddirCache.ctousestrcpy() - -Revision1.42004/07/0523:06:32reddawg -Fixens - -Revision1.32004/06/2823:12:58reddawg -fileformatnowcontainer:/path/to/file - -Revision1.22004/05/1914:40:58reddawg -Cleanedupsomewarningfromleavingouttypedefs - -Revision1.1.1.12004/04/1512:07:11reddawg -UbixOSv1.0 - -Revision1.52004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<string.h> + +u_charconstbcd2bin_data[]={0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,10,11,12,13,14,15,16,17,18,19,0,0,0,0,0,0,20,21,22,23,24,25,26,27,28,29,0,0,0,0,0,0,30,31,32,33,34,35,36,37,38,39,0,0,0,0,0,0,40,41,42,43,44,45,46,47,48,49,0,0,0,0,0,0,50,51,52,53,54,55,56,57,58,59,0,0,0,0,0,0,60,61,62,63,64,65,66,67,68,69,0,0,0,0,0,0,70,71,72,73,74,75,76,77,78,79,0,0,0,0,0,0,80,81,82,83,84,85,86,87,88,89,0,0,0,0,0,0,90,91,92,93,94,95,96,97,98,99}; + +u_charconstbin2bcd_data[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99}; + +/*Thisisactuallyusedwithradix[2..36]*/ +charconsthex2ascii_data[]="0123456789abcdefghijklmnopqrstuvwxyz"; - + diff --git a/doc/xml/string_8h.xml b/doc/xml/string_8h.xml index a201f1f..92afddf 100644 --- a/doc/xml/string_8h.xml +++ b/doc/xml/string_8h.xml @@ -1,180 +1,661 @@ - - - + + + string.h - ubixos/types.h - src/sys/isa/ne2k.c - src/sys/kernel/fork.c - src/sys/kernel/gen_calls.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/ld.c - src/sys/kernel/sched.c - src/sys/kernel/systemtask.c - src/sys/kernel/tty.c - src/sys/kernel/vitals.c - src/sys/kmods/kmod.c - src/sys/lib/kmalloc.c - src/sys/lib/bcopy.c - src/sys/lib/memset.c - src/sys/lib/net.c - src/sys/pci/hd.c - src/sys/sys/idt.c - src/sys/vmm/copyvirtualspace.c - src/sys/vmm/paging.c + sys/types.h + strings.h + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/spinlock.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/fs/devfs/devfs.c + C:/Dev/git/UbixOS/sys/fs/fat/fat.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_access.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_cache.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_filelib.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_format.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_misc.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_string.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_table.c + C:/Dev/git/UbixOS/sys/fs/fat/fat_write.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/dirCache.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/directory.c + C:/Dev/git/UbixOS/sys/fs/ubixfs/ubixfs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/fs/vfs/vfs.c + C:/Dev/git/UbixOS/sys/include/fs/common/gpt.h + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/elf.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_pipe.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c + C:/Dev/git/UbixOS/sys/kernel/vitals.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/lib/kprintf.c + C:/Dev/git/UbixOS/sys/lib/net.c + C:/Dev/git/UbixOS/sys/lib/string.c + C:/Dev/git/UbixOS/sys/lib/strncpy.c + C:/Dev/git/UbixOS/sys/lib/strtok.c + C:/Dev/git/UbixOS/sys/lib/vsprintf.c + C:/Dev/git/UbixOS/sys/mpi/system.c + C:/Dev/git/UbixOS/sys/net/core/def.c + C:/Dev/git/UbixOS/sys/net/core/inet_chksum.c + C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c + C:/Dev/git/UbixOS/sys/net/core/mem.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/net/bot.c + C:/Dev/git/UbixOS/sys/net/net/shell.c + C:/Dev/git/UbixOS/sys/pci/hd.c + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/copyvirtualspace.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_allocpagetable.c - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bcd2bin + bcd + (bcd2bin_data[bcd]) + + + + + + + + + + bin2bcd + bin + (bin2bcd_data[bin]) + + + + + + + + + + hex2ascii + hex + (hex2ascii_data[hex]) + + + + + + + + + + tolower + c + ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z'))) + + + + + + + + + + toupper + c + ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z'))) + + + + + + + + + + + + const u_char + const u_char bcd2bin_data[] + [] + bcd2bin_data + + + + + + + + + + const u_char + const u_char bin2bcd_data[] + [] + bin2bcd_data + + + + + + + + + + const char + const char hex2ascii_data[] + [] + hex2ascii_data + + + + + + + + + - - void * - void* memcpy - (void *dst, const void *src, size_t length) - memcpy + + int + int memcmp + (const void *dst, const void *src, size_t length) + memcmp - void * + const void * dst - const void * + const void * src - size_t + size_t length @@ -183,9 +664,54 @@ - + - + + void * + void* memcpy + (const void *dst, const void *src, size_t length) + memcpy + + const void * + dst + + + const void * + src + + + size_t + length + + + + + + + + + addDirEntry + apicMagic + dup2 + fatfs_get_file_entry + fatfs_mark_file_deleted + fatfs_split_path + fatfs_update_file_length + fcntl + fork_copyProcess + lnc_sendPacket + schedNewTask + sys_call_posix + sys_fork + sys_getlogin + sys_read + sys_setlogin + sys_sigaction + sys_sigprocmask + sys_write + tty_change + + void * void* memset (void *dst, int c, size_t length) @@ -199,7 +725,7 @@ c - size_t + size_t length @@ -208,24 +734,47 @@ - - VAL - WIDEVAL - wmask - wsize + + elf_load_file + execFile + fatfs_fat_init + fatfs_filename_to_lfn + fatfs_get_file_entry + fatfs_lfn_cache_init + fatfs_lfn_create_sfn + fatfs_lfn_generate_tail + fatfs_list_directory_next + fopen + initLNC + kmod_load + ldEnable + lnc_rxINT + lnc_thread + lncAttach + mem_calloc + netif_add + pciProbe + schedNewTask + spinLockInit + sys_pipe2 + sys_thread_new + sysExec + ubthread_cond_init + ubthread_mutex_init + vitals_init - + int int sprintf - (char *str, const char *format,...) + (char *buf, const char *fmt,...) sprintf char * - str + buf - const char * - format + const char * + fmt ... @@ -236,21 +785,24 @@ - - vaEnd - vaStart - vsprintf + + kvprintf + NULL + va_end + va_start - + int int strcmp - (const char *, const char *) + (const char *str1, const char *str2) strcmp - const char * + const char * + str1 - const char * + const char * + str2 @@ -258,20 +810,24 @@ - + + kmod_load + ldEnable + systemTask + vfs_findMount + writeFileByte + writeUbixFS - + char * char* strcpy - (char *dst, const char *src) + (char *, const char *) strcpy char * - dst - const char * - src + const char * @@ -279,15 +835,18 @@ - + + fopen + sysExec + ubixfs_cacheNew - + int int strlen (const char *string) strlen - const char * + const char * string @@ -296,24 +855,26 @@ - + + LONGPTR_MASK + testbyte - - long - long strtol - (const char *__restrict nptr, char **__restrict endptr, int base) - strtol + + int + int strncmp + (const char *a, const char *b, size_t c) + strncmp - const char *__restrict - nptr + const char * + a - char **__restrict - endptr + const char * + b - int - base + size_t + c @@ -321,11 +882,108 @@ - - LONG_MAX - LONG_MIN - NULL - inet_aton + + + + char * + char* strncpy + (char *__restrict, const char *__restrict, size_t) + strncpy + + char * + __restrict + + + const char * + __restrict + + + size_t + + + + + + + + + fatfs_list_directory_next + + + char * + char* strstr + (const char *s, char *find) + strstr + + const char * + s + + + char * + find + + + + + + + + + fopen + sys_chdir + sys_fchdir + sysMkDir + + + char * + char* strtok + (char *str, const char *sep) + strtok + + char * + str + + + const char * + sep + + + + + + + + + strtok_r + fopen + sysMkDir + + + char * + char* strtok_r + (char *str, const char *sep, char **last) + strtok_r + + char * + str + + + const char * + sep + + + char ** + last + + + + + + + + + NULL + strtok @@ -333,57 +991,81 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: string_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_STRING_H -#define_STRING_H - -#include<ubixos/types.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_STRING_H +#define_STRING_H + +#include<sys/types.h> +#include<strings.h> -char*strcpy(char*dst,constchar*src); - -void*memcpy(void*dst,constvoid*src,size_tlength); -void*memset(void*dst,intc,size_tlength); -intstrlen(constchar*string); -intstrcmp(constchar*,constchar*); - -intsprintf(char*str,constchar*format,...); - -longstrtol(constchar*__restrictnptr,char**__restrictendptr,intbase); - -#endif - -/*** -END -***/ +void*memcpy(constvoid*dst,constvoid*src,size_tlength); +char*strcpy(char*,constchar*); +intstrcmp(constchar*str1,constchar*str2); +intstrncmp(constchar*a,constchar*b,size_tc); +void*memset(void*dst,intc,size_tlength); +intstrlen(constchar*string); +intmemcmp(constvoid*dst,constvoid*src,size_tlength); +char*strncpy(char*__restrict,constchar*__restrict,size_t); +char*strtok(char*str,constchar*sep); +char*strtok_r(char*str,constchar*sep,char**last); +char*strstr(constchar*s,char*find); + +externu_charconstbcd2bin_data[]; +externu_charconstbin2bcd_data[]; +externcharconsthex2ascii_data[]; + +#definebcd2bin(bcd)(bcd2bin_data[bcd]) +#definebin2bcd(bin)(bin2bcd_data[bin]) +#definehex2ascii(hex)(hex2ascii_data[hex]) + +#definetoupper(c)((c)-0x20*(((c)>='a')&&((c)<='z'))) +#definetolower(c)((c)+0x20*(((c)>='A')&&((c)<='Z'))) + +#ifdef__cplusplus +extern"C"{ +#endif + + + + + + + +intsprintf(char*buf,constchar*fmt,...); + +#ifdef__cplusplus +} +#endif + +#endif/*END_STRING_H*/ - + diff --git a/doc/xml/strtok_8c.xml b/doc/xml/strtok_8c.xml index 0adaff2..0976527 100644 --- a/doc/xml/strtok_8c.xml +++ b/doc/xml/strtok_8c.xml @@ -1,37 +1,83 @@ - - - + + + strtok.c - lib/string.h - ubixos/types.h + string.h + sys/types.h - - - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + - + char * char* strtok (char *s, const char *delim) @@ -41,7 +87,7 @@ s - const char * + const char * delim @@ -50,13 +96,12 @@ - - strtok_r - fopen - sysMkDir - unlink + + strtok_r + fopen + sysMkDir - + char * char* strtok_r (char *s, const char *delim, char **last) @@ -66,7 +111,7 @@ s - const char * + const char * delim @@ -79,9 +124,9 @@ - - NULL - strtok + + NULL + strtok @@ -89,112 +134,86 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: strtok_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<lib/string.h> -#include<ubixos/types.h> - -char*strtok_r(char*s,constchar*delim,char**last){ -char*spanp; -intc,sc; -char*tok; - -if((s==NULL)&&((s=*last)==NULL)){ -return(NULL); -} - -cont: -c=*s++; -for(spanp=(char*)delim;(sc=*spanp++)!=0;){ -if(c==sc){ -gotocont; -} -} -if(c==0){ -*last=NULL; -return(NULL); -} -tok=s-1; - -for(;;){ -c=*s++; -spanp=(char*)delim; -do{ -if((sc=*spanp++)==c){ -if(c==0){ -s=NULL; -} -else{ -char*w=s-1; -*w='\0'; -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<string.h> +#include<sys/types.h> + +char*strtok_r(char*s,constchar*delim,char**last){ +char*spanp,*tok; +intc,sc; + +if(s==NULL&&(s=*last)==NULL) +return(NULL); + +/* +*Skip(span)leadingdelimiters(s+=strspn(s,delim),sortof). +*/ +cont:c=*s++; +for(spanp=(char*)delim;(sc=*spanp++)!=0;){ +if(c==sc) +gotocont; +} + +if(c==0){/*nonon-delimitercharacters*/ +*last=NULL; +return(NULL); +} +tok=s-1; + +/* +*Scantoken(scanfordelimiters:s+=strcspn(s,delim),sortof). +*NotethatdelimmusthaveoneNUL;westopifweseethat,too. +*/ +for(;;){ +c=*s++; +spanp=(char*)delim; +do{ +if((sc=*spanp++)==c){ +if(c==0) +s=NULL; +else +s[-1]='\0'; *last=s; -return(tok); -} -}while(sc!=0); -} -} - -char*strtok(char*s,constchar*delim){ -staticchar*last; -return(strtok_r(s,delim,&last)); -} - -/*** -$Log: strtok_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:52 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:13reddawg -nomessage - -Revision1.22004/05/1903:46:32reddawg -AFewQuickHacksToMakeThingsWork - -Revision1.1.1.12004/04/1512:07:11reddawg -UbixOSv1.0 - -Revision1.22004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - - +return(tok); +} +}while(sc!=0); +} +/*NOTREACHED*/ +return(NULL); +} + +char*strtok(char*s,constchar*delim){ +staticchar*last; +return(strtok_r(s,delim,&last)); +} - + diff --git a/doc/xml/strtol_8c.xml b/doc/xml/strtol_8c.xml index 5bb7b52..70cd2c7 100644 --- a/doc/xml/strtol_8c.xml +++ b/doc/xml/strtol_8c.xml @@ -1,34 +1,22 @@ - - - + + + strtol.c sys/cdefs.h - - - - + + + + - - - - - - - - - - - + - - - + LONG_MAX 0x7fffffffL @@ -37,10 +25,9 @@ - - strtol + - + LONG_MIN (-0x7fffffffL - 1) @@ -49,22 +36,21 @@ - - strtol + - + long long strtol (const char *__restrict nptr, char **__restrict endptr, int base) strtol - const char *__restrict + const char *__restrict nptr - char **__restrict + char **__restrict endptr @@ -77,11 +63,9 @@ - - LONG_MAX - LONG_MIN - NULL - inet_aton + + LONG_MAX + LONG_MIN @@ -89,110 +73,135 @@ -#include<sys/cdefs.h> -//#include<limits.h> -//#include<ctype.h> -//#include<stdlib.h> - -#defineLONG_MIN(-0x7fffffffL-1) -#defineLONG_MAX0x7fffffffL - - - -long -strtol(constchar*__restrictnptr,char**__restrictendptr,intbase) -{ -constchar*s; -unsignedlongacc; -charc=0x0;/*toremovewarning*/ -unsignedlongcutoff; -intneg,any,cutlim; - -/* -*Skipwhitespaceandpickupleading+/-signifany. -*Ifbaseis0,allow0xforhexand0foroctal,else -*assumedecimal;ifbaseisalready16,allow0x. -*/ -s=nptr; -/* -do{ -c=*s++; -}while(isspace((unsignedchar)c)); -*/ -if(c=='-'){ -neg=1; -c=*s++; -}else{ -neg=0; -if(c=='+') -c=*s++; -} -if((base==0||base==16)&& -c=='0'&&(*s=='x'||*s=='X')){ -c=s[1]; -s+=2; -base=16; -} -if(base==0) -base=c=='0'?8:10; -acc=any=0; -if(base<2||base>36) -gotonoconv; - -/* -*Computethecutoffvaluebetweenlegalnumbersandillegal -*numbers.Thatisthelargestlegalvalue,dividedbythe -*base.Aninputnumberthatisgreaterthanthisvalue,if -*followedbyalegalinputcharacter,istoobig.Onethat -*isequaltothisvaluemaybevalidornot;thelimit -*betweenvalidandinvalidnumbersisthenbasedonthelast -*digit.Forinstance,iftherangeforlongsis -*[-2147483648..2147483647]andtheinputbaseis10, -*cutoffwillbesetto214748364andcutlimtoeither -*7(neg==0)or8(neg==1),meaningthatifwehaveaccumulated -*avalue>214748364,orequalbutthenextdigitis>7(or8), -*thenumberistoobig,andwewillreturnarangeerror. -* -*Set'any'ifany`digits'consumed;makeitnegativetoindicate -*overflow. -*/ -cutoff=neg?(unsignedlong)-(LONG_MIN+LONG_MAX)+LONG_MAX -:LONG_MAX; -cutlim=cutoff%base; -cutoff/=base; -for(;;c=*s++){ -if(c>='0'&&c<='9') -c-='0'; -elseif(c>='A'&&c<='Z') -c-='A'-10; -elseif(c>='a'&&c<='z') -c-='a'-10; -else -break; -if(c>=base) -break; -if(any<0||acc>cutoff||(acc==cutoff&&c>cutlim)) -any=-1; -else{ -any=1; -acc*=base; -acc+=c; -} -} -if(any<0){ -acc=neg?LONG_MIN:LONG_MAX; -//errno=ERANGE; -}elseif(!any){ -noconv: -//errno=EINVAL; -cutoff=0x0;//UBU -}elseif(neg) -acc=-acc; -if(endptr!=NULL) -*endptr=(char*)(any?s-1:nptr); -return(acc); -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/cdefs.h> +//#include<limits.h> +//#include<ctype.h> +//#include<stdlib.h> + +#defineLONG_MIN(-0x7fffffffL-1) +#defineLONG_MAX0x7fffffffL + +longstrtol(constchar*__restrictnptr,char**__restrictendptr,intbase){ +constchar*s; +unsignedlongacc; +charc=0x0;/*toremovewarning*/ +unsignedlongcutoff; +intneg,any,cutlim; + +/* +*Skipwhitespaceandpickupleading+/-signifany. +*Ifbaseis0,allow0xforhexand0foroctal,else +*assumedecimal;ifbaseisalready16,allow0x. +*/ +s=nptr; +/* +do{ +c=*s++; +}while(isspace((unsignedchar)c)); +*/ +if(c=='-'){ +neg=1; +c=*s++; +} +else{ +neg=0; +if(c=='+') +c=*s++; +} +if((base==0||base==16)&&c=='0'&&(*s=='x'||*s=='X')){ +c=s[1]; +s+=2; +base=16; +} +if(base==0) +base=c=='0'?8:10; +acc=any=0; +if(base<2||base>36) +gotonoconv; + +/* +*Computethecutoffvaluebetweenlegalnumbersandillegal +*numbers.Thatisthelargestlegalvalue,dividedbythe +*base.Aninputnumberthatisgreaterthanthisvalue,if +*followedbyalegalinputcharacter,istoobig.Onethat +*isequaltothisvaluemaybevalidornot;thelimit +*betweenvalidandinvalidnumbersisthenbasedonthelast +*digit.Forinstance,iftherangeforlongsis +*[-2147483648..2147483647]andtheinputbaseis10, +*cutoffwillbesetto214748364andcutlimtoeither +*7(neg==0)or8(neg==1),meaningthatifwehaveaccumulated +*avalue>214748364,orequalbutthenextdigitis>7(or8), +*thenumberistoobig,andwewillreturnarangeerror. +* +*Set'any'ifany`digits'consumed;makeitnegativetoindicate +*overflow. +*/ +cutoff=neg?(unsignedlong)-(LONG_MIN+LONG_MAX)+LONG_MAX:LONG_MAX; +cutlim=cutoff%base; +cutoff/=base; +for(;;c=*s++){ +if(c>='0'&&c<='9') +c-='0'; +elseif(c>='A'&&c<='Z') +c-='A'-10; +elseif(c>='a'&&c<='z') +c-='a'-10; +else +break; +if(c>=base) +break; +if(any<0||acc>cutoff||(acc==cutoff&&c>cutlim)) +any=-1; +else{ +any=1; +acc*=base; +acc+=c; +} +} +if(any<0){ +acc=neg?LONG_MIN:LONG_MAX; +//errno=ERANGE; +} +elseif(!any){ +noconv: +//errno=EINVAL; +cutoff=0x0;//UBU +} +elseif(neg) +acc=-acc; +if(endptr!=0x0) +*endptr=(char*)(any?s-1:nptr); +return(acc); +} - + diff --git a/doc/xml/structDrvGeom.xml b/doc/xml/structDrvGeom.xml index 9167ecb..28bd1f0 100644 --- a/doc/xml/structDrvGeom.xml +++ b/doc/xml/structDrvGeom.xml @@ -1,11 +1,11 @@ - - - + + + DrvGeom fdc.h - - Int8 + + Int8 Int8 DrvGeom::heads heads @@ -15,11 +15,10 @@ - - block2Hts + - - Int8 + + Int8 Int8 DrvGeom::spt spt @@ -29,12 +28,10 @@ - - block2Hts - fdcRw + - - Int8 + + Int8 Int8 DrvGeom::tracks tracks @@ -44,18 +41,24 @@ - + - + + + + + + + - DrvGeomheads - DrvGeomspt - DrvGeomtracks + DrvGeomheads + DrvGeomspt + DrvGeomtracks diff --git a/doc/xml/structTMode__Rec.xml b/doc/xml/structTMode__Rec.xml index 2df567b..37a8b7f 100644 --- a/doc/xml/structTMode__Rec.xml +++ b/doc/xml/structTMode__Rec.xml @@ -1,528 +1,447 @@ - - - + + + TMode_Rec - ogDisplay_VESA.h + objgfx30.h + + + uInt8 + uInt8 TMode_Rec::AlphaFieldPosition + + AlphaFieldPosition + + + + + + + + + + uInt8 + uInt8 TMode_Rec::AlphaMaskSize + + AlphaMaskSize + + + + + + + + + + uInt8 + uInt8 TMode_Rec::BankSize + + BankSize + + + + + + + + + + void * + void* TMode_Rec::BankSwitch + + BankSwitch + + + + + + + + + + uInt8 + uInt8 TMode_Rec::BitsPerPixel + + BitsPerPixel + + + + + + + + + + uInt8 + uInt8 TMode_Rec::BlueFieldPosition + + BlueFieldPosition + + + + + + + + + + uInt8 + uInt8 TMode_Rec::BlueMaskSize + + BlueMaskSize + + + + + + + + + + uInt16 + uInt16 TMode_Rec::BytesPerLine + + BytesPerLine + + + + + + + + + + uInt8 + uInt8 TMode_Rec::CharHeight + + CharHeight + + + + + + + + + + uInt8 + uInt8 TMode_Rec::CharWidth + + CharWidth + + + + + + + + + + uInt8 + uInt8 TMode_Rec::DirectColourMode + + DirectColourMode + + + + + + + + + + uInt16 + uInt16 TMode_Rec::Granularity + + Granularity + + + + + + + + + + uInt8 + uInt8 TMode_Rec::GreenFieldPosition + + GreenFieldPosition + + + + + + + + + + uInt8 + uInt8 TMode_Rec::GreenMaskSize + + GreenMaskSize + + + + + + + + + + uInt8 + uInt8 TMode_Rec::MemoryModel + + MemoryModel + + + + + + + + + + uInt16 + uInt16 TMode_Rec::ModeAttributes + + ModeAttributes + + + + + + + + + + uInt8 + uInt8 TMode_Rec::NumberOfBanks + + NumberOfBanks + + + + + + + + + + uInt8 + uInt8 TMode_Rec::NumBitPlanes + + NumBitPlanes + + + + + + + + + + uInt8 + uInt8 TMode_Rec::NumOfImagePages + + NumOfImagePages + + + + + + + + + + void * + void* TMode_Rec::OffScreenMemOffset + + OffScreenMemOffset + + + + + + + + + + uInt16 + uInt16 TMode_Rec::OffScreenMemSize + + OffScreenMemSize + + + + + + + + + + uInt8 + uInt8 TMode_Rec::paddington[461] + [461] + paddington + + + + + + + + + + uInt32 + uInt32 TMode_Rec::PhysBasePtr + + PhysBasePtr + + + + + + + + + + uInt8 + uInt8 TMode_Rec::RedFieldPosition + + RedFieldPosition + + + + + + + + + + uInt8 + uInt8 TMode_Rec::RedMaskSize + + RedMaskSize + + + + + + + + + + uInt8 + uInt8 TMode_Rec::Reserved + + Reserved + + + + + + + + + + uInt8 + uInt8 TMode_Rec::WindowAFlags + + WindowAFlags + + + + + + + + + + uInt16 + uInt16 TMode_Rec::WindowASeg + + WindowASeg + + + + + + + + + + uInt8 + uInt8 TMode_Rec::WindowBFlags + + WindowBFlags + + + + + + + + + + uInt16 + uInt16 TMode_Rec::WindowBSeg + + WindowBSeg + + + + + + + + + + uInt16 + uInt16 TMode_Rec::WindowSize + + WindowSize + + + + + + + + + + uInt16 + uInt16 TMode_Rec::xRes + + xRes + + + + + + + + + + uInt16 + uInt16 TMode_Rec::yRes + + yRes + + + + + + + + + - - uInt8 paddington[461] - uInt8 paddington [461] TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 OffScreenMemSize - uInt16 OffScreenMemSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - void *OffScreenMemOffset - void* OffScreenMemOffset TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 physBasePtr - uInt32 physBasePtr TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 DirectColourMode - uInt8 DirectColourMode TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 AlphaFieldPosition - uInt8 AlphaFieldPosition TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 AlphaMaskSize - uInt8 AlphaMaskSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 BlueFieldPosition - uInt8 BlueFieldPosition TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 BlueMaskSize - uInt8 BlueMaskSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 GreenFieldPosition - uInt8 GreenFieldPosition TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 GreenMaskSize - uInt8 GreenMaskSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 RedFieldPosition - uInt8 RedFieldPosition TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 RedMaskSize - uInt8 RedMaskSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 Reserved - uInt8 Reserved TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 NumOfImagePages - uInt8 NumOfImagePages TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 BankSize - uInt8 BankSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 MemoryModel - uInt8 MemoryModel TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 NumberOfBanks - uInt8 NumberOfBanks TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 BitsPerPixel - uInt8 BitsPerPixel TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 NumBitPlanes - uInt8 NumBitPlanes TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 CharHeight - uInt8 CharHeight TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 CharWidth - uInt8 CharWidth TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 yRes - uInt16 yRes TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 xRes - uInt16 xRes TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 BytesPerLine - uInt16 BytesPerLine TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - void *BankSwitch - void* BankSwitch TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 WindowBSeg - uInt16 WindowBSeg TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 WindowASeg - uInt16 WindowASeg TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 WindowSize - uInt16 WindowSize TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 Granularity - uInt16 Granularity TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 WindowBFlags - uInt8 WindowBFlags TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 WindowAFlags - uInt8 WindowAFlags TMode_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 ModeAttributes + + uInt16 ModeAttributes uInt16 ModeAttributes TMode_Rec::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -530,48 +449,599 @@ - + + + + uInt8 WindowAFlags + uInt8 WindowAFlags TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 WindowBFlags + uInt8 WindowBFlags TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 Granularity + uInt16 Granularity TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 WindowSize + uInt16 WindowSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 WindowASeg + uInt16 WindowASeg TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 WindowBSeg + uInt16 WindowBSeg TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + void *BankSwitch + void* BankSwitch TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 BytesPerLine + uInt16 BytesPerLine TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 xRes + uInt16 xRes TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 yRes + uInt16 yRes TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 CharWidth + uInt8 CharWidth TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 CharHeight + uInt8 CharHeight TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 NumBitPlanes + uInt8 NumBitPlanes TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 BitsPerPixel + uInt8 BitsPerPixel TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 NumberOfBanks + uInt8 NumberOfBanks TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 MemoryModel + uInt8 MemoryModel TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 BankSize + uInt8 BankSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 NumOfImagePages + uInt8 NumOfImagePages TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 Reserved + uInt8 Reserved TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 RedMaskSize + uInt8 RedMaskSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 RedFieldPosition + uInt8 RedFieldPosition TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 GreenMaskSize + uInt8 GreenMaskSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 GreenFieldPosition + uInt8 GreenFieldPosition TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 BlueMaskSize + uInt8 BlueMaskSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 BlueFieldPosition + uInt8 BlueFieldPosition TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 AlphaMaskSize + uInt8 AlphaMaskSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 AlphaFieldPosition + uInt8 AlphaFieldPosition TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 DirectColourMode + uInt8 DirectColourMode TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 physBasePtr + uInt32 physBasePtr TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + void *OffScreenMemOffset + void* OffScreenMemOffset TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 OffScreenMemSize + uInt16 OffScreenMemSize TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 paddington[461] + uInt8 paddington [461] TMode_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + - + + + + + + + - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ - TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_Rec__attribute__ + TMode_RecAlphaFieldPosition + TMode_RecAlphaMaskSize + TMode_RecBankSize + TMode_RecBankSwitch + TMode_RecBitsPerPixel + TMode_RecBlueFieldPosition + TMode_RecBlueMaskSize + TMode_RecBytesPerLine + TMode_RecCharHeight + TMode_RecCharWidth + TMode_RecDirectColourMode + TMode_RecGranularity + TMode_RecGreenFieldPosition + TMode_RecGreenMaskSize + TMode_RecMemoryModel + TMode_RecModeAttributes + TMode_RecNumberOfBanks + TMode_RecNumBitPlanes + TMode_RecNumOfImagePages + TMode_RecOffScreenMemOffset + TMode_RecOffScreenMemSize + TMode_Recpaddington + TMode_RecPhysBasePtr + TMode_RecRedFieldPosition + TMode_RecRedMaskSize + TMode_RecReserved + TMode_RecWindowAFlags + TMode_RecWindowASeg + TMode_RecWindowBFlags + TMode_RecWindowBSeg + TMode_RecWindowSize + TMode_RecxRes + TMode_RecyRes diff --git a/doc/xml/structTVESA__Rec.xml b/doc/xml/structTVESA__Rec.xml index a70be7d..bb89c48 100644 --- a/doc/xml/structTVESA__Rec.xml +++ b/doc/xml/structTVESA__Rec.xml @@ -1,192 +1,174 @@ - - - + + + TVESA_Rec - ogDisplay_VESA.h + objgfx30.h + + + uInt32 + uInt32 TVESA_Rec::Capabilities + + Capabilities + + + + + + + + + + uInt8 + uInt8 TVESA_Rec::majVersion + + majVersion + + + + + + + + + + uInt8 + uInt8 TVESA_Rec::minVersion + + minVersion + + + + + + + + + + char * + char* TVESA_Rec::OEMProductNamePtr + + OEMProductNamePtr + + + + + + + + + + char * + char* TVESA_Rec::OEMProductRevPtr + + OEMProductRevPtr + + + + + + + + + + uInt16 + uInt16 TVESA_Rec::OEMSoftwareRev + + OEMSoftwareRev + + + + + + + + + + char * + char* TVESA_Rec::OEMStringPtr + + OEMStringPtr + + + + + + + + + + char * + char* TVESA_Rec::OEMVendorNamePtr + + OEMVendorNamePtr + + + + + + + + + + uInt8 + uInt8 TVESA_Rec::paddington[474] + [474] + paddington + + + + + + + + + + uInt16 + uInt16 TVESA_Rec::TotalMemory + + TotalMemory + + + + + + + + + + char + char TVESA_Rec::VBESignature[4] + [4] + VBESignature + + + + + + + + + + uInt16 * + uInt16* TVESA_Rec::VideoModePtr + + VideoModePtr + + + + + + + + + - - uInt8 paddington[474] - uInt8 paddington [474] TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMProductRevPtr - uInt32 OEMProductRevPtr TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMProductNamePtr - uInt32 OEMProductNamePtr TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMVendorNamePtr - uInt32 OEMVendorNamePtr TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 OEMSoftwareRev - uInt16 OEMSoftwareRev TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 TotalMemory - uInt16 TotalMemory TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 VideoModePtr - uInt32 VideoModePtr TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 Capabilities - uInt32 Capabilities TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMStringPtr - uInt32 OEMStringPtr TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 majVersion - uInt8 majVersion TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 minVersion - uInt8 minVersion TVESA_Rec::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - char VBESignature[4] + + char VBESignature[4] char VBESignature [4] TVESA_Rec::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -194,27 +176,221 @@ - + + + + uInt8 minVersion + uInt8 minVersion TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 majVersion + uInt8 majVersion TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 OEMStringPtr + uInt32 OEMStringPtr TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 Capabilities + uInt32 Capabilities TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 VideoModePtr + uInt32 VideoModePtr TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 TotalMemory + uInt16 TotalMemory TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt16 OEMSoftwareRev + uInt16 OEMSoftwareRev TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 OEMVendorNamePtr + uInt32 OEMVendorNamePtr TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 OEMProductNamePtr + uInt32 OEMProductNamePtr TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt32 OEMProductRevPtr + uInt32 OEMProductRevPtr TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uInt8 paddington[474] + uInt8 paddington [474] TVESA_Rec::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + - + + + + + + + - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ - TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_Rec__attribute__ + TVESA_RecCapabilities + TVESA_RecmajVersion + TVESA_RecminVersion + TVESA_RecOEMProductNamePtr + TVESA_RecOEMProductRevPtr + TVESA_RecOEMSoftwareRev + TVESA_RecOEMStringPtr + TVESA_RecOEMVendorNamePtr + TVESA_Recpaddington + TVESA_RecTotalMemory + TVESA_RecVBESignature + TVESA_RecVideoModePtr diff --git a/doc/xml/struct__UbixUser.xml b/doc/xml/struct__UbixUser.xml index fb763a1..b128efd 100644 --- a/doc/xml/struct__UbixUser.xml +++ b/doc/xml/struct__UbixUser.xml @@ -1,9 +1,9 @@ - - - + + + _UbixUser - + int int _UbixUser::gid @@ -14,12 +14,11 @@ - - sysAuth + - + char * - char* _UbixUser::home + char * _UbixUser::home home @@ -28,11 +27,11 @@ - + - + char * - char* _UbixUser::password + char * _UbixUser::password password @@ -41,12 +40,11 @@ - - sysAuth + - + char * - char* _UbixUser::shell + char * _UbixUser::shell shell @@ -55,9 +53,9 @@ - + - + int int _UbixUser::uid @@ -68,12 +66,11 @@ - - sysAuth + - + char * - char* _UbixUser::username + char * _UbixUser::username username @@ -82,22 +79,27 @@ - - sysAuth + - + + + + + + + - _UbixUsergid - _UbixUserhome - _UbixUserpassword - _UbixUsershell - _UbixUseruid - _UbixUserusername + _UbixUsergid + _UbixUserhome + _UbixUserpassword + _UbixUsershell + _UbixUseruid + _UbixUserusername diff --git a/doc/xml/struct____sigset.xml b/doc/xml/struct____sigset.xml index e09bf3d..22325ee 100644 --- a/doc/xml/struct____sigset.xml +++ b/doc/xml/struct____sigset.xml @@ -1,11 +1,11 @@ - - - + + + __sigset - signal.h + _sigset.h - - __uint32_t + + __uint32_t __uint32_t __sigset::__bits[4] [4] __bits @@ -15,16 +15,23 @@ - + + sys_sigprocmask - + + + + + + + - __sigset__bits + __sigset__bits diff --git a/doc/xml/struct____timespec.xml b/doc/xml/struct____timespec.xml index 7af9dbf..6b48cc3 100644 --- a/doc/xml/struct____timespec.xml +++ b/doc/xml/struct____timespec.xml @@ -1,10 +1,10 @@ - - - + + + __timespec - kern_descrip.h + stat.h - + long long __timespec::tv_nsec @@ -15,10 +15,10 @@ - + - - __time_t + + __time_t __time_t __timespec::tv_sec tv_sec @@ -28,17 +28,23 @@ - + - + + + + + + + - __timespectv_nsec - __timespectv_sec + __timespectv_nsec + __timespectv_sec diff --git a/doc/xml/struct__item__t.xml b/doc/xml/struct__item__t.xml index 5f9d875..41fc354 100644 --- a/doc/xml/struct__item__t.xml +++ b/doc/xml/struct__item__t.xml @@ -1,10 +1,10 @@ - - - + + + _item_t lists.h - + void * void* _item_t::data @@ -15,11 +15,11 @@ - - kmod_add + + kmod_add - - Item_t * + + Item_t * Item_t* _item_t::Next Next @@ -29,10 +29,10 @@ - + - - Item_t * + + Item_t * Item_t* _item_t::Previous Previous @@ -42,7 +42,7 @@ - + @@ -50,20 +50,20 @@ - + - - Next -Previous + + +Previous + +Next - + - _item_tdata - _item_tNext - _item_tPrevious + _item_tdata + _item_tNext + _item_tPrevious diff --git a/doc/xml/struct__list__t.xml b/doc/xml/struct__list__t.xml index 419d0f5..7493343 100644 --- a/doc/xml/struct__list__t.xml +++ b/doc/xml/struct__list__t.xml @@ -1,11 +1,11 @@ - - - + + + _list_t lists.h - - Item_t * + + Item_t * Item_t* _list_t::First First @@ -15,10 +15,10 @@ - + - - Item_t * + + Item_t * Item_t* _list_t::Last Last @@ -28,7 +28,7 @@ - + @@ -36,27 +36,27 @@ - + - - Last -First + + +First + +Last - + - - Next -Previous + + +Previous + +Next - + - _list_tFirst - _list_tLast + _list_tFirst + _list_tLast diff --git a/doc/xml/structarp__entry.xml b/doc/xml/structarp__entry.xml index b969c4a..3f0f3ae 100644 --- a/doc/xml/structarp__entry.xml +++ b/doc/xml/structarp__entry.xml @@ -1,10 +1,10 @@ - - - + + + arp_entry - - uInt8 + + uInt8 uInt8 arp_entry::ctime ctime @@ -14,11 +14,10 @@ - - add_arp_entry + - - eth_addr + + struct eth_addr struct eth_addr arp_entry::ethaddr ethaddr @@ -28,11 +27,10 @@ - - add_arp_entry + - - ip_addr + + struct ip_addr struct ip_addr arp_entry::ipaddr ipaddr @@ -42,10 +40,7 @@ - - add_arp_entry - arp_init - arp_tmr + @@ -53,30 +48,23 @@ - + - - - - - + - - ethaddr - - - ipaddr + + +ethaddr - + - arp_entryctime - arp_entryethaddr - arp_entryipaddr + arp_entryctime + arp_entryethaddr + arp_entryipaddr diff --git a/doc/xml/structarp__hdr.xml b/doc/xml/structarp__hdr.xml index fc442a0..3b53547 100644 --- a/doc/xml/structarp__hdr.xml +++ b/doc/xml/structarp__hdr.xml @@ -1,26 +1,9 @@ - - - + + + arp_hdr - - - arp_hdr::PACK_STRUCT_FIELD - (struct ip_addr dipaddr) - PACK_STRUCT_FIELD - - struct ip_addr - dipaddr - - - - - - - - - - + arp_hdr::PACK_STRUCT_FIELD (struct eth_addr dhwaddr) @@ -35,26 +18,9 @@ - + - - - arp_hdr::PACK_STRUCT_FIELD - (struct ip_addr sipaddr) - PACK_STRUCT_FIELD - - struct ip_addr - sipaddr - - - - - - - - - - + arp_hdr::PACK_STRUCT_FIELD (struct eth_addr shwaddr) @@ -69,77 +35,9 @@ - + - - - arp_hdr::PACK_STRUCT_FIELD - (uInt16 opcode) - PACK_STRUCT_FIELD - - uInt16 - opcode - - - - - - - - - - - - arp_hdr::PACK_STRUCT_FIELD - (uInt16 _hwlen_protolen) - PACK_STRUCT_FIELD - - uInt16 - _hwlen_protolen - - - - - - - - - - - - arp_hdr::PACK_STRUCT_FIELD - (uInt16 proto) - PACK_STRUCT_FIELD - - uInt16 - proto - - - - - - - - - - - - arp_hdr::PACK_STRUCT_FIELD - (uInt16 hwtype) - PACK_STRUCT_FIELD - - uInt16 - hwtype - - - - - - - - - - + arp_hdr::PACK_STRUCT_FIELD (struct eth_hdr ethhdr) @@ -154,24 +52,132 @@ - + + + + + arp_hdr::PACK_STRUCT_FIELD + (struct ip_addr dipaddr) + PACK_STRUCT_FIELD + + struct ip_addr + dipaddr + + + + + + + + + + + + arp_hdr::PACK_STRUCT_FIELD + (struct ip_addr sipaddr) + PACK_STRUCT_FIELD + + struct ip_addr + sipaddr + + + + + + + + + + + + arp_hdr::PACK_STRUCT_FIELD + (uInt16 _hwlen_protolen) + PACK_STRUCT_FIELD + + uInt16 + _hwlen_protolen + + + + + + + + + + + + arp_hdr::PACK_STRUCT_FIELD + (uInt16 hwtype) + PACK_STRUCT_FIELD + + uInt16 + hwtype + + + + + + + + + + + + arp_hdr::PACK_STRUCT_FIELD + (uInt16 opcode) + PACK_STRUCT_FIELD + + uInt16 + opcode + + + + + + + + + + + + arp_hdr::PACK_STRUCT_FIELD + (uInt16 proto) + PACK_STRUCT_FIELD + + uInt16 + proto + + + + + + + + - + + + + + + + - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD - arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD + arp_hdrPACK_STRUCT_FIELD diff --git a/doc/xml/structarpcom.xml b/doc/xml/structarpcom.xml index a6ea75c..9640648 100644 --- a/doc/xml/structarpcom.xml +++ b/doc/xml/structarpcom.xml @@ -1,12 +1,12 @@ - - - + + + arpcom lnc.h - - uInt8 - uInt8 arpcom::ac_enaddr[6] + + uint8_t + uint8_t arpcom::ac_enaddr[6] [6] ac_enaddr @@ -15,11 +15,10 @@ - - initLNC - lncAttach + + initLNC - + int int arpcom::ac_multicnt @@ -30,9 +29,9 @@ - + - + void * void* arpcom::ac_netgraph @@ -43,18 +42,24 @@ - + - + + + + + + + - arpcomac_enaddr - arpcomac_multicnt - arpcomac_netgraph + arpcomac_enaddr + arpcomac_multicnt + arpcomac_netgraph diff --git a/doc/xml/structblockAllocationTableEntry.xml b/doc/xml/structblockAllocationTableEntry.xml index 1ad1643..862a86a 100644 --- a/doc/xml/structblockAllocationTableEntry.xml +++ b/doc/xml/structblockAllocationTableEntry.xml @@ -1,10 +1,10 @@ - - - + + + blockAllocationTableEntry - ubixfs.h + ubixfs.h - + long long blockAllocationTableEntry::attributes @@ -15,11 +15,12 @@ - - freeBlocks - getFreeBlocks + + freeBlocks + getFreeBlocks + writeFileByte - + long long blockAllocationTableEntry::nextBlock @@ -30,14 +31,13 @@ - - freeBlocks - getFreeBlocks - ubixfs_loadData - writeFileByte - writeUbixFS + + freeBlocks + getFreeBlocks + writeFileByte + writeUbixFS - + long long blockAllocationTableEntry::realSector @@ -48,12 +48,13 @@ - - ubixfs_loadData - ubixFSmkDir - writeUbixFS + + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - + long long blockAllocationTableEntry::reserved @@ -64,19 +65,25 @@ - + - + + + + + + + - blockAllocationTableEntryattributes - blockAllocationTableEntrynextBlock - blockAllocationTableEntryrealSector - blockAllocationTableEntryreserved + blockAllocationTableEntryattributes + blockAllocationTableEntrynextBlock + blockAllocationTableEntryrealSector + blockAllocationTableEntryreserved diff --git a/doc/xml/structbootSect.xml b/doc/xml/structbootSect.xml index 8b45ad9..5cbae4b 100644 --- a/doc/xml/structbootSect.xml +++ b/doc/xml/structbootSect.xml @@ -1,11 +1,11 @@ - - - + + + bootSect - ubixfs.h + ubixfs.h - - uInt + + uInt uInt bootSect::BytesPerSector BytesPerSector @@ -15,10 +15,10 @@ - + - - uInt8 + + uInt8 uInt8 bootSect::code[479] [479] code @@ -28,10 +28,10 @@ - + - - uInt16 + + uInt16 uInt16 bootSect::fsStart fsStart @@ -41,10 +41,10 @@ - + - - uInt8 + + uInt8 uInt8 bootSect::id[6] [6] id @@ -54,10 +54,10 @@ - + - - uInt8 + + uInt8 uInt8 bootSect::jmp[4] [4] jmp @@ -67,10 +67,10 @@ - + - - uInt32 + + uInt32 uInt32 bootSect::krnl_start krnl_start @@ -80,10 +80,10 @@ - + - - uInt + + uInt uInt bootSect::SectersPerTrack SectersPerTrack @@ -93,10 +93,10 @@ - + - - uInt16 + + uInt16 uInt16 bootSect::tmp tmp @@ -106,10 +106,10 @@ - + - - uInt16 + + uInt16 uInt16 bootSect::tmp2 tmp2 @@ -119,10 +119,10 @@ - + - - uInt + + uInt uInt bootSect::TotalHeads TotalHeads @@ -132,10 +132,10 @@ - + - - uInt32 + + uInt32 uInt32 bootSect::TotalSectors TotalSectors @@ -145,10 +145,10 @@ - + - - uInt16 + + uInt16 uInt16 bootSect::version version @@ -158,27 +158,33 @@ - + - + + + + + + + - bootSectBytesPerSector - bootSectcode - bootSectfsStart - bootSectid - bootSectjmp - bootSectkrnl_start - bootSectSectersPerTrack - bootSecttmp - bootSecttmp2 - bootSectTotalHeads - bootSectTotalSectors - bootSectversion + bootSectBytesPerSector + bootSectcode + bootSectfsStart + bootSectid + bootSectjmp + bootSectkrnl_start + bootSectSectersPerTrack + bootSecttmp + bootSecttmp2 + bootSectTotalHeads + bootSectTotalSectors + bootSectversion diff --git a/doc/xml/structbsd__disklabel.xml b/doc/xml/structbsd__disklabel.xml index 663f832..c1d2228 100644 --- a/doc/xml/structbsd__disklabel.xml +++ b/doc/xml/structbsd__disklabel.xml @@ -1,12 +1,12 @@ - - - + + + bsd_disklabel hd.h bsd_disklabel::partition - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_acylinders d_acylinders @@ -16,10 +16,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_bbsize d_bbsize @@ -29,10 +29,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_checksum d_checksum @@ -42,10 +42,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_cylskew d_cylskew @@ -55,10 +55,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_drivedata[5] [5] d_drivedata @@ -68,10 +68,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_flags d_flags @@ -81,10 +81,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_headswitch d_headswitch @@ -94,10 +94,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_interleave d_interleave @@ -107,10 +107,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_magic d_magic @@ -120,10 +120,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_magic2 d_magic2 @@ -133,10 +133,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_ncylinders d_ncylinders @@ -146,10 +146,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_npartitions d_npartitions @@ -159,11 +159,10 @@ - - initHardDisk + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_nsectors d_nsectors @@ -173,10 +172,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_ntracks d_ntracks @@ -186,9 +185,9 @@ - + - + char char bsd_disklabel::d_packname[16] [16] @@ -199,10 +198,10 @@ - + - - bsd_disklabel::partition + + struct bsd_disklabel::partition struct bsd_disklabel::partition bsd_disklabel::d_partitions[ 8 ] [8] d_partitions @@ -212,11 +211,10 @@ - - initHardDisk + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_rpm d_rpm @@ -226,10 +224,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_sbsize d_sbsize @@ -239,10 +237,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_secpercyl d_secpercyl @@ -252,10 +250,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_secperunit d_secperunit @@ -265,10 +263,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_secsize d_secsize @@ -278,10 +276,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_spare[5] [5] d_spare @@ -291,10 +289,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_sparespercyl d_sparespercyl @@ -304,10 +302,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_sparespertrack d_sparespertrack @@ -317,10 +315,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_subtype d_subtype @@ -330,10 +328,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_trackskew d_trackskew @@ -343,10 +341,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::d_trkseek d_trkseek @@ -356,10 +354,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::d_type d_type @@ -369,9 +367,9 @@ - + - + char char bsd_disklabel::d_typename[16] [16] @@ -382,7 +380,7 @@ - + @@ -390,49 +388,49 @@ - + - - d_partitions + + +d_partitions - + - + - bsd_disklabeld_acylinders - bsd_disklabeld_bbsize - bsd_disklabeld_checksum - bsd_disklabeld_cylskew - bsd_disklabeld_drivedata - bsd_disklabeld_flags - bsd_disklabeld_headswitch - bsd_disklabeld_interleave - bsd_disklabeld_magic - bsd_disklabeld_magic2 - bsd_disklabeld_ncylinders - bsd_disklabeld_npartitions - bsd_disklabeld_nsectors - bsd_disklabeld_ntracks - bsd_disklabeld_packname - bsd_disklabeld_partitions - bsd_disklabeld_rpm - bsd_disklabeld_sbsize - bsd_disklabeld_secpercyl - bsd_disklabeld_secperunit - bsd_disklabeld_secsize - bsd_disklabeld_spare - bsd_disklabeld_sparespercyl - bsd_disklabeld_sparespertrack - bsd_disklabeld_subtype - bsd_disklabeld_trackskew - bsd_disklabeld_trkseek - bsd_disklabeld_type - bsd_disklabeld_typename + bsd_disklabeld_acylinders + bsd_disklabeld_bbsize + bsd_disklabeld_checksum + bsd_disklabeld_cylskew + bsd_disklabeld_drivedata + bsd_disklabeld_flags + bsd_disklabeld_headswitch + bsd_disklabeld_interleave + bsd_disklabeld_magic + bsd_disklabeld_magic2 + bsd_disklabeld_ncylinders + bsd_disklabeld_npartitions + bsd_disklabeld_nsectors + bsd_disklabeld_ntracks + bsd_disklabeld_packname + bsd_disklabeld_partitions + bsd_disklabeld_rpm + bsd_disklabeld_sbsize + bsd_disklabeld_secpercyl + bsd_disklabeld_secperunit + bsd_disklabeld_secsize + bsd_disklabeld_spare + bsd_disklabeld_sparespercyl + bsd_disklabeld_sparespertrack + bsd_disklabeld_subtype + bsd_disklabeld_trackskew + bsd_disklabeld_trkseek + bsd_disklabeld_type + bsd_disklabeld_typename diff --git a/doc/xml/structbsd__disklabel_1_1partition.xml b/doc/xml/structbsd__disklabel_1_1partition.xml index 567401b..3fafdac 100644 --- a/doc/xml/structbsd__disklabel_1_1partition.xml +++ b/doc/xml/structbsd__disklabel_1_1partition.xml @@ -1,11 +1,11 @@ - - - + + + bsd_disklabel::partition hd.h - - u_int16_t + + u_int16_t u_int16_t bsd_disklabel::partition::p_cpg p_cpg @@ -15,10 +15,10 @@ - + - - u_int8_t + + u_int8_t u_int8_t bsd_disklabel::partition::p_frag p_frag @@ -28,10 +28,10 @@ - + - - uint32_t + + uint32_t uint32_t bsd_disklabel::partition::p_fsize p_fsize @@ -41,10 +41,10 @@ - + - - u_int8_t + + u_int8_t u_int8_t bsd_disklabel::partition::p_fstype p_fstype @@ -54,11 +54,10 @@ - - initHardDisk + - - uint32_t + + uint32_t uint32_t bsd_disklabel::partition::p_offset p_offset @@ -68,11 +67,10 @@ - - initHardDisk + - - uint32_t + + uint32_t uint32_t bsd_disklabel::partition::p_size p_size @@ -82,22 +80,27 @@ - - initHardDisk + - + + + + + + + - bsd_disklabel::partitionp_cpg - bsd_disklabel::partitionp_frag - bsd_disklabel::partitionp_fsize - bsd_disklabel::partitionp_fstype - bsd_disklabel::partitionp_offset - bsd_disklabel::partitionp_size + bsd_disklabel::partitionp_cpg + bsd_disklabel::partitionp_frag + bsd_disklabel::partitionp_fsize + bsd_disklabel::partitionp_fstype + bsd_disklabel::partitionp_offset + bsd_disklabel::partitionp_size diff --git a/doc/xml/structbuf.xml b/doc/xml/structbuf.xml index 2d52987..a0d129d 100644 --- a/doc/xml/structbuf.xml +++ b/doc/xml/structbuf.xml @@ -1,13 +1,19 @@ - - - + + + buf buf.h - + + + + + + + diff --git a/doc/xml/structcacheNode.xml b/doc/xml/structcacheNode.xml index b08063b..fccdf0c 100644 --- a/doc/xml/structcacheNode.xml +++ b/doc/xml/structcacheNode.xml @@ -1,11 +1,11 @@ - - - + + + cacheNode dirCache.h - - uInt16 * + + uInt16 * uInt16* cacheNode::attributes attributes @@ -15,12 +15,11 @@ - - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize + + ubixfs_cacheNew + ubixfs_initialize - + int int cacheNode::dirty @@ -31,11 +30,11 @@ - - ubixfs_cacheNew + + ubixfs_cacheNew - - cacheNode * + + struct cacheNode * struct cacheNode* cacheNode::fileListHead fileListHead @@ -45,14 +44,12 @@ - - ubixfs_cacheAdd - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew + + ubixfs_cacheDelete + ubixfs_cacheNew - - cacheNode * + + struct cacheNode * struct cacheNode* cacheNode::fileListTail fileListTail @@ -62,12 +59,10 @@ - - ubixfs_cacheAdd - ubixfs_cacheFind - ubixfs_cacheNew + + ubixfs_cacheNew - + void * void* cacheNode::info @@ -78,15 +73,13 @@ - - openFileUbixFS - readUbixFS - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize + + readUbixFS + ubixfs_cacheDelete + ubixfs_cacheNew + ubixfs_initialize - + char * char* cacheNode::name @@ -97,13 +90,12 @@ - - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew + + ubixfs_cacheDelete + ubixfs_cacheNew - - cacheNode * + + struct cacheNode * struct cacheNode* cacheNode::next next @@ -113,14 +105,12 @@ - - ubixfs_cacheAdd - ubixfs_cacheDelete - ubixfs_cacheFind - ubixfs_cacheNew + + ubixfs_cacheDelete + ubixfs_cacheNew - - cacheNode * + + struct cacheNode * struct cacheNode* cacheNode::parent parent @@ -130,13 +120,11 @@ - - ubixfs_cacheAdd - ubixfs_cacheFind - ubixfs_cacheNew + + ubixfs_cacheNew - - uInt16 * + + uInt16 * uInt16* cacheNode::permissions permissions @@ -146,13 +134,11 @@ - - openFileUbixFS - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize + + ubixfs_cacheNew + ubixfs_initialize - + int int cacheNode::present @@ -163,15 +149,13 @@ - - openFileUbixFS - readUbixFS - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize + + readUbixFS + ubixfs_cacheNew + ubixfs_initialize - - cacheNode * + + struct cacheNode * struct cacheNode* cacheNode::prev prev @@ -181,12 +165,10 @@ - - ubixfs_cacheAdd - ubixfs_cacheFind - ubixfs_cacheNew + + ubixfs_cacheNew - + int * int* cacheNode::size @@ -197,14 +179,12 @@ - - openFileUbixFS - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize + + ubixfs_cacheNew + ubixfs_initialize - - uInt32 * + + uInt32 * uInt32* cacheNode::startCluster startCluster @@ -214,11 +194,9 @@ - - openFileUbixFS - ubixfs_cacheFind - ubixfs_cacheNew - ubixfs_initialize + + ubixfs_cacheNew + ubixfs_initialize @@ -226,33 +204,33 @@ - + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + - cacheNodeattributes - cacheNodedirty - cacheNodefileListHead - cacheNodefileListTail - cacheNodeinfo - cacheNodename - cacheNodenext - cacheNodeparent - cacheNodepermissions - cacheNodepresent - cacheNodeprev - cacheNodesize - cacheNodestartCluster + cacheNodeattributes + cacheNodedirty + cacheNodefileListHead + cacheNodefileListTail + cacheNodeinfo + cacheNodename + cacheNodenext + cacheNodeparent + cacheNodepermissions + cacheNodepresent + cacheNodeprev + cacheNodesize + cacheNodestartCluster diff --git a/doc/xml/structclose__args.xml b/doc/xml/structclose__args.xml index 3daf285..32d3152 100644 --- a/doc/xml/structclose__args.xml +++ b/doc/xml/structclose__args.xml @@ -1,10 +1,10 @@ - - - + + + close_args - sysproto.h + sysproto_posix.h - + int int close_args::fd @@ -15,10 +15,10 @@ - - close + + close - + char char close_args::fd_l_[0] [0] @@ -29,12 +29,12 @@ - + - + char - char close_args::fd_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char close_args::fd_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] fd_r_ @@ -42,18 +42,24 @@ - + - + + + + + + + - close_argsfd - close_argsfd_l_ - close_argsfd_r_ + close_argsfd + close_argsfd_l_ + close_argsfd_r_ diff --git a/doc/xml/structconfadd.xml b/doc/xml/structconfadd.xml index dff2dc0..c4e9d76 100644 --- a/doc/xml/structconfadd.xml +++ b/doc/xml/structconfadd.xml @@ -1,12 +1,12 @@ - - - + + + confadd pci.h - - uInt8 - uInt8 confadd::bus + + uint8_t + uint8_t confadd::bus bus 8 @@ -16,12 +16,13 @@ - - pci_init + + pciRead + pciWrite - - uInt8 - uInt8 confadd::dev + + uint8_t + uint8_t confadd::dev dev 5 @@ -31,12 +32,13 @@ - - pci_init + + pciRead + pciWrite - - uInt8 - uInt8 confadd::enable + + uint8_t + uint8_t confadd::enable enable 1 @@ -46,11 +48,13 @@ - + + pciRead + pciWrite - - uInt8 - uInt8 confadd::func + + uint8_t + uint8_t confadd::func func 3 @@ -60,12 +64,13 @@ - - pci_init + + pciRead + pciWrite - - uInt8 - uInt8 confadd::reg + + uint8_t + uint8_t confadd::reg reg 8 @@ -75,11 +80,13 @@ - + + pciRead + pciWrite - - uInt8 - uInt8 confadd::rsvd + + uint8_t + uint8_t confadd::rsvd rsvd 7 @@ -89,21 +96,27 @@ - + - + + + + + + + - confaddbus - confadddev - confaddenable - confaddfunc - confaddreg - confaddrsvd + confaddbus + confadddev + confaddenable + confaddfunc + confaddreg + confaddrsvd diff --git a/doc/xml/structcpuinfo__t.xml b/doc/xml/structcpuinfo__t.xml index 7b932f3..e8c6a0f 100644 --- a/doc/xml/structcpuinfo__t.xml +++ b/doc/xml/structcpuinfo__t.xml @@ -1,11 +1,11 @@ - - - + + + cpuinfo_t smp.h - - uInt8 + + uInt8 uInt8 cpuinfo_t::apic_id apic_id @@ -15,11 +15,10 @@ - - cpuInfo + - - uInt8 + + uInt8 uInt8 cpuinfo_t::apic_ver apic_ver @@ -29,10 +28,9 @@ - - cpuInfo + - + char char cpuinfo_t::brand[49] [49] @@ -43,11 +41,10 @@ - - cpuInfo + - - uInt32 + + uInt32 uInt32 cpuinfo_t::feature feature @@ -57,11 +54,10 @@ - - cpuInfo + - - uInt8 + + uInt8 uInt8 cpuinfo_t::id id @@ -71,11 +67,9 @@ - - cpuInfo - kernel_function + - + char char cpuinfo_t::ident[17] [17] @@ -86,11 +80,10 @@ - - cpuInfo + - - uInt32 + + uInt32 uInt32 cpuinfo_t::max max @@ -100,11 +93,10 @@ - - cpuInfo + - - uInt8 + + uInt8 uInt8 cpuinfo_t::ok ok @@ -114,11 +106,10 @@ - - cpuInfo + - - uInt32 + + uInt32 uInt32 cpuinfo_t::signature signature @@ -128,25 +119,30 @@ - - cpuInfo + - + + + + + + + - cpuinfo_tapic_id - cpuinfo_tapic_ver - cpuinfo_tbrand - cpuinfo_tfeature - cpuinfo_tid - cpuinfo_tident - cpuinfo_tmax - cpuinfo_tok - cpuinfo_tsignature + cpuinfo_tapic_id + cpuinfo_tapic_ver + cpuinfo_tbrand + cpuinfo_tfeature + cpuinfo_tid + cpuinfo_tident + cpuinfo_tmax + cpuinfo_tok + cpuinfo_tsignature diff --git a/doc/xml/structcsum.xml b/doc/xml/structcsum.xml index 317abf2..6893bb8 100644 --- a/doc/xml/structcsum.xml +++ b/doc/xml/structcsum.xml @@ -1,11 +1,11 @@ - - - + + + csum - ufs.h + fs.h - - int32_t + + int32_t int32_t csum::cs_nbfree cs_nbfree @@ -15,10 +15,10 @@ - + - - int32_t + + int32_t int32_t csum::cs_ndir cs_ndir @@ -28,10 +28,10 @@ - + - - int32_t + + int32_t int32_t csum::cs_nffree cs_nffree @@ -41,10 +41,10 @@ - + - - int32_t + + int32_t int32_t csum::cs_nifree cs_nifree @@ -54,19 +54,25 @@ - + - + + + + + + + - csumcs_nbfree - csumcs_ndir - csumcs_nffree - csumcs_nifree + csumcs_nbfree + csumcs_ndir + csumcs_nffree + csumcs_nifree diff --git a/doc/xml/structcsum__total.xml b/doc/xml/structcsum__total.xml index 854cd11..f14de66 100644 --- a/doc/xml/structcsum__total.xml +++ b/doc/xml/structcsum__total.xml @@ -1,11 +1,11 @@ - - - + + + csum_total - ufs.h + fs.h - - int64_t + + int64_t int64_t csum_total::cs_nbfree cs_nbfree @@ -15,10 +15,10 @@ - + - - int64_t + + int64_t int64_t csum_total::cs_ndir cs_ndir @@ -28,10 +28,10 @@ - + - - int64_t + + int64_t int64_t csum_total::cs_nffree cs_nffree @@ -41,10 +41,10 @@ - + - - int64_t + + int64_t int64_t csum_total::cs_nifree cs_nifree @@ -54,10 +54,10 @@ - + - - int64_t + + int64_t int64_t csum_total::cs_numclusters cs_numclusters @@ -67,11 +67,11 @@ - + - - int64_t - int64_t csum_total::cs_spare[3] + + int64_t + int64_t csum_total::cs_spare [3] cs_spare @@ -80,21 +80,27 @@ - + - + + + + + + + - csum_totalcs_nbfree - csum_totalcs_ndir - csum_totalcs_nffree - csum_totalcs_nifree - csum_totalcs_numclusters - csum_totalcs_spare + csum_totalcs_nbfree + csum_totalcs_ndir + csum_totalcs_nffree + csum_totalcs_nifree + csum_totalcs_numclusters + csum_totalcs_spare diff --git a/doc/xml/structdevMethodType.xml b/doc/xml/structdevMethodType.xml index 9de0ddc..e3edf5c 100644 --- a/doc/xml/structdevMethodType.xml +++ b/doc/xml/structdevMethodType.xml @@ -1,13 +1,19 @@ - - - + + + devMethodType driver.h - + + + + + + + diff --git a/doc/xml/structdevfs__devices.xml b/doc/xml/structdevfs__devices.xml index f50c538..88661f7 100644 --- a/doc/xml/structdevfs__devices.xml +++ b/doc/xml/structdevfs__devices.xml @@ -1,11 +1,11 @@ - - - + + + devfs_devices devfs.h - - uInt16 + + uInt16 uInt16 devfs_devices::devMajor devMajor @@ -15,14 +15,10 @@ - - devfs_makeNode - devfs_open - devfs_read - devfs_write + - - uInt16 + + uInt16 uInt16 devfs_devices::devMinor devMinor @@ -32,13 +28,9 @@ - - devfs_makeNode - devfs_open - devfs_read - devfs_write + - + char char devfs_devices::devName[32] [32] @@ -49,12 +41,10 @@ - - devfs_makeNode - devfs_open + - - uInt8 + + uInt8 uInt8 devfs_devices::devType devType @@ -64,11 +54,10 @@ - - devfs_makeNode + - - devfs_devices * + + struct devfs_devices * struct devfs_devices* devfs_devices::next next @@ -78,12 +67,10 @@ - - devfs_makeNode - devfs_open + - - devfs_devices * + + struct devfs_devices * struct devfs_devices* devfs_devices::prev prev @@ -93,8 +80,7 @@ - - devfs_makeNode + @@ -102,23 +88,23 @@ - + - - prev -next + + +prev + +next - + - devfs_devicesdevMajor - devfs_devicesdevMinor - devfs_devicesdevName - devfs_devicesdevType - devfs_devicesnext - devfs_devicesprev + devfs_devicesdevMajor + devfs_devicesdevMinor + devfs_devicesdevName + devfs_devicesdevType + devfs_devicesnext + devfs_devicesprev diff --git a/doc/xml/structdevfs__info.xml b/doc/xml/structdevfs__info.xml index 1f81443..6599aa3 100644 --- a/doc/xml/structdevfs__info.xml +++ b/doc/xml/structdevfs__info.xml @@ -1,11 +1,11 @@ - - - + + + devfs_info devfs.h - - devfs_devices * + + struct devfs_devices * struct devfs_devices* devfs_info::deviceList deviceList @@ -15,10 +15,7 @@ - - devfs_initialize - devfs_makeNode - devfs_open + @@ -26,25 +23,25 @@ - + - - prev -next + + +prev + +next - + - - deviceList + + +deviceList - + - devfs_infodeviceList + devfs_infodeviceList diff --git a/doc/xml/structdevice.xml b/doc/xml/structdevice.xml index 5240860..bd4f0e7 100644 --- a/doc/xml/structdevice.xml +++ b/doc/xml/structdevice.xml @@ -1,11 +1,11 @@ - - - + + + device device.old.h - - uInt16 + + uInt16 uInt16 device::ioAddr ioAddr @@ -15,16 +15,12 @@ - - dp_recv - getblock - ne2k_init - ne2kHandler - NICtoPC - PCtoNIC + + NICtoPC + PCtoNIC - - uInt32 + + uInt32 uInt32 device::irq irq @@ -34,11 +30,10 @@ - - ne2k_init + - - uInt32 + + uInt32 uInt32 device::mtu mtu @@ -48,10 +43,10 @@ - + - - net * + + struct net * struct net* device::net net @@ -61,10 +56,10 @@ - + - - ei_device * + + struct ei_device * struct ei_device* device::priv priv @@ -74,7 +69,7 @@ - + @@ -82,32 +77,32 @@ - + - + - + - - priv + + +priv - - net + + +net - + - deviceioAddr - deviceirq - devicemtu - devicenet - devicepriv + deviceioAddr + deviceirq + devicemtu + devicenet + devicepriv diff --git a/doc/xml/structdevice__interface.xml b/doc/xml/structdevice__interface.xml index facfd54..d8a8d0c 100644 --- a/doc/xml/structdevice__interface.xml +++ b/doc/xml/structdevice__interface.xml @@ -1,10 +1,10 @@ - - - + + + device_interface - device.h + device.h - + void * void* device_interface::info @@ -15,22 +15,20 @@ - - devfs_read - devfs_write - dskread - hdInit - initHardDisk - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - writeUbixFS + + gptfind + hdInit + media_read + media_write + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - + int(* - int(* device_interface::init)(void *) + int(* device_interface::init) (void *) )(void *) init @@ -39,13 +37,11 @@ - - device_add - fdc_init - initHardDisk + + fdc_init - - uInt8 + + uInt8 uInt8 device_interface::initialized initialized @@ -55,13 +51,12 @@ - - device_add - hdInit + + hdInit - + void(* - void(* device_interface::ioctl)(void *) + void(* device_interface::ioctl) (void *) )(void *) ioctl @@ -70,10 +65,9 @@ - - initHardDisk + - + int int device_interface::major @@ -84,14 +78,12 @@ - - device_find - fdc_init - initHardDisk + + fdc_init - - void(* - void(* device_interface::read)(void *, void *, uInt32, uInt32) + + int(* + int(* device_interface::read) (void *, void *, uInt32, uInt32) )(void *, void *, uInt32, uInt32) read @@ -100,21 +92,17 @@ - - devfs_read - devfs_write - dskread - fdc_init - initHardDisk - openFileUbixFS - ubixfs_initialize - ubixfs_loadData - ubixFSUnlink - writeUbixFS + + fdc_init + media_read + open_fat + ubixfs_initialize + writeFileByte + writeUbixFS - + void(* - void(* device_interface::reset)(void *) + void(* device_interface::reset) (void *) )(void *) reset @@ -123,12 +111,11 @@ - - fdc_init - initHardDisk + + fdc_init - - uInt32 + + uInt32 uInt32 device_interface::size size @@ -138,14 +125,13 @@ - - devfs_open - fdcInit2 - hdInit + + fdcInit2 + hdInit - + void(* - void(* device_interface::standby)(void *) + void(* device_interface::standby) (void *) )(void *) standby @@ -154,12 +140,11 @@ - - initHardDisk + - + void(* - void(* device_interface::start)(void *) + void(* device_interface::start) (void *) )(void *) start @@ -168,12 +153,11 @@ - - initHardDisk + - + void(* - void(* device_interface::stop)(void *) + void(* device_interface::stop) (void *) )(void *) stop @@ -182,12 +166,11 @@ - - initHardDisk + - - void(* - void(* device_interface::write)(void *, void *, uInt32, uInt32) + + int(* + int(* device_interface::write) (void *, void *, uInt32, uInt32) )(void *, void *, uInt32, uInt32) write @@ -196,34 +179,39 @@ - - devfs_write - fdc_init - initHardDisk - syncBat - ubixFSmkDir - ubixFSUnlink - writeUbixFS + + fdc_init + media_write + syncBat + ubixFSmkDir + writeFileByte + writeUbixFS - + + + + + + + - device_interfaceinfo - device_interfaceinit - device_interfaceinitialized - device_interfaceioctl - device_interfacemajor - device_interfaceread - device_interfacereset - device_interfacesize - device_interfacestandby - device_interfacestart - device_interfacestop - device_interfacewrite + device_interfaceinfo + device_interfaceinit + device_interfaceinitialized + device_interfaceioctl + device_interfacemajor + device_interfaceread + device_interfacereset + device_interfacesize + device_interfacestandby + device_interfacestart + device_interfacestop + device_interfacewrite diff --git a/doc/xml/structdevice__node.xml b/doc/xml/structdevice__node.xml index 83a3ba0..8ea0f41 100644 --- a/doc/xml/structdevice__node.xml +++ b/doc/xml/structdevice__node.xml @@ -1,11 +1,11 @@ - - - + + + device_node - device.h + device.h - - device_interface * + + struct device_interface * struct device_interface* device_node::devInfo devInfo @@ -15,25 +15,21 @@ - - devfs_open - devfs_read - devfs_write - device_add - device_find - dskread - fdcInit2 - hdInit - openFileUbixFS - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - writeUbixFS + + device_add + fdcInit2 + hdInit + media_read + media_write + open_fat + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - - device_resource * + + struct device_resource * struct device_resource* device_node::devRec devRec @@ -43,9 +39,9 @@ - + - + int int device_node::minor @@ -56,12 +52,12 @@ - - device_add - device_find + + device_add + vfs_mount - - device_node * + + struct device_node * struct device_node* device_node::next next @@ -71,13 +67,10 @@ - - device_add - device_find - device_remove + - - device_node * + + struct device_node * struct device_node* device_node::prev prev @@ -87,10 +80,10 @@ - - device_add + + device_add - + char char device_node::type @@ -101,8 +94,8 @@ - - device_add + + device_add @@ -110,37 +103,37 @@ - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - + - device_nodedevInfo - device_nodedevRec - device_nodeminor - device_nodenext - device_nodeprev - device_nodetype + device_nodedevInfo + device_nodedevRec + device_nodeminor + device_nodenext + device_nodeprev + device_nodetype diff --git a/doc/xml/structdevice__resource.xml b/doc/xml/structdevice__resource.xml index 73b0557..2d76c52 100644 --- a/doc/xml/structdevice__resource.xml +++ b/doc/xml/structdevice__resource.xml @@ -1,11 +1,11 @@ - - - + + + device_resource - device.h + device.h - - uInt8 + + uInt8 uInt8 device_resource::irq irq @@ -15,16 +15,22 @@ - + - + + + + + + + - device_resourceirq + device_resourceirq diff --git a/doc/xml/structdirectoryEntry.xml b/doc/xml/structdirectoryEntry.xml index c56655a..3d8d30d 100644 --- a/doc/xml/structdirectoryEntry.xml +++ b/doc/xml/structdirectoryEntry.xml @@ -1,11 +1,11 @@ - - - + + + directoryEntry - ubixfs.h + ubixfs.h - - uInt16 + + uInt16 uInt16 directoryEntry::attributes attributes @@ -15,11 +15,11 @@ - - ubixFSmkDir + + ubixFSmkDir - - uInt32 + + uInt32 uInt32 directoryEntry::creationDate creationDate @@ -29,9 +29,9 @@ - + - + char char directoryEntry::fileName[256] [256] @@ -42,14 +42,13 @@ - - ubixfs_findName - ubixFSmkDir - ubixFSUnlink - writeUbixFS + + ubixFSmkDir + writeFileByte + writeUbixFS - - uInt32 + + uInt32 uInt32 directoryEntry::gid gid @@ -59,10 +58,10 @@ - + - - uInt32 + + uInt32 uInt32 directoryEntry::lastModified lastModified @@ -72,10 +71,10 @@ - + - - uInt16 + + uInt16 uInt16 directoryEntry::permissions permissions @@ -85,11 +84,11 @@ - - ubixFSmkDir + + ubixFSmkDir - - uInt32 + + uInt32 uInt32 directoryEntry::size size @@ -99,12 +98,13 @@ - - ubixFSmkDir - writeUbixFS + + ubixFSmkDir + writeFileByte + writeUbixFS - - uInt32 + + uInt32 uInt32 directoryEntry::startCluster startCluster @@ -114,12 +114,12 @@ - - ubixFSmkDir - writeUbixFS + + ubixFSmkDir + writeUbixFS - - uInt32 + + uInt32 uInt32 directoryEntry::uid uid @@ -129,24 +129,30 @@ - + - + + + + + + + - directoryEntryattributes - directoryEntrycreationDate - directoryEntryfileName - directoryEntrygid - directoryEntrylastModified - directoryEntrypermissions - directoryEntrysize - directoryEntrystartCluster - directoryEntryuid + directoryEntryattributes + directoryEntrycreationDate + directoryEntryfileName + directoryEntrygid + directoryEntrylastModified + directoryEntrypermissions + directoryEntrysize + directoryEntrystartCluster + directoryEntryuid diff --git a/doc/xml/structdirectoryList.xml b/doc/xml/structdirectoryList.xml index eff1ed3..e289c84 100644 --- a/doc/xml/structdirectoryList.xml +++ b/doc/xml/structdirectoryList.xml @@ -1,11 +1,11 @@ - - - + + + directoryList - ubixfs.h + ubixfs.h - - uInt32 + + uInt32 uInt32 directoryList::dirBlock dirBlock @@ -15,9 +15,9 @@ - + - + char * char* directoryList::dirCache @@ -28,10 +28,9 @@ - - ubixFSLoadDir + - + char char directoryList::dirName[256] [256] @@ -42,11 +41,11 @@ - - ubixFSLoadDir + + ubixFSLoadDir - - directoryList * + + struct directoryList * struct directoryList* directoryList::next next @@ -56,11 +55,10 @@ - - ubixFSLoadDir + - - directoryList * + + struct directoryList * struct directoryList* directoryList::prev prev @@ -70,8 +68,7 @@ - - ubixFSLoadDir + @@ -79,22 +76,22 @@ - + - - prev -next + + +prev + +next - + - directoryListdirBlock - directoryListdirCache - directoryListdirName - directoryListnext - directoryListprev + directoryListdirBlock + directoryListdirCache + directoryListdirName + directoryListnext + directoryListprev diff --git a/doc/xml/structdirent.xml b/doc/xml/structdirent.xml index d2e06c4..91983e5 100644 --- a/doc/xml/structdirent.xml +++ b/doc/xml/structdirent.xml @@ -1,11 +1,11 @@ - - - + + + dirent ufs.h - - __uint32_t + + __uint32_t __uint32_t dirent::d_fileno d_fileno @@ -15,10 +15,9 @@ - - fsfind + - + char char dirent::d_name[255+1] [255+1] @@ -29,11 +28,10 @@ - - fsfind + - - __uint8_t + + __uint8_t __uint8_t dirent::d_namlen d_namlen @@ -43,10 +41,10 @@ - + - - __uint16_t + + __uint16_t __uint16_t dirent::d_reclen d_reclen @@ -56,11 +54,10 @@ - - fsfind + - - __uint8_t + + __uint8_t __uint8_t dirent::d_type d_type @@ -70,21 +67,26 @@ - - fsfind + - + + + + + + + - direntd_fileno - direntd_name - direntd_namlen - direntd_reclen - direntd_type + direntd_fileno + direntd_name + direntd_namlen + direntd_reclen + direntd_type diff --git a/doc/xml/structdmadat.xml b/doc/xml/structdmadat.xml index ca5f5a4..3447eb6 100644 --- a/doc/xml/structdmadat.xml +++ b/doc/xml/structdmadat.xml @@ -1,10 +1,10 @@ - - - + + + dmadat - file.h + file.h - + char char dmadat::blkbuf[(1<< 12)] [(1<< 12)] @@ -15,10 +15,9 @@ - - fsread + - + char char dmadat::indbuf[(1<< 12)] [(1<< 12)] @@ -29,10 +28,9 @@ - - fsread + - + char char dmadat::sbbuf[8192] [8192] @@ -43,11 +41,10 @@ - - ffs_read - fsread + + ffs_read - + char char dmadat::secbuf[(1<< 9)] [(1<< 9)] @@ -58,19 +55,25 @@ - + - + + + + + + + - dmadatblkbuf - dmadatindbuf - dmadatsbbuf - dmadatsecbuf + dmadatblkbuf + dmadatindbuf + dmadatsbbuf + dmadatsecbuf diff --git a/doc/xml/structdos__partition.xml b/doc/xml/structdos__partition.xml index 0c2829f..58606e6 100644 --- a/doc/xml/structdos__partition.xml +++ b/doc/xml/structdos__partition.xml @@ -1,10 +1,10 @@ - - - + + + dos_partition hd.h - + unsigned char unsigned char dos_partition::dp_ecyl @@ -15,9 +15,9 @@ - + - + unsigned char unsigned char dos_partition::dp_ehd @@ -28,9 +28,9 @@ - + - + unsigned char unsigned char dos_partition::dp_esect @@ -41,9 +41,9 @@ - + - + unsigned char unsigned char dos_partition::dp_flag @@ -54,9 +54,9 @@ - + - + unsigned char unsigned char dos_partition::dp_scyl @@ -67,9 +67,9 @@ - + - + unsigned char unsigned char dos_partition::dp_shd @@ -80,10 +80,10 @@ - + - - uInt32 + + uInt32 uInt32 dos_partition::dp_size dp_size @@ -93,9 +93,9 @@ - + - + unsigned char unsigned char dos_partition::dp_ssect @@ -106,10 +106,10 @@ - + - - uInt32 + + uInt32 uInt32 dos_partition::dp_start dp_start @@ -119,10 +119,9 @@ - - initHardDisk + - + unsigned char unsigned char dos_partition::dp_type @@ -133,25 +132,31 @@ - + - + + + + + + + - dos_partitiondp_ecyl - dos_partitiondp_ehd - dos_partitiondp_esect - dos_partitiondp_flag - dos_partitiondp_scyl - dos_partitiondp_shd - dos_partitiondp_size - dos_partitiondp_ssect - dos_partitiondp_start - dos_partitiondp_type + dos_partitiondp_ecyl + dos_partitiondp_ehd + dos_partitiondp_esect + dos_partitiondp_flag + dos_partitiondp_scyl + dos_partitiondp_shd + dos_partitiondp_size + dos_partitiondp_ssect + dos_partitiondp_start + dos_partitiondp_type diff --git a/doc/xml/structdp__rcvhdr.xml b/doc/xml/structdp__rcvhdr.xml index 1e352ea..d053791 100644 --- a/doc/xml/structdp__rcvhdr.xml +++ b/doc/xml/structdp__rcvhdr.xml @@ -1,11 +1,11 @@ - - - + + + dp_rcvhdr ne2k.h - - uInt8 + + uInt8 uInt8 dp_rcvhdr::dr_next dr_next @@ -15,10 +15,10 @@ - + - - uInt8 + + uInt8 uInt8 dp_rcvhdr::dr_rbch dr_rbch @@ -28,10 +28,10 @@ - + - - uInt8 + + uInt8 uInt8 dp_rcvhdr::dr_rbcl dr_rbcl @@ -41,10 +41,10 @@ - + - - uInt8 + + uInt8 uInt8 dp_rcvhdr::dr_status dr_status @@ -54,19 +54,25 @@ - + - + + + + + + + - dp_rcvhdrdr_next - dp_rcvhdrdr_rbch - dp_rcvhdrdr_rbcl - dp_rcvhdrdr_status + dp_rcvhdrdr_next + dp_rcvhdrdr_rbch + dp_rcvhdrdr_rbcl + dp_rcvhdrdr_status diff --git a/doc/xml/structdriveInfo.xml b/doc/xml/structdriveInfo.xml index c158911..99963a7 100644 --- a/doc/xml/structdriveInfo.xml +++ b/doc/xml/structdriveInfo.xml @@ -1,11 +1,25 @@ - - - + + + driveInfo hd.h - - driveDiskLabel * + + struct ata_identify_data * + struct ata_identify_data* driveInfo::ata_identify + + ata_identify + + + + + + + + hdInit + + + struct driveDiskLabel * struct driveDiskLabel* driveInfo::diskLabel diskLabel @@ -15,9 +29,9 @@ - + - + long long driveInfo::hdCalc @@ -28,11 +42,11 @@ - - hdRead - hdWrite + + hdRead + hdWrite - + char char driveInfo::hdDev @@ -43,13 +57,12 @@ - - hdInit - hdRead - hdWrite - initHardDisk + + hdInit + hdRead + hdWrite - + char char driveInfo::hdEnable @@ -60,12 +73,12 @@ - - hdInit - hdRead - hdWrite + + hdInit + hdRead + hdWrite - + char char driveInfo::hdFlags @@ -76,9 +89,9 @@ - + - + long long driveInfo::hdMask @@ -89,12 +102,12 @@ - - hdInit + + hdInit - - long - long driveInfo::hdMulti + + uint32_t + uint32_t driveInfo::hdMulti hdMulti @@ -103,12 +116,12 @@ - - hdInit - hdRead - hdWrite + + hdInit + hdRead + hdWrite - + long long driveInfo::hdPort @@ -119,27 +132,12 @@ - - hdInit - hdRead - hdWrite - initHardDisk + + hdInit + hdRead + hdWrite - - char - char driveInfo::hdSector[512] - [512] - hdSector - - - - - - - - hdInit - - + char char driveInfo::hdShift @@ -150,12 +148,12 @@ - - hdInit - hdRead - hdWrite + + hdInit + hdRead + hdWrite - + long long driveInfo::hdSize @@ -166,11 +164,66 @@ - - hdInit - initHardDisk + + hdInit - + + long + long driveInfo::lba_end + + lba_end + + + + + + + + + + uint32_t + uint32_t driveInfo::lba_high + + lba_high + + + + + + + + hdInit + + + uint32_t + uint32_t driveInfo::lba_low + + lba_low + + + + + + + + hdInit + + + long + long driveInfo::lba_start + + lba_start + + + + + + + + hdRead + hdWrite + + long long driveInfo::parOffset @@ -181,30 +234,76 @@ - - hdRead - hdWrite - initHardDisk + + hdRead + hdWrite + + + int + int driveInfo::part + + part + + + + + + + + gptfind + + + uint32_t + uint32_t driveInfo::sector_size + + sector_size + + + + + + + + hdInit - + + + + + + + + + + +ata_identify + + + + - driveInfodiskLabel - driveInfohdCalc - driveInfohdDev - driveInfohdEnable - driveInfohdFlags - driveInfohdMask - driveInfohdMulti - driveInfohdPort - driveInfohdSector - driveInfohdShift - driveInfohdSize - driveInfoparOffset + driveInfoata_identify + driveInfodiskLabel + driveInfohdCalc + driveInfohdDev + driveInfohdEnable + driveInfohdFlags + driveInfohdMask + driveInfohdMulti + driveInfohdPort + driveInfohdShift + driveInfohdSize + driveInfolba_end + driveInfolba_high + driveInfolba_low + driveInfolba_start + driveInfoparOffset + driveInfopart + driveInfosector_size diff --git a/doc/xml/structdriverType.xml b/doc/xml/structdriverType.xml index 4addd41..287e59e 100644 --- a/doc/xml/structdriverType.xml +++ b/doc/xml/structdriverType.xml @@ -1,11 +1,11 @@ - - - + + + driverType driver.h - - const char * + + const char * const char* driverType::devName devName @@ -15,10 +15,10 @@ - + - - devMethod * + + devMethod * devMethod* driverType::methods methods @@ -28,7 +28,7 @@ - + @@ -36,22 +36,22 @@ - + - + - - methods + + +methods - + - driverTypedevName - driverTypemethods + driverTypedevName + driverTypemethods diff --git a/doc/xml/structei__device.xml b/doc/xml/structei__device.xml index 1f19580..f79188a 100644 --- a/doc/xml/structei__device.xml +++ b/doc/xml/structei__device.xml @@ -1,10 +1,10 @@ - - - + + + ei_device device.old.h - + int int ei_device::currentPage @@ -15,10 +15,10 @@ - + - - uInt32 + + uInt32 uInt32 ei_device::pingPong pingPong @@ -28,9 +28,9 @@ - + - + int int ei_device::rxStartPage @@ -41,9 +41,9 @@ - + - + int int ei_device::stopPage @@ -54,9 +54,9 @@ - + - + int int ei_device::tx1 @@ -67,9 +67,9 @@ - + - + int int ei_device::tx2 @@ -80,9 +80,9 @@ - + - + int int ei_device::txStartPage @@ -93,10 +93,10 @@ - + - - uInt16 + + uInt16 uInt16 ei_device::word16 word16 @@ -106,23 +106,29 @@ - + - + + + + + + + - ei_devicecurrentPage - ei_devicepingPong - ei_devicerxStartPage - ei_devicestopPage - ei_devicetx1 - ei_devicetx2 - ei_devicetxStartPage - ei_deviceword16 + ei_devicecurrentPage + ei_devicepingPong + ei_devicerxStartPage + ei_devicestopPage + ei_devicetx1 + ei_devicetx2 + ei_devicetxStartPage + ei_deviceword16 diff --git a/doc/xml/structeth__addr.xml b/doc/xml/structeth__addr.xml index 799e3fd..560406e 100644 --- a/doc/xml/structeth__addr.xml +++ b/doc/xml/structeth__addr.xml @@ -1,16 +1,16 @@ - - - + + + eth_addr - arp.h + ethernet.h - + - eth_addr::PACK_STRUCT_FIELD - (uInt8 addr[6]) - PACK_STRUCT_FIELD + eth_addr::PACK_STRUCT_FLD_8 + (u8_t addr[6]) + PACK_STRUCT_FLD_8 - uInt8 + u8_t addr [6] @@ -20,16 +20,22 @@ - + - + + + + + + + - eth_addrPACK_STRUCT_FIELD + eth_addrPACK_STRUCT_FLD_8 diff --git a/doc/xml/structeth__hdr.xml b/doc/xml/structeth__hdr.xml index 2419079..b91e4c2 100644 --- a/doc/xml/structeth__hdr.xml +++ b/doc/xml/structeth__hdr.xml @@ -1,16 +1,16 @@ - - - + + + eth_hdr - arp.h + ethernet.h - + eth_hdr::PACK_STRUCT_FIELD - (uInt16 type) + (u16_t type) PACK_STRUCT_FIELD - uInt16 + u16_t type @@ -19,30 +19,13 @@ - + - + - eth_hdr::PACK_STRUCT_FIELD - (struct eth_addr src) - PACK_STRUCT_FIELD - - struct eth_addr - src - - - - - - - - - - - - eth_hdr::PACK_STRUCT_FIELD + eth_hdr::PACK_STRUCT_FLD_S (struct eth_addr dest) - PACK_STRUCT_FIELD + PACK_STRUCT_FLD_S struct eth_addr dest @@ -53,18 +36,42 @@ - + + + + + eth_hdr::PACK_STRUCT_FLD_S + (struct eth_addr src) + PACK_STRUCT_FLD_S + + struct eth_addr + src + + + + + + + + +Ethernet header - + + + + + + + - eth_hdrPACK_STRUCT_FIELD - eth_hdrPACK_STRUCT_FIELD - eth_hdrPACK_STRUCT_FIELD + eth_hdrPACK_STRUCT_FIELD + eth_hdrPACK_STRUCT_FLD_S + eth_hdrPACK_STRUCT_FLD_S diff --git a/doc/xml/structethernetif.xml b/doc/xml/structethernetif.xml index caccb7a..241845d 100644 --- a/doc/xml/structethernetif.xml +++ b/doc/xml/structethernetif.xml @@ -1,10 +1,10 @@ - - - + + + ethernetif - - eth_addr * + + struct eth_addr * struct eth_addr* ethernetif::ethaddr ethaddr @@ -14,32 +14,30 @@ - - ethernetif_input - ethernetif_output - low_level_init + +Helper struct to hold private data used to operate your ethernet interface. Keeping the ethernet address of the MAC in this struct is not necessary as it is already kept in the struct netif. But this is only an example, anyway... - + - + - - ethaddr + + +ethaddr - + - ethernetifethaddr + ethernetifethaddr diff --git a/doc/xml/structethip__hdr.xml b/doc/xml/structethip__hdr.xml index 69c65fe..3a933d4 100644 --- a/doc/xml/structethip__hdr.xml +++ b/doc/xml/structethip__hdr.xml @@ -1,26 +1,9 @@ - - - + + + ethip_hdr - - - ethip_hdr::PACK_STRUCT_FIELD - (struct ip_hdr ip) - PACK_STRUCT_FIELD - - struct ip_hdr - ip - - - - - - - - - - + ethip_hdr::PACK_STRUCT_FIELD (struct eth_hdr eth) @@ -35,17 +18,40 @@ - + + + + + ethip_hdr::PACK_STRUCT_FIELD + (struct ip_hdr ip) + PACK_STRUCT_FIELD + + struct ip_hdr + ip + + + + + + + + - + + + + + + + - ethip_hdrPACK_STRUCT_FIELD - ethip_hdrPACK_STRUCT_FIELD + ethip_hdrPACK_STRUCT_FIELD + ethip_hdrPACK_STRUCT_FIELD diff --git a/doc/xml/structfcntl__args.xml b/doc/xml/structfcntl__args.xml index c007979..c75dfef 100644 --- a/doc/xml/structfcntl__args.xml +++ b/doc/xml/structfcntl__args.xml @@ -1,10 +1,10 @@ - - - + + + fcntl_args - sysproto.h + sysproto_posix.h - + long long fcntl_args::arg @@ -15,10 +15,9 @@ - - fcntl + - + char char fcntl_args::arg_l_[0] [0] @@ -29,12 +28,12 @@ - + - + char - char fcntl_args::arg_r_[(sizeof(register_t)<=sizeof(long)?0:sizeof(register_t)-sizeof(long))] - [(sizeof(register_t)<=sizeof(long)?0:sizeof(register_t)-sizeof(long))] + char fcntl_args::arg_r_[(sizeof(register_t)<=sizeof(long) ? 0 :sizeof(register_t) - sizeof(long))] + [(sizeof(register_t)<=sizeof(long) ? 0 :sizeof(register_t) - sizeof(long))] arg_r_ @@ -42,9 +41,9 @@ - + - + int int fcntl_args::cmd @@ -55,10 +54,9 @@ - - fcntl + - + char char fcntl_args::cmd_l_[0] [0] @@ -69,12 +67,12 @@ - + - + char - char fcntl_args::cmd_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char fcntl_args::cmd_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] cmd_r_ @@ -82,9 +80,9 @@ - + - + int int fcntl_args::fd @@ -95,10 +93,9 @@ - - fcntl + - + char char fcntl_args::fd_l_[0] [0] @@ -109,12 +106,12 @@ - + - + char - char fcntl_args::fd_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char fcntl_args::fd_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] fd_r_ @@ -122,24 +119,30 @@ - + - + + + + + + + - fcntl_argsarg - fcntl_argsarg_l_ - fcntl_argsarg_r_ - fcntl_argscmd - fcntl_argscmd_l_ - fcntl_argscmd_r_ - fcntl_argsfd - fcntl_argsfd_l_ - fcntl_argsfd_r_ + fcntl_argsarg + fcntl_argsarg_l_ + fcntl_argsarg_r_ + fcntl_argscmd + fcntl_argscmd_l_ + fcntl_argscmd_r_ + fcntl_argsfd + fcntl_argsfd_l_ + fcntl_argsfd_r_ diff --git a/doc/xml/structfile.xml b/doc/xml/structfile.xml index b6031c4..241ad1d 100644 --- a/doc/xml/structfile.xml +++ b/doc/xml/structfile.xml @@ -1,12 +1,29 @@ - - - + + + file - kern_descrip.h + descrip.h - - int - int file::f_flag + + void * + void* file::data + + data + + + + + + + + sys_close + sys_pipe2 + sys_read + sys_write + + + uint32_t + uint32_t file::f_flag f_flag @@ -15,14 +32,41 @@ - - fcntl - pipe - schedNewTask + + fcntl + kern_openat + pipe + schedNewTask - - fileDescriptor * - fileDescriptor* file::fd + + struct fileOps * + struct fileOps* file::f_ops + + f_ops + + + + + + + + + + uint16_t + uint16_t file::f_type + + f_type + + + + + + + + + + fileDescriptor_t * + fileDescriptor_t* file::fd fd @@ -31,24 +75,66 @@ - - pipe - read - sys_open + + dup2 + fclose + fdestroy + feof + fgetc + fputc + fread + getfd + kern_openat + pipe + read + sys_close + sys_fchdir + sys_fstat + sys_fstatat + sys_fstatfs + sys_getdirentries + sys_lseek + sys_mmap + sys_openat + sys_pread + sys_read + sys_sendto + sys_setsockopt + sys_socket + sys_statfs + sys_write - - char - char file::path[1024] - [1024] - path + + int + int file::fd_type + + fd_type - - sys_open + + sys_close + sys_pipe2 + sys_read + sys_socket + sys_write + + + int + int file::socket + + socket + + + + + + + + sys_socket @@ -56,109 +142,315 @@ - + + + + + + + + + + + + + + + + + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + + + + + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + + + + + + + + + - - fd + + +fd + + + +f_ops - + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + + + + + +exec + +root + +pwd + + + +parent + +prev + +next + + + +i387 + + + +td + + + +files + + + +term + + + +oInfo + + + +tss + + + + + + + - + + + + + +wait + + + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + - + + + + + +wait + + + + + + + +task + + + +next + + + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + + + + + + + + + + + - - prev -next + + +prev + +next - + - filef_flag - filefd - filepath + filedata + filef_flag + filef_ops + filef_type + filefd + filefd_type + filesocket diff --git a/doc/xml/structfileDescriptor.xml b/doc/xml/structfileDescriptor.xml index 64f2a0f..4e7c8f3 100644 --- a/doc/xml/structfileDescriptor.xml +++ b/doc/xml/structfileDescriptor.xml @@ -1,12 +1,130 @@ - - - + + + fileDescriptor - file.h + file.h - - void * - void* fileDescriptor::inode + + char * + char* fileDescriptor::buffer + + buffer + + + + + + + + fopen + writeFileByte + writeUbixFS + + + struct cacheNode * + struct cacheNode* fileDescriptor::cacheNode + + cacheNode + + + + + + + + readUbixFS + + + struct dmadat * + struct dmadat* fileDescriptor::dmadat + + dmadat + + + + + + + + ffs_read + + + int + int fileDescriptor::dsk_meta + + dsk_meta + + + + + + + + + + int + int fileDescriptor::dup + + dup + + + + + + + + dup2 + + + int + int fileDescriptor::fd_type + + fd_type + + + + + + + + + + char + char fileDescriptor::fileName[512] + [512] + fileName + + + + + + + + fopen + sys_fchdir + writeFileByte + writeUbixFS + + + uint32_t + uint32_t fileDescriptor::ino + + ino + + + + + + + + _sys_stat + open_fat + sys_fstat + sys_fstatat + + + struct inode + struct inode fileDescriptor::inode inode @@ -15,16 +133,66 @@ - - UbixFS::vfs_init - UbixFS::vfs_mkdir - UbixFS::vfs_open - UbixFS::vfs_read - UbixFS::vfs_stop - UbixFS::vfs_write + + _sys_stat + sys_fstat + sys_fstatat - - fileDescriptor * + + uint16_t + uint16_t fileDescriptor::length + + length + + + + + + + + + + uint16_t + uint16_t fileDescriptor::mode + + mode + + + + + + + + fopen + open_fat + + + struct vfs_mountPoint * + struct vfs_mountPoint* fileDescriptor::mp + + mp + + + + + + + + fgetc + fopen + fputc + fread + freeBlocks + getFreeBlocks + open_fat + readUbixFS + sysMkDir + ubixFSmkDir + writeFileByte + writeUbixFS + + + struct fileDescriptor * struct fileDescriptor* fileDescriptor::next next @@ -34,12 +202,10 @@ - - fclose - fopen + - - off_t + + off_t off_t fileDescriptor::offset offset @@ -49,21 +215,34 @@ - - addDirEntry - fgetc - fopen - fputc - fread - fseek - fsfind - fsread - fwrite - ufs_openFile - UbixFS::vfs_open + + addDirEntry + fgetc + fputc + fread + open_fat + sys_fseek + sys_lseek + sys_pread - - fileDescriptor * + + uint32_t + uint32_t fileDescriptor::perms + + perms + + + + + + + + execFile + open_fat + sysExec + + + struct fileDescriptor * struct fileDescriptor* fileDescriptor::prev prev @@ -73,13 +252,42 @@ - - fclose - fopen + - - size_t - size_t fileDescriptor::size + + void * + void* fileDescriptor::res + + res + + + + + + + + open_fat + read_fat + sys_fstat + sys_write + write_fat + + + uint32_t + uint32_t fileDescriptor::resid + + resid + + + + + + + + + + uint32_t + uint32_t fileDescriptor::size size @@ -88,14 +296,45 @@ - - addDirEntry - devfs_open - fsread - openFileUbixFS - readUbixFS - UbixFS::vfs_open - writeUbixFS + + addDirEntry + open_fat + readUbixFS + sys_fopen + sys_fstat + writeFileByte + writeUbixFS + + + uint32_t + uint32_t fileDescriptor::start + + start + + + + + + + + writeFileByte + writeUbixFS + + + uint16_t + uint16_t fileDescriptor::status + + status + + + + + + + + feof + readUbixFS + writeFileByte @@ -103,22 +342,315 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + +devRec + + + +devInfo + + + +prev + +next + + + + + + + + + + + +fat_wait + + + + + + + +sa_mask + + + + + + + +parent + +fileListTail + +fileListHead + +prev + +next + + + + + + + +i_old + +i_depend + + + + + + + +partitions + + + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + + + + + + + + + + + + + + + + + +diskLabel + + + +device + + + +fs + + + +prev + +next + + + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + + + + + +exec + +root + +pwd + + + +parent + +prev + +next + + + +i387 + + + +td + + + +files + + + +term + + + +oInfo + + + +tss + + + + + + + + + + + + + + + +wait + + + - - prev -next + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + + + + + + + + + +wait + + + + + + + +task + + + +next + + + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + + + + + + + + + + + + + + + +prev + +next - + - fileDescriptorinode - fileDescriptornext - fileDescriptoroffset - fileDescriptorprev - fileDescriptorsize + fileDescriptorbuffer + fileDescriptorcacheNode + fileDescriptordmadat + fileDescriptordsk_meta + fileDescriptordup + fileDescriptorfd_type + fileDescriptorfileName + fileDescriptorino + fileDescriptorinode + fileDescriptorlength + fileDescriptormode + fileDescriptormp + fileDescriptornext + fileDescriptoroffset + fileDescriptorperms + fileDescriptorprev + fileDescriptorres + fileDescriptorresid + fileDescriptorsize + fileDescriptorstart + fileDescriptorstatus diff --git a/doc/xml/structfileSystem.xml b/doc/xml/structfileSystem.xml index 63fe6f1..82af016 100644 --- a/doc/xml/structfileSystem.xml +++ b/doc/xml/structfileSystem.xml @@ -1,11 +1,11 @@ - - - + + + fileSystem - vfs.h + vfs.h - - fileSystem * + + struct fileSystem * struct fileSystem* fileSystem::next next @@ -15,12 +15,11 @@ - - vfsFindFS - vfsRegisterFS + + vfsFindFS - - fileSystem * + + struct fileSystem * struct fileSystem* fileSystem::prev prev @@ -30,93 +29,98 @@ - - vfsRegisterFS + - + int(* - int(* fileSystem::vfsInitFS)(void *) + int(* fileSystem::vfsInitFS) (void *) )(void *) vfsInitFS -pointer to inialization routine +pointer to inialization routine + - - vfs_mount + + vfs_mount - + int(* - int(* fileSystem::vfsMakeDir)(char *, void *) + int(* fileSystem::vfsMakeDir) (char *, void *) )(char *, void *) vfsMakeDir -pointer to makedir routine +pointer to makedir routine + - - sysMkDir + + sysMkDir - + int(* - int(* fileSystem::vfsOpenFile)(void *, void *) + int(* fileSystem::vfsOpenFile) (void *, void *) )(void *, void *) vfsOpenFile -pointer to openfile routine +pointer to openfile routine + - - fopen + + fopen - + int(* - int(* fileSystem::vfsRead)(void *, char *, long, long) + int(* fileSystem::vfsRead) (void *, char *, long, long) )(void *, char *, long, long) vfsRead -pointer to read routine +pointer to read routine + - - fgetc - fread + + fgetc + fread - + int(* - int(* fileSystem::vfsRemDir)(char *) + int(* fileSystem::vfsRemDir) (char *) )(char *) vfsRemDir -pointer to remdir routine +pointer to remdir routine + - + - + int(* - int(* fileSystem::vfsSync)(void) + int(* fileSystem::vfsSync) (void) )(void) vfsSync -pointer to sync routine +pointer to sync routine + - + - + int int fileSystem::vfsType @@ -124,70 +128,73 @@ -vfs type id +vfs type id + - - vfsFindFS - vfsRegisterFS + + vfs_mount + vfsFindFS - + int(* - int(* fileSystem::vfsUnlink)(char *, void *) + int(* fileSystem::vfsUnlink) (char *, void *) )(char *, void *) vfsUnlink -pointer to unlink routine +pointer to unlink routine + - - unlink + - + int(* - int(* fileSystem::vfsWrite)(void *, char *, long, long) + int(* fileSystem::vfsWrite) (void *, char *, long, long) )(void *, char *, long, long) vfsWrite -pointer to write routine +pointer to write routine + - - fputc - fwrite + + fputc -filesSystem Structure +filesSystem Structure + -not sure if we should allow function to point to NULL +not sure if we should allow function to point to NULL + - + - - prev -next + + +prev + +next - + - fileSystemnext - fileSystemprev - fileSystemvfsInitFS - fileSystemvfsMakeDir - fileSystemvfsOpenFile - fileSystemvfsRead - fileSystemvfsRemDir - fileSystemvfsSync - fileSystemvfsType - fileSystemvfsUnlink - fileSystemvfsWrite + fileSystemnext + fileSystemprev + fileSystemvfsInitFS + fileSystemvfsMakeDir + fileSystemvfsOpenFile + fileSystemvfsRead + fileSystemvfsRemDir + fileSystemvfsSync + fileSystemvfsType + fileSystemvfsUnlink + fileSystemvfsWrite diff --git a/doc/xml/structfs.xml b/doc/xml/structfs.xml index 5b33f78..5ff583a 100644 --- a/doc/xml/structfs.xml +++ b/doc/xml/structfs.xml @@ -1,12 +1,12 @@ - - - + + + fs - ufs.h + fs.h - - u_int * - u_int* fs::fs_active + + u_int * + u_int * fs::fs_active fs_active @@ -15,10 +15,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_avgfilesize fs_avgfilesize @@ -28,10 +28,23 @@ - + - - int32_t + + u_int32_t + u_int32_t fs::fs_avgfilesize + + fs_avgfilesize + + + + + + + + + + int32_t int32_t fs::fs_avgfpdir fs_avgfpdir @@ -41,10 +54,23 @@ - + - - int32_t + + u_int32_t + u_int32_t fs::fs_avgfpdir + + fs_avgfpdir + + + + + + + + + + int32_t int32_t fs::fs_bmask fs_bmask @@ -54,10 +80,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_bshift fs_bshift @@ -67,10 +93,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_bsize fs_bsize @@ -80,10 +106,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_cblkno fs_cblkno @@ -93,10 +119,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_cgrotor fs_cgrotor @@ -106,10 +132,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_cgsize fs_cgsize @@ -119,10 +145,10 @@ - + - - int8_t + + int8_t int8_t fs::fs_clean fs_clean @@ -132,11 +158,11 @@ - + - - u_int8_t * - u_int8_t* fs::fs_contigdirs + + u_int8_t * + u_int8_t * fs::fs_contigdirs fs_contigdirs @@ -145,10 +171,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_contigsumsize fs_contigsumsize @@ -158,10 +184,10 @@ - + - - ufs2_daddr_t + + ufs2_daddr_t ufs2_daddr_t fs::fs_csaddr fs_csaddr @@ -171,11 +197,11 @@ - + - - csum * - struct csum* fs::fs_csp + + struct csum * + struct csum * fs::fs_csp fs_csp @@ -184,10 +210,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_cssize fs_cssize @@ -197,10 +223,10 @@ - + - - csum_total + + struct csum_total struct csum_total fs::fs_cstotal fs_cstotal @@ -210,10 +236,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_dblkno fs_dblkno @@ -223,10 +249,10 @@ - + - - int64_t + + int64_t int64_t fs::fs_dsize fs_dsize @@ -236,10 +262,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_firstfield fs_firstfield @@ -249,10 +275,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_flags fs_flags @@ -262,10 +288,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_fmask fs_fmask @@ -275,10 +301,10 @@ - + - - int8_t + + int8_t int8_t fs::fs_fmod fs_fmod @@ -288,10 +314,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_fpg fs_fpg @@ -301,10 +327,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_frag fs_frag @@ -314,10 +340,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_fragshift fs_fragshift @@ -327,10 +353,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_fsbtodb fs_fsbtodb @@ -340,10 +366,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_fshift fs_fshift @@ -353,10 +379,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_fsize fs_fsize @@ -366,11 +392,11 @@ - + - - u_char - u_char fs::fs_fsmnt[468] + + u_char + u_char fs::fs_fsmnt [468] fs_fsmnt @@ -379,10 +405,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_iblkno fs_iblkno @@ -392,11 +418,11 @@ - + - - int32_t - int32_t fs::fs_id[2] + + int32_t + int32_t fs::fs_id [2] fs_id @@ -405,10 +431,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_inopb fs_inopb @@ -418,10 +444,23 @@ - + - - int32_t + + u_int32_t + u_int32_t fs::fs_inopb + + fs_inopb + + + + + + + + + + int32_t int32_t fs::fs_ipg fs_ipg @@ -431,10 +470,23 @@ - + - - int32_t + + u_int32_t + u_int32_t fs::fs_ipg + + fs_ipg + + + + + + + + + + int32_t int32_t fs::fs_magic fs_magic @@ -444,11 +496,10 @@ - - fsread + - - int32_t + + int32_t int32_t fs::fs_maxbpg fs_maxbpg @@ -458,10 +509,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_maxbsize fs_maxbsize @@ -471,11 +522,11 @@ - + - - int32_t * - int32_t* fs::fs_maxcluster + + int32_t * + int32_t * fs::fs_maxcluster fs_maxcluster @@ -484,10 +535,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_maxcontig fs_maxcontig @@ -497,10 +548,10 @@ - + - - u_int64_t + + u_int64_t u_int64_t fs::fs_maxfilesize fs_maxfilesize @@ -510,11 +561,11 @@ - - ffs_read + + ffs_read - - int32_t + + int32_t int32_t fs::fs_maxsymlinklen fs_maxsymlinklen @@ -524,10 +575,23 @@ - + - - int32_t + + int64_t + int64_t fs::fs_metaspace + + fs_metaspace + + + + + + + + + + int32_t int32_t fs::fs_minfree fs_minfree @@ -537,10 +601,23 @@ - + - - int32_t + + ufs_time_t + ufs_time_t fs::fs_mtime + + fs_mtime + + + + + + + + + + int32_t int32_t fs::fs_ncg fs_ncg @@ -550,10 +627,23 @@ - + - - int32_t + + u_int32_t + u_int32_t fs::fs_ncg + + fs_ncg + + + + + + + + + + int32_t int32_t fs::fs_nindir fs_nindir @@ -563,12 +653,12 @@ - + - + void * - void* fs::fs_ocsp[((128/sizeof(void *))-4)] - [((128/sizeof(void *))-4)] + void * fs::fs_ocsp + [((128/sizeof(void *)) - 4)] fs_ocsp @@ -576,10 +666,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_cgmask fs_old_cgmask @@ -589,10 +679,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_cgoffset fs_old_cgoffset @@ -602,10 +692,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_cpc fs_old_cpc @@ -615,10 +705,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_cpg fs_old_cpg @@ -628,10 +718,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_csaddr fs_old_csaddr @@ -641,10 +731,10 @@ - + - - csum + + struct csum struct csum fs::fs_old_cstotal fs_old_cstotal @@ -654,10 +744,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_dsize fs_old_dsize @@ -667,10 +757,10 @@ - + - - int8_t + + int8_t int8_t fs::fs_old_flags fs_old_flags @@ -680,10 +770,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_inodefmt fs_old_inodefmt @@ -693,10 +783,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_interleave fs_old_interleave @@ -706,10 +796,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_ncyl fs_old_ncyl @@ -719,10 +809,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_npsect fs_old_npsect @@ -732,10 +822,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_nrpos fs_old_nrpos @@ -745,10 +835,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_nsect fs_old_nsect @@ -758,10 +848,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_nspf fs_old_nspf @@ -771,10 +861,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_postblformat fs_old_postblformat @@ -784,10 +874,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_rotdelay fs_old_rotdelay @@ -797,10 +887,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_rps fs_old_rps @@ -810,10 +900,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_size fs_old_size @@ -823,10 +913,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_spc fs_old_spc @@ -836,10 +926,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_time fs_old_time @@ -849,10 +939,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_old_trackskew fs_old_trackskew @@ -862,10 +952,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_optim fs_optim @@ -875,10 +965,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_pad fs_pad @@ -888,10 +978,10 @@ - + - - int64_t + + int64_t int64_t fs::fs_pendingblocks fs_pendingblocks @@ -901,10 +991,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_pendinginodes fs_pendinginodes @@ -914,10 +1004,36 @@ - + - - int64_t + + u_int32_t + u_int32_t fs::fs_pendinginodes + + fs_pendinginodes + + + + + + + + + + int64_t + int64_t fs::fs_providersize + + fs_providersize + + + + + + + + + + int64_t int64_t fs::fs_qbmask fs_qbmask @@ -927,10 +1043,10 @@ - + - - int64_t + + int64_t int64_t fs::fs_qfmask fs_qfmask @@ -940,10 +1056,10 @@ - + - - int8_t + + int8_t int8_t fs::fs_ronly fs_ronly @@ -953,10 +1069,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_save_cgsize fs_save_cgsize @@ -966,10 +1082,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_sblkno fs_sblkno @@ -979,10 +1095,10 @@ - + - - int64_t + + int64_t int64_t fs::fs_sblockloc fs_sblockloc @@ -992,10 +1108,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_sbsize fs_sbsize @@ -1005,10 +1121,10 @@ - + - - int64_t + + int64_t int64_t fs::fs_size fs_size @@ -1018,10 +1134,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_snapinum[20] [20] fs_snapinum @@ -1031,11 +1147,24 @@ - + - - int32_t - int32_t fs::fs_spare1[2] + + uint32_t + uint32_t fs::fs_snapinum[20] + [20] + fs_snapinum + + + + + + + + + + int32_t + int32_t fs::fs_spare1 [2] fs_spare1 @@ -1044,10 +1173,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_spare2 fs_spare2 @@ -1057,11 +1186,11 @@ - + - - int32_t - int32_t fs::fs_spare5[2] + + int32_t + int32_t fs::fs_spare5 [2] fs_spare5 @@ -1070,12 +1199,12 @@ - + - - int32_t - int32_t fs::fs_sparecon32[26] - [26] + + int32_t + int32_t fs::fs_sparecon32 + [23] fs_sparecon32 @@ -1083,12 +1212,12 @@ - + - - int64_t - int64_t fs::fs_sparecon64[17] - [17] + + int64_t + int64_t fs::fs_sparecon64 + [14] fs_sparecon64 @@ -1096,10 +1225,10 @@ - + - - int32_t + + int32_t int32_t fs::fs_state fs_state @@ -1109,10 +1238,23 @@ - + - - u_int64_t + + int32_t + int32_t fs::fs_sujfree + + fs_sujfree + + + + + + + + + + u_int64_t u_int64_t fs::fs_swuid fs_swuid @@ -1122,10 +1264,10 @@ - + - - ufs_time_t + + ufs_time_t ufs_time_t fs::fs_time fs_time @@ -1135,10 +1277,23 @@ - + - - int32_t + + int64_t + int64_t fs::fs_unrefs + + fs_unrefs + + + + + + + + + + int32_t int32_t fs::fs_unused_1 fs_unused_1 @@ -1148,11 +1303,11 @@ - + - - u_char - u_char fs::fs_volname[32] + + u_char + u_char fs::fs_volname [32] fs_volname @@ -1161,7 +1316,7 @@ - + @@ -1169,117 +1324,129 @@ - + - + - + - - fs_old_cstotal -fs_csp + + +fs_csp + +fs_old_cstotal - - fs_cstotal + + +fs_cstotal - + - fsfs_active - fsfs_avgfilesize - fsfs_avgfpdir - fsfs_bmask - fsfs_bshift - fsfs_bsize - fsfs_cblkno - fsfs_cgrotor - fsfs_cgsize - fsfs_clean - fsfs_contigdirs - fsfs_contigsumsize - fsfs_csaddr - fsfs_csp - fsfs_cssize - fsfs_cstotal - fsfs_dblkno - fsfs_dsize - fsfs_firstfield - fsfs_flags - fsfs_fmask - fsfs_fmod - fsfs_fpg - fsfs_frag - fsfs_fragshift - fsfs_fsbtodb - fsfs_fshift - fsfs_fsize - fsfs_fsmnt - fsfs_iblkno - fsfs_id - fsfs_inopb - fsfs_ipg - fsfs_magic - fsfs_maxbpg - fsfs_maxbsize - fsfs_maxcluster - fsfs_maxcontig - fsfs_maxfilesize - fsfs_maxsymlinklen - fsfs_minfree - fsfs_ncg - fsfs_nindir - fsfs_ocsp - fsfs_old_cgmask - fsfs_old_cgoffset - fsfs_old_cpc - fsfs_old_cpg - fsfs_old_csaddr - fsfs_old_cstotal - fsfs_old_dsize - fsfs_old_flags - fsfs_old_inodefmt - fsfs_old_interleave - fsfs_old_ncyl - fsfs_old_npsect - fsfs_old_nrpos - fsfs_old_nsect - fsfs_old_nspf - fsfs_old_postblformat - fsfs_old_rotdelay - fsfs_old_rps - fsfs_old_size - fsfs_old_spc - fsfs_old_time - fsfs_old_trackskew - fsfs_optim - fsfs_pad - fsfs_pendingblocks - fsfs_pendinginodes - fsfs_qbmask - fsfs_qfmask - fsfs_ronly - fsfs_save_cgsize - fsfs_sblkno - fsfs_sblockloc - fsfs_sbsize - fsfs_size - fsfs_snapinum - fsfs_spare1 - fsfs_spare2 - fsfs_spare5 - fsfs_sparecon32 - fsfs_sparecon64 - fsfs_state - fsfs_swuid - fsfs_time - fsfs_unused_1 - fsfs_volname + fsfs_active + fsfs_avgfilesize + fsfs_avgfilesize + fsfs_avgfpdir + fsfs_avgfpdir + fsfs_bmask + fsfs_bshift + fsfs_bsize + fsfs_cblkno + fsfs_cgrotor + fsfs_cgsize + fsfs_clean + fsfs_contigdirs + fsfs_contigsumsize + fsfs_csaddr + fsfs_csp + fsfs_cssize + fsfs_cstotal + fsfs_dblkno + fsfs_dsize + fsfs_firstfield + fsfs_flags + fsfs_fmask + fsfs_fmod + fsfs_fpg + fsfs_frag + fsfs_fragshift + fsfs_fsbtodb + fsfs_fshift + fsfs_fsize + fsfs_fsmnt + fsfs_iblkno + fsfs_id + fsfs_inopb + fsfs_inopb + fsfs_ipg + fsfs_ipg + fsfs_magic + fsfs_maxbpg + fsfs_maxbsize + fsfs_maxcluster + fsfs_maxcontig + fsfs_maxfilesize + fsfs_maxsymlinklen + fsfs_metaspace + fsfs_minfree + fsfs_mtime + fsfs_ncg + fsfs_ncg + fsfs_nindir + fsfs_ocsp + fsfs_old_cgmask + fsfs_old_cgoffset + fsfs_old_cpc + fsfs_old_cpg + fsfs_old_csaddr + fsfs_old_cstotal + fsfs_old_dsize + fsfs_old_flags + fsfs_old_inodefmt + fsfs_old_interleave + fsfs_old_ncyl + fsfs_old_npsect + fsfs_old_nrpos + fsfs_old_nsect + fsfs_old_nspf + fsfs_old_postblformat + fsfs_old_rotdelay + fsfs_old_rps + fsfs_old_size + fsfs_old_spc + fsfs_old_time + fsfs_old_trackskew + fsfs_optim + fsfs_pad + fsfs_pendingblocks + fsfs_pendinginodes + fsfs_pendinginodes + fsfs_providersize + fsfs_qbmask + fsfs_qfmask + fsfs_ronly + fsfs_save_cgsize + fsfs_sblkno + fsfs_sblockloc + fsfs_sbsize + fsfs_size + fsfs_snapinum + fsfs_snapinum + fsfs_spare1 + fsfs_spare2 + fsfs_spare5 + fsfs_sparecon32 + fsfs_sparecon64 + fsfs_state + fsfs_sujfree + fsfs_swuid + fsfs_time + fsfs_unrefs + fsfs_unused_1 + fsfs_volname diff --git a/doc/xml/structgdtDescriptor.xml b/doc/xml/structgdtDescriptor.xml index 992a583..1524f11 100644 --- a/doc/xml/structgdtDescriptor.xml +++ b/doc/xml/structgdtDescriptor.xml @@ -1,10 +1,10 @@ - - - + + + gdtDescriptor gdt.h - + unsigned char unsigned char gdtDescriptor::access @@ -15,9 +15,10 @@ - + + sys_sysarch - + unsigned char unsigned char gdtDescriptor::baseHigh @@ -28,9 +29,10 @@ - + + sys_sysarch - + unsigned short unsigned short gdtDescriptor::baseLow @@ -41,9 +43,10 @@ - + + sys_sysarch - + unsigned char unsigned char gdtDescriptor::baseMed @@ -54,9 +57,10 @@ - + + sys_sysarch - + unsigned int unsigned int gdtDescriptor::granularity @@ -68,9 +72,10 @@ - + + sys_sysarch - + unsigned int unsigned int gdtDescriptor::limitHigh @@ -82,9 +87,10 @@ - + + sys_sysarch - + unsigned short unsigned short gdtDescriptor::limitLow @@ -95,22 +101,29 @@ - + + sys_sysarch - + + + + + + + - gdtDescriptoraccess - gdtDescriptorbaseHigh - gdtDescriptorbaseLow - gdtDescriptorbaseMed - gdtDescriptorgranularity - gdtDescriptorlimitHigh - gdtDescriptorlimitLow + gdtDescriptoraccess + gdtDescriptorbaseHigh + gdtDescriptorbaseLow + gdtDescriptorbaseMed + gdtDescriptorgranularity + gdtDescriptorlimitHigh + gdtDescriptorlimitLow diff --git a/doc/xml/structgdtGate.xml b/doc/xml/structgdtGate.xml index 894e8e1..f918fc7 100644 --- a/doc/xml/structgdtGate.xml +++ b/doc/xml/structgdtGate.xml @@ -1,10 +1,10 @@ - - - + + + gdtGate gdt.h - + unsigned short unsigned short gdtGate::access @@ -15,11 +15,9 @@ - - setTaskVector - setVector + - + unsigned short unsigned short gdtGate::offsetHigh @@ -30,11 +28,9 @@ - - setTaskVector - setVector + - + unsigned short unsigned short gdtGate::offsetLow @@ -45,11 +41,9 @@ - - setTaskVector - setVector + - + unsigned short unsigned short gdtGate::selector @@ -60,21 +54,25 @@ - - setTaskVector - setVector + - + + + + + + + - gdtGateaccess - gdtGateoffsetHigh - gdtGateoffsetLow - gdtGateselector + gdtGateaccess + gdtGateoffsetHigh + gdtGateoffsetLow + gdtGateselector diff --git a/doc/xml/structgdt__descr.xml b/doc/xml/structgdt__descr.xml index 6475f1a..95e8ce5 100644 --- a/doc/xml/structgdt__descr.xml +++ b/doc/xml/structgdt__descr.xml @@ -1,28 +1,10 @@ - - - + + + gdt_descr - - - uInt32 *base - uInt32* base gdt_descr::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - - uInt16 + + uInt16 uInt16 gdt_descr::limit limit @@ -32,18 +14,41 @@ - - GDT_fixer + + + + + + uInt32 *base + uInt32* base gdt_descr::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + - + + + + + + + - gdt_descr__attribute__ - gdt_descrlimit + gdt_descr__attribute__ + gdt_descrlimit diff --git a/doc/xml/structgetdtablesize__args.xml b/doc/xml/structgetdtablesize__args.xml index 0037b14..a50d0ca 100644 --- a/doc/xml/structgetdtablesize__args.xml +++ b/doc/xml/structgetdtablesize__args.xml @@ -1,11 +1,11 @@ - - - + + + getdtablesize_args - sysproto.h + sysproto_posix.h - - register_t + + register_t register_t getdtablesize_args::dummy dummy @@ -15,16 +15,22 @@ - + - + + + + + + + - getdtablesize_argsdummy + getdtablesize_argsdummy diff --git a/doc/xml/structgetgid__args.xml b/doc/xml/structgetgid__args.xml index 9f6821c..90ac0a1 100644 --- a/doc/xml/structgetgid__args.xml +++ b/doc/xml/structgetgid__args.xml @@ -1,11 +1,11 @@ - - - + + + getgid_args - sysproto.h + sysproto_posix.h - - register_t + + register_t register_t getgid_args::dummy dummy @@ -15,16 +15,22 @@ - + - + + + + + + + - getgid_argsdummy + getgid_argsdummy diff --git a/doc/xml/structgetpid__args.xml b/doc/xml/structgetpid__args.xml index 2c9c3a4..db3fcee 100644 --- a/doc/xml/structgetpid__args.xml +++ b/doc/xml/structgetpid__args.xml @@ -1,11 +1,11 @@ - - - + + + getpid_args - sysproto.h + sysproto_posix.h - - register_t + + register_t register_t getpid_args::dummy dummy @@ -15,16 +15,22 @@ - + - + + + + + + + - getpid_argsdummy + getpid_argsdummy diff --git a/doc/xml/structgettimeofday__args.xml b/doc/xml/structgettimeofday__args.xml index 4642410..fb85700 100644 --- a/doc/xml/structgettimeofday__args.xml +++ b/doc/xml/structgettimeofday__args.xml @@ -1,11 +1,11 @@ - - - + + + gettimeofday_args - sysproto.h + sysproto_posix.h - - timeval * + + struct timeval * struct timeval* gettimeofday_args::tp tp @@ -15,9 +15,9 @@ - + - + char char gettimeofday_args::tp_l_[0] [0] @@ -28,12 +28,12 @@ - + - + char - char gettimeofday_args::tp_r_[(sizeof(register_t)<=sizeof(struct timeval *)?0:sizeof(register_t)-sizeof(struct timeval *))] - [(sizeof(register_t)<=sizeof(struct timeval *)?0:sizeof(register_t)-sizeof(struct timeval *))] + char gettimeofday_args::tp_r_[(sizeof(register_t)<=sizeof(struct timeval *) ? 0 :sizeof(register_t) - sizeof(struct timeval *))] + [(sizeof(register_t)<=sizeof(struct timeval *) ? 0 :sizeof(register_t) - sizeof(struct timeval *))] tp_r_ @@ -41,10 +41,10 @@ - + - - timezone * + + struct timezone * struct timezone* gettimeofday_args::tzp tzp @@ -54,9 +54,9 @@ - + - + char char gettimeofday_args::tzp_l_[0] [0] @@ -67,12 +67,12 @@ - + - + char - char gettimeofday_args::tzp_r_[(sizeof(register_t)<=sizeof(struct timezone *)?0:sizeof(register_t)-sizeof(struct timezone *))] - [(sizeof(register_t)<=sizeof(struct timezone *)?0:sizeof(register_t)-sizeof(struct timezone *))] + char gettimeofday_args::tzp_r_[(sizeof(register_t)<=sizeof(struct timezone *) ? 0 :sizeof(register_t) - sizeof(struct timezone *))] + [(sizeof(register_t)<=sizeof(struct timezone *) ? 0 :sizeof(register_t) - sizeof(struct timezone *))] tzp_r_ @@ -80,7 +80,7 @@ - + @@ -88,33 +88,33 @@ - + - + - - tzp + + +tzp - - tp + + +tp - + - + - gettimeofday_argstp - gettimeofday_argstp_l_ - gettimeofday_argstp_r_ - gettimeofday_argstzp - gettimeofday_argstzp_l_ - gettimeofday_argstzp_r_ + gettimeofday_argstp + gettimeofday_argstp_l_ + gettimeofday_argstp_r_ + gettimeofday_argstzp + gettimeofday_argstzp_l_ + gettimeofday_argstzp_r_ diff --git a/doc/xml/structgetuid__args.xml b/doc/xml/structgetuid__args.xml index f36379d..6aadb3b 100644 --- a/doc/xml/structgetuid__args.xml +++ b/doc/xml/structgetuid__args.xml @@ -1,11 +1,11 @@ - - - + + + getuid_args - sysproto.h + sysproto_posix.h - - register_t + + register_t register_t getuid_args::dummy dummy @@ -15,16 +15,22 @@ - + - + + + + + + + - getuid_argsdummy + getuid_argsdummy diff --git a/doc/xml/structhostRingEntry.xml b/doc/xml/structhostRingEntry.xml index 8cd7eff..7d7ffba 100644 --- a/doc/xml/structhostRingEntry.xml +++ b/doc/xml/structhostRingEntry.xml @@ -1,39 +1,42 @@ - - - + + + hostRingEntry lnc.h - - hostRingEntry::@0 - union hostRingEntry::@0 hostRingEntry::buff + + uint32_t + uint32_t hostRingEntry::addr - buff + addr - + + lncAttach - - char * - char* hostRingEntry::data + + uint16_t + uint16_t hostRingEntry::bcnt - data + bcnt - + + lnc_sendPacket + lncAttach - - mds * - struct mds* hostRingEntry::md - + + uint8_t + uint8_t hostRingEntry::md[6] + [6] md @@ -41,7 +44,26 @@ - + + lnc_driverOwnsRX + lnc_driverOwnsTX + lnc_rxINT + lnc_sendPacket + lnc_thread + lncAttach + + + uint32_t + uint32_t hostRingEntry::reserved + + reserved + + + + + + + @@ -49,23 +71,17 @@ - - - - - + - - md - - + - hostRingEntrybuff - hostRingEntrydata - hostRingEntrymd + hostRingEntryaddr + hostRingEntrybcnt + hostRingEntrymd + hostRingEntryreserved diff --git a/doc/xml/structi386__frame.xml b/doc/xml/structi386__frame.xml index c6046fa..6f91c22 100644 --- a/doc/xml/structi386__frame.xml +++ b/doc/xml/structi386__frame.xml @@ -1,12 +1,12 @@ - - - + + + i386_frame tss.h - - uInt32 - uInt32 i386_frame::cs + + uint32_t + uint32_t i386_frame::cs cs @@ -15,11 +15,11 @@ - + - - uInt32 - uInt32 i386_frame::ds + + uint32_t + uint32_t i386_frame::ds ds @@ -28,11 +28,11 @@ - + - - uInt32 - uInt32 i386_frame::eax + + uint32_t + uint32_t i386_frame::eax eax @@ -41,11 +41,11 @@ - + - - uInt32 - uInt32 i386_frame::ebp + + uint32_t + uint32_t i386_frame::ebp ebp @@ -54,12 +54,12 @@ - - sysExec + + sysExec - - uInt32 - uInt32 i386_frame::ebx + + uint32_t + uint32_t i386_frame::ebx ebx @@ -68,11 +68,11 @@ - + - - uInt32 - uInt32 i386_frame::ecx + + uint32_t + uint32_t i386_frame::ecx ecx @@ -81,11 +81,11 @@ - + - - uInt32 - uInt32 i386_frame::edi + + uint32_t + uint32_t i386_frame::edi edi @@ -94,11 +94,11 @@ - + - - uInt32 - uInt32 i386_frame::edx + + uint32_t + uint32_t i386_frame::edx edx @@ -107,11 +107,11 @@ - + - - uInt32 - uInt32 i386_frame::eip + + uint32_t + uint32_t i386_frame::eip eip @@ -120,13 +120,12 @@ - - sys_exec - sysExec + + sysExec - - uInt32 - uInt32 i386_frame::es + + uint32_t + uint32_t i386_frame::es es @@ -135,11 +134,11 @@ - + - - uInt32 - uInt32 i386_frame::esi + + uint32_t + uint32_t i386_frame::esi esi @@ -148,11 +147,11 @@ - + - - uInt32 - uInt32 i386_frame::esp + + uint32_t + uint32_t i386_frame::esp esp @@ -161,11 +160,11 @@ - + - - uInt32 - uInt32 i386_frame::flags + + uint32_t + uint32_t i386_frame::flags flags @@ -174,11 +173,11 @@ - + - - uInt32 - uInt32 i386_frame::fs + + uint32_t + uint32_t i386_frame::fs fs @@ -187,11 +186,11 @@ - + - - uInt32 - uInt32 i386_frame::gs + + uint32_t + uint32_t i386_frame::gs gs @@ -200,11 +199,11 @@ - + - - uInt32 - uInt32 i386_frame::ss + + uint32_t + uint32_t i386_frame::ss ss @@ -213,11 +212,11 @@ - + - - uInt32 - uInt32 i386_frame::user_esp + + uint32_t + uint32_t i386_frame::user_esp user_esp @@ -226,12 +225,12 @@ - - sysExec + + sysExec - - uInt32 - uInt32 i386_frame::user_ss + + uint32_t + uint32_t i386_frame::user_ss user_ss @@ -240,33 +239,39 @@ - + - + + + + + + + - i386_framecs - i386_frameds - i386_frameeax - i386_frameebp - i386_frameebx - i386_frameecx - i386_frameedi - i386_frameedx - i386_frameeip - i386_framees - i386_frameesi - i386_frameesp - i386_frameflags - i386_framefs - i386_framegs - i386_framess - i386_frameuser_esp - i386_frameuser_ss + i386_framecs + i386_frameds + i386_frameeax + i386_frameebp + i386_frameebx + i386_frameecx + i386_frameedi + i386_frameedx + i386_frameeip + i386_framees + i386_frameesi + i386_frameesp + i386_frameflags + i386_framefs + i386_framegs + i386_framess + i386_frameuser_esp + i386_frameuser_ss diff --git a/doc/xml/structi387Struct.xml b/doc/xml/structi387Struct.xml index e5342bc..2e0f393 100644 --- a/doc/xml/structi387Struct.xml +++ b/doc/xml/structi387Struct.xml @@ -1,10 +1,10 @@ - - - + + + i387Struct tss.h - + long long i387Struct::cwd @@ -15,9 +15,9 @@ - + - + long long i387Struct::fcs @@ -28,9 +28,9 @@ - + - + long long i387Struct::fip @@ -41,9 +41,9 @@ - + - + long long i387Struct::foo @@ -54,9 +54,9 @@ - + - + long long i387Struct::fos @@ -67,9 +67,9 @@ - + - + long long i387Struct::st_space[20] [20] @@ -80,9 +80,9 @@ - + - + long long i387Struct::swd @@ -93,9 +93,9 @@ - + - + long long i387Struct::twd @@ -106,23 +106,29 @@ - + - + + + + + + + - i387Structcwd - i387Structfcs - i387Structfip - i387Structfoo - i387Structfos - i387Structst_space - i387Structswd - i387Structtwd + i387Structcwd + i387Structfcs + i387Structfip + i387Structfoo + i387Structfos + i387Structst_space + i387Structswd + i387Structtwd diff --git a/doc/xml/structicmp__echo__hdr.xml b/doc/xml/structicmp__echo__hdr.xml index 16c479b..5d17cca 100644 --- a/doc/xml/structicmp__echo__hdr.xml +++ b/doc/xml/structicmp__echo__hdr.xml @@ -1,50 +1,16 @@ - - - + + + icmp_echo_hdr - icmp.h + icmp.h - + icmp_echo_hdr::PACK_STRUCT_FIELD - (uInt16 seqno) + (u16_t chksum) PACK_STRUCT_FIELD - uInt16 - seqno - - - - - - - - - - - - icmp_echo_hdr::PACK_STRUCT_FIELD - (uInt16 id) - PACK_STRUCT_FIELD - - uInt16 - id - - - - - - - - - - - - icmp_echo_hdr::PACK_STRUCT_FIELD - (uInt16 chksum) - PACK_STRUCT_FIELD - - uInt16 + u16_t chksum @@ -53,16 +19,16 @@ - + - + icmp_echo_hdr::PACK_STRUCT_FIELD - (uInt16 _type_code) + (u16_t id) PACK_STRUCT_FIELD - uInt16 - _type_code + u16_t + id @@ -70,91 +36,78 @@ - + - - - - u16_t - u16_t icmp_echo_hdr::chksum - - chksum + + + icmp_echo_hdr::PACK_STRUCT_FIELD + (u16_t seqno) + PACK_STRUCT_FIELD + + u16_t + seqno + - + - - u8_t - u8_t icmp_echo_hdr::icode - - icode + + + icmp_echo_hdr::PACK_STRUCT_FLD_8 + (u8_t code) + PACK_STRUCT_FLD_8 + + u8_t + code + - + - - u16_t - u16_t icmp_echo_hdr::id - - id + + + icmp_echo_hdr::PACK_STRUCT_FLD_8 + (u8_t type) + PACK_STRUCT_FLD_8 + + u8_t + type + - - - - u16_t - u16_t icmp_echo_hdr::seqno - - seqno - - - - - - - - - - u8_t - u8_t icmp_echo_hdr::type - - type - - - - - - - + +This is the standard ICMP header only that the u32_t data is split to two u16_t like ICMP echo needs it. This header is also used for other ICMP types that do not use the data part. - + + + + + + + - icmp_echo_hdrchksum - icmp_echo_hdricode - icmp_echo_hdrid - icmp_echo_hdrPACK_STRUCT_FIELD - icmp_echo_hdrPACK_STRUCT_FIELD - icmp_echo_hdrPACK_STRUCT_FIELD - icmp_echo_hdrPACK_STRUCT_FIELD - icmp_echo_hdrseqno - icmp_echo_hdrtype + icmp_echo_hdrPACK_STRUCT_FIELD + icmp_echo_hdrPACK_STRUCT_FIELD + icmp_echo_hdrPACK_STRUCT_FIELD + icmp_echo_hdrPACK_STRUCT_FLD_8 + icmp_echo_hdrPACK_STRUCT_FLD_8 diff --git a/doc/xml/structin__addr.xml b/doc/xml/structin__addr.xml index a702f11..199a972 100644 --- a/doc/xml/structin__addr.xml +++ b/doc/xml/structin__addr.xml @@ -1,12 +1,12 @@ - - - + + + in_addr - sockets.h + inet.h - - uInt32 - uInt32 in_addr::s_addr + + in_addr_t + in_addr_t in_addr::s_addr s_addr @@ -15,17 +15,22 @@ - - inet_aton + - + + + + + + + - in_addrs_addr + in_addrs_addr diff --git a/doc/xml/structioctl__args.xml b/doc/xml/structioctl__args.xml index 8d7c31e..70d6bf7 100644 --- a/doc/xml/structioctl__args.xml +++ b/doc/xml/structioctl__args.xml @@ -1,11 +1,11 @@ - - - + + + ioctl_args - sysproto.h + sysproto_posix.h - - u_long + + u_long u_long ioctl_args::com com @@ -15,9 +15,9 @@ - + - + char char ioctl_args::com_l_[0] [0] @@ -28,12 +28,12 @@ - + - + char - char ioctl_args::com_r_[(sizeof(register_t)<=sizeof(u_long)?0:sizeof(register_t)-sizeof(u_long))] - [(sizeof(register_t)<=sizeof(u_long)?0:sizeof(register_t)-sizeof(u_long))] + char ioctl_args::com_r_[(sizeof(register_t)<=sizeof(u_long) ? 0 :sizeof(register_t) - sizeof(u_long))] + [(sizeof(register_t)<=sizeof(u_long) ? 0 :sizeof(register_t) - sizeof(u_long))] com_r_ @@ -41,10 +41,10 @@ - + - - caddr_t + + caddr_t caddr_t ioctl_args::data data @@ -54,9 +54,9 @@ - + - + char char ioctl_args::data_l_[0] [0] @@ -67,12 +67,12 @@ - + - + char - char ioctl_args::data_r_[(sizeof(register_t)<=sizeof(caddr_t)?0:sizeof(register_t)-sizeof(caddr_t))] - [(sizeof(register_t)<=sizeof(caddr_t)?0:sizeof(register_t)-sizeof(caddr_t))] + char ioctl_args::data_r_[(sizeof(register_t)<=sizeof(caddr_t) ? 0 :sizeof(register_t) - sizeof(caddr_t))] + [(sizeof(register_t)<=sizeof(caddr_t) ? 0 :sizeof(register_t) - sizeof(caddr_t))] data_r_ @@ -80,9 +80,9 @@ - + - + int int ioctl_args::fd @@ -93,9 +93,9 @@ - + - + char char ioctl_args::fd_l_[0] [0] @@ -106,12 +106,12 @@ - + - + char - char ioctl_args::fd_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char ioctl_args::fd_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] fd_r_ @@ -119,24 +119,30 @@ - + - + + + + + + + - ioctl_argscom - ioctl_argscom_l_ - ioctl_argscom_r_ - ioctl_argsdata - ioctl_argsdata_l_ - ioctl_argsdata_r_ - ioctl_argsfd - ioctl_argsfd_l_ - ioctl_argsfd_r_ + ioctl_argscom + ioctl_argscom_l_ + ioctl_argscom_r_ + ioctl_argsdata + ioctl_argsdata_l_ + ioctl_argsdata_r_ + ioctl_argsfd + ioctl_argsfd_l_ + ioctl_argsfd_r_ diff --git a/doc/xml/structip__hdr.xml b/doc/xml/structip__hdr.xml index 9375fd4..35bfe7a 100644 --- a/doc/xml/structip__hdr.xml +++ b/doc/xml/structip__hdr.xml @@ -1,50 +1,16 @@ - - - + + + ip_hdr - ip.h + ip4.h - + ip_hdr::PACK_STRUCT_FIELD - (struct ip_addr dest) + (u16_t _chksum) PACK_STRUCT_FIELD - struct ip_addr - dest - - - - - - - - - - - - ip_hdr::PACK_STRUCT_FIELD - (struct ip_addr src) - PACK_STRUCT_FIELD - - struct ip_addr - src - - - - - - - - - - - - ip_hdr::PACK_STRUCT_FIELD - (uInt16 _chksum) - PACK_STRUCT_FIELD - - uInt16 + u16_t _chksum @@ -53,49 +19,15 @@ - + - + ip_hdr::PACK_STRUCT_FIELD - (uInt16 _ttl_proto) + (u16_t _id) PACK_STRUCT_FIELD - uInt16 - _ttl_proto - - - - - - - - - - - - ip_hdr::PACK_STRUCT_FIELD - (uInt16 _offset) - PACK_STRUCT_FIELD - - uInt16 - _offset - - - - - - - - - - - - ip_hdr::PACK_STRUCT_FIELD - (uInt16 _id) - PACK_STRUCT_FIELD - - uInt16 + u16_t _id @@ -104,15 +36,15 @@ - + - + ip_hdr::PACK_STRUCT_FIELD - (uInt16 _len) + (u16_t _len) PACK_STRUCT_FIELD - uInt16 + u16_t _len @@ -121,16 +53,16 @@ - + - + ip_hdr::PACK_STRUCT_FIELD - (uInt16 _v_hl_tos) + (u16_t _offset) PACK_STRUCT_FIELD - uInt16 - _v_hl_tos + u16_t + _offset @@ -138,130 +70,109 @@ - + - - - - ip_addr src - struct ip_addr src ip_hdr::dest - - dest + + + ip_hdr::PACK_STRUCT_FLD_8 + (u8_t _proto) + PACK_STRUCT_FLD_8 + + u8_t + _proto + - + - - u8_t - u8_t ip_hdr::flow1 - - flow1 - 4 + + + ip_hdr::PACK_STRUCT_FLD_8 + (u8_t _tos) + PACK_STRUCT_FLD_8 + + u8_t + _tos + - + - - u16_t - u16_t ip_hdr::flow2 - - flow2 + + + ip_hdr::PACK_STRUCT_FLD_8 + (u8_t _ttl) + PACK_STRUCT_FLD_8 + + u8_t + _ttl + - + - - u8_t - u8_t ip_hdr::hoplim - - hoplim + + + ip_hdr::PACK_STRUCT_FLD_8 + (u8_t _v_hl) + PACK_STRUCT_FLD_8 + + u8_t + _v_hl + - + - - u16_t - u16_t ip_hdr::len - - len + + + ip_hdr::PACK_STRUCT_FLD_S + (ip4_addr_p_t dest) + PACK_STRUCT_FLD_S + + ip4_addr_p_t + dest + - + - - u8_t - u8_t ip_hdr::nexthdr - - nexthdr + + + ip_hdr::PACK_STRUCT_FLD_S + (ip4_addr_p_t src) + PACK_STRUCT_FLD_S + + ip4_addr_p_t + src + - - - - u8_t - u8_t ip_hdr::tclass1 - - tclass1 - 4 - - - - - - - - - - u8_t - u8_t ip_hdr::tclass2 - - tclass2 - 4 - - - - - - - - - - u8_t - u8_t ip_hdr::v - - v - 4 - - - - - - - + @@ -269,37 +180,23 @@ - - - - - + - - dest - - + - ip_hdrdest - ip_hdrflow1 - ip_hdrflow2 - ip_hdrhoplim - ip_hdrlen - ip_hdrnexthdr - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrPACK_STRUCT_FIELD - ip_hdrtclass1 - ip_hdrtclass2 - ip_hdrv + ip_hdrPACK_STRUCT_FIELD + ip_hdrPACK_STRUCT_FIELD + ip_hdrPACK_STRUCT_FIELD + ip_hdrPACK_STRUCT_FIELD + ip_hdrPACK_STRUCT_FLD_8 + ip_hdrPACK_STRUCT_FLD_8 + ip_hdrPACK_STRUCT_FLD_8 + ip_hdrPACK_STRUCT_FLD_8 + ip_hdrPACK_STRUCT_FLD_S + ip_hdrPACK_STRUCT_FLD_S diff --git a/doc/xml/structkmod__struct.xml b/doc/xml/structkmod__struct.xml index edb2d50..bbbeb2c 100644 --- a/doc/xml/structkmod__struct.xml +++ b/doc/xml/structkmod__struct.xml @@ -1,11 +1,11 @@ - - - + + + kmod_struct kmod.h - - uInt32 + + uInt32 uInt32 kmod_struct::address address @@ -15,10 +15,10 @@ - + - - uInt16 + + uInt16 uInt16 kmod_struct::id id @@ -28,9 +28,9 @@ - + - + char char kmod_struct::name[128] [128] @@ -41,10 +41,10 @@ - + - - kmod_struct * + + struct kmod_struct * struct kmod_struct* kmod_struct::next next @@ -54,10 +54,10 @@ - + - - kmod_struct * + + struct kmod_struct * struct kmod_struct* kmod_struct::prev prev @@ -67,10 +67,10 @@ - + - - uInt16 + + uInt16 uInt16 kmod_struct::refs refs @@ -80,7 +80,7 @@ - + @@ -88,23 +88,23 @@ - + - - prev -next + + +prev + +next - + - kmod_structaddress - kmod_structid - kmod_structname - kmod_structnext - kmod_structprev - kmod_structrefs + kmod_structaddress + kmod_structid + kmod_structname + kmod_structnext + kmod_structprev + kmod_structrefs diff --git a/doc/xml/structlncInfo.xml b/doc/xml/structlncInfo.xml index f6ea543..61c5878 100644 --- a/doc/xml/structlncInfo.xml +++ b/doc/xml/structlncInfo.xml @@ -1,11 +1,11 @@ - - - + + + lncInfo lnc.h - - arpcom + + struct arpcom struct arpcom lncInfo::arpcom arpcom @@ -15,41 +15,70 @@ - - initLNC - lncAttach + + initLNC - + int - int lncInfo::bdp + int lncInfo::bufferSize - bdp + bufferSize - - initLNC - readBcr - writeBcr + + initLNC + lnc_rxINT + lnc_sendPacket + lnc_thread + lncAttach - - initBlock * - struct initBlock* lncInfo::initBloack + + struct initBlock32 + struct initBlock32 lncInfo::init - initBloack + init - + + initLNC - - nicInfo + + unsigned int + unsigned int lncInfo::ioAddr + + ioAddr + + + + + + + + initLNC + lanceProbe + lnc_readBCR + lnc_readBCR32 + lnc_readCSR + lnc_readCSR32 + lnc_reset + lnc_reset32 + lnc_switchDWord + lnc_writeBCR + lnc_writeBCR32 + lnc_writeCSR + lnc_writeCSR32 + lncInt + + + struct nicInfo struct nicInfo lncInfo::nic nic @@ -59,11 +88,11 @@ - - initLNC - lncAttach + + initLNC + lncAttach - + int int lncInfo::nrdre @@ -74,11 +103,12 @@ - - initLNC - lncAttach + + initLNC + lnc_nextRxPtr + lncAttach - + int int lncInfo::ntdre @@ -89,72 +119,109 @@ - - initLNC - lncAttach + + initLNC + lnc_nextTxPtr + lncAttach - + + char * + char* lncInfo::rxBuffer + + rxBuffer + + + + + + + + lnc_rxINT + lnc_thread + lncAttach + + int - int lncInfo::rap + int lncInfo::rxPtr - rap + rxPtr - - initLNC - readBcr - readCsr - writeBcr - writeCsr + + lnc_driverOwnsRX + lnc_nextRxPtr + lnc_rxINT + lnc_thread - + + struct hostRingEntry * + struct hostRingEntry* lncInfo::rxRing + + rxRing + + + + + + + + initLNC + lnc_driverOwnsRX + lnc_rxINT + lnc_thread + lncAttach + + + char * + char* lncInfo::txBuffer + + txBuffer + + + + + + + + lnc_sendPacket + lncAttach + + int - int lncInfo::rdp + int lncInfo::txPtr - rdp + txPtr - - initLNC - lanceProbe - lncInt - readCsr - writeCsr + + lnc_driverOwnsTX + lnc_nextTxPtr + lnc_sendPacket - - hostRingEntry * - struct hostRingEntry* lncInfo::recvRing + + struct hostRingEntry * + struct hostRingEntry* lncInfo::txRing - recvRing + txRing - - lncAttach - - - hostRingEntry * - struct hostRingEntry* lncInfo::transRings - - transRings - - - - - - - + + initLNC + lnc_driverOwnsTX + lnc_sendPacket + lncAttach @@ -162,59 +229,55 @@ - - - - - - - - - + - - arpcom + + +arpcom - - nic + + +nic - - recvRing -transRings + + +txRing + +rxRing - - initBloack + + +init - + - + - - md - - + + + + + - + - lncInfoarpcom - lncInfobdp - lncInfoinitBloack - lncInfonic - lncInfonrdre - lncInfontdre - lncInforap - lncInfordp - lncInforecvRing - lncInfotransRings + lncInfoarpcom + lncInfobufferSize + lncInfoinit + lncInfoioAddr + lncInfonic + lncInfonrdre + lncInfontdre + lncInforxBuffer + lncInforxPtr + lncInforxRing + lncInfotxBuffer + lncInfotxPtr + lncInfotxRing diff --git a/doc/xml/structmMap.xml b/doc/xml/structmMap.xml index ffa7a8d..5e4f36a 100644 --- a/doc/xml/structmMap.xml +++ b/doc/xml/structmMap.xml @@ -1,10 +1,10 @@ - - - + + + mMap vmm.h - + int int mMap::cowCounter @@ -15,14 +15,12 @@ - - adjustCowCounter - freePage - vmmFreeProcessPages + + vmm_memMapInit - - uInt32 - uInt32 mMap::pageAddr + + uint32_t + uint32_t mMap::pageAddr pageAddr @@ -31,11 +29,11 @@ - - vmmMemMapInit + + vmm_memMapInit - - pid_t + + pid_t pid_t mMap::pid pid @@ -45,16 +43,12 @@ - - adjustCowCounter - freePage - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit + + vmm_memMapInit - - uInt16 - uInt16 mMap::reserved + + u_int16_t + u_int16_t mMap::reserved reserved @@ -63,11 +57,11 @@ - + - - uInt16 - uInt16 mMap::status + + u_int16_t + u_int16_t mMap::status status @@ -76,23 +70,27 @@ - - adjustCowCounter - freePage - vmmMemMapInit + + vmm_memMapInit - + + + + + + + - mMapcowCounter - mMappageAddr - mMappid - mMapreserved - mMapstatus + mMapcowCounter + mMappageAddr + mMappid + mMapreserved + mMapstatus diff --git a/doc/xml/structmds.xml b/doc/xml/structmds.xml index ce790d9..0335abc 100644 --- a/doc/xml/structmds.xml +++ b/doc/xml/structmds.xml @@ -1,12 +1,12 @@ - - - + + + mds lnc.h - - uInt16 - uInt16 mds::md0 + + uint16_t + uint16_t mds::md0 md0 @@ -15,11 +15,11 @@ - + - - uInt16 - uInt16 mds::md1 + + uint16_t + uint16_t mds::md1 md1 @@ -28,9 +28,9 @@ - + - + short short mds::md2 @@ -41,11 +41,11 @@ - + - - uInt16 - uInt16 mds::md3 + + uint16_t + uint16_t mds::md3 md3 @@ -54,19 +54,25 @@ - + - + + + + + + + - mdsmd0 - mdsmd1 - mdsmd2 - mdsmd3 + mdsmd0 + mdsmd1 + mdsmd2 + mdsmd3 diff --git a/doc/xml/structmemDescriptor.xml b/doc/xml/structmemDescriptor.xml index 9109c28..766adeb 100644 --- a/doc/xml/structmemDescriptor.xml +++ b/doc/xml/structmemDescriptor.xml @@ -1,10 +1,10 @@ - - - + + + memDescriptor kmalloc.h - + void * void* memDescriptor::baseAddr @@ -15,13 +15,11 @@ - - kfree - kmalloc - mergeMemBlocks + + kfree - - uInt32 + + uInt32 uInt32 memDescriptor::limit limit @@ -31,14 +29,10 @@ - - insertFreeDesc - kfree - kmalloc - mergeMemBlocks + - - memDescriptor * + + struct memDescriptor * struct memDescriptor* memDescriptor::next next @@ -48,15 +42,10 @@ - - getEmptyDesc - insertFreeDesc - kfree - kmalloc - mergeMemBlocks + - - memDescriptor * + + struct memDescriptor * struct memDescriptor* memDescriptor::prev prev @@ -66,12 +55,7 @@ - - getEmptyDesc - insertFreeDesc - kfree - kmalloc - mergeMemBlocks + @@ -79,21 +63,21 @@ - + - - prev -next + + +prev + +next - + - memDescriptorbaseAddr - memDescriptorlimit - memDescriptornext - memDescriptorprev + memDescriptorbaseAddr + memDescriptorlimit + memDescriptornext + memDescriptorprev diff --git a/doc/xml/structmpi__mbox.xml b/doc/xml/structmpi__mbox.xml index 3b4324d..2a52be7 100644 --- a/doc/xml/structmpi__mbox.xml +++ b/doc/xml/structmpi__mbox.xml @@ -1,11 +1,11 @@ - - - + + + mpi_mbox mpi.h - - mpi_message * + + struct mpi_message * struct mpi_message* mpi_mbox::msg msg @@ -15,13 +15,10 @@ - - mpi_fetchMessage - mpi_postMessage - mpi_spam + - - mpi_message * + + struct mpi_message * struct mpi_message* mpi_mbox::msgLast msgLast @@ -31,11 +28,9 @@ - - mpi_postMessage - mpi_spam + - + char char mpi_mbox::name[64] [64] @@ -46,13 +41,10 @@ - - mpi_createMbox - mpi_destroyMbox - mpi_findMbox + - - mpi_mbox * + + struct mpi_mbox * struct mpi_mbox* mpi_mbox::next next @@ -62,14 +54,10 @@ - - mpi_createMbox - mpi_destroyMbox - mpi_findMbox - mpi_spam + - - pidType + + pidType pidType mpi_mbox::pid pid @@ -79,13 +67,10 @@ - - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage + - - mpi_mbox * + + struct mpi_mbox * struct mpi_mbox* mpi_mbox::prev prev @@ -95,9 +80,7 @@ - - mpi_createMbox - mpi_destroyMbox + @@ -105,34 +88,34 @@ - + - - next + + +next - + - - msgLast -msg + + +msg + +msgLast - - prev -next + + +prev + +next - + - mpi_mboxmsg - mpi_mboxmsgLast - mpi_mboxname - mpi_mboxnext - mpi_mboxpid - mpi_mboxprev + mpi_mboxmsg + mpi_mboxmsgLast + mpi_mboxname + mpi_mboxnext + mpi_mboxpid + mpi_mboxprev diff --git a/doc/xml/structmpi__message.xml b/doc/xml/structmpi__message.xml index a2eb089..28cd786 100644 --- a/doc/xml/structmpi__message.xml +++ b/doc/xml/structmpi__message.xml @@ -1,10 +1,10 @@ - - - + + + mpi_message mpi.h - + char char mpi_message::data[248] [248] @@ -15,14 +15,11 @@ - - mpi_fetchMessage - mpi_postMessage - mpi_spam - systemTask + + systemTask - - uInt32 + + uInt32 uInt32 mpi_message::header header @@ -32,15 +29,11 @@ - - mpi_fetchMessage - mpi_postMessage - mpi_spam - systemTask - ubixfs_thread + + systemTask - - mpi_message * + + struct mpi_message * struct mpi_message* mpi_message::next next @@ -50,13 +43,10 @@ - - mpi_fetchMessage - mpi_postMessage - mpi_spam + - - pidType + + pidType pidType mpi_message::pid pid @@ -66,10 +56,8 @@ - - mpi_fetchMessage - mpi_postMessage - systemTask + + systemTask @@ -77,20 +65,20 @@ - + - - next + + +next - + - mpi_messagedata - mpi_messageheader - mpi_messagenext - mpi_messagepid + mpi_messagedata + mpi_messageheader + mpi_messagenext + mpi_messagepid diff --git a/doc/xml/structnet.xml b/doc/xml/structnet.xml index fc5b95a..90b6ffd 100644 --- a/doc/xml/structnet.xml +++ b/doc/xml/structnet.xml @@ -1,10 +1,10 @@ - - - + + + net device.old.h - + char char net::broadcast[6] [6] @@ -15,9 +15,9 @@ - + - + char char net::mac[6] [6] @@ -28,17 +28,23 @@ - + - + + + + + + + - netbroadcast - netmac + netbroadcast + netmac diff --git a/doc/xml/structnetif.xml b/doc/xml/structnetif.xml index 8538e0c..5c31e5a 100644 --- a/doc/xml/structnetif.xml +++ b/doc/xml/structnetif.xml @@ -1,84 +1,104 @@ - - - + + + netif netif.h - - ip_addr - struct ip_addr netif::gw + + u8_t + u8_t netif::flags - gw + flags +flags (Flags) + + - - ethernetif_output + + netif_add + netif_input + netif_remove + netif_set_down + netif_set_link_down + netif_set_link_up + netif_set_up - - char - char netif::hwaddr[6] - [6] + + u8_t + u8_t netif::hwaddr[6U] + [6U] hwaddr +link level hardware address of this interface - - ethernetif_init + - - err_t(* - err_t(* netif::input)(struct pbuf *p, struct netif *inp) - )(struct pbuf *p, struct netif *inp) + + u8_t + u8_t netif::hwaddr_len + + hwaddr_len + + + +number of bytes used in hwaddr + + + + + + + netif_input_fn + netif_input_fn netif::input + input +This function is called by the network device driver to pass a packet up the TCP/IP stack. - - ethernetif_input - loopif_output + - - ip_addr - struct ip_addr netif::ip_addr + + netif_linkoutput_fn + netif_linkoutput_fn netif::linkoutput - ip_addr - - - - - - - - arp_arp_input - arp_ip_input - arp_query - ethernetif_output - - - err_t(* - err_t(* netif::linkoutput)(struct netif *netif, struct pbuf *p) - )(struct netif *netif, struct pbuf *p) linkoutput +This function is called by ethernet_output() when it wants to send a packet on the interface. This function outputs the pbuf as-is on the link medium. - - ethernetif_init + + ethernetif_init - + + u16_t + u16_t netif::mtu + + mtu + + + +maximum transfer unit (in bytes) + + + + + + char char netif::name[2] [2] @@ -86,70 +106,49 @@ +descriptive abbreviation - - ethernetif_init - loopif_init + + ethernetif_init + loopif_init + netif_find + netif_set_default - - ip_addr - struct ip_addr netif::netmask - - netmask - - - - - - - - arp_ip_input - ethernetif_output - - - netif * + + struct netif * struct netif* netif::next next +pointer to next in linked list - + + netif_find + netif_remove - - uInt8 - uInt8 netif::num + + u8_t + u8_t netif::num num +number of this interface - + + netif_add + netif_find - - err_t(* - err_t(* netif::output)(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) - )(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) - output - - - - - - - - ethernetif_init - loopif_init - - + void * void* netif::state @@ -157,51 +156,53 @@ +This field can be set by the device driver and could point to state information for the device. - - ethernetif_init - ethernetif_input - ethernetif_output - low_level_init + + ethernetif_init + ethernetif_input + netif_add +Generic data structure used for all lwIP network interfaces. The following fields should be filled in by the initialization function for the device driver: hwaddr_len, hwaddr[], mtu, flags - - - + + + + + +next + - + - - next + + +linkoutput + +next - - netmask -ip_addr -gw + + +input - + - netifgw - netifhwaddr - netifinput - netifip_addr - netiflinkoutput - netifname - netifnetmask - netifnext - netifnum - netifoutput - netifstate + netifflags + netifhwaddr + netifhwaddr_len + netifinput + netiflinkoutput + netifmtu + netifname + netifnext + netifnum + netifstate diff --git a/doc/xml/structnicBuffer.xml b/doc/xml/structnicBuffer.xml index 80ad98d..e68c9a5 100644 --- a/doc/xml/structnicBuffer.xml +++ b/doc/xml/structnicBuffer.xml @@ -1,10 +1,10 @@ - - - + + + nicBuffer - ne2k.h + netif.h - + char * char* nicBuffer::buffer @@ -15,12 +15,11 @@ - - dp_pkt2user - ne2kAllocBuffer - ne2kFreeBuffer + + lnc_rxINT + lnc_thread - + int int nicBuffer::length @@ -31,11 +30,12 @@ - - ne2kAllocBuffer + + lnc_rxINT + lnc_thread - - nicBuffer * + + struct nicBuffer * struct nicBuffer* nicBuffer::next next @@ -45,9 +45,7 @@ - - ne2kAllocBuffer - ne2kGetBuffer + @@ -55,19 +53,19 @@ - + - - next + + +next - + - nicBufferbuffer - nicBufferlength - nicBuffernext + nicBufferbuffer + nicBufferlength + nicBuffernext diff --git a/doc/xml/structnicInfo.xml b/doc/xml/structnicInfo.xml index 5a72836..00f5da2 100644 --- a/doc/xml/structnicInfo.xml +++ b/doc/xml/structnicInfo.xml @@ -1,10 +1,10 @@ - - - + + + nicInfo lnc.h - + int int nicInfo::ic @@ -15,11 +15,11 @@ - - initLNC - lncAttach + + initLNC + lncAttach - + int int nicInfo::ident @@ -30,11 +30,10 @@ - - initLNC - lncAttach + + initLNC - + int int nicInfo::iobase @@ -45,9 +44,9 @@ - + - + int int nicInfo::memMode @@ -58,11 +57,11 @@ - - initLNC - lncAttach + + initLNC + lncAttach - + int int nicInfo::mode @@ -73,21 +72,27 @@ - - lncAttach + + lncAttach - + + + + + + + - nicInfoic - nicInfoident - nicInfoiobase - nicInfomemMode - nicInfomode + nicInfoic + nicInfoident + nicInfoiobase + nicInfomemMode + nicInfomode diff --git a/doc/xml/structobreak__args.xml b/doc/xml/structobreak__args.xml index 37faab2..9751843 100644 --- a/doc/xml/structobreak__args.xml +++ b/doc/xml/structobreak__args.xml @@ -1,10 +1,10 @@ - - - + + + obreak_args - sysproto.h + sysproto_posix.h - + char * char* obreak_args::nsize @@ -15,10 +15,9 @@ - - obreak + - + char char obreak_args::nsize_l_[0] [0] @@ -29,12 +28,12 @@ - + - + char - char obreak_args::nsize_r_[(sizeof(register_t)<=sizeof(char *)?0:sizeof(register_t)-sizeof(char *))] - [(sizeof(register_t)<=sizeof(char *)?0:sizeof(register_t)-sizeof(char *))] + char obreak_args::nsize_r_[(sizeof(register_t)<=sizeof(char *) ? 0 :sizeof(register_t) - sizeof(char *))] + [(sizeof(register_t)<=sizeof(char *) ? 0 :sizeof(register_t) - sizeof(char *))] nsize_r_ @@ -42,18 +41,24 @@ - + - + + + + + + + - obreak_argsnsize - obreak_argsnsize_l_ - obreak_argsnsize_r_ + obreak_argsnsize + obreak_argsnsize_l_ + obreak_argsnsize_r_ diff --git a/doc/xml/structogModeInfo.xml b/doc/xml/structogModeInfo.xml index a30a79d..9f9bdb7 100644 --- a/doc/xml/structogModeInfo.xml +++ b/doc/xml/structogModeInfo.xml @@ -1,16 +1,16 @@ - - - + + + ogModeInfo ogDisplay_UbixOS.h - - uInt8 paddington[461] - uInt8 paddington [461] ogModeInfo::__attribute__ + + uint16_t modeAttributes + uint16_t modeAttributes ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -18,15 +18,15 @@ - + - - uInt16 offScreenMemSize - uInt16 offScreenMemSize ogModeInfo::__attribute__ + + uint8_t windowAFlags + uint8_t windowAFlags ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -34,15 +34,15 @@ - + - - void *offScreenMemOffset - void* offScreenMemOffset ogModeInfo::__attribute__ + + uint8_t windowBFlags + uint8_t windowBFlags ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -50,15 +50,15 @@ - + - - uInt32 physBasePtr - uInt32 physBasePtr ogModeInfo::__attribute__ + + uint16_t granularity + uint16_t granularity ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -66,15 +66,15 @@ - + - - uInt8 directColourMode - uInt8 directColourMode ogModeInfo::__attribute__ + + uint16_t windowSize + uint16_t windowSize ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -82,15 +82,15 @@ - + - - uInt8 alphaFieldPosition - uInt8 alphaFieldPosition ogModeInfo::__attribute__ + + uint16_t windowASeg + uint16_t windowASeg ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -98,15 +98,15 @@ - + - - uInt8 alphaMaskSize - uInt8 alphaMaskSize ogModeInfo::__attribute__ + + uint16_t windowBSeg + uint16_t windowBSeg ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -114,303 +114,15 @@ - + - - uInt8 blueFieldPosition - uInt8 blueFieldPosition ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 blueMaskSize - uInt8 blueMaskSize ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 greenFieldPosition - uInt8 greenFieldPosition ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 greenMaskSize - uInt8 greenMaskSize ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 redFieldPosition - uInt8 redFieldPosition ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 redMaskSize - uInt8 redMaskSize ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 reserved - uInt8 reserved ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 numOfImagePages - uInt8 numOfImagePages ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 bankSize - uInt8 bankSize ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 memoryModel - uInt8 memoryModel ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 numberOfBanks - uInt8 numberOfBanks ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 bitsPerPixel - uInt8 bitsPerPixel ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 numBitPlanes - uInt8 numBitPlanes ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 charHeight - uInt8 charHeight ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 charWidth - uInt8 charWidth ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 yRes - uInt16 yRes ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 xRes - uInt16 xRes ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 bytesPerLine - uInt16 bytesPerLine ogModeInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - + void *bankSwitch void* bankSwitch ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -418,15 +130,15 @@ - + - - uInt16 windowBSeg - uInt16 windowBSeg ogModeInfo::__attribute__ + + uint16_t bytesPerLine + uint16_t bytesPerLine ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -434,15 +146,15 @@ - + - - uInt16 windowASeg - uInt16 windowASeg ogModeInfo::__attribute__ + + uint16_t xRes + uint16_t xRes ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -450,15 +162,15 @@ - + - - uInt16 windowSize - uInt16 windowSize ogModeInfo::__attribute__ + + uint16_t yRes + uint16_t yRes ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -466,15 +178,15 @@ - + - - uInt16 granularity - uInt16 granularity ogModeInfo::__attribute__ + + uint8_t charWidth + uint8_t charWidth ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -482,15 +194,15 @@ - + - - uInt8 windowBFlags - uInt8 windowBFlags ogModeInfo::__attribute__ + + uint8_t charHeight + uint8_t charHeight ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -498,15 +210,15 @@ - + - - uInt8 windowAFlags - uInt8 windowAFlags ogModeInfo::__attribute__ + + uint8_t numBitPlanes + uint8_t numBitPlanes ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -514,15 +226,15 @@ - + - - uInt16 modeAttributes - uInt16 modeAttributes ogModeInfo::__attribute__ + + uint8_t bitsPerPixel + uint8_t bitsPerPixel ogModeInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -530,48 +242,342 @@ - + + + + uint8_t numberOfBanks + uint8_t numberOfBanks ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t memoryModel + uint8_t memoryModel ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t bankSize + uint8_t bankSize ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t numOfImagePages + uint8_t numOfImagePages ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t reserved + uint8_t reserved ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t redMaskSize + uint8_t redMaskSize ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t redFieldPosition + uint8_t redFieldPosition ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t greenMaskSize + uint8_t greenMaskSize ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t greenFieldPosition + uint8_t greenFieldPosition ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t blueMaskSize + uint8_t blueMaskSize ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t blueFieldPosition + uint8_t blueFieldPosition ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t alphaMaskSize + uint8_t alphaMaskSize ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t alphaFieldPosition + uint8_t alphaFieldPosition ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t directColourMode + uint8_t directColourMode ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t physBasePtr + uint32_t physBasePtr ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + void *offScreenMemOffset + void* offScreenMemOffset ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint16_t offScreenMemSize + uint16_t offScreenMemSize ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t paddington[461] + uint8_t paddington [461] ogModeInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + - + + + + + + + - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ - ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ + ogModeInfo__attribute__ diff --git a/doc/xml/structogVESAInfo.xml b/doc/xml/structogVESAInfo.xml index fa4eb67..3e3c74c 100644 --- a/doc/xml/structogVESAInfo.xml +++ b/doc/xml/structogVESAInfo.xml @@ -1,192 +1,16 @@ - - - + + + ogVESAInfo ogDisplay_UbixOS.h - - uInt8 paddington[474] - uInt8 paddington [474] ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMProductRevPtr - uInt32 OEMProductRevPtr ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMProductNamePtr - uInt32 OEMProductNamePtr ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMVendorNamePtr - uInt32 OEMVendorNamePtr ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 OEMSoftwareRev - uInt16 OEMSoftwareRev ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt16 totalMemory - uInt16 totalMemory ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 videoModePtr - uInt32 videoModePtr ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 capabilities - uInt32 capabilities ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt32 OEMStringPtr - uInt32 OEMStringPtr ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 majVersion - uInt8 majVersion ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - - uInt8 minVersion - uInt8 minVersion ogVESAInfo::__attribute__ - ((packed)) - __attribute__ - - (packed) - - - - - - - - - - + char VBESignature[4] char VBESignature [4] ogVESAInfo::__attribute__ ((packed)) __attribute__ - (packed) + (packed) @@ -194,27 +18,209 @@ - + + + + uint8_t minVersion + uint8_t minVersion ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t majVersion + uint8_t majVersion ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t OEMStringPtr + uint32_t OEMStringPtr ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t capabilities + uint32_t capabilities ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t videoModePtr + uint32_t videoModePtr ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint16_t totalMemory + uint16_t totalMemory ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint16_t OEMSoftwareRev + uint16_t OEMSoftwareRev ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t OEMVendorNamePtr + uint32_t OEMVendorNamePtr ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t OEMProductNamePtr + uint32_t OEMProductNamePtr ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint32_t OEMProductRevPtr + uint32_t OEMProductRevPtr ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + + + + uint8_t paddington[474] + uint8_t paddington [474] ogVESAInfo::__attribute__ + ((packed)) + __attribute__ + + (packed) + + + + + + + + - + + + + + + + - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ - ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ + ogVESAInfo__attribute__ diff --git a/doc/xml/structosInfo.xml b/doc/xml/structosInfo.xml index 9184740..a0e2366 100644 --- a/doc/xml/structosInfo.xml +++ b/doc/xml/structosInfo.xml @@ -1,11 +1,11 @@ - - - + + + osInfo sched.h - - uInt32 + + uInt32 uInt32 osInfo::controlKeys controlKeys @@ -15,9 +15,9 @@ - + - + char char osInfo::cwd[1024] [1024] @@ -28,13 +28,30 @@ - - fork_copyProcess - sysChDir - sysGetCwd - sysMkDir + + fopen + fork_copyProcess + sys_chdir + sys_fchdir + sys_fork + sys_getcwd + sysGetCwd + sysMkDir - + + uint8_t + uint8_t osInfo::gpf + + gpf + + + + + + + + + char * char* osInfo::stdin @@ -45,10 +62,10 @@ - + - - uInt32 + + uInt32 uInt32 osInfo::stdinSize stdinSize @@ -58,10 +75,10 @@ - + - - uInt8 + + uInt8 uInt8 osInfo::timer timer @@ -71,11 +88,10 @@ - - _int13 + - - bool + + bool bool osInfo::v86If v86If @@ -85,11 +101,10 @@ - - _int13 + - - uInt8 + + uInt8 uInt8 osInfo::v86Task v86Task @@ -99,11 +114,11 @@ - - biosCall + + biosCall - - uInt32 + + uInt32 uInt32 osInfo::vmStart vmStart @@ -113,30 +128,35 @@ - - execFile - execThread - fork_copyProcess - sys_exec - sysExec - vmmGetFreeVirtualPage - vmmMapFromTask + + execFile + execThread + fork_copyProcess + sys_fork + sysExec - + + + + + + + - osInfocontrolKeys - osInfocwd - osInfostdin - osInfostdinSize - osInfotimer - osInfov86If - osInfov86Task - osInfovmStart + osInfocontrolKeys + osInfocwd + osInfogpf + osInfostdin + osInfostdinSize + osInfotimer + osInfov86If + osInfov86Task + osInfovmStart diff --git a/doc/xml/structpartitionInformation.xml b/doc/xml/structpartitionInformation.xml index 2e63fee..dfd75e2 100644 --- a/doc/xml/structpartitionInformation.xml +++ b/doc/xml/structpartitionInformation.xml @@ -1,11 +1,11 @@ - - - + + + partitionInformation - ubixfs.h + ubixfs.h - - uInt32 + + uInt32 uInt32 partitionInformation::blockAllocationTable blockAllocationTable @@ -15,10 +15,10 @@ - + - - uInt32 + + uInt32 uInt32 partitionInformation::rootDirectory rootDirectory @@ -28,10 +28,10 @@ - + - - uInt32 + + uInt32 uInt32 partitionInformation::size size @@ -41,10 +41,10 @@ - + - - uInt32 + + uInt32 uInt32 partitionInformation::startSector startSector @@ -54,19 +54,25 @@ - + - + + + + + + + - partitionInformationblockAllocationTable - partitionInformationrootDirectory - partitionInformationsize - partitionInformationstartSector + partitionInformationblockAllocationTable + partitionInformationrootDirectory + partitionInformationsize + partitionInformationstartSector diff --git a/doc/xml/structpbuf.xml b/doc/xml/structpbuf.xml index b3d0aa5..6740af0 100644 --- a/doc/xml/structpbuf.xml +++ b/doc/xml/structpbuf.xml @@ -1,60 +1,79 @@ - - - + + + pbuf pbuf.h - - uInt8 - uInt8 pbuf::flags + + u8_t + u8_t pbuf::flags flags +misc flags - + + pbuf_alloc + pbuf_realloc - - uInt16 - uInt16 pbuf::len + + u16_t + u16_t pbuf::len len +length of this buffer - - loopif_output - low_level_input - low_level_output - netbuf_copy_partial - netbuf_data - netbuf_ref + + inet_chksum + inet_chksum_pbuf + lwip_strnicmp + pbuf_alloc + pbuf_cat + pbuf_copy + pbuf_copy_partial + pbuf_dechain + pbuf_memcmp + pbuf_put_at + pbuf_realloc + pbuf_take + pbuf_take_at - - pbuf * + + struct pbuf * struct pbuf* pbuf::next next +next pbuf in singly linked pbuf chain - - loopif_output - low_level_input - low_level_output - netbuf_copy_partial - netbuf_next + + inet_chksum_pbuf + pbuf_alloc + pbuf_cat + pbuf_clen + pbuf_coalesce + pbuf_copy_partial + pbuf_dechain + pbuf_free + pbuf_memcmp + pbuf_realloc + pbuf_take + pbuf_take_at - + void * void* pbuf::payload @@ -62,78 +81,105 @@ +pointer to the actual data in the buffer - - arp_arp_input - arp_ip_input - arp_query - ethernetif_input - ethernetif_output - loopif_output - low_level_input - low_level_output - netbuf_alloc - netbuf_copy_partial - netbuf_data - netbuf_ref + + arp_arp_input + arp_ip_input + arp_query + inet_chksum_pbuf + pbuf_alloc + pbuf_copy_partial + pbuf_put_at + pbuf_realloc + pbuf_take + pbuf_take_at - - uInt8 - uInt8 pbuf::ref + + u16_t + u16_t pbuf::ref ref +the reference count always equals the number of pointers that refer to this pbuf. This can be pointers from an application, the stack itself, or pbuf->next pointers from a chain. - + + pbuf_alloc + pbuf_free + pbuf_ref - - uInt16 - uInt16 pbuf::tot_len + + u16_t + u16_t pbuf::tot_len tot_len +total length of this buffer and all next buffers in chain belonging to the same packet. +For non-queue packet chains this is the invariant: p->tot_len == p->len + (p->next? p->next->tot_len: 0) - - arp_arp_input - loopif_output - low_level_output - netbuf_len - netbuf_ref - netconn_recv - netconn_send + + arp_arp_input + pbuf_alloc + pbuf_cat + pbuf_coalesce + pbuf_dechain + pbuf_memcmp + pbuf_memfind + pbuf_realloc + pbuf_strstr + pbuf_take_at + + + u8_t + u8_t pbuf::type + + type + + + +pbuf_type as u8_t instead of enum to save space + + + + + pbuf_alloc + pbuf_free + pbuf_realloc +Main packet buffer struct - + - - next + + +next - + - pbufflags - pbuflen - pbufnext - pbufpayload - pbufref - pbuftot_len + pbufflags + pbuflen + pbufnext + pbufpayload + pbufref + pbuftot_len + pbuftype diff --git a/doc/xml/structpciConfig.xml b/doc/xml/structpciConfig.xml index c8be4bb..61ba714 100644 --- a/doc/xml/structpciConfig.xml +++ b/doc/xml/structpciConfig.xml @@ -1,41 +1,26 @@ - - - + + + pciConfig pci.h - - uInt32 - uInt32 pciConfig::base[6] + + uint32_t + uint32_t pciConfig::bar[6] [6] - base + bar - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::baseClass - - baseClass - - - - - - - - pci_init - pciProbe - - - uInt8 - uInt8 pciConfig::bist + + uint8_t + uint8_t pciConfig::bist bist @@ -44,12 +29,12 @@ - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::bus + + uint8_t + uint8_t pciConfig::bus bus @@ -58,12 +43,13 @@ - - pciProbe + + pci_init + pciProbe - - uInt8 - uInt8 pciConfig::cacheLineSize + + uint8_t + uint8_t pciConfig::cacheLineSize cacheLineSize @@ -72,12 +58,53 @@ - - pciProbe + + pciProbe - - uInt16 - uInt16 pciConfig::command + + uint16_t + uint16_t pciConfig::capabilites + + capabilites + + + + + + + + + + uint32_t + uint32_t pciConfig::cbPointer + + cbPointer + + + + + + + + + + uint8_t + uint8_t pciConfig::classCode + + classCode + + + + + + + + pci_init + pciProbe + + + uint16_t + uint16_t pciConfig::command command @@ -86,12 +113,12 @@ - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::dev + + uint8_t + uint8_t pciConfig::dev dev @@ -100,26 +127,40 @@ - - pciProbe + + pci_init + pciProbe - - uInt16 - uInt16 pciConfig::deviceId + + uint16_t + uint16_t pciConfig::deviceID - deviceId + deviceID - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::func + + uint32_t + uint32_t pciConfig::epromAddr + + epromAddr + + + + + + + + + + uint8_t + uint8_t pciConfig::func func @@ -128,12 +169,13 @@ - - pciProbe + + pci_init + pciProbe - - uInt8 - uInt8 pciConfig::headerType + + uint8_t + uint8_t pciConfig::headerType headerType @@ -142,42 +184,42 @@ - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::interface + + uint8_t + uint8_t pciConfig::intLine - interface + intLine - - pci_init - pciProbe + + pci_init + pciProbe - - uInt8 - uInt8 pciConfig::irq + + uint8_t + uint8_t pciConfig::intPin - irq + intPin - - pci_init - pciProbe + + pci_init + pciProbe - - uInt8 - uInt8 pciConfig::latencyTimer + + uint8_t + uint8_t pciConfig::latencyTimer latencyTimer @@ -186,39 +228,92 @@ - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::revisionId + + uint8_t + uint8_t pciConfig::maxLatency - revisionId + maxLatency - + - - uInt32 - uInt32 pciConfig::size[6] - [6] - size + + uint8_t + uint8_t pciConfig::minGrant + + minGrant - - pciProbe + - - uInt16 - uInt16 pciConfig::status + + uint8_t + uint8_t pciConfig::progIf + + progIf + + + + + + + + pci_init + pciProbe + + + uint16_t + uint16_t pciConfig::res1 + + res1 + + + + + + + + + + uint32_t + uint32_t pciConfig::res2 + + res2 + + + + + + + + + + uint8_t + uint8_t pciConfig::revisionID + + revisionID + + + + + + + + + + uint16_t + uint16_t pciConfig::status status @@ -227,12 +322,12 @@ - - pciProbe + + pciProbe - - uInt8 - uInt8 pciConfig::subClass + + uint8_t + uint8_t pciConfig::subClass subClass @@ -241,79 +336,91 @@ - - pci_init - pciProbe + + pci_init + pciProbe - - uInt16 - uInt16 pciConfig::subsys + + uint16_t + uint16_t pciConfig::subsysID - subsys + subsysID - - pciProbe + - - uInt16 - uInt16 pciConfig::subsysVendor + + uint16_t + uint16_t pciConfig::subsysVendorID - subsysVendor + subsysVendorID - - pciProbe + - - uInt16 - uInt16 pciConfig::vendorId + + uint16_t + uint16_t pciConfig::vendorID - vendorId + vendorID - - pciProbe + + pci_init + pciProbe - + + + + + + + - pciConfigbase - pciConfigbaseClass - pciConfigbist - pciConfigbus - pciConfigcacheLineSize - pciConfigcommand - pciConfigdev - pciConfigdeviceId - pciConfigfunc - pciConfigheaderType - pciConfiginterface - pciConfigirq - pciConfiglatencyTimer - pciConfigrevisionId - pciConfigsize - pciConfigstatus - pciConfigsubClass - pciConfigsubsys - pciConfigsubsysVendor - pciConfigvendorId + pciConfigbar + pciConfigbist + pciConfigbus + pciConfigcacheLineSize + pciConfigcapabilites + pciConfigcbPointer + pciConfigclassCode + pciConfigcommand + pciConfigdev + pciConfigdeviceID + pciConfigepromAddr + pciConfigfunc + pciConfigheaderType + pciConfigintLine + pciConfigintPin + pciConfiglatencyTimer + pciConfigmaxLatency + pciConfigminGrant + pciConfigprogIf + pciConfigres1 + pciConfigres2 + pciConfigrevisionID + pciConfigstatus + pciConfigsubClass + pciConfigsubsysID + pciConfigsubsysVendorID + pciConfigvendorID diff --git a/doc/xml/structpipe__args.xml b/doc/xml/structpipe__args.xml index 1eed31f..f93285e 100644 --- a/doc/xml/structpipe__args.xml +++ b/doc/xml/structpipe__args.xml @@ -1,11 +1,11 @@ - - - + + + pipe_args - sysproto.h + sysproto_posix.h - - register_t + + register_t register_t pipe_args::dummy dummy @@ -15,16 +15,22 @@ - + - + + + + + + + - pipe_argsdummy + pipe_argsdummy diff --git a/doc/xml/structreadlink__args.xml b/doc/xml/structreadlink__args.xml index 1942ef6..ff8df24 100644 --- a/doc/xml/structreadlink__args.xml +++ b/doc/xml/structreadlink__args.xml @@ -1,10 +1,10 @@ - - - + + + readlink_args - sysproto.h + sysproto_posix.h - + char * char* readlink_args::buf @@ -15,9 +15,9 @@ - + - + char char readlink_args::buf_l_[0] [0] @@ -28,12 +28,12 @@ - + - + char - char readlink_args::buf_r_[(sizeof(register_t)<=sizeof(char *)?0:sizeof(register_t)-sizeof(char *))] - [(sizeof(register_t)<=sizeof(char *)?0:sizeof(register_t)-sizeof(char *))] + char readlink_args::buf_r_[(sizeof(register_t)<=sizeof(char *) ? 0 :sizeof(register_t) - sizeof(char *))] + [(sizeof(register_t)<=sizeof(char *) ? 0 :sizeof(register_t) - sizeof(char *))] buf_r_ @@ -41,9 +41,9 @@ - + - + int int readlink_args::count @@ -54,10 +54,10 @@ - - readlink + + readlink - + char char readlink_args::count_l_[0] [0] @@ -68,12 +68,12 @@ - + - + char - char readlink_args::count_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char readlink_args::count_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] count_r_ @@ -81,9 +81,9 @@ - + - + char * char* readlink_args::path @@ -94,10 +94,10 @@ - - readlink + + readlink - + char char readlink_args::path_l_[0] [0] @@ -108,12 +108,12 @@ - + - + char - char readlink_args::path_r_[(sizeof(register_t)<=sizeof(char *)?0:sizeof(register_t)-sizeof(char *))] - [(sizeof(register_t)<=sizeof(char *)?0:sizeof(register_t)-sizeof(char *))] + char readlink_args::path_r_[(sizeof(register_t)<=sizeof(char *) ? 0 :sizeof(register_t) - sizeof(char *))] + [(sizeof(register_t)<=sizeof(char *) ? 0 :sizeof(register_t) - sizeof(char *))] path_r_ @@ -121,24 +121,30 @@ - + - + + + + + + + - readlink_argsbuf - readlink_argsbuf_l_ - readlink_argsbuf_r_ - readlink_argscount - readlink_argscount_l_ - readlink_argscount_r_ - readlink_argspath - readlink_argspath_l_ - readlink_argspath_r_ + readlink_argsbuf + readlink_argsbuf_l_ + readlink_argsbuf_r_ + readlink_argscount + readlink_argscount_l_ + readlink_argscount_r_ + readlink_argspath + readlink_argspath_l_ + readlink_argspath_r_ diff --git a/doc/xml/structsdeWindows.xml b/doc/xml/structsdeWindows.xml index d8660ae..9b7ae6c 100644 --- a/doc/xml/structsdeWindows.xml +++ b/doc/xml/structsdeWindows.xml @@ -1,10 +1,10 @@ - - - + + + sdeWindows sde.h - + void * void* sdeWindows::buf @@ -15,10 +15,11 @@ - + + sdeThread - - sdeWindows * + + struct sdeWindows * struct sdeWindows* sdeWindows::next next @@ -28,10 +29,12 @@ - + + sdeThread + sysSDE - - pidType + + pidType pidType sdeWindows::pid pid @@ -41,10 +44,11 @@ - + + sdeThread - - sdeWindows * + + struct sdeWindows * struct sdeWindows* sdeWindows::prev prev @@ -54,11 +58,13 @@ - + + sdeThread + sysSDE - - uInt8 - uInt8 sdeWindows::status + + uint8_t + uint8_t sdeWindows::status status @@ -67,7 +73,8 @@ - + + sdeThread @@ -75,22 +82,22 @@ - + - - prev -next + + +prev + +next - + - sdeWindowsbuf - sdeWindowsnext - sdeWindowspid - sdeWindowsprev - sdeWindowsstatus + sdeWindowsbuf + sdeWindowsnext + sdeWindowspid + sdeWindowsprev + sdeWindowsstatus diff --git a/doc/xml/structsigaction__args.xml b/doc/xml/structsigaction__args.xml index cf14911..91e3e5d 100644 --- a/doc/xml/structsigaction__args.xml +++ b/doc/xml/structsigaction__args.xml @@ -1,12 +1,12 @@ - - - + + + sigaction_args - sysproto.h + sysproto_posix.h - - sigaction * - struct sigaction* sigaction_args::act + + const struct sigaction * + const struct sigaction* sigaction_args::act act @@ -15,9 +15,9 @@ - + - + char char sigaction_args::act_l_[0] [0] @@ -28,12 +28,12 @@ - + - + char - char sigaction_args::act_r_[(sizeof(register_t)<=sizeof(const struct sigaction *)?0:sizeof(register_t)-sizeof(const struct sigaction *))] - [(sizeof(register_t)<=sizeof(const struct sigaction *)?0:sizeof(register_t)-sizeof(const struct sigaction *))] + char sigaction_args::act_r_[(sizeof(register_t)<=sizeof(const struct sigaction *) ? 0 :sizeof(register_t) - sizeof(const struct sigaction *))] + [(sizeof(register_t)<=sizeof(const struct sigaction *) ? 0 :sizeof(register_t) - sizeof(const struct sigaction *))] act_r_ @@ -41,10 +41,10 @@ - + - - sigaction * + + struct sigaction * struct sigaction* sigaction_args::oact oact @@ -54,9 +54,9 @@ - + - + char char sigaction_args::oact_l_[0] [0] @@ -67,12 +67,12 @@ - + - + char - char sigaction_args::oact_r_[(sizeof(register_t)<=sizeof(struct sigaction *)?0:sizeof(register_t)-sizeof(struct sigaction *))] - [(sizeof(register_t)<=sizeof(struct sigaction *)?0:sizeof(register_t)-sizeof(struct sigaction *))] + char sigaction_args::oact_r_[(sizeof(register_t)<=sizeof(struct sigaction *) ? 0 :sizeof(register_t) - sizeof(struct sigaction *))] + [(sizeof(register_t)<=sizeof(struct sigaction *) ? 0 :sizeof(register_t) - sizeof(struct sigaction *))] oact_r_ @@ -80,9 +80,9 @@ - + - + int int sigaction_args::sig @@ -93,9 +93,9 @@ - + - + char char sigaction_args::sig_l_[0] [0] @@ -106,12 +106,12 @@ - + - + char - char sigaction_args::sig_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char sigaction_args::sig_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] sig_r_ @@ -119,24 +119,45 @@ - + - + + + + + + +act + +oact + + + + + + + +sa_mask + + + + + + + + - sigaction_argsact - sigaction_argsact_l_ - sigaction_argsact_r_ - sigaction_argsoact - sigaction_argsoact_l_ - sigaction_argsoact_r_ - sigaction_argssig - sigaction_argssig_l_ - sigaction_argssig_r_ + sigaction_argsact + sigaction_argsact_l_ + sigaction_argsact_r_ + sigaction_argsoact + sigaction_argsoact_l_ + sigaction_argsoact_r_ + sigaction_argssig + sigaction_argssig_l_ + sigaction_argssig_r_ diff --git a/doc/xml/structsigprocmask__args.xml b/doc/xml/structsigprocmask__args.xml index 50bcd3f..2c149a3 100644 --- a/doc/xml/structsigprocmask__args.xml +++ b/doc/xml/structsigprocmask__args.xml @@ -1,10 +1,10 @@ - - - + + + sigprocmask_args - sysproto.h + sysproto_posix.h - + int int sigprocmask_args::how @@ -15,9 +15,9 @@ - + - + char char sigprocmask_args::how_l_[0] [0] @@ -28,12 +28,12 @@ - + - + char - char sigprocmask_args::how_r_[(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] - [(sizeof(register_t)<=sizeof(int)?0:sizeof(register_t)-sizeof(int))] + char sigprocmask_args::how_r_[(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] + [(sizeof(register_t)<=sizeof(int) ? 0 :sizeof(register_t) - sizeof(int))] how_r_ @@ -41,10 +41,10 @@ - + - - sigset_t * + + sigset_t * sigset_t* sigprocmask_args::oset oset @@ -54,9 +54,9 @@ - + - + char char sigprocmask_args::oset_l_[0] [0] @@ -67,12 +67,12 @@ - + - + char - char sigprocmask_args::oset_r_[(sizeof(register_t)<=sizeof(sigset_t *)?0:sizeof(register_t)-sizeof(sigset_t *))] - [(sizeof(register_t)<=sizeof(sigset_t *)?0:sizeof(register_t)-sizeof(sigset_t *))] + char sigprocmask_args::oset_r_[(sizeof(register_t)<=sizeof(sigset_t *) ? 0 :sizeof(register_t) - sizeof(sigset_t *))] + [(sizeof(register_t)<=sizeof(sigset_t *) ? 0 :sizeof(register_t) - sizeof(sigset_t *))] oset_r_ @@ -80,10 +80,10 @@ - + - - const sigset_t * + + const sigset_t * const sigset_t* sigprocmask_args::set set @@ -93,9 +93,9 @@ - + - + char char sigprocmask_args::set_l_[0] [0] @@ -106,12 +106,12 @@ - + - + char - char sigprocmask_args::set_r_[(sizeof(register_t)<=sizeof(const sigset_t *)?0:sizeof(register_t)-sizeof(const sigset_t *))] - [(sizeof(register_t)<=sizeof(const sigset_t *)?0:sizeof(register_t)-sizeof(const sigset_t *))] + char sigprocmask_args::set_r_[(sizeof(register_t)<=sizeof(const sigset_t *) ? 0 :sizeof(register_t) - sizeof(const sigset_t *))] + [(sizeof(register_t)<=sizeof(const sigset_t *) ? 0 :sizeof(register_t) - sizeof(const sigset_t *))] set_r_ @@ -119,7 +119,7 @@ - + @@ -127,30 +127,30 @@ - + - - oset -set + + +set + +oset - + - + - sigprocmask_argshow - sigprocmask_argshow_l_ - sigprocmask_argshow_r_ - sigprocmask_argsoset - sigprocmask_argsoset_l_ - sigprocmask_argsoset_r_ - sigprocmask_argsset - sigprocmask_argsset_l_ - sigprocmask_argsset_r_ + sigprocmask_argshow + sigprocmask_argshow_l_ + sigprocmask_argshow_r_ + sigprocmask_argsoset + sigprocmask_argsoset_l_ + sigprocmask_argsoset_r_ + sigprocmask_argsset + sigprocmask_argsset_l_ + sigprocmask_argsset_r_ diff --git a/doc/xml/structstat.xml b/doc/xml/structstat.xml index c9def37..17f40ee 100644 --- a/doc/xml/structstat.xml +++ b/doc/xml/structstat.xml @@ -1,10 +1,10 @@ - - - + + + stat - kern_descrip.h + stat.h - + long long stat::__st_atimensec @@ -15,9 +15,9 @@ - + - + long long stat::__st_ctimensec @@ -28,9 +28,9 @@ - + - + long long stat::__st_mtimensec @@ -41,24 +41,24 @@ - + - + unsigned unsigned stat::int int - (8 / 2) * (16 - (int)sizeof(struct __timespec)) + (8 / 2) * (16 - (int) sizeof(struct __timespec)) - + - - time_t + + time_t time_t stat::st_atime st_atime @@ -68,10 +68,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - time_t + + time_t time_t stat::st_birthtime st_birthtime @@ -81,9 +84,9 @@ - + - + long long stat::st_birthtimensec @@ -94,10 +97,10 @@ - + - - blksize_t + + blksize_t blksize_t stat::st_blksize st_blksize @@ -107,11 +110,11 @@ - - fstat + + fstat - - blkcnt_t + + blkcnt_t blkcnt_t stat::st_blocks st_blocks @@ -121,10 +124,10 @@ - + - - time_t + + time_t time_t stat::st_ctime st_ctime @@ -134,10 +137,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - __dev_t + + __dev_t __dev_t stat::st_dev st_dev @@ -147,10 +153,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - fflags_t + + fflags_t fflags_t stat::st_flags st_flags @@ -160,10 +169,10 @@ - + - - __uint32_t + + __uint32_t __uint32_t stat::st_gen st_gen @@ -173,10 +182,10 @@ - + - - gid_t + + gid_t gid_t stat::st_gid st_gid @@ -186,10 +195,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - ino_t + + ino_t ino_t stat::st_ino st_ino @@ -199,10 +211,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - __int32_t + + __int32_t __int32_t stat::st_lspare st_lspare @@ -212,11 +227,11 @@ - + - - mode_t - mode_t stat::st_mode + + __mode_t + __mode_t stat::st_mode st_mode @@ -225,11 +240,14 @@ - - fstat + + _sys_stat + fstat + sys_fstat + sys_fstatat - - time_t + + time_t time_t stat::st_mtime st_mtime @@ -239,11 +257,14 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - nlink_t - nlink_t stat::st_nlink + + __nlink_t + __nlink_t stat::st_nlink st_nlink @@ -252,10 +273,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - __dev_t + + __dev_t __dev_t stat::st_rdev st_rdev @@ -265,10 +289,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - off_t + + off_t off_t stat::st_size st_size @@ -278,10 +305,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - uid_t + + uid_t uid_t stat::st_uid st_uid @@ -291,37 +321,46 @@ - + + _sys_stat + sys_fstat + sys_fstatat - + + + + + + + - stat__st_atimensec - stat__st_ctimensec - stat__st_mtimensec - statint - statst_atime - statst_birthtime - statst_birthtimensec - statst_blksize - statst_blocks - statst_ctime - statst_dev - statst_flags - statst_gen - statst_gid - statst_ino - statst_lspare - statst_mode - statst_mtime - statst_nlink - statst_rdev - statst_size - statst_uid + stat__st_atimensec + stat__st_ctimensec + stat__st_mtimensec + statint + statst_atime + statst_birthtime + statst_birthtimensec + statst_blksize + statst_blocks + statst_ctime + statst_dev + statst_flags + statst_gen + statst_gid + statst_ino + statst_lspare + statst_mode + statst_mtime + statst_nlink + statst_rdev + statst_size + statst_uid diff --git a/doc/xml/structsys__mbox.xml b/doc/xml/structsys__mbox.xml index 8fbdb5c..a5a7c2b 100644 --- a/doc/xml/structsys__mbox.xml +++ b/doc/xml/structsys__mbox.xml @@ -1,61 +1,67 @@ - - - + + + sys_mbox + sys_arch.h - - uInt16 - uInt16 sys_mbox::first + + struct sys_sem * + struct sys_sem* sys_mbox::empty - first + empty - - sys_arch_mbox_fetch - sys_mbox_new - sys_mbox_post + - - uInt16 - uInt16 sys_mbox::last + + struct sys_sem * + struct sys_sem* sys_mbox::full - last + full - - sys_arch_mbox_fetch - sys_mbox_new - sys_mbox_post + - - sys_sem * - struct sys_sem* sys_mbox::mail + + uint32_t + uint32_t sys_mbox::head - mail + head - - sys_arch_mbox_fetch - sys_mbox_free - sys_mbox_new - sys_mbox_post + + sys_mbox_post + sys_mbox_trypost - + + struct sys_sem * + struct sys_sem* sys_mbox::lock + + lock + + + + + + + + + void * - void* sys_mbox::msgs[SYS_MBOX_SIZE] - [SYS_MBOX_SIZE] + void* sys_mbox::msgs[100] + [100] msgs @@ -63,26 +69,33 @@ - - sys_arch_mbox_fetch - sys_mbox_post + - - sys_sem * - struct sys_sem* sys_mbox::mutex + + uint32_t + uint32_t sys_mbox::tail - mutex + tail - - sys_arch_mbox_fetch - sys_mbox_free - sys_mbox_new - sys_mbox_post + + + + int + int sys_mbox::wait_send + + wait_send + + + + + + + @@ -90,40 +103,43 @@ - + - - mutex -mail + + +lock + +full + +empty - + - + - + - - mutex + + +mutex - - cond + + +cond - + - sys_mboxfirst - sys_mboxlast - sys_mboxmail - sys_mboxmsgs - sys_mboxmutex + sys_mboxempty + sys_mboxfull + sys_mboxhead + sys_mboxlock + sys_mboxmsgs + sys_mboxtail + sys_mboxwait_send diff --git a/doc/xml/structsys__sem.xml b/doc/xml/structsys__sem.xml index 7d5bd15..95c1b47 100644 --- a/doc/xml/structsys__sem.xml +++ b/doc/xml/structsys__sem.xml @@ -1,26 +1,11 @@ - - - + + + sys_sem + sem.h - - unsigned int - unsigned int sys_sem::c - - c - - - - - - - - sys_arch_sem_wait - sys_sem_new_ - sys_sem_signal - - - ubthread_cond_t + + ubthread_cond_t ubthread_cond_t sys_sem::cond cond @@ -30,14 +15,14 @@ - - sys_arch_sem_wait - sys_sem_free_ - sys_sem_new_ - sys_sem_signal + + sem_destroy + sem_init + sys_sem_new + sys_sem_signal - - ubthread_mutex_t + + ubthread_mutex_t ubthread_mutex_t sys_sem::mutex mutex @@ -47,11 +32,29 @@ - - sys_arch_sem_wait - sys_sem_free_ - sys_sem_new_ - sys_sem_signal + + sem_destroy + sem_init + sys_arch_sem_wait + sys_sem_new + sys_sem_signal + + + uint32_t + uint32_t sys_sem::signaled + + signaled + + + + + + + + sem_init + sys_arch_sem_wait + sys_sem_new + sys_sem_signal @@ -59,30 +62,30 @@ - + - + - + - - mutex + + +mutex - - cond + + +cond - + - sys_semc - sys_semcond - sys_semmutex + sys_semcond + sys_semmutex + sys_semsignaled diff --git a/doc/xml/structsys__thread.xml b/doc/xml/structsys__thread.xml index 171ceb5..e2d66ef 100644 --- a/doc/xml/structsys__thread.xml +++ b/doc/xml/structsys__thread.xml @@ -1,10 +1,24 @@ - - - + + + sys_thread + sys_arch.h - - sys_thread * + + char + char sys_thread::name[128] + [128] + name + + + + + + + + + + struct sys_thread * struct sys_thread* sys_thread::next next @@ -14,12 +28,10 @@ - - current_thread - sys_thread_new + - - sys_timeouts + + struct sys_timeouts struct sys_timeouts sys_thread::timeouts timeouts @@ -29,12 +41,10 @@ - - sys_arch_timeouts - sys_thread_new + - - kTask_t * + + kTask_t * kTask_t* sys_thread::ubthread ubthread @@ -44,9 +54,7 @@ - - current_thread - sys_thread_new + @@ -54,175 +62,315 @@ - + - + + + + + - + - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + - - next + + +next - - ubthread + + +ubthread - - timeouts + + +timeouts - + + + + + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + - - prev -next + + +exec + +root + +pwd - - i387 + + +parent + +prev + +next - - td + + +i387 - - term + + +td - - imageFd + + +files - - oInfo + + +term - - tss + + +oInfo + + + +tss - + + + + + - - - - - next + + + + + +wait - + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + + + + + - - - - - - - - - prev -next + + + + + +wait - - - - - next + + + + + +task + + + +next + + + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + + + + + + + + + + + + + + + +prev + +next - + - sys_threadnext - sys_threadtimeouts - sys_threadubthread + sys_threadname + sys_threadnext + sys_threadtimeouts + sys_threadubthread diff --git a/doc/xml/structsys__timeouts.xml b/doc/xml/structsys__timeouts.xml index ce4fce6..d0ea1d0 100644 --- a/doc/xml/structsys__timeouts.xml +++ b/doc/xml/structsys__timeouts.xml @@ -1,11 +1,11 @@ - - - + + + sys_timeouts - sys.h + sys_arch.h - - sys_timeout * + + struct sys_timeout * struct sys_timeout* sys_timeouts::next next @@ -15,8 +15,7 @@ - - sys_thread_new + @@ -24,24 +23,14 @@ - + - - next - - - - - - - next - - + - sys_timeoutsnext + sys_timeoutsnext diff --git a/doc/xml/structsysctl__args.xml b/doc/xml/structsysctl__args.xml index 3e5b681..0a85807 100644 --- a/doc/xml/structsysctl__args.xml +++ b/doc/xml/structsysctl__args.xml @@ -1,10 +1,10 @@ - - - + + + sysctl_args - sysproto.h + sysproto_posix.h - + int * int* sysctl_args::name @@ -15,10 +15,9 @@ - - __sysctl + - + char char sysctl_args::name_l_[0] [0] @@ -29,12 +28,12 @@ - + - + char - char sysctl_args::name_r_[(sizeof(register_t)<=sizeof(int *)?0:sizeof(register_t)-sizeof(int *))] - [(sizeof(register_t)<=sizeof(int *)?0:sizeof(register_t)-sizeof(int *))] + char sysctl_args::name_r_[(sizeof(register_t)<=sizeof(int *) ? 0 :sizeof(register_t) - sizeof(int *))] + [(sizeof(register_t)<=sizeof(int *) ? 0 :sizeof(register_t) - sizeof(int *))] name_r_ @@ -42,10 +41,10 @@ - + - - u_int + + u_int u_int sysctl_args::namelen namelen @@ -55,10 +54,9 @@ - - __sysctl + - + char char sysctl_args::namelen_l_[0] [0] @@ -69,12 +67,12 @@ - + - + char - char sysctl_args::namelen_r_[(sizeof(register_t)<=sizeof(u_int)?0:sizeof(register_t)-sizeof(u_int))] - [(sizeof(register_t)<=sizeof(u_int)?0:sizeof(register_t)-sizeof(u_int))] + char sysctl_args::namelen_r_[(sizeof(register_t)<=sizeof(u_int) ? 0 :sizeof(register_t) - sizeof(u_int))] + [(sizeof(register_t)<=sizeof(u_int) ? 0 :sizeof(register_t) - sizeof(u_int))] namelen_r_ @@ -82,22 +80,9 @@ - + - - void * - void* sysctl_args::new - - new - - - - - - - - - + char char sysctl_args::new_l_[0] [0] @@ -108,12 +93,12 @@ - + - + char - char sysctl_args::new_r_[(sizeof(register_t)<=sizeof(void *)?0:sizeof(register_t)-sizeof(void *))] - [(sizeof(register_t)<=sizeof(void *)?0:sizeof(register_t)-sizeof(void *))] + char sysctl_args::new_r_[(sizeof(register_t)<=sizeof(void *) ? 0 :sizeof(register_t) - sizeof(void *))] + [(sizeof(register_t)<=sizeof(void *) ? 0 :sizeof(register_t) - sizeof(void *))] new_r_ @@ -121,10 +106,10 @@ - + - - size_t + + size_t size_t sysctl_args::newlen newlen @@ -134,10 +119,9 @@ - - __sysctl + - + char char sysctl_args::newlen_l_[0] [0] @@ -148,12 +132,12 @@ - + - + char - char sysctl_args::newlen_r_[(sizeof(register_t)<=sizeof(size_t)?0:sizeof(register_t)-sizeof(size_t))] - [(sizeof(register_t)<=sizeof(size_t)?0:sizeof(register_t)-sizeof(size_t))] + char sysctl_args::newlen_r_[(sizeof(register_t)<=sizeof(size_t) ? 0 :sizeof(register_t) - sizeof(size_t))] + [(sizeof(register_t)<=sizeof(size_t) ? 0 :sizeof(register_t) - sizeof(size_t))] newlen_r_ @@ -161,23 +145,22 @@ - + - + void * - void* sysctl_args::old + void* sysctl_args::newp - old + newp - - __sysctl + - + char char sysctl_args::old_l_[0] [0] @@ -188,12 +171,12 @@ - + - + char - char sysctl_args::old_r_[(sizeof(register_t)<=sizeof(void *)?0:sizeof(register_t)-sizeof(void *))] - [(sizeof(register_t)<=sizeof(void *)?0:sizeof(register_t)-sizeof(void *))] + char sysctl_args::old_r_[(sizeof(register_t)<=sizeof(void *) ? 0 :sizeof(register_t) - sizeof(void *))] + [(sizeof(register_t)<=sizeof(void *) ? 0 :sizeof(register_t) - sizeof(void *))] old_r_ @@ -201,10 +184,10 @@ - + - - size_t * + + size_t * size_t* sysctl_args::oldlenp oldlenp @@ -214,10 +197,9 @@ - - __sysctl + - + char char sysctl_args::oldlenp_l_[0] [0] @@ -228,12 +210,12 @@ - + - + char - char sysctl_args::oldlenp_r_[(sizeof(register_t)<=sizeof(size_t *)?0:sizeof(register_t)-sizeof(size_t *))] - [(sizeof(register_t)<=sizeof(size_t *)?0:sizeof(register_t)-sizeof(size_t *))] + char sysctl_args::oldlenp_r_[(sizeof(register_t)<=sizeof(size_t *) ? 0 :sizeof(register_t) - sizeof(size_t *))] + [(sizeof(register_t)<=sizeof(size_t *) ? 0 :sizeof(register_t) - sizeof(size_t *))] oldlenp_r_ @@ -241,33 +223,52 @@ - + + + + void * + void* sysctl_args::oldp + + oldp + + + + + + + - + + + + + + + - sysctl_argsname - sysctl_argsname_l_ - sysctl_argsname_r_ - sysctl_argsnamelen - sysctl_argsnamelen_l_ - sysctl_argsnamelen_r_ - sysctl_argsnew - sysctl_argsnew_l_ - sysctl_argsnew_r_ - sysctl_argsnewlen - sysctl_argsnewlen_l_ - sysctl_argsnewlen_r_ - sysctl_argsold - sysctl_argsold_l_ - sysctl_argsold_r_ - sysctl_argsoldlenp - sysctl_argsoldlenp_l_ - sysctl_argsoldlenp_r_ + sysctl_argsname + sysctl_argsname_l_ + sysctl_argsname_r_ + sysctl_argsnamelen + sysctl_argsnamelen_l_ + sysctl_argsnamelen_r_ + sysctl_argsnew_l_ + sysctl_argsnew_r_ + sysctl_argsnewlen + sysctl_argsnewlen_l_ + sysctl_argsnewlen_r_ + sysctl_argsnewp + sysctl_argsold_l_ + sysctl_argsold_r_ + sysctl_argsoldlenp + sysctl_argsoldlenp_l_ + sysctl_argsoldlenp_r_ + sysctl_argsoldp diff --git a/doc/xml/structsysctl__entry.xml b/doc/xml/structsysctl__entry.xml index 2c34514..0404a78 100644 --- a/doc/xml/structsysctl__entry.xml +++ b/doc/xml/structsysctl__entry.xml @@ -1,11 +1,11 @@ - - - + + + sysctl_entry kern_sysctl.h - - sysctl_entry * + + struct sysctl_entry * struct sysctl_entry* sysctl_entry::children children @@ -15,12 +15,22 @@ - - sysctl_add - sysctl_find - sysctl_init + - + + int + int sysctl_entry::full_name[24] + [24] + full_name + + + + + + + + + int int sysctl_entry::id @@ -31,12 +41,9 @@ - - sysctl_add - sysctl_find - sysctl_init + - + char char sysctl_entry::name[32] [32] @@ -47,12 +54,23 @@ - - sysctl_add - sysctl_init + - - sysctl_entry * + + int + int sysctl_entry::namelen + + namelen + + + + + + + + + + struct sysctl_entry * struct sysctl_entry* sysctl_entry::next next @@ -62,13 +80,10 @@ - - sysctl_add - sysctl_find - sysctl_init + - - sysctl_entry * + + struct sysctl_entry * struct sysctl_entry* sysctl_entry::prev prev @@ -78,11 +93,9 @@ - - sysctl_add - sysctl_init + - + int int sysctl_entry::val_len @@ -93,11 +106,9 @@ - - __sysctl - sysctl_add + - + void * void* sysctl_entry::value @@ -108,9 +119,7 @@ - - __sysctl - sysctl_add + @@ -118,25 +127,27 @@ - + - - prev -next -children + + +prev + +children + +next - + - sysctl_entrychildren - sysctl_entryid - sysctl_entryname - sysctl_entrynext - sysctl_entryprev - sysctl_entryval_len - sysctl_entryvalue + sysctl_entrychildren + sysctl_entryfull_name + sysctl_entryid + sysctl_entryname + sysctl_entrynamelen + sysctl_entrynext + sysctl_entryprev + sysctl_entryval_len + sysctl_entryvalue diff --git a/doc/xml/structtaskStruct.xml b/doc/xml/structtaskStruct.xml index dbfb4f5..a20bac4 100644 --- a/doc/xml/structtaskStruct.xml +++ b/doc/xml/structtaskStruct.xml @@ -1,12 +1,97 @@ - - - + + + taskStruct sched.h - - uInt32 - uInt32 taskStruct::gid + + uint32_t + uint32_t taskStruct::children + + children + + + + + + + + sys_fork + sys_wait4 + + + uint32_t + uint32_t taskStruct::counter + + counter + + + + + + + + + + uint16_t + uint16_t taskStruct::egid + + egid + + + + + + + + in_group_p + + + uint16_t + uint16_t taskStruct::euid + + euid + + + + + + + + permission + + + struct inode * + struct inode* taskStruct::exec + + exec + + + + + + + + + + fileDescriptor_t * + fileDescriptor_t* taskStruct::files[MAX_OFILES] + [MAX_OFILES] + files + + + + + + + + execThread + sysExec + systemTask + + + uint32_t + uint32_t taskStruct::gid gid @@ -15,15 +100,32 @@ - - execFile - fork_copyProcess - getgid - sysGetGid - sysSetGid + + execFile + fork_copyProcess + getgid + sys_fork + sys_getegid + sys_getGID + sys_setGID + sysGetGid - - i387Struct + + uint16_t + uint16_t taskStruct::groups[32] + [32] + groups + + + + + + + + in_group_p + + + struct i387Struct struct i387Struct taskStruct::i387 i387 @@ -33,11 +135,11 @@ - - mathStateRestore + + mathStateRestore - - pidType + + pidType pidType taskStruct::id id @@ -47,73 +149,90 @@ - - __sysctl - _int0 - _int1 - _int10 - _int11 - _int12 - _int13 - _int2 - _int3 - _int4 - _int5 - _int6 - _int8 - _int9 - elf_loadfile - endTask - execFile - execThread - fork_copyProcess - getpid - intNull - kmod_load - ldEnable - mmap - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_postMessage - obreak - sched - sched_deleteTask - sched_init - schedEndTask - schedFindTask - schedNewTask - sys_exec - sysExec - sysExit - sysGetFreePage - sysGetpid - systemTask - ubthread_mutex_lock - ubthread_mutex_unlock - vmm_pageFault - vmm_remapPage - vmmGetFreeVirtualPage + + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __machineCheck + __nmi + __security + __simd + __virtualization + biosCall + elf_load_file + execFile + execThread + fork_copyProcess + freebsd6_mmap + getpid + invalidCall + invalidCall_posix + kmod_load + ldEnable + pbuf_free + schedEndTask + sys_call + sys_call_posix + sys_exit + sys_fork + sys_getpid + sys_invalid + sys_mmap + sys_setpgid + sys_wait4 + sysExec + sysGetFreePage + sysGetpid + sysSDE + systemTask + ubthread_mutex_lock + ubthread_mutex_unlock + vmm_pageFault - - fileDescriptor * - fileDescriptor* taskStruct::imageFd + + struct taskStruct::@20 + struct taskStruct::@20 taskStruct::inodes - imageFd + inodes - - execThread - sys_exec - sysExec - systemTask + - - taskStruct * + + uint32_t + uint32_t taskStruct::last_exit + + last_exit + + + + + + + + sys_wait4 + + + char + char taskStruct::name[256] + [256] + name + + + + + + + + + + struct taskStruct * struct taskStruct* taskStruct::next next @@ -123,16 +242,11 @@ - - sched - sched_addDelTask - sched_deleteTask - sched_getDelTask - schedFindTask - schedNewTask + + sched_addDelTask - - osInfo + + struct osInfo struct osInfo taskStruct::oInfo oInfo @@ -142,22 +256,67 @@ - - _int13 - biosCall - execFile - execThread - fork_copyProcess - sys_exec - sysChDir - sysExec - sysGetCwd - sysMkDir - vmmGetFreeVirtualPage - vmmMapFromTask + + biosCall + execFile + execThread + fopen + fork_copyProcess + sys_chdir + sys_fchdir + sys_fork + sys_getcwd + sysExec + sysGetCwd + sysMkDir - - taskStruct * + + struct taskStruct * + struct taskStruct* taskStruct::parent + + parent + + + + + + + + sys_fork + + + uint32_t + uint32_t taskStruct::pgrp + + pgrp + + + + + + + + sys_fork + sys_getpgrp + sys_setpgid + + + pidType + pidType taskStruct::ppid + + ppid + + + + + + + + sys_fork + sys_getppid + + + struct taskStruct * struct taskStruct* taskStruct::prev prev @@ -167,13 +326,50 @@ - - sched_addDelTask - sched_deleteTask - schedNewTask + - - tState + + struct inode * + struct inode* taskStruct::pwd + + pwd + + + + + + + + + + struct inode * + struct inode* taskStruct::root + + root + + + + + + + + lookup + + + uint16_t + uint16_t taskStruct::sgid + + sgid + + + + + + + + + + tState tState taskStruct::state state @@ -183,17 +379,29 @@ - - _int13 - biosCall - fork_copyProcess - sched - sched_setStatus - schedNewTask - sysCheckPid + + biosCall + fork_copyProcess + sched_setStatus + schedNewTask + sys_fork + sysCheckPid - - thread + + uint16_t + uint16_t taskStruct::suid + + suid + + + + + + + + + + struct thread struct thread taskStruct::td td @@ -203,23 +411,18 @@ - - execFile - fstat - getgid - getpid - getuid - readlink - schedNewTask - sys_exec - sys_write - syscall - sysExec - vmm_pageFault - vmmGetFreeVirtualPage + + execFile + fork_copyProcess + fstat + schedNewTask + sys_call + sys_call_posix + sys_fork + sysExec - - tty_term * + + tty_term * tty_term* taskStruct::term term @@ -229,15 +432,19 @@ - - execFile - fork_copyProcess - sysFgetc - sysFwrite - systemTask + + execFile + fork_copyProcess + sys_fgetc + sys_fork + sys_fwrite + sys_pread + sys_read + sysFwrite + systemTask - - tssStruct + + struct tssStruct struct tssStruct taskStruct::tss tss @@ -247,18 +454,17 @@ - - _int13 - biosCall - execFile - execThread - fork_copyProcess - sysExec - vmmMapFromTask + + biosCall + execFile + execThread + fork_copyProcess + sys_fork + sysExec - - uInt32 - uInt32 taskStruct::uid + + uint32_t + uint32_t taskStruct::uid uid @@ -267,16 +473,20 @@ - - execFile - fork_copyProcess - getuid - sysGetUid - sysPasswd - sysSetUid + + execFile + fork_copyProcess + getuid + sys_fork + sys_getEUID + sys_geteuid + sys_getUID + sys_setUID + sysGetUid + sysPasswd - - uInt16 + + uInt16 uInt16 taskStruct::usedMath usedMath @@ -286,9 +496,25 @@ - - mathStateRestore - schedNewTask + + mathStateRestore + schedNewTask + + + char + char taskStruct::username[256] + [256] + username + + + + + + + + schedNewTask + sys_getlogin + sys_setlogin @@ -296,158 +522,324 @@ - + - + + + + + - + - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + + + + + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + - - prev -next + + +exec + +root + +pwd - - i387 + + +parent + +prev + +next - - td + + +i387 - - term + + +td - - imageFd + + +files - - oInfo + + +term - - tss + + +oInfo + + + +tss - + + + + + - + + + + + +wait + + + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + - + + + + + +wait + + + + + + + +task + + + +next + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + - + + + + + + + + + - - prev -next + + +prev + +next - + - taskStructgid - taskStructi387 - taskStructid - taskStructimageFd - taskStructnext - taskStructoInfo - taskStructprev - taskStructstate - taskStructtd - taskStructterm - taskStructtss - taskStructuid - taskStructusedMath + taskStructchildren + taskStructcounter + taskStructegid + taskStructeuid + taskStructexec + taskStructfiles + taskStructgid + taskStructgroups + taskStructi387 + taskStructid + taskStructinodes + taskStructlast_exit + taskStructname + taskStructnext + taskStructoInfo + taskStructparent + taskStructpgrp + taskStructppid + taskStructprev + taskStructpwd + taskStructroot + taskStructsgid + taskStructstate + taskStructsuid + taskStructtd + taskStructterm + taskStructtss + taskStructuid + taskStructusedMath + taskStructusername diff --git a/doc/xml/structtcp__hdr.xml b/doc/xml/structtcp__hdr.xml index bb0b9f1..736275f 100644 --- a/doc/xml/structtcp__hdr.xml +++ b/doc/xml/structtcp__hdr.xml @@ -1,17 +1,17 @@ - - - + + + tcp_hdr - tcp.h + tcp.h - + tcp_hdr::PACK_STRUCT_FIELD - (uInt16 urgp) + (u16_t _hdrlen_rsvd_flags) PACK_STRUCT_FIELD - uInt16 - urgp + u16_t + _hdrlen_rsvd_flags @@ -19,15 +19,15 @@ - + - + tcp_hdr::PACK_STRUCT_FIELD - (uInt16 chksum) + (u16_t chksum) PACK_STRUCT_FIELD - uInt16 + u16_t chksum @@ -36,83 +36,15 @@ - + - + tcp_hdr::PACK_STRUCT_FIELD - (uInt16 wnd) + (u16_t dest) PACK_STRUCT_FIELD - uInt16 - wnd - - - - - - - - - - - - tcp_hdr::PACK_STRUCT_FIELD - (uInt16 _offset_flags) - PACK_STRUCT_FIELD - - uInt16 - _offset_flags - - - - - - - - - - - - tcp_hdr::PACK_STRUCT_FIELD - (uInt32 ackno) - PACK_STRUCT_FIELD - - uInt32 - ackno - - - - - - - - - - - - tcp_hdr::PACK_STRUCT_FIELD - (uInt32 seqno) - PACK_STRUCT_FIELD - - uInt32 - seqno - - - - - - - - - - - - tcp_hdr::PACK_STRUCT_FIELD - (uInt16 dest) - PACK_STRUCT_FIELD - - uInt16 + u16_t dest @@ -121,15 +53,15 @@ - + - + tcp_hdr::PACK_STRUCT_FIELD - (uInt16 src) + (u16_t src) PACK_STRUCT_FIELD - uInt16 + u16_t src @@ -138,23 +70,97 @@ - + + + + + tcp_hdr::PACK_STRUCT_FIELD + (u16_t urgp) + PACK_STRUCT_FIELD + + u16_t + urgp + + + + + + + + + + + + tcp_hdr::PACK_STRUCT_FIELD + (u16_t wnd) + PACK_STRUCT_FIELD + + u16_t + wnd + + + + + + + + + + + + tcp_hdr::PACK_STRUCT_FIELD + (u32_t ackno) + PACK_STRUCT_FIELD + + u32_t + ackno + + + + + + + + + + + + tcp_hdr::PACK_STRUCT_FIELD + (u32_t seqno) + PACK_STRUCT_FIELD + + u32_t + seqno + + + + + + + + - + + + + + + + - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD - tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD + tcp_hdrPACK_STRUCT_FIELD diff --git a/doc/xml/structtcpip__msg.xml b/doc/xml/structtcpip__msg.xml index ea7ce48..21725ca 100644 --- a/doc/xml/structtcpip__msg.xml +++ b/doc/xml/structtcpip__msg.xml @@ -1,26 +1,104 @@ - - - + + + tcpip_msg - tcpip.h + tcpip_priv.h - - api_msg * - struct api_msg* tcpip_msg::apimsg + + struct tcpip_msg::@3::@5 + struct tcpip_msg::@3::@5 tcpip_msg::api_call - apimsg + api_call - - tcpip_apimsg + - - tcpip_msg::@4::@5 - struct tcpip_msg::@4::@5 tcpip_msg::inp + + struct tcpip_msg::@3::@4 + struct tcpip_msg::@3::@4 tcpip_msg::api_msg + + api_msg + + + + + + + + + + struct tcpip_api_call_data * + struct tcpip_api_call_data* tcpip_msg::arg + + arg + + + + + + + + + + struct tcpip_msg::@3::@7 + struct tcpip_msg::@3::@7 tcpip_msg::cb + + cb + + + + + + + + + + void * + void* tcpip_msg::ctx + + ctx + + + + + + + + tcpip_callbackmsg_new + + + tcpip_callback_fn + tcpip_callback_fn tcpip_msg::function + + function + + + + + + + + + + tcpip_api_call_fn + tcpip_api_call_fn tcpip_msg::function + + function + + + + + + + + + + struct tcpip_msg::@3::@6 + struct tcpip_msg::@3::@6 tcpip_msg::inp inp @@ -29,12 +107,27 @@ - - tcpip_input + + tcpip_inpkt + tcpip_input - - tcpip_msg::@4 - union tcpip_msg::@4 tcpip_msg::msg + + netif_input_fn + netif_input_fn tcpip_msg::input_fn + + input_fn + + + + + + + + tcpip_inpkt + + + void * + void* tcpip_msg::msg msg @@ -43,13 +136,29 @@ - - tcpip_apimsg - tcpip_input - tcpip_thread + + tcpip_api_call + tcpip_callback_with_block + tcpip_callbackmsg_delete + tcpip_callbackmsg_new + tcpip_inpkt + tcpip_send_msg_wait_sem - - netif * + + union tcpip_msg::@3 + union tcpip_msg::@3 tcpip_msg::msg + + msg + + + + + + + + + + struct netif * struct netif* tcpip_msg::netif netif @@ -59,10 +168,10 @@ - + - - pbuf * + + struct pbuf * struct pbuf* tcpip_msg::p p @@ -72,11 +181,12 @@ - - tcpip_input + + tcpip_inpkt + tcpip_input - - sys_sem_t * + + sys_sem_t * sys_sem_t* tcpip_msg::sem sem @@ -86,10 +196,11 @@ - + + tcpip_send_msg_wait_sem - - enum tcpip_msg_type + + enum tcpip_msg_type enum tcpip_msg_type tcpip_msg::type type @@ -99,7 +210,7 @@ - + @@ -107,167 +218,85 @@ - - - - - mutex -mail - - - - - - - + - + - - - - - next - - - tcphdr - - - p - - - + - - netif + + +arg + +function - - p + + +netif - - apimsg + + +p + +input_fn - - sem + + +sem - + - - next + + +next - - - - - remote_ip - - - next - - - - - - - recvmbox -acceptmbox -mbox - - - sem - - - udp - - - tcp - - - - - - - mbox - - - p - - - ipaddr - - - conn - - - + - - mutex + + +mutex - - cond + + +cond - - - - - - - - - unsent -unacked - - - recv_data - - - local_ip -remote_ip - - - next + + + + + +sem - - - - - msg - - - + - - next + + +linkoutput + +next - - netmask -ip_addr -gw + + +input - + - tcpip_msgapimsg - tcpip_msginp - tcpip_msgmsg - tcpip_msgnetif - tcpip_msgp - tcpip_msgsem - tcpip_msgtype + tcpip_msgapi_call + tcpip_msgapi_msg + tcpip_msgarg + tcpip_msgcb + tcpip_msgctx + tcpip_msgfunction + tcpip_msgfunction + tcpip_msginp + tcpip_msginput_fn + tcpip_msgmsg + tcpip_msgmsg + tcpip_msgnetif + tcpip_msgp + tcpip_msgsem + tcpip_msgtype diff --git a/doc/xml/structthread.xml b/doc/xml/structthread.xml index a260eef..fb4bc16 100644 --- a/doc/xml/structthread.xml +++ b/doc/xml/structthread.xml @@ -1,13 +1,45 @@ - - - + + + thread thread.h - - uint32_t - uint32_t thread::o_files[64] - [64] + + int + int thread::abi + + abi + + + + + + + + sys_call + sys_call_posix + + + struct trapframe * + struct trapframe* thread::frame + + frame + + + + + + + + sys_call + sys_call_posix + sys_fork + sys_invalid + + + void * + void* thread::o_files[512] + [512] o_files @@ -15,15 +47,63 @@ - - close - falloc - fcntl - fstat - getfd - schedNewTask + + close + dup2 + falloc + fcntl + fdestroy + fstat + getfd + schedNewTask + sys_close + sys_fork + sys_write - + + struct rlimit + struct rlimit thread::rlim[RLIM_NLIMITS] + [RLIM_NLIMITS] + rlim + + + + + + + + sys_getrlimit + sys_setrlimit + + + struct sigaction + struct sigaction thread::sigact[128] + [128] + sigact + + + + + + + + sys_sigaction + + + sigset_t + sigset_t thread::sigmask + + sigmask + + + + + + + + sys_sigprocmask + + int int thread::td_retval[2] [2] @@ -34,26 +114,75 @@ - - __sysctl - close - fcntl - getdtablesize - getgid - getpid - getuid - ioctl - mmap - pipe - read - readlink - sys_open - sys_write - syscall + + close + fcntl + getdtablesize + getgid + getpid + getuid + ioctl + kern_openat + pipe + read + readlink + sys_access + sys_call + sys_call_posix + sys_chdir + sys_close + sys_dup2 + sys_execve + sys_fgetc + sys_fork + sys_fread + sys_fseek + sys_fstat + sys_fstatat + sys_fstatfs + sys_fwrite + sys_getdirentries + sys_getegid + sys_geteuid + sys_getpgrp + sys_getpid + sys_getppid + sys_gettimeofday + sys_invalid + sys_ioctl + sys_issetugid + sys_lseek + sys_lstat + sys_mmap + sys_mpiCreateMbox + sys_mpiDestroyMbox + sys_mpiFetchMessage + sys_mpiPostMessage + sys_munmap + sys_openat + sys_pipe2 + sys_pread + sys_read + sys_readlink + sys_rename + sys_select + sys_sendto + sys_setpgid + sys_setsockopt + sys_sigaction + sys_sigprocmask + sys_socket + sys_stat + sys_statfs + sys_sysarch + sys_wait4 + sys_write + sysGetFreePage + sysSDE - - char * - char* thread::vm_daddr + + u_long + u_long thread::vm_daddr vm_daddr @@ -62,17 +191,15 @@ - - execFile - obreak - sys_exec - sysExec - vmm_pageFault - vmmGetFreeVirtualPage + + execFile + fork_copyProcess + sys_fork + sysExec - - int32_t - int32_t thread::vm_dsize + + u_long + u_long thread::vm_dsize vm_dsize @@ -81,24 +208,96 @@ - - obreak - sys_exec - sysExec - vmm_pageFault - vmmGetFreeVirtualPage + + fork_copyProcess + sys_fork + sysExec + + + u_long + u_long thread::vm_taddr + + vm_taddr + + + + + + + + fork_copyProcess + sys_fork + + + u_long + u_long thread::vm_tsize + + vm_tsize + + + + + + + + fork_copyProcess + sys_fork - + + + + + + +sa_mask + + + + + + + + + + + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + + + + - threado_files - threadtd_retval - threadvm_daddr - threadvm_dsize + threadabi + threadframe + threado_files + threadrlim + threadsigact + threadsigmask + threadtd_retval + threadvm_daddr + threadvm_dsize + threadvm_taddr + threadvm_tsize diff --git a/doc/xml/structthread__start__param.xml b/doc/xml/structthread__start__param.xml index 3f29ed5..3c7ccae 100644 --- a/doc/xml/structthread__start__param.xml +++ b/doc/xml/structthread__start__param.xml @@ -1,9 +1,9 @@ - - - + + + thread_start_param - + void * void* thread_start_param::arg @@ -14,11 +14,11 @@ - + - + void(* - void(* thread_start_param::function)(void *) + void(* thread_start_param::function) (void *) )(void *) function @@ -27,10 +27,10 @@ - + - - sys_thread * + + struct sys_thread * struct sys_thread* thread_start_param::thread thread @@ -40,7 +40,7 @@ - + @@ -48,182 +48,321 @@ - + - + + + + + - + - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + - - next + + +next - - ubthread + + +ubthread - - timeouts + + +timeouts - + + + + + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + - - prev -next + + +exec + +root + +pwd - - i387 + + +parent + +prev + +next - - td + + +i387 - - term + + +td - - imageFd + + +files - - oInfo + + +term - - tss + + +oInfo + + + +tss - + - - thread + + +thread - + + + + + - - - - - next + + + + + +wait - + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + + + + + - - - - - - - - - prev -next + + + + + +wait - - - - - next + + + + + +task + + + +next + + + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + + + + + + + + + + + + + + + +prev + +next - + - thread_start_paramarg - thread_start_paramfunction - thread_start_paramthread + thread_start_paramarg + thread_start_paramfunction + thread_start_paramthread diff --git a/doc/xml/structtimeStruct.xml b/doc/xml/structtimeStruct.xml index 0c5bfb3..64f5dd7 100644 --- a/doc/xml/structtimeStruct.xml +++ b/doc/xml/structtimeStruct.xml @@ -1,10 +1,10 @@ - - - + + + timeStruct time.h - + int int timeStruct::day @@ -15,11 +15,9 @@ - - time_init - timeMake + - + int int timeStruct::hour @@ -30,11 +28,9 @@ - - time_init - timeMake + - + int int timeStruct::min @@ -45,11 +41,9 @@ - - time_init - timeMake + - + int int timeStruct::mon @@ -60,11 +54,9 @@ - - time_init - timeMake + - + int int timeStruct::sec @@ -75,11 +67,9 @@ - - time_init - timeMake + - + int int timeStruct::year @@ -90,23 +80,28 @@ - - time_init - timeMake + + timeMake - + + + + + + + - timeStructday - timeStructhour - timeStructmin - timeStructmon - timeStructsec - timeStructyear + timeStructday + timeStructhour + timeStructmin + timeStructmon + timeStructsec + timeStructyear diff --git a/doc/xml/structtimespec.xml b/doc/xml/structtimespec.xml index c13f682..6e601a0 100644 --- a/doc/xml/structtimespec.xml +++ b/doc/xml/structtimespec.xml @@ -1,10 +1,10 @@ - - - + + + timespec - time.h + _timespec.h - + long long timespec::tv_nsec @@ -15,10 +15,10 @@ - + - - time_t + + time_t time_t timespec::tv_sec tv_sec @@ -28,17 +28,23 @@ - + - + + + + + + + - timespectv_nsec - timespectv_sec + timespectv_nsec + timespectv_sec diff --git a/doc/xml/structtimeval.xml b/doc/xml/structtimeval.xml index c1e693e..985e875 100644 --- a/doc/xml/structtimeval.xml +++ b/doc/xml/structtimeval.xml @@ -1,12 +1,12 @@ - - - + + + timeval - time.h + _timeval.h - - long - long timeval::tv_sec + + time_t + time_t timeval::tv_sec tv_sec @@ -15,11 +15,12 @@ - - gettimeofday + + gettimeofday + sys_unix_now - - suseconds_t + + suseconds_t suseconds_t timeval::tv_usec tv_usec @@ -29,18 +30,24 @@ - - gettimeofday + + gettimeofday - + + + + + + + - timevaltv_sec - timevaltv_usec + timevaltv_sec + timevaltv_usec diff --git a/doc/xml/structtimezone.xml b/doc/xml/structtimezone.xml index b81acdf..32926e7 100644 --- a/doc/xml/structtimezone.xml +++ b/doc/xml/structtimezone.xml @@ -1,10 +1,10 @@ - - - + + + timezone time.h - + int int timezone::tz_dsttime @@ -15,9 +15,10 @@ - + + gettimeofday - + int int timezone::tz_minuteswest @@ -28,17 +29,24 @@ - + + gettimeofday - + + + + + + + - timezonetz_dsttime - timezonetz_minuteswest + timezonetz_dsttime + timezonetz_minuteswest diff --git a/doc/xml/structtms.xml b/doc/xml/structtms.xml index 9857194..5c48501 100644 --- a/doc/xml/structtms.xml +++ b/doc/xml/structtms.xml @@ -1,11 +1,11 @@ - - - + + + tms times.h - - clock_t + + clock_t clock_t tms::tms_cstime tms_cstime @@ -15,10 +15,10 @@ - + - - clock_t + + clock_t clock_t tms::tms_cutime tms_cutime @@ -28,10 +28,10 @@ - + - - clock_t + + clock_t clock_t tms::tms_stime tms_stime @@ -41,10 +41,10 @@ - + - - clock_t + + clock_t clock_t tms::tms_utime tms_utime @@ -54,19 +54,25 @@ - + - + + + + + + + - tmstms_cstime - tmstms_cutime - tmstms_stime - tmstms_utime + tmstms_cstime + tmstms_cutime + tmstms_stime + tmstms_utime diff --git a/doc/xml/structtrapframe.xml b/doc/xml/structtrapframe.xml index 09fd90b..828a578 100644 --- a/doc/xml/structtrapframe.xml +++ b/doc/xml/structtrapframe.xml @@ -1,10 +1,10 @@ - - - + + + trapframe trap.h - + int int trapframe::tf_cs @@ -15,9 +15,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_ds @@ -28,9 +30,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_eax @@ -41,10 +45,13 @@ - - syscall + + die_if_kernel + sys_call + sys_call_posix + sys_invalid - + int int trapframe::tf_ebp @@ -55,9 +62,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_ebx @@ -68,9 +77,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_ecx @@ -81,9 +92,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_edi @@ -94,9 +107,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_edx @@ -107,10 +122,13 @@ - - syscall + + die_if_kernel + sys_call + sys_call_posix + sys_fork - + int int trapframe::tf_eflags @@ -121,10 +139,13 @@ - - syscall + + die_if_kernel + sys_call + sys_call_posix + sys_fork - + int int trapframe::tf_eip @@ -135,10 +156,12 @@ - - syscall + + die_if_kernel + sys_fork + vmm_pageFault - + int int trapframe::tf_err @@ -149,10 +172,11 @@ - - syscall + + die_if_kernel + vmm_pageFault - + int int trapframe::tf_es @@ -163,9 +187,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_esi @@ -176,9 +202,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_esp @@ -189,10 +217,14 @@ - - syscall + + die_if_kernel + sys_call + sys_call_posix + sys_fork + vmm_pageFault - + int int trapframe::tf_fs @@ -203,9 +235,25 @@ - + + die_if_kernel + sys_fork - + + int + int trapframe::tf_gs + + tf_gs + + + + + + + + die_if_kernel + + int int trapframe::tf_isp @@ -216,9 +264,9 @@ - + - + int int trapframe::tf_ss @@ -229,9 +277,11 @@ - + + die_if_kernel + sys_fork - + int int trapframe::tf_trapno @@ -242,33 +292,42 @@ - + + die_if_kernel + trap - + + + + + + + - trapframetf_cs - trapframetf_ds - trapframetf_eax - trapframetf_ebp - trapframetf_ebx - trapframetf_ecx - trapframetf_edi - trapframetf_edx - trapframetf_eflags - trapframetf_eip - trapframetf_err - trapframetf_es - trapframetf_esi - trapframetf_esp - trapframetf_fs - trapframetf_isp - trapframetf_ss - trapframetf_trapno + trapframetf_cs + trapframetf_ds + trapframetf_eax + trapframetf_ebp + trapframetf_ebx + trapframetf_ecx + trapframetf_edi + trapframetf_edx + trapframetf_eflags + trapframetf_eip + trapframetf_err + trapframetf_es + trapframetf_esi + trapframetf_esp + trapframetf_fs + trapframetf_gs + trapframetf_isp + trapframetf_ss + trapframetf_trapno diff --git a/doc/xml/structtssStruct.xml b/doc/xml/structtssStruct.xml index d6f7a43..f84cf8d 100644 --- a/doc/xml/structtssStruct.xml +++ b/doc/xml/structtssStruct.xml @@ -1,10 +1,10 @@ - - - + + + tssStruct tss.h - + short short tssStruct::back_link @@ -15,14 +15,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::back_link_reserved @@ -33,9 +33,9 @@ - + - + long long tssStruct::cr3 @@ -46,16 +46,14 @@ - - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init - vmmMapFromTask + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::cs @@ -66,16 +64,14 @@ - - _int13 - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::cs_reserved @@ -86,9 +82,9 @@ - + - + short short tssStruct::ds @@ -99,15 +95,14 @@ - - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::ds_reserved @@ -118,9 +113,9 @@ - + - + long long tssStruct::eax @@ -131,12 +126,12 @@ - - _int13 - biosCall - fork_copyProcess + + biosCall + fork_copyProcess + sys_fork - + long long tssStruct::ebp @@ -147,16 +142,14 @@ - - _int13 - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + long long tssStruct::ebx @@ -167,11 +160,12 @@ - - biosCall - fork_copyProcess + + biosCall + fork_copyProcess + sys_fork - + long long tssStruct::ecx @@ -182,11 +176,12 @@ - - biosCall - fork_copyProcess + + biosCall + fork_copyProcess + sys_fork - + long long tssStruct::edi @@ -197,14 +192,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + long long tssStruct::edx @@ -215,12 +210,12 @@ - - _int13 - biosCall - fork_copyProcess + + biosCall + fork_copyProcess + sys_fork - + long long tssStruct::eflags @@ -231,16 +226,14 @@ - - _int13 - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + long long tssStruct::eip @@ -251,16 +244,14 @@ - - _int13 - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::es @@ -271,15 +262,14 @@ - - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::es_reserved @@ -290,9 +280,9 @@ - + - + long long tssStruct::esi @@ -303,14 +293,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + long long tssStruct::esp @@ -321,16 +311,14 @@ - - _int13 - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + long long tssStruct::esp0 @@ -341,15 +329,15 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init - sysExec + + biosCall + execFile + execThread + fork_copyProcess + sys_fork + sysExec - + long long tssStruct::esp1 @@ -360,14 +348,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + long long tssStruct::esp2 @@ -378,14 +366,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::fs @@ -396,15 +384,14 @@ - - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::fs_reserved @@ -415,9 +402,9 @@ - + - + short short tssStruct::gs @@ -428,15 +415,14 @@ - - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::gs_reserved @@ -447,9 +433,9 @@ - + - + short short tssStruct::io_map @@ -460,15 +446,14 @@ - - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + char char tssStruct::io_space[8192] [8192] @@ -479,9 +464,9 @@ - + - + short short tssStruct::ldt @@ -492,14 +477,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::ldt_reserved @@ -510,9 +495,9 @@ - + - + short short tssStruct::ss @@ -523,16 +508,14 @@ - - _int13 - _int8 - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::ss0 @@ -543,14 +526,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::ss0_reserved @@ -561,9 +544,9 @@ - + - + short short tssStruct::ss1 @@ -574,14 +557,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::ss1_reserved @@ -592,9 +575,9 @@ - + - + short short tssStruct::ss2 @@ -605,14 +588,14 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + short short tssStruct::ss2_reserved @@ -623,9 +606,9 @@ - + - + short short tssStruct::ss_reserved @@ -636,9 +619,9 @@ - + - + short short tssStruct::trace_bitmap @@ -649,59 +632,65 @@ - - biosCall - execFile - execThread - fork_copyProcess - idt_init + + biosCall + execFile + execThread + fork_copyProcess + sys_fork - + + + + + + + - tssStructback_link - tssStructback_link_reserved - tssStructcr3 - tssStructcs - tssStructcs_reserved - tssStructds - tssStructds_reserved - tssStructeax - tssStructebp - tssStructebx - tssStructecx - tssStructedi - tssStructedx - tssStructeflags - tssStructeip - tssStructes - tssStructes_reserved - tssStructesi - tssStructesp - tssStructesp0 - tssStructesp1 - tssStructesp2 - tssStructfs - tssStructfs_reserved - tssStructgs - tssStructgs_reserved - tssStructio_map - tssStructio_space - tssStructldt - tssStructldt_reserved - tssStructss - tssStructss0 - tssStructss0_reserved - tssStructss1 - tssStructss1_reserved - tssStructss2 - tssStructss2_reserved - tssStructss_reserved - tssStructtrace_bitmap + tssStructback_link + tssStructback_link_reserved + tssStructcr3 + tssStructcs + tssStructcs_reserved + tssStructds + tssStructds_reserved + tssStructeax + tssStructebp + tssStructebx + tssStructecx + tssStructedi + tssStructedx + tssStructeflags + tssStructeip + tssStructes + tssStructes_reserved + tssStructesi + tssStructesp + tssStructesp0 + tssStructesp1 + tssStructesp2 + tssStructfs + tssStructfs_reserved + tssStructgs + tssStructgs_reserved + tssStructio_map + tssStructio_space + tssStructldt + tssStructldt_reserved + tssStructss + tssStructss0 + tssStructss0_reserved + tssStructss1 + tssStructss1_reserved + tssStructss2 + tssStructss2_reserved + tssStructss_reserved + tssStructtrace_bitmap diff --git a/doc/xml/structtty__termNode.xml b/doc/xml/structtty__termNode.xml index 5200dca..f8e40d0 100644 --- a/doc/xml/structtty__termNode.xml +++ b/doc/xml/structtty__termNode.xml @@ -1,11 +1,11 @@ - - - + + + tty_termNode tty.h - - pidType + + pidType pidType tty_termNode::owner owner @@ -15,11 +15,12 @@ - - execFile - fork_copyProcess + + execFile + fork_copyProcess + sys_fork - + char char tty_termNode::stdin[512] [512] @@ -30,11 +31,9 @@ - - getch - keyboardHandler + - + int int tty_termNode::stdinSize @@ -45,11 +44,9 @@ - - getch - keyboardHandler + - + char * char* tty_termNode::tty_buffer @@ -60,13 +57,12 @@ - - tty_change - tty_init + + tty_change - - uInt8 - uInt8 tty_termNode::tty_colour + + uint8_t + uint8_t tty_termNode::tty_colour tty_colour @@ -75,11 +71,9 @@ - - tty_init - tty_print + - + char * char* tty_termNode::tty_pointer @@ -90,14 +84,11 @@ - - tty_change - tty_init - tty_print + - - uInt16 - uInt16 tty_termNode::tty_x + + uint16_t + uint16_t tty_termNode::tty_x tty_x @@ -106,15 +97,11 @@ - - backSpace - tty_change - tty_init - tty_print + - - uInt16 - uInt16 tty_termNode::tty_y + + uint16_t + uint16_t tty_termNode::tty_y tty_y @@ -123,27 +110,29 @@ - - backSpace - tty_change - tty_init - tty_print + - + + + + + + + - tty_termNodeowner - tty_termNodestdin - tty_termNodestdinSize - tty_termNodetty_buffer - tty_termNodetty_colour - tty_termNodetty_pointer - tty_termNodetty_x - tty_termNodetty_y + tty_termNodeowner + tty_termNodestdin + tty_termNodestdinSize + tty_termNodetty_buffer + tty_termNodetty_colour + tty_termNodetty_pointer + tty_termNodetty_x + tty_termNodetty_y diff --git a/doc/xml/structubixDiskLabel.xml b/doc/xml/structubixDiskLabel.xml index 958f065..9f66b0a 100644 --- a/doc/xml/structubixDiskLabel.xml +++ b/doc/xml/structubixDiskLabel.xml @@ -1,12 +1,12 @@ - - - + + + ubixDiskLabel - ubixfs.h + ubixfs.h ubixDiskLabel::ubixPartitions - - uInt16 + + uInt16 uInt16 ubixDiskLabel::driveType driveType @@ -16,10 +16,10 @@ - + - - uInt32 + + uInt32 uInt32 ubixDiskLabel::magicNum magicNum @@ -29,11 +29,11 @@ - - ubixfs_initialize + + ubixfs_initialize - - uInt32 + + uInt32 uInt32 ubixDiskLabel::magicNum2 magicNum2 @@ -43,11 +43,11 @@ - - ubixfs_initialize + + ubixfs_initialize - - uInt16 + + uInt16 uInt16 ubixDiskLabel::numPartitions numPartitions @@ -57,10 +57,10 @@ - + - - ubixDiskLabel::ubixPartitions + + struct ubixDiskLabel::ubixPartitions struct ubixDiskLabel::ubixPartitions ubixDiskLabel::partitions[ 16 ] [16] partitions @@ -70,14 +70,12 @@ - - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - writeFileByte - writeUbixFS + + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS @@ -85,25 +83,25 @@ - + - - partitions + + +partitions - + - + - ubixDiskLabeldriveType - ubixDiskLabelmagicNum - ubixDiskLabelmagicNum2 - ubixDiskLabelnumPartitions - ubixDiskLabelpartitions + ubixDiskLabeldriveType + ubixDiskLabelmagicNum + ubixDiskLabelmagicNum2 + ubixDiskLabelnumPartitions + ubixDiskLabelpartitions diff --git a/doc/xml/structubixDiskLabel_1_1ubixPartitions.xml b/doc/xml/structubixDiskLabel_1_1ubixPartitions.xml index 9d3c351..6df9b71 100644 --- a/doc/xml/structubixDiskLabel_1_1ubixPartitions.xml +++ b/doc/xml/structubixDiskLabel_1_1ubixPartitions.xml @@ -1,11 +1,11 @@ - - - + + + ubixDiskLabel::ubixPartitions - ubixfs.h + ubixfs.h - - uInt32 + + uInt32 uInt32 ubixDiskLabel::ubixPartitions::pBatSize pBatSize @@ -15,12 +15,13 @@ - - ubixfs_initialize - writeFileByte + + syncBat + ubixfs_initialize + writeFileByte - - uInt8 + + uInt8 uInt8 ubixDiskLabel::ubixPartitions::pFrag pFrag @@ -30,10 +31,10 @@ - + - - uInt32 + + uInt32 uInt32 ubixDiskLabel::ubixPartitions::pFsSize pFsSize @@ -43,10 +44,10 @@ - + - - uInt8 + + uInt8 uInt8 ubixDiskLabel::ubixPartitions::pFsType pFsType @@ -56,10 +57,10 @@ - + - - uInt32 + + uInt32 uInt32 ubixDiskLabel::ubixPartitions::pOffset pOffset @@ -69,10 +70,15 @@ - + + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - - uInt32 + + uInt32 uInt32 ubixDiskLabel::ubixPartitions::pSize pSize @@ -82,21 +88,27 @@ - + - + + + + + + + - ubixDiskLabel::ubixPartitionspBatSize - ubixDiskLabel::ubixPartitionspFrag - ubixDiskLabel::ubixPartitionspFsSize - ubixDiskLabel::ubixPartitionspFsType - ubixDiskLabel::ubixPartitionspOffset - ubixDiskLabel::ubixPartitionspSize + ubixDiskLabel::ubixPartitionspBatSize + ubixDiskLabel::ubixPartitionspFrag + ubixDiskLabel::ubixPartitionspFsSize + ubixDiskLabel::ubixPartitionspFsType + ubixDiskLabel::ubixPartitionspOffset + ubixDiskLabel::ubixPartitionspSize diff --git a/doc/xml/structubixFSInfo.xml b/doc/xml/structubixFSInfo.xml index a086423..7589fad 100644 --- a/doc/xml/structubixFSInfo.xml +++ b/doc/xml/structubixFSInfo.xml @@ -1,11 +1,11 @@ - - - + + + ubixFSInfo - ubixfs.h + ubixfs.h - - uInt32 + + uInt32 uInt32 ubixFSInfo::batEntries batEntries @@ -15,12 +15,13 @@ - - getFreeBlocks - ubixfs_initialize + + getFreeBlocks + ubixfs_initialize + writeFileByte - - blockAllocationTableEntry * + + struct blockAllocationTableEntry * struct blockAllocationTableEntry* ubixFSInfo::blockAllocationTable blockAllocationTable @@ -30,19 +31,17 @@ - - freeBlocks - getFreeBlocks - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - writeFileByte - writeUbixFS + + freeBlocks + getFreeBlocks + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - - cacheNode * + + struct cacheNode * struct cacheNode* ubixFSInfo::dirCache dirCache @@ -52,12 +51,11 @@ - - openFileUbixFS - ubixfs_initialize + + ubixfs_initialize - - uInt32 + + uInt32 uInt32 ubixFSInfo::rootDir rootDir @@ -67,9 +65,8 @@ - - ubixfs_initialize - ubixFSUnlink + + ubixfs_initialize @@ -77,38 +74,38 @@ - + - + - - dirCache + + +dirCache - - blockAllocationTable + + +blockAllocationTable - + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + - ubixFSInfobatEntries - ubixFSInfoblockAllocationTable - ubixFSInfodirCache - ubixFSInforootDir + ubixFSInfobatEntries + ubixFSInfoblockAllocationTable + ubixFSInfodirCache + ubixFSInforootDir diff --git a/doc/xml/structubthread.xml b/doc/xml/structubthread.xml index e4108a0..951e4ba 100644 --- a/doc/xml/structubthread.xml +++ b/doc/xml/structubthread.xml @@ -1,12 +1,12 @@ - - - + + + ubthread ubthread.h - - kTask_t * - kTask_t* ubthread::task + + struct taskStruct * + struct taskStruct* ubthread::task task @@ -15,7 +15,7 @@ - + @@ -23,153 +23,302 @@ - + - + + + + + - + - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - task + + +task - + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + + + + + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + - - prev -next + + +exec + +root + +pwd - - i387 + + +parent + +prev + +next - - td + + +i387 - - term + + +td - - imageFd + + +files - - oInfo + + +term - - tss + + +oInfo + + + +tss - + + + + + - + + + + + +wait + + + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + - + + + + + +wait + + + + + + + +task + + + +next + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + - + + + + + + + + + - - prev -next + + +prev + +next - + - ubthreadtask + ubthreadtask diff --git a/doc/xml/structubthread__cond.xml b/doc/xml/structubthread__cond.xml index b96fa27..b5e324c 100644 --- a/doc/xml/structubthread__cond.xml +++ b/doc/xml/structubthread__cond.xml @@ -1,10 +1,10 @@ - - - + + + ubthread_cond ubthread.h - + int int ubthread_cond::id @@ -15,35 +15,40 @@ - - ubthread_cond_init + + ubthread_cond_init - - uInt8 - uInt8 ubthread_cond::locked + + bool + bool ubthread_cond::lock - locked + lock - - ubthread_cond_init - ubthread_cond_signal - ubthread_cond_timedwait - ubthread_cond_wait + + ubthread_cond_init + ubthread_cond_timedwait + ubthread_cond_wait - + + + + + + + - ubthread_condid - ubthread_condlocked + ubthread_condid + ubthread_condlock diff --git a/doc/xml/structubthread__cond__list.xml b/doc/xml/structubthread__cond__list.xml index a15db80..8d7d13f 100644 --- a/doc/xml/structubthread__cond__list.xml +++ b/doc/xml/structubthread__cond__list.xml @@ -1,11 +1,11 @@ - - - + + + ubthread_cond_list ubthread.h - - ubthread_cond_t * + + ubthread_cond_t * ubthread_cond_t* ubthread_cond_list::cond cond @@ -15,10 +15,10 @@ - + - - ubthread_cond_list * + + struct ubthread_cond_list * struct ubthread_cond_list* ubthread_cond_list::next next @@ -28,7 +28,7 @@ - + @@ -36,25 +36,25 @@ - + - - next + + +next - - cond + + +cond - + - + - ubthread_cond_listcond - ubthread_cond_listnext + ubthread_cond_listcond + ubthread_cond_listnext diff --git a/doc/xml/structubthread__list.xml b/doc/xml/structubthread__list.xml index 005736b..994f6d0 100644 --- a/doc/xml/structubthread__list.xml +++ b/doc/xml/structubthread__list.xml @@ -1,11 +1,11 @@ - - - + + + ubthread_list ubthread.h - - ubthread_list * + + struct ubthread_list * struct ubthread_list* ubthread_list::next next @@ -15,10 +15,10 @@ - + - - ubthread_t + + ubthread_t ubthread_t ubthread_list::thread thread @@ -28,7 +28,7 @@ - + @@ -36,164 +36,313 @@ - + - + + + + + - + - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + - - next + + +next - - thread + + +thread - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - task + + +task - + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + + + + + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + - - prev -next + + +exec + +root + +pwd - - i387 + + +parent + +prev + +next - - td + + +i387 - - term + + +td - - imageFd + + +files - - oInfo + + +term - - tss + + +oInfo + + + +tss - + + + + + - + + + + + +wait + + + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + - + + + + + +wait + + + + + + + +task + + + +next + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + - + + + + + + + + + - - prev -next + + +prev + +next - + - ubthread_listnext - ubthread_listthread + ubthread_listnext + ubthread_listthread diff --git a/doc/xml/structubthread__mutex.xml b/doc/xml/structubthread__mutex.xml index 169843f..2ebbcef 100644 --- a/doc/xml/structubthread__mutex.xml +++ b/doc/xml/structubthread__mutex.xml @@ -1,10 +1,10 @@ - - - + + + ubthread_mutex ubthread.h - + int int ubthread_mutex::id @@ -15,29 +15,27 @@ - - ubthread_mutex_init + + ubthread_mutex_init - - uInt8 - uInt8 ubthread_mutex::locked + + bool + bool ubthread_mutex::lock - locked + lock - - ubthread_cond_timedwait - ubthread_cond_wait - ubthread_mutex_init - ubthread_mutex_lock - ubthread_mutex_unlock + + ubthread_mutex_init + ubthread_mutex_lock + ubthread_mutex_unlock - - pidType + + pidType pidType ubthread_mutex::pid pid @@ -47,20 +45,26 @@ - - ubthread_mutex_lock - ubthread_mutex_unlock + + ubthread_mutex_lock + ubthread_mutex_unlock - + + + + + + + - ubthread_mutexid - ubthread_mutexlocked - ubthread_mutexpid + ubthread_mutexid + ubthread_mutexlock + ubthread_mutexpid diff --git a/doc/xml/structubthread__mutex__list.xml b/doc/xml/structubthread__mutex__list.xml index 2a9209c..76b4d47 100644 --- a/doc/xml/structubthread__mutex__list.xml +++ b/doc/xml/structubthread__mutex__list.xml @@ -1,11 +1,11 @@ - - - + + + ubthread_mutex_list ubthread.h - - ubthread_mutex_t * + + ubthread_mutex_t * ubthread_mutex_t* ubthread_mutex_list::mutex mutex @@ -15,10 +15,14 @@ - + + sys_mutex_free + sys_mutex_lock + sys_mutex_new + sys_mutex_unlock - - ubthread_mutex_list * + + struct ubthread_mutex_list * struct ubthread_mutex_list* ubthread_mutex_list::next next @@ -28,7 +32,7 @@ - + @@ -36,25 +40,25 @@ - + - - mutex + + +mutex - - next + + +next - + - + - ubthread_mutex_listmutex - ubthread_mutex_listnext + ubthread_mutex_listmutex + ubthread_mutex_listnext diff --git a/doc/xml/structudp__hdr.xml b/doc/xml/structudp__hdr.xml index 29e2811..eaa83c0 100644 --- a/doc/xml/structudp__hdr.xml +++ b/doc/xml/structudp__hdr.xml @@ -1,16 +1,16 @@ - - - + + + udp_hdr - udp.h + udp.h - + udp_hdr::PACK_STRUCT_FIELD - (uInt16 chksum) + (u16_t chksum) PACK_STRUCT_FIELD - uInt16 + u16_t chksum @@ -19,32 +19,15 @@ - + - + udp_hdr::PACK_STRUCT_FIELD - (uInt16 len) + (u16_t dest) PACK_STRUCT_FIELD - uInt16 - len - - - - - - - - - - - - udp_hdr::PACK_STRUCT_FIELD - (uInt16 dest) - PACK_STRUCT_FIELD - - uInt16 + u16_t dest @@ -53,15 +36,32 @@ - + - + udp_hdr::PACK_STRUCT_FIELD - (uInt16 src) + (u16_t len) PACK_STRUCT_FIELD - uInt16 + u16_t + len + + + + + + + + + + + + udp_hdr::PACK_STRUCT_FIELD + (u16_t src) + PACK_STRUCT_FIELD + + u16_t src @@ -70,19 +70,25 @@ - + - + + + + + + + - udp_hdrPACK_STRUCT_FIELD - udp_hdrPACK_STRUCT_FIELD - udp_hdrPACK_STRUCT_FIELD - udp_hdrPACK_STRUCT_FIELD + udp_hdrPACK_STRUCT_FIELD + udp_hdrPACK_STRUCT_FIELD + udp_hdrPACK_STRUCT_FIELD + udp_hdrPACK_STRUCT_FIELD diff --git a/doc/xml/structufs1__dinode.xml b/doc/xml/structufs1__dinode.xml index 7518155..94907ed 100644 --- a/doc/xml/structufs1__dinode.xml +++ b/doc/xml/structufs1__dinode.xml @@ -1,11 +1,11 @@ - - - + + + ufs1_dinode ufs.h - - int32_t + + int32_t int32_t ufs1_dinode::di_atime di_atime @@ -15,10 +15,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_atimensec di_atimensec @@ -28,10 +28,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_blocks di_blocks @@ -41,10 +41,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_ctime di_ctime @@ -54,10 +54,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_ctimensec di_ctimensec @@ -67,10 +67,10 @@ - + - - ufs1_daddr_t + + ufs1_daddr_t ufs1_daddr_t ufs1_dinode::di_db[12] [12] di_db @@ -80,10 +80,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs1_dinode::di_flags di_flags @@ -93,10 +93,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_gen di_gen @@ -106,10 +106,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs1_dinode::di_gid di_gid @@ -119,10 +119,10 @@ - + - - ufs1_daddr_t + + ufs1_daddr_t ufs1_daddr_t ufs1_dinode::di_ib[3] [3] di_ib @@ -132,10 +132,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t ufs1_dinode::di_mode di_mode @@ -145,10 +145,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_mtime di_mtime @@ -158,10 +158,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_mtimensec di_mtimensec @@ -171,10 +171,10 @@ - + - - int16_t + + int16_t int16_t ufs1_dinode::di_nlink di_nlink @@ -184,10 +184,10 @@ - + - - u_int64_t + + u_int64_t u_int64_t ufs1_dinode::di_size di_size @@ -197,10 +197,10 @@ - + - - int32_t + + int32_t int32_t ufs1_dinode::di_spare[2] [2] di_spare @@ -210,11 +210,11 @@ - + - - ufs1_dinode::@1 - union ufs1_dinode::@1 ufs1_dinode::di_u + + union ufs1_dinode::@21 + union ufs1_dinode::@21 ufs1_dinode::di_u di_u @@ -223,10 +223,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs1_dinode::di_uid di_uid @@ -236,10 +236,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t ufs1_dinode::oldids[2] [2] oldids @@ -249,34 +249,40 @@ - + - + + + + + + + - ufs1_dinodedi_atime - ufs1_dinodedi_atimensec - ufs1_dinodedi_blocks - ufs1_dinodedi_ctime - ufs1_dinodedi_ctimensec - ufs1_dinodedi_db - ufs1_dinodedi_flags - ufs1_dinodedi_gen - ufs1_dinodedi_gid - ufs1_dinodedi_ib - ufs1_dinodedi_mode - ufs1_dinodedi_mtime - ufs1_dinodedi_mtimensec - ufs1_dinodedi_nlink - ufs1_dinodedi_size - ufs1_dinodedi_spare - ufs1_dinodedi_u - ufs1_dinodedi_uid - ufs1_dinodeoldids + ufs1_dinodedi_atime + ufs1_dinodedi_atimensec + ufs1_dinodedi_blocks + ufs1_dinodedi_ctime + ufs1_dinodedi_ctimensec + ufs1_dinodedi_db + ufs1_dinodedi_flags + ufs1_dinodedi_gen + ufs1_dinodedi_gid + ufs1_dinodedi_ib + ufs1_dinodedi_mode + ufs1_dinodedi_mtime + ufs1_dinodedi_mtimensec + ufs1_dinodedi_nlink + ufs1_dinodedi_size + ufs1_dinodedi_spare + ufs1_dinodedi_u + ufs1_dinodedi_uid + ufs1_dinodeoldids diff --git a/doc/xml/structufs2__dinode.xml b/doc/xml/structufs2__dinode.xml index 39dfc4d..59bffe6 100644 --- a/doc/xml/structufs2__dinode.xml +++ b/doc/xml/structufs2__dinode.xml @@ -1,11 +1,11 @@ - - - + + + ufs2_dinode ufs.h - - ufs_time_t + + ufs_time_t ufs_time_t ufs2_dinode::di_atime di_atime @@ -15,10 +15,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - int32_t + + int32_t int32_t ufs2_dinode::di_atimensec di_atimensec @@ -28,10 +31,10 @@ - + - - int32_t + + int32_t int32_t ufs2_dinode::di_birthnsec di_birthnsec @@ -41,10 +44,10 @@ - + - - ufs_time_t + + ufs_time_t ufs_time_t ufs2_dinode::di_birthtime di_birthtime @@ -54,10 +57,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs2_dinode::di_blksize di_blksize @@ -67,10 +70,10 @@ - + - - u_int64_t + + u_int64_t u_int64_t ufs2_dinode::di_blocks di_blocks @@ -80,10 +83,10 @@ - + - - ufs_time_t + + ufs_time_t ufs_time_t ufs2_dinode::di_ctime di_ctime @@ -93,10 +96,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - int32_t + + int32_t int32_t ufs2_dinode::di_ctimensec di_ctimensec @@ -106,10 +112,10 @@ - + - - ufs2_daddr_t + + ufs2_daddr_t ufs2_daddr_t ufs2_dinode::di_db[12] [12] di_db @@ -119,11 +125,10 @@ - - fsread + - - ufs2_daddr_t + + ufs2_daddr_t ufs2_daddr_t ufs2_dinode::di_extb[2] [2] di_extb @@ -133,10 +138,10 @@ - + - - int32_t + + int32_t int32_t ufs2_dinode::di_extsize di_extsize @@ -146,10 +151,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs2_dinode::di_flags di_flags @@ -159,10 +164,10 @@ - + - - int32_t + + int32_t int32_t ufs2_dinode::di_gen di_gen @@ -172,10 +177,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs2_dinode::di_gid di_gid @@ -185,10 +190,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - ufs2_daddr_t + + ufs2_daddr_t ufs2_daddr_t ufs2_dinode::di_ib[3] [3] di_ib @@ -198,11 +206,10 @@ - - fsread + - - uint32_t + + uint32_t uint32_t ufs2_dinode::di_kernflags di_kernflags @@ -212,10 +219,10 @@ - + - - u_int16_t + + u_int16_t u_int16_t ufs2_dinode::di_mode di_mode @@ -225,10 +232,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - ufs_time_t + + ufs_time_t ufs_time_t ufs2_dinode::di_mtime di_mtime @@ -238,10 +248,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - int32_t + + int32_t int32_t ufs2_dinode::di_mtimensec di_mtimensec @@ -251,10 +264,10 @@ - + - - int16_t + + int16_t int16_t ufs2_dinode::di_nlink di_nlink @@ -264,10 +277,13 @@ - + + _sys_stat + sys_fstat + sys_fstatat - - u_int64_t + + u_int64_t u_int64_t ufs2_dinode::di_size di_size @@ -277,11 +293,13 @@ - - fsread + + _sys_stat + sys_fstat + sys_fstatat - - int64_t + + int64_t int64_t ufs2_dinode::di_spare[3] [3] di_spare @@ -291,10 +309,10 @@ - + - - uint32_t + + uint32_t uint32_t ufs2_dinode::di_uid di_uid @@ -304,38 +322,47 @@ - + + _sys_stat + sys_fstat + sys_fstatat - + + + + + + + - ufs2_dinodedi_atime - ufs2_dinodedi_atimensec - ufs2_dinodedi_birthnsec - ufs2_dinodedi_birthtime - ufs2_dinodedi_blksize - ufs2_dinodedi_blocks - ufs2_dinodedi_ctime - ufs2_dinodedi_ctimensec - ufs2_dinodedi_db - ufs2_dinodedi_extb - ufs2_dinodedi_extsize - ufs2_dinodedi_flags - ufs2_dinodedi_gen - ufs2_dinodedi_gid - ufs2_dinodedi_ib - ufs2_dinodedi_kernflags - ufs2_dinodedi_mode - ufs2_dinodedi_mtime - ufs2_dinodedi_mtimensec - ufs2_dinodedi_nlink - ufs2_dinodedi_size - ufs2_dinodedi_spare - ufs2_dinodedi_uid + ufs2_dinodedi_atime + ufs2_dinodedi_atimensec + ufs2_dinodedi_birthnsec + ufs2_dinodedi_birthtime + ufs2_dinodedi_blksize + ufs2_dinodedi_blocks + ufs2_dinodedi_ctime + ufs2_dinodedi_ctimensec + ufs2_dinodedi_db + ufs2_dinodedi_extb + ufs2_dinodedi_extsize + ufs2_dinodedi_flags + ufs2_dinodedi_gen + ufs2_dinodedi_gid + ufs2_dinodedi_ib + ufs2_dinodedi_kernflags + ufs2_dinodedi_mode + ufs2_dinodedi_mtime + ufs2_dinodedi_mtimensec + ufs2_dinodedi_nlink + ufs2_dinodedi_size + ufs2_dinodedi_spare + ufs2_dinodedi_uid diff --git a/doc/xml/structuserFileDescriptorStruct.xml b/doc/xml/structuserFileDescriptorStruct.xml index 9e9027a..da13023 100644 --- a/doc/xml/structuserFileDescriptorStruct.xml +++ b/doc/xml/structuserFileDescriptorStruct.xml @@ -1,12 +1,12 @@ - - - + + + userFileDescriptorStruct - file.h + file.h - - fileDescriptorStruct * - struct fileDescriptorStruct* userFileDescriptorStruct::fd + + struct fileDescriptor * + struct fileDescriptor* userFileDescriptorStruct::fd fd @@ -15,17 +15,18 @@ - - sysFclose - sysFgetc - sysFopen - sysFread - sysFseek - sysFwrite + + sys_fclose + sys_fgetc + sys_fopen + sys_fread + sys_fseek + sys_fwrite + sysFwrite - - uInt32 - uInt32 userFileDescriptorStruct::fdSize + + uint32_t + uint32_t userFileDescriptorStruct::fdSize fdSize @@ -34,8 +35,8 @@ - - sysFopen + + sys_fopen @@ -43,108 +44,303 @@ - + + + + + + + + + + + + + + + + + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + + + + + + + + + +fat_wait + + + + + + + +sa_mask + + + - - prev -next -parent -fileListTail -fileListHead + + +parent + +fileListTail + +fileListHead + +prev + +next - + + + + + +i_old + +i_depend + + + - - partitions + + +partitions - + + + + + +msdos_i + + + +i_sb + + + +i_prev + +i_bound_by + +i_hash_next + +i_next + +i_bound_to + +i_hash_prev + +i_mount + + + +i_sem + + + +pipe_i + + + +ufs2_i + + + +i_wait + + + +i_op + + + +ufs1_i + + + - - - - - cacheNode - - - dmadat - - - mp - - - prev -next - + + + - + + + + + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + + + + + +msdos_sb + + + +s_mounted + +s_covered + + + +s_wait + + + +s_op + + + + + + + +exec + +root + +pwd + + + +parent + +prev + +next + + + +i387 + + + +td + + + +files + + + +term + + + +oInfo + + + +tss + + + + + + + - - - - - fd + + + + + +wait - + + + + + +inode + + + +cacheNode + + + +prev + +next + + + +dmadat + + + +mp + + + + + + + +fd + + + - + + + + + +wait + + + + + + + +task + + + +next + + + + + + + + + + + +frame + + + +sigmask + + + +rlim + + + +sigact + + + + + + + + + + + - - prev -next + + +prev + +next - + - userFileDescriptorStructfd - userFileDescriptorStructfdSize + userFileDescriptorStructfd + userFileDescriptorStructfdSize diff --git a/doc/xml/structvfs__mountPoint.xml b/doc/xml/structvfs__mountPoint.xml index 9043fa0..e0b60a3 100644 --- a/doc/xml/structvfs__mountPoint.xml +++ b/doc/xml/structvfs__mountPoint.xml @@ -1,11 +1,11 @@ - - - + + + vfs_mountPoint mount.h - - device_node * + + struct device_node * struct device_node* vfs_mountPoint::device device @@ -15,19 +15,19 @@ - - dskread - openFileUbixFS - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - vfs_mount - writeUbixFS + + media_read + media_write + open_fat + syncBat + ubixfs_initialize + ubixFSmkDir + vfs_mount + writeFileByte + writeUbixFS - - ubixDiskLabel * + + struct ubixDiskLabel * struct ubixDiskLabel* vfs_mountPoint::diskLabel diskLabel @@ -37,17 +37,15 @@ - - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - writeFileByte - writeUbixFS + + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - - fileSystem * + + struct fileSystem * struct fileSystem* vfs_mountPoint::fs fs @@ -57,17 +55,15 @@ - - fgetc - fopen - fputc - fread - fwrite - sysMkDir - unlink - vfs_mount + + fgetc + fopen + fputc + fread + sysMkDir + vfs_mount - + void * void* vfs_mountPoint::fsInfo @@ -78,23 +74,17 @@ - - devfs_initialize - devfs_makeNode - devfs_open - freeBlocks - getFreeBlocks - openFileUbixFS - readUbixFS - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - writeFileByte - writeUbixFS + + freeBlocks + getFreeBlocks + readUbixFS + syncBat + ubixfs_initialize + ubixFSmkDir + writeFileByte + writeUbixFS - + char char vfs_mountPoint::mountPoint[1024] [1024] @@ -105,13 +95,12 @@ - - unlink - vfs_findMount - vfs_mount + + vfs_findMount + vfs_mount - - vfs_mountPoint * + + struct vfs_mountPoint * struct vfs_mountPoint* vfs_mountPoint::next next @@ -121,11 +110,11 @@ - - vfs_addMount - vfs_findMount + + vfs_addMount + vfs_findMount - + int int vfs_mountPoint::partition @@ -136,17 +125,15 @@ - - syncBat - ubixfs_initialize - ubixfs_loadData - ubixFSmkDir - ubixFSUnlink - vfs_mount - writeFileByte - writeUbixFS + + syncBat + ubixfs_initialize + ubixFSmkDir + vfs_mount + writeFileByte + writeUbixFS - + char char vfs_mountPoint::perms @@ -157,11 +144,11 @@ - - vfs_mount + + vfs_mount - - vfs_mountPoint * + + struct vfs_mountPoint * struct vfs_mountPoint* vfs_mountPoint::prev prev @@ -171,8 +158,8 @@ - - vfs_addMount + + vfs_addMount @@ -180,76 +167,76 @@ - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - - partitions + + +partitions - + - + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + - + - - prev -next + + +prev + +next - + - vfs_mountPointdevice - vfs_mountPointdiskLabel - vfs_mountPointfs - vfs_mountPointfsInfo - vfs_mountPointmountPoint - vfs_mountPointnext - vfs_mountPointpartition - vfs_mountPointperms - vfs_mountPointprev + vfs_mountPointdevice + vfs_mountPointdiskLabel + vfs_mountPointfs + vfs_mountPointfsInfo + vfs_mountPointmountPoint + vfs_mountPointnext + vfs_mountPointpartition + vfs_mountPointperms + vfs_mountPointprev diff --git a/doc/xml/structvitalsStruct.xml b/doc/xml/structvitalsStruct.xml index c7824c3..c896f80 100644 --- a/doc/xml/structvitalsStruct.xml +++ b/doc/xml/structvitalsStruct.xml @@ -1,12 +1,12 @@ - - - + + + vitalsStruct vitals.h - - uInt32 - uInt32 vitalsStruct::dQuantum + + uint32_t + uint32_t vitalsStruct::dQuantum dQuantum @@ -15,11 +15,11 @@ - - vitals_init + + vitals_init - - fileSystem * + + struct fileSystem * struct fileSystem* vitalsStruct::fileSystems fileSystems @@ -29,12 +29,11 @@ - - vfs_init - vfsFindFS - vfsRegisterFS + + vfs_init + vfsFindFS - + void * void* vitalsStruct::font @@ -45,12 +44,13 @@ - - ogPrintf + + ogPrintf + sdeThread - - uInt32 - uInt32 vitalsStruct::freePages + + uint32_t + uint32_t vitalsStruct::freePages freePages @@ -59,16 +59,23 @@ - - adjustCowCounter - freePage - keyboardHandler - kmain - vmmFindFreePage - vmmFreeProcessPages + - - vfs_mountPoint * + + uint32_t + uint32_t vitalsStruct::lastFD + + lastFD + + + + + + + + + + struct vfs_mountPoint * struct vfs_mountPoint* vitalsStruct::mountPoints mountPoints @@ -78,13 +85,13 @@ - - vfs_addMount - vfs_findMount + + vfs_addMount + vfs_findMount - - uInt32 - uInt32 vitalsStruct::openFiles + + uint32_t + uint32_t vitalsStruct::openFiles openFiles @@ -93,11 +100,9 @@ - - fclose - fopen + - + char * char* vitalsStruct::packet @@ -108,11 +113,11 @@ - + - - uInt32 - uInt32 vitalsStruct::packetLength + + uint32_t + uint32_t vitalsStruct::packetLength packetLength @@ -121,11 +126,11 @@ - + - - uInt32 - uInt32 vitalsStruct::quantum + + uint32_t + uint32_t vitalsStruct::quantum quantum @@ -134,10 +139,10 @@ - - vitals_init + + vitals_init - + void * void* vitalsStruct::screen @@ -148,12 +153,16 @@ - - ogPrintf + + ogPrintf + sdeTestThread + sdeTestThreadOld + sdeThread + sysSDE - - uInt32 - uInt32 vitalsStruct::sysTicks + + uint32_t + uint32_t vitalsStruct::sysTicks sysTicks @@ -162,13 +171,12 @@ - - sysGetUptime - systemTask + + sysGetUptime - - uInt32 - uInt32 vitalsStruct::sysUptime + + uint32_t + uint32_t vitalsStruct::sysUptime sysUptime @@ -177,14 +185,15 @@ - - sysGetTime - systemTask - ubthread_cond_timedwait + + gettimeofday + sysGetTime + systemTask + ubthread_cond_timedwait - - uInt32 - uInt32 vitalsStruct::timeStart + + uint32_t + uint32_t vitalsStruct::timeStart timeStart @@ -193,9 +202,9 @@ - - sysGetTime - time_init + + gettimeofday + sysGetTime @@ -203,90 +212,91 @@ - + - + - - devRec + + +devRec - - devInfo + + +devInfo - - prev -next + + +prev + +next - + - - partitions + + +partitions - + - + - - diskLabel + + +diskLabel - - device + + +device - - fs + + +fs - - prev -next + + +prev + +next - + - - fileSystems + + +fileSystems - - mountPoints + + +mountPoints - + - + - - prev -next + + +prev + +next - + - vitalsStructdQuantum - vitalsStructfileSystems - vitalsStructfont - vitalsStructfreePages - vitalsStructmountPoints - vitalsStructopenFiles - vitalsStructpacket - vitalsStructpacketLength - vitalsStructquantum - vitalsStructscreen - vitalsStructsysTicks - vitalsStructsysUptime - vitalsStructtimeStart + vitalsStructdQuantum + vitalsStructfileSystems + vitalsStructfont + vitalsStructfreePages + vitalsStructlastFD + vitalsStructmountPoints + vitalsStructopenFiles + vitalsStructpacket + vitalsStructpacketLength + vitalsStructquantum + vitalsStructscreen + vitalsStructsysTicks + vitalsStructsysUptime + vitalsStructtimeStart diff --git a/doc/xml/sys_8h.xml b/doc/xml/sys_8h.xml index 411b4f3..ed844ed 100644 --- a/doc/xml/sys_8h.xml +++ b/doc/xml/sys_8h.xml @@ -1,243 +1,837 @@ - - - + + + sys.h - arch/cc.h - arch/sys_arch.h - src/sys/include/net/api.h - src/sys/include/net/api_msg.h - src/sys/include/net/tcp.h - src/sys/net/api/api_msg.c - src/sys/net/api/tcpip.c - src/sys/net/net/init.c - src/sys/net/net/sys_arch.c - src/sys/net/net/udpecho.c - src/sys/net/netif/ethernetif.c + net/opt.h + net/arch/sys_arch.h + net/err.h + C:/Dev/git/UbixOS/sys/include/net/priv/tcpip_priv.h + C:/Dev/git/UbixOS/sys/include/net/timeouts.h + C:/Dev/git/UbixOS/sys/net/api/err.c + C:/Dev/git/UbixOS/sys/net/api/tcpip.c + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/mem.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/net/core/pbuf.c + C:/Dev/git/UbixOS/sys/net/core/sys.c + C:/Dev/git/UbixOS/sys/net/core/timeouts.c + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + C:/Dev/git/UbixOS/sys/net/net/udpecho.c - - - - - - - - + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - sys_timeout - sys_timeouts - - - void(*) - typedef void(* ) sys_timeout_handler(void *arg) - (void *arg) - sys_timeout_handler + + + LWIP_COMPAT_MUTEX + 0 + + + +Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores should be used instead + + + + + + + SYS_ARCH_DEC + var + val + do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + var -= val; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) - + + + + SYS_ARCH_DECL_PROTECT + lev + + + +SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation. + + + + + + + SYS_ARCH_GET + var + ret + do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + ret = var; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) + + + + + + + + + + SYS_ARCH_INC + var + val + do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + var += val; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) + + + + + + + + + + SYS_ARCH_PROTECT + lev + + + + + + + + + + SYS_ARCH_SET + var + val + do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + var = val; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) + + + + + + + + + + SYS_ARCH_TIMEOUT + 0xffffffffUL + + + +Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait + + + + + + + SYS_ARCH_UNPROTECT + lev + + + + + + + + + + SYS_MBOX_EMPTY + SYS_ARCH_TIMEOUT + + + +sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. For now we use the same magic value, but we allow this to change in future. + + + + + + + sys_mbox_fetch + mbox + msg + sys_arch_mbox_fetch(mbox, msg, 0) + + + + + + + + + + sys_mbox_set_invalid_val + mbox + sys_mbox_set_invalid(&(mbox)) + + + +Same as sys_mbox_set_invalid() but taking a value, not a pointer + + + + + + + sys_mbox_tryfetch + mbox + msg + sys_arch_mbox_tryfetch(mbox, msg) + + + +For now, we map straight to sys_arch implementation. + + + + + + + sys_mbox_valid_val + mbox + sys_mbox_valid(&(mbox)) + + + +Same as sys_mbox_valid() but taking a value, not a pointer + + + + + + + sys_sem_set_invalid_val + sem + sys_sem_set_invalid(&(sem)) + + + +Same as sys_sem_set_invalid() but taking a value, not a pointer + + + + + + + sys_sem_valid_val + sem + sys_sem_valid(&(sem)) + + + +Same as sys_sem_valid() but taking a value, not a pointer + + + + + + + sys_sem_wait + sem + sys_arch_sem_wait(sem, 0) + + + +Wait for a semaphore - forever/no timeout + + + + + + + + + void(* + typedef void(* lwip_thread_fn) (void *arg) + )(void *arg) + lwip_thread_fn + + + +Function prototype for thread functions + + + + - - uInt16 - uInt16 sys_arch_mbox_fetch - (sys_mbox_t mbox, void **msg, uInt16 timeout) + + uint32_t + uint32_t sys_arch_mbox_fetch + (struct sys_mbox **mb, void **msg, uint32_t timeout) sys_arch_mbox_fetch - sys_mbox_t - mbox + struct sys_mbox ** + mb void ** msg - uInt16 + uint32_t timeout +Wait for a new message to arrive in the mbox + +mbox + + +mbox to get a message from + + + + +msg + + +pointer where the message is stored + + + + +timeout + + +maximum time (in milliseconds) to wait for a message (0 = wait forever) + + + +time (in milliseconds) waited for a message, may be 0 if not waited or SYS_ARCH_TIMEOUT on timeout The returned time has to be accurate to prevent timer jitter! + + - - netconn_delete + - - uInt16 - uInt16 sys_arch_sem_wait - (sys_sem_t sem, uInt16 timeout) + + uint32_t + uint32_t sys_arch_mbox_tryfetch + (struct sys_mbox **mb, void **msg) + sys_arch_mbox_tryfetch + + struct sys_mbox ** + mb + + + void ** + msg + + + + +Wait for a new message to arrive in the mbox + +mbox + + +mbox to get a message from + + + + +msg + + +pointer where the message is stored + + + +0 (milliseconds) if a message has been received or SYS_MBOX_EMPTY if the mailbox is empty + + + + + + + + + uint32_t + uint32_t sys_arch_sem_wait + (struct sys_sem **s, uint32_t timeout) sys_arch_sem_wait - sys_sem_t - sem + struct sys_sem ** + s - uInt16 + uint32_t timeout +Wait for a semaphore for the specified timeout + +sem + + +the semaphore to wait for + + + + +timeout + + +timeout in milliseconds to wait (0 = wait forever) + + + +time (in milliseconds) waited for the semaphore or SYS_ARCH_TIMEOUT on timeout + + - - sys_arch_mbox_fetch + + LWIP_ASSERT + sys_sem::mutex + NULL + sys_sem::signaled + ubthread_mutex_lock + sys_msleep - - sys_timeouts * - struct sys_timeouts* sys_arch_timeouts - (void) - sys_arch_timeouts - - void - - - - - - - - - current_thread - sys_thread::timeouts - - + void void sys_init (void) @@ -251,100 +845,105 @@ - - gettimeofday - starttime - net_init + + gettimeofday + lwip_init - - void - void sys_mbox_fetch - (sys_mbox_t mbox, void **msg) - sys_mbox_fetch - - sys_mbox_t - mbox - - - void ** - msg - - - - - - - - - netconn_accept - netconn_bind - netconn_close - netconn_connect - netconn_delete - netconn_listen - netconn_recv - netconn_send - netconn_write - tcpip_thread - - - void - void sys_mbox_free - (sys_mbox_t mbox) - sys_mbox_free - - sys_mbox_t - mbox - - - - - - - - - accept_function - netconn_delete - netconn_recv - - - sys_mbox_t - sys_mbox_t sys_mbox_new + + u32_t + u32_t sys_jiffies (void) - sys_mbox_new + sys_jiffies void +Ticks/jiffies since power up. - - sys_mbox::first - kmalloc - sys_mbox::last - sys_mbox::mail - mbox - sys_mbox::mutex - sys_sem_new_ - accept_function - do_listen - netconn_bind - netconn_connect - netconn_listen - netconn_new - tcpip_init + - + + void + void sys_mbox_free + (struct sys_mbox **mb) + sys_mbox_free + + struct sys_mbox ** + mb + + + + +Delete an mbox + +mbox + + +mbox to delete + + + + + + + + + NULL + SYS_MBOX_NULL + + + err_t + err_t sys_mbox_new + (struct sys_mbox **mb, int size) + sys_mbox_new + + struct sys_mbox ** + mb + + + int + size + + + + +Create a new mbox of specified size + +mbox + + +pointer to the mbox to create + + + + +size + + +(minimum) number of messages in this mbox + + + +ERR_OK if successful, another err_t otherwise + + + + + + + + void void sys_mbox_post - (sys_mbox_t mbox, void *msg) + (struct sys_mbox **mb, void *msg) sys_mbox_post - sys_mbox_t - mbox + struct sys_mbox ** + mb void * @@ -353,29 +952,303 @@ +Post a message to an mbox - may not fail -> blocks if full, only used from tasks not from ISR + +mbox + + +mbox to posts the message + + + + +msg + + +message to post (ATTENTION: can be NULL) + + + + - - accept_function - do_bind - do_close - do_connect - do_connected - do_delconn - do_listen - do_recv - do_send - do_write - err_tcp - recv_tcp - recv_udp - tcpip_apimsg - tcpip_input + + sys_mbox::head - - unsigned long - unsigned long sys_now + + void + void sys_mbox_set_invalid + (struct sys_mbox **mb) + sys_mbox_set_invalid + + struct sys_mbox ** + mb + + + + +Set an mbox invalid so that sys_mbox_valid returns 0 + + + + + + + err_t + err_t sys_mbox_trypost + (struct sys_mbox **mb, void *msg) + sys_mbox_trypost + + struct sys_mbox ** + mb + + + void * + msg + + + + +Try to post a message to an mbox - may fail if full or ISR + +mbox + + +mbox to posts the message + + + + +msg + + +message to post (ATTENTION: can be NULL) + + + + + + + + + sys_mbox::head + + + int + int sys_mbox_valid + (struct sys_mbox **mb) + sys_mbox_valid + + struct sys_mbox ** + mb + + + + +Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid + + + + + + + void + void sys_msleep + (u32_t ms) + sys_msleep + + u32_t + ms + + + + +Sleep for specified number of ms +Sleep for some ms. Timeouts are NOT processed while sleeping. + + +ms + + +number of milliseconds to sleep + + + + + + + + + ERR_OK + sys_arch_sem_wait + sys_sem_free + sys_sem_new + + + void + void sys_mutex_free + (sys_mutex_t *mutex) + sys_mutex_free + + sys_mutex_t * + mutex + + + + +Delete a semaphore + +mutex + + +the mutex to delete + + + + + + + + + mutex + ubthread_mutex_list::mutex + ubthread_mutex_destroy + + + void + void sys_mutex_lock + (sys_mutex_t *mutex) + sys_mutex_lock + + sys_mutex_t * + mutex + + + + +Lock a mutex + +mutex + + +the mutex to lock + + + + + + + + + mutex + ubthread_mutex_list::mutex + ubthread_mutex_lock + mem_malloc + + + err_t + err_t sys_mutex_new + (sys_mutex_t *mutex) + sys_mutex_new + + sys_mutex_t * + mutex + + + + +Create a new mutex. Note that mutexes are expected to not be taken recursively by the lwIP code, so both implementation types (recursive or non-recursive) should work. + +mutex + + +pointer to the mutex to create + + + +ERR_OK if successful, another err_t otherwise + + + + + + + ERR_OK + mutex + ubthread_mutex_list::mutex + NULL + ubthread_mutex_init + + + void + void sys_mutex_set_invalid + (sys_mutex_t *mutex) + sys_mutex_set_invalid + + sys_mutex_t * + mutex + + + + +Set a mutex invalid so that sys_mutex_valid returns 0 + + + + + + + void + void sys_mutex_unlock + (sys_mutex_t *mutex) + sys_mutex_unlock + + sys_mutex_t * + mutex + + + + +Unlock a mutex + +mutex + + +the mutex to unlock + + + + + + + + + mutex + ubthread_mutex_list::mutex + ubthread_mutex_unlock + + + int + int sys_mutex_valid + (sys_mutex_t *mutex) + sys_mutex_valid + + sys_mutex_t * + mutex + + + + +Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid + + + + + + + u32_t + u32_t sys_now (void) sys_now @@ -384,165 +1257,250 @@ +Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it. - + + sys_unix_now - + void void sys_sem_free - (sys_sem_t sem) + (sys_sem_t **sem) sys_sem_free - sys_sem_t + sys_sem_t ** sem +Delete a semaphore + +sem + + +semaphore to delete + + + + - - netconn_delete - netconn_write - netMainThread + + NULL + sem_destroy + SYS_SEM_NULL + sys_msleep - - sys_sem_t - sys_sem_t sys_sem_new - (uInt8 count) + + err_t + err_t sys_sem_new + (sys_sem_t **sem, u8_t count) sys_sem_new - uInt8 + sys_sem_t ** + sem + + + u8_t count +Create a new semaphore + +sem + + +pointer to the semaphore to create + + + + +count + + +initial count of the semaphore + + + +ERR_OK if successful, another err_t otherwise + + - - sys_sem_new_ - accept_function - netconn_write - netMainThread + + sys_sem::cond + ERR_OK + kmalloc + kprintf + sys_sem::mutex + NULL + sem_init + sys_sem::signaled + ubthread_cond_init + ubthread_mutex_init + sys_msleep + tcpip_api_call - + + void + void sys_sem_set_invalid + (struct sys_sem **s) + sys_sem_set_invalid + + struct sys_sem ** + s + + + + +Set a semaphore invalid so that sys_sem_valid returns 0 + + + + + + void void sys_sem_signal - (sys_sem_t sem) + (struct sys_sem **s) sys_sem_signal - sys_sem_t - sem + struct sys_sem ** + s +Signals a semaphore + +sem + + +the semaphore to signal + + + + - - err_tcp - poll_tcp - sent_tcp - sys_arch_mbox_fetch - sys_mbox_post - tcpip_init_done + + sys_sem::cond + LWIP_ASSERT + sys_sem::mutex + NULL + sys_sem::signaled + ubthread_cond_broadcast + ubthread_mutex_lock + ubthread_mutex_unlock - - void - void sys_sem_wait - (sys_sem_t sem) - sys_sem_wait + + int + int sys_sem_valid + (struct sys_sem **s) + sys_sem_valid - sys_sem_t - sem + struct sys_sem ** + s +Check if a semaphore is valid/allocated: return 1 for valid, 0 for invalid - - netconn_close - netconn_write - netMainThread - sys_mbox_free - sys_mbox_post + + tcpip_send_msg_wait_sem - - void - void sys_thread_new - (void(*function)(void), void *arg) + + sys_thread_t + sys_thread_t sys_thread_new + (const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) sys_thread_new - void(*)(void) - function + const char * + name + + + lwip_thread_fn + thread void * arg - - - - - - - - kmalloc - kpanic - kprintf - netThreadSpinlock - sys_thread::next - sys_timeouts::next - NULL - spinLock - spinUnlock - threads - sys_thread::timeouts - sys_thread::ubthread - ubthread_create - bot_init - low_level_init - net_init - shell_init - tcpip_init - udpecho_init - - - void - void sys_timeout - (uInt16 msecs, sys_timeout_handler h, void *arg) - sys_timeout - uInt16 - msecs + int + stacksize - sys_timeout_handler - h - - - void * - arg + int + prio +The only thread function: Creates a new thread ATTENTION: although this function returns a value, it MUST NOT FAIL (ports have to assert this!) + +name + + +human-readable name for the thread (used for debugging purposes) + + + + +thread + + +thread-function + + + + +arg + + +parameter passed to 'thread' + + + + +stacksize + + +stack size in bytes for the new thread (may be ignored by ports) + + + + +prio + + +priority of the new thread (may be ignored by ports) + + + + - - arp_timer - ethernetif_init - tcpip_tcp_timer - tcpip_thread + + kmalloc + LWIP_ASSERT + memset + spinLock + bot_init + net_init + udpecho_init @@ -551,100 +1509,246 @@ /* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. * -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. * -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: sys_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_SYS_H__ -#define__LWIP_SYS_H__ - -#include"arch/cc.h" -#include"arch/sys_arch.h" - -typedefvoid(*sys_timeout_handler)(void*arg); - -structsys_timeout{ -structsys_timeout*next; -uInt16time; -sys_timeout_handlerh; -void*arg; -}; - -structsys_timeouts{ -structsys_timeout*next; -}; +*Author:AdamDunkels<adam@sics.se> +*/ + +#ifndefNET_HDR_SYS_H +#defineNET_HDR_SYS_H + +#include<net/opt.h> +#include<net/arch/sys_arch.h> + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifNO_SYS + +#else/*NO_SYS*/ + +#defineSYS_ARCH_TIMEOUT0xffffffffUL + +#defineSYS_MBOX_EMPTYSYS_ARCH_TIMEOUT -/*sys_init()mustbecalledbeforeanthingelse.*/ -voidsys_init(void); +#include"net/err.h" +#include"net/arch/sys_arch.h" -/* -*sys_timeout(): -* -*Scheduleatimeoutaspecifiedamountofmillisecondsinthe -*future.Whenthetimeoutoccurs,thespecifiedtimeouthandlerwill -*becalled.Thehandlerwillbepassedthe"arg"argumentwhen -*called. -* -*/ -voidsys_timeout(uInt16msecs,sys_timeout_handlerh,void*arg); -structsys_timeouts*sys_arch_timeouts(void); - -/*Semaphorefunctions.*/ -sys_sem_tsys_sem_new(uInt8count); -voidsys_sem_signal(sys_sem_tsem); -uInt16sys_arch_sem_wait(sys_sem_tsem,uInt16timeout); -voidsys_sem_free(sys_sem_tsem); - -voidsys_sem_wait(sys_sem_tsem); - -/*Mailboxfunctions.*/ -sys_mbox_tsys_mbox_new(void); -voidsys_mbox_post(sys_mbox_tmbox,void*msg); -uInt16sys_arch_mbox_fetch(sys_mbox_tmbox,void**msg,uInt16timeout); -voidsys_mbox_free(sys_mbox_tmbox); +typedefvoid(*lwip_thread_fn)(void*arg); + +/*Functionprototypesforfunctionstobeimplementedbyplatformports +(insys_arch.c)*/ + +/*Mutexfunctions:*/ + +#ifndefLWIP_COMPAT_MUTEX +#defineLWIP_COMPAT_MUTEX0 +#endif + +#ifLWIP_COMPAT_MUTEX +/*foroldportsthatdon'thavemutexes:definethemtobinarysemaphores*/ +#definesys_mutex_tsys_sem_t +#definesys_mutex_new(mutex)sys_sem_new(mutex,1) +#definesys_mutex_lock(mutex)sys_sem_wait(mutex) +#definesys_mutex_unlock(mutex)sys_sem_signal(mutex) +#definesys_mutex_free(mutex)sys_sem_free(mutex) +#definesys_mutex_valid(mutex)sys_sem_valid(mutex) +#definesys_mutex_set_invalid(mutex)sys_sem_set_invalid(mutex) + +#else/*LWIP_COMPAT_MUTEX*/ -voidsys_mbox_fetch(sys_mbox_tmbox,void**msg); - -/*Threadfunctions.*/ -//voidsys_thread_new(void(*thread)(void*arg),void*arg); -voidsys_thread_new(void(*function)(void),void*arg); - -/*ThefollowingfunctionsareusedonlyinUnixcode,and -canbeomittedwhenportingthestack.*/ -/*Returnsthecurrenttimeinmicroseconds.*/ -unsignedlongsys_now(void); - -#endif/*__LWIP_SYS_H__*/ +err_tsys_mutex_new(sys_mutex_t*mutex); +voidsys_mutex_lock(sys_mutex_t*mutex); +voidsys_mutex_unlock(sys_mutex_t*mutex); +voidsys_mutex_free(sys_mutex_t*mutex); +#ifndefsys_mutex_valid + +intsys_mutex_valid(sys_mutex_t*mutex); +#endif +#ifndefsys_mutex_set_invalid + +voidsys_mutex_set_invalid(sys_mutex_t*mutex); +#endif +#endif/*LWIP_COMPAT_MUTEX*/ + +/*Semaphorefunctions:*/ + +err_tsys_sem_new(sys_sem_t**sem,u8_tcount); +voidsys_sem_signal(structsys_sem**s); +uint32_tsys_arch_sem_wait(structsys_sem**s,uint32_ttimeout); +voidsys_sem_free(sys_sem_t**sem); +#definesys_sem_wait(sem)sys_arch_sem_wait(sem,0) +#ifndefsys_sem_valid + +intsys_sem_valid(structsys_sem**s); +#endif +#ifndefsys_sem_set_invalid + +voidsys_sem_set_invalid(structsys_sem**s); +#endif +#ifndefsys_sem_valid_val + +#definesys_sem_valid_val(sem)sys_sem_valid(&(sem)) +#endif +#ifndefsys_sem_set_invalid_val + +#definesys_sem_set_invalid_val(sem)sys_sem_set_invalid(&(sem)) +#endif + +#ifndefsys_msleep + +voidsys_msleep(u32_tms);/*onlyhasa(closeto)1msresolution.*/ +#endif + +/*Mailboxfunctions.*/ + +err_tsys_mbox_new(structsys_mbox**mb,intsize); +voidsys_mbox_post(structsys_mbox**mb,void*msg); +err_tsys_mbox_trypost(structsys_mbox**mb,void*msg); +uint32_tsys_arch_mbox_fetch(structsys_mbox**mb,void**msg,uint32_ttimeout); +/*Allowporttooverridewithamacro,e.g.specialtimeoutforsys_arch_mbox_fetch()*/ +#ifndefsys_arch_mbox_tryfetch + +uint32_tsys_arch_mbox_tryfetch(structsys_mbox**mb,void**msg); +#endif + +#definesys_mbox_tryfetch(mbox,msg)sys_arch_mbox_tryfetch(mbox,msg) + +voidsys_mbox_free(structsys_mbox**mb); +#definesys_mbox_fetch(mbox,msg)sys_arch_mbox_fetch(mbox,msg,0) +#ifndefsys_mbox_valid + +intsys_mbox_valid(structsys_mbox**mb); +#endif +#ifndefsys_mbox_set_invalid + +voidsys_mbox_set_invalid(structsys_mbox**mb); +#endif +#ifndefsys_mbox_valid_val + +#definesys_mbox_valid_val(mbox)sys_mbox_valid(&(mbox)) +#endif +#ifndefsys_mbox_set_invalid_val + +#definesys_mbox_set_invalid_val(mbox)sys_mbox_set_invalid(&(mbox)) +#endif + + +sys_thread_tsys_thread_new(constchar*name,lwip_thread_fnthread,void*arg,intstacksize,intprio); + +#endif/*NO_SYS*/ + +/*sys_init()mustbecalledbeforeanythingelse.*/ +voidsys_init(void); + +#ifndefsys_jiffies + +u32_tsys_jiffies(void); +#endif + +u32_tsys_now(void); + +/*CriticalRegionProtection*/ +/*Thesefunctionsmustbeimplementedinthesys_arch.cfile. +Insomeimplementationstheycanprovideamorelight-weightprotection +mechanismthanusingsemaphores.Otherwisesemaphorescanbeusedfor +implementation*/ +#ifndefSYS_ARCH_PROTECT + +#ifSYS_LIGHTWEIGHT_PROT + +#defineSYS_ARCH_DECL_PROTECT(lev)sys_prot_tlev + +#defineSYS_ARCH_PROTECT(lev)lev=sys_arch_protect() + +#defineSYS_ARCH_UNPROTECT(lev)sys_arch_unprotect(lev) +sys_prot_tsys_arch_protect(void); +voidsys_arch_unprotect(sys_prot_tpval); + +#else + +#defineSYS_ARCH_DECL_PROTECT(lev) +#defineSYS_ARCH_PROTECT(lev) +#defineSYS_ARCH_UNPROTECT(lev) + +#endif/*SYS_LIGHTWEIGHT_PROT*/ + +#endif/*SYS_ARCH_PROTECT*/ + +/* +*Macrostoset/getandincrease/decreasevariablesinathread-safeway. +*Usetheseforaccessingvariablethatareusedfrommorethanonethread. +*/ + +#ifndefSYS_ARCH_INC +#defineSYS_ARCH_INC(var,val)do{\ +SYS_ARCH_DECL_PROTECT(old_level);\ +SYS_ARCH_PROTECT(old_level);\ +var+=val;\ +SYS_ARCH_UNPROTECT(old_level);\ +}while(0) +#endif/*SYS_ARCH_INC*/ + +#ifndefSYS_ARCH_DEC +#defineSYS_ARCH_DEC(var,val)do{\ +SYS_ARCH_DECL_PROTECT(old_level);\ +SYS_ARCH_PROTECT(old_level);\ +var-=val;\ +SYS_ARCH_UNPROTECT(old_level);\ +}while(0) +#endif/*SYS_ARCH_DEC*/ + +#ifndefSYS_ARCH_GET +#defineSYS_ARCH_GET(var,ret)do{\ +SYS_ARCH_DECL_PROTECT(old_level);\ +SYS_ARCH_PROTECT(old_level);\ +ret=var;\ +SYS_ARCH_UNPROTECT(old_level);\ +}while(0) +#endif/*SYS_ARCH_GET*/ + +#ifndefSYS_ARCH_SET +#defineSYS_ARCH_SET(var,val)do{\ +SYS_ARCH_DECL_PROTECT(old_level);\ +SYS_ARCH_PROTECT(old_level);\ +var=val;\ +SYS_ARCH_UNPROTECT(old_level);\ +}while(0) +#endif/*SYS_ARCH_SET*/ + + +#ifdef__cplusplus +} +#endif + +#endif/*NET_HDR_SYS_H*/ - + diff --git a/doc/xml/sys__arch_8c.xml b/doc/xml/sys__arch_8c.xml index 4933dbc..977017c 100644 --- a/doc/xml/sys__arch_8c.xml +++ b/doc/xml/sys__arch_8c.xml @@ -1,293 +1,535 @@ - - - + + + sys_arch.c - ubixos/types.h + sys/types.h ubixos/sched.h ubixos/ubthread.h ubixos/kpanic.h lib/kprintf.h lib/kmalloc.h + sys/sysproto_posix.h + sys/descrip.h net/debug.h net/sys.h net/opt.h net/stats.h + net/arch/sys_arch.h ubixos/spinlock.h + ubixos/sem.h - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - sys_mbox - sys_mbox_msg - sys_sem - sys_thread thread_start_param - - SYS_MBOX_SIZE - 100 + + ERR_NOT_READY + 0 - - sys_arch_mbox_fetch - sys_mbox_post + - - UMAX - a - b - ((a) > (b) ? (a) : (b)) + + ERR_TIMED_OUT + 1 - + + + + INFINITE_TIME + 0 + + + + + + + + + + + + struct spinLock + struct spinLock netThreadSpinlock + + netThreadSpinlock + = SPIN_LOCK_INITIALIZER + + + + + + + + + + struct timeval + struct timeval starttime + + starttime + + + + + + + + + + struct sys_thread * + struct sys_thread* threads + + threads + = 0x0 + + + + + + + - - uInt16 - static uInt16 cond_wait - (ubthread_cond_t *cond, ubthread_mutex_t *mutex, uInt16 timeout) + + uint32_t + static uint32_t cond_wait + (ubthread_cond_t *cond, ubthread_mutex_t *mutex, uint32_t timeout) cond_wait - ubthread_cond_t * + ubthread_cond_t * cond - ubthread_mutex_t * + ubthread_mutex_t * mutex - uInt16 + uint32_t timeout @@ -296,19 +538,9 @@ - - ETIMEDOUT - gettimeofday - mutex - timespec::tv_nsec - timespec::tv_sec - timeval::tv_sec - timeval::tv_usec - ubthread_cond_timedwait - ubthread_cond_wait - sys_arch_sem_wait + - + struct sys_thread * static struct sys_thread* current_thread (void) @@ -322,81 +554,151 @@ - - netThreadSpinlock - sys_thread::next - NULL - spinLock - spinUnlock - threads - sys_thread::ubthread - ubthread_self - sys_arch_timeouts + - - uInt16 - uInt16 sys_arch_mbox_fetch - (struct sys_mbox *mbox, void **msg, uInt16 timeout) + + uint32_t + uint32_t sys_arch_mbox_fetch + (struct sys_mbox **mb, void **msg, uint32_t timeout) sys_arch_mbox_fetch - struct sys_mbox * - mbox + struct sys_mbox ** + mb void ** msg - uInt16 + uint32_t timeout +Wait for a new message to arrive in the mbox + +mbox + + +mbox to get a message from + + + + +msg + + +pointer where the message is stored + + + + +timeout + + +maximum time (in milliseconds) to wait for a message (0 = wait forever) + + + +time (in milliseconds) waited for a message, may be 0 if not waited or SYS_ARCH_TIMEOUT on timeout The returned time has to be accurate to prevent timer jitter! + + - - sys_mbox::first - sys_mbox::last - sys_mbox::mail - mbox - sys_mbox::msgs - sys_mbox::mutex - NULL - sys_arch_sem_wait - SYS_MBOX_SIZE - sys_sem_signal + - - uInt16 - uInt16 sys_arch_sem_wait - (struct sys_sem *sem, uInt16 timeout) + + uint32_t + uint32_t sys_arch_mbox_tryfetch + (struct sys_mbox **mb, void **msg) + sys_arch_mbox_tryfetch + + struct sys_mbox ** + mb + + + void ** + msg + + + + +Wait for a new message to arrive in the mbox + +mbox + + +mbox to get a message from + + + + +msg + + +pointer where the message is stored + + + +0 (milliseconds) if a message has been received or SYS_MBOX_EMPTY if the mailbox is empty + + + + + + + + + uint32_t + uint32_t sys_arch_sem_wait + (struct sys_sem **s, uint32_t timeout) sys_arch_sem_wait - struct sys_sem * - sem + struct sys_sem ** + s - uInt16 + uint32_t timeout +Wait for a semaphore for the specified timeout + +sem + + +the semaphore to wait for + + + + +timeout + + +timeout in milliseconds to wait (0 = wait forever) + + + +time (in milliseconds) waited for the semaphore or SYS_ARCH_TIMEOUT on timeout + + - - sys_sem::c - sys_sem::cond - cond_wait - sys_sem::mutex - ubthread_mutex_lock - ubthread_mutex_unlock + + LWIP_ASSERT + NULL + ubthread_mutex_lock + sys_sem::mutex + sys_sem::signaled + sys_msleep - - sys_timeouts * + + struct sys_timeouts * struct sys_timeouts* sys_arch_timeouts (void) sys_arch_timeouts @@ -409,11 +711,9 @@ - - current_thread - sys_thread::timeouts + - + void void sys_init () @@ -424,71 +724,88 @@ - - gettimeofday - starttime - net_init + + gettimeofday + lwip_init - + void void sys_mbox_free - (struct sys_mbox *mbox) + (struct sys_mbox **mb) sys_mbox_free - struct sys_mbox * - mbox + struct sys_mbox ** + mb +Delete an mbox + +mbox + + +mbox to delete + + + + - - kfree - sys_mbox::mail - mbox - sys_mbox::mutex - NULL - SYS_MBOX_NULL - sys_sem_free_ - sys_sem_wait + + NULL + SYS_MBOX_NULL - - sys_mbox * - struct sys_mbox* sys_mbox_new - () + + err_t + err_t sys_mbox_new + (struct sys_mbox **mb, int size) sys_mbox_new + + struct sys_mbox ** + mb + + + int + size + +Create a new mbox of specified size + +mbox + + +pointer to the mbox to create + + + + +size + + +(minimum) number of messages in this mbox + + + +ERR_OK if successful, another err_t otherwise + + - - sys_mbox::first - kmalloc - sys_mbox::last - sys_mbox::mail - mbox - sys_mbox::mutex - sys_sem_new_ - accept_function - do_listen - netconn_bind - netconn_connect - netconn_listen - netconn_new - tcpip_init + - + void void sys_mbox_post - (struct sys_mbox *mbox, void *msg) + (struct sys_mbox **mb, void *msg) sys_mbox_post - struct sys_mbox * - mbox + struct sys_mbox ** + mb void * @@ -497,44 +814,285 @@ +Post a message to an mbox - may not fail -> blocks if full, only used from tasks not from ISR + +mbox + + +mbox to posts the message + + + + +msg + + +message to post (ATTENTION: can be NULL) + + + + - - sys_mbox::first - sys_mbox::last - sys_mbox::mail - mbox - sys_mbox::msgs - sys_mbox::mutex - SYS_MBOX_SIZE - sys_sem_signal - sys_sem_wait + + sys_mbox::head - + + void + void sys_mbox_set_invalid + (struct sys_mbox **mb) + sys_mbox_set_invalid + + struct sys_mbox ** + mb + + + + +Set an mbox invalid so that sys_mbox_valid returns 0 + + + + + + + err_t + err_t sys_mbox_trypost + (struct sys_mbox **mb, void *msg) + sys_mbox_trypost + + struct sys_mbox ** + mb + + + void * + msg + + + + +Try to post a message to an mbox - may fail if full or ISR + +mbox + + +mbox to posts the message + + + + +msg + + +message to post (ATTENTION: can be NULL) + + + + + + + + + sys_mbox::head + + + int + int sys_mbox_valid + (struct sys_mbox **mb) + sys_mbox_valid + + struct sys_mbox ** + mb + + + + +Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid + + + + + + + void + void sys_mutex_free + (sys_mutex_t *mutex) + sys_mutex_free + + sys_mutex_t * + mutex + + + + +Delete a semaphore + +mutex + + +the mutex to delete + + + + + + + + + ubthread_mutex_destroy + mutex + ubthread_mutex_list::mutex + + + void + void sys_mutex_lock + (sys_mutex_t *mutex) + sys_mutex_lock + + sys_mutex_t * + mutex + + + + +Lock a mutex + +mutex + + +the mutex to lock + + + + + + + + + ubthread_mutex_lock + mutex + ubthread_mutex_list::mutex + mem_malloc + + + err_t + err_t sys_mutex_new + (sys_mutex_t *mutex) + sys_mutex_new + + sys_mutex_t * + mutex + + + + +Create a new mutex. Note that mutexes are expected to not be taken recursively by the lwIP code, so both implementation types (recursive or non-recursive) should work. + +mutex + + +pointer to the mutex to create + + + +ERR_OK if successful, another err_t otherwise + + + + + + + ubthread_mutex_init + mutex + ubthread_mutex_list::mutex + NULL + ERR_OK + + + void + void sys_mutex_unlock + (sys_mutex_t *mutex) + sys_mutex_unlock + + sys_mutex_t * + mutex + + + + +Unlock a mutex + +mutex + + +the mutex to unlock + + + + + + + + + ubthread_mutex_unlock + mutex + ubthread_mutex_list::mutex + + + uint32_t + uint32_t sys_now + () + sys_now + + void + + + + +Returns the current time in milliseconds, may be the same as sys_jiffies or at least based on it. + + + + + sys_unix_now + + void void sys_sem_free - (struct sys_sem *sem) + (struct sys_sem **sem) sys_sem_free - struct sys_sem * + sys_sem_t ** sem +Delete a semaphore + +sem + + +semaphore to delete + + + + - - sys_sem_free_ - SYS_SEM_NULL + + sem_destroy + NULL + SYS_SEM_NULL + sys_msleep - + void - static void sys_sem_free_ + static void sys_sem_free_internal (struct sys_sem *sem) - sys_sem_free_ + sys_sem_free_internal struct sys_sem * sem @@ -545,126 +1103,307 @@ - - sys_sem::cond - kfree - sys_sem::mutex - ubthread_cond_destroy - ubthread_mutex_destroy - sys_mbox_free - sys_sem_free + - - sys_sem * - struct sys_sem* sys_sem_new - (uInt8 count) + + err_t + err_t sys_sem_new + (sys_sem_t **sem, uint8_t count) sys_sem_new - uInt8 - count - - - - - - - - - sys_sem_new_ - accept_function - netconn_write - netMainThread - - - struct sys_sem * - static struct sys_sem * sys_sem_new_ - (uInt8 count) - sys_sem_new_ - - uInt8 - count - - - - - - - - - sys_sem::c - sys_sem::cond - kmalloc - sys_sem::mutex - NULL - ubthread_cond_init - ubthread_mutex_init - sys_mbox_new - sys_sem_new - - - void - void sys_sem_signal - (struct sys_sem *sem) - sys_sem_signal - - struct sys_sem * + sys_sem_t ** sem + + u8_t + count + + + + +Create a new semaphore + +sem + + +pointer to the semaphore to create + + + + +count + + +initial count of the semaphore + + + +ERR_OK if successful, another err_t otherwise + + + + + + + sem_init + kprintf + kmalloc + sys_sem::signaled + ubthread_cond_init + sys_sem::cond + NULL + ubthread_mutex_init + sys_sem::mutex + ERR_OK + tcpip_api_call + sys_msleep + + + void + void sys_sem_set_invalid + (struct sys_sem **s) + sys_sem_set_invalid + + struct sys_sem ** + s + + + + +Set a semaphore invalid so that sys_sem_valid returns 0 + + + + + + + void + void sys_sem_signal + (struct sys_sem **s) + sys_sem_signal + + struct sys_sem ** + s + + + + +Signals a semaphore + +sem + + +the semaphore to signal + + + + + + + + + LWIP_ASSERT + NULL + ubthread_mutex_lock + sys_sem::mutex + sys_sem::signaled + ubthread_cond_broadcast + sys_sem::cond + ubthread_mutex_unlock + + + int + int sys_sem_valid + (struct sys_sem **s) + sys_sem_valid + + struct sys_sem ** + s + + + + +Check if a semaphore is valid/allocated: return 1 for valid, 0 for invalid + + + + + tcpip_send_msg_wait_sem + + + int + int sys_sendto + (struct thread *td, struct sys_sendto_args *args) + sys_sendto + + struct thread * + td + + + struct sys_sendto_args * + args + - - sys_sem::c - sys_sem::cond - sys_sem::mutex - ubthread_cond_signal - ubthread_mutex_lock - ubthread_mutex_unlock + + sys_sendto_args::buf + file::fd + sys_sendto_args::flags + getfd + sys_sendto_args::len + sys_sendto_args::s + thread::td_retval + sys_sendto_args::to + sys_sendto_args::tolen - - void - void sys_thread_new - (void(*function)(void), void *arg) + + int + int sys_setsockopt + (struct thread *td, struct sys_setsockopt_args *args) + sys_setsockopt + + struct thread * + td + + + struct sys_setsockopt_args * + args + + + + + + + + + file::fd + getfd + kprintf + sys_setsockopt_args::level + sys_setsockopt_args::name + sys_setsockopt_args::s + thread::td_retval + sys_setsockopt_args::val + sys_setsockopt_args::valsize + + + int + int sys_socket + (struct thread *td, struct sys_socket_args *args) + sys_socket + + struct thread * + td + + + struct sys_socket_args * + args + + + + + + + + + sys_socket_args::domain + falloc + file::fd + file::fd_type + fdestroy + kprintf + sys_socket_args::protocol + file::socket + thread::td_retval + sys_socket_args::type + + + sys_thread_t + sys_thread_t sys_thread_new + (const char *name, void(*thread)(void *arg), void *arg, int stacksize, int prio) sys_thread_new - void(*)(void) - function + const char * + name + + + lwip_thread_fn + thread void * arg + + int + stacksize + + + int + prio + +The only thread function: Creates a new thread ATTENTION: although this function returns a value, it MUST NOT FAIL (ports have to assert this!) + +name + + +human-readable name for the thread (used for debugging purposes) + + + + +thread + + +thread-function + + + + +arg + + +parameter passed to 'thread' + + + + +stacksize + + +stack size in bytes for the new thread (may be ignored by ports) + + + + +prio + + +priority of the new thread (may be ignored by ports) + + + + - - kmalloc - kpanic - kprintf - netThreadSpinlock - sys_timeouts::next - sys_thread::next - NULL - spinLock - spinUnlock - threads - sys_thread::timeouts - sys_thread::ubthread - ubthread_create - bot_init - low_level_init - net_init - shell_init - tcpip_init - udpecho_init + + LWIP_ASSERT + kmalloc + memset + spinLock + net_init + bot_init + udpecho_init - + unsigned long unsigned long sys_unix_now () @@ -675,60 +1414,10 @@ - - gettimeofday - starttime - timeval::tv_sec - timeval::tv_usec - - - - - spinLock_t - spinLock_t netThreadSpinlock - - netThreadSpinlock - SPIN_LOCK_INITIALIZER - - - - - - - - current_thread - sys_thread_new - - - struct timeval - struct timeval starttime - - starttime - - - - - - - - sys_init - sys_unix_now - - - struct sys_thread * - struct sys_thread* threads - - threads - 0x0 - - - - - - - - current_thread - sys_thread_new + + gettimeofday + timeval::tv_sec + sys_now @@ -736,427 +1425,555 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -*SubAuthor:ChristopherOlsen<colsen@domaintlantic.com> -* -*Notes: -*Modifiedtoworkwiththeubixoperatingsystem -* -*$Log: sys__arch_8c.xml,v $ -*Revision 1.4 2006/12/12 14:09:16 reddawg -*Changes -* -*Revision1.1.1.12006/06/0112:46:16reddawg -*ubix2 -* -*Revision1.22005/10/1200:13:37reddawg -*Removed -* -*Revision1.1.1.12005/09/2617:24:31reddawg -*nomessage -* -*Revision1.62004/09/1121:30:37apwillia -*Fixraceconditionsinnetthreadandscheduler -* -*Revision1.52004/09/0720:58:35reddawg -*timetorollbackican'tthinkstraightbyfriday -* -*Revision1.42004/05/2522:49:29reddawg -*StupidOldCODE!!! -* -*Revision1.32004/05/1904:07:43reddawg -*kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen -* -*Revision1.22004/05/1903:35:02reddawg -*FixedAFewOrderingIssuesInTheServiceStartupRoutine -* -*Revision1.1.1.12004/04/1512:07:14reddawg -*UbixOSv1.0 -* -*Revision1.132004/04/1321:29:53reddawg -*Wenowhavesocketsworking.Lotsoffunctionalitytobeaddedtocontinually -*improveontheexistinglayersnowitscleanuptimetogetthingsinabetter -*workingorder. -* -*Revision1.122004/04/1316:08:07reddawg -*Removedalloftheolddebugcodetheproblemseemstobeinubthreadswith -*ubthread_mutex_init -* -*Revision1.112004/04/1316:05:40reddawg -*FunctionRenaming -* -* -* -*$Id: sys__arch_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -#include<ubixos/types.h> -#include<ubixos/sched.h> -#include<ubixos/ubthread.h> -#include<ubixos/kpanic.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> - -#include"net/debug.h" -#include"net/sys.h" -#include"net/opt.h" -#include"net/stats.h" +#include<sys/types.h> +#include<ubixos/sched.h> +#include<ubixos/ubthread.h> +#include<ubixos/kpanic.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<sys/sysproto_posix.h> +#include<sys/descrip.h> + +#include"net/debug.h" +#include"net/sys.h" +#include"net/opt.h" +#include"net/stats.h" +#include<net/arch/sys_arch.h> + +#include<ubixos/spinlock.h> +#include<ubixos/sem.h> + +/*GetDefinitionsForThese*/ +#defineERR_NOT_READY0 +#defineERR_TIMED_OUT1 +#defineINFINITE_TIME0 + +staticstructtimevalstarttime; +staticstructspinLocknetThreadSpinlock=SPIN_LOCK_INITIALIZER; +staticstructsys_thread*threads=0x0; + +staticuint32_tcond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,uint32_ttimeout); +staticvoidsys_sem_free_internal(structsys_sem*sem); + +/*sys_archlayerinitializer*/ +voidsys_init(){ +structtimezonetz; +gettimeofday(&starttime,&tz); +} + +#ifdef_IGNORE +staticstructsys_sem*sys_sem_new_internal(uint8_tcount){ +structsys_sem*sem; + +sem=(structsys_sem*)kmalloc(sizeof(structsys_sem)); +if(sem!=NULL){ +sem->signaled=count; +ubthread_cond_init(&(sem->cond),NULL); +ubthread_mutex_init(&(sem->mutex),NULL); +} +returnsem; +} +#endif + +/*Createanewsemaphore*/ +err_tsys_sem_new(sys_sem_t**sem,uint8_tcount){ +return(sem_init(sem,count)); + +#ifdef__IGNORE +sys_sem_t*newSem=0x0; + +if(*sem!=0){ +kprintf("UHOH!"); +} + +newSem=kmalloc(sizeof(structsys_sem)); +newSem->signaled=count; + +ubthread_cond_init(&(newSem->cond),NULL); +ubthread_mutex_init(&(newSem->mutex),NULL); + +*sem=newSem; + +return(ERR_OK); +#endif +} + +/*Deallocatesemaphore*/ +voidsys_sem_free(structsys_sem**sem){ +sem_destroy(sem); + +#ifdef_IGNORE +if((sem!=NULL)&&(*sem!=SYS_SEM_NULL)){ +sys_sem_free_internal(*sem); +*sem=0x0; +} +#endif + + +} + +/*Signalsemaphore*/ +voidsys_sem_signal(structsys_sem**s){ +structsys_sem*sem; +LWIP_ASSERT("invalidsem",(s!=NULL)&&(*s!=NULL)); +sem=*s; -#include<ubixos/spinlock.h> - -#defineUMAX(a,b)((a)>(b)?(a):(b)) - -staticstructsys_thread*threads=0x0; -staticspinLock_tnetThreadSpinlock=SPIN_LOCK_INITIALIZER; +ubthread_mutex_lock(&(sem->mutex)); +sem->signaled++; + +if(sem->signaled>1){ +sem->signaled=1; +} -structsys_mbox_msg{ -structsys_mbox_msg*next; -void*msg; -}; - -#defineSYS_MBOX_SIZE100 - -structsys_mbox{ -uInt16first,last; -void*msgs[SYS_MBOX_SIZE]; -structsys_sem*mail; -structsys_sem*mutex; -}; - -structsys_sem{ -unsignedintc; -ubthread_cond_tcond; -ubthread_mutex_tmutex; -}; - -structsys_thread{ -structsys_thread*next; -structsys_timeoutstimeouts; -kTask_t*ubthread; -}; - - -staticstructtimevalstarttime; - -staticstructsys_sem*sys_sem_new_(uInt8count); -staticvoidsys_sem_free_(structsys_sem*sem); - -staticuInt16cond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,uInt16timeout); - -staticstructsys_thread*current_thread(void){ -structsys_thread*st; -kTask_t*pt; -pt=ubthread_self(); -spinLock(&netThreadSpinlock); -for(st=threads;st!=NULL;st=st->next){ -if(st->ubthread==pt){ -spinUnlock(&netThreadSpinlock); -returnst; -} -} -spinUnlock(&netThreadSpinlock); -kprintf("sys:current_thread:couldnotfindcurrentthread!\n"); -kprintf("ThisisduetoaraceconditionintheLinuxThreads\n"); -kprintf("ubthreadsimplementation.Starttheprogramagain.\n"); - -kpanic("ABORT"); -return(0x0); -} - - -structthread_start_param{ -structsys_thread*thread; -void(*function)(void*); -void*arg; -}; - -/* -staticvoid*thread_start(void*arg){ -structthread_start_param*tp=arg; -tp->thread->ubthread=ubthread_self(); -tp->function(tp->arg); -kfree(tp); -return(NULL); -} -*/ - -voidsys_thread_new(void(*function)(void),void*arg){ -structsys_thread*thread=0x0; -//structthread_start_param*thread_param; -kprintf("sys_thread:[0x%X]\n",sizeof(structsys_thread)); - -thread=kmalloc(sizeof(structsys_thread)); -kprintf("THREAD:[0x%X]\n",thread); -spinLock(&netThreadSpinlock); -thread->next=threads; -thread->timeouts.next=NULL; -thread->ubthread=0x0; -threads=thread; -spinUnlock(&netThreadSpinlock); - - -/* -thread_param=kmalloc(sizeof(structthread_start_param)); - -thread_param->function=function; -thread_param->arg=arg; -thread_param->thread=thread; -*/ -//execThread((void*)function,0x0,0x0); - -kprintf("thread->ubthread:[0x%X]\n",thread->ubthread); -if(ubthread_create(&thread->ubthread,0x0,(void*)(function),arg)!=0x0){ -kpanic("sys_thread_new:ubthread_create"); -} -kprintf("thread->ubthread:[0x%X]\n",thread->ubthread); - -} - -structsys_mbox*sys_mbox_new(){ -structsys_mbox*mbox; +ubthread_cond_broadcast(&(sem->cond)); +ubthread_mutex_unlock(&(sem->mutex)); +} + +uint32_tsys_arch_sem_wait(structsys_sem**s,uint32_ttimeout){ +uint32_ttime_needed=0; +structsys_sem*sem; +LWIP_ASSERT("invalidsem",(s!=NULL)&&(*s!=NULL)); +sem=*s; + +ubthread_mutex_lock(&(sem->mutex)); +while(sem->signaled<=0){ +if(timeout>0){ +time_needed=cond_wait(&(sem->cond),&(sem->mutex),timeout); + +if(time_needed==SYS_ARCH_TIMEOUT){ +ubthread_mutex_unlock(&(sem->mutex)); +returnSYS_ARCH_TIMEOUT; +} +/*ubthread_mutex_unlock(&(sem->mutex)); +returntime_needed;*/ +} +else{ +cond_wait(&(sem->cond),&(sem->mutex),0); +} +} +sem->signaled--; +ubthread_mutex_unlock(&(sem->mutex)); +returntime_needed; +} + +intsys_sem_valid(structsys_sem**s){ +structsys_sem*sem=*s; +if(sem==0) +return0; +else +return1; +} + +voidsys_sem_set_invalid(structsys_sem**s){ +*s=0x0; +} + +err_tsys_mutex_new(sys_mutex_t*mutex){ +ubthread_mutex_init(&(mutex->mutex),NULL); +returnERR_OK; +} + +voidsys_mutex_free(sys_mutex_t*mutex){ +ubthread_mutex_destroy(&(mutex->mutex)); +} + +voidsys_mutex_lock(sys_mutex_t*mutex){ +ubthread_mutex_lock(&(mutex->mutex)); +} + +voidsys_mutex_unlock(sys_mutex_t*mutex){ +ubthread_mutex_unlock(&(mutex->mutex)); +} + +err_tsys_mbox_new(structsys_mbox**mb,intsize){ +structsys_mbox*mbox=0x0; +LWIP_UNUSED_ARG(size); + +mbox=(structsys_mbox*)kmalloc(sizeof(structsys_mbox)); + +if(mbox==NULL) +return(ERR_MEM); + +mbox->head=0; +mbox->tail=0; +mbox->wait_send=0; +//mbox->size=size; + +//PassByReferenceIt'saPointer +//ubthread_mutex_init(&mbox->lock,NULL); + +//PassByReferenceIt'saPointer +sys_sem_new(&mbox->lock,1); +sys_sem_new(&mbox->empty,0); +sys_sem_new(&mbox->full,0); + +//mbox->queue=kmalloc(sizeof(void*)*size);//calloc(size,sizeof(void*)); + +//if(!mbox->queue){ +//returnERR_MEM; +//} + +*mb=mbox; + +return(ERR_OK); +} + +voidsys_mbox_free(structsys_mbox**mb){ +if((mb!=NULL)&&(*mb!=SYS_MBOX_NULL)){ +structsys_mbox*mbox=*mb; +sys_arch_sem_wait(&mbox->lock,0); +/* +sys_sem_free_internal(mbox->full); +sys_sem_free_internal(mbox->empty); +sys_sem_free_internal(mbox->lock); +*/ +sem_destroy(mbox->full); +sem_destroy(mbox->empty); +sem_destroy(mbox->lock); -mbox=kmalloc(sizeof(structsys_mbox)); -mbox->first=mbox->last=0; -mbox->mail=sys_sem_new_(0); -mbox->mutex=sys_sem_new_(1); - -return(mbox); -} +mbox->full=mbox->empty=mbox->lock=NULL; +kfree(mbox); +*mb=0x0; +} +//kfree(mbox->queue); +//mbox->queue=NULL; +} -voidsys_mbox_free(structsys_mbox*mbox){ -if(mbox!=SYS_MBOX_NULL){ -sys_sem_wait(mbox->mutex); - -sys_sem_free_(mbox->mail); -sys_sem_free_(mbox->mutex); -mbox->mail=mbox->mutex=NULL; -//kprintf("sys_mbox_free:mbox0x%lx\n",mbox); -kfree(mbox); -} -} - -voidsys_mbox_post(structsys_mbox*mbox,void*msg){ -uInt8first; - -sys_sem_wait(mbox->mutex); - -//kprintf("sys_mbox_post:mbox%pmsg%p\n",mbox,msg); - -mbox->msgs[mbox->last]=msg; - -if(mbox->last==mbox->first){ -first=1; -} -else{ -first=0; -} - -mbox->last++; -if(mbox->last==SYS_MBOX_SIZE){ -mbox->last=0; -} +voidsys_mbox_post(structsys_mbox**mb,void*msg){ +uint8_thead; +structsys_mbox*mbox; +LWIP_ASSERT("invalidmbox",(mb!=NULL)&&(*mb!=NULL)); +mbox=*mb; + +sys_arch_sem_wait(&mbox->lock,0); + +LWIP_DEBUGF(SYS_DEBUG,("sys_mbox_post:mbox%pmsg%p\n",(void*)mbox,(void*)msg)); + +while((mbox->tail+1)>=(mbox->head+SYS_MBOX_SIZE)){ +mbox->wait_send++; +sys_sem_signal(&mbox->lock); +sys_arch_sem_wait(&mbox->empty,0); +sys_arch_sem_wait(&mbox->lock,0); +mbox->wait_send--; +} + +mbox->msgs[mbox->tail%SYS_MBOX_SIZE]=msg; + +if(mbox->tail==mbox->head){ +head=1; +} +else{ +head=0; +} + +mbox->tail++; + +if(head){ +sys_sem_signal(&mbox->full); +} -if(first){ -sys_sem_signal(mbox->mail); -} -sys_sem_signal(mbox->mutex); -} - -uInt16sys_arch_mbox_fetch(structsys_mbox*mbox,void**msg,uInt16timeout){ -uInt16time=1; - -/*Themutexlockisquicksowedon'tbotherwiththetimeout -stuffhere.*/ -sys_arch_sem_wait(mbox->mutex,0); - -while(mbox->first==mbox->last){ -sys_sem_signal(mbox->mutex); - -/*Weblockwhilewaitingforamailtoarriveinthemailbox.We -mustbepreparedtotimeout.*/ -if(timeout!=0){ -time=sys_arch_sem_wait(mbox->mail,timeout); - -/*Iftime==0,thesem_waittimedout,andwereturn0.*/ -if(time==0){ -return0; -} -}else{ -sys_arch_sem_wait(mbox->mail,0); -} - -sys_arch_sem_wait(mbox->mutex,0); -} - -if(msg!=NULL){ -//kprintf("sys_mbox_fetch:mbox%pmsg%p\n",mbox,*msg); -*msg=mbox->msgs[mbox->first]; -} - -mbox->first++; -if(mbox->first==SYS_MBOX_SIZE){ -mbox->first=0; -} - -sys_sem_signal(mbox->mutex); - -return(time); -} - -structsys_sem*sys_sem_new(uInt8count){ -returnsys_sem_new_(count); -} - -staticstructsys_sem*sys_sem_new_(uInt8count){ -structsys_sem*sem; - -sem=kmalloc(sizeof(structsys_sem)); -sem->c=count; - -ubthread_cond_init(&(sem->cond),NULL); -ubthread_mutex_init(&(sem->mutex),NULL); - -returnsem; -} - -staticuInt16cond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,uInt16timeout){ -unsignedinttdiff; -unsignedlongsec,usec; -structtimevalrtime1,rtime2; -structtimespects; -structtimezonetz; -intretval; - -if(timeout>0){ -/*Getatimestampandaddthetimeoutvalue.*/ -gettimeofday(&rtime1,&tz); -sec=rtime1.tv_sec; -usec=rtime1.tv_usec; -usec+=timeout%1000*1000; -sec+=(int)(timeout/1000)+(int)(usec/1000000); -usec=usec%1000000; -ts.tv_nsec=usec*1000; -ts.tv_sec=sec; - -retval=ubthread_cond_timedwait(cond,mutex,&ts); -if(retval==ETIMEDOUT){ -return0; -} -else{ -/*Calculateforhowlongwewaitedforthecond.*/ -gettimeofday(&rtime2,&tz); -tdiff=(rtime2.tv_sec-rtime1.tv_sec)*1000+ -(rtime2.tv_usec-rtime1.tv_usec)/1000; -if(tdiff==0){ -return1; -} -returntdiff; -} -} -else{ -ubthread_cond_wait(cond,mutex); -return0; -} -} - -uInt16sys_arch_sem_wait(structsys_sem*sem,uInt16timeout){ -uInt16time=1; -ubthread_mutex_lock(&(sem->mutex)); -while(sem->c<=0){ -if(timeout>0){ -time=cond_wait(&(sem->cond),&(sem->mutex),timeout); -if(time==0){ -ubthread_mutex_unlock(&(sem->mutex)); -return0; -} -}else{ -cond_wait(&(sem->cond),&(sem->mutex),0); -} -} -sem->c--; -ubthread_mutex_unlock(&(sem->mutex)); -return(time); -} - -voidsys_sem_signal(structsys_sem*sem){ -ubthread_mutex_lock(&(sem->mutex)); -sem->c++; -if(sem->c>1) -sem->c=1; -ubthread_cond_signal(&(sem->cond)); -ubthread_mutex_unlock(&(sem->mutex)); -} +sys_sem_signal(&mbox->lock); +} + +err_tsys_mbox_trypost(structsys_mbox**mb,void*msg){ +uint8_thead; +structsys_mbox*mbox; +LWIP_ASSERT("invalidmbox",(mb!=NULL)&&(*mb!=NULL)); +mbox=*mb; + +sys_arch_sem_wait(&mbox->lock,0); + +LWIP_DEBUGF(SYS_DEBUG,("sys_mbox_trypost:mbox%pmsg%p\n", +(void*)mbox,(void*)msg)); + +if((mbox->tail+1)>=(mbox->head+SYS_MBOX_SIZE)){ +sys_sem_signal(&mbox->lock); +returnERR_MEM; +} + +mbox->msgs[mbox->tail%SYS_MBOX_SIZE]=msg; + +if(mbox->tail==mbox->head){ +head=1; +} +else{ +head=0; +} + +mbox->tail++; + +if(head){ +sys_sem_signal(&mbox->full); +} + +sys_sem_signal(&mbox->lock); + +returnERR_OK; +} + +uint32_tsys_arch_mbox_fetch(structsys_mbox**mb,void**msg,uint32_ttimeout){ +uint32_ttime_needed=0x0; +structsys_mbox*mbox=0x0; + +LWIP_ASSERT("invalidmbox",(mb!=NULL)&&(*mb!=NULL)); +mbox=*mb; + +/*Themutexlockisquicksowedon'tbotherwiththetimeout +stuffhere.*/ +sys_arch_sem_wait(&mbox->lock,0); + +while(mbox->head==mbox->tail){ +sys_sem_signal(&mbox->lock); + +/*Weblockwhilewaitingforamailtoarriveinthemailbox.We +mustbepreparedtotimeout.*/ +if(timeout!=0){ +time_needed=sys_arch_sem_wait(&mbox->full,timeout); + +if(time_needed==SYS_ARCH_TIMEOUT){ +returnSYS_ARCH_TIMEOUT; +} +} +else{ +sys_arch_sem_wait(&mbox->full,0); +} + +sys_arch_sem_wait(&mbox->lock,0); +} + +if(msg!=NULL){ +LWIP_DEBUGF(SYS_DEBUG,("sys_mbox_fetch:mbox%pmsg%p\n",(void*)mbox,*msg)); +*msg=mbox->msgs[mbox->head%SYS_MBOX_SIZE]; +} +else{ +LWIP_DEBUGF(SYS_DEBUG,("sys_mbox_fetch:mbox%p,nullmsg\n",(void*)mbox)); +} + +mbox->head++; + +if(mbox->wait_send){ +sys_sem_signal(&mbox->empty); +} + +sys_sem_signal(&mbox->lock); + +returntime_needed; +} + +uint32_tsys_arch_mbox_tryfetch(structsys_mbox**mb,void**msg){ +structsys_mbox*mbox; +LWIP_ASSERT("invalidmbox",(mb!=NULL)&&(*mb!=NULL)); +mbox=*mb; + +sys_arch_sem_wait(&mbox->lock,0); + +if(mbox->head==mbox->tail){ +sys_sem_signal(&mbox->lock); +returnSYS_MBOX_EMPTY; +} + +if(msg!=NULL){ +LWIP_DEBUGF(SYS_DEBUG,("sys_mbox_tryfetch:mbox%pmsg%p\n",(void*)mbox,*msg)); +*msg=mbox->msgs[mbox->head%SYS_MBOX_SIZE]; +} +else{ +LWIP_DEBUGF(SYS_DEBUG,("sys_mbox_tryfetch:mbox%p,nullmsg\n",(void*)mbox)); +} + +mbox->head++; + +if(mbox->wait_send){ +sys_sem_signal(&mbox->empty); +} + +sys_sem_signal(&mbox->lock); + +return0; +} + +intsys_mbox_valid(structsys_mbox**mb){ +structsys_mbox*mbox=*mb; +if(mbox==NULL) +return(0); +else +return(1); +} + +voidsys_mbox_set_invalid(structsys_mbox**mb){ +*mb=0x0; +} -voidsys_sem_free(structsys_sem*sem){ -if(sem!=SYS_SEM_NULL){ -sys_sem_free_(sem); -} -} - -staticvoidsys_sem_free_(structsys_sem*sem){ -ubthread_cond_destroy(&(sem->cond)); -ubthread_mutex_destroy(&(sem->mutex)); -kfree(sem); -} - -unsignedlongsys_unix_now(){ -structtimevaltv; -structtimezonetz; -longsec,usec; -unsignedlongmsec; -gettimeofday(&tv,&tz); - -sec=tv.tv_sec-starttime.tv_sec; -usec=tv.tv_usec-starttime.tv_usec; -msec=sec*1000+usec/1000; -returnmsec; -} - -voidsys_init(){ -structtimezonetz; -gettimeofday(&starttime,&tz); -} - -structsys_timeouts*sys_arch_timeouts(void){ -structsys_thread*thread; -thread=current_thread(); -return(&thread->timeouts); -} - -/*** -END -***/ +sys_thread_tsys_thread_new(constchar*name,void(*thread)(void*arg),void*arg,intstacksize,intprio){ +//voidsys_thread_new(void(*function)(void),void*arg){ +structsys_thread*new_thread=0x0; +//structthread_start_param*thread_param; +prio=1; +LWIP_ASSERT("Non-positiveprio",prio>0); +LWIP_ASSERT("Prioistoobig",prio<20); + +new_thread=kmalloc(sizeof(structsys_thread)); +memset(new_thread,0x0,sizeof(structsys_thread)); + +spinLock(&netThreadSpinlock); +new_thread->next=threads; +new_thread->timeouts.next=NULL; +new_thread->ubthread=0x0; +threads=new_thread; +spinUnlock(&netThreadSpinlock); + +/* +thread_param=kmalloc(sizeof(structthread_start_param)); + +thread_param->function=function; +thread_param->arg=arg; +thread_param->thread=thread; +*/ +if(ubthread_create(&new_thread->ubthread,0x0,(void*)(thread),arg)!=0x0){ +kpanic("sys_thread_new:ubthread_create"); +} +return(new_thread); +} + +/*OLD*/ + +structthread_start_param{ +structsys_thread*thread; +void(*function)(void*); +void*arg; +}; + +staticuint32_tcond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,uint32_ttimeout){ +unsignedinttdiff; +unsignedlongsec,usec; +structtimevalrtime1,rtime2; +structtimespects; +structtimezonetz; +intretval; + +if(timeout>0){ +/*Getatimestampandaddthetimeoutvalue.*/ +gettimeofday(&rtime1,&tz); +sec=rtime1.tv_sec; +usec=rtime1.tv_usec; +usec+=timeout%1000*1000; +sec+=(int)(timeout/1000)+(int)(usec/1000000); +usec=usec%1000000; +ts.tv_nsec=usec*1000; +ts.tv_sec=sec; + +retval=ubthread_cond_timedwait(cond,mutex,&ts); +if(retval==ETIMEDOUT){ +return0; +} +else{ +/*Calculateforhowlongwewaitedforthecond.*/ +gettimeofday(&rtime2,&tz); +tdiff=(rtime2.tv_sec-rtime1.tv_sec)*1000+(rtime2.tv_usec-rtime1.tv_usec)/1000; +if(tdiff==0){ +return1; +} +returntdiff; +} +} +else{ +ubthread_cond_wait(cond,mutex); +return0; +} +} + +staticstructsys_thread*current_thread(void){ +structsys_thread*st; +kTask_t*pt; +pt=ubthread_self(); +spinLock(&netThreadSpinlock); +for(st=threads;st!=NULL;st=st->next){ +if(st->ubthread==pt){ +spinUnlock(&netThreadSpinlock); +returnst; +} +} +spinUnlock(&netThreadSpinlock); +kprintf("sys:current_thread:couldnotfindcurrentthread!\n"); +kprintf("ThisisduetoaraceconditionintheLinuxThreads\n"); +kprintf("ubthreadsimplementation.Starttheprogramagain.\n"); + +kpanic("ABORT"); +return(0x0); +} + +structsys_timeouts*sys_arch_timeouts(void){ +structsys_thread*thread; +thread=current_thread(); +return(&thread->timeouts); +} + +unsignedlongsys_unix_now(){ +structtimevaltv; +structtimezonetz; +longsec,usec; +unsignedlongmsec; + +gettimeofday(&tv,&tz); + +sec=tv.tv_sec-starttime.tv_sec; +usec=tv.tv_usec-starttime.tv_usec; +msec=sec*1000+usec/1000; +returnmsec; +} + +uint32_tsys_now(){ +return(sys_unix_now()); +} + + +intsys_socket(structthread*td,structsys_socket_args*args){ +interror=0x0; +intfd=0x0; +structfile*nfp=0x0; + +error=falloc(td,&nfp,&fd); + +if(error) +return(error); + +nfp->socket=lwip_socket(args->domain,args->type,args->protocol); +nfp->fd_type=2; +kprintf("socket(%i:%i):0x%X:0x%X:0x%X",nfp->socket,fd,args->domain,args->type,args->protocol); + +if(nfp->fd==0x0&&nfp->socket){ +fdestroy(td,nfp,fd); + +td->td_retval[0]=-1; +error=-1; +} +else{ +td->td_retval[0]=fd;//nfp->fd;//MrOlsen2018index; +} + +return(error); +} + +intsys_setsockopt(structthread*td,structsys_setsockopt_args*args){ +structfile*fd=0x0; +getfd(td,&fd,args->s); + +td->td_retval[0]=lwip_setsockopt(fd->socket,args->level,args->name,args->val,args->valsize); +kprintf("SSO:%i:%i:%i",args->s,fd->socket,td->td_retval[0]); +td->td_retval[0]=0; + +return(0); +} + +intsys_sendto(structthread*td,structsys_sendto_args*args){ +structfile*fd=0x0; +getfd(td,&fd,args->s); + +lwip_sendto(fd->socket,args->buf,args->len,args->flags,args->to,args->tolen); +td->td_retval[0]=0x0; + +return(0); +} - + diff --git a/doc/xml/sys__arch_8h.xml b/doc/xml/sys__arch_8h.xml index af829c0..69af2f9 100644 --- a/doc/xml/sys__arch_8h.xml +++ b/doc/xml/sys__arch_8h.xml @@ -1,186 +1,408 @@ - - - + + + sys_arch.h - src/sys/include/net/sys.h + ubixos/ubthread.h + ubixos/sem.h + C:/Dev/git/UbixOS/sys/include/net/sys.h + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + - - - + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sys_mbox + sys_mutex + sys_thread + sys_timeouts - + SYS_MBOX_NULL - NULL + NULL - - accept_function - do_delconn - do_listen - err_tcp - netconn_bind - netconn_connect - netconn_delete - netconn_listen - netconn_new - netconn_recv - recv_tcp - recv_udp - sys_mbox_free + - - SYS_SEM_NULL - NULL + + SYS_MBOX_SIZE + 100 - - accept_function - err_tcp - netconn_close - netconn_delete - netconn_new - netconn_write - poll_tcp - sent_tcp - sys_sem_free + + + + SYS_SEM_NULL + NULL + + + + + + + - - sys_mbox * - typedef struct sys_mbox* sys_mbox_t + + struct sys_mbox + typedef struct sys_mbox sys_mbox_t sys_mbox_t @@ -189,23 +411,23 @@ - + - - sys_sem * - typedef struct sys_sem* sys_sem_t + + struct sys_mutex + typedef struct sys_mutex sys_mutex_t - sys_sem_t + sys_mutex_t - + - - sys_thread * + + struct sys_thread * typedef struct sys_thread* sys_thread_t sys_thread_t @@ -215,7 +437,7 @@ - + @@ -223,58 +445,60 @@ -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: sys__arch_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__ARCH_SYS_ARCH_H__ -#define__ARCH_SYS_ARCH_H__ - -#defineSYS_MBOX_NULLNULL -#defineSYS_SEM_NULLNULL - -structsys_sem; -typedefstructsys_sem*sys_sem_t; - -structsys_mbox; -typedefstructsys_mbox*sys_mbox_t; - -structsys_thread; -typedefstructsys_thread*sys_thread_t; +#ifndef__ARCH_SYS_ARCH_H__ +#define__ARCH_SYS_ARCH_H__ + +#include<ubixos/ubthread.h> +#include<ubixos/sem.h> + +#defineSYS_MBOX_NULLNULL +#defineSYS_SEM_NULLNULL +#defineSYS_MBOX_SIZE100 + +/*Structs*/ +structsys_timeouts{ +structsys_timeout*next; +}; + +structsys_mutex{ +ubthread_mutex_tmutex; +}; + +typedefstructsys_mutexsys_mutex_t; + +structsys_mbox{ +uint32_thead; +uint32_ttail; + +//MrOlsen(2017-12-28)-Thiswillbreakbecausesizeispassable +void*msgs[SYS_MBOX_SIZE]; + +//structubthread_mutex*lock; + +structsys_sem*empty; +structsys_sem*full; +structsys_sem*lock; + +intwait_send; + +//void**queue; +//uint32_tsize; +}; + +typedefstructsys_mboxsys_mbox_t; + +structsys_thread{ +structsys_thread*next; +structsys_timeoutstimeouts; +kTask_t*ubthread; +charname[128]; +}; -#endif/*__ARCH_SYS_ARCH_H__*/ +typedefstructsys_thread*sys_thread_t; + +#endif - + diff --git a/doc/xml/sys__call__new_8S.xml b/doc/xml/sys__call__new_8S.xml index d90f13b..3303218 100644 --- a/doc/xml/sys__call__new_8S.xml +++ b/doc/xml/sys__call__new_8S.xml @@ -1,189 +1,80 @@ - - - + + + sys_call_new.S - - - FAKE_MCOUNT - caller - pushl caller ; call __mcount ; popl %ecx - - - - - - - - - - - - globl _sysCall_new text code32 - globl _sysCall_new text code32 _sysCall_new - - _sysCall_new - - - - - - - - idt_init - - - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl es movl fs call syscall popl fs popl es popl ds popal - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl es movl fs call syscall popl fs popl es popl ds popal addl - - addl - - - - - - - - - - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl es movl - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl es movl eax - - eax - - - - - - - - - - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl eax - - eax - - - - - - - - - - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl eax - - eax - - - - - - - - - - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl es movl fs call syscall popl fs popl es popl ds popal esp iret - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl eax movl ds movl es movl fs call syscall popl fs popl es popl ds popal esp iret invalidSysCall - - invalidSysCall - - - - - - - - - - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl - globl _sysCall_new text code32 esp pushal pushl ds pushl es pushl fs movl x10 - - x10 - - - - - - - - - -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sys__call__new_8S.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#defineFAKE_MCOUNT(caller)pushlcaller;call__mcount;popl%ecx - -.globl_sysCall_new -.text -.code32 -_sysCall_new: -pushl$2/*sizeof"int0x80"*/ -subl$4,%esp/*skipovertf_trapno*/ -pushal -pushl%ds -pushl%es -pushl%fs -/*switchtokernelsegments*/ -movl$0x10,%eax -movl%eax,%ds -movl%eax,%es -movl%eax,%fs -//FAKE_MCOUNT(TF_EIP(%esp)) -callsyscall -//MEXITCOUNT -//jmpdoreti -popl%fs -popl%es -popl%ds -popal -addl$8,%esp -iret - -invalidSysCall: -push%eax -callinvalidCall -pop%eax -movl$-1,%eax -iret - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#defineFAKE_MCOUNT(caller)pushlcaller;call__mcount;popl%ecx + +.globl_sysCall_new +.text +.code32 +_sysCall_new: +pushl$2/*sizeof"int0x80"*/ +subl$4,%esp/*skipovertf_trapno*/ +pushal +pushl%ds +pushl%es +pushl%fs +/*switchtokernelsegments*/ +movl$0x10,%eax +movl%eax,%ds +movl%eax,%es +movl%eax,%fs +//FAKE_MCOUNT(TF_EIP(%esp)) +callsyscall +//MEXITCOUNT +//jmpdoreti +popl%fs +popl%es +popl%ds +popal +addl$8,%esp +iret + +invalidSysCall: +push%eax +callinvalidCall +pop%eax +movl$-1,%eax +iret + +/*** +END +***/ + - + diff --git a/doc/xml/syscall_8h.xml b/doc/xml/syscall_8h.xml index 69049bc..f9259b8 100644 --- a/doc/xml/syscall_8h.xml +++ b/doc/xml/syscall_8h.xml @@ -1,76 +1,164 @@ - - - + + + syscall.h - ubixos/types.h - src/sys/kernel/syscall.c - src/sys/sys/idt.c + sys/trap.h + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/include/ubixos/syscalls.h + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/sys/idt.c - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void - void _sysCall + void _sys_call () - _sysCall + _sys_call - + - - void - void _sysCall_new - () - _sysCall_new - - - - - - - - - - void - void invalidCall + + int + int invalidCall () invalidCall @@ -79,7 +167,66 @@ - + + _current + taskStruct::id + kprintf + sys_call + + + void + void invalidCallINT + (int) + invalidCallINT + + int + + + + + + + + + + + void + void sys_call + (struct trapframe *frame) + sys_call + + struct trapframe * + frame + + + + + + + + + _current + thread::abi + die_if_kernel + ELFOSABI_FREEBSD + thread::frame + taskStruct::id + kpanic + kprintf + PSL_C + syscall_entry::sc_name + SYSCALL_DUMMY + SYSCALL_INVALID + systemCalls + taskStruct::td + thread::td_retval + trapframe::tf_eax + trapframe::tf_edx + trapframe::tf_eflags + trapframe::tf_esp + totalCalls + invalidCall + invalidCall_posix @@ -87,73 +234,46 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: syscall_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SYSCALL_H -#define_SYSCALL_H - -#include<ubixos/types.h> - -void_sysCall(); -void_sysCall_new(); -voidinvalidCall(); +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_SYSCALL_H +#define_UBIXOS_SYSCALL_H + +#include<sys/trap.h> + +void_sys_call(); +voidsys_call(structtrapframe*frame); +intinvalidCall(); +voidinvalidCallINT(int); #endif - -/*** -$Log: syscall_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.22006/10/2623:52:02reddawg -Cleaned - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:56reddawg -nomessage - -Revision1.32004/07/0523:06:32reddawg -Fixens - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ - + diff --git a/doc/xml/syscalls_8h.xml b/doc/xml/syscalls_8h.xml index 37ffafe..2433d95 100644 --- a/doc/xml/syscalls_8h.xml +++ b/doc/xml/syscalls_8h.xml @@ -1,101 +1,368 @@ - - - + + + syscalls.h ubixos/sched.h - vfs/file.h - src/sys/kernel/syscall.c + vfs/file.h + ubixos/syscall.h + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/kernel/syscalls.c + C:/Dev/git/UbixOS/sys/kernel/syscalls_posix.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - + + + + + - + - + - + - + - + - - - - - - - + - - - - - - - - + + + + - - - - + + + + - - - - - - - + - + - - - - - - - - - - - - + + + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + syscall_entry + + + ARG_COUNT + name + (sizeof(struct name) / sizeof(register_t)) + + + + + + + + + + EJUSTRETURN + (-2) /* don't modify regs, just return */ + + + + + + + + + + ERESTART + (-1) /* restart syscall */ + + + + + + + + + + PSL_C + 0x00000001 /* carry bit */ + + + + + + + + + + SYSCALL_DUMMY + 2 + + + + + + + + + + SYSCALL_INVALID + 0 + + + + + + + + + + SYSCALL_NOTIMP + 3 + + + + + + + + + + SYSCALL_VALID + 1 + + + + + + + + + + SYSCALLS_MAX + 1024 + + + + + + + + + - - void(*) - typedef void(*) functionPTR() - () + + int(* + typedef int(* functionPTR) () + )() functionPTR @@ -103,13 +370,85 @@ - + + + + int + typedef int sys_call_t(struct thread *, void *) + (struct thread *, void *) + sys_call_t + + + + + + + + + + + + struct syscall_entry + struct syscall_entry systemCalls[] + [] + systemCalls + + + + + + + + sys_call + sys_call_posix + + + struct syscall_entry + struct syscall_entry systemCalls_posix[] + [] + systemCalls_posix + + + + + + + + sys_call_posix + + + int + int totalCalls + + totalCalls + + + + + + + + sys_call + + + int + int totalCalls_posix + + totalCalls_posix + + + + + + + + sys_call_posix - - void - void sysAddModule + + int + int sysAddModule () sysAddModule @@ -118,11 +457,11 @@ - + - - void - void sysAuth + + int + int sysAuth () sysAuth @@ -131,11 +470,11 @@ - + - - void - void sysChDir + + int + int sysChDir () sysChDir @@ -144,11 +483,11 @@ - + - - void - void sysCheckPid + + int + int sysCheckPid () sysCheckPid @@ -157,11 +496,11 @@ - + - - void - void sysExec + + int + int sysExec () sysExec @@ -170,11 +509,11 @@ - + - - void - void sysExit + + int + int sysExit () sysExit @@ -183,11 +522,11 @@ - + - - void - void sysFclose + + int + int sysFclose () sysFclose @@ -196,11 +535,11 @@ - + - - void - void sysFgetc + + int + int sysFgetc () sysFgetc @@ -209,11 +548,11 @@ - + - - void - void sysFopen + + int + int sysFopen () sysFopen @@ -222,37 +561,11 @@ - + - - void - void sysFork - () - sysFork - - - - - - - - - - void - void sysFread - () - sysFread - - - - - - - - - - void - void sysFseek + + int + int sysFseek () sysFseek @@ -261,24 +574,11 @@ - + - - void - void sysFwrite - () - sysFwrite - - - - - - - - - - void - void sysGetCwd + + int + int sysGetCwd () sysGetCwd @@ -287,11 +587,11 @@ - + - - void - void sysGetDrives + + int + int sysGetDrives () sysGetDrives @@ -300,11 +600,11 @@ - + - - void - void sysGetFreePage + + int + int sysGetFreePage () sysGetFreePage @@ -313,24 +613,11 @@ - + - - void - void sysGetGid - () - sysGetGid - - - - - - - - - - void - void sysGetpid + + int + int sysGetpid () sysGetpid @@ -339,11 +626,11 @@ - + - - void - void sysGetTime + + int + int sysGetTime () sysGetTime @@ -352,24 +639,11 @@ - + - - void - void sysGetUid - () - sysGetUid - - - - - - - - - - void - void sysGetUptime + + int + int sysGetUptime () sysGetUptime @@ -378,11 +652,11 @@ - + - - void - void sysMkDir + + int + int sysMkDir () sysMkDir @@ -391,11 +665,11 @@ - + - - void - void sysMpiCreateMbox + + int + int sysMpiCreateMbox () sysMpiCreateMbox @@ -404,11 +678,11 @@ - + - - void - void sysMpiDestroyMbox + + int + int sysMpiDestroyMbox () sysMpiDestroyMbox @@ -417,11 +691,11 @@ - + - - void - void sysMpiFetchMessage + + int + int sysMpiFetchMessage () sysMpiFetchMessage @@ -430,11 +704,11 @@ - + - - void - void sysMpiPostMessage + + int + int sysMpiPostMessage () sysMpiPostMessage @@ -443,11 +717,11 @@ - + - - void - void sysMpiSpam + + int + int sysMpiSpam () sysMpiSpam @@ -456,11 +730,11 @@ - + - - void - void sysPasswd + + int + int sysPasswd () sysPasswd @@ -469,11 +743,11 @@ - + - - void - void sysRmDir + + int + int sysRmDir () sysRmDir @@ -482,11 +756,11 @@ - + - - void - void sysRmModule + + int + int sysRmModule () sysRmModule @@ -495,64 +769,11 @@ - + - - void - void sysSchedYield - () - sysSchedYield - - - - - - - - sched_yield - - - void - void sysSDE - () - sysSDE - - - - - - - - - - void - void sysSetGid - () - sysSetGid - - - - - - - - - - void - void sysSetUid - () - sysSetUid - - - - - - - - - - void - void sysStartSDE + + int + int sysStartSDE () sysStartSDE @@ -561,11 +782,11 @@ - + - - void - void sysUnlink + + int + int sysUnlink () sysUnlink @@ -574,94 +795,7 @@ - - - - - - functionPTR - functionPTR systemCalls[] - [] - systemCalls - { - invalidCall, - sysGetpid, - sysExit, - sysExec, - sysFork, - sysFgetc, - sysCheckPid, - sysGetFreePage, - sysFopen, - invalidCall, - sysFclose, - sysSchedYield, - invalidCall, - invalidCall, - invalidCall, - invalidCall, - invalidCall, - invalidCall, - invalidCall, - invalidCall, - sysFopen, - sysFclose, - sysFread, - sysFwrite, - sysMkDir, - sysRmDir, - sysGetCwd, - sysFseek, - sysChDir, - sysMkDir, - sysUnlink, - sysGetUid, - sysGetGid, - sysSetUid, - sysSetGid, - sysAuth, - sysPasswd, - sysAddModule, - sysRmModule, - invalidCall, - - invalidCall, - invalidCall, - invalidCall, - invalidCall, - invalidCall, - sysGetDrives, - sysGetUptime, - sysGetTime, - sysStartSDE, - invalidCall, - sysMpiCreateMbox, - sysMpiDestroyMbox, - sysMpiPostMessage, - sysMpiFetchMessage, - sysMpiSpam, - } - - - - - - - - - - int - int totalCalls - - totalCalls - sizeof(systemCalls)/sizeof(functionPTR) - - - - - - - + @@ -669,178 +803,110 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: syscalls_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SYSCALLS_H -#define_SYSCALLS_H - -#include<ubixos/sched.h> -#include<vfs/file.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYSCALLS_H +#define_SYSCALLS_H + +#include<ubixos/sched.h> +#include<vfs/file.h> +#include<ubixos/syscall.h> -voidsysAuth(); -voidsysPasswd(); -voidsysAddModule(); -voidsysRmModule(); -voidsysGetpid(); -voidsysExit(); -voidsysExec(); -voidsysFork(); -voidsysCheckPid(); -voidsysGetFreePage(); - -voidsysFwrite(); -voidsysFgetc(); -voidsysFopen(); -voidsysFread(); -voidsysFclose(); -voidsysSchedYield(); -voidsysFseek(); -voidsysMkDir(); -voidsysRmDir(); -voidsysGetUid(); -voidsysGetGid(); -voidsysSetUid(); -voidsysSetGid(); -voidsysSDE(); -voidsysGetDrives(); -voidsysGetCwd(); -voidsysChDir(); -voidsysGetUptime(); -voidsysGetTime(); -voidsysStartSDE(); -voidsysUnlink(); -voidsysMpiCreateMbox(); -voidsysMpiDestroyMbox(); -voidsysMpiPostMessage(); -voidsysMpiFetchMessage(); -voidsysMpiSpam(); +#defineSYSCALLS_MAX1024 + +#definePSL_C0x00000001/*carrybit*/ +#defineEJUSTRETURN(-2)/*don'tmodifyregs,justreturn*/ +#defineERESTART(-1)/*restartsyscall*/ + +#defineARG_COUNT(name)(sizeof(structname)/sizeof(register_t)) + +#defineSYSCALL_INVALID0 +#defineSYSCALL_VALID1 +#defineSYSCALL_DUMMY2 +#defineSYSCALL_NOTIMP3 + +typedefintsys_call_t(structthread*,void*); + +structsyscall_entry{ +intsc_args; +char*sc_name; +sys_call_t*sc_entry; +intsc_status; +}; + +/* +* +*OldStyleCallsNeedUpdates +* +*/ +intsysAuth(); +intsysPasswd(); +intsysAddModule(); +intsysRmModule(); +intsysGetpid(); +intsysExit(); +intsysExec(); + +intsysCheckPid(); +intsysGetFreePage(); -typedefvoid(*functionPTR)(); - -functionPTRsystemCalls[]={ -invalidCall, -sysGetpid, -sysExit, -sysExec, -sysFork, -sysFgetc, -sysCheckPid, -sysGetFreePage, -sysFopen, -invalidCall, -sysFclose, -sysSchedYield, -invalidCall, -invalidCall, -invalidCall, -invalidCall, -invalidCall, -invalidCall, -invalidCall, -invalidCall, -sysFopen, -sysFclose, -sysFread, -sysFwrite, -sysMkDir, -sysRmDir, -sysGetCwd, -sysFseek, -sysChDir, -sysMkDir, -sysUnlink, -sysGetUid, -sysGetGid, -sysSetUid, -sysSetGid, -sysAuth, -sysPasswd, -sysAddModule, -sysRmModule, -invalidCall, -//sysSDE,/**40SDEKernelInterface**/ -invalidCall, -invalidCall, -invalidCall, -invalidCall, -invalidCall, -sysGetDrives, -sysGetUptime, -sysGetTime, -sysStartSDE, -invalidCall, -sysMpiCreateMbox, -sysMpiDestroyMbox, -sysMpiPostMessage, -sysMpiFetchMessage, -sysMpiSpam, -}; - -inttotalCalls=sizeof(systemCalls)/sizeof(functionPTR); - -#endif - -/*** -$Log: syscalls_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.22006/10/1217:05:44reddawg -RemovingSDE - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:56reddawg -nomessage - -Revision1.52005/08/0422:48:39fsdfs - -added4newsyscalls:sysAuth(),sysPasswd(),sysAddModule(),sysRmModule() - -Revision1.42004/05/2615:39:22reddawg -mpi:broughtmpiDestroyMbox(char*name)intotheuserland - -Revision1.32004/05/2515:42:19reddawg -EnabledmpiSpam(); - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ +intsysFgetc(); +intsysFopen(); +intsysFclose(); +intsysFseek(); +intsysMkDir(); +intsysRmDir(); + +//intsysSDE(); +intsysGetDrives(); +intsysGetCwd(); +intsysChDir(); +intsysGetUptime(); +intsysGetTime(); +intsysStartSDE(); +intsysUnlink(); +intsysMpiCreateMbox(); +intsysMpiDestroyMbox(); +intsysMpiPostMessage(); +intsysMpiFetchMessage(); +intsysMpiSpam(); + +typedefint(*functionPTR)(); + +externinttotalCalls; +externstructsyscall_entrysystemCalls[]; + +externinttotalCalls_posix; +externstructsyscall_entrysystemCalls_posix[]; + +#endif - + diff --git a/doc/xml/syscalls__new_8h.xml b/doc/xml/syscalls__new_8h.xml index ea6713c..fd792ae 100644 --- a/doc/xml/syscalls__new_8h.xml +++ b/doc/xml/syscalls__new_8h.xml @@ -1,85 +1,202 @@ - - - + + + syscalls_new.h - sys/sysproto.h - src/sys/kernel/syscall_new.c + sys/sysproto_posix.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - + + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + EJUSTRETURN - (-2) + (-2) /* don't modify regs, just return */ - - syscall + - + ERESTART - (-1) + (-1) /* restart syscall */ - - syscall + - + invalid_call 0x0 @@ -88,26 +205,25 @@ - + - + PSL_C - 0x00000001 + 0x00000001 /* carry bit */ - - syscall + - - int(*) - typedef int(*) functionPTR() - () + + int(* + typedef int(* functionPTR) () + )() functionPTR @@ -115,11 +231,41 @@ - + + + + + + functionPTR + functionPTR systemCalls_new[] + [] + systemCalls_new + +Mast System Call List. + + + + + + + + + int + int totalCalls_new + + totalCalls_new + = sizeof(systemCalls_new) / sizeof(functionPTR) + + + + + + + - + int int __sysctl () @@ -130,9 +276,9 @@ - + - + int int close () @@ -143,9 +289,9 @@ - + - + int int fcntl () @@ -156,9 +302,9 @@ - + - + int int fstat () @@ -169,9 +315,9 @@ - + - + int int getdtablesize () @@ -182,9 +328,9 @@ - + - + int int getgid () @@ -195,9 +341,9 @@ - + - + int int getpid () @@ -208,9 +354,9 @@ - + - + int int gettimeofday_new () @@ -221,9 +367,9 @@ - + - + int int getuid () @@ -234,9 +380,9 @@ - + - + int int ioctl () @@ -247,9 +393,9 @@ - + - + int int issetugid () @@ -260,9 +406,9 @@ - + - + int int mmap () @@ -273,9 +419,9 @@ - + - + int int munmap () @@ -286,9 +432,9 @@ - + - + int int obreak () @@ -299,9 +445,9 @@ - + - + int int pipe () @@ -312,9 +458,9 @@ - + - + int int read () @@ -325,9 +471,9 @@ - + - + int int readlink () @@ -338,9 +484,9 @@ - + - + int int sigaction () @@ -351,9 +497,9 @@ - + - + int int sigprocmask () @@ -364,9 +510,9 @@ - + - + int int sysExit () @@ -377,38 +523,7 @@ - - - - - - functionPTR - functionPTR systemCalls_new[] - [] - systemCalls_new - -Mast System Call List. - - - - - - syscall - - - int - int totalCalls_new - - totalCalls_new - sizeof(systemCalls_new)/sizeof(functionPTR) - - - - - - - - syscall + @@ -416,536 +531,535 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: syscalls__new_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SYSCALLS_NEW_H -#define_SYSCALLS_NEW_H - -#include<sys/sysproto.h> - -intsysExit(); -intread(); -intgetpid(); -intfcntl(); -intissetugid(); -int__sysctl(); -intpipe(); -intreadlink(); -intgetuid(); -intgetgid(); -intclose(); -intmmap(); -intobreak(); -intsigaction(); -intgetdtablesize(); -intmunmap(); -intsigprocmask(); -intgettimeofday_new(); -intfstat(); -intioctl(); - -#defineinvalid_call0x0 -#definePSL_C0x00000001/*carrybit*/ -#defineEJUSTRETURN(-2)/*don'tmodifyregs,justreturn*/ -#defineERESTART(-1)/*restartsyscall*/ - -typedefint(*functionPTR)(); - -functionPTRsystemCalls_new[]={ -invalid_call, -sysExit, -invalid_call, -read, -sys_write, -sys_open, -close, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -obreak, -invalid_call, -invalid_call, -getpid, -invalid_call, -invalid_call, -invalid_call, -getuid, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -pipe, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -getgid, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -ioctl, -invalid_call, -invalid_call, -invalid_call, -readlink, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -munmap, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -setitimer, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -getdtablesize, -invalid_call, -invalid_call, -fcntl, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -gettimeofday_new, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -fstat, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -mmap, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -__sysctl, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -issetugid, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -sigprocmask, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -sigaction, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -invalid_call, -}; - -inttotalCalls_new=sizeof(systemCalls_new)/sizeof(functionPTR); - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYSCALLS_NEW_H +#define_SYSCALLS_NEW_H + +#include<sys/sysproto_posix.h> + +intsysExit(); +intread(); +intgetpid(); +intfcntl(); +intissetugid(); +int__sysctl(); +intpipe(); +intreadlink(); +intgetuid(); +intgetgid(); +intclose(); +intmmap(); +intobreak(); +intsigaction(); +intgetdtablesize(); +intmunmap(); +intsigprocmask(); +intgettimeofday_new(); +intfstat(); +intioctl(); + +#defineinvalid_call0x0 +#definePSL_C0x00000001/*carrybit*/ +#defineEJUSTRETURN(-2)/*don'tmodifyregs,justreturn*/ +#defineERESTART(-1)/*restartsyscall*/ + +typedefint(*functionPTR)(); + +functionPTRsystemCalls_new[]={ +invalid_call, +sysExit, +invalid_call, +read, +sys_write, +sys_open, +close, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +obreak, +invalid_call, +invalid_call, +getpid, +invalid_call, +invalid_call, +invalid_call, +getuid, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +access, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +pipe, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +getgid, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +ioctl, +invalid_call, +invalid_call, +invalid_call, +readlink, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +munmap, +mprotect, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +setitimer, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +getdtablesize, +invalid_call, +invalid_call, +fcntl, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +gettimeofday_new, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +fstat, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +mmap, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +__sysctl, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +issetugid, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +sigprocmask, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +fstatfs, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +sigaction, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +invalid_call, +}; + +inttotalCalls_new=sizeof(systemCalls_new)/sizeof(functionPTR); + +#endif + +/*** +END +***/ + - + diff --git a/doc/xml/sysproto_8h.xml b/doc/xml/sysproto_8h.xml index b645666..e2f224d 100644 --- a/doc/xml/sysproto_8h.xml +++ b/doc/xml/sysproto_8h.xml @@ -1,546 +1,198 @@ - - - + + + sysproto.h - sys/signal.h sys/thread.h - src/sys/include/sys/gen_calls.h - src/sys/include/sys/kern_descrip.h - src/sys/include/sys/kern_sig.h - src/sys/include/sys/kern_sysctl.h - src/sys/include/sys/pipe.h - src/sys/include/ubixos/syscalls_new.h - src/sys/include/vfs/vfs.h - src/sys/include/vmm/paging.h - src/sys/kernel/kern_descrip.c - src/sys/kernel/kern_sig.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/pipe.c + C:/Dev/git/UbixOS/sys/fs/vfs/stat.c + C:/Dev/git/UbixOS/sys/include/sde/sde.h + C:/Dev/git/UbixOS/sys/kernel/syscalls.c + C:/Dev/git/UbixOS/sys/mpi/mpi_syscalls.c + C:/Dev/git/UbixOS/sys/mpi/system.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - + + + + - - - - + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - + - - - + + + - - - - + + + + + + + + + + + + - + - + - + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - close_args - fcntl_args - fstat_args - getdtablesize_args - getgid_args - getpid_args - gettimeofday_args - getuid_args - ioctl_args - issetugid_args - mmap_args - munmap_args - obreak_args - open_args - pipe_args - read_args - readlink_args - setitimer_args - sigaction_args - sigprocmask_args - sysctl_args - write_args + sys_mpiCreateMbox_args + sys_mpiDestroyMbox_args + sys_mpiFetchMessage_args + sys_mpiPostMessage_args + sys_sde_args - + PAD_ t - (sizeof(register_t) <= sizeof(t) ? \ - 0 : sizeof(register_t) - sizeof(t)) + (sizeof(register_t) <= sizeof(t) ? 0 : sizeof(register_t) - sizeof(t)) - + - + PADL_ t 0 @@ -550,23 +202,23 @@ - + - + PADR_ t - PAD_(t) + PAD_(t) - + - + int typedef int register_t @@ -577,87 +229,20 @@ - + - + int - int setitimer - (struct thread *td, struct setitimer_args *uap) - setitimer + int sys_invalid + (struct thread *, void *) + sys_invalid struct thread * - td - struct setitimer_args * - uap - - -place holder for now functionality to be added later - - - - - - - - int - int sys_open - (struct thread *td, struct open_args *uap) - sys_open - - struct thread * - td - - - struct open_args * - uap - - -entry point for open syscall - - - -*td - - -pointer to callers thread - - - -*uap - - -pointer to user space arguements for call - - -index to file descriptor - - - - - falloc - file::fd - fopen - file::path - open_args::path - strcpy - thread::td_retval - - - int - int sys_write - (struct thread *td, struct write_args *uap) - sys_write - - struct thread * - td - - - struct write_args * - uap + void * @@ -665,16 +250,99 @@ - - write_args::buf - write_args::fd - kfree - kmalloc - kprintf - memcpy - write_args::nbyte - taskStruct::td - thread::td_retval + + + + int + int sys_mpiCreateMbox + (struct thread *, struct sys_mpiCreateMbox_args *) + sys_mpiCreateMbox + + struct thread * + + + struct sys_mpiCreateMbox_args * + + + + + + + + + mpi_createMbox + sys_mpiCreateMbox_args::name + thread::td_retval + + + int + int sys_mpiDestroyMbox + (struct thread *, struct sys_mpiDestroyMbox_args *) + sys_mpiDestroyMbox + + struct thread * + + + struct sys_mpiDestroyMbox_args * + + + + + + + + + mpi_destroyMbox + sys_mpiDestroyMbox_args::name + thread::td_retval + + + int + int sys_mpiFetchMessage + (struct thread *, struct sys_mpiFetchMessage_args *) + sys_mpiFetchMessage + + struct thread * + + + struct sys_mpiFetchMessage_args * + + + + + + + + + mpi_fetchMessage + sys_mpiFetchMessage_args::msg + sys_mpiFetchMessage_args::name + thread::td_retval + + + int + int sys_mpiPostMessage + (struct thread *, struct sys_mpiPostMessage_args *) + sys_mpiPostMessage + + struct thread * + + + struct sys_mpiPostMessage_args * + + + + + + + + + kprintf + mpi_postMessage + sys_mpiPostMessage_args::msg + sys_mpiPostMessage_args::name + thread::td_retval + sys_mpiPostMessage_args::type @@ -682,183 +350,104 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: sysproto_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SYSPROTO_H -#define_SYSPROTO_H - -#include<sys/signal.h> -#include<sys/thread.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_SYSPROTO_H +#define_SYS_SYSPROTO_H + +#include<sys/thread.h> + +typedefintregister_t; -typedefintregister_t; +#definePAD_(t)(sizeof(register_t)<=sizeof(t)?0:sizeof(register_t)-sizeof(t)) -#definePAD_(t)(sizeof(register_t)<=sizeof(t)?\ -0:sizeof(register_t)-sizeof(t)) - -#ifBYTE_ORDER==LITTLE_ENDIAN -#definePADL_(t)0 -#definePADR_(t)PAD_(t) -#else -#definePADL_(t)PAD_(t) -#definePADR_(t)0 -#endif - -//Protos -structwrite_args{ -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -charbuf_l_[PADL_(constvoid*)];constvoid*buf;charbuf_r_[PADR_(constvoid*)]; -charnbyte_l_[PADL_(size_t)];size_tnbyte;charnbyte_r_[PADR_(size_t)]; -}; - -structopen_args{ -charpath_l_[PADL_(char*)];char*path;charpath_r_[PADR_(char*)]; -charflags_l_[PADL_(int)];intflags;charflags_r_[PADR_(int)]; -charmode_l_[PADL_(int)];intmode;charmode_r_[PADR_(int)]; -}; - -structsetitimer_args{ -charwhich_l_[PADL_(u_int)];u_intwhich;charwhich_r_[PADR_(u_int)]; -charitv_l_[PADL_(structitimerval*)];structitimerval*itv;charitv_r_[PADR_(structitimerval*)]; -charoitv_l_[PADL_(structitimerval*)];structitimerval*oitv;charoitv_r_[PADR_(structitimerval*)]; -}; +#ifBYTE_ORDER==LITTLE_ENDIAN +#definePADL_(t)0 +#definePADR_(t)PAD_(t) +#else +#definePADL_(t)PAD_(t) +#definePADR_(t)0 +#endif + +//Protos +structsys_mpiCreateMbox_args{ +charname_l_[PADL_(char*)]; +char*name; +charname_r_[PADR_(char*)]; +}; + +structsys_mpiDestroyMbox_args{ +charname_l_[PADL_(char*)]; +char*name; +charname_r_[PADR_(char*)]; +}; + +structsys_mpiFetchMessage_args{ +charname_l_[PADL_(char*)]; +char*name; +charname_r_[PADR_(char*)]; +charmsg_l_[PADL_(constvoid*)]; +constvoid*msg; +charmsg_r_[PADR_(constvoid*)]; +}; -//Old - -structsysctl_args{ -charname_l_[PADL_(int*)];int*name;charname_r_[PADR_(int*)]; -charnamelen_l_[PADL_(u_int)];u_intnamelen;charnamelen_r_[PADR_(u_int)]; -charold_l_[PADL_(void*)];void*old;charold_r_[PADR_(void*)]; -charoldlenp_l_[PADL_(size_t*)];size_t*oldlenp;charoldlenp_r_[PADR_(size_t*)]; -charnew_l_[PADL_(void*)];void*new;charnew_r_[PADR_(void*)]; -charnewlen_l_[PADL_(size_t)];size_tnewlen;charnewlen_r_[PADR_(size_t)]; -}; - -structgetpid_args{ -register_tdummy; -}; -structissetugid_args{ -register_tdummy; -}; -structfcntl_args{ -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -charcmd_l_[PADL_(int)];intcmd;charcmd_r_[PADR_(int)]; -chararg_l_[PADL_(long)];longarg;chararg_r_[PADR_(long)]; -}; - -structpipe_args{ -register_tdummy; -}; - -structreadlink_args{ -charpath_l_[PADL_(char*)];char*path;charpath_r_[PADR_(char*)]; -charbuf_l_[PADL_(char*)];char*buf;charbuf_r_[PADR_(char*)]; -charcount_l_[PADL_(int)];intcount;charcount_r_[PADR_(int)]; -}; - -structgetuid_args{ -register_tdummy; -}; - -structgetgid_args{ -register_tdummy; -}; -structclose_args{ -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -}; - -structmmap_args{ -charaddr_l_[PADL_(caddr_t)];caddr_taddr;charaddr_r_[PADR_(caddr_t)]; -charlen_l_[PADL_(size_t)];size_tlen;charlen_r_[PADR_(size_t)]; -charprot_l_[PADL_(int)];intprot;charprot_r_[PADR_(int)]; -charflags_l_[PADL_(int)];intflags;charflags_r_[PADR_(int)]; -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -charpad_l_[PADL_(int)];intpad;charpad_r_[PADR_(int)]; -charpos_l_[PADL_(off_t)];off_tpos;charpos_r_[PADR_(off_t)]; -}; - -structobreak_args{ -charnsize_l_[PADL_(char*)];char*nsize;charnsize_r_[PADR_(char*)]; -}; - -structsigaction_args{ -charsig_l_[PADL_(int)];intsig;charsig_r_[PADR_(int)]; -charact_l_[PADL_(conststructsigaction*)];conststructsigaction*act;charact_r_[PADR_(conststructsigaction*)]; -charoact_l_[PADL_(structsigaction*)];structsigaction*oact;charoact_r_[PADR_(structsigaction*)]; -}; - -structgetdtablesize_args{ -register_tdummy; -}; - -structmunmap_args{ -charaddr_l_[PADL_(void*)];void*addr;charaddr_r_[PADR_(void*)]; -charlen_l_[PADL_(size_t)];size_tlen;charlen_r_[PADR_(size_t)]; -}; - -structsigprocmask_args{ -charhow_l_[PADL_(int)];inthow;charhow_r_[PADR_(int)]; -charset_l_[PADL_(constsigset_t*)];constsigset_t*set;charset_r_[PADR_(constsigset_t*)]; -charoset_l_[PADL_(sigset_t*)];sigset_t*oset;charoset_r_[PADR_(sigset_t*)]; -}; -structgettimeofday_args{ -chartp_l_[PADL_(structtimeval*)];structtimeval*tp;chartp_r_[PADR_(structtimeval*)]; -chartzp_l_[PADL_(structtimezone*)];structtimezone*tzp;chartzp_r_[PADR_(structtimezone*)]; -}; -structfstat_args{ -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -charsb_l_[PADL_(structstat*)];structstat*sb;charsb_r_[PADR_(structstat*)]; -}; -structioctl_args{ -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -charcom_l_[PADL_(u_long)];u_longcom;charcom_r_[PADR_(u_long)]; -chardata_l_[PADL_(caddr_t)];caddr_tdata;chardata_r_[PADR_(caddr_t)]; -}; - -structread_args{ -charfd_l_[PADL_(int)];intfd;charfd_r_[PADR_(int)]; -charbuf_l_[PADL_(void*)];void*buf;charbuf_r_[PADR_(void*)]; -charnbyte_l_[PADL_(size_t)];size_tnbyte;charnbyte_r_[PADR_(size_t)]; -}; - -//FuncDefs -intsys_write(structthread*td,structwrite_args*uap); -intsys_open(structthread*td,structopen_args*uap); -intsetitimer(structthread*td,structsetitimer_args*uap); - -#endif - -/*** -END -***/ - +structsys_mpiPostMessage_args{ +charname_l_[PADL_(char*)]; +char*name; +charname_r_[PADR_(char*)]; +chartype_l_[PADL_(uint32_t)]; +uint32_ttype; +chartype_r_[PADR_(uint32_t)]; +charmsg_l_[PADL_(constvoid*)]; +constvoid*msg; +charmsg_r_[PADR_(constvoid*)]; +}; + +structsys_sde_args{ +charcmd_l_[PADL_(uint32_t)]; +uint32_tcmd; +charcmd_r_[PADR_(uint32_t)]; +charptr_l_[PADL_(uint32_t)]; +uint32_tptr; +charptr_r_[PADR_(uint32_t)]; +}; + + +//FuncDefs +intsys_invalid(structthread*,void*); +intsys_mpiCreateMbox(structthread*,structsys_mpiCreateMbox_args*); +intsys_mpiDestroyMbox(structthread*,structsys_mpiDestroyMbox_args*); +intsys_mpiFetchMessage(structthread*,structsys_mpiFetchMessage_args*); +intsys_mpiPostMessage(structthread*,structsys_mpiPostMessage_args*); + +#endif - + diff --git a/doc/xml/system_8c.xml b/doc/xml/system_8c.xml index 99d3325..73e733a 100644 --- a/doc/xml/system_8c.xml +++ b/doc/xml/system_8c.xml @@ -1,117 +1,278 @@ - - - + + + system.c mpi/mpi.h lib/kmalloc.h - lib/string.h + string.h ubixos/spinlock.h + sys/sysproto.h - - - - + + + + + + - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + - + - + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + mpi_mbox_t * + mpi_mbox_t* mboxList + + mboxList + = 0x0 + + + + + + + + + + struct spinLock + struct spinLock mpiSpinLock + + mpiSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + int int mpi_createMbox (char *name) @@ -126,25 +287,11 @@ - - _current - taskStruct::id - kmalloc - mboxList - mpi_findMbox - mpiSpinLock - mpi_mbox::name - mpi_mbox::next - mpi_mbox::pid - mpi_mbox::prev - spinLock - spinUnlock - sprintf - sysMpiCreateMbox - systemTask - ubixfs_thread + + sys_mpiCreateMbox + systemTask - + int int mpi_destroyMbox (char *name) @@ -159,22 +306,10 @@ - - _current - taskStruct::id - kfree - mboxList - mpiSpinLock - mpi_mbox::name - mpi_mbox::next - mpi_mbox::pid - mpi_mbox::prev - spinLock - spinUnlock - strcmp - sysMpiDestroyMbox + + sys_mpiDestroyMbox - + int int mpi_fetchMessage (char *name, mpi_message_t *msg) @@ -184,7 +319,7 @@ name - mpi_message_t * + mpi_message_t * msg @@ -193,28 +328,12 @@ - - _current - mpi_message::data - mpi_message::header - taskStruct::id - kfree - memcpy - MESSAGE_LENGTH - mpi_findMbox - mpiSpinLock - mpi_mbox::msg - mpi_message::next - mpi_message::pid - mpi_mbox::pid - spinLock - spinUnlock - sysMpiFetchMessage - systemTask - ubixfs_thread + + sys_mpiFetchMessage + systemTask - - mpi_mbox_t * + + mpi_mbox_t * static mpi_mbox_t* mpi_findMbox (char *name) mpi_findMbox @@ -228,30 +347,23 @@ - - mboxList - mpi_mbox::name - mpi_mbox::next - strcmp - mpi_createMbox - mpi_fetchMessage - mpi_postMessage + - + int int mpi_postMessage - (char *name, uInt32 type, mpi_message_t *msg) + (char *name, uint32_t type, mpi_message_t *msg) mpi_postMessage char * name - uInt32 + uint32_t type - mpi_message_t * + mpi_message_t * msg @@ -260,32 +372,15 @@ - - _current - mpi_message::data - mpi_message::header - taskStruct::id - kmalloc - memcpy - MESSAGE_LENGTH - mpi_findMbox - mpiSpinLock - mpi_mbox::msg - mpi_mbox::msgLast - mpi_message::next - mpi_message::pid - spinLock - spinUnlock - x1 - sysMpiPostMessage + - + int int mpi_spam (uInt32 type, void *data) mpi_spam - uInt32 + uInt32 type @@ -298,60 +393,7 @@ - - mpi_message::data - mpi_message::header - kmalloc - mboxList - memcpy - MESSAGE_LENGTH - mpiSpinLock - mpi_mbox::msg - mpi_mbox::msgLast - mpi_message::next - mpi_mbox::next - spinLock - spinUnlock - sysMpiSpam - - - - - mpi_mbox_t * - mpi_mbox_t* mboxList - - mboxList - 0x0 - - - - - - - - mpi_createMbox - mpi_destroyMbox - mpi_findMbox - mpi_spam - - - spinLock_t - spinLock_t mpiSpinLock - - mpiSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_postMessage - mpi_spam + @@ -359,266 +401,269 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: system_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<mpi/mpi.h> -#include<lib/kmalloc.h> -#include<lib/string.h> -#include<ubixos/spinlock.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<mpi/mpi.h> +#include<lib/kmalloc.h> +#include<string.h> +#include<ubixos/spinlock.h> +#include<sys/sysproto.h> -staticmpi_mbox_t*mboxList=0x0; -staticspinLock_tmpiSpinLock=SPIN_LOCK_INITIALIZER; - -/***************************************************************************************** - -Function:staticmpiMbox_t*mpiFindMbox(char*name) - -Description:Thisfunctionwillfindamailboxthatmatchesthesuppliedname - -Notes:Thisfunctionisnottask-safe!Lockmustbedonebeforecall. - -*****************************************************************************************/ -staticmpi_mbox_t*mpi_findMbox(char*name){ -mpi_mbox_t*mbox=0x0; - -for(mbox=mboxList;mbox;mbox=mbox->next){ -if(!strcmp(mbox->name,name)){ -return(mbox); -} + +staticmpi_mbox_t*mboxList=0x0; +staticstructspinLockmpiSpinLock=SPIN_LOCK_INITIALIZER; + +/***************************************************************************************** + +Function:staticmpiMbox_t*mpiFindMbox(char*name) + +Description:Thisfunctionwillfindamailboxthatmatchesthesuppliedname + +Notes:Thisfunctionisnottask-safe!Lockmustbedonebeforecall. + +*****************************************************************************************/ +staticmpi_mbox_t*mpi_findMbox(char*name){ +mpi_mbox_t*mbox=0x0; + +for(mbox=mboxList;mbox;mbox=mbox->next){ +if(!strcmp(mbox->name,name)){ +return(mbox); } - -return(0x0); -} - -/***************************************************************************************** - -Function:intmpiCreateMbox(char*name) - -Description:Thisfunctionwillcreateanewmailboxifitfailsitwillreturn-1 -otherwiseitreturns0x0 - -Notes: - -*****************************************************************************************/ -intmpi_createMbox(char*name){ -mpi_mbox_t*mbox=0x0; - -spinLock(&mpiSpinLock); -if(mpi_findMbox(name)!=0x0){ -spinUnlock(&mpiSpinLock); -return(-1); -} - -mbox=(mpi_mbox_t*)kmalloc(sizeof(mpi_mbox_t)); - -sprintf(mbox->name,name); -mbox->pid=_current->id; - -if(mboxList==0x0){ -mbox->prev=0x0; -mbox->next=0x0; -mboxList=mbox; -} -else{ -mbox->next=mboxList; -mbox->prev=0x0; -mboxList->prev=mbox; -mboxList=mbox; -} - -spinUnlock(&mpiSpinLock); -return(0x0); -} - -/***************************************************************************************** - -Function:intmpiSpam(uInt32type,void*data) +} + +return(0x0); +} + +/***************************************************************************************** + +Function:intmpiCreateMbox(char*name) + +Description:Thisfunctionwillcreateanewmailboxifitfailsitwillreturn-1 +otherwiseitreturns0x0 + +Notes: + +*****************************************************************************************/ +intmpi_createMbox(char*name){ +mpi_mbox_t*mbox=0x0; + +spinLock(&mpiSpinLock); +if(mpi_findMbox(name)!=0x0){ +spinUnlock(&mpiSpinLock); +return(-1); +} + +mbox=(mpi_mbox_t*)kmalloc(sizeof(mpi_mbox_t)); + +sprintf(mbox->name,name); +mbox->pid=_current->id; + +if(mboxList==0x0){ +mbox->prev=0x0; +mbox->next=0x0; +mboxList=mbox; +} +else{ +mbox->next=mboxList; +mbox->prev=0x0; +mboxList->prev=mbox; +mboxList=mbox; +} + + +spinUnlock(&mpiSpinLock); +return(0x0); +} + +/***************************************************************************************** -Description:Thisfunctionwillsendamessagetoeverymailbox +Function:intmpiSpam(uInt32type,void*data) -Notes: +Description:Thisfunctionwillsendamessagetoeverymailbox -*****************************************************************************************/ -intmpi_spam(uInt32type,void*data){ -mpi_mbox_t*mbox=0x0; -mpi_message_t*message=0x0; - -spinLock(&mpiSpinLock); +Notes: + +*****************************************************************************************/ +intmpi_spam(uInt32type,void*data){ +mpi_mbox_t*mbox=0x0; +mpi_message_t*message=0x0; -for(mbox=mboxList;mbox;mbox=mbox->next){ -message=(mpi_message_t*)kmalloc(sizeof(mpi_message_t)); - -message->header=type; -memcpy(message->data,data,MESSAGE_LENGTH); -message->next=0x0; - -if(mbox->msg==0x0){ -mbox->msg=message; -} -else{ -mbox->msgLast->next=message; -mbox->msgLast=message; -} -} - -spinUnlock(&mpiSpinLock); -return(0x0); -} - -/***************************************************************************************** - -Function:intmpiPostMessage(char*name,uInt32type,void*data) +spinLock(&mpiSpinLock); + +for(mbox=mboxList;mbox;mbox=mbox->next){ +message=(mpi_message_t*)kmalloc(sizeof(mpi_message_t)); + +message->header=type; +memcpy(message->data,data,MESSAGE_LENGTH); +message->next=0x0; + +if(mbox->msg==0x0){ +mbox->msg=message; +} +else{ +mbox->msgLast->next=message; +mbox->msgLast=message; +} +} + +spinUnlock(&mpiSpinLock); +return(0x0); +} + +/***************************************************************************************** -Description:Thisfunctionwillpostamessagetospecifiedmailbox +Function:intmpiPostMessage(char*name,uInt32type,void*data) -Notes: - -*****************************************************************************************/ -intmpi_postMessage(char*name,uInt32type,mpi_message_t*msg){ -mpi_mbox_t*mbox=0x0; -mpi_message_t*message=0x0; - -spinLock(&mpiSpinLock); +Description:Thisfunctionwillpostamessagetospecifiedmailbox + +Notes: + +*****************************************************************************************/ +intmpi_postMessage(char*name,uint32_ttype,mpi_message_t*msg){ +mpi_mbox_t*mbox=0x0; +mpi_message_t*message=0x0; -mbox=mpi_findMbox(name); +spinLock(&mpiSpinLock); -if(mbox==0x0){ -spinUnlock(&mpiSpinLock); -return(0x1); -} - -message=(mpi_message_t*)kmalloc(sizeof(mpi_message_t)); +mbox=mpi_findMbox(name); + +if(mbox==0x0){ +spinUnlock(&mpiSpinLock); +return(0x1); +} -message->header=msg->header; -memcpy(message->data,msg->data,MESSAGE_LENGTH); -message->pid=_current->id; -message->next=0x0; - -if(mbox->msg==0x0){ -mbox->msg=message; -} -else{ -mbox->msgLast->next=message; -mbox->msgLast=message; -} - -spinUnlock(&mpiSpinLock); - -if(type==0x2){ -while(mbox->msgLast!=0x0); -} - -return(0x0); +message=(mpi_message_t*)kmalloc(sizeof(mpi_message_t)); + +message->header=msg->header; +memcpy(message->data,msg->data,MESSAGE_LENGTH); +message->pid=_current->id; +message->next=0x0; + +if(mbox->msg==0x0){ +mbox->msg=message; +} +else{ +mbox->msgLast->next=message; +mbox->msgLast=message; +} + +spinUnlock(&mpiSpinLock); + +if(type==0x2){ +while(mbox->msgLast!=0x0) +; } -/***************************************************************************************** - -Function:intmpiFetchMessage(char*name,mpiMessage_t*msg) - -Description:Thisfunctionwillfetchthenextmessageoutofthespecifiedmailbox - -Notes: - -*****************************************************************************************/ -intmpi_fetchMessage(char*name,mpi_message_t*msg){ -mpi_mbox_t*mbox=0x0; -mpi_message_t*tmpMsg=0x0; - -spinLock(&mpiSpinLock); - -mbox=mpi_findMbox(name); - -if(mbox==0x0){ -spinUnlock(&mpiSpinLock); -return(-1); -} - -if(mbox->msg==0x0){ -spinUnlock(&mpiSpinLock); -return(-1); -} - -if(mbox->pid!=_current->id){ -spinUnlock(&mpiSpinLock); -return(-1); -} - -msg->header=mbox->msg->header; -memcpy(msg->data,mbox->msg->data,MESSAGE_LENGTH); -msg->pid=mbox->msg->pid; - -tmpMsg=mbox->msg; -mbox->msg=mbox->msg->next; - -kfree(tmpMsg); - -spinUnlock(&mpiSpinLock); -return(0x0); -} - -/***************************************************************************************** - -Function:intmpiDestroyMbox(char*name) - -Description:Thisfunctionwillfetchthenextmessageoutofthespecifiedmailbox - -Notes: - -*****************************************************************************************/ -intmpi_destroyMbox(char*name){ -mpi_mbox_t*mbox=0x0; - -spinLock(&mpiSpinLock); - -for(mbox=mboxList;mbox;mbox=mbox->next){ -if(!strcmp(mbox->name,name)){ -if(mbox->pid!=_current->id){ -spinUnlock(&mpiSpinLock); -return(-1); -} -mbox->prev->next=mbox->next; -mbox->next->prev=mbox->prev; -kfree(mbox); -spinUnlock(&mpiSpinLock); -return(0x0); -} -} - -spinUnlock(&mpiSpinLock); -return(-1); -} - -/*** -END -***/ +return(0x0); +} + +/***************************************************************************************** + +Function:intmpiFetchMessage(char*name,mpiMessage_t*msg) + +Description:Thisfunctionwillfetchthenextmessageoutofthespecifiedmailbox + +Notes: + +*****************************************************************************************/ +intmpi_fetchMessage(char*name,mpi_message_t*msg){ +mpi_mbox_t*mbox=0x0; +mpi_message_t*tmpMsg=0x0; + +spinLock(&mpiSpinLock); + +mbox=mpi_findMbox(name); + +if(mbox==0x0){ +spinUnlock(&mpiSpinLock); +return(-1); +} + +if(mbox->msg==0x0){ +spinUnlock(&mpiSpinLock); +return(-1); +} + +if(mbox->pid!=_current->id){ +spinUnlock(&mpiSpinLock); +return(-1); +} + +msg->header=mbox->msg->header; +memcpy(msg->data,mbox->msg->data,MESSAGE_LENGTH); +msg->pid=mbox->msg->pid; + +tmpMsg=mbox->msg; +mbox->msg=mbox->msg->next; + +kfree(tmpMsg); + +spinUnlock(&mpiSpinLock); +return(0x0); +} + +/***************************************************************************************** + +Function:intmpiDestroyMbox(char*name) + +Description:Thisfunctionwillfetchthenextmessageoutofthespecifiedmailbox + +Notes: + +*****************************************************************************************/ +intmpi_destroyMbox(char*name){ +mpi_mbox_t*mbox=0x0; + +spinLock(&mpiSpinLock); + +for(mbox=mboxList;mbox;mbox=mbox->next){ +if(!strcmp(mbox->name,name)){ +if(mbox->pid!=_current->id){ +spinUnlock(&mpiSpinLock); +return(-1); +} +mbox->prev->next=mbox->next; +mbox->next->prev=mbox->prev; +kfree(mbox); +spinUnlock(&mpiSpinLock); +return(0x0); +} +} + +spinUnlock(&mpiSpinLock); +return(-1); +} + +/*** +END +***/ - + diff --git a/doc/xml/systemtask_8h.xml b/doc/xml/systemtask_8h.xml index 233397b..0fc4711 100644 --- a/doc/xml/systemtask_8h.xml +++ b/doc/xml/systemtask_8h.xml @@ -1,48 +1,93 @@ - - - + + + systemtask.h - ubixos/types.h - src/sys/init/main.c - src/sys/kernel/systemtask.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/init/main.c - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + void void systemTask () @@ -53,35 +98,34 @@ - - biosCall - mpi_message::data - fclose - mpi_message::header - taskStruct::id - taskStruct::imageFd - inportByte - kfree - kpanic - kprintf - mpi_createMbox - mpi_fetchMessage - outportByte - mpi_message::pid - printOff - sched_getDelTask - sched_yield - schedFindTask - strcmp - systemVitals - vitalsStruct::sysTicks - vitalsStruct::sysUptime - taskStruct::term - tty_find - videoBuffer - vmmFreeProcessPages - x10 - kmain + + biosCall + mpi_message::data + execThread + fclose + taskStruct::files + mpi_message::header + taskStruct::id + inportByte + kfree + kpanic + kprintf + mpi_createMbox + mpi_fetchMessage + ogprintOff + outportByte + mpi_message::pid + printOff + sched_getDelTask + sched_yield + schedFindTask + sdeThread + strcmp + systemVitals + vitalsStruct::sysUptime + taskStruct::term + tty_find + vmm_freeProcessPages @@ -89,71 +133,67 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: systemtask_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_SYSTEMTASK_H -#define_SYSTEMTASK_H - -#include<ubixos/types.h> - -voidsystemTask(); - -#endif - -/*** -$Log: systemtask_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:56reddawg -nomessage - -Revision1.22004/06/0417:49:32reddawg -Wontworkwithoutthemakefileupdated - -Revision1.12004/06/0417:33:33reddawg -Changedidletasktosystemtask - -Revision1.22004/05/2115:20:00reddawg -Cleanedup +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYSTEMTASK_H +#define_SYSTEMTASK_H + +#include<sys/types.h> + +voidsystemTask(); + +#endif + +/*** +$Log:systemtask.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:23:56reddawg +nomessage + +Revision1.22004/06/0417:49:32reddawg +Wontworkwithoutthemakefileupdated + +Revision1.12004/06/0417:33:33reddawg +Changedidletasktosystemtask + +Revision1.22004/05/2115:20:00reddawg +Cleanedup + - -END -***/ +END +***/ - + diff --git a/doc/xml/tcp_8h.xml b/doc/xml/tcp_8h.xml index 1a3787e..5a2afff 100644 --- a/doc/xml/tcp_8h.xml +++ b/doc/xml/tcp_8h.xml @@ -1,1980 +1,524 @@ - - - + + + tcp.h - net/sys.h - net/mem.h - net/pbuf.h net/opt.h - net/ipv4/ip.h - net/ipv4/icmp.h - net/err.h - src/sys/include/net/api.h - src/sys/include/net/api_msg.h - src/sys/net/api/tcpip.c - src/sys/net/netif/loopif.c - src/sys/net/netif/tcpdump.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/netif/loopif.c + C:/Dev/git/UbixOS/sys/net/netif/tcpdump.c - - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + - - - - + + + + - + - - - - - + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - tcp_hdr - tcp_pcb - tcp_pcb_listen - tcp_seg - - - tcp_ack - pcb - if((pcb)->flags & TF_ACK_DELAY) { \ - (pcb)->flags |= TF_ACK_NOW; \ - tcp_output(pcb); \ - } else { \ - (pcb)->flags |= TF_ACK_DELAY; \ - } - - - - - - - - - - TCP_ACK - 0x10 - - - - - - - - - - tcp_ack_now - pcb - (pcb)->flags |= TF_ACK_NOW; \ - tcp_output(pcb) - - - - - - - - - - TCP_FAST_INTERVAL - 200 - - - - - - - - - - TCP_FIN - 0x01 - - - - - - - - - - TCP_FIN_WAIT_TIMEOUT - 20000 - - - - - - - - - - TCP_HLEN - 20 - - - - - - - - - - TCP_MSL - 60000 - - - - - - - - - - TCP_OOSEQ_TIMEOUT - 6 - - - - - - - - - - tcp_pcbs_sane - - 1 - - - - - - - - - - TCP_PSH - 0x08 - - - - - - - - - - TCP_REG - pcbs - npcb - do { \ - npcb->next = *pcbs; \ - *pcbs = npcb; \ - } while(0) - - - - - - - - - - TCP_RMV - pcbs - npcb - do { \ - if(*pcbs == npcb) { \ - *pcbs = (*pcbs)->next; \ - } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ - if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \ - tcp_tmp_pcb->next = npcb->next; \ - break; \ - } \ - } \ - npcb->next = NULL; \ - } while(0) - - - - - - - - - - TCP_RST - 0x04 - - - - - - - - - - TCP_SEQ_GEQ - a - b - ((Int32)((a)-(b)) >= 0) - - - - - - - - - - TCP_SEQ_GT - a - b - ((Int32)((a)-(b)) > 0) - - - - - - - - - - TCP_SEQ_LEQ - a - b - ((Int32)((a)-(b)) <= 0) - - - - - - - - - - TCP_SEQ_LT - a - b - ((Int32)((a)-(b)) < 0) - - - - - - - - - - TCP_SLOW_INTERVAL - 500 - - - - - - - - - - tcp_sndbuf - pcb - ((pcb)->snd_buf) - - - - - - - - netconn_write - - - TCP_SYN - 0x02 - - - - - - - - - - TCP_SYN_RCVD_TIMEOUT - 20000 - - - - - - - - - - TCP_TCPLEN - seg - ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \ - TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0)) - - - - - - - - - - TCP_TMR_INTERVAL - 100 - - - - - - - - tcpip_tcp_timer - tcpip_thread - - - TCP_URG - 0x20 - - - - - - - - - - TCPH_FLAGS - hdr - (NTOHS((hdr)->_offset_flags) & 0xff) - - - - - - - - - - TCPH_FLAGS_SET - hdr - flags - (hdr)->_offset_flags = HTONS((TCPH_OFFSET(hdr) << 8) | (flags)) - - - - - - - - - - TCPH_OFFSET - hdr - (NTOHS((hdr)->_offset_flags) >> 8) - - - - - - - - - - TCPH_OFFSET_SET - hdr - offset - (hdr)->_offset_flags = HTONS(((offset) << 8) | TCPH_FLAGS(hdr)) - - - - - - - - - - TF_ACK_DELAY - 0x01 - - - - - - - - - - TF_ACK_NOW - 0x02 - - - - - - - - - - TF_CLOSED - 0x10 - - - - - - - - - - TF_GOT_FIN - 0x20 - - - - - - - - - - TF_INFR - 0x04 - - - - - - - - - - TF_RESET - 0x08 - - - - - - - - - - - - tcp_state - - CLOSED - 0 - - - - - - - LISTEN - 1 - - - - - - - SYN_SENT - 2 - - - - - - - SYN_RCVD - 3 - - - - - - - ESTABLISHED - 4 - - - - - - - FIN_WAIT_1 - 5 - - - - - - - FIN_WAIT_2 - 6 - - - - - - - CLOSE_WAIT - 7 - - - - - - - CLOSING - 8 - - - - - - - LAST_ACK - 9 - - - - - - - TIME_WAIT - 10 - - - - - - - - - - - - - - - - - void - void tcp_abort - (struct tcp_pcb *pcb) - tcp_abort - - struct tcp_pcb * - pcb - - - - - - - - - do_delconn - - - void - void tcp_accept - (struct tcp_pcb *pcb, err_t(*accept)(void *arg, struct tcp_pcb *newpcb, err_t err)) - tcp_accept - - struct tcp_pcb * - pcb - - - err_t(*)(void *arg, struct tcp_pcb *newpcb, err_t err) - accept - - - - - - - - - do_delconn - do_listen - - - void - void tcp_arg - (struct tcp_pcb *pcb, void *arg) - tcp_arg - - struct tcp_pcb * - pcb - - - void * - arg - - - - - - - - - do_delconn - do_listen - setup_tcp - - - err_t - err_t tcp_bind - (struct tcp_pcb *pcb, struct ip_addr *ipaddr, uInt16 port) - tcp_bind - - struct tcp_pcb * - pcb - - - struct ip_addr * - ipaddr - - - uInt16 - port - - - - - - - - - do_bind - - - err_t - err_t tcp_close - (struct tcp_pcb *pcb) - tcp_close - - struct tcp_pcb * - pcb - - - - - - - - - do_close - do_delconn - - - err_t - err_t tcp_connect - (struct tcp_pcb *pcb, struct ip_addr *ipaddr, uInt16 port, err_t(*connected)(void *arg, struct tcp_pcb *tpcb, err_t err)) - tcp_connect - - struct tcp_pcb * - pcb - - - struct ip_addr * - ipaddr - - - uInt16 - port - - - err_t(*)(void *arg, struct tcp_pcb *tpcb, err_t err) - connected - - - - - - - - - do_connect - - - err_t - err_t tcp_enqueue - (struct tcp_pcb *pcb, void *dataptr, uInt16 len, uInt8 flags, uInt8 copy, uInt8 *optdata, uInt8 optlen) - tcp_enqueue - - struct tcp_pcb * - pcb - - - void * - dataptr - - - uInt16 - len - - - uInt8 - flags - - - uInt8 - copy - - - uInt8 * - optdata - - - uInt8 - optlen - - - - - - - - - - - void - void tcp_err - (struct tcp_pcb *pcb, void(*err)(void *arg, err_t err)) - tcp_err - - struct tcp_pcb * - pcb - - - void(*)(void *arg, err_t err) - err - - - - - - - - - do_delconn - setup_tcp - - - void - void tcp_fasttmr - (void) - tcp_fasttmr - - void - - - - - - - - - - - void - void tcp_init - (void) - tcp_init - - void - - - - - - - - - tcpip_thread - - - void - void tcp_input - (struct pbuf *p, struct netif *inp) - tcp_input - - struct pbuf * - p - - - struct netif * - inp - - - - - - - - - - - tcp_pcb * - struct tcp_pcb* tcp_listen - (struct tcp_pcb *pcb) - tcp_listen - - struct tcp_pcb * - pcb - - - - - - - - - do_listen - - - tcp_pcb * - struct tcp_pcb* tcp_new - (void) - tcp_new - - void - - - - - - - - - do_bind - do_connect - - - uInt32 - uInt32 tcp_next_iss - (void) - tcp_next_iss - - void - - - - - - - - - - - err_t - err_t tcp_output - (struct tcp_pcb *pcb) - tcp_output - - struct tcp_pcb * - pcb - - - - - - - - - do_write - - - tcp_pcb * - struct tcp_pcb* tcp_pcb_copy - (struct tcp_pcb *pcb) - tcp_pcb_copy - - struct tcp_pcb * - pcb - - - - - - - - - - - void - void tcp_pcb_purge - (struct tcp_pcb *pcb) - tcp_pcb_purge - - struct tcp_pcb * - pcb - - - - - - - - - - - void - void tcp_pcb_remove - (struct tcp_pcb **pcblist, struct tcp_pcb *pcb) - tcp_pcb_remove - - struct tcp_pcb ** - pcblist - - - struct tcp_pcb * - pcb - - - - - - - - - - - void - void tcp_poll - (struct tcp_pcb *pcb, err_t(*poll)(void *arg, struct tcp_pcb *tpcb), uInt8 interval) - tcp_poll - - struct tcp_pcb * - pcb - - - err_t(*)(void *arg, struct tcp_pcb *tpcb) - poll - - - uInt8 - interval - - - - - - - - - do_delconn - setup_tcp - - - void - void tcp_recv - (struct tcp_pcb *pcb, err_t(*recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)) - tcp_recv - - struct tcp_pcb * - pcb - - - err_t(*)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) - recv - - - - - - - - - do_delconn - setup_tcp - - - void - void tcp_recved - (struct tcp_pcb *pcb, uInt16 len) - tcp_recved - - struct tcp_pcb * - pcb - - - uInt16 - len - - - - - - - - - do_recv - - - void - void tcp_rexmit_seg - (struct tcp_pcb *pcb, struct tcp_seg *seg) - tcp_rexmit_seg - - struct tcp_pcb * - pcb - - - struct tcp_seg * - seg - - - - - - - - - - - void - void tcp_rst - (uInt32 seqno, uInt32 ackno, struct ip_addr *local_ip, struct ip_addr *remote_ip, uInt16 local_port, uInt16 remote_port) - tcp_rst - - uInt32 - seqno - - - uInt32 - ackno - - - struct ip_addr * - local_ip - - - struct ip_addr * - remote_ip - - - uInt16 - local_port - - - uInt16 - remote_port - - - - - - - - - - - tcp_seg * - struct tcp_seg* tcp_seg_copy - (struct tcp_seg *seg) - tcp_seg_copy - - struct tcp_seg * - seg - - - - - - - - - - - uInt8 - uInt8 tcp_seg_free - (struct tcp_seg *seg) - tcp_seg_free - - struct tcp_seg * - seg - - - - - - - - - - - uInt8 - uInt8 tcp_segs_free - (struct tcp_seg *seg) - tcp_segs_free - - struct tcp_seg * - seg - - - - - - - - - - - err_t - err_t tcp_send_ctrl - (struct tcp_pcb *pcb, uInt8 flags) - tcp_send_ctrl - - struct tcp_pcb * - pcb - - - uInt8 - flags - - - - - - - - - - - void - void tcp_sent - (struct tcp_pcb *pcb, err_t(*sent)(void *arg, struct tcp_pcb *tpcb, uInt16 len)) - tcp_sent - - struct tcp_pcb * - pcb - - - err_t(*)(void *arg, struct tcp_pcb *tpcb, uInt16 len) - sent - - - - - - - - - do_delconn - setup_tcp - - - void - void tcp_slowtmr - (void) - tcp_slowtmr - - void - - - - - - - - - - - void - void tcp_tmr - (void) - tcp_tmr - - void - - - - - - - - - tcpip_tcp_timer - - - err_t - err_t tcp_write - (struct tcp_pcb *pcb, const void *dataptr, uInt16 len, uInt8 copy) - tcp_write - - struct tcp_pcb * - pcb - - - const void * - dataptr - - - uInt16 - len - - - uInt8 - copy - - - - - - - - - do_write - - - - - tcp_hdr - struct tcp_hdr PACK_STRUCT_STRUCT - - PACK_STRUCT_STRUCT - - - - - - - - - - tcp_pcb * - struct tcp_pcb* tcp_active_pcbs - - tcp_active_pcbs - - - - - - - - - - tcp_pcb_listen * - struct tcp_pcb_listen* tcp_listen_pcbs - - tcp_listen_pcbs - - - - - - - - - - uInt32 - uInt32 tcp_ticks - - tcp_ticks - - - - - - - - - - tcp_pcb * - struct tcp_pcb* tcp_tmp_pcb - - tcp_tmp_pcb - - - - - - - - - - tcp_pcb * - struct tcp_pcb* tcp_tw_pcbs - - tcp_tw_pcbs - - - - - - - - - +TCP API (to be used from TCPIP thread) +See also TCP -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. * -*$Id: tcp_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_TCP_H__ -#define__LWIP_TCP_H__ - -#include"net/sys.h" -#include"net/mem.h" +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_TCP_H +#defineLWIP_HDR_TCP_H -#include"net/pbuf.h" -#include"net/opt.h" -//UBU -#include"net/ipv4/ip.h" -//UBU -#include"net/ipv4/icmp.h" - -#include"net/sys.h" - -#include"net/err.h" - -structtcp_pcb; - -/*FunctionsforinterfacingwithTCP:*/ - -/*LowerlayerinterfacetoTCP:*/ -voidtcp_init(void);/*Mustbecalledfirstto -initializeTCP.*/ -voidtcp_tmr(void);/*Mustbecalledevery -TCP_TMR_INTERVAL -ms.(Typically100ms).*/ -/*Applicationprogram'sinterface:*/ -structtcp_pcb*tcp_new(void); - -voidtcp_arg(structtcp_pcb*pcb,void*arg); -voidtcp_accept(structtcp_pcb*pcb, -err_t(*accept)(void*arg,structtcp_pcb*newpcb, -err_terr)); -voidtcp_recv(structtcp_pcb*pcb, -err_t(*recv)(void*arg,structtcp_pcb*tpcb, -structpbuf*p,err_terr)); -voidtcp_sent(structtcp_pcb*pcb, -err_t(*sent)(void*arg,structtcp_pcb*tpcb, -uInt16len)); -voidtcp_poll(structtcp_pcb*pcb, -err_t(*poll)(void*arg,structtcp_pcb*tpcb), -uInt8interval); -voidtcp_err(structtcp_pcb*pcb, -void(*err)(void*arg,err_terr)); - -#definetcp_sndbuf(pcb)((pcb)->snd_buf) - -voidtcp_recved(structtcp_pcb*pcb,uInt16len); -err_ttcp_bind(structtcp_pcb*pcb,structip_addr*ipaddr, -uInt16port); -err_ttcp_connect(structtcp_pcb*pcb,structip_addr*ipaddr, -uInt16port,err_t(*connected)(void*arg, -structtcp_pcb*tpcb, -err_terr)); -structtcp_pcb*tcp_listen(structtcp_pcb*pcb); -voidtcp_abort(structtcp_pcb*pcb); -err_ttcp_close(structtcp_pcb*pcb); -err_ttcp_write(structtcp_pcb*pcb,constvoid*dataptr,uInt16len, -uInt8copy); - -/*Itisalsopossibletocallthesetwofunctionsattheright -intervals(insteadofcallingtcp_tmr()).*/ -voidtcp_slowtmr(void); -voidtcp_fasttmr(void); - - -/*OnlyusedbyIPtopassaTCPsegmenttoTCP:*/ -voidtcp_input(structpbuf*p,structnetif*inp); -/*UsedwithintheTCPcodeonly:*/ -err_ttcp_output(structtcp_pcb*pcb); - +#include"net/opt.h" + +#ifLWIP_TCP/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include"net/mem.h" +#include"net/pbuf.h" +#include"net/ip.h" +#include"net/icmp.h" +#include"net/err.h" +#include"net/ip6.h" +#include"net/ip6_addr.h" + +#ifdef__cplusplus +extern"C"{ +#endif + +structtcp_pcb; + +typedeferr_t(*tcp_accept_fn)(void*arg,structtcp_pcb*newpcb,err_terr); + +typedeferr_t(*tcp_recv_fn)(void*arg,structtcp_pcb*tpcb, +structpbuf*p,err_terr); + +typedeferr_t(*tcp_sent_fn)(void*arg,structtcp_pcb*tpcb, +u16_tlen); + +typedeferr_t(*tcp_poll_fn)(void*arg,structtcp_pcb*tpcb); - - -#defineTCP_SEQ_LT(a,b)((Int32)((a)-(b))<0) -#defineTCP_SEQ_LEQ(a,b)((Int32)((a)-(b))<=0) -#defineTCP_SEQ_GT(a,b)((Int32)((a)-(b))>0) -#defineTCP_SEQ_GEQ(a,b)((Int32)((a)-(b))>=0) - -#defineTCP_FIN0x01 -#defineTCP_SYN0x02 -#defineTCP_RST0x04 -#defineTCP_PSH0x08 -#defineTCP_ACK0x10 -#defineTCP_URG0x20 - -/*LengthoftheTCPheader,excludingoptions.*/ -#defineTCP_HLEN20 - -#defineTCP_TMR_INTERVAL100/*TheTCPtimerintervalin -milliseconds.*/ - -#defineTCP_FAST_INTERVAL200/*thefinegrainedtimeoutin -milliseconds*/ -#defineTCP_SLOW_INTERVAL500/*thecoarsegrainedtimeoutin -milliseconds*/ -#defineTCP_FIN_WAIT_TIMEOUT20000/*milliseconds*/ -#defineTCP_SYN_RCVD_TIMEOUT20000/*milliseconds*/ - -#defineTCP_OOSEQ_TIMEOUT6/*xRTO*/ - -#defineTCP_MSL60000/*Themaximumsegmentlifetimeinmicroseconds*/ - -structtcp_hdr{ -PACK_STRUCT_FIELD(uInt16src); -PACK_STRUCT_FIELD(uInt16dest); -PACK_STRUCT_FIELD(uInt32seqno); -PACK_STRUCT_FIELD(uInt32ackno); -PACK_STRUCT_FIELD(uInt16_offset_flags); -PACK_STRUCT_FIELD(uInt16wnd); -PACK_STRUCT_FIELD(uInt16chksum); -PACK_STRUCT_FIELD(uInt16urgp); -}PACK_STRUCT_STRUCT; - -#defineTCPH_OFFSET(hdr)(NTOHS((hdr)->_offset_flags)>>8) -#defineTCPH_FLAGS(hdr)(NTOHS((hdr)->_offset_flags)&0xff) - -#defineTCPH_OFFSET_SET(hdr,offset)(hdr)->_offset_flags=HTONS(((offset)<<8)|TCPH_FLAGS(hdr)) -#defineTCPH_FLAGS_SET(hdr,flags)(hdr)->_offset_flags=HTONS((TCPH_OFFSET(hdr)<<8)|(flags)) - -#defineTCP_TCPLEN(seg)((seg)->len+((TCPH_FLAGS((seg)->tcphdr)&TCP_FIN||\ -TCPH_FLAGS((seg)->tcphdr)&TCP_SYN)?1:0)) - -enumtcp_state{ -CLOSED=0, -LISTEN=1, -SYN_SENT=2, -SYN_RCVD=3, -ESTABLISHED=4, -FIN_WAIT_1=5, -FIN_WAIT_2=6, -CLOSE_WAIT=7, -CLOSING=8, -LAST_ACK=9, -TIME_WAIT=10 -}; - - -/*theTCPprotocolcontrolblock*/ -structtcp_pcb{ -structtcp_pcb*next;/*forthelinkedlist*/ - -enumtcp_statestate;/*TCPstate*/ +typedefvoid(*tcp_err_fn)(void*arg,err_terr); + +typedeferr_t(*tcp_connected_fn)(void*arg,structtcp_pcb*tpcb,err_terr); + +#ifLWIP_WND_SCALE +#defineRCV_WND_SCALE(pcb,wnd)(((wnd)>>(pcb)->rcv_scale)) +#defineSND_WND_SCALE(pcb,wnd)(((wnd)<<(pcb)->snd_scale)) +#defineTCPWND16(x)((u16_t)LWIP_MIN((x),0xFFFF)) +#defineTCP_WND_MAX(pcb)((tcpwnd_size_t)(((pcb)->flags&TF_WND_SCALE)?TCP_WND:TCPWND16(TCP_WND))) +typedefu32_ttcpwnd_size_t; +#else +#defineRCV_WND_SCALE(pcb,wnd)(wnd) +#defineSND_WND_SCALE(pcb,wnd)(wnd) +#defineTCPWND16(x)(x) +#defineTCP_WND_MAX(pcb)TCP_WND +typedefu16_ttcpwnd_size_t; +#endif + +#ifLWIP_WND_SCALE||TCP_LISTEN_BACKLOG||LWIP_TCP_TIMESTAMPS +typedefu16_ttcpflags_t; +#else +typedefu8_ttcpflags_t; +#endif + +enumtcp_state{ +CLOSED=0, +LISTEN=1, +SYN_SENT=2, +SYN_RCVD=3, +ESTABLISHED=4, +FIN_WAIT_1=5, +FIN_WAIT_2=6, +CLOSE_WAIT=7, +CLOSING=8, +LAST_ACK=9, +TIME_WAIT=10 +}; + +#defineTCP_PCB_COMMON(type)\ +type*next;/*forthelinkedlist*/\ +void*callback_arg;\ +enumtcp_statestate;/*TCPstate*/\ +u8_tprio;\ +/*portsareinhostbyteorder*/\ +u16_tlocal_port + -void*callback_arg; - -/*Functiontocallwhenalistenerhasbeenconnected.*/ -err_t(*accept)(void*arg,structtcp_pcb*newpcb,err_terr); - -structip_addrlocal_ip; -uInt16local_port; - -structip_addrremote_ip; -uInt16remote_port; - -/*receivervarables*/ -uInt32rcv_nxt;/*nextseqnoexpected*/ -uInt16rcv_wnd;/*receiverwindow*/ - -/*Timers*/ -uInt16tmr; +structtcp_pcb_listen{ +IP_PCB; +TCP_PCB_COMMON(structtcp_pcb_listen); + +#ifLWIP_CALLBACK_API +/*Functiontocallwhenalistenerhasbeenconnected.*/ +tcp_accept_fnaccept; +#endif/*LWIP_CALLBACK_API*/ + +#ifTCP_LISTEN_BACKLOG +u8_tbacklog; +u8_taccepts_pending; +#endif/*TCP_LISTEN_BACKLOG*/ +}; -/*Retransmissiontimer.*/ -uInt8rtime; - -uInt16mss;/*maximumsegmentsize*/ - -uInt8flags; -#defineTF_ACK_DELAY0x01/*DelayedACK.*/ -#defineTF_ACK_NOW0x02/*ImmediateACK.*/ -#defineTF_INFR0x04/*Infastrecovery.*/ -#defineTF_RESET0x08/*Connectionwasreset.*/ -#defineTF_CLOSED0x10/*Connectionwassucessfullyclosed.*/ -#defineTF_GOT_FIN0x20/*Connectionwasclosedbytheremoteend.*/ - -/*RTTestimationvariables.*/ -uInt16rttest;/*RTTestimatein500msticks*/ -uInt32rtseq;/*sequencenumberbeingtimed*/ -Int32sa,sv; - -uInt16rto;/*retransmissiontime-out*/ -uInt8nrtx;/*numberofretransmissions*/ - -/*fastretransmit/recovery*/ -uInt32lastack;/*Highestacknowledgedseqno.*/ -uInt8dupacks; - -/*congestionavoidance/controlvariables*/ -uInt16cwnd; -uInt16ssthresh; - -/*sendervariables*/ -uInt32snd_nxt,/*nextseqnotobesent*/ -snd_max,/*Highestseqnosent.*/ -snd_wnd,/*senderwindow*/ -snd_wl1,snd_wl2, -snd_lbb; - -uInt16snd_buf;/*Avaliablebufferspaceforsending.*/ -uInt8snd_queuelen; - -/*Functiontobecalledwhenmoresendbufferspaceisavaliable.*/ -err_t(*sent)(void*arg,structtcp_pcb*pcb,uInt16space); -uInt16acked; - -/*Functiontobecalledwhen(in-sequence)datahasarrived.*/ -err_t(*recv)(void*arg,structtcp_pcb*pcb,structpbuf*p,err_terr); -structpbuf*recv_data; + +structtcp_pcb{ +IP_PCB; +TCP_PCB_COMMON(structtcp_pcb); + +/*portsareinhostbyteorder*/ +u16_tremote_port; + +tcpflags_tflags; +#defineTF_ACK_DELAY0x01U/*DelayedACK.*/ +#defineTF_ACK_NOW0x02U/*ImmediateACK.*/ +#defineTF_INFR0x04U/*Infastrecovery.*/ +#defineTF_CLOSEPEND0x08U/*Ifthisisset,tcp_closefailedtoenqueuetheFIN(retriedintcp_tmr)*/ +#defineTF_RXCLOSED0x10U/*rxclosedbytcp_shutdown*/ +#defineTF_FIN0x20U/*Connectionwasclosedlocally(FINsegmentenqueued).*/ +#defineTF_NODELAY0x40U/*DisableNaglealgorithm*/ +#defineTF_NAGLEMEMERR0x80U/*nagleenabled,memerr,trytooutputtopreventdelayedACKtohappen*/ +#ifLWIP_WND_SCALE +#defineTF_WND_SCALE0x0100U/*WindowScaleoptionenabled*/ +#endif +#ifTCP_LISTEN_BACKLOG +#defineTF_BACKLOGPEND0x0200U/*Ifthisisset,aconnectionpcbhasincreasedthebacklogonitslistener*/ +#endif +#ifLWIP_TCP_TIMESTAMPS +#defineTF_TIMESTAMP0x0400U/*Timestampoptionenabled*/ +#endif + +/*therestofthefieldsareinhostbyteorder +aswehavetodosomemathwiththem*/ + +/*Timers*/ +u8_tpolltmr,pollinterval; +u8_tlast_timer; +u32_ttmr; + +/*receivervariables*/ +u32_trcv_nxt;/*nextseqnoexpected*/ +tcpwnd_size_trcv_wnd;/*receiverwindowavailable*/ +tcpwnd_size_trcv_ann_wnd;/*receiverwindowtoannounce*/ +u32_trcv_ann_right_edge;/*announcedrightedgeofwindow*/ + +/*Retransmissiontimer.*/ +s16_trtime; -/*Functiontobecalledwhenaconnectionhasbeensetup.*/ -err_t(*connected)(void*arg,structtcp_pcb*pcb,err_terr); - -/*Functionwhichiscalledperiodically.*/ -err_t(*poll)(void*arg,structtcp_pcb*pcb); - -/*Functiontobecalledwheneverafatalerroroccurs.*/ -void(*errf)(void*arg,err_terr); - -uInt8polltmr,pollinterval; - -/*Theseareorderedbysequencenumber:*/ -structtcp_seg*unsent;/*Unsent(queued)segments.*/ -structtcp_seg*unacked;/*Sentbutunacknowledgedsegments.*/ -#ifTCP_QUEUE_OOSEQ -structtcp_seg*ooseq;/*Receivedoutofsequencesegments.*/ -#endif/*TCP_QUEUE_OOSEQ*/ +u16_tmss;/*maximumsegmentsize*/ + +/*RTT(roundtriptime)estimationvariables*/ +u32_trttest;/*RTTestimatein500msticks*/ +u32_trtseq;/*sequencenumberbeingtimed*/ +s16_tsa,sv;/*@tododocumentthis*/ + +s16_trto;/*retransmissiontime-out*/ +u8_tnrtx;/*numberofretransmissions*/ + +/*fastretransmit/recovery*/ +u8_tdupacks; +u32_tlastack;/*Highestacknowledgedseqno.*/ + +/*congestionavoidance/controlvariables*/ +tcpwnd_size_tcwnd; +tcpwnd_size_tssthresh; -}; - -structtcp_pcb_listen{ -structtcp_pcb_listen*next;/*forthelinkedlist*/ - -enumtcp_statestate;/*TCPstate*/ - -void*callback_arg; - -/*Functiontocallwhenalistenerhasbeenconnected.*/ -void(*accept)(void*arg,structtcp_pcb*newpcb); +/*sendervariables*/ +u32_tsnd_nxt;/*nextnewseqnotobesent*/ +u32_tsnd_wl1,snd_wl2;/*Sequenceandacknowledgementnumbersoflast +windowupdate.*/ +u32_tsnd_lbb;/*Sequencenumberofnextbytetobebuffered.*/ +tcpwnd_size_tsnd_wnd;/*senderwindow*/ +tcpwnd_size_tsnd_wnd_max;/*themaximumsenderwindowannouncedbytheremotehost*/ + +tcpwnd_size_tsnd_buf;/*Availablebufferspaceforsending(inbytes).*/ +#defineTCP_SNDQUEUELEN_OVERFLOW(0xffffU-3) +u16_tsnd_queuelen;/*Numberofpbufscurrentlyinthesendbuffer.*/ -structip_addrlocal_ip; -uInt16local_port; -}; - -/*ThisstructureisusedtorepressentTCPsegments.*/ -structtcp_seg{ -structtcp_seg*next;/*usedwhenputtingsegementsonaqueue*/ -structpbuf*p;/*buffercontainingdata+TCPheader*/ -void*dataptr;/*pointertotheTCPdatainthepbuf*/ -uInt16len;/*theTCPlengthofthissegment*/ -structtcp_hdr*tcphdr;/*theTCPheader*/ -}; - -/*Internalfunctionsandglobalvariables:*/ -structtcp_pcb*tcp_pcb_copy(structtcp_pcb*pcb); -voidtcp_pcb_purge(structtcp_pcb*pcb); -voidtcp_pcb_remove(structtcp_pcb**pcblist,structtcp_pcb*pcb); +#ifTCP_OVERSIZE +/*Extrabytesavailableattheendofthelastpbufinunsent.*/ +u16_tunsent_oversize; +#endif/*TCP_OVERSIZE*/ + +/*Theseareorderedbysequencenumber:*/ +structtcp_seg*unsent;/*Unsent(queued)segments.*/ +structtcp_seg*unacked;/*Sentbutunacknowledgedsegments.*/ +#ifTCP_QUEUE_OOSEQ +structtcp_seg*ooseq;/*Receivedoutofsequencesegments.*/ +#endif/*TCP_QUEUE_OOSEQ*/ + +structpbuf*refused_data;/*Datapreviouslyreceivedbutnotyettakenbyupperlayer*/ + +#ifLWIP_CALLBACK_API||TCP_LISTEN_BACKLOG +structtcp_pcb_listen*listener; +#endif/*LWIP_CALLBACK_API||TCP_LISTEN_BACKLOG*/ -uInt8tcp_segs_free(structtcp_seg*seg); -uInt8tcp_seg_free(structtcp_seg*seg); -structtcp_seg*tcp_seg_copy(structtcp_seg*seg); - -#definetcp_ack(pcb)if((pcb)->flags&TF_ACK_DELAY){\ -(pcb)->flags|=TF_ACK_NOW;\ -tcp_output(pcb);\ -}else{\ -(pcb)->flags|=TF_ACK_DELAY;\ -} - -#definetcp_ack_now(pcb)(pcb)->flags|=TF_ACK_NOW;\ -tcp_output(pcb) - -err_ttcp_send_ctrl(structtcp_pcb*pcb,uInt8flags); -err_ttcp_enqueue(structtcp_pcb*pcb,void*dataptr,uInt16len, -uInt8flags,uInt8copy, -uInt8*optdata,uInt8optlen); - -voidtcp_rexmit_seg(structtcp_pcb*pcb,structtcp_seg*seg); - -voidtcp_rst(uInt32seqno,uInt32ackno, -structip_addr*local_ip,structip_addr*remote_ip, -uInt16local_port,uInt16remote_port); +#ifLWIP_CALLBACK_API +/*Functiontobecalledwhenmoresendbufferspaceisavailable.*/ +tcp_sent_fnsent; +/*Functiontobecalledwhen(in-sequence)datahasarrived.*/ +tcp_recv_fnrecv; +/*Functiontobecalledwhenaconnectionhasbeensetup.*/ +tcp_connected_fnconnected; +/*Functionwhichiscalledperiodically.*/ +tcp_poll_fnpoll; +/*Functiontobecalledwheneverafatalerroroccurs.*/ +tcp_err_fnerrf; +#endif/*LWIP_CALLBACK_API*/ + +#ifLWIP_TCP_TIMESTAMPS +u32_tts_lastacksent; +u32_tts_recent; +#endif/*LWIP_TCP_TIMESTAMPS*/ + +/*idletimebeforeKEEPALIVEissent*/ +u32_tkeep_idle; +#ifLWIP_TCP_KEEPALIVE +u32_tkeep_intvl; +u32_tkeep_cnt; +#endif/*LWIP_TCP_KEEPALIVE*/ -uInt32tcp_next_iss(void); - -externuInt32tcp_ticks; - -#ifTCP_DEBUG||TCP_INPUT_DEBUG||TCP_OUTPUT_DEBUG -voidtcp_debug_print(structtcp_hdr*tcphdr); -voidtcp_debug_print_flags(uInt8flags); -voidtcp_debug_print_state(enumtcp_states); -voidtcp_debug_print_pcbs(void); -inttcp_pcbs_sane(void); -#else -#definetcp_pcbs_sane()1 -#endif/*TCP_DEBUG*/ +/*Persisttimercounter*/ +u8_tpersist_cnt; +/*Persisttimerback-off*/ +u8_tpersist_backoff; + +/*KEEPALIVEcounter*/ +u8_tkeep_cnt_sent; + +#ifLWIP_WND_SCALE +u8_tsnd_scale; +u8_trcv_scale; +#endif +}; - -/*TheTCPPCBlists.*/ -externstructtcp_pcb_listen*tcp_listen_pcbs;/*ListofallTCPPCBsinLISTENstate.*/ -externstructtcp_pcb*tcp_active_pcbs;/*ListofallTCPPCBsthatareina -stateinwhichtheyacceptorsend -data.*/ -externstructtcp_pcb*tcp_tw_pcbs;/*ListofallTCPPCBsinTIME-WAIT.*/ - -externstructtcp_pcb*tcp_tmp_pcb;/*Onlyusedfortemporarystorage.*/ - -/*Axoimsabouttheabovelists: -1)EveryTCPPCBthatisnotCLOSEDisinoneofthelists. -2)APCBisonlyinoneofthelists. -3)AllPCBsinthetcp_listen_pcbslistisinLISTENstate. -4)AllPCBsinthetcp_tw_pcbslistisinTIME-WAITstate. -*/ +#ifLWIP_EVENT_API + +enumlwip_event{ +LWIP_EVENT_ACCEPT, +LWIP_EVENT_SENT, +LWIP_EVENT_RECV, +LWIP_EVENT_CONNECTED, +LWIP_EVENT_POLL, +LWIP_EVENT_ERR +}; + +err_tlwip_tcp_event(void*arg,structtcp_pcb*pcb, +enumlwip_event, +structpbuf*p, +u16_tsize, +err_terr); -/*Definetwomacros,TCP_REGandTCP_RMVthatregistersaTCPPCB -withaPCBlistorremovesaPCBfromalist,respectively.*/ -#ifdefLWIP_DEBUG -#defineTCP_REG(pcbs,npcb)do{\ -DEBUGF(TCP_DEBUG,("TCP_REG%plocalport%d\n",npcb,npcb->local_port));\ -for(tcp_tmp_pcb=*pcbs;\ -tcp_tmp_pcb!=NULL;\ -tcp_tmp_pcb=tcp_tmp_pcb->next){\ -ASSERT("TCP_REG:alreadyregistered\n",tcp_tmp_pcb!=npcb);\ -}\ -ASSERT("TCP_REG:pcb->state!=CLOSED",npcb->state!=CLOSED);\ -npcb->next=*pcbs;\ -ASSERT("TCP_REG:npcb->next!=npcb",npcb->next!=npcb);\ -*pcbs=npcb;\ -ASSERT("TCP_RMV:tcp_pcbssane",tcp_pcbs_sane());\ -}while(0) -#defineTCP_RMV(pcbs,npcb)do{\ -ASSERT("TCP_RMV:pcbs!=NULL",*pcbs!=NULL);\ -DEBUGF(TCP_DEBUG,("TCP_RMV:removing%pfrom%p\n",npcb,*pcbs));\ -if(*pcbs==npcb){\ -*pcbs=(*pcbs)->next;\ -}elsefor(tcp_tmp_pcb=*pcbs;tcp_tmp_pcb!=NULL;tcp_tmp_pcb=tcp_tmp_pcb->next){\ -if(tcp_tmp_pcb->next!=NULL&&tcp_tmp_pcb->next==npcb){\ -tcp_tmp_pcb->next=npcb->next;\ -break;\ -}\ -}\ -npcb->next=NULL;\ -ASSERT("TCP_RMV:tcp_pcbssane",tcp_pcbs_sane());\ -DEBUGF(TCP_DEBUG,("TCP_RMV:removed%pfrom%p\n",npcb,*pcbs));\ -}while(0) - -#else/*LWIP_DEBUG*/ -#defineTCP_REG(pcbs,npcb)do{\ -npcb->next=*pcbs;\ -*pcbs=npcb;\ -}while(0) -#defineTCP_RMV(pcbs,npcb)do{\ -if(*pcbs==npcb){\ -*pcbs=(*pcbs)->next;\ -}elsefor(tcp_tmp_pcb=*pcbs;tcp_tmp_pcb!=NULL;tcp_tmp_pcb=tcp_tmp_pcb->next){\ -if(tcp_tmp_pcb->next!=NULL&&tcp_tmp_pcb->next==npcb){\ -tcp_tmp_pcb->next=npcb->next;\ -break;\ -}\ -}\ -npcb->next=NULL;\ -}while(0) -#endif/*LWIP_DEBUG*/ -#endif/*__LWIP_TCP_H__*/ - - +#endif/*LWIP_EVENT_API*/ + +/*Applicationprogram'sinterface:*/ +structtcp_pcb*tcp_new(void); +structtcp_pcb*tcp_new_ip_type(u8_ttype); + +voidtcp_arg(structtcp_pcb*pcb,void*arg); +#ifLWIP_CALLBACK_API +voidtcp_recv(structtcp_pcb*pcb,tcp_recv_fnrecv); +voidtcp_sent(structtcp_pcb*pcb,tcp_sent_fnsent); +voidtcp_err(structtcp_pcb*pcb,tcp_err_fnerr); +voidtcp_accept(structtcp_pcb*pcb,tcp_accept_fnaccept); +#endif/*LWIP_CALLBACK_API*/ +voidtcp_poll(structtcp_pcb*pcb,tcp_poll_fnpoll,u8_tinterval); + +#ifLWIP_TCP_TIMESTAMPS +#definetcp_mss(pcb)(((pcb)->flags&TF_TIMESTAMP)?((pcb)->mss-12):(pcb)->mss) +#else/*LWIP_TCP_TIMESTAMPS*/ +#definetcp_mss(pcb)((pcb)->mss) +#endif/*LWIP_TCP_TIMESTAMPS*/ +#definetcp_sndbuf(pcb)(TCPWND16((pcb)->snd_buf)) +#definetcp_sndqueuelen(pcb)((pcb)->snd_queuelen) + +#definetcp_nagle_disable(pcb)((pcb)->flags|=TF_NODELAY) + +#definetcp_nagle_enable(pcb)((pcb)->flags=(tcpflags_t)((pcb)->flags&~TF_NODELAY)) + +#definetcp_nagle_disabled(pcb)(((pcb)->flags&TF_NODELAY)!=0) + +#ifTCP_LISTEN_BACKLOG +#definetcp_backlog_set(pcb,new_backlog)do{\ +LWIP_ASSERT("pcb->state==LISTEN(calledforwrongpcb?)",(pcb)->state==LISTEN);\ +((structtcp_pcb_listen*)(pcb))->backlog=((new_backlog)?(new_backlog):1);}while(0) +voidtcp_backlog_delayed(structtcp_pcb*pcb); +voidtcp_backlog_accepted(structtcp_pcb*pcb); +#else/*TCP_LISTEN_BACKLOG*/ +#definetcp_backlog_set(pcb,new_backlog) +#definetcp_backlog_delayed(pcb) +#definetcp_backlog_accepted(pcb) +#endif/*TCP_LISTEN_BACKLOG*/ +#definetcp_accepted(pcb)/*compatibilitydefine,notneededanymore*/ + +voidtcp_recved(structtcp_pcb*pcb,u16_tlen); +err_ttcp_bind(structtcp_pcb*pcb,constip_addr_t*ipaddr, +u16_tport); +err_ttcp_connect(structtcp_pcb*pcb,constip_addr_t*ipaddr, +u16_tport,tcp_connected_fnconnected); + +structtcp_pcb*tcp_listen_with_backlog_and_err(structtcp_pcb*pcb,u8_tbacklog,err_t*err); +structtcp_pcb*tcp_listen_with_backlog(structtcp_pcb*pcb,u8_tbacklog); +#definetcp_listen(pcb)tcp_listen_with_backlog(pcb,TCP_DEFAULT_LISTEN_BACKLOG) +voidtcp_abort(structtcp_pcb*pcb); +err_ttcp_close(structtcp_pcb*pcb); +err_ttcp_shutdown(structtcp_pcb*pcb,intshut_rx,intshut_tx); + +/*Flagsfor"apiflags"parameterintcp_write*/ +#defineTCP_WRITE_FLAG_COPY0x01 +#defineTCP_WRITE_FLAG_MORE0x02 + +err_ttcp_write(structtcp_pcb*pcb,constvoid*dataptr,u16_tlen, +u8_tapiflags); + +voidtcp_setprio(structtcp_pcb*pcb,u8_tprio); + +#defineTCP_PRIO_MIN1 +#defineTCP_PRIO_NORMAL64 +#defineTCP_PRIO_MAX127 + +err_ttcp_output(structtcp_pcb*pcb); + + +constchar*tcp_debug_state_str(enumtcp_states); + +/*forcompatibilitywitholderimplementation*/ +#definetcp_new_ip6()tcp_new_ip_type(IPADDR_TYPE_V6) + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_TCP*/ + +#endif/*LWIP_HDR_TCP_H*/ - + diff --git a/doc/xml/tcpdump_8c.xml b/doc/xml/tcpdump_8c.xml index 5775bab..c29a0a5 100644 --- a/doc/xml/tcpdump_8c.xml +++ b/doc/xml/tcpdump_8c.xml @@ -1,288 +1,298 @@ - - - + + + tcpdump.c - vfs/file.h + vfs/file.h ubixos/kpanic.h - netif/tcpdump.h - net/ipv4/ip.h + netif/tcpdump.h + net/ipv4/ip.h net/tcp.h net/udp.h - net/ipv4/inet.h + net/ipv4/inet.h - - - - + + + + + + - - - - - - - - - - - - - - - + + + - + - - - + + + - - - - - - - - - - - - - - - - + + + + + + + - - - - + + + + + + + - + - + - + - + - - - - + + + + - + - + - + - + - - - + + + + + - - - + + + + + - + - - - - - - - - - - - - - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + - - - - + + + + - - - - - - - - + + + + - - - - + + + + + + - - - - + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fileDescriptor * + fileDescriptor* file + + file + = NULL + + + + + + + + fat_initialize + fl_fopen + fl_remove + fopen + main + + - + void void tcpdump (struct pbuf *p) @@ -297,12 +307,10 @@ - - file - NULL - loopif_output + + NULL - + void void tcpdump_init (void) @@ -316,29 +324,10 @@ - - file - fopen - kpanic - NULL - - - - - fileDescriptor * - fileDescriptor* file - - file - NULL - - - - - - - - tcpdump - tcpdump_init + + fopen + kpanic + NULL @@ -378,31 +367,31 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: tcpdump_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:tcpdump.c542016-01-1101:29:55Zreddawg$ */ -#include<vfs/file.h> +#include<vfs/file.h> #include<ubixos/kpanic.h> -#include"netif/tcpdump.h" -#include"net/ipv4/ip.h" +#include"netif/tcpdump.h" +#include"net/ipv4/ip.h" #include"net/tcp.h" #include"net/udp.h" -#include"net/ipv4/inet.h" +#include"net/ipv4/inet.h" -fileDescriptor*file=NULL; +fileDescriptor*file=NULL; -voidtcpdump_init(void){ +voidtcpdump_init(void){ char*fname; fname="tcpdump"; -file=fopen(fname,"wb"); -if(file==NULL){ -kpanic("tcpdump_init:fopen\n"); +file=fopen(fname,"wb"); +if(file==NULL){ +kpanic("tcpdump_init:fopen\n"); } } -voidtcpdump(structpbuf*p){ +voidtcpdump(structpbuf*p){ /* structip_hdr*iphdr; structtcp_hdr*tcphdr; @@ -412,7 +401,7 @@ intlen; intoffset; */ -if(file==NULL){ +if(file==NULL){ return; } @@ -523,6 +512,6 @@ ***/ - + diff --git a/doc/xml/tcpip_8c.xml b/doc/xml/tcpip_8c.xml index 9c1668e..7adc9b1 100644 --- a/doc/xml/tcpip_8c.xml +++ b/doc/xml/tcpip_8c.xml @@ -1,427 +1,932 @@ - - - + + + tcpip.c - ubixos/exec.h - lib/kmalloc.h - net/debug.h - net/opt.h - net/sys.h - net/memp.h - net/pbuf.h - net/ipv4/ip.h - net/udp.h - net/tcp.h - net/tcpip.h + net/opt.h + net/priv/tcpip_priv.h + net/sys.h + net/memp.h + net/mem.h + net/init.h + net/ip.h + net/pbuf.h + net/etharp.h + netif/ethernet.h - - - - + + + + + + - - - - + + + + + + + + + + + + - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + - - - - + + + + - - - - - - - - + + + + - - - - + + + + - - - - - - - - - - - + - - - - + + + + + + + + + + - - - - + + + + - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - void - void tcpip_apimsg - (struct api_msg *apimsg) - tcpip_apimsg - - struct api_msg * - apimsg - + + + TCPIP_MBOX_FETCH + mbox + msg + sys_mbox_fetch(mbox, msg) - - tcpip_msg::apimsg - mbox - memp_free - memp_mallocp - MEMP_TCPIP_MSG - tcpip_msg::msg - NULL - sys_mbox_post - TCPIP_MSG_API - api_msg_post + - + + TCPIP_MSG_VAR_ALLOC + name + API_VAR_ALLOC(struct tcpip_msg, MEMP_TCPIP_MSG_API, name, ERR_MEM) + + + + + + + + + + TCPIP_MSG_VAR_DECLARE + name + API_VAR_DECLARE(struct tcpip_msg, name) + + + + + + + + + + TCPIP_MSG_VAR_FREE + name + API_VAR_FREE(MEMP_TCPIP_MSG_API, name) + + + + + + + + + + TCPIP_MSG_VAR_REF + name + API_VAR_REF(name) + + + + + + + + + + + + sys_mbox_t + sys_mbox_t mbox + + mbox + + + + + + + + + + tcpip_init_done_fn + tcpip_init_done_fn tcpip_init_done + + tcpip_init_done + + + + + + + + + + void * + void* tcpip_init_done_arg + + tcpip_init_done_arg + + + + + + + + + + + + err_t + err_t mem_free_callback + (void *m) + mem_free_callback + + void * + m + + + + +A simple wrapper function that allows you to free heap memory from interrupt context. + + +m + + +the heap memory to free + + + +ERR_OK if callback could be enqueued, an err_t if not + + + + + + + mem_free + tcpip_callback_with_block + + + err_t + err_t pbuf_free_callback + (struct pbuf *p) + pbuf_free_callback + + struct pbuf * + p + + + + +A simple wrapper function that allows you to free a pbuf from interrupt context. + + +p + + +The pbuf (chain) to be dereferenced. + + + +ERR_OK if callback could be enqueued, an err_t if not + + + + + + + tcpip_callback_with_block + + + void + static void pbuf_free_int + (void *p) + pbuf_free_int + + void * + p + + + + +Simple callback function used with tcpip_callback to free a pbuf (pbuf_free has a wrong signature for tcpip_callback) + + +p + + +The pbuf (chain) to be dereferenced. + + + + + + + + + + + err_t + err_t tcpip_api_call + (tcpip_api_call_fn fn, struct tcpip_api_call_data *call) + tcpip_api_call + + tcpip_api_call_fn + fn + + + struct tcpip_api_call_data * + call + + + + +Synchronously calls function in TCPIP thread and waits for its completion. It is recommended to use LWIP_TCPIP_CORE_LOCKING (preferred) or LWIP_NETCONN_SEM_PER_THREAD. If not, a semaphore is created and destroyed on every call which is usually an expensive/slow operation. + +fn + + +Function to call + + + + +call + + +Call parameters + + + +Return value from tcpip_api_call_fn + + + + + + + ERR_OK + LOCK_TCPIP_CORE + LWIP_ASSERT + tcpip_msg::msg + tcpip_api_call_data::sem + sys_mbox_valid_val + sys_sem_new + TCPIP_MSG_VAR_DECLARE + UNLOCK_TCPIP_CORE + + + err_t + err_t tcpip_callback_with_block + (tcpip_callback_fn function, void *ctx, u8_t block) + tcpip_callback_with_block + + tcpip_callback_fn + function + + + void * + ctx + + + u8_t + block + + + + +Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. + + +function + + +the function to call + + + + +ctx + + +parameter passed to f + + + + +block + + +1 to block until the request is posted, 0 to non-blocking mode + + + +ERR_OK if the function was called, another err_t if not + + + + + + + LWIP_ASSERT + tcpip_msg::msg + sys_mbox_valid_val + mem_free_callback + pbuf_free_callback + + + void + void tcpip_callbackmsg_delete + (struct tcpip_callback_msg *msg) + tcpip_callbackmsg_delete + + struct tcpip_callback_msg * + msg + + + + +Free a callback message allocated by tcpip_callbackmsg_new(). + + +msg + + +the message to free + + + + + + + + + memp_free + tcpip_msg::msg + + + struct tcpip_callback_msg * + struct tcpip_callback_msg* tcpip_callbackmsg_new + (tcpip_callback_fn function, void *ctx) + tcpip_callbackmsg_new + + tcpip_callback_fn + function + + + void * + ctx + + + + +Allocate a structure for a static callback message and initialize it. This is intended to be used to send "static" messages from interrupt context. + + +function + + +the function to call + + + + +ctx + + +parameter passed to function + + + +a struct pointer to pass to tcpip_trycallback(). + + + + + + + tcpip_msg::ctx + memp_malloc + tcpip_msg::msg + NULL + TCPIP_MSG_CALLBACK_STATIC + + void void tcpip_init - (void(*initfunc)(void *), void *arg) + (tcpip_init_done_fn initfunc, void *arg) tcpip_init - void(*)(void *) + tcpip_init_done_fn initfunc @@ -431,21 +936,101 @@ +Initialize this module: +initialize all sub modules +start the tcpip_thread + + + + +initfunc + + +a function to call when tcpip_thread is running and finished initializing + + + + +arg + + +argument to pass to initfunc + + + + - - mbox - NULL - sys_mbox_new - sys_thread_new - tcpip_init_done - tcpip_init_done_arg - tcpip_thread - netMainThread + + lwip_init + net_init - - err_t + + err_t + err_t tcpip_inpkt + (struct pbuf *p, struct netif *inp, netif_input_fn input_fn) + tcpip_inpkt + + struct pbuf * + p + + + struct netif * + inp + + + netif_input_fn + input_fn + + + + +Pass a received packet to tcpip_thread for input processing + + +p + + +the received packet + + + + +inp + + +the network interface on which the packet was received + + + + +input_fn + + +input function to call + + + + + + + + + tcpip_msg::inp + tcpip_msg::input_fn + LOCK_TCPIP_CORE + LWIP_ASSERT + LWIP_DEBUGF + tcpip_msg::msg + tcpip_msg::p + sys_mbox_valid_val + TCPIP_DEBUG + UNLOCK_TCPIP_CORE + tcpip_input + + + err_t err_t tcpip_input (struct pbuf *p, struct netif *inp) tcpip_input @@ -460,47 +1045,102 @@ +Pass a received packet to tcpip_thread for input processing with ethernet_input or ip_input. Don't call directly, pass to netif_add() and call netif->input(). + + +p + + +the received packet, p->payload pointing to the Ethernet header or to an IP header (if inp doesn't have NETIF_FLAG_ETHARP or NETIF_FLAG_ETHERNET flags) + + + + +inp + + +the network interface on which the packet was received + + + + - - ERR_MEM - ERR_OK - tcpip_msg::inp - mbox - memp_mallocp - MEMP_TCPIP_MSG - tcpip_msg::msg - NULL - tcpip_msg::p - pbuf_free - sys_mbox_post - TCPIP_MSG_INPUT - netMainThread + + tcpip_msg::inp + NETIF_FLAG_ETHARP + NETIF_FLAG_ETHERNET + tcpip_msg::p + tcpip_inpkt + net_init + netif_init - - void - static void tcpip_tcp_timer - (void *arg) - tcpip_tcp_timer + + err_t + err_t tcpip_send_msg_wait_sem + (tcpip_callback_fn fn, void *apimsg, sys_sem_t *sem) + tcpip_send_msg_wait_sem + + tcpip_callback_fn + fn + void * - arg + apimsg + + + sys_sem_t * + sem +Sends a message to TCPIP thread to call a function. Caller thread blocks on on a provided semaphore, which ist NOT automatically signalled by TCPIP thread, this has to be done by the user. It is recommended to use LWIP_TCPIP_CORE_LOCKING since this is the way with least runtime overhead. + + +fn + + +function to be called from TCPIP thread + + + + +apimsg + + +argument to API function + + + + +sem + + +semaphore to wait on + + + +ERR_OK if the function was called, another err_t if not + + - - NULL - sys_timeout - tcp_tmr - TCP_TMR_INTERVAL - tcpip_thread + + ERR_OK + LOCK_TCPIP_CORE + LWIP_ASSERT + LWIP_UNUSED_ARG + tcpip_msg::msg + tcpip_msg::sem + sys_mbox_valid_val + sys_sem_valid + TCPIP_MSG_VAR_DECLARE + UNLOCK_TCPIP_CORE - + void static void tcpip_thread (void *arg) @@ -512,91 +1152,54 @@ +The main lwIP thread. This thread has exclusive access to lwIP core functions (unless access to them is not locked). Other threads communicate with this thread using message boxes. +It also starts all the timers to make sure they are running in the right thread context. + + +arg + + +unused argument + + + + - - api_msg_input - ip_init - ip_input - mbox - memp_freep - MEMP_TCPIP_MSG - tcpip_msg::msg - NULL - sys_mbox_fetch - sys_timeout - tcp_init - TCP_TMR_INTERVAL - tcpip_init_done - tcpip_init_done_arg - TCPIP_MSG_API - TCPIP_MSG_INPUT - tcpip_tcp_timer - udp_init - tcpip_init + - - - - sys_mbox_t - sys_mbox_t mbox - - mbox + + err_t + err_t tcpip_trycallback + (struct tcpip_callback_msg *msg) + tcpip_trycallback + + struct tcpip_callback_msg * + msg + +Try to post a callback-message to the tcpip_thread mbox This is intended to be used to send "static" messages from interrupt context. + + +msg + + +pointer to the message to post + + + +sys_mbox_trypost() return code + + - - accept_function - mpi_createMbox - mpi_destroyMbox - mpi_fetchMessage - mpi_findMbox - mpi_postMessage - mpi_spam - sys_arch_mbox_fetch - sys_mbox_free - sys_mbox_new - sys_mbox_post - tcpip_apimsg - tcpip_init - tcpip_input - tcpip_thread - - - void(*) - void(* ) tcpip_init_done(void *arg) - (void *arg) - tcpip_init_done - NULL - - - - - - - - netMainThread - tcpip_init - tcpip_thread - - - void * - void* tcpip_init_done_arg - - tcpip_init_done_arg - - - - - - - - tcpip_init - tcpip_thread + + LWIP_ASSERT + sys_mbox_valid_val @@ -605,151 +1208,378 @@ /* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. * -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. * -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: tcpip_8c.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ - -#include<ubixos/exec.h> -#include<lib/kmalloc.h> - -#include"net/debug.h" - -#include"net/opt.h" - -#include"net/sys.h" - -#include"net/memp.h" -#include"net/pbuf.h" - -#include"net/ipv4/ip.h" -#include"net/udp.h" -#include"net/tcp.h" +*Author:AdamDunkels<adam@sics.se> +* +*/ + +#include<net/opt.h> + +#if!NO_SYS/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include<net/priv/tcpip_priv.h> +#include<net/sys.h> +#include<net/memp.h> +#include<net/mem.h> +#include<net/init.h> +#include<net/ip.h> +#include<net/pbuf.h> +#include<net/etharp.h> +#include<netif/ethernet.h> + +#defineTCPIP_MSG_VAR_REF(name)API_VAR_REF(name) +#defineTCPIP_MSG_VAR_DECLARE(name)API_VAR_DECLARE(structtcpip_msg,name) +#defineTCPIP_MSG_VAR_ALLOC(name)API_VAR_ALLOC(structtcpip_msg,MEMP_TCPIP_MSG_API,name,ERR_MEM) +#defineTCPIP_MSG_VAR_FREE(name)API_VAR_FREE(MEMP_TCPIP_MSG_API,name) -#include"net/tcpip.h" - -staticvoid(*tcpip_init_done)(void*arg)=NULL; -staticvoid*tcpip_init_done_arg; -staticsys_mbox_tmbox; - -/*-----------------------------------------------------------------------------------*/ -staticvoid -tcpip_tcp_timer(void*arg) -{ -tcp_tmr(); -sys_timeout(TCP_TMR_INTERVAL,(sys_timeout_handler)tcpip_tcp_timer,NULL); -} -/*-----------------------------------------------------------------------------------*/ - -staticvoid -tcpip_thread(void*arg) -{ -structtcpip_msg*msg; - -ip_init(); -udp_init(); -tcp_init(); - -sys_timeout(TCP_TMR_INTERVAL,(sys_timeout_handler)tcpip_tcp_timer,NULL); - -if(tcpip_init_done!=NULL){ -tcpip_init_done(tcpip_init_done_arg); -} - -while(1){/*MAINLoop*/ -sys_mbox_fetch(mbox,(void*)&msg); -switch(msg->type){ -caseTCPIP_MSG_API: -//kprintf("tcpip_thread:APImessage%p\n",msg); -api_msg_input(msg->msg.apimsg); -break; -caseTCPIP_MSG_INPUT: -//kprintf("tcpip_thread:IPpacket%p\n",msg); -ip_input(msg->msg.inp.p,msg->msg.inp.netif); -break; -default: -break; -} -memp_freep(MEMP_TCPIP_MSG,msg); -} -} -/*-----------------------------------------------------------------------------------*/ -err_t -tcpip_input(structpbuf*p,structnetif*inp) -{ -structtcpip_msg*msg; - -msg=memp_mallocp(MEMP_TCPIP_MSG); -if(msg==NULL){ -//kprintf("BADMESSAGE!!!\n"); -pbuf_free(p); -returnERR_MEM; -} -//kprintf("GOODMESSAGE\n"); - -msg->type=TCPIP_MSG_INPUT; -msg->msg.inp.p=p; -msg->msg.inp.netif=inp; -sys_mbox_post(mbox,msg); -returnERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -void -tcpip_apimsg(structapi_msg*apimsg) -{ -structtcpip_msg*msg; -msg=memp_mallocp(MEMP_TCPIP_MSG); -if(msg==NULL){ -memp_free(MEMP_TCPIP_MSG,apimsg); -return; -} -msg->type=TCPIP_MSG_API; -msg->msg.apimsg=apimsg; -sys_mbox_post(mbox,msg); -} -/*-----------------------------------------------------------------------------------*/ -void -tcpip_init(void(*initfunc)(void*),void*arg) -{ -tcpip_init_done=initfunc; -tcpip_init_done_arg=arg; -mbox=sys_mbox_new(); -sys_thread_new((void*)tcpip_thread,NULL); -} -/*-----------------------------------------------------------------------------------*/ - - +/*globalvariables*/ +statictcpip_init_done_fntcpip_init_done; +staticvoid*tcpip_init_done_arg; +staticsys_mbox_tmbox; + +#ifLWIP_TCPIP_CORE_LOCKING + +sys_mutex_tlock_tcpip_core; +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +#ifLWIP_TIMERS +/*waitforamessage,timeoutsareprocessedwhilewaiting*/ +#defineTCPIP_MBOX_FETCH(mbox,msg)sys_timeouts_mbox_fetch(mbox,msg) +#else/*LWIP_TIMERS*/ +/*waitforamessagewithtimersdisabled(e.g.passatimer-checktriggerintotcpip_thread)*/ +#defineTCPIP_MBOX_FETCH(mbox,msg)sys_mbox_fetch(mbox,msg) +#endif/*LWIP_TIMERS*/ + +staticvoidtcpip_thread(void*arg){ +structtcpip_msg*msg; +LWIP_UNUSED_ARG(arg); + +if(tcpip_init_done!=NULL){ +tcpip_init_done(tcpip_init_done_arg); +} + +LOCK_TCPIP_CORE(); +while(1){/*MAINLoop*/ +UNLOCK_TCPIP_CORE(); +LWIP_TCPIP_THREAD_ALIVE(); +/*waitforamessage,timeoutsareprocessedwhilewaiting*/ +TCPIP_MBOX_FETCH(&mbox,(void**)&msg); +LOCK_TCPIP_CORE(); +if(msg==NULL){ +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:invalidmessage:NULL\n")); +LWIP_ASSERT("tcpip_thread:invalidmessage",0); +continue; +} +//kprintf("MSG->TYPE:0x%X]",msg->type); +switch(msg->type){ +#if!LWIP_TCPIP_CORE_LOCKING +caseTCPIP_MSG_API: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:APImessage%p\n",(void*)msg)); +msg->msg.api_msg.function(msg->msg.api_msg.msg); +break; +caseTCPIP_MSG_API_CALL: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:APICALLmessage%p\n",(void*)msg)); +msg->msg.api_call.arg->err=msg->msg.api_call.function(msg->msg.api_call.arg); +sys_sem_signal(msg->msg.api_call.sem); +break; +#endif/*!LWIP_TCPIP_CORE_LOCKING*/ + +#if!LWIP_TCPIP_CORE_LOCKING_INPUT +caseTCPIP_MSG_INPKT: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:PACKET%p\n",(void*)msg)); +msg->msg.inp.input_fn(msg->msg.inp.p,msg->msg.inp.netif); +memp_free(MEMP_TCPIP_MSG_INPKT,msg); +break; +#endif/*!LWIP_TCPIP_CORE_LOCKING_INPUT*/ + +#ifLWIP_TCPIP_TIMEOUT&&LWIP_TIMERS +caseTCPIP_MSG_TIMEOUT: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:TIMEOUT%p\n",(void*)msg)); +sys_timeout(msg->msg.tmo.msecs,msg->msg.tmo.h,msg->msg.tmo.arg); +memp_free(MEMP_TCPIP_MSG_API,msg); +break; +caseTCPIP_MSG_UNTIMEOUT: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:UNTIMEOUT%p\n",(void*)msg)); +sys_untimeout(msg->msg.tmo.h,msg->msg.tmo.arg); +memp_free(MEMP_TCPIP_MSG_API,msg); +break; +#endif/*LWIP_TCPIP_TIMEOUT&&LWIP_TIMERS*/ + +caseTCPIP_MSG_CALLBACK: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:CALLBACK%p\n",(void*)msg)); +msg->msg.cb.function(msg->msg.cb.ctx); +memp_free(MEMP_TCPIP_MSG_API,msg); +break; + +caseTCPIP_MSG_CALLBACK_STATIC: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:CALLBACK_STATIC%p\n",(void*)msg)); +msg->msg.cb.function(msg->msg.cb.ctx); +break; +default: +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_thread:invalidmessage:%d\n",msg->type)); +LWIP_ASSERT("tcpip_thread:invalidmessage",0); +break; +} +} +} + +err_ttcpip_inpkt(structpbuf*p,structnetif*inp,netif_input_fninput_fn){ +#ifLWIP_TCPIP_CORE_LOCKING_INPUT +err_tret; +LWIP_DEBUGF(TCPIP_DEBUG,("tcpip_inpkt:PACKET%p/%p\n",(void*)p,(void*)inp)); +LOCK_TCPIP_CORE(); +ret=input_fn(p,inp); +UNLOCK_TCPIP_CORE(); +returnret; +#else/*LWIP_TCPIP_CORE_LOCKING_INPUT*/ +structtcpip_msg*msg; + +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); + +msg=(structtcpip_msg*)memp_malloc(MEMP_TCPIP_MSG_INPKT); +if(msg==NULL){ +returnERR_MEM; +} + +msg->type=TCPIP_MSG_INPKT; +msg->msg.inp.p=p; +msg->msg.inp.netif=inp; +msg->msg.inp.input_fn=input_fn; +if(sys_mbox_trypost(&mbox,msg)!=ERR_OK){ +kprintf("INPKT%i\n",__LINE__); +memp_free(MEMP_TCPIP_MSG_INPKT,msg); +kprintf("INPKT%i\n",__LINE__); +returnERR_MEM; +} +returnERR_OK; +#endif/*LWIP_TCPIP_CORE_LOCKING_INPUT*/ +} + +err_ttcpip_input(structpbuf*p,structnetif*inp){ +#ifLWIP_ETHERNET +//kprintf("tcpip_input0\n"); +if(inp->flags&(NETIF_FLAG_ETHARP|NETIF_FLAG_ETHERNET)){ +//kprintf("tcpip_input1\n"); +returntcpip_inpkt(p,inp,ethernet_input); +} +else +#endif/*LWIP_ETHERNET*/ +//kprintf("tcpip_input2\n"); +returntcpip_inpkt(p,inp,ip_input); +//kprintf("tcpip_input3\n"); +} + +err_ttcpip_callback_with_block(tcpip_callback_fnfunction,void*ctx,u8_tblock){ +structtcpip_msg*msg; + +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); + +msg=(structtcpip_msg*)memp_malloc(MEMP_TCPIP_MSG_API); +if(msg==NULL){ +returnERR_MEM; +} + +msg->type=TCPIP_MSG_CALLBACK; +msg->msg.cb.function=function; +msg->msg.cb.ctx=ctx; +if(block){ +sys_mbox_post(&mbox,msg); +} +else{ +if(sys_mbox_trypost(&mbox,msg)!=ERR_OK){ +memp_free(MEMP_TCPIP_MSG_API,msg); +returnERR_MEM; +} +} +returnERR_OK; +} + +#ifLWIP_TCPIP_TIMEOUT&&LWIP_TIMERS + +err_t +tcpip_timeout(u32_tmsecs,sys_timeout_handlerh,void*arg) +{ +structtcpip_msg*msg; + +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); + +msg=(structtcpip_msg*)memp_malloc(MEMP_TCPIP_MSG_API); +if(msg==NULL){ +returnERR_MEM; +} + +msg->type=TCPIP_MSG_TIMEOUT; +msg->msg.tmo.msecs=msecs; +msg->msg.tmo.h=h; +msg->msg.tmo.arg=arg; +sys_mbox_post(&mbox,msg); +returnERR_OK; +} + +err_t +tcpip_untimeout(sys_timeout_handlerh,void*arg) +{ +structtcpip_msg*msg; + +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); + +msg=(structtcpip_msg*)memp_malloc(MEMP_TCPIP_MSG_API); +if(msg==NULL){ +returnERR_MEM; +} + +msg->type=TCPIP_MSG_UNTIMEOUT; +msg->msg.tmo.h=h; +msg->msg.tmo.arg=arg; +sys_mbox_post(&mbox,msg); +returnERR_OK; +} +#endif/*LWIP_TCPIP_TIMEOUT&&LWIP_TIMERS*/ + +err_ttcpip_send_msg_wait_sem(tcpip_callback_fnfn,void*apimsg,sys_sem_t*sem){ +#ifLWIP_TCPIP_CORE_LOCKING +LWIP_UNUSED_ARG(sem); +LOCK_TCPIP_CORE(); +fn(apimsg); +UNLOCK_TCPIP_CORE(); +returnERR_OK; +#else/*LWIP_TCPIP_CORE_LOCKING*/ +TCPIP_MSG_VAR_DECLARE(msg); + +LWIP_ASSERT("semaphorenotinitialized",sys_sem_valid(sem)); +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); + +TCPIP_MSG_VAR_ALLOC(msg); +TCPIP_MSG_VAR_REF(msg).type=TCPIP_MSG_API; +TCPIP_MSG_VAR_REF(msg).msg.api_msg.function=fn; +TCPIP_MSG_VAR_REF(msg).msg.api_msg.msg=apimsg; +sys_mbox_post(&mbox,&TCPIP_MSG_VAR_REF(msg)); +sys_arch_sem_wait(sem,0); +TCPIP_MSG_VAR_FREE(msg); +returnERR_OK; +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +} + +err_ttcpip_api_call(tcpip_api_call_fnfn,structtcpip_api_call_data*call){ +#ifLWIP_TCPIP_CORE_LOCKING +err_terr; +LOCK_TCPIP_CORE(); +err=fn(call); +UNLOCK_TCPIP_CORE(); +returnerr; +#else/*LWIP_TCPIP_CORE_LOCKING*/ +TCPIP_MSG_VAR_DECLARE(msg); + +#if!LWIP_NETCONN_SEM_PER_THREAD +err_terr=sys_sem_new(&call->sem,0); +if(err!=ERR_OK){ +returnerr; +} +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); + +TCPIP_MSG_VAR_ALLOC(msg); +TCPIP_MSG_VAR_REF(msg).type=TCPIP_MSG_API_CALL; +TCPIP_MSG_VAR_REF(msg).msg.api_call.arg=call; +TCPIP_MSG_VAR_REF(msg).msg.api_call.function=fn; +#ifLWIP_NETCONN_SEM_PER_THREAD +TCPIP_MSG_VAR_REF(msg).msg.api_call.sem=LWIP_NETCONN_THREAD_SEM_GET(); +#else/*LWIP_NETCONN_SEM_PER_THREAD*/ +TCPIP_MSG_VAR_REF(msg).msg.api_call.sem=&call->sem; +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ +sys_mbox_post(&mbox,&TCPIP_MSG_VAR_REF(msg)); +sys_arch_sem_wait(TCPIP_MSG_VAR_REF(msg).msg.api_call.sem,0); +TCPIP_MSG_VAR_FREE(msg); + +#if!LWIP_NETCONN_SEM_PER_THREAD +sys_sem_free(&call->sem); +#endif/*LWIP_NETCONN_SEM_PER_THREAD*/ + +returncall->err; +#endif/*LWIP_TCPIP_CORE_LOCKING*/ +} + +structtcpip_callback_msg* +tcpip_callbackmsg_new(tcpip_callback_fnfunction,void*ctx){ +structtcpip_msg*msg=(structtcpip_msg*)memp_malloc(MEMP_TCPIP_MSG_API); +if(msg==NULL){ +returnNULL; +} +msg->type=TCPIP_MSG_CALLBACK_STATIC; +msg->msg.cb.function=function; +msg->msg.cb.ctx=ctx; +return(structtcpip_callback_msg*)msg; +} + +voidtcpip_callbackmsg_delete(structtcpip_callback_msg*msg){ +memp_free(MEMP_TCPIP_MSG_API,msg); +} + +err_ttcpip_trycallback(structtcpip_callback_msg*msg){ +LWIP_ASSERT("Invalidmbox",sys_mbox_valid_val(mbox)); +returnsys_mbox_trypost(&mbox,msg); +} + +voidtcpip_init(tcpip_init_done_fninitfunc,void*arg){ +lwip_init(); + +tcpip_init_done=initfunc; +tcpip_init_done_arg=arg; +if(sys_mbox_new(&mbox,TCPIP_MBOX_SIZE)!=ERR_OK){ +LWIP_ASSERT("failedtocreatetcpip_threadmbox",0); +} +#ifLWIP_TCPIP_CORE_LOCKING +if(sys_mutex_new(&lock_tcpip_core)!=ERR_OK){ +LWIP_ASSERT("failedtocreatelock_tcpip_core",0); +} +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +sys_thread_new(TCPIP_THREAD_NAME,tcpip_thread,NULL,TCPIP_THREAD_STACKSIZE,TCPIP_THREAD_PRIO); +} + +staticvoidpbuf_free_int(void*p){ +structpbuf*q=(structpbuf*)p; +pbuf_free(q); +} + +err_tpbuf_free_callback(structpbuf*p){ +returntcpip_callback_with_block(pbuf_free_int,p,0); +} + +err_tmem_free_callback(void*m){ +returntcpip_callback_with_block(mem_free,m,0); +} + +#endif/*!NO_SYS*/ - + diff --git a/doc/xml/tcpip_8h.xml b/doc/xml/tcpip_8h.xml index 7da962e..61d20fb 100644 --- a/doc/xml/tcpip_8h.xml +++ b/doc/xml/tcpip_8h.xml @@ -1,329 +1,755 @@ - - - + + + tcpip.h - net/api_msg.h - net/pbuf.h - src/sys/net/api/api_msg.c - src/sys/net/api/tcpip.c - src/sys/net/net/init.c + net/opt.h + net/err.h + net/timeouts.h + net/netif.h + C:/Dev/git/UbixOS/sys/include/net/priv/tcpip_priv.h + C:/Dev/git/UbixOS/sys/net/net/init.c + C:/Dev/git/UbixOS/sys/net/netif/ethernetif.c - - - - + + + + - - - - - - - - - + - - - + + + - - - - + + + + + + + + - + - - - - - + - - - - - - - - - - - - + + + + - - - + + + - - - - - - - - + + + + - - - - - - - - - - - + - - - - + + + + + + + + - - - - - - - - + + + + - + - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - + - + + + + + - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + + + + + + + + + - - - - - - - - - - - + - + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + - + - + - - - + + + + + + + + + - - - + + + + + + + + + + + + + + + - tcpip_msg - - - tcpip_msg_type - - TCPIP_MSG_API - - - - - - - TCPIP_MSG_INPUT - - - - - + + + LOCK_TCPIP_CORE + - + + + + tcpip_callback + f + ctx + tcpip_callback_with_block(f, ctx, 1) + + + +tcpip_callback_with_block + + + + + + + + + UNLOCK_TCPIP_CORE + + + + + + + + + + + + + void(* + typedef void(* tcpip_callback_fn) (void *ctx) + )(void *ctx) + tcpip_callback_fn + + + +Function prototype for functions passed to tcpip_callback() + + + + + + + void(* + typedef void(* tcpip_init_done_fn) (void *arg) + )(void *arg) + tcpip_init_done_fn + + + +Function prototype for the init_done function passed to tcpip_init + + + + - - void - void tcpip_apimsg - (struct api_msg *apimsg) - tcpip_apimsg + + err_t + err_t mem_free_callback + (void *m) + mem_free_callback - struct api_msg * - apimsg + void * + m +A simple wrapper function that allows you to free heap memory from interrupt context. + + +m + + +the heap memory to free + + + +ERR_OK if callback could be enqueued, an err_t if not + + - - tcpip_msg::apimsg - mbox - memp_free - memp_mallocp - MEMP_TCPIP_MSG - tcpip_msg::msg - NULL - sys_mbox_post - TCPIP_MSG_API - api_msg_post + + mem_free + tcpip_callback_with_block - + + err_t + err_t pbuf_free_callback + (struct pbuf *p) + pbuf_free_callback + + struct pbuf * + p + + + + +A simple wrapper function that allows you to free a pbuf from interrupt context. + + +p + + +The pbuf (chain) to be dereferenced. + + + +ERR_OK if callback could be enqueued, an err_t if not + + + + + + + tcpip_callback_with_block + + + err_t + err_t tcpip_callback_with_block + (tcpip_callback_fn function, void *ctx, u8_t block) + tcpip_callback_with_block + + tcpip_callback_fn + function + + + void * + ctx + + + u8_t + block + + + + +Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. + + +function + + +the function to call + + + + +ctx + + +parameter passed to f + + + + +block + + +1 to block until the request is posted, 0 to non-blocking mode + + + +ERR_OK if the function was called, another err_t if not + + + + + + + LWIP_ASSERT + tcpip_msg::msg + sys_mbox_valid_val + mem_free_callback + pbuf_free_callback + + + void + void tcpip_callbackmsg_delete + (struct tcpip_callback_msg *msg) + tcpip_callbackmsg_delete + + struct tcpip_callback_msg * + msg + + + + +Free a callback message allocated by tcpip_callbackmsg_new(). + + +msg + + +the message to free + + + + + + + + + memp_free + tcpip_msg::msg + + + struct tcpip_callback_msg * + struct tcpip_callback_msg* tcpip_callbackmsg_new + (tcpip_callback_fn function, void *ctx) + tcpip_callbackmsg_new + + tcpip_callback_fn + function + + + void * + ctx + + + + +Allocate a structure for a static callback message and initialize it. This is intended to be used to send "static" messages from interrupt context. + + +function + + +the function to call + + + + +ctx + + +parameter passed to function + + + +a struct pointer to pass to tcpip_trycallback(). + + + + + + + tcpip_msg::ctx + memp_malloc + tcpip_msg::msg + NULL + TCPIP_MSG_CALLBACK_STATIC + + void void tcpip_init - (void(*tcpip_init_done)(void *), void *arg) + (tcpip_init_done_fn tcpip_init_done, void *arg) tcpip_init - void(*)(void *) + tcpip_init_done_fn tcpip_init_done + initfunc void * @@ -332,21 +758,101 @@ +Initialize this module: +initialize all sub modules +start the tcpip_thread + + + + +initfunc + + +a function to call when tcpip_thread is running and finished initializing + + + + +arg + + +argument to pass to initfunc + + + + - - mbox - NULL - sys_mbox_new - sys_thread_new - tcpip_init_done - tcpip_init_done_arg - tcpip_thread - netMainThread + + lwip_init + net_init - - err_t + + err_t + err_t tcpip_inpkt + (struct pbuf *p, struct netif *inp, netif_input_fn input_fn) + tcpip_inpkt + + struct pbuf * + p + + + struct netif * + inp + + + netif_input_fn + input_fn + + + + +Pass a received packet to tcpip_thread for input processing + + +p + + +the received packet + + + + +inp + + +the network interface on which the packet was received + + + + +input_fn + + +input function to call + + + + + + + + + tcpip_msg::inp + tcpip_msg::input_fn + LOCK_TCPIP_CORE + LWIP_ASSERT + LWIP_DEBUGF + tcpip_msg::msg + tcpip_msg::p + sys_mbox_valid_val + TCPIP_DEBUG + UNLOCK_TCPIP_CORE + tcpip_input + + + err_t err_t tcpip_input (struct pbuf *p, struct netif *inp) tcpip_input @@ -361,94 +867,172 @@ +Pass a received packet to tcpip_thread for input processing with ethernet_input or ip_input. Don't call directly, pass to netif_add() and call netif->input(). + + +p + + +the received packet, p->payload pointing to the Ethernet header or to an IP header (if inp doesn't have NETIF_FLAG_ETHARP or NETIF_FLAG_ETHERNET flags) + + + + +inp + + +the network interface on which the packet was received + + + + - - ERR_MEM - ERR_OK - tcpip_msg::inp - mbox - memp_mallocp - MEMP_TCPIP_MSG - tcpip_msg::msg - NULL - tcpip_msg::p - pbuf_free - sys_mbox_post - TCPIP_MSG_INPUT - netMainThread + + tcpip_msg::inp + NETIF_FLAG_ETHARP + NETIF_FLAG_ETHERNET + tcpip_msg::p + tcpip_inpkt + net_init + netif_init + + + err_t + err_t tcpip_trycallback + (struct tcpip_callback_msg *msg) + tcpip_trycallback + + struct tcpip_callback_msg * + msg + + + + +Try to post a callback-message to the tcpip_thread mbox This is intended to be used to send "static" messages from interrupt context. + + +msg + + +pointer to the message to post + + + +sys_mbox_trypost() return code + + + + + + + LWIP_ASSERT + sys_mbox_valid_val +Functions to sync with TCPIP thread -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> -* -*$Id: tcpip_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_TCPIP_H__ -#define__LWIP_TCPIP_H__ - -#include"net/api_msg.h" -#include"net/pbuf.h" - -voidtcpip_init(void(*tcpip_init_done)(void*),void*arg); -voidtcpip_apimsg(structapi_msg*apimsg); -err_ttcpip_input(structpbuf*p,structnetif*inp); - -enumtcpip_msg_type{ -TCPIP_MSG_API, -TCPIP_MSG_INPUT -}; - -structtcpip_msg{ -enumtcpip_msg_typetype; -sys_sem_t*sem; -union{ -structapi_msg*apimsg; -struct{ -structpbuf*p; -structnetif*netif; -}inp; -}msg; -}; - - -#endif/*__LWIP_TCPIP_H__*/ + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. +* +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_TCPIP_H +#defineLWIP_HDR_TCPIP_H + +#include"net/opt.h" + +#if!NO_SYS/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include"net/err.h" +#include"net/timeouts.h" +#include"net/netif.h" + +#ifdef__cplusplus +extern"C"{ +#endif + +#ifLWIP_TCPIP_CORE_LOCKING + +externsys_mutex_tlock_tcpip_core; +#defineLOCK_TCPIP_CORE()sys_mutex_lock(&lock_tcpip_core) + +#defineUNLOCK_TCPIP_CORE()sys_mutex_unlock(&lock_tcpip_core) +#else/*LWIP_TCPIP_CORE_LOCKING*/ +#defineLOCK_TCPIP_CORE() +#defineUNLOCK_TCPIP_CORE() +#endif/*LWIP_TCPIP_CORE_LOCKING*/ + +structpbuf; +structnetif; + +typedefvoid(*tcpip_init_done_fn)(void*arg); +typedefvoid(*tcpip_callback_fn)(void*ctx); + +/*Forwarddeclarations*/ +structtcpip_callback_msg; + +voidtcpip_init(tcpip_init_done_fntcpip_init_done,void*arg); + +err_ttcpip_inpkt(structpbuf*p,structnetif*inp,netif_input_fninput_fn); +err_ttcpip_input(structpbuf*p,structnetif*inp); + +err_ttcpip_callback_with_block(tcpip_callback_fnfunction,void*ctx,u8_tblock); +#definetcpip_callback(f,ctx)tcpip_callback_with_block(f,ctx,1) + +structtcpip_callback_msg*tcpip_callbackmsg_new(tcpip_callback_fnfunction,void*ctx); +voidtcpip_callbackmsg_delete(structtcpip_callback_msg*msg); +err_ttcpip_trycallback(structtcpip_callback_msg*msg); + +/*freepbufsorheapmemoryfromanothercontextwithoutblocking*/ +err_tpbuf_free_callback(structpbuf*p); +err_tmem_free_callback(void*m); + +#ifLWIP_TCPIP_TIMEOUT&&LWIP_TIMERS +err_ttcpip_timeout(u32_tmsecs,sys_timeout_handlerh,void*arg); +err_ttcpip_untimeout(sys_timeout_handlerh,void*arg); +#endif/*LWIP_TCPIP_TIMEOUT&&LWIP_TIMERS*/ + +#ifdef__cplusplus +} +#endif + +#endif/*!NO_SYS*/ + +#endif/*LWIP_HDR_TCPIP_H*/ - + diff --git a/doc/xml/thread_8c.xml b/doc/xml/thread_8c.xml index 139952f..a43be04 100644 --- a/doc/xml/thread_8c.xml +++ b/doc/xml/thread_8c.xml @@ -1,157 +1,467 @@ - - - + + + thread.c - ubixfs/ubixfs.h + ubixfs/ubixfs.h ubixos/kpanic.h - vfs/vfs.h + vfs/vfs.h lib/kprintf.h - - - - + + + + + + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - - - - + - - - - + + + + - - - + - - - - + + + + - - - - - - + + + + - - - - + + + + - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - + + + + - - - - + + + + - + - - - - - + - - - - - - - - - - - + + + + int + int mounts + + mounts + + + + + + + + + + struct @0 + struct @0 ubixFS_Info + + ubixFS_Info + + + + + + + + + - + void void ubixfs_thread (struct vfs_mountPoint *mp) @@ -166,42 +476,7 @@ - - mpi_message::header - kpanic - kprintf - mpi_createMbox - mpi_fetchMessage - ubixFS_Info - - - - - int - int mounts - - mounts - - - - - - - - - - struct @9 - struct @9 ubixFS_Info - - ubixFS_Info - - - - - - - - ubixfs_thread + @@ -234,46 +509,43 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: thread_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:thread.c542016-01-1101:29:55Zreddawg$ *****************************************************************************************/ -#include<ubixfs/ubixfs.h> +#include<ubixfs/ubixfs.h> #include<ubixos/kpanic.h> -#include<vfs/vfs.h> +#include<vfs/vfs.h> #include<lib/kprintf.h> staticstruct{ -intmounts; -}ubixFS_Info; - -voidubixfs_thread(structvfs_mountPoint*mp){ +intmounts; +}ubixFS_Info; + +voidubixfs_thread(structvfs_mountPoint*mp){ mpi_message_tmyMsg; -ubixFS_Info.mounts=0; +ubixFS_Info.mounts=0; if(mp==0x0) -kpanic("bah"); +kpanic("bah"); -if(mpi_createMbox("ubixfs")!=0x0){ -kpanic("Error:Errorcreatingmailbox:ubixfs\n"); +if(mpi_createMbox("ubixfs")!=0x0){ +kpanic("Error:Errorcreatingmailbox:ubixfs\n"); } while(1){ -if(mpi_fetchMessage("ubixfs",&myMsg)==0x0){ -switch(myMsg.header){ +if(mpi_fetchMessage("ubixfs",&myMsg)==0x0){ +switch(myMsg.header){ default: -kprintf("UnhandledMessage:%i\n",myMsg.header); +kprintf("UnhandledMessage:%i\n",myMsg.header); break; } } } } -/*** -$Log: thread_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - +/*** +$Log:thread.c,v$ Revision1.22006/12/0514:10:21reddawg WorkignDistro @@ -300,6 +572,6 @@ END ***/ - + diff --git a/doc/xml/thread_8h.xml b/doc/xml/thread_8h.xml index cb88d20..f35ad9d 100644 --- a/doc/xml/thread_8h.xml +++ b/doc/xml/thread_8h.xml @@ -1,699 +1,1305 @@ - - - + + + thread.h - ubixos/types.h - src/sys/include/sys/gen_calls.h - src/sys/include/sys/kern_descrip.h - src/sys/include/sys/kern_sig.h - src/sys/include/sys/kern_sysctl.h - src/sys/include/sys/pipe.h - src/sys/include/sys/sysproto.h - src/sys/include/ubixos/sched.h - src/sys/include/vfs/vfs.h - src/sys/include/vmm/paging.h - src/sys/kernel/gen_calls.c - src/sys/kernel/kern_descrip.c - src/sys/kernel/kern_sig.c - src/sys/kernel/kern_sysctl.c - src/sys/kernel/pipe.c + sys/types.h + sys/trap.h + sys/signal.h + sys/resource.h + C:/Dev/git/UbixOS/sys/include/sys/descrip.h + C:/Dev/git/UbixOS/sys/include/sys/gen_calls.h + C:/Dev/git/UbixOS/sys/include/sys/kern_sig.h + C:/Dev/git/UbixOS/sys/include/sys/kern_sysctl.h + C:/Dev/git/UbixOS/sys/include/sys/pipe.h + C:/Dev/git/UbixOS/sys/include/sys/sysproto.h + C:/Dev/git/UbixOS/sys/include/sys/sysproto_posix.h + C:/Dev/git/UbixOS/sys/include/ubixos/sched.h + C:/Dev/git/UbixOS/sys/include/vfs/file.h + C:/Dev/git/UbixOS/sys/include/vfs/vfs.h + C:/Dev/git/UbixOS/sys/include/vmm/paging.h + C:/Dev/git/UbixOS/sys/kernel/descrip.c + C:/Dev/git/UbixOS/sys/kernel/execve.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_pipe.c + C:/Dev/git/UbixOS/sys/kernel/kern_sig.c + C:/Dev/git/UbixOS/sys/kernel/kern_sysctl.c + C:/Dev/git/UbixOS/sys/kernel/pipe.c + C:/Dev/git/UbixOS/sys/kernel/signal.c + C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c - - - - + + + + - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + - + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + + + - - - - - - - - - - - - - - - - + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thread - + O_FILES - 64 + 512 - - getdtablesize + @@ -701,56 +1307,61 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: thread_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_THREAD_H -#define_THREAD_H - -#include<ubixos/types.h> - -#defineO_FILES64 - -structthread{ -inttd_retval[2]; -uint32_to_files[O_FILES]; -char*vm_daddr; -int32_tvm_dsize; -}; - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_THREAD_H +#define_SYS_THREAD_H + +#include<sys/types.h> +#include<sys/trap.h> +#include<sys/signal.h> +#include<sys/resource.h> + +//#defineO_FILES64 +#defineO_FILES512 + +structthread{ +inttd_retval[2]; +void*o_files[O_FILES]; +u_longvm_daddr; +u_longvm_dsize; +u_longvm_taddr; +u_longvm_tsize; +structtrapframe*frame; +intabi; +sigset_tsigmask; +structsigactionsigact[128]; +structrlimitrlim[RLIM_NLIMITS]; +}; + +#endif/*END_SYS_THREAD_H*/ - + diff --git a/doc/xml/time_8c.xml b/doc/xml/time_8c.xml index 6d81700..6092331 100644 --- a/doc/xml/time_8c.xml +++ b/doc/xml/time_8c.xml @@ -1,162 +1,438 @@ - - - + + + time.c - ubixos/types.h ubixos/time.h ubixos/vitals.h lib/kprintf.h assert.h - - - - + + + + + + - - - - - - - - - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + int + int month[12] + [12] + month + = { 0, +DAY * (31), +DAY * (31 + 29), +DAY * (31 + 29 + 31), +DAY * (31 + 29 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31), +DAY * (31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30) } + + + + + + + + + - + int int gettimeofday (struct timeval *tp, struct timezone *tzp) @@ -175,11 +451,19 @@ - - timeval::tv_sec - timeval::tv_usec + + systemVitals + vitalsStruct::sysUptime + vitalsStruct::timeStart + timeval::tv_sec + timeval::tv_usec + timezone::tz_dsttime + timezone::tz_minuteswest + sys_gettimeofday + sys_init + sys_unix_now - + int int time_init () @@ -190,21 +474,9 @@ - - BCD_TO_BIN - timeStruct::day - timeStruct::hour - kprintf - timeStruct::min - timeStruct::mon - timeStruct::sec - systemVitals - timeCmosRead - timeMake - vitalsStruct::timeStart - timeStruct::year + - + int static int timeCmosRead (int addr) @@ -219,14 +491,11 @@ - - inportByte - outportByteP - time_init + - - uInt32 - uInt32 timeMake + + uint32_t + uint32_t timeMake (struct timeStruct *time) timeMake @@ -239,49 +508,10 @@ - - timeStruct::day - DAY - timeStruct::hour - HOUR - timeStruct::min - MINUTE - timeStruct::mon - month - timeStruct::sec - YEAR - timeStruct::year - time_init - - - - - int - int month[12] - [12] - month - { - 0, - DAY*(31), - DAY*(31+29), - DAY*(31+29+31), - DAY*(31+29+31+30), - DAY*(31+29+31+30+31), - DAY*(31+29+31+30+31+30), - DAY*(31+29+31+30+31+30+31), - DAY*(31+29+31+30+31+30+31+31), - DAY*(31+29+31+30+31+30+31+31+30), - DAY*(31+29+31+30+31+30+31+31+30+31), - DAY*(31+29+31+30+31+30+31+31+30+31+30) -} - - - - - - - - timeMake + + DAY + YEAR + timeStruct::year @@ -289,127 +519,125 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: time_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/types.h> -#include<ubixos/time.h> -#include<ubixos/vitals.h> -#include<lib/kprintf.h> -#include<assert.h> - -staticintmonth[12]={ -0, -DAY*(31), -DAY*(31+29), -DAY*(31+29+31), -DAY*(31+29+31+30), -DAY*(31+29+31+30+31), -DAY*(31+29+31+30+31+30), -DAY*(31+29+31+30+31+30+31), -DAY*(31+29+31+30+31+30+31+31), -DAY*(31+29+31+30+31+30+31+31+30), -DAY*(31+29+31+30+31+30+31+31+30+31), -DAY*(31+29+31+30+31+30+31+31+30+31+30) -}; - -staticinttimeCmosRead(intaddr){ -outportByteP(0x70,addr); -return((int)inportByte(0x71)); -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/time.h> +#include<ubixos/vitals.h> +#include<lib/kprintf.h> +#include<assert.h> + +staticintmonth[12]={0, +DAY*(31), +DAY*(31+29), +DAY*(31+29+31), +DAY*(31+29+31+30), +DAY*(31+29+31+30+31), +DAY*(31+29+31+30+31+30), +DAY*(31+29+31+30+31+30+31), +DAY*(31+29+31+30+31+30+31+31), +DAY*(31+29+31+30+31+30+31+31+30), +DAY*(31+29+31+30+31+30+31+31+30+31), +DAY*(31+29+31+30+31+30+31+31+30+31+30)}; + +staticinttimeCmosRead(intaddr){ +outportByteP(0x70,addr); +return((int)inportByte(0x71)); +} + +inttime_init(){ +inti; +structtimeStructtime; -inttime_init(){ -inti; -structtimeStructtime; - -for(i=0;i<1000000;i++){ -if(!(timeCmosRead(10)&0x80)){ -break; -} -} - -do{ -time.sec=timeCmosRead(0); -time.min=timeCmosRead(2); -time.hour=timeCmosRead(4); -time.day=timeCmosRead(7); -time.mon=timeCmosRead(8); -time.year=timeCmosRead(9); -}while(time.sec!=timeCmosRead(0)); - -BCD_TO_BIN(time.sec); -BCD_TO_BIN(time.min); -BCD_TO_BIN(time.hour); -BCD_TO_BIN(time.day); -BCD_TO_BIN(time.mon); -BCD_TO_BIN(time.year); - -/*Setupourstarttimeinseconds*/ -systemVitals->timeStart=timeMake(&time); - -kprintf("%i/%i/%i%i:%i.%i\n",time.mon,time.day,time.year,time.hour,time.min,time.sec); +for(i=0;i<1000000;i++){ +if(!(timeCmosRead(10)&0x80)){ +break; +} +} + +do{ +time.sec=timeCmosRead(0); +time.min=timeCmosRead(2); +time.hour=timeCmosRead(4); +time.day=timeCmosRead(7); +time.mon=timeCmosRead(8); +time.year=timeCmosRead(9); +}while(time.sec!=timeCmosRead(0)); + +BCD_TO_BIN(time.sec); +BCD_TO_BIN(time.min); +BCD_TO_BIN(time.hour); +BCD_TO_BIN(time.day); +BCD_TO_BIN(time.mon); +BCD_TO_BIN(time.year); + +/*Setupourstarttimeinseconds*/ +systemVitals->timeStart=timeMake(&time); + +kprintf("%i/%i/%i%i:%i.%i\n",time.mon,time.day,time.year,time.hour,time.min,time.sec); + +/*Returnsoweknowallwentwell*/ +return(0x0); +} - -/*Returnsoweknowallwentwell*/ -return(0x0); -} - -uInt32timeMake(structtimeStruct*time){ -uInt32res; -intyear; +uint32_ttimeMake(structtimeStruct*time){ +uint32_tres; +intyear; + +year=(time->year+100)-70; + +/*magicoffsets(y+1)neededtogetleapyearsright.*/ +res=YEAR*year+DAY*((year+1)/4); -year=(time->year+100)-70; -/*magicoffsets(y+1)neededtogetleapyearsright.*/ -res=YEAR*year+DAY*((year+1)/4); -res+=month[time->mon]; -/*and(y+2)here.Ifitwasn'taleap-year,wehavetoadjust*/ -if(time->mon>1&&((year+2)%4)) -res-=DAY; -res+=DAY*(time->day-1); -res+=HOUR*time->hour; -res+=MINUTE*time->min; -res+=time->sec; -return(res); -} +res+=month[time->mon]; + +/*and(y+2)here.Ifitwasn'taleap-year,wehavetoadjust*/ +if(time->mon>1&&((year+2)%4)) +res-=DAY; + +res+=DAY*(time->day-1); +res+=HOUR*time->hour; +res+=MINUTE*time->min; +res+=time->sec; + +return(res); +} -intgettimeofday(structtimeval*tp,structtimezone*tzp){ -//tp->tv_sec=systemVitals->timeStart+systemVitals->sysUptime; -tp->tv_sec=0x0;//systemVitals->sysUptime; -tp->tv_usec=0x0; -return(0x0); -} +intgettimeofday(structtimeval*tp,structtimezone*tzp){ +tp->tv_sec=systemVitals->timeStart+systemVitals->sysUptime; +tp->tv_usec=0x0; + +tzp->tz_minuteswest=(-5*60); +tzp->tz_dsttime=0x0; -/*** -END -***/ - +return(0x0); +} - + diff --git a/doc/xml/time_8h.xml b/doc/xml/time_8h.xml index 313bebc..9a5a0a4 100644 --- a/doc/xml/time_8h.xml +++ b/doc/xml/time_8h.xml @@ -1,168 +1,1817 @@ - - - + + + time.h - ubixos/types.h + sys/types.h + sys/_timespec.h sys/io.h - src/sys/include/ubixos/init.h - src/sys/include/ubixos/ubthread.h - src/sys/kernel/syscall.c - src/sys/kernel/time.c - src/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/include/net/arch/cc.h + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/ubixos/ubthread.h + C:/Dev/git/UbixOS/sys/kernel/sem.c + C:/Dev/git/UbixOS/sys/kernel/time.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + + + - - + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + - - - + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - timespec timeStruct - timeval timezone - + BCD_TO_BIN val ((val)=((val)&15) + ((val)>>4)*10) @@ -172,34 +1821,31 @@ - - time_init + - + DAY - (24*HOUR) + (24*HOUR) - - timeMake + - + HOUR - (60*MINUTE) + (60*MINUTE) - - timeMake + - + MINUTE 60 @@ -208,24 +1854,22 @@ - - timeMake + - + YEAR - (365*DAY) + (365*DAY) - - timeMake + - + long typedef long suseconds_t @@ -236,24 +1880,11 @@ - - - - __time_t - typedef __time_t time_t - - time_t - - - - - - - + - + int int gettimeofday (struct timeval *tp, struct timezone *tzp) @@ -272,11 +1903,19 @@ - - timeval::tv_sec - timeval::tv_usec + + systemVitals + vitalsStruct::sysUptime + vitalsStruct::timeStart + timeval::tv_sec + timeval::tv_usec + timezone::tz_dsttime + timezone::tz_minuteswest + sys_gettimeofday + sys_init + sys_unix_now - + int int time_init () @@ -287,22 +1926,10 @@ - - BCD_TO_BIN - timeStruct::day - timeStruct::hour - kprintf - timeStruct::min - timeStruct::mon - timeStruct::sec - systemVitals - timeCmosRead - timeMake - vitalsStruct::timeStart - timeStruct::year + - - uInt32 + + uInt32 uInt32 timeMake (struct timeStruct *time) timeMake @@ -316,19 +1943,10 @@ - - DAY - timeStruct::day - HOUR - timeStruct::hour - timeStruct::min - MINUTE - timeStruct::mon - month - timeStruct::sec - timeStruct::year - YEAR - time_init + + DAY + YEAR + timeStruct::year @@ -336,118 +1954,96 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: time_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_TIME_H -#define_TIME_H - -#include<ubixos/types.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_TIME_H +#define_UBIXOS_TIME_H + +#include<sys/types.h> +#include<sys/_timespec.h> #include<sys/io.h> -typedeflongsuseconds_t; +typedeflongsuseconds_t; -#defineBCD_TO_BIN(val)((val)=((val)&15)+((val)>>4)*10) - -#defineMINUTE60 -#defineHOUR(60*MINUTE) -#defineDAY(24*HOUR) -#defineYEAR(365*DAY) - -#ifndef_TIME_T_DECLARED -typedef__time_ttime_t; -#define_TIME_T_DECLARED -#endif - -structtimespec{ -time_ttv_sec;/*seconds*/ -longtv_nsec;/*andnanoseconds*/ +#defineBCD_TO_BIN(val)((val)=((val)&15)+((val)>>4)*10) + +#defineMINUTE60 +#defineHOUR(60*MINUTE) +#defineDAY(24*HOUR) +#defineYEAR(365*DAY) + + +structtimeStruct{ +intsec; +intmin; +inthour; +intday; +intmon; +intyear; }; - - -structtimeStruct{ -intsec; -intmin; -inthour; -intday; -intmon; -intyear; -}; - +structtimezone{ +inttz_minuteswest;/*minuteswestofGreenwich*/ +inttz_dsttime;/*typeofdstcorrection*/ +}; + +intgettimeofday(structtimeval*tp,structtimezone*tzp); + +inttime_init(); +uInt32timeMake(structtimeStruct*time); + +#endif -structtimezone{ -inttz_minuteswest;/*minuteswestofGreenwich*/ -inttz_dsttime;/*typeofdstcorrection*/ -}; - -structtimeval{ -longtv_sec;/*seconds(XXXshouldbetime_t)*/ -suseconds_ttv_usec;/*andmicroseconds*/ -}; - -intgettimeofday(structtimeval*tp,structtimezone*tzp); - - - -inttime_init(); -uInt32timeMake(structtimeStruct*time); - -#endif - -/*** -$Log: time_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:56reddawg -nomessage - -Revision1.42004/07/0913:37:30reddawg -time:timeInittotime_init -Adjustedinitializationroutines - -Revision1.32004/06/2911:41:44reddawg -Fixedsomeglobalvariables - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - -END -***/ +/*** +$Log:time.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:23:56reddawg +nomessage + +Revision1.42004/07/0913:37:30reddawg +time:timeInittotime_init +Adjustedinitializationroutines + +Revision1.32004/06/2911:41:44reddawg +Fixedsomeglobalvariables + +Revision1.22004/05/2115:20:00reddawg +Cleanedup + +END +***/ - + diff --git a/doc/xml/times_8h.xml b/doc/xml/times_8h.xml index bf69213..f001a13 100644 --- a/doc/xml/times_8h.xml +++ b/doc/xml/times_8h.xml @@ -1,33 +1,93 @@ - - - + + + times.h - ubixos/types.h - sys/_types.h + sys/types.h + C:/Dev/git/UbixOS/sys/include/net/arch/perf.h - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + tms + + + _CLOCK_T_DECLARED + + + + + + + + + - - __clock_t + + __clock_t typedef __clock_t clock_t clock_t @@ -37,7 +97,7 @@ - + @@ -45,76 +105,71 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: times_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_TIMES_H -#define_TIMES_H - -#include<ubixos/types.h> -#include<sys/_types.h> - -#ifndef_CLOCK_T_DECLARED -typedef__clock_tclock_t; -#define_CLOCK_T_DECLARED -#endif - -structtms{ -clock_ttms_utime;/*UserCPUtime*/ -clock_ttms_stime;/*SystemCPUtime*/ -clock_ttms_cutime;/*UserCPUtimeofterminatedchildprocs*/ -clock_ttms_cstime;/*SystemCPUtimeofterminatedchildprocs*/ -}; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_TIMES_H +#define_TIMES_H + +#include<sys/types.h> + +#ifndef_CLOCK_T_DECLARED +typedef__clock_tclock_t; +#define_CLOCK_T_DECLARED +#endif + +structtms{ +clock_ttms_utime;/*UserCPUtime*/ +clock_ttms_stime;/*SystemCPUtime*/ +clock_ttms_cutime;/*UserCPUtimeofterminatedchildprocs*/ +clock_ttms_cstime;/*SystemCPUtimeofterminatedchildprocs*/ +}; + +#endif -#endif - -/*** -$Log: times_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:57reddawg -nomessage - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ +/*** +$Log:times.h,v$ +Revision1.1.1.12006/06/0112:46:14reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:23:57reddawg +nomessage + +Revision1.22004/05/2115:20:00reddawg +Cleanedup + + +END +***/ - + diff --git a/doc/xml/trap_8h.xml b/doc/xml/trap_8h.xml index 28f70e1..a66a612 100644 --- a/doc/xml/trap_8h.xml +++ b/doc/xml/trap_8h.xml @@ -1,96 +1,1441 @@ - - - + + + trap.h - src/sys/kernel/syscall.c - src/sys/kernel/syscall_new.c - - - - - - - - - - - - - + i386/cpu.h + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/i386/trap.c + C:/Dev/git/UbixOS/sys/include/sys/thread.h + C:/Dev/git/UbixOS/sys/include/ubixos/syscall.h + C:/Dev/git/UbixOS/sys/include/ubixos/syscall_posix.h + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/syscall_posix.c + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/pagefault.c + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + trapframe + + + void + void die_if_kernel + (char *str, struct trapframe *regs, long err) + die_if_kernel + + char * + str + + + struct trapframe * + regs + + + long + err + + + + + + + + + kprintf + trapframe::tf_cs + trapframe::tf_ds + trapframe::tf_eax + trapframe::tf_ebp + trapframe::tf_ebx + trapframe::tf_ecx + trapframe::tf_edi + trapframe::tf_edx + trapframe::tf_eflags + trapframe::tf_eip + trapframe::tf_err + trapframe::tf_es + trapframe::tf_esi + trapframe::tf_esp + trapframe::tf_fs + trapframe::tf_gs + trapframe::tf_ss + trapframe::tf_trapno + __alignmentCheck + __debug + __divideError + __doubleFault + __floatingPoint + __machineCheck + __nmi + __security + __simd + __virtualization + _intNull + sys_call + sys_call_posix + + + void + void trap + (struct trapframe *) + trap + + struct trapframe * + + + + + + + + + trapframe::tf_trapno + + -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: trap_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_TRAP_H -#define_TRAP_H - -structtrapframe{ -inttf_fs; -inttf_es; -inttf_ds; -inttf_edi; -inttf_esi; -inttf_ebp; -inttf_isp; -inttf_ebx; -inttf_edx; -inttf_ecx; -inttf_eax; -inttf_trapno; -/*belowportiondefinedin386hardware*/ -inttf_err; -inttf_eip; -inttf_cs; -inttf_eflags; -/*belowonlywhencrossingrings(e.g.usertokernel)*/ -inttf_esp; -inttf_ss; -}; - - -#endif - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_TRAP_H +#define_SYS_TRAP_H + +#include<i386/cpu.h> + +structtrapframe{ +inttf_gs; +inttf_fs; +inttf_es; +inttf_ds; +inttf_edi; +inttf_esi; +inttf_ebp; +inttf_isp; +inttf_ebx; +inttf_edx; +inttf_ecx; +inttf_eax; +inttf_trapno; +/*belowportiondefinedin386hardware*/ +inttf_err; +inttf_eip; +inttf_cs; +inttf_eflags; +/*belowonlywhencrossingrings(e.g.usertokernel)*/ +inttf_esp; +inttf_ss; +}; + +voiddie_if_kernel(char*str,structtrapframe*regs,longerr); +voidtrap(structtrapframe*); + +#endif/*END_SYS_TRAP_H*/ - + diff --git a/doc/xml/tss_8h.xml b/doc/xml/tss_8h.xml index a819b9e..d5977f9 100644 --- a/doc/xml/tss_8h.xml +++ b/doc/xml/tss_8h.xml @@ -1,413 +1,724 @@ - - - + + + tss.h - ubixos/types.h - src/sys/include/ubixos/sched.h - src/sys/init/main.c - src/sys/kernel/bioscall.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/include/ubixos/sched.h + C:/Dev/git/UbixOS/sys/init/main.c - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + - + - + - + - + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + + + + + + + + + + + + + - - - - - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i386_frame @@ -418,150 +729,116 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: tss_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_TSS_H -#define_TSS_H - -#include<ubixos/types.h> - -structtssStruct{ -shortback_link; -shortback_link_reserved; -longesp0; -shortss0; -shortss0_reserved; -longesp1; -shortss1; -shortss1_reserved; -longesp2; -shortss2; -shortss2_reserved; -longcr3; -longeip; -longeflags; -longeax,ecx,edx,ebx; -longesp; -longebp; -longesi; -longedi; -shortes; -shortes_reserved; -shortcs; -shortcs_reserved; -shortss; -shortss_reserved; -shortds; -shortds_reserved; -shortfs; -shortfs_reserved; -shortgs; -shortgs_reserved; -shortldt; -shortldt_reserved; -shorttrace_bitmap; -shortio_map; -chario_space[8192]; -}; - -structi387Struct{ -longcwd; -longswd; -longtwd; -longfip; -longfcs; -longfoo; -longfos; -longst_space[20];/*8*10bytesforeachFP-reg=80bytes*/ -}; - -structi386_frame{ -uInt32gs; -uInt32fs; -uInt32es; -uInt32ds; -uInt32ss; -uInt32edi; -uInt32esi; -uInt32ebp; -uInt32esp; -uInt32ebx; -uInt32edx; -uInt32ecx; -uInt32eax; -/* -uInt32vector; -uInt32error_code; -*/ -uInt32eip; -uInt32cs; -uInt32flags; -uInt32user_esp; -uInt32user_ss; -}; - -#endif - -/*** -$Log: tss_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:53reddawg -nomessage - -Revision1.62004/07/2707:42:29reddawg -*burp* - -Revision1.52004/07/2707:40:41reddawg -doesitcompilenow? - -Revision1.42004/07/2707:27:50reddawg -chg:Iwasfooledthoughtwefailedbutitwasacastingissue - -Revision1.32004/07/2220:53:07reddawg -atkbd:fixedproblem - -Revision1.22004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_TSS_H +#define_SYS_TSS_H + +#include<sys/types.h> + +structtssStruct{ +shortback_link; +shortback_link_reserved; +longesp0; +shortss0; +shortss0_reserved; +longesp1; +shortss1; +shortss1_reserved; +longesp2; +shortss2; +shortss2_reserved; +longcr3; +longeip; +longeflags; +longeax,ecx,edx,ebx; +longesp; +longebp; +longesi; +longedi; +shortes; +shortes_reserved; +shortcs; +shortcs_reserved; +shortss; +shortss_reserved; +shortds; +shortds_reserved; +shortfs; +shortfs_reserved; +shortgs; +shortgs_reserved; +shortldt; +shortldt_reserved; +shorttrace_bitmap; +shortio_map; +chario_space[8192]; +}; + +structi387Struct{ +longcwd; +longswd; +longtwd; +longfip; +longfcs; +longfoo; +longfos; +longst_space[20];/*8*10bytesforeachFP-reg=80bytes*/ +}; + +structi386_frame{ +uint32_tgs; +uint32_tfs; +uint32_tes; +uint32_tds; +uint32_tss; +uint32_tedi; +uint32_tesi; +uint32_tebp; +uint32_tesp; +uint32_tebx; +uint32_tedx; +uint32_tecx; +uint32_teax; +/* +uint32_tvector; +uint32_terror_code; +*/ +uint32_teip; +uint32_tcs; +uint32_tflags; +uint32_tuser_esp; +uint32_tuser_ss; +}; + +#endif/*END_SYS_TSS_H*/ - + diff --git a/doc/xml/tty_8c.xml b/doc/xml/tty_8c.xml index fedd15e..94c26d3 100644 --- a/doc/xml/tty_8c.xml +++ b/doc/xml/tty_8c.xml @@ -1,6 +1,6 @@ - - - + + + tty.c ubixos/tty.h ubixos/kpanic.h @@ -10,81 +10,184 @@ sys/io.h string.h - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tty_term * + tty_term* terms + + terms + = 0x0 + + + + + + + + + + tty_term * + tty_term* tty_foreground + + tty_foreground + = 0x0 + + + + + + + + getchar + kpanic + kprint + sys_fgetc + sys_pread + sys_read + tty_change + + + struct spinLock + struct spinLock tty_spinLock + + tty_spinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + int int tty_change (uInt16 tty) tty_change - uInt16 + uInt16 tty @@ -93,26 +196,20 @@ - - kpanic - memcpy - outportByte - terms - tty_termNode::tty_buffer - tty_foreground - TTY_MAX_TERMS - tty_termNode::tty_pointer - tty_termNode::tty_x - tty_termNode::tty_y - keyboardHandler + + kpanic + memcpy + tty_termNode::tty_buffer + tty_foreground + TTY_MAX_TERMS - - tty_term * + + tty_term * tty_term* tty_find (uInt16 tty) tty_find - uInt16 + uInt16 tty @@ -121,13 +218,12 @@ - - terms - execFile - kprint - systemTask + + execFile + kprint + systemTask - + int int tty_init () @@ -138,22 +234,9 @@ - - inportByte - kmalloc - kpanic - kprintf - outportByte - terms - tty_termNode::tty_buffer - tty_termNode::tty_colour - tty_foreground - TTY_MAX_TERMS - tty_termNode::tty_pointer - tty_termNode::tty_x - tty_termNode::tty_y + - + int int tty_print (char *string, tty_term *term) @@ -163,7 +246,7 @@ string - tty_term * + tty_term * term @@ -172,76 +255,11 @@ - - outportByte - spinLock - spinUnlock - tty_termNode::tty_colour - tty_foreground - tty_termNode::tty_pointer - tty_spinLock - tty_termNode::tty_x - tty_termNode::tty_y - x20 - kprint - sysFwrite - - - - - tty_term * - tty_term* terms - - terms - 0x0 - - - - - - - - tty_change - tty_find - tty_init - - - tty_term * - tty_term* tty_foreground - - tty_foreground - 0x0 - - - - - - - - backSpace - getch - keyboardHandler - kpanic - kprint - sysFgetc - tty_change - tty_init - tty_print - - - spinLock_t - spinLock_t tty_spinLock - - tty_spinLock - SPIN_LOCK_INITIALIZER - - - - - - - - tty_print + + spinLock + kprint + sys_fwrite + sysFwrite @@ -249,183 +267,180 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: tty_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/tty.h> -#include<ubixos/kpanic.h> -#include<ubixos/spinlock.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<sys/io.h> -#include<string.h> - -statictty_term*terms=0x0; -tty_term*tty_foreground=0x0; -staticspinLock_ttty_spinLock=SPIN_LOCK_INITIALIZER; - -inttty_init(){ -inti=0x0; - -/*Allocatememoryforterminals*/ -terms=(tty_term*)kmalloc(sizeof(tty_term)*TTY_MAX_TERMS); -if(terms==0x0) -kpanic("tty_init:Failedtoallocatememory.File:%s,Line:%i\n",__FILE__,__LINE__); - -/*Setupalldefaultterminalinformation*/ -for(i=0;i<TTY_MAX_TERMS;i++){ -terms[i].tty_buffer=(char*)kmalloc(80*60*2); -if(terms[i].tty_buffer==0x0) -kpanic("tty_init:Failedtoallocatebuffermemory.File:%s,Line:%i\n",__FILE__,__LINE__); - -terms[i].tty_pointer=terms[i].tty_buffer;/*Setupttypointertointernalbuffer*/ -terms[i].tty_x=0x0;/*SetupdefaultXposition*/ -terms[i].tty_y=0x0;/*SetupdefaultYposition*/ -terms[i].tty_colour=0x0A+i;/*Setupdefaultttytextcolour*/ -} - -/*Readtty0currentposition(tomigratefromkprintf).*/ -outportByte(0x3D4,0x0e); -terms[0].tty_y=inportByte(0x3D5); -outportByte(0x3D4,0x0f); -terms[0].tty_x=inportByte(0x3D5); - - -/*Setuppointerfortheforegroundtty*/ -tty_foreground=&terms[0]; - -/*Setuptheforegroundttysinformation*/ -tty_foreground->tty_pointer=(char*)0xB8000; - -/*Returntoletkernelknowinitializationiscomplete*/ -kprintf("tty0-Initialized\n"); - -return(0x0); -} - - -/* -Thiswillchangethespecifiedtty.Itultimatelycopiesthescreen -totheforegroundbuffercopiesthenewttysbuffertothescreenand -adjustsacouplepointersandwearegoodtogo. -*/ -inttty_change(uInt16tty){ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/tty.h> +#include<ubixos/kpanic.h> +#include<ubixos/spinlock.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<sys/io.h> +#include<string.h> + +statictty_term*terms=0x0; +tty_term*tty_foreground=0x0; +staticstructspinLocktty_spinLock=SPIN_LOCK_INITIALIZER; + +inttty_init(){ +inti=0x0; + +/*Allocatememoryforterminals*/ +terms=(tty_term*)kmalloc(sizeof(tty_term)*TTY_MAX_TERMS); +if(terms==0x0) +kpanic("tty_init:Failedtoallocatememory.File:%s,Line:%i\n",__FILE__,__LINE__); + +/*Setupalldefaultterminalinformation*/ +for(i=0;i<TTY_MAX_TERMS;i++){ +terms[i].tty_buffer=(char*)kmalloc(80*60*2); +if(terms[i].tty_buffer==0x0) +kpanic("tty_init:Failedtoallocatebuffermemory.File:%s,Line:%i\n",__FILE__,__LINE__); + +terms[i].tty_pointer=terms[i].tty_buffer;/*Setupttypointertointernalbuffer*/ +terms[i].tty_x=0x0;/*SetupdefaultXposition*/ +terms[i].tty_y=0x0;/*SetupdefaultYposition*/ +terms[i].tty_colour=0x0A+i;/*Setupdefaultttytextcolour*/ +} + +/*Readtty0currentposition(tomigratefromkprintf).*/ +outportByte(0x3D4,0x0e); +terms[0].tty_y=inportByte(0x3D5); +outportByte(0x3D4,0x0f); +terms[0].tty_x=inportByte(0x3D5); + +/*Setuppointerfortheforegroundtty*/ +tty_foreground=&terms[0]; + +/*Setuptheforegroundttysinformation*/ +tty_foreground->tty_pointer=(char*)0xB8000; + +/*Returntoletkernelknowinitializationiscomplete*/ +kprintf("tty0-Initialized\n"); + +return(0x0); +} + +/* +Thiswillchangethespecifiedtty.Itultimatelycopiesthescreen +totheforegroundbuffercopiesthenewttysbuffertothescreenand +adjustsacouplepointersandwearegoodtogo. +*/ +inttty_change(uInt16tty){ + +if(tty>TTY_MAX_TERMS) +kpanic("Error:Changingtoaninvalidtty.File:%s,Line:%i\n",__FILE__,__LINE__); -if(tty>TTY_MAX_TERMS) -kpanic("Error:Changingtoaninvalidtty.File:%s,Line:%i\n",__FILE__,__LINE__); +/*Copydisplaybuffertottybuffer*/ +memcpy(tty_foreground->tty_buffer,(char*)0xB8000,(80*60*2)); -/*Copydisplaybuffertottybuffer*/ -memcpy(tty_foreground->tty_buffer,(char*)0xB8000,(80*60*2)); +/*Copynewttybuffertodisplaybuffer*/ +memcpy((char*)0xB8000,terms[tty].tty_buffer,(80*60*2)); -/*Copynewttybuffertodisplaybuffer*/ -memcpy((char*)0xB8000,terms[tty].tty_buffer,(80*60*2)); - -/* -Setthetty_pointertotheinternalbuffersoIcancontinue -writingtowhatitbelievesisthescreen -*/ -tty_foreground->tty_pointer=tty_foreground->tty_buffer; - -terms[tty].tty_pointer=(char*)0xB8000; +/* +Setthetty_pointertotheinternalbuffersoIcancontinue +writingtowhatitbelievesisthescreen +*/ +tty_foreground->tty_pointer=tty_foreground->tty_buffer; + +terms[tty].tty_pointer=(char*)0xB8000; + +/*setnewforegroundtty*/ +tty_foreground=&terms[tty]; -/*setnewforegroundtty*/ -tty_foreground=&terms[tty]; - -/*Adjustcursorwhenwechangeconsoles*/ -outportByte(0x3D4,0x0F); -outportByte(0x3D5,tty_foreground->tty_x); -outportByte(0x3D4,0x0E); -outportByte(0x3D5,tty_foreground->tty_y); +/*Adjustcursorwhenwechangeconsoles*/ +outportByte(0x3D4,0x0F); +outportByte(0x3D5,tty_foreground->tty_x); +outportByte(0x3D4,0x0E); +outportByte(0x3D5,tty_foreground->tty_y); + +return(0x0); +} -return(0x0); -} - -inttty_print(char*string,tty_term*term){ -unsignedintbufferOffset=0x0,character=0x0,i=0x0; -spinLock(&tty_spinLock); - -/*WeNeedToGetTheYPosition*/ -bufferOffset=term->tty_y; -bufferOffset<<=8; - -/*ThenWeNeedToAddTheXPosition*/ -bufferOffset+=term->tty_x; -bufferOffset<<=1; - -while((character=*string++)){ -switch(character){ -case'\n': -bufferOffset=(bufferOffset/160)*160+160; -break; -default: -term->tty_pointer[bufferOffset++]=character; -term->tty_pointer[bufferOffset++]=term->tty_colour; -break; -}/*switch*/ - -/*CheckToSeeIfWeAreOutOfBounds*/ -if(bufferOffset>=160*25){ -for(i=0;i<160*24;i++){ -term->tty_pointer[i]=term->tty_pointer[i+160]; -} -for(i=0;i<80;i++){ -term->tty_pointer[(160*24)+(i*2)]=0x20; -term->tty_pointer[(160*24)+(i*2)+1]=term->tty_colour; -} -bufferOffset-=160; -} -} - -bufferOffset>>=1;/*Setthenewcursorposition*/ -term->tty_x=(bufferOffset&0xFF); -term->tty_y=(bufferOffset>>0x8); - -if(term==tty_foreground){ -outportByte(0x3D4,0x0f); -outportByte(0x3D5,term->tty_x); -outportByte(0x3D4,0x0e); -outportByte(0x3D5,term->tty_y); -} - -spinUnlock(&tty_spinLock); +inttty_print(char*string,tty_term*term){ +unsignedintbufferOffset=0x0,character=0x0,i=0x0; +spinLock(&tty_spinLock); + +/*WeNeedToGetTheYPosition*/ +bufferOffset=term->tty_y; +bufferOffset<<=8; + +/*ThenWeNeedToAddTheXPosition*/ +bufferOffset+=term->tty_x; +bufferOffset<<=1; + +while((character=*string++)){ +switch(character){ +case'\n': +bufferOffset=(bufferOffset/160)*160+160; +break; +default: +term->tty_pointer[bufferOffset++]=character; +term->tty_pointer[bufferOffset++]=term->tty_colour; +break; +}/*switch*/ + +/*CheckToSeeIfWeAreOutOfBounds*/ +if(bufferOffset>=160*25){ +for(i=0;i<160*24;i++){ +term->tty_pointer[i]=term->tty_pointer[i+160]; +} +for(i=0;i<80;i++){ +term->tty_pointer[(160*24)+(i*2)]=0x20; +term->tty_pointer[(160*24)+(i*2)+1]=term->tty_colour; +} +bufferOffset-=160; +} +} + +bufferOffset>>=1;/*Setthenewcursorposition*/ +term->tty_x=(bufferOffset&0xFF); +term->tty_y=(bufferOffset>>0x8); + +if(term==tty_foreground){ +outportByte(0x3D4,0x0f); +outportByte(0x3D5,term->tty_x); +outportByte(0x3D4,0x0e); +outportByte(0x3D5,term->tty_y); +} + +spinUnlock(&tty_spinLock); + +return(0x0); +} -return(0x0); -} - -tty_term*tty_find(uInt16tty){ -return(&terms[tty]); -} - -/*** -END -***/ +tty_term*tty_find(uInt16tty){ +return(&terms[tty]); +} + +/*** +END +***/ - + diff --git a/doc/xml/tty_8h.xml b/doc/xml/tty_8h.xml index 98af6a0..0599f14 100644 --- a/doc/xml/tty_8h.xml +++ b/doc/xml/tty_8h.xml @@ -1,445 +1,766 @@ - - - + + + tty.h - ubixos/types.h - src/sys/include/ubixos/init.h - src/sys/include/ubixos/sched.h - src/sys/isa/atkbd.c - src/sys/kernel/fork.c - src/sys/kernel/kpanic.c - src/sys/kernel/systemtask.c - src/sys/kernel/tty.c - src/sys/sys/video.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/kpanic.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/kpanic.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/ubixos/sched.h + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/kernel/tty.c + C:/Dev/git/UbixOS/sys/sys/video.c - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - - + + + + - + - + - + - + - + - + - + + + + + + + - - + + + + + + + + + + + + + + - - - - - - + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tty_termNode - + TTY_MAX_TERMS 5 @@ -448,14 +769,12 @@ - - tty_change - tty_init + - - tty_termNode + + struct tty_termNode typedef struct tty_termNode tty_term tty_term @@ -465,17 +784,39 @@ - + + + + + + tty_term * + tty_term* tty_foreground + + tty_foreground + + + + + + + + getchar + kpanic + kprint + sys_fgetc + sys_pread + sys_read + tty_change - + int int tty_change (uInt16) tty_change - uInt16 + uInt16 @@ -483,26 +824,20 @@ - - kpanic - memcpy - outportByte - terms - tty_termNode::tty_buffer - tty_foreground - TTY_MAX_TERMS - tty_termNode::tty_pointer - tty_termNode::tty_x - tty_termNode::tty_y - keyboardHandler + + kpanic + memcpy + tty_termNode::tty_buffer + tty_foreground + TTY_MAX_TERMS - - tty_term * + + tty_term * tty_term* tty_find (uInt16) tty_find - uInt16 + uInt16 @@ -510,13 +845,12 @@ - - terms - execFile - kprint - systemTask + + execFile + kprint + systemTask - + int int tty_init () @@ -527,22 +861,9 @@ - - inportByte - kmalloc - kpanic - kprintf - outportByte - terms - tty_termNode::tty_buffer - tty_termNode::tty_colour - tty_foreground - TTY_MAX_TERMS - tty_termNode::tty_pointer - tty_termNode::tty_x - tty_termNode::tty_y + - + int int tty_print (char *, tty_term *) @@ -551,7 +872,7 @@ char * - tty_term * + tty_term * @@ -559,43 +880,11 @@ - - outportByte - spinLock - spinUnlock - tty_termNode::tty_colour - tty_foreground - tty_termNode::tty_pointer - tty_spinLock - tty_termNode::tty_x - tty_termNode::tty_y - x20 - kprint - sysFwrite - - - - - tty_term * - tty_term* tty_foreground - - tty_foreground - - - - - - - - backSpace - getch - keyboardHandler - kpanic - kprint - sysFgetc - tty_change - tty_init - tty_print + + spinLock + kprint + sys_fwrite + sysFwrite @@ -603,102 +892,61 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: tty_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_TTY_H -#define_TTY_H - -#include<ubixos/types.h> - -#defineTTY_MAX_TERMS5 - -typedefstructtty_termNode{ -char*tty_buffer; -char*tty_pointer; -uInt8tty_colour; -uInt16tty_x; -uInt16tty_y; -pidTypeowner; -charstdin[512]; -intstdinSize; -}tty_term; - -inttty_init(); -inttty_change(uInt16); -tty_term*tty_find(uInt16); -inttty_print(char*,tty_term*); - -externtty_term*tty_foreground; - -#endif - -/*** -$Log: tty_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:57reddawg -nomessage - -Revision1.82004/09/0622:11:29reddawg -tty:noweachttyhasastdin.... - -Revision1.72004/08/1411:23:02reddawg -Changes - -Revision1.62004/08/0912:58:05reddawg -letmeknowwhenyougotthesurce - -Revision1.52004/08/0905:40:31reddawg -tty:removedcurrentandmadeaforeground - -Revision1.42004/08/0622:32:16reddawg -UbixWorksAgain - -Revision1.22004/08/0408:17:57reddawg -tty:wehaveprimativettystryf1-f5soitiseasiertouseanddebug -ubixos - -Revision1.12004/08/0321:44:24reddawg -ttys - -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_TTY_H +#define_UBIXOS_TTY_H + +#include<sys/types.h> + +#defineTTY_MAX_TERMS5 + +typedefstructtty_termNode{ +char*tty_buffer; +char*tty_pointer; +uint8_ttty_colour; +uint16_ttty_x; +uint16_ttty_y; +pidTypeowner; +charstdin[512]; +intstdinSize; +}tty_term; + +inttty_init(); +inttty_change(uInt16); +tty_term*tty_find(uInt16); +inttty_print(char*,tty_term*); + +externtty_term*tty_foreground; + +#endif - + diff --git a/doc/xml/ubixfs_8c.xml b/doc/xml/ubixfs_8c.xml index 461c3bf..74185fb 100644 --- a/doc/xml/ubixfs_8c.xml +++ b/doc/xml/ubixfs_8c.xml @@ -1,212 +1,499 @@ - - - + + + ubixfs.c - ubixfs/ubixfs.h + ubixfs/ubixfs.h ubixfs/dirCache.h - vfs/vfs.h - ubixos/types.h + vfs/vfs.h ubixos/sched.h ubixos/kpanic.h ubixos/exec.h lib/kmalloc.h - lib/string.h + string.h lib/kprintf.h assert.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + - + - + + + + + - + + + + + - + - - - - + + + + - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - + + + + - + - - - - - + - - - - - - - - - - - + - + int static int openFileUbixFS - (const char *file, fileDescriptor *fd) + (const char *file, fileDescriptor_t *fd) openFileUbixFS - const char * + const char * file - fileDescriptor * + fileDescriptor_t * fd @@ -215,42 +502,15 @@ - - assert - fileDescriptorStruct::cacheNode - vfs_mountPoint::device - device_node::devInfo - ubixFSInfo::dirCache - fileRead - fileWrite - vfs_mountPoint::fsInfo - cacheNode::info - kmalloc - kprintf - fileDescriptorStruct::mode - fileDescriptorStruct::mp - NULL - cacheNode::permissions - fileDescriptorStruct::perms - cacheNode::present - device_interface::read - fileDescriptorStruct::size - cacheNode::size - fileDescriptorStruct::start - cacheNode::startCluster - UBIXFS_ALIGN - ubixfs_cacheFind - ubixfs_loadData - x1 - ubixfs_init + - + int int readUbixFS - (fileDescriptor *fd, char *data, uInt32 offset, long size) + (fileDescriptor_t *fd, char *data, uInt32 offset, long size) readUbixFS - fileDescriptor * + fileDescriptor_t * fd @@ -258,7 +518,7 @@ data - uInt32 + uInt32 offset @@ -271,22 +531,23 @@ - - assert - fileDescriptorStruct::cacheNode - fdEof - vfs_mountPoint::fsInfo - cacheNode::info - kpanic - fileDescriptorStruct::mp - NULL - cacheNode::present - fileDescriptorStruct::size - fileDescriptorStruct::status - addDirEntry - ubixfs_init + + assert + buffer + fileDescriptor::cacheNode + fdEof + vfs_mountPoint::fsInfo + cacheNode::info + kpanic + fileDescriptor::mp + NULL + cacheNode::present + fileDescriptor::size + fileDescriptor::status + addDirEntry + ubixfs_init - + int int ubixfs_init () @@ -297,19 +558,13 @@ - - kpanic - NULL - openFileUbixFS - readUbixFS - ubixfs_initialize - ubixFSmkDir - ubixFSUnlink - vfsRegisterFS - writeUbixFS - x1 + + NULL + readUbixFS + ubixfs_initialize + writeUbixFS - + int int ubixfs_initialize (struct vfs_mountPoint *mp) @@ -324,42 +579,44 @@ - - assert - cacheNode::attributes - ubixFSInfo::batEntries - ubixFSInfo::blockAllocationTable - vfs_mountPoint::device - device_node::devInfo - ubixFSInfo::dirCache - vfs_mountPoint::diskLabel - vfs_mountPoint::fsInfo - cacheNode::info - device_interface::info - kmalloc - kprintf - ubixDiskLabel::magicNum - ubixDiskLabel::magicNum2 - vfs_mountPoint::partition - ubixDiskLabel::partitions - ubixDiskLabel::ubixPartitions::pBatSize - cacheNode::permissions - cacheNode::present - device_interface::read - ubixFSInfo::rootDir - cacheNode::size - cacheNode::startCluster - UBIXDISKMAGIC - ubixfs_cacheNew - x1 + + assert + cacheNode::attributes + ubixFSInfo::batEntries + ubixFSInfo::blockAllocationTable + vfs_mountPoint::device + device_node::devInfo + ubixFSInfo::dirCache + vfs_mountPoint::diskLabel + vfs_mountPoint::fsInfo + cacheNode::info + device_interface::info + kmalloc + kprintf + ubixDiskLabel::magicNum + ubixDiskLabel::magicNum2 + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pBatSize + cacheNode::permissions + ubixDiskLabel::ubixPartitions::pOffset + cacheNode::present + device_interface::read + blockAllocationTableEntry::realSector + ubixFSInfo::rootDir + cacheNode::size + cacheNode::startCluster + UBIXDISKMAGIC + ubixfs_cacheNew + ubixfs_init - + int static int ubixfs_loadData - (fileDescriptor *fd, char *data, uInt32 size, uInt32 batIndex) + (fileDescriptor_t *fd, char *data, uInt32 size, uInt32 batIndex) ubixfs_loadData - fileDescriptor * + fileDescriptor_t * fd @@ -367,11 +624,11 @@ data - uInt32 + uInt32 size - uInt32 + uInt32 batIndex @@ -380,27 +637,9 @@ - - assert - ubixFSInfo::blockAllocationTable - blockSize - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - vfs_mountPoint::fsInfo - device_interface::info - fileDescriptorStruct::mp - blockAllocationTableEntry::nextBlock - NULL - vfs_mountPoint::partition - ubixDiskLabel::partitions - device_interface::read - blockAllocationTableEntry::realSector - UBIXFS_ALIGN - UBIXFS_BLOCKSIZE_BYTES - openFileUbixFS + - + void void ubixFSUnlink (char *path, struct vfs_mountPoint *mp) @@ -419,37 +658,19 @@ - - ubixFSInfo::blockAllocationTable - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - directoryEntry::fileName - vfs_mountPoint::fsInfo - device_interface::info - kmalloc - kprintf - vfs_mountPoint::partition - ubixDiskLabel::partitions - device_interface::read - ubixFSInfo::rootDir - strcmp - typeDeleted - device_interface::write - x1000 - ubixfs_init + - + int int writeFileByte - (int ch, fileDescriptor *fd, long offset) + (int ch, fileDescriptor_t *fd, long offset) writeFileByte int ch - fileDescriptor * + fileDescriptor_t * fd @@ -462,29 +683,46 @@ - - assert - ubixFSInfo::blockAllocationTable - vfs_mountPoint::diskLabel - fdOpen - fdRead - vfs_mountPoint::fsInfo - fileDescriptorStruct::mp - blockAllocationTableEntry::nextBlock - NULL - vfs_mountPoint::partition - ubixDiskLabel::partitions - ubixDiskLabel::ubixPartitions::pBatSize - fileDescriptorStruct::start - fileDescriptorStruct::status + + assert + blockAllocationTableEntry::attributes + ubixFSInfo::batEntries + ubixFSInfo::blockAllocationTable + fileDescriptor::buffer + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + fdOpen + fdRead + fileDescriptor::fileName + directoryEntry::fileName + vfs_mountPoint::fsInfo + device_interface::info + kfree + kmalloc + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + NULL + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pBatSize + ubixDiskLabel::ubixPartitions::pOffset + device_interface::read + blockAllocationTableEntry::realSector + fileDescriptor::size + directoryEntry::size + fileDescriptor::start + fileDescriptor::status + strcmp + device_interface::write - + int int writeUbixFS - (fileDescriptor *fd, char *data, long offset, long size) + (fileDescriptor_t *fd, char *data, long offset, long size) writeUbixFS - fileDescriptor * + fileDescriptor_t * fd @@ -505,38 +743,38 @@ - - assert - ubixFSInfo::blockAllocationTable - blockSize - fileDescriptorStruct::buffer - vfs_mountPoint::device - device_node::devInfo - vfs_mountPoint::diskLabel - EOBC - fileDescriptorStruct::fileName - directoryEntry::fileName - vfs_mountPoint::fsInfo - getFreeBlocks - device_interface::info - kfree - kmalloc - fileDescriptorStruct::mp - blockAllocationTableEntry::nextBlock - NULL - vfs_mountPoint::partition - ubixDiskLabel::partitions - device_interface::read - blockAllocationTableEntry::realSector - directoryEntry::size - fileDescriptorStruct::size - fileDescriptorStruct::start - directoryEntry::startCluster - strcmp - device_interface::write - x1000 - addDirEntry - ubixfs_init + + assert + ubixFSInfo::blockAllocationTable + blockSize + fileDescriptor::buffer + vfs_mountPoint::device + device_node::devInfo + vfs_mountPoint::diskLabel + EOBC + fileDescriptor::fileName + directoryEntry::fileName + vfs_mountPoint::fsInfo + getFreeBlocks + device_interface::info + kfree + kmalloc + fileDescriptor::mp + blockAllocationTableEntry::nextBlock + NULL + vfs_mountPoint::partition + ubixDiskLabel::partitions + ubixDiskLabel::ubixPartitions::pOffset + device_interface::read + blockAllocationTableEntry::realSector + fileDescriptor::size + directoryEntry::size + fileDescriptor::start + directoryEntry::startCluster + strcmp + device_interface::write + addDirEntry + ubixfs_init @@ -569,628 +807,624 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: ubixfs_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:ubixfs.c792016-01-1116:21:27Zreddawg$ *****************************************************************************************/ -#include<ubixfs/ubixfs.h> +#include<ubixfs/ubixfs.h> #include<ubixfs/dirCache.h> -#include<vfs/vfs.h> -#include<ubixos/types.h> -#include<ubixos/sched.h> -#include<ubixos/kpanic.h> -#include<ubixos/exec.h> -#include<lib/kmalloc.h> -#include<lib/string.h> -#include<lib/kprintf.h> -#include<assert.h> - -/*Staticdefines*/ -staticintubixfs_loadData(fileDescriptor*fd,char*data,uInt32size,uInt32batIndex); - - -staticintopenFileUbixFS(constchar*file,fileDescriptor*fd){ -//intx=0; -/*mjistructdirectoryEntry*dirEntry=(structdirectoryEntry*)kmalloc(0x4000);*/ -structcacheNode*cacheNode=NULL; -//structdirectoryEntry*dirEntry=NULL; -structubixFSInfo*fsInfo=fd->mp->fsInfo; - - - -/*kprintf("openFileUbixFS(%s),cwd:%s\n",file,_current->oInfo.cwd);*/ - -//if(fsInfo->dirCache==NULL)kprintf("dirCacheisnull!\n"); -assert(fd); -assert(fd->mp); -assert(fd->mp->device); -assert(fd->mp->device->devInfo); -assert(fd->mp->device->devInfo->read); -assert(fsInfo); -assert(fsInfo->dirCache); -assert(file); - -if((fd->mode&fileRead)==fileRead){ -do{ -cacheNode=ubixfs_cacheFind(fsInfo->dirCache,(char*)file); -if(cacheNode==NULL)return0; -if(cacheNode->present==1)break; -assert(cacheNode->size); -if(*cacheNode->size!=0&&cacheNode->info==NULL){ -//kprintf("cachingname(size):%s(%d)\n",cacheNode->name,*cacheNode->size); -cacheNode->info=kmalloc(UBIXFS_ALIGN(*cacheNode->size)); -fd->size=*cacheNode->size; -assert(cacheNode->startCluster); -ubixfs_loadData(fd, -cacheNode->info, -*cacheNode->size, -*cacheNode->startCluster); -cacheNode->present=1; -}/*if*/ -}while(1); - -assert(cacheNode); -if(cacheNode==NULL)return0;/*thisshouldbecaughtabove*/ - -fd->start=*cacheNode->startCluster; -fd->size=*cacheNode->size; -fd->perms=*cacheNode->permissions; -fd->cacheNode=cacheNode;/*DirectoryStartSector*/ -/* -if(cacheNode->size!=0x0&&cacheNode->info==NULL){ -cacheNode->info=kmalloc(UBIXFS_ALIGN(*cacheNode->size)); -ubixfs_loadData(fd,cacheNode->info,cacheNode->size,cacheNode->startCluster); -cacheNode->present=0x1; -} -*/ -return(0x1); -} -else -if((fd->mode&fileWrite)==fileWrite){ -kprintf("Ouch!infilewrite!\n"); -#if0 -fd->start=dirEntry->startCluster; -fd->size=dirEntry->size; -fd->perms=dirEntry->permissions; -//fd->dirBlock=0x0;/*DirectoryStartSector*/ -#endif -return(0x1); -} - -return0; - -} - -intwriteFileByte(intch,fileDescriptor*fd,longoffset){ - -intblockCount=0x0,batIndex=0x0,batIndexPrev=0x0; -uInt32i=0x0; -structdirectoryEntry*dirEntry=0x0; -structubixFSInfo*fsInfo=NULL; - -assert(fd); -assert(fd->mp); -assert(fd->mp->diskLabel); - -batIndexPrev=fd->start; -fsInfo=fd->mp->fsInfo; - -/*FindOutHowManyBlocksLongThisFileIs*/ -blockCount=(offset/4096); - -/*FindTheBlockIfItDoesn'tExistWeWillHaveToAllocateOne*/ -for(i=0x0;i<=fd->mp->diskLabel->partitions[fd->mp->partition].pBatSize; -i++){ -batIndex=fsInfo->blockAllocationTable[batIndexPrev].nextBlock; -if(batIndex==0x0){ -break; -} -batIndexPrev=batIndex; -} - -if((offset%4096==0)&&(fd->status==fdRead)){ -fd->status=fdOpen; -} - -/*IfbatIndex==0x0ThenWeMustAllocateANewBlock*/ -if(batIndex==0x0){ -for(i=1;i<fsInfo->batEntries;i++){ -if(fsInfo->blockAllocationTable[i].attributes==0x0){ -fsInfo->blockAllocationTable[batIndexPrev].nextBlock=i; -fsInfo->blockAllocationTable[batIndex].nextBlock=-1; -batIndex=i; -fd->start=i; -break; -} -} -/*fd->mp->drive->read(fd->mp->drive->driveInfoStruct,diskLabel->partitions[0].pOffset+blockAllocationTable[batIndex].realSector,8,fd->buffer);*/ -fd->buffer[offset-(blockCount*4096)]=ch; -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); -} -else{ -if(fd->status!=fdRead){ -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); -fd->status=fdRead; -} -fd->buffer[offset-(blockCount*4096)]=ch; -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); -} -if((uInt32)offset>fd->size){ -fd->size=offset; -dirEntry=(structdirectoryEntry*)kmalloc(4096); -/* -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8); -*/ -for(i=0x0;i<(4096/sizeof(structdirectoryEntry));i++){ -if((int)!strcmp(dirEntry[i].fileName,fd->fileName)) -break; -} -dirEntry[i].size=fd->size; -/* -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8); -*/ -kfree(dirEntry); -} -return(ch); -} - -/*VerifiedFunctions*/ - - -intreadUbixFS(fileDescriptor*fd,char*data,uInt32offset,longsize){ -inti=0x0; -char*buffer=0x0; -structubixFSInfo*fsInfo=NULL; - -assert(fd); -assert(fd->mp); -assert(fd->mp->fsInfo); - -fsInfo=fd->mp->fsInfo; - -if(fd->cacheNode->present!=1) -kpanic("ERRORwithcachenode\n"); - -buffer=(char*)fd->cacheNode->info; - -for(i=0x0;i<size;i++){ -if(offset>fd->size){ -/*SetFileEOFIfThereIsNothingToDo*/ -/*data[i]='\0';Isthissafe?*/ -fd->status=fdEof; -return(size); -} -/*CopyDataFromBufferToData*/ -data[i]=buffer[i+offset]; -} -/*Return*/ -return(size); -} +#include<vfs/vfs.h> +#include<ubixos/sched.h> +#include<ubixos/kpanic.h> +#include<ubixos/exec.h> +#include<lib/kmalloc.h> +#include<string.h> +#include<lib/kprintf.h> +#include<assert.h> + +/*Staticdefines*/ +staticintubixfs_loadData(fileDescriptor_t*fd,char*data,uInt32size,uInt32batIndex); + + +staticintopenFileUbixFS(constchar*file,fileDescriptor_t*fd){ +//intx=0; +/*mjistructdirectoryEntry*dirEntry=(structdirectoryEntry*)kmalloc(0x4000);*/ +structcacheNode*cacheNode=NULL; +//structdirectoryEntry*dirEntry=NULL; +structubixFSInfo*fsInfo=fd->mp->fsInfo; + + + +/*kprintf("openFileUbixFS(%s),cwd:%s\n",file,_current->oInfo.cwd);*/ + +//if(fsInfo->dirCache==NULL)kprintf("dirCacheisnull!\n"); +assert(fd); +assert(fd->mp); +assert(fd->mp->device); +assert(fd->mp->device->devInfo); +assert(fd->mp->device->devInfo->read); +assert(fsInfo); +assert(fsInfo->dirCache); +assert(file); + +if((fd->mode&fileRead)==fileRead){ +do{ +cacheNode=ubixfs_cacheFind(fsInfo->dirCache,(char*)file); +if(cacheNode==NULL)return0; +if(cacheNode->present==1)break; +assert(cacheNode->size); +if(*cacheNode->size!=0&&cacheNode->info==NULL){ +//kprintf("cachingname(size):%s(%d)\n",cacheNode->name,*cacheNode->size); +cacheNode->info=kmalloc(UBIXFS_ALIGN(*cacheNode->size)); +fd->size=*cacheNode->size; +assert(cacheNode->startCluster); +ubixfs_loadData(fd, +cacheNode->info, +*cacheNode->size, +*cacheNode->startCluster); +cacheNode->present=1; +}/*if*/ +}while(1); + +assert(cacheNode); +if(cacheNode==NULL)return0;/*thisshouldbecaughtabove*/ + +fd->start=*cacheNode->startCluster; +fd->size=*cacheNode->size; +fd->perms=*cacheNode->permissions; +fd->cacheNode=cacheNode;/*DirectoryStartSector*/ +/* +if(cacheNode->size!=0x0&&cacheNode->info==NULL){ +cacheNode->info=kmalloc(UBIXFS_ALIGN(*cacheNode->size)); +ubixfs_loadData(fd,cacheNode->info,cacheNode->size,cacheNode->startCluster); +cacheNode->present=0x1; +} +*/ +return(0x1); +} +else +if((fd->mode&fileWrite)==fileWrite){ +kprintf("Ouch!infilewrite!\n"); +#if0 +fd->start=dirEntry->startCluster; +fd->size=dirEntry->size; +fd->perms=dirEntry->permissions; +//fd->dirBlock=0x0;/*DirectoryStartSector*/ +#endif +return(0x1); +} + +return0; + +} + +intwriteFileByte(intch,fileDescriptor_t*fd,longoffset){ + +intblockCount=0x0,batIndex=0x0,batIndexPrev=0x0; +uInt32i=0x0; +structdirectoryEntry*dirEntry=0x0; +structubixFSInfo*fsInfo=NULL; + +assert(fd); +assert(fd->mp); +assert(fd->mp->diskLabel); + +batIndexPrev=fd->start; +fsInfo=fd->mp->fsInfo; + +/*FindOutHowManyBlocksLongThisFileIs*/ +blockCount=(offset/4096); + +/*FindTheBlockIfItDoesn'tExistWeWillHaveToAllocateOne*/ +for(i=0x0;i<=fd->mp->diskLabel->partitions[fd->mp->partition].pBatSize; +i++){ +batIndex=fsInfo->blockAllocationTable[batIndexPrev].nextBlock; +if(batIndex==0x0){ +break; +} +batIndexPrev=batIndex; +} + +if((offset%4096==0)&&(fd->status==fdRead)){ +fd->status=fdOpen; +} + +/*IfbatIndex==0x0ThenWeMustAllocateANewBlock*/ +if(batIndex==0x0){ +for(i=1;i<fsInfo->batEntries;i++){ +if(fsInfo->blockAllocationTable[i].attributes==0x0){ +fsInfo->blockAllocationTable[batIndexPrev].nextBlock=i; +fsInfo->blockAllocationTable[batIndex].nextBlock=-1; +batIndex=i; +fd->start=i; +break; +} +} +/*fd->mp->drive->read(fd->mp->drive->driveInfoStruct,diskLabel->partitions[0].pOffset+blockAllocationTable[batIndex].realSector,8,fd->buffer);*/ +fd->buffer[offset-(blockCount*4096)]=ch; +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); +} +else{ +if(fd->status!=fdRead){ +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); +fd->status=fdRead; +} +fd->buffer[offset-(blockCount*4096)]=ch; +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); +} +if((uInt32)offset>fd->size){ +fd->size=offset; +dirEntry=(structdirectoryEntry*)kmalloc(4096); +/* +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8); +*/ +for(i=0x0;i<(4096/sizeof(structdirectoryEntry));i++){ +if((int)!strcmp(dirEntry[i].fileName,fd->fileName)) +break; +} +dirEntry[i].size=fd->size; +/* +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8); +*/ +kfree(dirEntry); +} +return(ch); +} + +/*VerifiedFunctions*/ + + +intreadUbixFS(fileDescriptor_t*fd,char*data,uInt32offset,longsize){ +inti=0x0; +char*buffer=0x0; +structubixFSInfo*fsInfo=NULL; + +assert(fd); +assert(fd->mp); +assert(fd->mp->fsInfo); + +fsInfo=fd->mp->fsInfo; + +if(fd->cacheNode->present!=1) +kpanic("ERRORwithcachenode\n"); + +buffer=(char*)fd->cacheNode->info; + +for(i=0x0;i<size;i++){ +if(offset>fd->size){ +/*SetFileEOFIfThereIsNothingToDo*/ +/*data[i]='\0';Isthissafe?*/ +fd->status=fdEof; +return(size); +} +/*CopyDataFromBufferToData*/ +data[i]=buffer[i+offset]; +} +/*Return*/ +return(size); +} + - -/************************************************************************ - -Function:intwriteUbixFS(fileDescriptor*fd,char*data,longoffset,longsize) -Description:WriteDataIntoFile -Notes: - -************************************************************************/ -intwriteUbixFS(fileDescriptor*fd,char*data,longoffset,longsize){ -uInt32blockOffset=0x0; -uInt32blockIndex; -uInt32blockIndexPrev; -uInt32i=0x0; -structubixFSInfo*fsInfo=NULL; -structdirectoryEntry*dirEntry=0x0; - -assert(fd); -assert(fd->mp); -assert(fd->mp->fsInfo); -assert(fd->mp->device); -assert(fd->mp->device->devInfo); - -blockIndex=blockIndexPrev=fd->start; -fsInfo=fd->mp->fsInfo; - -blockOffset=(offset/0x1000); - -if(fd->size!=0x0){ -for(i=0x0;i<blockOffset;i++){ -blockIndex=fsInfo->blockAllocationTable[blockIndexPrev].nextBlock; -if((int)blockIndex==EOBC){ -blockIndex=getFreeBlocks(1,fd); -fsInfo->blockAllocationTable[blockIndexPrev].nextBlock=blockIndex; -fsInfo->blockAllocationTable[blockIndex].nextBlock=EOBC; -break; -} -blockIndexPrev=blockIndex; -} -} - -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); -for(i=0x0;i<(uInt32)size;i++){ - -fd->buffer[(offset-(blockOffset*0x1000))]=data[i]; -offset++; - -if(offset%4096==0x0){ -blockOffset++; -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); - -if(fsInfo->blockAllocationTable[blockIndex].nextBlock==EOBC){ -blockIndexPrev=blockIndex; -blockIndex=getFreeBlocks(1,fd); -fsInfo->blockAllocationTable[blockIndexPrev].nextBlock=blockIndex; -fsInfo->blockAllocationTable[blockIndex].nextBlock=EOBC; -} -else{ -blockIndex=fsInfo->blockAllocationTable[blockIndex].nextBlock; -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); -} -} -} -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); - -if((uInt32)offset>fd->size){ -fd->size=offset; -dirEntry=(structdirectoryEntry*)kmalloc(4096); -/* -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize); -*/ -for(i=0x0;i<(4096/sizeof(structdirectoryEntry));i++){ -if((int)!strcmp(dirEntry[i].fileName,fd->fileName)) -break; -} -dirEntry[i].size=fd->size; -dirEntry[i].startCluster=fd->start; -/* -fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize); -*/ -kfree(dirEntry); -} -/*Return*/ -return(size); -} - -voidubixFSUnlink(char*path,structvfs_mountPoint*mp){ -intx=0; -structdirectoryEntry*dirEntry=(structdirectoryEntry*)kmalloc(0x1000); -structubixFSInfo*fsInfo=mp->fsInfo; - -mp->device->devInfo->read(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); - -for(x=0;(uInt32)x<(4096/sizeof(structdirectoryEntry));x++){ -if((int)!strcmp(dirEntry[x].fileName,path)){ -dirEntry[x].attributes|=typeDeleted; -dirEntry[x].fileName[0]='?'; -mp->device->devInfo->write(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); -return; -} -} -kprintf("FileNotFound\n"); -return; -} +/************************************************************************ + +Function:intwriteUbixFS(fileDescriptor_t*fd,char*data,longoffset,longsize) +Description:WriteDataIntoFile +Notes: + +************************************************************************/ +intwriteUbixFS(fileDescriptor_t*fd,char*data,longoffset,longsize){ +uInt32blockOffset=0x0; +uInt32blockIndex; +uInt32blockIndexPrev; +uInt32i=0x0; +structubixFSInfo*fsInfo=NULL; +structdirectoryEntry*dirEntry=0x0; + +assert(fd); +assert(fd->mp); +assert(fd->mp->fsInfo); +assert(fd->mp->device); +assert(fd->mp->device->devInfo); + +blockIndex=blockIndexPrev=fd->start; +fsInfo=fd->mp->fsInfo; + +blockOffset=(offset/0x1000); + +if(fd->size!=0x0){ +for(i=0x0;i<blockOffset;i++){ +blockIndex=fsInfo->blockAllocationTable[blockIndexPrev].nextBlock; +if((int)blockIndex==EOBC){ +blockIndex=getFreeBlocks(1,fd); +fsInfo->blockAllocationTable[blockIndexPrev].nextBlock=blockIndex; +fsInfo->blockAllocationTable[blockIndex].nextBlock=EOBC; +break; +} +blockIndexPrev=blockIndex; +} +} + +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); +for(i=0x0;i<(uInt32)size;i++){ + +fd->buffer[(offset-(blockOffset*0x1000))]=data[i]; +offset++; + +if(offset%4096==0x0){ +blockOffset++; +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); + +if(fsInfo->blockAllocationTable[blockIndex].nextBlock==EOBC){ +blockIndexPrev=blockIndex; +blockIndex=getFreeBlocks(1,fd); +fsInfo->blockAllocationTable[blockIndexPrev].nextBlock=blockIndex; +fsInfo->blockAllocationTable[blockIndex].nextBlock=EOBC; +} +else{ +blockIndex=fsInfo->blockAllocationTable[blockIndex].nextBlock; +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); +} +} +} +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); + +if((uInt32)offset>fd->size){ +fd->size=offset; +dirEntry=(structdirectoryEntry*)kmalloc(4096); +/* +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize); +*/ +for(i=0x0;i<(4096/sizeof(structdirectoryEntry));i++){ +if((int)!strcmp(dirEntry[i].fileName,fd->fileName)) +break; +} +dirEntry[i].size=fd->size; +dirEntry[i].startCluster=fd->start; +/* +fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize); +*/ +kfree(dirEntry); +} +/*Return*/ +return(size); +} + +voidubixFSUnlink(char*path,structvfs_mountPoint*mp){ +intx=0; +structdirectoryEntry*dirEntry=(structdirectoryEntry*)kmalloc(0x1000); +structubixFSInfo*fsInfo=mp->fsInfo; + +mp->device->devInfo->read(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); + +for(x=0;(uInt32)x<(4096/sizeof(structdirectoryEntry));x++){ +if((int)!strcmp(dirEntry[x].fileName,path)){ +dirEntry[x].attributes|=typeDeleted; +dirEntry[x].fileName[0]='?'; +mp->device->devInfo->write(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); +return; +} +} +kprintf("FileNotFound\n"); +return; +} + - -/***************************************************************************************** - -Function:static -intubixfs_loadData(fileDescriptor*fd,char*data,uInt32size,uInt32batIndex) - -Description:Thiswillloadthenodedatainfromthedisk - -Notes: -07/23/2004-Thisloadscompleteblocksfromdisksoitisalignedto0x1000notthe -actualfilesize - -*****************************************************************************************/ -staticintubixfs_loadData(fileDescriptor*fd,char*data,uInt32size,uInt32batIndex){ -uInt32i=0x0; - -structubixFSInfo*fsInfo=NULL; - -assert(fd); -assert(fd->mp); -assert(fd->mp->fsInfo); - -fsInfo=fd->mp->fsInfo; - -size=UBIXFS_ALIGN(size); -/*Loopbyblocksize*/ - -for(i=0x0;i<size;i+=(UBIXFS_BLOCKSIZE_BYTES)){ -/*Getnextblockifwearereadyforit*/ -if(i!=0x0) -batIndex=fsInfo->blockAllocationTable[batIndex].nextBlock; -/*Readdatainfrommedia*/ -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,data+i,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize); -} -/*Return*/ -return(0x0); -} +/***************************************************************************************** + +Function:static +intubixfs_loadData(fileDescriptor_t*fd,char*data,uInt32size,uInt32batIndex) + +Description:Thiswillloadthenodedatainfromthedisk + +Notes: +07/23/2004-Thisloadscompleteblocksfromdisksoitisalignedto0x1000notthe +actualfilesize + +*****************************************************************************************/ +staticintubixfs_loadData(fileDescriptor_t*fd,char*data,uInt32size,uInt32batIndex){ +uInt32i=0x0; + +structubixFSInfo*fsInfo=NULL; + +assert(fd); +assert(fd->mp); +assert(fd->mp->fsInfo); + +fsInfo=fd->mp->fsInfo; + +size=UBIXFS_ALIGN(size); +/*Loopbyblocksize*/ + +for(i=0x0;i<size;i+=(UBIXFS_BLOCKSIZE_BYTES)){ +/*Getnextblockifwearereadyforit*/ +if(i!=0x0) +batIndex=fsInfo->blockAllocationTable[batIndex].nextBlock; +/*Readdatainfrommedia*/ +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,data+i,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize); +} +/*Return*/ +return(0x0); +} + - -/***************************************************************************************** - -Function:intubixfs_initialize() - -Description:ThiswillinitializeamountpointitloadstheBATandCachestherootDir - -Notes: - -*****************************************************************************************/ -intubixfs_initialize(structvfs_mountPoint*mp){ -structubixFSInfo*fsInfo=0x0; - -assert(mp); -assert(mp->diskLabel); -assert(mp->diskLabel->partitions); - -mp->fsInfo=(structubixFSInfo*)kmalloc(sizeof(structubixFSInfo)); -assert(mp->fsInfo); - -fsInfo=mp->fsInfo; -fsInfo->rootDir=0x0;/*Rootdirectoryisalways0x0ontheUbixFS*/ - -/* -CheckthedisklabeltoensurethisisanUbixFSpartition -*/ -if((mp->diskLabel->magicNum==UBIXDISKMAGIC)&&(mp->diskLabel->magicNum2==UBIXDISKMAGIC)){ - -/*AllocatememoryforBAT*/ -fsInfo->blockAllocationTable=(structblockAllocationTableEntry*)kmalloc(mp->diskLabel->partitions[mp->partition].pBatSize*512); -assert(fsInfo->blockAllocationTable); - -/*SetuptheamountofBATentries*/ -fsInfo->batEntries=(mp->diskLabel->partitions[mp->partition].pBatSize*512)/sizeof(structblockAllocationTableEntry); - -/*ReadtheBATtomemory*/ -assert(mp->device->devInfo->read); -mp->device->devInfo->read(mp->device->devInfo->info, -fsInfo->blockAllocationTable, -mp->diskLabel->partitions[mp->partition].pOffset, -mp->diskLabel->partitions[mp->partition].pBatSize); - -/*Setuprootdirectorycache*/ -fsInfo->dirCache=ubixfs_cacheNew("/"); -assert(fsInfo->dirCache); -fsInfo->dirCache->info=(structdirectoryEntry*)kmalloc(0x4000);/*allocaterootdir*/ -fsInfo->dirCache->present=1; -fsInfo->dirCache->size=kmalloc(sizeof(fsInfo->dirCache->size)); -fsInfo->dirCache->startCluster=kmalloc(sizeof(fsInfo->dirCache->startCluster)); -fsInfo->dirCache->attributes=kmalloc(sizeof(fsInfo->dirCache->attributes)); -fsInfo->dirCache->permissions=kmalloc(sizeof(fsInfo->dirCache->permissions)); - -*fsInfo->dirCache->size=0x4000; -*fsInfo->dirCache->startCluster=fsInfo->rootDir; - -assert(fsInfo->dirCache->info); -/*Readrootdirinfromdiskitisalways0x4000byteslong*/ -mp->device->devInfo->read(mp->device->devInfo->info, -fsInfo->dirCache->info, -(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector), -0x4000/512); - -/*Startourubixfs_threadtomanagethemountpoint*/ -/* -UBUdisablefornow -execThread(ubixfs_Thread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); -*/ -kprintf("Offset:[%i],Partition:[%i]\n", -mp->diskLabel->partitions[mp->partition].pOffset,mp->partition); -kprintf("UbixFSInitialized\n"); -return(0x1); -} - -kprintf("NotavalidUbixFSdisk.\n"); -/*Return*/ -return(0x0); -} - -/***************************************************************************************** - -Function:intubixfs_init() - -Description:ThisisthemasterinitializationfortheUbixFileSystemitwillmakethe -OSUbixFSaware. -Itdoesnotinanywayshapeorformconnectamountpointanmediumthatis -uptotheubixfs_initialize()function - -Notes: - -*****************************************************************************************/ -intubixfs_init(){ -/*Setupourfilesystemstructure*/ -structfileSystemubixFileSystem= -{NULL,/*prev*/ -NULL,/*next*/ -(void*)ubixfs_initialize,/*vfsInitFS*/ -(void*)readUbixFS,/*vfsRead*/ -(void*)writeUbixFS,/*vfsWrite*/ -(void*)openFileUbixFS,/*vfsOpenFile*/ -(void*)ubixFSUnlink,/*vfsUnlink*/ -(void*)ubixFSmkDir,/*vfsMakeDir*/ -NULL,/*vfsRemDir*/ -NULL,/*vfsSync*/ -0/*vfsType*/ -};/*ubixFileSystem*/ - -/*AddUbixFS*/ -if(vfsRegisterFS(ubixFileSystem)!=0x0){ -kpanic("UnableToEnableUbixFS"); -return(0x1); -} - -/*Return*/ -return(0x0); -} - -/*** -$Log: ubixfs_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.22006/12/0514:10:21reddawg -WorkignDistro - -Revision1.1.1.12006/06/0112:46:17reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:42reddawg -nomessage - -Revision1.442004/08/2622:51:19reddawg -TCAtouchedme:(ithinkhelikesmen.... +/***************************************************************************************** + +Function:intubixfs_initialize() + +Description:ThiswillinitializeamountpointitloadstheBATandCachestherootDir + +Notes: + +*****************************************************************************************/ +intubixfs_initialize(structvfs_mountPoint*mp){ +structubixFSInfo*fsInfo=0x0; + +assert(mp); +assert(mp->diskLabel); +assert(mp->diskLabel->partitions); + +mp->fsInfo=(structubixFSInfo*)kmalloc(sizeof(structubixFSInfo)); +assert(mp->fsInfo); + +fsInfo=mp->fsInfo; +fsInfo->rootDir=0x0;/*Rootdirectoryisalways0x0ontheUbixFS*/ + +/* +CheckthedisklabeltoensurethisisanUbixFSpartition +*/ +if((mp->diskLabel->magicNum==UBIXDISKMAGIC)&&(mp->diskLabel->magicNum2==UBIXDISKMAGIC)){ + +/*AllocatememoryforBAT*/ +fsInfo->blockAllocationTable=(structblockAllocationTableEntry*)kmalloc(mp->diskLabel->partitions[mp->partition].pBatSize*512); +assert(fsInfo->blockAllocationTable); + +/*SetuptheamountofBATentries*/ +fsInfo->batEntries=(mp->diskLabel->partitions[mp->partition].pBatSize*512)/sizeof(structblockAllocationTableEntry); + +/*ReadtheBATtomemory*/ +assert(mp->device->devInfo->read); +mp->device->devInfo->read(mp->device->devInfo->info, +fsInfo->blockAllocationTable, +mp->diskLabel->partitions[mp->partition].pOffset, +mp->diskLabel->partitions[mp->partition].pBatSize); + +/*Setuprootdirectorycache*/ +fsInfo->dirCache=ubixfs_cacheNew("/"); +assert(fsInfo->dirCache); +fsInfo->dirCache->info=(structdirectoryEntry*)kmalloc(0x4000);/*allocaterootdir*/ +fsInfo->dirCache->present=1; +fsInfo->dirCache->size=kmalloc(sizeof(fsInfo->dirCache->size)); +fsInfo->dirCache->startCluster=kmalloc(sizeof(fsInfo->dirCache->startCluster)); +fsInfo->dirCache->attributes=kmalloc(sizeof(fsInfo->dirCache->attributes)); +fsInfo->dirCache->permissions=kmalloc(sizeof(fsInfo->dirCache->permissions)); + +*fsInfo->dirCache->size=0x4000; +*fsInfo->dirCache->startCluster=fsInfo->rootDir; + +assert(fsInfo->dirCache->info); +/*Readrootdirinfromdiskitisalways0x4000byteslong*/ +mp->device->devInfo->read(mp->device->devInfo->info, +fsInfo->dirCache->info, +(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector), +0x4000/512); + +/*Startourubixfs_threadtomanagethemountpoint*/ +/* +UBUdisablefornow +execThread(ubixfs_Thread,0x2000),0x0); +*/ +kprintf("Offset:[%i],Partition:[%i]\n", +mp->diskLabel->partitions[mp->partition].pOffset,mp->partition); +kprintf("UbixFSInitialized\n"); +return(0x1); +} + +kprintf("NotavalidUbixFSdisk.\n"); +/*Return*/ +return(0x0); +} + +/***************************************************************************************** + +Function:intubixfs_init() + +Description:ThisisthemasterinitializationfortheUbixFileSystemitwillmakethe +OSUbixFSaware. +Itdoesnotinanywayshapeorformconnectamountpointanmediumthatis +uptotheubixfs_initialize()function + +Notes: + +*****************************************************************************************/ +intubixfs_init(){ +/*Setupourfilesystemstructure*/ +structfileSystemubixFileSystem= +{NULL,/*prev*/ +NULL,/*next*/ +(void*)ubixfs_initialize,/*vfsInitFS*/ +(void*)readUbixFS,/*vfsRead*/ +(void*)writeUbixFS,/*vfsWrite*/ +(void*)openFileUbixFS,/*vfsOpenFile*/ +(void*)ubixFSUnlink,/*vfsUnlink*/ +(void*)ubixFSmkDir,/*vfsMakeDir*/ +NULL,/*vfsRemDir*/ +NULL,/*vfsSync*/ +0/*vfsType*/ +};/*ubixFileSystem*/ + +/*AddUbixFS*/ +if(vfsRegisterFS(ubixFileSystem)!=0x0){ +kpanic("UnableToEnableUbixFS"); +return(0x1); +} + +/*Return*/ +return(0x0); +} + +/*** +$Log:ubixfs.c,v$ +Revision1.22006/12/0514:10:21reddawg +WorkignDistro + +Revision1.1.1.12006/06/0112:46:17reddawg +ubix2 + +Revision1.22005/10/1200:13:37reddawg +Removed + +Revision1.1.1.12005/09/2617:24:42reddawg +nomessage + +Revision1.442004/08/2622:51:19reddawg +TCAtouchedme:(ithinkhelikesmen.... + - -sched.h:kTask_taddedparentPid -endtask.c:fixedtermbacktoparentPid -exec.c:cleanedwarnings -fork.c:fixedtermtochildPid -sched.c:cleanupfordeadtasks -systemtask.c:cleanupdeadtasks -kmalloc.c:cleanedupwarnings -udp.c:cleanedupwarnings -bot.c:cleanedupwarnings -shell.c:cleanedupwarnings -tcpdump.c:tookadump -hd.c:cleanedupwarnings -ubixfs.c:stoppedprningdebuginfo - -Revision1.432004/08/1411:23:02reddawg -Changes - -Revision1.422004/08/0912:58:05reddawg -letmeknowwhenyougotthesurce - -Revision1.412004/08/0117:58:39flameshadow -chg:fixedstringallocationbuginubixfs_cacheNew() - -Revision1.402004/07/2817:07:29flameshadow -chg:re-addedmovingcachednodestothefrontofthelistwhenfound -add:addedanassert()inubixfs.c - -Revision1.392004/07/2719:24:31flameshadow -chg:reducedthenumberofdebuggingstatementsinthekernel. - -Revision1.382004/07/2712:02:01reddawg -chg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch - -Revision1.372004/07/2709:05:43flameshadow -chg:fixedfilenotfoundbug.Stillcan'tfindloopingissue - -Revision1.362004/07/2704:05:20flameshadow -chg:kindafixedit.Addedbunchesofdebuginfo - -Revision1.352004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.342004/07/2423:04:44reddawg -Changes...markletmeknowifyoufaultatpid185whenyoutypestress - -Revision1.332004/07/2309:10:06reddawg -ubixfs:cleanedupsomefunctionsplayedwiththecachingabit -vfs:renamedabunchoffunctions -cleanedupafewmiscbugs - -Revision1.322004/07/2223:01:51reddawg -OkcheckinginbeforeIsleep - -Revision1.312004/07/2222:37:03reddawg -CachingisworkingnowtheFSisextremelyfastbutneedstobeoptimizedtodo32bitcopiesover8bit - -Revision1.302004/07/2219:01:59flameshadow -chg:moredirectoryandfilecaching - -Revision1.292004/07/2216:34:32flameshadow -add:fileanddircachingkindawork - -Revision1.282004/07/2122:07:18flameshadow -chg:renamedcachingfunctions(again) - -Revision1.272004/07/2121:08:05flameshadow -add:addedprovisionsforfilecaching - -Revision1.262004/07/2023:21:31flameshadow -syncing - -Revision1.252004/07/2021:39:53reddawg -ubixfs:doesproppercachingnowproblemwasyoudidnotseekrealSectorhowevertheosstartsbutIamgettingasegfaultcouldbefromanythinghaven'tlookedintoitrightquick - -Revision1.242004/07/2021:38:08flameshadow -trynow +sched.h:kTask_taddedparentPid +endtask.c:fixedtermbacktoparentPid +exec.c:cleanedwarnings +fork.c:fixedtermtochildPid +sched.c:cleanupfordeadtasks +systemtask.c:cleanupdeadtasks +kmalloc.c:cleanedupwarnings +udp.c:cleanedupwarnings +bot.c:cleanedupwarnings +shell.c:cleanedupwarnings +tcpdump.c:tookadump +hd.c:cleanedupwarnings +ubixfs.c:stoppedprningdebuginfo + +Revision1.432004/08/1411:23:02reddawg +Changes + +Revision1.422004/08/0912:58:05reddawg +letmeknowwhenyougotthesurce + +Revision1.412004/08/0117:58:39flameshadow +chg:fixedstringallocationbuginubixfs_cacheNew() + +Revision1.402004/07/2817:07:29flameshadow +chg:re-addedmovingcachednodestothefrontofthelistwhenfound +add:addedanassert()inubixfs.c + +Revision1.392004/07/2719:24:31flameshadow +chg:reducedthenumberofdebuggingstatementsinthekernel. + +Revision1.382004/07/2712:02:01reddawg +chg:fixedmarksbugreadFiledidalookupwhichiswhyitlookedlikeitwaslooppingsomuch + +Revision1.372004/07/2709:05:43flameshadow +chg:fixedfilenotfoundbug.Stillcan'tfindloopingissue + +Revision1.362004/07/2704:05:20flameshadow +chg:kindafixedit.Addedbunchesofdebuginfo + +Revision1.352004/07/2619:15:49reddawg +testcode,fixesandthelike + +Revision1.342004/07/2423:04:44reddawg +Changes...markletmeknowifyoufaultatpid185whenyoutypestress + +Revision1.332004/07/2309:10:06reddawg +ubixfs:cleanedupsomefunctionsplayedwiththecachingabit +vfs:renamedabunchoffunctions +cleanedupafewmiscbugs + +Revision1.322004/07/2223:01:51reddawg +OkcheckinginbeforeIsleep + +Revision1.312004/07/2222:37:03reddawg +CachingisworkingnowtheFSisextremelyfastbutneedstobeoptimizedtodo32bitcopiesover8bit + +Revision1.302004/07/2219:01:59flameshadow +chg:moredirectoryandfilecaching + +Revision1.292004/07/2216:34:32flameshadow +add:fileanddircachingkindawork + +Revision1.282004/07/2122:07:18flameshadow +chg:renamedcachingfunctions(again) + +Revision1.272004/07/2121:08:05flameshadow +add:addedprovisionsforfilecaching + +Revision1.262004/07/2023:21:31flameshadow +syncing + +Revision1.252004/07/2021:39:53reddawg +ubixfs:doesproppercachingnowproblemwasyoudidnotseekrealSectorhowevertheosstartsbutIamgettingasegfaultcouldbefromanythinghaven'tlookedintoitrightquick + +Revision1.242004/07/2021:38:08flameshadow +trynow + - -Revision1.232004/07/2021:35:09reddawg -Letmecommitbeforewestarttooverlap - -Revision1.222004/07/2021:28:16flameshadow -oops - -Revision1.202004/07/2019:36:49reddawg -UBUTags - -Revision1.192004/07/2018:09:37flameshadow -add:directorycachingrelatedstuff - -Revision1.182004/07/1703:21:34flameshadow -chg:cleanedupcode;addedassert()statements - -Revision1.152004/07/1412:21:49reddawg -ubixfs:enableUbixFstoubixfs_init -ChangedStartupRoutines - -Revision1.142004/06/2823:12:58reddawg -fileformatnowcontainer:/path/to/file - -Revision1.132004/06/2818:12:44reddawg -Weneedthesefiles - -Revision1.122004/06/2811:57:58reddawg -FixingUpFilesystem - -Revision1.102004/06/0413:20:22reddawg -ubixFSmkDir():playedwithitabittoseeifitstillworked - -Revision1.92004/06/0410:19:42reddawg -notes:wecompileagain,thankg-danywaysiwasabouttocry - -Revision1.82004/06/0100:04:53reddawg -Trynowmark - -Revision1.72004/05/1915:20:06reddawg -Fixedreferenceproblemsduetochangesindrivesubsystem - -Revision1.62004/05/1904:07:43reddawg -kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen - -Revision1.52004/04/2915:45:19reddawg -Fixedsomebugssonowtheautomadeimageswillworkcorrectly - -Revision1.42004/04/2821:10:40reddawg -LotsOfchangestomakeitworkwithexistingos - -Revision1.32004/04/2813:33:09reddawg -OverhaultoubixfsandbootloaderandMBRtoworkwellwithourschema -nowBATanddirandfileentriesarealloffset64Sectorsfromthestartofthepartition - -Revision1.22004/04/2802:22:55reddawg -Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel -allaround - -Revision1.1.1.12004/04/1512:07:08reddawg -UbixOSv1.0 - -Revision1.312004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ - +Revision1.232004/07/2021:35:09reddawg +Letmecommitbeforewestarttooverlap + +Revision1.222004/07/2021:28:16flameshadow +oops + +Revision1.202004/07/2019:36:49reddawg +UBUTags + +Revision1.192004/07/2018:09:37flameshadow +add:directorycachingrelatedstuff + +Revision1.182004/07/1703:21:34flameshadow +chg:cleanedupcode;addedassert()statements + +Revision1.152004/07/1412:21:49reddawg +ubixfs:enableUbixFstoubixfs_init +ChangedStartupRoutines + +Revision1.142004/06/2823:12:58reddawg +fileformatnowcontainer:/path/to/file + +Revision1.132004/06/2818:12:44reddawg +Weneedthesefiles + +Revision1.122004/06/2811:57:58reddawg +FixingUpFilesystem + +Revision1.102004/06/0413:20:22reddawg +ubixFSmkDir():playedwithitabittoseeifitstillworked + +Revision1.92004/06/0410:19:42reddawg +notes:wecompileagain,thankg-danywaysiwasabouttocry + +Revision1.82004/06/0100:04:53reddawg +Trynowmark + +Revision1.72004/05/1915:20:06reddawg +Fixedreferenceproblemsduetochangesindrivesubsystem + +Revision1.62004/05/1904:07:43reddawg +kmalloc(size,pid)nomoreitisnokmalloc(size);thewayitshouldofbeen + +Revision1.52004/04/2915:45:19reddawg +Fixedsomebugssonowtheautomadeimageswillworkcorrectly + +Revision1.42004/04/2821:10:40reddawg +LotsOfchangestomakeitworkwithexistingos + +Revision1.32004/04/2813:33:09reddawg +OverhaultoubixfsandbootloaderandMBRtoworkwellwithourschema +nowBATanddirandfileentriesarealloffset64Sectorsfromthestartofthepartition + +Revision1.22004/04/2802:22:55reddawg +Thisisafiarlylargecommitbutwearestartingtousenewdrivermodel +allaround + +Revision1.1.1.12004/04/1512:07:08reddawg +UbixOSv1.0 + +Revision1.312004/04/1316:36:34reddawg +Changedourcopyright,itisallnowunderaBSD-Stylelicense + +END +***/ + - + diff --git a/doc/xml/ubixfs_8cpp.xml b/doc/xml/ubixfs_8cpp.xml index 36cd065..eb5fc33 100644 --- a/doc/xml/ubixfs_8cpp.xml +++ b/doc/xml/ubixfs_8cpp.xml @@ -1,599 +1,466 @@ - - - + + + ubixfs.cpp - stddef.h - stdlib.h - unistd.h - string.h - assert.h - iostream - ubixfs.h - btree.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#include<stddef.h> -#include<stdlib.h> -#include<unistd.h> -#include<string.h> -#include<assert.h> -#include<iostream> - -#include"ubixfs.h" -#include"btree.h" - -usingnamespacestd; - -UbixFS::UbixFS(void){ -device=NULL; -freeBlockList=NULL; -superBlock=NULL; -root=NULL; -}//UbixFS::UbixFS - - -UbixFS::UbixFS(device_t*dev){ -device=dev; -freeBlockList=NULL; -superBlock=NULL; -root=NULL; -}//UbixFS::UbixFS - -void -UbixFS::printSuperBlock(void){ -printf("superBlock->name...........%s\n",superBlock->name); -printf("superBlock->magic1.........%X\n",superBlock->magic1); -printf("superBlock->fsByteOrder....%d\n",superBlock->fsByteOrder); -printf("superBlock->blockSize......%d\n",superBlock->blockSize); -printf("superBlock->blockShift.....%d\n",superBlock->blockShift); -printf("superBlock->numBlocks......%lld\n",superBlock->numBlocks); -printf("superBlock->usedBlocks.....%lld\n",superBlock->usedBlocks); -printf("superBlock->batSectors.....%d\n",superBlock->batSectors); -printf("superBlock->inodeCount.....%d\n",superBlock->inodeCount); -printf("superBlock->magic2.........%X\n",superBlock->magic2); -printf("superBlock->blocksPerAG....%d\n",superBlock->blocksPerAG); -printf("superBlock->AGShift........%d\n",superBlock->AGShift); -printf("superBlock->numAGs.........%d\n",superBlock->numAGs); -printf("superBlock->lastUsedAG.....%d\n",superBlock->lastUsedAG); -printf("superBlock->flags..........%X\n",superBlock->flags); -printf("superBlock->magic3.........%X\n",superBlock->magic3); -return; -}//UbixFS::printSuperBlock - -int -UbixFS::vfs_init(void){ -assert(device); -size_tresult; -cout<<"vfs_init()"<<endl; -assert(device); - -if(device==NULL)return-1; -if(superBlock!=NULL)deletesuperBlock; -superBlock=newdiskSuperBlock; -assert(superBlock); -if(superBlock==NULL)return-1; - -//readinthesuperBlock.It'salwaysthelastblockonthepartition -cout<<"readinginsuperBlock"<<endl; -device->read(device,superBlock,device->sectors-1,1); -cout<<"done"<<endl; - -assert(superBlock->magic1==UBIXFS_MAGIC1); -assert(superBlock->magic2==UBIXFS_MAGIC2); -assert(superBlock->magic3==UBIXFS_MAGIC3); -assert(strcmp(superBlock->name,"UbixFS")==0); -assert((1<<superBlock->blockShift)==superBlock->blockSize); -assert((unsigned)(1<<superBlock->AGShift)==superBlock->blocksPerAG); -assert(superBlock->flags==UBIXFS_CLEAN); - -if(freeBlockList!=NULL)delete[]freeBlockList; -freeBlockList=newsignedchar[superBlock->batSectors*512]; -assert(freeBlockList); -memset(freeBlockList,0,superBlock->batSectors*512); - -device->read(device, -freeBlockList, -device->sectors-superBlock->batSectors-1, -superBlock->batSectors -);//device->read() - -root=newfileDescriptor; -assert(root); -memset(root,0,sizeof(fileDescriptor)); -cout<<"allocatingrootdirinode"<<endl; -root->inode=newubixfsInode; -memset(root->inode,0,sizeof(ubixfsInode)); -cout<<"rootdirinodestartingsector:"<< -((superBlock->rootDir.AG<<superBlock->AGShift) -+superBlock->rootDir.start)*(superBlock->blockSize/512) -<<endl; - -cout<<"readinginrootdirinode"<<endl; - -device->read(device, -root->inode, -((superBlock->rootDir.AG<<superBlock->AGShift) -+superBlock->rootDir.start)*(superBlock->blockSize/512), -sizeof(ubixfsInode)/512 -); -cout<<"done"<<endl; -ubixfsInode*rootInode=static_cast<ubixfsInode*>(root->inode); -assert(rootInode); - -/*thebTreeconstructornowloadsintheheader*/ - -rootInode->data.btPtr=newbTree(this,root); -rootInode->data.btPtr->Info(); -printSuperBlock(); -return0; -}//UbixFS::init - -int -UbixFS::vfs_format(device_t*dev){ -cout<<"vfs_format()"<<endl; -charsector[512]; -uInt32blocks,batSect,batSize; -if(dev==NULL)return-1; - -//zerooutthesector -memset(&sector,0x0,sizeof(sector)); - -//fillthedriveinwithzeroedoutsectors -cout<<"dev->sectors:"<<dev->sectors<<endl; -cout<<"clearingdevice..."; - -for(unsignedinti=0;i<dev->sectors;i++){ -dev->write(dev,&sector,i,1); -}//fori - -cout<<"done"<<endl; - -//allocateanewsuperBlockandclearit - -diskSuperBlock*sb=newdiskSuperBlock; -if(sb==NULL)return-1; -memset(sb,0,sizeof(diskSuperBlock)); - -//dev->sectorsisthenumberof512bytesectors - -blocks=(dev->sectors-1)/8;//4kblocks -batSize=(dev->sectors-1)%8;//remainder - -//computetheBATsize - -while((batSize*4096)<blocks){ -batSize+=8; ---blocks; -}//while - -//batSizeisinsectors -batSect=blocks*8; - -strcpy(sb->name,"UbixFS"); -sb->magic1=UBIXFS_MAGIC1; -sb->fsByteOrder=0; -sb->blockSize=4096; -sb->blockShift=12; -sb->numBlocks=blocks; -sb->usedBlocks=2;//rootdirtakestwoblocks(inode+bTreeheader) -sb->inodeCount=1; -sb->inodeSize=4096; -sb->magic2=UBIXFS_MAGIC2; -sb->blocksPerAG=2048; -sb->AGShift=11; -sb->numAGs=(sb->numBlocks+2047)/2048; -sb->lastUsedAG=0; - -//theBATexistsoutsideourofficialblockcount,sono -//entriesintheBATneedtobesetforit -sb->batSectors=batSize; - -sb->flags=0x434C454E;//CLEN -sb->logBlocks.AG=0; -sb->logBlocks.start=0; -sb->logBlocks.len=0; -sb->logStart=0; -sb->logEnd=0; -sb->magic3=UBIXFS_MAGIC3; -sb->indicies.AG=0; -sb->indicies.start=0; -sb->indicies.len=0; - -sb->rootDir.AG=0; -sb->rootDir.start=0; -sb->rootDir.len=1; - -//writeoutthesuperBlock - -dev->write(dev,sb,dev->sectors-1,1); - -//markthefirsttwo4kblocksused -memset(&sector,0,sizeof(sector)); -sector[0]=(1<<7)|(1<<6); - -//writeoutthefirstsectoroftheBAT - -dev->write(dev,&sector,batSect,1); -//cleartherest -sector[0]=0; - -//writeouttherestoftheBAT - -for(unsignedinti=1;i<batSize;i++){ -dev->write(dev,&sector,(batSect)+i,1); -}//fori - -/*allocatepartoftherootdir*/ - -//sanitychecks -assert(sb->blockSize); -assert((unsigned)sb->blockSize>=sizeof(bTreeHeader)); - -bTreeHeader*bth=newbTreeHeader; -assert(bth); -memset(bth,0,sizeof(bTreeHeader)); - -bth->firstDeleted=-1; -bth->firstNodeOffset=-1; -bth->treeDepth=1; -bth->treeWidth=0; -bth->treeLeafCount=0; - -/*createtherootdirinodehere*/ - -ubixfsInode*inode=newubixfsInode; -assert(inode); -if(inode==NULL)return-1; -memset(inode,0,sizeof(ubixfsInode)); - -inode->magic1=UBIXFS_INODE_MAGIC; - -//inodespointtothemselves -inode->inodeNum.AG=0; -inode->inodeNum.start=0; -inode->inodeNum.len=1; - -//rootdirhasnoparentdirectory -inode->parent.iAddr.AG=0; -inode->parent.iAddr.start=0; -inode->parent.iAddr.len=0; - -/*thisispartoftherootdirstructure(thebTreeHeader)*/ -inode->blocks.direct[0].AG=0; -inode->blocks.direct[0].start=1; -inode->blocks.direct[0].len=1; - -inode->blocks.maxDirectRange=sizeof(bTreeHeader); -inode->blocks.size=sizeof(bTreeHeader); - -strcpy(inode->name,"/"); -inode->uid=getuid(); -inode->gid=getgid(); -//inode->mode -inode->flags=INODE_DIRECTORY; -//inode->createTime -//inode->lastModifiedTime -//inode->type - -inode->attributes.AG=0; -inode->attributes.start=0; -inode->attributes.len=0; - -inode->inodeSize=sb->inodeSize; - -/* +/*#include<stddef.h> +#include<stdlib.h> +#include<unistd.h> +#include<string.h> +#include<assert.h> +#include<iostream> + +#include"ubixfs.h" +#include"btree.h" + +usingnamespacestd; + +UbixFS::UbixFS(void){ +device=NULL; +freeBlockList=NULL; +superBlock=NULL; +root=NULL; +}//UbixFS::UbixFS + + +UbixFS::UbixFS(device_t*dev){ +device=dev; +freeBlockList=NULL; +superBlock=NULL; +root=NULL; +}//UbixFS::UbixFS + +void +UbixFS::printSuperBlock(void){ +printf("superBlock->name...........%s\n",superBlock->name); +printf("superBlock->magic1.........%X\n",superBlock->magic1); +printf("superBlock->fsByteOrder....%d\n",superBlock->fsByteOrder); +printf("superBlock->blockSize......%d\n",superBlock->blockSize); +printf("superBlock->blockShift.....%d\n",superBlock->blockShift); +printf("superBlock->numBlocks......%lld\n",superBlock->numBlocks); +printf("superBlock->usedBlocks.....%lld\n",superBlock->usedBlocks); +printf("superBlock->batSectors.....%d\n",superBlock->batSectors); +printf("superBlock->inodeCount.....%d\n",superBlock->inodeCount); +printf("superBlock->magic2.........%X\n",superBlock->magic2); +printf("superBlock->blocksPerAG....%d\n",superBlock->blocksPerAG); +printf("superBlock->AGShift........%d\n",superBlock->AGShift); +printf("superBlock->numAGs.........%d\n",superBlock->numAGs); +printf("superBlock->lastUsedAG.....%d\n",superBlock->lastUsedAG); +printf("superBlock->flags..........%X\n",superBlock->flags); +printf("superBlock->magic3.........%X\n",superBlock->magic3); +return; +}//UbixFS::printSuperBlock + +int +UbixFS::vfs_init(void){ +assert(device); +size_tresult; +cout<<"vfs_init()"<<endl; +assert(device); + +if(device==NULL)return-1; +if(superBlock!=NULL)deletesuperBlock; +superBlock=newdiskSuperBlock; +assert(superBlock); +if(superBlock==NULL)return-1; + +//readinthesuperBlock.It'salwaysthelastblockonthepartition +cout<<"readinginsuperBlock"<<endl; +device->read(device,superBlock,device->sectors-1,1); +cout<<"done"<<endl; + +assert(superBlock->magic1==UBIXFS_MAGIC1); +assert(superBlock->magic2==UBIXFS_MAGIC2); +assert(superBlock->magic3==UBIXFS_MAGIC3); +assert(strcmp(superBlock->name,"UbixFS")==0); +assert((1<<superBlock->blockShift)==superBlock->blockSize); +assert((unsigned)(1<<superBlock->AGShift)==superBlock->blocksPerAG); +assert(superBlock->flags==UBIXFS_CLEAN); + +if(freeBlockList!=NULL)delete[]freeBlockList; +freeBlockList=newsignedchar[superBlock->batSectors*512]; +assert(freeBlockList); +memset(freeBlockList,0,superBlock->batSectors*512); + +device->read(device, +freeBlockList, +device->sectors-superBlock->batSectors-1, +superBlock->batSectors +);//device->read() + +root=newfileDescriptor; +assert(root); +memset(root,0,sizeof(fileDescriptor)); +cout<<"allocatingrootdirinode"<<endl; +root->inode=newubixfsInode; +memset(root->inode,0,sizeof(ubixfsInode)); +cout<<"rootdirinodestartingsector:"<< +((superBlock->rootDir.AG<<superBlock->AGShift) ++superBlock->rootDir.start)*(superBlock->blockSize/512) +<<endl; + +cout<<"readinginrootdirinode"<<endl; + +device->read(device, +root->inode, +((superBlock->rootDir.AG<<superBlock->AGShift) ++superBlock->rootDir.start)*(superBlock->blockSize/512), +sizeof(ubixfsInode)/512 +); +cout<<"done"<<endl; +ubixfsInode*rootInode=static_cast<ubixfsInode*>(root->inode); +assert(rootInode); + +//thebTreeconstructornowloadsintheheader + +rootInode->data.btPtr=newbTree(this,root); +rootInode->data.btPtr->Info(); +printSuperBlock(); +return0; +}//UbixFS::init + +int +UbixFS::vfs_format(device_t*dev){ +cout<<"vfs_format()"<<endl; +charsector[512]; +uInt32blocks,batSect,batSize; +if(dev==NULL)return-1; + +//zerooutthesector +memset(&sector,0x0,sizeof(sector)); + +//fillthedriveinwithzeroedoutsectors +cout<<"dev->sectors:"<<dev->sectors<<endl; +cout<<"clearingdevice..."; + +for(unsignedinti=0;i<dev->sectors;i++){ +dev->write(dev,&sector,i,1); +}//fori + +cout<<"done"<<endl; + +//allocateanewsuperBlockandclearit + +diskSuperBlock*sb=newdiskSuperBlock; +if(sb==NULL)return-1; +memset(sb,0,sizeof(diskSuperBlock)); + +//dev->sectorsisthenumberof512bytesectors + +blocks=(dev->sectors-1)/8;//4kblocks +batSize=(dev->sectors-1)%8;//remainder + +//computetheBATsize + +while((batSize*4096)<blocks){ +batSize+=8; +--blocks; +}//while + +//batSizeisinsectors +batSect=blocks*8; + +strcpy(sb->name,"UbixFS"); +sb->magic1=UBIXFS_MAGIC1; +sb->fsByteOrder=0; +sb->blockSize=4096; +sb->blockShift=12; +sb->numBlocks=blocks; +sb->usedBlocks=2;//rootdirtakestwoblocks(inode+bTreeheader) +sb->inodeCount=1; +sb->inodeSize=4096; +sb->magic2=UBIXFS_MAGIC2; +sb->blocksPerAG=2048; +sb->AGShift=11; +sb->numAGs=(sb->numBlocks+2047)/2048; +sb->lastUsedAG=0; + +//theBATexistsoutsideourofficialblockcount,sono +//entriesintheBATneedtobesetforit +sb->batSectors=batSize; + +sb->flags=0x434C454E;//CLEN +sb->logBlocks.AG=0; +sb->logBlocks.start=0; +sb->logBlocks.len=0; +sb->logStart=0; +sb->logEnd=0; +sb->magic3=UBIXFS_MAGIC3; +sb->indicies.AG=0; +sb->indicies.start=0; +sb->indicies.len=0; + +sb->rootDir.AG=0; +sb->rootDir.start=0; +sb->rootDir.len=1; + +//writeoutthesuperBlock + +dev->write(dev,sb,dev->sectors-1,1); + +//markthefirsttwo4kblocksused +memset(&sector,0,sizeof(sector)); +sector[0]=(1<<7)|(1<<6); + +//writeoutthefirstsectoroftheBAT + +dev->write(dev,&sector,batSect,1); +//cleartherest +sector[0]=0; + +//writeouttherestoftheBAT + +for(unsignedinti=1;i<batSize;i++){ +dev->write(dev,&sector,(batSect)+i,1); +}//fori + +//allocatepartoftherootdir + +//sanitychecks +assert(sb->blockSize); +assert((unsigned)sb->blockSize>=sizeof(bTreeHeader)); + +bTreeHeader*bth=newbTreeHeader; +assert(bth); +memset(bth,0,sizeof(bTreeHeader)); + +bth->firstDeleted=-1; +bth->firstNodeOffset=-1; +bth->treeDepth=1; +bth->treeWidth=0; +bth->treeLeafCount=0; + +//createtherootdirinodehere + +ubixfsInode*inode=newubixfsInode; +assert(inode); +if(inode==NULL)return-1; +memset(inode,0,sizeof(ubixfsInode)); + +inode->magic1=UBIXFS_INODE_MAGIC; + +//inodespointtothemselves +inode->inodeNum.AG=0; +inode->inodeNum.start=0; +inode->inodeNum.len=1; + +//rootdirhasnoparentdirectory +inode->parent.iAddr.AG=0; +inode->parent.iAddr.start=0; +inode->parent.iAddr.len=0; + +//thisispartoftherootdirstructure(thebTreeHeader) +inode->blocks.direct[0].AG=0; +inode->blocks.direct[0].start=1; +inode->blocks.direct[0].len=1; + +inode->blocks.maxDirectRange=sizeof(bTreeHeader); +inode->blocks.size=sizeof(bTreeHeader); + +strcpy(inode->name,"/"); +inode->uid=getuid(); +inode->gid=getgid(); +//inode->mode +inode->flags=INODE_DIRECTORY; +//inode->createTime +//inode->lastModifiedTime +//inode->type + +inode->attributes.AG=0; +inode->attributes.start=0; +inode->attributes.len=0; + +inode->inodeSize=sb->inodeSize; + +*//* *nextandprevareusedinmemorytoholdpointerstothenext/prev *inodesinthisdir.Ondisktheymayhaveanothervalue,butfor *nowtheyshouldbesettonull. -*/ - -inode->next.offset=0; -inode->prev.offset=0; - -//writeoutthe"root"dirinode - -dev->write(dev, -inode, -((inode->inodeNum.AG<<sb->AGShift)+ -inode->inodeNum.start)*(sb->blockSize/512), -sb->inodeSize/512 -);//dev->write - -//writeoutthe"root"dir - -dev->write(dev, -bth, -((inode->blocks.direct[0].AG<<sb->AGShift)+ -inode->blocks.direct[0].start)*(sb->blockSize/512), -sb->blockSize/512 -);//dev->write - -deleteinode; -deletebth; -deletesb; -cout<<"formatcomplete"<<endl; -return0; -}//UbixFS::vfs_format - -void* -UbixFS::vfs_mknod(constchar*path,mode_tmode){ -returnmknod(path,0,mode);//<-thisprobablyisn'tcorrect -}//UbixFS::vfs_mknod - -int -UbixFS::vfs_open(constchar*filename,fileDescriptor*fd,intflags,...){ -if(filename==NULL||fd==NULL)return-1; -flags=flags; -fd->inode=NULL; -fd->offset=0; -fd->size=0; -//lookupthefilehere -return0; -}//UbixFS::vfs_open - -size_t -UbixFS::vfs_read(fileDescriptor*fd,void*data,off_toffset,size_tsize){ - -unsignedinti; -off_tsum,startingBlock; -size_trunSize,sectorCount,totalSize,bSize;//blockSize -ubixfsInode*inode=NULL; - -if(fd==NULL||data==NULL)return~0; - -if(size==0)return0;//don'tfailifsizeis0? - -assert(device); -assert(superBlock); - -inode=static_cast<ubixfsInode*>(fd->inode); - -assert(inode); - -bSize=superBlock->blockSize; - -totalSize=sum=i=0; - -while(size>0){ - -/* +*//* + +inode->next.offset=0; +inode->prev.offset=0; + +//writeoutthe"root"dirinode + +dev->write(dev, +inode, +((inode->inodeNum.AG<<sb->AGShift)+ +inode->inodeNum.start)*(sb->blockSize/512), +sb->inodeSize/512 +);//dev->write + +//writeoutthe"root"dir + +dev->write(dev, +bth, +((inode->blocks.direct[0].AG<<sb->AGShift)+ +inode->blocks.direct[0].start)*(sb->blockSize/512), +sb->blockSize/512 +);//dev->write + +deleteinode; +deletebth; +deletesb; +cout<<"formatcomplete"<<endl; +return0; +}//UbixFS::vfs_format + +void* +UbixFS::vfs_mknod(constchar*path,mode_tmode){ +returnmknod(path,0,mode);//<-thisprobablyisn'tcorrect +}//UbixFS::vfs_mknod + +int +UbixFS::vfs_open(constchar*filename,fileDescriptor*fd,intflags,...){ +if(filename==NULL||fd==NULL)return-1; +flags=flags; +fd->inode=NULL; +fd->offset=0; +fd->size=0; +//lookupthefilehere +return0; +}//UbixFS::vfs_open + +size_t +UbixFS::vfs_read(fileDescriptor*fd,void*data,off_toffset,size_tsize){ + +unsignedinti; +off_tsum,startingBlock; +size_trunSize,sectorCount,totalSize,bSize;//blockSize +ubixfsInode*inode=NULL; + +if(fd==NULL||data==NULL)return~0; + +if(size==0)return0;//don'tfailifsizeis0? + +assert(device); +assert(superBlock); + +inode=static_cast<ubixfsInode*>(fd->inode); + +assert(inode); + +bSize=superBlock->blockSize; + +totalSize=sum=i=0; + +while(size>0){ + +*//* *placecheckheretoseewhichsetofblockswe'relookingthrough -*/ - -//scanthroughdirectblocks -do{ -if(offset>=sum&&offset<sum+inode->blocks.direct[i].len*bSize)break; - -sum+=inode->blocks.direct[i++].len*bSize; - -}while(i<NUM_DIRECT_BLOCKS); - -startingBlock=(inode->blocks.direct[i].AG<<superBlock->AGShift)+ -inode->blocks.direct[i].start+((offset-sum)/bSize); - -runSize=inode->blocks.direct[i].len*bSize; - -//startingBlockisin4kblocks -startingBlock*=(bSize/512); -//startingBlockisnowinsectors - -if(runSize>=size){ -runSize=size; -size=0; -}else{ -size-=runSize; -}//else - -sectorCount=runSize/512; - -cout<<"device->read(device,data,"<<startingBlock<<","; -cout<<sectorCount<<");"<<endl; - -device->read(device,data,startingBlock,sectorCount); - -(uInt8*)data+=runSize; -totalSize+=runSize; -}//while -returntotalSize; -}//UbixFS::vfs_read - -size_t -UbixFS::vfs_write(fileDescriptor*fd,void*data,off_toffset,size_tsize){ -//char*sector[512];//usedtopad -unsignedinti,whichBlocks; -off_tsum,startingBlock,EORPos,maxRange; -size_trunSize,runRemainder,sectorCount,totalSize,bSize;//blockSize -ubixfsInode*inode=NULL; -blockRunbr; - -if(fd==NULL||data==NULL)return~0; - -if(size==0)return0;//don'tfailifsizeis0? - -assert(device); -assert(superBlock); - -inode=static_cast<ubixfsInode*>(fd->inode); - -assert(inode); - -bSize=superBlock->blockSize; -assert(bSize!=0); - -totalSize=sum=i=whichBlocks=0; - -EORPos=offset+size;//computeEndOfRunPosition -maxRange=inode->blocks.maxDirectRange; - -if(inode->blocks.maxIndirectRange>maxRange){ -maxRange=inode->blocks.maxIndirectRange; -whichBlocks=1; -} - -if(inode->blocks.maxDoubleIndirectRange>maxRange){ -maxRange=inode->blocks.maxDoubleIndirectRange; -whichBlocks=2; -} - -if(EORPos>maxRange){ -/* +*//* + +//scanthroughdirectblocks +do{ +if(offset>=sum&&offset<sum+inode->blocks.direct[i].len*bSize)break; + +sum+=inode->blocks.direct[i++].len*bSize; + +}while(i<NUM_DIRECT_BLOCKS); + +startingBlock=(inode->blocks.direct[i].AG<<superBlock->AGShift)+ +inode->blocks.direct[i].start+((offset-sum)/bSize); + +runSize=inode->blocks.direct[i].len*bSize; + +//startingBlockisin4kblocks +startingBlock*=(bSize/512); +//startingBlockisnowinsectors + +if(runSize>=size){ +runSize=size; +size=0; +}else{ +size-=runSize; +}//else + +sectorCount=runSize/512; + +cout<<"device->read(device,data,"<<startingBlock<<","; +cout<<sectorCount<<");"<<endl; + +device->read(device,data,startingBlock,sectorCount); + +(uInt8*)data+=runSize; +totalSize+=runSize; +}//while +returntotalSize; +}//UbixFS::vfs_read + +size_t +UbixFS::vfs_write(fileDescriptor*fd,void*data,off_toffset,size_tsize){ +//char*sector[512];//usedtopad +unsignedinti,whichBlocks; +off_tsum,startingBlock,EORPos,maxRange; +size_trunSize,runRemainder,sectorCount,totalSize,bSize;//blockSize +ubixfsInode*inode=NULL; +blockRunbr; + +if(fd==NULL||data==NULL)return~0; + +if(size==0)return0;//don'tfailifsizeis0? + +assert(device); +assert(superBlock); + +inode=static_cast<ubixfsInode*>(fd->inode); + +assert(inode); + +bSize=superBlock->blockSize; +assert(bSize!=0); + +totalSize=sum=i=whichBlocks=0; + +EORPos=offset+size;//computeEndOfRunPosition +maxRange=inode->blocks.maxDirectRange; + +if(inode->blocks.maxIndirectRange>maxRange){ +maxRange=inode->blocks.maxIndirectRange; +whichBlocks=1; +} + +if(inode->blocks.maxDoubleIndirectRange>maxRange){ +maxRange=inode->blocks.maxDoubleIndirectRange; +whichBlocks=2; +} + +if(EORPos>maxRange){ +*//* *Theoffset+sizeisgreaterthanthesizeofthefile,soweneedto *extendoutthefile.Scanthroughthedirectblocks(FIXLATER) *tofindoutwhereweneedtoextend -*/ -switch(whichBlocks){ -case0: -while(i<NUM_DIRECT_BLOCKS&&inode->blocks.direct[i].len!=0)++i; -//iholdswhichdirectblockwe'regoingtoaddto -break; -case1: -case2: -assert(false);//UNFINISHED -break; -default: -assert(false);//sanitycheck -}//switch - -/* +*//* +switch(whichBlocks){ +case0: +while(i<NUM_DIRECT_BLOCKS&&inode->blocks.direct[i].len!=0)++i; +//iholdswhichdirectblockwe'regoingtoaddto +break; +case1: +case2: +assert(false);//UNFINISHED +break; +default: +assert(false);//sanitycheck +}//switch + +*//* *NOTE:it'spossiblethatifwescanthroughtofindwherethe *rungoes,wemightbeabletoextendthepreviousblockextent. *Thiswillrequirethatwesetupbr.starttobewherewe'dliketo *startlookingthroughthefreeblocklist,andthenmodifying *getFreeBlock()tohonourthat. -*/ - -br.AG=inode->inodeNum.AG;//requestasaneallocationgroup -br.start=0;//getFreeBlock()willignorethis - -/* +*//* + +br.AG=inode->inodeNum.AG;//requestasaneallocationgroup +br.start=0;//getFreeBlock()willignorethis + +*//* *Thelengththatweneedisdeterminedbyhowmuchextraslackwe *alreadyhaveinthepre-allocatedblocks. *e.g.(assumes4kblocks) @@ -615,521 +482,521 @@ *((3000+4000)-4096+(4095))/4096==1(roundeddown) *Andthenweexpanditbyalittleextrasowedon'thavetokeep *lookingformoreblocks.Currentlyweuse32kofslack(or8blocks) -*/ - -br.len=((EORPos-maxRange+(bSize-1))/bSize); - -if(br.len<8)br.len=8;//weallocate32kifthefileneedstogrow - -br=getFreeBlock(br); -assert(br.len>0); -switch(whichBlocks){ -case0: -inode->blocks.direct[i]=br; -inode->blocks.maxDirectRange+=br.len*bSize; -break; -case1: -assert(false);//UNFINISHED -inode->blocks.maxIndirectRange+=br.len*bSize; -break; -case2: -assert(false);//UNFINISHED -inode->blocks.maxDoubleIndirectRange+=br.len*bSize; -break; -default: -assert(false);//sanitycheck -}//switch - -inode->blocks.size=EORPos; -}//if - - -runRemainder=size%512; -size-=runRemainder; - -totalSize=sum=i=0; - -while(size>0){ - -/* -*placecheckheretoseewhichsetofblockswe'relookingthrough -*/ - -//scanthroughdirectblocks -do{ -if(offset>=sum&&offset<sum+inode->blocks.direct[i].len*bSize) -break; - -sum+=inode->blocks.direct[i++].len*bSize; - -}while(i<NUM_DIRECT_BLOCKS); - -startingBlock=(inode->blocks.direct[i].AG<<superBlock->AGShift)+ -inode->blocks.direct[i].start+((offset-sum)/bSize); - -runSize=inode->blocks.direct[i].len*bSize; - -//startingBlockisin4kblocks -startingBlock*=(bSize/512); -//startingBlockisnowinsectors - -if(runSize>=size){ -runSize=size; -size=0; -}else{ -size-=runSize; -}//else - -sectorCount=runSize/512; - -cout<<"device->write(device,data,"<<startingBlock<<","; -cout<<sectorCount<<");"<<endl; - -device->write(device,data,startingBlock,sectorCount); - -(uInt8*)data+=runSize; -totalSize+=runSize; -}//while - -assert(runRemainder!=0);//UNFINISHED -returntotalSize; -}//UbixFS::vfs_write - -int -UbixFS::vfs_stop(void){ -if(vfs_sync()!=0)return-1; - -//youmustdeletetherootdirfirst,incaseitneedsto -//stillwriteanythingout - -if(root!=NULL){ -ubixfsInode*rootInode=static_cast<ubixfsInode*>(root->inode); -deleterootInode->data.btPtr; -deleterootInode; -root->inode=NULL; - -}//if - -deleteroot; -delete[]freeBlockList; -deletesuperBlock; - -freeBlockList=NULL; -superBlock=NULL; -root=NULL; - -/* -*Thedeviceisn'tnullatthispoint,allowingforpeopletorestart -*themountpoint.Or,alternatively,toblowthingsup. -*/ - -return0; -}//UbixFS::vfs_stop - -int -UbixFS::vfs_sync(void){ -if(device==NULL||superBlock==NULL||freeBlockList==NULL)return-1; -device->write(device, -freeBlockList, -device->sectors-superBlock->batSectors-1, -superBlock->batSectors -); -device->write(device,superBlock,device->sectors-1,1); -return0; -}//UbixFS::vfs_sync - -void -UbixFS::setFreeBlock(blockRunibr){ -signedchar*ptr; - -if(superBlock==NULL||freeBlockList==NULL)return; -if(ibr.len==0)return; -ptr=freeBlockList+((ibr.AG<<superBlock->AGShift)>>3); -ptr+=ibr.start>>3; - -if(ibr.start%8!=0){ - -ibr.len-=ibr.start%8; -}//if - -}//UbixFS::setFreeBlock - -blockRun -UbixFS::getFreeBlock(blockRunibr){ -signedchar*ptr; -signedchar*holdPtr; -int32count,holdCount; - -blockRunobr={0,0,0};//outputblockrun - -//Checktomakesurenoneofthesearenull -if(device==NULL||freeBlockList==NULL||superBlock==NULL)returnobr; - -if(ibr.len==0)returnobr; - -if(ibr.len>superBlock->numBlocks)returnobr; - -if(ibr.len==1)returngetFreeBlock(ibr.AG); -/* -*countistheblockfromthebaseofthelist. -*Sincewe'regivenaspecificAGtolookthrough,westartthecountat -*AG<<AGShift,whereAGShiftistheshiftvalueofthenumberofblocks -*inanAG -*/ - -count=(ibr.AG<<superBlock->AGShift); - -/* -*ThefreeBlockListisabitmapofthefree/usedblocks. -*Used=onbit -*Unused=offbit -*Thereare8bitsperbyte(hopefully)andsowehavetodividethecount -*by8togetourstartingbyteoffsettolookfrom -*/ - -ptr=freeBlockList+(count>>3); - -rescan: -//lookforthefirstfree8blocks(thismaycreateholes) -while(*ptr!=0){ -++ptr; -count+=8; -if(count+8>superBlock->numBlocks){ -ptr=freeBlockList; -count=0; -}//if -}//while*ptr!=0 - -holdPtr=ptr; -holdCount=count; - -for(unsignedshorti=0;i<((ibr.len+7)/8);i++){ -++ptr; -count+=8; -if(count+8>superBlock->numBlocks){ -ptr=freeBlockList; -count=0; -gotorescan; -}//if -if(*ptr!=0)gotorescan; -}//fori - -//wehavefoundarangeofblocksthatworkforus - -obr.AG=holdCount/superBlock->blocksPerAG; -obr.start=holdCount%superBlock->blocksPerAG; -obr.len=ibr.len; - -for(unsignedshorti=0;i<(ibr.len/8);i++){ -*holdPtr=-1; -++holdPtr; -}//for - -if(ibr.len%8!=0)*holdPtr=(-1<<(8-(ibr.len%8))); - -superBlock->usedBlocks+=ibr.len;//incrementthenumberofusedblocks -returnobr; -}//UbixFS::getFreeBlock - -blockRun -UbixFS::getFreeBlock(uInt32AG){ -//AG==AllocationGroup -blockRunbr; -signedchar*ptr; -int32count; -int32subCount=128; - -br.AG=0; -br.start=0; -br.len=0; -//Checktomakesureneitherofthesearenull -if(device==NULL||freeBlockList==NULL||superBlock==NULL)returnbr; - -//Arethereanyblocksavailable? -if(superBlock->numBlocks==superBlock->usedBlocks)returnbr; - -/* -*countistheblockfromthebaseofthelist. -*Sincewe'regivenaspecificAGtolookthrough,westartthecountat -*AG<<AGShift,whereAGShiftistheshiftvalueofthenumberofblocks -*inanAG -*/ - -count=(AG<<superBlock->AGShift); - -/* -*ThefreeBlockListisabitmapofthefree/usedblocks. -*Used=onbit -*Unused=offbit -*Thereare8bitsperbyte(hopefully)andsowehavetodividethecount -*by8togetourstartingbyteoffsettolookfrom -*/ - -ptr=freeBlockList+(count>>3); - -//ScanthroughthefreeBlockList - -rescan: -while(*ptr==-1){ -++ptr; -count+=8; -if(count+8>superBlock->numBlocks)break; -}//while*ptr==-1 - -subCount=128; - -do{ -if((*ptr&subCount)==0)break; -subCount>>=1; -++count; -if(count==superBlock->numBlocks){ -count=0; -ptr=freeBlockList; -gotorescan; -}//if -}while(subCount>1); - -*ptr|=subCount;//markthisblockasused -++superBlock->usedBlocks;//incrementthenumberofusedblocks - -br.AG=count/superBlock->blocksPerAG; -br.start=count%superBlock->blocksPerAG; -br.len=1; -returnbr;//returntheallocatedblocknumber -}//Ubixfs::getFreeBlock - -uInt32 -UbixFS::getNextAG(void){ - -if(superBlock->lastUsedAG==superBlock->numAGs) -superBlock->lastUsedAG=0; -else -superBlock->lastUsedAG++; -returnsuperBlock->lastUsedAG; - -}//UbixFS::getNextAG - -/* -*UbixFS::getFreeBlock(void) -*uponsuccessreturnsafreeblockbasedonthenextAGafterthelastUsedAG -*failurereturns-1 -*/ - -blockRun -UbixFS::getFreeBlock(void){ -returngetFreeBlock(getNextAG()); -}//UbixFS::getFreeBlock - -blockRun -UbixFS::get8FreeBlocks(uInt32AG){ -//AG==AllocationGroup -blockRunbr; -signedchar*ptr; -signedchar*endPtr; -int32count; - -br.AG=0; -br.start=0; -br.len=0; - -if(device==NULL||freeBlockList==NULL||superBlock==NULL)returnbr; - -//Arethereanyblocksavailable? -if(superBlock->usedBlocks+8>superBlock->numBlocks)returnbr; - -/* -*countistheblockfromthebaseofthelist. -*Sincewe'regivenaspecificAGtolookthrough,westartthecountat -*AG<<AGShift,whereAGShiftistheshiftvalueofthenumberofblocks -*inanAG -*/ - -count=(AG<<superBlock->AGShift); - -ptr=freeBlockList+(count>>3); - -endPtr=freeBlockList+(superBlock->numBlocks>>3); - -boolsecondTime=false; -while(*ptr!=0){ -++ptr; -count+=8; -if(ptr==endPtr){ -if(secondTime) -returnbr; -else -secondTime=true; - -count=0; -ptr=freeBlockList; -}//if -}//while - -*ptr=-1;//mark8blocksastaken - -br.AG=count/superBlock->blocksPerAG; -br.start=count%superBlock->blocksPerAG; -br.len=8; -returnbr; -}//UbixFS::get8FreeBlocks - -void* -UbixFS::mknod(constchar*filename,ubixfsInode*parent,mode_tmode){ -ubixfsInode*inode=NULL; - -inode=newubixfsInode; -assert(inode); -if(inode==NULL)returnNULL; -memset(inode,0,sizeof(ubixfsInode)); - -inode->magic1=UBIXFS_INODE_MAGIC; - -/* -*inretrospect..I'mnotsurewhyparentwouldbenull..onlythe -*rootdirectorywouldhaveanullparent,butthat'smanuallyallocated -*invfs_format() -*/ - -if(parent==NULL){ -inode->inodeNum=getFreeBlock(); -inode->parent.iAddr.AG=0; -inode->parent.iAddr.start=0; -inode->parent.iAddr.len=0; -}else{ -inode->inodeNum=getFreeBlock(parent->inodeNum.AG); -inode->parent.iAddr=parent->inodeNum; -}//else - -strncpy(inode->name,filename,MAX_FILENAME_LENGTH); - -inode->uid=getuid(); -inode->gid=getgid(); -//inode->mode -inode->flags=mode; -//inode->createTime -//inode->lastModifiedTime -inode->inodeSize=superBlock->inodeSize; - -inode->attributes.AG=0; -inode->attributes.start=0; -inode->attributes.len=0; - -//inode->type - -/* -*nextandprevareusedinmemorytoholdpointerstothenext/prev -*inodesinthisdir.Ondisktheymayhaveanothervalue,butfor -*nowtheyshouldbesettonull. -*/ - -inode->next.offset=0; -inode->prev.offset=0; -inode->refCount=0; -++superBlock->inodeCount; -returninode; -}//UbixFS::mknod - -int -UbixFS::vfs_mkdir(constchar*path,mode_tmode){ -charname[MAX_FILENAME_LENGTH]; -unsignedintstart,end,len,nameStart; -ubixfsInode*dir=static_cast<ubixfsInode*>(root->inode); -ubixfsInode*inode=NULL; - -assert(path);//badinput:vfs_mkdir(NULL); -assert(*path);//badinput:vfs_mkdir(""); - -memset(&name,0,sizeof(name)); -//findthedirname -len=strlen(path); - -assert(path[0]=='/');//badinput:vfsisn'tdoingitsjob -assert(len>1);//badinput:mkdir/ - -//removetrailing"/"ifpresent -if(path[len-1]=='/')--len; - -assert(len>1);//badinput:mkdir// - -nameStart=len-1; - -assert(path[nameStart]!='/');//badinput:mkdir/a// - -/* -*we'reguaranteedbytheassert()abovethatthereis -*atleastone"/"beforeourlocation.Ifyouremovetheassert -*youmightneedtomakesurenameStartstaysabove0inthefollowing -*while -*/ - -while(path[nameStart]!='/')--nameStart; -++nameStart; -assert(len-nameStart>0); - -/*e.g. -*v---------------------start -*v------------------end -*v------nameStart -*/usr/local/data/dirname/<---ignorestrailing/ -*<---------23---------->len -*/ - -start=end=1;//skipleading/ -while(end<nameStart){ -do{++end;}while(path[end]!='/'); - -assert(end-start+1<sizeof(name)); -//thisisprobablywrong: -strncpy(name,&path[start],end-start+1); -cout<<name<<endl; -dir=dir->data.btPtr->Find(name); -assert(dir); -assert(dir->flags&INODE_DIRECTORY==INODE_DIRECTORY); -start=++end; -} - -strncpy(name,&path[nameStart],len-nameStart); -inode=(ubixfsInode*)mknod(name,dir,mode|INODE_DIRECTORY); - -/* -*keepinmindthatthereasonforpassinginthenameisbecause -*wethoughtaboutallowingkeynamestobedifferentfrominode -*names.Inretrospect,Idon'tthinkthat'sagoodideasinceadir -*listingwillprinttheactualdirnameinsteadof.and.. -*Thus:thefirstparameterofbtPtr->Insert()maygoaway. -*/ - -assert(dir->data.btPtr->Insert(inode->name,inode)); - -return0; -}//UbixFS::vfs_mkdir - -void -UbixFS::printFreeBlockList(uInt32AG){ -unsignedintj; -if(superBlock==NULL||freeBlockList==NULL)return; -printf("AG=%d\n",AG); -for(unsignedinti=0;i<superBlock->blocksPerAG/8;i++){ -j=128; -signedcharfoo=freeBlockList[(AG<<superBlock->AGShift)+i]; -while(j>0){ -if((foo&j)==j) -printf("1"); -else -printf("0"); -j>>=1; - -} -}//fori -printf("\n"); -return; -}//UbixFS::printFreeBlockList - -UbixFS::~UbixFS(void){ -delete[]freeBlockList; -return; -} +*//* + +br.len=((EORPos-maxRange+(bSize-1))/bSize); + +if(br.len<8)br.len=8;//weallocate32kifthefileneedstogrow + +br=getFreeBlock(br); +assert(br.len>0); +switch(whichBlocks){ +case0: +inode->blocks.direct[i]=br; +inode->blocks.maxDirectRange+=br.len*bSize; +break; +case1: +assert(false);//UNFINISHED +inode->blocks.maxIndirectRange+=br.len*bSize; +break; +case2: +assert(false);//UNFINISHED +inode->blocks.maxDoubleIndirectRange+=br.len*bSize; +break; +default: +assert(false);//sanitycheck +}//switch + +inode->blocks.size=EORPos; +}//if + + +runRemainder=size%512; +size-=runRemainder; + +totalSize=sum=i=0; + +while(size>0){ + +/placecheckheretoseewhichsetofblockswe'relookingthrough + + +//scanthroughdirectblocks +do{ +if(offset>=sum&&offset<sum+inode->blocks.direct[i].len*bSize) +break; + +sum+=inode->blocks.direct[i++].len*bSize; + +}while(i<NUM_DIRECT_BLOCKS); + +startingBlock=(inode->blocks.direct[i].AG<<superBlock->AGShift)+ +inode->blocks.direct[i].start+((offset-sum)/bSize); + +runSize=inode->blocks.direct[i].len*bSize; + +//startingBlockisin4kblocks +startingBlock*=(bSize/512); +//startingBlockisnowinsectors + +if(runSize>=size){ +runSize=size; +size=0; +}else{ +size-=runSize; +}//else + +sectorCount=runSize/512; + +cout<<"device->write(device,data,"<<startingBlock<<","; +cout<<sectorCount<<");"<<endl; + +device->write(device,data,startingBlock,sectorCount); + +(uInt8*)data+=runSize; +totalSize+=runSize; +}//while + +assert(runRemainder!=0);//UNFINISHED +returntotalSize; +}//UbixFS::vfs_write + +int +UbixFS::vfs_stop(void){ +if(vfs_sync()!=0)return-1; + +//youmustdeletetherootdirfirst,incaseitneedsto +//stillwriteanythingout + +if(root!=NULL){ +ubixfsInode*rootInode=static_cast<ubixfsInode*>(root->inode); +deleterootInode->data.btPtr; +deleterootInode; +root->inode=NULL; + +}//if + +deleteroot; +delete[]freeBlockList; +deletesuperBlock; + +freeBlockList=NULL; +superBlock=NULL; +root=NULL; + +*//* +*Thedeviceisn'tnullatthispoint,allowingforpeopletorestart +*themountpoint.Or,alternatively,toblowthingsup. +*//* + +return0; +}//UbixFS::vfs_stop + +int +UbixFS::vfs_sync(void){ +if(device==NULL||superBlock==NULL||freeBlockList==NULL)return-1; +device->write(device, +freeBlockList, +device->sectors-superBlock->batSectors-1, +superBlock->batSectors +); +device->write(device,superBlock,device->sectors-1,1); +return0; +}//UbixFS::vfs_sync + +void +UbixFS::setFreeBlock(blockRunibr){ +signedchar*ptr; + +if(superBlock==NULL||freeBlockList==NULL)return; +if(ibr.len==0)return; +ptr=freeBlockList+((ibr.AG<<superBlock->AGShift)>>3); +ptr+=ibr.start>>3; + +if(ibr.start%8!=0){ + +ibr.len-=ibr.start%8; +}//if + +}//UbixFS::setFreeBlock + +blockRun +UbixFS::getFreeBlock(blockRunibr){ +signedchar*ptr; +signedchar*holdPtr; +int32count,holdCount; + +blockRunobr={0,0,0};//outputblockrun + +//Checktomakesurenoneofthesearenull +if(device==NULL||freeBlockList==NULL||superBlock==NULL)returnobr; + +if(ibr.len==0)returnobr; + +if(ibr.len>superBlock->numBlocks)returnobr; + +if(ibr.len==1)returngetFreeBlock(ibr.AG); +*//* +*countistheblockfromthebaseofthelist. +*Sincewe'regivenaspecificAGtolookthrough,westartthecountat +*AG<<AGShift,whereAGShiftistheshiftvalueofthenumberofblocks +*inanAG +*//* + +count=(ibr.AG<<superBlock->AGShift); + +*//* +*ThefreeBlockListisabitmapofthefree/usedblocks. +*Used=onbit +*Unused=offbit +*Thereare8bitsperbyte(hopefully)andsowehavetodividethecount +*by8togetourstartingbyteoffsettolookfrom +*//* + +ptr=freeBlockList+(count>>3); + +rescan: +//lookforthefirstfree8blocks(thismaycreateholes) +while(*ptr!=0){ +++ptr; +count+=8; +if(count+8>superBlock->numBlocks){ +ptr=freeBlockList; +count=0; +}//if +}//while*ptr!=0 + +holdPtr=ptr; +holdCount=count; + +for(unsignedshorti=0;i<((ibr.len+7)/8);i++){ +++ptr; +count+=8; +if(count+8>superBlock->numBlocks){ +ptr=freeBlockList; +count=0; +gotorescan; +}//if +if(*ptr!=0)gotorescan; +}//fori + +//wehavefoundarangeofblocksthatworkforus + +obr.AG=holdCount/superBlock->blocksPerAG; +obr.start=holdCount%superBlock->blocksPerAG; +obr.len=ibr.len; + +for(unsignedshorti=0;i<(ibr.len/8);i++){ +*holdPtr=-1; +++holdPtr; +}//for + +if(ibr.len%8!=0)*holdPtr=(-1<<(8-(ibr.len%8))); + +superBlock->usedBlocks+=ibr.len;//incrementthenumberofusedblocks +returnobr; +}//UbixFS::getFreeBlock + +blockRun +UbixFS::getFreeBlock(uInt32AG){ +//AG==AllocationGroup +blockRunbr; +signedchar*ptr; +int32count; +int32subCount=128; + +br.AG=0; +br.start=0; +br.len=0; +//Checktomakesureneitherofthesearenull +if(device==NULL||freeBlockList==NULL||superBlock==NULL)returnbr; + +//Arethereanyblocksavailable? +if(superBlock->numBlocks==superBlock->usedBlocks)returnbr; + +*//* +*countistheblockfromthebaseofthelist. +*Sincewe'regivenaspecificAGtolookthrough,westartthecountat +*AG<<AGShift,whereAGShiftistheshiftvalueofthenumberofblocks +*inanAG +*//* + +count=(AG<<superBlock->AGShift); + +*//* +*ThefreeBlockListisabitmapofthefree/usedblocks. +*Used=onbit +*Unused=offbit +*Thereare8bitsperbyte(hopefully)andsowehavetodividethecount +*by8togetourstartingbyteoffsettolookfrom +*//* + +ptr=freeBlockList+(count>>3); + +//ScanthroughthefreeBlockList + +rescan: +while(*ptr==-1){ +++ptr; +count+=8; +if(count+8>superBlock->numBlocks)break; +}//while*ptr==-1 + +subCount=128; + +do{ +if((*ptr&subCount)==0)break; +subCount>>=1; +++count; +if(count==superBlock->numBlocks){ +count=0; +ptr=freeBlockList; +gotorescan; +}//if +}while(subCount>1); + +*ptr|=subCount;//markthisblockasused +++superBlock->usedBlocks;//incrementthenumberofusedblocks + +br.AG=count/superBlock->blocksPerAG; +br.start=count%superBlock->blocksPerAG; +br.len=1; +returnbr;//returntheallocatedblocknumber +}//Ubixfs::getFreeBlock + +uInt32 +UbixFS::getNextAG(void){ + +if(superBlock->lastUsedAG==superBlock->numAGs) +superBlock->lastUsedAG=0; +else +superBlock->lastUsedAG++; +returnsuperBlock->lastUsedAG; + +}//UbixFS::getNextAG + +*//* +*UbixFS::getFreeBlock(void) +*uponsuccessreturnsafreeblockbasedonthenextAGafterthelastUsedAG +*failurereturns-1 +*//* + +blockRun +UbixFS::getFreeBlock(void){ +returngetFreeBlock(getNextAG()); +}//UbixFS::getFreeBlock + +blockRun +UbixFS::get8FreeBlocks(uInt32AG){ +//AG==AllocationGroup +blockRunbr; +signedchar*ptr; +signedchar*endPtr; +int32count; + +br.AG=0; +br.start=0; +br.len=0; + +if(device==NULL||freeBlockList==NULL||superBlock==NULL)returnbr; + +//Arethereanyblocksavailable? +if(superBlock->usedBlocks+8>superBlock->numBlocks)returnbr; + +*//* +*countistheblockfromthebaseofthelist. +*Sincewe'regivenaspecificAGtolookthrough,westartthecountat +*AG<<AGShift,whereAGShiftistheshiftvalueofthenumberofblocks +*inanAG +*//* + +count=(AG<<superBlock->AGShift); + +ptr=freeBlockList+(count>>3); + +endPtr=freeBlockList+(superBlock->numBlocks>>3); + +boolsecondTime=false; +while(*ptr!=0){ +++ptr; +count+=8; +if(ptr==endPtr){ +if(secondTime) +returnbr; +else +secondTime=true; + +count=0; +ptr=freeBlockList; +}//if +}//while + +*ptr=-1;//mark8blocksastaken + +br.AG=count/superBlock->blocksPerAG; +br.start=count%superBlock->blocksPerAG; +br.len=8; +returnbr; +}//UbixFS::get8FreeBlocks + +void* +UbixFS::mknod(constchar*filename,ubixfsInode*parent,mode_tmode){ +ubixfsInode*inode=NULL; + +inode=newubixfsInode; +assert(inode); +if(inode==NULL)returnNULL; +memset(inode,0,sizeof(ubixfsInode)); + +inode->magic1=UBIXFS_INODE_MAGIC; + +*//* +*inretrospect..I'mnotsurewhyparentwouldbenull..onlythe +*rootdirectorywouldhaveanullparent,butthat'smanuallyallocated +*invfs_format() +*//* + +if(parent==NULL){ +inode->inodeNum=getFreeBlock(); +inode->parent.iAddr.AG=0; +inode->parent.iAddr.start=0; +inode->parent.iAddr.len=0; +}else{ +inode->inodeNum=getFreeBlock(parent->inodeNum.AG); +inode->parent.iAddr=parent->inodeNum; +}//else + +strncpy(inode->name,filename,MAX_FILENAME_LENGTH); + +inode->uid=getuid(); +inode->gid=getgid(); +//inode->mode +inode->flags=mode; +//inode->createTime +//inode->lastModifiedTime +inode->inodeSize=superBlock->inodeSize; + +inode->attributes.AG=0; +inode->attributes.start=0; +inode->attributes.len=0; + +//inode->type + +*//* +*nextandprevareusedinmemorytoholdpointerstothenext/prev +*inodesinthisdir.Ondisktheymayhaveanothervalue,butfor +*nowtheyshouldbesettonull. +*//* + +inode->next.offset=0; +inode->prev.offset=0; +inode->refCount=0; +++superBlock->inodeCount; +returninode; +}//UbixFS::mknod + +int +UbixFS::vfs_mkdir(constchar*path,mode_tmode){ +charname[MAX_FILENAME_LENGTH]; +unsignedintstart,end,len,nameStart; +ubixfsInode*dir=static_cast<ubixfsInode*>(root->inode); +ubixfsInode*inode=NULL; + +assert(path);//badinput:vfs_mkdir(NULL); +assert(*path);//badinput:vfs_mkdir(""); + +memset(&name,0,sizeof(name)); +//findthedirname +len=strlen(path); + +assert(path[0]=='/');//badinput:vfsisn'tdoingitsjob +assert(len>1);//badinput:mkdir/ + +//removetrailing"/"ifpresent +if(path[len-1]=='/')--len; + +assert(len>1);//badinput:mkdir// + +nameStart=len-1; + +assert(path[nameStart]!='/');//badinput:mkdir/a// + +*//* +*we'reguaranteedbytheassert()abovethatthereis +*atleastone"/"beforeourlocation.Ifyouremovetheassert +*youmightneedtomakesurenameStartstaysabove0inthefollowing +*while +*//* + +while(path[nameStart]!='/')--nameStart; +++nameStart; +assert(len-nameStart>0); + +*//*e.g. +*v---------------------start +*v------------------end +*v------nameStart +*/usr/local/data/dirname/<---ignorestrailing/ +*<---------23---------->len +*//* + +start=end=1;//skipleading/ +while(end<nameStart){ +do{++end;}while(path[end]!='/'); + +assert(end-start+1<sizeof(name)); +//thisisprobablywrong: +strncpy(name,&path[start],end-start+1); +cout<<name<<endl; +dir=dir->data.btPtr->Find(name); +assert(dir); +assert(dir->flags&INODE_DIRECTORY==INODE_DIRECTORY); +start=++end; +} + +strncpy(name,&path[nameStart],len-nameStart); +inode=(ubixfsInode*)mknod(name,dir,mode|INODE_DIRECTORY); + +*//* +*keepinmindthatthereasonforpassinginthenameisbecause +*wethoughtaboutallowingkeynamestobedifferentfrominode +*names.Inretrospect,Idon'tthinkthat'sagoodideasinceadir +*listingwillprinttheactualdirnameinsteadof.and.. +*Thus:thefirstparameterofbtPtr->Insert()maygoaway. +*//* + +assert(dir->data.btPtr->Insert(inode->name,inode)); + +return0; +}//UbixFS::vfs_mkdir + +void +UbixFS::printFreeBlockList(uInt32AG){ +unsignedintj; +if(superBlock==NULL||freeBlockList==NULL)return; +printf("AG=%d\n",AG); +for(unsignedinti=0;i<superBlock->blocksPerAG/8;i++){ +j=128; +signedcharfoo=freeBlockList[(AG<<superBlock->AGShift)+i]; +while(j>0){ +if((foo&j)==j) +printf("1"); +else +printf("0"); +j>>=1; + +} +}//fori +printf("\n"); +return; +}//UbixFS::printFreeBlockList + +UbixFS::~UbixFS(void){ +delete[]freeBlockList; +return; +} +*/ - + diff --git a/doc/xml/ubixos_2init_8h.xml b/doc/xml/ubixos_2init_8h.xml index 72cc792..07e35e2 100644 --- a/doc/xml/ubixos_2init_8h.xml +++ b/doc/xml/ubixos_2init_8h.xml @@ -1,367 +1,652 @@ - - - + + + init.h vmm/vmm.h - vfs/vfs.h + vfs/vfs.h isa/8259.h sys/idt.h ubixos/sched.h isa/pit.h - isa/atkbd.h + isa/atkbd.h ubixos/time.h net/net.h isa/ne2k.h devfs/devfs.h pci/pci.h - ubixfs/ubixfs.h + ubixfs/ubixfs.h isa/fdc.h ubixos/tty.h ufs/ufs.h + fat/fat.h ubixos/static.h pci/hd.h sys/kern_sysctl.h ubixos/vitals.h - src/sys/init/main.c + ubixos/syscalls.h + pci/lnc.h + C:/Dev/git/UbixOS/sys/init/main.c - + - + - - - + - - - - - + + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + - - int(*) - typedef int(*) intFunctionPTR(void) - (void) + + int(* + typedef int(* intFunctionPTR) (void) + )(void) intFunctionPTR @@ -369,60 +654,37 @@ - + - - intFunctionPTR + + intFunctionPTR intFunctionPTR init_tasks[] [] init_tasks - { - vmm_init, - static_constructors, - i8259_init, - idt_init, - vitals_init, - sysctl_init, - vfs_init, - sched_init, - pit_init, - atkbd_init, - time_init, - - - devfs_init, - - - - tty_init, - ufs_init, - initHardDisk, - } + = { static_constructors, i8259_init, idt_init, vitals_init, sysctl_init, vfs_init, sched_init, pit_init, atkbd_init, time_init, pci_init, devfs_init, tty_init, ufs_init, fat_init, initHardDisk, initLNC, net_init } - - kmain + - + int int init_tasksTotal init_tasksTotal - sizeof(init_tasks)/sizeof(intFunctionPTR) + = sizeof(init_tasks) / sizeof(intFunctionPTR) - - kmain + @@ -430,92 +692,73 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ubixos_2init_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_INIT_H -#define_INIT_H - -#include<vmm/vmm.h> -#include<vfs/vfs.h> -#include<isa/8259.h> -#include<sys/idt.h> -#include<ubixos/sched.h> -#include<isa/pit.h> -#include<isa/atkbd.h> -#include<ubixos/time.h> -#include<net/net.h> -#include<isa/ne2k.h> -#include<devfs/devfs.h> -#include<pci/pci.h> -#include<ubixfs/ubixfs.h> -#include<isa/fdc.h> -#include<ubixos/tty.h> -#include<ufs/ufs.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_INIT_H +#define_UBIXOS_INIT_H + +#include<vmm/vmm.h> +#include<vfs/vfs.h> +#include<isa/8259.h> +#include<sys/idt.h> +#include<ubixos/sched.h> +#include<isa/pit.h> +#include<isa/atkbd.h> +#include<ubixos/time.h> +#include<net/net.h> +#include<isa/ne2k.h> +#include<devfs/devfs.h> +#include<pci/pci.h> +#include<ubixfs/ubixfs.h> +#include<isa/fdc.h> +#include<ubixos/tty.h> +#include<ufs/ufs.h> +#include<fat/fat.h> #include<ubixos/static.h> #include<pci/hd.h> #include<sys/kern_sysctl.h> #include<ubixos/vitals.h> - -typedefint(*intFunctionPTR)(void); +#include<ubixos/syscalls.h> +#include<pci/lnc.h> -intFunctionPTRinit_tasks[]={ -vmm_init, -static_constructors, -i8259_init, -idt_init, -vitals_init, -sysctl_init, -vfs_init, -sched_init, -pit_init, -atkbd_init, -time_init, -//net_init, -//ne2k_init, -devfs_init, -//pci_init, -//ubixfs_init, -//fdc_init, -tty_init, -ufs_init, -initHardDisk, -}; - -intinit_tasksTotal=sizeof(init_tasks)/sizeof(intFunctionPTR); - -#endif - -/*** -END -***/ +typedefint(*intFunctionPTR)(void); + +intFunctionPTRinit_tasks[]={static_constructors,i8259_init,idt_init,vitals_init,sysctl_init,vfs_init,sched_init,pit_init,atkbd_init,time_init,pci_init,devfs_init,tty_init,ufs_init,fat_init,initHardDisk,initLNC,net_init}; + +//ne2k_init, +//ubixfs_init, +//fdc_init, + +intinit_tasksTotal=sizeof(init_tasks)/sizeof(intFunctionPTR); + +#endif/*END_UBIXOS_INIT_H*/ - + diff --git a/doc/xml/ubthread_8c.xml b/doc/xml/ubthread_8c.xml index 20f97c9..674fd6e 100644 --- a/doc/xml/ubthread_8c.xml +++ b/doc/xml/ubthread_8c.xml @@ -1,6 +1,6 @@ - - - + + + ubthread.c ubixos/ubthread.h ubixos/exec.h @@ -10,184 +10,520 @@ ubixos/vitals.h lib/kmalloc.h lib/kprintf.h + ubixos/kpanic.h + sys/stdatomic.h - - - - + + + + + + - - - - + + + + + + + + + + + + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + struct ubthread_cond_list * + struct ubthread_cond_list* conds + + conds + = 0x0 + + + + + + + + + + struct ubthread_mutex_list * + struct ubthread_mutex_list* mutex + + mutex + = 0x0 + + + + + + + + sys_mutex_free + sys_mutex_lock + sys_mutex_new + sys_mutex_unlock + ubthread_cond_timedwait + ubthread_cond_wait + ubthread_mutex_destroy + ubthread_mutex_init + ubthread_mutex_lock + ubthread_mutex_unlock + + - + int - int ubthread_cond_destroy + int ubthread_cond_broadcast (ubthread_cond_t *cond) - ubthread_cond_destroy + ubthread_cond_broadcast - ubthread_cond_t * + ubthread_cond_t * cond @@ -196,20 +532,39 @@ - - kfree + + sys_sem_signal - + + int + int ubthread_cond_destroy + (ubthread_cond_t *cond) + ubthread_cond_destroy + + ubthread_cond_t * + cond + + + + + + + + + kfree + sem_destroy + + int int ubthread_cond_init - (ubthread_cond_t *cond, const uInt32 attr) + (ubthread_cond_t *cond, const uint32_t attr) ubthread_cond_init - ubthread_cond_t * + ubthread_cond_t * cond - const uInt32 + const uint32_t attr @@ -218,19 +573,20 @@ - - ubthread_cond::id - kmalloc - ubthread_cond::locked - UNLOCKED + + ATOMIC_VAR_INIT + ubthread_cond::id + kmalloc + ubthread_cond::lock + memset - + int int ubthread_cond_signal (ubthread_cond_t *cond) ubthread_cond_signal - ubthread_cond_t * + ubthread_cond_t * cond @@ -239,25 +595,23 @@ - - ubthread_cond::locked - UNLOCKED + - + int int ubthread_cond_timedwait (ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime) ubthread_cond_timedwait - ubthread_cond_t * + ubthread_cond_t * cond - ubthread_mutex_t * + ubthread_mutex_t * mutex - const struct timespec * + const struct timespec * abstime @@ -266,26 +620,27 @@ - - ubthread_mutex::locked - ubthread_cond::locked - mutex - sched_yield - systemVitals - vitalsStruct::sysUptime - UNLOCKED + + FALSE + ubthread_cond::lock + mutex + sched_yield + systemVitals + vitalsStruct::sysUptime + ubthread_mutex_lock + ubthread_mutex_unlock - + int int ubthread_cond_wait (ubthread_cond_t *cond, ubthread_mutex_t *mutex) ubthread_cond_wait - ubthread_cond_t * + ubthread_cond_t * cond - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -294,25 +649,25 @@ - - ubthread_mutex::locked - LOCKED - ubthread_cond::locked - mutex - sched_yield - UNLOCKED + + ubthread_cond::lock + mutex + sched_yield + TRUE + ubthread_mutex_lock + ubthread_mutex_unlock - + int int ubthread_create (kTask_t **thread, const uInt32 *attr, void(*tproc)(void), void *arg) ubthread_create - kTask_t ** + kTask_t ** thread - const uInt32 * + const uInt32 * attr @@ -329,18 +684,16 @@ - - execThread - kmalloc - x2000 + + execThread - + int int ubthread_mutex_destroy (ubthread_mutex_t *mutex) ubthread_mutex_destroy - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -349,21 +702,23 @@ - - kfree - mutex + + kfree + mutex + sem_destroy + sys_mutex_free - + int int ubthread_mutex_init - (ubthread_mutex_t *mutex, const uInt32 attr) + (ubthread_mutex_t *mutex, const uint32_t attr) ubthread_mutex_init - ubthread_mutex_t * + ubthread_mutex_t * mutex - const uInt32 + const uint32_t attr @@ -372,20 +727,21 @@ - - ubthread_mutex::id - kmalloc - ubthread_mutex::locked - mutex - UNLOCKED + + ATOMIC_VAR_INIT + ubthread_mutex::id + kmalloc + ubthread_mutex::lock + memset + mutex - + int int ubthread_mutex_lock (ubthread_mutex_t *mutex) ubthread_mutex_lock - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -394,22 +750,28 @@ - - _current - taskStruct::id - kprintf - LOCKED - ubthread_mutex::locked - mutex - ubthread_mutex::pid + + _current + taskStruct::id + kpanic + kprintf + ubthread_mutex::lock + mutex + ubthread_mutex::pid + TRUE + sys_arch_sem_wait + sys_mutex_lock + sys_sem_signal + ubthread_cond_timedwait + ubthread_cond_wait - + int int ubthread_mutex_unlock (ubthread_mutex_t *mutex) ubthread_mutex_unlock - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -418,16 +780,22 @@ - - _current - taskStruct::id - ubthread_mutex::locked - mutex - ubthread_mutex::pid - UNLOCKED + + _current + taskStruct::id + kpanic + kprintf + ubthread_mutex::lock + mutex + ubthread_mutex::pid + TRUE + sys_mutex_unlock + sys_sem_signal + ubthread_cond_timedwait + ubthread_cond_wait - - kTask_t * + + kTask_t * kTask_t* ubthread_self () ubthread_self @@ -437,44 +805,8 @@ - - _current - - - - - ubthread_cond_list * - struct ubthread_cond_list* conds - - conds - 0x0 - - - - - - - - - - ubthread_mutex_list * - struct ubthread_mutex_list* mutex - - mutex - 0x0 - - - - - - - - ubthread_cond_timedwait - ubthread_cond_wait - ubthread_mutex_destroy - ubthread_mutex_init - ubthread_mutex_lock - ubthread_mutex_unlock + + _current @@ -482,141 +814,177 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ubthread_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -/*Allthesemustbeconvertedtobedoneatomically*/ - -#include<ubixos/ubthread.h> -#include<ubixos/exec.h> -#include<ubixos/sched.h> -#include<ubixos/time.h> -#include<ubixos/spinlock.h> -#include<ubixos/vitals.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> - -structubthread_cond_list*conds=0x0; -structubthread_mutex_list*mutex=0x0; - -kTask_t*ubthread_self(){ -return(_current); -} - -intubthread_cond_init(ubthread_cond_t*cond,constuInt32attr){ -ubthread_cond_tubcond=kmalloc(sizeof(structubthread_cond)); -ubcond->id=(int)cond; -ubcond->locked=UNLOCKED; -*cond=ubcond; -return(0x0); -} +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +/*Allthesemustbeconvertedtobedoneatomically*/ + +#include<ubixos/ubthread.h> +#include<ubixos/exec.h> +#include<ubixos/sched.h> +#include<ubixos/time.h> +#include<ubixos/spinlock.h> +#include<ubixos/vitals.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<ubixos/kpanic.h> +#include<sys/stdatomic.h> + +structubthread_cond_list*conds=0x0; +structubthread_mutex_list*mutex=0x0; + +kTask_t*ubthread_self(){ +return(_current); +} + +intubthread_cond_init(ubthread_cond_t*cond,constuint32_tattr){ +ubthread_cond_tubcond=kmalloc(sizeof(structubthread_cond)); +memset(ubcond,0x0,sizeof(structubthread_cond)); + +ubcond->id=(int)cond; +ubcond->lock=ATOMIC_VAR_INIT(0); -intubthread_mutex_init(ubthread_mutex_t*mutex,constuInt32attr){ -ubthread_mutex_tubmutex=kmalloc(sizeof(structubthread_mutex)); -ubmutex->id=(int)mutex; -ubmutex->locked=UNLOCKED; -*mutex=ubmutex; -return(0x0); -} +*cond=ubcond; +return(0x0); +} + +intubthread_mutex_init(ubthread_mutex_t*mutex,constuint32_tattr){ +ubthread_mutex_tubmutex=kmalloc(sizeof(structubthread_mutex)); +memset(ubmutex,0x0,sizeof(structubthread_mutex)); -intubthread_cond_destroy(ubthread_cond_t*cond){ -kfree(*cond); -*cond=0x0; -return(0x0); -} - -intubthread_mutex_destroy(ubthread_mutex_t*mutex){ -kfree(*mutex); -*mutex=0x0; -return(0x0); -} - -intubthread_create(kTask_t**thread,constuInt32*attr,void(*tproc)(void),void*arg){ -*thread=(void*)execThread(tproc,(int)(kmalloc(0x2000)+0x2000),arg); -return(0x0); -} - -intubthread_mutex_lock(ubthread_mutex_t*mutex){ -ubthread_mutex_tubmutex=*mutex; -if(ubmutex->locked==LOCKED){ -kprintf("MutexAlreadyLockBy%xTryingToBeRelockedBy%x\n",ubmutex->pid,_current->id); -while(ubmutex->locked==LOCKED); -} -ubmutex->locked=LOCKED; -ubmutex->pid=_current->id; -return(0x0); -} - -intubthread_mutex_unlock(ubthread_mutex_t*mutex){ -ubthread_mutex_tubmutex=*mutex; -if(ubmutex->pid==_current->id){ -ubmutex->locked=UNLOCKED; -return(0x0); -} -else{ -//kprintf("TryingToUnlockMutexFromNoLockingThread\n"); -ubmutex->locked=UNLOCKED; -return(-1); -} +ubmutex->id=(int)mutex; +ubmutex->lock=ATOMIC_VAR_INIT(0); + +*mutex=ubmutex; +return(0x0); +} + +intubthread_cond_destroy(ubthread_cond_t*cond){ +kfree(*cond); +*cond=0x0; +return(0x0); +} + +intubthread_mutex_destroy(ubthread_mutex_t*mutex){ +kfree(*mutex); +*mutex=0x0; +return(0x0); +} + +intubthread_create(kTask_t**thread,constuInt32*attr,void(*tproc)(void),void*arg){ +*thread=(void*)execThread(tproc,0x2000,arg); +return(0x0); +} + +intubthread_mutex_lock(ubthread_mutex_t*mutex){ +ubthread_mutex_tubmutex=*mutex; + +if(ubmutex->lock==TRUE&&ubmutex->pid==_current->id){ +kprintf("MutexAlreadyLockedByThisThread"); +kpanic("WHY?"); +return(0x0); +} + +while(1){ +if(xchg_32(&ubmutex->lock,TRUE)==FALSE) +break; + +while(ubmutex->lock==TRUE) +sched_yield(); } -intubthread_cond_timedwait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,conststructtimespec*abstime){ -ubthread_cond_tubcond=*cond; -ubthread_mutex_tubmutex=*mutex; -uInt32enterTime=systemVitals->sysUptime+20; -while(enterTime>systemVitals->sysUptime){ -if(ubcond->locked==UNLOCKED)break; -sched_yield(); -} -ubmutex->locked=UNLOCKED; -return(0x0); -} - -intubthread_cond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex){ -ubthread_cond_tubcond=*cond; -ubthread_mutex_tubmutex=*mutex; -while(ubcond->locked==LOCKED)sched_yield(); -ubmutex->locked=UNLOCKED; -return(0x0); +ubmutex->pid=_current->id; +return(0x0); +} + +intubthread_mutex_unlock(ubthread_mutex_t*mutex){ +ubthread_mutex_tubmutex=*mutex; + +if(ubmutex->lock!=TRUE) +kpanic("NOTLOCKED?"); + +if(ubmutex->pid!=_current->id) +kprintf("TryingToUnlockMutexFromNoLockingThread[%i-%i:0x%X]\n",ubmutex->pid,_current->id,*ubmutex); + +while(1){ +if(xchg_32(&ubmutex->lock,FALSE)==TRUE) +break; +while(ubmutex->lock==FALSE) +sched_yield(); } -intubthread_cond_signal(ubthread_cond_t*cond){ -ubthread_cond_tubcond=*cond; -ubcond->locked=UNLOCKED; -return(0x0); -} - -/*** -END -***/ +ubmutex->pid=0x0; +return(0x0); +} + +intubthread_cond_timedwait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,conststructtimespec*abstime){ +ubthread_cond_tubcond=*cond; +ubthread_mutex_tubmutex=*mutex; + +uint32_tenterTime=systemVitals->sysUptime+20; +ubthread_mutex_unlock(mutex); + +while(enterTime>systemVitals->sysUptime){ +if(ubcond->lock==FALSE) +break; +sched_yield(); +} + +ubthread_mutex_lock(mutex); + +return(0x0); +} + +intubthread_cond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex){ +ubthread_cond_tubcond=*cond; +ubthread_mutex_unlock(mutex); +while(ubcond->lock==TRUE) +sched_yield(); +ubthread_mutex_lock(mutex); +return(0x0); +} + +intubthread_cond_signal(ubthread_cond_t*cond){ +ubthread_cond_tubcond=*cond; +while(xchg_32(&ubcond->lock,FALSE)) +sched_yield(); +return(0x0); +} + +intubthread_cond_broadcast(ubthread_cond_t*cond){ +ubthread_cond_tubcond=*cond; +while(xchg_32(&ubcond->lock,FALSE)) +sched_yield(); +return(0x0); +} + - + diff --git a/doc/xml/ubthread_8h.xml b/doc/xml/ubthread_8h.xml index 74a48a8..4e8e6f0 100644 --- a/doc/xml/ubthread_8h.xml +++ b/doc/xml/ubthread_8h.xml @@ -1,208 +1,452 @@ - - - + + + ubthread.h - ubixos/types.h + sys/types.h ubixos/sched.h ubixos/time.h - src/sys/include/ubixos/vitals.h - src/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/include/net/arch/sys_arch.h + C:/Dev/git/UbixOS/sys/include/sys/elf.h + C:/Dev/git/UbixOS/sys/include/ubixos/access.h + C:/Dev/git/UbixOS/sys/include/ubixos/sem.h + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/net/net/sys_arch.c - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - + + + + - + - + - + - - - - - - - - - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - + + + + - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + ubthread @@ -212,18 +456,7 @@ ubthread_mutex ubthread_mutex_list - - ETIMEDOUT - -1 - - - - - - - - - + LOCKED 1 @@ -232,11 +465,9 @@ - - ubthread_cond_wait - ubthread_mutex_lock + - + UNLOCKED 0 @@ -245,18 +476,12 @@ - - ubthread_cond_init - ubthread_cond_signal - ubthread_cond_timedwait - ubthread_cond_wait - ubthread_mutex_init - ubthread_mutex_unlock + - - ubthread_cond * + + struct ubthread_cond * typedef struct ubthread_cond* ubthread_cond_t ubthread_cond_t @@ -266,10 +491,10 @@ - + - - ubthread_mutex * + + struct ubthread_mutex * typedef struct ubthread_mutex* ubthread_mutex_t ubthread_mutex_t @@ -279,10 +504,10 @@ - + - - ubthread * + + struct ubthread * typedef struct ubthread* ubthread_t ubthread_t @@ -292,17 +517,17 @@ - + - + int - int ubthread_cond_destroy + int ubthread_cond_broadcast (ubthread_cond_t *cond) - ubthread_cond_destroy + ubthread_cond_broadcast - ubthread_cond_t * + ubthread_cond_t * cond @@ -311,20 +536,39 @@ - - kfree + + sys_sem_signal - + + int + int ubthread_cond_destroy + (ubthread_cond_t *cond) + ubthread_cond_destroy + + ubthread_cond_t * + cond + + + + + + + + + kfree + sem_destroy + + int int ubthread_cond_init (ubthread_cond_t *cond, const uInt32 attr) ubthread_cond_init - ubthread_cond_t * + ubthread_cond_t * cond - const uInt32 + const uInt32 attr @@ -333,19 +577,17 @@ - - ubthread_cond::id - kmalloc - ubthread_cond::locked - UNLOCKED + + sem_init + sys_sem_new - + int int ubthread_cond_signal (ubthread_cond_t *cond) ubthread_cond_signal - ubthread_cond_t * + ubthread_cond_t * cond @@ -354,25 +596,23 @@ - - ubthread_cond::locked - UNLOCKED + - + int int ubthread_cond_timedwait (ubthread_cond_t *cond, ubthread_mutex_t *mutex, const struct timespec *abstime) ubthread_cond_timedwait - ubthread_cond_t * + ubthread_cond_t * cond - ubthread_mutex_t * + ubthread_mutex_t * mutex - const struct timespec * + const struct timespec * abstime @@ -381,26 +621,27 @@ - - ubthread_cond::locked - ubthread_mutex::locked - mutex - sched_yield - systemVitals - vitalsStruct::sysUptime - UNLOCKED + + FALSE + ubthread_cond::lock + mutex + sched_yield + systemVitals + vitalsStruct::sysUptime + ubthread_mutex_lock + ubthread_mutex_unlock - + int int ubthread_cond_wait (ubthread_cond_t *cond, ubthread_mutex_t *mutex) ubthread_cond_wait - ubthread_cond_t * + ubthread_cond_t * cond - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -409,25 +650,25 @@ - - ubthread_cond::locked - LOCKED - ubthread_mutex::locked - mutex - sched_yield - UNLOCKED + + ubthread_cond::lock + mutex + sched_yield + TRUE + ubthread_mutex_lock + ubthread_mutex_unlock - + int int ubthread_create - (kTask_t **thread, const uInt32 *attr, void(*tproc)(void), void *arg) + (struct taskStruct **thread, const uInt32 *attr, void(*tproc)(void), void *arg) ubthread_create - kTask_t ** + struct taskStruct ** thread - const uInt32 * + const uInt32 * attr @@ -444,18 +685,16 @@ - - execThread - kmalloc - x2000 + + execThread - + int int ubthread_mutex_destroy (ubthread_mutex_t *mutex) ubthread_mutex_destroy - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -464,21 +703,23 @@ - - kfree - mutex + + kfree + mutex + sem_destroy + sys_mutex_free - + int int ubthread_mutex_init (ubthread_mutex_t *mutex, const uInt32 attr) ubthread_mutex_init - ubthread_mutex_t * + ubthread_mutex_t * mutex - const uInt32 + const uInt32 attr @@ -487,20 +728,18 @@ - - ubthread_mutex::id - kmalloc - ubthread_mutex::locked - mutex - UNLOCKED + + sem_init + sys_mutex_new + sys_sem_new - + int int ubthread_mutex_lock (ubthread_mutex_t *mutex) ubthread_mutex_lock - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -509,22 +748,28 @@ - - _current - taskStruct::id - kprintf - ubthread_mutex::locked - LOCKED - mutex - ubthread_mutex::pid + + _current + taskStruct::id + kpanic + kprintf + ubthread_mutex::lock + mutex + ubthread_mutex::pid + TRUE + sys_arch_sem_wait + sys_mutex_lock + sys_sem_signal + ubthread_cond_timedwait + ubthread_cond_wait - + int int ubthread_mutex_unlock (ubthread_mutex_t *mutex) ubthread_mutex_unlock - ubthread_mutex_t * + ubthread_mutex_t * mutex @@ -533,17 +778,23 @@ - - _current - taskStruct::id - ubthread_mutex::locked - mutex - ubthread_mutex::pid - UNLOCKED + + _current + taskStruct::id + kpanic + kprintf + ubthread_mutex::lock + mutex + ubthread_mutex::pid + TRUE + sys_mutex_unlock + sys_sem_signal + ubthread_cond_timedwait + ubthread_cond_wait - - kTask_t * - kTask_t* ubthread_self + + struct taskStruct * + struct taskStruct* ubthread_self () ubthread_self @@ -552,8 +803,8 @@ - - _current + + _current @@ -561,120 +812,93 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: ubthread_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_UBTHREAD_H -#define_UBTHREAD_H - -#include<ubixos/types.h> -#include<ubixos/sched.h> -#include<ubixos/time.h> - -#defineETIMEDOUT-1 - -#defineLOCKED1 -#defineUNLOCKED0 - -typedefstructubthread*ubthread_t; -typedefstructubthread_cond*ubthread_cond_t; -typedefstructubthread_mutex*ubthread_mutex_t; - -structubthread{ -kTask_t*task; -}; - -structubthread_cond{ -intid; -uInt8locked; -}; - -structubthread_mutex{ -intid; -uInt8locked; -pidTypepid; -}; - -structubthread_list{ -structubthread_list*next; -ubthread_tthread; -}; - -structubthread_cond_list{ -structubthread_cond_list*next; -ubthread_cond_t*cond; -}; - -structubthread_mutex_list{ -structubthread_mutex_list*next; -ubthread_mutex_t*mutex; -}; - - -kTask_t*ubthread_self(); -intubthread_cond_init(ubthread_cond_t*cond,constuInt32attr); -intubthread_mutex_init(ubthread_mutex_t*mutex,constuInt32attr); -intubthread_cond_destroy(ubthread_cond_t*cond); -intubthread_mutex_destroy(ubthread_mutex_t*mutex); -intubthread_create(kTask_t**thread,constuInt32*attr,void(*tproc)(void),void*arg); -intubthread_mutex_lock(ubthread_mutex_t*mutex); -intubthread_mutex_unlock(ubthread_mutex_t*mutex); -intubthread_cond_timedwait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,conststructtimespec*abstime); -intubthread_cond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex); -intubthread_cond_signal(ubthread_cond_t*cond); - -#endif - -/*** -$Log: ubthread_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:53 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:14reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:57reddawg -nomessage - -Revision1.32004/09/0720:58:35reddawg -timetorollbackican'tthinkstraightbyfriday - -Revision1.22004/05/2115:20:00reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBTHREAD_H +#define_UBTHREAD_H + +#include<sys/types.h> +#include<ubixos/sched.h> +#include<ubixos/time.h> + +#defineLOCKED1 +#defineUNLOCKED0 + +typedefstructubthread*ubthread_t; +typedefstructubthread_cond*ubthread_cond_t; +typedefstructubthread_mutex*ubthread_mutex_t; + +structubthread{ +structtaskStruct*task; +}; + +structubthread_cond{ +intid; +boollock; +}; + +structubthread_mutex{ +intid; +boollock; +pidTypepid; +}; + +structubthread_list{ +structubthread_list*next; +ubthread_tthread; +}; + +structubthread_cond_list{ +structubthread_cond_list*next; +ubthread_cond_t*cond; +}; + +structubthread_mutex_list{ +structubthread_mutex_list*next; +ubthread_mutex_t*mutex; +}; + +structtaskStruct*ubthread_self(); +intubthread_cond_init(ubthread_cond_t*cond,constuInt32attr); +intubthread_mutex_init(ubthread_mutex_t*mutex,constuInt32attr); +intubthread_cond_destroy(ubthread_cond_t*cond); +intubthread_mutex_destroy(ubthread_mutex_t*mutex); +intubthread_create(structtaskStruct**thread,constuInt32*attr,void(*tproc)(void),void*arg); +intubthread_mutex_lock(ubthread_mutex_t*mutex); +intubthread_mutex_unlock(ubthread_mutex_t*mutex); +intubthread_cond_timedwait(ubthread_cond_t*cond,ubthread_mutex_t*mutex,conststructtimespec*abstime); +intubthread_cond_wait(ubthread_cond_t*cond,ubthread_mutex_t*mutex); +intubthread_cond_signal(ubthread_cond_t*cond); +intubthread_cond_broadcast(ubthread_cond_t*cond); + +#endif - + diff --git a/doc/xml/udp_8h.xml b/doc/xml/udp_8h.xml index d893cff..f7af024 100644 --- a/doc/xml/udp_8h.xml +++ b/doc/xml/udp_8h.xml @@ -1,623 +1,331 @@ - - - + + + udp.h - net/arch.h - net/pbuf.h - net/ipv4/inet.h - net/ipv4/ip.h - net/err.h - src/sys/include/net/api.h - src/sys/include/net/api_msg.h - src/sys/net/api/tcpip.c - src/sys/net/netif/tcpdump.c + net/opt.h + C:/Dev/git/UbixOS/sys/net/core/init.c + C:/Dev/git/UbixOS/sys/net/core/memp.c + C:/Dev/git/UbixOS/sys/net/core/netif.c + C:/Dev/git/UbixOS/sys/net/netif/tcpdump.c - - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - + + + + - - - - - - - - + + + + - - - - - - - - - - - - - + - - - - + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - + - + + + - - - - + + + + - + - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - udp_hdr - udp_pcb - - - udp_flags - pcb - ((pcb)->flags) - - - - - - - - - - UDP_FLAGS_NOCHKSUM - 0x01 - - - - - - - - do_bind - do_connect - - - UDP_FLAGS_UDPLITE - 0x02 - - - - - - - - do_bind - do_connect - - - UDP_HLEN - 8 - - - - - - - - - - udp_setflags - pcb - f - ((pcb)->flags = (f)) - - - - - - - - do_bind - do_connect - - - - - err_t - err_t udp_bind - (struct udp_pcb *pcb, struct ip_addr *ipaddr, uInt16 port) - udp_bind - - struct udp_pcb * - pcb - - - struct ip_addr * - ipaddr - - - uInt16 - port - - - - - - - - - do_bind - - - err_t - err_t udp_connect - (struct udp_pcb *pcb, struct ip_addr *ipaddr, uInt16 port) - udp_connect - - struct udp_pcb * - pcb - - - struct ip_addr * - ipaddr - - - uInt16 - port - - - - - - - - - do_connect - - - void - void udp_init - (void) - udp_init - - void - - - - - - - - - tcpip_thread - - - void - void udp_input - (struct pbuf *p, struct netif *inp) - udp_input - - struct pbuf * - p - - - struct netif * - inp - - - - - - - - - - - uInt8 - uInt8 udp_lookup - (struct ip_hdr *iphdr, struct netif *inp) - udp_lookup - - struct ip_hdr * - iphdr - - - struct netif * - inp - - - - - - - - - - - udp_pcb * - struct udp_pcb* udp_new - (void) - udp_new - - void - - - - - - - - - do_bind - do_connect - - - void - void udp_recv - (struct udp_pcb *pcb, void(*recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p, struct ip_addr *addr, uInt16 port), void *recv_arg) - udp_recv - - struct udp_pcb * - pcb - - - void(*)(void *arg, struct udp_pcb *upcb, struct pbuf *p, struct ip_addr *addr, uInt16 port) - recv - - - void * - recv_arg - - - - - - - - - do_bind - do_connect - - - void - void udp_remove - (struct udp_pcb *pcb) - udp_remove - - struct udp_pcb * - pcb - - - - - - - - - do_delconn - - - err_t - err_t udp_send - (struct udp_pcb *pcb, struct pbuf *p) - udp_send - - struct udp_pcb * - pcb - - - struct pbuf * - p - - - - - - - - - do_send - - - - - udp_hdr - struct udp_hdr PACK_STRUCT_STRUCT - - PACK_STRUCT_STRUCT - - - - - - - - - +UDP API (to be used from TCPIP thread) +See also UDP -/* -*Copyright(c)2001,SwedishInstituteofComputerScience. -*Allrightsreserved. -* -*Redistributionanduseinsourceandbinaryforms,withorwithout -*modification,arepermittedprovidedthatthefollowingconditions -*aremet: -*1.Redistributionsofsourcecodemustretaintheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimer. -*2.Redistributionsinbinaryformmustreproducetheabovecopyright -*notice,thislistofconditionsandthefollowingdisclaimerinthe -*documentationand/orothermaterialsprovidedwiththedistribution. -*3.NeitherthenameoftheInstitutenorthenamesofitscontributors -*maybeusedtoendorseorpromoteproductsderivedfromthissoftware -*withoutspecificpriorwrittenpermission. -* -*THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND -*ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE -*IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE -*AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE -*FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL -*DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS -*ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -*HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT -*LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY -*OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF -*SUCHDAMAGE. -* -*ThisfileispartofthelwIPTCP/IPstack. -* -*Author:AdamDunkels<adam@sics.se> + +/* +*Copyright(c)2001-2004SwedishInstituteofComputerScience. +*Allrightsreserved. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification, +*arepermittedprovidedthatthefollowingconditionsaremet: +* +*1.Redistributionsofsourcecodemustretaintheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimer. +*2.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice, +*thislistofconditionsandthefollowingdisclaimerinthedocumentation +*and/orothermaterialsprovidedwiththedistribution. +*3.Thenameoftheauthormaynotbeusedtoendorseorpromoteproducts +*derivedfromthissoftwarewithoutspecificpriorwrittenpermission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHOR``ASIS''ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF +*MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENT +*SHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL, +*EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT +*OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESS +*INTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISING +*INANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITY +*OFSUCHDAMAGE. * -*$Id: udp_8h.xml 88 2016-01-12 00:11:29Z reddawg $ -*/ -#ifndef__LWIP_UDP_H__ -#define__LWIP_UDP_H__ - -#include"net/arch.h" - -#include"net/pbuf.h" -//UBU -#include"net/ipv4/inet.h" -//UBU -#include"net/ipv4/ip.h" - -#include"net/err.h" - -#defineUDP_HLEN8 - -structudp_hdr{ -PACK_STRUCT_FIELD(uInt16src); -PACK_STRUCT_FIELD(uInt16dest);/*src/destUDPports*/ -PACK_STRUCT_FIELD(uInt16len); -PACK_STRUCT_FIELD(uInt16chksum); -}PACK_STRUCT_STRUCT; - -#defineUDP_FLAGS_NOCHKSUM0x01 -#defineUDP_FLAGS_UDPLITE0x02 - -structudp_pcb{ -structudp_pcb*next; +*ThisfileispartofthelwIPTCP/IPstack. +* +*Author:AdamDunkels<adam@sics.se> +* +*/ +#ifndefLWIP_HDR_UDP_H +#defineLWIP_HDR_UDP_H + +#include"net/opt.h" + +#ifLWIP_UDP/*don'tbuildifnotconfiguredforuseinlwipopts.h*/ + +#include"net/pbuf.h" +#include"net/netif.h" +#include"net/ip_addr.h" +#include"net/ip.h" +#include"net/ip6_addr.h" +#include"net/prot/udp.h" + +#ifdef__cplusplus +extern"C"{ +#endif + +#defineUDP_FLAGS_NOCHKSUM0x01U +#defineUDP_FLAGS_UDPLITE0x02U +#defineUDP_FLAGS_CONNECTED0x04U +#defineUDP_FLAGS_MULTICAST_LOOP0x08U + +structudp_pcb; -structip_addrlocal_ip,remote_ip; -uInt16local_port,remote_port; - -uInt8flags; -uInt16chksum_len; - -void(*recv)(void*arg,structudp_pcb*pcb,structpbuf*p, -structip_addr*addr,uInt16port); -void*recv_arg; -}; - -/*Thefollowingfunctionsistheapplicationlayerinterfacetothe -UDPcode.*/ -structudp_pcb*udp_new(void); -voidudp_remove(structudp_pcb*pcb); -err_tudp_bind(structudp_pcb*pcb,structip_addr*ipaddr, -uInt16port); -err_tudp_connect(structudp_pcb*pcb,structip_addr*ipaddr, -uInt16port); -voidudp_recv(structudp_pcb*pcb, -void(*recv)(void*arg,structudp_pcb*upcb, -structpbuf*p, -structip_addr*addr, -uInt16port), -void*recv_arg); -err_tudp_send(structudp_pcb*pcb,structpbuf*p); - -#defineudp_flags(pcb)((pcb)->flags) -#defineudp_setflags(pcb,f)((pcb)->flags=(f)) - - -/*ThefollowingfunctionsisthelowerlayerinterfacetoUDP.*/ -uInt8udp_lookup(structip_hdr*iphdr,structnetif*inp); -voidudp_input(structpbuf*p,structnetif*inp); -voidudp_init(void); - +typedefvoid(*udp_recv_fn)(void*arg,structudp_pcb*pcb,structpbuf*p, +constip_addr_t*addr,u16_tport); + +structudp_pcb{ +IP_PCB; + +/*ProtocolspecificPCBmembers*/ + +structudp_pcb*next; + +u8_tflags; +u16_tlocal_port,remote_port; + +#ifLWIP_MULTICAST_TX_OPTIONS + +ip_addr_tmulticast_ip; +u8_tmcast_ttl; +#endif/*LWIP_MULTICAST_TX_OPTIONS*/ -#endif/*__LWIP_UDP_H__*/ +#ifLWIP_UDPLITE - +u16_tchksum_len_rx,chksum_len_tx; +#endif/*LWIP_UDPLITE*/ + +udp_recv_fnrecv; +void*recv_arg; +}; +/*udp_pcbsexportforexternalreference(e.g.SNMPagent)*/ +externstructudp_pcb*udp_pcbs; + +/*Thefollowingfunctionsistheapplicationlayerinterfacetothe +UDPcode.*/ +structudp_pcb*udp_new(void); +structudp_pcb*udp_new_ip_type(u8_ttype); +voidudp_remove(structudp_pcb*pcb); +err_tudp_bind(structudp_pcb*pcb,constip_addr_t*ipaddr, +u16_tport); +err_tudp_connect(structudp_pcb*pcb,constip_addr_t*ipaddr, +u16_tport); +voidudp_disconnect(structudp_pcb*pcb); +voidudp_recv(structudp_pcb*pcb,udp_recv_fnrecv, +void*recv_arg); +err_tudp_sendto_if(structudp_pcb*pcb,structpbuf*p, +constip_addr_t*dst_ip,u16_tdst_port, +structnetif*netif); +err_tudp_sendto_if_src(structudp_pcb*pcb,structpbuf*p, +constip_addr_t*dst_ip,u16_tdst_port, +structnetif*netif,constip_addr_t*src_ip); +err_tudp_sendto(structudp_pcb*pcb,structpbuf*p, +constip_addr_t*dst_ip,u16_tdst_port); +err_tudp_send(structudp_pcb*pcb,structpbuf*p); + +#ifLWIP_CHECKSUM_ON_COPY&&CHECKSUM_GEN_UDP +err_tudp_sendto_if_chksum(structudp_pcb*pcb,structpbuf*p, +constip_addr_t*dst_ip,u16_tdst_port, +structnetif*netif,u8_thave_chksum, +u16_tchksum); +err_tudp_sendto_chksum(structudp_pcb*pcb,structpbuf*p, +constip_addr_t*dst_ip,u16_tdst_port, +u8_thave_chksum,u16_tchksum); +err_tudp_send_chksum(structudp_pcb*pcb,structpbuf*p, +u8_thave_chksum,u16_tchksum); +err_tudp_sendto_if_src_chksum(structudp_pcb*pcb,structpbuf*p, +constip_addr_t*dst_ip,u16_tdst_port,structnetif*netif, +u8_thave_chksum,u16_tchksum,constip_addr_t*src_ip); +#endif/*LWIP_CHECKSUM_ON_COPY&&CHECKSUM_GEN_UDP*/ + +#defineudp_flags(pcb)((pcb)->flags) +#defineudp_setflags(pcb,f)((pcb)->flags=(f)) + +/*ThefollowingfunctionsarethelowerlayerinterfacetoUDP.*/ +voidudp_input(structpbuf*p,structnetif*inp); + +voidudp_init(void); + +/*forcompatibilitywitholderimplementation*/ +#defineudp_new_ip6()udp_new_ip_type(IPADDR_TYPE_V6) + +#ifLWIP_MULTICAST_TX_OPTIONS +#defineudp_set_multicast_netif_addr(pcb,ip4addr)ip_addr_copy_from_ip4((pcb)->multicast_ip,*(ip4addr)) +#defineudp_get_multicast_netif_addr(pcb)ip_2_ip4(&(pcb)->multicast_ip) +#defineudp_set_multicast_ttl(pcb,value)do{(pcb)->mcast_ttl=value;}while(0) +#defineudp_get_multicast_ttl(pcb)((pcb)->mcast_ttl) +#endif/*LWIP_MULTICAST_TX_OPTIONS*/ + +#ifUDP_DEBUG +voidudp_debug_print(structudp_hdr*udphdr); +#else +#defineudp_debug_print(udphdr) +#endif + +voidudp_netif_ip_addr_changed(constip_addr_t*old_addr,constip_addr_t*new_addr); + +#ifdef__cplusplus +} +#endif + +#endif/*LWIP_UDP*/ + +#endif/*LWIP_HDR_UDP_H*/ - + diff --git a/doc/xml/udpecho_8c.xml b/doc/xml/udpecho_8c.xml index 083c58a..c236102 100644 --- a/doc/xml/udpecho_8c.xml +++ b/doc/xml/udpecho_8c.xml @@ -1,235 +1,329 @@ - - - + + + udpecho.c - ubixos/types.h + sys/types.h lib/kprintf.h net/api.h net/sys.h - - - - + + + + - + - + - + - - - - + + + + - - - - - - - - - + - - - + + + - - - - + + + + + + + + - + - - - - - + - - - - - - - - - - - - + + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - + + + + - - - - + + + + - - - - - - - - + + + + - + + + + + + + - - - - + + + + - + - + - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - + + + + - + - - - - - - - - - + - - - - - + - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + void void udpecho_init (void) @@ -243,12 +337,12 @@ - - NULL - sys_thread_new - udpecho_thread + + NULL + sys_thread_new + udpecho_thread - + void void udpecho_thread (void *arg) @@ -263,22 +357,10 @@ - - ip_addr::addr - buffer - kprintf - netbuf_copy - netbuf_delete - netbuf_fromaddr - netbuf_fromport - netconn_bind - netconn_connect - netconn_new - netconn_recv - netconn_send - NETCONN_UDP - NULL - udpecho_init + + buffer + NULL + udpecho_init @@ -318,56 +400,41 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: udpecho_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:udpecho.c542016-01-1101:29:55Zreddawg$ */ -#include<ubixos/types.h> +#include<sys/types.h> #include<lib/kprintf.h> #include"net/api.h" #include"net/sys.h" /*-----------------------------------------------------------------------------------*/ -void -udpecho_thread(void*arg) -{ -staticstructnetconn*conn; -staticstructnetbuf*buf; -staticstructip_addr*addr; -staticunsignedshortport; -charbuffer[4096]; - -kprintf("1"); -conn=netconn_new(NETCONN_UDP); -kprintf("2"); -netconn_bind(conn,NULL,7); -kprintf("3"); - -while(1){ -kprintf("a"); -buf=netconn_recv(conn); -kprintf("b"); -addr=netbuf_fromaddr(buf); -kprintf("c"); -port=netbuf_fromport(buf); -kprintf("d"); -netconn_connect(conn,addr,port); -kprintf("e"); -netconn_send(conn,buf); -kprintf("f"); -netbuf_copy(buf,buffer,sizeof(buffer)); -kprintf("got%s\n",buffer); -netbuf_delete(buf); -kprintf("g"); -} -} -/*-----------------------------------------------------------------------------------*/ -void -udpecho_init(void) -{ -sys_thread_new(udpecho_thread,NULL); -} +voidudpecho_thread(void*arg){ +staticstructnetconn*conn; +staticstructnetbuf*buf; +staticstructip_addr*addr; +staticunsignedshortport; +charbuffer[4096]; + +conn=netconn_new(NETCONN_UDP); +netconn_bind(conn,NULL,7); + +while(1){ +buf=netconn_recv(conn); +addr=netbuf_fromaddr(buf); +port=netbuf_fromport(buf); +netconn_connect(conn,addr,port); +netconn_send(conn,buf); +netbuf_copy(buf,buffer,sizeof(buffer)); +netbuf_delete(buf); +} +} +/*-----------------------------------------------------------------------------------*/ +voidudpecho_init(void){ +sys_thread_new(udpecho_thread,NULL); +} - + diff --git a/doc/xml/udpecho_8h.xml b/doc/xml/udpecho_8h.xml index efa508d..a076003 100644 --- a/doc/xml/udpecho_8h.xml +++ b/doc/xml/udpecho_8h.xml @@ -1,9 +1,9 @@ - - - + + + udpecho.h - + void void udpecho_init (void) @@ -17,10 +17,10 @@ - - NULL - sys_thread_new - udpecho_thread + + NULL + sys_thread_new + udpecho_thread @@ -60,15 +60,15 @@ * *Author:AdamDunkels<adam@sics.se> * -*$Id: udpecho_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +*$Id:udpecho.h542016-01-1101:29:55Zreddawg$ */ -#ifndef__UDPECHO_H__ -#define__UDPECHO_H__ - -voidudpecho_init(void); +#ifndef__UDPECHO_H__ +#define__UDPECHO_H__ + +voidudpecho_init(void); -#endif/*__UDPECHO_H__*/ +#endif/*__UDPECHO_H__*/ - + diff --git a/doc/xml/ufs_8c.xml b/doc/xml/ufs_8c.xml index 711f18e..e2ce1e4 100644 --- a/doc/xml/ufs_8c.xml +++ b/doc/xml/ufs_8c.xml @@ -1,204 +1,486 @@ - - - + + + ufs.c - vfs/vfs.h + sys/types.h + vfs/vfs.h + vfs/file.h ufs/ufs.h ufs/ffs.h lib/kprintf.h lib/kmalloc.h ubixos/kpanic.h - lib/string.h + string.h - + - + - - - + - - - - - + + + - + - - - - + + + + + + + + - - - + - - - - + + + + - - - - - - - - - - - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - - + + + + - - - + - - - - + + + + - - - - - - - - - - - - + + + + - - - - + + + + + + + + - - - - - - - + - + - - - - - - + + + + - - - - + + + + - - - - - + + + + + - + DBPERVBLK - (VBLKSIZE / DEV_BSIZE) + (VBLKSIZE / DEV_BSIZE) - - fsread + - + DIP field - fs->fs_magic == FS_UFS1_MAGIC ? dp1.field : dp2.field + fs->fs_magic == FS_UFS1_MAGIC ? dp1.field : dp2.field - - fsread + - + INDIRPERVBLK fs - (NINDIR(fs) / ((fs)->fs_bsize >> VBLKSHIFT)) + (NINDIR(fs) / ((fs)->fs_bsize >> VBLKSHIFT)) - - fsread + - + INO_TO_VBA fs ipervblk x - (fsbtodb(fs, cgimin(fs, ino_to_cg(fs, x))) + \ - (((x) % (fs)->fs_ipg) / (ipervblk) * DBPERVBLK)) + (fsbtodb(fs, cgimin(fs, ino_to_cg(fs, x))) + \ + (((x) % (fs)->fs_ipg) / (ipervblk) * DBPERVBLK)) - - fsread + - + INO_TO_VBO ipervblk x @@ -209,10 +491,9 @@ - - fsread + - + INOPB fs ((fs)->fs_inopb) @@ -222,34 +503,32 @@ - + - + IPERVBLK fs - (INOPB(fs) / ((fs)->fs_bsize >> VBLKSHIFT)) + (INOPB(fs) / ((fs)->fs_bsize >> VBLKSHIFT)) - - fsread + - + VBLKMASK - (VBLKSIZE - 1) + (VBLKSIZE - 1) - - fsread + - + VBLKSHIFT 12 @@ -258,40 +537,56 @@ - + - + VBLKSIZE - (1 << VBLKSHIFT) + (1 << VBLKSHIFT) - + + + + + + int + int sblock_try[] + [] + sblock_try + = SBLOCKSEARCH + + + + + + + - + int static int dskread - (void *buf, u_int64_t block, size_t count, fileDescriptor *fd) + (void *buf, uint64_t block, size_t count, fileDescriptor_t *fd) dskread void * buf - u_int64_t + uint64_t block - size_t + size_t count - fileDescriptor * + fileDescriptor_t * fd @@ -300,29 +595,23 @@ - - vfs_mountPoint::device - device_node::devInfo - device_interface::info - fileDescriptorStruct::mp - device_interface::read - fsread + - - __inline int + + __inline int static __inline int fsfind - (const char *name, ino_t *ino, fileDescriptor *fd) + (const char *name, ino_t *ino, fileDescriptor_t *fd) fsfind - const char * + const char * name - ino_t * + ino_t * ino - fileDescriptor * + fileDescriptor_t * fd @@ -331,24 +620,15 @@ - - dirent::d_fileno - dirent::d_name - dirent::d_reclen - dirent::d_type - DEV_BSIZE - fsread - fileDescriptorStruct::offset - strcmp - lookup + - - ssize_t + + ssize_t static ssize_t fsread - (ino_t inode, void *buf, size_t nbyte, fileDescriptor *fd) + (ino_t inode, void *buf, size_t nbyte, fileDescriptor_t *fd) fsread - ino_t + ino_t inode @@ -356,11 +636,11 @@ buf - size_t + size_t nbyte - fileDescriptor * + fileDescriptor_t * fd @@ -369,57 +649,19 @@ - - dmadat::blkbuf - blkoff - DBPERVBLK - DEV_BSHIFT - DEV_BSIZE - ufs2_dinode::di_db - ufs2_dinode::di_ib - ufs2_dinode::di_size - DIP - fileDescriptorStruct::dmadat - fileDescriptorStruct::dsk_meta - dskread - fs::fs_magic - FS_UFS1_MAGIC - FS_UFS2_MAGIC - fsbtodb - dmadat::indbuf - INDIRPERVBLK - INO_TO_VBA - INO_TO_VBO - IPERVBLK - kprintf - lblkno - MAXBSIZE - memcpy - NDADDR - NINDIR - fileDescriptorStruct::offset - dmadat::sbbuf - sblksize - sblock_try - fileDescriptorStruct::size - VBLKMASK - VBLKSHIFT - VBLKSIZE - fsfind - ufs_openFile - ufs_readFile + - - ino_t + + ino_t static ino_t lookup - (const char *path, fileDescriptor *fd) + (const char *path, fileDescriptor_t *fd) lookup - const char * + const char * path - fileDescriptor * + fileDescriptor_t * fd @@ -428,18 +670,9 @@ - - DT_DIR - DT_REG - fsfind - kprintf - MAXNAMLEN - memcpy - name - ROOTINO - ufs_openFile + - + int int ufs_init () @@ -450,17 +683,9 @@ - - kpanic - NULL - ufs_initialize - ufs_openFile - ufs_readFile - ufs_writeFile - vfsRegisterFS - x1 + - + int int ufs_initialize (struct vfs_mountPoint *mp) @@ -475,20 +700,19 @@ - - x1 + - + int static int ufs_openFile - (const char *file, fileDescriptor *fd) + (const char *file, fileDescriptor_t *fd) ufs_openFile - const char * + const char * file - fileDescriptor * + fileDescriptor_t * fd @@ -497,24 +721,15 @@ - - fileDescriptorStruct::dmadat - fsread - fileDescriptorStruct::ino - kmalloc - lookup - fileDescriptorStruct::offset - fileDescriptorStruct::perms - x1 - ufs_init + - + int int ufs_readFile - (fileDescriptor *fd, char *data, uInt32 offset, long size) + (fileDescriptor_t *fd, char *data, uInt32 offset, long size) ufs_readFile - fileDescriptor * + fileDescriptor_t * fd @@ -522,7 +737,7 @@ data - uInt32 + uInt32 offset @@ -535,18 +750,15 @@ - - fsread - fileDescriptorStruct::ino - ufs_init + - + int int ufs_writeFile - (fileDescriptor *fd, char *data, uInt32 offset, long size) + (fileDescriptor_t *fd, char *data, uInt32 offset, long size) ufs_writeFile - fileDescriptor * + fileDescriptor_t * fd @@ -554,7 +766,7 @@ data - uInt32 + uInt32 offset @@ -567,26 +779,8 @@ - - kprintf - ufs_init - - - - - int - int sblock_try[] - [] - sblock_try - SBLOCKSEARCH - - - - - - - - fsread + + kprintf @@ -619,324 +813,323 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: ufs_8c.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:ufs.c1022016-01-1203:59:34Zreddawg$ -*****************************************************************************************/ +*****************************************************************************************/ -#include<vfs/vfs.h> -#include<ufs/ufs.h> -#include<ufs/ffs.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<ubixos/kpanic.h> -#include<lib/string.h> - -#defineVBLKSHIFT12 -#defineVBLKSIZE(1<<VBLKSHIFT) -#defineVBLKMASK(VBLKSIZE-1) -#defineDBPERVBLK(VBLKSIZE/DEV_BSIZE) -#defineINDIRPERVBLK(fs)(NINDIR(fs)/((fs)->fs_bsize>>VBLKSHIFT)) -#defineIPERVBLK(fs)(INOPB(fs)/((fs)->fs_bsize>>VBLKSHIFT)) -#defineINOPB(fs)((fs)->fs_inopb) -#defineINO_TO_VBA(fs,ipervblk,x)\ -(fsbtodb(fs,cgimin(fs,ino_to_cg(fs,x)))+\ -(((x)%(fs)->fs_ipg)/(ipervblk)*DBPERVBLK)) -#defineINO_TO_VBO(ipervblk,x)((x)%ipervblk) - - -staticintdskread(void*buf,u_int64_tblock,size_tcount,fileDescriptor*fd){ -fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,buf,block,count); -return(0x0); -} - -//structdmadat{ -//charblkbuf[VBLKSIZE];/*filesystemblocks*/ -//charindbuf[VBLKSIZE];/*indirblocks*/ -//charsbbuf[SBLOCKSIZE];/*superblock*/ -//charsecbuf[DEV_BSIZE];/*forMBR/disklabel*/ -//}; -//staticstructdmadat*dmadat; - -//staticintls,dsk_meta; - -staticintsblock_try[]=SBLOCKSEARCH; - -#ifdefined(UFS2_ONLY) -#defineDIP(field)dp2.field -#elifdefined(UFS1_ONLY) -#defineDIP(field)dp1.field -#else -#defineDIP(field)fs->fs_magic==FS_UFS1_MAGIC?dp1.field:dp2.field -#endif - +#include<sys/types.h> +#include<vfs/vfs.h> +#include<vfs/file.h> +#include<ufs/ufs.h> +#include<ufs/ffs.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<ubixos/kpanic.h> +#include<string.h> + +#defineVBLKSHIFT12 +#defineVBLKSIZE(1<<VBLKSHIFT) +#defineVBLKMASK(VBLKSIZE-1) +#defineDBPERVBLK(VBLKSIZE/DEV_BSIZE) +#defineINDIRPERVBLK(fs)(NINDIR(fs)/((fs)->fs_bsize>>VBLKSHIFT)) +#defineIPERVBLK(fs)(INOPB(fs)/((fs)->fs_bsize>>VBLKSHIFT)) +#defineINOPB(fs)((fs)->fs_inopb) +#defineINO_TO_VBA(fs,ipervblk,x)\ +(fsbtodb(fs,cgimin(fs,ino_to_cg(fs,x)))+\ +(((x)%(fs)->fs_ipg)/(ipervblk)*DBPERVBLK)) +#defineINO_TO_VBO(ipervblk,x)((x)%ipervblk) + +staticintdskread(void*buf,uint64_tblock,size_tcount,fileDescriptor_t*fd){ +fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,buf,block,count); +return(0x0); +} + +//structdmadat{ +//charblkbuf[VBLKSIZE];/*filesystemblocks*/ +//charindbuf[VBLKSIZE];/*indirblocks*/ +//charsbbuf[SBLOCKSIZE];/*superblock*/ +//charsecbuf[DEV_BSIZE];/*forMBR/disklabel*/ +//}; +//staticstructdmadat*dmadat; + +//staticintls,dsk_meta; + +staticintsblock_try[]=SBLOCKSEARCH; + +#ifdefined(UFS2_ONLY) +#defineDIP(field)dp2.field +#elifdefined(UFS1_ONLY) +#defineDIP(field)dp1.field +#else +#defineDIP(field)fs->fs_magic==FS_UFS1_MAGIC?dp1.field:dp2.field +#endif -staticssize_tfsread(ino_tinode,void*buf,size_tnbyte,fileDescriptor*fd){ -#ifndefUFS2_ONLY -staticstructufs1_dinodedp1; -#endif -#ifndefUFS1_ONLY -staticstructufs2_dinodedp2; -#endif -staticino_tinomap; -char*blkbuf; -void*indbuf; -structfs*fs; -char*s; -size_tn,nb,size,off,vboff; -ufs_lbn_tlbn; -ufs2_daddr_taddr,vbaddr; -staticufs2_daddr_tblkmap,indmap; -u_intu; +staticssize_tfsread(ino_tinode,void*buf,size_tnbyte,fileDescriptor_t*fd){ +#ifndefUFS2_ONLY +staticstructufs1_dinodedp1; +#endif +#ifndefUFS1_ONLY +staticstructufs2_dinodedp2; +#endif +staticino_tinomap; +char*blkbuf; +void*indbuf; +structfs*fs; +char*s; +size_tn,nb,size,off,vboff; +ufs_lbn_tlbn; +ufs2_daddr_taddr,vbaddr; +staticufs2_daddr_tblkmap,indmap; +u_intu; - -blkbuf=fd->dmadat->blkbuf; -indbuf=fd->dmadat->indbuf; -fs=(structfs*)fd->dmadat->sbbuf; - -if(!fd->dsk_meta){ -inomap=0; -for(n=0;sblock_try[n]!=-1;n++){ -if(dskread(fs,sblock_try[n]/DEV_BSIZE,16,fd)) -return-1; -if(( -#ifdefined(UFS1_ONLY) -fs->fs_magic==FS_UFS1_MAGIC -#elifdefined(UFS2_ONLY) -(fs->fs_magic==FS_UFS2_MAGIC&& -fs->fs_sblockloc==sblock_try[n]) -#else -fs->fs_magic==FS_UFS1_MAGIC|| -(fs->fs_magic==FS_UFS2_MAGIC&& -fs->fs_sblockloc==sblock_try[n]) -#endif -)&& -fs->fs_bsize<=MAXBSIZE&& -fs->fs_bsize>=sizeof(structfs)) -break; -} -if(sblock_try[n]==-1){ -kprintf("Notufs\n"); -return-1; -} -fd->dsk_meta++; -} - -if(!inode) -return(0x0); - -if(inomap!=inode){ -n=IPERVBLK(fs); -if(dskread(blkbuf,INO_TO_VBA(fs,n,inode),DBPERVBLK,fd)) -return-1; -n=INO_TO_VBO(n,inode); -#ifdefined(UFS1_ONLY) -dp1=((structufs1_dinode*)blkbuf)[n]; -#elifdefined(UFS2_ONLY) -dp2=((structufs2_dinode*)blkbuf)[n]; -#else -if(fs->fs_magic==FS_UFS1_MAGIC) -dp1=((structufs1_dinode*)blkbuf)[n]; -else -dp2=((structufs2_dinode*)blkbuf)[n]; -#endif -inomap=inode; -fd->offset=0; -blkmap=indmap=0; -} - -s=buf; -size=DIP(di_size); -fd->size=size; -n=size-fd->offset; -//Why? -if(n<0) -return(0x0); -if(nbyte>n) -nbyte=n; -nb=nbyte; -while(nb){ -lbn=lblkno(fs,fd->offset); -off=blkoff(fs,fd->offset); -if(lbn<NDADDR){ -addr=DIP(di_db[lbn]); -}elseif(lbn<NDADDR+NINDIR(fs)){ -n=INDIRPERVBLK(fs); -addr=DIP(di_ib[0]); -u=(u_int)(lbn-NDADDR)/(n*DBPERVBLK); -vbaddr=fsbtodb(fs,addr)+u; -if(indmap!=vbaddr){ -if(dskread(indbuf,vbaddr,DBPERVBLK,fd)) -return-1; -indmap=vbaddr; -} -n=(lbn-NDADDR)&(n-1); -#ifdefined(UFS1_ONLY) -addr=((ufs1_daddr_t*)indbuf)[n]; -#elifdefined(UFS2_ONLY) -addr=((ufs2_daddr_t*)indbuf)[n]; -#else -if(fs->fs_magic==FS_UFS1_MAGIC) -addr=((ufs1_daddr_t*)indbuf)[n]; -else -addr=((ufs2_daddr_t*)indbuf)[n]; -#endif -}else{ -return-1; -} -vbaddr=fsbtodb(fs,addr)+(off>>VBLKSHIFT)*DBPERVBLK; -vboff=off&VBLKMASK; -n=sblksize(fs,size,lbn)-(off&~VBLKMASK); -if(n>VBLKSIZE) -n=VBLKSIZE; -if(blkmap!=vbaddr){ -if(dskread(blkbuf,vbaddr,n>>DEV_BSHIFT,fd)) -return-1; -blkmap=vbaddr; -} -n-=vboff; -if(n>nb) -n=nb; -memcpy(s,blkbuf+vboff,n); -s+=n; -fd->offset+=n; -nb-=n; -} -returnnbyte; -} - +blkbuf=fd->dmadat->blkbuf; +indbuf=fd->dmadat->indbuf; +fs=(structfs*)fd->dmadat->sbbuf; + +if(!fd->dsk_meta){ +inomap=0; +for(n=0;sblock_try[n]!=-1;n++){ +if(dskread(fs,sblock_try[n]/DEV_BSIZE,16,fd)) +return-1; +if(( +#ifdefined(UFS1_ONLY) +fs->fs_magic==FS_UFS1_MAGIC +#elifdefined(UFS2_ONLY) +(fs->fs_magic==FS_UFS2_MAGIC&&fs->fs_sblockloc==sblock_try[n]) +#else +fs->fs_magic==FS_UFS1_MAGIC||(fs->fs_magic==FS_UFS2_MAGIC&&fs->fs_sblockloc==sblock_try[n]) +#endif +)&&fs->fs_bsize<=MAXBSIZE&&fs->fs_bsize>=sizeof(structfs)) +break; +//MrOlsen2017-12-14thiswasfordebuggingkprintf("FindingSBlock:[%s][0x%X][%i-%i]\n",fs->fs_fsmnt,fs->fs_magic,sblock_try[n],sblock_try[n]/DEV_BSIZE); +} +if(sblock_try[n]==-1){ +kprintf("Notufs\n"); +return-1; +} +fd->dsk_meta++; +} + +if(!inode) +return(0x0); + +if(inomap!=inode){ +n=IPERVBLK(fs); +if(dskread(blkbuf,INO_TO_VBA(fs,n,inode),DBPERVBLK,fd)) +return-1; +n=INO_TO_VBO(n,inode); +#ifdefined(UFS1_ONLY) +dp1=((structufs1_dinode*)blkbuf)[n]; +memcpy(fd->inode.ufs1,dp1,sizeof(structufs1_dinode)); +#elifdefined(UFS2_ONLY) +dp2=((structufs2_dinode*)blkbuf)[n]; +memcpy(fd->inode.ufs2,dp2,sizeof(structufs2_dinode)); +#else +if(fs->fs_magic==FS_UFS1_MAGIC){ +dp1=((structufs1_dinode*)blkbuf)[n]; +memcpy(&fd->inode.u.ufs1_i,&dp1,sizeof(structufs1_dinode)); +} +else{ +dp2=((structufs2_dinode*)blkbuf)[n]; +memcpy(&fd->inode.u.ufs2_i,&dp2,sizeof(structufs2_dinode)); +} +#endif +inomap=inode; +fd->offset=0; +blkmap=indmap=0; +} + +s=buf; +size=DIP(di_size); +fd->size=size; +n=size-fd->offset; +//Why? +if(n<0) +return(0x0); +if(nbyte>n) +nbyte=n; +nb=nbyte; +while(nb){ +lbn=lblkno(fs,fd->offset); +off=blkoff(fs,fd->offset); +if(lbn<NDADDR){ +addr=DIP(di_db[lbn]); +}elseif(lbn<NDADDR+NINDIR(fs)){ +n=INDIRPERVBLK(fs); +addr=DIP(di_ib[0]); +u=(u_int)(lbn-NDADDR)/(n*DBPERVBLK); +vbaddr=fsbtodb(fs,addr)+u; +if(indmap!=vbaddr){ +if(dskread(indbuf,vbaddr,DBPERVBLK,fd)) +return-1; +indmap=vbaddr; +} +n=(lbn-NDADDR)&(n-1); +#ifdefined(UFS1_ONLY) +addr=((ufs1_daddr_t*)indbuf)[n]; +#elifdefined(UFS2_ONLY) +addr=((ufs2_daddr_t*)indbuf)[n]; +#else +if(fs->fs_magic==FS_UFS1_MAGIC) +addr=((ufs1_daddr_t*)indbuf)[n]; +else +addr=((ufs2_daddr_t*)indbuf)[n]; +#endif +}else{ +return-1; +} +vbaddr=fsbtodb(fs,addr)+(off>>VBLKSHIFT)*DBPERVBLK; +vboff=off&VBLKMASK; +n=sblksize(fs,size,lbn)-(off&~VBLKMASK); +if(n>VBLKSIZE) +n=VBLKSIZE; +if(blkmap!=vbaddr){ +if(dskread(blkbuf,vbaddr,n>>DEV_BSHIFT,fd)) +return-1; +blkmap=vbaddr; +} +n-=vboff; +if(n>nb) +n=nb; +memcpy(s,blkbuf+vboff,n); +s+=n; +fd->offset+=n; +nb-=n; +} +returnnbyte; +} - - -static__inlineintfsfind(constchar*name,ino_t*ino,fileDescriptor*fd){ -charbuf[DEV_BSIZE]; -structdirent*d; -char*s; -ssize_tn; - -fd->offset=0; -while((n=fsread(*ino,buf,DEV_BSIZE,fd))>0) -for(s=buf;s<buf+DEV_BSIZE;){ -d=(void*)s; -if(!strcmp(name,d->d_name)){ -*ino=d->d_fileno; -returnd->d_type; -} -s+=d->d_reclen; -} -//if(n!=-1&&ls) -//kprintf("\n"); -return0; -} - - -staticino_tlookup(constchar*path,fileDescriptor*fd){ -charname[MAXNAMLEN+1]; -constchar*s; -ino_tino; -ssize_tn; -intdt; - -ino=ROOTINO; -dt=DT_DIR; -name[0]='/'; -name[1]='\0'; -for(;;){ -if(*path=='/') -path++; -if(!*path) -break; -for(s=path;*s&&*s!='/';s++); -if((n=s-path)>MAXNAMLEN) -return0; -//ls=*path=='?'&&n==1&&!*s; -memcpy(name,path,n); -name[n]=0; -if(dt!=DT_DIR){ -kprintf("%s:notadirectory.\n",name); -return(0); -} -if((dt=fsfind(name,&ino,fd))<=0) -break; -path=s; -} +static__inlineintfsfind(constchar*name,ino_t*ino,fileDescriptor_t*fd){ +charbuf[DEV_BSIZE]; +structdirent*d; +char*s; +ssize_tn; + +fd->offset=0; +while((n=fsread(*ino,buf,DEV_BSIZE,fd))>0) +for(s=buf;s<buf+DEV_BSIZE;){ +d=(void*)s; +if(!strcmp(name,d->d_name)){ +*ino=d->d_fileno; +returnd->d_type; +} +s+=d->d_reclen; +} +*ino=0x0; +return0; +} + +staticino_tlookup(constchar*path,fileDescriptor_t*fd){ +charname[MAXNAMLEN+1]; +constchar*s; +ino_tino; +ssize_tn; +intdt; + +ino=ROOTINO; +dt=DT_DIR; +name[0]='/'; +name[1]='\0'; +for(;;){ +if(*path=='/') +path++; +if(!*path) +break; +for(s=path;*s&&*s!='/';s++) +; +if((n=s-path)>MAXNAMLEN) +return0; +//ls=*path=='?'&&n==1&&!*s; +memcpy(name,path,n); +name[n]=0; +if(dt!=DT_DIR){ +kprintf("%s:notadirectory.\n",name); +return(0); +} +if((dt=fsfind(name,&ino,fd))<=0) +break; +path=s; +} +returnino; +returndt==DT_REG?ino:0; +} - -returndt==DT_REG?ino:0; -} +staticintufs_openFile(constchar*file,fileDescriptor_t*fd){ +chartmp[2]; +intino=0; - -staticintufs_openFile(constchar*file,fileDescriptor*fd){ -chartmp[2]; -intino=0; -fd->dmadat=(structdmadat*)kmalloc(sizeof(structdmadat)); -ino=lookup(file,fd); -fd->offset=0x0; -fd->ino=ino; -if(ino==0x0){ -return(-1); -} +fd->dmadat=(structdmadat*)kmalloc(sizeof(structdmadat)); + +ino=lookup(file,fd); + +fd->offset=0x0; +fd->ino=ino; + +if(ino==0x0){ +kfree(fd->dmadat); +return(-1); +} /*QuickHackforfilesize*/ -fsread(fd->ino,&tmp,1,fd); -fd->offset=0; -/*Return*/ -fd->perms=0x1; -return(0x1); -} - -intufs_readFile(fileDescriptor*fd,char*data,uInt32offset,longsize){ -return(fsread(fd->ino,data,size,fd)); -} - -intufs_writeFile(fileDescriptor*fd,char*data,uInt32offset,longsize){ -kprintf("Writing:)\n"); -return(0x0); -} - -/***************************************************************************************** - -Function:intufs_initialize() - -Description:ThiswillinitializeamountpointitloadstheBATandCachestherootDir - -Notes: - -*****************************************************************************************/ -intufs_initialize(structvfs_mountPoint*mp){ -/*Return*/ -return(0x1); -} - -intufs_init(){ -/*Buildourufsstruct*/ -structfileSystemufs= -{NULL,/*prev*/ -NULL,/*next*/ -(void*)ufs_initialize,/*vfsInitFS*/ -(void*)ufs_readFile,/*vfsRead*/ -(void*)ufs_writeFile,/*vfsWrite*/ -(void*)ufs_openFile,/*vfsOpenFile*/ -NULL,/*vfsUnlink*/ -NULL,/*vfsMakeDir*/ -NULL,/*vfsRemDir*/ -NULL,/*vfsSync*/ -0xAA,/*vfsType*/ -};/*UFS*/ +fsread(fd->ino,&tmp,1,fd); +fd->offset=0; + +/*Return*/ +fd->perms=0x1; +return(0x1); +} + +intufs_readFile(fileDescriptor_t*fd,char*data,uInt32offset,longsize){ +return(fsread(fd->ino,data,size,fd)); +} + +intufs_writeFile(fileDescriptor_t*fd,char*data,uInt32offset,longsize){ +kprintf("Writing:)\n"); +return(0x0); +} + +/***************************************************************************************** + +Function:intufs_initialize() + +Description:ThiswillinitializeamountpointitloadstheBATandCachestherootDir + +Notes: + +*****************************************************************************************/ +intufs_initialize(structvfs_mountPoint*mp){ +/*Return*/ +return(0x1); +} + +intufs_init(){ +/*Buildourufsstruct*/ +structfileSystemufs={NULL,/*prev*/ +NULL,/*next*/ +(void*)ufs_initialize,/*vfsInitFS*/ +(void*)ufs_readFile,/*vfsRead*/ +(void*)ufs_writeFile,/*vfsWrite*/ +(void*)ufs_openFile,/*vfsOpenFile*/ +NULL,/*vfsUnlink*/ +NULL,/*vfsMakeDir*/ +NULL,/*vfsRemDir*/ +NULL,/*vfsSync*/ +0xAA,/*vfsType*/ +};/*UFS*/ -if(vfsRegisterFS(ufs)!=0x0){ -kpanic("UnableToEnableUFS"); -return(0x1); -} -//dmadat=(structdmadat*)kmalloc(sizeof(structdmadat)); +if(vfsRegisterFS(ufs)!=0x0){ +kpanic("UnableToEnableUFS"); +return(0x1); +} +//dmadat=(structdmadat*)kmalloc(sizeof(structdmadat)); /*Return*/ -return(0x0); -} +return(0x0); +} /*** END ***/ - - + diff --git a/doc/xml/ufs_8h.xml b/doc/xml/ufs_8h.xml index ee86a40..781fac0 100644 --- a/doc/xml/ufs_8h.xml +++ b/doc/xml/ufs_8h.xml @@ -1,124 +1,1198 @@ - - - + + + ufs.h - ubixos/types.h - vfs/vfs.h - sys/device.h - src/sys/include/ubixos/init.h - src/sys/ufs/ffs.c - src/sys/ufs/ufs.c + sys/types.h + sys/device.h + C:/Dev/git/UbixOS/sys/fs/ufs/ffs.c + C:/Dev/git/UbixOS/sys/fs/ufs/ufs.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/include/vfs/file.h + C:/Dev/git/UbixOS/sys/include/vfs/inode.h + C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c - - - - + + + + - - - + - - - - + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + + - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + + + + + + + - - - + + + - - - - + + + + + + + + - + - + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -129,101 +1203,98 @@ ufs1_dinode ufs2_dinode - + blkoff fs loc - /* calculates (loc % fs->fs_bsize) */ \ - ((loc) & (fs)->fs_qbmask) + ((loc) & (fs)->fs_qbmask) - - fsread + - + cgbase fs c - (((ufs2_daddr_t)(fs)->fs_fpg) * (c)) + (((ufs2_daddr_t)(fs)->fs_fpg) * (c)) - + - + cgdmin fs c - (cgstart(fs, c) + (fs)->fs_dblkno) + (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ - + - + cgimin fs c - (cgstart(fs, c) + (fs)->fs_iblkno) + (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ - + - + cgsblock fs c - (cgstart(fs, c) + (fs)->fs_sblkno) + (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ - + - + cgstart fs c - ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : \ - (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) + ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) : (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))) - + - + cgtod fs c - (cgstart(fs, c) + (fs)->fs_cblkno) + (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */ - + - + dbtofsb fs b @@ -234,34 +1305,31 @@ - + - + DEV_BSHIFT - 9 + 9 /* log2(DEV_BSIZE) */ - - fsread + - + DEV_BSIZE - (1<<DEV_BSHIFT) + (1<<DEV_BSHIFT) - - fsfind - fsread + - + DT_DIR 4 @@ -270,10 +1338,9 @@ - - lookup + - + DT_REG 8 @@ -282,62 +1349,57 @@ - - lookup + - + fragroundup fs size - /* calculates roundup(size, fs->fs_fsize) */ \ - (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask) + (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask) - + - + FS_UFS1_MAGIC - 0x011954 + 0x011954 /* UFS1 fast filesystem magic number */ - - fsread + - + FS_UFS2_MAGIC - 0x19540119 + 0x19540119 /* UFS2 fast filesystem magic number */ - - fsread + - + fsbtodb fs b - ((daddr_t)(b) << (fs)->fs_fsbtodb) + ((daddr_t)(b) << (fs)->fs_fsbtodb) - - fsread + - + FSMAXSNAP 20 @@ -346,9 +1408,9 @@ - + - + ino_to_cg fs x @@ -359,51 +1421,48 @@ - + - + ino_to_fsba fs x - ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ - (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) + ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) - + - + ino_to_fsbo fs x - ((x) % INOPB(fs)) + ((x) % INOPB(fs)) - + - + lblkno fs loc - /* calculates (loc / fs->fs_bsize) */ \ - ((loc) >> (fs)->fs_bshift) + ((loc) >> (fs)->fs_bshift) - - fsread + - + MAXBSIZE 65536 @@ -412,10 +1471,9 @@ - - fsread + - + MAXMNTLEN 468 @@ -424,9 +1482,9 @@ - + - + MAXNAMLEN 255 @@ -435,10 +1493,9 @@ - - lookup + - + MAXVOLLEN 32 @@ -447,32 +1504,31 @@ - + - + NDADDR - 12 + 12 /* Direct addresses in inode. */ - - fsread + - + NIADDR - 3 + 3 /* Indirect addresses in inode. */ - + - + NINDIR fs ((fs)->fs_nindir) @@ -482,10 +1538,9 @@ - - fsread + - + NOCSPTRS ((128 / sizeof(void *)) - 4) @@ -494,49 +1549,45 @@ - + - + NXADDR - 2 + 2 /* External addresses in inode. */ - + - + ROOTINO - ((ino_t)2) + ((ino_t)2) - - lookup + - + sblksize fs size lbn - (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \ - ? (fs)->fs_bsize \ - : (fragroundup(fs, blkoff(fs, (size))))) + (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) ? (fs)->fs_bsize : (fragroundup(fs, blkoff(fs, (size))))) - - fsread + - + SBLOCK_FLOPPY 0 @@ -545,9 +1596,9 @@ - + - + SBLOCK_PIGGY 262144 @@ -556,9 +1607,9 @@ - + - + SBLOCK_UFS1 8192 @@ -567,9 +1618,9 @@ - + - + SBLOCK_UFS2 65536 @@ -578,20 +1629,20 @@ - + - + SBLOCKSEARCH - { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } + { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 } - + - + SBLOCKSIZE 8192 @@ -600,25 +1651,12 @@ - + - - __int64_t - typedef __int64_t daddr_t - - daddr_t - - - - - - - - - - int32_t + + int32_t typedef int32_t ufs1_daddr_t ufs1_daddr_t @@ -628,10 +1666,10 @@ - + - - int64_t + + int64_t typedef int64_t ufs2_daddr_t ufs2_daddr_t @@ -641,10 +1679,10 @@ - + - - int64_t + + int64_t typedef int64_t ufs_lbn_t ufs_lbn_t @@ -654,10 +1692,10 @@ - + - - int64_t + + int64_t typedef int64_t ufs_time_t ufs_time_t @@ -667,11 +1705,11 @@ - + - + int int ufs_init () @@ -682,17 +1720,9 @@ - - kpanic - NULL - ufs_initialize - ufs_openFile - ufs_readFile - ufs_writeFile - vfsRegisterFS - x1 + - + int int ufs_initialize () @@ -703,8 +1733,7 @@ - - ufs_init + @@ -713,7 +1742,7 @@ /***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject +Copyright(c)2002-2004,2017TheUbixOSProject Allrightsreserved. Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are @@ -737,283 +1766,261 @@ TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. -$Id: ufs_8h.xml 88 2016-01-12 00:11:29Z reddawg $ +$Id:ufs.h1412016-01-1702:05:18Zreddawg$ -*****************************************************************************************/ +*****************************************************************************************/ -#ifndef_UFS_H -#define_UFS_H - -#include<ubixos/types.h> -#include<vfs/vfs.h> -#include<sys/device.h> - - -#defineDT_REG8 -#defineMAXNAMLEN255 -#defineROOTINO((ino_t)2) -#defineDT_DIR4 -#defineDEV_BSHIFT9/*log2(DEV_BSIZE)*/ -#defineDEV_BSIZE(1<<DEV_BSHIFT) -#defineSBLOCK_FLOPPY0 -#defineSBLOCK_UFS18192 -#defineSBLOCK_UFS265536 -#defineSBLOCK_PIGGY262144 -#defineSBLOCKSIZE8192 -#defineSBLOCKSEARCH\ -{SBLOCK_UFS2,SBLOCK_UFS1,SBLOCK_FLOPPY,SBLOCK_PIGGY,-1} -#defineFS_UFS1_MAGIC0x011954/*UFS1fastfilesystemmagicnumber*/ -#defineFS_UFS2_MAGIC0x19540119/*UFS2fastfilesystemmagicnumber*/ -#defineMAXMNTLEN468 -#defineMAXVOLLEN32 -#defineNOCSPTRS((128/sizeof(void*))-4) -#defineFSMAXSNAP20 -#defineMAXBSIZE65536 -#defineNINDIR(fs)((fs)->fs_nindir) - -/* -*Cylindergroupmacrostolocatethingsincylindergroups. -*Theycalcfilesystemaddressesofcylindergroupdatastructures. -*/ -#definecgbase(fs,c)(((ufs2_daddr_t)(fs)->fs_fpg)*(c)) -#definecgdmin(fs,c)(cgstart(fs,c)+(fs)->fs_dblkno)/*1stdata*/ -#definecgimin(fs,c)(cgstart(fs,c)+(fs)->fs_iblkno)/*inodeblk*/ -#definecgsblock(fs,c)(cgstart(fs,c)+(fs)->fs_sblkno)/*superblk*/ -#definecgtod(fs,c)(cgstart(fs,c)+(fs)->fs_cblkno)/*cgblock*/ -#definecgstart(fs,c)\ -((fs)->fs_magic==FS_UFS2_MAGIC?cgbase(fs,c):\ -(cgbase(fs,c)+(fs)->fs_old_cgoffset*((c)&~((fs)->fs_old_cgmask)))) - - -#definefsbtodb(fs,b)((daddr_t)(b)<<(fs)->fs_fsbtodb) -#definedbtofsb(fs,b)((b)>>(fs)->fs_fsbtodb) - -/* -*Macrosforhandlinginodenumbers: -*inodenumbertofilesystemblockoffset. -*inodenumbertocylindergroupnumber. -*inodenumbertofilesystemblockaddress. -*/ -#defineino_to_cg(fs,x)((x)/(fs)->fs_ipg) -#defineino_to_fsba(fs,x)\ -((ufs2_daddr_t)(cgimin(fs,ino_to_cg(fs,x))+\ -(blkstofrags((fs),(((x)%(fs)->fs_ipg)/INOPB(fs)))))) -#defineino_to_fsbo(fs,x)((x)%INOPB(fs)) - - -#defineblkoff(fs,loc)/*calculates(loc%fs->fs_bsize)*/\ -((loc)&(fs)->fs_qbmask) -#definelblkno(fs,loc)/*calculates(loc/fs->fs_bsize)*/\ -((loc)>>(fs)->fs_bshift) -#definefragroundup(fs,size)/*calculatesroundup(size,fs->fs_fsize)*/\ -(((size)+(fs)->fs_qfmask)&(fs)->fs_fmask) - - -#definesblksize(fs,size,lbn)\ -(((lbn)>=NDADDR||(size)>=((lbn)+1)<<(fs)->fs_bshift)\ -?(fs)->fs_bsize\ -:(fragroundup(fs,blkoff(fs,(size))))) - - - - -typedefint32_tufs1_daddr_t; -typedefint64_tufs2_daddr_t; -typedefint64_tufs_lbn_t; -typedefint64_tufs_time_t; -typedef__int64_tdaddr_t; - -structdirent{ -__uint32_td_fileno;/*filenumberofentry*/ -__uint16_td_reclen;/*lengthofthisrecord*/ -__uint8_td_type;/*filetype,seebelow*/ -__uint8_td_namlen;/*lengthofstringind_name*/ -chard_name[MAXNAMLEN+1];/*namemustbenolongerthanthis*/ -}; - -#defineNXADDR2/*Externaladdressesininode.*/ -#defineNDADDR12/*Directaddressesininode.*/ -#defineNIADDR3/*Indirectaddressesininode.*/ - -structufs2_dinode{ -u_int16_tdi_mode;/*0:IFMT,permissions;seebelow.*/ -int16_tdi_nlink;/*2:Filelinkcount.*/ -uint32_tdi_uid;/*4:Fileowner.*/ -uint32_tdi_gid;/*8:Filegroup.*/ -uint32_tdi_blksize;/*12:Inodeblocksize.*/ -u_int64_tdi_size;/*16:Filebytecount.*/ -u_int64_tdi_blocks;/*24:Bytesactuallyheld.*/ -ufs_time_tdi_atime;/*32:Lastaccesstime.*/ -ufs_time_tdi_mtime;/*40:Lastmodifiedtime.*/ -ufs_time_tdi_ctime;/*48:Lastinodechangetime.*/ -ufs_time_tdi_birthtime;/*56:Inodecreationtime.*/ -int32_tdi_mtimensec;/*64:Lastmodifiedtime.*/ -int32_tdi_atimensec;/*68:Lastaccesstime.*/ -int32_tdi_ctimensec;/*72:Lastinodechangetime.*/ -int32_tdi_birthnsec;/*76:Inodecreationtime.*/ -int32_tdi_gen;/*80:Generationnumber.*/ -uint32_tdi_kernflags;/*84:Kernelflags.*/ -uint32_tdi_flags;/*88:Statusflags(chflags).*/ -int32_tdi_extsize;/*92:Externalattributesblock.*/ -ufs2_daddr_tdi_extb[NXADDR];/*96:Externalattributesblock.*/ -ufs2_daddr_tdi_db[NDADDR];/*112:Directdiskblocks.*/ -ufs2_daddr_tdi_ib[NIADDR];/*208:Indirectdiskblocks.*/ -int64_tdi_spare[3];/*232:Reserved;currentlyunused*/ -}; - -structufs1_dinode{ -u_int16_tdi_mode;/*0:IFMT,permissions;seebelow.*/ -int16_tdi_nlink;/*2:Filelinkcount.*/ -union{ -u_int16_toldids[2];/*4:Ffs:olduserandgroupids.*/ -}di_u; -u_int64_tdi_size;/*8:Filebytecount.*/ -int32_tdi_atime;/*16:Lastaccesstime.*/ -int32_tdi_atimensec;/*20:Lastaccesstime.*/ -int32_tdi_mtime;/*24:Lastmodifiedtime.*/ -int32_tdi_mtimensec;/*28:Lastmodifiedtime.*/ -int32_tdi_ctime;/*32:Lastinodechangetime.*/ -int32_tdi_ctimensec;/*36:Lastinodechangetime.*/ -ufs1_daddr_tdi_db[NDADDR];/*40:Directdiskblocks.*/ -ufs1_daddr_tdi_ib[NIADDR];/*88:Indirectdiskblocks.*/ -uint32_tdi_flags;/*100:Statusflags(chflags).*/ -int32_tdi_blocks;/*104:Blocksactuallyheld.*/ -int32_tdi_gen;/*108:Generationnumber.*/ -uint32_tdi_uid;/*112:Fileowner.*/ -uint32_tdi_gid;/*116:Filegroup.*/ -int32_tdi_spare[2];/*120:Reserved;currentlyunused*/ -}; - -structcsum{ -int32_tcs_ndir;/*numberofdirectories*/ -int32_tcs_nbfree;/*numberoffreeblocks*/ -int32_tcs_nifree;/*numberoffreeinodes*/ -int32_tcs_nffree;/*numberoffreefrags*/ -}; -structcsum_total{ -int64_tcs_ndir;/*numberofdirectories*/ -int64_tcs_nbfree;/*numberoffreeblocks*/ -int64_tcs_nifree;/*numberoffreeinodes*/ -int64_tcs_nffree;/*numberoffreefrags*/ -int64_tcs_numclusters;/*numberoffreeclusters*/ -int64_tcs_spare[3];/*futureexpansion*/ -}; - - -structfs{ -int32_tfs_firstfield;/*historicfilesystemlinkedlist,*/ -int32_tfs_unused_1;/*usedforincoresuperblocks*/ -int32_tfs_sblkno;/*offsetofsuper-blockinfilesys*/ -int32_tfs_cblkno;/*offsetofcyl-blockinfilesys*/ -int32_tfs_iblkno;/*offsetofinode-blocksinfilesys*/ -int32_tfs_dblkno;/*offsetoffirstdataaftercg*/ -int32_tfs_old_cgoffset;/*cylindergroupoffsetincylinder*/ -int32_tfs_old_cgmask;/*usedtocalcmodfs_ntrak*/ -int32_tfs_old_time;/*lasttimewritten*/ -int32_tfs_old_size;/*numberofblocksinfs*/ -int32_tfs_old_dsize;/*numberofdatablocksinfs*/ -int32_tfs_ncg;/*numberofcylindergroups*/ -int32_tfs_bsize;/*sizeofbasicblocksinfs*/ -int32_tfs_fsize;/*sizeoffragblocksinfs*/ -int32_tfs_frag;/*numberoffragsinablockinfs*/ -/*theseareconfigurationparameters*/ -int32_tfs_minfree;/*minimumpercentageoffreeblocks*/ -int32_tfs_old_rotdelay;/*numofmsforoptimalnextblock*/ -int32_tfs_old_rps;/*diskrevolutionspersecond*/ -/*thesefieldscanbecomputedfromtheothers*/ -int32_tfs_bmask;/*``blkoff''calcofblkoffsets*/ -int32_tfs_fmask;/*``fragoff''calcoffragoffsets*/ -int32_tfs_bshift;/*``lblkno''calcoflogicalblkno*/ -int32_tfs_fshift;/*``numfrags''calcnumberoffrags*/ -/*theseareconfigurationparameters*/ -int32_tfs_maxcontig;/*maxnumberofcontiguousblks*/ -int32_tfs_maxbpg;/*maxnumberofblkspercylgroup*/ -/*thesefieldscanbecomputedfromtheothers*/ -int32_tfs_fragshift;/*blocktofragshift*/ -int32_tfs_fsbtodb;/*fsbtodbanddbtofsbshiftconstant*/ -int32_tfs_sbsize;/*actualsizeofsuperblock*/ -int32_tfs_spare1[2];/*oldfs_csmask*/ -/*oldfs_csshift*/ -int32_tfs_nindir;/*valueofNINDIR*/ -int32_tfs_inopb;/*valueofINOPB*/ -int32_tfs_old_nspf;/*valueofNSPF*/ -/*yetanotherconfigurationparameter*/ -int32_tfs_optim;/*optimizationpreference,seebelow*/ -int32_tfs_old_npsect;/*#sectors/trackincludingspares*/ -int32_tfs_old_interleave;/*hardwaresectorinterleave*/ -int32_tfs_old_trackskew;/*sector0skew,pertrack*/ -int32_tfs_id[2];/*uniquefilesystemid*/ -/*sizesdeterminedbynumberofcylindergroupsandtheirsizes*/ -int32_tfs_old_csaddr;/*blkaddrofcylgrpsummaryarea*/ -int32_tfs_cssize;/*sizeofcylgrpsummaryarea*/ -int32_tfs_cgsize;/*cylindergroupsize*/ -int32_tfs_spare2;/*oldfs_ntrak*/ -int32_tfs_old_nsect;/*sectorspertrack*/ -int32_tfs_old_spc;/*sectorspercylinder*/ -int32_tfs_old_ncyl;/*cylindersinfilesystem*/ -int32_tfs_old_cpg;/*cylinderspergroup*/ -int32_tfs_ipg;/*inodespergroup*/ -int32_tfs_fpg;/*blockspergroup*fs_frag*/ -/*thisdatamustbere-computedaftercrashes*/ -structcsumfs_old_cstotal;/*cylindersummaryinformation*/ -/*thesefieldsareclearedatmounttime*/ -int8_tfs_fmod;/*superblockmodifiedflag*/ -int8_tfs_clean;/*filesystemiscleanflag*/ -int8_tfs_ronly;/*mountedread-onlyflag*/ -int8_tfs_old_flags;/*oldFS_flags*/ -u_charfs_fsmnt[MAXMNTLEN];/*namemountedon*/ -u_charfs_volname[MAXVOLLEN];/*volumename*/ -u_int64_tfs_swuid;/*system-wideuid*/ -int32_tfs_pad;/*duetoalignmentoffs_swuid*/ -/*thesefieldsretainthecurrentblockallocationinfo*/ -int32_tfs_cgrotor;/*lastcgsearched*/ -void*fs_ocsp[NOCSPTRS];/*padding;waslistoffs_csbuffers*/ -u_int8_t*fs_contigdirs;/*(u)#ofcontig.allocateddirs*/ -structcsum*fs_csp;/*(u)cgsummaryinfobuffer*/ -int32_t*fs_maxcluster;/*(u)maxclusterineachcylgroup*/ -u_int*fs_active;/*(u)usedbysnapshotstotrackfs*/ -int32_tfs_old_cpc;/*cylpercycleinpostbl*/ -int32_tfs_maxbsize;/*maximumblockingfactorpermitted*/ -int64_tfs_sparecon64[17];/*oldrotationblocklisthead*/ -int64_tfs_sblockloc;/*byteoffsetofstandardsuperblock*/ -structcsum_totalfs_cstotal;/*(u)cylindersummaryinformation*/ -ufs_time_tfs_time;/*lasttimewritten*/ -int64_tfs_size;/*numberofblocksinfs*/ -int64_tfs_dsize;/*numberofdatablocksinfs*/ -ufs2_daddr_tfs_csaddr;/*blkaddrofcylgrpsummaryarea*/ -int64_tfs_pendingblocks;/*(u)blocksbeingfreed*/ -int32_tfs_pendinginodes;/*(u)inodesbeingfreed*/ -int32_tfs_snapinum[FSMAXSNAP];/*listofsnapshotinodenumbers*/ -int32_tfs_avgfilesize;/*expectedaveragefilesize*/ -int32_tfs_avgfpdir;/*expected#offilesperdirectory*/ -int32_tfs_save_cgsize;/*saverealcgsizetousefs_bsize*/ -int32_tfs_sparecon32[26];/*reservedforfutureconstants*/ -int32_tfs_flags;/*seeFS_flagsbelow*/ -int32_tfs_contigsumsize;/*sizeofclustersummaryarray*/ -int32_tfs_maxsymlinklen;/*maxlengthofaninternalsymlink*/ -int32_tfs_old_inodefmt;/*formatofon-diskinodes*/ -u_int64_tfs_maxfilesize;/*maximumrepresentablefilesize*/ -int64_tfs_qbmask;/*~fs_bmaskforusewith64-bitsize*/ -int64_tfs_qfmask;/*~fs_fmaskforusewith64-bitsize*/ -int32_tfs_state;/*validatefs_cleanfield*/ -int32_tfs_old_postblformat;/*formatofpositionallayouttables*/ -int32_tfs_old_nrpos;/*numberofrotationalpositions*/ -int32_tfs_spare5[2];/*oldfs_postbloff*/ -/*oldfs_rotbloff*/ -int32_tfs_magic;/*magicnumber*/ -}; - - -intufs_init(); -intufs_initialize(); - -#endif - -/*** -END -***/ - +#ifndef_UFS_H +#define_UFS_H + +#include<sys/types.h> +#include<sys/device.h> + +#defineDT_REG8 +#defineMAXNAMLEN255 +#defineROOTINO((ino_t)2) +#defineDT_DIR4 +#defineDEV_BSHIFT9/*log2(DEV_BSIZE)*/ +#defineDEV_BSIZE(1<<DEV_BSHIFT) +#defineSBLOCK_FLOPPY0 +#defineSBLOCK_UFS18192 +#defineSBLOCK_UFS265536 +#defineSBLOCK_PIGGY262144 +#defineSBLOCKSIZE8192 +#defineSBLOCKSEARCH{SBLOCK_UFS2,SBLOCK_UFS1,SBLOCK_FLOPPY,SBLOCK_PIGGY,-1} +#defineFS_UFS1_MAGIC0x011954/*UFS1fastfilesystemmagicnumber*/ +#defineFS_UFS2_MAGIC0x19540119/*UFS2fastfilesystemmagicnumber*/ +#defineMAXMNTLEN468 +#defineMAXVOLLEN32 +#defineNOCSPTRS((128/sizeof(void*))-4) +#defineFSMAXSNAP20 +#defineMAXBSIZE65536 +#defineNINDIR(fs)((fs)->fs_nindir) + +/* +*Cylindergroupmacrostolocatethingsincylindergroups. +*Theycalcfilesystemaddressesofcylindergroupdatastructures. +*/ +#definecgbase(fs,c)(((ufs2_daddr_t)(fs)->fs_fpg)*(c)) +#definecgdmin(fs,c)(cgstart(fs,c)+(fs)->fs_dblkno)/*1stdata*/ +#definecgimin(fs,c)(cgstart(fs,c)+(fs)->fs_iblkno)/*inodeblk*/ +#definecgsblock(fs,c)(cgstart(fs,c)+(fs)->fs_sblkno)/*superblk*/ +#definecgtod(fs,c)(cgstart(fs,c)+(fs)->fs_cblkno)/*cgblock*/ +#definecgstart(fs,c)((fs)->fs_magic==FS_UFS2_MAGIC?cgbase(fs,c):(cgbase(fs,c)+(fs)->fs_old_cgoffset*((c)&~((fs)->fs_old_cgmask)))) + +#definefsbtodb(fs,b)((daddr_t)(b)<<(fs)->fs_fsbtodb) +#definedbtofsb(fs,b)((b)>>(fs)->fs_fsbtodb) + +/* +*Macrosforhandlinginodenumbers: +*inodenumbertofilesystemblockoffset. +*inodenumbertocylindergroupnumber. +*inodenumbertofilesystemblockaddress. +*/ +#defineino_to_cg(fs,x)((x)/(fs)->fs_ipg) +#defineino_to_fsba(fs,x)((ufs2_daddr_t)(cgimin(fs,ino_to_cg(fs,x))+(blkstofrags((fs),(((x)%(fs)->fs_ipg)/INOPB(fs)))))) +#defineino_to_fsbo(fs,x)((x)%INOPB(fs)) + +#defineblkoff(fs,loc)((loc)&(fs)->fs_qbmask)//calculates(loc%fs->fs_bsize) +#definelblkno(fs,loc)((loc)>>(fs)->fs_bshift)//calculates(loc/fs->fs_bsize) +#definefragroundup(fs,size)(((size)+(fs)->fs_qfmask)&(fs)->fs_fmask)//calculatesroundup(size,fs->fs_fsize) + +#definesblksize(fs,size,lbn)(((lbn)>=NDADDR||(size)>=((lbn)+1)<<(fs)->fs_bshift)?(fs)->fs_bsize:(fragroundup(fs,blkoff(fs,(size))))) + +typedefint32_tufs1_daddr_t; +typedefint64_tufs2_daddr_t; +typedefint64_tufs_lbn_t; +typedefint64_tufs_time_t; +//MrOlsen(2016-01-16)NOTE:typedef__int64_tdaddr_t; + +structdirent{ +__uint32_td_fileno;/*filenumberofentry*/ +__uint16_td_reclen;/*lengthofthisrecord*/ +__uint8_td_type;/*filetype,seebelow*/ +__uint8_td_namlen;/*lengthofstringind_name*/ +chard_name[MAXNAMLEN+1];/*namemustbenolongerthanthis*/ +}; + +#defineNXADDR2/*Externaladdressesininode.*/ +#defineNDADDR12/*Directaddressesininode.*/ +#defineNIADDR3/*Indirectaddressesininode.*/ + +structufs2_dinode{ +u_int16_tdi_mode;/*0:IFMT,permissions;seebelow.*/ +int16_tdi_nlink;/*2:Filelinkcount.*/ +uint32_tdi_uid;/*4:Fileowner.*/ +uint32_tdi_gid;/*8:Filegroup.*/ +uint32_tdi_blksize;/*12:Inodeblocksize.*/ +u_int64_tdi_size;/*16:Filebytecount.*/ +u_int64_tdi_blocks;/*24:Bytesactuallyheld.*/ +ufs_time_tdi_atime;/*32:Lastaccesstime.*/ +ufs_time_tdi_mtime;/*40:Lastmodifiedtime.*/ +ufs_time_tdi_ctime;/*48:Lastinodechangetime.*/ +ufs_time_tdi_birthtime;/*56:Inodecreationtime.*/ +int32_tdi_mtimensec;/*64:Lastmodifiedtime.*/ +int32_tdi_atimensec;/*68:Lastaccesstime.*/ +int32_tdi_ctimensec;/*72:Lastinodechangetime.*/ +int32_tdi_birthnsec;/*76:Inodecreationtime.*/ +int32_tdi_gen;/*80:Generationnumber.*/ +uint32_tdi_kernflags;/*84:Kernelflags.*/ +uint32_tdi_flags;/*88:Statusflags(chflags).*/ +int32_tdi_extsize;/*92:Externalattributesblock.*/ +ufs2_daddr_tdi_extb[NXADDR];/*96:Externalattributesblock.*/ +ufs2_daddr_tdi_db[NDADDR];/*112:Directdiskblocks.*/ +ufs2_daddr_tdi_ib[NIADDR];/*208:Indirectdiskblocks.*/ +int64_tdi_spare[3];/*232:Reserved;currentlyunused*/ +}; + +structufs1_dinode{ +u_int16_tdi_mode;/*0:IFMT,permissions;seebelow.*/ +int16_tdi_nlink;/*2:Filelinkcount.*/ +union{ +u_int16_toldids[2];/*4:Ffs:olduserandgroupids.*/ +}di_u; +u_int64_tdi_size;/*8:Filebytecount.*/ +int32_tdi_atime;/*16:Lastaccesstime.*/ +int32_tdi_atimensec;/*20:Lastaccesstime.*/ +int32_tdi_mtime;/*24:Lastmodifiedtime.*/ +int32_tdi_mtimensec;/*28:Lastmodifiedtime.*/ +int32_tdi_ctime;/*32:Lastinodechangetime.*/ +int32_tdi_ctimensec;/*36:Lastinodechangetime.*/ +ufs1_daddr_tdi_db[NDADDR];/*40:Directdiskblocks.*/ +ufs1_daddr_tdi_ib[NIADDR];/*88:Indirectdiskblocks.*/ +uint32_tdi_flags;/*100:Statusflags(chflags).*/ +int32_tdi_blocks;/*104:Blocksactuallyheld.*/ +int32_tdi_gen;/*108:Generationnumber.*/ +uint32_tdi_uid;/*112:Fileowner.*/ +uint32_tdi_gid;/*116:Filegroup.*/ +int32_tdi_spare[2];/*120:Reserved;currentlyunused*/ +}; + +structcsum{ +int32_tcs_ndir;/*numberofdirectories*/ +int32_tcs_nbfree;/*numberoffreeblocks*/ +int32_tcs_nifree;/*numberoffreeinodes*/ +int32_tcs_nffree;/*numberoffreefrags*/ +}; +structcsum_total{ +int64_tcs_ndir;/*numberofdirectories*/ +int64_tcs_nbfree;/*numberoffreeblocks*/ +int64_tcs_nifree;/*numberoffreeinodes*/ +int64_tcs_nffree;/*numberoffreefrags*/ +int64_tcs_numclusters;/*numberoffreeclusters*/ +int64_tcs_spare[3];/*futureexpansion*/ +}; + +structfs{ +int32_tfs_firstfield;/*historicfilesystemlinkedlist,*/ +int32_tfs_unused_1;/*usedforincoresuperblocks*/ +int32_tfs_sblkno;/*offsetofsuper-blockinfilesys*/ +int32_tfs_cblkno;/*offsetofcyl-blockinfilesys*/ +int32_tfs_iblkno;/*offsetofinode-blocksinfilesys*/ +int32_tfs_dblkno;/*offsetoffirstdataaftercg*/ +int32_tfs_old_cgoffset;/*cylindergroupoffsetincylinder*/ +int32_tfs_old_cgmask;/*usedtocalcmodfs_ntrak*/ +int32_tfs_old_time;/*lasttimewritten*/ +int32_tfs_old_size;/*numberofblocksinfs*/ +int32_tfs_old_dsize;/*numberofdatablocksinfs*/ +int32_tfs_ncg;/*numberofcylindergroups*/ +int32_tfs_bsize;/*sizeofbasicblocksinfs*/ +int32_tfs_fsize;/*sizeoffragblocksinfs*/ +int32_tfs_frag;/*numberoffragsinablockinfs*/ +/*theseareconfigurationparameters*/ +int32_tfs_minfree;/*minimumpercentageoffreeblocks*/ +int32_tfs_old_rotdelay;/*numofmsforoptimalnextblock*/ +int32_tfs_old_rps;/*diskrevolutionspersecond*/ +/*thesefieldscanbecomputedfromtheothers*/ +int32_tfs_bmask;/*``blkoff''calcofblkoffsets*/ +int32_tfs_fmask;/*``fragoff''calcoffragoffsets*/ +int32_tfs_bshift;/*``lblkno''calcoflogicalblkno*/ +int32_tfs_fshift;/*``numfrags''calcnumberoffrags*/ +/*theseareconfigurationparameters*/ +int32_tfs_maxcontig;/*maxnumberofcontiguousblks*/ +int32_tfs_maxbpg;/*maxnumberofblkspercylgroup*/ +/*thesefieldscanbecomputedfromtheothers*/ +int32_tfs_fragshift;/*blocktofragshift*/ +int32_tfs_fsbtodb;/*fsbtodbanddbtofsbshiftconstant*/ +int32_tfs_sbsize;/*actualsizeofsuperblock*/ +int32_tfs_spare1[2];/*oldfs_csmask*/ +/*oldfs_csshift*/ +int32_tfs_nindir;/*valueofNINDIR*/ +int32_tfs_inopb;/*valueofINOPB*/ +int32_tfs_old_nspf;/*valueofNSPF*/ +/*yetanotherconfigurationparameter*/ +int32_tfs_optim;/*optimizationpreference,seebelow*/ +int32_tfs_old_npsect;/*#sectors/trackincludingspares*/ +int32_tfs_old_interleave;/*hardwaresectorinterleave*/ +int32_tfs_old_trackskew;/*sector0skew,pertrack*/ +int32_tfs_id[2];/*uniquefilesystemid*/ +/*sizesdeterminedbynumberofcylindergroupsandtheirsizes*/ +int32_tfs_old_csaddr;/*blkaddrofcylgrpsummaryarea*/ +int32_tfs_cssize;/*sizeofcylgrpsummaryarea*/ +int32_tfs_cgsize;/*cylindergroupsize*/ +int32_tfs_spare2;/*oldfs_ntrak*/ +int32_tfs_old_nsect;/*sectorspertrack*/ +int32_tfs_old_spc;/*sectorspercylinder*/ +int32_tfs_old_ncyl;/*cylindersinfilesystem*/ +int32_tfs_old_cpg;/*cylinderspergroup*/ +int32_tfs_ipg;/*inodespergroup*/ +int32_tfs_fpg;/*blockspergroup*fs_frag*/ +/*thisdatamustbere-computedaftercrashes*/ +structcsumfs_old_cstotal;/*cylindersummaryinformation*/ +/*thesefieldsareclearedatmounttime*/ +int8_tfs_fmod;/*superblockmodifiedflag*/ +int8_tfs_clean;/*filesystemiscleanflag*/ +int8_tfs_ronly;/*mountedread-onlyflag*/ +int8_tfs_old_flags;/*oldFS_flags*/ +u_charfs_fsmnt[MAXMNTLEN];/*namemountedon*/ +u_charfs_volname[MAXVOLLEN];/*volumename*/ +u_int64_tfs_swuid;/*system-wideuid*/ +int32_tfs_pad;/*duetoalignmentoffs_swuid*/ +/*thesefieldsretainthecurrentblockallocationinfo*/ +int32_tfs_cgrotor;/*lastcgsearched*/ +void*fs_ocsp[NOCSPTRS];/*padding;waslistoffs_csbuffers*/ +u_int8_t*fs_contigdirs;/*(u)#ofcontig.allocateddirs*/ +structcsum*fs_csp;/*(u)cgsummaryinfobuffer*/ +int32_t*fs_maxcluster;/*(u)maxclusterineachcylgroup*/ +u_int*fs_active;/*(u)usedbysnapshotstotrackfs*/ +int32_tfs_old_cpc;/*cylpercycleinpostbl*/ +int32_tfs_maxbsize;/*maximumblockingfactorpermitted*/ +int64_tfs_sparecon64[17];/*oldrotationblocklisthead*/ +int64_tfs_sblockloc;/*byteoffsetofstandardsuperblock*/ +structcsum_totalfs_cstotal;/*(u)cylindersummaryinformation*/ +ufs_time_tfs_time;/*lasttimewritten*/ +int64_tfs_size;/*numberofblocksinfs*/ +int64_tfs_dsize;/*numberofdatablocksinfs*/ +ufs2_daddr_tfs_csaddr;/*blkaddrofcylgrpsummaryarea*/ +int64_tfs_pendingblocks;/*(u)blocksbeingfreed*/ +int32_tfs_pendinginodes;/*(u)inodesbeingfreed*/ +int32_tfs_snapinum[FSMAXSNAP];/*listofsnapshotinodenumbers*/ +int32_tfs_avgfilesize;/*expectedaveragefilesize*/ +int32_tfs_avgfpdir;/*expected#offilesperdirectory*/ +int32_tfs_save_cgsize;/*saverealcgsizetousefs_bsize*/ +int32_tfs_sparecon32[26];/*reservedforfutureconstants*/ +int32_tfs_flags;/*seeFS_flagsbelow*/ +int32_tfs_contigsumsize;/*sizeofclustersummaryarray*/ +int32_tfs_maxsymlinklen;/*maxlengthofaninternalsymlink*/ +int32_tfs_old_inodefmt;/*formatofon-diskinodes*/ +u_int64_tfs_maxfilesize;/*maximumrepresentablefilesize*/ +int64_tfs_qbmask;/*~fs_bmaskforusewith64-bitsize*/ +int64_tfs_qfmask;/*~fs_fmaskforusewith64-bitsize*/ +int32_tfs_state;/*validatefs_cleanfield*/ +int32_tfs_old_postblformat;/*formatofpositionallayouttables*/ +int32_tfs_old_nrpos;/*numberofrotationalpositions*/ +int32_tfs_spare5[2];/*oldfs_postbloff*/ +/*oldfs_rotbloff*/ +int32_tfs_magic;/*magicnumber*/ +}; + +intufs_init(); +intufs_initialize(); + +#endif + +/*** +END +***/ - + diff --git a/doc/xml/uniondescriptorTableUnion.xml b/doc/xml/uniondescriptorTableUnion.xml index bcd46a4..9828e65 100644 --- a/doc/xml/uniondescriptorTableUnion.xml +++ b/doc/xml/uniondescriptorTableUnion.xml @@ -1,11 +1,11 @@ - - - + + + descriptorTableUnion gdt.h - - gdtDescriptor + + struct gdtDescriptor struct gdtDescriptor descriptorTableUnion::descriptor descriptor @@ -15,9 +15,9 @@ - + - + unsigned long unsigned long descriptorTableUnion::dummy @@ -28,10 +28,10 @@ - + - - gdtGate + + struct gdtGate struct gdtGate descriptorTableUnion::gate gate @@ -41,9 +41,7 @@ - - setTaskVector - setVector + @@ -51,30 +49,30 @@ - + - + - + - - gate + + +gate - - descriptor + + +descriptor - + - descriptorTableUniondescriptor - descriptorTableUniondummy - descriptorTableUniongate + descriptorTableUniondescriptor + descriptorTableUniondummy + descriptorTableUniongate diff --git a/doc/xml/unionetheraddr.xml b/doc/xml/unionetheraddr.xml index 8ce2d86..9fb689b 100644 --- a/doc/xml/unionetheraddr.xml +++ b/doc/xml/unionetheraddr.xml @@ -1,10 +1,10 @@ - - - + + + etheraddr ne2k.h - + unsigned char unsigned char etheraddr::bytes[6] [6] @@ -15,9 +15,9 @@ - + - + unsigned short unsigned short etheraddr::shorts[3] [3] @@ -28,17 +28,23 @@ - + - + + + + + + + - etheraddrbytes - etheraddrshorts + etheraddrbytes + etheraddrshorts diff --git a/doc/xml/unmappage_8c.xml b/doc/xml/unmappage_8c.xml index 07b6cf5..2f37fd2 100644 --- a/doc/xml/unmappage_8c.xml +++ b/doc/xml/unmappage_8c.xml @@ -1,76 +1,208 @@ - - - + + + unmappage.c vmm/vmm.h - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + - + + + - - - - + + + + - - - - + + + + - + void - void vmmUnmapPage - (uInt32 pageAddr, int flags) - vmmUnmapPage + void vmm_unmapPage + (uint32_t pageAddr, unmapFlags_t flags) + vmm_unmapPage - uInt32 + uint32_t pageAddr - int + unmapFlags_t flags @@ -79,35 +211,40 @@ - - tablesBaseAddress - x1000 - vmm_pageFault - vmmCopyVirtualSpace - vmmCreateVirtualSpace - vmmMapFromTask + + freePage + PAGE_PRESENT + PD_BASE_ADDR + PT_BASE_ADDR + sys_mmap + vmm_createVirtualSpace - + void - void vmmUnmapPages - (void *ptr, uInt32 size) - vmmUnmapPages + void vmm_unmapPages + (void *ptr, uint32_t size, unmapFlags_t flags) + vmm_unmapPages void * ptr - uInt32 + uint32_t size + + unmapFlags_t + flags + - - tablesBaseAddress + + PT_BASE_ADDR + sdeThread @@ -115,153 +252,121 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: unmappage_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> - -/************************************************************************ - -Function:voidvmmUnmapPage(uInt32pageAddr,intflags); -Description:ThisFunctionWillUnmapAPageFromTheKernelVMSpace -TheFlagsVariableDecidesIfItsToFreeThePageOrNot -AFlagOf0WillFreeItAndAFlagOf1WillKeepIt -Notes: - -07/30/02-IHaveDecidedThatThisShouldFreeThePhysicalPageThere -IsNoReasonToKeepItMarkedAsNotAvailable - -07/30/02-OkAFoundAReasonToKeepItMarkedAsAvailableIAdmit -EvenIAmNotPerfectOkTheCaseWhereYouWouldn'tWantTo -FreeItWouldBeOnSomethingLikeWhereIAllocatedAPage -ToCreateANewVirtualSpaceSoNowItHasAFlag - -************************************************************************/ -void -vmmUnmapPage(uInt32pageAddr,intflags) -{ -intpageDirectoryIndex=0,pageTableIndex=0; -uInt32*pageTable=0x0; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> + +/************************************************************************ + +Function:voidvmm_unmapPage(uInt32pageAddr,intflags); +Description:ThisFunctionWillUnmapAPageFromTheKernelVMSpace +TheFlagsVariableDecidesIfItsToFreeThePageOrNot +AFlagOf0WillFreeItAndAFlagOf1WillKeepIt +Notes: + +07/30/02-IHaveDecidedThatThisShouldFreeThePhysicalPageThere +IsNoReasonToKeepItMarkedAsNotAvailable + +07/30/02-OkAFoundAReasonToKeepItMarkedAsAvailableIAdmit +EvenIAmNotPerfectOkTheCaseWhereYouWouldn'tWantTo +FreeItWouldBeOnSomethingLikeWhereIAllocatedAPage +ToCreateANewVirtualSpaceSoNowItHasAFlag + +************************************************************************/ +voidvmm_unmapPage(uint32_tpageAddr,unmapFlags_tflags){ +intpageDirectoryIndex=0,pageTableIndex=0; +uint32_t*pageTable=0x0; +uint32_t*pageDirectory=0x0; + +pageDirectory=PD_BASE_ADDR; /*GetTheIndexToThePageDirectory*/ pageDirectoryIndex=(pageAddr>>22); - -//CalculateThePageTableIndex -pageTableIndex=((pageAddr>>12)&0x3FF); + +if((pageDirectory[pageDirectoryIndex]&PAGE_PRESENT)!=PAGE_PRESENT) +return; -/*SetpageTableToTheVirtualAddressOfTable*/ -pageTable=(uInt32*)(tablesBaseAddress+(0x1000*pageDirectoryIndex)); -/*FreeThePhysicalPageIfFlagsIs0*/ -if(flags==0){ - -/* -*ThisistempithinkitsstillanissueclearVirtualPage(pageAddr); -*freePage((uInt32)(pageTable[pageTableIndex]&0xFFFFF000)); -*/ -} +//CalculateThePageTableIndex +pageTableIndex=((pageAddr>>12)&0x3FF); + +/*SetpageTableToTheVirtualAddressOfTable*/ +pageTable=(uint32_t*)(PT_BASE_ADDR+(0x1000*pageDirectoryIndex)); + +/*FreeThePhysicalPageIfFlagsIs0*/ +if(flags==0) +freePage((uint32_t)(pageTable[pageTableIndex]&0xFFFFF000)); + /*UnmapThePage*/ pageTable[pageTableIndex]=0x0; -/*RehashThePageDirectory*/ -asmvolatile( -"movl%cr3,%eax\n" -"movl%eax,%cr3\n" -); -/*Return*/ -return; -} - - + +/*RehashThePageDirectory*/ +asmvolatile( +"movl%cr3,%eax\n" +"movl%eax,%cr3\n" +); + +/*Return*/ +return; +} /************************************************************************ -Function:voidvmmUnmapPages(uInt32pageAddr,intflags); -Description:ThisFunctionWillUnmapAPageFromTheKernelVMSpace -TheFlagsVariableDecidesIfItsToFreeThePageOrNot -AFlagOf0WillFreeItAndAFlagOf1WillKeepIt -Notes: +Function:voidvmm_unmapPages(uInt32pageAddr,intflags); +Description:ThisFunctionWillUnmapAPageFromTheKernelVMSpace +TheFlagsVariableDecidesIfItsToFreeThePageOrNot +AFlagOf0WillFreeItAndAFlagOf1WillKeepIt +Notes: -07/30/02-IHaveDecidedThatThisShouldFreeThePhysicalPageThere -IsNoReasonToKeepItMarkedAsNotAvailable +07/30/02-IHaveDecidedThatThisShouldFreeThePhysicalPageThere +IsNoReasonToKeepItMarkedAsNotAvailable -07/30/02-OkAFoundAReasonToKeepItMarkedAsAvailableIAdmit -EvenIAmNotPerfectOkTheCaseWhereYouWouldn'tWantTo -FreeItWouldBeOnSomethingLikeWhereIAllocatedAPage -ToCreateANewVirtualSpaceSoNowItHasAFlag - -************************************************************************/ -voidvmmUnmapPages(void*ptr,uInt32size){ -uInt32baseAddr=(uInt32)ptr&0xFFFFF000; -uInt32dI=0x0,tI=0x0; -uInt32y=0x0; -uInt32*pageTable=0x0; +07/30/02-OkAFoundAReasonToKeepItMarkedAsAvailableIAdmit +EvenIAmNotPerfectOkTheCaseWhereYouWouldn'tWantTo +FreeItWouldBeOnSomethingLikeWhereIAllocatedAPage +ToCreateANewVirtualSpaceSoNowItHasAFlag + +************************************************************************/ +voidvmm_unmapPages(void*ptr,uint32_tsize,unmapFlags_tflags){ +uInt32baseAddr=(uInt32)ptr&0xFFFFF000; +uInt32dI=0x0,tI=0x0; +uInt32y=0x0; +uInt32*pageTable=0x0; -dI=(baseAddr/(1024*4096)); -tI=((baseAddr-(dI*(1024*4096)))/4096); -pageTable=(uInt32*)(tablesBaseAddress+(4096*dI)); -for(y=tI;y<(tI+((size+4095)/4096));y++){ +dI=(baseAddr/(1024*4096)); +tI=((baseAddr-(dI*(1024*4096)))/4096); +pageTable=(uInt32*)(PT_BASE_ADDR+(4096*dI)); +for(y=tI;y<(tI+((size+4095)/4096));y++){ pageTable[y]=0x0; -} +} return; -} - -/*** -$Log: unmappage_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:54 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:38reddawg -Removed - -Revision1.1.1.12005/09/2617:24:54reddawg -nomessage - -Revision1.42004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.32004/06/1512:35:05reddawg -CleanedUp - -Revision1.22004/06/1022:23:56reddawg -Volatiles - -Revision1.1.1.12004/04/1512:06:53reddawg -UbixOSv1.0 - -Revision1.72004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - -END -***/ +} - + diff --git a/doc/xml/vfs_8c.xml b/doc/xml/vfs_8c.xml index 832106f..2753a66 100644 --- a/doc/xml/vfs_8c.xml +++ b/doc/xml/vfs_8c.xml @@ -1,227 +1,457 @@ - - - + + + vfs.c - vfs/vfs.h + vfs/vfs.h ubixos/vitals.h lib/kmalloc.h lib/kprintf.h - lib/string.h - sys/kern_descrip.h + string.h + sys/descrip.h - - - - + + + + + + + + + + - - - - + + + + - + - + - + - + - - - - - - - + + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + - + - + + + + + - + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - int - int sys_open - (struct thread *td, struct open_args *uap) - sys_open - - struct thread * - td - - - struct open_args * - uap - - -entry point for open syscall - - - -*td - - -pointer to callers thread - - - -*uap - - -pointer to user space arguements for call - - -index to file descriptor - - - - - falloc - file::fd - fopen - open_args::path - file::path - strcpy - thread::td_retval - - + int int vfs_init () @@ -232,13 +462,13 @@ - - vitalsStruct::fileSystems - kprintf - systemVitals + + vitalsStruct::fileSystems + kprintf + systemVitals - - fileSystem * + + struct fileSystem * struct fileSystem* vfsFindFS (int vfsType) vfsFindFS @@ -252,15 +482,14 @@ - - vitalsStruct::fileSystems - fileSystem::next - systemVitals - fileSystem::vfsType - vfs_mount - vfsRegisterFS + + vitalsStruct::fileSystems + fileSystem::next + systemVitals + fileSystem::vfsType + vfs_mount - + int int vfsRegisterFS (struct fileSystem newFS) @@ -270,34 +499,25 @@ newFS -register a file system +register a file system + -This registers a new filesystem into the vfs which is referenced when trying to mount a device +This registers a new filesystem into the vfs which is referenced when trying to mount a device + newFS -pointer to fileSystem structure +pointer to fileSystem structure + - + + - - vitalsStruct::fileSystems - kmalloc - kprintf - memcpy - fileSystem::next - NULL - fileSystem::prev - systemVitals - vfsFindFS - fileSystem::vfsType - x1 - devfs_init - ubixfs_init - ufs_init + + fat_init @@ -305,164 +525,137 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: vfs_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vfs/vfs.h> -#include<ubixos/vitals.h> -#include<lib/kmalloc.h> -#include<lib/kprintf.h> -#include<lib/string.h> -#include<sys/kern_descrip.h> - -/************************************************************************ - -Function:voidvfs_init(); - -Description:ThisFunctionInitializesTheVFSLayer - -Notes: - -02/20/2004-Approvedforquality - -************************************************************************/ -intvfs_init(){ -/*SetupdefaultfileSystemslist*/ -systemVitals->fileSystems=0x0; - -/*Printinformation*/ -kprintf("vfs0:loadedataddress:[0x%X]\n",systemVitals->fileSystems); - -/*Returnsoweknowthingswentwell*/ -return(0x0); -} - -structfileSystem*vfsFindFS(intvfsType){ -structfileSystem*tmp=0x0; - -/*SearchForFileSystem*/ -for(tmp=systemVitals->fileSystems;tmp;tmp=tmp->next){ -/*IfFoundReturnFileSystem*/ -if(tmp->vfsType==vfsType){ -return(tmp); -} -} - -/*IfFSNotFoundReturnNULL*/ -return(0x0); -} - -intvfsRegisterFS(structfileSystemnewFS){ -/* -intvfsType, -void*vfsInitFS, -void*vfsRead, -void*vfsWrite, -void*vfsOpenFile, -void*vfsUnlink, -void*vfsMakeDir, -void*vfsRemDir, -void*vfsSync){ -*/ -structfileSystem*tmpFs=0x0; - -if(vfsFindFS(newFS.vfsType)!=0x0){ -kprintf("FSIsalreadyRegistered\n"); -return(0x1); -} - -/*AllocateMemory*/ -tmpFs=(structfileSystem*)kmalloc(sizeof(structfileSystem)); -if(tmpFs==NULL){ -kprintf("vfsRegisterFS:memoryallocationfailed\n"); -/*MemoryAllocationFailed*/ -return(0x1); -} - -/*SetUpFSDefaults*/ - -/*20047-16-2004mji -*Oldmethod: -*tmpFs->vfsType=newFS.vfsType; -*tmpFs->vfsInitFS=newFS.vfsInitFS; -*tmpFs->vfsRead=newFS.vfsRead; -*tmpFs->vfsWrite=newFS.vfsWrite; -*tmpFs->vfsOpenFile=newFS.vfsOpenFile; -*tmpFs->vfsUnlink=newFS.vfsUnlink; -*tmpFs->vfsMakeDir=newFS.vfsMakeDir; -*tmpFs->vfsRemDir=newFS.vfsRemDir; -*tmpFs->vfsSync=newFS.vfsSync; -*/ -/*newmethod:*/ - -memcpy(tmpFs,&newFS,sizeof(structfileSystem)); -if(!systemVitals->fileSystems){ -tmpFs->prev=0x0; -tmpFs->next=0x0; -systemVitals->fileSystems=tmpFs; -} -else{ -tmpFs->prev=0x0; -tmpFs->next=systemVitals->fileSystems; -systemVitals->fileSystems->prev=tmpFs; -systemVitals->fileSystems=tmpFs; -} - -return(0x0); -} - -intsys_open(structthread*td,structopen_args*uap){ -interror=0x0; -intindex=0x0; -structfile*nfp=0x0; - -error=falloc(td,&nfp,&index); - -if(error) -return(error); - -strcpy(nfp->path,uap->path); - -nfp->fd=fopen(uap->path,"r"); -if(nfp->fd==0x0) -td->td_retval[0]=-1; -else -td->td_retval[0]=index; -return(error); -} - - -/*** -END -***/ - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vfs/vfs.h> +#include<ubixos/vitals.h> +#include<lib/kmalloc.h> +#include<lib/kprintf.h> +#include<string.h> +#include<sys/descrip.h> + +/************************************************************************ + +Function:voidvfs_init(); + +Description:ThisFunctionInitializesTheVFSLayer + +Notes: + +02/20/2004-Approvedforquality + +************************************************************************/ +intvfs_init(){ +/*SetupdefaultfileSystemslist*/ +systemVitals->fileSystems=0x0; + +/*Printinformation*/ +kprintf("vfs0:loadedataddress:[0x%X]\n",systemVitals->fileSystems); + +/*Returnsoweknowthingswentwell*/ +return(0x0); +} + +structfileSystem*vfsFindFS(intvfsType){ +structfileSystem*tmp=0x0; + +/*SearchForFileSystem*/ +for(tmp=systemVitals->fileSystems;tmp;tmp=tmp->next){ +/*IfFoundReturnFileSystem*/ +if(tmp->vfsType==vfsType){ +return(tmp); +} +} + +/*IfFSNotFoundReturnNULL*/ +return(0x0); +} + +intvfsRegisterFS(structfileSystemnewFS){ +/* +intvfsType, +void*vfsInitFS, +void*vfsRead, +void*vfsWrite, +void*vfsOpenFile, +void*vfsUnlink, +void*vfsMakeDir, +void*vfsRemDir, +void*vfsSync){ +*/ +structfileSystem*tmpFs=0x0; + +if(vfsFindFS(newFS.vfsType)!=0x0){ +kprintf("FSIsalreadyRegistered\n"); +return(0x1); +} + +/*AllocateMemory*/ +tmpFs=(structfileSystem*)kmalloc(sizeof(structfileSystem)); +if(tmpFs==NULL){ +kprintf("vfsRegisterFS:memoryallocationfailed\n"); +/*MemoryAllocationFailed*/ +return(0x1); +} + +/*SetUpFSDefaults*/ + +/*20047-16-2004mji +*Oldmethod: +*tmpFs->vfsType=newFS.vfsType; +*tmpFs->vfsInitFS=newFS.vfsInitFS; +*tmpFs->vfsRead=newFS.vfsRead; +*tmpFs->vfsWrite=newFS.vfsWrite; +*tmpFs->vfsOpenFile=newFS.vfsOpenFile; +*tmpFs->vfsUnlink=newFS.vfsUnlink; +*tmpFs->vfsMakeDir=newFS.vfsMakeDir; +*tmpFs->vfsRemDir=newFS.vfsRemDir; +*tmpFs->vfsSync=newFS.vfsSync; +*/ +/*newmethod:*/ + +memcpy(tmpFs,&newFS,sizeof(structfileSystem)); +if(!systemVitals->fileSystems){ +tmpFs->prev=0x0; +tmpFs->next=0x0; +systemVitals->fileSystems=tmpFs; +} +else{ +tmpFs->prev=0x0; +tmpFs->next=systemVitals->fileSystems; +systemVitals->fileSystems->prev=tmpFs; +systemVitals->fileSystems=tmpFs; +} + +return(0x0); +} - + diff --git a/doc/xml/vfs_8cpp.xml b/doc/xml/vfs_8cpp.xml index ea706f9..23c8f9e 100644 --- a/doc/xml/vfs_8cpp.xml +++ b/doc/xml/vfs_8cpp.xml @@ -1,61 +1,36 @@ - - - + + + vfs.cpp - stdio.h - vfs.h - - - - - - - - - - - - - - - - - - - - - - - - -#include<stdio.h> -#include"vfs.h" - -DiskFS::DiskFS(constchar*filename){ -diskFile=fopen(filename,"r+"); -}//DiskFS::DiskFS - -int -DiskFS::write(constvoid*data,longoffset,longsize){ -if(diskFile==NULL)return1; -fseek(diskFile,offset,SEEK_SET); -fwrite(data,size,1,diskFile); -return0; -}//DiskFS::write - -int -DiskFS::read(void*data,longoffset,longsize){ -if(diskFile==NULL)return1; -fseek(diskFile,offset,SEEK_SET); -fread(data,size,1,diskFile); -return0; -}//DiskFS::read +/*#include<stdio.h> +#include"vfs.h" + +DiskFS::DiskFS(constchar*filename){ +diskFile=fopen(filename,"r+"); +}//DiskFS::DiskFS + +int +DiskFS::write(constvoid*data,longoffset,longsize){ +if(diskFile==NULL)return1; +fseek(diskFile,offset,SEEK_SET); +fwrite(data,size,1,diskFile); +return0; +}//DiskFS::write + +int +DiskFS::read(void*data,longoffset,longsize){ +if(diskFile==NULL)return1; +fseek(diskFile,offset,SEEK_SET); +fread(data,size,1,diskFile); +return0; +}//DiskFS::read +*/ - + diff --git a/doc/xml/video_8c.xml b/doc/xml/video_8c.xml index dcdf007..2135aca 100644 --- a/doc/xml/video_8c.xml +++ b/doc/xml/video_8c.xml @@ -1,62 +1,128 @@ - - - + + + video.c sys/io.h sys/video.h - ubixos/types.h ubixos/spinlock.h ubixos/tty.h - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + int + int printColor + + printColor + = defaultColor + + + + + + + + sys_write + + + unsigned char * + unsigned char* videoBuffer + + videoBuffer + = (unsigned char *) 0xB8000 + + + + + + + + + - + void void backSpace () @@ -67,17 +133,11 @@ - - inportByte - outportByte - printColor - tty_foreground - tty_termNode::tty_x - tty_termNode::tty_y - videoBuffer - keyboardHandler + + inportByte + outportByte - + void void clearScreen () @@ -88,14 +148,9 @@ - - defaultColor - outportByte - videoBuffer - x20 - kmain + - + void void kprint (char *string) @@ -110,51 +165,14 @@ - - inportByte - NULL - outportByte - printColor - tty_find - tty_foreground - tty_print - videoBuffer - x20 - fdcRw - kmain - kprintf - - - - - int - int printColor - - printColor - defaultColor - - - - - - - - backSpace - kprint - - - unsigned char * - unsigned char* videoBuffer - - videoBuffer - (char *)0xB8000 - - - - - - - + + inportByte + NULL + outportByte + tty_find + tty_foreground + tty_print + kprintf @@ -162,137 +180,131 @@ -/***************************************************************************************** -Copyright(c)2002-2005TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: video_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<sys/io.h> -#include<sys/video.h> -#include<ubixos/types.h> -#include<ubixos/spinlock.h> -#include<ubixos/tty.h> - -staticunsignedchar*videoBuffer=(char*)0xB8000; -intprintColor=defaultColor; - - -voidbackSpace(){ -uInt32bufferOffset=0x0; -outportByte(0x3d4,0x0e); -bufferOffset=inportByte(0x3d5); -bufferOffset<<=0x8;/*ShiftAddressLeft8Bits*/ -outportByte(0x3d4,0x0f); -bufferOffset+=inportByte(0x3d5); -bufferOffset<<=0x1;/*ShiftAddressLeft1Bits*/ -videoBuffer[bufferOffset--]=0x20; -videoBuffer[bufferOffset--]=printColor; -videoBuffer[bufferOffset]=0x20; -bufferOffset>>=0x1; -tty_foreground->tty_x=(bufferOffset&0xFF); -tty_foreground->tty_y=(bufferOffset>>0x8); -outportByte(0x3D4,0x0f); -outportByte(0x3D5,tty_foreground->tty_x); -outportByte(0x3D4,0x0e); -outportByte(0x3D5,tty_foreground->tty_y); -return; -} - -void -kprint(char*string) -{ - -unsignedintbufferOffset=0x0,character=0x0,i=0x0; - -/*Shortcircuitifwe'reinttymode*/ -if(NULL!=tty_foreground) -{ -tty_print(string,tty_find(0)); -return; -} - -/*WeNeedToGetTheYPosition*/ -outportByte(0x3D4,0x0e); -bufferOffset=inportByte(0x3D5); -bufferOffset<<=8;/*ShiftAddressLeft8Bits*/ -/*ThenWeNeedToAddTheXPosition*/ -outportByte(0x3D4,0x0f); -bufferOffset+=inportByte(0x3D5); -bufferOffset<<=1;/*ShiftAddressLeft1Bits*/ - -while((character=*string++)){ -switch(character){ -case'\n': -bufferOffset=(bufferOffset/160)*160+160; -break; -default: -videoBuffer[bufferOffset++]=character; -videoBuffer[bufferOffset++]=printColor; -break; -}/*switch*/ -/*CheckToSeeIfWeAreOutOfBounds*/ -if(bufferOffset>=160*25){ -for(i=0;i<160*24;i++){ -videoBuffer[i]=videoBuffer[i+160]; -}/*for*/ -for(i=0;i<80;i++){ -videoBuffer[(160*24)+(i*2)]=0x20; -videoBuffer[(160*24)+(i*2)+1]=printColor; -}/*for*/ -bufferOffset-=160; -}/*if*/ -}/*while*/ -bufferOffset>>=1;/*Setthenewcursorposition*/ -outportByte(0x3D4,0x0f); -outportByte(0x3D5,((bufferOffset&0x0ff)&0xFF)); -outportByte(0x3D4,0x0e); -outportByte(0x3D5,((bufferOffset>>8)&0xFF)); - -return; -} - -/*ClearsTheScreen*/ -voidclearScreen(){ -shorti=0x0; - -for(i=0x0;i<(80*25);i++){ -videoBuffer[i*2]=0x20; -videoBuffer[i*2+1]=defaultColor; -} -outportByte(0x3D4,0x0f); -outportByte(0x3D5,0); -outportByte(0x3D4,0x0e); -outportByte(0x3D5,0); -} - -/*** -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<sys/io.h> +#include<sys/video.h> +#include<ubixos/spinlock.h> +#include<ubixos/tty.h> + +staticunsignedchar*videoBuffer=(unsignedchar*)0xB8000; +intprintColor=defaultColor; + +voidbackSpace(){ +uInt32bufferOffset=0x0; +outportByte(0x3d4,0x0e); +bufferOffset=inportByte(0x3d5); +bufferOffset<<=0x8;/*ShiftAddressLeft8Bits*/ +outportByte(0x3d4,0x0f); +bufferOffset+=inportByte(0x3d5); +bufferOffset<<=0x1;/*ShiftAddressLeft1Bits*/ +videoBuffer[bufferOffset--]=0x20; +videoBuffer[bufferOffset--]=printColor; +videoBuffer[bufferOffset]=0x20; +bufferOffset>>=0x1; +tty_foreground->tty_x=(bufferOffset&0xFF); +tty_foreground->tty_y=(bufferOffset>>0x8); +outportByte(0x3D4,0x0f); +outportByte(0x3D5,tty_foreground->tty_x); +outportByte(0x3D4,0x0e); +outportByte(0x3D5,tty_foreground->tty_y); +return; +} + +voidkprint(char*string){ + +unsignedintbufferOffset=0x0,character=0x0,i=0x0; + +/*Shortcircuitifwe'reinttymode*/ +if(NULL!=tty_foreground){ +tty_print(string,tty_find(0)); +return; +} + +/*WeNeedToGetTheYPosition*/ +outportByte(0x3D4,0x0e); +bufferOffset=inportByte(0x3D5); +bufferOffset<<=8;/*ShiftAddressLeft8Bits*/ +/*ThenWeNeedToAddTheXPosition*/ +outportByte(0x3D4,0x0f); +bufferOffset+=inportByte(0x3D5); +bufferOffset<<=1;/*ShiftAddressLeft1Bits*/ + +while((character=*string++)){ +switch(character){ +case'\n': +bufferOffset=(bufferOffset/160)*160+160; +break; +default: +videoBuffer[bufferOffset++]=character; +videoBuffer[bufferOffset++]=printColor; +break; +}/*switch*/ +/*CheckToSeeIfWeAreOutOfBounds*/ +if(bufferOffset>=160*25){ +for(i=0;i<160*24;i++){ +videoBuffer[i]=videoBuffer[i+160]; +}/*for*/ +for(i=0;i<80;i++){ +videoBuffer[(160*24)+(i*2)]=0x20; +videoBuffer[(160*24)+(i*2)+1]=printColor; +}/*for*/ +bufferOffset-=160; +}/*if*/ +}/*while*/ +bufferOffset>>=1;/*Setthenewcursorposition*/ +outportByte(0x3D4,0x0f); +outportByte(0x3D5,((bufferOffset&0x0ff)&0xFF)); +outportByte(0x3D4,0x0e); +outportByte(0x3D5,((bufferOffset>>8)&0xFF)); + +return; +} + +/*ClearsTheScreen*/ +voidclearScreen(){ +shorti=0x0; + +for(i=0x0;i<(80*25);i++){ +videoBuffer[i*2]=0x20; +videoBuffer[i*2+1]=defaultColor; +} +outportByte(0x3D4,0x0f); +outportByte(0x3D5,0); +outportByte(0x3D4,0x0e); +outportByte(0x3D5,0); +} + +/*** +END +***/ - + diff --git a/doc/xml/video_8h.xml b/doc/xml/video_8h.xml index 7328791..9f1636a 100644 --- a/doc/xml/video_8h.xml +++ b/doc/xml/video_8h.xml @@ -1,104 +1,177 @@ - - - + + + video.h - ubixos/types.h - src/sys/init/main.c - src/sys/isa/atkbd.c - src/sys/isa/fdc.c - src/sys/kernel/bioscall.c - src/sys/kernel/syscall.c - src/sys/lib/kprintf.c - src/sys/lib/libcpp.cc - src/sys/pci/hd.c - src/sys/pci/lnc.c - src/sys/sys/video.c + sys/types.h + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/init/main.c + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/fdc.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/kern_pipe.c + C:/Dev/git/UbixOS/sys/kernel/vfs_calls.c + C:/Dev/git/UbixOS/sys/lib/kprintf.c + C:/Dev/git/UbixOS/sys/lib/libcpp.cc + C:/Dev/git/UbixOS/sys/pci/lnc.c + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc + C:/Dev/git/UbixOS/sys/sys/video.c - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + defaultColor 0x0F @@ -107,12 +180,27 @@ - - clearScreen + + + + + + int + int printColor + + printColor + + + + + + + + sys_write - + void void backSpace () @@ -123,17 +211,11 @@ - - inportByte - outportByte - printColor - tty_foreground - tty_termNode::tty_x - tty_termNode::tty_y - videoBuffer - keyboardHandler + + inportByte + outportByte - + void void clearScreen () @@ -144,14 +226,9 @@ - - defaultColor - outportByte - videoBuffer - x20 - kmain + - + void void kprint (char *string) @@ -166,36 +243,14 @@ - - inportByte - NULL - outportByte - printColor - tty_find - tty_foreground - tty_print - videoBuffer - x20 - fdcRw - kmain - kprintf - - - - - int - int printColor - - printColor - - - - - - - - backSpace - kprint + + inportByte + NULL + outportByte + tty_find + tty_foreground + tty_print + kprintf @@ -203,71 +258,49 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: video_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_VIDEO_H -#define_VIDEO_H - -#include<ubixos/types.h> - -#definedefaultColor0x0F - -externintprintColor; - -voidclearScreen(); -voidkprint(char*string); -voidbackSpace(); - -#endif - -/*** -$Log: video_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:54 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:15reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:53reddawg -nomessage - -Revision1.22004/05/2115:12:17reddawg -Cleanedup - - -END -***/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_SYS_VIDEO_H +#define_SYS_VIDEO_H + +#include<sys/types.h> + +#definedefaultColor0x0F + +externintprintColor; + +voidclearScreen(); +voidkprint(char*string); +voidbackSpace(); + +#endif/*END_SYS_VIDEO_H*/ - + diff --git a/doc/xml/vitals_8c.xml b/doc/xml/vitals_8c.xml index 954269c..a5761e7 100644 --- a/doc/xml/vitals_8c.xml +++ b/doc/xml/vitals_8c.xml @@ -1,6 +1,6 @@ - - - + + + vitals.c ubixos/vitals.h ubixos/kpanic.h @@ -8,167 +8,468 @@ lib/kmalloc.h string.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vitalsNode * + vitalsNode* systemVitals + + systemVitals + = 0x0 + + + + + + + + gettimeofday + ogPrintf + sdeTestThread + sdeTestThreadOld + sdeThread + sysGetTime + sysGetUptime + sysSDE + systemTask + ubthread_cond_timedwait + vfs_addMount + vfs_findMount + vfs_init + vfsFindFS + vitals_init + + + spinLock_t + spinLock_t vitals_lock + + vitals_lock + + + + + + + + vitals_init + + - + int int vitals_init () @@ -179,50 +480,16 @@ - - vitalsStruct::dQuantum - kmalloc - kpanic - kprintf - memset - vitalsStruct::quantum - systemVitals - - - - - vitalsNode * - vitalsNode* systemVitals - - systemVitals - 0x0 - - - - - - - - adjustCowCounter - fclose - fopen - freePage - keyboardHandler - kmain - ogPrintf - sysGetTime - sysGetUptime - systemTask - time_init - ubthread_cond_timedwait - vfs_addMount - vfs_findMount - vfs_init - vfsFindFS - vfsRegisterFS - vitals_init - vmmFindFreePage - vmmFreeProcessPages + + vitalsStruct::dQuantum + kmalloc + kpanic + kprintf + memset + vitalsStruct::quantum + spinLockInit + systemVitals + vitals_lock @@ -230,81 +497,83 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: vitals_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<ubixos/vitals.h> -#include<ubixos/kpanic.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<string.h> - -vitalsNode*systemVitals=0x0; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<ubixos/vitals.h> +#include<ubixos/kpanic.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<string.h> + +vitalsNode*systemVitals=0x0; +spinLock_tvitals_lock; /************************************************************************ -Function:vitals_init(); -Description:Thiswillenablethevitalssubsystemforubixos +Function:vitals_init(); +Description:Thiswillenablethevitalssubsystemforubixos -Notes: +Notes: -02/20/2004-ApprovedItsQuality +02/20/2004-ApprovedItsQuality -************************************************************************/ -intvitals_init(){ -/*InitializeMemoryForTheSystemVitalsNode*/ -systemVitals=(vitalsNode*)kmalloc(sizeof(vitalsNode)); +************************************************************************/ +intvitals_init(){ +/*InitializeVitalsSpinLock*/ +spinLockInit(&vitals_lock); -/*IfmallocFailedThenError*/ -if(systemVitals==0x0) -{ -kpanic("Error:kmallocFailedIninitVitals\n"); -} - -/*Setalldefaultvalues*/ -memset(systemVitals,0x0,sizeof(vitalsNode)); - -systemVitals->quantum=8; -systemVitals->dQuantum=8; - -/*PrintOutInfoForVitals:*/ -kprintf("vitals0-Address:[0x%X]\n",systemVitals); - -/*Returnsokernelknowsthatthereisnoproblem*/ -return(0x0); -} - -/*** -END -***/ - +/*InitializeMemoryForTheSystemVitalsNode*/ +systemVitals=(vitalsNode*)kmalloc(sizeof(vitalsNode)); + +/*IfmallocFailedThenError*/ +if(systemVitals==0x0){ +kpanic("Error:kmallocFailedIninitVitals\n"); +} + +/*Setalldefaultvalues*/ +memset(systemVitals,0x0,sizeof(vitalsNode)); + +systemVitals->quantum=8; +systemVitals->dQuantum=8; + +/*PrintOutInfoForVitals:*/ +kprintf("vitals0-Address:[0x%X]\n",systemVitals); + +/*Returnsokernelknowsthatthereisnoproblem*/ +return(0x0); +} + +/*** +END +***/ + - + diff --git a/doc/xml/vitals_8h.xml b/doc/xml/vitals_8h.xml index 7a1eb95..45130a9 100644 --- a/doc/xml/vitals_8h.xml +++ b/doc/xml/vitals_8h.xml @@ -1,254 +1,562 @@ - - - + + + vitals.h - ubixos/ubthread.h - vfs/vfs.h - src/sys/include/ubixos/init.h - src/sys/isa/atkbd.c - src/sys/isa/ne2k.c - src/sys/kernel/endtask.c - src/sys/kernel/fork.c - src/sys/kernel/syscall.c - src/sys/kernel/systemtask.c - src/sys/kernel/time.c - src/sys/kernel/ubthread.c - src/sys/kernel/vitals.c - src/sys/lib/ogprintf.cc - src/sys/vfs/file.c - src/sys/vfs/mount.c - src/sys/vfs/vfs.c - src/sys/vmm/vmm_memory.c + sys/types.h + ubixos/spinlock.h + vfs/vfs.h + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/fs/vfs/file.c + C:/Dev/git/UbixOS/sys/fs/vfs/mount.c + C:/Dev/git/UbixOS/sys/fs/vfs/vfs.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/isa/atkbd.c + C:/Dev/git/UbixOS/sys/isa/ne2k.c + C:/Dev/git/UbixOS/sys/kernel/endtask.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kernel/time.c + C:/Dev/git/UbixOS/sys/kernel/ubthread.c + C:/Dev/git/UbixOS/sys/kernel/vitals.c + C:/Dev/git/UbixOS/sys/lib/ogprintf.cc + C:/Dev/git/UbixOS/sys/sde/colours.cc + C:/Dev/git/UbixOS/sys/sde/main.cc + C:/Dev/git/UbixOS/sys/sde/sde.cc + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c - - - - + + + + + + - - - - - - - - - - - - - + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vitalsStruct - - vitalsStruct + + struct vitalsStruct typedef struct vitalsStruct vitalsNode vitalsNode @@ -258,11 +566,55 @@ - + + + + + + vitalsNode * + vitalsNode* systemVitals + + systemVitals + + + + + + + + gettimeofday + ogPrintf + sdeTestThread + sdeTestThreadOld + sdeThread + sysGetTime + sysGetUptime + sysSDE + systemTask + ubthread_cond_timedwait + vfs_addMount + vfs_findMount + vfs_init + vfsFindFS + vitals_init + + + spinLock_t + spinLock_t vitals_lock + + vitals_lock + + + + + + + + vitals_init - + int int vitals_init () @@ -273,49 +625,16 @@ - - vitalsStruct::dQuantum - kmalloc - kpanic - kprintf - memset - vitalsStruct::quantum - systemVitals - - - - - vitalsNode * - vitalsNode* systemVitals - - systemVitals - - - - - - - - adjustCowCounter - fclose - fopen - freePage - keyboardHandler - kmain - ogPrintf - sysGetTime - sysGetUptime - systemTask - time_init - ubthread_cond_timedwait - vfs_addMount - vfs_findMount - vfs_init - vfsFindFS - vfsRegisterFS - vitals_init - vmmFindFreePage - vmmFreeProcessPages + + vitalsStruct::dQuantum + kmalloc + kpanic + kprintf + memset + vitalsStruct::quantum + spinLockInit + systemVitals + vitals_lock @@ -323,69 +642,65 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: vitals_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_VITALS_H -#define_VITALS_H - -//#include<ubixos/types.h> -#include<ubixos/ubthread.h> -//#include<vfs/mount.h> -#include<vfs/vfs.h> - -typedefstructvitalsStruct{ -uInt32openFiles; -uInt32sysTicks; -uInt32sysUptime; -uInt32quantum; -uInt32dQuantum; -uInt32freePages; -structfileSystem*fileSystems; -structvfs_mountPoint*mountPoints; -uInt32timeStart; -void*screen; -void*font; -char*packet; -uInt32packetLength; -}vitalsNode; - -externvitalsNode*systemVitals; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_UBIXOS_VITALS_H +#define_UBIXOS_VITALS_H + +#include<sys/types.h> +#include<ubixos/spinlock.h> +#include<vfs/vfs.h> + +typedefstructvitalsStruct{ +uint32_tsysTicks;//0-DoNotChangeOrder +uint32_tsysUptime;//4-DoNotChangeOrder +uint32_tquantum;//8-DoNotChangeOrder +uint32_tdQuantum;//12-DoNotChangeOrder +uint32_topenFiles; +uint32_tlastFD; +uint32_tfreePages; +structfileSystem*fileSystems; +structvfs_mountPoint*mountPoints; +uint32_ttimeStart; +void*screen; +void*font; +char*packet; +uint32_tpacketLength; +}vitalsNode; + +externvitalsNode*systemVitals; +externspinLock_tvitals_lock; -intvitals_init(); +intvitals_init(); #endif - -/*** -END -***/ - + diff --git a/doc/xml/vmm_8h.xml b/doc/xml/vmm_8h.xml index ca38651..7bf991b 100644 --- a/doc/xml/vmm_8h.xml +++ b/doc/xml/vmm_8h.xml @@ -1,242 +1,459 @@ - - - + + + vmm.h + sys/types.h vmm/paging.h - ubixos/types.h - src/sys/include/ubixos/init.h - src/sys/kernel/bioscall.c - src/sys/kernel/elf.c - src/sys/kernel/endtask.c - src/sys/kernel/exec.c - src/sys/kernel/fork.c - src/sys/kernel/ld.c - src/sys/kernel/sched.c - src/sys/kernel/syscall.c - src/sys/kernel/systemtask.c - src/sys/kmods/kmod.c - src/sys/lib/kmalloc.c - src/sys/sys/idt.c - src/sys/vmm/copyvirtualspace.c - src/sys/vmm/createvirtualspace.c - src/sys/vmm/getfreepage.c - src/sys/vmm/getfreevirtualpage.c - src/sys/vmm/getphysicaladdr.c - src/sys/vmm/pagefault.c - src/sys/vmm/paging.c - src/sys/vmm/setpageattributes.c - src/sys/vmm/unmappage.c - src/sys/vmm/vmm_init.c - src/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/arch/armv6/bioscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/exec.c + C:/Dev/git/UbixOS/sys/arch/armv6/fork.c + C:/Dev/git/UbixOS/sys/arch/armv6/sched.c + C:/Dev/git/UbixOS/sys/arch/armv6/syscall.c + C:/Dev/git/UbixOS/sys/arch/armv6/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/bioscall.c + C:/Dev/git/UbixOS/sys/arch/i386/fork.c + C:/Dev/git/UbixOS/sys/arch/i386/i386_exec.c + C:/Dev/git/UbixOS/sys/arch/i386/sched.c + C:/Dev/git/UbixOS/sys/arch/i386/systemtask.c + C:/Dev/git/UbixOS/sys/arch/i386/trap.c + C:/Dev/git/UbixOS/sys/include/ubixos/init.h + C:/Dev/git/UbixOS/sys/kernel/elf.c + C:/Dev/git/UbixOS/sys/kernel/endtask.c + C:/Dev/git/UbixOS/sys/kernel/gen_calls.c + C:/Dev/git/UbixOS/sys/kernel/ld.c + C:/Dev/git/UbixOS/sys/kernel/syscall.c + C:/Dev/git/UbixOS/sys/kmods/kmod.c + C:/Dev/git/UbixOS/sys/lib/kmalloc.c + C:/Dev/git/UbixOS/sys/sde/main.cc + C:/Dev/git/UbixOS/sys/sde/ogDisplay_UbixOS.cc + C:/Dev/git/UbixOS/sys/sys/idt.c + C:/Dev/git/UbixOS/sys/vmm/copyvirtualspace.c + C:/Dev/git/UbixOS/sys/vmm/createvirtualspace.c + C:/Dev/git/UbixOS/sys/vmm/getfreepage.c + C:/Dev/git/UbixOS/sys/vmm/getfreevirtualpage.c + C:/Dev/git/UbixOS/sys/vmm/getphysicaladdr.c + C:/Dev/git/UbixOS/sys/vmm/pagefault.c + C:/Dev/git/UbixOS/sys/vmm/paging.c + C:/Dev/git/UbixOS/sys/vmm/setpageattributes.c + C:/Dev/git/UbixOS/sys/vmm/unmappage.c + C:/Dev/git/UbixOS/sys/vmm/vmm_allocpagetable.c + C:/Dev/git/UbixOS/sys/vmm/vmm_init.c + C:/Dev/git/UbixOS/sys/vmm/vmm_memory.c + C:/Dev/git/UbixOS/sys/vmm/vmm_mmap.c - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + - - - - - + + + - + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + - + + + - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + freebsd6_mmap_args mMap - + memAvail 1 @@ -245,14 +462,9 @@ - - adjustCowCounter - freePage - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit + - + memNotavail 2 @@ -261,11 +473,163 @@ - - vmmFindFreePage - vmmMemMapInit + - + + STACK_ADDR + 0xBFFFFFFF + + + + + + + + + + VMM_KERN_CODE_END + 0x007FEFFF + + + + + + + + + + VMM_KERN_CODE_START + 0x00000000 + + + + + + + + + + VMM_KERN_END + 0xFDFFFFFF + + + + + + + + + + VMM_KERN_STACK_END + 0xFFFFFFFF + + + + + + + + + + VMM_KERN_STACK_START + 0xFE000000 + + + + + + + + + + VMM_KERN_START + 0xC0800000 + + + + + + + + + + VMM_MMAP_ADDR_PMODE + VMM_KERN_START /* (PD_BASE_ADDR + PAGE_SIZE) */ + + + + + + + + + + VMM_MMAP_ADDR_RMODE + 0x101000 + + + + + + + + + + VMM_PAGE_DIR + 0xC0400000 + + + + + + + + + + VMM_PAGE_DIRS + 0xC0000000 + + + + + + + + + + VMM_USER_END + 0xBFFFFFFF + + + + + + + + + + VMM_USER_LDT + 0x007FF000 + + + + + + + + + + VMM_USER_START + 0x00800000 + + + + + + + + + vmmID -3 @@ -274,32 +638,93 @@ - - adjustCowCounter - vmmFreeProcessPages - vmmMemMapInit + - - vmmMemoryMapAddr - 0xE6667000 + + + + + unmapFlags_t + + VMM_FREE + = 0 + + + + + + + VMM_KEEP + = 1 + + + + + - - vmm_pagingInit + + + + + + int + int numPages + + numPages + + + + + + + + vmm_memMapInit + vmm_pagingInit + + + struct spinLock + struct spinLock pdSpinLock + + pdSpinLock + + + + + + + + vmm_getFreeKernelPage + + + mMap * + mMap* vmmMemoryMap + + vmmMemoryMap + + + + + + + + freePage + vmm_memMapInit + vmm_pagingInit - + int int adjustCowCounter - (uInt32 baseAddr, int adjustment) + (uint32_t baseAddr, int adjustment) adjustCowCounter - uInt32 + uint32_t baseAddr @@ -312,26 +737,10 @@ - - assert - mMap::cowCounter - freePages - vitalsStruct::freePages - memAvail - mMap::pid - spinLock - spinUnlock - mMap::status - systemVitals - vmmCowSpinLock - vmmID - vmmMemoryMap - freePage - vmm_pageFault - vmmCopyVirtualSpace - vmmFreeProcessPages + + vmm_createVirtualSpace - + int int countMemory () @@ -342,19 +751,18 @@ - - cr0 - inportByte - outportByte - vmmMemMapInit + + inportByte + outportByte + vmm_memMapInit - + int int freePage - (uInt32 pageAddr) + (uint32_t pageAddr) freePage - uInt32 + uint32_t pageAddr @@ -363,23 +771,96 @@ - - adjustCowCounter - assert - mMap::cowCounter - freePages - vitalsStruct::freePages - memAvail - mMap::pid - spinLock - spinUnlock - mMap::status - systemVitals - vmmMemoryMap - vmmSpinLock - vmm_remapPage + + assert + spinLock + vmmMemoryMap + vmm_unmapPage - + + int + int vmm_allocPageTable + (uint32_t, pidType) + vmm_allocPageTable + + uint32_t + + + pidType + + + + + + + + + bzero + KERNEL_PAGE_DEFAULT + kpanic + PAGE_DEFAULT + PAGE_PRESENT + PAGE_SIZE + PD_BASE_ADDR + PD_ENTRIES + PD_INDEX + PT_BASE_ADDR + vmm_findFreePage + VMM_USER_END + VMM_USER_START + vmm_getFreeKernelPage + + + uint32_t + uint32_t vmm_findFreePage + (pidType pid) + vmm_findFreePage + + pidType + pid + + + + + + + + + kpanic + spinLock + sysID + elf_load_file + execFile + freebsd6_mmap + kmod_load + ldEnable + sys_mmap + sysExec + vmm_allocPageTable + vmm_getFreeKernelPage + vmm_pagingInit + + + void + void vmm_freeProcessPages + (pidType pid) + vmm_freeProcessPages + + pidType + pid + + + + + + + + + PD_BASE_ADDR + spinLock + systemTask + + int int vmm_init () @@ -387,161 +868,90 @@ -Function: int vmm_init()Description: Initializes the vmm subsystemNotes: - - - - K_PANIC - vmm_pagingInit - vmmMemMapInit - - - uint32_t - uint32_t vmmFindFreePage - (pidType pid) - vmmFindFreePage - - pidType - pid - - - - +Function: int vmm_init() +Description: Initializes the vmm subsystem +Notes: - - freePages - vitalsStruct::freePages - kpanic - memAvail - memNotavail - numPages - mMap::pid - spinLock - spinUnlock - status - sysID - systemVitals - vmmMemoryMap - vmmSpinLock - elf_loadfile - execFile - kmod_load - ldEnable - obreak - sys_exec - sysExec - vmm_getFreeMallocPage - vmm_pageFault - vmm_pagingInit - vmm_remapPage - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage + + K_PANIC + vmm_memMapInit + vmm_pagingInit - - void - void vmmFreeProcessPages - (pidType pid) - vmmFreeProcessPages - - pidType - pid - - - - - - - - - adjustCowCounter - mMap::cowCounter - freePages - vitalsStruct::freePages - memAvail - numPages - PAGE_COW - pageEntries - parentPageDirAddr - mMap::pid - spinLock - spinUnlock - status - systemVitals - tablesBaseAddress - vmmID - vmmMemoryMap - vmmSpinLock - x1000 - systemTask - - + int - int vmmMemMapInit + int vmm_memMapInit () - vmmMemMapInit + vmm_memMapInit - - countMemory - freePages - kprintf - memAvail - memNotavail - numPages - mMap::pageAddr - mMap::pid - mMap::status - status - vmmID - vmmMemoryMap - x1000 - vmm_init + + countMemory + mMap::cowCounter + memNotavail + numPages + PAGE_SIZE + mMap::pageAddr + mMap::pid + mMap::status + VMM_MMAP_ADDR_RMODE + vmmID + vmmMemoryMap + vmm_init - - - - int - int numPages - - numPages + + void + void vmm_unmapPage + (uint32_t, unmapFlags_t) + vmm_unmapPage + + uint32_t + + + unmapFlags_t + - - vmm_pagingInit - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit + + freePage + PAGE_PRESENT + PD_BASE_ADDR + PT_BASE_ADDR + sys_mmap + vmm_createVirtualSpace - - mMap * - mMap* vmmMemoryMap - - vmmMemoryMap + + void + void vmm_unmapPages + (void *, uint32_t, unmapFlags_t) + vmm_unmapPages + + void * + + + uint32_t + + + unmapFlags_t + - - adjustCowCounter - freePage - kmain - vmm_pagingInit - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit + + PT_BASE_ADDR + sdeThread @@ -549,100 +959,140 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: vmm_8h.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#ifndef_VMM_H -#define_VMM_H - +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#ifndef_VMM_VMM_H +#define_VMM_VMM_H + +#include<sys/types.h> #include<vmm/paging.h> -#include<ubixos/types.h> - -#definememAvail1 -#definememNotavail2 -#definevmmID-3 -#definevmmMemoryMapAddr0xE6667000 - -typedefstruct{ -uInt32pageAddr; -uInt16status; -uInt16reserved; -pid_tpid; -intcowCounter; -}mMap; - -externintnumPages; -externmMap*vmmMemoryMap; - -intvmm_init(); -intvmmMemMapInit(); -intcountMemory(); -uint32_tvmmFindFreePage(pidTypepid); -intfreePage(uInt32pageAddr); -intadjustCowCounter(uInt32baseAddr,intadjustment); -voidvmmFreeProcessPages(pidTypepid); - -#endif - -/*** -$Log: vmm_8h.xml,v $ -Revision 1.6 2006/12/19 14:12:54 reddawg -rtld-elf almost workign - -Revision1.22006/12/0514:10:21reddawg -WorkignDistro - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:23:59reddawg -nomessage - -Revision1.62004/07/2117:39:04reddawg -removeddevice - -Revision1.52004/07/1902:08:28reddawg -Cleanedouttherestofdebugingcodealsotemporarilydisabledtheipstacktoimproveboottime - -Revision1.42004/07/0912:18:19reddawg -UpdatingInitializationProcedures - -Revision1.32004/05/2115:21:04reddawg -Cleanedup - - -END -***/ + +#ifdef__cplusplus +extern"C"{ +#endif + +#defineSTACK_ADDR0xBFFFFFFF//0xC800000//DefaultAppStackAddress + +#definememAvail1 +#definememNotavail2 +#definevmmID-3 + +/* +#definevmmMemoryMapAddr0xE6667000 +#defineVMM_MMAP_ADDR_PMODE20xE6667000 +*/ + +#defineVMM_MMAP_ADDR_PMODEVMM_KERN_START/*(PD_BASE_ADDR+PAGE_SIZE)*/ +#defineVMM_MMAP_ADDR_RMODE0x101000 + +#defineVMM_KERN_CODE_START0x00000000 +#defineVMM_KERN_CODE_END0x007FEFFF + +#defineVMM_USER_LDT0x007FF000 + +#defineVMM_USER_START0x00800000 +#defineVMM_USER_END0xBFFFFFFF + +#defineVMM_PAGE_DIRS0xC0000000 +#defineVMM_PAGE_DIR0xC0400000 + +#defineVMM_KERN_START0xC0800000//TMPADDED1000 +#defineVMM_KERN_END0xFDFFFFFF + +#defineVMM_KERN_STACK_START0xFE000000 +#defineVMM_KERN_STACK_END0xFFFFFFFF + +externstructspinLockpdSpinLock; + + +structfreebsd6_mmap_args{ +charaddr_l_[PADL_(caddr_t)]; +caddr_taddr; +charaddr_r_[PADR_(caddr_t)]; + +charlen_l_[PADL_(size_t)]; +size_tlen; +charlen_r_[PADR_(size_t)]; + +charprot_l_[PADL_(int)]; +intprot; +charprot_r_[PADR_(int)]; +charflags_l_[PADL_(int)]; + +intflags; +charflags_r_[PADR_(int)]; +charfd_l_[PADL_(int)]; +intfd; +charfd_r_[PADR_(int)]; + +charpad_l_[PADL_(int)]; +intpad; +charpad_r_[PADR_(int)]; + +charpos_l_[PADL_(off_t)]; +off_tpos; +charpos_r_[PADR_(off_t)]; +}; + +typedefstruct{ +uint32_tpageAddr; +u_int16_tstatus; +u_int16_treserved; +pid_tpid; +intcowCounter; +}mMap; + +typedefenum{ +VMM_FREE=0,VMM_KEEP=1 +}unmapFlags_t; + +externintnumPages; +externmMap*vmmMemoryMap; + +intvmm_init(); +intvmm_memMapInit(); +intcountMemory(); +uint32_tvmm_findFreePage(pidTypepid); +intfreePage(uint32_tpageAddr); +intadjustCowCounter(uint32_tbaseAddr,intadjustment); +voidvmm_freeProcessPages(pidTypepid); + +intvmm_allocPageTable(uint32_t,pidType); +voidvmm_unmapPage(uint32_t,unmapFlags_t); +voidvmm_unmapPages(void*,uint32_t,unmapFlags_t); + +#ifdef__cplusplus +} +#endif + +#endif//_VMM_VMM_H - + diff --git a/doc/xml/vmm__init_8c.xml b/doc/xml/vmm__init_8c.xml index c508851..ce245fc 100644 --- a/doc/xml/vmm__init_8c.xml +++ b/doc/xml/vmm__init_8c.xml @@ -1,73 +1,231 @@ - - - + + + vmm_init.c vmm/vmm.h + ubixos/spinlock.h ubixos/kpanic.h - - - - + + + + + + - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - - - - + + + + - - - - + + + + - + + + - - - - - - + + + + - - - - + + + + + + + struct spinLock + struct spinLock pdSpinLock + + pdSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + vmm_getFreeKernelPage + + - + int int vmm_init () @@ -75,13 +233,16 @@ -Function: int vmm_init()Description: Initializes the vmm subsystemNotes: +Function: int vmm_init() +Description: Initializes the vmm subsystem +Notes: + - - K_PANIC - vmm_pagingInit - vmmMemMapInit + + K_PANIC + vmm_memMapInit + vmm_pagingInit @@ -89,53 +250,50 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: vmm__init_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<ubixos/spinlock.h> #include<ubixos/kpanic.h> -intvmm_init(){ -if(vmmMemMapInit()!=0x0) -K_PANIC("Couldn'tInitializevmmMemMap"); - -if(vmm_pagingInit()!=0x0) -K_PANIC("Couldn'tInitializepagingsystem"); - -return(0x0); -} - -/*** -END -***/ - +structspinLockpdSpinLock=SPIN_LOCK_INITIALIZER; + +intvmm_init(){ +if(vmm_memMapInit()!=0x0) +K_PANIC("Couldn'tInitializevmm_memMap"); + +if(vmm_pagingInit()!=0x0) +K_PANIC("Couldn'tInitializepagingsystem"); + +return(0x0); +} - + diff --git a/doc/xml/vmm__memory_8c.xml b/doc/xml/vmm__memory_8c.xml index c77c3ef..2f8a953 100644 --- a/doc/xml/vmm__memory_8c.xml +++ b/doc/xml/vmm__memory_8c.xml @@ -1,6 +1,6 @@ - - - + + + vmm_memory.c vmm/vmm.h sys/io.h @@ -10,202 +10,510 @@ ubixos/vitals.h ubixos/spinlock.h assert.h + i386/cpu.h - - - - + + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + uint32_t + uint32_t freePages + + freePages + = 0 + + + + + + + + + + int + int numPages + + numPages + = 0x0 + + + + + + + + vmm_memMapInit + vmm_pagingInit + + + mMap * + mMap* vmmMemoryMap + + vmmMemoryMap + = (mMap *) VMM_MMAP_ADDR_RMODE + + + + + + + + freePage + vmm_memMapInit + vmm_pagingInit + + + struct spinLock + struct spinLock vmmSpinLock + + vmmSpinLock + = SPIN_LOCK_INITIALIZER + + + + + + + + + - + int int adjustCowCounter (uInt32 baseAddr, int adjustment) adjustCowCounter - uInt32 + uInt32 baseAddr @@ -218,26 +526,12 @@ - - assert - mMap::cowCounter - vitalsStruct::freePages - freePages - memAvail - mMap::pid - spinLock - spinUnlock - mMap::status - systemVitals - vmmCowSpinLock - vmmID - vmmMemoryMap - freePage - vmm_pageFault - vmmCopyVirtualSpace - vmmFreeProcessPages + + assert + PAGE_SIZE + spinLock - + int int countMemory () @@ -248,19 +542,18 @@ - - cr0 - inportByte - outportByte - vmmMemMapInit + + inportByte + outportByte + vmm_memMapInit - + int int freePage - (uInt32 pageAddr) + (uint32_t pageAddr) freePage - uInt32 + uint32_t pageAddr @@ -269,29 +562,19 @@ - - adjustCowCounter - assert - mMap::cowCounter - vitalsStruct::freePages - freePages - memAvail - mMap::pid - spinLock - spinUnlock - mMap::status - systemVitals - vmmMemoryMap - vmmSpinLock - vmm_remapPage + + assert + spinLock + vmmMemoryMap + vmm_unmapPage - - uInt32 - uInt32 vmmFindFreePage + + uint32_t + uint32_t vmm_findFreePage (pidType pid) - vmmFindFreePage + vmm_findFreePage - pidType + pidType pid @@ -300,43 +583,28 @@ - - vitalsStruct::freePages - freePages - kpanic - memAvail - memNotavail - numPages - mMap::pid - spinLock - spinUnlock - status - sysID - systemVitals - vmmMemoryMap - vmmSpinLock - elf_loadfile - execFile - kmod_load - ldEnable - obreak - sys_exec - sysExec - vmm_getFreeMallocPage - vmm_pageFault - vmm_pagingInit - vmm_remapPage - vmmGetFreeKernelPage - vmmGetFreePage - vmmGetFreeVirtualPage + + kpanic + spinLock + sysID + elf_load_file + execFile + freebsd6_mmap + kmod_load + ldEnable + sys_mmap + sysExec + vmm_allocPageTable + vmm_getFreeKernelPage + vmm_pagingInit - + void - void vmmFreeProcessPages + void vmm_freeProcessPages (pidType pid) - vmmFreeProcessPages + vmm_freeProcessPages - pidType + pidType pid @@ -345,146 +613,35 @@ - - adjustCowCounter - mMap::cowCounter - vitalsStruct::freePages - freePages - memAvail - numPages - PAGE_COW - pageEntries - parentPageDirAddr - mMap::pid - spinLock - spinUnlock - status - systemVitals - tablesBaseAddress - vmmID - vmmMemoryMap - vmmSpinLock - x1000 - systemTask + + PD_BASE_ADDR + spinLock + systemTask - + int - int vmmMemMapInit + int vmm_memMapInit () - vmmMemMapInit + vmm_memMapInit - - countMemory - freePages - kprintf - memAvail - memNotavail - numPages - mMap::pageAddr - mMap::pid - status - mMap::status - vmmID - vmmMemoryMap - x1000 - vmm_init - - - - - uInt32 - uInt32 freePages - - freePages - 0 - - - - - - - - adjustCowCounter - freePage - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit - - - int - int numPages - - numPages - 0x0 - - - - - - - - vmm_pagingInit - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit - - - spinLock_t - spinLock_t vmmCowSpinLock - - vmmCowSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - adjustCowCounter - - - mMap * - mMap* vmmMemoryMap - - vmmMemoryMap - (mMap *) 0x101000 - - - - - - - - adjustCowCounter - freePage - kmain - vmm_pagingInit - vmmFindFreePage - vmmFreeProcessPages - vmmMemMapInit - - - spinLock_t - spinLock_t vmmSpinLock - - vmmSpinLock - SPIN_LOCK_INITIALIZER - - - - - - - - freePage - vmmFindFreePage - vmmFreeProcessPages + + countMemory + mMap::cowCounter + memNotavail + numPages + PAGE_SIZE + mMap::pageAddr + mMap::pid + mMap::status + VMM_MMAP_ADDR_RMODE + vmmID + vmmMemoryMap + vmm_init @@ -492,426 +649,406 @@ -/***************************************************************************************** -Copyright(c)2002-2004TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Id: vmm__memory_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -#include<vmm/vmm.h> -#include<sys/io.h> -#include<ubixos/kpanic.h> -#include<lib/kprintf.h> -#include<lib/kmalloc.h> -#include<ubixos/vitals.h> -#include<ubixos/spinlock.h> -#include<assert.h> - -staticuInt32freePages=0; -staticspinLock_tvmmSpinLock=SPIN_LOCK_INITIALIZER; -staticspinLock_tvmmCowSpinLock=SPIN_LOCK_INITIALIZER; - - -intnumPages=0x0; -mMap*vmmMemoryMap=(mMap*)0x101000; +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +#include<vmm/vmm.h> +#include<sys/io.h> +#include<ubixos/kpanic.h> +#include<lib/kprintf.h> +#include<lib/kmalloc.h> +#include<ubixos/vitals.h> +#include<ubixos/spinlock.h> +#include<assert.h> + +//MrOlsen(2016-01-11)NOTE:NeedtoSeperateOutCPUSpecificStuffOverTime +#include<i386/cpu.h> + +staticuint32_tfreePages=0; +staticstructspinLockvmmSpinLock=SPIN_LOCK_INITIALIZER; +//staticstructspinLockvmmCowSpinLock=SPIN_LOCK_INITIALIZER; + +intnumPages=0x0; - -/************************************************************************ - -Function:voidvmmMemMapInit(); -Description:ThisFunctionInitializesTheMemoryMapFortheSystem -Notes: - -02/20/2004-MadeItReportRealAndAvailableMemory - -************************************************************************/ -intvmmMemMapInit(){ -inti=0x0; -intmemStart=0x0; - -/*CountSystemMemory*/ -numPages=countMemory(); - -/*SetMemoryMapToPointToFirstPhysicalPageThatWeWillUse*/ -vmmMemoryMap=(mMap*)0x101000; - -/*InitializeMapMakeAllPagesNotAvailable*/ -for(i=0x0;i<numPages;i++){ -vmmMemoryMap[i].cowCounter=0x0; -vmmMemoryMap[i].status=memNotavail; -vmmMemoryMap[i].pid=vmmID; -vmmMemoryMap[i].pageAddr=i*4096; -} - -/*CalculateStartOfFreeMemory*/ -memStart=(0x101000/0x1000); -memStart+=(((sizeof(mMap)*numPages)+(sizeof(mMap)-1))/0x1000); +mMap*vmmMemoryMap=(mMap*)VMM_MMAP_ADDR_RMODE; + +/************************************************************************ + +Function:voidvmm_memMapInit(); +Description:ThisFunctionInitializesTheMemoryMapFortheSystem +Notes: + +02/20/2004-MadeItReportRealAndAvailableMemory + +************************************************************************/ +intvmm_memMapInit(){ +inti=0x0; +intmemStart=0x0; + +/*CountSystemMemory*/ +numPages=countMemory(); + +/*SetMemoryMapToPointToFirstPhysicalPageThatWeWillUse*/ +vmmMemoryMap=(mMap*)VMM_MMAP_ADDR_RMODE; + +/*InitializeMapMakeAllPagesNotAvailable*/ +for(i=0x0;i<numPages;i++){ +vmmMemoryMap[i].cowCounter=0x0; +vmmMemoryMap[i].status=memNotavail; +vmmMemoryMap[i].pid=vmmID; +vmmMemoryMap[i].pageAddr=i*PAGE_SIZE; +} + +/*CalculateStartOfFreeMemory*/ +memStart=(0x101000/0x1000); -/*InitializeAllFreePagesToAvailable*/ -vmmMemoryMap[(0x100000/0x1000)].status=memAvail; -freePages++; -for(i=memStart;i<numPages;i++){ -vmmMemoryMap[i].status=memAvail; -freePages++; -} - -/*PrintOutAmountOfMemory*/ -kprintf("RealMemory:%iKB\n",numPages*4); -kprintf("AvailableMemory:%iKB\n",freePages*4); +memStart+=(((sizeof(mMap)*numPages)+(sizeof(mMap)-1))/0x1000); + +/*InitializeAllFreePagesToAvailable*/ +vmmMemoryMap[(0x100000/0x1000)].status=memAvail; + +freePages++; + +for(i=memStart;i<numPages;i++){ +vmmMemoryMap[i].status=memAvail; +freePages++; +} -/*Return*/ -return(0); -} - -/************************************************************************ - -Function:intcountMemory(); -Description:ThisFunctionCountsTheSystemsPhysicalMemory -Notes: - -02/20/2004-InspectForQualityAndApproved - -************************************************************************/ -intcountMemory(){ -registeruInt32*mem=0x0; -unsignedlongmemCount=-1,tempMemory=0x0; -unsignedshortmemKb=0; -unsignedcharirq1State,irq2State; -unsignedlongcr0=0x0; - -/* -*SaveTheStatesOfBothIRQ1And2SoWeCanTurnThemOffAndRestore -*ThemLater -*/ -irq1State=inportByte(0x21); -irq2State=inportByte(0xA1); +if(systemVitals) +systemVitals->freePages=freePages; + +/*PrintOutAmountOfMemory*/ +kprintf("RealMemory:%iKB\n",numPages*4); +kprintf("AvailableMemory:%iKB\n",freePages*4); + +/*Return*/ +return(0); +} + +/************************************************************************ + +Function:intcountMemory(); +Description:ThisFunctionCountsTheSystemsPhysicalMemory +Notes: + +02/20/2004-InspectForQualityAndApproved + +************************************************************************/ +intcountMemory(){ +registeruInt32*mem=0x0; +unsignedlongmemCount=-1,tempMemory=0x0; +unsignedshortmemKb=8; +unsignedcharirq1State,irq2State; +unsignedlongcr0=0x0; -/*TurnOffIRQ1And2ToPreventChancesOfFaultsWhileExaminingMemory*/ -outportByte(0x21,0xFF); -outportByte(0xA1,0xFF); - -/*SaveTheStateOfRegisterCR0*/ -asmvolatile( -"movl%%cr0,%%ebx\n" -:"=a"(cr0) -: -:"ebx" -); - -asmvolatile("wbinvd"); -asmvolatile( -"movl%%ebx,%%cr0\n" -: -:"a"(cr0|0x00000001|0x40000000|0x20000000) -:"ebx" -); - -while(memKb<4096&&memCount!=0){ -memKb++; -if(memCount==-1) -memCount=0; -memCount+=1024*1024; -mem=(uInt32*)memCount; -tempMemory=*mem; -*mem=0x55AA55AA; -asm("":::"memory"); -if(*mem!=0x55AA55AA){ -memCount=0; -} -else{ -*mem=0xAA55AA55; -asm("":::"memory"); -if(*mem!=0xAA55AA55){ -memCount=0; -} -} -asm("":::"memory"); -*mem=tempMemory; -} - -asmvolatile( -"movl%%ebx,%%cr0\n" -: -:"a"(cr0) -:"ebx" -); +/* +*SaveTheStatesOfBothIRQ1And2SoWeCanTurnThemOffAndRestore +*ThemLater +*/ +irq1State=inportByte(0x21); +irq2State=inportByte(0xA1); + +/*TurnOffIRQ1And2ToPreventChancesOfFaultsWhileExaminingMemory*/ +outportByte(0x21,0xFF); +outportByte(0xA1,0xFF); + +/*SaveTheStateOfRegisterCR0*/ +cr0=rcr0(); + +/* +asmvolatile( +"movl%%cr0,%%ebx\n" +:"=a"(cr0) +: +:"ebx" +); +*/ + +asmvolatile("wbinvd"); + +load_cr0(cr0|0x00000001|0x40000000|0x20000000); + +/* +asmvolatile( +"movl%%ebx,%%cr0\n" +: +:"a"(cr0|0x00000001|0x40000000|0x20000000) +:"ebx" +); +*/ + +while(memKb<4096&&memCount!=0){ +memKb++; + +if(memCount==-1) +memCount=8388608; +else +memCount+=1024*1024; + +mem=(uInt32*)memCount; + +tempMemory=*mem; + +*mem=0x55AA55AA; -/*RestoreStatesForBothIRQ1And2*/ -outportByte(0x21,irq1State); -outportByte(0xA1,irq2State); - -/*ReturnAmountOfMemoryInPages*/ -return((memKb*1024*1024)/4096); -} - -/************************************************************************ - -Function:uInt32vmmFindFreePage(pid_tpid); - -Description:ThisReturnsAFreePhysicalPageAddressThenMarksIt -NotAvailableAsWellAsSettingThePIDToTheProccess -AllocatingThisPage -Notes: - -************************************************************************/ -uInt32vmmFindFreePage(pidTypepid){ -inti=0x0; +asm("":::"memory"); + +if(*mem!=0x55AA55AA){ +memCount=0; +} +else{ +*mem=0xAA55AA55; +asm("":::"memory"); +if(*mem!=0xAA55AA55){ +memCount=0; +} +} +asm("":::"memory"); +*mem=tempMemory; +} + +asm("nop"); + +//MrOlsen(2016-01-10)NOTE:Idon'tlikethisbutIstartincrementingformthestart. +memKb--; -/*LetsLookForAFreePage*/ -if(pid<sysID) -kpanic("Error:invalidPID%i\n",pid); - -spinLock(&vmmSpinLock); - -for(i=0;i<=numPages;i++){ - -/* -*IfWeFoundAFreePageSetItToNotAvailableAfterThatSetItsOwn -*AndReturnTheAddress -*/ -if((vmmMemoryMap[i].status==memAvail)&&(vmmMemoryMap[i].cowCounter==0)){ -vmmMemoryMap[i].status=memNotavail; -vmmMemoryMap[i].pid=pid; -freePages--; -if(systemVitals) -systemVitals->freePages=freePages; +asm("nop"); + +load_cr0(cr0); + +/* +asmvolatile( +"movl%%ebx,%%cr0\n" +: +:"a"(cr0) +:"ebx" +); +*/ + +asm("nop"); + +/*RestoreStatesForBothIRQ1And2*/ +outportByte(0x21,irq1State); +outportByte(0xA1,irq2State); -spinUnlock(&vmmSpinLock); -return(vmmMemoryMap[i].pageAddr); -} -} - -/*IfNoFreeMemoryIsFoundReturnNULL*/ -kpanic("OutOfMemory!!!!"); -return(0x0); -} - - -/************************************************************************ - -Function:intfreePage(uInt32pageAddr); +asm("nop"); + +/*ReturnAmountOfMemoryInPages*/ +return((memKb*1024*1024)/PAGE_SIZE); +} + +/************************************************************************ + +Function:uInt32vmm_findFreePage(pid_tpid); + +Description:ThisReturnsAFreePhysicalPageAddressThenMarksIt +NotAvailableAsWellAsSettingThePIDToTheProccess +AllocatingThisPage +Notes: -Description:ThisFunctionMarksThePageAsFree - -Notes: - -************************************************************************/ -intfreePage(uInt32pageAddr){ -intpageIndex=0x0; -assert((pageAddr&0xFFF)==0x0); -spinLock(&vmmSpinLock); - -/*FindThePageIndexToTheMemoryMap*/ -pageIndex=(pageAddr/4096); +************************************************************************/ +uint32_tvmm_findFreePage(pidTypepid){ + +inti=0x0; + +/*LetsLookForAFreePage*/ +if(pid<sysID) +kpanic("Error:invalidPID%i\n",pid); + +spinLock(&vmmSpinLock); + +for(i=0;i<=numPages;i++){ -/*CheckIfPageCOWIsGreaterThen0IfItIsDecItIfNotFreeIt*/ -if(vmmMemoryMap[pageIndex].cowCounter==0){ -/*SetPageAsAvailSoItCanBeUsedAgain*/ -vmmMemoryMap[pageIndex].status=memAvail; -vmmMemoryMap[pageIndex].cowCounter=0x0; -vmmMemoryMap[pageIndex].pid=-2; -freePages++; -systemVitals->freePages=freePages; -} -else{ -/*AdjustTheCOWCounter*/ -adjustCowCounter(((uInt32)vmmMemoryMap[pageIndex].pageAddr),-1); -} -spinUnlock(&vmmSpinLock); -/*Return*/ -return(0); -} - -/************************************************************************ - -Function:intadjustCowCounter(uInt32baseAddr,intadjustment); - -Description:ThisAdjustTheCOWCounterForPageAtbaseAddrItWill -ErrorIfTheCountGoesBelow0 +/* +*IfWeFoundAFreePageSetItToNotAvailableAfterThatSetItsOwn +*AndReturnTheAddress +*/ +if((vmmMemoryMap[i].status==memAvail)&&(vmmMemoryMap[i].cowCounter==0)){ +vmmMemoryMap[i].status=memNotavail; +vmmMemoryMap[i].pid=pid; +freePages--; +if(systemVitals) +systemVitals->freePages=freePages; + +spinUnlock(&vmmSpinLock); +return(vmmMemoryMap[i].pageAddr); +} +} + +/*IfNoFreeMemoryIsFoundReturnNULL*/ +kpanic("OutOfMemory!!!!"); +return(0x0); +} + +/************************************************************************ + +Function:intfreePage(uInt32pageAddr); -Notes: - -08/01/02-IThinkIfCounterGetsTo0IShouldFreeThePage +Description:ThisFunctionMarksThePageAsFree + +Notes: -************************************************************************/ -intadjustCowCounter(uInt32baseAddr,intadjustment){ -intvmmMemoryMapIndex=(baseAddr/4096); -assert((baseAddr&0xFFF)==0x0); -spinLock(&vmmCowSpinLock); -/*AdjustCOWCounter*/ -vmmMemoryMap[vmmMemoryMapIndex].cowCounter+=adjustment; - -if(vmmMemoryMap[vmmMemoryMapIndex].cowCounter==0){ -vmmMemoryMap[vmmMemoryMapIndex].cowCounter=0x0; -vmmMemoryMap[vmmMemoryMapIndex].pid=vmmID; -vmmMemoryMap[vmmMemoryMapIndex].status=memAvail; -freePages++; -systemVitals->freePages=freePages; -} -spinUnlock(&vmmCowSpinLock); -/*Return*/ -return(0); -} - -/************************************************************************ - -Function:voidvmmFreeProcessPages(pid_tpid); - -Description:ThisFunctionWillFreeUpMemoryForTheExitingProcess - -Notes: - -08/04/02-AddedCheckingForCOWPagesFirst - -************************************************************************/ -voidvmmFreeProcessPages(pidTypepid){ -inti=0,x=0; -uInt32*tmpPageTable=0x0; -uInt32*tmpPageDir=(uInt32*)parentPageDirAddr; -spinLock(&vmmSpinLock); -/*CheckPageDirectoryForAnAvailPageTable*/ -for(i=0;i<=0x300;i++){ -if(tmpPageDir[i]!=0){ -/*SetUpPageTablePointer*/ -tmpPageTable=(uInt32*)(tablesBaseAddress+(i*0x1000)); -/*CheckThePageTableForCOWPages*/ -for(x=0;x<pageEntries;x++){ -/*IfThePageIsCOWAdjustCOWCounter*/ -if(((uInt32)tmpPageTable[x]&PAGE_COW)==PAGE_COW){ -adjustCowCounter(((uInt32)tmpPageTable[x]&0xFFFFF000),-1); -} -} -} -} - -/*LoopThroughPagesToFindPagesOwnedByProcess*/ -for(i=0;i<numPages;i++){ -if(vmmMemoryMap[i].pid==pid){ -/*CheckToSeeIfThecowCounterIsZeroIfSoWeCanReeIt*/ -if(vmmMemoryMap[i].cowCounter==0){ -vmmMemoryMap[i].status=memAvail; -vmmMemoryMap[i].cowCounter=0x0; -vmmMemoryMap[i].pid=vmmID; -freePages++; -systemVitals->freePages=freePages; -} -} -} -/*Return*/ -spinUnlock(&vmmSpinLock); -return; -} - -/*** -$Log: vmm__memory_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:54 reddawg -rtld-elf almost workign - -Revision1.12006/12/0118:46:19reddawg -renamingfiles +************************************************************************/ +intfreePage(uint32_tpageAddr){ + +intpageIndex=0x0; +assert((pageAddr&0xFFF)==0x0); + +/*FindThePageIndexToTheMemoryMap*/ +pageIndex=(pageAddr/4096); + +/*CheckIfPageCOWIsGreaterThen0IfItIsDecItIfNotFreeIt*/ +if(vmmMemoryMap[pageIndex].cowCounter==0){ + +/*SetPageAsAvailSoItCanBeUsedAgain*/ +spinLock(&vmmSpinLock); +vmmMemoryMap[pageIndex].status=memAvail; +vmmMemoryMap[pageIndex].cowCounter=0x0; +vmmMemoryMap[pageIndex].pid=-2; +freePages++; +systemVitals->freePages=freePages; +spinUnlock(&vmmSpinLock); + +} +else{ +/*AdjustTheCOWCounter*/ +adjustCowCounter(((uint32_t)vmmMemoryMap[pageIndex].pageAddr),-1); +} + +/*Return*/ +return(0); +} + +/************************************************************************ + +Function:intadjustCowCounter(uInt32baseAddr,intadjustment); + +Description:ThisAdjustTheCOWCounterForPageAtbaseAddrItWill +ErrorIfTheCountGoesBelow0 + +Notes: + +08/01/02-IThinkIfCounterGetsTo0IShouldFreeThePage + +************************************************************************/ +intadjustCowCounter(uInt32baseAddr,intadjustment){ + +intvmmMemoryMapIndex=(baseAddr/PAGE_SIZE); + +assert((baseAddr&0xFFF)==0x0); + +spinLock(&vmmSpinLock); +/*AdjustCOWCounter*/ +vmmMemoryMap[vmmMemoryMapIndex].cowCounter+=adjustment; + +if(vmmMemoryMap[vmmMemoryMapIndex].cowCounter<=0){ + +if(vmmMemoryMap[vmmMemoryMapIndex].cowCounter<0) +kprintf("ERROR:WhyisCOWlessthan0"); + +vmmMemoryMap[vmmMemoryMapIndex].cowCounter=0x0; +vmmMemoryMap[vmmMemoryMapIndex].pid=vmmID; +vmmMemoryMap[vmmMemoryMapIndex].status=memAvail; +freePages++; +systemVitals->freePages=freePages; +} + +spinUnlock(&vmmSpinLock); +/*Return*/ +return(0); +} + +/************************************************************************ + +Function:voidvmm_freeProcessPages(pid_tpid); -Revision1.22006/12/0105:12:35reddawg -We'realmostthere...:) - -Revision1.1.1.12006/06/0112:46:13reddawg -ubix2 +Description:ThisFunctionWillFreeUpMemoryForTheExitingProcess + +Notes: + +08/04/02-AddedCheckingForCOWPagesFirst -Revision1.52006/06/0112:42:09reddawg -Gettingbacktothebasics - -Revision1.42006/06/0104:15:32reddawg -Woot - -Revision1.32006/06/0103:58:33reddawg -wonderingaboutthisstuffhere - -Revision1.22005/10/1200:13:38reddawg -Removed - -Revision1.1.1.12005/09/2617:24:51reddawg -nomessage - -Revision1.152004/09/1123:39:31reddawg -oktimeforbed - -Revision1.142004/09/1116:39:19apwillia -FixorderinadjustCowCountertopreventpotentialracecondition - -Revision1.132004/08/1411:23:03reddawg -Changes - -Revision1.122004/08/0120:51:33reddawg -adjustCowCounter:wenolongerneedtodebugunhandledadjustmentstheyarenormalsituationsnow - -Revision1.112004/07/2800:17:05reddawg -Major: -Disconnectedpage0x0fromthesystem...Unfortunatelythisbrokemanythings -allofwhichhavebeenfixed.ThiswasgoodbecausenothingdeferencesNULL -anymore. - -Thingsaffected: -malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file - -Revision1.102004/07/2619:15:49reddawg -testcode,fixesandthelike - -Revision1.92004/07/2423:04:44reddawg -Changes...markletmeknowifyoufaultatpid185whenyoutypestress - -Revision1.82004/07/2417:47:28reddawg -vmm_pageFault:deadlockresolvedthankstoaproppersolutionsuggestedbygeist - -Revision1.72004/07/1902:04:32reddawg -memory.c:addedspinlockstovmmFindFreePageandvmmFreePagetopreventtwotasksfrompossiblyallocatingthesamepage - -Revision1.62004/06/1412:20:54reddawg -notes:manybugsrepairedandldworks100%now. - -Revision1.52004/05/2115:34:23reddawg -Fixedacoupleoftypo - -Revision1.42004/05/2114:50:10reddawg -Cleanedup - -Revision1.32004/05/1917:28:28reddawg -AddedthecorrectendTaskProcedure - -Revision1.22004/04/3014:16:04reddawg -FixedallthedatatypestobeconsistantuInt8,uInt16,uInt32,Int8,Int16,Int32 - -Revision1.1.1.12004/04/1512:06:52reddawg -UbixOSv1.0 - -Revision1.272004/04/1316:36:34reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - - -END -***/ +************************************************************************/ + +/*TODO:Thiscanbegreatlyimprovedforperformancebutitgetsthejobdone*/ +voidvmm_freeProcessPages(pidTypepid){ +inti=0,x=0; +uint32_t*tmpPageTable=0x0; +uint32_t*tmpPageDir=(uInt32*)PD_BASE_ADDR; + +spinLock(&vmmSpinLock); + +/*CheckPageDirectoryForAnAvailPageTable*/ +//NOTE:Thiscleansallmemoryspaceuptokernelspace +#ifdef_IGNORE +for(i=0;i<(PAGE_SIZE-(PAGE_SIZE/4));i++){ + +if(tmpPageDir[i]!=0){ + +/*SetUpPageTablePointer*/ +tmpPageTable=(uint32_t*)(PT_BASE_ADDR+(i*PAGE_SIZE)); + +/*CheckThePageTableForCOWPages*/ +for(x=0;x<PD_ENTRIES;x++){ + +/*IfThePageIsCOWAdjustCOWCounter*/ +if(((uint32_t)tmpPageTable[x]&PAGE_COW)==PAGE_COW){ +adjustCowCounter(((uint32_t)tmpPageTable[x]&0xFFFFF000),-1); +} +} +} +} +#endif + +/*LoopThroughPagesToFindPagesOwnedByProcess*/ +for(i=0;i<numPages;i++){ +if(vmmMemoryMap[i].pid==pid){ +/*CheckToSeeIfThecowCounterIsZeroIfSoWeCanReeIt*/ +if(vmmMemoryMap[i].cowCounter==0){ +vmmMemoryMap[i].status=memAvail; +vmmMemoryMap[i].cowCounter=0x0; +vmmMemoryMap[i].pid=vmmID; +freePages++; +systemVitals->freePages=freePages; +} +else{ +spinUnlock(&vmmSpinLock); +adjustCowCounter((i*PAGE_SIZE),-1); +spinLock(&vmmSpinLock); +} +} +} + +/*Return*/ +spinUnlock(&vmmSpinLock); +return; +} - + diff --git a/doc/xml/vsprintf_8c.xml b/doc/xml/vsprintf_8c.xml index d180179..1f55619 100644 --- a/doc/xml/vsprintf_8c.xml +++ b/doc/xml/vsprintf_8c.xml @@ -1,41 +1,87 @@ - - - + + + vsprintf.c stdarg.h - lib/string.h + string.h - + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - + + + + + + + - + do_div n base @@ -49,10 +95,9 @@ - - number + - + is_digit c ((c) >= '0' && (c) <= '9') @@ -62,104 +107,88 @@ - - skip_atoi - vsprintf + - + LEFT - 16 + 16 /* left justified */ - - number - vsprintf + - + PLUS - 4 + 4 /* show plus */ - - number - vsprintf + - + SIGN - 2 + 2 /* unsigned/signed long */ - - number - vsprintf + - + SMALL - 64 + 64 /* use 'abcdef' instead of 'ABCDEF' */ - - number - vsprintf + - + SPACE - 8 + 8 /* space if plus */ - - number - vsprintf + - + SPECIAL - 32 + 32 /* 0x */ - - number - vsprintf + - + ZEROPAD - 1 + 1 /* pad with zero */ - - number - vsprintf + - + char * static char* number (char *str, int num, int base, int size, int precision, int type) @@ -194,24 +223,15 @@ - - do_div - LEFT - PLUS - SIGN - SMALL - SPACE - SPECIAL - ZEROPAD - vsprintf + - + int static int skip_atoi (const char **s) skip_atoi - const char ** + const char ** s @@ -220,25 +240,23 @@ - - is_digit - vsprintf + - + int int vsprintf - (char *buf, const char *fmt, vaList args) + (char *buf, const char *fmt, va_list args) vsprintf char * buf - const char * + const char * fmt - vaList + va_list args @@ -247,22 +265,14 @@ - - is_digit - LEFT - number - PLUS - SIGN - skip_atoi - SMALL - SPACE - SPECIAL - strlen - vaArg - ZEROPAD - kpanic - kprintf - sprintf + + is_digit + LEFT + PLUS + SPACE + SPECIAL + ZEROPAD + kpanic @@ -270,295 +280,280 @@ -/***************************************************************************************** -Copyright(c)2002TheUbixOSProject -Allrightsreserved. - -Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are -permittedprovidedthatthefollowingconditionsaremet: - -Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof -conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary -formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing -disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided -withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits -contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware -withoutspecificpriorwrittenpermission. - -THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY -EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF -MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL -THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL, -SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT -OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION) -HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR -TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS -SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. - -$Log: vsprintf_8c.xml,v $ -Revision 1.6 2006/12/19 14:12:54 reddawg -rtld-elf almost workign - -Revision1.1.1.12006/06/0112:46:16reddawg -ubix2 - -Revision1.22005/10/1200:13:37reddawg -Removed - -Revision1.1.1.12005/09/2617:24:14reddawg -nomessage - -Revision1.22004/06/2823:12:58reddawg -fileformatnowcontainer:/path/to/file - -Revision1.1.1.12004/04/1512:07:11reddawg -UbixOSv1.0 - -Revision1.32004/04/1316:36:33reddawg -Changedourcopyright,itisallnowunderaBSD-Stylelicense - - - -$Id: vsprintf_8c.xml 88 2016-01-12 00:11:29Z reddawg $ - -*****************************************************************************************/ - -/*vsprintf.c--LarsWirzenius&LinusTorvalds.*/ -/* -*Wirzeniuswrotethisportably,Torvaldsfuckeditup:-) -*/ +/*- +*Copyright(c)2002-2018TheUbixOSProject. +*Allrightsreserved. +* +*ThiswasdevelopedbyChristopherW.OlsenfortheUbixOSProject. +* +*Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermitted +*providedthatthefollowingconditionsaremet: +* +*1)Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthors. +*2)Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistof +*conditions,thefollowingdisclaimerandthelistofauthorsinthedocumentationand/or +*othermaterialsprovidedwiththedistribution. +*3)NeitherthenameoftheUbixOSProjectnorthenamesofitscontributorsmaybeusedto +*endorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwritten +*permission. +* +*THISSOFTWAREISPROVIDEDBYTHEAUTHORANDCONTRIBUTORS"ASIS"ANDANYEXPRESSORIMPLIED +*WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESS +*FORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALLTHECOPYRIGHTOWNERORCONTRIBUTORS +*BELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES +*(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA, +*ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERIN +*CONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUT +*OFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE. +*/ + +/*vsprintf.c--LarsWirzenius&LinusTorvalds.*/ +/* +*Wirzeniuswrotethisportably,Torvaldsfuckeditup:-) +*/ + +#include<stdarg.h> +#include<string.h> + +/*weusethissothatwecandowithoutthectypelibrary*/ +#defineis_digit(c)((c)>='0'&&(c)<='9') + +staticintskip_atoi(constchar**s){ +inti=0; + +while(is_digit(**s)) +i=i*10+*((*s)++)-'0'; +returni; +} + +#defineZEROPAD1/*padwithzero*/ +#defineSIGN2/*unsigned/signedlong*/ +#definePLUS4/*showplus*/ +#defineSPACE8/*spaceifplus*/ +#defineLEFT16/*leftjustified*/ +#defineSPECIAL32/*0x*/ +#defineSMALL64/*use'abcdef'insteadof'ABCDEF'*/ -#include<stdarg.h> -#include<lib/string.h> - -/*weusethissothatwecandowithoutthectypelibrary*/ -#defineis_digit(c)((c)>='0'&&(c)<='9') - -staticintskip_atoi(constchar**s) -{ -inti=0; +#definedo_div(n,base)({\ +int__res;\ +__asm__("divl%4":"=a"(n),"=d"(__res):"0"(n),"1"(0),"r"(base));\ +__res;}) + +staticchar*number(char*str,intnum,intbase,intsize,intprecision,inttype){ +charc,sign,tmp[36]; +constchar*digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +inti; -while(is_digit(**s)) -i=i*10+*((*s)++)-'0'; -returni; -} - -#defineZEROPAD1/*padwithzero*/ -#defineSIGN2/*unsigned/signedlong*/ -#definePLUS4/*showplus*/ -#defineSPACE8/*spaceifplus*/ -#defineLEFT16/*leftjustified*/ -#defineSPECIAL32/*0x*/ -#defineSMALL64/*use'abcdef'insteadof'ABCDEF'*/ - -#definedo_div(n,base)({\ -int__res;\ -__asm__("divl%4":"=a"(n),"=d"(__res):"0"(n),"1"(0),"r"(base));\ -__res;}) - -staticchar*number(char*str,intnum,intbase,intsize,intprecision -,inttype) -{ -charc,sign,tmp[36]; -constchar*digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -inti; - -if(type&SMALL)digits="0123456789abcdefghijklmnopqrstuvwxyz"; -if(type&LEFT)type&=~ZEROPAD; -if(base<2||base>36) -return0; -c=(type&ZEROPAD)?'0':''; -if(type&SIGN&&num<0){ -sign='-'; -num=-num; -}else -sign=(type&PLUS)?'+':((type&SPACE)?'':0); -if(sign)size--; -if(type&SPECIAL){ -if(base==16){size-=2;} -elseif(base==8){size--;} -} -i=0; -if(num==0) -tmp[i++]='0'; -elsewhile(num!=0) -tmp[i++]=digits[do_div(num,base)]; -if(i>precision)precision=i; -size-=precision; -if(!(type&(ZEROPAD+LEFT))) -while(size-->0) -*str++=''; -if(sign) -*str++=sign; -if(type&SPECIAL){ -if(base==8){ -*str++='0'; -} -elseif(base==16){ -*str++='0'; -*str++=digits[33]; -} -} -if(!(type&LEFT)) -while(size-->0) -*str++=c; -while(i<precision--) -*str++='0'; -while(i-->0) -*str++=tmp[i]; -while(size-->0) -*str++=''; -returnstr; -} - -intvsprintf(char*buf,constchar*fmt,vaListargs) -{ -intlen; -inti; -char*str; -char*s; -int*ip; - -intflags;/*flagstonumber()*/ - -intfield_width;/*widthofoutputfield*/ -intprecision;/*min.#ofdigitsforintegers;max -numberofcharsforfromstring*/ -intqualifier;/*'h','l',or'L'forintegerfields*/ - -for(str=buf;*fmt;++fmt){ -if(*fmt!='%'){ -*str++=*fmt; -continue; -} - -/*processflags*/ -flags=0; -repeat: -++fmt;/*thisalsoskipsfirst'%'*/ -switch(*fmt){ -case'-':flags|=LEFT;gotorepeat; -case'+':flags|=PLUS;gotorepeat; -case'':flags|=SPACE;gotorepeat; -case'#':flags|=SPECIAL;gotorepeat; -case'0':flags|=ZEROPAD;gotorepeat; -} - -/*getfieldwidth*/ -field_width=-1; -if(is_digit(*fmt)) -field_width=skip_atoi(&fmt); -elseif(*fmt=='*'){ -/*it'sthenextargument*/ -field_width=vaArg(args,int); -if(field_width<0){ -field_width=-field_width; -flags|=LEFT; -} -} - -/*gettheprecision*/ -precision=-1; -if(*fmt=='.'){ -++fmt; -if(is_digit(*fmt)) -precision=skip_atoi(&fmt); -elseif(*fmt=='*'){ -/*it'sthenextargument*/ -precision=vaArg(args,int); -} -if(precision<0) -precision=0; -} +if(type&SMALL) +digits="0123456789abcdefghijklmnopqrstuvwxyz"; +if(type&LEFT) +type&=~ZEROPAD; +if(base<2||base>36) +return0; +c=(type&ZEROPAD)?'0':''; +if((type&SIGN)&&num<0){ +sign='-'; +num=-num; +} +else +sign=(type&PLUS)?'+':((type&SPACE)?'':0); +if(sign) +size--; +if(type&SPECIAL){ +if(base==16){ +size-=2; +} +elseif(base==8){ +size--; +} +} +i=0; +if(num==0) +tmp[i++]='0'; +else +while(num!=0) +tmp[i++]=digits[do_div(num,base)]; +if(i>precision) +precision=i; +size-=precision; +if(!(type&(ZEROPAD+LEFT))) +while(size-->0) +*str++=''; +if(sign) +*str++=sign; +if(type&SPECIAL){ +if(base==8){ +*str++='0'; +} +elseif(base==16){ +*str++='0'; +*str++=digits[33]; +} +} +if(!(type&LEFT)) +while(size-->0) +*str++=c; +while(i<precision--) +*str++='0'; +while(i-->0) +*str++=tmp[i]; +while(size-->0) +*str++=''; +returnstr; +} + +intvsprintf(char*buf,constchar*fmt,va_listargs){ +intlen; +inti; +char*str; +char*s; +int*ip; + +intflags;/*flagstonumber()*/ + +intfield_width;/*widthofoutputfield*/ +intprecision;/*min.#ofdigitsforintegers;max +numberofcharsforfromstring*/ +intqualifier;/*'h','l',or'L'forintegerfields*/ + +for(str=buf;*fmt;++fmt){ +if(*fmt!='%'){ +*str++=*fmt; +continue; +} + +/*processflags*/ +flags=0; +repeat:++fmt;/*thisalsoskipsfirst'%'*/ +switch(*fmt){ +case'-': +flags|=LEFT; +gotorepeat; +case'+': +flags|=PLUS; +gotorepeat; +case'': +flags|=SPACE; +gotorepeat; +case'#': +flags|=SPECIAL; +gotorepeat; +case'0': +flags|=ZEROPAD; +gotorepeat; +} + +/*getfieldwidth*/ +field_width=-1; +if(is_digit(*fmt)) +field_width=skip_atoi(&fmt); +elseif(*fmt=='*'){ +/*it'sthenextargument*/ +field_width=va_arg(args,int); +if(field_width<0){ +field_width=-field_width; +flags|=LEFT; +} +} + +/*gettheprecision*/ +precision=-1; +if(*fmt=='.'){ +++fmt; +if(is_digit(*fmt)) +precision=skip_atoi(&fmt); +elseif(*fmt=='*'){ +/*it'sthenextargument*/ +precision=va_arg(args,int); +} +if(precision<0) +precision=0; +} + +/*gettheconversionqualifier*/ +qualifier=-1; +if(*fmt=='h'||*fmt=='l'||*fmt=='L'){ +qualifier=*fmt; +++fmt; +} -/*gettheconversionqualifier*/ -qualifier=-1; -if(*fmt=='h'||*fmt=='l'||*fmt=='L'){ -qualifier=*fmt; -++fmt; -} - -switch(*fmt){ -case'c': -if(!(flags&LEFT)) -while(--field_width>0) -*str++=''; -*str++=(unsignedchar)vaArg(args,int); -while(--field_width>0) -*str++=''; -break; - -case's': -s=vaArg(args,char*); -len=strlen(s); -if(precision<0) -precision=len; -elseif(len>precision) -len=precision; - -if(!(flags&LEFT)) -while(len<field_width--) -*str++=''; -for(i=0;i<len;++i) -*str++=*s++; -while(len<field_width--) -*str++=''; -break; - -case'o': -str=number(str,vaArg(args,unsignedlong),8, -field_width,precision,flags); -break; +switch(*fmt){ +case'c': +if(!(flags&LEFT)) +while(--field_width>0) +*str++=''; +*str++=(unsignedchar)va_arg(args,int); +while(--field_width>0) +*str++=''; +break; + +case's': +s=va_arg(args,char*); +len=strlen(s); +if(precision<0) +precision=len; +elseif(len>precision) +len=precision; + +if(!(flags&LEFT)) +while(len<field_width--) +*str++=''; +for(i=0;i<len;++i) +*str++=*s++; +while(len<field_width--) +*str++=''; +break; + +case'o': +str=number(str,va_arg(args,unsignedlong),8,field_width,precision,flags); +break; + +case'p': +if(field_width==-1){ +field_width=8; +flags|=ZEROPAD; +} +str=number(str,(unsignedlong)va_arg(args,void*),16,field_width,precision,flags); +break; -case'p': -if(field_width==-1){ -field_width=8; -flags|=ZEROPAD; -} -str=number(str, -(unsignedlong)vaArg(args,void*),16, -field_width,precision,flags); -break; - -case'x': -flags|=SMALL; -case'X': -str=number(str,vaArg(args,unsignedlong),16, -field_width,precision,flags); -break; - -case'd': -case'i': -flags|=SIGN; -case'u': -str=number(str,vaArg(args,unsignedlong),10, -field_width,precision,flags); -break; - -case'n': -ip=vaArg(args,int*); -*ip=(str-buf); -break; - -default: -if(*fmt!='%') -*str++='%'; -if(*fmt) -*str++=*fmt; -else ---fmt; -break; -} -} -*str='\0'; -returnstr-buf; -} - -/*** -END -***/ - +case'x': +flags|=SMALL; +case'X': +str=number(str,va_arg(args,unsignedlong),16,field_width,precision,flags); +break; + +case'd': +case'i': +flags|=SIGN; +case'u': +str=number(str,va_arg(args,unsignedlong),10,field_width,precision,flags); +break; + +case'n': +ip=va_arg(args,int*); +*ip=(str-buf); +break; + +default: +if(*fmt!='%') +*str++='%'; +if(*fmt) +*str++=*fmt; +else +--fmt; +break; +} +} +*str='\0'; +returnstr-buf; +} + +/*** +END +***/ + - + diff --git a/sys/kernel/descrip.c b/sys/kernel/descrip.c index 403c43d..4b8892f 100644 --- a/sys/kernel/descrip.c +++ b/sys/kernel/descrip.c @@ -27,6 +27,7 @@ */ #include + #include #include #include @@ -66,7 +67,7 @@ //td->o_files[uap->fd] = 0; - if (!fdestroy(td, fp, uap->fd)) + if (fdestroy(td, fp, uap->fd) != 0x0) kprintf("[%s:%i] fdestroy(0x%X, 0x%X) failed\n", __FILE__, __LINE__, fp, td->o_files[uap->fd]); kprintf("FCNTL: %i, %i, 0x%X.", i, uap->fd, fp); @@ -93,7 +94,6 @@ return (fcntl(td, uap)); } - int falloc(struct thread *td, struct file **resultfp, int *resultfd) { struct file *fp = 0x0; @@ -125,6 +125,25 @@ #include +/** + * \brief This destroys a thread local file descriptor. + * + * \details This function will destroy the thread local file file specified as fd, + * for sanity it requires the file descriptor id and memory address to check before destroying. + * + * \note This text shall only show you, how such a \"note\" section + * is looking. There is nothing which really needs your notice, + * so you do not really need to read this section. + * + * \param[in] td Pointer to thread which initiated the syscall. + * \param[in] fp Pointer to the thread local file which you want to destroy. + * \param[in] fd File descriptor id that points to the thread local file which you want to destroy. + * + * \return The error return code of the function. + * + * \retval 0 The function is successfully executed + * \retval -1 An error occurred + */ int fdestroy(struct thread *td, struct file *fp, int fd) { int error = 0; @@ -337,7 +356,8 @@ else if (td->o_files[to] != 0x0) { fclose(((struct file*) td->o_files[to])->fd); - fdestroy(td, (struct file*) td->o_files[to], to); + if (fdestroy(td, (struct file*) td->o_files[to], to) != 0x0) + kprintf("[%s:%i] Error with fdestroy!", __FILE__, __LINE__); } fp = (struct file*) td->o_files[from]; diff --git a/sys/kernel/vfs_calls.c b/sys/kernel/vfs_calls.c index 9cde232..b991b27 100644 --- a/sys/kernel/vfs_calls.c +++ b/sys/kernel/vfs_calls.c @@ -65,7 +65,8 @@ nfp->fd = fopen(args->path, "r"); if (nfp->fd == 0x0) { - fdestroy(td, nfp, fd); + if (fdestroy(td, nfp, fd) != 0x0) + kprintf("[%s:%i] fdestroy() failed.", __FILE__, __LINE__); td->td_retval[0] = -1; error = -1; @@ -118,13 +119,15 @@ pFD = fd->data; if (args->fd == pFD->rFD) { if (pFD->rfdCNT < 2) - fdestroy(td, fd, args->fd); + if (fdestroy(td, fd, args->fd) != 0x0) + kprintf("[%s:%i] fdestroy() failed.", __FILE__, __LINE__); pFD->rfdCNT--; } if (args->fd == pFD->wFD) { if (pFD->wfdCNT < 2) - fdestroy(td, fd, args->fd); + if (fdestroy(td, fd, args->fd) != 0x0) + kprintf("[%s:%i] fdestroy() failed.", __FILE__, __LINE__); pFD->wfdCNT--; } @@ -137,7 +140,7 @@ td->td_retval[0] = -1; kprintf("DESTROY: %i!", args->fd); - if (!fdestroy(td, fd, args->fd)) + if (fdestroy(td, fd, args->fd) != 0x0) kprintf("[%s:%i] fdestroy(0x%X, 0x%X) failed\n", __FILE__, __LINE__, fd, td->o_files[args->fd]); td->td_retval[0] = 0; @@ -431,7 +434,8 @@ nfp->fd = fopen(path, "rwb"); if (nfp->fd == 0x0) { - fdestroy(thr, nfp, fd); + if (fdestroy(thr, nfp, fd) != 0x0) + kprintf("[%s:%i] fdestroy() failed.", __FILE__, __LINE__); thr->td_retval[0] = -1; diff --git a/sys/net/net/sys_arch.c b/sys/net/net/sys_arch.c index 254c2fb..035bd2b 100644 --- a/sys/net/net/sys_arch.c +++ b/sys/net/net/sys_arch.c @@ -82,7 +82,6 @@ } #endif - } /* Signal semaphore */ @@ -162,7 +161,7 @@ struct sys_mbox *mbox = 0x0; LWIP_UNUSED_ARG(size); - mbox = (struct sys_mbox *) kmalloc(sizeof(struct sys_mbox)); + mbox = (struct sys_mbox*) kmalloc(sizeof(struct sys_mbox)); if (mbox == NULL) return (ERR_MEM); @@ -195,14 +194,14 @@ if ((mb != NULL) && (*mb != SYS_MBOX_NULL)) { struct sys_mbox *mbox = *mb; sys_arch_sem_wait(&mbox->lock, 0); -/* - sys_sem_free_internal(mbox->full); - sys_sem_free_internal(mbox->empty); - sys_sem_free_internal(mbox->lock); -*/ - sem_destroy(mbox->full); - sem_destroy(mbox->empty); - sem_destroy(mbox->lock); + /* + sys_sem_free_internal(mbox->full); + sys_sem_free_internal(mbox->empty); + sys_sem_free_internal(mbox->lock); + */ + sem_destroy(mbox->full); + sem_destroy(mbox->empty); + sem_destroy(mbox->lock); mbox->full = mbox->empty = mbox->lock = NULL; kfree(mbox); @@ -257,7 +256,7 @@ sys_arch_sem_wait(&mbox->lock, 0); LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_trypost: mbox %p msg %p\n", - (void *)mbox, (void *)msg)); + (void *)mbox, (void *)msg)); if ((mbox->tail + 1) >= (mbox->head + SYS_MBOX_SIZE)) { sys_sem_signal(&mbox->lock); @@ -367,9 +366,9 @@ int sys_mbox_valid(struct sys_mbox **mb) { struct sys_mbox *mbox = *mb; if (mbox == NULL) - return(0); + return (0); else - return(1); + return (1); } void sys_mbox_set_invalid(struct sys_mbox **mb) { @@ -401,7 +400,7 @@ thread_param->arg = arg; thread_param->thread = thread; */ - if (ubthread_create(&new_thread->ubthread, 0x0, (void *) (thread), arg) != 0x0) { + if (ubthread_create(&new_thread->ubthread, 0x0, (void*) (thread), arg) != 0x0) { kpanic("sys_thread_new: ubthread_create"); } return (new_thread); @@ -411,7 +410,7 @@ struct thread_start_param { struct sys_thread *thread; - void (*function)(void *); + void (*function)(void*); void *arg; }; @@ -454,7 +453,7 @@ } } -static struct sys_thread *current_thread(void) { +static struct sys_thread* current_thread(void) { struct sys_thread *st; kTask_t *pt; pt = ubthread_self(); @@ -474,7 +473,7 @@ return (0x0); } -struct sys_timeouts *sys_arch_timeouts(void) { +struct sys_timeouts* sys_arch_timeouts(void) { struct sys_thread *thread; thread = current_thread(); return (&thread->timeouts); @@ -498,7 +497,6 @@ return (sys_unix_now()); } - int sys_socket(struct thread *td, struct sys_socket_args *args) { int error = 0x0; int fd = 0x0; @@ -513,14 +511,15 @@ nfp->fd_type = 2; kprintf("socket(%i:%i): 0x%X:0x%X:0x%X", nfp->socket, fd, args->domain, args->type, args->protocol); - if (nfp->fd == 0x0 && nfp->socket) { - fdestroy(td, nfp, fd); + if (nfp->fd == 0x0 && nfp->socket) { + if (fdestroy(td, nfp, fd) != 0x0) + kprintf("[%s:%i] fdestroy() failed.", __FILE__, __LINE__); td->td_retval[0] = -1; error = -1; } else { - td->td_retval[0] = fd;//nfp->fd; //MrOlsen 2018index; + td->td_retval[0] = fd; //nfp->fd; //MrOlsen 2018index; } return (error); @@ -534,7 +533,7 @@ kprintf("SSO: %i:%i:%i", args->s, fd->socket, td->td_retval[0]); td->td_retval[0] = 0; - return(0); + return (0); } int sys_sendto(struct thread *td, struct sys_sendto_args *args) { @@ -543,6 +542,6 @@ lwip_sendto(fd->socket, args->buf, args->len, args->flags, args->to, args->tolen); td->td_retval[0] = 0x0; - + return (0); }