1
0
mirror of https://github.com/golang/go synced 2024-10-04 08:31:22 -06:00
go/src/pkg/runtime/signal_linux_386.h
Russ Cox e9d62a6d81 runtime: refactor os-specific code
thread_GOOS.c becomes os_GOOS.c.

signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c,
but with non-GOARCH-specific code moved into os_GOOS.c.

The actual arch-specific signal handler moves into signal_GOARCH.c
to avoid per-GOOS duplication.

New files signal_GOOS_GOARCH.h provide macros for
accessing fields of the very system-specific signal info structs.

Lots moving, but nothing changing.
This is a preliminarly cleanup so I can work on the signal
handling code to fix some open issues without having to
make each change 13 times.

Tested on Linux and OS X, 386 and amd64.
Will fix Plan 9, Windows, and ARM after the fact if necessary.
(Plan 9 and Windows should be fine; ARM will probably have some typos.)

Net effect: -1081 lines of code.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7565048
2013-03-14 11:35:13 -07:00

25 lines
979 B
C

// Copyright 2013 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.
#define SIG_REGS(ctxt) (*((Sigcontext*)&((Ucontext*)(ctxt))->uc_mcontext))
#define SIG_EAX(info, ctxt) (SIG_REGS(ctxt).eax)
#define SIG_EBX(info, ctxt) (SIG_REGS(ctxt).ebx)
#define SIG_ECX(info, ctxt) (SIG_REGS(ctxt).ecx)
#define SIG_EDX(info, ctxt) (SIG_REGS(ctxt).edx)
#define SIG_EDI(info, ctxt) (SIG_REGS(ctxt).edi)
#define SIG_ESI(info, ctxt) (SIG_REGS(ctxt).esi)
#define SIG_EBP(info, ctxt) (SIG_REGS(ctxt).ebp)
#define SIG_ESP(info, ctxt) (SIG_REGS(ctxt).esp)
#define SIG_EIP(info, ctxt) (SIG_REGS(ctxt).eip)
#define SIG_EFLAGS(info, ctxt) (SIG_REGS(ctxt).eflags)
#define SIG_CS(info, ctxt) (SIG_REGS(ctxt).cs)
#define SIG_FS(info, ctxt) (SIG_REGS(ctxt).fs)
#define SIG_GS(info, ctxt) (SIG_REGS(ctxt).gs)
#define SIG_CODE0(info, ctxt) ((info)->si_code)
#define SIG_CODE1(info, ctxt) (((uintptr*)(info))[2])