📄 reference
字号:
/** Reference ** ** Original Author: Guido de Jong ** Date: 01-26-00 ** ** Description: ** Apostle micro-kernel Reference Manual ** ** Revision History: ** First draft 01-26-00 Guido de Jong ** ** This program is free software, you can redistribute it and/or ** modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation; either version ** 2 of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be ** useful, but WITHOUT ANY WARRANTY; without even the implied ** warranty or MERCHANTABILITY or FITNESS FOR A PARTICULAR ** PURPOSE. See the GNU General Public License for more ** details. ** ** You should have received a copy of the GNU General Public ** License along with this program; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place, Suite 330, ** Boston, MA 02111-1307 USA ** *********************************************************Apostle OS**/Apostle micro-kernel Reference Manual1. IntroductionThis document contains a first draft of a reference manual for the Apostlemicro-kernel. The goal of this first draft is to describe how user processescan interface with the micro-kernel and consequently with other user processes.2. System CallsInteraction with the Apostle micro-kernel is done by means of system calls. Thesystem calls are mapped to interrupts 0x30 and on. For InterprocessCommunication (IPC) a number of system calls are available. A short list ofsystem calls:- SendTo- ReceiveFrom- CallRemote- SendReceive- Unmap- CreateProcess- DestroyProcess- ProcessID- RequestProcessor- Idle- Yield- SleepNext each system call will be desribed in detail. Table 2.1 and table 2.2contain more information on bitmaps of the IPC Options and the Return Flags.2.1 SendToDescription: Send a message to another processInterrupt: 0x30Registers: eax = IPC Options edx = Process ID ecx = Timeout ebx = Register Message 0 / Activation (*) ebp = Register Message 1 esi = Register Message 2 / Source Flexible Page (#) edi = Register Message 3Returns: eax = Return Flags edx = Receiver Process IDA process ID 0 signifies the multiplexer.(*) When replying to a CallRemote EBX contains the Activation, otherwise it can be used for register messages.(#) When sending a flexible page message ESI contains the source page, otherwise it can be used for register messages.2.2 ReceiveFromDescription: Receive a message from another processInterrupt: 0x31Registers: eax = IPC Options edx = Process ID ecx = Timeout ebx = Register Message 0 ebp = Register Message 1 esi = Register Message 2 edi = Register Message 3 / Destination Flexible Page (#)Returns: eax = Return Flags edx = Sender Process ID ecx = Caller Activation (+)A process ID 0 signifies receiving from any process.(#) When receiving a flexible page message EDI contains the destination page, otherwise it can be used for register messages.(+) Only when receiving RPC, otherwise undefined.2.3 CallRemoteDescription: Call a remote procedureInterrupt: 0x32Registers: eax = IPC Options edx = Process ID ecx = Timeout ebx = Register Message 0 ebp = Register Message 1 esi = Register Message 2 / Source Flexible Page (#) edi = Register Message 3 / Destination Flexible Page (#)Returns: eax = Return Flags edx = Callee Process IDA process ID 0 signifies the multiplexer. The timeout is used for both theinitial call and the waiting for a reply. It is not possible to both send andreceive a flexible page.(#) When sending a flexible page message ESI contains the source page, otherwise it can be used for register messages. When receiving a flexible page message EDI contains the destination page, otherwise it can be used for register messages.2.4 SendReceiveDescription: Reply a message to a process and receive next message from any processInterrupt: 0x33Registers: eax = IPC Options edx = Process ID ecx = Timeout ebx = Register Message 0 / Activation (*) ebp = Register Message 1 esi = Register Message 2 / Source Flexible Page (#) edi = Register Message 3 / Destination Flexible Page (#)Returns: eax = Return Flags edx = Sender Process ID ecx = Caller Activation (+)The process ID is only used for replying. The timeout is only for receiving,the reply is done with timeout 0. It is not possible to both send and receivea flexible page.(*) When replying to a CallRemote EBX contains the Activation, otherwise it can be used for register messages.(#) When sending a flexible page message ESI contains the source page, otherwise it can be used for register messages. When receiving a flexible page message EDI contains the destination page, otherwise it can be used for register messages.(+) Only when receiving RPC, otherwise undefined.2.5 UnmapDescription: Unmap proviuosly mapped/granted pagesInterrupt: 0x34Registers: eax = Unmap Options esi = Source Flexible PageReturn: eax = Success: TRUE/FALSE2.6 CreateProcessDescription: Create new process, assign memory to the process and place it in the ready queue.Interrupt: 0x35Registers: eax = Page Flags esi = Source Flexible PageReturn: eax = Process ID2.7 ExitDescription: Cleanly exit current processInterrupt: 0x36Registers: -Return: -2.8 ProcessIDDescription: Get process ID of calling processInterrupt: 0x37Registers: -Return: eax = Process ID2.9 RequestProcessorDescription:Interrupt: 0x38Registers:Return:2.10 IdleDescription:Interrupt: 0x39Registers:Return:2.11 YieldDescription: Give up share of processing time in favor of other processesInterrupt: 0x3aRegisters: -Return: -2.12 SleepDescription: Wait for a number of clock ticksInterrupt: 0x3bRegisters: eax = number of ticksReturn: -Table 2.1: IPC Options15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +- infinite send timeout | | | | | | | | | | | | | | +--- send register message | | | | | | | | | | | | | +----- send flexpage message | | | | | | | | | | | | +------- send IO map message | | | | | | | | | | | +--------- send mapping | | | | | | | | | | +----------- send granting | | | | | | | | | +------------- send read-only | | | | | | | | +--------------- send no access | | | | | | | +----------------- infinite receive timeout | | | | | | +------------------- receive register message | | | | | +--------------------- receive flexpage message | | | | +------------------------ receive IO map message | | | +--------------------------- receive mapping | | +------------------------------ receive granting | +--------------------------------- receive read-only +------------------------------------ receive no accessBits 16-30 are reserved.Bit 31 signifies if the message is part of call remote sequenceTable 2.2: IPC Return Flags 3 2 1 0 | | | | | | | +- register message OK | | +--- flexpage message OK | +----- IO map message OK +------- call remote OKTable 2.3: Assign Options 3 2 1 0 | | | | | | | +- assign mapping | | +--- assign granting | +----- assign read-only +------- assign no accessTable 2.4: Unmap Options 1 0 | | | +- unmap partial +--- unmap me tooMultiplexer ProtocolWhen calling the multiplexer, the specified process ID (in EDX) must be 0. Thevalue in ESI (the source flexible page) determines the subfunction of thesystem call.ESI = 0xffffffff (-1):The multiplexer will try to map/grant (determined by the IPC options in EAX)an arbitrary free page to the destination flexible page specified by EDI.ESI < 0x20000000 (kernel space):The multiplexer will try to map/grant (determined by the IPC options in EAX)the flexible page specified in ESI to the destination flexible page specifiedby EDI.ESI = ? (to be determined)The multiplexer will try to grant access to specific IO ports to the callingprocess.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -