Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c5f694a5
Commit
c5f694a5
authored
Mar 01, 2013
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: fix new scheduler on freebsd, windows
R=devon.odell CC=golang-dev
https://golang.org/cl/7443046
parent
8d732368
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
45 additions
and
17 deletions
+45
-17
src/pkg/runtime/runtime.h
src/pkg/runtime/runtime.h
+2
-2
src/pkg/runtime/sys_freebsd_386.s
src/pkg/runtime/sys_freebsd_386.s
+6
-1
src/pkg/runtime/sys_freebsd_amd64.s
src/pkg/runtime/sys_freebsd_amd64.s
+7
-1
src/pkg/runtime/sys_freebsd_arm.s
src/pkg/runtime/sys_freebsd_arm.s
+5
-1
src/pkg/runtime/sys_windows_386.s
src/pkg/runtime/sys_windows_386.s
+4
-1
src/pkg/runtime/sys_windows_amd64.s
src/pkg/runtime/sys_windows_amd64.s
+5
-1
src/pkg/runtime/thread_darwin.c
src/pkg/runtime/thread_darwin.c
+1
-1
src/pkg/runtime/thread_freebsd.c
src/pkg/runtime/thread_freebsd.c
+5
-3
src/pkg/runtime/thread_linux.c
src/pkg/runtime/thread_linux.c
+1
-1
src/pkg/runtime/thread_netbsd.c
src/pkg/runtime/thread_netbsd.c
+1
-1
src/pkg/runtime/thread_openbsd.c
src/pkg/runtime/thread_openbsd.c
+1
-1
src/pkg/runtime/thread_plan9.c
src/pkg/runtime/thread_plan9.c
+1
-1
src/pkg/runtime/thread_windows.c
src/pkg/runtime/thread_windows.c
+6
-2
No files found.
src/pkg/runtime/runtime.h
View file @
c5f694a5
...
...
@@ -52,7 +52,7 @@ typedef struct G G;
typedef
struct
Gobuf
Gobuf
;
typedef
union
Lock
Lock
;
typedef
struct
M
M
;
typedef
struct
P
P
;
typedef
struct
P
P
;
typedef
struct
Mem
Mem
;
typedef
union
Note
Note
;
typedef
struct
Slice
Slice
;
...
...
@@ -265,7 +265,7 @@ struct M
uintptr
cret
;
// return value from C
uint64
procid
;
// for debuggers, but offset not hard-coded
G
*
gsignal
;
// signal-handling G
uint
32
tls
[
8
];
// thread-local storage (for 3
86 extern register)
uint
64
tls
[
4
];
// thread-local storage (for x
86 extern register)
G
*
curg
;
// current running goroutine
P
*
p
;
// attached P for executing Go code (nil if not executing Go code)
P
*
nextp
;
...
...
src/pkg/runtime/sys_freebsd_386.s
View file @
c5f694a5
...
...
@@ -38,7 +38,12 @@ TEXT runtime·thr_start(SB),7,$0
MOVL
AX
,
m
(
CX
)
CALL
runtime
·
stackcheck
(
SB
)
//
smashes
AX
CALL
runtime
·
mstart
(
SB
)
//
newosproc
left
the
function
we
should
call
in
mp
->
tls
[
2
]
for
us
.
get_tls
(
CX
)
MOVQ
8
(
CX
),
AX
CALL
AX
MOVL
0
,
AX
//
crash
(
not
reached
)
//
Exit
the
entire
program
(
like
C
exit
)
...
...
src/pkg/runtime/sys_freebsd_amd64.s
View file @
c5f694a5
...
...
@@ -34,12 +34,18 @@ TEXT runtime·thr_start(SB),7,$0
//
set
up
m
,
g
get_tls
(
CX
)
MOVQ
8
(
CX
),
AX
MOVQ
R13
,
m
(
CX
)
MOVQ
m_g0
(
R13
),
DI
MOVQ
DI
,
g
(
CX
)
CALL
runtime
·
stackcheck
(
SB
)
CALL
runtime
·
mstart
(
SB
)
//
newosproc
left
the
function
we
should
call
in
mp
->
tls
[
2
]
for
us
.
get_tls
(
CX
)
MOVQ
16
(
CX
),
AX
CALL
AX
MOVQ
0
,
AX
//
crash
(
not
reached
)
//
Exit
the
entire
program
(
like
C
exit
)
...
...
src/pkg/runtime/sys_freebsd_arm.s
View file @
c5f694a5
...
...
@@ -33,7 +33,11 @@ TEXT runtime·thr_start(SB),7,$0
//
set
up
g
MOVW
m_g0
(
R9
),
R10
BL
runtime
·
emptyfunc
(
SB
)
//
fault
if
stack
check
is
wrong
BL
runtime
·
mstart
(
SB
)
//
newosproc
left
the
function
we
should
call
in
mp
->
tls
[
2
]
for
us
.
MOVW
(
m_tls
+
8
)(
m
),
R0
BL
(
R0
)
MOVW
$
2
,
R9
//
crash
(
not
reached
)
MOVW
R9
,
(
R9
)
RET
...
...
src/pkg/runtime/sys_windows_386.s
View file @
c5f694a5
...
...
@@ -260,7 +260,10 @@ TEXT runtime·tstart(SB),7,$0
CALL
runtime
·
stackcheck
(
SB
)
//
clobbers
AX
,
CX
CALL
runtime
·
mstart
(
SB
)
//
start
function
is
in
tls
[
2
]
get_tls
(
CX
)
MOVL
8
(
CX
),
AX
CALL
AX
RET
...
...
src/pkg/runtime/sys_windows_amd64.s
View file @
c5f694a5
...
...
@@ -329,7 +329,11 @@ TEXT runtime·tstart_stdcall(SB),7,$0
CLD
CALL
runtime
·
stackcheck
(
SB
)
//
clobbers
AX
,
CX
CALL
runtime
·
mstart
(
SB
)
//
start
function
is
in
tls
[
2
]
get_tls
(
CX
)
MOVQ
16
(
CX
),
AX
CALL
AX
XORL
AX
,
AX
//
return
0
==
success
RET
...
...
src/pkg/runtime/thread_darwin.c
View file @
c5f694a5
...
...
@@ -95,7 +95,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
mp
->
tls
[
0
]
=
mp
->
id
;
// so 386 asm can find it
if
(
0
){
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p
\n
"
,
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
mp
->
tls
[
0
],
&
mp
);
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
(
int32
)
mp
->
tls
[
0
],
&
mp
);
}
runtime
·
sigprocmask
(
SIG_SETMASK
,
&
sigset_all
,
&
oset
);
...
...
src/pkg/runtime/thread_freebsd.c
View file @
c5f694a5
...
...
@@ -82,12 +82,13 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
ThrParam
param
;
Sigset
oset
;
USED
(
fn
);
// thr_start assumes fn == mstart
USED
(
gp
);
// thr_start assumes gp == mp->g0
// thr_start assumes gp == mp->g0
if
(
gp
!=
mp
->
g0
)
runtime
·
throw
(
"invalid newosproc gp"
);
if
(
0
){
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p
\n
"
,
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
mp
->
tls
[
0
],
&
mp
);
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
(
int32
)
mp
->
tls
[
0
],
&
mp
);
}
runtime
·
sigprocmask
(
&
sigset_all
,
&
oset
);
...
...
@@ -103,6 +104,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
param
.
tls_size
=
sizeof
mp
->
tls
;
mp
->
tls
[
0
]
=
mp
->
id
;
// so 386 asm can find it
mp
->
tls
[
2
]
=
(
uintptr
)
fn
;
runtime
·
thr_new
(
&
param
,
sizeof
param
);
runtime
·
sigprocmask
(
&
oset
,
nil
);
...
...
src/pkg/runtime/thread_linux.c
View file @
c5f694a5
...
...
@@ -143,7 +143,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
mp
->
tls
[
0
]
=
mp
->
id
;
// so 386 asm can find it
if
(
0
){
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p clone=%p id=%d/%d ostk=%p
\n
"
,
stk
,
mp
,
gp
,
fn
,
runtime
·
clone
,
mp
->
id
,
mp
->
tls
[
0
],
&
mp
);
stk
,
mp
,
gp
,
fn
,
runtime
·
clone
,
mp
->
id
,
(
int32
)
mp
->
tls
[
0
],
&
mp
);
}
// Disable signals during clone, so that the new thread starts
...
...
src/pkg/runtime/thread_netbsd.c
View file @
c5f694a5
...
...
@@ -153,7 +153,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
if
(
0
)
{
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p
\n
"
,
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
mp
->
tls
[
0
],
&
mp
);
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
(
int32
)
mp
->
tls
[
0
],
&
mp
);
}
mp
->
tls
[
0
]
=
mp
->
id
;
// so 386 asm can find it
...
...
src/pkg/runtime/thread_openbsd.c
View file @
c5f694a5
...
...
@@ -132,7 +132,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
if
(
0
)
{
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p id=%d/%d ostk=%p
\n
"
,
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
mp
->
tls
[
0
],
&
mp
);
stk
,
mp
,
gp
,
fn
,
mp
->
id
,
(
int32
)
mp
->
tls
[
0
],
&
mp
);
}
mp
->
tls
[
0
]
=
mp
->
id
;
// so 386 asm can find it
...
...
src/pkg/runtime/thread_plan9.c
View file @
c5f694a5
...
...
@@ -228,7 +228,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
mp
->
tls
[
0
]
=
mp
->
id
;
// so 386 asm can find it
if
(
0
){
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p rfork=%p id=%d/%d ostk=%p
\n
"
,
stk
,
mp
,
gp
,
fn
,
runtime
·
rfork
,
mp
->
id
,
mp
->
tls
[
0
],
&
mp
);
stk
,
mp
,
gp
,
fn
,
runtime
·
rfork
,
mp
->
id
,
(
int32
)
mp
->
tls
[
0
],
&
mp
);
}
if
(
runtime
·
rfork
(
RFPROC
|
RFMEM
|
RFNOWAIT
,
stk
,
mp
,
gp
,
fn
)
<
0
)
...
...
src/pkg/runtime/thread_windows.c
View file @
c5f694a5
...
...
@@ -192,8 +192,12 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
void
*
thandle
;
USED
(
stk
);
USED
(
gp
);
// assuming gp = mp->g0
USED
(
fn
);
// assuming fn = mstart
// assume gp == mp->g0
if
(
gp
!=
mp
->
g0
)
runtime
·
throw
(
"invalid newosproc gp"
);
mp
->
tls
[
2
]
=
(
uintptr
)
fn
;
thandle
=
runtime
·
stdcall
(
runtime
·
CreateThread
,
6
,
nil
,
(
uintptr
)
0x20000
,
runtime
·
tstart_stdcall
,
mp
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment