void pm_setup(void) { cr0_set(cr0_get() | CR0_PM); cs_set(KERNEL_CS); ds_set(KERNEL_DS); es_set(KERNEL_DS); fs_set(KERNEL_DS); gs_set(KERNEL_DS); ss_set(KERNEL_DS); console_message(T_OK, "Kernel now running in protected-mode"); }
void fs_test(int tid) { fun_string f[25]; unsigned char d1[] = "kungfu\0kaleidescopes", d2[] = "funintheSun"; size_t count; printf("[%d] START: FUN STRING test!\n", tid); assert(f[1] = fs_new(d1, 20, 0)); assert(f[2] = fs_new(d1, 20, 0)); assert(f[3] = fs_new(d2, 11, 0)); assert(!fs_cmp(f[1], f[2])); assert(fs_cmp(f[1], f[3])); assert(f[4] = fs_resize(f[1], 10)); assert(f[5] = fs_resize(f[2], 15)); assert(f[6] = fs_resize(f[3], 10)); assert(fs_cmp(f[4], f[5])); assert(!fs_ncmp(f[4], f[5], 10)); assert(!fs_ncmp(f[3], f[6], 10)); assert(f[7] = fs_access(f[1], 3, 10)); assert(f[8] = fs_access(f[4], 3, 5)); assert(f[9] = fs_access(f[5], 5, 10)); assert(!fs_ncmp(f[7], f[8], 3)); assert(fs_cmp(f[7], f[8])); assert(fs_ncmp(f[7], f[9], 5)); assert(10 == fs_len(f[7])); assert(5 == fs_len(f[8])); assert(10 == fs_len(f[7])); assert(20 == fs_len(f[1])); assert(10 == fs_len(f[4])); assert(11 == fs_len(f[3])); assert(f[10] = fs_set(f[1], '9', 40)); assert(f[11] = fs_set(f[1], '9', 50)); assert(f[12] = fs_set(f[1], 'A', 40)); assert(!fs_ncmp(f[10], f[11], 30)); assert(fs_cmp(f[10], f[11])); assert(fs_cmp(f[10], f[12])); assert(fs_cmp(f[1], f[10])); assert(f[13] = fs_dup(f[1])); assert(f[14] = fs_dup(f[2])); assert(f[15] = fs_dup(f[4])); assert(!fs_cmp(f[13], f[14])); assert(!fs_ncmp(f[13], f[15], 5)); assert(fs_cmp(f[13], f[6])); assert(f[16] = fs_chr(f[1], 'g')); assert(f[17] = fs_chr(f[4], 'g')); assert(f[18] = fs_rchr(f[1], 'g')); assert(!fs_ncmp(f[16], f[17], 3)); assert(!fs_cmp(f[16], f[18])); assert(fs_cmp(f[16], f[7])); assert(f[19] = fs_cat(f[3], f[16])); assert(f[20] = fs_cat(f[3], f[18])); assert(f[21] = fs_ncat(f[3], f[17], 2)); assert(!fs_cmp(f[19], f[20])); assert(fs_cmp(f[19], f[21])); assert(!fs_ncmp(f[19], f[21], 13)); // To test // cat // ncat fs_free(&f[1]); fs_free(&f[2]); fs_free(&f[3]); fs_free(&f[4]); fs_free(&f[5]); fs_free(&f[6]); fs_free(&f[7]); fs_free(&f[8]); fs_free(&f[9]); fs_free(&f[10]); fs_free(&f[11]); fs_free(&f[12]); fs_free(&f[13]); fs_free(&f[14]); fs_free(&f[15]); fs_free(&f[16]); fs_free(&f[17]); fs_free(&f[18]); fs_free(&f[19]); fs_free(&f[20]); fs_free(&f[21]); printf("[%d] Strings destroyed!\n", tid); printf("[%d] END: FUN STRING Test!\n\n", tid); return; }