[U-Boot-Users] Re: The i386 patch

Robert Kaiser rob at sysgo.de
Wed Nov 20 13:22:17 CET 2002


Am Dienstag, 19. November 2002 22:19 schrieb Wolfgang Denk:
> > I think it will be a problem that printf is defined as a
> > syscall because it is a variable argument list function.
> >
> > How do I know how much of the stack to copy when I enter
> > the firmware?
>
> What do you mean with "stack to copy"?

The standard method for the x86 to implement a syscall is through a 
"gate", which is also a mechanism to switch to a higher protection level. 
Since caller and callee run at different protection levels, they use 
different stacks and since the x86 passes arguments on the stack, it is 
possible to specify (in the corresponding gate structure) the amount of bytes 
to be copied from the caller's stack to the callee's stack.

> You are running in the  U-Boot
> environment,  accessing  the  U-Boot  stack directly. No need to copy
> anything...

Does that mean that the caller always runs at the same protection level as 
U-Boot?

If so, then I think that a syscall mechanism for the x86 through gates would 
be overkill. But then, OTOH, why use syscalls at all ? A simple jump table 
could do the same thing, and do it portably.

Rob

----------------------------------------------------------------
Robert Kaiser                         email: rkaiser at sysgo.de
SYSGO AG
Am Pfaffenstein 14                    phone: (49) 6136 9948-762
D-55270 Klein-Winternheim / Germany   fax:   (49) 6136 9948-10




More information about the U-Boot mailing list