next up previous contents
Next: 2.8 Domains and resource Up: 2.7 Resource unit availability: Previous: 2.7 Resource unit availability:

  
2.7.1 Delivering Missing exceptions

Exception delivering is done by missing. It uses the portal server kpct utility to issue a PCT from the kernel to the user (i.e. to upcall the user). The message delivered is of type MissingReq and a reply of type MissingRep is expected.

In the missing request the kernel supplies (in addition to the exception type, m_type) the missing object identifier and the object kind (because the identifier could correspond to different resources in the case of abstract resources). Message type is EX_MISSING.

<Off user-kernel messages. >+= [<-D->]
// Missing message. 
struct off_MissingReq : public off_MsgReq {
  off_Magic m_obj;      // Object kind.
  off_id_t  m_id;       // Object id.

  // Creates a missing request.
  off_MissingReq(const off_Magic obj, const off_id_t &id) :
    off_MsgReq(OFF_EX_MISSING), m_obj(obj), m_id(id) {;}
};

Defines off_MissingReq (links are to index).

<Off user-kernel messages dependencies. >+= [<-D]
#include <klib/ids.h>           // for off_eu_id_t et al.

The user is expected to fetch the remote resource, fix the resource identifier slot field to match the entry used in the local resource allocator and return the fixed identifier. If due to some circumstances the resource could not be fetched, a null identifier must be returned by the user.

<Off user-kernel messages. >+= [<-D]
struct off_MissingRep : public off_MsgRep {
  off_id_t m_id;             // Local object id.
  off_MissingRep(void){;}
  off_MissingRep(const off_id_t &id) : m_id(id) {;}
};

Defines off_MissingRep (links are to index).

These message types are defined in prtl/ex.h.

<Off relocation table implementation dependencies. >= (U->) [D->]
//#include <prtl/ex.h>            // for off_Missing{Req|Rep} XXX uncomment it

<off_RelocTbl::missing implementation. >= (U->)
// Talks to the user at ex to fetch ID which is missing.
// Returns non-zero error code when failed.
err_t off_RelocTbl::missing(const off_prtl_id_t &ex, 
                            const off_Magic id_type, off_id_t &id) 
{
  err_t r=EOK;
#if 0                           // XXX 
  off_MissingReq m(id_type, id);
  off_MissingRep r;
  if (ex == OFF_PRTL_NULL)
    return ENOPRTL;
  if ((r=prtl.kpct(ex,off_Shtl::self(),sizeof(m),sizeof(r),&m,&r,0)))
    return r;
  else
    return ((id=r.m_id) == OFF_ID_NULL) ? ENOENT : EOK;
#endif
  (void)ex;(void)id_type;(void)id;
  return r;
}

<Off relocation table implementation dependencies. >+= (U->) [<-D]
//#include <prtl/PrtlSrv.h>       // for prtl.  XXX include it all.
//#include <shtl/Shtl.h>          // for off_Shtl and self.

\subsection{Relocation tables \cpp{} source files}

Relocation tables are kept in klib/RelocTbl.h and klib/RelocTbl.C.

<RelocTbl.h*>=
<Read the literate code instead warning. >
#ifndef __OFF_RELOC_TBL_H
#define __OFF_RELOC_TBL_H 1

<Off relocation table dependencies. >

#ifdef __KERNEL__
class off_RelocTbl;
<Off relocation table entry. >
<Off relocation table hasher. >
<Off relocation table. >
#endif // __KERNEL__

#endif // __OFF_RELOC_TBL_H

<RelocTbl.C*>=
<Read the literate code instead warning. >

#include <klib/RelocTbl.h>      // Exported interface. 
<Off relocation table implementation dependencies. >

<Off relocation table static members. >
<off_RelocTbl::off_RelocTbl implementation. >
<off_RelocTblEnt::new/delete implementation. > 
<off_RelocTbl::is_relocated implementation. >
<off_RelocTbl::relocate implementation. >
<off_RelocTbl::unrelocate implementation. >
<off_RelocTbl::missing implementation. >
<off_RelocTbl::start implementation. >



Francisco J. Ballesteros
1998-05-25