Esempio n. 1
0
File: idt.c Progetto: gdarcy/scaraOS
void panic_exc(volatile struct intr_ctx ctx)
{
	cli();
	ctx_dump((struct intr_ctx *)&ctx);
	stack_dump((struct intr_ctx *)&ctx);
	idle_task_func();
}
void bmw256_init(bmw256_ctx_t* ctx){
	uint8_t i;
	ctx->h[0] = 0x40414243;
	for(i=1; i<16; ++i){
		ctx->h[i] = ctx->h[i-1]+ 0x04040404;
	}
	ctx->counter=0;
	ctx_dump(ctx);
}
void bmw_small_nextBlock(bmw_small_ctx_t* ctx, const void* block){
	uint32_t q[32];
	dump_x(block, 16, 'M');
	bmw_small_f0(q, ctx->h, block);
	dump_x(q, 16, 'Q');
	bmw_small_f1(q, block, ctx->h);
	dump_x(q, 32, 'Q');
	bmw_small_f2(ctx->h, q, block);
	ctx->counter += 1;
	ctx_dump(ctx);
}
void bmw224_init(bmw224_ctx_t* ctx){
	uint8_t i;
	ctx->h[0] = 0x00010203;
	for(i=1; i<16; ++i){
		ctx->h[i] = ctx->h[i-1]+ 0x04040404;
	}
#if BUG24
	ctx->h[13] = 0x24353637;
#endif
	ctx->counter=0;
	ctx_dump(ctx);
}
Esempio n. 5
0
void ke_dump(FILE *f)
{
	struct ctx_t *ctx;
	int n = 0;
	ctx = ke->context_list_head;
	fprintf(f, "List of kernel contexts (arbitrary order):\n");
	while (ctx) {
		fprintf(f, "kernel context #%d:\n", n);
		ctx_dump(ctx, f);
		ctx = ctx->context_next;
		n++;
	}
}
Esempio n. 6
0
File: idt.c Progetto: gdarcy/scaraOS
unsigned exc_handler(uint32_t exc_num, volatile struct intr_ctx ctx)
{
	static const char * const tname[] = {
		"UNKNOWN",
		"fault",
		"trap",
		"abort condition",
	};

	if ( exc[exc_num].handler ) {
		(*exc[exc_num].handler)((struct intr_ctx *)&ctx);
		return return_from_intr(&ctx);
	}

	if ( (ctx.cs & __CPL3) == __CPL3 ) {
		_sys_exit(~0);
	}

	cli();
	printk("%s: %s @ 0x%.8lx",
		tname[exc[exc_num].type], exc[exc_num].name, ctx.eip);
	if ( exc[exc_num].err_code ) {
		if ( ctx.err_code & 0x1 )
			printk(" EXT");
		switch ( ctx.err_code & 0x6 ) {
		case 0:
			printk(" GDT");
			break;
		case 2:
			printk(" IDT");
			break;
		case 4:
			printk(" LDT");
			break;
		}
		printk(" selector=0x%.lx", ctx.err_code & 0xfff8);
	}
	printk("\n");
	ctx_dump((struct intr_ctx *)&ctx);
	idle_task_func();
}
Esempio n. 7
0
File: idt.c Progetto: gdarcy/scaraOS
static void page_fault(struct intr_ctx *ctx)
{
	if ( 0 == (ctx->err_code & (PAGEFAULT_PROTECTION)) ) {
		unsigned prot;
		if ( (ctx->err_code & PAGEFAULT_WRITE) )
			prot = PROT_WRITE;
		else
			prot = PROT_READ;
		if ( !mm_pagefault(__this_task, pf_address(), prot) )
			return;
	}

	if ( ctx->err_code & PAGEFAULT_USER )
		_sys_exit(~0);
	else{
		struct pagefault_fixup *fix;
		for(fix = &__rodata_pagefault;
				fix < &__rodata_pagefault_end; fix++) {
			if ( fix->fault_addr == ctx->eip ) {
				ctx->eip = fix->fixup_addr;
				return;
			}
		}
	}

	cli();
	printk("Unhandled #PF in %s mode: %s fault_addr=0x%.8lx/%s%s\n",
		(ctx->err_code & PAGEFAULT_USER) ?
			"user" : "supervisor",
		(ctx->err_code & PAGEFAULT_PROTECTION) ?
			"PROTECTION_VIOLATION" : "NONPRESENT",
		pf_address(),
		(ctx->err_code & PAGEFAULT_WRITE) ?
			"WRITE" : "READ",
		(ctx->err_code & PAGEFAULT_RESERVED_BIT) ?
			" RESERVED_BIT" : "");
	ctx_dump(ctx);
	idle_task_func();
}