Question

Any one can see why the following ifs, lines 3279-3285 in xv6-rev6 code, are used:

int num;
num = proc−>tf−>eax;
if (num >= 0 && num < SYS_open && syscalls[num]) {
    proc−>tf−>eax = syscalls[num]();
} else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
    proc−>tf−>eax = syscalls[num]();
} else {...}

and not just:

int num;
num = proc−>tf−>eax;
if (num >= 0 && num < NELEM(syscalls) && syscalls[num]) {
   proc−>tf−>eax = syscalls[num]();
} else {...}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top