Re: [PATCH] DL support on usparc & cls disabling when debugging

2005-10-22 Thread Hollis Blanchard

On Oct 22, 2005, at 7:24 AM, Vincent Pelletier wrote:


Vincent Pelletier wrote:

I'll send a separate patch for the .mk & .rmk files, because I have a
lot of dust in those files.


Here they are, along with cache.S
I'll commit those tomorrow if nothing is wrong with those
(conf/sparc64-ieee1275.rmk, conf/sparc64-ieee1275.mk and
kern/sparc64/dl.c, kern/sparc64/cache.S, -kern/sparc64/cache.c).


Especially since your patch affects only sparc64 files, I'd say go 
right ahead and commit. :)



2005-10-22  Vincent Pelletier <[EMAIL PROTECTED]>
...
* conf/sparc64-ieee1275.mk: Generated from sparc64-ieee1275.rmk.


We've been in the habit of simply not mentioning the .mk files: not in 
the changelog, and not in patches to the list. The diffs are simply too 
large and not meaningful.


However, when you commit, please do commit the .mk file in addition to 
the real changes.


Warning: this particular patch you sent has a lot of CVS conflicts in 
the .mk file. In general please do a build/boot test before sending out 
a patch... even for "trivial" changes. I've been embarrassed by that a 
few times myself. :)


-Hollis



___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] DL support on usparc & cls disabling when debugging

2005-10-12 Thread Vincent Pelletier
Timothy Baldwin wrote:
> With a bad gnupg signature here.

Probably because of the mailing list signature...


signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] DL support on usparc & cls disabling when debugging

2005-10-12 Thread Timothy Baldwin
On Wednesday 12 Oct 2005 18:53, Vincent Pelletier wrote:
> Hi.
>
> Finally, I send this dl.c patch.

With a bad gnupg signature here.

-- 
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents!Victory to the iraqi resistance!


pgpjCNkx0Ec84.pgp
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] DL support on usparc & cls disabling when debugging

2005-10-12 Thread Vincent Pelletier
Hi.

Finally, I send this dl.c patch.
I'll send a separate patch for the .mk & .rmk files, because I have a
lot of dust in those files.

I also joined a patch to disable cls when setting a debug level, and
some changes to parse such arguments before any initialisation, so error
messages won't get cleaned by a cls in early boot.

2005-10-12  Vincent Pelletier  [EMAIL PROTECTED]

* kern/sparc64/dl.c (grub_arch_dl_check_header): Use sparcv9
ELF header values.
grub_arch_dl_relocate_symbols) : Implement 64 bits relocations.
* kern/term.c (grub_cls): Return without clearing screen if
debug is set.
* kern/sparc64/ieee1275/init.c (grub_machine_init): Read
environment variables before anything else.
Index: kern/sparc64/dl.c
===
RCS file: /cvsroot/grub/grub2/kern/sparc64/dl.c,v
retrieving revision 1.1
diff -u -p -r1.1 dl.c
--- kern/sparc64/dl.c   21 Aug 2005 18:42:55 -  1.1
+++ kern/sparc64/dl.c   12 Oct 2005 17:34:00 -
@@ -30,9 +30,9 @@ grub_arch_dl_check_header (void *ehdr)
   Elf64_Ehdr *e = ehdr;
 
   /* Check the magic numbers.  */
-  if (e->e_ident[EI_CLASS] != ELFCLASS32
+  if (e->e_ident[EI_CLASS] != ELFCLASS64
   || e->e_ident[EI_DATA] != ELFDATA2MSB
-  || e->e_machine != EM_PPC)
+  || e->e_machine != EM_SPARCV9)
 return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
 
   return GRUB_ERR_NONE;
@@ -83,53 +83,53 @@ grub_arch_dl_relocate_symbols (grub_dl_t
 rel < max;
 rel++)
  {
-   Elf64_Xword *addr;
+   Elf64_Word *addr;
Elf64_Sym *sym;
-   grub_uint64_t value;
+   Elf64_Addr value;

if (seg->size < rel->r_offset)
  return grub_error (GRUB_ERR_BAD_MODULE,
 "reloc offset is out of the segment");

-   addr = (Elf64_Xword *) ((char *) seg->addr + rel->r_offset);
+   addr = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
sym = (Elf64_Sym *) ((char *) symtab
-+ entsize * ELF32_R_SYM (rel->r_info));
-   
-   /* On the PPC the value does not have an explicit
-  addend, add it.  */
++ entsize * ELF64_R_SYM (rel->r_info));
+
value = sym->st_value + rel->r_addend;
-   switch (ELF32_R_TYPE (rel->r_info))
+   switch (ELF64_R_TYPE (rel->r_info))
  {
- case R_PPC_ADDR16_LO:
-   *(Elf64_Half *) addr = value;
-   break;
-   
- case R_PPC_REL24:
-   {
- Elf64_Sxword delta = value - (Elf64_Xword) addr;
- 
- if (delta << 6 >> 6 != delta)
-   return grub_error (GRUB_ERR_BAD_MODULE, "Relocation 
overflow");
- *addr = (*addr & 0xfc03) | (delta & 0x3fc);
- break;
-   }
-   
- case R_PPC_ADDR16_HA:
-   *(Elf64_Half *) addr = (value + 0x8000) >> 16;
-   break;
-   
- case R_PPC_ADDR32:
-   *addr = value;
-   break;
-   
- case R_PPC_REL32:
-   *addr = value - (Elf64_Xword) addr;
-   break;
-   
+  case R_SPARC_32: /* 3 V-word32 */
+if (value & 0x)
+  return grub_error (GRUB_ERR_BAD_MODULE,
+ "Address out of 32 bits range");
+*addr = value;
+break;
+  case R_SPARC_WDISP30: /* 7 V-disp30 */
+if (((value - (Elf64_Addr) addr) & 0x) &&
+((value - (Elf64_Addr) addr) & 0x
+!= 0x))
+  return grub_error (GRUB_ERR_BAD_MODULE,
+ "Displacement out of 30 bits range");
+*addr = (*addr & 0xC000) |
+  (((grub_int32_t) ((value - (Elf64_Addr) addr) >> 2)) &
+   0x3FFF);
+break;
+  case R_SPARC_HI22: /* 9 V-imm22 */
+if (((grub_int32_t) value) & 0xFF)
+  return grub_error (GRUB_ERR_BAD_MODULE,
+ "High address out of 22 bits range");
+*addr = (*addr & 0xFFC0) | ((value >> 10) & 0x3F);
+break;
+  case R_SPARC_LO10: /* 12 T-simm13 */
+