mirror of
https://github.com/golang/go
synced 2024-11-19 06:14:39 -07:00
runtime: use uintXX instead of *byte for si_addr on Darwin
Currently, Darwin's siginfo type uses *byte for the si_addr field. This results in unwanted write barriers in set_sigaddr. It's also pointless since it never points to anything real and the get/set methods return/take uintXX and cast it from/to the pointer. All other arches use a uint type for this field. Change Darwin to match. This simplifies the get/set methods and eliminates the unwanted write barriers. Change-Id: Ifdb5646d35e1f2f6808b87a3d59745ec9718add1 Reviewed-on: https://go-review.googlesource.com/8086 Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
9b0ea6aa27
commit
ec2c7e6659
@ -174,7 +174,7 @@ type siginfo struct {
|
|||||||
si_pid int32
|
si_pid int32
|
||||||
si_uid uint32
|
si_uid uint32
|
||||||
si_status int32
|
si_status int32
|
||||||
si_addr *byte
|
si_addr uint32
|
||||||
si_value [4]byte
|
si_value [4]byte
|
||||||
si_band int32
|
si_band int32
|
||||||
__pad [7]uint32
|
__pad [7]uint32
|
||||||
|
@ -175,7 +175,7 @@ type siginfo struct {
|
|||||||
si_pid int32
|
si_pid int32
|
||||||
si_uid uint32
|
si_uid uint32
|
||||||
si_status int32
|
si_status int32
|
||||||
si_addr *byte
|
si_addr uint64
|
||||||
si_value [8]byte
|
si_value [8]byte
|
||||||
si_band int64
|
si_band int64
|
||||||
__pad [7]uint64
|
__pad [7]uint64
|
||||||
|
@ -176,7 +176,7 @@ type siginfo struct {
|
|||||||
si_pid int32
|
si_pid int32
|
||||||
si_uid uint32
|
si_uid uint32
|
||||||
si_status int32
|
si_status int32
|
||||||
si_addr *byte
|
si_addr uint32
|
||||||
si_value [4]byte
|
si_value [4]byte
|
||||||
si_band int32
|
si_band int32
|
||||||
__pad [7]uint32
|
__pad [7]uint32
|
||||||
|
@ -26,9 +26,9 @@ func (c *sigctxt) cs() uint32 { return c.regs().cs }
|
|||||||
func (c *sigctxt) fs() uint32 { return c.regs().fs }
|
func (c *sigctxt) fs() uint32 { return c.regs().fs }
|
||||||
func (c *sigctxt) gs() uint32 { return c.regs().gs }
|
func (c *sigctxt) gs() uint32 { return c.regs().gs }
|
||||||
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
|
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
|
||||||
func (c *sigctxt) sigaddr() uint32 { return uint32(uintptr(unsafe.Pointer(c.info.si_addr))) }
|
func (c *sigctxt) sigaddr() uint32 { return c.info.si_addr }
|
||||||
|
|
||||||
func (c *sigctxt) set_eip(x uint32) { c.regs().eip = x }
|
func (c *sigctxt) set_eip(x uint32) { c.regs().eip = x }
|
||||||
func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x }
|
func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x }
|
||||||
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
|
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
|
||||||
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = (*byte)(unsafe.Pointer(uintptr(x))) }
|
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = x }
|
||||||
|
@ -34,9 +34,9 @@ func (c *sigctxt) cs() uint64 { return c.regs().cs }
|
|||||||
func (c *sigctxt) fs() uint64 { return c.regs().fs }
|
func (c *sigctxt) fs() uint64 { return c.regs().fs }
|
||||||
func (c *sigctxt) gs() uint64 { return c.regs().gs }
|
func (c *sigctxt) gs() uint64 { return c.regs().gs }
|
||||||
func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
|
func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
|
||||||
func (c *sigctxt) sigaddr() uint64 { return uint64(uintptr(unsafe.Pointer(c.info.si_addr))) }
|
func (c *sigctxt) sigaddr() uint64 { return c.info.si_addr }
|
||||||
|
|
||||||
func (c *sigctxt) set_rip(x uint64) { c.regs().rip = x }
|
func (c *sigctxt) set_rip(x uint64) { c.regs().rip = x }
|
||||||
func (c *sigctxt) set_rsp(x uint64) { c.regs().rsp = x }
|
func (c *sigctxt) set_rsp(x uint64) { c.regs().rsp = x }
|
||||||
func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) }
|
func (c *sigctxt) set_sigcode(x uint64) { c.info.si_code = int32(x) }
|
||||||
func (c *sigctxt) set_sigaddr(x uint64) { c.info.si_addr = (*byte)(unsafe.Pointer(uintptr(x))) }
|
func (c *sigctxt) set_sigaddr(x uint64) { c.info.si_addr = x }
|
||||||
|
@ -29,7 +29,7 @@ func (c *sigctxt) sp() uint32 { return c.regs().sp }
|
|||||||
func (c *sigctxt) lr() uint32 { return c.regs().lr }
|
func (c *sigctxt) lr() uint32 { return c.regs().lr }
|
||||||
func (c *sigctxt) pc() uint32 { return c.regs().pc }
|
func (c *sigctxt) pc() uint32 { return c.regs().pc }
|
||||||
func (c *sigctxt) cpsr() uint32 { return c.regs().cpsr }
|
func (c *sigctxt) cpsr() uint32 { return c.regs().cpsr }
|
||||||
func (c *sigctxt) fault() uint32 { return uint32(uintptr(unsafe.Pointer(c.info.si_addr))) }
|
func (c *sigctxt) fault() uint32 { return c.info.si_addr }
|
||||||
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
|
func (c *sigctxt) sigcode() uint32 { return uint32(c.info.si_code) }
|
||||||
func (c *sigctxt) trap() uint32 { return 0 }
|
func (c *sigctxt) trap() uint32 { return 0 }
|
||||||
func (c *sigctxt) error() uint32 { return 0 }
|
func (c *sigctxt) error() uint32 { return 0 }
|
||||||
@ -41,4 +41,4 @@ func (c *sigctxt) set_lr(x uint32) { c.regs().lr = x }
|
|||||||
func (c *sigctxt) set_r10(x uint32) { c.regs().r[10] = x }
|
func (c *sigctxt) set_r10(x uint32) { c.regs().r[10] = x }
|
||||||
|
|
||||||
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
|
func (c *sigctxt) set_sigcode(x uint32) { c.info.si_code = int32(x) }
|
||||||
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = (*byte)(unsafe.Pointer(uintptr(x))) }
|
func (c *sigctxt) set_sigaddr(x uint32) { c.info.si_addr = x }
|
||||||
|
Loading…
Reference in New Issue
Block a user