From: guenther Date: Mon, 31 Jul 2023 01:33:57 +0000 (+0000) Subject: The replacement code passed to codepatch_replace() can usefully be X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=183b7dd1109a83aabbd0498cbaf8d93d385757f7;p=openbsd The replacement code passed to codepatch_replace() can usefully be const. suggested by bluhm@ --- diff --git a/sys/arch/amd64/amd64/codepatch.c b/sys/arch/amd64/amd64/codepatch.c index ec32b44119c..1ed1dd993e2 100644 --- a/sys/arch/amd64/amd64/codepatch.c +++ b/sys/arch/amd64/amd64/codepatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: codepatch.c,v 1.9 2020/09/11 09:27:09 mpi Exp $ */ +/* $OpenBSD: codepatch.c,v 1.10 2023/07/31 01:33:57 guenther Exp $ */ /* * Copyright (c) 2014-2015 Stefan Fritsch * @@ -126,7 +126,7 @@ codepatch_nop(uint16_t tag) /* Patch with alternative code */ void -codepatch_replace(uint16_t tag, void *code, size_t len) +codepatch_replace(uint16_t tag, const void *code, size_t len) { struct codepatch *patch; unsigned char *rwaddr; diff --git a/sys/arch/amd64/include/codepatch.h b/sys/arch/amd64/include/codepatch.h index 71fe9475710..6401dab9f2f 100644 --- a/sys/arch/amd64/include/codepatch.h +++ b/sys/arch/amd64/include/codepatch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: codepatch.h,v 1.16 2023/07/28 06:18:35 guenther Exp $ */ +/* $OpenBSD: codepatch.h,v 1.17 2023/07/31 01:33:57 guenther Exp $ */ /* * Copyright (c) 2014-2015 Stefan Fritsch * @@ -29,7 +29,7 @@ __cptext void *codepatch_maprw(vaddr_t *nva, vaddr_t dest); __cptext void codepatch_unmaprw(vaddr_t nva); __cptext void codepatch_fill_nop(void *caddr, uint16_t len); __cptext void codepatch_nop(uint16_t tag); -__cptext void codepatch_replace(uint16_t tag, void *code, size_t len); +__cptext void codepatch_replace(uint16_t tag, const void *code, size_t len); __cptext void codepatch_call(uint16_t _tag, void *_func); __cptext void codepatch_jmp(uint16_t _tag, void *_func); void codepatch_disable(void);