Ejemplo n.º 1
0
void print_thread_table() {
	for(thread_t *i = init_thread; ; i = i->next) {
		put_addr(i);
		puts(" : ");
		put_addr((void *)i->stack);
		puts("\n");

		if(i->children != 0) {
			for(thread_t *j = i->children; ; j = j->next) {
				puts("	");
				put_addr(j);
				puts(" : ");
				put_addr((void *)j->stack);
				puts("\n");

				if(j->next == 0)
					break;
			}
		}

		if(i->next == 0) 
			return;
	}

	
}
Ejemplo n.º 2
0
static void send_arp(int fd,unsigned short op,uint32_t local_ip,
  struct sockaddr_atmsvc *local_addr,uint32_t remote_ip,
  struct sockaddr_atmsvc *remote_addr)
{
    struct sockaddr_atmsvc local;
    struct atmarphdr *hdr;
    unsigned char *buffer,*here;

    if (!local_addr) {
	if (get_local(fd,&local) < 0) return;
	local_addr = &local;
    }
    buffer = alloc(MAX_ATMARP_SIZE+RFC1483LLC_LEN);
    memcpy(buffer,llc_oui_arp,RFC1483LLC_LEN);
    hdr = (struct atmarphdr *) (buffer+RFC1483LLC_LEN);
    memset(hdr,0,MAX_ATMARP_SIZE);
    hdr->ar_hrd = htons(ARPHRD_ATM);
    hdr->ar_pro = htons(ETH_P_IP);
    hdr->ar_op = htons(op);
    here = hdr->data;
    put_addr(&here,local_addr,&hdr->ar_shtl,&hdr->ar_sstl);
    put_ip(&here,local_ip,&hdr->ar_spln);
    put_addr(&here,remote_addr,&hdr->ar_thtl,&hdr->ar_tstl);
    put_ip(&here,remote_ip,&hdr->ar_tpln);
    send_packet(fd,buffer,here-buffer);
    free(buffer);
}
Ejemplo n.º 3
0
void mov_addr_r32(void *dest, int source)
{
	//eg, "mov 0x0, %eax" where 0x0 = C_stack
	if(isreg(source)) {
		//special case for eax
		if(source==EAX) {
			putbyte(0xa1);
			put_addr(dest);
		}
		else {
			putbyte(0x8b);
			putbyte((source*0x8)+0x5);
			put_addr(dest);
		}
	}
	else aerror("Error in moving a reg to an address");
}
Ejemplo n.º 4
0
void mov_r32_addr(int dest, void *source)
{
	//eg, "mov %eax, 0x0" where 0x0 = C_stack
	if(isreg(dest)) {
		//special case for eax
		if(dest==EAX) {
			putbyte(0xa3);
			put_addr(source);
		}
		else {
			putbyte(0x89);
			putbyte((dest*0x8)+0x5);
			put_addr(source);
		}
	}
	else aerror("Error in moving an address to a reg");
}	
Ejemplo n.º 5
0
void sub_imm8_addr(int size, void *addr)
{
	put2bytes(0x832d);
	put_addr(addr);
	putbyte(size);
}
Ejemplo n.º 6
0
void add_imm8_addr(int size, void *addr)
{
	put2bytes(0x8305);
	put_addr(addr);
	putbyte(size);
}