Commit 22a5c78f authored by Russ Cox's avatar Russ Cox

rename sys functions to runtime,

because they are in package runtime.

another step to enforcing package boundaries.

R=r
DELTA=732  (114 added, 93 deleted, 525 changed)
OCL=35811
CL=35824
parent 488ca3c7
...@@ -128,7 +128,7 @@ noops(void) ...@@ -128,7 +128,7 @@ noops(void)
Bflush(&bso); Bflush(&bso);
pmorestack = P; pmorestack = P;
symmorestack = lookup("sys·morestackx", 0); symmorestack = lookup("runtime·morestackx", 0);
if(symmorestack->type == STEXT) if(symmorestack->type == STEXT)
for(p = firstp; p != P; p = p->link) { for(p = firstp; p != P; p = p->link) {
...@@ -142,7 +142,7 @@ noops(void) ...@@ -142,7 +142,7 @@ noops(void)
} }
// TODO(kaib): make lack of morestack an error // TODO(kaib): make lack of morestack an error
// if(pmorestack == P) // if(pmorestack == P)
// diag("sys·morestack not defined"); // diag("runtime·morestack not defined");
curframe = 0; curframe = 0;
curbecome = 0; curbecome = 0;
...@@ -360,7 +360,7 @@ noops(void) ...@@ -360,7 +360,7 @@ noops(void)
// CMP R1, $-autosize(SP) // CMP R1, $-autosize(SP)
// MOVW.LT $args, R2 // MOVW.LT $args, R2
// MOVW.W.LT R14, R3 // MOVW.W.LT R14, R3
// BL.LT sys·morestackx(SB) // modifies LR // BL.LT runtime·morestackx(SB) // modifies LR
// MOVW.W R14,$-autosize(SP) // MOVW.W R14,$-autosize(SP)
// TODO(kaib): add more trampolines // TODO(kaib): add more trampolines
...@@ -401,7 +401,7 @@ noops(void) ...@@ -401,7 +401,7 @@ noops(void)
p->to.type = D_REG; p->to.type = D_REG;
p->to.reg = 3; p->to.reg = 3;
// BL.LT sys·morestackx(SB) // modifies LR // BL.LT runtime·morestackx(SB) // modifies LR
p = appendp(p); p = appendp(p);
p->as = ABL; p->as = ABL;
p->scond = C_SCOND_LT; p->scond = C_SCOND_LT;
......
...@@ -513,17 +513,17 @@ brloop(Prog *p) ...@@ -513,17 +513,17 @@ brloop(Prog *p)
static char* static char*
morename[] = morename[] =
{ {
"sys·morestack00", "runtime·morestack00",
"sys·morestack10", "runtime·morestack10",
"sys·morestack01", "runtime·morestack01",
"sys·morestack11", "runtime·morestack11",
"sys·morestack8", "runtime·morestack8",
"sys·morestack16", "runtime·morestack16",
"sys·morestack24", "runtime·morestack24",
"sys·morestack32", "runtime·morestack32",
"sys·morestack40", "runtime·morestack40",
"sys·morestack48", "runtime·morestack48",
}; };
Prog* pmorestack[nelem(morename)]; Prog* pmorestack[nelem(morename)];
Sym* symmorestack[nelem(morename)]; Sym* symmorestack[nelem(morename)];
......
...@@ -477,7 +477,7 @@ dostkoff(void) ...@@ -477,7 +477,7 @@ dostkoff(void)
Sym *symmorestack; Sym *symmorestack;
pmorestack = P; pmorestack = P;
symmorestack = lookup("sys·morestack", 0); symmorestack = lookup("runtime·morestack", 0);
if(symmorestack->type == STEXT) if(symmorestack->type == STEXT)
for(p = firstp; p != P; p = p->link) { for(p = firstp; p != P; p = p->link) {
...@@ -490,7 +490,7 @@ dostkoff(void) ...@@ -490,7 +490,7 @@ dostkoff(void)
} }
} }
if(pmorestack == P) if(pmorestack == P)
diag("sys·morestack not defined"); diag("runtime·morestack not defined");
curframe = 0; curframe = 0;
curbecome = 0; curbecome = 0;
......
...@@ -54,7 +54,7 @@ y.tab.h: $(YFILES) ...@@ -54,7 +54,7 @@ y.tab.h: $(YFILES)
y.tab.c: y.tab.h y.tab.c: y.tab.h
test -f y.tab.c && touch y.tab.c test -f y.tab.c && touch y.tab.c
builtin.c: sys.go unsafe.go mkbuiltin1.c mkbuiltin builtin.c: runtime.go unsafe.go mkbuiltin1.c mkbuiltin
./mkbuiltin >builtin.c || \ ./mkbuiltin >builtin.c || \
(echo 'mkbuiltin failed; using bootstrap copy of builtin.c'; cp builtin.c.boot builtin.c) (echo 'mkbuiltin failed; using bootstrap copy of builtin.c'; cp builtin.c.boot builtin.c)
......
char *sysimport = char *runtimeimport =
"package sys\n" "package runtime\n"
"func sys.mal (? int32) (? *any)\n" "func runtime.mal (? int32) (? *any)\n"
"func sys.throwindex ()\n" "func runtime.throwindex ()\n"
"func sys.throwreturn ()\n" "func runtime.throwreturn ()\n"
"func sys.throwinit ()\n" "func runtime.throwinit ()\n"
"func sys.panicl ()\n" "func runtime.panicl ()\n"
"func sys.printbool (? bool)\n" "func runtime.printbool (? bool)\n"
"func sys.printfloat (? float64)\n" "func runtime.printfloat (? float64)\n"
"func sys.printint (? int64)\n" "func runtime.printint (? int64)\n"
"func sys.printuint (? uint64)\n" "func runtime.printuint (? uint64)\n"
"func sys.printstring (? string)\n" "func runtime.printstring (? string)\n"
"func sys.printpointer (? any)\n" "func runtime.printpointer (? any)\n"
"func sys.printiface (? any)\n" "func runtime.printiface (? any)\n"
"func sys.printeface (? any)\n" "func runtime.printeface (? any)\n"
"func sys.printslice (? any)\n" "func runtime.printslice (? any)\n"
"func sys.printnl ()\n" "func runtime.printnl ()\n"
"func sys.printsp ()\n" "func runtime.printsp ()\n"
"func sys.catstring (? string, ? string) (? string)\n" "func runtime.catstring (? string, ? string) (? string)\n"
"func sys.cmpstring (? string, ? string) (? int)\n" "func runtime.cmpstring (? string, ? string) (? int)\n"
"func sys.slicestring (? string, ? int, ? int) (? string)\n" "func runtime.slicestring (? string, ? int, ? int) (? string)\n"
"func sys.indexstring (? string, ? int) (? uint8)\n" "func runtime.indexstring (? string, ? int) (? uint8)\n"
"func sys.intstring (? int64) (? string)\n" "func runtime.intstring (? int64) (? string)\n"
"func sys.slicebytetostring (? []uint8) (? string)\n" "func runtime.slicebytetostring (? []uint8) (? string)\n"
"func sys.sliceinttostring (? []int) (? string)\n" "func runtime.sliceinttostring (? []int) (? string)\n"
"func sys.stringiter (? string, ? int) (? int)\n" "func runtime.stringiter (? string, ? int) (? int)\n"
"func sys.stringiter2 (? string, ? int) (retk int, retv int)\n" "func runtime.stringiter2 (? string, ? int) (retk int, retv int)\n"
"func sys.ifaceI2E (iface any) (ret any)\n" "func runtime.ifaceI2E (iface any) (ret any)\n"
"func sys.ifaceE2I (typ *uint8, iface any) (ret any)\n" "func runtime.ifaceE2I (typ *uint8, iface any) (ret any)\n"
"func sys.ifaceT2E (typ *uint8, elem any) (ret any)\n" "func runtime.ifaceT2E (typ *uint8, elem any) (ret any)\n"
"func sys.ifaceE2T (typ *uint8, elem any) (ret any)\n" "func runtime.ifaceE2T (typ *uint8, elem any) (ret any)\n"
"func sys.ifaceE2I2 (typ *uint8, iface any) (ret any, ok bool)\n" "func runtime.ifaceE2I2 (typ *uint8, iface any) (ret any, ok bool)\n"
"func sys.ifaceE2T2 (typ *uint8, elem any) (ret any, ok bool)\n" "func runtime.ifaceE2T2 (typ *uint8, elem any) (ret any, ok bool)\n"
"func sys.ifaceT2I (typ1 *uint8, typ2 *uint8, elem any) (ret any)\n" "func runtime.ifaceT2I (typ1 *uint8, typ2 *uint8, elem any) (ret any)\n"
"func sys.ifaceI2T (typ *uint8, iface any) (ret any)\n" "func runtime.ifaceI2T (typ *uint8, iface any) (ret any)\n"
"func sys.ifaceI2T2 (typ *uint8, iface any) (ret any, ok bool)\n" "func runtime.ifaceI2T2 (typ *uint8, iface any) (ret any, ok bool)\n"
"func sys.ifaceI2I (typ *uint8, iface any) (ret any)\n" "func runtime.ifaceI2I (typ *uint8, iface any) (ret any)\n"
"func sys.ifaceI2Ix (typ *uint8, iface any) (ret any)\n" "func runtime.ifaceI2Ix (typ *uint8, iface any) (ret any)\n"
"func sys.ifaceI2I2 (typ *uint8, iface any) (ret any, ok bool)\n" "func runtime.ifaceI2I2 (typ *uint8, iface any) (ret any, ok bool)\n"
"func sys.ifaceeq (i1 any, i2 any) (ret bool)\n" "func runtime.ifaceeq (i1 any, i2 any) (ret bool)\n"
"func sys.efaceeq (i1 any, i2 any) (ret bool)\n" "func runtime.efaceeq (i1 any, i2 any) (ret bool)\n"
"func sys.ifacethash (i1 any) (ret uint32)\n" "func runtime.ifacethash (i1 any) (ret uint32)\n"
"func sys.efacethash (i1 any) (ret uint32)\n" "func runtime.efacethash (i1 any) (ret uint32)\n"
"func sys.makemap (key *uint8, val *uint8, hint int) (hmap map[any] any)\n" "func runtime.makemap (key *uint8, val *uint8, hint int) (hmap map[any] any)\n"
"func sys.mapaccess1 (hmap map[any] any, key any) (val any)\n" "func runtime.mapaccess1 (hmap map[any] any, key any) (val any)\n"
"func sys.mapaccess2 (hmap map[any] any, key any) (val any, pres bool)\n" "func runtime.mapaccess2 (hmap map[any] any, key any) (val any, pres bool)\n"
"func sys.mapassign1 (hmap map[any] any, key any, val any)\n" "func runtime.mapassign1 (hmap map[any] any, key any, val any)\n"
"func sys.mapassign2 (hmap map[any] any, key any, val any, pres bool)\n" "func runtime.mapassign2 (hmap map[any] any, key any, val any, pres bool)\n"
"func sys.mapiterinit (hmap map[any] any, hiter *any)\n" "func runtime.mapiterinit (hmap map[any] any, hiter *any)\n"
"func sys.mapiternext (hiter *any)\n" "func runtime.mapiternext (hiter *any)\n"
"func sys.mapiter1 (hiter *any) (key any)\n" "func runtime.mapiter1 (hiter *any) (key any)\n"
"func sys.mapiter2 (hiter *any) (key any, val any)\n" "func runtime.mapiter2 (hiter *any) (key any, val any)\n"
"func sys.makechan (elem *uint8, hint int) (hchan chan any)\n" "func runtime.makechan (elem *uint8, hint int) (hchan chan any)\n"
"func sys.chanrecv1 (hchan <-chan any) (elem any)\n" "func runtime.chanrecv1 (hchan <-chan any) (elem any)\n"
"func sys.chanrecv2 (hchan <-chan any) (elem any, pres bool)\n" "func runtime.chanrecv2 (hchan <-chan any) (elem any, pres bool)\n"
"func sys.chansend1 (hchan chan<- any, elem any)\n" "func runtime.chansend1 (hchan chan<- any, elem any)\n"
"func sys.chansend2 (hchan chan<- any, elem any) (pres bool)\n" "func runtime.chansend2 (hchan chan<- any, elem any) (pres bool)\n"
"func sys.closechan (hchan any)\n" "func runtime.closechan (hchan any)\n"
"func sys.closedchan (hchan any) (? bool)\n" "func runtime.closedchan (hchan any) (? bool)\n"
"func sys.newselect (size int) (sel *uint8)\n" "func runtime.newselect (size int) (sel *uint8)\n"
"func sys.selectsend (sel *uint8, hchan chan<- any, elem any) (selected bool)\n" "func runtime.selectsend (sel *uint8, hchan chan<- any, elem any) (selected bool)\n"
"func sys.selectrecv (sel *uint8, hchan <-chan any, elem *any) (selected bool)\n" "func runtime.selectrecv (sel *uint8, hchan <-chan any, elem *any) (selected bool)\n"
"func sys.selectdefault (sel *uint8) (selected bool)\n" "func runtime.selectdefault (sel *uint8) (selected bool)\n"
"func sys.selectgo (sel *uint8)\n" "func runtime.selectgo (sel *uint8)\n"
"func sys.makeslice (nel int, cap int, width int) (ary []any)\n" "func runtime.makeslice (nel int, cap int, width int) (ary []any)\n"
"func sys.sliceslice (old []any, lb int, hb int, width int) (ary []any)\n" "func runtime.sliceslice (old []any, lb int, hb int, width int) (ary []any)\n"
"func sys.slicearray (old *any, nel int, lb int, hb int, width int) (ary []any)\n" "func runtime.slicearray (old *any, nel int, lb int, hb int, width int) (ary []any)\n"
"func sys.arraytoslice (old *any, nel int) (ary []any)\n" "func runtime.arraytoslice (old *any, nel int) (ary []any)\n"
"func sys.closure ()\n" "func runtime.closure ()\n"
"func sys.int64div (? int64, ? int64) (? int64)\n" "func runtime.int64div (? int64, ? int64) (? int64)\n"
"func sys.uint64div (? uint64, ? uint64) (? uint64)\n" "func runtime.uint64div (? uint64, ? uint64) (? uint64)\n"
"func sys.int64mod (? int64, ? int64) (? int64)\n" "func runtime.int64mod (? int64, ? int64) (? int64)\n"
"func sys.uint64mod (? uint64, ? uint64) (? uint64)\n" "func runtime.uint64mod (? uint64, ? uint64) (? uint64)\n"
"func sys.float64toint64 (? float64) (? int64)\n" "func runtime.float64toint64 (? float64) (? int64)\n"
"func sys.int64tofloat64 (? int64) (? float64)\n" "func runtime.int64tofloat64 (? int64) (? float64)\n"
"\n" "\n"
"$$\n"; "$$\n";
char *unsafeimport = char *unsafeimport =
......
...@@ -14,7 +14,7 @@ dflag(void) ...@@ -14,7 +14,7 @@ dflag(void)
return 0; return 0;
if(debug['y']) if(debug['y'])
return 1; return 1;
if(inimportsys) if(incannedimport)
return 0; return 0;
return 1; return 1;
} }
......
...@@ -294,10 +294,10 @@ pkgtype(Sym *s) ...@@ -294,10 +294,10 @@ pkgtype(Sym *s)
static int static int
mypackage(Sym *s) mypackage(Sym *s)
{ {
// we import all definitions for sys. // we import all definitions for runtime.
// lowercase ones can only be used by the compiler. // lowercase ones can only be used by the compiler.
return strcmp(s->package, package) == 0 return strcmp(s->package, package) == 0
|| strcmp(s->package, "sys") == 0; || strcmp(s->package, "runtime") == 0;
} }
void void
......
...@@ -14,7 +14,7 @@ sysfunc(char *name) ...@@ -14,7 +14,7 @@ sysfunc(char *name)
{ {
Node *n; Node *n;
n = newname(pkglookup(name, "sys")); n = newname(pkglookup(name, "runtime"));
n->class = PFUNC; n->class = PFUNC;
return n; return n;
} }
......
...@@ -627,7 +627,7 @@ EXTERN Sym* hash[NHASH]; ...@@ -627,7 +627,7 @@ EXTERN Sym* hash[NHASH];
EXTERN Sym* pkgmyname; // my name for package EXTERN Sym* pkgmyname; // my name for package
EXTERN Sym* pkgimportname; // package name from imported package EXTERN Sym* pkgimportname; // package name from imported package
EXTERN int tptr; // either TPTR32 or TPTR64 EXTERN int tptr; // either TPTR32 or TPTR64
extern char* sysimport; extern char* runtimeimport;
extern char* unsafeimport; extern char* unsafeimport;
EXTERN Idir* idirs; EXTERN Idir* idirs;
...@@ -665,7 +665,7 @@ EXTERN NodeList* closures; ...@@ -665,7 +665,7 @@ EXTERN NodeList* closures;
EXTERN NodeList* exportlist; EXTERN NodeList* exportlist;
EXTERN NodeList* typelist; EXTERN NodeList* typelist;
EXTERN int dclcontext; // PEXTERN/PAUTO EXTERN int dclcontext; // PEXTERN/PAUTO
EXTERN int inimportsys; EXTERN int incannedimport;
EXTERN int statuniqgen; // name generator for static temps EXTERN int statuniqgen; // name generator for static temps
EXTERN int loophack; EXTERN int loophack;
......
...@@ -139,13 +139,13 @@ package: ...@@ -139,13 +139,13 @@ package:
} }
/* /*
* this loads the definitions for the sys functions, * this loads the definitions for the low-level runtime functions,
* so that the compiler can generate calls to them, * so that the compiler can generate calls to them,
* but does not make the name "sys" visible as a package. * but does not make the name "runtime" visible as a package.
*/ */
loadsys: loadsys:
{ {
cannedimports("sys.6", sysimport); cannedimports("runtime.builtin", runtimeimport);
} }
import_package import_package
import_there import_there
...@@ -245,7 +245,7 @@ import_package: ...@@ -245,7 +245,7 @@ import_package:
// statements have to go away in programs building // statements have to go away in programs building
// against the release. Once the programs have converted // against the release. Once the programs have converted
// it should probably just go away. // it should probably just go away.
if(strcmp($2->name, package) == 0) if(strcmp($2->name, package) == 0 && strcmp(package, "runtime") != 0)
yyerror("package cannot import itself (anymore)"); yyerror("package cannot import itself (anymore)");
} }
......
...@@ -339,7 +339,7 @@ unimportfile(void) ...@@ -339,7 +339,7 @@ unimportfile(void)
curio = pushedio; curio = pushedio;
pushedio.bin = nil; pushedio.bin = nil;
inimportsys = 0; incannedimport = 0;
typecheckok = 0; typecheckok = 0;
} }
...@@ -357,7 +357,7 @@ cannedimports(char *file, char *cp) ...@@ -357,7 +357,7 @@ cannedimports(char *file, char *cp)
pkgmyname = S; pkgmyname = S;
typecheckok = 1; typecheckok = 1;
inimportsys = 1; incannedimport = 1;
} }
int int
......
...@@ -13,7 +13,7 @@ fi ...@@ -13,7 +13,7 @@ fi
gcc -o mkbuiltin1 mkbuiltin1.c gcc -o mkbuiltin1 mkbuiltin1.c
rm -f _builtin.c rm -f _builtin.c
for i in sys unsafe for i in runtime unsafe
do do
$GC -A $i.go $GC -A $i.go
O=$O ./mkbuiltin1 $i >>_builtin.c O=$O ./mkbuiltin1 $i >>_builtin.c
......
...@@ -311,6 +311,7 @@ pkglookup(char *name, char *pkg) ...@@ -311,6 +311,7 @@ pkglookup(char *name, char *pkg)
s->link = hash[h]; s->link = hash[h];
hash[h] = s; hash[h] = s;
s->lexical = LNAME;
return s; return s;
} }
...@@ -1543,13 +1544,13 @@ isselect(Node *n) ...@@ -1543,13 +1544,13 @@ isselect(Node *n)
if(n == N) if(n == N)
return 0; return 0;
n = n->left; n = n->left;
s = pkglookup("selectsend", "sys"); s = pkglookup("selectsend", "runtime");
if(s == n->sym) if(s == n->sym)
return 1; return 1;
s = pkglookup("selectrecv", "sys"); s = pkglookup("selectrecv", "runtime");
if(s == n->sym) if(s == n->sym)
return 1; return 1;
s = pkglookup("selectdefault", "sys"); s = pkglookup("selectdefault", "runtime");
if(s == n->sym) if(s == n->sym)
return 1; return 1;
return 0; return 0;
...@@ -1960,9 +1961,9 @@ syslook(char *name, int copy) ...@@ -1960,9 +1961,9 @@ syslook(char *name, int copy)
Sym *s; Sym *s;
Node *n; Node *n;
s = pkglookup(name, "sys"); s = pkglookup(name, "runtime");
if(s == S || s->def == N) if(s == S || s->def == N)
fatal("looksys: cant find sys.%s", name); fatal("looksys: cant find runtime.%s", name);
if(!copy) if(!copy)
return s->def; return s->def;
......
...@@ -455,20 +455,20 @@ sweeplist(Prog **first, Prog **last) ...@@ -455,20 +455,20 @@ sweeplist(Prog **first, Prog **last)
static char* static char*
morename[] = morename[] =
{ {
"sys·morestack", "runtime·morestack",
"sys·morestackx", "runtime·morestackx",
"sys·morestack00", "runtime·morestack00",
"sys·morestack10", "runtime·morestack10",
"sys·morestack01", "runtime·morestack01",
"sys·morestack11", "runtime·morestack11",
"sys·morestack8", "runtime·morestack8",
"sys·morestack16", "runtime·morestack16",
"sys·morestack24", "runtime·morestack24",
"sys·morestack32", "runtime·morestack32",
"sys·morestack40", "runtime·morestack40",
"sys·morestack48", "runtime·morestack48",
}; };
void void
......
...@@ -64,7 +64,7 @@ ok: ...@@ -64,7 +64,7 @@ ok:
// create a new goroutine to start program // create a new goroutine to start program
PUSHL $mainstart(SB) // entry PUSHL $mainstart(SB) // entry
PUSHL $0 // arg size PUSHL $0 // arg size
CALL sys·newproc(SB) CALL runtime·newproc(SB)
POPL AX POPL AX
POPL AX POPL AX
...@@ -137,7 +137,7 @@ TEXT gogocall(SB), 7, $0 ...@@ -137,7 +137,7 @@ TEXT gogocall(SB), 7, $0
*/ */
// Called during function prolog when more stack is needed. // Called during function prolog when more stack is needed.
TEXT sys·morestack(SB),7,$0 TEXT runtime·morestack(SB),7,$0
// Cannot grow scheduler stack (m->g0). // Cannot grow scheduler stack (m->g0).
MOVL m, BX MOVL m, BX
MOVL m_g0(BX), SI MOVL m_g0(BX), SI
...@@ -215,7 +215,7 @@ TEXT reflect·call(SB), 7, $0 ...@@ -215,7 +215,7 @@ TEXT reflect·call(SB), 7, $0
// Return point when leaving stack. // Return point when leaving stack.
TEXT sys·lessstack(SB), 7, $0 TEXT runtime·lessstack(SB), 7, $0
// Save return value in m->cret // Save return value in m->cret
MOVL m, BX MOVL m, BX
MOVL AX, m_cret(BX) MOVL AX, m_cret(BX)
...@@ -260,7 +260,7 @@ TEXT jmpdefer(SB), 7, $0 ...@@ -260,7 +260,7 @@ TEXT jmpdefer(SB), 7, $0
SUBL $5, (SP) // return to CALL again SUBL $5, (SP) // return to CALL again
JMP AX // but first run the deferred function JMP AX // but first run the deferred function
TEXT sys·memclr(SB),7,$0 TEXT runtime·memclr(SB),7,$0
MOVL 4(SP), DI // arg 1 addr MOVL 4(SP), DI // arg 1 addr
MOVL 8(SP), CX // arg 2 count MOVL 8(SP), CX // arg 2 count
ADDL $3, CX ADDL $3, CX
...@@ -271,12 +271,12 @@ TEXT sys·memclr(SB),7,$0 ...@@ -271,12 +271,12 @@ TEXT sys·memclr(SB),7,$0
STOSL STOSL
RET RET
TEXT sys·getcallerpc+0(SB),7,$0 TEXT runtime·getcallerpc+0(SB),7,$0
MOVL x+0(FP),AX // addr of first arg MOVL x+0(FP),AX // addr of first arg
MOVL -4(AX),AX // get calling pc MOVL -4(AX),AX // get calling pc
RET RET
TEXT sys·setcallerpc+0(SB),7,$0 TEXT runtime·setcallerpc+0(SB),7,$0
MOVL x+0(FP),AX // addr of first arg MOVL x+0(FP),AX // addr of first arg
MOVL x+4(FP), BX MOVL x+4(FP), BX
MOVL BX, -4(AX) // set calling pc MOVL BX, -4(AX) // set calling pc
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// fn func(arg0, arg1, arg2 *ptr, callerpc uintptr, xxx) yyy, // fn func(arg0, arg1, arg2 *ptr, callerpc uintptr, xxx) yyy,
// arg0, arg1, arg2 *ptr) (func(xxx) yyy) // arg0, arg1, arg2 *ptr) (func(xxx) yyy)
void void
sys·closure(int32 siz, byte *fn, byte *arg0) runtime·closure(int32 siz, byte *fn, byte *arg0)
{ {
byte *p, *q, **ret; byte *p, *q, **ret;
int32 i, n; int32 i, n;
......
...@@ -27,7 +27,7 @@ traceback(byte *pc0, byte *sp, G *g) ...@@ -27,7 +27,7 @@ traceback(byte *pc0, byte *sp, G *g)
stk = (Stktop*)g->stackbase; stk = (Stktop*)g->stackbase;
for(n=0; n<100; n++) { for(n=0; n<100; n++) {
if(pc == (uint64)sys·lessstack) { if(pc == (uint64)runtime·lessstack) {
// printf("--\n"); // printf("--\n");
// pop to earlier stack block // pop to earlier stack block
pc = (uintptr)stk->gobuf.pc; pc = (uintptr)stk->gobuf.pc;
...@@ -68,7 +68,7 @@ traceback(byte *pc0, byte *sp, G *g) ...@@ -68,7 +68,7 @@ traceback(byte *pc0, byte *sp, G *g)
for(i = 0; i < f->args; i++) { for(i = 0; i < f->args; i++) {
if(i != 0) if(i != 0)
prints(", "); prints(", ");
sys·printhex(((uint32*)sp)[i]); runtime·printhex(((uint32*)sp)[i]);
if(i >= 4) { if(i >= 4) {
prints(", ..."); prints(", ...");
break; break;
...@@ -112,7 +112,7 @@ runtime·Caller(int32 n, uintptr retpc, String retfile, int32 retline, bool retb ...@@ -112,7 +112,7 @@ runtime·Caller(int32 n, uintptr retpc, String retfile, int32 retline, bool retb
// now unwind n levels // now unwind n levels
stk = (Stktop*)g->stackbase; stk = (Stktop*)g->stackbase;
while(n-- > 0) { while(n-- > 0) {
while(pc == (uintptr)sys·lessstack) { while(pc == (uintptr)runtime·lessstack) {
pc = (uintptr)stk->gobuf.pc; pc = (uintptr)stk->gobuf.pc;
sp = stk->gobuf.sp; sp = stk->gobuf.sp;
stk = (Stktop*)stk->stackbase; stk = (Stktop*)stk->stackbase;
......
...@@ -270,7 +270,7 @@ _divvu(Vlong *q, Vlong n, Vlong d) ...@@ -270,7 +270,7 @@ _divvu(Vlong *q, Vlong n, Vlong d)
} }
void void
sys·uint64div(Vlong n, Vlong d, Vlong q) runtime·uint64div(Vlong n, Vlong d, Vlong q)
{ {
_divvu(&q, n, d); _divvu(&q, n, d);
} }
...@@ -288,7 +288,7 @@ _modvu(Vlong *r, Vlong n, Vlong d) ...@@ -288,7 +288,7 @@ _modvu(Vlong *r, Vlong n, Vlong d)
} }
void void
sys·uint64mod(Vlong n, Vlong d, Vlong q) runtime·uint64mod(Vlong n, Vlong d, Vlong q)
{ {
_modvu(&q, n, d); _modvu(&q, n, d);
} }
...@@ -334,7 +334,7 @@ _divv(Vlong *q, Vlong n, Vlong d) ...@@ -334,7 +334,7 @@ _divv(Vlong *q, Vlong n, Vlong d)
} }
void void
sys·int64div(Vlong n, Vlong d, Vlong q) runtime·int64div(Vlong n, Vlong d, Vlong q)
{ {
_divv(&q, n, d); _divv(&q, n, d);
} }
...@@ -368,7 +368,7 @@ _modv(Vlong *r, Vlong n, Vlong d) ...@@ -368,7 +368,7 @@ _modv(Vlong *r, Vlong n, Vlong d)
} }
void void
sys·int64mod(Vlong n, Vlong d, Vlong q) runtime·int64mod(Vlong n, Vlong d, Vlong q)
{ {
_modv(&q, n, d); _modv(&q, n, d);
} }
......
...@@ -38,7 +38,7 @@ TEXT _rt0_amd64(SB),7,$-8 ...@@ -38,7 +38,7 @@ TEXT _rt0_amd64(SB),7,$-8
// create a new goroutine to start program // create a new goroutine to start program
PUSHQ $mainstart(SB) // entry PUSHQ $mainstart(SB) // entry
PUSHQ $0 // arg size PUSHQ $0 // arg size
CALL sys·newproc(SB) CALL runtime·newproc(SB)
POPQ AX POPQ AX
POPQ AX POPQ AX
...@@ -108,7 +108,7 @@ TEXT gogocall(SB), 7, $0 ...@@ -108,7 +108,7 @@ TEXT gogocall(SB), 7, $0
*/ */
// Called during function prolog when more stack is needed. // Called during function prolog when more stack is needed.
TEXT sys·morestack(SB),7,$0 TEXT runtime·morestack(SB),7,$0
// Called from f. // Called from f.
// Set m->morebuf to f's caller. // Set m->morebuf to f's caller.
MOVQ 8(SP), AX // f's caller's PC MOVQ 8(SP), AX // f's caller's PC
...@@ -166,7 +166,7 @@ TEXT reflect·call(SB), 7, $0 ...@@ -166,7 +166,7 @@ TEXT reflect·call(SB), 7, $0
RET RET
// Return point when leaving stack. // Return point when leaving stack.
TEXT sys·lessstack(SB), 7, $0 TEXT runtime·lessstack(SB), 7, $0
// Save return value in m->cret // Save return value in m->cret
MOVQ AX, m_cret(m) MOVQ AX, m_cret(m)
...@@ -178,66 +178,66 @@ TEXT sys·lessstack(SB), 7, $0 ...@@ -178,66 +178,66 @@ TEXT sys·lessstack(SB), 7, $0
RET RET
// morestack trampolines // morestack trampolines
TEXT sys·morestack00+0(SB),7,$0 TEXT runtime·morestack00+0(SB),7,$0
MOVQ $0, AX MOVQ $0, AX
MOVQ AX, m_moreframe(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $runtime·morestack+0(SB), AX
JMP AX JMP AX
TEXT sys·morestack01+0(SB),7,$0 TEXT runtime·morestack01+0(SB),7,$0
SHLQ $32, AX SHLQ $32, AX
MOVQ AX, m_moreframe(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $runtime·morestack+0(SB), AX
JMP AX JMP AX
TEXT sys·morestack10+0(SB),7,$0 TEXT runtime·morestack10+0(SB),7,$0
MOVLQZX AX, AX MOVLQZX AX, AX
MOVQ AX, m_moreframe(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $runtime·morestack+0(SB), AX
JMP AX JMP AX
TEXT sys·morestack11+0(SB),7,$0 TEXT runtime·morestack11+0(SB),7,$0
MOVQ AX, m_moreframe(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $runtime·morestack+0(SB), AX
JMP AX JMP AX
// subcases of morestack01 // subcases of morestack01
// with const of 8,16,...48 // with const of 8,16,...48
TEXT sys·morestack8(SB),7,$0 TEXT runtime·morestack8(SB),7,$0
PUSHQ $1 PUSHQ $1
MOVQ $sys·morestackx(SB), AX MOVQ $runtime·morestackx(SB), AX
JMP AX JMP AX
TEXT sys·morestack16(SB),7,$0 TEXT runtime·morestack16(SB),7,$0
PUSHQ $2 PUSHQ $2
MOVQ $sys·morestackx(SB), AX MOVQ $runtime·morestackx(SB), AX
JMP AX JMP AX
TEXT sys·morestack24(SB),7,$0 TEXT runtime·morestack24(SB),7,$0
PUSHQ $3 PUSHQ $3
MOVQ $sys·morestackx(SB), AX MOVQ $runtime·morestackx(SB), AX
JMP AX JMP AX
TEXT sys·morestack32(SB),7,$0 TEXT runtime·morestack32(SB),7,$0
PUSHQ $4 PUSHQ $4
MOVQ $sys·morestackx(SB), AX MOVQ $runtime·morestackx(SB), AX
JMP AX JMP AX
TEXT sys·morestack40(SB),7,$0 TEXT runtime·morestack40(SB),7,$0
PUSHQ $5 PUSHQ $5
MOVQ $sys·morestackx(SB), AX MOVQ $runtime·morestackx(SB), AX
JMP AX JMP AX
TEXT sys·morestack48(SB),7,$0 TEXT runtime·morestack48(SB),7,$0
PUSHQ $6 PUSHQ $6
MOVQ $sys·morestackx(SB), AX MOVQ $runtime·morestackx(SB), AX
JMP AX JMP AX
TEXT sys·morestackx(SB),7,$0 TEXT runtime·morestackx(SB),7,$0
POPQ AX POPQ AX
SHLQ $35, AX SHLQ $35, AX
MOVQ AX, m_moreframe(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack(SB), AX MOVQ $runtime·morestack(SB), AX
JMP AX JMP AX
// bool cas(int32 *val, int32 old, int32 new) // bool cas(int32 *val, int32 old, int32 new)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// fn func(arg0, arg1, arg2 *ptr, callerpc uintptr, xxx) yyy, // fn func(arg0, arg1, arg2 *ptr, callerpc uintptr, xxx) yyy,
// arg0, arg1, arg2 *ptr) (func(xxx) yyy) // arg0, arg1, arg2 *ptr) (func(xxx) yyy)
void void
sys·closure(int32 siz, byte *fn, byte *arg0) runtime·closure(int32 siz, byte *fn, byte *arg0)
{ {
byte *p, *q, **ret; byte *p, *q, **ret;
int32 i, n; int32 i, n;
......
...@@ -24,7 +24,7 @@ traceback(byte *pc0, byte *sp, G *g) ...@@ -24,7 +24,7 @@ traceback(byte *pc0, byte *sp, G *g)
stk = (Stktop*)g->stackbase; stk = (Stktop*)g->stackbase;
for(n=0; n<100; n++) { for(n=0; n<100; n++) {
if(pc == (uint64)sys·lessstack) { if(pc == (uint64)runtime·lessstack) {
// pop to earlier stack block // pop to earlier stack block
// printf("-- stack jump %p => %p\n", sp, stk->gobuf.sp); // printf("-- stack jump %p => %p\n", sp, stk->gobuf.sp);
pc = (uintptr)stk->gobuf.pc; pc = (uintptr)stk->gobuf.pc;
...@@ -65,7 +65,7 @@ traceback(byte *pc0, byte *sp, G *g) ...@@ -65,7 +65,7 @@ traceback(byte *pc0, byte *sp, G *g)
for(i = 0; i < f->args; i++) { for(i = 0; i < f->args; i++) {
if(i != 0) if(i != 0)
prints(", "); prints(", ");
sys·printhex(((uint32*)sp)[i]); runtime·printhex(((uint32*)sp)[i]);
if(i >= 4) { if(i >= 4) {
prints(", ..."); prints(", ...");
break; break;
...@@ -109,7 +109,7 @@ runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbo ...@@ -109,7 +109,7 @@ runtime·Caller(int32 n, uint64 retpc, String retfile, int32 retline, bool retbo
// now unwind n levels // now unwind n levels
stk = (Stktop*)g->stackbase; stk = (Stktop*)g->stackbase;
while(n-- > 0) { while(n-- > 0) {
while(pc == (uintptr)sys·lessstack) { while(pc == (uintptr)runtime·lessstack) {
pc = (uintptr)stk->gobuf.pc; pc = (uintptr)stk->gobuf.pc;
sp = stk->gobuf.sp; sp = stk->gobuf.sp;
stk = (Stktop*)stk->stackbase; stk = (Stktop*)stk->stackbase;
......
...@@ -49,7 +49,7 @@ TEXT _rt0_arm(SB),7,$-4 ...@@ -49,7 +49,7 @@ TEXT _rt0_arm(SB),7,$-4
MOVW.W R0, -4(R13) MOVW.W R0, -4(R13)
MOVW $0, R0 MOVW $0, R0
MOVW.W R0, -4(R13) // push $0 as guard MOVW.W R0, -4(R13) // push $0 as guard
BL sys·newproc(SB) BL runtime·newproc(SB)
MOVW $12(R13), R13 // pop args and LR MOVW $12(R13), R13 // pop args and LR
// start this M // start this M
...@@ -132,7 +132,7 @@ TEXT gogocall(SB), 7, $-4 ...@@ -132,7 +132,7 @@ TEXT gogocall(SB), 7, $-4
// R2 arg size // R2 arg size
// R3 prolog's LR // R3 prolog's LR
// using frame size $-4 means do not save LR on stack. // using frame size $-4 means do not save LR on stack.
TEXT sys·morestack(SB),7,$-4 TEXT runtime·morestack(SB),7,$-4
// Cannot grow scheduler stack (m->g0). // Cannot grow scheduler stack (m->g0).
MOVW m_g0(m), R4 MOVW m_g0(m), R4
CMP g, R4 CMP g, R4
...@@ -195,7 +195,7 @@ TEXT reflect·call(SB), 7, $-4 ...@@ -195,7 +195,7 @@ TEXT reflect·call(SB), 7, $-4
// Return point when leaving stack. // Return point when leaving stack.
// using frame size $-4 means do not save LR on stack. // using frame size $-4 means do not save LR on stack.
TEXT sys·lessstack(SB), 7, $-4 TEXT runtime·lessstack(SB), 7, $-4
// Save return value in m->cret // Save return value in m->cret
MOVW R0, m_cret(m) MOVW R0, m_cret(m)
...@@ -209,9 +209,9 @@ TEXT sys·lessstack(SB), 7, $-4 ...@@ -209,9 +209,9 @@ TEXT sys·lessstack(SB), 7, $-4
// R2 is argsize // R2 is argsize
// R3 is LR for f (f's caller's PC) // R3 is LR for f (f's caller's PC)
// using frame size $-4 means do not save LR on stack. // using frame size $-4 means do not save LR on stack.
TEXT sys·morestackx(SB), 7, $-4 TEXT runtime·morestackx(SB), 7, $-4
MOVW $0, R1 // set frame size MOVW $0, R1 // set frame size
B sys·morestack(SB) B runtime·morestack(SB)
// void jmpdefer(fn, sp); // void jmpdefer(fn, sp);
...@@ -227,7 +227,7 @@ TEXT jmpdefer(SB), 7, $0 ...@@ -227,7 +227,7 @@ TEXT jmpdefer(SB), 7, $0
MOVW $-4(R1), SP // correct for sp pointing to arg0, past stored lr MOVW $-4(R1), SP // correct for sp pointing to arg0, past stored lr
B (R0) B (R0)
TEXT sys·memclr(SB),7,$20 TEXT runtime·memclr(SB),7,$20
MOVW 0(FP), R0 MOVW 0(FP), R0
MOVW $0, R1 // c = 0 MOVW $0, R1 // c = 0
MOVW R1, -16(SP) MOVW R1, -16(SP)
...@@ -240,13 +240,13 @@ TEXT sys·memclr(SB),7,$20 ...@@ -240,13 +240,13 @@ TEXT sys·memclr(SB),7,$20
MOVW -4(SP), g MOVW -4(SP), g
RET RET
TEXT sys·getcallerpc+0(SB),7,$0 TEXT runtime·getcallerpc+0(SB),7,$0
BL abort(SB) BL abort(SB)
// MOVL x+0(FP),AX // addr of first arg // MOVL x+0(FP),AX // addr of first arg
// MOVL -4(AX),AX // get calling pc // MOVL -4(AX),AX // get calling pc
// RET // RET
TEXT sys·setcallerpc+0(SB),7,$0 TEXT runtime·setcallerpc+0(SB),7,$0
BL abort(SB) BL abort(SB)
// MOVL x+0(FP),AX // addr of first arg // MOVL x+0(FP),AX // addr of first arg
// MOVL x+4(FP), BX // MOVL x+4(FP), BX
......
...@@ -65,7 +65,7 @@ traceback(byte *pc0, byte *sp, G *g) ...@@ -65,7 +65,7 @@ traceback(byte *pc0, byte *sp, G *g)
// for(i = 0; i < f->args; i++) { // for(i = 0; i < f->args; i++) {
// if(i != 0) // if(i != 0)
// prints(", "); // prints(", ");
// sys·printhex(((uint32*)sp)[i]); // runtime·printhex(((uint32*)sp)[i]);
// if(i >= 4) { // if(i >= 4) {
// prints(", ..."); // prints(", ...");
// break; // break;
......
...@@ -143,7 +143,7 @@ _f2v(Vlong *y, float f) ...@@ -143,7 +143,7 @@ _f2v(Vlong *y, float f)
} }
void void
sys·float64toint64(double d, Vlong y) runtime·float64toint64(double d, Vlong y)
{ {
_d2v(&y, d); _d2v(&y, d);
} }
...@@ -169,7 +169,7 @@ _v2f(Vlong x) ...@@ -169,7 +169,7 @@ _v2f(Vlong x)
} }
void void
sys·int64tofloat64(Vlong y, double d) runtime·int64tofloat64(Vlong y, double d)
{ {
d = _v2d(y); d = _v2d(y);
} }
...@@ -250,7 +250,7 @@ _divvu(Vlong *q, Vlong n, Vlong d) ...@@ -250,7 +250,7 @@ _divvu(Vlong *q, Vlong n, Vlong d)
} }
void void
sys·uint64div(Vlong n, Vlong d, Vlong q) runtime·uint64div(Vlong n, Vlong d, Vlong q)
{ {
_divvu(&q, n, d); _divvu(&q, n, d);
} }
...@@ -268,7 +268,7 @@ _modvu(Vlong *r, Vlong n, Vlong d) ...@@ -268,7 +268,7 @@ _modvu(Vlong *r, Vlong n, Vlong d)
} }
void void
sys·uint64mod(Vlong n, Vlong d, Vlong q) runtime·uint64mod(Vlong n, Vlong d, Vlong q)
{ {
_modvu(&q, n, d); _modvu(&q, n, d);
} }
...@@ -313,7 +313,7 @@ _divv(Vlong *q, Vlong n, Vlong d) ...@@ -313,7 +313,7 @@ _divv(Vlong *q, Vlong n, Vlong d)
} }
void void
sys·int64div(Vlong n, Vlong d, Vlong q) runtime·int64div(Vlong n, Vlong d, Vlong q)
{ {
_divv(&q, n, d); _divv(&q, n, d);
} }
...@@ -340,7 +340,7 @@ _modv(Vlong *r, Vlong n, Vlong d) ...@@ -340,7 +340,7 @@ _modv(Vlong *r, Vlong n, Vlong d)
} }
void void
sys·int64mod(Vlong n, Vlong d, Vlong q) runtime·int64mod(Vlong n, Vlong d, Vlong q)
{ {
_modv(&q, n, d); _modv(&q, n, d);
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
void *initcgo; /* filled in by dynamic linker when Cgo is available */ void *initcgo; /* filled in by dynamic linker when Cgo is available */
int64 ncgocall; int64 ncgocall;
void sys·entersyscall(void); void runtime·entersyscall(void);
void sys·exitsyscall(void); void runtime·exitsyscall(void);
void void
cgocall(void (*fn)(void*), void *arg) cgocall(void (*fn)(void*), void *arg)
...@@ -24,9 +24,9 @@ cgocall(void (*fn)(void*), void *arg) ...@@ -24,9 +24,9 @@ cgocall(void (*fn)(void*), void *arg)
* M to run goroutines while we are in the * M to run goroutines while we are in the
* foreign code. * foreign code.
*/ */
sys·entersyscall(); runtime·entersyscall();
runcgo(fn, arg); runcgo(fn, arg);
sys·exitsyscall(); runtime·exitsyscall();
return; return;
} }
......
...@@ -97,7 +97,7 @@ makechan(Type *elem, uint32 hint) ...@@ -97,7 +97,7 @@ makechan(Type *elem, uint32 hint)
if(elem->alg >= nelem(algarray)) { if(elem->alg >= nelem(algarray)) {
printf("chan(alg=%d)\n", elem->alg); printf("chan(alg=%d)\n", elem->alg);
throw("sys·makechan: unsupported elem type"); throw("runtime·makechan: unsupported elem type");
} }
c = mal(sizeof(*c)); c = mal(sizeof(*c));
...@@ -128,15 +128,15 @@ makechan(Type *elem, uint32 hint) ...@@ -128,15 +128,15 @@ makechan(Type *elem, uint32 hint)
if(debug) { if(debug) {
prints("makechan: chan="); prints("makechan: chan=");
sys·printpointer(c); runtime·printpointer(c);
prints("; elemsize="); prints("; elemsize=");
sys·printint(elem->size); runtime·printint(elem->size);
prints("; elemalg="); prints("; elemalg=");
sys·printint(elem->alg); runtime·printint(elem->alg);
prints("; elemalign="); prints("; elemalign=");
sys·printint(elem->align); runtime·printint(elem->align);
prints("; dataqsiz="); prints("; dataqsiz=");
sys·printint(c->dataqsiz); runtime·printint(c->dataqsiz);
prints("\n"); prints("\n");
} }
...@@ -145,7 +145,7 @@ makechan(Type *elem, uint32 hint) ...@@ -145,7 +145,7 @@ makechan(Type *elem, uint32 hint)
// makechan(elemsize uint32, elemalg uint32, hint uint32) (hchan *chan any); // makechan(elemsize uint32, elemalg uint32, hint uint32) (hchan *chan any);
void void
sys·makechan(Type *elem, uint32 hint, Hchan *ret) runtime·makechan(Type *elem, uint32 hint, Hchan *ret)
{ {
ret = makechan(elem, hint); ret = makechan(elem, hint);
FLUSH(&ret); FLUSH(&ret);
...@@ -178,7 +178,7 @@ chansend(Hchan *c, byte *ep, bool *pres) ...@@ -178,7 +178,7 @@ chansend(Hchan *c, byte *ep, bool *pres)
if(debug) { if(debug) {
prints("chansend: chan="); prints("chansend: chan=");
sys·printpointer(c); runtime·printpointer(c);
prints("; elem="); prints("; elem=");
c->elemalg->print(c->elemsize, ep); c->elemalg->print(c->elemsize, ep);
prints("\n"); prints("\n");
...@@ -281,7 +281,7 @@ chanrecv(Hchan* c, byte *ep, bool* pres) ...@@ -281,7 +281,7 @@ chanrecv(Hchan* c, byte *ep, bool* pres)
if(debug) { if(debug) {
prints("chanrecv: chan="); prints("chanrecv: chan=");
sys·printpointer(c); runtime·printpointer(c);
prints("\n"); prints("\n");
} }
...@@ -379,7 +379,7 @@ closed: ...@@ -379,7 +379,7 @@ closed:
// chansend1(hchan *chan any, elem any); // chansend1(hchan *chan any, elem any);
void void
sys·chansend1(Hchan* c, ...) runtime·chansend1(Hchan* c, ...)
{ {
int32 o; int32 o;
byte *ae; byte *ae;
...@@ -391,7 +391,7 @@ sys·chansend1(Hchan* c, ...) ...@@ -391,7 +391,7 @@ sys·chansend1(Hchan* c, ...)
// chansend2(hchan *chan any, elem any) (pres bool); // chansend2(hchan *chan any, elem any) (pres bool);
void void
sys·chansend2(Hchan* c, ...) runtime·chansend2(Hchan* c, ...)
{ {
int32 o; int32 o;
byte *ae, *ap; byte *ae, *ap;
...@@ -406,7 +406,7 @@ sys·chansend2(Hchan* c, ...) ...@@ -406,7 +406,7 @@ sys·chansend2(Hchan* c, ...)
// chanrecv1(hchan *chan any) (elem any); // chanrecv1(hchan *chan any) (elem any);
void void
sys·chanrecv1(Hchan* c, ...) runtime·chanrecv1(Hchan* c, ...)
{ {
int32 o; int32 o;
byte *ae; byte *ae;
...@@ -419,7 +419,7 @@ sys·chanrecv1(Hchan* c, ...) ...@@ -419,7 +419,7 @@ sys·chanrecv1(Hchan* c, ...)
// chanrecv2(hchan *chan any) (elem any, pres bool); // chanrecv2(hchan *chan any) (elem any, pres bool);
void void
sys·chanrecv2(Hchan* c, ...) runtime·chanrecv2(Hchan* c, ...)
{ {
int32 o; int32 o;
byte *ae, *ap; byte *ae, *ap;
...@@ -434,7 +434,7 @@ sys·chanrecv2(Hchan* c, ...) ...@@ -434,7 +434,7 @@ sys·chanrecv2(Hchan* c, ...)
// newselect(size uint32) (sel *byte); // newselect(size uint32) (sel *byte);
void void
sys·newselect(int32 size, ...) runtime·newselect(int32 size, ...)
{ {
int32 n, o; int32 n, o;
Select **selp; Select **selp;
...@@ -462,16 +462,16 @@ sys·newselect(int32 size, ...) ...@@ -462,16 +462,16 @@ sys·newselect(int32 size, ...)
*selp = sel; *selp = sel;
if(debug) { if(debug) {
prints("newselect s="); prints("newselect s=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" size="); prints(" size=");
sys·printint(size); runtime·printint(size);
prints("\n"); prints("\n");
} }
} }
// selectsend(sel *byte, hchan *chan any, elem any) (selected bool); // selectsend(sel *byte, hchan *chan any, elem any) (selected bool);
void void
sys·selectsend(Select *sel, Hchan *c, ...) runtime·selectsend(Select *sel, Hchan *c, ...)
{ {
int32 i, eo; int32 i, eo;
Scase *cas; Scase *cas;
...@@ -491,7 +491,7 @@ sys·selectsend(Select *sel, Hchan *c, ...) ...@@ -491,7 +491,7 @@ sys·selectsend(Select *sel, Hchan *c, ...)
sel->scase[i] = cas; sel->scase[i] = cas;
} }
cas->pc = sys·getcallerpc(&sel); cas->pc = runtime·getcallerpc(&sel);
cas->chan = c; cas->chan = c;
eo = rnd(sizeof(sel), sizeof(c)); eo = rnd(sizeof(sel), sizeof(c));
...@@ -504,22 +504,22 @@ sys·selectsend(Select *sel, Hchan *c, ...) ...@@ -504,22 +504,22 @@ sys·selectsend(Select *sel, Hchan *c, ...)
if(debug) { if(debug) {
prints("selectsend s="); prints("selectsend s=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" pc="); prints(" pc=");
sys·printpointer(cas->pc); runtime·printpointer(cas->pc);
prints(" chan="); prints(" chan=");
sys·printpointer(cas->chan); runtime·printpointer(cas->chan);
prints(" po="); prints(" po=");
sys·printint(cas->so); runtime·printint(cas->so);
prints(" send="); prints(" send=");
sys·printint(cas->send); runtime·printint(cas->send);
prints("\n"); prints("\n");
} }
} }
// selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool); // selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool);
void void
sys·selectrecv(Select *sel, Hchan *c, ...) runtime·selectrecv(Select *sel, Hchan *c, ...)
{ {
int32 i, eo; int32 i, eo;
Scase *cas; Scase *cas;
...@@ -537,7 +537,7 @@ sys·selectrecv(Select *sel, Hchan *c, ...) ...@@ -537,7 +537,7 @@ sys·selectrecv(Select *sel, Hchan *c, ...)
cas = mal(sizeof *cas); cas = mal(sizeof *cas);
sel->scase[i] = cas; sel->scase[i] = cas;
} }
cas->pc = sys·getcallerpc(&sel); cas->pc = runtime·getcallerpc(&sel);
cas->chan = c; cas->chan = c;
eo = rnd(sizeof(sel), sizeof(c)); eo = rnd(sizeof(sel), sizeof(c));
...@@ -548,15 +548,15 @@ sys·selectrecv(Select *sel, Hchan *c, ...) ...@@ -548,15 +548,15 @@ sys·selectrecv(Select *sel, Hchan *c, ...)
if(debug) { if(debug) {
prints("selectrecv s="); prints("selectrecv s=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" pc="); prints(" pc=");
sys·printpointer(cas->pc); runtime·printpointer(cas->pc);
prints(" chan="); prints(" chan=");
sys·printpointer(cas->chan); runtime·printpointer(cas->chan);
prints(" so="); prints(" so=");
sys·printint(cas->so); runtime·printint(cas->so);
prints(" send="); prints(" send=");
sys·printint(cas->send); runtime·printint(cas->send);
prints("\n"); prints("\n");
} }
} }
...@@ -564,7 +564,7 @@ sys·selectrecv(Select *sel, Hchan *c, ...) ...@@ -564,7 +564,7 @@ sys·selectrecv(Select *sel, Hchan *c, ...)
// selectdefaul(sel *byte) (selected bool); // selectdefaul(sel *byte) (selected bool);
void void
sys·selectdefault(Select *sel, ...) runtime·selectdefault(Select *sel, ...)
{ {
int32 i; int32 i;
Scase *cas; Scase *cas;
...@@ -578,7 +578,7 @@ sys·selectdefault(Select *sel, ...) ...@@ -578,7 +578,7 @@ sys·selectdefault(Select *sel, ...)
cas = mal(sizeof *cas); cas = mal(sizeof *cas);
sel->scase[i] = cas; sel->scase[i] = cas;
} }
cas->pc = sys·getcallerpc(&sel); cas->pc = runtime·getcallerpc(&sel);
cas->chan = nil; cas->chan = nil;
cas->so = rnd(sizeof(sel), Structrnd); cas->so = rnd(sizeof(sel), Structrnd);
...@@ -587,20 +587,20 @@ sys·selectdefault(Select *sel, ...) ...@@ -587,20 +587,20 @@ sys·selectdefault(Select *sel, ...)
if(debug) { if(debug) {
prints("selectdefault s="); prints("selectdefault s=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" pc="); prints(" pc=");
sys·printpointer(cas->pc); runtime·printpointer(cas->pc);
prints(" so="); prints(" so=");
sys·printint(cas->so); runtime·printint(cas->so);
prints(" send="); prints(" send=");
sys·printint(cas->send); runtime·printint(cas->send);
prints("\n"); prints("\n");
} }
} }
// selectgo(sel *byte); // selectgo(sel *byte);
void void
sys·selectgo(Select *sel) runtime·selectgo(Select *sel)
{ {
uint32 p, o, i; uint32 p, o, i;
Scase *cas, *dfl; Scase *cas, *dfl;
...@@ -611,7 +611,7 @@ sys·selectgo(Select *sel) ...@@ -611,7 +611,7 @@ sys·selectgo(Select *sel)
if(debug) { if(debug) {
prints("selectgo: sel="); prints("selectgo: sel=");
sys·printpointer(sel); runtime·printpointer(sel);
prints("\n"); prints("\n");
} }
...@@ -768,15 +768,15 @@ loop: ...@@ -768,15 +768,15 @@ loop:
if(debug) { if(debug) {
prints("wait-return: sel="); prints("wait-return: sel=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" c="); prints(" c=");
sys·printpointer(c); runtime·printpointer(c);
prints(" cas="); prints(" cas=");
sys·printpointer(cas); runtime·printpointer(cas);
prints(" send="); prints(" send=");
sys·printint(cas->send); runtime·printint(cas->send);
prints(" o="); prints(" o=");
sys·printint(o); runtime·printint(o);
prints("\n"); prints("\n");
} }
...@@ -818,11 +818,11 @@ gotr: ...@@ -818,11 +818,11 @@ gotr:
// recv path to wakeup the sender (sg) // recv path to wakeup the sender (sg)
if(debug) { if(debug) {
prints("gotr: sel="); prints("gotr: sel=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" c="); prints(" c=");
sys·printpointer(c); runtime·printpointer(c);
prints(" o="); prints(" o=");
sys·printint(o); runtime·printint(o);
prints("\n"); prints("\n");
} }
if(cas->u.elemp != nil) if(cas->u.elemp != nil)
...@@ -843,11 +843,11 @@ gots: ...@@ -843,11 +843,11 @@ gots:
// send path to wakeup the receiver (sg) // send path to wakeup the receiver (sg)
if(debug) { if(debug) {
prints("gots: sel="); prints("gots: sel=");
sys·printpointer(sel); runtime·printpointer(sel);
prints(" c="); prints(" c=");
sys·printpointer(c); runtime·printpointer(c);
prints(" o="); prints(" o=");
sys·printint(o); runtime·printint(o);
prints("\n"); prints("\n");
} }
if(c->closed & Wclosed) if(c->closed & Wclosed)
...@@ -869,14 +869,14 @@ retc: ...@@ -869,14 +869,14 @@ retc:
} }
unlock(&chanlock); unlock(&chanlock);
sys·setcallerpc(&sel, cas->pc); runtime·setcallerpc(&sel, cas->pc);
as = (byte*)&sel + cas->so; as = (byte*)&sel + cas->so;
*as = true; *as = true;
} }
// closechan(sel *byte); // closechan(sel *byte);
void void
sys·closechan(Hchan *c) runtime·closechan(Hchan *c)
{ {
SudoG *sg; SudoG *sg;
G* gp; G* gp;
...@@ -913,7 +913,7 @@ sys·closechan(Hchan *c) ...@@ -913,7 +913,7 @@ sys·closechan(Hchan *c)
void void
chanclose(Hchan *c) chanclose(Hchan *c)
{ {
sys·closechan(c); runtime·closechan(c);
} }
bool bool
...@@ -937,7 +937,7 @@ chancap(Hchan *c) ...@@ -937,7 +937,7 @@ chancap(Hchan *c)
// closedchan(sel *byte) bool; // closedchan(sel *byte) bool;
void void
sys·closedchan(Hchan *c, bool closed) runtime·closedchan(Hchan *c, bool closed)
{ {
closed = chanclosed(c); closed = chanclosed(c);
FLUSH(&closed); FLUSH(&closed);
......
...@@ -35,7 +35,7 @@ TEXT write(SB),7,$0 ...@@ -35,7 +35,7 @@ TEXT write(SB),7,$0
CALL notok(SB) CALL notok(SB)
RET RET
TEXT sys·mmap(SB),7,$0 TEXT runtime·mmap(SB),7,$0
MOVL $197, AX MOVL $197, AX
INT $0x80 INT $0x80
JAE 2(PC) JAE 2(PC)
......
...@@ -63,7 +63,7 @@ TEXT sigtramp(SB),7,$40 ...@@ -63,7 +63,7 @@ TEXT sigtramp(SB),7,$40
SYSCALL SYSCALL
INT $3 // not reached INT $3 // not reached
TEXT sys·mmap(SB),7,$-8 TEXT runtime·mmap(SB),7,$-8
MOVQ 8(SP), DI // arg 1 addr MOVQ 8(SP), DI // arg 1 addr
MOVL 16(SP), SI // arg 2 len MOVL 16(SP), SI // arg 2 len
MOVL 20(SP), DX // arg 3 prot MOVL 20(SP), DX // arg 3 prot
...@@ -81,7 +81,7 @@ TEXT notok(SB),7,$-8 ...@@ -81,7 +81,7 @@ TEXT notok(SB),7,$-8
MOVQ BP, (BP) MOVQ BP, (BP)
RET RET
TEXT sys·memclr(SB),7,$-8 TEXT runtime·memclr(SB),7,$-8
MOVQ 8(SP), DI // arg 1 addr MOVQ 8(SP), DI // arg 1 addr
MOVL 16(SP), CX // arg 2 count MOVL 16(SP), CX // arg 2 count
ADDL $7, CX ADDL $7, CX
...@@ -92,12 +92,12 @@ TEXT sys·memclr(SB),7,$-8 ...@@ -92,12 +92,12 @@ TEXT sys·memclr(SB),7,$-8
STOSQ STOSQ
RET RET
TEXT sys·getcallerpc+0(SB),7,$0 TEXT runtime·getcallerpc+0(SB),7,$0
MOVQ x+0(FP),AX // addr of first arg MOVQ x+0(FP),AX // addr of first arg
MOVQ -8(AX),AX // get calling pc MOVQ -8(AX),AX // get calling pc
RET RET
TEXT sys·setcallerpc+0(SB),7,$0 TEXT runtime·setcallerpc+0(SB),7,$0
MOVQ x+0(FP),AX // addr of first arg MOVQ x+0(FP),AX // addr of first arg
MOVQ x+8(FP), BX MOVQ x+8(FP), BX
MOVQ BX, -8(AX) // set calling pc MOVQ BX, -8(AX) // set calling pc
......
...@@ -245,7 +245,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize) ...@@ -245,7 +245,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize)
prints("send:\t"); prints("send:\t");
for(i=0; i<h->msgh_size/sizeof(p[0]); i++){ for(i=0; i<h->msgh_size/sizeof(p[0]); i++){
prints(" "); prints(" ");
sys·printpointer((void*)p[i]); runtime·printpointer((void*)p[i]);
if(i%8 == 7) if(i%8 == 7)
prints("\n\t"); prints("\n\t");
} }
...@@ -258,7 +258,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize) ...@@ -258,7 +258,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize)
if(ret != 0){ if(ret != 0){
if(DebugMach){ if(DebugMach){
prints("mach_msg error "); prints("mach_msg error ");
sys·printint(ret); runtime·printint(ret);
prints("\n"); prints("\n");
} }
return ret; return ret;
...@@ -269,7 +269,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize) ...@@ -269,7 +269,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize)
prints("recv:\t"); prints("recv:\t");
for(i=0; i<h->msgh_size/sizeof(p[0]); i++){ for(i=0; i<h->msgh_size/sizeof(p[0]); i++){
prints(" "); prints(" ");
sys·printpointer((void*)p[i]); runtime·printpointer((void*)p[i]);
if(i%8 == 7) if(i%8 == 7)
prints("\n\t"); prints("\n\t");
} }
...@@ -280,9 +280,9 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize) ...@@ -280,9 +280,9 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize)
if(h->msgh_id != id+Reply){ if(h->msgh_id != id+Reply){
if(DebugMach){ if(DebugMach){
prints("mach_msg reply id mismatch "); prints("mach_msg reply id mismatch ");
sys·printint(h->msgh_id); runtime·printint(h->msgh_id);
prints(" != "); prints(" != ");
sys·printint(id+Reply); runtime·printint(id+Reply);
prints("\n"); prints("\n");
} }
return -303; // MIG_REPLY_MISMATCH return -303; // MIG_REPLY_MISMATCH
...@@ -299,7 +299,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize) ...@@ -299,7 +299,7 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize)
&& !(h->msgh_bits & MACH_MSGH_BITS_COMPLEX)){ && !(h->msgh_bits & MACH_MSGH_BITS_COMPLEX)){
if(DebugMach){ if(DebugMach){
prints("mig result "); prints("mig result ");
sys·printint(c->code); runtime·printint(c->code);
prints("\n"); prints("\n");
} }
return c->code; return c->code;
...@@ -308,9 +308,9 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize) ...@@ -308,9 +308,9 @@ machcall(MachHeader *h, int32 maxsize, int32 rxsize)
if(h->msgh_size != rxsize){ if(h->msgh_size != rxsize){
if(DebugMach){ if(DebugMach){
prints("mach_msg reply size mismatch "); prints("mach_msg reply size mismatch ");
sys·printint(h->msgh_size); runtime·printint(h->msgh_size);
prints(" != "); prints(" != ");
sys·printint(rxsize); runtime·printint(rxsize);
prints("\n"); prints("\n");
} }
return -307; // MIG_ARRAY_TOO_LARGE return -307; // MIG_ARRAY_TOO_LARGE
......
...@@ -679,12 +679,12 @@ makemap(Type *key, Type *val, uint32 hint) ...@@ -679,12 +679,12 @@ makemap(Type *key, Type *val, uint32 hint)
if(keyalg >= nelem(algarray) || algarray[keyalg].hash == nohash) { if(keyalg >= nelem(algarray) || algarray[keyalg].hash == nohash) {
printf("map(keyalg=%d)\n", keyalg); printf("map(keyalg=%d)\n", keyalg);
throw("sys·makemap: unsupported map key type"); throw("runtime·makemap: unsupported map key type");
} }
if(valalg >= nelem(algarray)) { if(valalg >= nelem(algarray)) {
printf("map(valalg=%d)\n", valalg); printf("map(valalg=%d)\n", valalg);
throw("sys·makemap: unsupported map value type"); throw("runtime·makemap: unsupported map value type");
} }
h = mal(sizeof(*h)); h = mal(sizeof(*h));
...@@ -733,7 +733,7 @@ makemap(Type *key, Type *val, uint32 hint) ...@@ -733,7 +733,7 @@ makemap(Type *key, Type *val, uint32 hint)
// makemap(key, val *Type, hint uint32) (hmap *map[any]any); // makemap(key, val *Type, hint uint32) (hmap *map[any]any);
void void
sys·makemap(Type *key, Type *val, uint32 hint, Hmap *ret) runtime·makemap(Type *key, Type *val, uint32 hint, Hmap *ret)
{ {
ret = makemap(key, val, hint); ret = makemap(key, val, hint);
FLUSH(&ret); FLUSH(&ret);
...@@ -756,7 +756,7 @@ mapaccess(Hmap *h, byte *ak, byte *av, bool *pres) ...@@ -756,7 +756,7 @@ mapaccess(Hmap *h, byte *ak, byte *av, bool *pres)
// mapaccess1(hmap *map[any]any, key any) (val any); // mapaccess1(hmap *map[any]any, key any) (val any);
void void
sys·mapaccess1(Hmap *h, ...) runtime·mapaccess1(Hmap *h, ...)
{ {
byte *ak, *av; byte *ak, *av;
bool pres; bool pres;
...@@ -766,24 +766,24 @@ sys·mapaccess1(Hmap *h, ...) ...@@ -766,24 +766,24 @@ sys·mapaccess1(Hmap *h, ...)
mapaccess(h, ak, av, &pres); mapaccess(h, ak, av, &pres);
if(!pres) if(!pres)
throw("sys·mapaccess1: key not in map"); throw("runtime·mapaccess1: key not in map");
if(debug) { if(debug) {
prints("sys·mapaccess1: map="); prints("runtime·mapaccess1: map=");
sys·printpointer(h); runtime·printpointer(h);
prints("; key="); prints("; key=");
h->keyalg->print(h->keysize, ak); h->keyalg->print(h->keysize, ak);
prints("; val="); prints("; val=");
h->valalg->print(h->valsize, av); h->valalg->print(h->valsize, av);
prints("; pres="); prints("; pres=");
sys·printbool(pres); runtime·printbool(pres);
prints("\n"); prints("\n");
} }
} }
// mapaccess2(hmap *map[any]any, key any) (val any, pres bool); // mapaccess2(hmap *map[any]any, key any) (val any, pres bool);
void void
sys·mapaccess2(Hmap *h, ...) runtime·mapaccess2(Hmap *h, ...)
{ {
byte *ak, *av, *ap; byte *ak, *av, *ap;
...@@ -794,14 +794,14 @@ sys·mapaccess2(Hmap *h, ...) ...@@ -794,14 +794,14 @@ sys·mapaccess2(Hmap *h, ...)
mapaccess(h, ak, av, ap); mapaccess(h, ak, av, ap);
if(debug) { if(debug) {
prints("sys·mapaccess2: map="); prints("runtime·mapaccess2: map=");
sys·printpointer(h); runtime·printpointer(h);
prints("; key="); prints("; key=");
h->keyalg->print(h->keysize, ak); h->keyalg->print(h->keysize, ak);
prints("; val="); prints("; val=");
h->valalg->print(h->valsize, av); h->valalg->print(h->valsize, av);
prints("; pres="); prints("; pres=");
sys·printbool(*ap); runtime·printbool(*ap);
prints("\n"); prints("\n");
} }
} }
...@@ -824,22 +824,22 @@ mapassign(Hmap *h, byte *ak, byte *av) ...@@ -824,22 +824,22 @@ mapassign(Hmap *h, byte *ak, byte *av)
if(debug) { if(debug) {
prints("mapassign: map="); prints("mapassign: map=");
sys·printpointer(h); runtime·printpointer(h);
prints("; key="); prints("; key=");
h->keyalg->print(h->keysize, ak); h->keyalg->print(h->keysize, ak);
prints("; val="); prints("; val=");
h->valalg->print(h->valsize, av); h->valalg->print(h->valsize, av);
prints("; hit="); prints("; hit=");
sys·printint(hit); runtime·printint(hit);
prints("; res="); prints("; res=");
sys·printpointer(res); runtime·printpointer(res);
prints("\n"); prints("\n");
} }
} }
// mapassign1(hmap *map[any]any, key any, val any); // mapassign1(hmap *map[any]any, key any, val any);
void void
sys·mapassign1(Hmap *h, ...) runtime·mapassign1(Hmap *h, ...)
{ {
byte *ak, *av; byte *ak, *av;
...@@ -851,7 +851,7 @@ sys·mapassign1(Hmap *h, ...) ...@@ -851,7 +851,7 @@ sys·mapassign1(Hmap *h, ...)
// mapassign2(hmap *map[any]any, key any, val any, pres bool); // mapassign2(hmap *map[any]any, key any, val any, pres bool);
void void
sys·mapassign2(Hmap *h, ...) runtime·mapassign2(Hmap *h, ...)
{ {
byte *ak, *av, *ap; byte *ak, *av, *ap;
...@@ -866,7 +866,7 @@ sys·mapassign2(Hmap *h, ...) ...@@ -866,7 +866,7 @@ sys·mapassign2(Hmap *h, ...)
if(debug) { if(debug) {
prints("mapassign2: map="); prints("mapassign2: map=");
sys·printpointer(h); runtime·printpointer(h);
prints("; key="); prints("; key=");
h->keyalg->print(h->keysize, ak); h->keyalg->print(h->keysize, ak);
prints("\n"); prints("\n");
...@@ -875,7 +875,7 @@ sys·mapassign2(Hmap *h, ...) ...@@ -875,7 +875,7 @@ sys·mapassign2(Hmap *h, ...)
// mapiterinit(hmap *map[any]any, hiter *any); // mapiterinit(hmap *map[any]any, hiter *any);
void void
sys·mapiterinit(Hmap *h, struct hash_iter *it) runtime·mapiterinit(Hmap *h, struct hash_iter *it)
{ {
if(h == nil) { if(h == nil) {
it->data = nil; it->data = nil;
...@@ -884,12 +884,12 @@ sys·mapiterinit(Hmap *h, struct hash_iter *it) ...@@ -884,12 +884,12 @@ sys·mapiterinit(Hmap *h, struct hash_iter *it)
hash_iter_init(h, it); hash_iter_init(h, it);
it->data = hash_next(it); it->data = hash_next(it);
if(debug) { if(debug) {
prints("sys·mapiterinit: map="); prints("runtime·mapiterinit: map=");
sys·printpointer(h); runtime·printpointer(h);
prints("; iter="); prints("; iter=");
sys·printpointer(it); runtime·printpointer(it);
prints("; data="); prints("; data=");
sys·printpointer(it->data); runtime·printpointer(it->data);
prints("\n"); prints("\n");
} }
} }
...@@ -900,20 +900,20 @@ mapiterinit(Hmap *h) ...@@ -900,20 +900,20 @@ mapiterinit(Hmap *h)
struct hash_iter *it; struct hash_iter *it;
it = mal(sizeof *it); it = mal(sizeof *it);
sys·mapiterinit(h, it); runtime·mapiterinit(h, it);
return it; return it;
} }
// mapiternext(hiter *any); // mapiternext(hiter *any);
void void
sys·mapiternext(struct hash_iter *it) runtime·mapiternext(struct hash_iter *it)
{ {
it->data = hash_next(it); it->data = hash_next(it);
if(debug) { if(debug) {
prints("sys·mapiternext: iter="); prints("runtime·mapiternext: iter=");
sys·printpointer(it); runtime·printpointer(it);
prints("; data="); prints("; data=");
sys·printpointer(it->data); runtime·printpointer(it->data);
prints("\n"); prints("\n");
} }
} }
...@@ -921,12 +921,12 @@ sys·mapiternext(struct hash_iter *it) ...@@ -921,12 +921,12 @@ sys·mapiternext(struct hash_iter *it)
void void
mapiternext(struct hash_iter *it) mapiternext(struct hash_iter *it)
{ {
sys·mapiternext(it); runtime·mapiternext(it);
} }
// mapiter1(hiter *any) (key any); // mapiter1(hiter *any) (key any);
void void
sys·mapiter1(struct hash_iter *it, ...) runtime·mapiter1(struct hash_iter *it, ...)
{ {
Hmap *h; Hmap *h;
byte *ak, *res; byte *ak, *res;
...@@ -936,15 +936,15 @@ sys·mapiter1(struct hash_iter *it, ...) ...@@ -936,15 +936,15 @@ sys·mapiter1(struct hash_iter *it, ...)
res = it->data; res = it->data;
if(res == nil) if(res == nil)
throw("sys·mapiter2: key:val nil pointer"); throw("runtime·mapiter2: key:val nil pointer");
h->keyalg->copy(h->keysize, ak, res); h->keyalg->copy(h->keysize, ak, res);
if(debug) { if(debug) {
prints("mapiter2: iter="); prints("mapiter2: iter=");
sys·printpointer(it); runtime·printpointer(it);
prints("; map="); prints("; map=");
sys·printpointer(h); runtime·printpointer(h);
prints("\n"); prints("\n");
} }
} }
...@@ -965,7 +965,7 @@ mapiterkey(struct hash_iter *it, void *ak) ...@@ -965,7 +965,7 @@ mapiterkey(struct hash_iter *it, void *ak)
// mapiter2(hiter *any) (key any, val any); // mapiter2(hiter *any) (key any, val any);
void void
sys·mapiter2(struct hash_iter *it, ...) runtime·mapiter2(struct hash_iter *it, ...)
{ {
Hmap *h; Hmap *h;
byte *ak, *av, *res; byte *ak, *av, *res;
...@@ -976,16 +976,16 @@ sys·mapiter2(struct hash_iter *it, ...) ...@@ -976,16 +976,16 @@ sys·mapiter2(struct hash_iter *it, ...)
res = it->data; res = it->data;
if(res == nil) if(res == nil)
throw("sys·mapiter2: key:val nil pointer"); throw("runtime·mapiter2: key:val nil pointer");
h->keyalg->copy(h->keysize, ak, res); h->keyalg->copy(h->keysize, ak, res);
h->valalg->copy(h->valsize, av, res+h->datavo); h->valalg->copy(h->valsize, av, res+h->datavo);
if(debug) { if(debug) {
prints("mapiter2: iter="); prints("mapiter2: iter=");
sys·printpointer(it); runtime·printpointer(it);
prints("; map="); prints("; map=");
sys·printpointer(h); runtime·printpointer(h);
prints("\n"); prints("\n");
} }
} }
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#define malloc mal #define malloc mal
#define free(a) USED(a) #define free(a) USED(a)
#define offsetof(s,m) (uint32)(&(((s*)0)->m)) #define offsetof(s,m) (uint32)(&(((s*)0)->m))
#define memset(a,b,c) sys·memclr((byte*)(a), (uint32)(c)) #define memset(a,b,c) runtime·memclr((byte*)(a), (uint32)(c))
#define memmove(a,b,c) mmov((byte*)(a),(byte*)(b),(uint32)(c)) #define memmove(a,b,c) mmov((byte*)(a),(byte*)(b),(uint32)(c))
#define memcpy(a,b,c) mcpy((byte*)(a),(byte*)(b),(uint32)(c)) #define memcpy(a,b,c) mcpy((byte*)(a),(byte*)(b),(uint32)(c))
#define assert(a) if(!(a)) throw("assert") #define assert(a) if(!(a)) throw("assert")
......
...@@ -171,7 +171,7 @@ copyout(Type *t, void **src, void *dst) ...@@ -171,7 +171,7 @@ copyout(Type *t, void **src, void *dst)
// ifaceT2I(sigi *byte, sigt *byte, elem any) (ret Iface); // ifaceT2I(sigi *byte, sigt *byte, elem any) (ret Iface);
#pragma textflag 7 #pragma textflag 7
void void
sys·ifaceT2I(InterfaceType *inter, Type *t, ...) runtime·ifaceT2I(InterfaceType *inter, Type *t, ...)
{ {
byte *elem; byte *elem;
Iface *ret; Iface *ret;
...@@ -187,7 +187,7 @@ sys·ifaceT2I(InterfaceType *inter, Type *t, ...) ...@@ -187,7 +187,7 @@ sys·ifaceT2I(InterfaceType *inter, Type *t, ...)
// ifaceT2E(sigt *byte, elem any) (ret Eface); // ifaceT2E(sigt *byte, elem any) (ret Eface);
#pragma textflag 7 #pragma textflag 7
void void
sys·ifaceT2E(Type *t, ...) runtime·ifaceT2E(Type *t, ...)
{ {
byte *elem; byte *elem;
Eface *ret; Eface *ret;
...@@ -204,7 +204,7 @@ sys·ifaceT2E(Type *t, ...) ...@@ -204,7 +204,7 @@ sys·ifaceT2E(Type *t, ...)
// ifaceI2T(sigt *byte, iface any) (ret any); // ifaceI2T(sigt *byte, iface any) (ret any);
#pragma textflag 7 #pragma textflag 7
void void
sys·ifaceI2T(Type *t, Iface i, ...) runtime·ifaceI2T(Type *t, Iface i, ...)
{ {
Itab *tab; Itab *tab;
byte *ret; byte *ret;
...@@ -225,7 +225,7 @@ sys·ifaceI2T(Type *t, Iface i, ...) ...@@ -225,7 +225,7 @@ sys·ifaceI2T(Type *t, Iface i, ...)
// ifaceI2T2(sigt *byte, i Iface) (ret any, ok bool); // ifaceI2T2(sigt *byte, i Iface) (ret any, ok bool);
#pragma textflag 7 #pragma textflag 7
void void
sys·ifaceI2T2(Type *t, Iface i, ...) runtime·ifaceI2T2(Type *t, Iface i, ...)
{ {
byte *ret; byte *ret;
bool *ok; bool *ok;
...@@ -237,7 +237,7 @@ sys·ifaceI2T2(Type *t, Iface i, ...) ...@@ -237,7 +237,7 @@ sys·ifaceI2T2(Type *t, Iface i, ...)
if(i.tab == nil || i.tab->type != t) { if(i.tab == nil || i.tab->type != t) {
*ok = false; *ok = false;
sys·memclr(ret, wid); runtime·memclr(ret, wid);
return; return;
} }
...@@ -248,7 +248,7 @@ sys·ifaceI2T2(Type *t, Iface i, ...) ...@@ -248,7 +248,7 @@ sys·ifaceI2T2(Type *t, Iface i, ...)
// ifaceE2T(sigt *byte, e Eface) (ret any); // ifaceE2T(sigt *byte, e Eface) (ret any);
#pragma textflag 7 #pragma textflag 7
void void
sys·ifaceE2T(Type *t, Eface e, ...) runtime·ifaceE2T(Type *t, Eface e, ...)
{ {
byte *ret; byte *ret;
...@@ -267,7 +267,7 @@ sys·ifaceE2T(Type *t, Eface e, ...) ...@@ -267,7 +267,7 @@ sys·ifaceE2T(Type *t, Eface e, ...)
// ifaceE2T2(sigt *byte, iface any) (ret any, ok bool); // ifaceE2T2(sigt *byte, iface any) (ret any, ok bool);
#pragma textflag 7 #pragma textflag 7
void void
sys·ifaceE2T2(Type *t, Eface e, ...) runtime·ifaceE2T2(Type *t, Eface e, ...)
{ {
byte *ret; byte *ret;
bool *ok; bool *ok;
...@@ -279,7 +279,7 @@ sys·ifaceE2T2(Type *t, Eface e, ...) ...@@ -279,7 +279,7 @@ sys·ifaceE2T2(Type *t, Eface e, ...)
if(t != e.type) { if(t != e.type) {
*ok = false; *ok = false;
sys·memclr(ret, wid); runtime·memclr(ret, wid);
return; return;
} }
...@@ -290,7 +290,7 @@ sys·ifaceE2T2(Type *t, Eface e, ...) ...@@ -290,7 +290,7 @@ sys·ifaceE2T2(Type *t, Eface e, ...)
// ifaceI2E(sigi *byte, iface any) (ret any); // ifaceI2E(sigi *byte, iface any) (ret any);
// TODO(rsc): Move to back end, throw away function. // TODO(rsc): Move to back end, throw away function.
void void
sys·ifaceI2E(Iface i, Eface ret) runtime·ifaceI2E(Iface i, Eface ret)
{ {
Itab *tab; Itab *tab;
...@@ -307,7 +307,7 @@ sys·ifaceI2E(Iface i, Eface ret) ...@@ -307,7 +307,7 @@ sys·ifaceI2E(Iface i, Eface ret)
// called only for implicit (no type assertion) conversions. // called only for implicit (no type assertion) conversions.
// converting nil is okay. // converting nil is okay.
void void
sys·ifaceI2I(InterfaceType *inter, Iface i, Iface ret) runtime·ifaceI2I(InterfaceType *inter, Iface i, Iface ret)
{ {
Itab *tab; Itab *tab;
...@@ -330,7 +330,7 @@ sys·ifaceI2I(InterfaceType *inter, Iface i, Iface ret) ...@@ -330,7 +330,7 @@ sys·ifaceI2I(InterfaceType *inter, Iface i, Iface ret)
// called only for explicit conversions (with type assertion). // called only for explicit conversions (with type assertion).
// converting nil is not okay. // converting nil is not okay.
void void
sys·ifaceI2Ix(InterfaceType *inter, Iface i, Iface ret) runtime·ifaceI2Ix(InterfaceType *inter, Iface i, Iface ret)
{ {
Itab *tab; Itab *tab;
...@@ -350,7 +350,7 @@ sys·ifaceI2Ix(InterfaceType *inter, Iface i, Iface ret) ...@@ -350,7 +350,7 @@ sys·ifaceI2Ix(InterfaceType *inter, Iface i, Iface ret)
// ifaceI2I2(sigi *byte, iface any) (ret any, ok bool); // ifaceI2I2(sigi *byte, iface any) (ret any, ok bool);
void void
sys·ifaceI2I2(InterfaceType *inter, Iface i, Iface ret, bool ok) runtime·ifaceI2I2(InterfaceType *inter, Iface i, Iface ret, bool ok)
{ {
Itab *tab; Itab *tab;
...@@ -397,14 +397,14 @@ ifaceE2I(InterfaceType *inter, Eface e, Iface *ret) ...@@ -397,14 +397,14 @@ ifaceE2I(InterfaceType *inter, Eface e, Iface *ret)
// ifaceE2I(sigi *byte, iface any) (ret any); // ifaceE2I(sigi *byte, iface any) (ret any);
// Called only for explicit conversions (with type assertion). // Called only for explicit conversions (with type assertion).
void void
sys·ifaceE2I(InterfaceType *inter, Eface e, Iface ret) runtime·ifaceE2I(InterfaceType *inter, Eface e, Iface ret)
{ {
ifaceE2I(inter, e, &ret); ifaceE2I(inter, e, &ret);
} }
// ifaceE2I2(sigi *byte, iface any) (ret any, ok bool); // ifaceE2I2(sigi *byte, iface any) (ret any, ok bool);
void void
sys·ifaceE2I2(InterfaceType *inter, Eface e, Iface ret, bool ok) runtime·ifaceE2I2(InterfaceType *inter, Eface e, Iface ret, bool ok)
{ {
Type *t; Type *t;
...@@ -508,7 +508,7 @@ efaceeq(Eface e1, Eface e2) ...@@ -508,7 +508,7 @@ efaceeq(Eface e1, Eface e2)
// ifaceeq(i1 any, i2 any) (ret bool); // ifaceeq(i1 any, i2 any) (ret bool);
void void
sys·ifaceeq(Iface i1, Iface i2, bool ret) runtime·ifaceeq(Iface i1, Iface i2, bool ret)
{ {
ret = ifaceeq(i1, i2); ret = ifaceeq(i1, i2);
FLUSH(&ret); FLUSH(&ret);
...@@ -516,7 +516,7 @@ sys·ifaceeq(Iface i1, Iface i2, bool ret) ...@@ -516,7 +516,7 @@ sys·ifaceeq(Iface i1, Iface i2, bool ret)
// efaceeq(i1 any, i2 any) (ret bool) // efaceeq(i1 any, i2 any) (ret bool)
void void
sys·efaceeq(Eface e1, Eface e2, bool ret) runtime·efaceeq(Eface e1, Eface e2, bool ret)
{ {
ret = efaceeq(e1, e2); ret = efaceeq(e1, e2);
FLUSH(&ret); FLUSH(&ret);
...@@ -524,7 +524,7 @@ sys·efaceeq(Eface e1, Eface e2, bool ret) ...@@ -524,7 +524,7 @@ sys·efaceeq(Eface e1, Eface e2, bool ret)
// ifacethash(i1 any) (ret uint32); // ifacethash(i1 any) (ret uint32);
void void
sys·ifacethash(Iface i1, uint32 ret) runtime·ifacethash(Iface i1, uint32 ret)
{ {
Itab *tab; Itab *tab;
...@@ -537,7 +537,7 @@ sys·ifacethash(Iface i1, uint32 ret) ...@@ -537,7 +537,7 @@ sys·ifacethash(Iface i1, uint32 ret)
// efacethash(e1 any) (ret uint32) // efacethash(e1 any) (ret uint32)
void void
sys·efacethash(Eface e1, uint32 ret) runtime·efacethash(Eface e1, uint32 ret)
{ {
Type *t; Type *t;
...@@ -549,13 +549,13 @@ sys·efacethash(Eface e1, uint32 ret) ...@@ -549,13 +549,13 @@ sys·efacethash(Eface e1, uint32 ret)
} }
void void
sys·printiface(Iface i) runtime·printiface(Iface i)
{ {
printiface(i); printiface(i);
} }
void void
sys·printeface(Eface e) runtime·printeface(Eface e)
{ {
printeface(e); printeface(e);
} }
......
...@@ -58,7 +58,7 @@ TEXT sigreturn(SB),7,$0 ...@@ -58,7 +58,7 @@ TEXT sigreturn(SB),7,$0
INT $3 // not reached INT $3 // not reached
RET RET
TEXT sys·mmap(SB),7,$0 TEXT runtime·mmap(SB),7,$0
MOVL $192, AX // mmap2 MOVL $192, AX // mmap2
MOVL 4(SP), BX MOVL 4(SP), BX
MOVL 8(SP), CX MOVL 8(SP), CX
......
...@@ -36,7 +36,7 @@ TEXT write(SB),7,$0-24 ...@@ -36,7 +36,7 @@ TEXT write(SB),7,$0-24
SYSCALL SYSCALL
RET RET
TEXT sys·write(SB),7,$0-24 TEXT runtime·write(SB),7,$0-24
MOVL 8(SP), DI MOVL 8(SP), DI
MOVQ 16(SP), SI MOVQ 16(SP), SI
MOVL 24(SP), DX MOVL 24(SP), DX
...@@ -69,7 +69,7 @@ TEXT sigreturn(SB),7,$0 ...@@ -69,7 +69,7 @@ TEXT sigreturn(SB),7,$0
SYSCALL SYSCALL
INT $3 // not reached INT $3 // not reached
TEXT sys·mmap(SB),7,$0-32 TEXT runtime·mmap(SB),7,$0-32
MOVQ 8(SP), DI MOVQ 8(SP), DI
MOVQ $0, SI MOVQ $0, SI
MOVL 16(SP), SI MOVL 16(SP), SI
...@@ -90,7 +90,7 @@ TEXT notok(SB),7,$0 ...@@ -90,7 +90,7 @@ TEXT notok(SB),7,$0
MOVQ BP, (BP) MOVQ BP, (BP)
RET RET
TEXT sys·memclr(SB),7,$0-16 TEXT runtime·memclr(SB),7,$0-16
MOVQ 8(SP), DI // arg 1 addr MOVQ 8(SP), DI // arg 1 addr
MOVL 16(SP), CX // arg 2 count (cannot be zero) MOVL 16(SP), CX // arg 2 count (cannot be zero)
ADDL $7, CX ADDL $7, CX
...@@ -101,12 +101,12 @@ TEXT sys·memclr(SB),7,$0-16 ...@@ -101,12 +101,12 @@ TEXT sys·memclr(SB),7,$0-16
STOSQ STOSQ
RET RET
TEXT sys·getcallerpc+0(SB),7,$0 TEXT runtime·getcallerpc+0(SB),7,$0
MOVQ x+0(FP),AX // addr of first arg MOVQ x+0(FP),AX // addr of first arg
MOVQ -8(AX),AX // get calling pc MOVQ -8(AX),AX // get calling pc
RET RET
TEXT sys·setcallerpc+0(SB),7,$0 TEXT runtime·setcallerpc+0(SB),7,$0
MOVQ x+0(FP),AX // addr of first arg MOVQ x+0(FP),AX // addr of first arg
MOVQ x+8(FP), BX MOVQ x+8(FP), BX
MOVQ BX, -8(AX) // set calling pc MOVQ BX, -8(AX) // set calling pc
......
...@@ -22,7 +22,7 @@ TEXT exit(SB),7,$0 ...@@ -22,7 +22,7 @@ TEXT exit(SB),7,$0
// Exit value already in R0 // Exit value already in R0
SWI $SYS_exit SWI $SYS_exit
TEXT sys·mmap(SB),7,$0 TEXT runtime·mmap(SB),7,$0
MOVW 0(FP), R0 MOVW 0(FP), R0
MOVW 4(FP), R1 MOVW 4(FP), R1
MOVW 8(FP), R2 MOVW 8(FP), R2
......
...@@ -49,11 +49,11 @@ futexsleep(uint32 *addr, uint32 val) ...@@ -49,11 +49,11 @@ futexsleep(uint32 *addr, uint32 val)
return; return;
prints("futexsleep addr="); prints("futexsleep addr=");
sys·printpointer(addr); runtime·printpointer(addr);
prints(" val="); prints(" val=");
sys·printint(val); runtime·printint(val);
prints(" returned "); prints(" returned ");
sys·printint(ret); runtime·printint(ret);
prints("\n"); prints("\n");
*(int32*)0x1005 = 0x1005; *(int32*)0x1005 = 0x1005;
} }
...@@ -74,9 +74,9 @@ futexwakeup(uint32 *addr) ...@@ -74,9 +74,9 @@ futexwakeup(uint32 *addr)
// safe to loop and call futex again. // safe to loop and call futex again.
prints("futexwakeup addr="); prints("futexwakeup addr=");
sys·printpointer(addr); runtime·printpointer(addr);
prints(" returned "); prints(" returned ");
sys·printint(ret); runtime·printint(ret);
prints("\n"); prints("\n");
*(int32*)0x1006 = 0x1006; *(int32*)0x1006 = 0x1006;
} }
......
...@@ -113,7 +113,7 @@ free(void *v) ...@@ -113,7 +113,7 @@ free(void *v)
if(sizeclass == 0) { if(sizeclass == 0) {
// Large object. // Large object.
mstats.alloc -= s->npages<<PageShift; mstats.alloc -= s->npages<<PageShift;
sys_memclr(v, s->npages<<PageShift); runtime_memclr(v, s->npages<<PageShift);
MHeap_Free(&mheap, s); MHeap_Free(&mheap, s);
goto out; goto out;
} }
...@@ -123,7 +123,7 @@ free(void *v) ...@@ -123,7 +123,7 @@ free(void *v)
// Small object. // Small object.
c = m->mcache; c = m->mcache;
size = class_to_size[sizeclass]; size = class_to_size[sizeclass];
sys_memclr(v, size); runtime_memclr(v, size);
mstats.alloc -= size; mstats.alloc -= size;
MCache_Free(c, v, sizeclass, size); MCache_Free(c, v, sizeclass, size);
...@@ -209,7 +209,7 @@ void* ...@@ -209,7 +209,7 @@ void*
SysAlloc(uintptr n) SysAlloc(uintptr n)
{ {
mstats.sys += n; mstats.sys += n;
return sys_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0); return runtime_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0);
} }
void void
......
...@@ -19,7 +19,7 @@ brk(uint32 n) ...@@ -19,7 +19,7 @@ brk(uint32 n)
{ {
byte *v; byte *v;
v = sys_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0); v = runtime_mmap(nil, n, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0);
m->mem.nmmap += n; m->mem.nmmap += n;
return v; return v;
} }
...@@ -51,10 +51,10 @@ oldmal(uint32 n) ...@@ -51,10 +51,10 @@ oldmal(uint32 n)
// hunk, and then once brk returned we'd immediately // hunk, and then once brk returned we'd immediately
// overwrite that hunk with our own. // overwrite that hunk with our own.
// (the net result would be a memory leak, not a crash.) // (the net result would be a memory leak, not a crash.)
// so we have to call sys_mmap directly - it is written // so we have to call runtime_mmap directly - it is written
// in assembly and tagged not to grow the stack. // in assembly and tagged not to grow the stack.
m->mem.hunk = m->mem.hunk =
sys_mmap(nil, NHUNK, PROT_READ|PROT_WRITE|PROT_EXEC, runtime_mmap(nil, NHUNK, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_ANON|MAP_PRIVATE, 0, 0); MAP_ANON|MAP_PRIVATE, 0, 0);
m->mem.nhunk = NHUNK; m->mem.nhunk = NHUNK;
m->mem.nmmap += NHUNK; m->mem.nmmap += NHUNK;
...@@ -68,7 +68,7 @@ oldmal(uint32 n) ...@@ -68,7 +68,7 @@ oldmal(uint32 n)
} }
void void
sys·mal(uint32 n, uint8 *ret) runtime·mal(uint32 n, uint8 *ret)
{ {
ret = mal(n); ret = mal(n);
FLUSH(&ret); FLUSH(&ret);
......
...@@ -84,7 +84,7 @@ MHeapMap_Preallocate(MHeapMap *m, PageID k, uintptr len) ...@@ -84,7 +84,7 @@ MHeapMap_Preallocate(MHeapMap *m, PageID k, uintptr len)
p2 = m->allocator(sizeof *p2); p2 = m->allocator(sizeof *p2);
if(p2 == nil) if(p2 == nil)
return false; return false;
sys_memclr((byte*)p2, sizeof *p2); runtime_memclr((byte*)p2, sizeof *p2);
m->p[i1] = p2; m->p[i1] = p2;
} }
......
...@@ -96,7 +96,7 @@ MHeapMap_Preallocate(MHeapMap *m, PageID k, uintptr len) ...@@ -96,7 +96,7 @@ MHeapMap_Preallocate(MHeapMap *m, PageID k, uintptr len)
p2 = m->allocator(sizeof *p2); p2 = m->allocator(sizeof *p2);
if(p2 == nil) if(p2 == nil)
return false; return false;
sys_memclr((byte*)p2, sizeof *p2); runtime_memclr((byte*)p2, sizeof *p2);
m->p[i1] = p2; m->p[i1] = p2;
} }
...@@ -105,7 +105,7 @@ MHeapMap_Preallocate(MHeapMap *m, PageID k, uintptr len) ...@@ -105,7 +105,7 @@ MHeapMap_Preallocate(MHeapMap *m, PageID k, uintptr len)
p3 = m->allocator(sizeof *p3); p3 = m->allocator(sizeof *p3);
if(p3 == nil) if(p3 == nil)
return false; return false;
sys_memclr((byte*)p3, sizeof *p3); runtime_memclr((byte*)p3, sizeof *p3);
p2->p[i2] = p3; p2->p[i2] = p3;
} }
......
...@@ -54,7 +54,7 @@ TEXT mutex_unlock(SB),7,$0 ...@@ -54,7 +54,7 @@ TEXT mutex_unlock(SB),7,$0
TEXT thread_create(SB),7,$0 TEXT thread_create(SB),7,$0
JMP SYSCALL(thread_create) JMP SYSCALL(thread_create)
TEXT sys·mmap(SB),7,$24 TEXT runtime·mmap(SB),7,$24
MOVL a1+0(FP), BX MOVL a1+0(FP), BX
MOVL a2+4(FP), CX // round up to 64 kB boundary; silences nacl warning MOVL a2+4(FP), CX // round up to 64 kB boundary; silences nacl warning
ADDL $(64*1024-1), CX ADDL $(64*1024-1), CX
......
...@@ -12,8 +12,8 @@ dump(byte *p, int32 n) ...@@ -12,8 +12,8 @@ dump(byte *p, int32 n)
int32 i; int32 i;
for(i=0; i<n; i++) { for(i=0; i<n; i++) {
sys·printpointer((byte*)(p[i]>>4)); runtime·printpointer((byte*)(p[i]>>4));
sys·printpointer((byte*)(p[i]&0xf)); runtime·printpointer((byte*)(p[i]&0xf));
if((i&15) == 15) if((i&15) == 15)
prints("\n"); prints("\n");
else else
...@@ -73,25 +73,25 @@ printf(int8 *s, ...) ...@@ -73,25 +73,25 @@ printf(int8 *s, ...)
} }
switch(*p) { switch(*p) {
case 'd': case 'd':
sys·printint(*(int32*)arg); runtime·printint(*(int32*)arg);
break; break;
case 'D': case 'D':
sys·printint(*(int64*)arg); runtime·printint(*(int64*)arg);
break; break;
case 'x': case 'x':
sys·printhex(*(uint32*)arg); runtime·printhex(*(uint32*)arg);
break; break;
case 'X': case 'X':
sys·printhex(*(uint64*)arg); runtime·printhex(*(uint64*)arg);
break; break;
case 'p': case 'p':
sys·printpointer(*(void**)arg); runtime·printpointer(*(void**)arg);
break; break;
case 's': case 's':
prints(*(int8**)arg); prints(*(int8**)arg);
break; break;
case 'S': case 'S':
sys·printstring(*(String*)arg); runtime·printstring(*(String*)arg);
break; break;
} }
arg = narg; arg = narg;
...@@ -105,14 +105,14 @@ printf(int8 *s, ...) ...@@ -105,14 +105,14 @@ printf(int8 *s, ...)
void void
sys·printpc(void *p) runtime·printpc(void *p)
{ {
prints("PC="); prints("PC=");
sys·printhex((uint64)sys·getcallerpc(p)); runtime·printhex((uint64)runtime·getcallerpc(p));
} }
void void
sys·printbool(bool v) runtime·printbool(bool v)
{ {
if(v) { if(v) {
write(fd, (byte*)"true", 4); write(fd, (byte*)"true", 4);
...@@ -122,7 +122,7 @@ sys·printbool(bool v) ...@@ -122,7 +122,7 @@ sys·printbool(bool v)
} }
void void
sys·printfloat(float64 v) runtime·printfloat(float64 v)
{ {
byte buf[20]; byte buf[20];
int32 e, s, i, n; int32 e, s, i, n;
...@@ -200,7 +200,7 @@ sys·printfloat(float64 v) ...@@ -200,7 +200,7 @@ sys·printfloat(float64 v)
} }
void void
sys·printuint(uint64 v) runtime·printuint(uint64 v)
{ {
byte buf[100]; byte buf[100];
int32 i; int32 i;
...@@ -215,17 +215,17 @@ sys·printuint(uint64 v) ...@@ -215,17 +215,17 @@ sys·printuint(uint64 v)
} }
void void
sys·printint(int64 v) runtime·printint(int64 v)
{ {
if(v < 0) { if(v < 0) {
write(fd, "-", 1); write(fd, "-", 1);
v = -v; v = -v;
} }
sys·printuint(v); runtime·printuint(v);
} }
void void
sys·printhex(uint64 v) runtime·printhex(uint64 v)
{ {
static int8 *dig = "0123456789abcdef"; static int8 *dig = "0123456789abcdef";
byte buf[100]; byte buf[100];
...@@ -242,13 +242,13 @@ sys·printhex(uint64 v) ...@@ -242,13 +242,13 @@ sys·printhex(uint64 v)
} }
void void
sys·printpointer(void *p) runtime·printpointer(void *p)
{ {
sys·printhex((uint64)p); runtime·printhex((uint64)p);
} }
void void
sys·printstring(String v) runtime·printstring(String v)
{ {
extern int32 maxstring; extern int32 maxstring;
...@@ -261,13 +261,13 @@ sys·printstring(String v) ...@@ -261,13 +261,13 @@ sys·printstring(String v)
} }
void void
sys·printsp(void) runtime·printsp(void)
{ {
write(fd, " ", 1); write(fd, " ", 1);
} }
void void
sys·printnl(void) runtime·printnl(void)
{ {
write(fd, "\n", 1); write(fd, "\n", 1);
} }
...@@ -522,7 +522,7 @@ gosched(void) ...@@ -522,7 +522,7 @@ gosched(void)
// from the low-level system calls used by the runtime. // from the low-level system calls used by the runtime.
// The "arguments" are syscall.Syscall's stack frame // The "arguments" are syscall.Syscall's stack frame
void void
sys·entersyscall(uint64 callerpc, int64 trap) runtime·entersyscall(uint64 callerpc, int64 trap)
{ {
USED(callerpc, trap); USED(callerpc, trap);
...@@ -552,7 +552,7 @@ sys·entersyscall(uint64 callerpc, int64 trap) ...@@ -552,7 +552,7 @@ sys·entersyscall(uint64 callerpc, int64 trap)
// This is called only from the go syscall library, not // This is called only from the go syscall library, not
// from the low-level system calls used by the runtime. // from the low-level system calls used by the runtime.
void void
sys·exitsyscall(void) runtime·exitsyscall(void)
{ {
lock(&sched); lock(&sched);
if(sched.predawn) { if(sched.predawn) {
...@@ -715,7 +715,7 @@ newstack(void) ...@@ -715,7 +715,7 @@ newstack(void)
// Continue as if lessstack had just called m->morepc // Continue as if lessstack had just called m->morepc
// (the PC that decided to grow the stack). // (the PC that decided to grow the stack).
label.sp = sp; label.sp = sp;
label.pc = (byte*)sys·lessstack; label.pc = (byte*)runtime·lessstack;
label.g = m->curg; label.g = m->curg;
gogocall(&label, m->morepc); gogocall(&label, m->morepc);
...@@ -747,7 +747,7 @@ malg(int32 stacksize) ...@@ -747,7 +747,7 @@ malg(int32 stacksize)
*/ */
#pragma textflag 7 #pragma textflag 7
void void
sys·newproc(int32 siz, byte* fn, byte* arg0) runtime·newproc(int32 siz, byte* fn, byte* arg0)
{ {
byte *stk, *sp; byte *stk, *sp;
G *newg; G *newg;
...@@ -756,7 +756,7 @@ sys·newproc(int32 siz, byte* fn, byte* arg0) ...@@ -756,7 +756,7 @@ sys·newproc(int32 siz, byte* fn, byte* arg0)
siz = (siz+7) & ~7; siz = (siz+7) & ~7;
if(siz > 1024) if(siz > 1024)
throw("sys·newproc: too many args"); throw("runtime·newproc: too many args");
lock(&sched); lock(&sched);
...@@ -795,7 +795,7 @@ sys·newproc(int32 siz, byte* fn, byte* arg0) ...@@ -795,7 +795,7 @@ sys·newproc(int32 siz, byte* fn, byte* arg0)
#pragma textflag 7 #pragma textflag 7
void void
sys·deferproc(int32 siz, byte* fn, byte* arg0) runtime·deferproc(int32 siz, byte* fn, byte* arg0)
{ {
Defer *d; Defer *d;
...@@ -811,7 +811,7 @@ sys·deferproc(int32 siz, byte* fn, byte* arg0) ...@@ -811,7 +811,7 @@ sys·deferproc(int32 siz, byte* fn, byte* arg0)
#pragma textflag 7 #pragma textflag 7
void void
sys·deferreturn(uintptr arg0) runtime·deferreturn(uintptr arg0)
{ {
Defer *d; Defer *d;
byte *sp, *fn; byte *sp, *fn;
......
...@@ -20,7 +20,7 @@ gotraceback(void) ...@@ -20,7 +20,7 @@ gotraceback(void)
} }
void void
sys·panicl(int32 lno) runtime·panicl(int32 lno)
{ {
uint8 *sp; uint8 *sp;
...@@ -34,7 +34,7 @@ sys·panicl(int32 lno) ...@@ -34,7 +34,7 @@ sys·panicl(int32 lno)
printf("\npanic PC=%X\n", (uint64)(uintptr)&lno); printf("\npanic PC=%X\n", (uint64)(uintptr)&lno);
sp = (uint8*)&lno; sp = (uint8*)&lno;
if(gotraceback()){ if(gotraceback()){
traceback(sys·getcallerpc(&lno), sp, g); traceback(runtime·getcallerpc(&lno), sp, g);
tracebackothers(g); tracebackothers(g);
} }
breakpoint(); // so we can grab it in a debugger breakpoint(); // so we can grab it in a debugger
...@@ -42,25 +42,25 @@ sys·panicl(int32 lno) ...@@ -42,25 +42,25 @@ sys·panicl(int32 lno)
} }
void void
sys·throwindex(void) runtime·throwindex(void)
{ {
throw("index out of range"); throw("index out of range");
} }
void void
sys·throwslice(void) runtime·throwslice(void)
{ {
throw("slice out of range"); throw("slice out of range");
} }
void void
sys·throwreturn(void) runtime·throwreturn(void)
{ {
throw("no return at end of a typed function"); throw("no return at end of a typed function");
} }
void void
sys·throwinit(void) runtime·throwinit(void)
{ {
throw("recursive call during initialization"); throw("recursive call during initialization");
} }
...@@ -70,7 +70,7 @@ throw(int8 *s) ...@@ -70,7 +70,7 @@ throw(int8 *s)
{ {
fd = 2; fd = 2;
printf("throw: %s\n", s); printf("throw: %s\n", s);
sys·panicl(-1); runtime·panicl(-1);
*(int32*)0 = 0; // not reached *(int32*)0 = 0; // not reached
exit(1); // even more not reached exit(1); // even more not reached
} }
...@@ -332,7 +332,7 @@ memprint(uint32 s, void *a) ...@@ -332,7 +332,7 @@ memprint(uint32 s, void *a)
v = *(uint64*)a; v = *(uint64*)a;
break; break;
} }
sys·printint(v); runtime·printint(v);
} }
static void static void
...@@ -370,7 +370,7 @@ static void ...@@ -370,7 +370,7 @@ static void
strprint(uint32 s, String *a) strprint(uint32 s, String *a)
{ {
USED(s); USED(s);
sys·printstring(*a); runtime·printstring(*a);
} }
static uintptr static uintptr
...@@ -384,7 +384,7 @@ static void ...@@ -384,7 +384,7 @@ static void
interprint(uint32 s, Iface *a) interprint(uint32 s, Iface *a)
{ {
USED(s); USED(s);
sys·printiface(*a); runtime·printiface(*a);
} }
static uint32 static uint32
...@@ -405,7 +405,7 @@ static void ...@@ -405,7 +405,7 @@ static void
nilinterprint(uint32 s, Eface *a) nilinterprint(uint32 s, Eface *a)
{ {
USED(s); USED(s);
sys·printeface(*a); runtime·printeface(*a);
} }
static uint32 static uint32
......
...@@ -330,7 +330,7 @@ int32 charntorune(int32*, uint8*, int32); ...@@ -330,7 +330,7 @@ int32 charntorune(int32*, uint8*, int32);
void gogo(Gobuf*, uintptr); void gogo(Gobuf*, uintptr);
void gogocall(Gobuf*, void(*)(void)); void gogocall(Gobuf*, void(*)(void));
uintptr gosave(Gobuf*); uintptr gosave(Gobuf*);
void sys·lessstack(void); void runtime·lessstack(void);
void goargs(void); void goargs(void);
void FLUSH(void*); void FLUSH(void*);
void* getu(void); void* getu(void);
...@@ -430,45 +430,45 @@ void notewakeup(Note*); ...@@ -430,45 +430,45 @@ void notewakeup(Note*);
* UTF-8 characters in identifiers. * UTF-8 characters in identifiers.
*/ */
#ifndef __GNUC__ #ifndef __GNUC__
#define sys_memclr sys·memclr #define runtime_memclr runtime·memclr
#define sys_getcallerpc sys·getcallerpc #define runtime_getcallerpc runtime·getcallerpc
#define sys_mmap sys·mmap #define runtime_mmap runtime·mmap
#define sys_printslice sys·printslice #define runtime_printslice runtime·printslice
#define sys_printbool sys·printbool #define runtime_printbool runtime·printbool
#define sys_printfloat sys·printfloat #define runtime_printfloat runtime·printfloat
#define sys_printhex sys·printhex #define runtime_printhex runtime·printhex
#define sys_printint sys·printint #define runtime_printint runtime·printint
#define sys_printiface sys·printiface #define runtime_printiface runtime·printiface
#define sys_printeface sys·printeface #define runtime_printeface runtime·printeface
#define sys_printpc sys·printpc #define runtime_printpc runtime·printpc
#define sys_printpointer sys·printpointer #define runtime_printpointer runtime·printpointer
#define sys_printstring sys·printstring #define runtime_printstring runtime·printstring
#define sys_printuint sys·printuint #define runtime_printuint runtime·printuint
#define sys_setcallerpc sys·setcallerpc #define runtime_setcallerpc runtime·setcallerpc
#endif #endif
/* /*
* low level go-called * low level go-called
*/ */
uint8* sys_mmap(byte*, uint32, int32, int32, int32, uint32); uint8* runtime_mmap(byte*, uint32, int32, int32, int32, uint32);
void sys_memclr(byte*, uint32); void runtime_memclr(byte*, uint32);
void sys_setcallerpc(void*, void*); void runtime_setcallerpc(void*, void*);
void* sys_getcallerpc(void*); void* runtime_getcallerpc(void*);
/* /*
* runtime go-called * runtime go-called
*/ */
void sys_printbool(bool); void runtime_printbool(bool);
void sys_printfloat(float64); void runtime_printfloat(float64);
void sys_printint(int64); void runtime_printint(int64);
void sys_printiface(Iface); void runtime_printiface(Iface);
void sys_printeface(Eface); void runtime_printeface(Eface);
void sys_printstring(String); void runtime_printstring(String);
void sys_printpc(void*); void runtime_printpc(void*);
void sys_printpointer(void*); void runtime_printpointer(void*);
void sys_printuint(uint64); void runtime_printuint(uint64);
void sys_printhex(uint64); void runtime_printhex(uint64);
void sys_printslice(Slice); void runtime_printslice(Slice);
/* /*
* wrapped for go users * wrapped for go users
......
...@@ -8,7 +8,7 @@ static int32 debug = 0; ...@@ -8,7 +8,7 @@ static int32 debug = 0;
// makeslice(nel int, cap int, width int) (ary []any); // makeslice(nel int, cap int, width int) (ary []any);
void void
sys·makeslice(uint32 nel, uint32 cap, uint32 width, Slice ret) runtime·makeslice(uint32 nel, uint32 cap, uint32 width, Slice ret)
{ {
uint64 size; uint64 size;
...@@ -24,13 +24,13 @@ sys·makeslice(uint32 nel, uint32 cap, uint32 width, Slice ret) ...@@ -24,13 +24,13 @@ sys·makeslice(uint32 nel, uint32 cap, uint32 width, Slice ret)
if(debug) { if(debug) {
prints("makeslice: nel="); prints("makeslice: nel=");
sys·printint(nel); runtime·printint(nel);
prints("; cap="); prints("; cap=");
sys·printint(cap); runtime·printint(cap);
prints("; width="); prints("; width=");
sys·printint(width); runtime·printint(width);
prints("; ret="); prints("; ret=");
sys·printslice(ret); runtime·printslice(ret);
prints("\n"); prints("\n");
} }
} }
...@@ -39,36 +39,36 @@ static void ...@@ -39,36 +39,36 @@ static void
throwslice(uint32 lb, uint32 hb, uint32 n) throwslice(uint32 lb, uint32 hb, uint32 n)
{ {
prints("slice["); prints("slice[");
sys·printint(lb); runtime·printint(lb);
prints(":"); prints(":");
sys·printint(hb); runtime·printint(hb);
prints("] of ["); prints("] of [");
sys·printint(n); runtime·printint(n);
prints("] array\n"); prints("] array\n");
throw("array slice"); throw("array slice");
} }
// sliceslice(old []any, lb int, hb int, width int) (ary []any); // sliceslice(old []any, lb int, hb int, width int) (ary []any);
void void
sys·sliceslice(Slice old, uint32 lb, uint32 hb, uint32 width, Slice ret) runtime·sliceslice(Slice old, uint32 lb, uint32 hb, uint32 width, Slice ret)
{ {
if(hb > old.cap || lb > hb) { if(hb > old.cap || lb > hb) {
if(debug) { if(debug) {
prints("sys·sliceslice: old="); prints("runtime·sliceslice: old=");
sys·printslice(old); runtime·printslice(old);
prints("; lb="); prints("; lb=");
sys·printint(lb); runtime·printint(lb);
prints("; hb="); prints("; hb=");
sys·printint(hb); runtime·printint(hb);
prints("; width="); prints("; width=");
sys·printint(width); runtime·printint(width);
prints("\n"); prints("\n");
prints("oldarray: nel="); prints("oldarray: nel=");
sys·printint(old.len); runtime·printint(old.len);
prints("; cap="); prints("; cap=");
sys·printint(old.cap); runtime·printint(old.cap);
prints("\n"); prints("\n");
} }
throwslice(lb, hb, old.cap); throwslice(lb, hb, old.cap);
...@@ -82,37 +82,37 @@ sys·sliceslice(Slice old, uint32 lb, uint32 hb, uint32 width, Slice ret) ...@@ -82,37 +82,37 @@ sys·sliceslice(Slice old, uint32 lb, uint32 hb, uint32 width, Slice ret)
FLUSH(&ret); FLUSH(&ret);
if(debug) { if(debug) {
prints("sys·sliceslice: old="); prints("runtime·sliceslice: old=");
sys·printslice(old); runtime·printslice(old);
prints("; lb="); prints("; lb=");
sys·printint(lb); runtime·printint(lb);
prints("; hb="); prints("; hb=");
sys·printint(hb); runtime·printint(hb);
prints("; width="); prints("; width=");
sys·printint(width); runtime·printint(width);
prints("; ret="); prints("; ret=");
sys·printslice(ret); runtime·printslice(ret);
prints("\n"); prints("\n");
} }
} }
// slicearray(old *any, nel int, lb int, hb int, width int) (ary []any); // slicearray(old *any, nel int, lb int, hb int, width int) (ary []any);
void void
sys·slicearray(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Slice ret) runtime·slicearray(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Slice ret)
{ {
if(hb > nel || lb > hb) { if(hb > nel || lb > hb) {
if(debug) { if(debug) {
prints("sys·slicearray: old="); prints("runtime·slicearray: old=");
sys·printpointer(old); runtime·printpointer(old);
prints("; nel="); prints("; nel=");
sys·printint(nel); runtime·printint(nel);
prints("; lb="); prints("; lb=");
sys·printint(lb); runtime·printint(lb);
prints("; hb="); prints("; hb=");
sys·printint(hb); runtime·printint(hb);
prints("; width="); prints("; width=");
sys·printint(width); runtime·printint(width);
prints("\n"); prints("\n");
} }
throwslice(lb, hb, nel); throwslice(lb, hb, nel);
...@@ -126,25 +126,25 @@ sys·slicearray(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Slice ...@@ -126,25 +126,25 @@ sys·slicearray(byte* old, uint32 nel, uint32 lb, uint32 hb, uint32 width, Slice
FLUSH(&ret); FLUSH(&ret);
if(debug) { if(debug) {
prints("sys·slicearray: old="); prints("runtime·slicearray: old=");
sys·printpointer(old); runtime·printpointer(old);
prints("; nel="); prints("; nel=");
sys·printint(nel); runtime·printint(nel);
prints("; lb="); prints("; lb=");
sys·printint(lb); runtime·printint(lb);
prints("; hb="); prints("; hb=");
sys·printint(hb); runtime·printint(hb);
prints("; width="); prints("; width=");
sys·printint(width); runtime·printint(width);
prints("; ret="); prints("; ret=");
sys·printslice(ret); runtime·printslice(ret);
prints("\n"); prints("\n");
} }
} }
// arraytoslice(old *any, nel int) (ary []any) // arraytoslice(old *any, nel int) (ary []any)
void void
sys·arraytoslice(byte* old, uint32 nel, Slice ret) runtime·arraytoslice(byte* old, uint32 nel, Slice ret)
{ {
// new dope to old array // new dope to old array
...@@ -155,21 +155,21 @@ sys·arraytoslice(byte* old, uint32 nel, Slice ret) ...@@ -155,21 +155,21 @@ sys·arraytoslice(byte* old, uint32 nel, Slice ret)
FLUSH(&ret); FLUSH(&ret);
if(debug) { if(debug) {
prints("sys·slicearrayp: old="); prints("runtime·slicearrayp: old=");
sys·printpointer(old); runtime·printpointer(old);
prints("; ret="); prints("; ret=");
sys·printslice(ret); runtime·printslice(ret);
prints("\n"); prints("\n");
} }
} }
void void
sys·printslice(Slice a) runtime·printslice(Slice a)
{ {
prints("["); prints("[");
sys·printint(a.len); runtime·printint(a.len);
prints("/"); prints("/");
sys·printint(a.cap); runtime·printint(a.cap);
prints("]"); prints("]");
sys·printpointer(a.array); runtime·printpointer(a.array);
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package sys package runtime
#include "runtime.h" #include "runtime.h"
String emptystring; String emptystring;
...@@ -68,11 +68,11 @@ prbounds(int8* s, int32 a, int32 b, int32 c) ...@@ -68,11 +68,11 @@ prbounds(int8* s, int32 a, int32 b, int32 c)
{ {
prints(s); prints(s);
prints(" "); prints(" ");
sys·printint(a); runtime·printint(a);
prints("<"); prints("<");
sys·printint(b); runtime·printint(b);
prints(">"); prints(">");
sys·printint(c); runtime·printint(c);
prints("\n"); prints("\n");
throw("string bounds"); throw("string bounds");
} }
...@@ -128,7 +128,7 @@ func slicestring(si String, lindex int32, hindex int32) (so String) { ...@@ -128,7 +128,7 @@ func slicestring(si String, lindex int32, hindex int32) (so String) {
if(lindex < 0 || lindex > si.len || if(lindex < 0 || lindex > si.len ||
hindex < lindex || hindex > si.len) { hindex < lindex || hindex > si.len) {
sys·printpc(&si); runtime·printpc(&si);
prints(" "); prints(" ");
prbounds("slice", lindex, si.len, hindex); prbounds("slice", lindex, si.len, hindex);
} }
...@@ -144,7 +144,7 @@ func slicestring(si String, lindex int32, hindex int32) (so String) { ...@@ -144,7 +144,7 @@ func slicestring(si String, lindex int32, hindex int32) (so String) {
func indexstring(s String, i int32) (b byte) { func indexstring(s String, i int32) (b byte) {
if(i < 0 || i >= s.len) { if(i < 0 || i >= s.len) {
sys·printpc(&s); runtime·printpc(&s);
prints(" "); prints(" ");
prbounds("index", 0, i, s.len); prbounds("index", 0, i, s.len);
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// Return a pointer to a byte array containing the symbol table segment. // Return a pointer to a byte array containing the symbol table segment.
void void
sys·symdat(Slice *symtab, Slice *pclntab) runtime·symdat(Slice *symtab, Slice *pclntab)
{ {
Slice *a; Slice *a;
int32 *v; int32 *v;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
// Trap # in AX, args on stack above caller pc. // Trap # in AX, args on stack above caller pc.
TEXT syscall·Syscall(SB),7,$0 TEXT syscall·Syscall(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number // slide args down on top of system call number
LEAL 8(SP), SI LEAL 8(SP), SI
...@@ -25,17 +25,17 @@ TEXT syscall·Syscall(SB),7,$0 ...@@ -25,17 +25,17 @@ TEXT syscall·Syscall(SB),7,$0
MOVL $-1, 20(SP) // r1 MOVL $-1, 20(SP) // r1
MOVL $-1, 24(SP) // r2 MOVL $-1, 24(SP) // r2
MOVL AX, 28(SP) // errno MOVL AX, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok: ok:
MOVL AX, 20(SP) // r1 MOVL AX, 20(SP) // r1
MOVL DX, 24(SP) // r2 MOVL DX, 24(SP) // r2
MOVL $0, 28(SP) // errno MOVL $0, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
TEXT syscall·Syscall6(SB),7,$0 TEXT syscall·Syscall6(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry MOVL 4(SP), AX // syscall entry
// slide args down on top of system call number // slide args down on top of system call number
LEAL 8(SP), SI LEAL 8(SP), SI
...@@ -52,13 +52,13 @@ TEXT syscall·Syscall6(SB),7,$0 ...@@ -52,13 +52,13 @@ TEXT syscall·Syscall6(SB),7,$0
MOVL $-1, 32(SP) // r1 MOVL $-1, 32(SP) // r1
MOVL $-1, 36(SP) // r2 MOVL $-1, 36(SP) // r2
MOVL AX, 40(SP) // errno MOVL AX, 40(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok6: ok6:
MOVL AX, 32(SP) // r1 MOVL AX, 32(SP) // r1
MOVL DX, 36(SP) // r2 MOVL DX, 36(SP) // r2
MOVL $0, 40(SP) // errno MOVL $0, 40(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
TEXT syscall·RawSyscall(SB),7,$0 TEXT syscall·RawSyscall(SB),7,$0
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
// Trap # in AX, args in DI SI DX, return in AX DX // Trap # in AX, args in DI SI DX, return in AX DX
TEXT syscall·Syscall(SB),7,$0 TEXT syscall·Syscall(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI MOVQ 16(SP), DI
MOVQ 24(SP), SI MOVQ 24(SP), SI
MOVQ 32(SP), DX MOVQ 32(SP), DX
...@@ -25,17 +25,17 @@ TEXT syscall·Syscall(SB),7,$0 ...@@ -25,17 +25,17 @@ TEXT syscall·Syscall(SB),7,$0
MOVQ $-1, 40(SP) // r1 MOVQ $-1, 40(SP) // r1
MOVQ $0, 48(SP) // r2 MOVQ $0, 48(SP) // r2
MOVQ AX, 56(SP) // errno MOVQ AX, 56(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok: ok:
MOVQ AX, 40(SP) // r1 MOVQ AX, 40(SP) // r1
MOVQ DX, 48(SP) // r2 MOVQ DX, 48(SP) // r2
MOVQ $0, 56(SP) // errno MOVQ $0, 56(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
TEXT syscall·Syscall6(SB),7,$0 TEXT syscall·Syscall6(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI MOVQ 16(SP), DI
MOVQ 24(SP), SI MOVQ 24(SP), SI
MOVQ 32(SP), DX MOVQ 32(SP), DX
...@@ -49,13 +49,13 @@ TEXT syscall·Syscall6(SB),7,$0 ...@@ -49,13 +49,13 @@ TEXT syscall·Syscall6(SB),7,$0
MOVQ $-1, 64(SP) // r1 MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2 MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno MOVQ AX, 80(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok6: ok6:
MOVQ AX, 64(SP) // r1 MOVQ AX, 64(SP) // r1
MOVQ DX, 72(SP) // r2 MOVQ DX, 72(SP) // r2
MOVQ $0, 80(SP) // errno MOVQ $0, 80(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
TEXT syscall·RawSyscall(SB),7,$0 TEXT syscall·RawSyscall(SB),7,$0
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// Trap # in AX, args in BX CX DX SI DI, return in AX // Trap # in AX, args in BX CX DX SI DI, return in AX
TEXT syscall·Syscall(SB),7,$0 TEXT syscall·Syscall(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX MOVL 8(SP), BX
MOVL 12(SP), CX MOVL 12(SP), CX
...@@ -24,19 +24,19 @@ TEXT syscall·Syscall(SB),7,$0 ...@@ -24,19 +24,19 @@ TEXT syscall·Syscall(SB),7,$0
MOVL $0, 24(SP) // r2 MOVL $0, 24(SP) // r2
NEGL AX NEGL AX
MOVL AX, 28(SP) // errno MOVL AX, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok: ok:
MOVL AX, 20(SP) // r1 MOVL AX, 20(SP) // r1
MOVL DX, 24(SP) // r2 MOVL DX, 24(SP) // r2
MOVL $0, 28(SP) // errno MOVL $0, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr); // func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually Syscall5 but the rest of the code expects it to be named Syscall6. // Actually Syscall5 but the rest of the code expects it to be named Syscall6.
TEXT syscall·Syscall6(SB),7,$0 TEXT syscall·Syscall6(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL 4(SP), AX // syscall entry MOVL 4(SP), AX // syscall entry
MOVL 8(SP), BX MOVL 8(SP), BX
MOVL 12(SP), CX MOVL 12(SP), CX
...@@ -51,13 +51,13 @@ TEXT syscall·Syscall6(SB),7,$0 ...@@ -51,13 +51,13 @@ TEXT syscall·Syscall6(SB),7,$0
MOVL $0, 36(SP) // r2 MOVL $0, 36(SP) // r2
NEGL AX NEGL AX
MOVL AX, 40(SP) // errno MOVL AX, 40(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok6: ok6:
MOVL AX, 32(SP) // r1 MOVL AX, 32(SP) // r1
MOVL DX, 36(SP) // r2 MOVL DX, 36(SP) // r2
MOVL $0, 40(SP) // errno MOVL $0, 40(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr); // func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
...@@ -75,7 +75,7 @@ TEXT syscall·RawSyscall(SB),7,$0 ...@@ -75,7 +75,7 @@ TEXT syscall·RawSyscall(SB),7,$0
MOVL $0, 24(SP) // r2 MOVL $0, 24(SP) // r2
NEGL AX NEGL AX
MOVL AX, 28(SP) // errno MOVL AX, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok1: ok1:
MOVL AX, 20(SP) // r1 MOVL AX, 20(SP) // r1
...@@ -88,7 +88,7 @@ ok1: ...@@ -88,7 +88,7 @@ ok1:
// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int) // func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
// Kernel interface gets call sub-number and pointer to a0. // Kernel interface gets call sub-number and pointer to a0.
TEXT syscall·socketcall(SB),7,$0 TEXT syscall·socketcall(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL $SYS_SOCKETCALL, AX // syscall entry MOVL $SYS_SOCKETCALL, AX // syscall entry
MOVL 4(SP), BX // socket call number MOVL 4(SP), BX // socket call number
LEAL 8(SP), CX // pointer to call arguments LEAL 8(SP), CX // pointer to call arguments
...@@ -101,12 +101,12 @@ TEXT syscall·socketcall(SB),7,$0 ...@@ -101,12 +101,12 @@ TEXT syscall·socketcall(SB),7,$0
MOVL $-1, 32(SP) // n MOVL $-1, 32(SP) // n
NEGL AX NEGL AX
MOVL AX, 36(SP) // errno MOVL AX, 36(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
oksock: oksock:
MOVL AX, 32(SP) // n MOVL AX, 32(SP) // n
MOVL $0, 36(SP) // errno MOVL $0, 36(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
#define SYS__LLSEEK 140 /* from zsysnum_linux_386.go */ #define SYS__LLSEEK 140 /* from zsysnum_linux_386.go */
...@@ -116,7 +116,7 @@ oksock: ...@@ -116,7 +116,7 @@ oksock:
// Underlying system call is // Underlying system call is
// llseek(int fd, int offhi, int offlo, int64 *result, int whence) // llseek(int fd, int offhi, int offlo, int64 *result, int whence)
TEXT syscall·Seek(SB),7,$0 TEXT syscall·Seek(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL $SYS__LLSEEK, AX // syscall entry MOVL $SYS__LLSEEK, AX // syscall entry
MOVL 4(SP), BX // fd MOVL 4(SP), BX // fd
MOVL 12(SP), CX // offset-high MOVL 12(SP), CX // offset-high
...@@ -130,10 +130,10 @@ TEXT syscall·Seek(SB),7,$0 ...@@ -130,10 +130,10 @@ TEXT syscall·Seek(SB),7,$0
MOVL $-1, 24(SP) // newoffset high MOVL $-1, 24(SP) // newoffset high
NEGL AX NEGL AX
MOVL AX, 28(SP) // errno MOVL AX, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
okseek: okseek:
// system call filled in newoffset already // system call filled in newoffset already
MOVL $0, 28(SP) // errno MOVL $0, 28(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// would pass 4th arg in CX, not R10. // would pass 4th arg in CX, not R10.
TEXT syscall·Syscall(SB),7,$0 TEXT syscall·Syscall(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI MOVQ 16(SP), DI
MOVQ 24(SP), SI MOVQ 24(SP), SI
MOVQ 32(SP), DX MOVQ 32(SP), DX
...@@ -27,17 +27,17 @@ TEXT syscall·Syscall(SB),7,$0 ...@@ -27,17 +27,17 @@ TEXT syscall·Syscall(SB),7,$0
MOVQ $0, 48(SP) // r2 MOVQ $0, 48(SP) // r2
NEGQ AX NEGQ AX
MOVQ AX, 56(SP) // errno MOVQ AX, 56(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok: ok:
MOVQ AX, 40(SP) // r1 MOVQ AX, 40(SP) // r1
MOVQ DX, 48(SP) // r2 MOVQ DX, 48(SP) // r2
MOVQ $0, 56(SP) // errno MOVQ $0, 56(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
TEXT syscall·Syscall6(SB),7,$0 TEXT syscall·Syscall6(SB),7,$0
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVQ 16(SP), DI MOVQ 16(SP), DI
MOVQ 24(SP), SI MOVQ 24(SP), SI
MOVQ 32(SP), DX MOVQ 32(SP), DX
...@@ -52,13 +52,13 @@ TEXT syscall·Syscall6(SB),7,$0 ...@@ -52,13 +52,13 @@ TEXT syscall·Syscall6(SB),7,$0
MOVQ $0, 72(SP) // r2 MOVQ $0, 72(SP) // r2
NEGQ AX NEGQ AX
MOVQ AX, 80(SP) // errno MOVQ AX, 80(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok6: ok6:
MOVQ AX, 64(SP) // r1 MOVQ AX, 64(SP) // r1
MOVQ DX, 72(SP) // r2 MOVQ DX, 72(SP) // r2
MOVQ $0, 80(SP) // errno MOVQ $0, 80(SP) // errno
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
TEXT syscall·RawSyscall(SB),7,$0 TEXT syscall·RawSyscall(SB),7,$0
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// func Syscall(syscall uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr); // func Syscall(syscall uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
TEXT syscall·Syscall(SB),7,$0 TEXT syscall·Syscall(SB),7,$0
BL sys·entersyscall(SB) BL runtime·entersyscall(SB)
MOVW 4(SP), R7 MOVW 4(SP), R7
MOVW 8(SP), R0 MOVW 8(SP), R0
MOVW 12(SP), R1 MOVW 12(SP), R1
...@@ -24,13 +24,13 @@ TEXT syscall·Syscall(SB),7,$0 ...@@ -24,13 +24,13 @@ TEXT syscall·Syscall(SB),7,$0
MOVW R1, 24(SP) // r2 MOVW R1, 24(SP) // r2
MOVW $0, R0 MOVW $0, R0
MOVW R0, 28(SP) // errno MOVW R0, 28(SP) // errno
BL sys·exitsyscall(SB) BL runtime·exitsyscall(SB)
RET RET
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr); // func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
// Actually Syscall5 but the rest of the code expects it to be named Syscall6. // Actually Syscall5 but the rest of the code expects it to be named Syscall6.
TEXT syscall·Syscall6(SB),7,$0 TEXT syscall·Syscall6(SB),7,$0
BL sys·entersyscall(SB) BL runtime·entersyscall(SB)
MOVW 4(SP), R7 // syscall entry MOVW 4(SP), R7 // syscall entry
MOVW 8(SP), R0 MOVW 8(SP), R0
MOVW 12(SP), R1 MOVW 12(SP), R1
...@@ -43,7 +43,7 @@ TEXT syscall·Syscall6(SB),7,$0 ...@@ -43,7 +43,7 @@ TEXT syscall·Syscall6(SB),7,$0
MOVW R1, 36(SP) // r2 MOVW R1, 36(SP) // r2
MOVW $0, R0 MOVW $0, R0
MOVW R0, 40(SP) // errno MOVW R0, 40(SP) // errno
BL sys·exitsyscall(SB) BL runtime·exitsyscall(SB)
RET RET
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr); // func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// Trap # in AX, args in BX CX DX SI DI, return in AX // Trap # in AX, args in BX CX DX SI DI, return in AX
TEXT syscall·Syscall(SB),7,$20 TEXT syscall·Syscall(SB),7,$20
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX // syscall entry MOVL trap+0(FP), AX // syscall entry
MOVL a1+4(FP), BX MOVL a1+4(FP), BX
MOVL a2+8(FP), CX MOVL a2+8(FP), CX
...@@ -37,18 +37,18 @@ TEXT syscall·Syscall(SB),7,$20 ...@@ -37,18 +37,18 @@ TEXT syscall·Syscall(SB),7,$20
MOVL $0, r2+20(FP) MOVL $0, r2+20(FP)
NEGL AX NEGL AX
MOVL AX, errno+24(FP) MOVL AX, errno+24(FP)
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok: ok:
MOVL AX, r1+16(FP) MOVL AX, r1+16(FP)
MOVL DX, r2+20(FP) MOVL DX, r2+20(FP)
MOVL $0, errno+24(FP) MOVL $0, errno+24(FP)
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr); // func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
TEXT syscall·Syscall6(SB),7,$24 TEXT syscall·Syscall6(SB),7,$24
CALL sys·entersyscall(SB) CALL runtime·entersyscall(SB)
MOVL a1+4(FP), BX MOVL a1+4(FP), BX
MOVL a2+8(FP), CX MOVL a2+8(FP), CX
MOVL a3+12(FP), DX MOVL a3+12(FP), DX
...@@ -75,13 +75,13 @@ TEXT syscall·Syscall6(SB),7,$24 ...@@ -75,13 +75,13 @@ TEXT syscall·Syscall6(SB),7,$24
MOVL $0, r2+32(FP) MOVL $0, r2+32(FP)
NEGL AX NEGL AX
MOVL AX, errno+36(FP) MOVL AX, errno+36(FP)
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
ok6: ok6:
MOVL AX, r1+28(FP) MOVL AX, r1+28(FP)
MOVL DX, r2+32(FP) MOVL DX, r2+32(FP)
MOVL $0, errno+36(FP) MOVL $0, errno+36(FP)
CALL sys·exitsyscall(SB) CALL runtime·exitsyscall(SB)
RET RET
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr); // func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
......
// errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// make sure that even if a file imports runtime,
// it cannot get at the low-level runtime definitions
// known to the compiler. for normal packages
// the compiler doesn't even record the lower case
// functions in its symbol table, but some functions
// in runtime are hard-coded into the compiler.
package main
import "runtime"
func main() {
runtime.printbool(true); // ERROR "cannot refer"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment