getcontextx.c (fd6b1cc34e4175c1e223f42540debb74cfe3c3e6) | getcontextx.c (5202ca77aaf552310bcbaccba750ee9f0888d0d8) |
---|---|
1/* 2 * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 18 unchanged lines hidden (view full) --- 27#include <sys/types.h> 28#include <sys/ucontext.h> 29#include <errno.h> 30#include <stdlib.h> 31 32int 33__getcontextx_size(void) 34{ | 1/* 2 * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 18 unchanged lines hidden (view full) --- 27#include <sys/types.h> 28#include <sys/ucontext.h> 29#include <errno.h> 30#include <stdlib.h> 31 32int 33__getcontextx_size(void) 34{ |
35 size_t size; |
|
35 | 36 |
36 return (sizeof(ucontext_t)); | 37 size = sizeof(ucontext_t); 38 size += sizeof(struct arm64_reg_context); /* Space for ARM64_CTX_END */ 39 40 return (size); |
37} 38 39int 40__fillcontextx2(char *ctx) 41{ | 41} 42 43int 44__fillcontextx2(char *ctx) 45{ |
46 struct arm64_reg_context *reg_ctx; 47 ucontext_t *ucp; |
|
42 | 48 |
49 ucp = (ucontext_t *)ctx; 50 ucp->uc_mcontext.mc_ptr = (uint64_t)(ucp + 1); 51 52 reg_ctx = (struct arm64_reg_context *)ucp->uc_mcontext.mc_ptr; 53 reg_ctx->ctx_id = ARM64_CTX_END; 54 reg_ctx->ctx_size = sizeof(struct arm64_reg_context); 55 |
|
43 return (0); 44} 45 46int 47__fillcontextx(char *ctx) 48{ 49 ucontext_t *ucp; 50 51 ucp = (ucontext_t *)ctx; | 56 return (0); 57} 58 59int 60__fillcontextx(char *ctx) 61{ 62 ucontext_t *ucp; 63 64 ucp = (ucontext_t *)ctx; |
52 return (getcontext(ucp)); | 65 if (getcontext(ucp) == -1) 66 return (-1); 67 __fillcontextx2(ctx); 68 return (0); |
53} 54 55__weak_reference(__getcontextx, getcontextx); 56 57ucontext_t * 58__getcontextx(void) 59{ 60 char *ctx; --- 13 unchanged lines hidden --- | 69} 70 71__weak_reference(__getcontextx, getcontextx); 72 73ucontext_t * 74__getcontextx(void) 75{ 76 char *ctx; --- 13 unchanged lines hidden --- |