int main(int argc, char *argv[]) { lzo_bytep buf; lzo_uint step; if (argc >= 2 && strcmp(argv[1],"-v") == 0) opt_verbose = 1; if (lzo_init() != LZO_E_OK) { printf("lzo_init() failed !!!\n"); return 3; } buf = (lzo_bytep) lzo_malloc(2*BLOCK_SIZE + 256); if (buf == NULL) { printf("out of memory\n"); return 2; } #if defined(lzo_uintptr_t) printf("Align init: %p ( 0x%lx )\n", buf, (unsigned long) (lzo_uintptr_t) buf); #elif defined(__LZO_MMODEL_HUGE) printf("Align init: %p ( 0x%lx )\n", buf, (unsigned long) buf); #else printf("Align init: %p ( 0x%lx )\n", buf, (unsigned long) (size_t) buf); #endif for (step = 1; step <= 65536L; step *= 2) { lzo_bytep block = buf; unsigned long n; unsigned gap; gap = __lzo_align_gap(block, step); block = LZO_PTR_ALIGN_UP(block, step); if (opt_verbose >= 1) printf("STEP %5lu: GAP: %5lu %p %p %5lu\n", (unsigned long) step, (unsigned long) gap, buf, block, (unsigned long) (block - buf)); n = align_test(block, BLOCK_SIZE, step); if (n == 0) return 1; if ((n + 1) * step != BLOCK_SIZE) { printf("error 4: %ld %lu\n", (long)step, n); return 1; } } lzo_free(buf); printf("Alignment test passed.\n"); return 0; }
int main (void) { int ret; printf("except_test\n"); /* Register bus error handler */ excpt_buserr = (unsigned long)bus_err_handler; /* Register illegal insn handler */ excpt_illinsn = (unsigned long)ill_insn_handler; /* Register tick timer exception handler */ excpt_tick = (unsigned long)tick_handler; /* Register external interrupt handler */ excpt_int = (unsigned long)int_handler; /* Register ITLB miss handler */ excpt_itlbmiss = (unsigned long)itlb_miss_handler; /* Register instruction page fault handler */ excpt_ipfault = (unsigned long)ipage_fault_handler; /* Register DTLB miss handler */ excpt_dtlbmiss = (unsigned long)dtlb_miss_handler; /* Register data page fault handler */ excpt_dpfault = (unsigned long)dpage_fault_handler; /* Register trap handler */ excpt_trap = (unsigned long)trap_handler; /* Register align handler */ excpt_align = (unsigned long)align_handler; /* Register range handler */ excpt_range = (unsigned long)range_handler; /* Exception basic test */ ret = except_basic (); ASSERT(ret == 0); printf("interupt_test\n"); /* Interrupt exception test */ interrupt_test (); printf("itlb_test\n"); /* ITLB exception test */ itlb_test (); printf("dtlb_test\n"); /* DTLB exception test */ dtlb_test (); printf("buserr_test\n"); /* Bus error exception test */ buserr_test (); printf("illegal_insn_test\n"); /* Bus error exception test */ /* Illegal insn test */ illegal_insn_test (); printf("align_test\n"); /* Alignment test */ align_test (); printf("trap_test\n"); /* Trap test */ trap_test (); printf("except_priority_test\n"); /* Range test */ // range_test (); /* Exception priority test */ except_priority_test (); report (0xdeaddead); exit (0); return 0; }