コード例 #1
0
ファイル: task_utils.c プロジェクト: odites/DreamOs
/**
   * Make a copy of the kernel into a new pagedir/pagetable
   * @author Ivan Gualandri
   * @version 1.0 
   */
table_address_t map_kernel(){
	table_address_t logicmemory_root;
	unsigned int *logic_pd_address = kmalloc(8*4096);
	unsigned int *logic_pt_address = kmalloc(8*4096);
	unsigned int *pagedir;
	unsigned int *pagetable;
	unsigned int i=0;	
	unsigned int j=0;
	/** Request physical space for pagedir and pagetable*/ 	
	pagedir = create_pageDir();
	pagetable = create_pageTable();	
	//set_pagedir_entry_ric(1023, fis_address, PD_PRESENT|SUPERVISOR, 0);
	/*new_pd_node->start_address = (heap_node_t*) pagedir;
	new_pd_node->size = 8 * 4096;*/
	/**Map the logic addresses for pagedir and pagetable into phisical address
	 * identified by the variables pagetable and pagedir*/
	while(i < 8){
		map_address(pagedir, logic_pd_address);
		map_address(pagetable, logic_pt_address);		
		pagedir+=4096;
		pagetable+=4096;
		i++;
	}	
	//set_pagedir_entry_ric(0, (unsigned int)current_page_table, PD_PRESENT|SUPERVISOR|WRITE,0);  
	/**Initialize the pagedir with all 0's and the pagetable with the locations of the kernel*/  
	while(j<PD_LIMIT){
		pagedir[j] = 0x0;
		pagetable[j] = (j*0x1000&0xFFFFF0)|PD_PRESENT|SUPERVISOR|WRITE|0;
		j++;
	}
	/**Add the pagetable to first entry of the pagedir*/
	pagedir[0] = ((unsigned int)pagetable&0xFFFFF000)|PD_PRESENT|SUPERVISOR|WRITE|0;
	pagedir[1023] = ((unsigned int)pagedir&0xFFFFF000)|PD_PRESENT|SUPERVISOR|0;	
	/**Prepare the result and return it*/
	logicmemory_root.page_dir = (unsigned int) pagedir;
	logicmemory_root.page_table = (unsigned int) pagetable;
	return logicmemory_root;
}
コード例 #2
0
ファイル: transact.c プロジェクト: aosm/fetchmail
static void find_server_names(const char *hdr,
			      struct query *ctl,
			      struct idlist **xmit_names)
/* parse names out of a RFC822 header into an ID list */
/*   hdr:		RFC822 header in question */
/*   ctl:		list of permissible aliases */
/*   xmit_names:	list of recipient names parsed out */
{
    if (hdr == (char *)NULL)
	return;
    else
    {
	char	*cp;

	for (cp = nxtaddr(hdr); cp != NULL; cp = nxtaddr(NULL))
	{
	    char	*atsign;

	    /* 
	     * Handle empty address from a To: header containing only 
	     * a comment.
	     */
	    if (!*cp)
		continue;

	    /*
	     * If the name of the user begins with a qmail virtual
	     * domain prefix, ignore the prefix.  Doing this here
	     * means qvirtual will work either with ordinary name
	     * mapping or with a localdomains option.
	     */
	    if (ctl->server.qvirtual)
	    {
		int sl = strlen(ctl->server.qvirtual);
 
		if (!strncasecmp((char *)cp, ctl->server.qvirtual, sl))
		    cp += sl;
	    }

	    if ((atsign = strchr((char *)cp, '@'))) {
		struct idlist	*idp;

		/* try to match full address first, this takes
		 * precedence over localdomains and alias mappings */
		if (map_address(cp, ctl, xmit_names))
		    goto nomap;

		/*
		 * Does a trailing segment of the hostname match something
		 * on the localdomains list?  If so, save the whole name
		 * and keep going.
		 */
		for (idp = ctl->server.localdomains; idp; idp = idp->next) {
		    char	*rhs;

		    rhs = atsign + (strlen(atsign) - strlen(idp->id));
		    if (rhs > atsign &&
			(rhs[-1] == '.' || rhs[-1] == '@') &&
			strcasecmp(rhs, idp->id) == 0)
		    {
			if (outlevel >= O_DEBUG)
			    report(stdout, GT_("passed through %s matching %s\n"), 
				  cp, idp->id);
			save_str(xmit_names, (const char *)cp, XMIT_ACCEPT);
			accept_count++;
			goto nomap;
		    }
		}

		/* if we matched a local domain, idp != NULL */
		if (!idp)
		{
		    /*
		     * Check to see if the right-hand part is an alias
		     * or MX equivalent of the mailserver.  If it's
		     * not, skip this name.  If it is, we'll keep
		     * going and try to find a mapping to a client name.
		     */
		    if (!is_host_alias(atsign+1, ctl, &ai0))
		    {
			save_str(xmit_names, cp, XMIT_REJECT);
			reject_count++;
			continue;
		    }
		}
		atsign[0] = '\0';
		map_name(cp, ctl, xmit_names);
	    nomap:;
	    }
	}
    }
}