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
90294a08
Commit
90294a08
authored
Jan 25, 2011
by
Hector Chu
Committed by
Alex Brainman
Jan 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: make Walk webbrowser example work
R=rsc, brainman, lxn CC=golang-dev
https://golang.org/cl/4005045
parent
4e5e0b1d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
26 deletions
+29
-26
src/pkg/exp/wingui/gui.go
src/pkg/exp/wingui/gui.go
+1
-1
src/pkg/exp/wingui/winapi.go
src/pkg/exp/wingui/winapi.go
+1
-1
src/pkg/runtime/386/asm.s
src/pkg/runtime/386/asm.s
+1
-1
src/pkg/runtime/windows/386/sys.s
src/pkg/runtime/windows/386/sys.s
+17
-15
src/pkg/runtime/windows/thread.c
src/pkg/runtime/windows/thread.c
+6
-6
src/pkg/syscall/syscall_windows.go
src/pkg/syscall/syscall_windows.go
+3
-2
No files found.
src/pkg/exp/wingui/gui.go
View file @
90294a08
...
...
@@ -95,7 +95,7 @@ func rungui() int {
}
// Create callback
wproc
:=
syscall
.
NewCallback
(
WndProc
,
4
*
4
)
wproc
:=
syscall
.
NewCallback
(
WndProc
,
4
)
// RegisterClassEx
wcname
:=
syscall
.
StringToUTF16Ptr
(
"myWindowClass"
)
...
...
src/pkg/exp/wingui/winapi.go
View file @
90294a08
...
...
@@ -28,7 +28,7 @@ func getSysProcAddr(m uint32, pname string) uintptr {
type
Wndclassex
struct
{
Size
uint32
Style
uint32
WndProc
uint
32
WndProc
uint
ptr
ClsExtra
int32
WndExtra
int32
Instance
uint32
...
...
src/pkg/runtime/386/asm.s
View file @
90294a08
...
...
@@ -47,7 +47,7 @@ ok:
MOVL
CX
,
m_g0
(
AX
)
//
create
istack
out
of
the
OS
stack
LEAL
(-
16
*
1024
+
104
)(
SP
),
AX
//
TODO
:
104
?
LEAL
(-
64
*
1024
+
104
)(
SP
),
AX
//
TODO
:
104
?
MOVL
AX
,
g_stackguard
(
CX
)
MOVL
SP
,
g_stackbase
(
CX
)
CALL
runtime
·
emptyfunc
(
SB
)
//
fault
if
stack
check
is
wrong
...
...
src/pkg/runtime/windows/386/sys.s
View file @
90294a08
...
...
@@ -84,9 +84,8 @@ TEXT runtime·sigtramp1(SB),0,$16-28
//
call
windows
default
handler
early
MOVL
4
(
SP
),
BX
//
our
SEH
frame
MOVL
0
(
BX
),
BX
//
SEH
frame
of
default
handler
MOVL
4
(
BX
),
AX
//
handler
function
pointer
MOVL
BX
,
4
(
SP
)
//
set
establisher
frame
CALL
AX
CALL
4
(
BX
)
sigdone
:
RET
...
...
@@ -94,7 +93,7 @@ sigdone:
//
Called
from
dynamic
function
created
by
..
/
thread
.
c
compilecallback
,
//
running
on
Windows
stack
(
not
Go
stack
)
.
//
Returns
straight
to
DLL
.
//
EBX
,
ESI
,
EDI
registers
and
DF
flag
are
preserved
//
EBX
,
E
BP
,
E
SI
,
EDI
registers
and
DF
flag
are
preserved
//
as
required
by
windows
callback
convention
.
//
On
entry
to
the
function
the
stack
looks
like
:
//
...
...
@@ -102,17 +101,19 @@ sigdone:
//
4(
SP
)
-
address
of
go
func
we
need
to
call
//
8(
SP
)
-
total
size
of
arguments
//
12(
SP
)
-
room
to
save
BX
register
//
16(
SP
)
-
room
to
save
SI
//
20(
SP
)
-
room
to
save
DI
//
24(
SP
)
-
return
address
to
DLL
//
28(
SP
)
-
beginning
of
arguments
//
16(
SP
)
-
room
to
save
BP
//
20(
SP
)
-
room
to
save
SI
//
24(
SP
)
-
room
to
save
DI
//
28(
SP
)
-
return
address
to
DLL
//
32(
SP
)
-
beginning
of
arguments
//
TEXT
runtime
·
callbackasm
+0(
SB
),7,$0
MOVL
BX
,
12
(
SP
)
//
save
registers
as
required
for
windows
callback
MOVL
SI
,
16
(
SP
)
MOVL
DI
,
20
(
SP
)
MOVL
BP
,
16
(
SP
)
MOVL
SI
,
20
(
SP
)
MOVL
DI
,
24
(
SP
)
LEAL
args
+
28
(
SP
),
AX
LEAL
args
+
32
(
SP
),
AX
MOVL
AX
,
0
(
SP
)
CLD
...
...
@@ -120,13 +121,14 @@ TEXT runtime·callbackasm+0(SB),7,$0
CALL
runtime
·
callback
(
SB
)
MOVL
12
(
SP
),
BX
//
restore
registers
as
required
for
windows
callback
MOVL
16
(
SP
),
SI
MOVL
20
(
SP
),
DI
MOVL
16
(
SP
),
BP
MOVL
20
(
SP
),
SI
MOVL
24
(
SP
),
DI
CLD
MOVL
ret
+
2
4
(
SP
),
CX
MOVL
ret
+
2
8
(
SP
),
CX
MOVL
size
+
8
(
SP
),
DX
ADDL
$
28
,
DX
ADDL
$
32
,
DX
ADDL
DX
,
SP
JMP
CX
...
...
@@ -144,7 +146,7 @@ TEXT runtime·tstart(SB),7,$0
MOVL
SP
,
AX
SUBL
$
256
,
AX
//
just
some
space
for
ourselves
MOVL
AX
,
g_stackbase
(
DX
)
SUBL
$
(
16
*
1024
),
AX
//
stack
size
SUBL
$
(
64
*
1024
),
AX
//
stack
size
MOVL
AX
,
g_stackguard
(
DX
)
//
Set
up
tls
.
...
...
src/pkg/runtime/windows/thread.c
View file @
90294a08
...
...
@@ -276,13 +276,13 @@ runtime·compilecallback(byte *code, void *fn, uint32 argsize)
byte
*
p
;
p
=
code
;
// SUBL $1
2
, SP
// SUBL $1
6
, SP
*
p
++
=
0x83
;
*
p
++
=
0xec
;
*
p
++
=
0x
0c
;
// PUSH argsize
*
p
++
=
0x
10
;
// PUSH argsize
* 4
*
p
++
=
0x68
;
*
(
uint32
*
)
p
=
argsize
;
*
(
uint32
*
)
p
=
argsize
<<
2
;
p
+=
4
;
// PUSH fn
*
p
++
=
0x68
;
...
...
@@ -308,8 +308,8 @@ runtime·callback(void *arg, void (*fn)(void), int32 argsize)
G
*
g1
;
void
*
sp
,
*
gostack
;
void
**
p
;
USED
(
argsize
);
USED
(
argsize
);
if
(
g
!=
m
->
g0
)
runtime
·
throw
(
"bad g in callback"
);
...
...
@@ -326,7 +326,7 @@ runtime·callback(void *arg, void (*fn)(void), int32 argsize)
if
(
sp
<
g1
->
stackguard
-
StackGuard
+
4
)
// +4 for return address
runtime
·
throw
(
"g stack overflow in callback"
);
p
=
sp
;
p
[
0
]
=
arg
;
...
...
src/pkg/syscall/syscall_windows.go
View file @
90294a08
...
...
@@ -104,10 +104,11 @@ type Callback struct {
code
[
50
]
byte
// have to be big enough to fit asm written in it by compileCallback
}
func
(
cb
*
Callback
)
ExtFnEntry
()
uint
32
{
return
uint
32
(
uintptr
(
unsafe
.
Pointer
(
&
cb
.
code
[
0
])
))
func
(
cb
*
Callback
)
ExtFnEntry
()
uint
ptr
{
return
uint
ptr
(
unsafe
.
Pointer
(
&
cb
.
code
[
0
]
))
}
// argsize is in words
func
NewCallback
(
fn
CallbackFunc
,
argsize
int
)
*
Callback
{
cb
:=
Callback
{}
compileCallback
(
&
cb
.
code
[
0
],
fn
,
argsize
)
...
...
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