├── .gitattributes ├── .gitignore ├── Command.mk ├── Documentation ├── AddressSpace.txt ├── DLLBases.txt ├── IPCSummary.md └── OSLoader.md ├── ExecManifest ├── ExecManifest.XRstation ├── ExecManifest.fox32 ├── LICENSE ├── Makefile ├── OS ├── AMS │ ├── Client │ │ ├── API.df │ │ ├── AmsClient.h │ │ ├── Enumerate.df │ │ ├── Init.df │ │ └── Makefile │ ├── Server │ │ ├── AmsServer.h │ │ ├── Client.df │ │ ├── Create.df │ │ ├── Enumerate.df │ │ ├── Logon.df │ │ ├── Main.df │ │ ├── Makefile │ │ ├── Query.df │ │ ├── README │ │ └── UserDb.df │ └── include │ │ └── AmsAPI.h ├── BootDrivers │ ├── AisixFS │ │ ├── AFSBlock.df │ │ ├── AFSDirectory.df │ │ ├── AFSINode.df │ │ ├── AFSOpenClose.df │ │ ├── AFSParseDelete.df │ │ ├── AFSReadWrite.df │ │ ├── AFSTruncate.df │ │ ├── AisixFS.h │ │ ├── DriverAisixFS.df │ │ └── Makefile │ ├── AnalogClockTest │ │ ├── DriverAnalogClockTest.df │ │ └── Makefile │ ├── Fat │ │ ├── DriverFat.df │ │ ├── Fat.h │ │ ├── FatBlock.df │ │ ├── FatDirectory.df │ │ ├── FatFile.df │ │ ├── FatOpenClose.df │ │ ├── FatParseDelete.df │ │ ├── FatReadWrite.df │ │ ├── FatTruncate.df │ │ ├── FatUtil.df │ │ └── Makefile │ ├── RyFS │ │ ├── DriverRyFS.df │ │ ├── Makefile │ │ ├── README │ │ └── RyFS.h │ ├── XRstation │ │ ├── EBus │ │ │ ├── DriverDKS.df │ │ │ ├── DriverEBus.df │ │ │ ├── DriverRTC.df │ │ │ ├── DriverSerial.df │ │ │ ├── DriverSystem.df │ │ │ └── Makefile │ │ ├── Keyboard │ │ │ ├── DriverKeyboard.df │ │ │ └── Makefile │ │ ├── KinnowFB │ │ │ ├── DriverKinnowFB.df │ │ │ └── Makefile │ │ └── Mouse │ │ │ ├── DriverMouse.df │ │ │ └── Makefile │ └── fox32 │ │ └── foxmobo │ │ ├── DriverFoxMobo.df │ │ ├── FoxDisk.df │ │ ├── FoxFramebuffer.df │ │ ├── FoxKeyboard.df │ │ ├── FoxMouse.df │ │ └── Makefile ├── Commands │ ├── aptdisk │ │ ├── IDisk.df │ │ ├── Main.df │ │ ├── Makefile │ │ ├── Partition.df │ │ └── Prompt.df │ ├── cat │ │ ├── Main.df │ │ └── Makefile │ ├── chgrp │ │ ├── Main.df │ │ └── Makefile │ ├── chmod │ │ ├── Main.df │ │ └── Makefile │ ├── chown │ │ ├── Main.df │ │ └── Makefile │ ├── clear │ │ ├── Main.df │ │ └── Makefile │ ├── cmd │ │ ├── Main.df │ │ └── Makefile │ ├── cp │ │ ├── Main.df │ │ └── Makefile │ ├── crypt │ │ ├── Main.df │ │ └── Makefile │ ├── date │ │ ├── Main.df │ │ └── Makefile │ ├── dd │ │ ├── Main.df │ │ └── Makefile │ ├── dhrystone │ │ ├── Main.df │ │ └── Makefile │ ├── echo │ │ ├── Main.df │ │ └── Makefile │ ├── edit │ │ ├── Buffer.df │ │ ├── Draw.df │ │ ├── Edit.h │ │ ├── Editor.df │ │ ├── Main.df │ │ ├── Makefile │ │ ├── Screen.df │ │ └── Terminal.df │ ├── env │ │ ├── Main.df │ │ └── Makefile │ ├── groups │ │ ├── Main.df │ │ └── Makefile │ ├── help │ │ ├── Main.df │ │ └── Makefile │ ├── kill │ │ ├── Main.df │ │ └── Makefile │ ├── killall │ │ ├── Main.df │ │ └── Makefile │ ├── kstats │ │ ├── Main.df │ │ └── Makefile │ ├── label │ │ ├── Main.df │ │ └── Makefile │ ├── login │ │ ├── Main.df │ │ └── Makefile │ ├── ls │ │ ├── Main.df │ │ └── Makefile │ ├── mem │ │ ├── Main.df │ │ └── Makefile │ ├── mkdir │ │ ├── Main.df │ │ └── Makefile │ ├── mkfs_aisixfs │ │ ├── Main.df │ │ └── Makefile │ ├── mount │ │ ├── Main.df │ │ └── Makefile │ ├── mousedemo │ │ ├── Main.df │ │ └── Makefile │ ├── mv │ │ ├── Main.df │ │ └── Makefile │ ├── nvram │ │ ├── Main.df │ │ └── Makefile │ ├── oldcmd │ │ ├── Cmd.h │ │ ├── CmdBuiltins.df │ │ ├── CmdParse.df │ │ ├── CmdSymbol.df │ │ ├── CmdToken.df │ │ ├── Main.df │ │ └── Makefile │ ├── passwd │ │ ├── Main.df │ │ └── Makefile │ ├── ps │ │ ├── Main.df │ │ └── Makefile │ ├── pwd │ │ ├── Main.df │ │ └── Makefile │ ├── quota │ │ ├── Main.df │ │ └── Makefile │ ├── reboot │ │ ├── Main.df │ │ └── Makefile │ ├── rm │ │ ├── Main.df │ │ └── Makefile │ ├── shutdown │ │ ├── Main.df │ │ └── Makefile │ ├── sleep │ │ ├── Main.df │ │ └── Makefile │ ├── stress │ │ ├── Main.df │ │ ├── Makefile │ │ ├── Stress.h │ │ └── Tests.df │ ├── swapon │ │ ├── Main.df │ │ └── Makefile │ ├── sync │ │ ├── Main.df │ │ └── Makefile │ ├── tee │ │ ├── Main.df │ │ └── Makefile │ ├── time │ │ ├── Main.df │ │ └── Makefile │ ├── trunc │ │ ├── Main.df │ │ └── Makefile │ ├── umount │ │ ├── Main.df │ │ └── Makefile │ ├── users │ │ ├── Main.df │ │ └── Makefile │ ├── ver │ │ ├── Main.df │ │ └── Makefile │ ├── view │ │ ├── Main.df │ │ ├── Makefile │ │ ├── Pager.h │ │ └── Terminal.df │ └── whoami │ │ ├── Main.df │ │ └── Makefile ├── Common │ ├── ComBitmap.df │ ├── ComDLLLoad.df │ ├── Common.h │ └── Module.h ├── HAL │ ├── HAL │ │ ├── HALArgs.df │ │ ├── HALConsole.df │ │ ├── HALCrash.df │ │ ├── HALDebug.df │ │ ├── HALInterrupt.df │ │ ├── HALLog.df │ │ ├── HALMain.df │ │ ├── HALRTC.df │ │ └── HALResource.df │ ├── XRstation │ │ ├── HALXRstation.df │ │ ├── HALXRstationAmtsu.df │ │ ├── HALXRstationCitron.df │ │ ├── HALXRstationConsole.df │ │ ├── HALXRstationDebug.df │ │ ├── HALXRstationDebugSerial.df │ │ ├── HALXRstationEBus.df │ │ ├── HALXRstationIPL.df │ │ ├── HALXRstationNvram.df │ │ ├── KVDraw.df │ │ ├── Makefile │ │ ├── include │ │ │ ├── HALXRstationAmtsu.h │ │ │ ├── HALXRstationCitron.h │ │ │ └── HALXRstationEBus.h │ │ └── xr17032 │ │ │ ├── HALXr17032FastDrawGlyph.s │ │ │ ├── HALXr17032Halt.s │ │ │ ├── HALXr17032Init.s │ │ │ └── HALXr17032Misc.df │ ├── fox32 │ │ ├── HALfox32.df │ │ ├── HALfox32Console.df │ │ ├── HALfox32Debug.df │ │ ├── HALfox32DebugSerial.df │ │ ├── HALfox32IPL.df │ │ ├── KVDraw.df │ │ ├── Makefile │ │ ├── fox32 │ │ │ ├── HALfox32Halt.s │ │ │ └── HALfox32Misc.df │ │ └── include │ │ │ └── HALfox32IO.h │ └── include │ │ ├── HALArgs.h │ │ ├── HALCPU.h │ │ ├── HALConsole.h │ │ ├── HALCrash.h │ │ ├── HALDebug.h │ │ ├── HALDriver.h │ │ ├── HALExit.h │ │ ├── HALIPL.h │ │ ├── HALInterrupt.h │ │ ├── HALLog.h │ │ ├── HALMap.h │ │ ├── HALNvram.h │ │ ├── HALRTC.h │ │ └── HALResource.h ├── Headers │ ├── AMS │ │ └── Ams.h │ ├── BME │ │ ├── Bme.h │ │ └── Region.h │ ├── MCL │ │ └── Mcl.h │ └── OSDLL │ │ ├── OS.h │ │ ├── OSAbort.h │ │ ├── OSAccess.h │ │ ├── OSAlloc.h │ │ ├── OSBootFlags.h │ │ ├── OSCalls.h │ │ ├── OSConfiguration.h │ │ ├── OSConsoleControl.h │ │ ├── OSContext.h │ │ ├── OSCrypt.h │ │ ├── OSEnvironment.h │ │ ├── OSFastMutex.h │ │ ├── OSFile.h │ │ ├── OSIOControl.h │ │ ├── OSMap.h │ │ ├── OSMemory.h │ │ ├── OSModule.h │ │ ├── OSMount.h │ │ ├── OSMouseControl.h │ │ ├── OSNvramControl.h │ │ ├── OSObject.h │ │ ├── OSPort.h │ │ ├── OSProcess.h │ │ ├── OSShutdown.h │ │ ├── OSSignal.h │ │ ├── OSStatistics.h │ │ ├── OSStatus.h │ │ ├── OSStream.h │ │ ├── OSTime.h │ │ ├── OSVersion.h │ │ ├── OSVideoControl.h │ │ └── OSWait.h ├── KDebug │ ├── DebugIO.df │ ├── DebugMain.df │ ├── DebugPrompt.df │ ├── DebugSymbols.df │ ├── Makefile │ ├── fox32 │ │ └── DebugTrace.df │ ├── include │ │ ├── DebugIO.h │ │ ├── DebugSymbols.h │ │ └── DebugTrace.h │ └── xr17032 │ │ └── DebugTrace.df ├── MCL │ ├── API.df │ ├── Builtins.df │ ├── Eval.df │ ├── EvalPipeline.df │ ├── Input.df │ ├── Lex.df │ ├── Makefile │ ├── Mcl.h │ ├── Parse.df │ └── Symbol.df ├── OSDLL │ ├── DLLConfiguration.df │ ├── DLLCrypt.df │ ├── DLLEnvironment.df │ ├── DLLFastMutex.df │ ├── DLLFile.df │ ├── DLLHeap.df │ ├── DLLMain.df │ ├── DLLMemory.df │ ├── DLLModule.df │ ├── DLLModuleCalls.df │ ├── DLLObject.df │ ├── DLLPrint.df │ ├── DLLProcess.df │ ├── DLLSignal.df │ ├── DLLStatistics.df │ ├── DLLStatus.df │ ├── DLLStream.df │ ├── DLLTime.df │ ├── Makefile │ ├── OSDLL.h │ ├── fox32 │ │ ├── DLLDebug.df │ │ ├── DLLMainTrampoline.df │ │ ├── DLLThreadLocal.df │ │ └── OSCallStubs.s │ └── xr17032 │ │ ├── DLLDebug.df │ │ ├── DLLMainTrampoline.df │ │ ├── DLLThreadLocal.df │ │ └── OSCallStubs.s ├── OSKernel │ ├── Console │ │ ├── CoConsole.df │ │ ├── CoDuplex.df │ │ ├── CoDuplex.h │ │ ├── CoDuplexClient.df │ │ ├── CoDuplexDispatch.df │ │ ├── CoDuplexServer.df │ │ ├── CoOSCalls.df │ │ └── CoVideoConsole.df │ ├── Executive │ │ ├── ExAvlTree.df │ │ ├── ExBalanceManager.df │ │ ├── ExBitmap.df │ │ ├── ExEvent.df │ │ ├── ExHandleTable.df │ │ ├── ExInit.df │ │ ├── ExInternal.h │ │ ├── ExLog.df │ │ ├── ExMutex.df │ │ ├── ExOSCalls.df │ │ ├── ExRwLock.df │ │ ├── ExSemaphore.df │ │ ├── ExShutdown.df │ │ ├── ExTimer.df │ │ ├── fox32 │ │ │ ├── ExBuildDate.df │ │ │ └── OSCallTrampolines.s │ │ └── xr17032 │ │ │ ├── ExBuildDate.df │ │ │ └── OSCallTrampolines.s │ ├── FSRTL │ │ └── FSVolume.df │ ├── IO │ │ ├── IOCache.df │ │ ├── IOCacheInfoBlock.df │ │ ├── IOCachePage.df │ │ ├── IOCacheZero.df │ │ ├── IOCancel.df │ │ ├── IODevice.df │ │ ├── IOFile.df │ │ ├── IOFileControlBlock.df │ │ ├── IOFilesystem.df │ │ ├── IOInit.df │ │ ├── IOInternal.h │ │ ├── IONullZeroDevice.df │ │ ├── IOOSCalls.df │ │ ├── IOPacket.df │ │ ├── IOPageFile.df │ │ ├── IOParse.df │ │ ├── IOPartition.df │ │ ├── IOPartitionAPT.df │ │ ├── IOPartitionMBR.df │ │ ├── IOReadWrite.df │ │ ├── IOTransfer.df │ │ ├── IOViewCache.df │ │ └── IOWorkerThreads.df │ ├── IPC │ │ ├── IPCCompletion.df │ │ ├── IPCInit.df │ │ ├── IPCInternal.h │ │ ├── IPCMessage.df │ │ ├── IPCOSCalls.df │ │ ├── IPCPort.df │ │ ├── IPCPortConnect.df │ │ └── IPCSendReceive.df │ ├── Kernel │ │ ├── KeAPC.df │ │ ├── KeCrash.df │ │ ├── KeDFGlue.df │ │ ├── KeDPC.df │ │ ├── KeDispatcher.df │ │ ├── KeEvent.df │ │ ├── KeIPL.df │ │ ├── KeInternal.h │ │ ├── KeMain.df │ │ ├── KeMutex.df │ │ ├── KeProcess.df │ │ ├── KeSemaphore.df │ │ ├── KeStatistics.df │ │ ├── KeThread.df │ │ ├── KeThreadDispatcher.df │ │ ├── KeThreadWait.df │ │ ├── KeTimer.df │ │ ├── fox32 │ │ │ ├── KeException.df │ │ │ └── KeSafeAccess.df │ │ └── xr17032 │ │ │ ├── KeException.df │ │ │ └── KeSafeAccess.df │ ├── Makefile │ ├── Memory │ │ ├── MmAnonymousPage.df │ │ ├── MmEvictable.df │ │ ├── MmFasterHeap.df │ │ ├── MmFault.df │ │ ├── MmIOMap.df │ │ ├── MmInit.df │ │ ├── MmInternal.h │ │ ├── MmKernelStack.df │ │ ├── MmMDL.df │ │ ├── MmMap.df │ │ ├── MmModifiedPageWriter.df │ │ ├── MmOSCalls.df │ │ ├── MmPageAlloc.df │ │ ├── MmPool.df │ │ ├── MmPrivateAllocate.df │ │ ├── MmProcess.df │ │ ├── MmProcessHeader.df │ │ ├── MmQuota.df │ │ ├── MmSection.df │ │ ├── MmSwapWorker.df │ │ ├── MmSystemPage.df │ │ ├── MmVAD.df │ │ ├── MmViewCache.df │ │ ├── MmWorkingSetList.df │ │ ├── MmZeroPageWorker.df │ │ ├── MmZone.df │ │ ├── fox32 │ │ │ ├── MmFlushCache.df │ │ │ ├── MmPTELinear.df │ │ │ ├── MmPageDirectory.df │ │ │ └── MmPlatformInit.df │ │ └── xr17032 │ │ │ ├── MmFlushCache.df │ │ │ ├── MmPTELinear.df │ │ │ ├── MmPageDirectory.df │ │ │ └── MmPlatformInit.df │ ├── Object │ │ ├── ObCreate.df │ │ ├── ObDirectory.df │ │ ├── ObDuplicate.df │ │ ├── ObInit.df │ │ ├── ObInternal.h │ │ ├── ObOSCalls.df │ │ ├── ObObject.df │ │ └── ObWait.df │ ├── Process │ │ ├── PsCreate.df │ │ ├── PsDelete.df │ │ ├── PsInit.df │ │ ├── PsInternal.h │ │ ├── PsJob.df │ │ ├── PsOSCalls.df │ │ ├── PsProcess.df │ │ ├── PsThread.df │ │ └── PsUserEntry.df │ ├── Security │ │ ├── SeCheck.df │ │ ├── SeInit.df │ │ └── SeOSCalls.df │ └── include │ │ ├── Console.h │ │ ├── Console │ │ ├── Console.h │ │ └── VideoConsole.h │ │ ├── Executive.h │ │ ├── Executive │ │ ├── AvlTree.h │ │ ├── Boost.h │ │ ├── Call.h │ │ ├── Event.h │ │ ├── Handle.h │ │ ├── Mutex.h │ │ ├── RwLock.h │ │ ├── Semaphore.h │ │ ├── Shutdown.h │ │ └── Timer.h │ │ ├── FSRTL.h │ │ ├── FSRTL │ │ └── FSVolume.h │ │ ├── IO.h │ │ ├── IO │ │ ├── Cache.h │ │ ├── Device.h │ │ ├── Dispatch.h │ │ ├── Filesystem.h │ │ ├── IO.h │ │ ├── Packet.h │ │ ├── PageFile.h │ │ ├── Partition.h │ │ └── ReadWrite.h │ │ ├── IPC.h │ │ ├── IPC │ │ └── Port.h │ │ ├── Kernel.h │ │ ├── Kernel │ │ ├── APC.h │ │ ├── Crash.h │ │ ├── DPC.h │ │ ├── Dispatch.h │ │ ├── Event.h │ │ ├── IPL.h │ │ ├── Mutex.h │ │ ├── Process.h │ │ ├── Semaphore.h │ │ ├── Time.h │ │ └── Timer.h │ │ ├── Memory.h │ │ ├── Memory │ │ ├── Evict.h │ │ ├── IORegion.h │ │ ├── MDL.h │ │ ├── Memory.h │ │ ├── PTE.h │ │ ├── Pool.h │ │ ├── Process.h │ │ ├── Quota.h │ │ ├── Section.h │ │ ├── VAD.h │ │ ├── ViewCache.h │ │ └── Zone.h │ │ ├── Object.h │ │ ├── Object │ │ ├── Directory.h │ │ ├── Object.h │ │ └── Wait.h │ │ ├── Process.h │ │ ├── Process │ │ └── Process.h │ │ ├── Security.h │ │ ├── Security │ │ └── Security.h │ │ ├── Transfer.h │ │ ├── Video.h │ │ ├── Video │ │ └── Draw.h │ │ ├── ViewCache.h │ │ └── ViewCache │ │ └── ViewCache.h ├── OSLoader │ ├── LdrAisixFS.df │ ├── LdrArgs.df │ ├── LdrBitmap.df │ ├── LdrBootDrivers.df │ ├── LdrBootResources.df │ ├── LdrFileIO.df │ ├── LdrMain.df │ ├── LdrMemory.df │ ├── LdrModule.df │ ├── LdrResourceFile.df │ ├── Makefile │ ├── OSLoader.h │ ├── OSLoaderGlobal.h │ ├── XRstation │ │ ├── LdrXRstationInit.df │ │ ├── LdrXr17032Map.df │ │ ├── OSLoader.mk │ │ └── bootcode │ │ │ ├── AisixFSBoot.s │ │ │ ├── Makefile │ │ │ ├── a3xBootDescriptor.s │ │ │ └── mint.bmp │ └── fox32 │ │ ├── LdrFox32Init.df │ │ ├── LdrFox32Map.df │ │ ├── LdrFox32Video.df │ │ ├── OSLoader.mk │ │ ├── PC.8x8.hcf │ │ ├── _start.s │ │ ├── bootcode │ │ ├── AisixFSBoot.s │ │ ├── FoxJump.s │ │ └── Makefile │ │ └── fox32.h ├── SystemInit │ ├── Makefile │ ├── SiMain.df │ ├── SiSwapFiles.df │ ├── SiSystemManagement.df │ ├── SiTime.df │ └── SystemInit.h └── Window │ ├── BME │ ├── Init.df │ ├── Makefile │ └── Region.df │ ├── Drivers │ └── KinnowFB │ │ ├── Init.df │ │ └── Makefile │ └── README ├── Project.mk ├── README.md ├── Root ├── home │ └── guest │ │ └── README └── mintia │ ├── BootDrivers.txt │ ├── BootResources.txt │ ├── BootResources │ ├── Fixed.10x20.hcf │ ├── Fixed.18x18.hcf │ ├── Fixed.6x13.hcf │ ├── Haiku.6x12.hcf │ ├── Mach.8x12.hcf │ ├── PC.8x16.hcf │ ├── PC.8x8.hcf │ ├── Sony.12x24.hcf │ ├── Sony.8x16.hcf │ ├── Sun.12x22.hcf │ └── Terminus.8x16.hcf │ ├── SystemInit.cfg │ ├── SystemInit.cfg.small │ ├── boot.cmd │ ├── groups.cfg │ ├── help │ ├── 0 │ │ ├── amssrv │ │ ├── help │ │ ├── login │ │ └── systeminit │ └── 1 │ │ ├── aptdisk │ │ ├── cat │ │ ├── chgrp │ │ ├── chmod │ │ ├── chown │ │ ├── clear │ │ ├── cmd │ │ ├── cp │ │ ├── crypt │ │ ├── date │ │ ├── dd │ │ ├── dhrystone │ │ ├── echo │ │ ├── edit │ │ ├── groups │ │ ├── kill │ │ ├── killall │ │ ├── kstats │ │ ├── label │ │ ├── ls │ │ ├── mem │ │ ├── mkdir │ │ ├── mkfs_aisixfs │ │ ├── mount │ │ ├── mousedemo │ │ ├── mv │ │ ├── nvram │ │ ├── passwd │ │ ├── ps │ │ ├── pwd │ │ ├── quota │ │ ├── reboot │ │ ├── rm │ │ ├── shutdown │ │ ├── sleep │ │ ├── stress │ │ ├── swapon │ │ ├── sync │ │ ├── tee │ │ ├── time │ │ ├── trunc │ │ ├── umount │ │ ├── users │ │ ├── ver │ │ ├── view │ │ └── whoami │ ├── motd.txt │ └── users.cfg ├── SysCommand.mk ├── TextManifest ├── TextManifestSuffixed ├── XRstation.mk ├── badge-17032.png ├── badge-fox32.png ├── fox32.mk └── screenshot.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | *.h linguist-detectable=false 4 | *.fst linguist-detectable=false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | tmp/* 3 | *.o 4 | *.bin 5 | *.a3x 6 | *.img 7 | *.LOFF 8 | *.s_ 9 | *.exe 10 | *.dll 11 | *.sys 12 | *.fre 13 | *.chk 14 | DELTA.* 15 | **/.new -------------------------------------------------------------------------------- /Command.mk: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(BINROOT)/$(CMDNAME).exe 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) 6 | 7 | INCDIR := ./ 8 | 9 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /Documentation/AddressSpace.txt: -------------------------------------------------------------------------------- 1 | MINTIA Process Address Space 2 | 3 | +------------------+ - FFFFFFFF 4 | | | 5 | +------------------+ 6 | | dynamic pool | 7 | +------------------+ - B8000000 8 | | | 9 | +------------------+ 10 | | viewcache | 11 | +------------------+ - B4000000 12 | | | 13 | +------------------+ 14 | | virtually linear | 15 | | page tables | 16 | +------------------+ - B0000000 17 | | system | 18 | | structures | 19 | +------------------+ - A0000000 20 | | system binaries | 21 | +------------------+ - 80000000 22 | | 64K No-Mans-Land | 23 | +------------------+ - 7FFF0000 24 | | | 25 | +------------------+ 26 | | PEB | 27 | +------------------+ - 7FF00000 28 | | DLL heads | 29 | +------------------+ - 7FE00000 30 | | thread stacks | 31 | +------------------+ - 7FD00000 32 | | heap | 33 | +------------------+ - 7FC00000 34 | | system DLLs | 35 | +------------------+ - 70000000 36 | | user mappings | 37 | +------------------+ - 00300000 38 | | user DLLs | 39 | +------------------+ - 00200000 40 | | user executable | 41 | +------------------+ - 00100000 42 | | OSDLL | 43 | +------------------+ - 00001000 44 | | | 45 | +------------------+ - 00000000 -------------------------------------------------------------------------------- /Documentation/DLLBases.txt: -------------------------------------------------------------------------------- 1 | == system DLLs == 2 | 3 | OSKernel.exe - 0x80001000 4 | HALx.dll - 0x80101000 5 | Dragonfruit.dll - 0x80300000 6 | 7 | == generic drivers == 8 | 9 | AnalogClockTest.sys - 0x80500000 10 | AisixFS.sys - 0x80F00000 11 | Fat.sys - 0x81000000 12 | ryfs.sys - 0x81100000 13 | 14 | == XR/station drivers == 15 | 16 | AISA,kinnowfb8,1.sys - 0x80900000 17 | AISA,ebus,1.sys - 0x80A00000 18 | AISA,keyboard,2.sys - 0x80B00000 19 | AISA,mouse,1.sys - 0x80C00000 20 | 21 | == fox32 drivers == 22 | 23 | fox.sys - 0x80400000 24 | 25 | == user DLLs == 26 | 27 | OSDLL.dll - 0x1000 28 | USER PROGRAM - 0x100000 29 | 30 | ams.dll - 0x70000000 31 | mcl.dll - 0x70100000 32 | win.dll - 0x70200000 33 | bme.dll - 0x70300000 34 | 35 | == bitmap engine drivers == 36 | 37 | kinnowfb.drv - 0x71000000 38 | foxfb.drv - 0x71100000 39 | -------------------------------------------------------------------------------- /ExecManifest.XRstation: -------------------------------------------------------------------------------- 1 | /OSLoader.a3x Root/OSLoader.a3x 2 | 3 | /mintia/HALXRstation.dll Root/mintia/HALXRstation.dll 492 4 | 5 | # list of window drivers to add to the distribution image 6 | 7 | /mintia/win/kinnowfb.drv Root/mintia/win/kinnowfb.drv 493 8 | 9 | # list of drivers to add to the distribution image 10 | 11 | /mintia/BootDrivers/AISA,ebus,1.sys Root/mintia/BootDrivers/AISA,ebus,1.sys 493 12 | /mintia/BootDrivers/AISA,kinnowfb8,1.sys Root/mintia/BootDrivers/AISA,kinnowfb8,1.sys 493 13 | /mintia/BootDrivers/AISA,keyboard,2.sys Root/mintia/BootDrivers/AISA,keyboard,2.sys 493 14 | /mintia/BootDrivers/AISA,mouse,1.sys Root/mintia/BootDrivers/AISA,mouse,1.sys 493 -------------------------------------------------------------------------------- /ExecManifest.fox32: -------------------------------------------------------------------------------- 1 | /OSLoader.bin Root/OSLoader.bin 2 | 3 | /mintia/HALfox32.dll Root/mintia/HALfox32.dll 492 4 | 5 | # list of drivers to add to the distribution image 6 | 7 | /mintia/BootDrivers/fox.sys Root/mintia/BootDrivers/fox.sys 493 -------------------------------------------------------------------------------- /OS/AMS/Client/AmsClient.h: -------------------------------------------------------------------------------- 1 | extern AmsLock { -- } 2 | extern AmsUnlock { -- } 3 | 4 | externptr AmsApiPort 5 | externptr AmsSectionBase -------------------------------------------------------------------------------- /OS/AMS/Client/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(SYSROOT)/ams.dll 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) 6 | 7 | MOVEEXPR := mintiadll text=0x70000000,data=text+text_size+align,bss=data+data_size+align 8 | 9 | INCDIR := ../include/ 10 | 11 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/AMS/Server/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(SYSROOT)/amssrv.exe 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) 6 | 7 | MOVEEXPR := mintia 8 | 9 | INCDIR := ../include/ 10 | 11 | EXECFILEMODE := 492 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/AMS/Server/README: -------------------------------------------------------------------------------- 1 | This is a very simple implementation of the Authority Management Server (AMS) 2 | for MINTIA. This version only has the capacity to deal with a local "database" of 3 | users and groups, but the IPC interface is supposed to allow a future networked 4 | sign-on system mediated locally by this server. This implementation should not be 5 | taken as authoritative on the future workings of the AMS and is a placeholder. 6 | -------------------------------------------------------------------------------- /OS/BootDrivers/AisixFS/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/AisixFS.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80F00000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR):./ 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/AnalogClockTest/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/AnalogClockTest.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80500000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/Fat/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/Fat.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x81000000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR):./ 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/RyFS/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/ryfs.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x81100000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR):./ 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/XRstation/EBus/DriverEBus.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the EBus enumeration driver. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/OSDLL/OS.h" 8 | 9 | #include "/HALLog.h" 10 | #include "/HALDriver.h" 11 | #include "/HALRTC.h" 12 | #include "/HALXRstationEBus.h" 13 | #include "/HALInterrupt.h" 14 | #include "/HALCPU.h" 15 | 16 | #include "/Kernel.h" 17 | 18 | #include "/Executive.h" 19 | 20 | #include "/Memory.h" 21 | 22 | #include "/IO.h" 23 | 24 | const EBusSlotsStart 0xC0000000 25 | const EBusSlots 7 26 | const EBusSlotSpace 0x8000000 27 | const EBusBoardMagic 0x0C007CA1 28 | 29 | struct EBusIDROM 30 | 4 Magic 31 | 4 MID 32 | 16 Name 33 | 4 DriverROMOffset 34 | endstruct 35 | 36 | fn (FDriverInit) DriverInitEBus { stage -- ok } 37 | pointerof EBusEnumerate HALXRstationEBusEnumerateFunction! 38 | 0 ok! 39 | end 40 | 41 | fn (HALXRstationEBusEnumerateF) EBusEnumerate { func mid -- count } 42 | // loop all the boards on the bus and call the provided function for each 43 | // one found with the given MID. 44 | 45 | auto i 46 | 0 i! 47 | 48 | 0 count! 49 | 50 | auto phyaddr 51 | EBusSlotsStart phyaddr! 52 | 53 | auto vaddr 54 | 55 | while (i@ EBusSlots <) 56 | auto ok 57 | MMIO_NOCACHE // cached 58 | 512 // length 59 | phyaddr@ // phyaddr 60 | MmIORegionMap ok! vaddr! 61 | 62 | if (ok@) 63 | return 64 | end 65 | 66 | if (vaddr@ EBusIDROM_Magic + @ EBusBoardMagic ==) 67 | if (vaddr@ EBusIDROM_MID + @ mid@ ==) 68 | i@ // slotid 69 | phyaddr@ // phyaddr 70 | func@ HALXRstationEBusCallbackF 71 | end 72 | end 73 | 74 | 512 // length 75 | vaddr@ // vaddr 76 | MmIORegionUnmap 77 | 78 | EBusSlotSpace phyaddr += 79 | 1 i += 80 | end 81 | end -------------------------------------------------------------------------------- /OS/BootDrivers/XRstation/EBus/DriverSystem.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the XR/station system driver. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/OSDLL/OS.h" 8 | 9 | #include "/HALLog.h" 10 | #include "/HALDriver.h" 11 | #include "/HALRTC.h" 12 | #include "/HALXRstationEBus.h" 13 | #include "/HALInterrupt.h" 14 | #include "/HALCPU.h" 15 | 16 | extern DriverInitEBus { stage -- ok } 17 | extern DriverInitRTC { stage -- ok } 18 | extern DriverInitDKS { stage -- ok } 19 | extern DriverInitSerial { stage -- ok } 20 | 21 | fn (FDriverInit) DriverInit { stage -- ok } 22 | stage@ DriverInitEBus ok! 23 | 24 | if (ok@) 25 | return 26 | end 27 | 28 | stage@ DriverInitRTC ok! 29 | 30 | if (ok@) 31 | return 32 | end 33 | 34 | stage@ DriverInitSerial ok! 35 | 36 | if (ok@) 37 | return 38 | end 39 | 40 | stage@ DriverInitDKS ok! 41 | 42 | if (ok@) 43 | return 44 | end 45 | end -------------------------------------------------------------------------------- /OS/BootDrivers/XRstation/EBus/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/AISA,ebus,1.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80A00000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/XRstation/Keyboard/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/AISA,keyboard,2.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80B00000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/XRstation/KinnowFB/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/AISA,kinnowfb8,1.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80900000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/XRstation/Mouse/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/AISA,mouse,1.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80C00000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/BootDrivers/fox32/foxmobo/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(DRIVERROOT)/fox.sys 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80400000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/Commands/aptdisk/IDisk.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | var DiskNode 0 6 | public DiskNode 7 | 8 | buffer DiskInfo OSFileInformation_SIZEOF 9 | public DiskInfo 10 | 11 | fn IDiskInit { path -- } 12 | auto ok 13 | OSFILETYPE_ANY // filetype 14 | OSFILEFLAG_NOCACHE // flags 15 | ACCESS_READ ACCESS_WRITE | // access 16 | path@ // path 17 | OSFileOpen ok! DiskNode! 18 | 19 | if (ok@) 20 | ok@ OSStatusGetName path@ "aptdisk: %s: %s\n" OSError 21 | end 22 | 23 | DiskNode@ // filehandle 24 | DiskInfo // query 25 | OSFileQuery ok! 26 | 27 | if (ok@) 28 | ok@ OSStatusGetName path@ "aptdisk: couldn't stat %s: %s\n" OSError 29 | end 30 | end 31 | 32 | fn IReadBlock { block buf -- } 33 | auto ok 34 | block@ 512 * // offset 35 | DiskNode@ // handle 36 | OSSEEK_SET // mode 37 | OSFileSeek ok! drop 38 | 39 | if (ok@) 40 | ok@ OSStatusGetName block@ "aptdisk: couldn't seek to block %d: %s\n" OSError 41 | end 42 | 43 | OSWAIT_TIMEOUTINFINITE // timeout 44 | 0 // flags 45 | 512 // length 46 | buf@ // buffer 47 | DiskNode@ // filehandle 48 | OSFileRead ok! drop 49 | 50 | if (ok@) 51 | ok@ OSStatusGetName block@ "aptdisk: couldn't read block %d: %s\n" OSError 52 | end 53 | end 54 | 55 | fn IWriteBlock { block buf -- } 56 | auto ok 57 | block@ 512 * // offset 58 | DiskNode@ // handle 59 | OSSEEK_SET // mode 60 | OSFileSeek ok! drop 61 | 62 | if (ok@) 63 | ok@ OSStatusGetName block@ "aptdisk: couldn't seek to block %d: %s\n" OSError 64 | end 65 | 66 | 0 // flags 67 | 512 // length 68 | buf@ // buffer 69 | DiskNode@ // filehandle 70 | OSFileWrite ok! drop 71 | 72 | if (ok@) 73 | ok@ OSStatusGetName block@ "aptdisk: couldn't write block %d: %s\n" OSError 74 | end 75 | end -------------------------------------------------------------------------------- /OS/Commands/aptdisk/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | // ported from aisix standalone program "limnvol.a3x" 6 | 7 | extern IDiskInit { bootdev -- } 8 | extern Prompt { -- } 9 | extern PromptYN { ... fmt -- r } 10 | 11 | fn Usage { -- } 12 | "usage: aptdisk [disk path]\n" OSGetStdErr FPrintf 13 | end 14 | 15 | fn Main { ... -- ret } 16 | 0 ret! 17 | 18 | if (argc@ 2 ~=) 19 | Usage 20 | -1 OSExit 21 | end 22 | 23 | auto path 24 | [1]argv@ path! 25 | 26 | path@ IDiskInit 27 | 28 | while (1) 29 | Prompt 30 | end 31 | end -------------------------------------------------------------------------------- /OS/Commands/aptdisk/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = aptdisk 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/cat/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = cat 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/chgrp/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | #include "/AMS/Ams.h" 5 | 6 | fn private Usage { -- } 7 | "usage: chgrp group file\n" OSGetStdErr FPrintf 8 | end 9 | 10 | fn Main { ... -- ret } 11 | 0 ret! 12 | 13 | if (argc@ 3 ~=) 14 | Usage 15 | -1 OSExit 16 | end 17 | 18 | auto gid 19 | 20 | if ([1]argv@ gb '0' >= [1]argv@ gb '9' <= &&) 21 | [1]argv@ atoi gid! 22 | end else 23 | AmsInit ret! 24 | 25 | if (ret@) 26 | ret@ OSStatusGetName "chgrp: couldn't connect to AMS: %s\n" OSError 27 | end 28 | 29 | [1]argv@ // groupname 30 | AmsQueryGIDByName ret! gid! 31 | 32 | if (ret@) 33 | ret@ OSStatusGetName [1]argv@ "chgrp: %s: %s\n" OSError 34 | end 35 | end 36 | 37 | auto handle 38 | OSFILETYPE_ANY // filetype 39 | 0 // flags 40 | 0 // access 41 | [2]argv@ // path 42 | OSFileOpen ret! handle! 43 | 44 | if (ret@) 45 | ret@ OSStatusGetName [2]argv@ "chgrp: %s: %s\n" OSError 46 | end 47 | 48 | -1 // uid 49 | gid@ // gid 50 | -1 // permissions 51 | handle@ // handle 52 | OSSetSecurity ret! 53 | 54 | if (ret@) 55 | ret@ OSStatusGetName [2]argv@ "chgrp: %s: %s\n" OSError 56 | end 57 | 58 | handle@ OSClose drop 59 | end -------------------------------------------------------------------------------- /OS/Commands/chgrp/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = chgrp 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/chmod/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn private Usage { -- } 6 | "usage: chmod permissions file\n" OSGetStdErr FPrintf 7 | end 8 | 9 | fn Main { ... -- ret } 10 | 0 ret! 11 | 12 | if (argc@ 3 ~=) 13 | Usage 14 | -1 OSExit 15 | end 16 | 17 | auto handle 18 | OSFILETYPE_ANY // filetype 19 | 0 // flags 20 | 0 // access 21 | [2]argv@ // path 22 | OSFileOpen ret! handle! 23 | 24 | if (ret@) 25 | ret@ OSStatusGetName [2]argv@ "chmod: %s: %s\n" OSError 26 | end 27 | 28 | -1 // uid 29 | -1 // gid 30 | [1]argv@ atoi // permissions 31 | handle@ // handle 32 | OSSetSecurity ret! 33 | 34 | if (ret@) 35 | ret@ OSStatusGetName [2]argv@ "chmod: %s: %s\n" OSError 36 | end 37 | 38 | handle@ OSClose drop 39 | end -------------------------------------------------------------------------------- /OS/Commands/chmod/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = chmod 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/chown/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | #include "/AMS/Ams.h" 5 | 6 | fn private Usage { -- } 7 | "usage: chown owner file\n" OSGetStdErr FPrintf 8 | end 9 | 10 | fn Main { ... -- ret } 11 | 0 ret! 12 | 13 | if (argc@ 3 ~=) 14 | Usage 15 | -1 OSExit 16 | end 17 | 18 | auto uid 19 | 20 | if ([1]argv@ gb '0' >= [1]argv@ gb '9' <= &&) 21 | [1]argv@ atoi uid! 22 | end else 23 | AmsInit ret! 24 | 25 | if (ret@) 26 | ret@ OSStatusGetName "chown: couldn't connect to AMS: %s\n" OSError 27 | end 28 | 29 | [1]argv@ // username 30 | AmsQueryUIDByName ret! uid! 31 | 32 | if (ret@) 33 | ret@ OSStatusGetName [1]argv@ "chown: %s: %s\n" OSError 34 | end 35 | end 36 | 37 | auto handle 38 | OSFILETYPE_ANY // filetype 39 | 0 // flags 40 | 0 // access 41 | [2]argv@ // path 42 | OSFileOpen ret! handle! 43 | 44 | if (ret@) 45 | ret@ OSStatusGetName [2]argv@ "chown: %s: %s\n" OSError 46 | end 47 | 48 | uid@ // uid 49 | -1 // gid 50 | -1 // permissions 51 | handle@ // handle 52 | OSSetSecurity ret! 53 | 54 | if (ret@) 55 | ret@ OSStatusGetName [2]argv@ "chown: %s: %s\n" OSError 56 | end 57 | 58 | handle@ OSClose drop 59 | end -------------------------------------------------------------------------------- /OS/Commands/chown/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = chown 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/clear/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Main { ... -- ret } 6 | 0 ret! 7 | 8 | "\[[0m\[[1;1H\[[2J" Printf 9 | OSFlushLine 10 | end -------------------------------------------------------------------------------- /OS/Commands/clear/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = clear 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/cmd/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += mcl.dll:$(MCLBIN) 2 | 3 | CMDNAME = cmd 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/cp/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = cp 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/crypt/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | #include "/OSDLL/OSCrypt.h" 6 | 7 | fn Usage { -- } 8 | "usage: crypt string salt\n" OSGetStdErr FPrintf 9 | end 10 | 11 | fn Main { ... -- ret } 12 | 0 ret! 13 | 14 | if (argc@ 3 ~=) 15 | Usage 16 | -1 OSExit 17 | end 18 | 19 | auto hash 20 | 16 alloc hash! 21 | 22 | [1]argv@ // string 23 | [2]argv@ gb [2]argv@ 1 + gb 8 << | // salt 24 | hash@ // hash 25 | OSSimpleCrypt 26 | 27 | hash@ "%s\n" Printf 28 | end -------------------------------------------------------------------------------- /OS/Commands/crypt/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = crypt 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/date/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = date 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/dd/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = dd 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/dhrystone/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = dhrystone 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/echo/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Main { ... -- ret } 6 | 0 ret! 7 | 8 | auto i 9 | 1 i! 10 | 11 | while (i@ argc@ <) 12 | [i@]argv@ "%s" Printf 13 | 14 | if (i@ argc@ 1 - ~=) 15 | ' ' Putc 16 | end 17 | 18 | 1 i += 19 | end 20 | 21 | '\n' Putc 22 | end -------------------------------------------------------------------------------- /OS/Commands/echo/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = echo 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/edit/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | #include "Edit.h" 6 | 7 | fn private Usage { -- } 8 | "usage: edit [file]\n" OSGetStdErr FPrintf 9 | end 10 | 11 | fn Main { ... -- ret } 12 | 0 ret! 13 | 14 | if (argc@ 2 >) 15 | Usage 16 | -1 OSExit 17 | end 18 | 19 | if (argc@ 1 ==) 20 | "Unnamed" EditorFileName! 21 | ACCESS_READ ACCESS_WRITE | EditorFileAccess! 22 | end else 23 | [1]argv@ EditorFileName! 24 | 25 | OSFILETYPE_FILE // filetype 26 | 0 // flags 27 | ACCESS_READ ACCESS_WRITE | // access 28 | [1]argv@ // path 29 | OSFileOpen ret! EditorFileHandle! 30 | 31 | if (ret@ STATUS_NOT_FOUND ==) 32 | OSNONE EditorFileHandle! 33 | ACCESS_READ ACCESS_WRITE | EditorFileAccess! 34 | end elseif (ret@) 35 | if (ret@ STATUS_PERMISSION_DENIED ~=) 36 | ret@ OSStatusGetName [1]argv@ "edit: %s: %s\n" OSError 37 | end 38 | 39 | // try to open it read-only 40 | 41 | OSFILETYPE_FILE // filetype 42 | 0 // flags 43 | ACCESS_READ // access 44 | [1]argv@ // path 45 | OSFileOpen ret! EditorFileHandle! 46 | 47 | if (ret@) 48 | if (ret@ STATUS_NOT_FOUND ==) 49 | STATUS_PERMISSION_DENIED ret! 50 | end 51 | 52 | ret@ OSStatusGetName [1]argv@ "edit: %s: %s\n" OSError 53 | end 54 | 55 | ACCESS_READ EditorFileAccess! 56 | end else 57 | ACCESS_READ ACCESS_WRITE | EditorFileAccess! 58 | end 59 | end 60 | 61 | Editor 62 | end -------------------------------------------------------------------------------- /OS/Commands/edit/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = edit 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/edit/Terminal.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | #include "/OSDLL/OSConsoleControl.h" 5 | 6 | var TermWidth 0 7 | public TermWidth 8 | 9 | var TermHeight 0 10 | public TermHeight 11 | 12 | fn TermInit { -- } 13 | auto ok 14 | OSGetStdOut OSConsoleQuerySize ok! TermHeight! TermWidth! 15 | 16 | if (ok@) 17 | ok@ OSStatusGetName "couldn't determine terminal size: %s\n" OSError 18 | end 19 | end 20 | 21 | fn TermSetMode { -- } 22 | OSCONSOLEMODE_RAW // arg2 23 | OSCONSOLEIOCONTROL_SETMODE // arg1 24 | OSGetStdOut // filehandle 25 | OSIOControl drop drop 26 | end 27 | 28 | fn TermResetMode { -- } 29 | 0 // arg2 30 | OSCONSOLEIOCONTROL_RESETMODE // arg1 31 | OSGetStdOut // filehandle 32 | OSIOControl drop drop 33 | end 34 | 35 | fn TermSetCursorPosition { x y -- } 36 | x@ 1 + y@ 1 + "\[[%d;%dH" Printf 37 | end 38 | 39 | fn TermSetCursorHidden { hidden -- } 40 | if (hidden@) 41 | "\[[?25l" Puts 42 | end else 43 | "\[[?25h" Puts 44 | end 45 | end 46 | 47 | fn TermClearAll { -- } 48 | "\[[2J" Puts 49 | end 50 | 51 | fn TermClearLineAll { -- } 52 | "\[[2K" Puts 53 | end 54 | 55 | fn TermClearLine { -- } 56 | "\[[K" Puts 57 | end 58 | 59 | fn TermInvertColor { -- } 60 | "\[[7m" Puts 61 | end 62 | 63 | fn TermResetColor { -- } 64 | "\[[0m" Puts 65 | end 66 | 67 | fn TermFinishDrawing { -- } 68 | OSFlushLine 69 | 70 | 0 // arg2 71 | OSCONSOLEIOCONTROL_EXPEDITE // arg1 72 | OSGetStdOut // filehandle 73 | OSIOControl drop drop 74 | end -------------------------------------------------------------------------------- /OS/Commands/env/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Main { ... -- ret } 6 | 0 ret! 7 | 8 | pointerof EnumerateEnv // func 9 | OSEnumerateEnvironment drop 10 | end 11 | 12 | fn (OSEnumerateEnvironmentF) EnumerateEnv { entry -- ok } 13 | entry@ "%s\n" Printf 14 | 0 ok! 15 | end -------------------------------------------------------------------------------- /OS/Commands/env/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = env 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/groups/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = groups 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/help/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = help 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/kill/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Usage { -- } 6 | "usage: kill [-sig] pid 7 | sig may either be a number or a unix-like symbolic name.\n" OSGetStdErr FPrintf 8 | end 9 | 10 | fn Main { ... -- ret } 11 | 0 ret! 12 | 13 | if (argc@ 2 < argc@ 3 > ||) 14 | Usage 15 | -1 OSExit 16 | end 17 | 18 | auto signal 19 | OSSIGNAL_TERM signal! 20 | 21 | auto pid 22 | 23 | if (argc@ 3 ==) 24 | auto signame 25 | [1]argv@ signame! 26 | 27 | if (signame@ gb '-' ~=) 28 | Usage 29 | -1 OSExit 30 | end 31 | 32 | 1 signame += 33 | 34 | if (signame@ gb '0' >= signame@ gb '9' <= &&) 35 | // its a number 36 | signame@ atoi signal! 37 | end else 38 | // its a symbolic name 39 | signame@ OSSignalGetNumber ret! signal! 40 | 41 | if (ret@) 42 | ret@ OSStatusGetName "kill: %s\n" OSError 43 | end 44 | end 45 | 46 | [2]argv@ atoi pid! 47 | end else 48 | [1]argv@ atoi pid! 49 | end 50 | 51 | auto phandle 52 | ACCESS_EXEC // access 53 | pid@ // pid 54 | OSProcessOpenByPID ret! phandle! 55 | 56 | if (ret@) 57 | if (ret@ STATUS_INVALID_HANDLE ==) 58 | // nicer error message 59 | "kill: no such process\n" OSError 60 | end 61 | 62 | ret@ OSStatusGetName "kill: %s\n" OSError 63 | end 64 | 65 | signal@ // signal 66 | phandle@ // processhandle 67 | OSProcessSignal ret! 68 | 69 | phandle@ OSClose drop 70 | 71 | if (ret@) 72 | ret@ OSStatusGetName "kill: %s\n" OSError 73 | end 74 | end -------------------------------------------------------------------------------- /OS/Commands/kill/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = kill 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/killall/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = killall 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/kstats/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | buffer Statistics OSStatistics_SIZEOF 6 | buffer LaterStatistics OSStatistics_SIZEOF 7 | 8 | fn Main { ... -- ret } 9 | 0 ret! 10 | 11 | auto timediff 12 | 0 timediff! 13 | 14 | if (argc@ 2 ==) 15 | [1]argv@ atoi timediff! 16 | end 17 | 18 | if (timediff@) 19 | "Please wait while statistics are gathered...\n" Printf 20 | end 21 | 22 | Statistics OSGetStatistics ret! 23 | 24 | if (ret@) 25 | ret@ OSStatusGetName "kstats: couldn't query stats: %s\n" OSError 26 | end 27 | 28 | if (timediff@) 29 | timediff@ OSThreadSleep drop 30 | 31 | LaterStatistics OSGetStatistics ret! 32 | 33 | if (ret@) 34 | ret@ OSStatusGetName "kstats: couldn't query stats: %s\n" OSError 35 | end 36 | 37 | '\n' Putc 38 | 39 | Statistics LaterStatistics OSStatisticsDump 40 | 41 | return 42 | end 43 | 44 | 0 Statistics OSStatisticsDump 45 | end -------------------------------------------------------------------------------- /OS/Commands/kstats/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = kstats 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/label/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | buffer MountInformation OSMountInformation_SIZEOF 6 | 7 | fn private Usage { -- } 8 | "usage: label device newlabel\n" OSGetStdErr FPrintf 9 | end 10 | 11 | fn Main { ... -- ret } 12 | 0 ret! 13 | 14 | if (argc@ 3 <) 15 | Usage 16 | -1 OSExit 17 | end 18 | 19 | MountInformation OSMountInformationInitialize 20 | 21 | OSMOUNTSET_VOLUMELABEL MountInformation OSMountInformation_SetFlags + |= 22 | 23 | MountInformation OSMountInformation_VolumeLabel + // dest 24 | [2]argv@ // src 25 | strcpy 26 | 27 | auto devhandle 28 | OSFILETYPE_ANY // filetype 29 | 0 // flags 30 | ACCESS_WRITE // access 31 | [1]argv@ // path 32 | OSFileOpen ret! devhandle! 33 | 34 | if (ret@) 35 | ret@ OSStatusGetName [1]argv@ "label: %s: %s\n" OSError 36 | end 37 | 38 | MountInformation // query 39 | devhandle@ // handle 40 | OSMountSet ret! 41 | 42 | devhandle@ OSClose drop 43 | 44 | if (ret@) 45 | ret@ OSStatusGetName [1]argv@ "label: %s: %s\n" OSError 46 | end 47 | end -------------------------------------------------------------------------------- /OS/Commands/label/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = label 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/login/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = login 4 | 5 | include $(REPO)/SysCommand.mk -------------------------------------------------------------------------------- /OS/Commands/ls/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = ls 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/mem/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = mem 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/mkdir/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Main { ... -- ret } 6 | 0 ret! 7 | 8 | auto i 9 | 1 i! 10 | 11 | while (i@ argc@ <) 12 | [i@]argv@ MkDir 13 | 14 | 1 i += 15 | end 16 | end 17 | 18 | fn MkDir { path -- } 19 | auto ok 20 | auto handle 21 | 22 | OSFILETYPE_DIRECTORY // filetype 23 | OSDEFAULTDIRPERMISSIONS // permissions 24 | OSFILEFLAG_MUSTCREATE // flags 25 | 0 // access 26 | path@ // path 27 | OSFileCreate ok! handle! 28 | 29 | if (ok@) 30 | ok@ OSStatusGetName path@ "mkdir: %s: %s\n" OSError 31 | end 32 | 33 | handle@ OSClose drop 34 | end -------------------------------------------------------------------------------- /OS/Commands/mkdir/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = mkdir 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/mkfs_aisixfs/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = mkfs_aisixfs 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/mount/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = mount 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/mousedemo/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = mousedemo 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/mv/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = mv 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/nvram/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = nvram 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/oldcmd/Cmd.h: -------------------------------------------------------------------------------- 1 | externptr CmdInteractiveMode 2 | externptr CmdTokenStreamHandle 3 | 4 | externptr CmdTokenLineNumber 5 | 6 | externptr CmdLastStatusCode 7 | 8 | externptr CmdSymbolStdInHandle 9 | externptr CmdSymbolStdOutHandle 10 | externptr CmdSymbolStdErrHandle 11 | 12 | const CMDSTREAM_OK 0 13 | const CMDSTREAM_EOF 1 14 | 15 | const CMDTOKENTYPE_NORMAL 1 16 | const CMDTOKENTYPE_EOF 2 17 | const CMDTOKENTYPE_TOOBIG 3 18 | const CMDTOKENTYPE_EOL 4 19 | const CMDTOKENTYPE_INVALID 5 20 | const CMDTOKENTYPE_STRING 6 21 | 22 | extern CmdIgnoreSignals { -- } 23 | extern CmdResetSignals { -- } 24 | 25 | extern CmdDoNextStatement { -- done ok } 26 | 27 | extern CmdGetNextToken { tokenbuf bufsize issyntactic -- length tokentype ok } 28 | 29 | struct CmdSymbol 30 | 4 Name 31 | 4 Contents 32 | 33 | 4 Next 34 | 4 Prev 35 | endstruct 36 | 37 | extern CmdSymbolGet { name -- contents ok } 38 | extern CmdSymbolFind { name -- sym ok } 39 | extern CmdSymbolSet { contents name -- sym ok } 40 | extern CmdSymbolDeletePtr { sym -- } 41 | extern CmdSymbolDelete { name -- ok } 42 | 43 | extern CmdSymbolSetStdIOHandle { trunc path access retptr -- ok } 44 | extern CmdSymbolSetStdIO { -- oldstdin oldstdout oldstderr } 45 | extern CmdSymbolGetStdIOHandles { -- stdin stdout stderr ok } 46 | 47 | fnptr CmdBuiltinF { argvt argcn -- ret ok } 48 | 49 | extern CmdBuiltinRun { argvt argcn -- ran ok } -------------------------------------------------------------------------------- /OS/Commands/oldcmd/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | #include "Cmd.h" 6 | 7 | var CmdInteractiveMode 0 8 | public CmdInteractiveMode 9 | 10 | fn (OSSignalHandler) SignalInterrupt { context signum -- } 11 | // do nothing 12 | end 13 | 14 | fn CmdIgnoreSignals { -- } 15 | OSSIGNALACTION_IGNORE // action 16 | OSSIGNAL_INT // signum 17 | OSSignalSetAction drop 18 | 19 | OSSIGNALACTION_IGNORE // action 20 | OSSIGNAL_QUIT // signum 21 | OSSignalSetAction drop 22 | end 23 | 24 | fn CmdResetSignals { -- } 25 | pointerof SignalInterrupt // action 26 | OSSIGNAL_INT // signum 27 | OSSignalSetAction drop 28 | 29 | pointerof SignalInterrupt // action 30 | OSSIGNAL_QUIT // signum 31 | OSSignalSetAction drop 32 | end 33 | 34 | fn Main { ... -- ret } 35 | auto pwd 36 | auto ok 37 | 0 ok! 38 | 39 | CmdResetSignals 40 | 41 | 1 CmdInteractiveMode! 42 | OSGetStdIn CmdTokenStreamHandle! 43 | 44 | while (1) 45 | if (CmdInteractiveMode@) 46 | "PWD" OSFindEnvironmentVariable ok! pwd! drop 47 | 48 | if (ok@) 49 | "?" pwd! 50 | end else 51 | pwd@ OSLastComponent pwd! 52 | end 53 | 54 | pwd@ "%s # " Printf 55 | OSFlushLine 56 | end 57 | 58 | auto done 59 | CmdDoNextStatement ok! done! 60 | 61 | if (ok@) 62 | if (ok@ STATUS_SIGNALLED ~=) 63 | ok@ OSStatusGetName "cmd: CmdDoNextStatement: %s\n" OSError 64 | end else 65 | "\n" Printf 66 | 0 done! 67 | end 68 | end 69 | 70 | if (done@ 1 ==) 71 | 0 ret! 72 | return 73 | end 74 | end 75 | end -------------------------------------------------------------------------------- /OS/Commands/oldcmd/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = oldcmd 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/passwd/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = passwd 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/ps/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = ps 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/pwd/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | buffer CWDBuf OSFILEPATHMAX 6 | 7 | fn Main { ... -- ret } 8 | CWDBuf // cwd 9 | OSFILEPATHMAX // bufsize 10 | OSGetCWD ret! 11 | 12 | if (ret@) 13 | ret@ OSStatusGetName "pwd: %s\n" OSError 14 | end 15 | 16 | CWDBuf "%s\n" Printf 17 | end -------------------------------------------------------------------------------- /OS/Commands/pwd/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = pwd 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/quota/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | buffer QuotaInformation OSQuotaInformation_SIZEOF 6 | 7 | buffer MemoryInformation OSMemoryInformation_SIZEOF 8 | 9 | fn Main { ... -- ret } 10 | 0 ret! 11 | 12 | QuotaInformation // query 13 | OSCURRENTPROCESS // processhandle 14 | OSQuotaQuery ret! 15 | 16 | if (ret@) 17 | ret@ OSStatusGetName "quota: couldn't query quota: %s\n" OSError 18 | end 19 | 20 | "User Limits:\n" Printf 21 | 22 | QuotaInformation OSQuotaInformation_PoolMaximum + @ 23 | QuotaInformation OSQuotaInformation_PoolUsed + @ 24 | " Nonpaged pool: %d bytes / %d bytes\n" Printf 25 | 26 | QuotaInformation OSQuotaInformation_PagedPoolMaximum + @ 27 | QuotaInformation OSQuotaInformation_PagedPoolUsed + @ 28 | " Paged pool: %d bytes / %d bytes\n" Printf 29 | 30 | QuotaInformation OSQuotaInformation_VirtualMemoryMaximum + @ 31 | QuotaInformation OSQuotaInformation_VirtualMemoryUsed + @ 32 | " Virtual memory: %d bytes / %d bytes\n" Printf 33 | 34 | QuotaInformation OSQuotaInformation_WorkingSetMaximum + @ 35 | QuotaInformation OSQuotaInformation_WorkingSetUsed + @ 36 | " Working set: %d pages / %d pages\n" Printf 37 | 38 | MemoryInformation // query 39 | OSMemoryQuery ret! 40 | 41 | if (ret@) 42 | ret@ OSStatusGetName "quota: couldn't query memory: %s\n" OSError 43 | end 44 | 45 | "\nSystem Limits:\n" Printf 46 | 47 | MemoryInformation OSMemoryInformation_CommitLimit + @ 48 | MemoryInformation OSMemoryInformation_CommitUsage + @ 49 | " Commit: %d pages / %d pages\n" Printf 50 | 51 | MemoryInformation OSMemoryInformation_PhysicalCommitLimit + @ 52 | MemoryInformation OSMemoryInformation_PhysicalCommitUsage + @ 53 | " NP Commit: %d pages / %d pages\n" Printf 54 | end -------------------------------------------------------------------------------- /OS/Commands/quota/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = quota 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/reboot/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Main { ... -- ret } 6 | OSSHUTDOWN_REBOOT OSShutdownSystem ret! 7 | 8 | ret@ OSStatusGetName "reboot: %s\n" OSError 9 | end -------------------------------------------------------------------------------- /OS/Commands/reboot/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = reboot 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/rm/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = rm 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/shutdown/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Main { ... -- ret } 6 | OSSHUTDOWN_HALT OSShutdownSystem ret! 7 | 8 | if (ret@) 9 | ret@ OSStatusGetName "shutdown: %s\n" OSError 10 | end 11 | end -------------------------------------------------------------------------------- /OS/Commands/shutdown/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = shutdown 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/sleep/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Usage { -- } 6 | "usage: sleep secs\n" OSGetStdErr FPrintf 7 | end 8 | 9 | fn Main { ... -- ret } 10 | 0 ret! 11 | 12 | if (argc@ 2 ~=) 13 | Usage 14 | -1 OSExit 15 | end 16 | 17 | [1]argv@ atoi 1000 * OSThreadSleep drop 18 | end -------------------------------------------------------------------------------- /OS/Commands/sleep/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = sleep 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/stress/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = stress 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/stress/Stress.h: -------------------------------------------------------------------------------- 1 | fnptr StressTestF { -- ok } 2 | 3 | extern ForkbombTest { -- ok } 4 | extern SwapTest { -- ok } 5 | extern NullptrTest { -- ok } 6 | extern OverflowTest { -- ok } 7 | extern FastMutexTest { -- ok } 8 | extern StreamReadTest { -- ok } 9 | extern StreamWriteTest { -- ok } 10 | extern ConfigReadTest { -- ok } 11 | extern ConfigWriteTest { -- ok } 12 | extern IPCTestServer { -- ok } 13 | extern IPCTestClient { -- ok } 14 | extern InfiniteLoopTest { -- ok } 15 | extern CacheFloodTest { -- ok } 16 | extern AsyncIOTest { -- ok } 17 | extern OpenCloseTest { -- ok } 18 | extern NullSysTest { -- ok } 19 | extern SysAbort { -- ok } 20 | extern JobsTest { -- ok } 21 | extern AsyncIOEventTest { -- ok } 22 | 23 | externptr ArgTable 24 | externptr ArgCount -------------------------------------------------------------------------------- /OS/Commands/swapon/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn private Usage { -- } 6 | "usage: swapon [path minsize maxsize priority]\n" OSGetStdErr FPrintf 7 | end 8 | 9 | fn Main { ... -- ret } 10 | 0 ret! 11 | 12 | if (argc@ 1 ==) 13 | OSPageFileInformationDump 14 | return 15 | end 16 | 17 | if (argc@ 5 ~=) 18 | Usage 19 | -1 ret! 20 | return 21 | end 22 | 23 | auto file 24 | [1]argv@ file! 25 | 26 | auto minsize 27 | [2]argv@ atoi minsize! 28 | 29 | auto maxsize 30 | [3]argv@ atoi maxsize! 31 | 32 | auto priority 33 | [4]argv@ atoi priority! 34 | 35 | minsize@ OSPAGESHIFT >> // minpages 36 | maxsize@ OSPAGESHIFT >> // maxpages 37 | priority@ // pri 38 | file@ // path 39 | OSPageFileCreate ret! 40 | 41 | if (ret@) 42 | ret@ OSStatusGetName file@ "swapon: %s: %s\n" OSError 43 | end 44 | end -------------------------------------------------------------------------------- /OS/Commands/swapon/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = swapon 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/sync/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | buffer MemoryInformation OSMemoryInformation_SIZEOF 6 | 7 | fn Main { ... -- ret } 8 | 0 ret! 9 | 10 | if (argc@ 2 ==) 11 | auto handle 12 | OSFILETYPE_ANY // filetype 13 | 0 // flags 14 | ACCESS_READ // access 15 | [1]argv@ // path 16 | OSFileOpen ret! handle! 17 | 18 | if (ret@) 19 | ret@ OSStatusGetName [1]argv@ "sync: %s: %s\n" OSError 20 | end 21 | 22 | 1 // purge 23 | handle@ // filehandle 24 | OSFileFlush ret! 25 | 26 | if (ret@) 27 | ret@ OSStatusGetName [1]argv@ "sync: couldn't flush %s: %s\n" OSError 28 | end 29 | 30 | handle@ OSClose drop 31 | 32 | return 33 | end 34 | 35 | OSFlushModifiedPages ret! 36 | 37 | if (ret@) 38 | ret@ OSStatusGetName "sync: %s\n" OSError 39 | end 40 | 41 | auto tries 42 | 50 tries! 43 | 44 | while (tries@) 45 | MemoryInformation OSMemoryQuery ret! 46 | 47 | if (ret@) 48 | ret@ OSStatusGetName "sync: %s\n" OSError 49 | end 50 | 51 | if (MemoryInformation OSMemoryInformation_DirtyFileCount + @ ~~) 52 | // complete flush 53 | 54 | return 55 | end 56 | 57 | OSFlushModifiedPages ret! 58 | 59 | if (ret@) 60 | ret@ OSStatusGetName "sync: %s\n" OSError 61 | end 62 | 63 | // incomplete flush, wait 100ms and try again 64 | 65 | 100 OSThreadSleep drop 66 | 67 | 1 tries -= 68 | end 69 | 70 | "sync: incomplete flush\n" OSGetStdErr FPrintf 71 | end -------------------------------------------------------------------------------- /OS/Commands/sync/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = sync 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/tee/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = tee 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/time/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = time 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/trunc/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn Usage { -- } 6 | "usage: trunc [file] [size]\n" OSGetStdErr FPrintf 7 | end 8 | 9 | fn Main { ... -- ret } 10 | 0 ret! 11 | 12 | if (argc@ 3 ~=) 13 | Usage 14 | -1 OSExit 15 | end 16 | 17 | auto handle 18 | auto ok 19 | 20 | OSFILETYPE_ANY_STREAM // filetype 21 | OSDEFAULTFILEPERMISSIONS // permissions 22 | 0 // flags 23 | ACCESS_WRITE // access 24 | [1]argv@ // path 25 | OSFileCreate ret! handle! 26 | 27 | if (ret@) 28 | ret@ OSStatusGetName [1]argv@ "trunc: couldn't open %s: %s\n" OSError 29 | end 30 | 31 | auto oldsize 32 | [2]argv@ atoi // newsize 33 | 0 // growing 34 | handle@ // handle 35 | OSFileTruncate ret! oldsize! 36 | 37 | if (ret@) 38 | ret@ OSStatusGetName [1]argv@ "trunc: couldn't truncate %s: %s\n" OSError 39 | end 40 | 41 | handle@ OSClose drop 42 | end -------------------------------------------------------------------------------- /OS/Commands/trunc/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = trunc 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/umount/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | 5 | fn private Usage { -- } 6 | "usage: umount device\n" OSGetStdErr FPrintf 7 | end 8 | 9 | fn Main { ... -- ret } 10 | 0 ret! 11 | 12 | if (argc@ 2 <) 13 | Usage 14 | -1 OSExit 15 | end 16 | 17 | auto devhandle 18 | OSFILETYPE_ANY // filetype 19 | 0 // flags 20 | ACCESS_EXEC // access 21 | [1]argv@ // path 22 | OSFileOpen ret! devhandle! 23 | 24 | if (ret@) 25 | ret@ OSStatusGetName [1]argv@ "umount: %s: %s\n" OSError 26 | end 27 | 28 | devhandle@ OSFilesystemUnmount ret! 29 | 30 | devhandle@ OSClose drop 31 | 32 | if (ret@) 33 | ret@ OSStatusGetName [1]argv@ "umount: %s: %s\n" OSError 34 | end 35 | end -------------------------------------------------------------------------------- /OS/Commands/umount/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = umount 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/users/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = users 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/ver/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = ver 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/view/Makefile: -------------------------------------------------------------------------------- 1 | CMDNAME = view 2 | 3 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Commands/view/Pager.h: -------------------------------------------------------------------------------- 1 | // terminal control 2 | 3 | extern TermInit { -- } 4 | 5 | extern TermSetMode { -- } 6 | extern TermResetMode { -- } 7 | 8 | extern TermSetCursorPosition { x y -- } 9 | extern TermSetCursorHidden { hidden -- } 10 | 11 | extern TermClearAll { -- } 12 | extern TermClearLineAll { -- } 13 | extern TermClearLine { -- } 14 | 15 | extern TermFinishDrawing { -- } 16 | 17 | extern TermInvertColor { -- } 18 | extern TermResetColor { -- } 19 | 20 | extern TermSetScrollMargin { top bottom -- } 21 | extern TermResetScrollMargin { -- } 22 | 23 | extern TermScrollDown { -- } 24 | extern TermScrollUp { -- } 25 | 26 | externptr TermWidth 27 | externptr TermHeight -------------------------------------------------------------------------------- /OS/Commands/view/Terminal.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | #include "/OSDLL/OSConsoleControl.h" 5 | 6 | var TermWidth 0 7 | public TermWidth 8 | 9 | var TermHeight 0 10 | public TermHeight 11 | 12 | fn TermInit { -- } 13 | auto ok 14 | OSGetStdOut OSConsoleQuerySize ok! TermHeight! TermWidth! 15 | 16 | if (ok@) 17 | ok@ OSStatusGetName "couldn't determine terminal size: %s\n" OSError 18 | end 19 | end 20 | 21 | fn TermSetMode { -- } 22 | OSCONSOLEMODE_RAW // arg2 23 | OSCONSOLEIOCONTROL_SETMODE // arg1 24 | OSGetStdOut // filehandle 25 | OSIOControl drop drop 26 | end 27 | 28 | fn TermResetMode { -- } 29 | 0 // arg2 30 | OSCONSOLEIOCONTROL_RESETMODE // arg1 31 | OSGetStdOut // filehandle 32 | OSIOControl drop drop 33 | end 34 | 35 | fn TermSetScrollMargin { top bottom -- } 36 | bottom@ 1 + top@ 1 + "\[[%d;%dr" Printf 37 | end 38 | 39 | fn TermResetScrollMargin { -- } 40 | "\[[;r" Puts 41 | end 42 | 43 | fn TermScrollDown { -- } 44 | "\[[1T" Puts 45 | end 46 | 47 | fn TermScrollUp { -- } 48 | "\[[1S" Puts 49 | end 50 | 51 | fn TermSetCursorPosition { x y -- } 52 | x@ 1 + y@ 1 + "\[[%d;%dH" Printf 53 | end 54 | 55 | fn TermSetCursorHidden { hidden -- } 56 | if (hidden@) 57 | "\[[?25l" Puts 58 | end else 59 | "\[[?25h" Puts 60 | end 61 | end 62 | 63 | fn TermClearAll { -- } 64 | "\[[2J" Puts 65 | end 66 | 67 | fn TermClearLineAll { -- } 68 | "\[[2K" Puts 69 | end 70 | 71 | fn TermClearLine { -- } 72 | "\[[K" Puts 73 | end 74 | 75 | fn TermInvertColor { -- } 76 | "\[[7m" Puts 77 | end 78 | 79 | fn TermResetColor { -- } 80 | "\[[0m" Puts 81 | end 82 | 83 | fn TermFinishDrawing { -- } 84 | OSFlushLine 85 | 86 | 0 // arg2 87 | OSCONSOLEIOCONTROL_EXPEDITE // arg1 88 | OSGetStdOut // filehandle 89 | OSIOControl drop drop 90 | end -------------------------------------------------------------------------------- /OS/Commands/whoami/Main.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/OSDLL/OS.h" 4 | #include "/AMS/Ams.h" 5 | 6 | buffer ProcessInformation OSProcessInformation_SIZEOF 7 | 8 | fn Main { ... -- ret } 9 | AmsInit ret! 10 | 11 | if (ret@) 12 | ret@ OSStatusGetName "whoami: couldn't connect to AMS: %s\n" Printf 13 | end 14 | 15 | OSCURRENTPROCESS // processhandle 16 | ProcessInformation // query 17 | OSProcessQuery ret! 18 | 19 | if (ret@) 20 | ret@ OSStatusGetName "whoami: couldn't query self: %s\n" OSError 21 | end 22 | 23 | auto info 24 | AmsUserInformation_SIZEOF alloc info! 25 | 26 | info@ // info 27 | ProcessInformation OSProcessInformation_OwningUID + @ // uid 28 | AmsQueryByUID ret! 29 | 30 | if (ret@) 31 | ret@ OSStatusGetName "whoami: couldn't query UID: %s\n" OSError 32 | end 33 | 34 | info@ AmsUserInformation_UserName + "%s\n" Printf 35 | 36 | AmsFree 37 | end -------------------------------------------------------------------------------- /OS/Commands/whoami/Makefile: -------------------------------------------------------------------------------- 1 | DYLIBS += ams.dll:$(AMSBIN) 2 | 3 | CMDNAME = whoami 4 | 5 | include $(REPO)/Command.mk -------------------------------------------------------------------------------- /OS/Common/Common.h: -------------------------------------------------------------------------------- 1 | #ifdef OSLOADER 2 | 3 | const COMSTATUS_NOT_FOUND LDRSTATUS_NOT_FOUND 4 | const COMSTATUS_UNAVAILABLE_ADDRESS LDRSTATUS_ADDRESS_NOT_AVAILABLE 5 | const COMSTATUS_BAD_EXECUTABLE LDRSTATUS_BAD_EXECUTABLE 6 | const COMSTATUS_STRIPPED_EXECUTABLE LDRSTATUS_STRIPPED_EXECUTABLE 7 | const COMSTATUS_INVALID_ARGUMENT LDRSTATUS_INVALID_ARGUMENT 8 | const COMSTATUS_EXEC_NOT_FOR_ARCH LDRSTATUS_EXEC_NOT_FOR_ARCH 9 | const COMSTATUS_NO_SYMBOL LDRSTATUS_NOT_FOUND 10 | 11 | #endif 12 | 13 | #ifdef OSDLL 14 | 15 | const COMSTATUS_NOT_FOUND STATUS_NOT_FOUND 16 | const COMSTATUS_UNAVAILABLE_ADDRESS STATUS_UNAVAILABLE_ADDRESS 17 | const COMSTATUS_BAD_EXECUTABLE STATUS_BAD_EXECUTABLE 18 | const COMSTATUS_STRIPPED_EXECUTABLE STATUS_STRIPPED_EXECUTABLE 19 | const COMSTATUS_INVALID_ARGUMENT STATUS_INVALID_ARGUMENT 20 | const COMSTATUS_EXEC_NOT_FOR_ARCH STATUS_EXEC_NOT_FOR_ARCH 21 | const COMSTATUS_NO_SYMBOL STATUS_NO_SYMBOL 22 | 23 | #endif 24 | 25 | struct ComBitmapHeader 26 | 4 Data 27 | 4 SizeInBits 28 | endstruct 29 | 30 | extern ComBitmapInitialize { sizeinbits data header -- } 31 | extern ComBitmapDump { header -- } 32 | extern ComBitmapGetData { header -- data } 33 | extern ComBitmapClear { header -- } 34 | extern ComBitmapFindRun { hint runlength header -- offset ok } 35 | extern ComBitmapSetBits { runlength index header -- } 36 | extern ComBitmapClearBits { runlength index header -- } 37 | extern ComBitmapBitGet { index header -- value } 38 | extern ComBitmapCheckClearBits { runlength index header -- isclear } -------------------------------------------------------------------------------- /OS/HAL/HAL/HALArgs.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements HAL argument checking. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | #include "../../OSLoader/OSLoaderGlobal.h" 7 | 8 | var HALArgsBuffer 0 9 | 10 | buffer HALLocalArgsBuffer 256 11 | 12 | fn HALArgsInit { ldrinfo -- } 13 | fnsection "INIT$text" 14 | 15 | HALLocalArgsBuffer // dest 16 | ldrinfo@ LdrInfo_ArgsBuffer + @ // src 17 | 256 // size 18 | memcpy 19 | 20 | HALLocalArgsBuffer HALArgsBuffer! 21 | end 22 | 23 | buffer HALArgsNameBuffer 32 24 | 25 | fn HALArgsValue { arg -- out } 26 | auto p 27 | HALArgsBuffer@ p! 28 | 29 | auto tp 30 | HALArgsNameBuffer tp! 31 | 32 | auto tpm 33 | tp@ 32 + tpm! 34 | 35 | auto m 36 | p@ 255 + m! 37 | 38 | 0 out! 39 | 40 | while (p@ m@ <) 41 | if (p@ gb ~~) 42 | HALArgsNameBuffer tp! 43 | 44 | 1 p += 45 | 46 | if (p@ gb ~~) 47 | break 48 | end 49 | end elseif (p@ gb '=' ==) 50 | 0 tp@ sb 51 | 52 | if (HALArgsNameBuffer arg@ strcmp) 53 | p@ 1 + out! 54 | return 55 | end 56 | 57 | p@ strlen p += 58 | 59 | continue 60 | end 61 | 62 | p@ gb tp@ sb 63 | 64 | 1 tp += 65 | 1 p += 66 | end 67 | end 68 | 69 | fn HALArgsCheck { arg -- present } 70 | auto p 71 | HALArgsBuffer@ p! 72 | 73 | auto m 74 | p@ 255 + m! 75 | 76 | 0 present! 77 | 78 | while (p@ m@ <) 79 | if (p@ gb ~~) 80 | break 81 | end 82 | 83 | if (arg@ p@ strcmp) 84 | 1 present! 85 | return 86 | end else 87 | p@ strlen 1 + p += 88 | end 89 | end 90 | end -------------------------------------------------------------------------------- /OS/HAL/HAL/HALInterrupt.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the generic portion of interrupt support. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | #include "/HALLog.h" 7 | 8 | #include "/HALInterrupt.h" 9 | 10 | extern HALPlatformInterruptRegister { handler int ipl -- } 11 | 12 | extern HALPlatformInterruptUnregister { int -- } 13 | 14 | fn HALInterruptRegister { handler int ipl -- } 15 | handler@ int@ ipl@ HALPlatformInterruptRegister 16 | end 17 | 18 | fn HALInterruptUnregister { int -- } 19 | int@ HALPlatformInterruptUnregister 20 | end 21 | 22 | // update the table in DLLStatistics.df if you change this 23 | table HALIPLNames 24 | "IPLLOW" // 00 25 | "IPLAPC" // 01 26 | "IPLDPC" // 02 27 | "IPL03" // 03 28 | "IPLINTERACTIVE" // 04 29 | "IPLBOARDS" // 05 30 | "IPLSERIAL" // 06 31 | "IPLDISK" // 07 32 | "IPLDMA" // 08 33 | "IPL09" // 09 34 | "IPL10" // 10 35 | "IPL11" // 11 36 | "IPL12" // 12 37 | "IPL13" // 13 38 | "IPL14" // 14 39 | "IPL15" // 15 40 | "IPL16" // 16 41 | "IPL17" // 17 42 | "IPL18" // 18 43 | "IPL19" // 19 44 | "IPL20" // 20 45 | "IPL21" // 21 46 | "IPL22" // 22 47 | "IPL23" // 23 48 | "IPL24" // 24 49 | "IPL25" // 25 50 | "IPL26" // 26 51 | "IPL27" // 27 52 | "IPL28" // 28 53 | "IPLCLOCK" // 29 54 | "IPL30" // 30 55 | "IPLHIGH" // 31 56 | endtable 57 | public HALIPLNames -------------------------------------------------------------------------------- /OS/HAL/HAL/HALLog.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements message logging for the HAL. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALRTC.h" 8 | 9 | var HALLogLastSource 0 10 | 11 | fn HALLogReset { -- } 12 | 0 HALLogLastSource! 13 | end 14 | 15 | fn HALLog { ... fmt src -- } 16 | argv argc@ fmt@ src@ HALVLog 17 | end 18 | 19 | fn HALVLog { argvt argcn fmt src -- } 20 | if (src@ HALLogLastSource@ ~=) 21 | if (HALLogLastSource@) 22 | "\n" Printf 23 | end 24 | 25 | src@ HALLogLastSource! 26 | end 27 | 28 | src@ "%s: " Printf 29 | 30 | argvt@ argcn@ fmt@ VPrintf 31 | end -------------------------------------------------------------------------------- /OS/HAL/HAL/HALRTC.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements RTC driver entrypoints. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | #include "/HALLog.h" 7 | 8 | #include "/HALRTC.h" 9 | 10 | var HALRTCQueryFunction 0 11 | public HALRTCQueryFunction 12 | 13 | var HALUptimeQueryFunction 0 14 | public HALUptimeQueryFunction 15 | 16 | var HALRTCSetFunction 0 17 | public HALRTCSetFunction 18 | 19 | var HALRTCInterval 0 20 | public HALRTCInterval 21 | 22 | var HALRTCIsLocalTime 0 23 | public HALRTCIsLocalTime 24 | 25 | fn HALRTCQuery { time -- } 26 | if (HALRTCQueryFunction@ ~~) 27 | 0 time@! 28 | 0 time@ 4 + ! 29 | 30 | return 31 | end 32 | 33 | time@ HALRTCQueryFunction@ HALRTCQueryF 34 | end 35 | 36 | fn HALUptimeQuery { time -- } 37 | if (HALUptimeQueryFunction@ ~~) 38 | 0 time@! 39 | 0 time@ 4 + ! 40 | 41 | return 42 | end 43 | 44 | time@ HALUptimeQueryFunction@ HALUptimeQueryF 45 | end 46 | 47 | fn HALRTCSet { time -- ok } 48 | time@ HALRTCSetFunction@ HALRTCSetF ok! 49 | end -------------------------------------------------------------------------------- /OS/HAL/HAL/HALResource.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements boot resource management routines. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | #include "../../OSLoader/OSLoaderGlobal.h" 7 | 8 | #include "/HALLog.h" 9 | 10 | #include "/HALMap.h" 11 | 12 | var HALResourceKeepHeaders 0 13 | public HALResourceKeepHeaders 14 | 15 | var HALResourceListHead 0 16 | public HALResourceListHead 17 | 18 | fn HALResourceInit { ldrinfo -- ok } 19 | fnsection "INIT$text" 20 | 21 | ldrinfo@ LdrInfo_ResourceListHead + @ HALResourceListHead! 22 | 23 | 0 ok! 24 | end 25 | 26 | fn HALResourceByName { name -- rsrc } 27 | HALResourceListHead@ rsrc! 28 | 29 | while (rsrc@) 30 | if (rsrc@ LdrBootResource_Data + @) 31 | if (rsrc@ LdrBootResource_Name + name@ strcmp) 32 | return 33 | end 34 | end 35 | 36 | rsrc@ LdrBootResource_Next + @ rsrc! 37 | end 38 | end 39 | 40 | fn HALResourceWire { rsrc -- } 41 | 0 rsrc@ LdrBootResource_Jettison + ! 42 | end 43 | 44 | fn HALResourceData { rsrc -- data } 45 | rsrc@ LdrBootResource_Data + @ data! 46 | end -------------------------------------------------------------------------------- /OS/HAL/XRstation/HALXRstationDebug.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the default platform debug dump. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALConsole.h" 8 | 9 | extern HALCPUGetSP { -- sp } 10 | 11 | fn HALPlatformDebugDump { rows cols -- } 12 | "\n" Printf 13 | 14 | return 15 | end -------------------------------------------------------------------------------- /OS/HAL/XRstation/HALXRstationDebugSerial.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements a tiny serial driver for the serial-mode HAL console. 3 | // 4 | 5 | #include "/rta3x/a3x.h" 6 | #include "/dragonfruit.h" 7 | 8 | #include "/HALConsole.h" 9 | #include "/HALCPU.h" 10 | #include "/HALMap.h" 11 | 12 | #include "/HALXRstationCitron.h" 13 | 14 | const SERIALA_PORTCMD 0x10 15 | const SERIALA_PORTDATA 0x11 16 | 17 | const SERIALCMDWRITE 1 18 | const SERIALCMDREAD 2 19 | 20 | fn HALPlatformConsolePutc { c -- } 21 | auto rs 22 | HALCPUInterruptDisable rs! 23 | 24 | if (c@ '\n' ==) 25 | SERIALA_PORTCMD HALXRstationCitronWait 26 | '\r' SERIALA_PORTDATA HALXRstationCitronOutb 27 | end 28 | 29 | SERIALA_PORTCMD HALXRstationCitronWait 30 | c@ SERIALA_PORTDATA HALXRstationCitronOutb 31 | 32 | rs@ HALCPUInterruptRestore 33 | end 34 | 35 | fn HALPlatformConsoleGetc { -- c } 36 | auto rs 37 | HALCPUInterruptDisable rs! 38 | 39 | SERIALA_PORTDATA HALXRstationCitronIni c! 40 | 41 | rs@ HALCPUInterruptRestore 42 | 43 | if (c@ 0xFFFF ==) 44 | ERR c! return 45 | end 46 | end -------------------------------------------------------------------------------- /OS/HAL/XRstation/HALXRstationEBus.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the parts of EBus support that need to be in the HAL. 3 | // 4 | 5 | #include "/rta3x/a3x.h" 6 | #include "/dragonfruit.h" 7 | 8 | #include "/HALLog.h" 9 | #include "/HALXRstationEBus.h" 10 | 11 | #include "/HALIPL.h" 12 | #include "/HALInterrupt.h" 13 | #include "/HALCPU.h" 14 | #include "/HALCrash.h" 15 | 16 | var HALXRstationEBusEnumerateFunction 0 17 | public HALXRstationEBusEnumerateFunction 18 | 19 | fn HALXRstationEBusEnumerate { func mid -- count } 20 | auto enumfunc 21 | HALXRstationEBusEnumerateFunction@ enumfunc! 22 | 23 | if (enumfunc@ ~~) 24 | "HALXRstationEBusEnumerate: no enumerate function\n" HALCrash 25 | end 26 | 27 | func@ // func 28 | mid@ // mid 29 | enumfunc@ HALXRstationEBusEnumerateF count! 30 | end -------------------------------------------------------------------------------- /OS/HAL/XRstation/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := ../HAL . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(SYSROOT)/HAL$(PLATFORM).dll 6 | 7 | PRELIBS := LX/xr17032/rta3x/_boot.o 8 | LIBS := L/rta3x/cia3x.o 9 | DYLIBS := Dragonfruit.dll:$(DFLIBBIN) 10 | 11 | MOVEEXPR := base=0x80101000 12 | 13 | INCDIR := $(HALINCDIR) 14 | 15 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/HAL/XRstation/include/HALXRstationAmtsu.h: -------------------------------------------------------------------------------- 1 | fnptr HALXRstationAmtsuCallbackF { id -- } 2 | 3 | extern HALXRstationAmtsuSelect { num -- } 4 | 5 | extern HALXRstationAmtsuCheckMID { num -- mid } 6 | extern HALXRstationAmtsuReadMID { -- mid } 7 | 8 | extern HALXRstationAmtsuCommand { cmd -- } 9 | extern HALXRstationAmtsuCommandAsync { cmd -- } 10 | 11 | extern HALXRstationAmtsuWriteA { long -- } 12 | extern HALXRstationAmtsuWriteB { long -- } 13 | 14 | extern HALXRstationAmtsuReadA { -- long } 15 | extern HALXRstationAmtsuReadB { -- long } 16 | 17 | extern HALXRstationAmtsuSetInterrupt { dev -- } 18 | extern HALXRstationAmtsuClearInterrupt { dev -- } 19 | 20 | extern HALXRstationAmtsuSpecialCMD { a b cmd -- } 21 | 22 | extern HALXRstationAmtsuReset { -- } 23 | 24 | extern HALXRstationAmtsuEnumerate { func mid -- count } 25 | 26 | extern HALXRstationAmtsuIDToIrq { id -- irq } 27 | extern HALXRstationAmtsuIrqToID { irq -- id } -------------------------------------------------------------------------------- /OS/HAL/XRstation/include/HALXRstationCitron.h: -------------------------------------------------------------------------------- 1 | extern HALXRstationCitronInb { port -- byte } 2 | 3 | extern HALXRstationCitronIni { port -- int } 4 | 5 | extern HALXRstationCitronInl { port -- long } 6 | 7 | extern HALXRstationCitronOutb { byte port -- } 8 | 9 | extern HALXRstationCitronOuti { int port -- } 10 | 11 | extern HALXRstationCitronOutl { long port -- } 12 | 13 | extern HALXRstationCitronWait { port -- } 14 | 15 | extern HALXRstationCitronCommand { command port -- } 16 | 17 | // doesn't wait for the device to report the operation as completed before returning 18 | extern HALXRstationCitronCommandASync { command port -- } 19 | 20 | extern HALXRstationCitronCommandASyncIdle { command port -- } -------------------------------------------------------------------------------- /OS/HAL/XRstation/include/HALXRstationEBus.h: -------------------------------------------------------------------------------- 1 | fnptr HALXRstationEBusEnumerateF { func mid -- count } 2 | 3 | fnptr HALXRstationEBusCallbackF { slotid phyaddr -- } 4 | 5 | externptr HALXRstationEBusEnumerateFunction 6 | 7 | extern HALXRstationEBusEnumerate { func mid -- count } -------------------------------------------------------------------------------- /OS/HAL/XRstation/xr17032/HALXr17032FastDrawGlyph.s: -------------------------------------------------------------------------------- 1 | .section text 2 | 3 | ;a0 - glyph addr 4 | ;a1 - fb modulo 5 | ;a2 - start addr 6 | ;a3 - height 7 | ;sp+4 - background 8 | ;sp+8 - width 9 | ;sp+12 - foreground 10 | HALCPUFastDrawGlyphBackwards: ;lowest bit is leftmost 11 | .global HALCPUFastDrawGlyphBackwards 12 | mov t5, long [sp + 4] 13 | 14 | .yloop: 15 | subi a3, a3, 1 16 | 17 | mov t1, long [sp + 8] 18 | 19 | mov t2, byte [a0] 20 | 21 | .xloop: 22 | subi t1, t1, 1 23 | 24 | mov t4, t5 25 | 26 | rshi t2, t2, 1 27 | andi t3, t2, 1 28 | beq t3, .nopix 29 | 30 | mov t4, long [sp + 12] 31 | 32 | .nopix: 33 | mov byte [a2], t4 34 | 35 | addi a2, a2, 1 36 | bne t1, .xloop 37 | 38 | addi a0, a0, 1 39 | add a2, a2, a1 40 | bne a3, .yloop 41 | 42 | ret 43 | 44 | ;a0 - glyph addr 45 | ;a1 - fb modulo 46 | ;a2 - start addr 47 | ;a3 - height 48 | ;sp+4 - background 49 | ;sp+8 - width 50 | ;sp+12 - foreground 51 | HALCPUFastDrawGlyph: ;highest bit is leftmost 52 | .global HALCPUFastDrawGlyph 53 | mov t5, long [sp + 4] 54 | 55 | .yloop: 56 | subi a3, a3, 1 57 | 58 | mov t1, long [sp + 8] 59 | 60 | mov t2, byte [a0] 61 | 62 | .xloop: 63 | subi t1, t1, 1 64 | 65 | mov t4, t5 66 | 67 | rsh t3, t2, t1 68 | andi t3, t3, 1 69 | beq t3, .nopix 70 | 71 | mov t4, long [sp + 12] 72 | 73 | .nopix: 74 | mov byte [a2], t4 75 | 76 | addi a2, a2, 1 77 | bne t1, .xloop 78 | 79 | addi a0, a0, 1 80 | add a2, a2, a1 81 | bne a3, .yloop 82 | 83 | ret -------------------------------------------------------------------------------- /OS/HAL/XRstation/xr17032/HALXr17032Halt.s: -------------------------------------------------------------------------------- 1 | .section text 2 | 3 | HALCPUHalt: 4 | .global HALCPUHalt 5 | subi sp, sp, 4 6 | mov long [sp], lr 7 | 8 | hlt 9 | 10 | addi sp, sp, 4 11 | ret 12 | 13 | HALXr17032Reset: 14 | .global HALXr17032Reset 15 | mtcr eb, zero 16 | .dl 0 ;this is an invalid instruction 17 | .wait: 18 | b .wait -------------------------------------------------------------------------------- /OS/HAL/XRstation/xr17032/HALXr17032Init.s: -------------------------------------------------------------------------------- 1 | .extern HALXr17032ExceptionVector 2 | 3 | .section text 4 | 5 | HALXr17032SavedEV: 6 | .global HALXr17032SavedEV 7 | .dl 0 8 | 9 | HALCPUExit: 10 | .global HALCPUExit 11 | mov t0, long [HALXr17032SavedEV] 12 | mtcr eb, t0 13 | 14 | ret 15 | 16 | ; code sp -- 17 | HALXr17032Exit: 18 | .global HALXr17032Exit 19 | mov sp, a0 20 | mov a0, a1 21 | 22 | mov lr, long [sp] 23 | addi sp, sp, 4 24 | 25 | ret -------------------------------------------------------------------------------- /OS/HAL/fox32/HALfox32Debug.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the default platform debug dump. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALConsole.h" 8 | 9 | extern HALCPUGetSP { -- sp } 10 | 11 | fn HALPlatformDebugDump { rows cols -- } 12 | "\n" Printf 13 | 14 | return 15 | end -------------------------------------------------------------------------------- /OS/HAL/fox32/HALfox32DebugSerial.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements a tiny serial driver for the serial-mode HAL console. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALConsole.h" 8 | #include "/HALCPU.h" 9 | #include "/HALMap.h" 10 | 11 | fn HALPlatformConsolePutc { c -- } 12 | 13 | end 14 | 15 | fn HALPlatformConsoleGetc { -- c } 16 | 17 | end -------------------------------------------------------------------------------- /OS/HAL/fox32/HALfox32IPL.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the platform-dependent part of interrupt support 3 | // 4 | 5 | #include "/rta3x/a3x.h" 6 | #include "/dragonfruit.h" 7 | #include "../../OSLoader/OSLoaderGlobal.h" 8 | 9 | #include "/HALLog.h" 10 | 11 | #include "/HALMap.h" 12 | #include "/HALIPL.h" 13 | #include "/HALInterrupt.h" 14 | #include "/HALCPU.h" 15 | #include "/HALCrash.h" 16 | 17 | #include "/OSDLL/OS.h" 18 | 19 | var KeIPLCurrent IPLDPC 20 | public KeIPLCurrent 21 | 22 | table HALPlatformInterruptHandlers[256] 23 | public HALPlatformInterruptHandlers 24 | 25 | fn HALfox32InterruptInit { -- } 26 | auto i 27 | 0 i! 28 | 29 | while (i@ 256 <) 30 | pointerof HALfox32InterruptSpurious [i@]HALPlatformInterruptHandlers! 31 | 32 | 1 i += 33 | end 34 | end 35 | 36 | fn HALPlatformInterruptRegister { handler int ipl -- } 37 | if ([int@]HALPlatformInterruptHandlers@ pointerof HALfox32InterruptSpurious ~=) 38 | int@ "HALPlatformInterruptRegister: attempt to register IRQ #%d twice\n" HALCrash 39 | end 40 | 41 | handler@ [int@]HALPlatformInterruptHandlers! 42 | end 43 | 44 | fn HALPlatformInterruptUnregister { int -- } 45 | auto spf 46 | pointerof HALfox32InterruptSpurious spf! 47 | 48 | if ([int@]HALPlatformInterruptHandlers@ spf@ ==) 49 | int@ "HALPlatformInterruptUnregister: attempt to unregister IRQ #%d; wasn't registered\n" HALCrash 50 | end 51 | 52 | spf@ [int@]HALPlatformInterruptHandlers! 53 | end 54 | 55 | fn (HALInterruptHandler) HALfox32InterruptSpurious { trapframe int -- } 56 | int@ "spurious interrupt: 0x%x\n" HALCrash 57 | end -------------------------------------------------------------------------------- /OS/HAL/fox32/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := ../HAL . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(SYSROOT)/HAL$(PLATFORM).dll 6 | 7 | DYLIBS := Dragonfruit.dll:$(DFLIBBIN) 8 | 9 | MOVEEXPR := base=0x80101000 10 | 11 | INCDIR := $(HALINCDIR) 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/HAL/fox32/fox32/HALfox32Halt.s: -------------------------------------------------------------------------------- 1 | .section text 2 | 3 | HALCPUHalt: 4 | .global HALCPUHalt 5 | halt 6 | ret 7 | 8 | HALfox32Reset: 9 | .global HALfox32Reset 10 | jmp 0xF0000000 11 | ret -------------------------------------------------------------------------------- /OS/HAL/fox32/include/HALfox32IO.h: -------------------------------------------------------------------------------- 1 | extern HALfox32Out { value port -- } 2 | extern HALfox32In { port -- value } -------------------------------------------------------------------------------- /OS/HAL/include/HALArgs.h: -------------------------------------------------------------------------------- 1 | extern HALArgsValue { arg -- out } 2 | extern HALArgsCheck { arg -- present } -------------------------------------------------------------------------------- /OS/HAL/include/HALCPU.h: -------------------------------------------------------------------------------- 1 | extern HALCPUHalt { -- } 2 | 3 | extern HALCPUInterruptDisable { -- rs } 4 | extern HALCPUInterruptRestore { rs -- } 5 | extern HALCPUInterruptEnable { -- } 6 | 7 | extern HALCPUContextInit { context1 context2 startfunc kstack process -- ctx } 8 | extern HALCPUContextSwitch { old new -- } 9 | extern HALCPUIsUserTrapFrame { tf -- user } 10 | extern HALCPUTrapFrameAbort { ok abort tf -- } 11 | 12 | extern HALDcacheExpunge { -- } 13 | extern HALIcacheSynchronize { -- } 14 | extern HALCPUFence { -- } 15 | 16 | externptr HALCPUModel 17 | externptr HALPlatformModel 18 | externptr HALBusModel -------------------------------------------------------------------------------- /OS/HAL/include/HALConsole.h: -------------------------------------------------------------------------------- 1 | extern HALPutc { c -- } 2 | extern HALGetc { -- c } 3 | extern HALConsoleQuery { -- w h x y } 4 | extern HALConsoleSetCursor { x y -- } 5 | extern HALConsoleClear { -- } 6 | extern HALConsoleStolen { -- } 7 | extern HALConsoleShutter { -- } 8 | extern HALConsoleSetMode { newmode -- oldmode } 9 | 10 | const CONSOLEFG 0 // white 11 | const CONSOLEBG 6 // blue 12 | 13 | const CONSOLEMODEOFF 0 14 | const CONSOLEMODETTY 1 15 | const CONSOLEMODESCREEN 2 16 | 17 | externptr HALConsoleMode 18 | externptr HALConsoleFont 19 | externptr HALConsoleFontWidth 20 | externptr HALConsoleFontHeight 21 | externptr HALConsoleWidthChars 22 | externptr HALConsoleHeightChars 23 | externptr HALConsoleWidthPix 24 | externptr HALConsoleHeightPix 25 | externptr HALConsoleFontFlags 26 | externptr HALConsoleFontName 27 | 28 | // definitions for the HAL Console Font (HCF) format 29 | 30 | const HCFMAGIC 'fNLE' 31 | 32 | const HCFFLAG_REVERSE 1 33 | 34 | struct HCFHeader 35 | 4 Magic 36 | 4 Width 37 | 4 Height 38 | 4 Flags 39 | 16 FontName 40 | 16 Reserved 41 | endstruct -------------------------------------------------------------------------------- /OS/HAL/include/HALCrash.h: -------------------------------------------------------------------------------- 1 | externptr HALCrashed 2 | 3 | extern HALCrash { ... fmt -- } 4 | extern HALVCrash { argv argc fmt -- } 5 | extern HALPlatformCrash { -- } 6 | 7 | extern HALIsComputerOnFire { -- isonfire ok } -------------------------------------------------------------------------------- /OS/HAL/include/HALDebug.h: -------------------------------------------------------------------------------- 1 | extern HALDebug { -- ran } 2 | extern HALDebugDump { rows cols -- } 3 | extern HALPlatformTrace { pc link rows cols -- } -------------------------------------------------------------------------------- /OS/HAL/include/HALDriver.h: -------------------------------------------------------------------------------- 1 | fnptr FDriverInitEarly { arg1 arg2 arg3 arg4 -- ok } 2 | fnptr FDriverInit { stage -- ok } 3 | 4 | extern HALDriverInit { stage ldrinfo -- } 5 | 6 | const STAGE_PRETASKING 1 7 | const STAGE_THREAD 2 -------------------------------------------------------------------------------- /OS/HAL/include/HALExit.h: -------------------------------------------------------------------------------- 1 | extern HALExit { ret mode -- } -------------------------------------------------------------------------------- /OS/HAL/include/HALIPL.h: -------------------------------------------------------------------------------- 1 | const IPLHIGH 31 2 | const IPLCLOCK 29 3 | 4 | const IPLDMA 8 5 | const IPLDISK 7 6 | const IPLSERIAL 6 7 | const IPLBOARDS 5 8 | const IPLINTERACTIVE 4 9 | 10 | const IPLDPC 2 11 | const IPLAPC 1 12 | const IPLLOW 0 13 | 14 | externptr HALIPLCurrent 15 | externptr HALIPLNames -------------------------------------------------------------------------------- /OS/HAL/include/HALInterrupt.h: -------------------------------------------------------------------------------- 1 | extern HALInterruptRegister { handler int ipl -- } 2 | extern HALInterruptUnregister { int -- } 3 | 4 | extern HALInterrupt { trapframe -- } 5 | 6 | fnptr HALInterruptHandler { trapframe int -- } 7 | 8 | externptr HALPlatformInterruptHandlers 9 | externptr HALInterruptNested -------------------------------------------------------------------------------- /OS/HAL/include/HALLog.h: -------------------------------------------------------------------------------- 1 | extern HALLog { ... fmt src -- } 2 | extern HALVLog { argvt argcn fmt src -- } 3 | extern HALLogReset { -- } -------------------------------------------------------------------------------- /OS/HAL/include/HALNvram.h: -------------------------------------------------------------------------------- 1 | extern HALNvramQuery { query -- ok } 2 | extern HALNvramSet { delete query -- ok } 3 | extern HALNvramRead { query index -- nextindex ok } -------------------------------------------------------------------------------- /OS/HAL/include/HALRTC.h: -------------------------------------------------------------------------------- 1 | fnptr HALRTCQueryF { time -- } 2 | fnptr HALUptimeQueryF { time -- } 3 | fnptr HALRTCSetF { time -- ok } 4 | 5 | extern HALRTCQuery { time -- } 6 | extern HALUptimeQuery { time -- } 7 | extern HALRTCSet { time -- ok } 8 | 9 | externptr HALRTCQueryFunction 10 | externptr HALUptimeQueryFunction 11 | externptr HALRTCSetFunction 12 | externptr HALRTCInterval 13 | externptr HALRTCIsLocalTime -------------------------------------------------------------------------------- /OS/HAL/include/HALResource.h: -------------------------------------------------------------------------------- 1 | externptr HALResourceListHead 2 | 3 | extern HALResourceByName { name -- rsrc } 4 | extern HALResourceWire { rsrc -- } 5 | extern HALResourceData { rsrc -- data } -------------------------------------------------------------------------------- /OS/Headers/BME/Bme.h: -------------------------------------------------------------------------------- 1 | #include "/BME/Region.h" -------------------------------------------------------------------------------- /OS/Headers/BME/Region.h: -------------------------------------------------------------------------------- 1 | // A region is a clippable shape that represents a specific "view" of pixels. 2 | // This is the fundamental drawing primitive, i.e., this is the structure 3 | // given (along with texture, x, y, etc) to the graphics driver for drawing 4 | // operations. 5 | 6 | struct BmeBox 7 | 2 X1I 8 | 2 X2I 9 | 2 Y1I 10 | 2 Y2I 11 | endstruct 12 | 13 | struct BmeRect 14 | 2 XI 15 | 2 YI 16 | 2 WidthI 17 | 2 HeightI 18 | endstruct 19 | 20 | struct BmeRegion 21 | 4 Size 22 | 4 BoxCount 23 | BmeBox_SIZEOF BoundingBox 24 | endstruct -------------------------------------------------------------------------------- /OS/Headers/MCL/Mcl.h: -------------------------------------------------------------------------------- 1 | fnptr MclBuiltinF { argvt argcn machine -- value ok } 2 | 3 | extern MclMachineCreate { -- machine ok } 4 | extern MclMachineFree { machine -- } 5 | extern MclMachineParseFile { filename interactive streamhandle machine -- rootblock ok } 6 | 7 | extern MclMachineEvaluateNode { capture node machine -- value ok } 8 | extern MclMachineRegisterBuiltin { func name machine -- ok } 9 | 10 | extern MclParseSubtreeFree { node -- } 11 | 12 | extern MclValueContents { value -- contents } 13 | extern MclFreeValue { value -- } 14 | 15 | extern MclDiagnostic { ... fmt machine -- } 16 | 17 | extern MclRunScript { argcn argvt filename -- value ok } 18 | 19 | extern MclInterrupt { machine -- } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OS.h: -------------------------------------------------------------------------------- 1 | #include "/OSDLL/OSStatus.h" 2 | #include "/OSDLL/OSAccess.h" 3 | #include "/OSDLL/OSFile.h" 4 | #include "/OSDLL/OSWait.h" 5 | #include "/OSDLL/OSMap.h" 6 | #include "/OSDLL/OSSignal.h" 7 | #include "/OSDLL/OSCalls.h" 8 | #include "/OSDLL/OSAbort.h" 9 | #include "/OSDLL/OSObject.h" 10 | #include "/OSDLL/OSAlloc.h" 11 | #include "/OSDLL/OSModule.h" 12 | #include "/OSDLL/OSProcess.h" 13 | #include "/OSDLL/OSEnvironment.h" 14 | #include "/OSDLL/OSMemory.h" 15 | #include "/OSDLL/OSMount.h" 16 | #include "/OSDLL/OSFastMutex.h" 17 | #include "/OSDLL/OSTime.h" 18 | #include "/OSDLL/OSVersion.h" 19 | #include "/OSDLL/OSShutdown.h" 20 | #include "/OSDLL/OSConfiguration.h" 21 | #include "/OSDLL/OSStatistics.h" 22 | #include "/OSDLL/OSStream.h" 23 | #include "/OSDLL/OSPort.h" 24 | #include "/OSDLL/OSIOControl.h" 25 | #include "/OSDLL/OSNvramControl.h" 26 | 27 | #include "/OSDLL/OSContext.h" -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSAbort.h: -------------------------------------------------------------------------------- 1 | extern OSAbort { ... fmt -- } 2 | extern OSError { ... fmt -- } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSAccess.h: -------------------------------------------------------------------------------- 1 | const ACCESS_EXEC 1 2 | const ACCESS_WRITE 2 3 | const ACCESS_READ 4 4 | 5 | const ACCESS_ALL (ACCESS_WRITE ACCESS_READ | ACCESS_EXEC |) 6 | 7 | const ACCESS_NOINHERIT 0x10000000 8 | 9 | const ACCESS_WORLD_EXEC 1 10 | const ACCESS_WORLD_WRITE 2 11 | const ACCESS_WORLD_READ 4 12 | 13 | const ACCESS_WORLD_ALL (ACCESS_WORLD_EXEC ACCESS_WORLD_WRITE | ACCESS_WORLD_READ |) 14 | 15 | const ACCESS_GROUP_EXEC 8 16 | const ACCESS_GROUP_WRITE 16 17 | const ACCESS_GROUP_READ 32 18 | 19 | const ACCESS_GROUP_ALL (ACCESS_GROUP_EXEC ACCESS_GROUP_WRITE | ACCESS_GROUP_READ |) 20 | 21 | const ACCESS_OWNER_EXEC 64 22 | const ACCESS_OWNER_WRITE 128 23 | const ACCESS_OWNER_READ 256 24 | 25 | const ACCESS_OWNER_ALL (ACCESS_OWNER_EXEC ACCESS_OWNER_WRITE | ACCESS_OWNER_READ |) 26 | 27 | const ACCESS_ALL_ALL (ACCESS_WORLD_ALL ACCESS_GROUP_ALL | ACCESS_OWNER_ALL |) 28 | 29 | const ACCESS_ANY_EXEC (ACCESS_WORLD_EXEC ACCESS_GROUP_EXEC | ACCESS_OWNER_EXEC |) 30 | 31 | const ACCESS_SET_ONLY_EID 0x80000000 32 | 33 | const UID_SYSTEM 0 34 | const GID_SYSTEM 0 35 | 36 | const SYSTEMPERMISSION_REBOOT 1 37 | const SYSTEMPERMISSION_SHUTDOWN 2 38 | const SYSTEMPERMISSION_SYNC 3 39 | const SYSTEMPERMISSION_ADMIN 4 40 | const SYSTEMPERMISSION_SYSTEM 5 41 | const SYSTEMPERMISSION_MOUNT 6 42 | const SYSTEMPERMISSION_SETCONSOLE 7 43 | const SYSTEMPERMISSION_NEWSESSION 8 44 | const SYSTEMPERMISSION_DETACHJOB 9 45 | const SYSTEMPERMISSION_SETQUOTA 10 46 | const SYSTEMPERMISSION_RAISEPRIORITY 11 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSAlloc.h: -------------------------------------------------------------------------------- 1 | extern OSHeapAllocate { bytes -- ptr ok } 2 | extern OSHeapFree { ptr -- } 3 | 4 | extern OSHeapQuery { query -- } 5 | 6 | struct OSHeapInformation 7 | 4 UsedInternally 8 | 4 UsedExternally 9 | 10 | 20 Reserved 11 | endstruct -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSBootFlags.h: -------------------------------------------------------------------------------- 1 | const OSBOOTFLAG_SINGLEUSERMODE 1 2 | const OSBOOTFLAG_NONPAGEDEXEC 2 3 | const OSBOOTFLAG_NONPAGEDPOOL 4 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSConfiguration.h: -------------------------------------------------------------------------------- 1 | extern OSConfigFileLoad { path create write -- config ok } 2 | extern OSConfigFileWrite { config -- ok } 3 | extern OSConfigFileFree { config -- } 4 | 5 | extern OSConfigGetKey { keyname section -- key ok } 6 | extern OSConfigGetKeyName { key -- name } 7 | extern OSConfigGetKeyValue { key -- valueptr } 8 | extern OSConfigSetKey { valueptr key -- ok } 9 | extern OSConfigCreateKey { valueptr keyname section -- key ok } 10 | extern OSConfigDeleteKey { key -- } 11 | 12 | extern OSConfigGetSection { sectionname config -- section ok } 13 | extern OSConfigGetSectionName { section -- name } 14 | extern OSConfigSetSectionName { name section -- } 15 | extern OSConfigCreateSection { sectionname config -- section ok } 16 | extern OSConfigDeleteSection { section -- } 17 | 18 | extern OSConfigGetKeyIterator { sectionname config -- iterator ok } 19 | extern OSConfigGetSectionIterator { config -- iterator ok } 20 | 21 | extern OSConfigNextKey { iterator config -- key valueptr nextiterator ok } 22 | extern OSConfigNextSection { iterator config -- section nextiterator ok } 23 | 24 | extern OSConfigFileGetSectionCount { config -- count } 25 | extern OSConfigSectionGetKeyCount { section -- count } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSConsoleControl.h: -------------------------------------------------------------------------------- 1 | const OSCONSOLEMODE_NOECHO 1 2 | const OSCONSOLEMODE_RAW 2 3 | 4 | struct OSConsoleQuery 5 | 4 Reserved1 6 | 4 Reserved2 7 | 4 Mode 8 | 9 | 24 Reserved 10 | endstruct 11 | 12 | const OSDUPLEXFLAG_SIMPLEX 1 13 | const OSDUPLEXFLAG_CONSOLE 2 14 | const OSDUPLEXFLAG_PIPE 4 15 | 16 | extern OSConsoleQuerySize { filehandle -- w h ok } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSContext.h: -------------------------------------------------------------------------------- 1 | #ifdef XR17032 2 | 3 | // if you modify below, update the matching name table in OSDLL debug dumper 4 | struct OSContext 5 | 4 t0 4 t1 6 | 4 t2 4 t3 7 | 4 t4 4 t5 8 | 4 a0 4 a1 9 | 4 a2 4 a3 10 | 4 s0 4 s1 11 | 4 s2 4 s3 12 | 4 s4 4 s5 13 | 4 s6 4 s7 14 | 4 s8 4 s9 15 | 4 s10 4 s11 16 | 4 s12 4 s13 17 | 4 s14 4 s15 18 | 4 s16 4 s17 19 | 4 s18 20 | 21 | 4 sp 22 | 4 ers 23 | 4 epc 24 | 4 lr 25 | 26 | 4 badaddr 27 | endstruct 28 | 29 | const OSCONTEXTCOUNT 34 30 | 31 | const XR17032_RS_USER 1 32 | const XR17032_RS_INT 2 33 | const XR17032_RS_MMU 4 34 | 35 | const XR17032_ERS_USER 256 36 | const XR17032_ERS_INT 512 37 | 38 | const XR17032_ERS_KTHREAD (XR17032_RS_INT XR17032_RS_MMU | 8 <<) 39 | const XR17032_ERS_UTHREAD (XR17032_RS_INT XR17032_RS_MMU | XR17032_RS_USER | 8 <<) 40 | 41 | #endif 42 | 43 | #ifdef FOX32 44 | 45 | // if you modify below, update the matching name table in OSDLL debug dumper 46 | struct OSContext 47 | 4 t0 4 t1 48 | 4 t2 4 t3 49 | 4 t4 4 t5 50 | 4 t6 51 | 4 a0 4 a1 52 | 4 a2 4 a3 53 | 4 s0 4 s1 54 | 4 s2 4 s3 55 | 4 s4 4 s5 56 | 4 s6 4 s7 57 | 4 s8 4 s9 58 | 4 s10 4 s11 59 | 4 s12 4 s13 60 | 4 s14 4 s15 61 | 4 s16 4 s17 62 | 63 | 4 at 64 | 65 | 4 tp 66 | 67 | 4 r31 68 | 4 fp 69 | 70 | 4 badaddr 71 | 1 eflagsB 72 | 4 epc 73 | 4 sp 74 | endstruct 75 | 76 | const OSCONTEXTCOUNT 37 77 | 78 | const FOX32_RS_INT 4 79 | const FOX32_RS_USER 8 80 | 81 | const FOX32_RS_KTHREAD FOX32_RS_INT 82 | const FOX32_RS_UTHREAD (FOX32_RS_INT FOX32_RS_USER |) 83 | 84 | #endif -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSCrypt.h: -------------------------------------------------------------------------------- 1 | const OSSIMPLECRYPT_HASHLENGTH 16 2 | 3 | extern OSSimpleCrypt { str salt hash -- } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSEnvironment.h: -------------------------------------------------------------------------------- 1 | fnptr OSEnumerateEnvironmentF { entry -- ok } 2 | 3 | extern OSFindEnvironmentVariable { name -- entry env ok } 4 | extern OSGetEnvironmentVariable { env name bufsize -- ok } 5 | extern OSSetEnvironmentVariable { env name -- ok } 6 | extern OSDeleteEnvironmentVariable { name -- ok } 7 | extern OSEnumerateEnvironment { func -- ok } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSFastMutex.h: -------------------------------------------------------------------------------- 1 | struct OSFastMutex 2 | 4 SemaphoreHandle 3 | 4 LockCount 4 | 4 Name 5 | 4 OwningThread 6 | 4 ThreadLockCount 7 | 8 | 16 Reserved 9 | endstruct 10 | 11 | extern OSFastMutexInitialize { name fastmutex -- } 12 | extern OSFastMutexDelete { fastmutex -- } 13 | 14 | extern OSFastMutexAcquire { fastmutex -- } 15 | extern OSFastMutexTryAcquire { fastmutex -- acquired } 16 | extern OSFastMutexRelease { fastmutex -- } 17 | 18 | extern OSInterlockedIncrement { inc ptr -- oldcount } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSIOControl.h: -------------------------------------------------------------------------------- 1 | // these are kept in one place so that they can be kept apart more easily. 2 | 3 | const OSCONSOLEIOCONTROL_QUERY 1 4 | const OSCONSOLEIOCONTROL_SETMODE 2 5 | const OSCONSOLEIOCONTROL_RESETMODE 3 6 | const OSCONSOLEIOCONTROL_EXPEDITE 4 7 | 8 | const OSVIDEOIOCONTROL_QUERY 128 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSMap.h: -------------------------------------------------------------------------------- 1 | const OSPAGESIZE 4096 2 | const OSPAGEOFFSETMASK (OSPAGESIZE 1 -) 3 | const OSPAGENUMBERMASK (OSPAGEOFFSETMASK ~) 4 | const OSPAGESHIFT 12 5 | 6 | const OSPEB 0x7FF00000 7 | const OSPEBSIZE OSPAGESIZE 8 | 9 | const OSDLLHEAD 0x7FE00000 10 | 11 | const USTACKS 0x7FD00000 // preferred, to keep them out of the way 12 | const USTACKSZ (OSPAGESIZE 3 *) 13 | 14 | const HEAPSTART 0x7FC00000 15 | 16 | const USERMAP 0x00300000 17 | 18 | const PAGEACCESS_EXEC 1 19 | const PAGEACCESS_WRITE 2 20 | const PAGEACCESS_READ 4 21 | const PAGEACCESS_WRITECOPY 8 22 | const PAGEACCESS_NONCACHED 16 23 | const PAGEACCESS_WRITECOMBINE 32 24 | 25 | const PAGEACCESS_ALL (PAGEACCESS_EXEC PAGEACCESS_WRITE | PAGEACCESS_READ |) 26 | 27 | const OSMAPFLAG_FIXEDADDRESS 1 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSModule.h: -------------------------------------------------------------------------------- 1 | const OSMODULEFORMAT_UNINITIALIZED 0 2 | const OSMODULEFORMAT_LOFF 1 3 | 4 | const OSMODULEFLAGS_REBASESELF 1 5 | const OSMODULEFLAGS_REBASE 2 6 | 7 | const OSMODULEFLAGS_REBASEEITHER (OSMODULEFLAGS_REBASE OSMODULEFLAGS_REBASESELF |) 8 | 9 | const OSMODULEFLAGS_SHOULDINIT 4 10 | 11 | const OSMODULELOAD_MAINIMAGE 1 12 | 13 | struct OSModule 14 | 4 Next 15 | 4 Prev 16 | 17 | 4 Name 18 | 19 | 4 LoadCount 20 | 21 | 4 HeadVAddr 22 | 4 HeadLength 23 | 24 | 4 Flags 25 | 26 | 4 Format 27 | endstruct 28 | 29 | fnptr OSModuleMainFunction { -- ok } 30 | fnptr OSModuleUnloadFunction { -- } 31 | 32 | extern OSModuleLoad { flags name -- dll ok } 33 | extern OSModuleUnload { dll -- } 34 | extern OSGetSymbolAddress { name dll -- address ok } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSMount.h: -------------------------------------------------------------------------------- 1 | struct OSMountInformation 2 | OBNAMEMAX VolumeName 3 | OBNAMEMAX FilesystemName 4 | OBNAMEMAX VolumeLabel 5 | 6 | 4 Flags 7 | 8 | 4 VolumeCapacity 9 | 4 VolumeUsed 10 | 11 | 4 SetFlags 12 | 13 | 20 Reserved 14 | endstruct 15 | 16 | const OSMOUNT_READONLY 1 17 | const OSMOUNT_NOUID 2 18 | const OSMOUNT_MATCHUID 4 19 | 20 | const OSMOUNTSET_VOLUMELABEL 1 21 | 22 | extern OSMountInformationInitialize { info -- } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSMouseControl.h: -------------------------------------------------------------------------------- 1 | struct OSMousePacket 2 | 4 EventType 3 | 4 Info 4 | 4 Reserved1 5 | 4 Reserved2 6 | endstruct 7 | 8 | const OSMOUSEEVENT_PRESSED 1 9 | const OSMOUSEEVENT_RELEASED 2 10 | const OSMOUSEEVENT_MOVED 3 11 | const OSMOUSEEVENT_MOVEDABS 4 12 | 13 | const OSMOUSEBUTTON_PRIMARY 1 14 | const OSMOUSEBUTTON_SECONDARY 2 15 | const OSMOUSEBUTTON_MIDDLE 3 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSNvramControl.h: -------------------------------------------------------------------------------- 1 | struct OSNvramQuery 2 | 63 Name 3 | 1 NameNullTerminator 4 | 255 Contents 5 | 1 ContentsNullTerminator 6 | endstruct -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSPort.h: -------------------------------------------------------------------------------- 1 | struct OSMessageHeader 2 | 1 TypeB 3 | 1 SubtypeB 4 | 2 LengthI 5 | 4 ConversationID 6 | 4 ClientID 7 | 4 Context 8 | 4 Handle 9 | 4 Access 10 | endstruct 11 | 12 | struct OSMessageHeaderIOCompletion 13 | 1 TypeB 14 | 1 SubtypeB 15 | 2 LengthI 16 | 4 ConversationID 17 | 4 BytesTransferred 18 | 4 Context 19 | 4 Status 20 | 4 Reserved 21 | endstruct 22 | 23 | extern OSPortConnect { rxmsg txmsg timeout path -- porthandle ok } 24 | 25 | const OSPORT_FLAG_NO_HANDLES 1 // forbid handle passing 26 | 27 | const OSPORT_CID_SYSTEM -1 28 | 29 | const OSPORT_MESSAGE_CONNECTION 1 30 | const OSPORT_MESSAGE_REQUEST 2 31 | const OSPORT_MESSAGE_REPLY 3 32 | const OSPORT_MESSAGE_DISCONNECT 4 33 | const OSPORT_MESSAGE_IOCOMPLETE 5 34 | 35 | const OSPORT_CONID_FIRSTDYNAMIC 32 36 | const OSPORT_CONID_FIRSTUSER 8 37 | const OSPORT_CONID_NONE 0 38 | const OSPORT_CONID_ANY 0 39 | const OSPORT_CONID_ALL 0 40 | const OSPORT_CONID_NEW 0 41 | const OSPORT_CONID_CONNECTION 1 42 | const OSPORT_CONID_DISCONNECT 2 43 | const OSPORT_CONID_IOCOMPLETE 3 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSShutdown.h: -------------------------------------------------------------------------------- 1 | const OSSHUTDOWN_HALT 1 2 | const OSSHUTDOWN_REBOOT 2 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSSignal.h: -------------------------------------------------------------------------------- 1 | fnptr OSSignalHandler { context signum -- } 2 | fnptr OSUserAPCRoutine { context apccontext -- } 3 | 4 | const OSSIGNALACTION_DEFAULT 0 5 | const OSSIGNALACTION_IGNORE 1 6 | 7 | const OSSIGNAL_NONE 0 8 | const OSSIGNAL_HUP 1 9 | const OSSIGNAL_INT 2 10 | const OSSIGNAL_QUIT 3 11 | const OSSIGNAL_ILL 4 12 | const OSSIGNAL_TRAP 5 13 | const OSSIGNAL_ABRT 6 14 | const OSSIGNAL_EMT 7 15 | const OSSIGNAL_FPE 8 16 | const OSSIGNAL_KILL 9 17 | const OSSIGNAL_BUS 10 18 | const OSSIGNAL_SEGV 11 19 | const OSSIGNAL_SYS 12 20 | const OSSIGNAL_PIPE 13 21 | const OSSIGNAL_ALRM 14 22 | const OSSIGNAL_TERM 15 23 | const OSSIGNAL_URG 16 24 | const OSSIGNAL_STOP 17 25 | const OSSIGNAL_TSTP 18 26 | const OSSIGNAL_CONT 19 27 | const OSSIGNAL_CHLD 20 28 | const OSSIGNAL_TTIN 21 29 | const OSSIGNAL_TTOU 22 30 | const OSSIGNAL_IO 23 31 | const OSSIGNAL_XCPU 24 32 | const OSSIGNAL_IOERR 25 33 | const OSSIGNAL_VTALRM 26 34 | const OSSIGNAL_PROF 27 35 | const OSSIGNAL_WINCH 28 36 | const OSSIGNAL_INFO 29 37 | const OSSIGNAL_USR1 30 38 | const OSSIGNAL_USR2 31 39 | 40 | const OSSIGNALCOUNT 32 41 | 42 | extern OSSignalSetDefaults { -- } 43 | extern OSSignalSetAction { action signum -- oldaction } 44 | extern OSSignalGetAction { signum -- action } 45 | 46 | extern OSSignalGetName { signum -- signame ok } 47 | extern OSSignalGetNumber { signame -- signum ok } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSStatistics.h: -------------------------------------------------------------------------------- 1 | const OSSTATISTICSCOUNT (6 32 +) 2 | 3 | struct OSStatistics 4 | 4 Interrupts 5 | 4 ClockTicks 6 | 4 Preemptions 7 | 4 QuantumEnds 8 | 4 SystemCalls 9 | 4 DPCTimeMs 10 | 11 | (32 4 *) IPLTimes 12 | 13 | 80 Reserved 14 | endstruct 15 | 16 | extern OSStatisticsDump { diffquery query -- } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSStream.h: -------------------------------------------------------------------------------- 1 | // lower 4 bits of flags contain buffering type 2 | const OSSTREAMFLAG_BUFFERTYPEMASK 15 3 | 4 | const OSSTREAMFLAG_DIRTY 16 5 | 6 | const OSSTREAMTYPE_NOBUFFER 1 7 | const OSSTREAMTYPE_LINEBUFFER 2 8 | const OSSTREAMTYPE_FULLBUFFER 3 9 | 10 | const OSSTREAMLINEBUFFERLENGTH 512 11 | 12 | struct OSStream 13 | 4 Flags 14 | 4 FileHandle 15 | 4 Access 16 | 4 Buffer 17 | 4 BufferedLength 18 | endstruct 19 | 20 | const OSSTREAMPURGE_RELEASE 2 21 | 22 | const OSSTREAMHANDLEFLAG 1 23 | 24 | extern OSStreamCreate { streamflags filetype permissions flags access path -- stream ok } 25 | extern OSStreamOpen { streamflags filetype flags access path -- stream ok } 26 | extern OSStreamObjectCreate { flags access filehandle -- stream ok } 27 | extern OSStreamClose { stream -- ok } 28 | extern OSStreamGetFileHandle { stream -- filehandle } 29 | extern OSStreamTruncate { newsize growing stream -- oldsize ok } 30 | extern OSStreamSeek { offset stream mode -- newoffset ok } 31 | extern OSStreamFlush { purge stream -- ok } 32 | extern OSStreamRead { timeout flags length buffer stream -- bytesread ok } 33 | extern OSStreamWrite { flags length buffer stream -- byteswritten ok } 34 | extern OSStreamWriteCharacter { c stream -- ok } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSTime.h: -------------------------------------------------------------------------------- 1 | struct OSTime 2 | 4 Year 3 | 4 Month 4 | 4 Hour 5 | 4 Minute 6 | 4 Second 7 | 4 Milliseconds 8 | 4 IsDST 9 | 10 | 4 DayOfWeek 11 | 4 DayOfYear 12 | 4 DayOfMonth 13 | 14 | 24 Reserved 15 | endstruct 16 | 17 | extern OSTimeUTCGet { ostime ms sec -- } 18 | extern OSTimeLocalGet { ostime ms sec -- } 19 | extern OSTimePrint { ostime showyear -- } 20 | extern OSDatePrint { ostime -- } 21 | 22 | extern OSTimeToTimestamp { ostime -- sec ms } 23 | extern OSLocalTimeToTimestamp { ostime -- sec ms } 24 | 25 | extern OSMonthNameToIndex { month -- index } 26 | 27 | extern OSTimeZoneNameToOffset { name -- offset ok } 28 | 29 | extern OSTimeZoneOffsetToName { offset namebuf -- } 30 | 31 | extern OSTimeZoneEnumerate { context func -- ok } 32 | 33 | fnptr OSTimeZoneEnumerateF { context name offset -- ok } -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSVersion.h: -------------------------------------------------------------------------------- 1 | struct OSVersionQuery 2 | 256 OSName 3 | 256 NodeName 4 | 256 Release 5 | 256 Version 6 | 256 Machine 7 | 256 Processor 8 | endstruct -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSVideoControl.h: -------------------------------------------------------------------------------- 1 | struct OSVideoQuery 2 | 4 Width 3 | 4 Height 4 | 4 Format 5 | 4 VRAMSize 6 | 28 Reserved 7 | endstruct 8 | 9 | const OSFBFORMAT_NA 0 10 | const OSFBFORMAT_I8 1 11 | const OSFBFORMAT_RGBA32 2 -------------------------------------------------------------------------------- /OS/Headers/OSDLL/OSWait.h: -------------------------------------------------------------------------------- 1 | const OSWAIT_UNALERTABLE 0 2 | const OSWAIT_ALERTABLE 1 3 | 4 | const OSWAIT_TIMEOUTINFINITE -1 -------------------------------------------------------------------------------- /OS/KDebug/DebugIO.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements a hack to read a string from the non-video HAL console. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | #include "/HALConsole.h" 7 | 8 | #include "/DebugIO.h" 9 | 10 | fn DebugGets { s max -- } 11 | auto len 12 | 0 len! 13 | 14 | while (1) 15 | auto c 16 | ERR c! 17 | while (c@ ERR ==) 18 | HALGetc c! 19 | end 20 | 21 | if (c@ '\r' ==) 22 | '\n' HALPutc 23 | break 24 | end 25 | 26 | if (c@ '\b' ==) 27 | if (len@ 0 >) 28 | 1 len -= 29 | 0 s@ len@ + sb 30 | '\b' HALPutc 31 | ' ' HALPutc 32 | '\b' HALPutc 33 | end 34 | end elseif (len@ max@ <) 35 | c@ s@ len@ + sb 36 | 37 | 1 len += 38 | c@ HALPutc 39 | end 40 | end 41 | 42 | 0 s@ len@ + sb 43 | end -------------------------------------------------------------------------------- /OS/KDebug/DebugMain.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization of KDebug.dll. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALConsole.h" 8 | #include "/HALLog.h" 9 | #include "/HALMap.h" 10 | #include "/HALCrash.h" 11 | #include "/HALCPU.h" 12 | 13 | #include "/DebugTrace.h" 14 | 15 | #include "../OSLoader/OSLoaderGlobal.h" 16 | 17 | #include "/Kernel.h" 18 | 19 | extern DebugPrompt { -- } 20 | 21 | externptr HALDebugDumpFunction 22 | externptr HALDebuggerFunction 23 | 24 | externptr HALResourceKeepHeaders 25 | 26 | fn DebugInit { ldrinfo -- } 27 | if (ldrinfo@ LdrInfo_Major + @ OSLOADERMAJOR ~=) 28 | ldrinfo@ LdrInfo_Major + @ OSLOADERMAJOR "LOADERMAJOR mismatch: expected %d, was given %d.\n" "DebugInit" HALLog 29 | "224Debug can't be used with this system.\n" "DebugInit" HALLog 30 | return 31 | end elseif (ldrinfo@ LdrInfo_Minor + @ OSLOADERMINOR ~=) 32 | ldrinfo@ LdrInfo_Minor + @ OSLOADERMINOR "LOADERMINOR mismatch: expected %d, was given %d.\n" "DebugInit" HALLog 33 | "Will proceed, but there may be unexpected behavior.\n" "DebugInit" HALLog 34 | end 35 | 36 | pointerof DebugDump HALDebugDumpFunction! 37 | 38 | pointerof DebugMain HALDebuggerFunction! 39 | 40 | 1 HALResourceKeepHeaders! 41 | end 42 | 43 | var DebugCrashLater 0 44 | public DebugCrashLater 45 | 46 | var DebugSavedIPL 0 47 | public DebugSavedIPL 48 | 49 | fn DebugMain { -- } 50 | auto oldmode 51 | CONSOLEMODETTY HALConsoleSetMode oldmode! 52 | 53 | auto rs 54 | HALCPUInterruptDisable rs! 55 | 56 | KeIPLCurrentGet DebugSavedIPL! 57 | 58 | //"224Debug invoked!\n" "DebugMain" HALLog 59 | 60 | DebugPrompt 61 | 62 | oldmode@ HALConsoleSetMode drop 63 | 64 | rs@ HALCPUInterruptRestore 65 | 66 | if (DebugCrashLater@) 67 | 0 DebugCrashLater! 68 | "debug\n" KeCrash 69 | end 70 | end -------------------------------------------------------------------------------- /OS/KDebug/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | LINKOPT = -nostubs 4 | 5 | OUTPUTFILE := $(SYSROOT)/KDebug.dll 6 | 7 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) OSKernel.exe:$(KERNBIN) 8 | 9 | MOVEEXPR := base=0x80600000 10 | 11 | INCDIR := $(HALINCDIR):$(KERNINCDIR):./include/ 12 | 13 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/KDebug/include/DebugIO.h: -------------------------------------------------------------------------------- 1 | extern DebugGets { s max -- } -------------------------------------------------------------------------------- /OS/KDebug/include/DebugSymbols.h: -------------------------------------------------------------------------------- 1 | extern DebugGetSymbolByAddress { address dll -- symbase symname symbol ok } 2 | extern DebugGetSymbol { name dll -- symbol ok } 3 | extern DebugGetSymbolAddress { name dll -- address ok } 4 | extern DebugGetSymDLL { address -- dll symbase symname symbol ok } 5 | extern DebugGetDLL { name -- dll } -------------------------------------------------------------------------------- /OS/KDebug/include/DebugTrace.h: -------------------------------------------------------------------------------- 1 | extern DebugDump { rows cols -- } 2 | extern DebugTrace { pc link rows cols -- } -------------------------------------------------------------------------------- /OS/MCL/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(SYSROOT)/mcl.dll 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) 6 | 7 | MOVEEXPR := mintiadll text=0x70100000,data=text+text_size+align,bss=data+data_size+align 8 | 9 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/OSDLL/DLLModuleCalls.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the module management APIs. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/OSDLL/OSCalls.h" 8 | #include "/OSDLL/OSMap.h" 9 | #include "/OSDLL/OSFile.h" 10 | #include "/OSDLL/OSAbort.h" 11 | #include "/OSDLL/OSAccess.h" 12 | #include "/OSDLL/OSObject.h" 13 | #include "/OSDLL/OSStatus.h" 14 | #include "/OSDLL/OSModule.h" 15 | #include "/OSDLL/OSAlloc.h" 16 | #include "/OSDLL/OSWait.h" 17 | #include "/OSDLL/OSFastMutex.h" 18 | 19 | #include "OSDLL.h" 20 | 21 | fn OSGetSymbolAddress { name dll -- address ok } 22 | name@ dll@ ComDLLGetSymbolAddress ok! address! 23 | end 24 | 25 | fn OSModuleLoad { flags name -- dll ok } 26 | DLLModuleMutex OSFastMutexAcquire 27 | 28 | flags@ name@ ComDLLLoad ok! dll! 29 | 30 | DLLModuleMutex OSFastMutexRelease 31 | end 32 | 33 | fn OSModuleUnload { dll -- } 34 | DLLModuleMutex OSFastMutexAcquire 35 | 36 | dll@ ComDLLUnload 37 | 38 | DLLModuleMutex OSFastMutexRelease 39 | end -------------------------------------------------------------------------------- /OS/OSDLL/Makefile: -------------------------------------------------------------------------------- 1 | DYSTRIP := yes 2 | 3 | COMPONENTS := . 4 | 5 | OUTPUTFILE := $(SYSROOT)/OSDLL.dll 6 | 7 | LIBS := L/dfrt/dfrt.f.o 8 | 9 | MOVEEXPR := mintiadll text=0x1000,data=text+text_size+align,bss=data+data_size+align 10 | 11 | include $(REPO)/Project.mk 12 | 13 | $(ARCHITECTURE)/OSCallStubs.s: $(REPO)/OS/Headers/OSDLL/OSCalls.h 14 | $(SYSCALLGEN) $(REPO)/OS/Headers/OSDLL/OSCalls.h ./$(ARCHITECTURE)/OSCallStubs.s NO -------------------------------------------------------------------------------- /OS/OSDLL/fox32/DLLMainTrampoline.df: -------------------------------------------------------------------------------- 1 | #include "/OSDLL/OSContext.h" 2 | 3 | asm " 4 | 5 | .extern OSExit 6 | .extern OSThreadExit 7 | .extern DLLMainHL 8 | 9 | .section text 10 | 11 | ; copy arguments table from OSPEB to stack and jump to entrypoint 12 | ; does not return 13 | 14 | DLLMain: 15 | .global DLLMain 16 | call DLLMainHL 17 | nop 18 | 19 | ;a2 - program entry 20 | ;a1 - argv 21 | ;a0 - argc 22 | DLLMainTrampoline: 23 | .global DLLMainTrampoline 24 | mov t0, sp 25 | mov t1, a0 26 | 27 | mov t3, a0 28 | sla t3, 2 29 | sub sp, t3 30 | mov t3, sp 31 | 32 | .loop: 33 | cmp t1, 0 34 | ifz jmp .done 35 | 36 | mov t2, [a1] 37 | mov [t3], t2 38 | 39 | add a1, 4 40 | add t3, 4 41 | sub t1, 1 42 | rjmp .loop 43 | 44 | .done: 45 | call a2 46 | 47 | jmp OSExit 48 | 49 | DLLThreadExit: 50 | .global DLLThreadExit 51 | ;return value is already in a0 52 | jmp OSThreadExit 53 | 54 | .extern DLLSignalDispatchHL 55 | .extern DLLAPCDispatchHL 56 | 57 | DLLSignalDispatch: 58 | .global DLLSignalDispatch 59 | mov t0, sp 60 | add t0, OSContext_epc 61 | mov t0, [t0] 62 | 63 | mov t1, sp 64 | add t1, OSContext_fp 65 | mov t1, [t1] 66 | 67 | push t0 68 | push t1 69 | 70 | mov fp, sp 71 | 72 | call DLLSignalDispatchHL 73 | 74 | nop 75 | 76 | DLLAPCDispatch: 77 | .global DLLAPCDispatch 78 | mov t0, sp 79 | add t0, OSContext_epc 80 | mov t0, [t0] 81 | 82 | mov t1, sp 83 | add t1, OSContext_fp 84 | mov t1, [t1] 85 | 86 | push t0 87 | push t1 88 | 89 | mov fp, sp 90 | 91 | call DLLAPCDispatchHL 92 | 93 | nop 94 | 95 | .section data 96 | 97 | nonsense: 98 | .dl 0 99 | 100 | .section bss 101 | 102 | nonsense2: 103 | .dl 0 104 | 105 | " -------------------------------------------------------------------------------- /OS/OSKernel/Executive/ExBitmap.df: -------------------------------------------------------------------------------- 1 | // 2 | // Faster bitmap management routines. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALDebug.h" 10 | 11 | #include "/Kernel.h" 12 | 13 | #include "/Executive.h" 14 | 15 | #include "/Memory.h" 16 | 17 | #include "../../Common/Common.h" 18 | 19 | #include "../../Common/ComBitmap.df" -------------------------------------------------------------------------------- /OS/OSKernel/Executive/ExInternal.h: -------------------------------------------------------------------------------- 1 | extern ExiEventInit { -- } 2 | extern ExiSemaphoreInit { -- } 3 | extern ExiMutexInit { -- } 4 | extern ExiTimerInit { -- } 5 | 6 | 7 | // balance manager stuff 8 | 9 | 10 | extern ExBalanceManager { -- } 11 | 12 | externptr ExiBalanceManagerThread 13 | 14 | 15 | // handle table stuff 16 | 17 | 18 | const EXTENDBYENTRIES 32 19 | 20 | struct ExiHandleTableHeader 21 | ExRwLock_SIZEOF RwLock 22 | 4 EntrySizeLog 23 | 4 QuotaBlock 24 | 25 | 4 Context 26 | 27 | 4 Entries 28 | 4 FreeEntries 29 | 30 | 4 FreeListHead 31 | 32 | 4 Table 33 | endstruct 34 | 35 | 36 | // rwlock stuff 37 | 38 | 39 | const EXBOOSTRWSTARVE 6 40 | const EXBOOSTEXCLUSIVEWAITER 2 41 | const EXBOOSTSHAREDWAITER 1 42 | 43 | const EXBOOSTTIMEOUT 300 44 | 45 | 46 | // nvram stuff 47 | 48 | 49 | extern ExiNvramLock { -- } 50 | extern ExiNvramUnlock { -- } -------------------------------------------------------------------------------- /OS/OSKernel/Executive/ExLog.df: -------------------------------------------------------------------------------- 1 | // 2 | // Message logging for the MINTIA executive. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALDebug.h" 10 | #include "/HALConsole.h" 11 | #include "/HALCrash.h" 12 | 13 | #include "/Kernel.h" 14 | 15 | #include "/Executive.h" 16 | 17 | #include "/Memory.h" 18 | 19 | #include "/Object.h" 20 | 21 | #include "/IO.h" 22 | 23 | #include "/Console.h" 24 | 25 | #include "/OSDLL/OS.h" 26 | 27 | fn FPuts { fd s -- } 28 | while (s@ gb) 29 | s@ gb Putc 30 | 1 s += 31 | end 32 | end 33 | 34 | fn FPutc { fd c -- } 35 | c@ HALPutc 36 | end 37 | 38 | fn Putc { c -- } 39 | 0 c@ FPutc 40 | end -------------------------------------------------------------------------------- /OS/OSKernel/Executive/fox32/ExBuildDate.df: -------------------------------------------------------------------------------- 1 | asm " 2 | 3 | .section PAGE$text 4 | 5 | ExBuildDate: 6 | .global ExBuildDate 7 | .ds$ __DATE 8 | .db 0 9 | 10 | .align 4 11 | 12 | " -------------------------------------------------------------------------------- /OS/OSKernel/Executive/xr17032/ExBuildDate.df: -------------------------------------------------------------------------------- 1 | asm " 2 | 3 | .section PAGE$text 4 | 5 | ExBuildDate: 6 | .global ExBuildDate 7 | .ds$ __DATE 8 | .db 0 9 | 10 | .align 4 11 | 12 | " -------------------------------------------------------------------------------- /OS/OSKernel/IO/IOCache.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the MINTIA page cache. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALRTC.h" 9 | #include "/HALCPU.h" 10 | #include "/HALDebug.h" 11 | #include "/HALDriver.h" 12 | #include "/HALMap.h" 13 | 14 | #include "/Kernel.h" 15 | 16 | #include "/Executive.h" 17 | 18 | #include "/Security.h" 19 | 20 | #include "/Memory.h" 21 | 22 | #include "/Object.h" 23 | 24 | #include "/Process.h" 25 | 26 | #include "/IO.h" 27 | 28 | #include "/OSDLL/OS.h" 29 | 30 | #include "IOInternal.h" 31 | 32 | fn IOiCacheInitialize { fcb -- cacheblock ok } 33 | fnsection "PAGE$text" 34 | 35 | // initialize caching for an FCB 36 | 37 | IOiCacheInfoBlockCreate ok! cacheblock! 38 | 39 | if (ok@) 40 | // creation failed 41 | 42 | return 43 | end 44 | 45 | if (DEBUGCHECKS) 46 | if (fcb@ IOFileControlBlock_CacheInfoBlock + @) 47 | "IOiCacheInitialize: FCB already had a cache info block\n" KeCrash 48 | end 49 | end 50 | 51 | cacheblock@ fcb@ IOFileControlBlock_CacheInfoBlock + ! 52 | end -------------------------------------------------------------------------------- /OS/OSKernel/IO/IOPartition.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements generic partition table support. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALRTC.h" 9 | #include "/HALCPU.h" 10 | #include "/HALDebug.h" 11 | #include "/HALDriver.h" 12 | 13 | #include "/Kernel.h" 14 | 15 | #include "/Executive.h" 16 | 17 | #include "/Security.h" 18 | 19 | #include "/Memory.h" 20 | 21 | #include "/Object.h" 22 | 23 | #include "/Process.h" 24 | 25 | #include "/IO.h" 26 | 27 | #include "/OSDLL/OS.h" 28 | 29 | #include "IOInternal.h" 30 | 31 | const IOPARTITIONFORMATCOUNT 2 32 | 33 | externptr IOPartitionAPT 34 | externptr IOPartitionMBR 35 | 36 | table IOPartitionFormats 37 | // APT must appear before MBR in this table because an APT VDB may contain 38 | // an MBR signature if it is bootable on x86, and will be erroneously 39 | // detected as an MBR boot block. 40 | 41 | pointerof IOPartitionAPT 42 | pointerof IOPartitionMBR 43 | endtable 44 | 45 | fn IOPartitionTableRead { devobject -- partitiontable ok } 46 | fnsection "PAGE$text" 47 | 48 | // loop through all supported partition table formats and attempt to 49 | // identify one 50 | 51 | STATUS_NOT_AVAILABLE ok! 52 | 53 | auto i 54 | 0 i! 55 | 56 | while (i@ IOPARTITIONFORMATCOUNT <) 57 | auto format 58 | [i@]IOPartitionFormats@ format! 59 | 60 | auto detectfunc 61 | format@ IOPartitionSupportTable_Detect + @ detectfunc! 62 | 63 | if (detectfunc@ ~~) 64 | 1 i += 65 | 66 | continue 67 | end 68 | 69 | devobject@ // devobject 70 | detectfunc@ IOPartitionDetectFunction ok! partitiontable! 71 | 72 | if (ok@ ~~) 73 | // success! 74 | 75 | return 76 | end 77 | 78 | 1 i += 79 | end 80 | end -------------------------------------------------------------------------------- /OS/OSKernel/Kernel/KeCrash.df: -------------------------------------------------------------------------------- 1 | #include "/dragonfruit.h" 2 | 3 | #include "/HALCrash.h" 4 | 5 | #include "/Kernel.h" 6 | 7 | fn KeCrash { ... fmt -- } 8 | argv argc@ fmt@ HALVCrash 9 | end -------------------------------------------------------------------------------- /OS/OSKernel/Kernel/KeDFGlue.df: -------------------------------------------------------------------------------- 1 | // 2 | // Glue to make Dragonfruit.dll link into the kernel properly. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/Kernel.h" 8 | 9 | fn Malloc { size -- ptr } 10 | fnsection "INIT$text" 11 | 12 | if (DEBUGCHECKS) 13 | "Malloc used in kernel code\n" KeCrash 14 | end 15 | end 16 | 17 | fn Free { ptr -- } 18 | fnsection "INIT$text" 19 | 20 | if (DEBUGCHECKS) 21 | "Free used in kernel code\n" KeCrash 22 | end 23 | end 24 | 25 | fn Calloc { size -- ptr } 26 | fnsection "INIT$text" 27 | 28 | if (DEBUGCHECKS) 29 | "Calloc used in kernel code\n" KeCrash 30 | end 31 | end -------------------------------------------------------------------------------- /OS/OSKernel/Kernel/KeInternal.h: -------------------------------------------------------------------------------- 1 | extern KiAPCDispatchQueue { -- } 2 | extern KiDPCDispatchQueue { -- } 3 | 4 | extern KiSoftwareInterruptRequest { ipl -- } 5 | 6 | extern KiThreadSwitch { thread -- } 7 | 8 | extern KiThreadWakeup { waitstatus priboost thread -- } 9 | 10 | extern KiThreadBasePrioritySet { priority thread -- } 11 | 12 | extern KiDispatchInitialize { name type dobject -- } 13 | 14 | extern KiDispatchSatisfyAll { waitstatus priboost object -- } 15 | extern KiDispatchSatisfyFirst { waitstatus priboost object signal -- wokenthread } 16 | 17 | extern KiMutexOwnerSet { thread mutex -- } 18 | 19 | extern KiThreadPriorityBoost { boost thread -- } 20 | 21 | extern KiInterruptUsermode { context userfunc dispatchfunc trapframe -- } 22 | 23 | extern KiThreadQuantumEnd { -- } 24 | extern KiThreadNextSwitch { -- } 25 | 26 | extern KiIdleThreadEntry { -- } 27 | 28 | extern KiThreadSelect { thread -- nextthread } 29 | 30 | extern KiThreadWait { waitipl waitmode alertable explicitstatus -- ok } 31 | extern KiThreadWaitBlocksDequeue { satisfy thread -- } 32 | 33 | extern KiThreadYieldQuantum { -- } 34 | 35 | extern KiDispatchSoftwareInterrupts { -- } 36 | 37 | fnptr KiSoftwareInterruptHandlerF { -- } 38 | 39 | externptr KiIdleThread 40 | 41 | externptr KiPendingSoftwareInterrupts 42 | externptr KiPendingSoftwareInterruptMask 43 | externptr KiPendingSoftwareInterruptFirst 44 | 45 | externptr KiDPCListHead 46 | externptr KiDPCListTail 47 | 48 | externptr KiTimerExpirationDPC 49 | 50 | externptr KiThreadNext 51 | 52 | externptr KiOldIPL 53 | 54 | externptr KiDispatchEvents 55 | 56 | externptr KiQuantumUnitsDefault 57 | 58 | externptr KiClockTicks 59 | 60 | externptr KiTimerTable 61 | 62 | // must be a power of two 63 | 64 | const TIMERTABLESIZE 128 65 | 66 | const KIDISPATCHIRQ_QUANTUMEND 2 67 | const KIDISPATCHIRQ_DPC 4 -------------------------------------------------------------------------------- /OS/OSKernel/Kernel/KeMain.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization of the MINTIA kernel. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALRTC.h" 9 | #include "/HALCPU.h" 10 | #include "/HALDebug.h" 11 | #include "/HALDriver.h" 12 | 13 | #include "/Kernel.h" 14 | 15 | #include "/Executive.h" 16 | 17 | #include "KeInternal.h" 18 | 19 | extern KiCPUInit { -- } 20 | 21 | extern KiTimerInit { -- } 22 | 23 | extern KiDispatcherInit { -- } 24 | 25 | externptr KeIPLCurrent 26 | 27 | rosection "INIT$text" 28 | 29 | fn KeMain { -- ret } 30 | fnsection "INIT$text" 31 | 32 | // early init that takes place before there's a thread context. 33 | 34 | KiCPUInit 35 | 36 | KiDispatcherInit 37 | 38 | KiTimerInit 39 | 40 | KiIdleThread KiThreadSwitch 41 | 42 | 0 ret! 43 | end 44 | 45 | fn KiIdleThreadEntry { -- } 46 | fnsection "INIT$text" 47 | 48 | // the idle thread is never ever not ready to run. 49 | // if it ever stops being ready to run, the system will do undefined 50 | // things and crash -- INCLUDING DURING PHASE 0 INITIALIZATION. 51 | 52 | "Hello MINTIA World!\n" "KiIdleThread" HALLog 53 | 54 | // initialize the executive layer 55 | 56 | ExInitPhase0 57 | 58 | while (1) 59 | HALCPUHalt 60 | end 61 | end -------------------------------------------------------------------------------- /OS/OSKernel/Kernel/KeSemaphore.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the kernel semaphore object. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALRTC.h" 10 | 11 | #include "/Kernel.h" 12 | 13 | #include "/OSDLL/OSStatus.h" 14 | 15 | #include "KeInternal.h" 16 | 17 | // initializes a KeSemaphore 18 | 19 | fn KeSemaphoreInitialize { count name semaphore -- } 20 | name@ DISPATCHOBJECT_SEMAPHORE semaphore@ KiDispatchInitialize 21 | 22 | count@ semaphore@ KeSemaphore_DispatchHeader + KeDispatchHeader_Signaled + ! 23 | end 24 | 25 | fn KeSemaphoreRelease { adjustment semaphore -- ok } 26 | if (DEBUGCHECKS) 27 | if (semaphore@ KeSemaphore_DispatchHeader + KeDispatchHeader_Type + @ DISPATCHOBJECT_SEMAPHORE ~=) 28 | "KeSemaphoreRelease: not a semaphore\n" KeCrash 29 | end 30 | end 31 | 32 | 0 ok! 33 | 34 | auto ipl 35 | IPLDPC KeIPLRaise ipl! 36 | 37 | auto count 38 | semaphore@ KeSemaphore_DispatchHeader + KeDispatchHeader_Signaled + @ count! 39 | 40 | if (count@ adjustment@ + count@ <) 41 | // count+adjustment overflows 42 | 43 | ipl@ KeIPLLower 44 | 45 | STATUS_OVERFLOW ok! 46 | 47 | return 48 | end 49 | 50 | if (count@ 0 ==) 51 | while (adjustment@) 52 | auto wth 53 | 54 | 0 // waitstatus 55 | 1 // priboost 56 | semaphore@ // object 57 | 0 // signal 58 | KiDispatchSatisfyFirst wth! 59 | 60 | if (wth@ ~~) 61 | break 62 | end 63 | 64 | 1 adjustment -= 65 | end 66 | end 67 | 68 | adjustment@ count += 69 | 70 | count@ semaphore@ KeSemaphore_DispatchHeader + KeDispatchHeader_Signaled + ! 71 | 72 | ipl@ KeIPLLower 73 | end -------------------------------------------------------------------------------- /OS/OSKernel/Kernel/KeStatistics.df: -------------------------------------------------------------------------------- 1 | // 2 | // Maintainence of kernel statistics. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALRTC.h" 10 | 11 | #include "/Kernel.h" 12 | 13 | #include "/OSDLL/OS.h" 14 | 15 | buffer KeStatistics OSStatistics_SIZEOF 16 | public KeStatistics 17 | -------------------------------------------------------------------------------- /OS/OSKernel/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := Console \ 2 | Executive \ 3 | FSRTL \ 4 | IO \ 5 | Kernel \ 6 | Memory \ 7 | Object \ 8 | Process \ 9 | Security \ 10 | IPC \ 11 | ViewCache 12 | 13 | LINKOPT = -nostubs 14 | 15 | OUTPUTFILE := $(SYSROOT)/OSKernel.exe 16 | 17 | DYLIBS := HAL.dll:$(HALBIN) Dragonfruit.dll:$(DFLIBBIN) 18 | 19 | MOVEEXPR := base=0x80001000 20 | 21 | INCDIR := $(HALINCDIR):./include/ 22 | 23 | include $(REPO)/Project.mk 24 | 25 | Executive/$(ARCHITECTURE)/OSCallTrampolines.s: $(REPO)/OS/Headers/OSDLL/OSCalls.h 26 | $(SYSCALLGEN) $(REPO)/OS/Headers/OSDLL/OSCalls.h NO ./Executive/$(ARCHITECTURE)/OSCallTrampolines.s -------------------------------------------------------------------------------- /OS/OSKernel/Memory/fox32/MmFlushCache.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements CPU cache flushing for the fox32 architecture. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALMap.h" 10 | #include "/HALDebug.h" 11 | 12 | #include "/Kernel.h" 13 | 14 | #include "/Executive.h" 15 | 16 | #include "/Memory.h" 17 | 18 | #include "/Security.h" 19 | 20 | #include "/IO.h" 21 | 22 | #include "/Process.h" 23 | 24 | #include "/OSDLL/OSStatus.h" 25 | 26 | #include "../MmInternal.h" 27 | 28 | fn MmMDLFlush { offset length write dma mdl -- } 29 | return 30 | end -------------------------------------------------------------------------------- /OS/OSKernel/Memory/fox32/MmPlatformInit.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization of the MINTIA memory manager. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALMap.h" 9 | #include "/HALCPU.h" 10 | #include "/HALResource.h" 11 | 12 | #include "/Kernel.h" 13 | 14 | #include "/Executive.h" 15 | 16 | #include "/Security.h" 17 | 18 | #include "/Memory.h" 19 | 20 | #include "/Process.h" 21 | 22 | #include "/Object.h" 23 | 24 | #include "/IO.h" 25 | 26 | #include "/OSDLL/OS.h" 27 | 28 | #include "../MmInternal.h" 29 | 30 | extern HALfox32MapSwitch { pgtb -- } 31 | 32 | fn MiPlatformInit { -- } 33 | fnsection "INIT$text" 34 | 35 | #ifdef 0 36 | // unmap the lower half so those page tables can be reclaimed 37 | 38 | HALPlatformKernelPageDirectory@ IDENTITYSPACE | // ptr 39 | 2048 // size 40 | 0 // word 41 | memset 42 | #endif 43 | 44 | // flush entire TLB 45 | 46 | HALPlatformKernelPageDirectory@ // pgtb 47 | HALfox32MapSwitch 48 | end -------------------------------------------------------------------------------- /OS/OSKernel/Memory/xr17032/MmFlushCache.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements CPU cache flushing for the xr17032 architecture. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALMap.h" 10 | #include "/HALDebug.h" 11 | 12 | #include "/Kernel.h" 13 | 14 | #include "/Executive.h" 15 | 16 | #include "/Memory.h" 17 | 18 | #include "/Security.h" 19 | 20 | #include "/IO.h" 21 | 22 | #include "/Process.h" 23 | 24 | #include "/OSDLL/OSStatus.h" 25 | 26 | #include "../MmInternal.h" 27 | 28 | fn MmMDLFlush { offset length write dma mdl -- } 29 | // xr17032 gives us no provisions for partial cache flushes, so just 30 | // yeet everything. 31 | 32 | if (write@) 33 | HALCPUFence 34 | end else 35 | if (dma@) 36 | HALDcacheExpunge 37 | end 38 | 39 | if (mdl@ MmMDLHeader_Flags + @ MMMDL_PAGEIN &) 40 | HALIcacheSynchronize 41 | end 42 | end 43 | end -------------------------------------------------------------------------------- /OS/OSKernel/Memory/xr17032/MmPlatformInit.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization of the MINTIA memory manager. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALMap.h" 9 | #include "/HALCPU.h" 10 | #include "/HALResource.h" 11 | 12 | #include "/Kernel.h" 13 | 14 | #include "/Executive.h" 15 | 16 | #include "/Security.h" 17 | 18 | #include "/Memory.h" 19 | 20 | #include "/Process.h" 21 | 22 | #include "/Object.h" 23 | 24 | #include "/IO.h" 25 | 26 | #include "/OSDLL/OS.h" 27 | 28 | #include "../MmInternal.h" 29 | 30 | extern HALXr17032TLBFlushAll { -- } 31 | 32 | fn MiPlatformInit { -- } 33 | fnsection "INIT$text" 34 | 35 | #ifdef 0 36 | // unmap the lower half so those page tables can be reclaimed 37 | 38 | HALPlatformKernelPageDirectory@ IDENTITYSPACE | // ptr 39 | 2048 // size 40 | 0 // word 41 | memset 42 | #endif 43 | 44 | HALXr17032TLBFlushAll 45 | end -------------------------------------------------------------------------------- /OS/OSKernel/Process/PsInternal.h: -------------------------------------------------------------------------------- 1 | struct PsiProcessActivationBlock 2 | KeEvent_SIZEOF Event 3 | 4 References 4 | endstruct 5 | 6 | extern PsiReaperWorker { context1 context2 -- } 7 | 8 | extern PsiThreadExit { -- } 9 | 10 | extern PsiProcessObjectDelete { object -- } 11 | extern PsiThreadObjectDelete { object -- } 12 | 13 | extern PsiJobInit { -- } 14 | 15 | extern PsiJobInherit { destprocessobject srcprocessobject -- ok } 16 | extern PsiJobIndicateProcessExit { processobject -- } 17 | 18 | extern PsiIdTableLock { alertable -- ok } 19 | extern PsiIdTableUnlock { -- } 20 | 21 | extern PsiIdCreate { object -- id ok } 22 | extern PsiIdDelete { id -- } 23 | 24 | const PSI_ID_INDEX_SHIFT 8 25 | const PSI_ID_SEQUENCE_MASK 0xFF -------------------------------------------------------------------------------- /OS/OSKernel/Security/SeInit.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization of the MINTIA security subsystem. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALMap.h" 10 | 11 | #include "/Kernel.h" 12 | 13 | #include "/Executive.h" 14 | 15 | #include "/Object.h" 16 | 17 | #include "/Memory.h" 18 | 19 | #include "/Security.h" 20 | 21 | #include "/Process.h" 22 | 23 | #include "/OSDLL/OS.h" 24 | 25 | rosection "INIT$text" 26 | 27 | fn SeInitPhase0 { -- } 28 | fnsection "INIT$text" 29 | 30 | auto idleproc 31 | KeProcessCurrent idleproc! 32 | 33 | 0 // inheritfrom 34 | idleproc@ PsProcess_PagedArea + @ PsProcessPaged_Permissions + // permissions 35 | SePermissionsInitialize 36 | 37 | auto ok 38 | 39 | SYSTEMPERMISSION_SYSTEM idleproc@ SeProcessGrantPermission ok! 40 | 41 | if (ok@) 42 | ok@ "SeInitPhase0: couldn't grant idle process necessary permissions (%i)\n" KeCrash 43 | end 44 | 45 | SYSTEMPERMISSION_ADMIN idleproc@ SeProcessGrantPermission ok! 46 | 47 | if (ok@) 48 | ok@ "SeInitPhase0: couldn't grant idle process necessary permissions (%i)\n" KeCrash 49 | end 50 | end -------------------------------------------------------------------------------- /OS/OSKernel/Security/SeOSCalls.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements the system calls for the security subsystem. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/HALLog.h" 8 | #include "/HALCPU.h" 9 | #include "/HALMap.h" 10 | 11 | #include "/Kernel.h" 12 | 13 | #include "/Executive.h" 14 | 15 | #include "/Object.h" 16 | 17 | #include "/Memory.h" 18 | 19 | #include "/Security.h" 20 | 21 | #include "/IO.h" 22 | 23 | #include "/Process.h" 24 | 25 | #include "/OSDLL/OS.h" 26 | 27 | fn OSCheckPermission { permission processhandle -- ok } 28 | fnsection "PAGE$text" 29 | 30 | // this is a form of querying so no permissions are required on the process 31 | // handle. 32 | 33 | auto object 34 | PsProcessObjectType@ // type 35 | processhandle@ // handle 36 | ObObjectReferenceByHandle ok! object! drop 37 | 38 | if (ok@) 39 | return 40 | end 41 | 42 | permission@ // permission 43 | object@ // process 44 | SeProcessCheckPermission ok! 45 | 46 | object@ ObObjectDereferenceByPointer drop 47 | end 48 | 49 | fn OSGrantPermission { permission processhandle -- ok } 50 | fnsection "PAGE$text" 51 | 52 | SYSTEMPERMISSION_ADMIN // permission 53 | KeProcessCurrent // process 54 | SeProcessCheckPermission ok! 55 | 56 | if (ok@) 57 | return 58 | end 59 | 60 | auto object 61 | PsProcessObjectType@ // type 62 | processhandle@ // handle 63 | ObObjectReferenceByHandle ok! object! drop 64 | 65 | if (ok@) 66 | return 67 | end 68 | 69 | permission@ // permission 70 | object@ // process 71 | SeProcessGrantPermission ok! 72 | 73 | object@ ObObjectDereferenceByPointer drop 74 | end -------------------------------------------------------------------------------- /OS/OSKernel/include/Console.h: -------------------------------------------------------------------------------- 1 | #include "/Console/Console.h" 2 | #include "/Console/VideoConsole.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/Console/Console.h: -------------------------------------------------------------------------------- 1 | extern CoConsoleByFileHandle { requiredaccess filehandle -- consoleobject ok } 2 | 3 | extern CoConsoleInitialize { header -- } 4 | 5 | extern CoConsoleRemoveProcess { process -- ok } 6 | extern CoConsoleInsertProcess { process consoleobject -- ok } 7 | 8 | extern CoConsoleIOControl { arg2 arg1 access console lastmode -- ret ok } 9 | 10 | extern CoDuplexObjectCreate { context txfunc flushfunc flags pri quotablock permanent name permissions -- duplexobject fileobject ok } 11 | extern CoDuplexCreate { flags name permissions -- duplexhandle filehandle ok } 12 | 13 | extern CoDuplexInputCharacter { c duplex -- ok } 14 | extern CoDuplexReadTransmitCharacter { duplex -- c ok } 15 | extern CoDuplexWriteCharacter { c duplex -- ok } 16 | 17 | extern CoDuplexGetContext { duplex -- context } 18 | 19 | fnptr CoDuplexTXFunction { c duplex -- ok } 20 | fnptr CoDuplexFlushFunction { duplex -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Console/VideoConsole.h: -------------------------------------------------------------------------------- 1 | externptr CoVideoConsole 2 | externptr CoVideoConsoleInputDevice 3 | 4 | extern CoVideoConsoleInit { -- } 5 | extern CoVideoConsoleExpediteRedraw { -- } 6 | extern CoVideoConsoleInputCharacter { c -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive.h: -------------------------------------------------------------------------------- 1 | #include "/Executive/Boost.h" 2 | #include "/Executive/RwLock.h" 3 | #include "/Executive/Handle.h" 4 | #include "/Executive/Call.h" 5 | #include "/Executive/Event.h" 6 | #include "/Executive/Semaphore.h" 7 | #include "/Executive/Mutex.h" 8 | #include "/Executive/Shutdown.h" 9 | #include "/Executive/AvlTree.h" 10 | #include "/Executive/Timer.h" 11 | 12 | extern ExInitPhase0 { -- } 13 | extern ExInitPhase1 { context1 context2 -- } 14 | 15 | externptr ExBootFlags -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/AvlTree.h: -------------------------------------------------------------------------------- 1 | // This structure gets inlined in funky ways in a lot of places, such as VADs, 2 | // file cache page PFDBEs, view cache buffers, and the FAT driver name cache. 3 | // Don't change its layout without fully understanding them or you will be 4 | // brutally executed. 5 | 6 | const EXAVLPARENTMASK (3 ~) 7 | const EXAVLBALANCEMASK 3 8 | 9 | struct ExAvlTreeNode 10 | 4 Parent // bottom 2 bits contain balance 11 | 4 LeftChild 12 | 4 RightChild 13 | 4 Value 14 | 4 EndValue // only used for some things 15 | endstruct 16 | 17 | struct ExAvlTree 18 | 12 Root // enough space for a Parent, LeftChild, RightChild 19 | endstruct 20 | 21 | extern ExAvlTreeInitialize { tree -- } 22 | 23 | extern ExAvlTreeInsertWithComparisonFunction { func node tree -- } 24 | extern ExAvlTreeInsert { node tree -- } 25 | extern ExAvlTreeRemove { node tree -- } 26 | 27 | extern ExAvlTreeNodeNext { node -- nextnode } 28 | extern ExAvlTreeNodePrevious { node -- prevnode } 29 | 30 | extern ExAvlTreeNodeFirst { tree -- first } 31 | 32 | extern ExAvlTreeFindNodeByValue { value tree -- node } 33 | extern ExAvlTreeFindNodeByValueRange { value tree -- node } 34 | 35 | extern ExAvlTreeFindFirstContainingNode { value endvalue tree -- node } 36 | 37 | extern ExAvlTreeFindEmptyRange { size tree -- value } 38 | 39 | fnptr ExAvlTreeComparisonF { node1 node2 -- result } 40 | 41 | #ifdef DEBUGCHECKS 42 | 43 | externptr ExAvlTreeLookupCount 44 | externptr ExAvlTreeModifyCount 45 | externptr ExAvlTreeDepthCount 46 | 47 | #endif -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Boost.h: -------------------------------------------------------------------------------- 1 | // default boost values. 2 | 3 | const IOBOOSTSERIAL 2 4 | const IOBOOSTDISK 1 5 | const IOBOOSTKEYBOARD 6 6 | const IOBOOSTMOUSE 6 7 | const IOBOOSTCONHOST 6 8 | const IOBOOSTCONSOLE IOBOOSTSERIAL 9 | const IOBOOSTPIPE 1 10 | 11 | // gives the first thread of a process a 2-quanta advantage, so that 12 | // interactive commands (i.e. ls, ps) feel responsive even while there 13 | // is a large quantity of background compute-bound activity. 14 | 15 | const KEBOOSTINITIAL 2 -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Call.h: -------------------------------------------------------------------------------- 1 | extern ExCallGetString { max string -- buf ok } 2 | extern ExCallFreeString { buf -- } 3 | 4 | extern ExCallGetUserBuffer { lockforwrite length vaddr -- buf mdl ok } 5 | extern ExCallFreeUserBuffer { mdl -- } 6 | 7 | externptr ExFaultStatuses -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Event.h: -------------------------------------------------------------------------------- 1 | extern ExEventCreateObject { signaled type permissions name -- eventobject ok } 2 | extern ExEventCreate { signaled type permissions name -- eventhandle ok } 3 | 4 | extern ExEventResetObject { eventobject -- signaled } 5 | extern ExEventReset { eventhandle -- signaled ok } 6 | 7 | extern ExEventSignalObject { eventobject -- } 8 | extern ExEventSignal { eventhandle -- ok } 9 | 10 | extern ExEventPulseObject { eventobject -- } 11 | extern ExEventPulse { eventhandle -- ok } 12 | 13 | extern ExEventReadState { eventhandle -- signaled ok } 14 | 15 | externptr ExEventObjectType -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Handle.h: -------------------------------------------------------------------------------- 1 | fnptr ExHandleEnumFunction { entryptr handle handletable -- ok } 2 | 3 | extern ExHandleTableDelete { func handletable -- } 4 | extern ExHandleTableCreate { context quotablock entrysizelog -- handletable ok } 5 | 6 | extern ExHandleTableLock { alertable handletable -- ok } 7 | extern ExHandleTableLockShared { alertable handletable -- ok } 8 | extern ExHandleTableUnlock { handletable -- } 9 | 10 | extern ExHandleDelete { handle handletable locked -- entryptr entryvalue ok } 11 | extern ExHandleCreate { entryvalue handletable locked -- handle entryptr ok } 12 | extern ExHandleLookup { handle handletable locked -- entryptr ok } 13 | 14 | extern ExHandleTableLookupAndReferenceObject { handle handletable locked -- object ok } 15 | 16 | extern ExHandleTableGetContext { handletable -- context } -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Mutex.h: -------------------------------------------------------------------------------- 1 | extern ExMutexCreateObject { permissions name -- mutexobject ok } 2 | extern ExMutexCreate { permissions name -- mutexhandle ok } 3 | 4 | extern ExMutexRelease { mutexhandle -- ok } 5 | 6 | extern ExMutexReadState { mutexhandle -- locked ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/RwLock.h: -------------------------------------------------------------------------------- 1 | struct ExRwLockOwner 2 | 4 Locked 3 | 4 OwningThread 4 | endstruct 5 | 6 | struct ExRwLock 7 | ExRwLockOwner_SIZEOF ExclusiveOwner 8 | ExRwLockOwner_SIZEOF SharedOwner 9 | 4 OwnerTable 10 | 4 SharedSemaphore 11 | 4 ExclusiveSyncEvent 12 | 13 | 2 TableSizeI 14 | 2 SharedWaitersCountI 15 | 2 ExclusiveWaitersCountI 16 | 2 HeldCountI 17 | endstruct 18 | 19 | extern ExRwLockInitialize { name rwlock -- } 20 | extern ExRwLockUninitialize { rwlock -- } 21 | extern ExRwLockRelease { rwlock -- } 22 | extern ExRwLockAcquireExclusive { alertable nowait rwlock -- ok } 23 | extern ExRwLockAcquireShared { alertable nowait canstarve rwlock -- ok } 24 | extern ExRwLockDemoteToShared { rwlock -- ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Semaphore.h: -------------------------------------------------------------------------------- 1 | extern ExSemaphoreCreateObject { count permissions name -- semaphoreobject ok } 2 | extern ExSemaphoreCreate { count permissions name -- semaphorehandle ok } 3 | 4 | extern ExSemaphoreRelease { adjustment semaphorehandle -- ok } 5 | 6 | extern ExSemaphoreReadState { semaphorehandle -- count ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Shutdown.h: -------------------------------------------------------------------------------- 1 | extern ExShutdownSystem { mode -- } 2 | extern ExShutdownSystemFinish { -- } 3 | 4 | externptr ExShuttingDown -------------------------------------------------------------------------------- /OS/OSKernel/include/Executive/Timer.h: -------------------------------------------------------------------------------- 1 | extern ExTimerCreateObject { permissions name -- timerobject ok } 2 | extern ExTimerCreate { permissions name -- timerhandle ok } 3 | 4 | extern ExTimerResetObject { timerobject -- signaled } 5 | extern ExTimerReset { timerhandle -- signaled ok } 6 | 7 | extern ExTimerEnqueueObject { interval timerobject -- ok } 8 | extern ExTimerDequeueObject { timerobject -- ok } 9 | 10 | extern ExTimerEnqueue { interval timerhandle -- ok } 11 | extern ExTimerDequeue { timerhandle -- ok } 12 | 13 | extern ExTimerReadState { timerhandle -- signaled ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/FSRTL.h: -------------------------------------------------------------------------------- 1 | #include "/FSRTL/FSVolume.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/FSRTL/FSVolume.h: -------------------------------------------------------------------------------- 1 | extern FSVolumeFlush { mount -- ok } 2 | 3 | extern FSCheckAccess { access permbits owninguid owninggid mount -- ok } 4 | extern FSFileObjectFill { fcb permissions uid gid fileobject mount -- } 5 | 6 | extern FSFileControlBlockGetMount { fcb -- mount } -------------------------------------------------------------------------------- /OS/OSKernel/include/IO.h: -------------------------------------------------------------------------------- 1 | #include "/IO/IO.h" 2 | #include "/IO/Device.h" 3 | #include "/IO/Dispatch.h" 4 | #include "/IO/ReadWrite.h" 5 | #include "/IO/Partition.h" 6 | #include "/IO/Cache.h" 7 | #include "/IO/Filesystem.h" 8 | #include "/IO/PageFile.h" 9 | #include "/IO/Packet.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/IO/Cache.h: -------------------------------------------------------------------------------- 1 | extern IOCacheDumpInfo { cacheblock -- } 2 | 3 | extern IOCacheInfoBlockLockBCB { cacheblock -- } 4 | extern IOCacheInfoBlockUnlockBCB { cacheblock -- } 5 | 6 | extern IOCacheInfoBlockTryIncrementMap { cacheblock -- oldcount ok } 7 | extern IOCacheInfoBlockDecrementMap { cacheblock -- oldcount } 8 | 9 | extern IOCacheInfoBlockFlush { cacheblock -- ok } 10 | extern IOCacheInfoBlockTruncate { newsize writeout cacheblock -- ok } 11 | 12 | extern IOCachePageModified { pfdbe -- } 13 | 14 | extern IOCacheAddZeroPage { modify offset fcb -- } 15 | 16 | extern IOCachePageRead { localpteaddr flags kflags offset fcb -- pfdbe ok } 17 | 18 | extern IOCachePageWrite { transfer kflags pfdbe -- ok } 19 | 20 | extern IOCachePageFlush { pfdbe -- ok } 21 | 22 | extern IOCacheZeroData { size offset flags fcb -- ok } 23 | 24 | externptr IOCachePagesUsed 25 | externptr IOModifiedFilePageCountTotal 26 | 27 | const IODIRTYFILEPAGEMAX 100 -------------------------------------------------------------------------------- /OS/OSKernel/include/IO/PageFile.h: -------------------------------------------------------------------------------- 1 | extern IOPageFileCreate { minpages maxpages pri initialobjecthandle path -- ok } 2 | extern IOPageFileQuery { query id -- ok } 3 | 4 | extern IOSwapPageFree { pno pagefile -- } 5 | extern IOSwapPageFreePTE { pte -- } 6 | extern IOSwapPageReadPTE { kflags pfdbe pte -- ok } 7 | 8 | extern IOPageFileWriteMDL { pagecount offset mdl -- ok } 9 | 10 | extern IOPageFileAwaitCreation { -- } 11 | 12 | extern IOPageFileRequestExpansion { ipl pri pages -- ok } 13 | 14 | extern IOPageFileGetPriority { pagefile -- pri } 15 | extern IOPageFileGetFree { pagefile -- free } 16 | extern IOPageFileGetNumber { pagefile -- number } 17 | 18 | extern IOPageFileReserve { pagesneeded pagefile -- offset ok } 19 | extern IOPageFileRelease { pages offset pagefile -- } 20 | 21 | extern IOPageFileFullOrFragmented { fragmented -- } 22 | 23 | const IOPAGEFILEMAX 16 24 | 25 | const IOPAGEFILEMAXPRI 8 26 | 27 | const IOPAGEFILEFREELOW 32 28 | 29 | externptr IOPageFileExtendEvent 30 | 31 | externptr IOSwapPagesUsed 32 | externptr IOSwapPagesCount 33 | externptr IOSwapPagesUsedPeak 34 | 35 | externptr IOSwapPagesWritten 36 | externptr IOSwapPagesRead 37 | 38 | externptr IOPageFileCount -------------------------------------------------------------------------------- /OS/OSKernel/include/IO/Partition.h: -------------------------------------------------------------------------------- 1 | extern IOPartitionTableRead { devobject -- partitiontable ok } 2 | 3 | fnptr IOPartitionDetectFunction { devobject -- partitiontable ok } 4 | 5 | struct IOPartitionSupportTable 6 | 4 Name 7 | 4 Detect 8 | 4 Reserved1 9 | 4 Reserved2 10 | endstruct 11 | 12 | const IOVOLUMELABELMAX 64 13 | 14 | // do NOT change the size of this 15 | struct IOPartitionTable 16 | 4 Format 17 | IOVOLUMELABELMAX Label 18 | 4 PartitionCount 19 | 4 Reserved1 20 | 4 Reserved2 21 | 4 Reserved3 22 | endstruct 23 | 24 | // do NOT change the size of this 25 | struct IOPartitionEntry 26 | IOVOLUMELABELMAX Label 27 | 4 BlockOffset 28 | 4 SizeInBlocks 29 | 4 ID 30 | 4 Reserved1 31 | 4 Reserved2 32 | 4 Reserved3 33 | endstruct -------------------------------------------------------------------------------- /OS/OSKernel/include/IO/ReadWrite.h: -------------------------------------------------------------------------------- 1 | extern IOFileFlush { purge filehandle -- ok } 2 | 3 | extern IOFileTruncate { newsize growing handle -- oldsize ok } 4 | 5 | extern IOFileSeek { offset handle mode -- newoffset ok } 6 | 7 | extern IOFileRead { timeout flags length buffer filehandle -- bytesread ok } 8 | extern IOFileWrite { flags length buffer filehandle -- byteswritten ok } 9 | 10 | extern IOFileReadAsync { requestblock flags offset length buffer filehandle -- ok } 11 | extern IOFileWriteAsync { requestblock flags offset length buffer filehandle -- ok } 12 | 13 | extern IODirectoryRename { srcname srcfilehandle destname destfilehandle -- ok } 14 | 15 | extern IODirectoryUnlink { name filehandle -- ok } 16 | 17 | extern IODirectoryRead { count dirent filehandle lastmode -- readcount ok } 18 | extern IODirectoryReadObject { count dirent fileobject lastmode -- readcount ok } 19 | 20 | // direct transfer helpers 21 | 22 | extern IOSystemBufferTransfer { functioncode flags kflags buf length offset fcb -- bytes ok } 23 | extern IOMDLTransfer { iop completionroutine functioncode flags kflags mdl offset fcb -- bytes ok } 24 | 25 | extern IOReadWriteAsync { requestblock flags length offset buffer fileobject functioncode -- ok } 26 | extern IOReadWrite { timeout flags length offset buffer fileobject functioncode -- bytes ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/IPC.h: -------------------------------------------------------------------------------- 1 | #include "/IPC/Port.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/IPC/Port.h: -------------------------------------------------------------------------------- 1 | extern IPCInitPhase1 { -- } 2 | 3 | externptr IPCPortObjectType 4 | 5 | extern IPCPortCreateObject { flags maxlen serverport owningprocess permissions name -- portobject ok } 6 | extern IPCPortCreate { flags maxlen permissions name -- porthandle ok } 7 | 8 | extern IPCPortAccept { mode context txmsg reject porthandle -- ok } 9 | extern IPCPortConnect { mode rxmsg txmsg timeout initialobjecthandle path -- porthandle ok } 10 | 11 | extern IPCPortSendAndWaitReceive { mode rxmsg txmsg timeout porthandle -- ok } 12 | extern IPCPortSendAndWaitReply { mode rxmsg txmsg timeout porthandle -- ok } 13 | 14 | extern IPCPortOpenProcessByClientID { access clientid porthandle -- processhandle ok } 15 | 16 | extern IPCPortAllocateCompletionMessage { context portobject -- msg ok } 17 | extern IPCPortSendCompletionMessage { bytes status msg -- } 18 | extern IPCCompletionMessageFree { msg -- } 19 | 20 | extern IPCThreadBlockFree { thread -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel.h: -------------------------------------------------------------------------------- 1 | #define OSKERNEL 2 | 3 | #include "/Kernel/Crash.h" 4 | #include "/Kernel/IPL.h" 5 | 6 | #include "/Kernel/APC.h" 7 | #include "/Kernel/DPC.h" 8 | #include "/Kernel/Time.h" 9 | #include "/Kernel/Dispatch.h" 10 | #include "/Kernel/Timer.h" 11 | 12 | #include "/Kernel/Mutex.h" 13 | #include "/Kernel/Event.h" 14 | #include "/Kernel/Semaphore.h" 15 | 16 | #include "/Kernel/Process.h" 17 | 18 | externptr KeStatistics -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/APC.h: -------------------------------------------------------------------------------- 1 | fnptr KeAPCFunctionNormal { context1 context2 -- } 2 | 3 | // normalfunc, context1, and context2 are passed by ref here!! 4 | fnptr KeAPCFunctionSpecial { normalfunc context1 context2 apc -- } 5 | 6 | struct KeAPC 7 | 4 Thread 8 | 9 | 4 Prev 10 | 4 Next 11 | 12 | 4 FunctionSpecial 13 | 4 FunctionNormal 14 | 15 | 4 Context1 16 | 4 Context2 17 | 18 | 1 EnqueuedB 19 | 1 ModeB 20 | 1 Reserved1B 21 | 1 Reserved2B 22 | endstruct 23 | 24 | extern KeAPCInitialize { thread specialfunc normalfunc apc -- } 25 | extern KeUserAPCInitialize { thread kernelfunc userfunc special apc -- } 26 | extern KeAPCDequeue { apc -- ok } 27 | extern KeAPCEnqueue { context1 context2 priboost apc -- ok } 28 | extern KeAPCDispatchQueueUser { dispatchfunc trapframe -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Crash.h: -------------------------------------------------------------------------------- 1 | extern KeCrash { ... fmt -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/DPC.h: -------------------------------------------------------------------------------- 1 | fnptr KeDPCFunction { context1 context2 dpc -- } 2 | 3 | // WARNING: changing the offset of the Next field may break optimized asm 4 | // routines 5 | 6 | // do NOT change the size of this 7 | struct KeDPC 8 | 4 Next 9 | 4 Function 10 | 4 Context1 11 | 4 Context2 12 | 4 Enqueued 13 | endstruct 14 | 15 | const DPCHIGHIMPORTANCE 1 16 | const DPCLOWIMPORTANCE 2 17 | 18 | extern KeDPCEnqueue { context1 context2 importance dpc -- ok } 19 | extern KeDPCDispatchQueue { -- } 20 | extern KeDPCInitialize { function dpc -- } 21 | 22 | externptr KeDPCActive -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Dispatch.h: -------------------------------------------------------------------------------- 1 | const DISPATCHOBJECT_TIMER 1 2 | const DISPATCHOBJECT_MUTEX 2 3 | const DISPATCHOBJECT_EVENTNOTIF 3 4 | const DISPATCHOBJECT_EVENTSYNCH 4 5 | const DISPATCHOBJECT_SEMAPHORE 5 6 | 7 | // do NOT change the size of this 8 | struct KeDispatchHeader 9 | 4 Signaled 10 | 11 | 4 Type 12 | 13 | 4 WaitBlockListHead 14 | 4 WaitBlockListTail 15 | 16 | 4 Name 17 | endstruct 18 | 19 | // a thread can wait on up to THREADWAITBLOCKS dispatcher objects at a time, 20 | // and a dispatcher object can be waited on by an arbitrary number of threads. 21 | // WaitBlocks are the data structure that accomplishes this feature of the 22 | // kernel. 23 | 24 | struct KeDispatchWaitBlock 25 | 4 Prev 26 | 4 Next 27 | 28 | 4 WaitType 29 | 30 | 4 WaitIndex 31 | 32 | 4 Thread 33 | 4 Object 34 | endstruct 35 | 36 | const THREADWAITBLOCKS 2 37 | 38 | extern KeDispatchInitialize { name type dobject -- } 39 | extern KeDispatchIsSignaled { dobject -- signaled } 40 | extern KeDispatchWaitBlockTableInitialize { thread count waitblocktable -- } 41 | 42 | extern KeThreadWaitForMultipleObjects { waitmode alertable waittype timeout objectcount objecttable waitblocktable -- ok } 43 | extern KeThreadWaitForObject { waitmode alertable timeout object -- ok } 44 | 45 | extern KeThreadWaitSuspended { -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Event.h: -------------------------------------------------------------------------------- 1 | // do NOT change the size of this 2 | struct KeEvent 3 | KeDispatchHeader_SIZEOF DispatchHeader 4 | endstruct 5 | 6 | extern KeEventInitialize { signaled type name event -- } 7 | extern KeEventReset { event -- signaled } 8 | extern KeEventSignal { priboost event -- } 9 | extern KeEventPulse { priboost event -- } 10 | extern KeEventSignalGetWaiter { priboost event -- waiter } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/IPL.h: -------------------------------------------------------------------------------- 1 | #include "/HALIPL.h" 2 | 3 | extern KeIPLRaise { newipl -- oldipl } 4 | extern KeIPLLower { newipl -- } 5 | extern KeIPLCurrentGet { -- ipl } 6 | 7 | extern KeClockTick { interval trapframe -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Mutex.h: -------------------------------------------------------------------------------- 1 | // do NOT change the size of this 2 | struct KeMutex 3 | KeDispatchHeader_SIZEOF DispatchHeader 4 | 4 OwningThread 5 | 4 Mode 6 | 7 | 4 Prev 8 | 4 Next 9 | endstruct 10 | 11 | extern KeMutexInitialize { name mode mutex -- } 12 | extern KeMutexRelease { abandon mutex -- ok } 13 | extern KeMutexIsLocked { mutex -- locked } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Semaphore.h: -------------------------------------------------------------------------------- 1 | // do NOT change the size of this 2 | struct KeSemaphore 3 | KeDispatchHeader_SIZEOF DispatchHeader 4 | endstruct 5 | 6 | extern KeSemaphoreInitialize { count name semaphore -- } 7 | extern KeSemaphoreRelease { adjustment semaphore -- ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Time.h: -------------------------------------------------------------------------------- 1 | // do NOT change this 2 | struct KeTime 3 | 4 SecPart 4 | 4 MsPart 5 | endstruct 6 | 7 | extern KeRealTimeToLocalTime { desttime srctime -- } 8 | extern KeLocalTimeToRealTime { desttime srctime -- } 9 | 10 | extern KeTimeZoneSet { offset -- oldoffset } 11 | extern KeTimeZoneGet { -- offset } 12 | 13 | extern KeTimeSet { time -- ok } 14 | 15 | extern KeTimeQuery { time -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Kernel/Timer.h: -------------------------------------------------------------------------------- 1 | // do NOT change the size of this 2 | struct KeTimer 3 | KeDispatchHeader_SIZEOF DispatchHeader 4 | 4 Next 5 | 4 Prev 6 | 4 Enqueued 7 | 4 ExpiryTicks 8 | 4 DPC 9 | endstruct 10 | 11 | extern KeTimerInitialize { name dpc timer -- } 12 | extern KeTimerDequeue { timer -- ok } 13 | extern KeTimerEnqueue { context1 context2 interval timer -- ok } 14 | extern KeTimerReset { timer -- signaled } -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory.h: -------------------------------------------------------------------------------- 1 | #include "/Memory/Memory.h" 2 | #include "/Memory/Quota.h" 3 | #include "/Memory/Evict.h" 4 | #include "/Memory/Section.h" 5 | #include "/Memory/VAD.h" 6 | #include "/Memory/Pool.h" 7 | #include "/Memory/Process.h" 8 | #include "/Memory/PTE.h" 9 | #include "/Memory/IORegion.h" 10 | #include "/Memory/MDL.h" 11 | #include "/Memory/Zone.h" 12 | #include "/Memory/ViewCache.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/Evict.h: -------------------------------------------------------------------------------- 1 | fnptr MmEvictionFunction { pfdbe -- } 2 | 3 | const MMEVICTFLAG_MODIFIED 1 4 | const MMEVICTFLAG_DELETED 2 5 | const MMEVICTFLAG_PRIVATE 16 6 | const MMEVICTFLAG_VALID 64 // file cache 7 | const MMEVICTFLAG_IOINPROGRESS 128 8 | 9 | const MMEVICTTYPE_FILE 0 10 | const MMEVICTTYPE_ANON 1 11 | 12 | extern MmEvictablePageInitialize { flags evictabletype pfdbe -- } 13 | extern MmEvictablePageGet { flags evictabletype priority -- pfdbe ok } 14 | extern MmEvictablePageDelete { pfdbe -- } 15 | extern MmEvictablePageDereference { pfdbe -- oldcount } 16 | extern MmEvictablePageReference { pfdbe -- oldcount } 17 | 18 | extern MmEvictablePageModify { pfdbe process -- } 19 | 20 | extern MmEvictablePageWait { process pri pfdbe -- ok } 21 | extern MmEvictablePageSatisfy { pfdbe -- } 22 | extern MmEvictablePageStartIO { pfdbe -- } 23 | 24 | externptr MmModifiedPageCount 25 | externptr MmModifiedFilePageCount 26 | 27 | externptr MmModifiedPageMaximum 28 | externptr MmModifiedPageMinimum -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/IORegion.h: -------------------------------------------------------------------------------- 1 | const MMIO_NOCACHE 0 2 | const MMIO_CACHED 1 3 | const MMIO_WRITECOMBINE 2 4 | 5 | extern MmIORegionMap { cached length phyaddr -- vaddr ok } 6 | extern MmIORegionUnmap { length vaddr -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/MDL.h: -------------------------------------------------------------------------------- 1 | struct MmMDLHeader 2 | 4 VirtualAddress 3 | 4 MappedAddress 4 | 5 | 4 Length 6 | 4 Flags 7 | 8 | 4 QuotaBlock 9 | 10 | 4 Process 11 | endstruct 12 | 13 | const MMMDL_MODIFIED 1 14 | const MMMDL_PINNED 2 15 | const MMMDL_MAPPED 4 16 | const MMMDL_ZONEMDL 8 17 | const MMMDL_DONTUNMAP 16 18 | const MMMDL_DONTUNPIN 32 19 | const MMMDL_PAGEIN 64 20 | const MMMDL_FREE 128 21 | 22 | extern MmMDLInitialize { length vaddr kflags mdl -- } 23 | 24 | extern MmMDLGetSize { vaddr length -- size } 25 | 26 | extern MmMDLAllocate { length vaddr kflags -- mdl ok } 27 | extern MmMDLAllocateWithQuota { length vaddr kflags -- mdl ok } 28 | extern MmMDLFree { mdl -- } 29 | extern MmMDLFreeComplete { mdl -- } 30 | 31 | extern MmMDLPin { lockforwrite mdl -- ok } 32 | extern MmMDLUnpin { mdl -- } 33 | 34 | extern MmMDLMap { mdl -- ok } 35 | extern MmMDLUnmap { mdl -- } 36 | 37 | extern MmMDLFlush { offset length write dma mdl -- } 38 | 39 | externptr MmPinnedPagesLimit 40 | externptr MmPinnedPagesCount -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/Pool.h: -------------------------------------------------------------------------------- 1 | externptr MmNonpagedPoolBytesUsed 2 | externptr MmNonpagedPoolBytesPeak 3 | 4 | externptr MmPagedPoolBytesUsed 5 | externptr MmPagedPoolBytesPeak 6 | 7 | extern MmPoolDump { tag -- usage } 8 | 9 | // heap stuff 10 | 11 | extern MmHeapChargeBytesGet { bytes -- charge } 12 | 13 | extern MmHeapChargeGet { block -- charge } 14 | 15 | externptr MmNonpagedHeapBytesUsedExternally 16 | externptr MmNonpagedHeapBytesUsedInternally 17 | externptr MmNonpagedHeapBytesUsedPeak 18 | 19 | externptr MmPagedHeapBytesUsedExternally 20 | externptr MmPagedHeapBytesUsedInternally 21 | externptr MmPagedHeapBytesUsedPeak -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/Process.h: -------------------------------------------------------------------------------- 1 | extern MmProcessInitialize { sectionobject process -- ok } 2 | extern MmProcessUninitialize { process -- } 3 | 4 | extern MmProcessDelete { process -- } 5 | extern MmProcessQuery { query process -- } 6 | 7 | extern MmThreadInitialize { thread -- ok } 8 | extern MmThreadUninitialize { thread -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/Quota.h: -------------------------------------------------------------------------------- 1 | const MMQUOTAINFINITE -1 2 | 3 | extern MmQuotaBlockGetByUID { uid forkquotablock -- quotablock ok } 4 | extern MmQuotaBlockCreate { uid wsmax pghpmax vmmax heapmax -- quotablock ok } 5 | extern MmQuotaBlockFork { uid quotablock -- newquotablock ok } 6 | extern MmQuotaBlockInitialize { uid wsmax pghpmax vmmax heapmax quotablock -- ok } 7 | extern MmQuotaBlockReference { quotablock -- } 8 | extern MmQuotaBlockDereference { quotablock -- } 9 | 10 | extern MmQuotaChargeBuffer { buffersize -- ok } 11 | extern MmQuotaUnchargeBuffer { buffersize -- } 12 | 13 | extern MmQuotaBlockCharge { charge quotablock -- ok } 14 | extern MmQuotaBlockUncharge { charge quotablock -- } 15 | extern MmQuotaBlockChargeWS { charge quotablock -- ok } 16 | extern MmQuotaBlockUnchargeWS { charge quotablock -- } 17 | extern MmQuotaBlockChargeVM { charge quotablock -- ok } 18 | extern MmQuotaBlockUnchargeVM { charge quotablock -- } 19 | extern MmQuotaBlockChargePaged { charge quotablock -- ok } 20 | extern MmQuotaBlockUnchargePaged { charge quotablock -- } 21 | extern MmQuotaBlockPrint { quotablock -- } 22 | 23 | extern MmChargeCommit { pri pages -- ok } 24 | extern MmUnchargeCommit { pages -- } 25 | 26 | extern MmSetQuota { quota quotablock -- } 27 | extern MmQuotaQuery { query quotablock -- } 28 | 29 | externptr MmSystemQuota 30 | externptr MmQuotaListMutex -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/Section.h: -------------------------------------------------------------------------------- 1 | extern MmSectionCreateObject { anonsize permissions name -- sectionobject ok } 2 | extern MmSectionCreate { anonsize permissions name -- sectionhandle ok } 3 | 4 | extern MmMapViewProcessObject { length startva sectionoffset mappedobject processobject pageprotection flags -- realva ok } 5 | extern MmMapView { length startva sectionoffset mappedhandle processhandle pageprotection flags -- realva ok } 6 | extern MmUnmapViewProcess { length vaddr processobject -- ok } 7 | extern MmUnmapView { length vaddr processhandle -- ok } 8 | 9 | extern MmRemapViewProcess { pageprotection length vaddr processobject -- ok } 10 | extern MmRemapView { pageprotection length vaddr processhandle -- ok } 11 | 12 | extern MmAllocateProcessObject { length startva processobject pageprotection flags -- realva ok } 13 | extern MmAllocate { length startva processhandle pageprotection flags -- realva ok } 14 | 15 | extern MmFlushViewProcess { length vaddr processobject -- ok } 16 | extern MmFlushView { length vaddr processhandle -- ok } 17 | 18 | externptr MmAnonymousPageCount -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/VAD.h: -------------------------------------------------------------------------------- 1 | extern MmVADListLock { alertable processobject -- ok } 2 | extern MmVADListUnlock { processobject -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/ViewCache.h: -------------------------------------------------------------------------------- 1 | externptr MmBufferMappings 2 | 3 | extern MmBufferMap { bcb -- } 4 | extern MmBufferUnmap { bcb -- } 5 | extern MmBufferTruncate { offset bcb -- } 6 | extern MmBufferDirty { bcb -- } 7 | 8 | extern MmBufferPin { bcb -- ok } 9 | extern MmBufferUnpin { bcb -- } 10 | 11 | extern MmViewPagePin { vaddr -- pfdbe ok } 12 | extern MmViewPageUnpin { pfdbe -- } 13 | 14 | externptr MmViewCachePageCount -------------------------------------------------------------------------------- /OS/OSKernel/include/Memory/Zone.h: -------------------------------------------------------------------------------- 1 | struct MmZoneHeader 2 | 4 ChunkListHead 3 | 4 FreeListHead 4 | 5 | 4 BlockSize 6 | endstruct 7 | 8 | struct MmZoneChunkHeader 9 | 4 Next 10 | endstruct 11 | 12 | const MMZONEOVERHEAD (MmZoneChunkHeader_SIZEOF) 13 | 14 | extern MmZoneInitialize { bytes chunk blocksize zoneheader -- } 15 | 16 | extern MmZoneExtend { bytes chunk zoneheader -- } 17 | extern MmZoneEmpty { zoneheader -- } 18 | 19 | extern MmZoneAllocate { zoneheader -- ptr ok } 20 | extern MmZoneFree { ptr zoneheader -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Object.h: -------------------------------------------------------------------------------- 1 | #include "/Object/Object.h" 2 | #include "/Object/Directory.h" 3 | #include "/Object/Wait.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/Object/Directory.h: -------------------------------------------------------------------------------- 1 | extern ObRootDirectoryLock { alertable -- ok } 2 | extern ObRootDirectoryLockShared { alertable -- ok } 3 | extern ObRootDirectoryUnlock { -- } 4 | 5 | extern ObDirectoryCreate { permissions name -- dirhandle ok } 6 | extern ObDirectoryCreateObject { permissions name flags -- dirobject ok } 7 | extern ObDirectoryCountQuery { directoryhandle -- count ok } 8 | extern ObDirectoryQueryAll { buffer maxquery directoryhandle -- count ok } 9 | extern ObDirectoryInsert { objecthandle directoryhandle -- ok } 10 | extern ObDirectoryRemove { objecthandle -- ok } 11 | extern ObDirectoryRemoveByPointer { locked object -- ok } 12 | extern ObDirectoryInsertByPointers { object directory -- ok } 13 | extern ObDirectoryDumpTree { directory spaces -- } 14 | 15 | extern ObObjectReferenceByPath { flags path initialobject process -- object ok } 16 | extern ObObjectOpenByPath { filetype objecttype flags access initialobjecthandle path -- handle ok } 17 | extern ObObjectOpenByPathProcess { filetype objecttype flags access initialobject path process -- handle ok } 18 | 19 | extern ObIsPathRelative { path -- isrelative } -------------------------------------------------------------------------------- /OS/OSKernel/include/Object/Wait.h: -------------------------------------------------------------------------------- 1 | extern ObWaitForMultipleObjects { alertable waittype timeout objectcount objecthandletable -- ok } 2 | extern ObWaitForObject { alertable timeout objecthandle -- ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/Process.h: -------------------------------------------------------------------------------- 1 | #include "/Process/Process.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/Security.h: -------------------------------------------------------------------------------- 1 | #include "/Security/Security.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/Security/Security.h: -------------------------------------------------------------------------------- 1 | const SEMAXPERMISSION 32 2 | const SEPERMISSIONSBITMAPSIZE (SEMAXPERMISSION 8 /) 3 | 4 | struct SePermissions 5 | SEPERMISSIONSBITMAPSIZE PermissionsBitmap 6 | endstruct 7 | 8 | extern SeInitPhase0 { -- } 9 | extern SeInitPhase1 { -- } 10 | 11 | extern SePermissionsInitialize { inheritfrom permissions -- } 12 | extern SeAmIAdmin { -- admin } 13 | extern SeProcessGrantPermission { permission process -- ok } 14 | extern SeProcessCheckPermission { permission process -- ok } 15 | extern SeCheckAccess { access permission -- ok } 16 | extern SeCheckAccessFilesystemX { access permbits owninguid owninggid process -- ok } 17 | extern SeCheckAccessObjectUserX { access object process -- ok } 18 | extern SeCheckAccessObjectOwnerX { object process -- ok } -------------------------------------------------------------------------------- /OS/OSKernel/include/Transfer.h: -------------------------------------------------------------------------------- 1 | struct IOTransfer 2 | (MmMDLHeader_SIZEOF IOCLUSTERMAX PAGESHIFT >> 1 + 4 * +) MDL 3 | 4 | 4 PageFile 5 | 4 State 6 | 4 Next 7 | 4 Prev // only used in the low space list; stores pagefile offset when active 8 | endstruct 9 | 10 | const IOTRANSFER_ACTIVE 0 11 | const IOTRANSFER_INACTIVE 1 12 | 13 | extern IOTransferComplete { transfer -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/Video.h: -------------------------------------------------------------------------------- 1 | #include "/Video/Draw.h" -------------------------------------------------------------------------------- /OS/OSKernel/include/Video/Draw.h: -------------------------------------------------------------------------------- 1 | extern KVInit { -- } 2 | 3 | extern KVQuery { -- w h ok } 4 | 5 | extern KVI8ToNative { i8 -- nativecolor } 6 | 7 | extern KVClearScreen { nativecolor -- } 8 | 9 | extern KVFontGet { name -- font ok } 10 | extern KVFontQuery { font -- width height } 11 | 12 | extern KVDrawFilledRectangle { nativecolor x y w h -- } 13 | extern KVDrawEmptyRectangle { nativecolor x y w h -- } 14 | extern KVDrawCharacter { char nativefg nativebg x y font -- } -------------------------------------------------------------------------------- /OS/OSKernel/include/ViewCache.h: -------------------------------------------------------------------------------- 1 | #include "/ViewCache/ViewCache.h" -------------------------------------------------------------------------------- /OS/OSLoader/LdrArgs.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements argument parsing for OSLoader. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "OSLoader.h" 8 | 9 | buffer LdrArgsNameBuffer 32 10 | 11 | fn LdrArgsValue { arg -- out } 12 | auto p 13 | LdrArgsBuffer p! 14 | 15 | auto tp 16 | LdrArgsNameBuffer tp! 17 | 18 | auto tpm 19 | tp@ 32 + tpm! 20 | 21 | auto m 22 | p@ 255 + m! 23 | 24 | 0 out! 25 | 26 | while (p@ m@ <) 27 | if (p@ gb ~~) 28 | LdrArgsNameBuffer tp! 29 | 30 | 1 p += 31 | 32 | if (p@ gb ~~) 33 | break 34 | end 35 | end elseif (p@ gb '=' ==) 36 | 0 tp@ sb 37 | 38 | if (LdrArgsNameBuffer arg@ strcmp) 39 | p@ 1 + out! 40 | return 41 | end 42 | 43 | p@ strlen p += 44 | 45 | continue 46 | end 47 | 48 | p@ gb tp@ sb 49 | 50 | 1 tp += 51 | 1 p += 52 | end 53 | end 54 | 55 | fn LdrArgsCheck { arg -- present } 56 | auto p 57 | LdrArgsBuffer p! 58 | 59 | auto m 60 | p@ 255 + m! 61 | 62 | 0 present! 63 | 64 | while (p@ m@ <) 65 | if (p@ gb ~~) 66 | break 67 | end 68 | 69 | if (arg@ p@ strcmp) 70 | 1 present! 71 | return 72 | end else 73 | p@ strlen 1 + p += 74 | end 75 | end 76 | end -------------------------------------------------------------------------------- /OS/OSLoader/LdrBitmap.df: -------------------------------------------------------------------------------- 1 | // 2 | // Faster bitmap management routines. Stolen from MINTIA executive for 3 | // OSLoader. 4 | // 5 | 6 | #include "/dragonfruit.h" 7 | 8 | #include "OSLoader.h" 9 | 10 | #include "../Common/ComBitmap.df" -------------------------------------------------------------------------------- /OS/OSLoader/LdrBootDrivers.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements boot driver loading. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "OSLoader.h" 8 | 9 | fn LdrBootDriversLoadAll { -- } 10 | // allow the platform to load drivers according to its device tree or 11 | // whatever. 12 | 13 | LdrPlatformBootDriversLoadAll 14 | 15 | // load whatever drivers are specified in BootDrivers.txt 16 | 17 | auto ok 18 | 19 | pointerof LdrBootDriverCallback // callback 20 | "/mintia/BootDrivers.txt" // path 21 | LdrBootDevice // device 22 | LdrResourceFileParse ok! 23 | 24 | if (ok@) 25 | ok@ "LdrBootDriversLoadAll: couldn't open /mintia/BootDrivers.txt (%i)\n" Printf 26 | return 27 | end 28 | end 29 | 30 | buffer LdrBootDriverPath 128 31 | 32 | fn LdrBootDriverLoad { flags name -- dll ok } 33 | LdrBootDriverPath // dest 34 | "/mintia/BootDrivers/" // src 35 | strcpy 36 | 37 | LdrBootDriverPath 20 + // dest 38 | name@ // src 39 | strcpy 40 | 41 | 0 // flags 42 | LdrBootDriverPath // name 43 | ComDLLLoad ok! dll! 44 | 45 | if (ok@) 46 | return 47 | end 48 | 49 | auto di 50 | "DriverInit" // name 51 | dll@ // dll 52 | ComDLLGetSymbolAddress ok! di! 53 | 54 | if (ok@ ~~) 55 | di@ dll@ ComDLL_LoadFunction + ! 56 | end 57 | end 58 | 59 | fn (LdrResourceFileCallbackFunction) LdrBootDriverCallback { linebuf -- } 60 | auto ok 61 | 62 | 0 // flags 63 | linebuf@ // name 64 | LdrBootDriverLoad ok! drop 65 | 66 | if (ok@) 67 | if (ok@ LDRSTATUS_NOT_FOUND ~=) 68 | ok@ linebuf@ "LdrBootDrivers: failed to load %s (%i)\n" LdrCrash 69 | end 70 | end 71 | end -------------------------------------------------------------------------------- /OS/OSLoader/LdrModule.df: -------------------------------------------------------------------------------- 1 | // 2 | // Implements module loading support for OSLoader. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "OSLoader.h" 8 | 9 | buffer LdrModuleNameBuffer 64 10 | 11 | var LdrAlwaysRelink 0 12 | public LdrAlwaysRelink 13 | 14 | fn ComDLLOpenFile { name -- file ok } 15 | if (name@ "HAL.dll" strcmp) 16 | LdrPlatformHALName@ name! 17 | end 18 | 19 | auto path 20 | 64 alloc path! 21 | 22 | if (name@ gb '/' ~=) 23 | path@ "/mintia/" strcpy 24 | path@ 8 + name@ strcpy 25 | end else 26 | name@ path! 27 | end 28 | 29 | auto after 30 | 0 after! 31 | 32 | if (path@ "/mintia/BootDrivers/" 20 strncmp ~~) 33 | path@ "%s\n" Printf 34 | end else 35 | 1 after! 36 | end 37 | 38 | path@ // path 39 | LdrBootDevice // device 40 | LdrFileOpen ok! file! 41 | 42 | if (ok@ ~~) 43 | if (after@) 44 | path@ "%s\n" Printf 45 | end 46 | end 47 | end 48 | 49 | #include "../Common/ComDLLLoad.df" 50 | -------------------------------------------------------------------------------- /OS/OSLoader/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . ./$(PLATFORM) 2 | 3 | include $(PLATFORM)/OSLoader.mk 4 | 5 | INCDIR := ./ 6 | 7 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/OSLoader/OSLoaderGlobal.h: -------------------------------------------------------------------------------- 1 | #include "../Common/Module.h" 2 | 3 | struct LdrMemoryDescriptor 4 | 4 Next 5 | 6 | 4 Type 7 | 8 | 4 StartPFN 9 | 4 Pages 10 | 11 | 4 OriginalExtent 12 | 4 OriginalDescriptor 13 | endstruct 14 | 15 | struct LdrInfo 16 | 4 Major 17 | 4 Minor 18 | 4 ReturnSP 19 | 4 MemoryDescriptorListHead 20 | 4 DLLListHead 21 | 4 ResourceListHead 22 | 4 ArgsBuffer 23 | 4 KeMain 24 | 25 | 4 HALConsoleFBWidth 26 | 4 HALConsoleFBHeight 27 | 4 HALConsoleFBFormat 28 | 4 HALConsoleFBAddr 29 | 30 | 4 InterruptStack 31 | 4 InterruptStackPages 32 | 33 | 4 DebugInit 34 | 35 | 4 PageFrameDB 36 | 37 | 4 PageDirectory 38 | 39 | 4 BootDeviceName 40 | 41 | 4 TotalRAM 42 | 43 | #ifdef XRSTATION 44 | 4 CitronBase 45 | 4 LSICBase 46 | 4 NVRAMBase 47 | #endif 48 | #ifdef XR17032 49 | 4 ExceptionBlockBase 50 | #endif 51 | endstruct 52 | 53 | struct LdrBootResource 54 | 4 Next 55 | 4 Jettison 56 | 64 Name 57 | 4 Size 58 | 4 Data 59 | endstruct 60 | 61 | const OSLOADERMEM_FREE 1 // not used by anything 62 | const OSLOADERMEM_RECLAIMABLE 2 // used by firmware and bootloader 63 | const OSLOADERMEM_USED 3 // needed by OS at runtime 64 | const OSLOADERMEM_DEBUG 4 // needed by debugger at runtime 65 | 66 | const OSLOADERMAJOR 3 67 | const OSLOADERMINOR 0 68 | 69 | const OSBOOTFBFORMAT_AB5G5R5 1 70 | const OSBOOTFBFORMAT_LGFX_I8 2 71 | const OSBOOTFBFORMAT_RGBA32 3 -------------------------------------------------------------------------------- /OS/OSLoader/XRstation/OSLoader.mk: -------------------------------------------------------------------------------- 1 | OUTPUTFILE := OSLoader.a3x 2 | 3 | PRELIBS := LX/xr17032/rta3x/_boot.o 4 | LIBS := L/rta3x/rta3x.o 5 | MOVEEXPR := text=0x20400,data=text+text_size,bss=data+data_size 6 | MKBINARY := yes -------------------------------------------------------------------------------- /OS/OSLoader/XRstation/bootcode/Makefile: -------------------------------------------------------------------------------- 1 | all: .new 2 | 3 | .new: a3xBootDescriptor.bin AisixFSBoot.bin 4 | dd if=a3xBootDescriptor.bin of=$(DISTIMAGE) bs=512 conv=notrunc seek=5 2>/dev/null 5 | dd if=AisixFSBoot.bin of=$(DISTIMAGE) bs=512 conv=notrunc seek=7 2>/dev/null 6 | touch .new 7 | 8 | a3xBootDescriptor.bin: a3xBootDescriptor.s 9 | $(ASM) format=flat a3xBootDescriptor.s a3xBootDescriptor.bin 10 | 11 | AisixFSBoot.bin: AisixFSBoot.s 12 | $(ASM) AisixFSBoot.s AisixFSBoot.bin 13 | $(LNK) move AisixFSBoot.bin text=0x20000,bss=text+text_size 14 | $(LNK) binary -nobss AisixFSBoot.bin 15 | 16 | cleanup: 17 | rm -f *.bin -------------------------------------------------------------------------------- /OS/OSLoader/XRstation/bootcode/a3xBootDescriptor.s: -------------------------------------------------------------------------------- 1 | .section text 2 | 3 | .ds ANTE 4 | 5 | ;OS label 6 | .ds "MINTIA\0\0\0\0\0\0\0\0\0\0" 7 | 8 | ;boot program offset in blocks 9 | .dl 3 10 | ;boot program length in blocks 11 | .dl 1 12 | 13 | ;reserved 14 | .dl 0 15 | 16 | .align 512 17 | 18 | ;boot picker icon bitmap 19 | .static mint.bmp -------------------------------------------------------------------------------- /OS/OSLoader/XRstation/bootcode/mint.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/OS/OSLoader/XRstation/bootcode/mint.bmp -------------------------------------------------------------------------------- /OS/OSLoader/fox32/OSLoader.mk: -------------------------------------------------------------------------------- 1 | OUTPUTFILE := OSLoader.bin 2 | 3 | LIBS := L/dfrt/dfrt.f.o 4 | MOVEEXPR := text=0x1000,data=text+text_size,bss=data+data_size 5 | MKBINARY := yes -------------------------------------------------------------------------------- /OS/OSLoader/fox32/PC.8x8.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/OS/OSLoader/fox32/PC.8x8.hcf -------------------------------------------------------------------------------- /OS/OSLoader/fox32/_start.s: -------------------------------------------------------------------------------- 1 | .section text 2 | 3 | .extern Main 4 | 5 | .dl 0x45544E41 6 | 7 | _start: 8 | mov fp, 0 9 | jmp Main -------------------------------------------------------------------------------- /OS/OSLoader/fox32/bootcode/FoxJump.s: -------------------------------------------------------------------------------- 1 | ;this file defines block 0 of a MINTIA disk on fox32. 2 | ; 3 | ;it just loads the boot block of the partition and jumps there. 4 | ;=========== BOOT PROGRAM ============ 5 | 6 | .section text 7 | 8 | start: 9 | jmp PastThePartitionTable 10 | 11 | .bytes -164 0 12 | 13 | PastThePartitionTable: 14 | mov t0, 0x80002000 ; command to set the location of the buffer 15 | mov t1, 0x80003000 ; command to read a sector from a disk into the buffer 16 | out t0, 0xA00 ; set the memory buffer location 17 | out t1, 7 ; read the sector into memory 18 | 19 | jmp 0xA00 20 | 21 | .bytes -508 0 22 | 23 | ; fox32 boot block identifier 24 | 25 | .dl 0x523C334C -------------------------------------------------------------------------------- /OS/OSLoader/fox32/bootcode/Makefile: -------------------------------------------------------------------------------- 1 | all: .new 2 | 3 | .new: AisixFSBoot.bin FoxJump.bin 4 | dd if=AisixFSBoot.bin of=$(DISTIMAGE) bs=512 conv=notrunc seek=7 2>/dev/null 5 | $(APTOOL) wb FoxJump.bin 6 | touch .new 7 | 8 | AisixFSBoot.bin: AisixFSBoot.s 9 | $(ASM) AisixFSBoot.s AisixFSBoot.bin 10 | $(LNK) move AisixFSBoot.bin text=0xA00,bss=text+text_size 11 | $(LNK) binary -nobss AisixFSBoot.bin 12 | 13 | FoxJump.bin: FoxJump.s 14 | $(ASM) FoxJump.s FoxJump.bin 15 | $(LNK) move FoxJump.bin text=0x800 16 | $(LNK) binary -nobss FoxJump.bin 17 | 18 | cleanup: 19 | rm -f *.bin -------------------------------------------------------------------------------- /OS/OSLoader/fox32/fox32.h: -------------------------------------------------------------------------------- 1 | const FRAMEBUFFER 0x02000000 2 | const FRAMEBUFFER_WIDTH 640 3 | const FRAMEBUFFER_HEIGHT 480 4 | 5 | const FRAMEBUFFER_SIZE (FRAMEBUFFER_WIDTH FRAMEBUFFER_HEIGHT * 4 * PAGEOFFSETMASK + PAGENUMBERMASK &) 6 | 7 | const FRAMEBUFFER_END (FRAMEBUFFER FRAMEBUFFER_SIZE + PAGEOFFSETMASK + PAGENUMBERMASK &) -------------------------------------------------------------------------------- /OS/SystemInit/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(SYSROOT)/SystemInit.exe 4 | 5 | DYLIBS := OSDLL.dll:$(OSDLLBIN) 6 | 7 | INCDIR := ./ 8 | 9 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/SystemInit/SystemInit.h: -------------------------------------------------------------------------------- 1 | extern SiSetPageFiles { -- } 2 | extern SiSystemManagementLoop { -- ok } 3 | extern SiSetTimeZone { -- } 4 | 5 | externptr SiConfigFile 6 | externptr SiBootFlags 7 | externptr SiPageFileCount -------------------------------------------------------------------------------- /OS/Window/BME/Init.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization for the Bitmap Engine (BME) DLL. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/OSDLL/OS.h" 8 | 9 | fn (OSModuleMainFunction) DLLMain { -- ok } 10 | 0 ok! 11 | end -------------------------------------------------------------------------------- /OS/Window/BME/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(WINROOT)/bme.dll 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) 6 | 7 | MOVEEXPR := mintiadll text=0x70300000,data=text+text_size+align,bss=data+data_size+align 8 | 9 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/Window/BME/Region.df: -------------------------------------------------------------------------------- 1 | // 2 | // Region manipulation functions. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/OSDLL/OS.h" 8 | 9 | #include "/BME/Bme.h" 10 | 11 | fn BmeBoxOverlapsBox { box1 box2 -- overlaps } 12 | 0 overlaps! 13 | 14 | // rule out all of the conditions that tell us the boxes cannot overlap. 15 | 16 | if (box2@ BmeBox_X1I + gi 17 | box1@ BmeBox_X2I + gi >=) 18 | 19 | return 20 | end 21 | 22 | if (box1@ BmeBox_X1I + gi 23 | box2@ BmeBox_X2I + gi >=) 24 | 25 | return 26 | end 27 | 28 | if (box2@ BmeBox_Y1I + gi 29 | box1@ BmeBox_Y2I + gi >=) 30 | 31 | return 32 | end 33 | 34 | box1@ BmeBox_Y1I + gi 35 | box2@ BmeBox_Y2I + gi < overlaps! 36 | end 37 | 38 | fn BmeBoxContainsPoint { x y box -- contains } 39 | 0 contains! 40 | 41 | if (box@ BmeBox_X1I + gi x@ >) 42 | return 43 | end 44 | 45 | if (x@ box@ BmeBox_X2I + gi >=) 46 | return 47 | end 48 | 49 | if (box@ BmeBox_Y1I + gi y@ >) 50 | return 51 | end 52 | 53 | y@ box@ BmeBox_Y2I + gi < contains! 54 | end 55 | 56 | fn BmeBoxContainsBox { containedbox box -- contains } 57 | 0 contains! 58 | 59 | // rule out all of the conditions that tell us the box cannot be contained 60 | // by the other box. 61 | 62 | if (containedbox@ BmeBox_X1I + gi 63 | box@ BmeBox_X1I + gi <) 64 | 65 | return 66 | end 67 | 68 | if (containedbox@ BmeBox_Y1I + gi 69 | box@ BmeBox_Y1I + gi <) 70 | 71 | return 72 | end 73 | 74 | if (containedbox@ BmeBox_X2I + gi 75 | box@ BmeBox_X2I + gi >) 76 | 77 | return 78 | end 79 | 80 | containedbox@ BmeBox_Y2I + gi 81 | box@ BmeBox_Y2I + gi <= contains! 82 | end -------------------------------------------------------------------------------- /OS/Window/Drivers/KinnowFB/Init.df: -------------------------------------------------------------------------------- 1 | // 2 | // Initialization for the KinnowFB BME driver. 3 | // 4 | 5 | #include "/dragonfruit.h" 6 | 7 | #include "/OSDLL/OS.h" 8 | 9 | fn (OSModuleMainFunction) DLLMain { -- ok } 10 | 0 ok! 11 | end -------------------------------------------------------------------------------- /OS/Window/Drivers/KinnowFB/Makefile: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(WINROOT)/kinnowfb.drv 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) bme.dll:$(BMEBIN) 6 | 7 | MOVEEXPR := mintiadll text=0x71000000,data=text+text_size+align,bss=data+data_size+align 8 | 9 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /OS/Window/README: -------------------------------------------------------------------------------- 1 | Sources for MINTIA Window Subsystem -------------------------------------------------------------------------------- /Project.mk: -------------------------------------------------------------------------------- 1 | INCLUDES := $(subst :, ,$(INCDIR)) 2 | INCLUDEFILES := $(foreach incdir,$(INCLUDES),$(shell find $(incdir) -type f -name "*.h")) 3 | 4 | SFILES := $(foreach component,$(COMPONENTS),$(wildcard $(component)/$(ARCHITECTURE)/*.s)) 5 | 6 | DFILES := $(foreach component,$(COMPONENTS),$(wildcard $(component)/*.df)) \ 7 | $(foreach component,$(COMPONENTS),$(wildcard $(component)/$(ARCHITECTURE)/*.df)) 8 | 9 | OBJ := $(DFILES:.df=.$(ARCHITECTURE).$(CHKFRE).o) 10 | SOBJ := $(SFILES:.s=.$(ARCHITECTURE).$(CHKFRE).o) 11 | 12 | ifndef EXECFILEMODE 13 | EXECFILEMODE := 493 14 | endif 15 | 16 | FULLOUTPUTFILE = $(BUILDROOT)/$(OUTPUTFILE).$(ARCHITECTURE).$(CHKFRE) 17 | 18 | all: $(FULLOUTPUTFILE) 19 | 20 | $(FULLOUTPUTFILE): $(OBJ) $(SOBJ) 21 | $(LNK) link $(LINKOPT) $(FULLOUTPUTFILE) $(PRELIBS) $(SOBJ) $(OBJ) $(LIBS) -d $(DYLIBS) 22 | 23 | ifdef MOVEEXPR 24 | $(LNK) move $(FULLOUTPUTFILE) $(MOVEEXPR) 25 | else 26 | $(LNK) move $(FULLOUTPUTFILE) mintia 27 | endif 28 | 29 | ifdef MKBINARY 30 | $(LNK) binary -nobss $(FULLOUTPUTFILE) 31 | echo "$(OUTPUTFILE) $(FULLOUTPUTFILE)" >> $(DELTA) 32 | else 33 | $(LNK) istrip $(FULLOUTPUTFILE) 34 | echo "$(OUTPUTFILE) $(FULLOUTPUTFILE) $(EXECFILEMODE)" >> $(DELTA) 35 | endif 36 | 37 | define COMPONENT_TEMPLATE 38 | 39 | $(1)/%.$$(ARCHITECTURE).$$(CHKFRE).o: $(1)/%.df $$(INCLUDEFILES) $$(wildcard $(1)/*.h) 40 | $$(DFC) $$< $$@ incdir=$$(INCDIR) libdir=$$(LIBDIR) 41 | 42 | endef 43 | 44 | $(foreach component,$(COMPONENTS), \ 45 | $(eval $(call COMPONENT_TEMPLATE,$(component))) \ 46 | ) 47 | 48 | %.$(ARCHITECTURE).$(CHKFRE).o: %.s 49 | $(ASM) $< $@ 50 | 51 | cleanup: 52 | rm -f ${OBJ} ${SOBJ} $(FULLOUTPUTFILE) -------------------------------------------------------------------------------- /Root/home/guest/README: -------------------------------------------------------------------------------- 1 | MINTIA is cool! 2 | -------------------------------------------------------------------------------- /Root/mintia/BootDrivers.txt: -------------------------------------------------------------------------------- 1 | # Default set of drivers loaded by the OS at boot time. 2 | # Some drivers are loaded that are not listed here; 3 | # these are loaded at the bootloader's discretion, 4 | # typically based on device tree information. 5 | # format: drivername 6 | 7 | AisixFS.sys 8 | Fat.sys 9 | -------------------------------------------------------------------------------- /Root/mintia/BootResources.txt: -------------------------------------------------------------------------------- 1 | # Configurable resources that the OS loader will load at boot time. 2 | # format: resourcename file 3 | 4 | HALFont PC.8x8.hcf 5 | 6 | VideoConsoleFont Mach.8x12.hcf 7 | VideoConsoleTitleFont Haiku.6x12.hcf 8 | -------------------------------------------------------------------------------- /Root/mintia/BootResources/Fixed.10x20.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Fixed.10x20.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Fixed.18x18.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Fixed.18x18.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Fixed.6x13.hcf: -------------------------------------------------------------------------------- 1 | ELNf Fixed>>(( 2 | 3 | <**$(((&$**> > """""(>"" >>" $>> ,2"" <""">""""""""""  >>  """"&**, """>"""<<" "<<> < >> < " &"""""">""""$""$(0($"" >""6**"""""22**&&"""""""""<"""< """"""*<"""<($""" ">""""""""""""""""****""""""> > ">"& <""""<" """"""> " <"""" ,2"""" $$ $(0($"4****",2""""""""<"""< """,2 ""< """"&"""""***"""""&"> >000*$ -------------------------------------------------------------------------------- /Root/mintia/BootResources/Haiku.6x12.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Haiku.6x12.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Mach.8x12.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Mach.8x12.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/PC.8x16.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/PC.8x16.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/PC.8x8.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/PC.8x8.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Sony.12x24.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Sony.12x24.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Sony.8x16.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Sony.8x16.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Sun.12x22.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Sun.12x22.hcf -------------------------------------------------------------------------------- /Root/mintia/BootResources/Terminus.8x16.hcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/Root/mintia/BootResources/Terminus.8x16.hcf -------------------------------------------------------------------------------- /Root/mintia/SystemInit.cfg: -------------------------------------------------------------------------------- 1 | @PageFile 2 | name='/mintia/pagefile.sys' 3 | minsize='0x200000' #2MB 4 | maxsize='0x1000000' #16MB 5 | priority='0' 6 | 7 | @Servers 8 | /mintia/amssrv.exe 9 | 10 | @Managers 11 | /mintia/login.exe :ttyV0 12 | /mintia/login.exe :ttyS0 13 | # /mintia/login.exe :ttyS1 14 | -------------------------------------------------------------------------------- /Root/mintia/SystemInit.cfg.small: -------------------------------------------------------------------------------- 1 | @PageFile 2 | name='/mintia/pagefile.sys' 3 | minsize='0x100000' #1MB 4 | maxsize='0x600000' #6MB 5 | priority='0' 6 | 7 | @Servers 8 | /mintia/amssrv.exe 9 | 10 | @Managers 11 | /mintia/login.exe :ttyV0 12 | /mintia/login.exe :ttyS0 13 | # /mintia/login.exe :ttyS1 14 | -------------------------------------------------------------------------------- /Root/mintia/boot.cmd: -------------------------------------------------------------------------------- 1 | # Set the PATH. 2 | 3 | (export PATH "/mintia/bin") 4 | 5 | # Site-specific procedures here... 6 | -------------------------------------------------------------------------------- /Root/mintia/groups.cfg: -------------------------------------------------------------------------------- 1 | nextgid='51' 2 | 3 | @system 4 | gid='0' 5 | 6 | @users 7 | gid='50' 8 | -------------------------------------------------------------------------------- /Root/mintia/help/0/amssrv: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | amssrv -- Authority Management Server 5 | 6 | SYNOPSIS 7 | amssrv 8 | 9 | DESCRIPTION 10 | amssrv is the server program which acts as the local mediator of MINTIA 11 | authority management. It uses IPC to talk to other processes on the same 12 | machine, in order to do actions such as logon, user querying, password 13 | changes, etc. It should not be invoked directly. 14 | 15 | User information is stored in two files: 16 | 17 | * /mintia/groups.cfg Stores group name information. 18 | * /mintia/users.cfg Stores user name, preferences, and quota information. 19 | 20 | SEE ALSO 21 | (0)SystemInit 22 | (0)amssrv 23 | -------------------------------------------------------------------------------- /Root/mintia/help/0/help: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | PREFACE 4 | This manual provides users of the MINTIA operating system with detailed 5 | information on the system, including its commands and services, along with 6 | general trivia that may aid in managing the system. This manual is 7 | organized into chapters and topics and is accessed by way of the "help" 8 | command. 9 | 10 | By specifying no arguments on the command line, "help" will display this 11 | page. If one argument is given, "help" will interpret it as a topic name, 12 | and will search the chapters in numerical order to find and display the page 13 | for that topic. If two arguments are provided, "help" will treat the first 14 | one as a chapter number and attempt to look up the topic in that particular 15 | chapter. 16 | 17 | 18 | INTRODUCTION 19 | The MINTIA operating system provides an environment suitable for use in a 20 | range of systems, from single-user desktop workstations to minicomputers 21 | supporting dozens of concurrent users. It does this while retaining 22 | performance and reliability. 23 | -------------------------------------------------------------------------------- /Root/mintia/help/0/login: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | login -- console log-in 5 | 6 | SYNOPSIS 7 | login 8 | 9 | DESCRIPTION 10 | login is the program which receives and handles console logins. It should 11 | not be invoked directly. It communicates with (0)amssrv to validate logins 12 | and to manage logon sessions. 13 | 14 | SEE ALSO 15 | (0)SystemInit 16 | (0)amssrv 17 | -------------------------------------------------------------------------------- /Root/mintia/help/1/aptdisk: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | aptdisk -- manage an APT (a3x partition table) volume. 5 | 6 | SYNOPSIS 7 | aptdisk [disk name] 8 | 9 | DESCRIPTION 10 | aptdisk displays menus that allow the user to manage an APT volume. Disks 11 | can be queried, partitioned (which is a destructive process), labeled, etc. 12 | The actual disk device should be specified, as opposed to one of the 13 | partition devices, i.e. :dks1 and not :dks1s0. The disk is accessed non- 14 | cached. 15 | 16 | HISTORY 17 | Ported from "limnvol" from the aisix standalone tools (which ran in the a3x 18 | firmware environment). This tool is in a sorry state due to its age and 19 | should be rewritten some day. 20 | -------------------------------------------------------------------------------- /Root/mintia/help/1/cat: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | cat -- concatenate and print files 5 | 6 | SYNOPSIS 7 | cat [-u] [file ...] 8 | 9 | DESCRIPTION 10 | cat sequentially reads each specified file in the order provided and writes 11 | their contents to standard output. If no filenames are provided, cat reads 12 | from standard input. 13 | 14 | The switches are as follows: 15 | 16 | -u Open the files noncached. 17 | -------------------------------------------------------------------------------- /Root/mintia/help/1/chgrp: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | chgrp -- change group of file 5 | 6 | SYNOPSIS 7 | chgrp group file 8 | 9 | DESCRIPTION 10 | chgrp changes the group ownership of a file. The group argument may be 11 | either a numerical group identifier (GID), or a symbolic group name. 12 | Only the root user may change the group of a file. 13 | -------------------------------------------------------------------------------- /Root/mintia/help/1/chmod: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | chmod -- change permissions of file 5 | 6 | SYNOPSIS 7 | chmod permissions file 8 | 9 | DESCRIPTION 10 | chmod changes the permission bits of a file. This is best specified as an 11 | octal number of the form: 12 | 13 | 0OGW 14 | 15 | O - owner bits 16 | G - group bits 17 | W - world bits 18 | -------------------------------------------------------------------------------- /Root/mintia/help/1/chown: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | chown -- change owning user of file 5 | 6 | SYNOPSIS 7 | chown user file 8 | 9 | DESCRIPTION 10 | chown changes the owning user a file. The user may be specified as either a 11 | numerical user identifier (UID), or as a symbolic username. Only the root 12 | user may change the owning user of a file. 13 | -------------------------------------------------------------------------------- /Root/mintia/help/1/clear: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | clear -- clear screen 5 | 6 | SYNOPSIS 7 | clear 8 | 9 | DESCRIPTION 10 | Clears the terminal and attempts to reset any attributes to normal. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/cmd: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | cmd -- command prompt 5 | 6 | SYNOPSIS 7 | cmd 8 | 9 | DESCRIPTION 10 | cmd is the default shell of MINTIA. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/cp: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | cp -- copy file 5 | 6 | SYNOPSIS 7 | cp [-ru] source target 8 | 9 | DESCRIPTION 10 | cp copies the source file to the target. If the target is a directory, the 11 | source file will be copied to the directory and retain its old name. If the 12 | target directory exists, but the target name does not, the file will be 13 | copied with the new target name. 14 | 15 | The switches are as follows: 16 | 17 | -r Recursively copy directories. 18 | -u Open the files noncached. 19 | -------------------------------------------------------------------------------- /Root/mintia/help/1/crypt: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | crypt -- simple cryptographic hash 5 | 6 | SYNOPSIS 7 | crypt string salt 8 | 9 | DESCRIPTION 10 | crypt generates a cryptographic hash from the given string and 2-character 11 | salt, using a very simple algorithm. The hash is written to stdout. 12 | -------------------------------------------------------------------------------- /Root/mintia/help/1/date: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | date -- print or set date and time 5 | 6 | SYNOPSIS 7 | date [-dtz [DD-MMM-YYYY] [HH:MM[:SS]] [timezone]] 8 | 9 | DESCRIPTION 10 | With no arguments, date will display the current date and time. 11 | 12 | The switches are as follows: 13 | 14 | -s Set the date. 15 | -t Set the time. 16 | -z Set the timezone. 17 | -------------------------------------------------------------------------------- /Root/mintia/help/1/dd: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | dd -- data duplicator 5 | 6 | SYNOPSIS 7 | dd [option=value] ... 8 | 9 | DESCRIPTION 10 | dd copies the standard input to the standard output. Input data is read and 11 | written in 512-byte blocks. 12 | 13 | Options are as follows: 14 | 15 | bs=n Set block size to n bytes. 16 | 17 | obs=n Set output block size to n bytes. 18 | 19 | ibs=s Set input block size to n bytes. 20 | 21 | count=n Copy n input blocks. 22 | 23 | if=file Read from file. 24 | 25 | of=file Write to file. 26 | 27 | iseek=n Seek n blocks into the input file. 28 | 29 | oseek=n Seek o blocks into the output file. 30 | 31 | conv=option[,option ...] 32 | notrunc Don't truncate the output file. 33 | -------------------------------------------------------------------------------- /Root/mintia/help/1/dhrystone: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | dhrystone -- dhrystone benchmark 5 | 6 | SYNOPSIS 7 | dhrystone 8 | 9 | DESCRIPTION 10 | dhrystone is a direct rewrite in the dragonfruit language of the 11 | time-honored Dhrystone 2.1 benchmark. It measures the performance of a 12 | compiler/CPU combination in units of VAX MIPS, the speed of a VAX-11/780. 13 | -------------------------------------------------------------------------------- /Root/mintia/help/1/echo: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | echo -- write arguments to stdout 5 | 6 | SYNOPSIS 7 | echo [arg1 arg2 ...] 8 | 9 | DESCRIPTION 10 | echo writes any provided arguments to stdout as given in the command line. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/edit: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | edit -- file editor 5 | 6 | SYNOPSIS 7 | edit file 8 | 9 | DESCRIPTION 10 | edit is a full-screen file editor. If the provided file does not exist, it 11 | will be created when the buffer is saved for the first time. If the file 12 | cannot be opened writable, it will be displayed in a read-only mode where 13 | edits are ignored. 14 | -------------------------------------------------------------------------------- /Root/mintia/help/1/groups: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | groups -- manage the system's groups 5 | 6 | SYNOPSIS 7 | groups command [args ...] 8 | 9 | DESCRIPTION 10 | This utility is used to manage the groups on the local workstation. It 11 | accepts a command argument, and each command may support multiple additional 12 | arguments. 13 | 14 | The commands are as follows: 15 | 16 | list Prints a list of all of the registered groups. 17 | 18 | info [groupname] 19 | Prints information about the given group. 20 | 21 | add [groupname] 22 | Creates a new group with the given name. 23 | 24 | delete [groupname] 25 | Deletes the given group. 26 | 27 | edit [groupname] [property] [value] 28 | Edits a property of the given group. Some properties expect numeric 29 | values and others expect textual values. The textual values are: 30 | 31 | * groupname 32 | 33 | SEE ALSO 34 | (1)users -------------------------------------------------------------------------------- /Root/mintia/help/1/kill: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | kill -- send signal 5 | 6 | SYNOPSIS 7 | kill [-SIGNAL] pid 8 | 9 | DESCRIPTION 10 | kill sends the specified signal to the provided process. If no signal is 11 | specified, then SIGTERM is sent by default. The signal may be specified as 12 | a numeric signal number or as a symbolic name. This requires ACCESS_EXEC 13 | access to the given process. To kill a process by name, see (1)killall. 14 | 15 | The recognized signal names are: 16 | 17 | 1 SIGHUP Console hung up. 18 | 2 SIGINT ^C struck at console. 19 | 3 SIGQUIT 20 | 4 SIGILL Illegal instruction executed. 21 | 5 SIGTRAP 22 | 6 SIGABRT Internal program abort. 23 | 7 SIGEMT 24 | 8 SIGFPE Divide by zero. 25 | 9 SIGKILL Unmaskable termination. 26 | 10 SIGBUS Unaligned access or physical bus error. 27 | 11 SIGSEGV Forbidden access. 28 | 12 SIGSYS 29 | 13 SIGPIPE 30 | 14 SIGALRM 31 | 15 SIGTERM Maskable termination. 32 | 16 SIGURG 33 | 17 SIGSTOP 34 | 18 SIGTSTP 35 | 19 SIGCONT 36 | 20 SIGCHLD 37 | 21 SIGTTIN 38 | 22 SIGTTOU 39 | 23 SIGIO 40 | 24 SIGXCPU 41 | 25 SIGIOERR I/O error during page-in. 42 | 26 SIGVTALRM 43 | 27 SIGPROF 44 | 28 SIGWINCH 45 | 29 SIGINFO 46 | 30 SIGUSR1 Reserved for user. 47 | 31 SIGUSR2 Reserved for user. 48 | 49 | SEE ALSO 50 | (1)killall 51 | -------------------------------------------------------------------------------- /Root/mintia/help/1/killall: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | killall -- send signal to processes by name 5 | 6 | SYNOPSIS 7 | killall [-SIGNAL] name 8 | 9 | DESCRIPTION 10 | killall sends the specified signal to all processes with the given name 11 | to which the calling user has ACCESS_EXEC permissions. If no signal is 12 | specified, then SIGTERM is sent by default. The signal may be specified as 13 | a numeric signal number or as a symbolic name. For all of the symbolic names 14 | for signals, see (1)kill. 15 | 16 | SEE ALSO 17 | (1)kill 18 | -------------------------------------------------------------------------------- /Root/mintia/help/1/kstats: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | kstats -- display kernel statistics 5 | 6 | SYNOPSIS 7 | kstats [timeperiod] 8 | 9 | DESCRIPTION 10 | kstats displays various kernel statistics. If no arguments are provided, 11 | it will display statistics for the entire lifetime of the system so far. 12 | If an argument is provided, it is used as a time period in milliseconds 13 | over which to take statistics. 14 | 15 | SEE ALSO 16 | (1)mem 17 | -------------------------------------------------------------------------------- /Root/mintia/help/1/label: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | label -- set volume label 5 | 6 | SYNOPSIS 7 | label device newlabel 8 | 9 | DESCRIPTION 10 | label sets the volume label on the specified device. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/ls: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | ls -- list files in directory 5 | 6 | SYNOPSIS 7 | ls [-adlx] [dir ...] 8 | 9 | DESCRIPTION 10 | ls sequentially prints the contents of each specified directory. If no 11 | directory is specified, it prints the contents of the current directory. 12 | Directories are signified in blue with a trailing slash, and executables are 13 | signified in red with a trailing asterisk. 14 | 15 | ls can list the contents of object directories in the object manager 16 | namespace if the path is prefixed with //:/. 17 | 18 | The switches are as follows: 19 | 20 | -a Display files beginning with a period. 21 | -d Display information about the directory itself, not its contents. 22 | -l Display more detailed information. 23 | -x Don't perform an ioctl on stdin to determine terminal width. 24 | -------------------------------------------------------------------------------- /Root/mintia/help/1/mem: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | mem -- print memory statistics 5 | 6 | SYNOPSIS 7 | mem 8 | 9 | DESCRIPTION 10 | mem prints a summary of memory statistics for the system. 11 | 12 | The switches are as follows: 13 | 14 | -c Print a comprehensive dump of all of the memory statistics. 15 | 16 | SEE ALSO 17 | (1)kstats 18 | -------------------------------------------------------------------------------- /Root/mintia/help/1/mkdir: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | mkdir -- make directory 5 | 6 | SYNOPSIS 7 | mkdir dir 8 | 9 | DESCRIPTION 10 | mkdir creates a directory with the given name. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/mkfs_aisixfs: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | mkfs_aisixfs -- create a new AisixFS filesystem 5 | 6 | SYNOPSIS 7 | mkfs_aisixfs [disk name] 8 | 9 | DESCRIPTION 10 | mkfs_aisixfs creates an AisixFS volume on the specified disk device. This is 11 | a destructive process that will overwrite anything else on the disk. It will 12 | display parameters for the filesystem it will create and prompt the user for 13 | confirmation, and then the disk will be formatted. The disk is accessed non- 14 | cached. 15 | 16 | The switches are as follows: 17 | 18 | -s Don't print information about the filesystem. 19 | -v Print extra information about the creation process. 20 | -y Don't prompt for confirmation. 21 | 22 | HISTORY 23 | Ported from AISIX. 24 | -------------------------------------------------------------------------------- /Root/mintia/help/1/mount: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | mount -- mount a filesystem volume 5 | 6 | SYNOPSIS 7 | mount [[-ru] device [fstype]] 8 | 9 | DESCRIPTION 10 | mount mounts a filesystem volume on the given device. The caller must have 11 | the appropriate permissions to the volume, i.e. if mounting normally then 12 | the caller must have ACCESS_WRITE and ACCESS_READ, but if mounting readonly 13 | then the caller need only have ACCESS_READ. If no arguments are provided, 14 | mount prints a list of the system's mounted volumes. A filesystem type may 15 | be explicitly specified. 16 | 17 | The switches are as follows: 18 | 19 | -i Ignore UIDs on the mount; all files on the volume appear as being 20 | owned by whoever happens to be looking. 21 | -r Mount read-only. 22 | -u Update the flags of an existing mount. 23 | -o All files on the volume appear to have a matching UID and GID with 24 | the owner of the device. 25 | 26 | SEE ALSO 27 | (1)umount 28 | -------------------------------------------------------------------------------- /Root/mintia/help/1/mousedemo: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | mousedemo -- demo mouse device and framebuffer 5 | 6 | SYNOPSIS 7 | mousedemo 8 | 9 | DESCRIPTION 10 | mousedemo is a simple demonstration of the mouse device and of framebuffer 11 | mapping. 12 | -------------------------------------------------------------------------------- /Root/mintia/help/1/mv: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | mv -- move file 5 | 6 | SYNOPSIS 7 | mv source target 8 | 9 | DESCRIPTION 10 | mv moves the source file to the target. If the target path ends in a forward 11 | slash character, it will try to move the source file into the target 12 | directory and retain the source file's original name. If it doesn't, it will 13 | try to move with the new target name. 14 | -------------------------------------------------------------------------------- /Root/mintia/help/1/nvram: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | nvram -- Set or print nvram variables. 5 | 6 | SYNOPSIS 7 | nvram [[^]variable[=value]] 8 | 9 | DESCRIPTION 10 | nvram prints the contents of the specified nvram variable, or sets it if a 11 | new value is provided. If no arguments are provided, all variables are 12 | listed. Placing a caret (^) in front of the variable name will cause it to 13 | be deleted. 14 | -------------------------------------------------------------------------------- /Root/mintia/help/1/passwd: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | passwd -- change password 5 | 6 | SYNOPSIS 7 | passwd [username] 8 | 9 | DESCRIPTION 10 | This utility is used to change a user's password. A user can change their 11 | own password without administrator assistance by specifying no username on 12 | the command line. 13 | 14 | You may change the password of an arbitrary user by specifying a username, 15 | but it must either match that of the current user, or the current user must 16 | be an administrator, otherwise a permission-denied diagnostic will be 17 | displayed. You must supply the old password, unless you are an administrator 18 | changing the password of another user. 19 | -------------------------------------------------------------------------------- /Root/mintia/help/1/ps: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | ps -- list processes 5 | 6 | SYNOPSIS 7 | ps 8 | 9 | DESCRIPTION 10 | ps lists all of the processes in the system. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/pwd: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | pwd -- print working directory 5 | 6 | SYNOPSIS 7 | pwd 8 | 9 | DESCRIPTION 10 | pwd prints the path of the current working directory to stdout. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/quota: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | quota -- print quota information 5 | 6 | SYNOPSIS 7 | quota 8 | 9 | DESCRIPTION 10 | quota prints the quota information of the current session and of the system 11 | itself. 12 | -------------------------------------------------------------------------------- /Root/mintia/help/1/reboot: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | reboot -- reboot the system 5 | 6 | SYNOPSIS 7 | reboot 8 | 9 | DESCRIPTION 10 | reboot causes a reboot to occur. The caller must be the root user. For more 11 | details on the shutdown process, see (1)shutdown. 12 | 13 | SEE ALSO 14 | (1)shutdown 15 | -------------------------------------------------------------------------------- /Root/mintia/help/1/rm: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | rm -- remove files 5 | 6 | SYNOPSIS 7 | rm [-r] [file1 file2 ...] 8 | 9 | DESCRIPTION 10 | rm sequentially deletes the files provided. 11 | 12 | The switches are as follows: 13 | 14 | -r Recursively delete directories. 15 | -------------------------------------------------------------------------------- /Root/mintia/help/1/shutdown: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | shutdown -- shutdown the system 5 | 6 | SYNOPSIS 7 | shutdown 8 | 9 | DESCRIPTION 10 | shutdown causes a shutdown to occur. The caller must be the root user. The 11 | kernel shutdown process begins by sending SIGTERM to all processes. It then 12 | waits for a short period for all of the processes to clean up, and then 13 | forcibly destroys them with SIGKILL. It waits another short period and then 14 | flushes all modified pages to disk, and then the kernel exits. 15 | 16 | SEE ALSO 17 | (1)reboot 18 | -------------------------------------------------------------------------------- /Root/mintia/help/1/sleep: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | sleep -- sleep for a number of seconds 5 | 6 | SYNOPSIS 7 | sleep seconds 8 | 9 | DESCRIPTION 10 | sleep for the specified number of seconds. 11 | -------------------------------------------------------------------------------- /Root/mintia/help/1/swapon: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | swapon -- list or set pagefiles 5 | 6 | SYNOPSIS 7 | swapon [path minsize maxsize priority] 8 | 9 | DESCRIPTION 10 | swapon creates a new pagefile. The pagefile will begin at minsize and may 11 | grow up to maxsize over time as the system consumes more virtual memory 12 | commitment. Pagefiles are filled from the lowest-numbered priority upwards. 13 | 14 | If no arguments are specified, a list of the currently set pagefiles will be 15 | printed. 16 | 17 | SEE ALSO 18 | (0)SystemInit 19 | -------------------------------------------------------------------------------- /Root/mintia/help/1/sync: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | sync -- synchronize page cache 5 | 6 | SYNOPSIS 7 | sync [file] 8 | 9 | DESCRIPTION 10 | sync causes a complete flush of the file page cache to disk. If a filename 11 | is provided, it will write and purge only the cached data for that file. 12 | -------------------------------------------------------------------------------- /Root/mintia/help/1/tee: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | tee -- pipe fitting 5 | 6 | SYNOPSIS 7 | tee [-ai] [file ....] 8 | 9 | DESCRIPTION 10 | tee copies standard input to standard output, and also copies it to the 11 | provided files. 12 | 13 | The switches are as follows: 14 | 15 | -a Append to the files. 16 | -i Ignore OSSIGNAL_INT. 17 | -------------------------------------------------------------------------------- /Root/mintia/help/1/time: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | time -- measure the time a command takes 5 | 6 | SYNOPSIS 7 | time command ... 8 | 9 | DESCRIPTION 10 | time kicks off the given command line and then waits for completion. When 11 | the command is complete, it will print a summary of the time occupied by the 12 | command process. The time taken by any children spawned by the command isn't 13 | measured. 14 | 15 | The printed time values have the following meaning: 16 | 17 | real The actual elapsed clock time. 18 | user The time the process spent running user code. 19 | sys The time the process spend running system code. 20 | -------------------------------------------------------------------------------- /Root/mintia/help/1/trunc: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | trunc -- truncate file 5 | 6 | SYNOPSIS 7 | trunc file size 8 | 9 | DESCRIPTION 10 | trunc sets the size of the given file to the provided size. If the file does 11 | not exist, it is created. If the size is larger than the current size, the 12 | new allocation will be zero-filled. 13 | -------------------------------------------------------------------------------- /Root/mintia/help/1/umount: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | umount -- unmount a filesystem volume 5 | 6 | SYNOPSIS 7 | umount device 8 | 9 | DESCRIPTION 10 | umount unmounts a filesystem volume from a given device. If any references 11 | exist to files on that volume, it will fail with a "device is busy" error 12 | message. 13 | 14 | SEE ALSO 15 | (1)mount 16 | -------------------------------------------------------------------------------- /Root/mintia/help/1/ver: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | ver -- print version information 5 | 6 | SYNOPSIS 7 | ver [-amnprs] 8 | 9 | DESCRIPTION 10 | ver prints system version information. 11 | 12 | The switches are as follows: 13 | 14 | -a All of the below. 15 | -m Print the machine name. 16 | -n Print the hostname. 17 | -p Print the processor name. 18 | -r Print the release number. 19 | -s Print the system name. 20 | -------------------------------------------------------------------------------- /Root/mintia/help/1/view: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | view -- text pager 5 | 6 | SYNOPSIS 7 | view [file] 8 | 9 | DESCRIPTION 10 | view displays a file and allows it to be navigated in full-screen. If no 11 | file is specified, it will read stdin until EOF is encountered, and then it 12 | will display the accumulated buffer. It is used by (0)help to display topic 13 | pages. 14 | -------------------------------------------------------------------------------- /Root/mintia/help/1/whoami: -------------------------------------------------------------------------------- 1 |  MINTIA Operating System: In-band Manual  2 | 3 | NAME 4 | whoami - print current username 5 | 6 | SYNOPSIS 7 | whoami 8 | 9 | DESCRIPTION 10 | whoami prints the name of the calling user. 11 | -------------------------------------------------------------------------------- /Root/mintia/motd.txt: -------------------------------------------------------------------------------- 1 | Welcome to the MINTIA Operating System 2 | 3 | -------------------------------------------------------------------------------- /Root/mintia/users.cfg: -------------------------------------------------------------------------------- 1 | nextuid='52' 2 | 3 | @root 4 | uid='0' 5 | gid='0' 6 | home='/' 7 | shell='/mintia/bin/cmd.exe' 8 | poolquota='-1' 9 | pgpoolquota='-1' 10 | vmquota='-1' 11 | wsquota='-1' 12 | restrict='0' 13 | password='LSpGG3NWmF|mZ' 14 | 15 | @admin 16 | uid='50' 17 | gid='0' 18 | home='/home/admin' 19 | shell='/mintia/bin/cmd.exe' 20 | poolquota='-2' 21 | pgpoolquota='-2' 22 | vmquota='-2' 23 | wsquota='-2' 24 | restrict='0' 25 | password='LSpGG3NWmF|mZ' 26 | 27 | @guest 28 | uid='51' 29 | gid='50' 30 | home='/home/guest' 31 | shell='/mintia/bin/cmd.exe' 32 | poolquota='-2' 33 | pgpoolquota='-2' 34 | vmquota='-2' 35 | wsquota='-2' 36 | restrict='8' 37 | password='DR00000000000' 38 | -------------------------------------------------------------------------------- /SysCommand.mk: -------------------------------------------------------------------------------- 1 | COMPONENTS := . 2 | 3 | OUTPUTFILE := $(SYSROOT)/$(CMDNAME).exe 4 | 5 | DYLIBS += OSDLL.dll:$(OSDLLBIN) 6 | 7 | EXECFILEMODE := 492 8 | 9 | INCDIR := ./ 10 | 11 | include $(REPO)/Project.mk -------------------------------------------------------------------------------- /TextManifestSuffixed: -------------------------------------------------------------------------------- 1 | # config files 2 | 3 | /mintia/SystemInit.cfg Root/mintia/SystemInit.cfg -------------------------------------------------------------------------------- /XRstation.mk: -------------------------------------------------------------------------------- 1 | ARCHITECTURE := xr17032 2 | 3 | KERNELMODULES += BootDrivers/XRstation/EBus \ 4 | BootDrivers/XRstation/Keyboard \ 5 | BootDrivers/XRstation/KinnowFB \ 6 | BootDrivers/XRstation/Mouse 7 | 8 | WINDRIVERS += Window/Drivers/KinnowFB -------------------------------------------------------------------------------- /badge-17032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/badge-17032.png -------------------------------------------------------------------------------- /badge-fox32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/badge-fox32.png -------------------------------------------------------------------------------- /fox32.mk: -------------------------------------------------------------------------------- 1 | ARCHITECTURE := fox32 2 | 3 | KERNELMODULES += BootDrivers/fox32/foxmobo 4 | # WINDRIVERS += Window/Drivers/FoxFB -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xrarch/mintia/fd4e598fce4f95d11e9e38b3f780bbb8f8088b1d/screenshot.png --------------------------------------------------------------------------------