Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support more arch with gohack library
- Loading branch information
Showing
6 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2022 TimAndy. All rights reserved. | ||
// Licensed under the Apache-2.0 license that can be found in the LICENSE file. | ||
|
||
//go:build loong64 | ||
// +build loong64 | ||
|
||
#include "funcdata.h" | ||
#include "go_asm.h" | ||
#include "textflag.h" | ||
|
||
TEXT ·getgp(SB), NOSPLIT, $0-8 | ||
MOVV g, R8 | ||
MOVV R8, ret+0(FP) | ||
RET | ||
|
||
TEXT ·getg0(SB), NOSPLIT, $0-16 | ||
NO_LOCAL_POINTERS | ||
MOVV $0, ret_type+0(FP) | ||
MOVV $0, ret_data+8(FP) | ||
GO_RESULTS_INITIALIZED | ||
//get runtime.g type | ||
MOVV $type·runtime·g(SB), R8 | ||
//get runtime·g0 variable | ||
MOVV $runtime·g0(SB), R9 | ||
//return interface{} | ||
MOVV R8, ret_type+0(FP) | ||
MOVV R9, ret_data+8(FP) | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2022 TimAndy. All rights reserved. | ||
// Licensed under the Apache-2.0 license that can be found in the LICENSE file. | ||
|
||
//go:build mips64 || mips64le | ||
// +build mips64 mips64le | ||
|
||
#include "funcdata.h" | ||
#include "go_asm.h" | ||
#include "textflag.h" | ||
|
||
TEXT ·getgp(SB), NOSPLIT, $0-8 | ||
MOVV g, R8 | ||
MOVV R8, ret+0(FP) | ||
RET | ||
|
||
TEXT ·getg0(SB), NOSPLIT, $0-16 | ||
NO_LOCAL_POINTERS | ||
MOVV $0, ret_type+0(FP) | ||
MOVV $0, ret_data+8(FP) | ||
GO_RESULTS_INITIALIZED | ||
//get runtime.g type | ||
MOVV $type·runtime·g(SB), R8 | ||
//get runtime·g0 variable | ||
MOVV $runtime·g0(SB), R9 | ||
//return interface{} | ||
MOVV R8, ret_type+0(FP) | ||
MOVV R9, ret_data+8(FP) | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2022 TimAndy. All rights reserved. | ||
// Licensed under the Apache-2.0 license that can be found in the LICENSE file. | ||
|
||
//go:build mips || mipsle | ||
// +build mips mipsle | ||
|
||
#include "funcdata.h" | ||
#include "go_asm.h" | ||
#include "textflag.h" | ||
|
||
TEXT ·getgp(SB), NOSPLIT, $0-4 | ||
MOVW g, R8 | ||
MOVW R8, ret+0(FP) | ||
RET | ||
|
||
TEXT ·getg0(SB), NOSPLIT, $0-8 | ||
NO_LOCAL_POINTERS | ||
MOVW $0, ret_type+0(FP) | ||
MOVW $0, ret_data+4(FP) | ||
GO_RESULTS_INITIALIZED | ||
//get runtime.g type | ||
MOVW $type·runtime·g(SB), R8 | ||
//get runtime·g0 variable | ||
MOVW $runtime·g0(SB), R9 | ||
//return interface{} | ||
MOVW R8, ret_type+0(FP) | ||
MOVW R9, ret_data+4(FP) | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2022 TimAndy. All rights reserved. | ||
// Licensed under the Apache-2.0 license that can be found in the LICENSE file. | ||
|
||
#include "funcdata.h" | ||
#include "go_asm.h" | ||
#include "textflag.h" | ||
|
||
TEXT ·getgp(SB), NOSPLIT, $0-8 | ||
MOV g, X10 | ||
MOV X10, ret+0(FP) | ||
RET | ||
|
||
TEXT ·getg0(SB), NOSPLIT, $0-16 | ||
NO_LOCAL_POINTERS | ||
MOV X10, ret_type+0(FP) | ||
MOV X11, ret_data+8(FP) | ||
GO_RESULTS_INITIALIZED | ||
//get runtime.g type | ||
MOV $type·runtime·g(SB), X10 | ||
//get runtime·g0 variable | ||
MOV $runtime·g0(SB), X11 | ||
//return interface{} | ||
MOV X10, ret_type+0(FP) | ||
MOV X11, ret_data+8(FP) | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2022 TimAndy. All rights reserved. | ||
// Licensed under the Apache-2.0 license that can be found in the LICENSE file. | ||
|
||
#include "funcdata.h" | ||
#include "go_asm.h" | ||
#include "textflag.h" | ||
|
||
TEXT ·getgp(SB), NOSPLIT, $0-8 | ||
MOVD g, R8 | ||
MOVD R8, ret+0(FP) | ||
RET | ||
|
||
TEXT ·getg0(SB), NOSPLIT, $0-16 | ||
NO_LOCAL_POINTERS | ||
MOVD $0, ret_type+0(FP) | ||
MOVD $0, ret_data+8(FP) | ||
GO_RESULTS_INITIALIZED | ||
//get runtime.g type | ||
MOVD $type·runtime·g(SB), R8 | ||
//get runtime·g0 variable | ||
MOVD $runtime·g0(SB), R9 | ||
//return interface{} | ||
MOVD R8, ret_type+0(FP) | ||
MOVD R9, ret_data+8(FP) | ||
RET |