├── AOT ├── AOT.build ├── Core.Tests │ ├── AssemblyInfo.cs │ ├── Core.Tests.build │ ├── SharpOS.AOT.Tests.csproj │ ├── X86.Memory16.cs │ ├── X86.Memory32.cs │ └── X86.cs ├── Core │ ├── AssemblyInfo.cs │ ├── Attributes │ │ ├── ADCInterfaceAttribute.cs │ │ ├── ADCLayerAttribute.cs │ │ ├── ADCStubAttribute.cs │ │ ├── AddressOfAttribute.cs │ │ ├── AllocArrayAttribute.cs │ │ ├── AllocAttribute.cs │ │ ├── AllocObjectAttribute.cs │ │ ├── CastClassAttribute.cs │ │ ├── ExceptionHandlingClauseAttribute.cs │ │ ├── ITableAttribute.cs │ │ ├── IncludeAttribute.cs │ │ ├── IsInstAttribute.cs │ │ ├── KernelMainAttribute.cs │ │ ├── LabelAddressAttribute.cs │ │ ├── LabelAttribute.cs │ │ ├── LabelledAllocAttribute.cs │ │ ├── MethodBoundaryAttribute.cs │ │ ├── NakedAttribute.cs │ │ ├── NullReferenceHandlerAttribute.cs │ │ ├── ObjectToPointerAttribute.cs │ │ ├── OverflowAttribute.cs │ │ ├── PointerToObjectAttribute.cs │ │ ├── StringAttribute.cs │ │ ├── TargetNamespaceAttribute.cs │ │ ├── ThrowAttribute.cs │ │ ├── TypeInfoAttribute.cs │ │ └── VTableAttribute.cs │ ├── COFF.cs │ ├── ChangeLog │ ├── Core.build │ ├── IAssembly.cs │ ├── IR │ │ ├── Block.cs │ │ ├── Class.cs │ │ ├── Dump.cs │ │ ├── Engine.cs │ │ ├── EngineException.cs │ │ ├── EngineOptions.cs │ │ ├── ExceptionHandlingClause.cs │ │ ├── Instructions │ │ │ ├── Add.cs │ │ │ ├── And.cs │ │ │ ├── Box.cs │ │ │ ├── Branch.cs │ │ │ ├── Break.cs │ │ │ ├── Call.cs │ │ │ ├── CallInstruction.cs │ │ │ ├── Callvirt.cs │ │ │ ├── Castclass.cs │ │ │ ├── ConditionCheck.cs │ │ │ ├── Convert.cs │ │ │ ├── Div.cs │ │ │ ├── Dup.cs │ │ │ ├── Endfilter.cs │ │ │ ├── Endfinally.cs │ │ │ ├── Initialize.cs │ │ │ ├── Initobj.cs │ │ │ ├── Instruction.cs │ │ │ ├── Isinst.cs │ │ │ ├── Jump.cs │ │ │ ├── Ldarg.cs │ │ │ ├── Ldarga.cs │ │ │ ├── Ldc.cs │ │ │ ├── Ldelem.cs │ │ │ ├── Ldelema.cs │ │ │ ├── Ldfld.cs │ │ │ ├── Ldflda.cs │ │ │ ├── Ldftn.cs │ │ │ ├── Ldind.cs │ │ │ ├── Ldlen.cs │ │ │ ├── Ldloc.cs │ │ │ ├── Ldloca.cs │ │ │ ├── Ldnull.cs │ │ │ ├── Ldobj.cs │ │ │ ├── Ldsfld.cs │ │ │ ├── Ldsflda.cs │ │ │ ├── Ldstr.cs │ │ │ ├── Ldtoken.cs │ │ │ ├── Leave.cs │ │ │ ├── Localloc.cs │ │ │ ├── Mul.cs │ │ │ ├── Neg.cs │ │ │ ├── Newarr.cs │ │ │ ├── Newobj.cs │ │ │ ├── Not.cs │ │ │ ├── Or.cs │ │ │ ├── PHI.cs │ │ │ ├── Pop.cs │ │ │ ├── RelationalType.cs │ │ │ ├── Rem.cs │ │ │ ├── Return.cs │ │ │ ├── Shl.cs │ │ │ ├── Shr.cs │ │ │ ├── SimpleBranch.cs │ │ │ ├── SizeOf.cs │ │ │ ├── Starg.cs │ │ │ ├── Stelem.cs │ │ │ ├── Stfld.cs │ │ │ ├── Stind.cs │ │ │ ├── Stloc.cs │ │ │ ├── Stobj.cs │ │ │ ├── Stsfld.cs │ │ │ ├── Sub.cs │ │ │ ├── Switch.cs │ │ │ ├── Throw.cs │ │ │ ├── Unbox.cs │ │ │ ├── UnboxAny.cs │ │ │ └── Xor.cs │ │ ├── Method.cs │ │ └── Operands │ │ │ ├── Argument.cs │ │ │ ├── Constant.cs │ │ │ ├── DoubleConstant.cs │ │ │ ├── Field.cs │ │ │ ├── FieldOperand.cs │ │ │ ├── FloatConstant.cs │ │ │ ├── Identifier.cs │ │ │ ├── IntConstant.cs │ │ │ ├── InternalType.cs │ │ │ ├── Local.cs │ │ │ ├── LongConstant.cs │ │ │ ├── NullConstant.cs │ │ │ ├── Operand.cs │ │ │ ├── Register.cs │ │ │ ├── StringConstant.cs │ │ │ └── TokenConstant.cs │ ├── Metadata │ │ └── ModuleMetadata.cs │ ├── SharpOS.AOT.Core.FxCop │ ├── SharpOS.AOT.Core.csproj │ └── X86 │ │ ├── AddressOf.cs │ │ ├── AlignInstruction.cs │ │ ├── Asm.cs │ │ ├── Assembly.cs │ │ ├── AssemblyMethod.cs │ │ ├── Bits32Instruction.cs │ │ ├── BlobDataInstruction.cs │ │ ├── ByteDataInstruction.cs │ │ ├── ByteMemory.cs │ │ ├── CR.cs │ │ ├── CRType.cs │ │ ├── CommentInstruction.cs │ │ ├── DR.cs │ │ ├── DRType.cs │ │ ├── DWordDataInstruction.cs │ │ ├── DWordMemory.cs │ │ ├── DataInstruction.cs │ │ ├── Engine.cs │ │ ├── FP.cs │ │ ├── FPType.cs │ │ ├── IR.cs │ │ ├── Instruction.cs │ │ ├── Instructions.cs │ │ ├── LabelInstruction.cs │ │ ├── Memory.cs │ │ ├── Metadata.cs │ │ ├── OffsetInstruction.cs │ │ ├── OrgInstruction.cs │ │ ├── QWordMemory.cs │ │ ├── R16.cs │ │ ├── R16Type.cs │ │ ├── R32.cs │ │ ├── R32Type.cs │ │ ├── R8.cs │ │ ├── R8Type.cs │ │ ├── Register.cs │ │ ├── Seg.cs │ │ ├── SegType.cs │ │ ├── TR.cs │ │ ├── TRType.cs │ │ ├── TWordMemory.cs │ │ ├── TimesInstruction.cs │ │ ├── WordDataInstruction.cs │ │ └── WordMemory.cs ├── Main │ ├── AssemblyInfo.cs │ ├── ChangeLog │ ├── Main.build │ ├── Program.cs │ ├── Resources │ │ ├── ImageBuilder.bat │ │ ├── ImageBuilder.sh │ │ └── Template.img │ ├── SharpOS.AOT.FxCop │ └── SharpOS.AOT.csproj └── SharpOS.AOT.sln ├── Data ├── Data.build ├── DiskImages │ ├── TemplateDisk.img │ └── TemplateDisk.old.img ├── FloppyDiskImage │ └── fat12.img └── KeyMaps │ ├── DE.skm │ ├── KeyMaps.build │ ├── UK.skm │ ├── US-Dvorak-ANSI.skm │ ├── US-Dvorak-Classic.skm │ └── US.skm ├── Kernel ├── Core │ ├── ADC │ │ ├── Architecture.cs │ │ ├── Barrier.cs │ │ ├── BootControl.cs │ │ ├── Debug.cs │ │ ├── Dispatcher.cs │ │ ├── ExceptionHandling.cs │ │ ├── IO.cs │ │ ├── IProcessor.cs │ │ ├── IScheduler.cs │ │ ├── Interlocked.cs │ │ ├── Keyboard.cs │ │ ├── Keys.cs │ │ ├── MemoryManager.cs │ │ ├── MemoryUtil.cs │ │ ├── Pager.cs │ │ ├── ProcessorType.cs │ │ ├── RTC.cs │ │ ├── RoundRobinScheduler.cs │ │ ├── SimpleEventDispatch.cs │ │ ├── SpinLock.cs │ │ ├── TextColor.cs │ │ ├── TextMode.cs │ │ ├── Thread.cs │ │ ├── ThreadManager.cs │ │ ├── Timer.cs │ │ └── X86 │ │ │ ├── Architecture.cs │ │ │ ├── AssemblyAttributes.cs │ │ │ ├── Barrier.cs │ │ │ ├── BootControl.cs │ │ │ ├── CMOS.cs │ │ │ ├── DMA.cs │ │ │ ├── DTPointer.cs │ │ │ ├── ExceptionHandling.cs │ │ │ ├── GDT.cs │ │ │ ├── IDT.cs │ │ │ ├── IO.cs │ │ │ ├── IRQHandler16bit.cs │ │ │ ├── Interlocked.cs │ │ │ ├── Keyboard.cs │ │ │ ├── MemoryUtil.cs │ │ │ ├── PIC.cs │ │ │ ├── PIT.cs │ │ │ ├── Pager.cs │ │ │ ├── Processor.cs │ │ │ ├── RTC.cs │ │ │ ├── TextMode.cs │ │ │ ├── Thread.cs │ │ │ ├── ThreadManager.cs │ │ │ └── Timer.cs │ ├── ASCII.cs │ ├── AssemblyInfo.cs │ ├── ChangeLog │ ├── Clock.cs │ ├── CommandLine.cs │ ├── Config │ │ └── BuiltinKeyMaps.cfg │ ├── Console.cs │ ├── Core.build │ ├── DeviceSystem │ │ ├── Boot.cs │ │ ├── Device.cs │ │ ├── DeviceManager.cs │ │ ├── Drivers │ │ │ ├── DiskControllers │ │ │ │ ├── FloppyDiskDriver.cs │ │ │ │ ├── IDEDiskDriver.cs │ │ │ │ └── IDiskControllerDevice.cs │ │ │ ├── ISerialDevice.cs │ │ │ ├── PCI │ │ │ │ ├── IPCIController.cs │ │ │ │ ├── PCIBaseAddress.cs │ │ │ │ ├── PCIController.cs │ │ │ │ └── PCIDevice.cs │ │ │ └── SerialDevice.cs │ │ ├── HardwareDevice.cs │ │ ├── HardwareResources.cs │ │ ├── IDevice.cs │ │ ├── IDiskDevice.cs │ │ ├── IFileSystemDevice.cs │ │ └── IPartitionDevice.cs │ ├── DiagnosticTool │ │ └── Server.cs │ ├── Diagnostics.cs │ ├── Documents │ │ └── ADC.txt │ ├── EntryModule.cs │ ├── EventRegisterStatus.cs │ ├── FileSystem │ │ ├── BinaryFormat.cs │ │ ├── Boot.cs │ │ ├── DiskDevice.cs │ │ ├── FATFileSystem │ │ │ ├── FAT.cs │ │ │ ├── FATDevice.cs │ │ │ ├── FATFileStream.cs │ │ │ ├── FATSettings.cs │ │ │ ├── VfsDirectory.cs │ │ │ ├── VfsFile.cs │ │ │ └── VfsFileSystem.cs │ │ ├── GenericFileSystem.cs │ │ ├── GenericPartition.cs │ │ ├── MasterBootBlock.cs │ │ ├── PartitionDevice.cs │ │ └── SettingsBase.cs │ ├── Foundation │ │ ├── BinaryTool.cs │ │ ├── ByteString.cs │ │ ├── CString8.cs │ │ ├── CalendarManager.cs │ │ ├── CalendarType.cs │ │ ├── Convert.cs │ │ ├── GregorianCalendar.cs │ │ ├── ICalendar.cs │ │ ├── PString8.cs │ │ ├── StringBuilder.cs │ │ ├── Testcase.cs │ │ ├── Time.cs │ │ ├── Timestamp.cs │ │ └── Timezone.cs │ ├── HAL │ │ ├── DMAChannel.cs │ │ ├── IOPort.cs │ │ └── IRQHandler.cs │ ├── KernelError.cs │ ├── KernelStage.cs │ ├── KeyMap.cs │ ├── Korlib │ │ ├── Convert.cs │ │ ├── Runtime │ │ │ ├── ExceptionHandlingClause.cs │ │ │ ├── FieldMetadata.cs │ │ │ ├── ITable.cs │ │ │ ├── Metadata.cs │ │ │ ├── MetadataSignatures.cs │ │ │ ├── MetadataToken.cs │ │ │ ├── MethodBoundary.cs │ │ │ ├── Runtime.cs │ │ │ ├── TokenType.cs │ │ │ ├── TypeInfo.cs │ │ │ ├── TypeMetadata.cs │ │ │ └── VTable.cs │ │ └── System │ │ │ ├── ArgumentException.cs │ │ │ ├── ArgumentNullException.cs │ │ │ ├── ArgumentOutOfRangeException.cs │ │ │ ├── ArithmeticException.cs │ │ │ ├── Array.cs │ │ │ ├── Boolean.cs │ │ │ ├── Byte.cs │ │ │ ├── Char.cs │ │ │ ├── CharEnumerator.cs │ │ │ ├── Collections │ │ │ ├── ArrayList.cs │ │ │ ├── Generic │ │ │ │ ├── ICollection.cs │ │ │ │ ├── IEnumerable.cs │ │ │ │ ├── IEnumerator.cs │ │ │ │ ├── IList.cs │ │ │ │ └── List.cs │ │ │ ├── ICollection.cs │ │ │ ├── IEnumerable.cs │ │ │ ├── IEnumerator.cs │ │ │ └── IList.cs │ │ │ ├── DivideByZeroException.cs │ │ │ ├── Enum.cs │ │ │ ├── Exception.cs │ │ │ ├── ICloneable.cs │ │ │ ├── IDisposable.cs │ │ │ ├── IO │ │ │ ├── FileAccess.cs │ │ │ ├── FileShare.cs │ │ │ ├── Path.cs │ │ │ ├── SeekOrigin.cs │ │ │ └── Stream.cs │ │ │ ├── Int16.cs │ │ │ ├── Int32.cs │ │ │ ├── Int64.cs │ │ │ ├── IntPtr.cs │ │ │ ├── InvalidCastException.cs │ │ │ ├── InvalidOperationException.cs │ │ │ ├── NotImplementedException.cs │ │ │ ├── NotSupportedException.cs │ │ │ ├── NullReferenceException.cs │ │ │ ├── Object.cs │ │ │ ├── OutOfMemoryException.cs │ │ │ ├── OverflowException.cs │ │ │ ├── RuntimeTypeHandle.cs │ │ │ ├── SByte.cs │ │ │ ├── String.cs │ │ │ ├── SystemException.cs │ │ │ ├── Type.cs │ │ │ ├── UInt16.cs │ │ │ ├── UInt32.cs │ │ │ ├── UInt64.cs │ │ │ ├── ValueType.cs │ │ │ └── Void.cs │ ├── MemoryBlock.cs │ ├── Multiboot.cs │ ├── PageAllocator.cs │ ├── PageAttributes.cs │ ├── PagingMemoryRequirements.cs │ ├── SharpOS.Kernel.Core.FxCop │ ├── SharpOS.Kernel.Core.csproj │ ├── Shell │ │ ├── Commands │ │ │ ├── BuiltIn │ │ │ │ ├── Cls.cs │ │ │ │ ├── Commands.cs │ │ │ │ ├── CpuId.cs │ │ │ │ ├── Egg.cs │ │ │ │ ├── Halt.cs │ │ │ │ ├── Help.cs │ │ │ │ ├── Keymap.cs │ │ │ │ ├── LS.cs │ │ │ │ ├── ListResources.cs │ │ │ │ ├── LsPci.cs │ │ │ │ ├── MemDump.cs │ │ │ │ ├── MemView.cs │ │ │ │ ├── More.cs │ │ │ │ ├── Mount.cs │ │ │ │ ├── Panic.cs │ │ │ │ ├── Reboot.cs │ │ │ │ ├── Show.cs │ │ │ │ ├── Snake.cs │ │ │ │ ├── Stage.cs │ │ │ │ ├── Testcase.cs │ │ │ │ ├── Time.cs │ │ │ │ ├── Timezone.cs │ │ │ │ └── Version.cs │ │ │ ├── CommandExecutionAttemptResult.cs │ │ │ ├── CommandExecutionContext.cs │ │ │ ├── CommandTableEntry.cs │ │ │ └── CommandTableHeader.cs │ │ └── Prompter.cs │ ├── Stubs.cs │ └── Vfs │ │ ├── AccessCheck.cs │ │ ├── AccessMode.cs │ │ ├── DirectoryEntry.cs │ │ ├── DirectoryNode.cs │ │ ├── FileSystemFactory.cs │ │ ├── IDirectory.cs │ │ ├── IFileSystem.cs │ │ ├── IFileSystemService.cs │ │ ├── IVfsNode.cs │ │ ├── NodeBase.cs │ │ ├── PathResolutionFlags.cs │ │ ├── PathResolver.cs │ │ ├── PathSplitter.cs │ │ ├── SymbolicLinkNode.cs │ │ ├── VfsNodeType.cs │ │ └── VirtualFileSystem.cs ├── Kernel.build └── Tests │ ├── CS │ ├── Abstract.cs │ ├── Arguments.cs │ ├── Arithmetic.cs │ ├── Array.cs │ ├── BitwiseOperators.cs │ ├── Boolean.cs │ ├── BooleanOrderOfOperations.cs │ ├── Boxing.cs │ ├── ByteString.cs │ ├── ConditionalOperator.cs │ ├── Delegates.cs │ ├── Enum.cs │ ├── Equals.cs │ ├── Exceptions.cs │ ├── Generics.cs │ ├── Inheritance.cs │ ├── Interface.cs │ ├── Misc.cs │ ├── MixedIntegerCast.cs │ ├── MixedIntegerPointerCast.cs │ ├── Object.cs │ ├── OrderOfOperations.cs │ ├── PointerCast.cs │ ├── SharpOS.Kernel.Tests.CS.csproj │ ├── SignedIntegerCast.cs │ ├── StaticConstructor.cs │ ├── String.cs │ ├── Struct.cs │ ├── Switch.cs │ ├── UInt32.cs │ ├── UnsignedIntegerCast.cs │ ├── WhileLoop.cs │ └── X86.cs │ ├── IL │ ├── Addition.il │ ├── ConditionChecking.il │ ├── ConstantLoading.il │ ├── ConversionOperations.il │ ├── ExceptionHandling.il │ ├── Generated.il │ ├── Main.il │ ├── MethodArguments.il │ └── SharpOS.Kernel.Tests.IL.csproj │ ├── NUnit │ └── SharpOS.Kernel.Tests.NUnit.csproj │ └── Tests.build ├── References ├── Mono.Cecil.dll ├── Mono.GetOptions.dll ├── Mono.Posix.dll └── nunit.framework.dll ├── SharpOS-VS05.sln ├── SharpOS-VS08.sln ├── SharpOS.build ├── Tools ├── DiagnosticTool │ ├── AssemblyInfo.cs │ ├── Client.cs │ ├── DiagnosticTool.build │ ├── DiagnosticTool.csproj │ ├── INamedPipe.cs │ ├── MainWindow.Designer.cs │ ├── MainWindow.cs │ ├── MainWindow.resx │ ├── MemoryView.Designer.cs │ ├── MemoryView.cs │ ├── MemoryView.resx │ ├── Program.cs │ ├── UnitTestsView.Designer.cs │ ├── UnitTestsView.cs │ ├── UnitTestsView.resx │ ├── UnixNamedPipe.cs │ └── WindowsNamedPipe.cs ├── DiskImageUpdater │ ├── AssemblyInfo.cs │ ├── Block.cs │ ├── DirectoryFileFormat.cs │ ├── DiskImageUpdater.build │ ├── DiskImageUpdater.csproj │ ├── Ext2FS.cs │ ├── FileSystem.cs │ ├── GroupDescriptor.cs │ ├── INode.cs │ ├── MsVhd.cs │ ├── Program.cs │ └── SuperBlock.cs ├── KernelTestsWrapperGen │ ├── AssemblyInfo.cs │ ├── KernelTestsWrapperGen.build │ ├── KernelTestsWrapperGen.csproj │ └── Program.cs ├── KeyCompiler │ ├── AssemblyInfo.cs │ ├── ChangeLog │ ├── KeyCompiler.build │ ├── KeyCompiler.cs │ ├── KeyCompiler.csproj │ ├── README │ └── Tokenizer.cs ├── RuntimeCop │ ├── CopOptions.cs │ ├── RuntimeCop.build │ ├── RuntimeCop.cs │ └── RuntimeCop.csproj ├── Tools.build └── VSUpdate │ ├── AssemblyInfo.cs │ ├── Program.cs │ ├── VSUpdate.build │ └── VSUpdate.csproj └── build └── distro ├── bochs └── bochsrc.bxrc ├── qemu ├── SDL.dll ├── bios.bin ├── fmod.dll ├── qemu.exe └── vgabios-cirrus.bin ├── virtualpc └── SharpOS.vmc └── vmware └── sharpos.vmx /AOT/AOT.build: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ADCInterfaceAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | 17 | /// 18 | /// Marks the namespace for a virtual ADC implementation contained 19 | /// in an assembly. This is used to support nested namespaces. 20 | /// 21 | [AttributeUsage (AttributeTargets.Assembly)] 22 | public sealed class ADCInterfaceAttribute : Attribute { 23 | public ADCInterfaceAttribute (string ns) 24 | { 25 | Namespace = ns; 26 | } 27 | 28 | public string Namespace; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ADCLayerAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | 17 | /// 18 | /// Marks an assembly as containing an architecture- 19 | /// dependent layer for the given CPU. Classes in the 20 | /// layer must match the layout and interface provided 21 | /// by the SharpOS.ADC framework, and exist in the specified 22 | /// namespace. 23 | /// 24 | [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)] 25 | public sealed class ADCLayerAttribute : Attribute { 26 | public ADCLayerAttribute (string cpu, string ns) 27 | { 28 | CPU = cpu; 29 | Namespace = ns; 30 | } 31 | 32 | public string CPU; 33 | public string Namespace; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ADCStubAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | 17 | /// 18 | /// Methods which carry this attribute act as stubs into 19 | /// the ADC layer in use at AOT compile-time. 20 | /// 21 | [AttributeUsage (AttributeTargets.Method)] 22 | public sealed class ADCStubAttribute : Attribute { 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/AddressOfAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace SharpOS.AOT.Attributes { 15 | [AttributeUsage (AttributeTargets.Field)] 16 | public sealed class AddressOfAttribute : Attribute { 17 | public AddressOfAttribute (string name) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/AllocArrayAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the method that is responsable to allocate a SZArray on the heap. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class AllocArrayAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/AllocAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace SharpOS.AOT.Attributes { 15 | [AttributeUsage (AttributeTargets.Method)] 16 | public sealed class AllocAttribute : Attribute { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/AllocObjectAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the method that is responsable to allocate an object on the heap. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class AllocObjectAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/CastClassAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the method that is responsible for implementing the `castclass' instruction. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class CastClassAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ExceptionHandlingClauseAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the ExceptionHandlingClause. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class)] 20 | public sealed class ExceptionHandlingClauseAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ITableAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Stanislaw Pitucha 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the itable in every object. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class)] 20 | public sealed class ITableAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/IncludeAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the classes in the SharpOS.AOT.Core that will be needed by the Kernel. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class | AttributeTargets.Enum)] 20 | public sealed class IncludeAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/IsInstAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the method that is responsible for implementing the `isinst' instruction. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class IsInstAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/KernelMainAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace SharpOS.AOT.Attributes { 15 | [AttributeUsage (AttributeTargets.Method)] 16 | public sealed class KernelMainAttribute : Attribute { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/LabelAddressAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace SharpOS.AOT.Attributes { 15 | [AttributeUsage (AttributeTargets.Method)] 16 | public sealed class LabelAddressAttribute : Attribute { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/LabelAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace SharpOS.AOT.Attributes { 15 | /// 16 | /// 17 | /// 18 | [AttributeUsage (AttributeTargets.Method)] 19 | public sealed class LabelAttribute : Attribute { 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | /// The label. 24 | public LabelAttribute (string label) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/LabelledAllocAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace SharpOS.AOT.Attributes { 15 | [AttributeUsage (AttributeTargets.Method)] 16 | public sealed class LabelledAllocAttribute : Attribute { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/MethodBoundaryAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the method boundary countainer. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class)] 20 | public sealed class MethodBoundaryAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/NakedAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark a method a Method as being naked, 18 | /// that means no prolog and no epilog. 19 | /// 20 | [AttributeUsage (AttributeTargets.Method)] 21 | public sealed class NakedAttribute : Attribute { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/NullReferenceHandlerAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the method that is responsable for handling null reference exceptions. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class NullReferenceHandlerAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ObjectToPointerAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the vtable in every object. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class ObjectToPointerAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/OverflowAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark a method as the runtime handling of 18 | /// overflow exceptions. 19 | /// 20 | [AttributeUsage (AttributeTargets.Method)] 21 | public sealed class OverflowHandlerAttribute : Attribute { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/PointerToObjectAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the vtable in every object. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class PointerToObjectAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/StringAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark a method as the AOT String() stub 18 | /// that allows character constants to be used in 19 | /// AOTed code. 20 | /// 21 | [AttributeUsage (AttributeTargets.Method)] 22 | public sealed class StringAttribute : Attribute { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/TargetNamespaceAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark a define the real namespace of a class/enum/struct/interface. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface)] 20 | public sealed class TargetNamespaceAttribute : Attribute 21 | { 22 | public TargetNamespaceAttribute (string value) 23 | { 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/ThrowAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the method that is responsable to process thrown exceptions. 18 | /// 19 | [AttributeUsage (AttributeTargets.Method)] 20 | public sealed class ThrowAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/TypeInfoAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the vtable in every object. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class)] 20 | public sealed class TypeInfoAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/Attributes/VTableAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Text; 13 | using SharpOS.AOT; 14 | 15 | namespace SharpOS.AOT.Attributes { 16 | /// 17 | /// Used to mark the class that will be used as the vtable in every object. 18 | /// 19 | [AttributeUsage (AttributeTargets.Class)] 20 | public sealed class VTableAttribute : Attribute { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AOT/Core/IR/EngineException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | 13 | namespace SharpOS.AOT.IR { 14 | 15 | /// 16 | /// Defines an exception thrown by 17 | /// and related classes when an unrecoverable error occurs while performing 18 | /// the AOT operation. This exception should be caught by the program 19 | /// embedding the AOT engine and displayed to the user. This exception is 20 | /// not thrown when an internal AOT error occurs. 21 | /// 22 | public class EngineException : Exception { 23 | public EngineException (string message) 24 | : 25 | base (message) 26 | { 27 | } 28 | } 29 | 30 | /// 31 | /// Thrown only when something still needs to be implemented. 32 | /// 33 | public class NotImplementedEngineException : EngineException { 34 | public NotImplementedEngineException () 35 | : 36 | base ("Not implemented yet.") 37 | { 38 | } 39 | 40 | public NotImplementedEngineException (string message) 41 | : base (message) 42 | { 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/And.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class And : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The first. 28 | /// The second. 29 | public And (Register result, Register first, Register second) 30 | : base ("And", result, new Operand [] { first, second }) 31 | { 32 | } 33 | 34 | /// 35 | /// Processes the specified method. 36 | /// 37 | /// The method. 38 | public override void Process (Method method) 39 | { 40 | this.def.InternalType = this.GetBitwiseResultType (this.use [0], this.use [1]); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Box.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Box : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type. 27 | /// The result. 28 | /// The value. 29 | public Box (Class type, Register result, Register value) 30 | : base ("Box", result, new Operand [] { value }) 31 | { 32 | this.type = type; 33 | 34 | result.InternalType = InternalType.O; 35 | } 36 | 37 | Class type; 38 | 39 | /// 40 | /// Gets the type. 41 | /// 42 | /// The type. 43 | public Class Type 44 | { 45 | get 46 | { 47 | return this.type; 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Branch.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Branch : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type. 27 | /// The first. 28 | /// The second. 29 | public Branch (RelationalType type, Register first, Register second) 30 | : base ("Branch", null, new Operand [] { first, second }) 31 | { 32 | this.type = type; 33 | } 34 | 35 | private RelationalType type; 36 | 37 | /// 38 | /// Gets the type of the relational. 39 | /// 40 | /// The type of the relational. 41 | public RelationalType RelationalType 42 | { 43 | get 44 | { 45 | return this.type; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Break.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Break : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | public Break () 27 | : base ("Break", null, null) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/CallInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public abstract class CallInstruction : Instruction { 23 | public CallInstruction (Method method, string name, Operand def, Operand [] use) 24 | : base (name, def, use) 25 | { 26 | this.method = method; 27 | } 28 | 29 | protected Method method; 30 | 31 | public Method Method 32 | { 33 | get 34 | { 35 | return this.method; 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Callvirt.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Callvirt : Call { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The method. 27 | /// The result. 28 | /// The parameters. 29 | public Callvirt (Method method, Register result, Operand [] parameters) 30 | : base (method, result, parameters) 31 | { 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Dup.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Dup : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Dup (Register result, Register value) 29 | : base ("Dup", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = this.use [0].InternalType; 40 | this.def.Type = this.use [0].Type; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Endfilter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Endfilter : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | public Endfilter (Register value) 27 | : base ("Endfilter", null, new Operand [] { value }) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Endfinally.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Endfinally : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | public Endfinally () 27 | : base ("Endfinally", null, null) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Initialize.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Initialize : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The source. 27 | /// The type reference. 28 | public Initialize (Local source, TypeReference typeReference) 29 | : base ("Initialize", null, new Operand [] { source }) 30 | { 31 | this.typeReference = typeReference; 32 | } 33 | 34 | TypeReference typeReference; 35 | } 36 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Initobj.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Initobj : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type reference. 27 | /// The instance. 28 | public Initobj (TypeReference typeReference, Register instance) 29 | : base ("Initobj", null, new Operand [] { instance }) 30 | { 31 | this.typeReference = typeReference; 32 | } 33 | 34 | TypeReference typeReference; 35 | 36 | public TypeReference Type 37 | { 38 | get 39 | { 40 | return this.typeReference; 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Jump.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Jump : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | public Jump () 27 | : base ("Jump", null, null) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldarg.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldarg : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldarg (Register result, Argument value) 29 | : base ("Ldarg", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | base.LdProcess (method); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldarga.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldarga : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldarga (Register result, Argument value) 29 | : base ("Ldarga", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = InternalType.M; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldc.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldc : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldc (Register result, Constant value) 29 | : base ("Ldc", result, new Operand [] { value }) 30 | { 31 | result.InternalType = value.InternalType; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldfld.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldfld : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldfld (Register result, FieldOperand value) 29 | : base ("Ldfld", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | base.LdfldProcess (method); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldflda.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldflda : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldflda (Register result, FieldOperand value) 29 | : base ("Ldflda", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | base.LdfldProcess (method); 40 | 41 | this.def.InternalType = InternalType.M; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldind.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldind : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type. 27 | /// The result. 28 | /// The value. 29 | public Ldind (InternalType type, Register result, Register value) 30 | : base ("Ldind", result, new Operand [] { value }) 31 | { 32 | this.type = type; 33 | result.InternalType = this.AdjustRegisterInternalType (type); 34 | } 35 | 36 | InternalType type; 37 | 38 | /// 39 | /// Gets the type of the internal. 40 | /// 41 | /// The type of the internal. 42 | public InternalType InternalType 43 | { 44 | get 45 | { 46 | return this.type; 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldlen.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldlen : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldlen (Register result, Register value) 29 | : base ("Ldlen", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = InternalType.U; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldloc.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldloc : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldloc (Register result, Local value) 29 | : base ("Ldloc", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | base.LdProcess (method); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldloca.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldloca : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldloca (Register result, Local value) 29 | : base ("Ldloca", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = InternalType.M; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldnull.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldnull : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | public Ldnull (Register result) 28 | : base ("Ldnull", result, new Operand [] { new NullConstant () }) 29 | { 30 | } 31 | 32 | /// 33 | /// Processes the specified method. 34 | /// 35 | /// The method. 36 | public override void Process (Method method) 37 | { 38 | this.def.InternalType = InternalType.M; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldobj.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldobj : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The type. 28 | /// The instance. 29 | public Ldobj (Register result, Class type, Register instance) 30 | : base ("Ldobj", result, new Operand [] { instance }) 31 | { 32 | result.InternalType = InternalType.ValueType; 33 | result.Type = type; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldsfld.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldsfld : Instruction { 23 | public Ldsfld (Register result, FieldOperand value) 24 | : base ("Ldsfld", result, new Operand [] { value }) 25 | { 26 | } 27 | 28 | /// 29 | /// Processes the specified method. 30 | /// 31 | /// The method. 32 | public override void Process (Method method) 33 | { 34 | base.LdfldProcess (method); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldsflda.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldsflda : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldsflda (Register result, FieldOperand value) 29 | : base ("Ldsflda", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | base.LdfldProcess (method); 40 | 41 | this.def.InternalType = InternalType.M; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldstr.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldstr : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldstr (Register result, StringConstant value) 29 | : base ("Ldstr", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = InternalType.O; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Ldtoken.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Ldtoken : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Ldtoken (Register result, TokenConstant value) 29 | : base ("Ldtoken", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = InternalType.M; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Leave.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Leave : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | public Leave () 27 | : base ("Leave", null, null) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Localloc.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Localloc : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Localloc (Register result, Register value) 29 | : base ("Localloc", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = InternalType.M; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Not.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Not : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Not (Register result, Register value) 29 | : base ("Not", result, new Operand [] { value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | this.def.InternalType = this.use [0].InternalType; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Or.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Or : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The first. 28 | /// The second. 29 | public Or (Register result, Register first, Register second) 30 | : base ("Or", result, new Operand [] { first, second }) 31 | { 32 | } 33 | 34 | /// 35 | /// Processes the specified method. 36 | /// 37 | /// The method. 38 | public override void Process (Method method) 39 | { 40 | this.def.InternalType = this.GetBitwiseResultType (this.use [0], this.use [1]); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Pop.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Pop : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The value. 27 | public Pop (Register value) 28 | : base ("Pop", null, new Operand [] { value }) 29 | { 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/RelationalType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | public enum RelationalType { 20 | Equal, 21 | GreaterThan, 22 | GreaterThanUnsignedOrUnordered, 23 | GreaterThanOrEqual, 24 | GreaterThanOrEqualUnsignedOrUnordered, 25 | LessThan, 26 | LessThanUnsignedOrUnordered, 27 | LessThanOrEqual, 28 | LessThanOrEqualUnsignedOrUnordered, 29 | NotEqualOrUnordered 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Return.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Return : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// Constructor for the case there is no return value 26 | /// 27 | public Return () 28 | : base ("Return", null, null) 29 | { 30 | } 31 | 32 | /// 33 | /// Initializes a new instance of the class. 34 | /// 35 | /// The value. 36 | public Return (Register value) 37 | : base ("Return", null, new Operand [] { value }) 38 | { 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Shl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Shl : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The first. 28 | /// The second. 29 | public Shl (Register result, Register first, Register second) 30 | : base ("Shl", result, new Operand [] { first, second }) 31 | { 32 | } 33 | 34 | /// 35 | /// Processes the specified method. 36 | /// 37 | /// The method. 38 | public override void Process (Method method) 39 | { 40 | this.def.InternalType = this.use [0].InternalType; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/SimpleBranch.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class SimpleBranch : Instruction { 23 | public enum Type { 24 | True, 25 | False 26 | } 27 | 28 | /// 29 | /// Initializes a new instance of the class. 30 | /// 31 | /// The type. 32 | /// The operand. 33 | public SimpleBranch (Type type, Register operand) 34 | : base ("SimpleBranch " + type.ToString () + " ", null, new Operand [] { operand }) 35 | { 36 | this.type = type; 37 | } 38 | 39 | private Type type; 40 | 41 | /// 42 | /// Gets the type of the simple branch. 43 | /// 44 | /// The type of the simple branch. 45 | public Type SimpleBranchType 46 | { 47 | get 48 | { 49 | return this.type; 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Starg.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Starg : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Starg (Argument result, Register value) 29 | : base ("Starg", result, new Operand [] { value }) 30 | { 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Stfld.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Stfld : Instruction { 23 | public Stfld (FieldOperand field, Register value) 24 | : base ("Stfld", null, new Operand [] { field, value }) 25 | { 26 | } 27 | 28 | /// 29 | /// Processes the specified method. 30 | /// 31 | /// The method. 32 | public override void Process (Method method) 33 | { 34 | base.StfldProcess (method); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Stind.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Stind : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type. 27 | /// The result. 28 | /// The value. 29 | public Stind (InternalType type, Register result, Register value) 30 | : base ("Stind", null, new Operand [] { result, value }) 31 | { 32 | this.type = type; 33 | } 34 | 35 | InternalType type; 36 | 37 | /// 38 | /// Gets the type of the internal. 39 | /// 40 | /// The type of the internal. 41 | public InternalType InternalType 42 | { 43 | get 44 | { 45 | return this.type; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Stloc.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Stloc : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The value. 28 | public Stloc (Local result, Register value) 29 | : base ("Stloc", result, new Operand [] { value }) 30 | { 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Stobj.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Stobj : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type reference. 27 | /// The instance. 28 | /// The value. 29 | public Stobj (TypeReference typeReference, Register instance, Register value) 30 | : base ("Stobj", null, new Operand [] { instance, value }) 31 | { 32 | this.typeReference = typeReference; 33 | } 34 | 35 | TypeReference typeReference; 36 | 37 | public TypeReference Type 38 | { 39 | get 40 | { 41 | return this.typeReference; 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Stsfld.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Stsfld : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The field. 27 | /// The value. 28 | public Stsfld (FieldOperand field, Register value) 29 | : base ("Stsfld", null, new Operand [] { field, value }) 30 | { 31 | } 32 | 33 | /// 34 | /// Processes the specified method. 35 | /// 36 | /// The method. 37 | public override void Process (Method method) 38 | { 39 | base.StfldProcess (method); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Switch.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Switch : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The value. 27 | /// The blocks. 28 | public Switch (Register value, Block [] blocks) 29 | : base ("Switch", null, new Operand [] { value }) 30 | { 31 | this.blocks = blocks; 32 | } 33 | 34 | private Block [] blocks; 35 | 36 | /// 37 | /// Gets the blocks. 38 | /// 39 | /// The blocks. 40 | public Block [] Blocks 41 | { 42 | get 43 | { 44 | return this.blocks; 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Throw.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Throw : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// Call this in case it is a Rethrow 26 | /// 27 | public Throw () 28 | : base ("Throw", null, null) 29 | { 30 | } 31 | 32 | /// 33 | /// Initializes a new instance of the class. 34 | /// 35 | /// The value. 36 | public Throw (Register value) 37 | : base ("Throw", null, new Operand [] { value }) 38 | { 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Unbox.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Unbox : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The type. 27 | /// The result. 28 | /// The instance. 29 | public Unbox (Class type, Register result, Register instance) 30 | : base ("Unbox", result, new Operand [] { instance }) 31 | { 32 | this.type = type; 33 | 34 | result.InternalType = InternalType.I; 35 | } 36 | 37 | Class type; 38 | 39 | /// 40 | /// Gets the type. 41 | /// 42 | /// The type. 43 | public Class Type 44 | { 45 | get 46 | { 47 | return this.type; 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Instructions/Xor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.AOT.IR.Operands; 15 | using Mono.Cecil; 16 | 17 | 18 | namespace SharpOS.AOT.IR.Instructions { 19 | /// 20 | /// 21 | /// 22 | public class Xor : Instruction { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The result. 27 | /// The first. 28 | /// The second. 29 | public Xor (Register result, Register first, Register second) 30 | : base ("Xor", result, new Operand [] { first, second }) 31 | { 32 | } 33 | 34 | /// 35 | /// Processes the specified method. 36 | /// 37 | /// The method. 38 | public override void Process (Method method) 39 | { 40 | this.def.InternalType = this.GetBitwiseResultType (this.use [0], this.use [1]); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Operands/Argument.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Mono.Cecil; 15 | 16 | 17 | namespace SharpOS.AOT.IR.Operands { 18 | /// 19 | /// Method Argument 20 | /// 21 | public class Argument : Identifier { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The index. 26 | /// The type. 27 | /// Type of the internal. 28 | public Argument (int index, Class type, InternalType internalType) 29 | : base ("Arg", index) 30 | { 31 | this.type = type; 32 | this.internalType = internalType; 33 | this.forceSpill = true; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Operands/Constant.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Mono.Cecil; 15 | 16 | 17 | namespace SharpOS.AOT.IR.Operands { 18 | /// 19 | /// Constant Value 20 | /// 21 | public abstract class Constant : Operand { 22 | } 23 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Operands/IntConstant.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Mono.Cecil; 15 | 16 | 17 | namespace SharpOS.AOT.IR.Operands { 18 | /// 19 | /// 20 | /// 21 | public class IntConstant : Constant { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The value. 26 | public IntConstant (int value) 27 | { 28 | this.value = value; 29 | this.InternalType = InternalType.I4; 30 | } 31 | 32 | private int value; 33 | 34 | public int Value 35 | { 36 | get 37 | { 38 | return this.value; 39 | } 40 | } 41 | 42 | public override string ToString () 43 | { 44 | return this.value.ToString (); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Operands/Local.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Mono.Cecil; 15 | 16 | 17 | namespace SharpOS.AOT.IR.Operands { 18 | /// 19 | /// Local Variable 20 | /// 21 | public class Local : Identifier { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The index. 26 | /// The type. 27 | /// Type of the internal. 28 | public Local (int index, Class type, InternalType internalType) 29 | : base ("Loc", index) 30 | { 31 | this.type = type; 32 | this.internalType = internalType; 33 | this.forceSpill = true; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Operands/NullConstant.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Mono.Cecil; 15 | 16 | 17 | namespace SharpOS.AOT.IR.Operands { 18 | /// 19 | /// 20 | /// 21 | public class NullConstant : Constant { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | public NullConstant () 26 | { 27 | this.InternalType = InternalType.I; 28 | } 29 | 30 | /// 31 | /// Gets the value. 32 | /// 33 | /// The value. 34 | public int Value 35 | { 36 | get 37 | { 38 | return 0; 39 | } 40 | } 41 | 42 | /// 43 | /// Returns a that represents the current . 44 | /// 45 | /// 46 | /// A that represents the current . 47 | /// 48 | public override string ToString () 49 | { 50 | return "null"; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /AOT/Core/IR/Operands/TokenConstant.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using Mono.Cecil; 15 | 16 | 17 | namespace SharpOS.AOT.IR.Operands { 18 | /// 19 | /// 20 | /// 21 | public class TokenConstant : Constant { 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The value. 26 | public TokenConstant (string value) 27 | { 28 | this.value = value; 29 | } 30 | 31 | private string value; 32 | 33 | /// 34 | /// Returns a that represents the current . 35 | /// 36 | /// 37 | /// A that represents the current . 38 | /// 39 | public override string ToString () 40 | { 41 | return "\"" + this.value + "\""; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /AOT/Core/X86/AddressOf.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class AddressOf : DWordDataInstruction { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The value. 25 | public AddressOf (string value) 26 | : base (0) 27 | { 28 | this.addressOfLabel = value; 29 | } 30 | 31 | private string addressOfLabel; 32 | 33 | public string AddressOfLabel 34 | { 35 | get 36 | { 37 | return this.addressOfLabel; 38 | } 39 | } 40 | 41 | public override string Parameters 42 | { 43 | get 44 | { 45 | return string.Format ("DD 0x{0:X8} ; Address of {1}", this.value, AddressOfLabel); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /AOT/Core/X86/AlignInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class AlignInstruction : Instruction { 21 | /// 22 | /// causes the AOT to burn a few bytes so that the address of the following 23 | /// data will align to the desired boundaries. The resulting offset will be a multiple of . 24 | /// 25 | /// The value. 26 | public AlignInstruction (UInt32 value) 27 | : base (true, string.Empty, string.Empty, "ALIGN", value.ToString (), null, null, null, value, null) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/Bits32Instruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class Bits32Instruction : Instruction { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// if set to true [value]. 25 | public Bits32Instruction (bool value) 26 | : base (true, string.Empty, string.Empty, "[BITS", value ? "32]" : "16]", null, null, null, value, null) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /AOT/Core/X86/CRType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class CRType : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name of the register that is being referred to 25 | /// An implementation-specific number used to encode this register to stream 26 | public CRType (string name, byte index) 27 | : base (name, index) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/CommentInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class CommentInstruction : Instruction { 21 | /// 22 | /// represents an assembler comment, which is ignored when 23 | /// encoding the output, but included when using the AOT's assembler dump feature. 24 | /// 25 | /// The Comment. 26 | public CommentInstruction (string value) 27 | : base (true, string.Empty, string.Empty, "; " + value.Trim (), string.Empty, null, null, null, null, null) 28 | { 29 | } 30 | 31 | public override string ToString () 32 | { 33 | return "\n" + string.Empty.PadRight (36) + this.Name; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /AOT/Core/X86/DRType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class DRType : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name of the register that is being referred to 25 | /// An implementation-specific number used to encode this register to stream 26 | public DRType (string name, byte index) 27 | : base (name, index) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/FPType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class FPType : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name of the register that is being referred to 25 | /// An implementation-specific number used to encode this register to stream 26 | public FPType (string name, byte index) 27 | : base (name, index) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/LabelInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class LabelInstruction : Instruction { 21 | /// 22 | /// represents a label in the output encoding, which may be used to represent 23 | /// a particular offset in the resulting image file. 24 | /// 25 | /// The label. 26 | public LabelInstruction (string label) 27 | : base (false, label, string.Empty, Assembly.FormatLabelName (label) + ":", string.Empty, null, null, null, Assembly.FormatLabelName (label), null) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/OffsetInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class OffsetInstruction : Instruction { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The value. 25 | public OffsetInstruction (UInt32 value) 26 | : base (true, string.Empty, string.Empty, "TIMES", value.ToString () + "-($-$$) DB 0", null, null, null, value, null) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /AOT/Core/X86/OrgInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class OrgInstruction : Instruction { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The value. 25 | public OrgInstruction (UInt32 value) 26 | : base (true, string.Empty, string.Empty, "ORG", value.ToString (), null, null, null, value, null) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /AOT/Core/X86/R16Type.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class R16Type : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name of the register that is being referred to 25 | /// An implementation-specific number used to encode this register to stream 26 | public R16Type (string name, byte index) 27 | : base (name, index) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/R32Type.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | /// 21 | /// This class represents an x86 32-bit register 22 | /// 23 | public class R32Type : Register { 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// The name of the register that is being referred to 28 | /// An implementation-specific number used to encode this register to stream 29 | public R32Type (string name, byte index) 30 | : base (name, index) 31 | { 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /AOT/Core/X86/R8Type.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class R8Type : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name of the register that is being referred to 25 | /// An implementation-specific number used to encode this register to stream 26 | public R8Type (string name, byte index) 27 | : base (name, index) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/SegType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class SegType : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name. 25 | /// The index. 26 | /// The value. 27 | public SegType (string name, byte index, byte value) 28 | : base (name, index) 29 | { 30 | this.value = value; 31 | } 32 | 33 | private byte value = 0; 34 | 35 | /// 36 | /// Gets the value. 37 | /// 38 | /// The value. 39 | public byte Value 40 | { 41 | get 42 | { 43 | return value; 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /AOT/Core/X86/TRType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | public class TRType : Register { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The name of the register that is being referred to 25 | /// An implementation-specific number used to encode this register to stream 26 | public TRType (string name, byte index) 27 | : base (name, index) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /AOT/Core/X86/TimesInstruction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Text; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.Cecil.Cil; 17 | using Mono.Cecil.Metadata; 18 | 19 | namespace SharpOS.AOT.X86 { 20 | internal class TimesInstruction : Instruction { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The length. 25 | /// The value. 26 | public TimesInstruction (UInt32 length, Byte value) 27 | : base (true, string.Empty, string.Empty, "TIMES", length.ToString () + " DB " + value.ToString (), null, null, null, value, null) 28 | { 29 | this.length = length; 30 | } 31 | 32 | private UInt32 length; 33 | 34 | /// 35 | /// Gets the length. 36 | /// 37 | /// The length. 38 | public UInt32 Length 39 | { 40 | get 41 | { 42 | return length; 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /AOT/Main/ChangeLog: -------------------------------------------------------------------------------- 1 | 2007-08-02 William Lahti 2 | * Program.cs: the '-bin-out' option now works correctly 3 | 4 | -------------------------------------------------------------------------------- /AOT/Main/Resources/ImageBuilder.bat: -------------------------------------------------------------------------------- 1 | vfd CLOSE 2 | vfd OPEN %2 3 | copy /Y %1 A:\SharpOS.bin 4 | vfd SAVE 5 | vfd CLOSE -------------------------------------------------------------------------------- /AOT/Main/Resources/ImageBuilder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TEMP="/tmp/sharpos" 4 | SUDO="sudo" 5 | 6 | if [ -z "$1" -o -z "$2" ]; then 7 | echo "ImageBuilder.sh [kernel.bin] [kernel.img]" 8 | exit 1 9 | fi 10 | 11 | in="$1" 12 | out="$2" 13 | 14 | if [ ! -f "$out" ]; then 15 | echo "Error (ImageBuilder.sh): Image file does not exist" 16 | fi 17 | 18 | test "`whoami`" = "root" && unset SUDO 19 | 20 | mkdir -p $TEMP 21 | $SUDO mount "$out" "$TEMP" -o loop 22 | $SUDO cp "$in" "$TEMP/SharpOS.bin" 23 | $SUDO umount "$TEMP" 24 | rmdir "$TEMP" 25 | -------------------------------------------------------------------------------- /AOT/Main/Resources/Template.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/AOT/Main/Resources/Template.img -------------------------------------------------------------------------------- /Data/Data.build: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Data/DiskImages/TemplateDisk.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Data/DiskImages/TemplateDisk.img -------------------------------------------------------------------------------- /Data/DiskImages/TemplateDisk.old.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Data/DiskImages/TemplateDisk.old.img -------------------------------------------------------------------------------- /Data/FloppyDiskImage/fat12.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Data/FloppyDiskImage/fat12.img -------------------------------------------------------------------------------- /Kernel/Core/ADC/Barrier.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using SharpOS; 13 | using SharpOS.AOT.X86; 14 | using SharpOS.AOT.IR; 15 | using AOTAttr = SharpOS.AOT.Attributes; 16 | 17 | namespace SharpOS.Kernel.ADC 18 | { 19 | public static unsafe class Barrier 20 | { 21 | #region Enter 22 | /// 23 | /// Starts the barrier, no other threads can run untill Exit is called 24 | /// 25 | /// 26 | /// This function should be made "inline" by the AOT 27 | /// 28 | [AOTAttr.ADCStub] 29 | public static void Enter() 30 | { 31 | } 32 | #endregion 33 | 34 | #region Exit 35 | /// 36 | /// Ends the barrier 37 | /// 38 | /// 39 | /// This function should be made "inline" by the AOT 40 | /// 41 | [AOTAttr.ADCStub] 42 | public static void Exit() 43 | { 44 | } 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/BootControl.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.ADC { 15 | public unsafe class BootControl { 16 | /// 17 | /// Powers down the system. 18 | /// 19 | [AOTAttr.ADCStub] 20 | public static void PowerOff () 21 | { 22 | } 23 | 24 | /// 25 | /// Freezes the system. 26 | /// Usually used after a crash to display information after which the user 27 | /// can turn of the machine. 28 | /// 29 | [AOTAttr.ADCStub] 30 | public static void Freeze () 31 | { 32 | } 33 | 34 | /// 35 | /// Puts the system into sleep mode. 36 | /// 37 | [AOTAttr.ADCStub] 38 | public static void Sleep () 39 | { 40 | } 41 | 42 | /// 43 | /// Reboot the system. 44 | /// 45 | [AOTAttr.ADCStub] 46 | public static void Reboot () 47 | { 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/IProcessor.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/ADC/IProcessor.cs -------------------------------------------------------------------------------- /Kernel/Core/ADC/IScheduler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | using SharpOS.Kernel.Foundation; 14 | 15 | namespace SharpOS.Kernel.ADC { 16 | public interface IScheduler { 17 | int Count { get; } 18 | Thread GetNextThread(); 19 | void Dump(); 20 | bool Schedule(Thread thread); 21 | bool Unschedule(Thread thread); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/Keys.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.ADC { 12 | public enum Keys : uint { 13 | Escape = 0x0001, 14 | Backspace = 0x000E, 15 | Tab = 0x000F, 16 | Enter = 0x001C, 17 | LeftControl = 0x001D, 18 | RightControl = 0xe01D, 19 | LeftShift = 0x002A, 20 | RightShift = 0x0036, 21 | LeftAlt = 0x0038, 22 | RightAlt = 0xe038, 23 | CapsLock = 0x003A, 24 | NumLock = 0x0045, 25 | ScrollLock = 0x0046, 26 | 27 | F1 = 0x003B, 28 | F2 = 0x003C, 29 | F3 = 0x003D, 30 | F4 = 0x003E, 31 | F5 = 0x003F, 32 | F6 = 0x0040, 33 | F7 = 0x0041, 34 | F8 = 0x0042, 35 | F9 = 0x0043, 36 | F10 = 0x0044, 37 | F11 = 0x0057, 38 | F12 = 0x0058, 39 | 40 | Home = 0x0047, 41 | UpArrow = 0x0048, 42 | PageUp = 0x0049, 43 | LeftArrow = 0x004B, 44 | RightArrow = 0x004D, 45 | End = 0x004F, 46 | DownArrow = 0x0050, 47 | PageDown = 0x0051, 48 | Insert = 0x0052, 49 | Delete = 0x0053 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/Pager.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/ADC/Pager.cs -------------------------------------------------------------------------------- /Kernel/Core/ADC/ProcessorType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.ADC { 15 | public enum ProcessorType : byte { 16 | Unknown = 0, 17 | IA32, 18 | IA64, 19 | PowerPC, 20 | POWER, 21 | SPARC, 22 | ARM, 23 | RISC, 24 | CBEA, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/RTC.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // William Lahti 7 | // 8 | // Licensed under the terms of the GNU GPL v3, 9 | // with Classpath Linking Exception for Libraries 10 | // 11 | 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Text; 15 | using System.Runtime.InteropServices; 16 | using SharpOS.Kernel; 17 | using SharpOS.AOT.X86; 18 | using SharpOS.AOT.IR; 19 | using SharpOS.AOT.Attributes; 20 | 21 | namespace SharpOS.Kernel.ADC { 22 | /// 23 | /// Real Time Clock 24 | /// 25 | public unsafe class RTC { 26 | 27 | /// 28 | /// Reads the time from CMOS 29 | /// 30 | [ADCStub] 31 | public static bool Read (out int year, out int month, out int day, out int hour, 32 | out int minutes, out int seconds) 33 | { 34 | year = month = day = hour = minutes = seconds = 0; 35 | return false; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/SimpleEventDispatch.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/ADC/SimpleEventDispatch.cs -------------------------------------------------------------------------------- /Kernel/Core/ADC/SpinLock.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia 6 | // Sander van Rossen 7 | // 8 | // Licensed under the terms of the GNU GPL License version 2. 9 | // 10 | 11 | using SharpOS.AOT; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.ADC 15 | { 16 | public struct SpinLock 17 | { 18 | private enum LockState : uint 19 | { 20 | Free = 0, 21 | Owned = 1 22 | } 23 | private int lockState; 24 | 25 | public void Enter() 26 | { 27 | Thread.BeginCriticalRegion(); 28 | while (true) 29 | { 30 | // If resource available, set it to in-use and return 31 | if (Interlocked.Exchange(ref lockState, (int)LockState.Owned) == (int)LockState.Free) 32 | return; 33 | 34 | while (Thread.VolatileRead(ref lockState) == (int)LockState.Owned) 35 | Thread.Yield(); 36 | } 37 | } 38 | 39 | public void Exit() 40 | { 41 | Interlocked.Exchange(ref lockState, (int)LockState.Free); 42 | Thread.EndCriticalRegion(); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/TextColor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // Sander van Rossen 7 | // 8 | // Licensed under the terms of the GNU GPL v3, 9 | // with Classpath Linking Exception for Libraries 10 | // 11 | 12 | using System; 13 | using System.Runtime.InteropServices; 14 | using SharpOS.Kernel; 15 | using SharpOS.AOT.X86; 16 | using SharpOS.AOT.IR; 17 | using SharpOS.Kernel.ADC.X86; 18 | 19 | namespace SharpOS.Kernel.ADC { 20 | public enum TextColor : byte { 21 | Black, 22 | Blue, 23 | Green, 24 | Cyan, 25 | Red, 26 | Magenta, 27 | Brown, 28 | White, 29 | DarkGray, 30 | LightBlue, 31 | LightGreen, 32 | LightCyan, 33 | LightRed, 34 | LightMagenta, 35 | Yellow, 36 | BrightWhite 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/ThreadManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.ADC { 15 | public static unsafe class ThreadManager { 16 | [AOTAttr.ADCStub] 17 | public static unsafe void Setup () 18 | { 19 | Diagnostics.Error ("Unimplemented - Setup"); 20 | } 21 | 22 | [AOTAttr.ADCStub] 23 | public static SharpOS.Kernel.ADC.Thread CreateThread (uint function_address) 24 | { 25 | Diagnostics.Error ("Unimplemented - CreateThread"); 26 | return null; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/Timer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.ADC { 15 | 16 | public unsafe class Timer { 17 | [AOTAttr.ADCStub] 18 | public static EventRegisterStatus RegisterTimerEvent (uint func) 19 | { 20 | return EventRegisterStatus.NotSupported; 21 | } 22 | 23 | public static EventRegisterStatus UnregisterTimerEvent (uint func) 24 | { 25 | return EventRegisterStatus.NotSupported; 26 | } 27 | 28 | [AOTAttr.ADCStub] 29 | public static ushort GetFrequency () 30 | { 31 | return 0; 32 | } 33 | 34 | [AOTAttr.ADCStub] 35 | public static void Delay(uint milliseconds) 36 | { 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.Kernel; 12 | using SharpOS.AOT; 13 | using SharpOS.AOT.Attributes; 14 | 15 | [assembly: ADCLayer ("X86", "SharpOS.Kernel.ADC.X86")] -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/Barrier.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL License version 2. 8 | // 9 | 10 | using SharpOS.AOT; 11 | using SharpOS.AOT.X86; 12 | using System; 13 | 14 | namespace SharpOS.Kernel.ADC.X86 15 | { 16 | public static unsafe class Barrier 17 | { 18 | #region Enter 19 | /// 20 | /// Starts the barrier, no other threads can run untill Exit is called 21 | /// 22 | /// 23 | /// This function should be made "inline" by the AOT 24 | /// 25 | public static void Enter() 26 | { 27 | Asm.CLI (); 28 | } 29 | #endregion 30 | 31 | #region Exit 32 | /// 33 | /// Ends the barrier 34 | /// 35 | /// 36 | /// This function should be made "inline" by the AOT 37 | /// 38 | public static void Exit() 39 | { 40 | Asm.STI (); 41 | } 42 | #endregion 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/DTPointer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Runtime.InteropServices; 13 | using SharpOS.Kernel; 14 | using SharpOS.AOT.X86; 15 | using SharpOS.AOT.IR; 16 | 17 | namespace SharpOS.Kernel.ADC.X86 { 18 | [StructLayout (LayoutKind.Sequential)] 19 | public struct DTPointer { 20 | public const uint SizeOf = 6; 21 | 22 | public ushort Size; 23 | public uint Address; 24 | 25 | public void Setup (ushort size, uint address) 26 | { 27 | this.Size = size; 28 | this.Address = address; 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/IDT.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/ADC/X86/IDT.cs -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/Pager.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/ADC/X86/Pager.cs -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/Processor.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/ADC/X86/Processor.cs -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/Thread.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | using SharpOS.Kernel.Foundation; 14 | using System; 15 | using SharpOS.AOT.X86; 16 | 17 | namespace SharpOS.Kernel.ADC.X86 { 18 | public sealed unsafe class Thread 19 | { 20 | public static void Yield() 21 | { 22 | // TODO: implement thread yielding 23 | SpinWait(1); 24 | } 25 | 26 | public static void SpinWait(int iterations) 27 | { 28 | if (iterations <= 0) 29 | return; 30 | 31 | Asm.MOV(R32.EAX, (uint*)&iterations); 32 | Asm.LABEL("SpinWait"); 33 | Asm.PAUSE(); 34 | Asm.DEC(R32.EAX); 35 | Asm.JNC("SpinWait"); 36 | } 37 | 38 | public static Int32 VolatileRead(ref Int32 address) 39 | { 40 | // NOTE: assuming single core system here! 41 | return address; 42 | } 43 | 44 | public static void BeginCriticalRegion() 45 | { 46 | // TODO: implement 47 | } 48 | 49 | public static void EndCriticalRegion() 50 | { 51 | // TODO: implement 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Kernel/Core/ADC/X86/Timer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | using AOTAttr = SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.ADC.X86 { 15 | 16 | public unsafe class Timer { 17 | public static EventRegisterStatus RegisterTimerEvent (uint func) 18 | { 19 | return PIT.RegisterTimerEvent (func); 20 | } 21 | 22 | public static EventRegisterStatus UnregisterTimerEvent (uint func) 23 | { 24 | return PIT.UnregisterTimerEvent (func); 25 | } 26 | 27 | public static ushort GetFrequency () 28 | { 29 | return PIT.HZ; 30 | } 31 | 32 | public static void Delay(uint milliseconds) 33 | { 34 | // resolution is only 10 milliseconds 35 | uint end = PIT.GetTickCount() + (milliseconds / 10); 36 | 37 | while (PIT.GetTickCount() < end) 38 | ; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Kernel/Core/Config/BuiltinKeyMaps.cfg: -------------------------------------------------------------------------------- 1 | US:../../build/KeyMaps/US.bin 2 | US-Dvorak-ANSI:../../build/KeyMaps/US-Dvorak-ANSI.bin 3 | US-Dvorak-Classic:../../build/KeyMaps/US-Dvorak-Classic.bin 4 | UK:../../build/KeyMaps/UK.bin 5 | DE:../../build/KeyMaps/DE.bin 6 | 7 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/Boot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpOS.Kernel.DeviceSystem; 3 | 4 | namespace SharpOS.Kernel.DeviceSystem 5 | { 6 | public static class Boot 7 | { 8 | public static void Start () 9 | { 10 | DeviceManager.Initalize (); 11 | SharpOS.Kernel.ADC.TextMode.WriteLine ("Starting Controllers"); 12 | DeviceManager.Add (new PCI.PCIController ()); 13 | 14 | DeviceManager.Add (new DiskController.IDEDiskDriver (DiskController.IDEDiskDriver.PrimaryIOBase)); 15 | //DeviceManager.Add (new DiskController.IDEDiskDriver (DiskController.IDEDiskDriver.SecondaryIOBase)); 16 | 17 | DeviceManager.Add (new DiskController.FloppyDiskDriver (DiskController.FloppyDiskDriver.PrimaryIOBase)); 18 | 19 | DeviceManager.Add (new SerialDevice(SerialDevice.Serial1Port,SerialDevice.Serial1IRQ)); 20 | DeviceManager.Add (new SerialDevice(SerialDevice.Serial2Port,SerialDevice.Serial2IRQ)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/Device.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace SharpOS.Kernel.DeviceSystem 5 | { 6 | public enum DeviceStatus : uint 7 | { 8 | Initializing, 9 | Online, 10 | Offline, 11 | NotFound, 12 | Error 13 | } 14 | 15 | public abstract class Device : IDevice 16 | { 17 | protected string name; 18 | protected Device parent; 19 | protected DeviceStatus deviceStatus; 20 | 21 | public string Name 22 | { 23 | get 24 | { 25 | return name; 26 | } 27 | } 28 | 29 | public Device Parent 30 | { 31 | get 32 | { 33 | return parent; 34 | } 35 | } 36 | 37 | public DeviceStatus Status 38 | { 39 | get 40 | { 41 | return deviceStatus; 42 | } 43 | } 44 | 45 | public Device() 46 | { 47 | name = string.Empty; 48 | parent = null; 49 | deviceStatus = DeviceStatus.Error; 50 | } 51 | 52 | public Device(Device parent, string name, DeviceStatus deviceStatus) 53 | { 54 | this.parent = parent; 55 | this.name = name; 56 | this.deviceStatus = deviceStatus; 57 | } 58 | 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/Drivers/DiskControllers/IDiskControllerDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpOS.Kernel.DeviceSystem.DiskController 4 | { 5 | public interface IDiskControllerDevice 6 | { 7 | void Initialize (); 8 | 9 | bool Open (uint driveNbr); 10 | bool Release (uint driveNbr); 11 | 12 | bool ReadBlock (uint driveNbr, uint block, uint count, byte[] data); 13 | bool WriteBlock (uint driveNbr, uint block, uint count, byte[] data); 14 | 15 | uint GetSectorSize (uint driveNbr); 16 | uint GetTotalSectors (uint driveNbr); 17 | bool CanWrite (uint driveNbr); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/Drivers/ISerialDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace SharpOS.Kernel.DeviceSystem 5 | { 6 | ///TODO: Add API to set Serial settings, like baud rate, parity, etc. 7 | public interface ISerialDevice 8 | { 9 | void Write (byte ch); 10 | int ReadByte (); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/Drivers/PCI/IPCIController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SharpOS.Kernel.DeviceSystem.PCI 6 | { 7 | public interface IPCIController 8 | { 9 | uint ReadConfig (uint bus, uint slot, uint function, uint register); 10 | void WriteConfig (uint bus, uint slot, uint function, uint register, uint value); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/HardwareDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpOS.Kernel.ADC; 3 | using SharpOS.Kernel.ADC.X86; 4 | using SharpOS.Kernel.HAL; 5 | 6 | namespace SharpOS.Kernel.DeviceSystem 7 | { 8 | public abstract class HardwareDevice : Device 9 | { 10 | protected HardwareResources hardware; 11 | 12 | protected HardwareDevice () 13 | { 14 | this.hardware = new HardwareResources (); 15 | } 16 | 17 | protected IOPort CreateIOPort (uint port) 18 | { 19 | IOPort IOPort = new IOPort (port); 20 | hardware.Add (IOPort); 21 | return IOPort; 22 | } 23 | 24 | protected IOPort CreateIOPort (uint port, uint offset) 25 | { 26 | return CreateIOPort (port + offset); 27 | } 28 | 29 | protected IDMAChannel CreateDMAChannel (byte channel) 30 | { 31 | IDMAChannel dmaChannel = new DMAChannel (channel); 32 | hardware.Add (dmaChannel); 33 | return dmaChannel; 34 | } 35 | 36 | protected IRQHandler CreateIRQHandler (byte irq) 37 | { 38 | IRQHandler irqHandler = new IRQHandler16bit (irq); 39 | hardware.Add (irqHandler); 40 | return irqHandler; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/IDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace SharpOS.Kernel.DeviceSystem 5 | { 6 | public interface IDevice 7 | { 8 | string Name { get; } 9 | Device Parent { get; } 10 | DeviceStatus Status { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/IDiskDevice.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia (aka tgiphil) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using SharpOS.Kernel.DeviceSystem; 13 | using SharpOS.Kernel.FileSystem; 14 | 15 | namespace SharpOS.Kernel.FileSystem 16 | { 17 | public interface IDiskDevice 18 | { 19 | byte[] ReadBlock(uint block, uint count); 20 | bool ReadBlock(uint block, uint count, byte[] data); 21 | bool WriteBlock(uint block, uint count, byte[] data); 22 | bool CanWrite { get; } 23 | uint TotalBlocks { get; } 24 | uint BlockSize { get; } 25 | GenericPartition this[uint partitionNbr] { get; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/IFileSystemDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpOS.Kernel.FileSystem; 3 | 4 | namespace SharpOS.Kernel.DeviceSystem 5 | { 6 | public interface IFileSystemDevice 7 | { 8 | GenericFileSystem Create(IPartitionDevice partition); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Kernel/Core/DeviceSystem/IPartitionDevice.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia (aka tgiphil) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using SharpOS.Kernel.DeviceSystem; 13 | 14 | namespace SharpOS.Kernel.DeviceSystem 15 | { 16 | public interface IPartitionDevice 17 | { 18 | byte[] ReadBlock(uint block, uint count); 19 | bool ReadBlock(uint block, uint count, byte[] data); 20 | bool WriteBlock(uint block, uint count, byte[] data); 21 | uint BlockCount { get; } 22 | uint BlockSize { get; } 23 | bool CanWrite { get; } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Kernel/Core/Documents/ADC.txt: -------------------------------------------------------------------------------- 1 | SharpOS ADC Conventions and Documentation 2 | Copyright (C) 2007, the SharpOS team (http://sharpos.sf.net/) 3 | 4 | Authors: 5 | William Lahti 6 | Jonathan Dickinson 7 | 8 | About ADC 9 | --------- 10 | 11 | The ADC allows us to seperate the code that depends on specific architectures. For now we only have a X86 architecture. 12 | 13 | Creating a new ADC Component 14 | ---------------------------- 15 | 16 | In the ADC directory you will find a bunch of classes. These classes have no implementations (they are stubs). The AOT is responsible for finding an implementation. It does this by prefixing the class namespace with the architecture in question. Thus: 17 | 18 | SharpOS.Kernel.ADT.Keyboard.cs 19 | 20 | receives its implementation from (under X86): 21 | 22 | SharpOS.Kernel.ADT.X86.Keyboard.cs 23 | 24 | Both classes must have the exact same member methods. 25 | 26 | Note that no code is ever compiled by the AOT under the ADC area, only a specific architecture such as ADC.X86. You may put whatever you want in the ADC code to make the C# compiler happy. Most often: 27 | 28 | * A blank method for a VOID method 29 | * A "return 0;" for integral or float types. 30 | * A "return null;" for object types. 31 | 32 | If your ADC component is complex, please provide object bindings for it once they have been completed. -------------------------------------------------------------------------------- /Kernel/Core/EntryModule.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/EntryModule.cs -------------------------------------------------------------------------------- /Kernel/Core/EventRegisterStatus.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | 13 | namespace SharpOS.Kernel.ADC { 14 | 15 | public enum EventRegisterStatus { 16 | Success, 17 | NotSupported, 18 | CapacityExceeded, 19 | AlreadySubscribed, 20 | NotSubscribed, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Kernel/Core/FileSystem/Boot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpOS.Kernel.FileSystem; 3 | 4 | namespace SharpOS.Kernel.FileSystem 5 | { 6 | public static class Boot 7 | { 8 | public static void Start () 9 | { 10 | Vfs.VirtualFileSystem.Setup (); 11 | FATFileSystem.FATDevice.Register (); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Kernel/Core/FileSystem/FATFileSystem/FATDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpOS.Kernel.DeviceSystem; 3 | using SharpOS.Kernel.FileSystem; 4 | 5 | namespace SharpOS.Kernel.FileSystem.FATFileSystem 6 | { 7 | public class FATDevice : Device, IFileSystemDevice 8 | { 9 | public FATDevice () 10 | { 11 | this.name = "FAT"; 12 | this.parent = null; 13 | this.deviceStatus = DeviceStatus.Online; 14 | } 15 | 16 | public static void Register () 17 | { 18 | DeviceManager.Add (new FATDevice()); 19 | } 20 | 21 | public GenericFileSystem Create(IPartitionDevice partition) 22 | { 23 | return new FAT (partition); 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Core/FileSystem/FATFileSystem/FATSettings.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia (aka tgiphil) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | 13 | namespace SharpOS.Kernel.FileSystem.FATFileSystem 14 | { 15 | public class FATSettings : SettingsBase 16 | { 17 | public FATType FatType; 18 | public string VolumeLabel; 19 | public byte[] SerialID; 20 | 21 | public FATSettings () 22 | { 23 | this.FatType = FATType.FAT16; // default 24 | this.VolumeLabel = string.Empty; 25 | this.SerialID = new byte[0]; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Kernel/Core/FileSystem/FATFileSystem/VfsFileSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SharpOS.Kernel.Vfs; 3 | 4 | namespace SharpOS.Kernel.FileSystem.FATFileSystem 5 | { 6 | public class VfsFileSystem : IFileSystemService, IFileSystem 7 | { 8 | protected FAT fat; 9 | 10 | public FAT FAT 11 | { 12 | get { return fat; } 13 | } 14 | 15 | public VfsFileSystem (FAT fat) 16 | { 17 | this.fat = fat; 18 | } 19 | 20 | public object SettingsType 21 | { 22 | get 23 | { 24 | return fat.SettingsType; 25 | } 26 | } 27 | 28 | public bool Mount () 29 | { 30 | return true; 31 | } 32 | 33 | public bool Format (SettingsBase settings) 34 | { 35 | return (fat.Format (((FATSettings)settings))); 36 | } 37 | 38 | public bool IsReadOnly 39 | { 40 | get 41 | { 42 | return fat.IsReadOnly; 43 | } 44 | } 45 | 46 | private VfsDirectory root; 47 | 48 | public IVfsNode Root 49 | { 50 | get 51 | { 52 | if (root == null) 53 | root = new VfsDirectory (this, 0); 54 | 55 | return root; 56 | } 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Kernel/Core/Foundation/CalendarManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using System.Runtime.InteropServices; 15 | using SharpOS.Kernel; 16 | using SharpOS.Kernel.ADC; 17 | using SharpOS.AOT.X86; 18 | using SharpOS.AOT.IR; 19 | using SharpOS.Kernel.Foundation; 20 | using AOTAttr = SharpOS.AOT.Attributes; 21 | 22 | namespace SharpOS.Kernel.Foundation { 23 | 24 | public unsafe class CalendarManager { 25 | static ICalendar Gregorian = null; 26 | 27 | public static ICalendar GetCalendar (CalendarType type) 28 | { 29 | // Initialize the calendars here 30 | 31 | if (Gregorian == null) 32 | Gregorian = new GregorianCalendar (); 33 | 34 | // List the calendars here 35 | 36 | switch (type) { 37 | case CalendarType.Gregorian: 38 | return Gregorian; 39 | default: 40 | return null; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Kernel/Core/Foundation/CalendarType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // William Lahti 7 | // 8 | // Licensed under the terms of the GNU GPL v3, 9 | // with Classpath Linking Exception for Libraries 10 | // 11 | 12 | //#define VERBOSE_BinaryTool 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Text; 17 | using System.Runtime.InteropServices; 18 | using SharpOS.Kernel; 19 | using SharpOS.Kernel.ADC; 20 | using SharpOS.AOT.X86; 21 | using SharpOS.AOT.IR; 22 | using SharpOS.Kernel.Foundation; 23 | using AOTAttr = SharpOS.AOT.Attributes; 24 | 25 | //#define VERBOSE_BinaryTool 26 | 27 | namespace SharpOS.Kernel.Foundation { 28 | public enum CalendarType : short { 29 | Unknown = 0, 30 | Gregorian, 31 | Islamic, 32 | Julian, 33 | Astronomical, 34 | ISO, 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Kernel/Core/Foundation/Convert.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/Foundation/Convert.cs -------------------------------------------------------------------------------- /Kernel/Core/HAL/IRQHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // Phil Garcia 7 | // 8 | // Licensed under the terms of the GNU GPL v3, 9 | // with Classpath Linking Exception for Libraries 10 | // 11 | 12 | using System; 13 | 14 | namespace SharpOS.Kernel.HAL 15 | { 16 | public interface IRQHandler 17 | { 18 | void ClearInterrupt (); 19 | bool WaitForInterrupt (uint timeout); 20 | void AssignCallBack (IIRQCallBack callback); 21 | } 22 | 23 | //NOTE: Since delegates are not yet supported, an interface will be used instead 24 | //delegate bool OnInterrupt (uint irg); 25 | public interface IIRQCallBack 26 | { 27 | bool OnInterrupt (uint irq); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Kernel/Core/KernelError.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel { 12 | public enum KernelError : uint { 13 | Unknown = 0, 14 | 15 | Success, 16 | MultibootError, 17 | 18 | /// 19 | /// Scheduler Queue is empty and this was not expected 20 | /// 21 | SchedulerQueueEmpty 22 | } 23 | } -------------------------------------------------------------------------------- /Kernel/Core/KernelStage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel { 12 | public enum KernelStage : uint { 13 | Init = 0, 14 | RuntimeInit, 15 | UserInit, 16 | Active, 17 | SingleUser, 18 | Stopping, 19 | Stop, 20 | Halt, 21 | Diagnostics, 22 | 23 | Unknown = 0xFFFFFFFF 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Convert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SharpOS.Kernel.Korlib 6 | { 7 | static public class Convert 8 | { 9 | static public string ToString (char[] val, int startIndex, int length) 10 | { 11 | return InternalSystem.String.CreateStringImpl (val, startIndex, length); 12 | } 13 | 14 | static public string ToString (char[] val) 15 | { 16 | return InternalSystem.String.CreateStringImpl (val); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/ExceptionHandlingClause.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | using SharpOS.AOT.Metadata; 13 | using SharpOS.Korlib.Runtime; 14 | 15 | namespace SharpOS.Korlib.Runtime { 16 | [SharpOS.AOT.Attributes.ExceptionHandlingClause] 17 | [StructLayout (LayoutKind.Sequential)] 18 | internal unsafe class ExceptionHandlingClause { 19 | public ExceptionHandlerType ExceptionType; 20 | public TypeInfo TypeInfo; 21 | public void* TryBegin; 22 | public void* TryEnd; 23 | public void* FilterBegin; 24 | public void* FilterEnd; 25 | public void* HandlerBegin; 26 | public void* HandlerEnd; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/FieldMetadata.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | #define DEBUG_EXCEPTION_HANDLING 12 | 13 | using System.Runtime.InteropServices; 14 | using SharpOS.AOT.Metadata; 15 | using SharpOS.AOT.Attributes; 16 | using SharpOS.Kernel; 17 | using SharpOS.Kernel.Foundation; 18 | using SharpOS.Kernel.ADC; 19 | 20 | namespace SharpOS.Korlib.Runtime { 21 | 22 | public class FieldMetadata : Metadata { 23 | public FieldMetadata (AssemblyMetadata assembly, FieldRow row): 24 | base (assembly) 25 | { 26 | this.fieldRow = row; //fieldRow; 27 | this.signature = new FieldSignature (assembly, row); 28 | } 29 | 30 | FieldRow fieldRow; 31 | FieldSignature signature; 32 | 33 | public override void Free () 34 | { 35 | signature.Free (); 36 | Runtime.Free (this); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/ITable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Stanislaw Pitucha 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | 13 | namespace SharpOS.Korlib.Runtime { 14 | [SharpOS.AOT.Attributes.ITable] 15 | [StructLayout (LayoutKind.Sequential)] 16 | internal class ITable : InternalSystem.Object { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/Metadata.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | #define DEBUG_EXCEPTION_HANDLING 12 | 13 | using System.Runtime.InteropServices; 14 | using SharpOS.AOT.Metadata; 15 | using SharpOS.AOT.Attributes; 16 | using SharpOS.Kernel; 17 | using SharpOS.Kernel.Foundation; 18 | using SharpOS.Kernel.ADC; 19 | 20 | namespace SharpOS.Korlib.Runtime { 21 | 22 | /// 23 | /// Base class for aggregated metadata information. 24 | /// NOTE: this has nothing to do with the metadata stored 25 | /// by the AOT, but is only the base class of objects 26 | /// which are constructed by iterating through that 27 | /// information. 28 | /// 29 | public abstract class Metadata { 30 | public Metadata (AssemblyMetadata assembly) 31 | { 32 | this.assembly = assembly; 33 | } 34 | 35 | AssemblyMetadata assembly; 36 | 37 | public AssemblyMetadata Assembly { 38 | get { return this.assembly; } 39 | protected set { this.assembly = value; } 40 | } 41 | 42 | public abstract void Free (); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/MethodBoundary.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | 13 | namespace SharpOS.Korlib.Runtime { 14 | [SharpOS.AOT.Attributes.MethodBoundary] 15 | [StructLayout (LayoutKind.Sequential)] 16 | internal unsafe class MethodBoundary { 17 | public string Name; 18 | public void* Begin; 19 | public void* End; 20 | public ExceptionHandlingClause [] ExceptionHandlingClauses; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/TypeInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | using SharpOS.AOT.Metadata; 13 | 14 | namespace SharpOS.Korlib.Runtime { 15 | [SharpOS.AOT.Attributes.TypeInfo] 16 | [StructLayout (LayoutKind.Sequential)] 17 | internal class TypeInfo : InternalSystem.Object { 18 | internal string Name; 19 | internal TypeInfo Base; 20 | internal AssemblyMetadata Assembly; 21 | internal uint MetadataToken; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/Runtime/VTable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | 13 | namespace SharpOS.Korlib.Runtime { 14 | [SharpOS.AOT.Attributes.VTable] 15 | [StructLayout (LayoutKind.Sequential)] 16 | internal class VTable : InternalSystem.Object { 17 | internal TypeInfo Type; 18 | internal uint Size; 19 | internal ITable ITable; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/ArgumentException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class ArgumentException: InternalSystem.SystemException { 18 | public ArgumentException (): 19 | this ("Value does not fall within the expected range.") 20 | { 21 | } 22 | 23 | public ArgumentException (string message): 24 | base (message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/ArgumentNullException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class ArgumentNullException: InternalSystem.ArgumentException { 18 | public ArgumentNullException (): 19 | this ("Argument cannot be null.") 20 | { 21 | } 22 | 23 | public ArgumentNullException (string message): 24 | base (message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/ArgumentOutOfRangeException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class ArgumentOutOfRangeException: InternalSystem.ArgumentException { 18 | public ArgumentOutOfRangeException (): 19 | this ("Argument is out of range.") 20 | { 21 | } 22 | 23 | public ArgumentOutOfRangeException (string paramName): 24 | base (paramName) 25 | { 26 | } 27 | 28 | public ArgumentOutOfRangeException (string paramName, string message): 29 | base (message) 30 | { 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/ArithmeticException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class ArithmeticException: InternalSystem.SystemException { 18 | public ArithmeticException () 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Array.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | using SharpOS.AOT.Attributes; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [StructLayout (LayoutKind.Sequential)] 17 | [TargetNamespace ("System")] 18 | public abstract class Array : InternalSystem.Object 19 | /* 20 | ICloneable, 21 | IList, 22 | ICollection, 23 | IEnumerable 24 | */ 25 | { 26 | [StructLayout (LayoutKind.Sequential)] 27 | internal struct BoundEntry { 28 | internal int LowerBound; 29 | internal int Length; 30 | } 31 | 32 | internal int Rank; 33 | internal BoundEntry FirstEntry; 34 | 35 | public unsafe int InternalLength 36 | { 37 | get 38 | { 39 | int result = this.FirstEntry.Length; 40 | 41 | fixed (BoundEntry* entries = &this.FirstEntry) { 42 | for (int i = 1; i < this.Rank; i++) 43 | result *= entries [i].Length; 44 | } 45 | 46 | return result; 47 | } 48 | } 49 | 50 | public int Length 51 | { 52 | get 53 | { 54 | return this.InternalLength; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Boolean.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct Boolean { 17 | #pragma warning disable 649 18 | internal byte Value; 19 | #pragma warning restore 649 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Byte.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct Byte/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal byte Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.Byte i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is Byte)) 35 | // return false; 36 | 37 | Byte other = (Byte)o; 38 | return other.Value == Value; 39 | } 40 | 41 | public string ToString () 42 | { 43 | return InternalSystem.String.CreateStringImpl ((uint)Value, true, false); 44 | } 45 | 46 | public string ToString (string format) 47 | { 48 | if (format == "X") 49 | return InternalSystem.String.CreateStringImpl ((uint)Value, true, true); 50 | else 51 | return ToString (); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Char.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct Char/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal char Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.Char i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is Char)) 35 | // return false; 36 | 37 | Char other = (Char)o; 38 | return other.Value == Value; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Collections/Generic/IEnumerable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | using SharpOS.AOT.Attributes; 13 | using SharpOS.Kernel.ADC; 14 | using SharpOS.Kernel.Foundation; 15 | 16 | namespace InternalSystem.Collections.Generic { 17 | /// 18 | /// Exposes the enumerator, which supports a simple iteration over a collection 19 | /// of a specified type. 20 | /// 21 | /// 22 | /// The type of objects to enumerate. 23 | /// 24 | [TargetNamespace ("System.Collections.Generic")] 25 | public interface IEnumerable : 26 | System.Collections.IEnumerable 27 | { 28 | /// 29 | /// Returns an enumerator that iterates through the collection. 30 | /// 31 | /// 32 | /// A System.Collections.Generic.IEnumerator<T^gt; that can be used to iterate through 33 | /// the collection. 34 | /// 35 | System.Collections.Generic.IEnumerator GetEnumerator(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Collections/Generic/IEnumerator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | using SharpOS.AOT.Attributes; 13 | using SharpOS.Kernel.ADC; 14 | using SharpOS.Kernel.Foundation; 15 | 16 | namespace InternalSystem.Collections.Generic { 17 | /// 18 | /// Supports a simple iteration over a generic collection. 19 | /// 20 | /// 21 | /// The type of objects to enumerate. 22 | /// 23 | [TargetNamespace ("System.Collections.Generic")] 24 | public interface IEnumerator : 25 | System.IDisposable, 26 | System.Collections.IEnumerator 27 | { 28 | /// 29 | /// Gets the element in the collection at the current position of the enumerator. 30 | /// 31 | /// 32 | /// The element in the collection at the current position of the enumerator. 33 | /// 34 | T Current { get; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Collections/IEnumerable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System.Runtime.InteropServices; 12 | using SharpOS.AOT.Attributes; 13 | using SharpOS.Kernel.ADC; 14 | using SharpOS.Kernel.Foundation; 15 | 16 | namespace InternalSystem.Collections { 17 | /// 18 | /// Exposes the enumerator, which supports a simple iteration over a non-generic 19 | /// collection. 20 | /// 21 | [TargetNamespace ("System.Collections")] 22 | public interface IEnumerable 23 | { 24 | /// 25 | /// Returns an enumerator that iterates through a collection. 26 | /// 27 | /// 28 | /// An System.Collections.IEnumerator object that can be used to iterate through the collection. 29 | /// 30 | System.Collections.IEnumerator GetEnumerator(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/DivideByZeroException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class DivideByZeroException: InternalSystem.ArithmeticException { 18 | public DivideByZeroException () 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Enum.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public abstract class Enum : InternalSystem.ValueType { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Exception.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class Exception: InternalSystem.Object { 18 | internal StackFrame [] CallingStack = null; 19 | internal int IgnoreStackFramesCount = 0; 20 | internal int CurrentStackFrame = 0; 21 | private string message; 22 | 23 | public Exception (): 24 | this ("An exception was thrown.") 25 | { 26 | } 27 | 28 | public Exception (string message) 29 | { 30 | this.message = message; 31 | } 32 | 33 | public virtual string Message { 34 | get { return message; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/ICloneable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem { 15 | /// 16 | /// Supports cloning, which creates a new instance of a class with the same value 17 | /// as an existing instance. 18 | /// 19 | [TargetNamespace ("System")] 20 | public interface ICloneable 21 | { 22 | /// 23 | /// Creates a new object that is a copy of the current instance. 24 | /// 25 | /// 26 | /// A new object that is a copy of this instance. 27 | /// 28 | object Clone(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/IDisposable.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem { 15 | /// 16 | /// Defines a method to release allocated resources. 17 | /// 18 | [TargetNamespace ("System")] 19 | public interface IDisposable 20 | { 21 | /// 22 | /// Performs application-defined tasks associated with freeing, releasing, or 23 | /// resetting unmanaged resources. 24 | /// 25 | void Dispose(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/IO/FileAccess.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Michael Ruck (aka grover) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | 13 | namespace InternalSystem.IO { 14 | [TargetNamespace("System.IO")] 15 | public enum FileAccess { 16 | Read, 17 | Write, 18 | ReadWrite 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/IO/FileShare.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Michael Ruck (aka grover) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | 13 | namespace InternalSystem.IO { 14 | [ TargetNamespace("System.IO") ] 15 | public enum FileShare { 16 | None, 17 | Read, 18 | Write, 19 | ReadWrite, 20 | Delete, 21 | Inheritable 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/IO/Path.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Michael Ruck (aka grover) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | 13 | namespace InternalSystem.IO 14 | { 15 | [TargetNamespace ("System.IO")] 16 | public static class Path 17 | { 18 | public static readonly char AltDirectorySeparatorChar = '\\'; 19 | public static readonly char DirectorySeparatorChar = '/'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/IO/SeekOrigin.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | 13 | namespace InternalSystem.IO 14 | { 15 | [TargetNamespace ("System.IO")] 16 | public enum SeekOrigin : int 17 | { 18 | Begin = 0, 19 | Current = 1, 20 | End = 2, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Int16.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct Int16/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal short Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.Int16 i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is Int16)) 35 | // return false; 36 | 37 | Int16 other = (Int16)o; 38 | return other.Value == Value; 39 | } 40 | 41 | public string ToString () 42 | { 43 | return InternalSystem.String.CreateStringImpl ((uint)Value, true, false); 44 | } 45 | 46 | public string ToString (string format) 47 | { 48 | if (format == "X") 49 | return InternalSystem.String.CreateStringImpl ((uint)Value, true, true); 50 | else 51 | return ToString (); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Int32.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem 15 | { 16 | [TargetNamespace ("System")] 17 | public struct Int32 /*: 18 | IComparable, 19 | IFormattable, 20 | IConvertible, 21 | IComparable, 22 | IEquatable*/ 23 | { 24 | #pragma warning disable 649 25 | internal int Value; 26 | #pragma warning restore 649 27 | 28 | public bool Equals (System.Int32 i) 29 | { 30 | return i == Value; 31 | } 32 | 33 | public override bool Equals (object o) 34 | { 35 | //if (!(o is Int32)) 36 | // return false; 37 | 38 | Int32 other = (Int32)o; 39 | return other.Value == Value; 40 | } 41 | 42 | public string ToString () 43 | { 44 | return InternalSystem.String.CreateStringImpl ((uint)Value, true, false); 45 | } 46 | 47 | public string ToString (string format) 48 | { 49 | if (format == "X") 50 | return InternalSystem.String.CreateStringImpl ((uint)Value, true, true); 51 | else 52 | return ToString (); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Int64.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct Int64/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal long Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.Int64 i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is Int64)) 35 | // return false; 36 | 37 | Int64 other = (Int64)o; 38 | return other.Value == Value; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/IntPtr.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia (aka tgiphil) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem 15 | { 16 | [TargetNamespace ("System")] 17 | public unsafe struct IntPtr 18 | { 19 | private void *value; 20 | 21 | public static readonly IntPtr Zero; 22 | 23 | public override bool Equals (object o) 24 | { 25 | if (!(o is System.IntPtr)) 26 | return false; 27 | 28 | return ((IntPtr)o).value == value; 29 | } 30 | 31 | public override int GetHashCode () 32 | { 33 | return (int)value; 34 | } 35 | 36 | public static bool operator == (IntPtr a, IntPtr b) 37 | { 38 | return (a.value == b.value); 39 | } 40 | 41 | public static bool operator != (IntPtr a, IntPtr b) 42 | { 43 | return (a.value != b.value); 44 | } 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/InvalidCastException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public class InvalidCastException: InternalSystem.SystemException { 17 | public InvalidCastException () 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/InvalidOperationException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public class InvalidOperationException: InternalSystem.SystemException { 17 | public InvalidOperationException () : 18 | base ("The requested operation cannot be performed.") 19 | { 20 | } 21 | 22 | public InvalidOperationException (string message): 23 | base (message) 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/NotImplementedException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class NotImplementedException : InternalSystem.SystemException { 18 | public NotImplementedException (): 19 | this ("The requested feature is not implemented.") 20 | { 21 | } 22 | 23 | public NotImplementedException (string message): 24 | base (message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/NotSupportedException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class NotSupportedException : InternalSystem.SystemException { 18 | public NotSupportedException (): 19 | this ("Operation is not supported.") 20 | { 21 | } 22 | 23 | public NotSupportedException (string message): 24 | base (message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/NullReferenceException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class NullReferenceException: InternalSystem.SystemException { 18 | public NullReferenceException (): 19 | this ("A null value was found where an object instance was required.") 20 | { 21 | } 22 | 23 | public NullReferenceException (string message): 24 | base (message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/OutOfMemoryException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public class OutOfMemoryException: InternalSystem.SystemException { 17 | public OutOfMemoryException () : 18 | base ("There was not enough memory to continue the execution of the program.") 19 | { 20 | } 21 | 22 | public OutOfMemoryException (string message): 23 | base (message) 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/OverflowException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | using SharpOS.Kernel.ADC; 14 | 15 | namespace InternalSystem { 16 | [TargetNamespace ("System")] 17 | public class OverflowException: InternalSystem.ArithmeticException { 18 | public OverflowException () 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/RuntimeTypeHandle.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Phil Garcia (aka tgiphil) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using SharpOS.AOT.Attributes; 13 | using SharpOS.Korlib.Runtime; 14 | 15 | namespace InternalSystem 16 | { 17 | [TargetNamespace ("System")] 18 | public struct RuntimeTypeHandle 19 | { 20 | IntPtr value; 21 | 22 | internal RuntimeTypeHandle (IntPtr val) 23 | { 24 | value = val; 25 | } 26 | 27 | public IntPtr Value 28 | { 29 | get 30 | { 31 | return value; 32 | } 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/SByte.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct SByte/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal sbyte Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.SByte i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is SByte)) 35 | // return false; 36 | 37 | SByte other = (SByte)o; 38 | return other.Value == Value; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/SystemException.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Korlib.Runtime; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public class SystemException : InternalSystem.Exception { 17 | public SystemException (string message): 18 | base (message) 19 | { 20 | } 21 | 22 | public SystemException (): 23 | base ("A system exception has occurred.") 24 | { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/UInt16.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct UInt16/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal ushort Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.UInt16 i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is UInt16)) 35 | // return false; 36 | 37 | UInt16 other = (UInt16)o; 38 | return other.Value == Value; 39 | } 40 | 41 | public string ToString () 42 | { 43 | return InternalSystem.String.CreateStringImpl (Value, false, false); 44 | } 45 | 46 | public string ToString (string format) 47 | { 48 | if (format == "X") 49 | return InternalSystem.String.CreateStringImpl (Value, false, true); 50 | else 51 | return ToString (); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/UInt32.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | using SharpOS.Kernel.Foundation; 14 | 15 | namespace InternalSystem 16 | { 17 | [TargetNamespace ("System")] 18 | public struct UInt32/*: 19 | IComparable, 20 | IFormattable, 21 | IConvertible, 22 | IComparable, 23 | IEquatable*/ 24 | { 25 | #pragma warning disable 649 26 | internal uint Value; 27 | #pragma warning restore 649 28 | 29 | public bool Equals (System.UInt32 i) 30 | { 31 | return i == Value; 32 | } 33 | 34 | public override bool Equals (object o) 35 | { 36 | //if (!(o is UInt32)) 37 | // return false; 38 | 39 | UInt32 other = (UInt32)o; 40 | return other.Value == Value; 41 | } 42 | 43 | public string ToString () 44 | { 45 | return InternalSystem.String.CreateStringImpl (Value, false, false); 46 | } 47 | 48 | public string ToString (string format) 49 | { 50 | if (format == "X") 51 | return InternalSystem.String.CreateStringImpl (Value, false, true); 52 | else 53 | return ToString (); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/UInt64.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct UInt64/*: 17 | IComparable, 18 | IFormattable, 19 | IConvertible, 20 | IComparable, 21 | IEquatable*/ 22 | { 23 | #pragma warning disable 649 24 | internal ulong Value; 25 | #pragma warning restore 649 26 | 27 | public bool Equals (System.UInt64 i) 28 | { 29 | return i == Value; 30 | } 31 | 32 | public override bool Equals (object o) 33 | { 34 | //if (!(o is UInt64)) 35 | // return false; 36 | 37 | UInt64 other = (UInt64)o; 38 | return other.Value == Value; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/ValueType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public abstract class ValueType : InternalSystem.Object { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Kernel/Core/Korlib/System/Void.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT.Attributes; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace InternalSystem { 15 | [TargetNamespace ("System")] 16 | public struct Void { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Kernel/Core/PageAllocator.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Core/PageAllocator.cs -------------------------------------------------------------------------------- /Kernel/Core/PageAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.AOT; 12 | using SharpOS.Kernel.ADC; 13 | 14 | namespace SharpOS.Kernel.Memory { 15 | [System.Flags] 16 | public enum PageAttributes : uint { 17 | None = 0, 18 | 19 | ReadWrite = 1, 20 | User = 1 << 1, 21 | Present = 1 << 2, 22 | } 23 | } -------------------------------------------------------------------------------- /Kernel/Core/PagingMemoryRequirements.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.Kernel; 12 | using SharpOS.AOT; 13 | using SharpOS.Kernel.Memory; 14 | 15 | namespace SharpOS.Kernel.ADC { 16 | public unsafe struct PagingMemoryRequirements { 17 | public PagingMemoryRequirements (uint atomicPages, void* start) 18 | { 19 | AtomicPages = atomicPages; 20 | Start = start; 21 | Error = PageAllocator.Errors.Success; 22 | } 23 | 24 | public uint AtomicPages; 25 | public void* Start; 26 | public PageAllocator.Errors Error; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Core/Shell/Commands/CommandExecutionAttemptResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SharpOS.Kernel.Shell.Commands { 6 | public enum CommandExecutionAttemptResult { 7 | UnknownError = 0, 8 | Success = 1, 9 | NotFound, 10 | BlankEntry 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Kernel/Core/Shell/Commands/CommandExecutionContext.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Bruce Markham 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.Kernel.Foundation; 15 | using System.Runtime.InteropServices; 16 | 17 | namespace SharpOS.Kernel.Shell.Commands { 18 | [StructLayout (LayoutKind.Sequential)] 19 | public unsafe struct CommandExecutionContext { 20 | public CString8* parameters; 21 | 22 | /// 23 | /// Allocates and returns an uninitialized CommandExecutionContext 24 | /// 25 | /// 26 | /// A newly allocated CommandExecutionContext 27 | public static CommandExecutionContext* CREATE () 28 | { 29 | CommandExecutionContext* result = (CommandExecutionContext*) ADC.MemoryManager.Allocate ((uint) sizeof (CommandExecutionContext)); 30 | 31 | return result; 32 | } 33 | 34 | public static void DISPOSE (CommandExecutionContext* instance) 35 | { 36 | ADC.MemoryManager.Free ((void*) instance); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Kernel/Core/Shell/Commands/CommandTableEntry.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Bruce Markham 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Collections.Generic; 13 | using System.Text; 14 | using SharpOS.Kernel.Foundation; 15 | using System.Runtime.InteropServices; 16 | 17 | namespace SharpOS.Kernel.Shell.Commands { 18 | [StructLayout (LayoutKind.Sequential)] 19 | public unsafe struct CommandTableEntry { 20 | public CString8* name; 21 | public CString8* shortDescription; 22 | 23 | public void* func_Execute; 24 | public void* func_GetHelp; 25 | 26 | public CommandTableEntry* nextEntry; 27 | 28 | public void DISPOSE () 29 | { 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Kernel/Core/Vfs/IDirectory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Michael Ruck (aka grover) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | 13 | namespace SharpOS.Kernel.Vfs { 14 | interface IDirectory : IDisposable { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Kernel/Core/Vfs/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Michael Ruck (aka grover) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Vfs { 12 | public interface IFileSystem { 13 | 14 | bool IsReadOnly { get; } 15 | 16 | IVfsNode Root { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Kernel/Core/Vfs/VfsNodeType.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Michael Ruck (aka grover) 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Vfs { 12 | /// 13 | /// Specifies the type of the node in the virtual file system. 14 | /// 15 | public enum VfsNodeType { 16 | 17 | /// 18 | /// An unknown node type. 19 | /// 20 | Unknown, 21 | 22 | /// 23 | /// Represents a classic file (represented by a System.IO.Stream or derived class. 24 | /// 25 | File, 26 | 27 | /// 28 | /// Represents a folder (aka directory) in the file system. 29 | /// 30 | Directory, 31 | 32 | /// 33 | /// A symbolic link in the (virtual) filesystem. 34 | /// 35 | SymbolicLink, 36 | 37 | /// 38 | /// Represents a basic device node. 39 | /// 40 | Device 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Kernel/Tests/CS/Arguments.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Tests.CS { 12 | public class Arguments { 13 | public static void Arguments1 (uint a, uint b, ref uint c) 14 | { 15 | c = a + b; 16 | 17 | return; 18 | } 19 | 20 | public static void Arguments2 (uint a, uint b, out uint c) 21 | { 22 | c = a + b; 23 | 24 | return; 25 | } 26 | 27 | public static int Arguments3 (params object[] args) 28 | { 29 | if (args.Length != 2) 30 | return -1; 31 | return (int)args[0]+(int)args[1]; 32 | } 33 | 34 | public static uint CMPArguments1 () 35 | { 36 | uint c = 0; 37 | 38 | Arguments1 (1, 2, ref c); 39 | 40 | if (c == 3) 41 | return 1; 42 | 43 | return 0; 44 | } 45 | 46 | public static uint CMPArguments2 () 47 | { 48 | uint c; 49 | 50 | Arguments2 (1, 2, out c); 51 | 52 | if (c == 3) 53 | return 1; 54 | 55 | return 0; 56 | } 57 | 58 | public static uint CMPArgumentsParams () 59 | { 60 | if (Arguments3 (1, 2) == 3) 61 | return 1; 62 | 63 | return 0; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Kernel/Tests/CS/Boolean.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Tests.CS { 12 | public class Boolean { 13 | public static bool And (bool a, bool b) 14 | { 15 | return a && b; 16 | } 17 | 18 | public static bool Or (bool a, bool b) 19 | { 20 | return a || b; 21 | } 22 | 23 | public static bool Not (bool a) 24 | { 25 | return !a; 26 | } 27 | 28 | public static uint CMPSimpleAnd () 29 | { 30 | if (And (true, false) != false) 31 | return 0; 32 | 33 | if (And (true, true) != true) 34 | return 0; 35 | 36 | if (And (false, false) != false) 37 | return 0; 38 | 39 | return 1; 40 | } 41 | 42 | public static uint CMPSimpleOr () 43 | { 44 | if (Or (true, false) != true) 45 | return 0; 46 | 47 | if (Or (true, true) != true) 48 | return 0; 49 | 50 | if (Or (false, false) != false) 51 | return 0; 52 | 53 | return 1; 54 | } 55 | 56 | public static uint CMPSimpleNot () 57 | { 58 | if (Not (false) != true) 59 | return 0; 60 | 61 | if (Not (true) != false) 62 | return 0; 63 | 64 | return 1; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Kernel/Tests/CS/Boxing.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Tests.CS { 12 | public class Boxing { 13 | private struct Point { 14 | public int x, y; 15 | 16 | public Point (int x, int y) 17 | { 18 | this.x = x; 19 | this.y = y; 20 | } 21 | 22 | public int GetSum () 23 | { 24 | return this.x + this.y; 25 | } 26 | } 27 | 28 | private static object GetPoint (int a, int b) 29 | { 30 | return new Point (a, b); 31 | } 32 | 33 | private static int Add (int a, int b) 34 | { 35 | Point point = (Point) GetPoint (a, b); 36 | 37 | return point.x + point.y; 38 | } 39 | 40 | public static uint CMPBoxUnbox () 41 | { 42 | if (Add (100, 200) == 300) 43 | return 1; 44 | 45 | return 0; 46 | } 47 | 48 | public static uint CMP2 () 49 | { 50 | object o = 0xbeef; 51 | 52 | if ((int) o == 0xbeef) 53 | return 1; 54 | 55 | return 0; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Kernel/Tests/CS/ByteString.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using SharpOS.Kernel; 12 | using SharpOS.AOT.Attributes; 13 | 14 | namespace SharpOS.Kernel.Tests.CS { 15 | public unsafe class ByteString { 16 | 17 | /// 18 | /// 19 | public static uint CMP0 () 20 | { 21 | byte* str = String ("XYZ"); 22 | uint result = 1; 23 | 24 | if (str [0] != 'X' || str [1] != 'Y' || str [2] != 'Z') 25 | result = 0; 26 | 27 | return result; 28 | } 29 | 30 | [String] 31 | public static byte* String (string str) 32 | { 33 | return null; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Kernel/Tests/CS/Delegates.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2008 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Stanisław Pitucha 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Tests.CS { 12 | /* public class Delegates { 13 | delegate int NoArgsDelegate (); 14 | 15 | static int Function () 16 | { 17 | return 69; 18 | } 19 | 20 | public static uint CMPBasic () 21 | { 22 | NoArgsDelegate p = new NoArgsDelegate (Function); 23 | 24 | if (p() == 69) 25 | return 1; 26 | return 0; 27 | } 28 | }*/ 29 | } -------------------------------------------------------------------------------- /Kernel/Tests/CS/Equals.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Sander van Rossen 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | 13 | namespace SharpOS.Kernel.Tests.CS 14 | { 15 | public class Equals 16 | { 17 | public static uint CMPInt32EqualsInt32() 18 | { 19 | Int32 test1 = 4; 20 | Int32 test2 = 4; 21 | Int32 test3 = 6; 22 | 23 | if (!test1.Equals(test2)) 24 | return 0; 25 | 26 | if (test1.Equals(test3)) 27 | return 0; 28 | 29 | return 1; 30 | } 31 | 32 | public static uint CMPInt32EqualsInt32Object() 33 | { 34 | Int32 test1 = 4; 35 | object test2 = 4; 36 | object test3 = 6; 37 | 38 | if (!test1.Equals(test2)) 39 | return 0; 40 | 41 | if (test1.Equals(test3)) 42 | return 0; 43 | 44 | return 1; 45 | } 46 | 47 | public static uint CMPInt32ObjectEqualsInt32Object() 48 | { 49 | Object test1 = 4; 50 | Object test2 = 4; 51 | Object test3 = 6; 52 | 53 | if (!test1.Equals(test2)) 54 | return 0; 55 | 56 | if (test1.Equals(test3)) 57 | return 0; 58 | 59 | return 1; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Kernel/Tests/CS/StaticConstructor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Tests.CS { 12 | public unsafe class StaticConstructor { 13 | static StaticConstructor () 14 | { 15 | result = 1; 16 | } 17 | 18 | static uint result = 0; 19 | 20 | /// 21 | /// tests the AOT's handling of a static constructor 22 | /// 23 | public static uint CMPStaticConstructor () 24 | { 25 | return result; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Kernel/Tests/CS/String.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Tests/CS/String.cs -------------------------------------------------------------------------------- /Kernel/Tests/CS/UInt32.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/Kernel/Tests/CS/UInt32.cs -------------------------------------------------------------------------------- /Kernel/Tests/CS/WhileLoop.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Mircea-Cristian Racasan 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | namespace SharpOS.Kernel.Tests.CS { 12 | public class WhileLoop { 13 | public static uint CMP0 () 14 | { 15 | int x, c; 16 | 17 | c = 10; 18 | x = 0; 19 | 20 | while (x < c) { 21 | if (x >= c) 22 | return 0; 23 | 24 | ++x; 25 | } 26 | 27 | return 1; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Kernel/Tests/IL/Addition.il: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Johann MacDonagh 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | .assembly extern mscorlib 12 | { 13 | } 14 | 15 | .namespace SharpOS.Kernel.Tests.IL 16 | { 17 | .class public auto ansi abstract sealed beforefieldinit Addition extends [mscorlib]System.Object 18 | { 19 | .method public static hidebysig default int32 CMP0 () cil managed 20 | { 21 | .maxstack 3 22 | 23 | ldc.i4 1 24 | ldc.i4 2 25 | add 26 | 27 | ldc.i4 3 28 | ceq 29 | brtrue ok 30 | 31 | ldc.i4 0 32 | ret 33 | 34 | ok: 35 | ldc.i4 1 36 | ret 37 | } 38 | 39 | .method public static hidebysig default int32 CMP1 () cil managed 40 | { 41 | .maxstack 3 42 | 43 | ldc.i4 1 44 | ldc.i4 -1 45 | add 46 | 47 | ldc.i4 0 48 | ceq 49 | brtrue ok 50 | 51 | ldc.i4 0 52 | ret 53 | 54 | ok: 55 | ldc.i4 1 56 | ret 57 | } 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /Kernel/Tests/IL/ConditionChecking.il: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Johann MacDonagh 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | .assembly extern mscorlib 12 | { 13 | } 14 | 15 | .namespace SharpOS.Kernel.Tests.IL 16 | { 17 | .class public auto ansi abstract sealed beforefieldinit ConditionChecking extends [mscorlib]System.Object 18 | { 19 | .method public static hidebysig default int32 CMP0 () cil managed 20 | { 21 | .maxstack 8 22 | 23 | ldc.i4 1 24 | ret 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Kernel/Tests/IL/ConstantLoading.il: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Johann MacDonagh 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | .assembly extern mscorlib 12 | { 13 | } 14 | 15 | .namespace SharpOS.Kernel.Tests.IL 16 | { 17 | .class public auto ansi abstract sealed beforefieldinit ConstantLoading extends [mscorlib]System.Object 18 | { 19 | .method public static hidebysig default int32 CMP0 () cil managed 20 | { 21 | .maxstack 8 22 | 23 | ldc.i4 1 24 | ret 25 | } 26 | 27 | .method public static hidebysig default int32 CMP1 () cil managed 28 | { 29 | .maxstack 8 30 | 31 | ldc.i4 1 32 | ldc.i4 0 33 | pop 34 | ret 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Kernel/Tests/IL/ConversionOperations.il: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Johann MacDonagh 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | .assembly extern mscorlib 12 | { 13 | } 14 | 15 | .namespace SharpOS.Kernel.Tests.IL 16 | { 17 | .class public auto ansi abstract sealed beforefieldinit ConversionOperations extends [mscorlib]System.Object 18 | { 19 | .method public static int32 CMP0() cil managed 20 | { 21 | .maxstack 8 22 | 23 | ldc.i4 1 24 | conv.i2 25 | 26 | ldc.i4 1 27 | conv.i2 28 | ceq 29 | brtrue ok 30 | 31 | ldc.i4 0 32 | ret 33 | 34 | ok: 35 | ldc.i4 1 36 | ret 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Kernel/Tests/IL/Main.il: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Johann MacDonagh 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | .assembly extern mscorlib 12 | { 13 | } 14 | 15 | .assembly 'SharpOS.Kernel.Tests.IL' 16 | { 17 | .ver 0:0:0:0 18 | } 19 | 20 | .namespace SharpOS.Kernel.Tests.IL 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /References/Mono.Cecil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/References/Mono.Cecil.dll -------------------------------------------------------------------------------- /References/Mono.GetOptions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/References/Mono.GetOptions.dll -------------------------------------------------------------------------------- /References/Mono.Posix.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/References/Mono.Posix.dll -------------------------------------------------------------------------------- /References/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/References/nunit.framework.dll -------------------------------------------------------------------------------- /Tools/DiagnosticTool/INamedPipe.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Cédric Rousseau 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | //#define LOG_IO 11 | 12 | using System; 13 | using System.Runtime.InteropServices; 14 | using System.Threading; 15 | using System.Collections.Generic; 16 | 17 | namespace SharpOS.Tools.DiagnosticTool { 18 | public interface INamedPipe { 19 | bool Opened { get; } 20 | uint BytesWritten { get; } 21 | uint BytesRead { get; } 22 | string FileName { get; } 23 | 24 | Client.Status Open (); 25 | void Close (); 26 | Client.Status Read (byte [] buf, ref uint read); 27 | Client.Status Write (byte [] buf); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Tools/DiagnosticTool/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // Cédric Rousseau 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.Windows.Forms; 13 | using Mono.GetOptions; 14 | 15 | namespace SharpOS.Tools.DiagnosticTool { 16 | 17 | public class ProgramOptions : Options { 18 | public ProgramOptions (string[] args): 19 | base (args) 20 | { 21 | } 22 | 23 | [Option ("Save pipe filename to this file", 's', "save-filename")] 24 | public string SaveFilename = null; 25 | } 26 | 27 | public static class Program 28 | { 29 | public static ProgramOptions Options; 30 | 31 | /// 32 | /// The main entry point for the application. 33 | /// 34 | [STAThread] 35 | public static void Main (string [] args) 36 | { 37 | Options = new ProgramOptions (args); 38 | Application.EnableVisualStyles (); 39 | Application.SetCompatibleTextRenderingDefault (false); 40 | Application.Run (new MainWindow ()); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Tools/KeyCompiler/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following 5 | // attributes. 6 | // 7 | // change them to the information which is associated with the assembly 8 | // you compile. 9 | 10 | [assembly: AssemblyTitle ("KeyCompiler")] 11 | [assembly: AssemblyDescription ("SharpOS Keymap compiler")] 12 | [assembly: AssemblyConfiguration ("")] 13 | [assembly: AssemblyCompany ("SharpOS Project")] 14 | [assembly: AssemblyProduct ("")] 15 | [assembly: AssemblyCopyright ("(C) 2007 SharpOS")] 16 | [assembly: AssemblyTrademark ("")] 17 | [assembly: AssemblyCulture ("")] 18 | 19 | [assembly: Mono.UsageComplement ("[mode] ...")] 20 | 21 | // The assembly version has following format : 22 | // 23 | // Major.Minor.Build.Revision 24 | // 25 | // You can specify all values by your own or you can build default build and revision 26 | // numbers with the '*' character (the default): 27 | 28 | [assembly: AssemblyVersion ("1.0.*")] 29 | 30 | // The following attributes specify the key for the sign of your assembly. See the 31 | // .NET Framework documentation for more information about signing. 32 | // This is not required, if you don't want signing let these attributes like they're. 33 | [assembly: AssemblyDelaySign (false)] 34 | [assembly: AssemblyKeyFile ("")] 35 | -------------------------------------------------------------------------------- /Tools/KeyCompiler/ChangeLog: -------------------------------------------------------------------------------- 1 | 2007-08-02 William Lahti 2 | * KeyCompiler.build: changed 'overwrite' on 'prefix' property to 3 | 'true', no more keycompiler files in build/KeyMaps 4 | 2007-08-02 William Lahti 5 | * removed stale debug statement 6 | 7 | 2007-07-24 William Lahti 8 | * added support for creating/unpacking keymap archives 9 | * added -force option to override safety checks 10 | * improved architecture to facilitate Unicode compilation 11 | * added UnicodeEncoding class to implement -enc:unicode 12 | * decompilation now inserts special key names instead of decimal 13 | value. 14 | * fixed bug where escaped characters were not encoded correctly, but 15 | instead encoded as the character that was escaped. Example: instead of 16 | a newline for scancode 28, an 'n' was inserted. 17 | * added support for macro arguments (for the archive modes only) using 18 | the @ prefix. 19 | * other bugfixes 20 | 21 | 2007-07-24 William Lahti 22 | * started 23 | 24 | -------------------------------------------------------------------------------- /Tools/KeyCompiler/README: -------------------------------------------------------------------------------- 1 | SharpOS KeyCompiler 2 | Author: William Lahti 3 | 4 | Introduction 5 | The SharpOS kernel requires a method of integrating character keymaps into the nanokernel for 6 | boot-time keyboard/console support. This tool compiles keymaps in the SharpOS Keymap format (.skm) 7 | into binary keymap tables (.sk) which can be loaded and used by the kernel. Keymaps generated by this 8 | tool will also be used by the userspace keyboard support as well as the SharpOS window system. 9 | 10 | Also supported is a basic keymap archive format used to make it easier for us to automate the 11 | addition and automatic availability of keymaps, without adding explicit code in the kernel. The 12 | format stores each keymap with a string label that represents it's name. The kernel searches 13 | through the archive at runtime to select the keymap requested by the user. 14 | 15 | The compiler also supports decoding both binary keymaps (.sk) and keymap archives (.ska) back into 16 | their original forms. 17 | -------------------------------------------------------------------------------- /Tools/RuntimeCop/CopOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) 2006-2007 The SharpOS Project Team (http://www.sharpos.org) 3 | // 4 | // Authors: 5 | // William Lahti 6 | // 7 | // Licensed under the terms of the GNU GPL v3, 8 | // with Classpath Linking Exception for Libraries 9 | // 10 | 11 | using System; 12 | using System.IO; 13 | using System.Runtime.CompilerServices; 14 | using System.Collections.Generic; 15 | using Mono.Cecil; 16 | using Mono.GetOptions; 17 | 18 | public class CopOptions : Options { 19 | public CopOptions (string [] args) 20 | : 21 | base (args) 22 | { 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Tools/Tools.build: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Tools/VSUpdate/VSUpdate.build: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /build/distro/bochs/bochsrc.bxrc: -------------------------------------------------------------------------------- 1 | megs: 64 2 | debugger_log: debug.log 3 | log: info.log 4 | 5 | ata0-master: type=disk, mode=flat, path="./../common/SharpOS.img", cylinders=20, heads=16, spt=63 6 | 7 | boot: disk 8 | 9 | error: action=report 10 | panic: action=ask 11 | -------------------------------------------------------------------------------- /build/distro/qemu/SDL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/build/distro/qemu/SDL.dll -------------------------------------------------------------------------------- /build/distro/qemu/bios.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/build/distro/qemu/bios.bin -------------------------------------------------------------------------------- /build/distro/qemu/fmod.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/build/distro/qemu/fmod.dll -------------------------------------------------------------------------------- /build/distro/qemu/qemu.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/build/distro/qemu/qemu.exe -------------------------------------------------------------------------------- /build/distro/qemu/vgabios-cirrus.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/build/distro/qemu/vgabios-cirrus.bin -------------------------------------------------------------------------------- /build/distro/virtualpc/SharpOS.vmc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sharpos/SharpOS/ffb7d085137f4fe691f0c937fb1161b62ec46d78/build/distro/virtualpc/SharpOS.vmc -------------------------------------------------------------------------------- /build/distro/vmware/sharpos.vmx: -------------------------------------------------------------------------------- 1 | config.version = "8" 2 | virtualHW.version = "4" 3 | memsize = "256" 4 | floppy0.fileName = "./../common/SharpOS.img" 5 | sound.present = "TRUE" 6 | sound.virtualDev = "es1371" 7 | displayName = "SharpOS" 8 | guestOS = "other" 9 | nvram = "other.nvram" 10 | 11 | floppy0.fileType = "file" 12 | isolation.tools.dnd.disable = "TRUE" 13 | isolation.tools.hgfs.disable = "TRUE" 14 | workingDir = "" 15 | debug = "TRUE" 16 | monitor_control.log_vmsample = "TRUE" 17 | 18 | uuid.location = "56 4d 14 8a 91 8b be 9e-d3 81 37 87 d2 f8 a1 6e" 19 | uuid.bios = "56 4d 5a 8b 15 f8 34 34-18 7b 54 61 34 be f9 f3" 20 | 21 | serial0.present = "TRUE" 22 | serial0.fileType = "pipe" 23 | serial0.fileName = "\\.\pipe\sharpos-serial0" 24 | serial0.tryNoRxLoss = "TRUE" 25 | 26 | uuid.action = "keep" 27 | 28 | tools.remindInstall = "TRUE" 29 | 30 | floppy0.clientDevice = "FALSE" 31 | virtualHW.productCompatibility = "hosted" 32 | tools.upgrade.policy = "manual" 33 | 34 | checkpoint.vmState = "sharpos.vmss" 35 | 36 | extendedConfigFile = "sharpos.vmxf" 37 | --------------------------------------------------------------------------------