Skip to content

Instantly share code, notes, and snippets.

@uchan-nos
Last active November 22, 2016 16:02
Show Gist options
  • Save uchan-nos/5e3af79d970b048daf2693b684b45623 to your computer and use it in GitHub Desktop.
Save uchan-nos/5e3af79d970b048daf2693b684b45623 to your computer and use it in GitHub Desktop.
void f() {
if (finfo != 0) {
/* ファイルが見つかった場合 */
appsiz = finfo->size;
p = file_loadfile2(finfo->clustno, &appsiz, fat);
if (appsiz >= 36 && strncmp(p + 4, "Hari", 4) == 0 && *p == 0x00) {
segsiz = *((int *) (p + 0x0000));
esp = *((int *) (p + 0x000c));
datsiz = *((int *) (p + 0x0010));
dathrb = *((int *) (p + 0x0014));
q = (char *) memman_alloc_4k(memman, segsiz);
task->ds_base = (int) q;
set_segmdesc(task->ldt + 0, appsiz - 1, (int) p, AR_CODE32_ER + 0x60);
set_segmdesc(task->ldt + 1, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
for (i = 0; i < datsiz; i++) {
q[esp + i] = p[dathrb + i];
}
start_app(0x1b, 0 * 8 + 4, esp, 1 * 8 + 4, &(task->tss.esp0));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment