Changeset ,94
- Timestamp:
- 10/26/2008 09:38:29 AM (2 months ago)
- branch-nick:
- bzr
- Files:
-
- coding_style.txt (added)
- apply_boilerplate.rb (modified) (3 diffs)
- vesper/src/ELF.h (modified) (1 diff)
- vesper/src/ElfParser.cpp (modified) (6 diffs)
- vesper/src/ElfParser.h (modified) (2 diffs)
- vesper/src/Globals.cpp (modified) (4 diffs)
- vesper/src/Globals.h (modified) (2 diffs)
- vesper/src/Kernel.cpp (modified) (6 diffs)
- vesper/src/Kernel.h (modified) (1 diff)
- vesper/src/arch/x86/MemoryManager-arch.h (modified) (4 diffs)
- vesper/src/boot/Multiboot.cpp (modified) (1 diff)
- vesper/src/boot/Multiboot.h (modified) (1 diff)
- vesper/src/boot/loader.s (modified) (2 diffs)
- vesper/src/lib/Atomic.h (modified) (1 diff)
- vesper/src/lib/BitArray.h (modified) (1 diff)
- vesper/src/lib/DefaultConsole.cpp (modified) (1 diff)
- vesper/src/lib/DefaultConsole.h (modified) (1 diff)
- vesper/src/lib/Lockable.h (modified) (3 diffs)
- vesper/src/lib/Macros.h (modified) (2 diffs)
- vesper/src/lib/OrderedArray.h (modified) (1 diff)
- vesper/src/lib/Registers.h (modified) (2 diffs)
- vesper/src/lib/Registers.s (modified) (3 diffs)
- vesper/src/lib/Types.h (modified) (2 diffs)
- vesper/src/lib/asm-x86-div64.h (modified) (1 diff)
- vesper/src/lib/common.h (modified) (2 diffs)
- vesper/src/lib/ctype.c (modified) (1 diff)
- vesper/src/lib/ctype.h (modified) (1 diff)
- vesper/src/lib/g++support.cpp (modified) (1 diff)
- vesper/src/lib/ia32.h (modified) (1 diff)
- vesper/src/lib/string.c (modified) (2 diffs)
- vesper/src/lib/string.h (modified) (2 diffs)
- vesper/src/lib/vsprintf.c (modified) (1 diff)
- vesper/src/lib/x86.h (modified) (3 diffs)
- vesper/src/memory/Heap.cpp (modified) (6 diffs)
- vesper/src/memory/Heap.h (modified) (1 diff)
- vesper/src/memory/MemoryManager.cpp (modified) (4 diffs)
- vesper/src/memory/MemoryManager.h (modified) (1 diff)
- vesper/src/pd/InterruptDescriptorTable.cpp (modified) (1 diff)
- vesper/src/pd/InterruptDescriptorTable.h (modified) (2 diffs)
- vesper/src/pd/activate.s (modified) (2 diffs)
- vesper/src/pd/gdt.cpp (modified) (2 diffs)
- vesper/src/pd/gdt.h (modified) (1 diff)
- vesper/src/pd/process.s (modified) (2 diffs)
- vesper/src/schedule/CriticalSection.cpp (modified) (2 diffs)
- vesper/src/schedule/InterruptServiceRoutine.cpp (modified) (5 diffs)
- vesper/src/schedule/InterruptServiceRoutine.h (modified) (2 diffs)
- vesper/src/schedule/PageFaultHandler.cpp (modified) (3 diffs)
- vesper/src/schedule/PageFaultHandler.h (modified) (2 diffs)
- vesper/src/schedule/Task.cpp (modified) (9 diffs)
- vesper/src/schedule/Task.h (modified) (1 diff)
- vesper/src/schedule/Timer.cpp (modified) (3 diffs)
- vesper/src/schedule/Timer.h (modified) (1 diff)
- vesper/src/schedule/interrupt.s (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
apply_boilerplate.rb
r93 r94 5 5 # Distributed under the Boost Software License, Version 1.0. 6 6 # (See file LICENSE_1_0.txt or a copy at http:#www.boost.org/LICENSE_1_0.txt) 7 # 7 8 # 8 9 # Apply license and modeline changes to text source files. … … 19 20 '.rb'=>[license.gsub("//","#"), modelines.gsub("//","#")] 20 21 } 22 23 ok_count = 0 24 modified_count = 0 21 25 22 26 Find.find('./') do |f| … … 44 48 end 45 49 puts "#{f} updated" 50 modified_count += 1 46 51 else 47 52 puts "#{f} is ok" 53 ok_count += 1 48 54 end 49 55 end 50 56 end 51 57 58 puts "#{modified_count} files changed, #{ok_count} files ok." 59 52 60 # kate: indent-width 4; replace-tabs on; 53 61 # vi:set ts=4:set expandtab=on: vesper/src/ELF.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /* 8 8 * ELF file format structures definitions 9 * According to Portable Formats Specification, version 1.1 (FIXME: update to 1.2) 9 * According to Portable Formats Specification, version 1.1 10 * (FIXME: update to 1.2) 10 11 * 11 12 * Typed in by Stanislav Karchebny <berkus+os@madfire.net>, 2001 vesper/src/ElfParser.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #include "Kernel.h" … … 9 9 #include "DefaultConsole.h" 10 10 11 ElfParser::ElfParser()11 elf_parser::elf_parser() 12 12 { 13 13 header = NULL; … … 19 19 } 20 20 21 ElfParser::~ElfParser()21 elf_parser::~elf_parser() 22 22 { 23 23 delete header; … … 26 26 } 27 27 28 void ElfParser::loadKernel(Elf32SectionHeader *symtab, Elf32SectionHeader *strtab) 28 void elf_parser::loadKernel(Elf32SectionHeader* symtab, 29 Elf32SectionHeader* strtab) 29 30 { 30 31 symbolTable = symtab; … … 32 33 } 33 34 34 char* ElfParser::findSymbol(address_t addr, address_t *symbolStart)35 char* elf_parser::findSymbol(address_t addr, address_t *symbolStart) 35 36 { 36 37 address_t max = 0; … … 76 77 return NULL; 77 78 } 79 78 80 // kate: indent-width 4; replace-tabs on; 79 81 // vi:set ts=4:set expandtab=on: vesper/src/ElfParser.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 11 11 12 12 /** 13 * Parses an ELF file, generating symbolic information and loading code/data segments. 13 * Parses an ELF file, generating symbolic information and loading code/data 14 * segments. 14 15 */ 15 class ElfParser16 class elf_parser 16 17 { 17 public:18 /**19 *Creates a blank ELF parser, preparing for a call to loadKernel.20 */21 ElfParser();18 public: 19 /** 20 * Creates a blank ELF parser, preparing for a call to loadKernel. 21 */ 22 elf_parser(); 22 23 23 /** 24 * Creates the ELF parser based on a file. 25 */ 26 ElfParser(char *fname); 24 /** 25 * Creates the ELF parser based on a file. 26 */ 27 elf_parser(const char *fname); 28 ~elf_parser(); 27 29 28 ~ElfParser(); 30 /** 31 * Duplicates (this), performing a deep copy. 32 */ 33 elf_parser *clone(); 29 34 30 /**31 * Duplicates (this), performing a deep copy.32 */33 ElfParser *clone();35 /** 36 * Writes all section information to the virtual memory image. 37 */ 38 void writeAllSections(); 34 39 35 /**36 Writes all section information to the virtual memory image.37 **/38 void writeAllSections();40 /** 41 * Returns the address of the last byte to be loaded in. 42 */ 43 address_t getLastAddress(); 39 44 40 /**41 Returns the address of the last byte to be loaded in.42 **/43 address_t getLastAddress();45 /** 46 * Loads the symbol table for the kernel from the specified location. 47 */ 48 void loadKernel(Elf32SectionHeader *symtab, Elf32SectionHeader *strtab); 44 49 45 /** 46 Loads the symbol table for the kernel from the specified location. 47 **/ 48 void loadKernel(Elf32SectionHeader *symtab, Elf32SectionHeader *strtab); 50 /** 51 * Returns the symbol name for an address. Also returns the start address 52 * of that symbol in startAddr if startAddr != NULL. 53 */ 54 char* findSymbol(address_t addr, address_t *symbolStart = NULL); 49 55 50 /** 51 Returns the symbol name for an address. Also returns the start address 52 of that symbol in startAddr if startAddr != NULL. 53 **/ 54 char* findSymbol(address_t addr, address_t *symbolStart = NULL); 56 /** 57 * Returns the address of a symbol with name str. 58 * NOTE: This is much slower than it should be. This should be implemented 59 * using the hashtable sections in ELF. 60 */ 61 address_t findSymbol(char* str); 55 62 56 /** 57 Returns the address of a symbol with name str. 58 NOTE: This is much slower than it should be. This should be implemented 59 using the hashtable sections in ELF. 60 **/ 61 address_t findSymbol(char* str); 63 /** 64 * Returns the address of the symbol with offset o in the 65 * relocation symbol table. 66 */ 67 address_t findDynamicSymbolLocation(address_t o); 62 68 63 /**64 Returns the address of the symbol with offset o in the65 relocation symbol table.66 **/67 address_t findDynamicSymbolLocation(address_t o);69 /** 70 * Returns a NULL terminated string specifying the name of 71 * the symbol at offset o in the relocation symbol table. 72 */ 73 char *findDynamicSymbolName(address_t o); 68 74 69 /** 70 Returns a NULL terminated string specifying the name of 71 the symbol at offset o in the relocation symbol table. 72 **/ 73 char *findDynamicSymbolName(address_t o); 75 /** 76 * Gets the address of the global offset table. 77 */ 78 address_t getGlobalOffsetTable(); 74 79 75 /** 76 Gets the address of the global offset table. 77 **/ 78 address_t getGlobalOffsetTable(); 80 /** 81 * Returns the entry point of the executable. 82 */ 83 address_t getEntryPoint() 84 { 85 return (address_t)header->e_entry; 86 } 79 87 80 /**81 Returns the entry point of the executable.82 **/83 address_t getEntryPoint()84 {85 return (address_t)header->e_entry;86 }88 /** 89 * Returns true if the parser loaded correctly. 90 */ 91 bool isValid() 92 { 93 return (filename!=0); 94 } 87 95 88 /** 89 Returns true if the parser loaded correctly. 90 **/ 91 bool isValid() 92 { 93 return (filename!=0); 94 } 95 96 private: 97 Elf32Header *header; 98 Elf32SectionHeader *symbolTable; 99 Elf32SectionHeader *stringTable; 100 Elf32SectionHeader *gotTable; // Global offset table. 101 Elf32SectionHeader *relTable; 102 Elf32SectionHeader *sectionHeaders; 103 public: 104 char *filename; 96 private: 97 Elf32Header *header; 98 Elf32SectionHeader *symbolTable; 99 Elf32SectionHeader *stringTable; 100 Elf32SectionHeader *gotTable; // Global offset table. 101 Elf32SectionHeader *relTable; 102 Elf32SectionHeader *sectionHeaders; 103 const char *filename; 105 104 }; 106 105 vesper/src/Globals.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #include "Globals.h" … … 17 17 class kernel kernel; 18 18 multiboot_t multiboot; 19 ElfParser kernelElfParser;19 elf_parser kernelElfParser; 20 20 MemoryManager memoryManager; 21 21 InterruptDescriptorTable interruptsTable; … … 109 109 void panic(const char *message, const char *file, uint32_t line) 110 110 { 111 disable Interrupts();111 disable_interrupts(); 112 112 113 113 kconsole.set_attr(RED, YELLOW); … … 122 122 void panic_assert(const char *desc, const char *file, uint32_t line) 123 123 { 124 disable Interrupts();124 disable_interrupts(); 125 125 126 126 kconsole.set_attr(WHITE, RED); vesper/src/Globals.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 13 13 extern class kernel kernel; 14 14 extern class multiboot_t multiboot; 15 extern class ElfParser kernelElfParser;15 extern class elf_parser kernelElfParser; 16 16 extern class MemoryManager memoryManager; 17 17 extern class InterruptDescriptorTable interruptsTable; vesper/src/Kernel.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #include "Kernel.h" … … 18 18 #include "PageFaultHandler.h" 19 19 20 PageFaultHandler pageFaultHandler;20 page_fault_handler pageFaultHandler; 21 21 22 22 void kernel::run() … … 122 122 address_t kernel::backtrace(int n) 123 123 { 124 address_t basePointer = read BasePointer();124 address_t basePointer = read_base_pointer(); 125 125 address_t ebp = basePointer; 126 126 address_t eip = 1; … … 143 143 if (basePointer == NULL) 144 144 { 145 basePointer = read BasePointer();145 basePointer = read_base_pointer(); 146 146 } 147 147 address_t ebp = basePointer; … … 164 164 void kernel::print_stacktrace(unsigned int n) 165 165 { 166 address_t esp = read StackPointer();166 address_t esp = read_stack_pointer(); 167 167 address_t espBase = esp; 168 168 kconsole.set_color(GREEN); … … 175 175 } 176 176 177 /* kate: indent-width 4; replace-tabs on; */ 178 /* vi:set ts=4:set expandtab=on: */// kate: indent-width 4; replace-tabs on; 177 // kate: indent-width 4; replace-tabs on; 179 178 // vi:set ts=4:set expandtab=on: vesper/src/Kernel.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/arch/x86/MemoryManager-arch.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 87 87 }; 88 88 89 extern "C" void copy PagePhysical(uint32_t from, uint32_t to);89 extern "C" void copy_page_physical(uint32_t from, uint32_t to); 90 90 91 91 /** … … 121 121 table->pages[i].setAccessed(pages[i].isAccessed()); 122 122 table->pages[i].setDirty(pages[i].isDirty()); 123 copy PagePhysical(pages[i].frame(), table->pages[i].frame());123 copy_page_physical(pages[i].frame(), table->pages[i].frame()); 124 124 } 125 125 } … … 269 269 270 270 // # endif // LANG_X86 271 271 272 // kate: indent-width 4; replace-tabs on; 272 273 // vi:set ts=4:set expandtab=on: vesper/src/boot/Multiboot.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #include "Multiboot.h" vesper/src/boot/Multiboot.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/boot/loader.s
r92 r94 3 3 ; 4 4 ; Distributed under the Boost Software License, Version 1.0. 5 ; (See accompanying file LICENSE_1_0.txt orcopy at http:;www.boost.org/LICENSE_1_0.txt)5 ; (See file LICENSE_1_0.txt or a copy at http:;www.boost.org/LICENSE_1_0.txt) 6 6 ; 7 ; kate: replace-tabs off; indent-width 4; tab-width: 4;8 7 global _loader ; making entry point visible to linker 9 8 global initialEsp … … 53 52 cli 54 53 jmp $ ; halt machine should kernel return 54 55 55 ; kate: indent-width 4; replace-tabs on; 56 56 ; vi:set ts=4:set expandtab=on: vesper/src/lib/Atomic.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once 8 8 9 class atomic_ t9 class atomic_ops 10 10 { 11 11 public: 12 12 static address_t exchange(address_t *lock, address_t new_val); 13 13 }; 14 14 15 // kate: indent-width 4; replace-tabs on; 15 16 // vi:set ts=4:set expandtab=on: vesper/src/lib/BitArray.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/lib/DefaultConsole.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #include "DefaultConsole.h" vesper/src/lib/DefaultConsole.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/lib/Lockable.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 27 27 uint32_t new_val = 1; 28 28 // If we exchange the lock value with 1 and get 1 out, it was locked. 29 while (atomic_ t::exchange(&lock, new_val) == 1)29 while (atomic_ops::exchange(&lock, new_val) == 1) 30 30 { 31 31 // Do nothing. … … 38 38 // Spin once. 39 39 uint32_t new_val = 1; 40 if (atomic_ t::exchange(&lock, new_val) == 0)40 if (atomic_ops::exchange(&lock, new_val) == 0) 41 41 { 42 42 return true; vesper/src/lib/Macros.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 15 15 #define NORETURN __attribute__((noreturn)) 16 16 // Uncommon optimization: functions that can be optimized out: 17 // Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void. 17 // Note that a function that has pointer arguments and examines the data 18 // pointed to must not be declared const. Likewise, a function that calls a 19 // non-const function usually must not be const. It does not make sense for a 20 // const function to return void. 18 21 #define CONST_FN __attribute__((const)) 19 22 20 23 #define PANIC(msg) panic(msg, __FILE__, __LINE__); 21 24 #define ASSERT(b) ((b) ? (void)0 : panic_assert(#b, __FILE__, __LINE__)) 22 #define BUG_ON(b) ASSERT(!(b)) 25 #define BUG_ON(b) ASSERT(!(b)) //TODO: remove 26 23 27 // kate: indent-width 4; replace-tabs on; 24 28 // vi:set ts=4:set expandtab=on: vesper/src/lib/OrderedArray.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/lib/Registers.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 9 9 #include "Types.h" 10 10 11 extern "C" address_t read InstructionPointer();12 extern "C" address_t read StackPointer();13 extern "C" address_t read BasePointer();11 extern "C" address_t read_instruction_pointer(); 12 extern "C" address_t read_stack_pointer(); 13 extern "C" address_t read_base_pointer(); 14 14 15 extern "C" void write StackPointer(address_t ptr);16 extern "C" void write BasePointer(address_t ptr);15 extern "C" void write_stack_pointer(address_t ptr); 16 extern "C" void write_base_pointer(address_t ptr); 17 17 18 extern "C" address_t read PageDirectory();19 extern "C" void write PageDirectory(address_t pageDirPhysical);20 extern "C" void flush PageDirectory(void);18 extern "C" address_t read_page_directory(); 19 extern "C" void write_page_directory(address_t pageDirPhysical); 20 extern "C" void flush_page_directory(void); 21 21 22 extern "C" void enable Paging(void);23 extern "C" void enable Interrupts(void);24 extern "C" void disable Interrupts(void);22 extern "C" void enable_paging(void); 23 extern "C" void enable_interrupts(void); 24 extern "C" void disable_interrupts(void); 25 25 26 26 // defined in schedule/CriticalSection.cpp 27 extern "C" void criticalSection(); 28 extern "C" void endCriticalSection(); 27 extern "C" void critical_section(); 28 extern "C" void end_critical_section(); 29 29 30 // kate: indent-width 4; replace-tabs on; 30 31 // vi:set ts=4:set expandtab=on: vesper/src/lib/Registers.s
r92 r94 3 3 ; 4 4 ; Distributed under the Boost Software License, Version 1.0. 5 ; (See accompanying file LICENSE_1_0.txt orcopy at http:;www.boost.org/LICENSE_1_0.txt)5 ; (See file LICENSE_1_0.txt or a copy at http:;www.boost.org/LICENSE_1_0.txt) 6 6 ; 7 7 ; 8 ; Register.s -- provides functions to read/write registers on the X86 architecture. 8 ; Register.s -- provides functions to read/write registers on the X86 9 ; architecture. 9 10 ; 10 11 11 global read InstructionPointer12 global read StackPointer13 global read BasePointer14 global write StackPointer15 global write BasePointer16 global read PageDirectory17 global write PageDirectory18 global flush PageDirectory19 global enable Paging20 global enable Interrupts21 global disable Interrupts12 global read_instruction_pointer 13 global read_stack_pointer 14 global read_base_pointer 15 global write_stack_pointer 16 global write_base_pointer 17 global read_page_directory 18 global write_page_directory 19 global flush_page_directory 20 global enable_paging 21 global enable_interrupts 22 global disable_interrupts 22 23 23 read InstructionPointer:24 read_instruction_pointer: 24 25 pop eax ; Get the return address 25 26 jmp eax ; return - can't use RET because return address popped off stack. 26 27 27 read StackPointer:28 read_stack_pointer: 28 29 mov eax, esp 29 30 add eax, 4 ; Stack was pushed with return address, so take into account. 30 31 ret 31 32 32 read BasePointer:33 read_base_pointer: 33 34 mov eax, ebp 34 35 ret 35 36 36 write StackPointer:37 write_stack_pointer: 37 38 pop ebx 38 39 pop eax … … 40 41 jmp ebx 41 42 42 write BasePointer:43 write_base_pointer: 43 44 mov ebp, [esp+4] 44 45 ret 45 46 46 write PageDirectory:47 write_page_directory: 47 48 mov eax, [esp+4] 48 49 mov cr3, eax 49 50 ret 50 51 51 read PageDirectory:52 read_page_directory: 52 53 mov eax, cr3 53 54 ret 54 55 55 flush PageDirectory:56 flush_page_directory: 56 57 mov eax, cr3 57 58 mov cr3, eax 58 59 ret 59 60 60 enable Paging:61 enable_paging: 61 62 mov eax, cr0 62 63 or eax, 0x80000000 … … 64 65 ret 65 66 66 disable Interrupts:67 disable_interrupts: 67 68 cli 68 69 ret 69 70 70 enable Interrupts:71 enable_interrupts: 71 72 sti 72 73 ret 74 73 75 ; kate: indent-width 4; replace-tabs on; 74 76 ; vi:set ts=4:set expandtab=on: vesper/src/lib/Types.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 15 15 typedef int32_t ptrdiff_t; 16 16 typedef uint32_t address_t; 17 17 18 // kate: indent-width 4; replace-tabs on; 18 19 // vi:set ts=4:set expandtab=on: vesper/src/lib/asm-x86-div64.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/lib/common.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 60 60 extern "C" int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 61 61 __attribute__ ((format (printf, 3, 0))); 62 // extern "C" char *kasprintf(gfp_t gfp, const char *fmt, ...)63 // __attribute__ ((format (printf, 2, 3)));64 // extern "C" char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);65 62 66 63 extern "C" int sscanf(const char *, const char *, ...) vesper/src/lib/ctype.c
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /* vesper/src/lib/ctype.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once vesper/src/lib/g++support.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /* Dummy implementation for now */ vesper/src/lib/ia32.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /********************************************************************* vesper/src/lib/string.c
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /* … … 593 593 EXPORT_SYMBOL(memchr); 594 594 #endif 595 595 596 // kate: indent-width 4; replace-tabs on; 596 597 // vi:set ts=4:set expandtab=on: vesper/src/lib/string.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 #pragma once … … 86 86 extern void * memchr(const void *,int,size_t); 87 87 #endif 88 88 89 // kate: indent-width 4; replace-tabs on; 89 90 // vi:set ts=4:set expandtab=on: vesper/src/lib/vsprintf.c
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /* vesper/src/lib/x86.h
r92 r94 3 3 // 4 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt orcopy at http://www.boost.org/LICENSE_1_0.txt)5 // (See file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt) 6 6 // 7 7 /********************************************************************* 8 * 8 * 9 9 * Copyright (C) 2003-2004, 2006-2007, Karlsruhe University 10 * 10 * 11 11 * File path: arch/x86/x86.h 12 12 * Description: X86-64 CPU Specific constants 13 * 13 * 14 14 * Redistribution and use in source and binary forms, with or without 15 15 * modification, are permitted provided that the following conditions … … 20 20 * notice, this list of conditions and the following disclaimer in the 21 21 * documentation and/or other materials provided with the distribution. 22 * 22 * 23 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE … … 32 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 33 * SUCH DAMAGE. 34 * 34 * 35 35 * $Id$ 36 * 36 * 37 37 ********************************************************************/ 38 38 #pragma once vesper/src/memory/Heap.cpp
r92 r94 3 3 // 4 4 // Distributed under the Boost Software Licen
