All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: James Hogan <james@albanarts.com>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH 6/9] MIPS: Call relocate_kernel if CONFIG_RELOCATABLE=y
Date: Fri, 4 Dec 2015 16:37:17 +0100	[thread overview]
Message-ID: <20151204153716.GA16238@linux-mips.org> (raw)
In-Reply-To: <56614CB5.9020002@imgtec.com>

On Fri, Dec 04, 2015 at 08:20:05AM +0000, Matt Redfearn wrote:

> >Although, it could still be reduced:
> >PTR_ADDU sp, gp, _THREAD_SIZE - 32 - PT_SIZE
> >
> >Assuming the immediate is in range of signed 16bit.
> 
> The immediate would be 32552, so in range of signed 16bit, but that would be
> brittle if either _THREAD_SIZE or PT_SIZE were to change in future....

The maximum value possible for _THREAD_SIZE would be with 64k pages for
which the expression will exceed the signed 16 bit range.  The good news
is that GAS is smart enough to cope with the situation by suitably
expanding the instruction into a macro unless ".set noat" or ".set nomacro"
mode are enabled:

$ cat s.s 
	addu	$sp, $gp, 65536
[ralf@h7 tmp]$ mips-linux-as -O2 -als -o s.o s.s
GAS LISTING s.s 			page 1


   1 0000 3C010001 		addu	$sp, $gp, 65536
   1      0381E821 
   1      00000000 
   1      00000000 

GAS LISTING s.s 			page 2


NO DEFINED SYMBOLS

NO UNDEFINED SYMBOLS
[ralf@h7 tmp]$ mips-linux-objdump -d s.o 
s.o:     file format elf32-tradbigmips


Disassembly of section .text:

00000000 <.text>:
   0:	3c010001 	lui	at,0x1
   4:	0381e821 	addu	sp,gp,at
	...

And of course that macro should better not be expanded in a branch
delay slot ...

  Ralf

  reply	other threads:[~2015-12-04 15:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 10:08 [PATCH 0/9] MIPS Relocatable kernel & KASLR Matt Redfearn
2015-12-03 10:08 ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 1/9] MIPS: tools: Add relocs tool Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 2/9] MIPS: tools: Build " Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 3/9] MIPS: Reserve space for relocation table Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 4/9] MIPS: Generate relocation table when CONFIG_RELOCATABLE Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 5/9] MIPS: Kernel: Add relocate.c Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 6/9] MIPS: Call relocate_kernel if CONFIG_RELOCATABLE=y Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 14:24   ` Sergei Shtylyov
2015-12-03 14:53     ` Matt Redfearn
2015-12-03 14:53       ` Matt Redfearn
2015-12-03 17:46       ` Sergei Shtylyov
2015-12-03 18:54         ` James Hogan
2015-12-04  8:20           ` Matt Redfearn
2015-12-04  8:20             ` Matt Redfearn
2015-12-04 15:37             ` Ralf Baechle [this message]
2015-12-04 15:45               ` Matt Redfearn
2015-12-04 15:45                 ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 7/9] MIPS: bootmem: When relocatable, free memory below kernel Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 8/9] MIPS: Add CONFIG_RELOCATABLE Kconfig option Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 10:08 ` [PATCH 9/9] MIPS: Kernel: Implement kASLR using CONFIG_RELOCATABLE Matt Redfearn
2015-12-03 10:08   ` Matt Redfearn
2015-12-03 22:23 ` [PATCH 0/9] MIPS Relocatable kernel & KASLR Joshua Kinard
2015-12-04  8:14   ` Matt Redfearn
2015-12-04  8:14     ` Matt Redfearn
2015-12-04 13:14     ` Joshua Kinard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151204153716.GA16238@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=james@albanarts.com \
    --cc=linux-mips@linux-mips.org \
    --cc=matt.redfearn@imgtec.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.