liblink, runtime: preliminary support for plan9/amd64
A TLS slot is reserved by _rt0_.*_plan9 as an automatic and
its address (which is static on Plan 9) is saved in the
global _privates symbol. The startup linkage now is exactly
like that from Plan 9 libc, and the way we access g is
exactly as if we'd have used privalloc(2).
Aside from making the code more standard, this change
drastically simplifies it, both for 386 and for amd64, and
makes the Plan 9 code in liblink common for both 386 and
amd64.
The amd64 runtime code was cleared of nxm assumptions, and
now runs on the standard Plan 9 kernel.
Note handling fixes will follow in a separate CL.
LGTM=rsc
R=golang-codereviews, rsc, bradfitz, dave
CC=0intro, ality, golang-codereviews, jas, minux.ma, mischief
https://golang.org/cl/101510049
2014-07-02 05:04:10 -06:00
|
|
|
#define PAGESIZE 0x1000
|
2013-01-30 03:53:56 -07:00
|
|
|
|
|
|
|
typedef struct Ureg Ureg;
|
|
|
|
|
|
|
|
struct Ureg {
|
|
|
|
uint64 ax;
|
|
|
|
uint64 bx;
|
|
|
|
uint64 cx;
|
|
|
|
uint64 dx;
|
|
|
|
uint64 si;
|
|
|
|
uint64 di;
|
|
|
|
uint64 bp;
|
|
|
|
uint64 r8;
|
|
|
|
uint64 r9;
|
|
|
|
uint64 r10;
|
|
|
|
uint64 r11;
|
|
|
|
uint64 r12;
|
|
|
|
uint64 r13;
|
|
|
|
uint64 r14;
|
|
|
|
uint64 r15;
|
|
|
|
|
|
|
|
uint16 ds;
|
|
|
|
uint16 es;
|
|
|
|
uint16 fs;
|
|
|
|
uint16 gs;
|
|
|
|
|
|
|
|
uint64 type;
|
|
|
|
uint64 error; /* error code (or zero) */
|
|
|
|
uint64 ip; /* pc */
|
|
|
|
uint64 cs; /* old context */
|
|
|
|
uint64 flags; /* old flags */
|
|
|
|
uint64 sp; /* sp */
|
|
|
|
uint64 ss; /* old stack segment */
|
|
|
|
};
|