incl %eax
call grub_gate_a20
- movl EXT_C(grub_kernel_image_size), %eax
- addl EXT_C(grub_total_module_size), %eax
+ movl EXT_C(grub_compressed_size), %edx
+ addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
movl reed_solomon_redundancy, %ecx
- leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %edx
- testl %eax, %eax
+ leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
+ testl %edx, %edx
jz post_reed_solomon
call EXT_C (grub_reed_solomon_recover)
jmp post_reed_solomon
-#include "/home/phcoder/compile/grub-core/rs_decoder.S"
+#include <rs_decoder.S>
.text
typedef grub_uint16_t gf_double_t;
#define GF_POLYNOMIAL 0x1d
#define GF_INVERT2 0x8e
-#ifdef STANDALONE
-static char *scratch __attribute__ ((section(".text"))) = (void *) 0x100000;
+#if defined (STANDALONE) && !defined (TEST)
+static char *gf_invert __attribute__ ((section(".text"))) = (void *) 0x100000;
+static char *scratch __attribute__ ((section(".text"))) = (void *) 0x100100;
#else
static char *scratch;
+static grub_uint8_t gf_invert[256];
#endif
#define SECTOR_SIZE 512
return gf_reduce (res);
}
-static grub_uint8_t gf_invert[256];
-
static void
init_inverts (void)
{
return s;
}
-#if !defined (STANDALONE) || defined (TEST)
+#if !defined (STANDALONE)
static void
rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs)
{
}
}
-#if !defined (STANDALONE) || defined (TEST)
+#if !defined (STANDALONE)
static void
encode_block (gf_single_t *ptr, grub_size_t s,
gf_single_t *rptr, grub_size_t rs)
}
#endif
-#if !defined (STANDALONE) || defined (TEST)
+#if !defined (STANDALONE)
void
grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size,
grub_size_t redundancy)
gf_single_t *ptr = buffer;
gf_single_t *rptr = ptr + s;
+ grub_printf ("solomon: %p, %x, %x\n", buffer, data_size, redundancy);
+
while (s > 0)
{
grub_size_t tt;
gf_single_t *ptr = ptr_;
gf_single_t *rptr = ptr + s;
-#if defined (STANDALONE) && !defined (TEST)
+#if defined (STANDALONE)
init_inverts ();
#endif
scratch = xmalloc (1048576);
#endif
+#ifndef STANDALONE
init_inverts ();
+#endif
in = fopen ("tst.bin", "rb");
if (!in)
buf = xmalloc (s + rs + SECTOR_SIZE);
fread (buf, 1, s, in);
+ s = 0x5fbb;
+ rs = 0x6af9;
+
+#if 0
grub_reed_solomon_add_redundancy (buf, s, rs);
out = fopen ("tst_rs.bin", "wb");
out = fopen ("tst_dam.bin", "wb");
fwrite (buf, 1, s + rs, out);
fclose (out);
-
+#endif
+ s = 0x5fbb;
+ rs = 0x6af9;
grub_reed_solomon_recover (buf, s, rs);
out = fopen ("tst_rec.bin", "wb");
#define GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE 0x20
/* The size of the first region which won't be compressed. */
-#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc6c
+#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc80
-#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x748
+#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x75c
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE