From: Gordon Matzigkeit <[EMAIL PROTECTED]>
Subject: cleanups and /sbin/grub GUI works
Date: 14 Mar 1999 20:14:37 -0600

> I have one question for you folks: under Linux on the i386, how do you
> move the stack to a different location, then move it back?  I've
> attempted to do this in asmstub.c (grub_stage2) [SIMULATE_STACK], but
> I don't know the necessary GCC magic.

  The safest way is to use the `clone' system call and set the stack
pointer of the new process to the pointer you want to specify. In
general, it's very dangerous to change the stack pointer of a process
after the process starts up, because you cannot use any variable on
realstack when the stack points to simstack. Therefore, you had better
create a new process.

> My reason is that I want grub_scratch_mem to be a memory image of the
> i386 machine at bootup.  That way, I can check for buffer and stack
> overruns the same as Electric Fence.

  I think your idea is very good, so I'd like you not to change the
meanings of the variables as well as the memory arrangement. For
example, you should not use `geometry' to store a pointer to FILE.

  By the way, if you want to simulate grub on Unix perfectly, i386
simulator is greater than the glue code. i386 simulator is described
in the task list of GNU, but I don't know if someone is already
working on it. Do you know?

----------------------------------------------------------------------
OKUJI Yoshinori  <[EMAIL PROTECTED]>           ^o-o^
http://duff.kuicr.kyoto-u.ac.jp/~okuji (in English)     m /

Reply via email to