2016年1月11日 星期一

mips knowledge(pic/gp/t9)

https://nieyong.github.io/wiki_ny/mips%20knowledge.html
global pointer

全局指针寄存器(gp)是MIPS的通用寄存器$28。这个寄存器的用途主要有两种:


http://lists.denx.de/pipermail/eldk/2007-November/000014.html
[ELDK] Crosstool for MIPS exception in "run time"


http://stackoverflow.com/questions/6835724/mips-stack-frame-and-addiu-instruction-confusion
Question #1:
Despite searching around for awhile on the internet, I still don't really understand how gp is supposed to be used in the stackframe.

In particular, the documents I read say the call procedure standard is a0-a3 are used as function input, v0-v3 as function output, s0-s8 are preserved across calls, and t0-t9 are not preserved across any call. So the pushing and popping of s0-s8 make sense. But why in the world is it setting gp according to the value in t9!?



http://www.linux-mips.org/wiki/PIC_code

A quick PIC howto



https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39493
Bug 39493 - [Mips] No space for arguments when implicitely calling __get_tls_addr

Compiled and linked with:

mipsel-unknown-elf-gcc -fpic -mshared -nostdinc -nostdlib -fno-builtin -mips2 -EL -mabicalls -G0 -c -o test.o test.c
mipsel-unknown-elf-ld -shared test.o -o test.so

Result in assembly:

5ffe0390 <func>:
5ffe0390:       3c1c0001        lui     gp,0x1
5ffe0394:       279c9090        addiu   gp,gp,-28528
5ffe0398:       0399e021        addu    gp,gp,t9
5ffe039c:       27bdffe8        addiu   sp,sp,-24



http://www.linux-mips.org/wiki/NPTL

Status

NPTL for Linux/MIPS is functionally complete. Ulrich Drepper's NPTL Design Document contains some information on the NTPL design including implementation details on other architectures. One prerequirement for NPTL is TLS, as documented in Thread Local Storage.


https://sourceware.org/ml/binutils/2013-02/msg00121.html

[9/20] MIPS GOT: Factor out GOT creation code

The master GOT and multigots use different hash equivalence functions,
and hence different hash functions.  The master GOT has a separate
mips_got_entry for each BFD that references a symbol, and a separate
mips_got_entry for each BFD that uses a TLS LDM slot.  Other GOTs have
a single mips_got_entry for all references to the same thing.


https://www.math.ku.edu/computing/cluster/totalview.6.0.0-0-doc/ref_guide/architectures24.html

MIPS General Registers

TotalView displays the MIPS general-purpose registers in the Stack Frame Pane of the Process Window. The following table describes how TotalView treats each general register, and the actions you can take with each register.

Programs compiled with either -64 or -n32 have 64-bit registers. TotalView uses <long> for -64 compiled programs and <long long> for -n32 compiled programs.


https://www.sourceware.org/ml/binutils/2004-05/msg00622.html

Re: [patch] MIPS gas problems with gcc's explicit relocs

沒有留言:

張貼留言