Subject: kern/32423: Boot loader hook for loading processor specified kernel segments
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <cherry@mahiti.org>
List: netbsd-bugs
Date: 12/31/2005 11:05:01
>Number:         32423
>Category:       kern
>Synopsis:       Boot loader hook for loading processor specified kernel segments
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 31 11:05:00 +0000 2005
>Originator:     Cherry G. Mathew
>Release:        -current
>Organization:
Mahiti
>Environment:
>Description:
See Thread on tech-kern:

http://mail-index.netbsd.org/tech-kern/2005/12/30/0007.html


>How-To-Repeat:

>Fix:
*** loadfile_elf32.c	11 Dec 2005 17:54:46 +0530	1.12
--- loadfile_elf32.c	31 Dec 2005 16:25:55 +0530	
***************
*** 296,301 ****
--- 296,308 ----
  
  	for (first = 1, i = 0; i < elf->e_phnum; i++) {
  		internalize_phdr(elf->e_ident[EI_DATA], &phdr[i]);
+ 
+ #ifdef MD_LOADSEG /* Allow processor ABI specific segment loads */
+ 		if ( (phdr[i].p_type & PT_LOPROC) &&
+ 		     MD_LOADSEG(phdr[i]))
+ 				goto loadseg;
+ #endif /*MD_LOADSEG*/
+ 
  		if (phdr[i].p_type != PT_LOAD ||
  		    (phdr[i].p_flags & (PF_W|PF_X)) == 0)
  			continue;
***************
*** 309,314 ****
--- 316,322 ----
  		if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||
  		    (IS_DATA(phdr[i]) && (flags & LOAD_DATA))) {
  
+ 		loadseg:
  			/* Read in segment. */
  			PROGRESS(("%s%lu", first ? "" : "+",
  			    (u_long)phdr[i].p_filesz));