kernel: use HDR_MAGIC constant to handle Exec header extension, make rebootcmd() handle AOUT_MAGIC macro
This commit is contained in:
parent
3ca9ac70c4
commit
4ec93f94c9
2 changed files with 17 additions and 13 deletions
|
@ -70,14 +70,17 @@ rebootcmd(int argc, char *argv[])
|
|||
text = l2be(exec.text);
|
||||
data = l2be(exec.data);
|
||||
|
||||
if(AOUT_MAGIC == S_MAGIC || AOUT_MAGIC == I_MAGIC){
|
||||
if(magic != S_MAGIC && magic != I_MAGIC)
|
||||
if(!(magic == AOUT_MAGIC)){
|
||||
switch(magic){
|
||||
case I_MAGIC:
|
||||
case S_MAGIC:
|
||||
if((I_MAGIC == AOUT_MAGIC) || (S_MAGIC == AOUT_MAGIC))
|
||||
break;
|
||||
default:
|
||||
error(Ebadexec);
|
||||
} else if(magic != AOUT_MAGIC)
|
||||
error(Ebadexec);
|
||||
|
||||
/* amd64 extra header */
|
||||
if(magic == S_MAGIC)
|
||||
}
|
||||
}
|
||||
if(magic & HDR_MAGIC)
|
||||
readn(c, &exec, 8);
|
||||
|
||||
/* round text out to page boundary */
|
||||
|
|
|
@ -282,15 +282,16 @@ sysexec(va_list list)
|
|||
error(Ebadexec);
|
||||
magic = l2be(exec.magic);
|
||||
if(n == sizeof(Exec) && (magic == AOUT_MAGIC)){
|
||||
text = l2be(exec.text);
|
||||
entry = l2be(exec.entry);
|
||||
switch(magic){
|
||||
case S_MAGIC:
|
||||
text = l2be(exec.text);
|
||||
if(magic & HDR_MAGIC)
|
||||
text += 8;
|
||||
align = 0x200000; /* 2MB segment alignment for amd64 */
|
||||
switch(magic){
|
||||
case S_MAGIC: /* 2MB segment alignment for amd64 */
|
||||
align = 0x200000;
|
||||
break;
|
||||
case V_MAGIC:
|
||||
align = 0x4000; /* MIPS has 16K page alignment */
|
||||
case V_MAGIC: /* 16K segment alignment for mips */
|
||||
align = 0x4000;
|
||||
break;
|
||||
}
|
||||
if(text >= (USTKTOP-USTKSIZE)-(UTZERO+sizeof(Exec))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue