grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Move assembly code out of the kernel


From: Robert Millan
Subject: Re: [PATCH] Move assembly code out of the kernel
Date: Thu, 31 Jul 2008 13:22:49 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Thu, Jul 31, 2008 at 03:46:47PM +0800, Bean wrote:
> diff --git a/include/grub/symbol.h b/include/grub/symbol.h
> index e951490..eef966f 100644
> --- a/include/grub/symbol.h
> +++ b/include/grub/symbol.h
> @@ -43,4 +43,13 @@
>  # define EXPORT_VAR(x)       x
>  #endif /* ! GRUB_SYMBOL_GENERATOR */
>  
> +#define REAL_STUB_START(x)   x ## _stub: ; \
> +     .long   x ## _start ; \
> +     .long   x ## _end - x ## _start ; \
> +x ## _start: ; \
> +     .code16
> +
> +#define REAL_STUB_END(x)     .code32 ; \
> +x ## _end:

Shouldn't this be in an i386/pc/ subdir?

> + * On entry, %eax should points to a structure that specifies the code/data 
> to
> + * be copied:
> + *
> + *   offset 0: address of code/data
> + *   offset 4: size of code/data
> + *
> + * grub_copy_real_stub fetches the address from offset 0, if it's not below 
> 1M or
> + * properly aligned, it copies it to a reserved area and updates the address 
> at
> + * offset 0, so that it don't need to do it again the next time.
> + *
> + * Currently, the reserved area for stub code/data is 0x80000 - 0x88000. It
> + * should be big enough for assembly code.

I wonder if this could be made simpler.  For example, by having a function
that just calls "int" in real mode.  Then callers could use inline assembly
to put parameters in appropiate registers and reading results from appropiate
registers.  Would this be faster than copiing hooks?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]