		Host - Guest - Communication - Protocoll (Pi0)
		----------------------------------------------

1. General format

Host receives from monitor:

                                   Data       Function Subfunction      
                            31             16 15     8 7       0
	context.event_info: |----------------|--------|--------|

                                             Data
                            31                                 0
	context.error     : |----------------------------------|


	Intended action: an action, preformed by kernel modul or user space program (plugin)
	Intended reply : a reply to guest, stored in event_info and error
	Description    : some words of description



2. Functions with action performed in host context

2.1. RET_BECAUSE_REDIR
  Function: RET_BECAUSE_REDIR
  Subfunction: interrupt vector
  Data: -
  Intended action: Handle a redirected interrupt
  Intended reply: - 
  Description: Monitor reflects all interrupts to host; host has to handle interrupt

2.2. RET_BECAUSE_EMERR    
  Function: RET_BECAUSE_EMERR
  Subfunction: 13 (GP(0))
  Data: - 
  Intended action: Close virtual machine
  Intended reply: - 
  Description: Unable to emulate a particular thing, it's safe to stop and close virtual machine

2.3. RET_BECAUSE_MON_ERROR
  Function: RET_BECAUSE_MON_ERROR
  Subfunction: -
  Data: -
  Intended action: Close virtual machine
  Intended reply: - 
  Description: An error happened in monitor itself, it's safe to stop and close virtual machine

2.4. RET_BECAUSE_REMAP    
  Function: RET_BECAUSE_REMAP
  Subfunction: -
  Data: -
  Intended action: Remap (unmap; map) monitor in guests's address space
  Intended reply: -
  Description: Segments or page tables changed, monitor has to remapped to a new place

2.5. RET_BECAUSE_USEREMU
  Function: RET_BECAUSE_USEREMU
  Subfunction:
    EMU_INSTR_OUT_8         
    EMU_INSTR_OUT_16        
    EMU_INSTR_OUT_32        
    EMU_INSTR_IN_8          
    EMU_INSTR_IN_16         
    EMU_INSTR_IN_32         
    EMU_INSTR_OUTS_8        
    EMU_INSTR_OUTS_16       
    EMU_INSTR_OUTS_32       
    EMU_INSTR_INS_8         
    EMU_INSTR_INS_16        
    EMU_INSTR_INS_32        
    EMU_INSTR_REP_OUTS_8    
    EMU_INSTR_REP_OUTS_16   
    EMU_INSTR_REP_OUTS_32   
    EMU_INSTR_REP_INS_8     
    EMU_INSTR_REP_INS_16    
    EMU_INSTR_REP_INS_32    
    EMU_INSTR_HLT           
    EMU_INSTR_INT           
    EMU_INSTR_STI           
  Data: specific to user space emulation function
  Intended action: Emulate a particular instruction in user space
  Intended reply: -
  Description: Some instructions have to emulated in user space, mostly by plugins


2.6. RET_BECAUSE_KERNELEMU
  Function: RET_BECAUSE_KERNELEMU
  Subfunction:
    PAGE_CACHE_EMPTY
    PAGE_CACHE_FULL
  Data: -
  Intended action: refill/empty page cache
  Intended reply: OK/FAIL
  Description: Monitor needs more pages than page cache contains or wants to put more
               pages into page cache than space is left -> refill/empty page cache




3. Functions with action performed in guest context

3.1.  MON_ACTION_RAISE_INT
  Function: MON_ACTION_RAISE_INT
  Subfunction: interrupt vector
  Data: -
  Intended action: Raise an interrupt for guest
  Intended reply: -
  Description: Emulate an interrupt exception for guest

3.2. MON_ACTION_SET_VIP
  Function: MON_ACTION_SET_VIP
  Subfunction: -
  Data: -
  Intended action: Set VIP-Flag in monitor's eflags
  Intended reply: -
  Description: Just set this flag


4. See also

See also files:
* plex86.h
* monitor.h
