{"action":"created","issue":{"url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/issues/19","labels_url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/issues/19/comments","events_url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/issues/19/events","html_url":"https://github.com/ucb-bar/riscv-gnu-toolchain/pull/19","id":55216552,"number":19,"title":"Add sys/reg.h for RISC-V","user":{"login":"palmer-dabbelt","id":1383006,"avatar_url":"https://avatars.githubusercontent.com/u/1383006?v=3","gravatar_id":"","url":"https://api.github.com/users/palmer-dabbelt","html_url":"https://github.com/palmer-dabbelt","followers_url":"https://api.github.com/users/palmer-dabbelt/followers","following_url":"https://api.github.com/users/palmer-dabbelt/following{/other_user}","gists_url":"https://api.github.com/users/palmer-dabbelt/gists{/gist_id}","starred_url":"https://api.github.com/users/palmer-dabbelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palmer-dabbelt/subscriptions","organizations_url":"https://api.github.com/users/palmer-dabbelt/orgs","repos_url":"https://api.github.com/users/palmer-dabbelt/repos","events_url":"https://api.github.com/users/palmer-dabbelt/events{/privacy}","received_events_url":"https://api.github.com/users/palmer-dabbelt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-22T22:12:56Z","updated_at":"2015-01-23T01:55:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/pulls/19","html_url":"https://github.com/ucb-bar/riscv-gnu-toolchain/pull/19","diff_url":"https://github.com/ucb-bar/riscv-gnu-toolchain/pull/19.diff","patch_url":"https://github.com/ucb-bar/riscv-gnu-toolchain/pull/19.patch"},"body":"One of the myriad ways of accessing state via the ptrace() appears to\r\nbe to use raw offsets into \"struct pt_regs\".  This header file defines\r\nthese offsets so user code can use them.  While this seems super\r\nfragile, it's the mechanism x86 and Tile (via a more convoluted set of\r\nmostly-empty headers) use so I think it's probably OK."},"comment":{"url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/issues/comments/71135512","html_url":"https://github.com/ucb-bar/riscv-gnu-toolchain/pull/19#issuecomment-71135512","issue_url":"https://api.github.com/repos/ucb-bar/riscv-gnu-toolchain/issues/19","id":71135512,"user":{"login":"palmer-dabbelt","id":1383006,"avatar_url":"https://avatars.githubusercontent.com/u/1383006?v=3","gravatar_id":"","url":"https://api.github.com/users/palmer-dabbelt","html_url":"https://github.com/palmer-dabbelt","followers_url":"https://api.github.com/users/palmer-dabbelt/followers","following_url":"https://api.github.com/users/palmer-dabbelt/following{/other_user}","gists_url":"https://api.github.com/users/palmer-dabbelt/gists{/gist_id}","starred_url":"https://api.github.com/users/palmer-dabbelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palmer-dabbelt/subscriptions","organizations_url":"https://api.github.com/users/palmer-dabbelt/orgs","repos_url":"https://api.github.com/users/palmer-dabbelt/repos","events_url":"https://api.github.com/users/palmer-dabbelt/events{/privacy}","received_events_url":"https://api.github.com/users/palmer-dabbelt/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T01:55:32Z","updated_at":"2015-01-23T01:55:32Z","body":"So it's all a bit convoluted:\r\n* I wanted to get the Gentoo port up, which requires Python.  There's a bug in the Python port that would be easy to solve with strace, but we don't have strace so I figured I'd port that.\r\n* The strace port is actually pretty easy, but it turns out that someone \"implemented\" ptrace with \"return 0\" instead of -ENOSYS, so I figured I'd just implement that too.\r\n* In order to actually use ptrace I figured it'd be best to just do what everyone else is doing to get data out of the kernel, despite how ugly it is.\r\n\r\nNow I'm 100% for hiding \"struct pt_regs\" from userspace, which I didn't know was a thing.  All strace needs is the \"what system call is this\" register (in addition to the argument registers, but those are going to be in there anyway), so as long as that's in \"struct user_regs_struct\" that's OK with me.\r\n\r\nI figured a7 would keep the syscall number around long enough to be usable by ptrace/strace, but it doesn't appear to for me (though it's entirely possible something is wrong).  My ptrace implementation runs some simple test cases (ie, everything in \"linux-testing-project\" and my own test case), but doesn't work for strace yet."}}