1
Index: b/grub/asmstub.c
2
===================================================================
13
+#define PAGESIZE 4096
17
# include <sys/ioctl.h> /* ioctl */
19
assert (grub_scratch_mem == 0);
20
scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15);
27
+ /* Align to a multiple of PAGESIZE, assumed to be a power of two. */
28
+ p = (char *) (((long) scratch) & ~(PAGESIZE - 1));
30
+ /* The simulated stack needs to be executable, since GCC uses stack
31
+ * trampolines to implement nested functions.
33
+ ret = mprotect (p, 0x100000 + EXTENDED_MEMSIZE + 15,
34
+ PROT_READ | PROT_WRITE | PROT_EXEC);
38
grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4);
40
/* FIXME: simulate the memory holes using mprot, if available. */