Pergunta

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 {...}

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top