00001 // See the end of this file for license information. 00002 00003 #ifndef TORSION_SEGMENT_H 00004 #define TORSION_SEGMENT_H 00005 00006 #include "addrmap.h" 00007 00010 00022 class Segment_map : public Address_map { 00023 public: 00025 void 00026 set_pages_count(unsigned int segment, unsigned int pages_count); 00027 00029 unsigned int 00030 get_pages_count(unsigned int segment); 00031 00034 void 00035 set_next_free_segment(unsigned int segment, unsigned int next_free_segment); 00036 00038 unsigned int 00039 get_next_free_segment(unsigned int segment); 00040 00042 bool 00043 is_segment_free(unsigned int segment); 00044 }; 00045 00048 00049 class Segment_header { 00050 protected: 00051 void** page_addresses; 00052 00053 public: 00057 inline void* 00058 get_page_address(unsigned int page_index) { 00059 return page_addresses[page_index]; 00060 } 00061 00063 inline void 00064 set_page_address(unsigned int page_index, void* page_address) { 00065 page_addresses[page_index] = page_address; 00066 } 00067 }; 00068 00070 00078 class Segment { 00079 public: 00080 Segment_header* header; 00081 void* buffer; 00082 unsigned int first_block; 00083 unsigned int curr_page_block; 00084 unsigned int pages_count; 00085 unsigned int index; 00086 }; 00087 00088 #endif 00089 00090 /* Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman 00091 * 00092 * This program is free software; you can redistribute it and/or modify it 00093 * under the terms of the GNU General Public License as published by the 00094 * Free Software Foundation; either version 2 of the License, or (at your 00095 * option) any later version. 00096 * 00097 * This program is distributed in the hope that it will be useful, but 00098 * WITHOUT ANY WARRANTY; without even the implied warranty of 00099 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00100 * General Public License for more details (in the COPYING file). 00101 * 00102 * You should have received a copy of the GNU General Public License along 00103 * with this program; if not, write to the Free Software Foundation, Inc., 00104 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00105 */
Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman