blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0d5aa2a7362ab5210460aa07fcd3550ed2a8abd1
|
5eff7a36d9a9917dce9111f0c3074375fe6f7656
|
/driver/xf86-video-cirrus/src/lg_xaa.c
|
5e6e72eeecfa0f8f523ffe81badc3f6a94181916
|
[
"HPND-sell-variant",
"MIT"
] |
permissive
|
openbsd/xenocara
|
cb392d02ebba06f6ff7d826fd8a89aa3b8401779
|
a012b5de33ea0b977095d77316a521195b26cc6b
|
refs/heads/master
| 2023-08-25T12:16:58.862008
| 2023-08-12T16:16:25
| 2023-08-12T16:16:25
| 66,967,384
| 177
| 66
| null | 2023-07-22T18:12:37
| 2016-08-30T18:36:01
|
C
|
UTF-8
|
C
| false
| false
| 7,441
|
c
|
lg_xaa.c
|
/*
* XAA acceleration for CL-GD546x -- The Laugna family
*
* lg_xaa.c
*
* (c) 1998 Corin Anderson.
* corina@the4cs.com
* Tukwila, WA
*
* Much of this code is inspired by the XAA acceleration from XFree86
* 3.3.3, laguna_acl.c
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "xf86.h"
#include "xf86_OSproc.h"
#include "compiler.h"
#include "xf86Pci.h"
#include "vgaHW.h"
#include "cir.h"
#define _LG_PRIVATE_
#include "lg.h"
#ifdef HAVE_XAA_H
#include "lg_xaa.h"
/* Laguna raster operations, source is OP1 and destination is OP0. */
/* The order in this array is important! */
static int lgRop[16] = {
/* Lg Op X name */
0x00, /* 0 GXclear */
0x88, /* S.D GXand */
0x44, /* S.~D GXandReverse */
0xCC, /* S GXcopy */
0x22, /* ~S.D GXandInverted */
0xAA, /* D GXnoop */
0x66, /* S~=D GXxor */
0xEE, /* S+D GXor */
0x77, /* ~S.~D GXnor */
0x99, /* S=D GXequiv */
0x55, /* ~D GXinvert */
0xDD, /* S+~D GXorReverse */
0x33, /* ~S GXcopyInverted */
0xBB, /* ~S+D GXorInverted */
0x11, /* ~S+~D GXnand */
0xFF /* 1 GXset */
};
#if 0
/* Laguna raster operations, source is OP2 and destination is OP0. */
static int lgPatRop[16] = {
/* Lg Op X name */
0x00, /* 0 GXclear */
0xA0, /* S.D GXand */
0x50, /* S.~D GXandReverse */
0xF0, /* S GXcopy */
0x0A, /* ~S.D GXandInverted */
0xAA, /* D GXnoop */
0x5A, /* S~=D GXxor */
0xFA, /* S+D GXor */
0x05, /* ~S.~D GXnor */
0xA5, /* S=D GXequiv */
0x55, /* ~D GXinvert */
0xF5, /* S+~D GXorReverse */
0x0F, /* ~S GXcopyInverted */
0xAF, /* ~S+D GXorInverted */
0x5F, /* ~S+~D GXnand */
0xFF /* 1 GXset */
};
#endif
static void LgSetBitmask(CirPtr pCir, const CARD32 m);
static void LgWaitQAvail(CirPtr pCir, int n);
static CARD32 LgExpandColor(CARD32 color, int bpp);
static void LgSync(ScrnInfoPtr pScrn);
static void LgSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask);
static void LgSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
int w, int h);
static void LgSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
int rop, unsigned int planemask,
int transparency_color);
static void LgSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2, int w, int h);
/**************************************************** LgXAAInit *****/
Bool
LgXAAInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CirPtr pCir = CIRPTR(pScrn);
XAAInfoRecPtr XAAPtr;
XAAPtr = XAACreateInfoRec();
if (!XAAPtr)
return FALSE;
/*
* Solid color fills.
*/
XAAPtr->SetupForSolidFill = LgSetupForSolidFill;
XAAPtr->SubsequentSolidFillRect = LgSubsequentSolidFillRect;
XAAPtr->SubsequentSolidFillTrap = NULL;
XAAPtr->SolidFillFlags = 0;
/*
* Screen-to-screen copies.
*/
XAAPtr->SetupForScreenToScreenCopy = LgSetupForScreenToScreenCopy;
XAAPtr->SubsequentScreenToScreenCopy = LgSubsequentScreenToScreenCopy;
/* Maybe ONLY_LEFT_TO_RIGHT_BITBLT or ONLY_TWO_BITBLT_DIRECTIONS? */
XAAPtr->ScreenToScreenCopyFlags = ONLY_LEFT_TO_RIGHT_BITBLT;
/*
* Miscellany.
*/
XAAPtr->Sync = LgSync;
pCir->AccelInfoRec = XAAPtr;
if (!XAAInit(pScreen, XAAPtr))
return FALSE;
return TRUE;
}
/******************************************** Lg XAA helper functions ***/
/*
* The bitmask is usually all 1's, so it's silly to spend a DWORD write
* to program the register with the same value each time. Bitmask is
* about the only register whose value is worth shadowing, so we special-
* case it.
*/
static void
LgSetBitmask(CirPtr pCir, const CARD32 m)
{
const LgPtr pLg = LGPTR(pCir);
if (m != pLg->oldBitmask) {
LgSETBITMASK(m);
pLg->oldBitmask = m;
}
}
/*
* Return from the function only when there's room somewhere for the
* upcoming register writes. That means that either PCI retry is enabled
* (i.e., we let the PCI bus buffer the register writes), or we wait for
* room in the Laguna's command queue explicitly.
*/
static void
LgWaitQAvail(CirPtr pCir, int n)
{
if (!0/*lgUsePCIRetry*/) {
CARD8 qfree;
/* Wait until n entries are open in the command queue */
do
qfree = *(volatile CARD8 *)(pCir->IOBase + QFREE);
while (qfree < n);
}
}
/* We might want to make this a macro at some point. */
static CARD32
LgExpandColor(CARD32 color, int bpp)
{
if (8 == bpp)
color = ((color&0xFF) << 8) | (color&0xFF);
if (8 == bpp || 16 == bpp)
color = ((color&0xFFFF) << 16) | (color&0xFFFF);
return color;
}
/*************************************************** Lg XAA functions ***/
static void
LgSync(ScrnInfoPtr pScrn)
{
const CirPtr pCir = CIRPTR(pScrn);
#if 0
LgPtr pLg = LGPTR(pScrn);
#endif
while (!LgREADY())
;
}
static void
LgSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask)
{
const CirPtr pCir = CIRPTR(pScrn);
color = LgExpandColor(color, pScrn->bitsPerPixel);
LgWaitQAvail(pCir, 4);
LgSETBACKGROUND(color);
LgSETROP(lgRop[rop]);
LgSETMODE(SCR2SCR | COLORFILL);
LgSetBitmask(pCir, planemask);
}
static void
LgSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
const CirPtr pCir = CIRPTR(pScrn);
/* Wait for room in the command queue. */
LgWaitQAvail(pCir, 2);
LgSETDSTXY(x, y);
LgSETEXTENTS(w, h);
}
static void
LgSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
int rop, unsigned int planemask, int transparency_color)
{
int bltmode = 0;
const CirPtr pCir = CIRPTR(pScrn);
const LgPtr pLg = LGPTR(pCir);
pLg->blitTransparent = (transparency_color != -1);
pLg->blitYDir = ydir;
LgWaitQAvail(pCir, 4);
/* We set the rop up here because the LgSETROP macro conveniently
(really -- it is convenient!) clears the transparency bits
in DRAWDEF. We'll set those bits appropriatly later. */
LgSETROP(lgRop[rop]);
if (ydir < 0)
bltmode |= BLITUP;
if (pLg->blitTransparent) {
/* Gotta extend the transparency_color to the full 32-bit
size of the register. */
transparency_color = LgExpandColor(transparency_color,
pScrn->bitsPerPixel);
bltmode |= COLORTRANS;
LgSETBACKGROUND(transparency_color);
LgSETTRANSPARENCY(TRANSEQ);
} else {
LgSETTRANSPARENCY(TRANSNONE);
}
LgSETMODE(SCR2SCR | COLORSRC | bltmode);
LgSetBitmask(pCir, planemask);
}
static void
LgSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2, int w, int h)
{
const CirPtr pCir = CIRPTR(pScrn);
const LgPtr pLg = LGPTR(pCir);
/*
* We have set the flag indicating that xdir must be one,
* so we can assume that here.
*/
if (pLg->blitYDir == -1) {
y1 += h - 1;
y2 += h - 1;
}
if (pLg->blitTransparent) {
/* We're doing a transparent blit. We'll need to point
OP2 to the color compare mask. */
LgWaitQAvail(pCir, 4);
LgSETTRANSMASK(x1, y1);
} else {
LgWaitQAvail(pCir, 3);
}
LgSETSRCXY(x1, y1);
LgSETDSTXY(x2, y2);
LgSETEXTENTS(w, h);
}
#endif
|
f98061e0f34e5c3f652eca26ddeb8f7f99a4fae7
|
13e2a9bf3ebb4d2c6cdcc5b3cadaa9d87d94933e
|
/src/game/scenes/mainmenu/menu_configuration.h
|
28f5c34e1d7458ac418367f37726312d81ff8629
|
[
"MIT"
] |
permissive
|
omf2097/openomf
|
5421fa6702efa16c33b4154bfacd36a1a9127aae
|
4287067184d9f16d02035f6cf0abcafb0f9755be
|
refs/heads/master
| 2023-08-26T00:39:11.531162
| 2023-07-27T14:49:11
| 2023-07-27T14:49:11
| 7,473,802
| 299
| 40
|
MIT
| 2023-07-27T14:49:13
| 2013-01-06T22:58:13
|
C
|
UTF-8
|
C
| false
| false
| 203
|
h
|
menu_configuration.h
|
#ifndef MENU_CONFIGURATION_H
#define MENU_CONFIGURATION_H
#include "game/gui/component.h"
#include "game/protos/scene.h"
component *menu_configuration_create(scene *s);
#endif // MENU_CONFIGURATION_H
|
fe36a662a2d2bb8ec7718b2b0665af03925ca07d
|
1230116ab815731ef387f9037852a00fadc95041
|
/cudaSiftH.h
|
2919545eb57d59fdabd255687e02b538de6b8de2
|
[
"MIT",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
Celebrandil/CudaSift
|
cd3cf17e2c1fa41e2a023609866a995ba08d6794
|
5bc874af176224770da573eb0135b3494e553690
|
refs/heads/Pascal
| 2023-08-30T03:07:34.049364
| 2019-06-12T11:35:07
| 2019-06-12T11:35:07
| 10,821,793
| 808
| 288
|
MIT
| 2023-09-12T18:52:16
| 2013-06-20T14:38:10
|
Cuda
|
UTF-8
|
C
| false
| false
| 1,490
|
h
|
cudaSiftH.h
|
#ifndef CUDASIFTH_H
#define CUDASIFTH_H
#include "cudautils.h"
#include "cudaImage.h"
//********************************************************//
// CUDA SIFT extractor by Marten Bjorkman aka Celebrandil //
//********************************************************//
int ExtractSiftLoop(SiftData &siftData, CudaImage &img, int numOctaves, double initBlur, float thresh, float lowestScale, float subsampling, float *memoryTmp, float *memorySub);
void ExtractSiftOctave(SiftData &siftData, CudaImage &img, int octave, float thresh, float lowestScale, float subsampling, float *memoryTmp);
double ScaleDown(CudaImage &res, CudaImage &src, float variance);
double ScaleUp(CudaImage &res, CudaImage &src);
double ComputeOrientations(cudaTextureObject_t texObj, CudaImage &src, SiftData &siftData, int octave);
double ExtractSiftDescriptors(cudaTextureObject_t texObj, SiftData &siftData, float subsampling, int octave);
double OrientAndExtract(cudaTextureObject_t texObj, SiftData &siftData, float subsampling, int octave);
double RescalePositions(SiftData &siftData, float scale);
double LowPass(CudaImage &res, CudaImage &src, float scale);
void PrepareLaplaceKernels(int numOctaves, float initBlur, float *kernel);
double LaplaceMulti(cudaTextureObject_t texObj, CudaImage &baseImage, CudaImage *results, int octave);
double FindPointsMulti(CudaImage *sources, SiftData &siftData, float thresh, float edgeLimit, float factor, float lowestScale, float subsampling, int octave);
#endif
|
610342686a0b1cf60801c85f11c015a20af7f144
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/mips/include/asm/mach-tx49xx/mangle-port.h
|
490867b03c8f6cb9d1834ed87e590928830aec26
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 786
|
h
|
mangle-port.h
|
#ifndef __ASM_MACH_TX49XX_MANGLE_PORT_H
#define __ASM_MACH_TX49XX_MANGLE_PORT_H
#define __swizzle_addr_b(port) (port)
#define __swizzle_addr_w(port) (port)
#define __swizzle_addr_l(port) (port)
#define __swizzle_addr_q(port) (port)
#define ioswabb(a, x) (x)
#define __mem_ioswabb(a, x) (x)
#if defined(CONFIG_TOSHIBA_RBTX4939) && \
IS_ENABLED(CONFIG_SMC91X) && \
defined(__BIG_ENDIAN)
#define NEEDS_TXX9_IOSWABW
extern u16 (*ioswabw)(volatile u16 *a, u16 x);
extern u16 (*__mem_ioswabw)(volatile u16 *a, u16 x);
#else
#define ioswabw(a, x) le16_to_cpu(x)
#define __mem_ioswabw(a, x) (x)
#endif
#define ioswabl(a, x) le32_to_cpu(x)
#define __mem_ioswabl(a, x) (x)
#define ioswabq(a, x) le64_to_cpu(x)
#define __mem_ioswabq(a, x) (x)
#endif /* __ASM_MACH_TX49XX_MANGLE_PORT_H */
|
97f5253a26b959030d5b4e956982a6a46b7a05be
|
8a51a96f61699f0318315ccc89cef39f6866f2b5
|
/src/common/hmac_openssl.c
|
12be542fa27ec9985a78aac9a1ac4bc76369945d
|
[
"PostgreSQL"
] |
permissive
|
postgres/postgres
|
979febf2b41c00090d1256228f768f33e7ef3b6f
|
b5934bfd6071fed3a38cea0cfaa93afda63d9c0c
|
refs/heads/master
| 2023-08-31T00:10:01.373472
| 2023-08-30T23:07:48
| 2023-08-30T23:07:48
| 927,442
| 13,691
| 4,807
|
NOASSERTION
| 2023-09-09T13:59:15
| 2010-09-21T11:35:45
|
C
|
UTF-8
|
C
| false
| false
| 7,084
|
c
|
hmac_openssl.c
|
/*-------------------------------------------------------------------------
*
* hmac_openssl.c
* Implementation of HMAC with OpenSSL.
*
* This should only be used if code is compiled with OpenSSL support.
*
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* src/common/hmac_openssl.c
*
*-------------------------------------------------------------------------
*/
#ifndef FRONTEND
#include "postgres.h"
#else
#include "postgres_fe.h"
#endif
#include <openssl/err.h>
#include <openssl/hmac.h>
#include "common/hmac.h"
#include "common/md5.h"
#include "common/sha1.h"
#include "common/sha2.h"
#ifndef FRONTEND
#include "utils/memutils.h"
#include "utils/resowner.h"
#include "utils/resowner_private.h"
#endif
/*
* In backend, use an allocation in TopMemoryContext to count for resowner
* cleanup handling if necessary. For versions of OpenSSL where HMAC_CTX is
* known, just use palloc(). In frontend, use malloc to be able to return
* a failure status back to the caller.
*/
#ifndef FRONTEND
#ifdef HAVE_HMAC_CTX_NEW
#define ALLOC(size) MemoryContextAlloc(TopMemoryContext, size)
#else
#define ALLOC(size) palloc(size)
#endif
#define FREE(ptr) pfree(ptr)
#else /* FRONTEND */
#define ALLOC(size) malloc(size)
#define FREE(ptr) free(ptr)
#endif /* FRONTEND */
/* Set of error states */
typedef enum pg_hmac_errno
{
PG_HMAC_ERROR_NONE = 0,
PG_HMAC_ERROR_DEST_LEN,
PG_HMAC_ERROR_OPENSSL
} pg_hmac_errno;
/* Internal pg_hmac_ctx structure */
struct pg_hmac_ctx
{
HMAC_CTX *hmacctx;
pg_cryptohash_type type;
pg_hmac_errno error;
const char *errreason;
#ifndef FRONTEND
ResourceOwner resowner;
#endif
};
static const char *
SSLerrmessage(unsigned long ecode)
{
if (ecode == 0)
return NULL;
/*
* This may return NULL, but we would fall back to a default error path if
* that were the case.
*/
return ERR_reason_error_string(ecode);
}
/*
* pg_hmac_create
*
* Allocate a hash context. Returns NULL on failure for an OOM. The
* backend issues an error, without returning.
*/
pg_hmac_ctx *
pg_hmac_create(pg_cryptohash_type type)
{
pg_hmac_ctx *ctx;
ctx = ALLOC(sizeof(pg_hmac_ctx));
if (ctx == NULL)
return NULL;
memset(ctx, 0, sizeof(pg_hmac_ctx));
ctx->type = type;
ctx->error = PG_HMAC_ERROR_NONE;
ctx->errreason = NULL;
/*
* Initialization takes care of assigning the correct type for OpenSSL.
* Also ensure that there aren't any unconsumed errors in the queue from
* previous runs.
*/
ERR_clear_error();
#ifdef HAVE_HMAC_CTX_NEW
#ifndef FRONTEND
ResourceOwnerEnlargeHMAC(CurrentResourceOwner);
#endif
ctx->hmacctx = HMAC_CTX_new();
#else
ctx->hmacctx = ALLOC(sizeof(HMAC_CTX));
#endif
if (ctx->hmacctx == NULL)
{
explicit_bzero(ctx, sizeof(pg_hmac_ctx));
FREE(ctx);
#ifndef FRONTEND
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
#endif
return NULL;
}
#ifdef HAVE_HMAC_CTX_NEW
#ifndef FRONTEND
ctx->resowner = CurrentResourceOwner;
ResourceOwnerRememberHMAC(CurrentResourceOwner, PointerGetDatum(ctx));
#endif
#else
memset(ctx->hmacctx, 0, sizeof(HMAC_CTX));
#endif /* HAVE_HMAC_CTX_NEW */
return ctx;
}
/*
* pg_hmac_init
*
* Initialize a HMAC context. Returns 0 on success, -1 on failure.
*/
int
pg_hmac_init(pg_hmac_ctx *ctx, const uint8 *key, size_t len)
{
int status = 0;
if (ctx == NULL)
return -1;
switch (ctx->type)
{
case PG_MD5:
status = HMAC_Init_ex(ctx->hmacctx, key, len, EVP_md5(), NULL);
break;
case PG_SHA1:
status = HMAC_Init_ex(ctx->hmacctx, key, len, EVP_sha1(), NULL);
break;
case PG_SHA224:
status = HMAC_Init_ex(ctx->hmacctx, key, len, EVP_sha224(), NULL);
break;
case PG_SHA256:
status = HMAC_Init_ex(ctx->hmacctx, key, len, EVP_sha256(), NULL);
break;
case PG_SHA384:
status = HMAC_Init_ex(ctx->hmacctx, key, len, EVP_sha384(), NULL);
break;
case PG_SHA512:
status = HMAC_Init_ex(ctx->hmacctx, key, len, EVP_sha512(), NULL);
break;
}
/* OpenSSL internals return 1 on success, 0 on failure */
if (status <= 0)
{
ctx->errreason = SSLerrmessage(ERR_get_error());
ctx->error = PG_HMAC_ERROR_OPENSSL;
return -1;
}
return 0;
}
/*
* pg_hmac_update
*
* Update a HMAC context. Returns 0 on success, -1 on failure.
*/
int
pg_hmac_update(pg_hmac_ctx *ctx, const uint8 *data, size_t len)
{
int status = 0;
if (ctx == NULL)
return -1;
status = HMAC_Update(ctx->hmacctx, data, len);
/* OpenSSL internals return 1 on success, 0 on failure */
if (status <= 0)
{
ctx->errreason = SSLerrmessage(ERR_get_error());
ctx->error = PG_HMAC_ERROR_OPENSSL;
return -1;
}
return 0;
}
/*
* pg_hmac_final
*
* Finalize a HMAC context. Returns 0 on success, -1 on failure.
*/
int
pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len)
{
int status = 0;
uint32 outlen;
if (ctx == NULL)
return -1;
switch (ctx->type)
{
case PG_MD5:
if (len < MD5_DIGEST_LENGTH)
{
ctx->error = PG_HMAC_ERROR_DEST_LEN;
return -1;
}
break;
case PG_SHA1:
if (len < SHA1_DIGEST_LENGTH)
{
ctx->error = PG_HMAC_ERROR_DEST_LEN;
return -1;
}
break;
case PG_SHA224:
if (len < PG_SHA224_DIGEST_LENGTH)
{
ctx->error = PG_HMAC_ERROR_DEST_LEN;
return -1;
}
break;
case PG_SHA256:
if (len < PG_SHA256_DIGEST_LENGTH)
{
ctx->error = PG_HMAC_ERROR_DEST_LEN;
return -1;
}
break;
case PG_SHA384:
if (len < PG_SHA384_DIGEST_LENGTH)
{
ctx->error = PG_HMAC_ERROR_DEST_LEN;
return -1;
}
break;
case PG_SHA512:
if (len < PG_SHA512_DIGEST_LENGTH)
{
ctx->error = PG_HMAC_ERROR_DEST_LEN;
return -1;
}
break;
}
status = HMAC_Final(ctx->hmacctx, dest, &outlen);
/* OpenSSL internals return 1 on success, 0 on failure */
if (status <= 0)
{
ctx->errreason = SSLerrmessage(ERR_get_error());
ctx->error = PG_HMAC_ERROR_OPENSSL;
return -1;
}
return 0;
}
/*
* pg_hmac_free
*
* Free a HMAC context.
*/
void
pg_hmac_free(pg_hmac_ctx *ctx)
{
if (ctx == NULL)
return;
#ifdef HAVE_HMAC_CTX_FREE
HMAC_CTX_free(ctx->hmacctx);
#ifndef FRONTEND
ResourceOwnerForgetHMAC(ctx->resowner, PointerGetDatum(ctx));
#endif
#else
explicit_bzero(ctx->hmacctx, sizeof(HMAC_CTX));
FREE(ctx->hmacctx);
#endif
explicit_bzero(ctx, sizeof(pg_hmac_ctx));
FREE(ctx);
}
/*
* pg_hmac_error
*
* Returns a static string providing details about an error that happened
* during a HMAC computation.
*/
const char *
pg_hmac_error(pg_hmac_ctx *ctx)
{
if (ctx == NULL)
return _("out of memory");
/*
* If a reason is provided, rely on it, else fallback to any error code
* set.
*/
if (ctx->errreason)
return ctx->errreason;
switch (ctx->error)
{
case PG_HMAC_ERROR_NONE:
return _("success");
case PG_HMAC_ERROR_DEST_LEN:
return _("destination buffer too small");
case PG_HMAC_ERROR_OPENSSL:
return _("OpenSSL failure");
}
Assert(false); /* cannot be reached */
return _("success");
}
|
a2f473ed78f58e60d691f8c38c30e3437e4ab9c8
|
07aeb5740a8dae36edf24e2686ff67e2959758fe
|
/programs/subprojects/doom/st_lib.c
|
7ce978d4456288a6964bbbeeeb69fd36e1010638
|
[
"MIT"
] |
permissive
|
codyd51/axle
|
59e992987bb871296aeadc69fc7244798090f3b1
|
96ae8852f15ad5c0a77c621c323ba47b4a7bdc69
|
refs/heads/paging-demo
| 2023-06-08T11:31:19.429032
| 2023-05-30T06:45:30
| 2023-05-30T06:45:30
| 58,590,685
| 597
| 61
|
MIT
| 2023-02-21T06:02:34
| 2016-05-11T23:41:08
|
C
|
UTF-8
|
C
| false
| false
| 4,691
|
c
|
st_lib.c
|
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// The status bar widget code.
//
#include <stdio.h>
#include <ctype.h>
#include "deh_main.h"
#include "doomdef.h"
#include "z_zone.h"
#include "v_video.h"
#include "i_swap.h"
#include "i_system.h"
#include "w_wad.h"
#include "st_stuff.h"
#include "st_lib.h"
#include "r_local.h"
// in AM_map.c
extern boolean automapactive;
//
// Hack display negative frags.
// Loads and store the stminus lump.
//
patch_t* sttminus;
void STlib_init(void)
{
sttminus = (patch_t *) W_CacheLumpName(DEH_String("STTMINUS"), PU_STATIC);
}
// ?
void
STlib_initNum
( st_number_t* n,
int x,
int y,
patch_t** pl,
int* num,
boolean* on,
int width )
{
n->x = x;
n->y = y;
n->oldnum = 0;
n->width = width;
n->num = num;
n->on = on;
n->p = pl;
}
//
// A fairly efficient way to draw a number
// based on differences from the old number.
// Note: worth the trouble?
//
void
STlib_drawNum
( st_number_t* n,
boolean refresh )
{
int numdigits = n->width;
int num = *n->num;
int w = SHORT(n->p[0]->width);
int h = SHORT(n->p[0]->height);
int x = n->x;
int neg;
n->oldnum = *n->num;
neg = num < 0;
if (neg)
{
if (numdigits == 2 && num < -9)
num = -9;
else if (numdigits == 3 && num < -99)
num = -99;
num = -num;
}
// clear the area
x = n->x - numdigits*w;
if (n->y - ST_Y < 0)
I_Error("drawNum: n->y - ST_Y < 0");
V_CopyRect(x, n->y - ST_Y, st_backing_screen, w*numdigits, h, x, n->y);
// if non-number, do not draw it
if (num == 1994)
return;
x = n->x;
// in the special case of 0, you draw 0
if (!num)
V_DrawPatch(x - w, n->y, n->p[ 0 ]);
// draw the new number
while (num && numdigits--)
{
x -= w;
V_DrawPatch(x, n->y, n->p[ num % 10 ]);
num /= 10;
}
// draw a minus sign if necessary
if (neg)
V_DrawPatch(x - 8, n->y, sttminus);
}
//
void
STlib_updateNum
( st_number_t* n,
boolean refresh )
{
if (*n->on) STlib_drawNum(n, refresh);
}
//
void
STlib_initPercent
( st_percent_t* p,
int x,
int y,
patch_t** pl,
int* num,
boolean* on,
patch_t* percent )
{
STlib_initNum(&p->n, x, y, pl, num, on, 3);
p->p = percent;
}
void
STlib_updatePercent
( st_percent_t* per,
int refresh )
{
if (refresh && *per->n.on)
V_DrawPatch(per->n.x, per->n.y, per->p);
STlib_updateNum(&per->n, refresh);
}
void
STlib_initMultIcon
( st_multicon_t* i,
int x,
int y,
patch_t** il,
int* inum,
boolean* on )
{
i->x = x;
i->y = y;
i->oldinum = -1;
i->inum = inum;
i->on = on;
i->p = il;
}
void
STlib_updateMultIcon
( st_multicon_t* mi,
boolean refresh )
{
int w;
int h;
int x;
int y;
if (*mi->on && (mi->oldinum != *mi->inum || refresh) && (*mi->inum != -1))
{
if (mi->oldinum != -1)
{
x = mi->x - SHORT(mi->p[mi->oldinum]->leftoffset);
y = mi->y - SHORT(mi->p[mi->oldinum]->topoffset);
w = SHORT(mi->p[mi->oldinum]->width);
h = SHORT(mi->p[mi->oldinum]->height);
if (y - ST_Y < 0)
I_Error("updateMultIcon: y - ST_Y < 0");
V_CopyRect(x, y-ST_Y, st_backing_screen, w, h, x, y);
}
V_DrawPatch(mi->x, mi->y, mi->p[*mi->inum]);
mi->oldinum = *mi->inum;
}
}
void
STlib_initBinIcon
( st_binicon_t* b,
int x,
int y,
patch_t* i,
boolean* val,
boolean* on )
{
b->x = x;
b->y = y;
b->oldval = false;
b->val = val;
b->on = on;
b->p = i;
}
void
STlib_updateBinIcon
( st_binicon_t* bi,
boolean refresh )
{
int x;
int y;
int w;
int h;
if (*bi->on
&& (bi->oldval != *bi->val || refresh))
{
x = bi->x - SHORT(bi->p->leftoffset);
y = bi->y - SHORT(bi->p->topoffset);
w = SHORT(bi->p->width);
h = SHORT(bi->p->height);
if (y - ST_Y < 0)
I_Error("updateBinIcon: y - ST_Y < 0");
if (*bi->val)
V_DrawPatch(bi->x, bi->y, bi->p);
else
V_CopyRect(x, y-ST_Y, st_backing_screen, w, h, x, y);
bi->oldval = *bi->val;
}
}
|
342dac62655dcf1d75c3ab1af2cb73f2c54d6638
|
e4a8425dd2eb2089a428ae8a4471264ccfb25c96
|
/libs/dutils_image/src/dutils_img_filter/simd_helper/see_intrin_base.h
|
827a79e3c34fa3c2efea7e3f6890288cd0fd493b
|
[
"MIT",
"BSD-3-Clause",
"BSL-1.0",
"Apache-2.0",
"LGPL-2.0-only",
"LicenseRef-scancode-public-domain"
] |
permissive
|
TheImagingSource/tiscamera
|
b2175152740f6307041fc5fc60f551eedb3a6c95
|
0be2537f8816c5ec892a4ebe4ad0f196f26021e7
|
refs/heads/master
| 2023-09-01T12:01:36.979982
| 2023-07-12T04:52:39
| 2023-07-12T04:52:39
| 16,314,708
| 279
| 159
|
Apache-2.0
| 2023-07-12T04:52:40
| 2014-01-28T14:53:28
|
C++
|
UTF-8
|
C
| false
| false
| 518
|
h
|
see_intrin_base.h
|
#ifndef SEE_INTRIN_BASE_H_INC__
#define SEE_INTRIN_BASE_H_INC__
#pragma once
#include <dutils_img/dutils_cpu_features.h>
#include "../src/dutils_img_base/interop_private.h"
#if !defined DUTILS_ARCH_ARM
#define DUTILS_SIMD_USAGE_LEVEL_SSSE3 3
#define DUTILS_SIMD_USAGE_LEVEL_SSE41 4
#define DUTILS_SIMD_USAGE_LEVEL_AVX1 5
#define DUTILS_SIMD_USAGE_LEVEL_AVX2 6
#else
#define DUTILS_SIMD_USAGE_LEVEL_ARM_A8 1
#define DUTILS_SIMD_USAGE_LEVEL_ARM_A64 2
#endif
#endif // SEE_INTRIN_BASE_H_INC__
|
989a43101deb023fc95e92482f9e6b1b8b5a5306
|
7744859512f027ef0da8b1bde0f8518e631b98eb
|
/soh/assets/scenes/dungeons/MIZUsin/MIZUsin_room_10.h
|
eab10f111325171e6d39ba98d7aab47f7d126fd6
|
[] |
no_license
|
HarbourMasters/Shipwright
|
7f70b9470e4f9a117f3fe2d6e4deb776b8742182
|
0e7c6585239c0d7ea2c039b8b8cb7eaedf8928a9
|
refs/heads/develop
| 2023-08-31T20:50:56.253521
| 2023-08-30T17:34:06
| 2023-08-30T17:34:06
| 472,575,717
| 2,104
| 459
| null | 2023-09-14T20:29:01
| 2022-03-22T01:42:52
|
C
|
UTF-8
|
C
| false
| false
| 2,469
|
h
|
MIZUsin_room_10.h
|
#pragma once
#include "align_asset_macro.h"
#define dMIZUsin_room_10DL_001B80 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_001B80"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_001B80[] = dMIZUsin_room_10DL_001B80;
#define dMIZUsin_room_10DL_000FE0 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_000FE0"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_000FE0[] = dMIZUsin_room_10DL_000FE0;
#define dMIZUsin_room_10Tex_004870 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10Tex_004870"
static const ALIGN_ASSET(2) char MIZUsin_room_10Tex_004870[] = dMIZUsin_room_10Tex_004870;
#define dMIZUsin_room_10Tex_005870 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10Tex_005870"
static const ALIGN_ASSET(2) char MIZUsin_room_10Tex_005870[] = dMIZUsin_room_10Tex_005870;
#define dMIZUsin_room_10Tex_005070 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10Tex_005070"
static const ALIGN_ASSET(2) char MIZUsin_room_10Tex_005070[] = dMIZUsin_room_10Tex_005070;
#define dMIZUsin_room_10Tex_004070 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10Tex_004070"
static const ALIGN_ASSET(2) char MIZUsin_room_10Tex_004070[] = dMIZUsin_room_10Tex_004070;
#define dMIZUsin_room_10DL_003298 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_003298"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_003298[] = dMIZUsin_room_10DL_003298;
#define dMIZUsin_room_10Tex_003870 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10Tex_003870"
static const ALIGN_ASSET(2) char MIZUsin_room_10Tex_003870[] = dMIZUsin_room_10Tex_003870;
#define dMIZUsin_room_10DL_001E60 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_001E60"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_001E60[] = dMIZUsin_room_10DL_001E60;
#define dMIZUsin_room_10DL_0036D8 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_0036D8"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_0036D8[] = dMIZUsin_room_10DL_0036D8;
#define dMIZUsin_room_10DL_002708 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_002708"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_002708[] = dMIZUsin_room_10DL_002708;
#define dMIZUsin_room_10DL_0021D0 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_0021D0"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_0021D0[] = dMIZUsin_room_10DL_0021D0;
#define dMIZUsin_room_10DL_002FE0 "__OTR__scenes/nonmq/MIZUsin_scene/MIZUsin_room_10DL_002FE0"
static const ALIGN_ASSET(2) char MIZUsin_room_10DL_002FE0[] = dMIZUsin_room_10DL_002FE0;
|
e614c5f387d6b7bd9f87baf12c8b6e1b94017432
|
edf4f46f7b473ce341ba292f84e3d1760218ebd1
|
/third_party/openssl/openssl/test/ecdhtest_cavs.h
|
fee701185bb65be50ddd1d86cc8bad95ae488a6e
|
[
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"OpenSSL",
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] |
permissive
|
openweave/openweave-core
|
7e7e6f6c089e2e8015a8281f74fbdcaf4aca5d2a
|
e3c8ca3d416a2e1687d6f5b7cec0b7d0bf1e590e
|
refs/heads/master
| 2022-11-01T17:21:59.964473
| 2022-08-10T16:36:19
| 2022-08-10T16:36:19
| 101,915,019
| 263
| 125
|
Apache-2.0
| 2022-10-17T18:48:30
| 2017-08-30T18:22:10
|
C++
|
UTF-8
|
C
| false
| false
| 228,466
|
h
|
ecdhtest_cavs.h
|
/*
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef ECDHTEST_CAVS_H
#define ECDHTEST_CAVS_H
/*
* co-factor ECDH KATs for NIST SP800-56A
* http://csrc.nist.gov/groups/STM/cavp/component-testing.html#ECCCDH
* $ sha256sum KAS_ECC_CDH_PrimitiveTest.txt
* 456068d3f8aad8ac62a03d19ed3173f00ad51f42b51aeab4753c20f30c01cf23 KAS_ECC_CDH_PrimitiveTest.txt
*/
typedef struct {
const int nid;
const char *QCAVSx;
const char *QCAVSy;
const char *dIUT;
const char *QIUTx;
const char *QIUTy;
const char *ZIUT;
} ecdh_cavs_kat_t;
static const ecdh_cavs_kat_t ecdh_cavs_kats[] = {
/* curves over prime fields go here */
{ NID_X9_62_prime192v1,
"42ea6dd9969dd2a61fea1aac7f8e98edcc896c6e55857cc0",
"dfbe5d7c61fac88b11811bde328e8a0d12bf01a9d204b523",
"f17d3fea367b74d340851ca4270dcb24c271f445bed9d527",
"b15053401f57285637ec324c1cd2139e3a67de3739234b37",
"f269c158637482aad644cd692dd1d3ef2c8a7c49e389f7f6",
"803d8ab2e5b6e6fca715737c3a82f7ce3c783124f6d51cd0" },
{ NID_X9_62_prime192v1,
"deb5712fa027ac8d2f22c455ccb73a91e17b6512b5e030e7",
"7e2690a02cc9b28708431a29fb54b87b1f0c14e011ac2125",
"56e853349d96fe4c442448dacb7cf92bb7a95dcf574a9bd5",
"c00d435716ffea53fd8c162792414c37665187e582716539",
"ab711c62aa71a5a18e8a3c48f89dc6fa52fac0108e52a8a0",
"c208847568b98835d7312cef1f97f7aa298283152313c29d" },
{ NID_X9_62_prime192v1,
"4edaa8efc5a0f40f843663ec5815e7762dddc008e663c20f",
"0a9f8dc67a3e60ef6d64b522185d03df1fc0adfd42478279",
"c6ef61fe12e80bf56f2d3f7d0bb757394519906d55500949",
"e184bc182482f3403c8787b83842477467fcd011db0f6c64",
"f9d1c14142f40de8639db97d51a63d2cce1007ccf773cdcb",
"87229107047a3b611920d6e3b2c0c89bea4f49412260b8dd" },
{ NID_X9_62_prime192v1,
"8887c276edeed3e9e866b46d58d895c73fbd80b63e382e88",
"04c5097ba6645e16206cfb70f7052655947dd44a17f1f9d5",
"e6747b9c23ba7044f38ff7e62c35e4038920f5a0163d3cda",
"2b838dbe73735f37a39a78d3195783d26991e86ff4d92d1a",
"60d344942274489f98903b2e7f93f8d197fc9ae60a0ed53a",
"eec0bed8fc55e1feddc82158fd6dc0d48a4d796aaf47d46c" },
{ NID_X9_62_prime192v1,
"0d045f30254adc1fcefa8a5b1f31bf4e739dd327cd18d594",
"542c314e41427c08278a08ce8d7305f3b5b849c72d8aff73",
"beabedd0154a1afcfc85d52181c10f5eb47adc51f655047d",
"1f65cf6e8978e1c1bc10bb61a7db311de310088c8cf9768b",
"f7d438168e7f42ab14b16af53a7a2f646ff40b53d74cbcc7",
"716e743b1b37a2cd8479f0a3d5a74c10ba2599be18d7e2f4" },
{ NID_X9_62_prime192v1,
"fb35ca20d2e96665c51b98e8f6eb3d79113508d8bccd4516",
"368eec0d5bfb847721df6aaff0e5d48c444f74bf9cd8a5a7",
"cf70354226667321d6e2baf40999e2fd74c7a0f793fa8699",
"5f4844ffcce61005d24f737db98675e92f7b6543aeb6106c",
"5424f598139215d389b6b12b86d58014857f2ddadb540f51",
"f67053b934459985a315cb017bf0302891798d45d0e19508" },
{ NID_X9_62_prime192v1,
"824752960c1307e5f13a83da21c7998ca8b5b00b9549f6d0",
"bc52d91e234363bc32ee0b6778f25cd8c1847510f4348b94",
"fe942515237fffdd7b4eb5c64909eee4856a076cdf12bae2",
"e6369df79b207b8b8679f7c869cfc264859d1ab55aa401e8",
"1f99c71f801a30b52f74da6e5e6dbb62ee4c5da1090cc020",
"75822971193edd472bf30151a782619c55ad0b279c9303dd" },
{ NID_X9_62_prime192v1,
"10bb57020291141981f833b4749e5611034b308e84011d21",
"e1cacd6b7bd17ed8ddb50b6aee0654c35f2d0eddc1cffcf6",
"33fed10492afa5bea0333c0af12cac940c4d222455bcd0fe",
"ef0b28afc41637d737f42e4c8aaceadc84ba2e0b849ca18c",
"57797942e552173bba17f73278e029f42335068bd770ddf2",
"67cba2cbb69ee78bf1abafb0e6fbe33fa2094c128d59652d" },
{ NID_X9_62_prime192v1,
"5192fce4185a7758ea1bc56e0e4f4e8b2dce32348d0dced1",
"20989981beaaf0006d88a96e7971a2fa3a33ba46047fc7ba",
"f3557c5d70b4c7954960c33568776adbe8e43619abe26b13",
"d70112c5f0f0844386494ac1ad99dce2214134176ebfb9af",
"d3c187a038510ab31d459e2b7af1a380dd7576af06267548",
"cf99a2770a386ca0137d1eca0a226e484297ac3c513f3631" },
{ NID_X9_62_prime192v1,
"26d019dbe279ead01eed143a91601ada26e2f42225b1c62b",
"6ca653f08272e0386fc9421fbd580093d7ae6301bca94476",
"586cfba1c6e81766ed52828f177b1be14ebbc5b83348c311",
"58b3c63e56bec9d696bf9a88df2873738391f76368aa2b49",
"5776773b261faf7ba2fdc4fe43b92c0b1c7a2fd054a43650",
"576331e2b4fb38a112810e1529834de8307fb0a0d2756877" },
{ NID_X9_62_prime192v1,
"539bc40fe20a0fb267888b647b03eaaf6ec20c02a1e1f8c8",
"69095e5bb7b4d44c3278a7ee6beca397c45246da9a34c8be",
"cad8100603a4f65be08d8fc8a1b7e884c5ff65deb3c96d99",
"b7fcc0f52c7a411edbed39e10bf02b6ae0f26614c6b325a2",
"47483b26eb67776de2b93ab7119d5447573739e3d55e72fb",
"902f4501916a0dd945554c3a37b3d780d375a6da713197c4" },
{ NID_X9_62_prime192v1,
"5d343ddb96318fb4794d10f6c573f99fee5d0d57b996250f",
"99fbdf9d97dd88ad410235dac36e5b92ce2824b8e587a82c",
"1edd879cc5c79619cae6c73a691bd5a0395c0ef3b356fcd2",
"6ce6adb2c30808f590048c33dffad4524ebf7a5fd39b747b",
"4966bd2f3d00569b4d4c0409fbd7a2db752f6d09bca8c25f",
"46e4de335054d429863218ae33636fc9b89c628b64b506c7" },
{ NID_X9_62_prime192v1,
"8d3db9bdce137ffbfb891388c37df6c0cbc90aa5e5376220",
"135d30b5cb660eef8764ffc744f15c1b5d6dc06ba4416d37",
"460e452273fe1827602187ad3bebee65cb84423bb4f47537",
"d1bd3a3efabf4767fe6380bdf0dbf49d52d4cf0cbb89404c",
"c150c2b4c8b3aa35f765f847e4f7f8fd8704d241a181ee99",
"1bfe9e5a20ac7a38d8f605b425bb9030be31ef97c101c76c" },
{ NID_X9_62_prime192v1,
"9e0a6949519c7f5be68c0433c5fdf13064aa13fb29483dc3",
"e1c8ba63e1f471db23185f50d9c871edea21255b3a63b4b7",
"b970365008456f8758ecc5a3b33cf3ae6a8d568107a52167",
"c1b8610c8c63f8d4abda093b9a11a566044bf65c6faa8999",
"a5bc4b3ca095382e9738aee95fe9479b17879b3ad5295559",
"0e8c493a4adc445dc9288a3b9b272599224054592d7265b3" },
{ NID_X9_62_prime192v1,
"be088238902e9939b3d054eeeb8492daf4bdcf09a2ab77f1",
"58d6749a3a923dc80440f2661fd35b651617e65294b46375",
"59c15b8a2464e41dfe4371c7f7dadf470ae425544f8113bd",
"1fe776f73567b6ac0b0d6764164de6c5be751ba8d1ff455e",
"4c160bf38afb2b71f684261664115ce874553e8b059432d2",
"0f1991086b455ded6a1c4146f7bf59fe9b495de566ebc6bf" },
{ NID_X9_62_prime192v1,
"bf5ae05025e1be617e666d87a4168363873d5761b376b503",
"e1e6e38b372b6bee0ff5b3502d83735e3b2c26825e4f0fcc",
"a6e9b885c66b959d1fc2708d591b6d3228e49eb98f726d61",
"632bb7651dbf49dde9dd125d13fb234e06617723beed3d1b",
"f4ad5209638488397c5f44f994dd7479807e79f4887d2e71",
"b30f2127c34df35aaa91dbf0bbe15798e799a03ed11698c1" },
{ NID_X9_62_prime192v1,
"6cc4feed84c7ab0d09005d660ed34de6955a9461c4138d11",
"31225f33864ed48da06fa45a913b46cf42557742e35085e6",
"bdb754096ffbfbd8b0f3cb046ccb7ca149c4e7192067a3ee",
"d9c098d421d741f6faab116f3e4731d28c5558e19fe112a1",
"38d4dc48ccdb1d3ed8d31fd06784a4f87a68aec1cbd5b08f",
"64a5c246599d3e8177a2402a1110eb81e6c456ab4edb5127" },
{ NID_X9_62_prime192v1,
"36157315bee7afedded58c4e8ba14d3421c401e51135bcc9",
"37c297ca703f77c52bb062d8ce971db84097ba0c753a418f",
"d5bcf2534dafc3d99964c7bd63ab7bd15999fe56dd969c42",
"fda1d5d28d6fe0e7909d6a8bafa7824db5572ab92ffe7de6",
"134a297c1d9c8bbab249abacd951ed11e5a99f92e7991572",
"017b8ca53c82fab163da2ab783966a39e061b32c8cfa334d" },
{ NID_X9_62_prime192v1,
"98464d47f0256f8292e027e8c92582ea77cf9051f5ce8e5d",
"449552ef7578be96236fe5ed9d0643c0bb6c5a9134b0108d",
"43d4b9df1053be5b4268104c02244d3bf9594b010b46a8b2",
"c3020b7091463d788f1f1d76f7cfeec82ecdb3b7d99c345c",
"9a7710d5179591d8f3df0aa122301768ae7db7eee2d7f583",
"340ef3db3dbebdd91c62c3d4e1a3da2c7c52a3338b865259" },
{ NID_X9_62_prime192v1,
"563eb66c334cf6f123bf04c7803b48a3110214237e983bf5",
"0f351104819199ef07c9a6051d20758f3af79027ea66a53f",
"94cac2c2ca714746401670d94edbf3f677867b5a03bee7ad",
"b18554a2e743ef0aa2f040987c4c451004e096df3d80ddae",
"6e3e2c618f896e36ba620077684b70a05ffb79bf5e6c7640",
"2162144921df5103d0e6a650fb13fd246f4738d0896ce92f" },
{ NID_X9_62_prime192v1,
"86828c4ac92b5507618aec7873a1d4fc6543c5be33cf3078",
"b22ca72437545e10d6d4f052422eb898b737a4b8543ee550",
"2a3a9e33c8cc3107a9f9265c3bdea1206570e86f92ac7014",
"a7ba38be1bc669dd23ccfcee0645b1f0db8cf942deafaeb6",
"b82db79d80cd0e37f28d4163adc389dee8fc7797b5c9831b",
"4c69e7feed4b11159adfc16a6047a92572ea44e0740b23af" },
{ NID_X9_62_prime192v1,
"6700a102437781a9581da2bc25ced5abf419da91d3c803df",
"71396c9cf08bcd91854e3e6e42d8c657ce0f27ab77a9dc4b",
"4a6b78a98ac98fa8e99a8ece08ec0251125f85c6fd0e289b",
"e769dbbcd5ce2d83514b768d3d2d5aa0bcd8f66af15f5500",
"2fc6d0b039e0f28f74fbeffe9e883d4dd72296e4e95cae71",
"46072acefd67bff50de355ca7a31fa6be59f26e467587259" },
{ NID_X9_62_prime192v1,
"a82f354cf97bee5d22dc6c079f2902ead44d96a8f614f178",
"a654a9aa8a1a0802f2ce0ee8a0f4ebe96dee1b37464b1ff2",
"c5a6491d78844d6617ef33be6b8bd54da221450885d5950f",
"db1b24f7466bc154e9d7d2c3ca52dcfe0bfc9563c5fdb6f3",
"1c74fbbf5bd99921f1a9a744f8e1cf770bd6a76a772b3003",
"ec5580eabca9f3389d2b427ddf6e49e26d629afd03fa766e" },
{ NID_X9_62_prime192v1,
"3cec21b28668a12a2cf78e1a8e55d0efe065152fffc34718",
"1029557beba4ff1992bd21c23cb4825f6dae70e3318fd1ca",
"2ba2703c5e23f6463c5b88dc37292fabd3399b5e1fb67c05",
"7543148906cef9b37a71a7c08363cdd3bba50142d65241aa",
"8b3a6973de8dc271e27c1ead1e962fdaae3710c724daac38",
"7f3929dd3cbf7673bc30d859d90b880307475f800660ea32" },
{ NID_X9_62_prime192v1,
"7082644715b8b731f8228b5118e7270d34d181f361a221fc",
"464649d6c88ca89614488a1cc7b8442bb42f9fb3020a3d76",
"836118c6248f882e9147976f764826c1a28755a6102977d5",
"fcd345a976c720caaa97de6697226825615e1287a9eff67e",
"58ea42edbeeafca9ff44cfd7f29abd2cbde7626d79e422c9",
"72e88f3ea67d46d46dbf83926e7e2a6b85b54536741e6d2c" },
{ NID_secp224r1,
"af33cd0629bc7e996320a3f40368f74de8704fa37b8fab69abaae280",
"882092ccbba7930f419a8a4f9bb16978bbc3838729992559a6f2e2d7",
"8346a60fc6f293ca5a0d2af68ba71d1dd389e5e40837942df3e43cbd",
"8de2e26adf72c582d6568ef638c4fd59b18da171bdf501f1d929e048",
"4a68a1c2b0fb22930d120555c1ece50ea98dea8407f71be36efac0de",
"7d96f9a3bd3c05cf5cc37feb8b9d5209d5c2597464dec3e9983743e8" },
{ NID_secp224r1,
"13bfcd4f8e9442393cab8fb46b9f0566c226b22b37076976f0617a46",
"eeb2427529b288c63c2f8963c1e473df2fca6caa90d52e2f8db56dd4",
"043cb216f4b72cdf7629d63720a54aee0c99eb32d74477dac0c2f73d",
"2f90f5c8eac9c7decdbb97b6c2f715ab725e4fe40fe6d746efbf4e1b",
"66897351454f927a309b269c5a6d31338be4c19a5acfc32cf656f45c",
"ee93ce06b89ff72009e858c68eb708e7bc79ee0300f73bed69bbca09" },
{ NID_secp224r1,
"756dd806b9d9c34d899691ecb45b771af468ec004486a0fdd283411e",
"4d02c2ca617bb2c5d9613f25dd72413d229fd2901513aa29504eeefb",
"5ad0dd6dbabb4f3c2ea5fe32e561b2ca55081486df2c7c15c9622b08",
"005bca45d793e7fe99a843704ed838315ab14a5f6277507e9bc37531",
"43e9d421e1486ae5893bfd23c210e5c140d7c6b1ada59d842c9a98de",
"3fcc01e34d4449da2a974b23fc36f9566754259d39149790cfa1ebd3" },
{ NID_secp224r1,
"0f537bf1c1122c55656d25e8aa8417e0b44b1526ae0523144f9921c4",
"f79b26d30e491a773696cc2c79b4f0596bc5b9eebaf394d162fb8684",
"0aa6ff55a5d820efcb4e7d10b845ea3c9f9bc5dff86106db85318e22",
"2f96754131e0968198aa78fbe8c201dc5f3581c792de487340d32448",
"61e8a5cd79615203b6d89e9496f9e236fe3b6be8731e743d615519c6",
"49129628b23afcef48139a3f6f59ff5e9811aa746aa4ff33c24bb940" },
{ NID_secp224r1,
"2b3631d2b06179b3174a100f7f57131eeea8947be0786c3dc64b2239",
"83de29ae3dad31adc0236c6de7f14561ca2ea083c5270c78a2e6cbc0",
"efe6e6e25affaf54c98d002abbc6328da159405a1b752e32dc23950a",
"355e962920bde043695f6bffb4b355c63da6f5de665ed46f2ec817e2",
"748e095368f62e1d364edd461719793b404adbdaacbcadd88922ff37",
"fcdc69a40501d308a6839653a8f04309ec00233949522902ffa5eac6" },
{ NID_secp224r1,
"4511403de29059f69a475c5a6a5f6cabed5d9f014436a8cb70a02338",
"7d2d1b62aa046df9340f9c37a087a06b32cf7f08a223f992812a828b",
"61cb2932524001e5e9eeed6df7d9c8935ee3322029edd7aa8acbfd51",
"d50e4adabfd989d7dbc7cf4052546cc7c447a97630436997ad4b9536",
"5bea503473c5eaef9552d42c40b1f2f7ca292733b255b9bbe1b12337",
"827e9025cb62e0e837c596063f3b9b5a0f7afd8d8783200086d61ec1" },
{ NID_secp224r1,
"314a0b26dd31c248845d7cc17b61cad4608259bed85a58d1f1ffd378",
"66e4b350352e119eecada382907f3619fd748ea73ae4899dfd496302",
"8c7ace347171f92def98d845475fc82e1d1496da81ee58f505b985fa",
"b1a8dcac89aca2799320b451df1c7ff4d97567abb68141c0d95fc2aa",
"3524950902b1510bdc987d860afc27ad871ceaea66935abd3c0a99a8",
"335ba51228d94acbed851ca7821c801d5cb1c7975d7aa90a7159f8fa" },
{ NID_secp224r1,
"abe6843beec2fd9e5fb64730d0be4d165438ce922ed75dd80b4603e5",
"6afe8673a96c4ba9900ad85995e631e436c6cc88a2c2b47b7c4886b8",
"382feb9b9ba10f189d99e71a89cdfe44cb554cec13a212840977fb68",
"abb6f1e3773ff8fc73aea2a0b107809ce70adcefed6e41fc5cb43045",
"a963897ae906c10a055eeadb97ffdd6f748d3e5621e5fff304e48ba7",
"8c2e627594206b34f7356d3426eb3d79f518ef843fbe94014cceace3" },
{ NID_secp224r1,
"13cf9d6d2c9aae8274c27d446afd0c888ffdd52ae299a35984d4f527",
"dcbee75b515751f8ee2ae355e8afd5de21c62a939a6507b538cbc4af",
"e0d62035101ef487c485c60fb4500eebe6a32ec64dbe97dbe0232c46",
"88537735e9b23e3e0e076f135a82d33f9bffb465f3abce8322a62a62",
"b4c8c123673197875c0bd14ed097606d330fba2b9200ef65a44764d3",
"632abb662728dbc994508873d5c527ca5ef923c0d31fa6c47ef4c825" },
{ NID_secp224r1,
"965b637c0dfbc0cf954035686d70f7ec30929e664e521dbaa2280659",
"82a58ff61bc90019bbcbb5875d3863db0bc2a1fa34b0ad4de1a83f99",
"b96ade5b73ba72aa8b6e4d74d7bf9c58e962ff78eb542287c7b44ba2",
"37682926a54f70a4c1748f54d50d5b00138a055f924f2c65e5b0bbe4",
"596afefcdd640d29635015b89bdddd1f8c2723686d332e7a06ca8799",
"34641141aab05ef58bd376d609345901fb8f63477c6be9097f037f1f" },
{ NID_secp224r1,
"73cc645372ca2e71637cda943d8148f3382ab6dd0f2e1a49da94e134",
"df5c355c23e6e232ebc3bee2ab1873ee0d83e3382f8e6fe613f6343c",
"a40d7e12049c71e6522c7ff2384224061c3a457058b310557655b854",
"399801243bfe0c2da9b0a53c8ca57f2eee87aaa94a8e4d5e029f42ca",
"aa49e6d4b47cee7a5c4ab71d5a67da84e0b9b425ce3e70da68c889e7",
"4f74ac8507501a32bfc5a78d8271c200e835966e187e8d00011a8c75" },
{ NID_secp224r1,
"546578216250354e449e21546dd11cd1c5174236739acad9ce0f4512",
"d2a22fcd66d1abedc767668327c5cb9c599043276239cf3c8516af24",
"ad2519bc724d484e02a69f05149bb047714bf0f5986fac2e222cd946",
"df9c1e0ef15e53b9f626e2be1cbe893639c06f3e0439ee95d7d4b1e3",
"7a52a7386adda243efdf8941085c84e31239cab92b8017336748965e",
"ad09c9ae4d2324ea81bb555b200d3c003e22a6870ee03b52df49e4de" },
{ NID_secp224r1,
"1d46b1dc3a28123cb51346e67baec56404868678faf7d0e8b2afa22a",
"0ec9e65ec97e218373e7fc115c2274d5b829a60d93f71e01d58136c3",
"3d312a9b9d8ed09140900bbac1e095527ebc9e3c6493bcf3666e3a29",
"b4a0198dc8810e884425b750928b0c960c31f7a99663400b01a179df",
"812b601bfc0738242c6f86f830f27acd632ca618a0b5280c9d5769f7",
"ef029c28c68064b8abd2965a38c404fb5e944ace57e8638daba9d3cd" },
{ NID_secp224r1,
"266d038cc7a4fe21f6c976318e827b82bb5b8f7443a55298136506e0",
"df123d98a7a20bbdf3943df2e3563422f8c0cf74d53aaabdd7c973ba",
"8ce0822dc24c153995755ac350737ef506641c7d752b4f9300c612ed",
"00dfc7ec137690cd6d12fdb2fd0b8c5314582108769c2b722ffb3958",
"5eef3da4ba458127346bb64023868bddb7558a2ecfc813645f4ce9fe",
"f83c16661dfcbad021cc3b5a5af51d9a18db4653866b3ff90787ce3e" },
{ NID_secp224r1,
"eb0a09f7a1c236a61f595809ec5670efd92e4598d5e613e092cdfdca",
"50787ae2f2f15b88bc10f7b5f0aee1418373f16153aebd1fba54288d",
"0ff9b485325ab77f29e7bc379fed74bfac859482da0dee7528c19db2",
"7e603e6976db83c36011508fa695d1b515249e2e54b48fcbcfb90247",
"0179a600ce86adfca9b1b931fa5173d618da09e841803d19b0264286",
"f51258c63f232e55a66aa25ebd597b2018d1052c02eeb63866758005" },
{ NID_secp224r1,
"6b2f6b18a587f562ffc61bd9b0047322286986a78f1fd139b84f7c24",
"7096908e4615266be59a53cd655515056ff92370a6271a5d3823d704",
"19cf5ff6306467f28b9fe0675a43c0582552c8c12e59ce7c38f292b1",
"fc20e906e609c112cfc2e0fea6303882c5db94e87e022373ab2c082a",
"aecdf1daa71782bc5a26bbbd8d7e8a76490e26abc17dffc774bd7341",
"7fdc969a186ff18429f2a276dac43beea21182d82ce2e5a0876552b1" },
{ NID_secp224r1,
"328101ba826acd75ff9f34d5574ce0dbc92f709bad8d7a33c47940c1",
"df39f1ea88488c55d5538160878b9ced18a887ea261dd712d14024ff",
"90a15368e3532c0b1e51e55d139447c2c89bc160719d697291ea7c14",
"c6837d506e976da7db3ad1267c359dff2ea6fb0b7f7f8e77024c59e9",
"67eb491d2fc8a530c46525d2a8b2d7c1df5fba1ae740a4649c683ee6",
"3d60ab6db2b3ffe2d29ccff46d056e54230cf34982e241556ed2920c" },
{ NID_secp224r1,
"0081e34270871e2ebbd94183f617b4ae15f0416dd634fe6e934cf3c0",
"3a1e9f38a7b90b7317d26b9f6311063ab58b268cf489b2e50386d5d6",
"8e0838e05e1721491067e1cabc2e8051b290e2616eec427b7121897d",
"e9150f770075626019e18f95473b71e6828041791d3f08d3faeeaa2b",
"475f70735eaae52308a3b763dc88efe18ab590ebafa035f6e08b001c",
"9116d72786f4db5df7a8b43078c6ab9160d423513d35ea5e2559306d" },
{ NID_secp224r1,
"2623632fdf0bd856805a69aa186d4133ef5904e1f655a972d66cce07",
"2cef9728dd06fb8b50150f529b695076d4507983912585c89bd0682e",
"38106e93f16a381adb1d72cee3da66ae462ad4bbfea9ecdf35d0814e",
"7be6c4c917829ab657dd79e8637d7aefd2f81f0de7654d957e97658d",
"430d22d9e8438310f61e0d43f25fa3e34585f432baad27db3021bf0d",
"207c53dcefac789aaa0276d9200b3a940ce5f2296f4cb2e81a185d3d" },
{ NID_secp224r1,
"8ee4d1dcc31dee4bf6fe21ca8a587721d910acfb122c16c2a77a8152",
"4ebf323fff04eb477069a0ac68b345f6b1ae134efc31940e513cb99f",
"e5d1718431cf50f6cbd1bc8019fa16762dfa12c989e5999977fb4ea2",
"2ea4966e7f92ed7f5cc61fde792045f63b731d6e7d0de2577f2d8ece",
"1c4a7b1ede6f839162292df424be78e8176fb6f942a3c02391700f31",
"10e467da34f48ad7072005bccd6da1b2ba3f71eafa1c393842f91d74" },
{ NID_secp224r1,
"97dcbe6d28335882a6d193cc54a1063dd0775dc328565300bb99e691",
"dad11dd5ece8cfd9f97c9a526e4a1506e6355969ee87826fc38bcd24",
"3d635691b62a9a927c633951c9369c8862bd2119d30970c2644727d6",
"438bbb980517afb20be1d674e3ac2b31cef07a9b23fb8f6e38e0d6c0",
"0be5f1c47d58d21b6ed28423b32f5a94750da47edcef33ea79942afd",
"82fd2f9c60c4f999ac00bbe64bfc11da8ff8cda2e499fced65230bb1" },
{ NID_secp224r1,
"ce9126dd53972dea1de1d11efef900de34b661859c4648c5c0e534f7",
"e113b6f2c1659d07f2716e64a83c18bbce344dd2121fe85168eae085",
"acf3c85bbdc379f02f5ea36e7f0f53095a9e7046a28685a8659bf798",
"ff7511215c71d796bd646e8474be4416b91684ce0d269ef6f422013b",
"b7bf5e79b5a9393bb9ea42c0bdb2d3c2dc806e1a7306aa58e4fdbea5",
"530f7e7fc932613b29c981f261cb036cba3f1df3864e0e1cba2685a2" },
{ NID_secp224r1,
"84419967d6cfad41e75a02b6da605a97949a183a97c306c4b46e66a5",
"5cc9b259718b1bc8b144fde633a894616ffd59a3a6d5d8e942c7cbb7",
"cffd62cb00a0e3163fbf2c397fadc9618210f86b4f54a675287305f0",
"04bf4d948f4430d18b4ed6c96dbaf981fa11a403ed16887f06754981",
"7c1326a9cef51f79d4e78303d6064b459f612584ac2fdf593d7d5d84",
"49f6fd0139248ef4df2db05d1319bd5b1489e249827a45a8a5f12427" },
{ NID_secp224r1,
"7c9cac35768063c2827f60a7f51388f2a8f4b7f8cd736bd6bc337477",
"29ee6b849c6025d577dbcc55fbd17018f4edbc2ef105b004d6257bcd",
"85f903e43943d13c68932e710e80de52cbc0b8f1a1418ea4da079299",
"970a4a7e01d4188497ceb46955eb1b842d9085819a9b925c84529d3d",
"dfa2526480f833ea0edbd204e4e365fef3472888fe7d9691c3ebc09f",
"8f7e34e597ae8093b98270a74a8dfcdbed457f42f43df487c5487161" },
{ NID_secp224r1,
"085a7642ad8e59b1a3e8726a7547afbecffdac1dab7e57230c6a9df4",
"f91c36d881fe9b8047a3530713554a1af4c25c5a8e654dcdcf689f2e",
"cce64891a3d0129fee0d4a96cfbe7ac470b85e967529057cfa31a1d9",
"a6b29632db94da2125dc1cf80e03702687b2acc1122022fa2174765a",
"61723edd73e10daed73775278f1958ba56f1fc9d085ebc2b64c84fe5",
"71954e2261e8510be1a060733671d2e9d0a2d012eb4e09556d697d2a" },
{ NID_X9_62_prime256v1,
"700c48f77f56584c5cc632ca65640db91b6bacce3a4df6b42ce7cc838833d287",
"db71e509e3fd9b060ddb20ba5c51dcc5948d46fbf640dfe0441782cab85fa4ac",
"7d7dc5f71eb29ddaf80d6214632eeae03d9058af1fb6d22ed80badb62bc1a534",
"ead218590119e8876b29146ff89ca61770c4edbbf97d38ce385ed281d8a6b230",
"28af61281fd35e2fa7002523acc85a429cb06ee6648325389f59edfce1405141",
"46fc62106420ff012e54a434fbdd2d25ccc5852060561e68040dd7778997bd7b" },
{ NID_X9_62_prime256v1,
"809f04289c64348c01515eb03d5ce7ac1a8cb9498f5caa50197e58d43a86a7ae",
"b29d84e811197f25eba8f5194092cb6ff440e26d4421011372461f579271cda3",
"38f65d6dce47676044d58ce5139582d568f64bb16098d179dbab07741dd5caf5",
"119f2f047902782ab0c9e27a54aff5eb9b964829ca99c06b02ddba95b0a3f6d0",
"8f52b726664cac366fc98ac7a012b2682cbd962e5acb544671d41b9445704d1d",
"057d636096cb80b67a8c038c890e887d1adfa4195e9b3ce241c8a778c59cda67" },
{ NID_X9_62_prime256v1,
"a2339c12d4a03c33546de533268b4ad667debf458b464d77443636440ee7fec3",
"ef48a3ab26e20220bcda2c1851076839dae88eae962869a497bf73cb66faf536",
"1accfaf1b97712b85a6f54b148985a1bdc4c9bec0bd258cad4b3d603f49f32c8",
"d9f2b79c172845bfdb560bbb01447ca5ecc0470a09513b6126902c6b4f8d1051",
"f815ef5ec32128d3487834764678702e64e164ff7315185e23aff5facd96d7bc",
"2d457b78b4614132477618a5b077965ec90730a8c81a1c75d6d4ec68005d67ec" },
{ NID_X9_62_prime256v1,
"df3989b9fa55495719b3cf46dccd28b5153f7808191dd518eff0c3cff2b705ed",
"422294ff46003429d739a33206c8752552c8ba54a270defc06e221e0feaf6ac4",
"207c43a79bfee03db6f4b944f53d2fb76cc49ef1c9c4d34d51b6c65c4db6932d",
"24277c33f450462dcb3d4801d57b9ced05188f16c28eda873258048cd1607e0d",
"c4789753e2b1f63b32ff014ec42cd6a69fac81dfe6d0d6fd4af372ae27c46f88",
"96441259534b80f6aee3d287a6bb17b5094dd4277d9e294f8fe73e48bf2a0024" },
{ NID_X9_62_prime256v1,
"41192d2813e79561e6a1d6f53c8bc1a433a199c835e141b05a74a97b0faeb922",
"1af98cc45e98a7e041b01cf35f462b7562281351c8ebf3ffa02e33a0722a1328",
"59137e38152350b195c9718d39673d519838055ad908dd4757152fd8255c09bf",
"a8c5fdce8b62c5ada598f141adb3b26cf254c280b2857a63d2ad783a73115f6b",
"806e1aafec4af80a0d786b3de45375b517a7e5b51ffb2c356537c9e6ef227d4a",
"19d44c8d63e8e8dd12c22a87b8cd4ece27acdde04dbf47f7f27537a6999a8e62" },
{ NID_X9_62_prime256v1,
"33e82092a0f1fb38f5649d5867fba28b503172b7035574bf8e5b7100a3052792",
"f2cf6b601e0a05945e335550bf648d782f46186c772c0f20d3cd0d6b8ca14b2f",
"f5f8e0174610a661277979b58ce5c90fee6c9b3bb346a90a7196255e40b132ef",
"7b861dcd2844a5a8363f6b8ef8d493640f55879217189d80326aad9480dfc149",
"c4675b45eeb306405f6c33c38bc69eb2bdec9b75ad5af4706aab84543b9cc63a",
"664e45d5bba4ac931cd65d52017e4be9b19a515f669bea4703542a2c525cd3d3" },
{ NID_X9_62_prime256v1,
"6a9e0c3f916e4e315c91147be571686d90464e8bf981d34a90b6353bca6eeba7",
"40f9bead39c2f2bcc2602f75b8a73ec7bdffcbcead159d0174c6c4d3c5357f05",
"3b589af7db03459c23068b64f63f28d3c3c6bc25b5bf76ac05f35482888b5190",
"9fb38e2d58ea1baf7622e96720101cae3cde4ba6c1e9fa26d9b1de0899102863",
"d5561b900406edf50802dd7d73e89395f8aed72fba0e1d1b61fe1d22302260f0",
"ca342daa50dc09d61be7c196c85e60a80c5cb04931746820be548cdde055679d" },
{ NID_X9_62_prime256v1,
"a9c0acade55c2a73ead1a86fb0a9713223c82475791cd0e210b046412ce224bb",
"f6de0afa20e93e078467c053d241903edad734c6b403ba758c2b5ff04c9d4229",
"d8bf929a20ea7436b2461b541a11c80e61d826c0a4c9d322b31dd54e7f58b9c8",
"20f07631e4a6512a89ad487c4e9d63039e579cb0d7a556cb9e661cd59c1e7fa4",
"6de91846b3eee8a5ec09c2ab1f41e21bd83620ccdd1bdce3ab7ea6e02dd274f5",
"35aa9b52536a461bfde4e85fc756be928c7de97923f0416c7a3ac8f88b3d4489" },
{ NID_X9_62_prime256v1,
"94e94f16a98255fff2b9ac0c9598aac35487b3232d3231bd93b7db7df36f9eb9",
"d8049a43579cfa90b8093a94416cbefbf93386f15b3f6e190b6e3455fedfe69a",
"0f9883ba0ef32ee75ded0d8bda39a5146a29f1f2507b3bd458dbea0b2bb05b4d",
"abb61b423be5d6c26e21c605832c9142dc1dfe5a5fff28726737936e6fbf516d",
"733d2513ef58beab202090586fac91bf0fee31e80ab33473ab23a2d89e58fad6",
"605c16178a9bc875dcbff54d63fe00df699c03e8a888e9e94dfbab90b25f39b4" },
{ NID_X9_62_prime256v1,
"e099bf2a4d557460b5544430bbf6da11004d127cb5d67f64ab07c94fcdf5274f",
"d9c50dbe70d714edb5e221f4e020610eeb6270517e688ca64fb0e98c7ef8c1c5",
"2beedb04b05c6988f6a67500bb813faf2cae0d580c9253b6339e4a3337bb6c08",
"3d63e429cb5fa895a9247129bf4e48e89f35d7b11de8158efeb3e106a2a87395",
"0cae9e477ef41e7c8c1064379bb7b554ddcbcae79f9814281f1e50f0403c61f3",
"f96e40a1b72840854bb62bc13c40cc2795e373d4e715980b261476835a092e0b" },
{ NID_X9_62_prime256v1,
"f75a5fe56bda34f3c1396296626ef012dc07e4825838778a645c8248cff01658",
"33bbdf1b1772d8059df568b061f3f1122f28a8d819167c97be448e3dc3fb0c3c",
"77c15dcf44610e41696bab758943eff1409333e4d5a11bbe72c8f6c395e9f848",
"ad5d13c3db508ddcd38457e5991434a251bed49cf5ddcb59cdee73865f138c9f",
"62cec1e70588aa4fdfc7b9a09daa678081c04e1208b9d662b8a2214bf8e81a21",
"8388fa79c4babdca02a8e8a34f9e43554976e420a4ad273c81b26e4228e9d3a3" },
{ NID_X9_62_prime256v1,
"2db4540d50230756158abf61d9835712b6486c74312183ccefcaef2797b7674d",
"62f57f314e3f3495dc4e099012f5e0ba71770f9660a1eada54104cdfde77243e",
"42a83b985011d12303db1a800f2610f74aa71cdf19c67d54ce6c9ed951e9093e",
"ab48caa61ea35f13f8ed07ffa6a13e8db224dfecfae1a7df8b1bb6ebaf0cb97d",
"1274530ca2c385a3218bddfbcbf0b4024c9badd5243bff834ebff24a8618dccb",
"72877cea33ccc4715038d4bcbdfe0e43f42a9e2c0c3b017fc2370f4b9acbda4a" },
{ NID_X9_62_prime256v1,
"cd94fc9497e8990750309e9a8534fd114b0a6e54da89c4796101897041d14ecb",
"c3def4b5fe04faee0a11932229fff563637bfdee0e79c6deeaf449f85401c5c4",
"ceed35507b5c93ead5989119b9ba342cfe38e6e638ba6eea343a55475de2800b",
"9a8cd9bd72e71752df91440f77c547509a84df98114e7de4f26cdb39234a625d",
"d07cfc84c8e144fab2839f5189bb1d7c88631d579bbc58012ed9a2327da52f62",
"e4e7408d85ff0e0e9c838003f28cdbd5247cdce31f32f62494b70e5f1bc36307" },
{ NID_X9_62_prime256v1,
"15b9e467af4d290c417402e040426fe4cf236bae72baa392ed89780dfccdb471",
"cdf4e9170fb904302b8fd93a820ba8cc7ed4efd3a6f2d6b05b80b2ff2aee4e77",
"43e0e9d95af4dc36483cdd1968d2b7eeb8611fcce77f3a4e7d059ae43e509604",
"f989cf8ee956a82e7ebd9881cdbfb2fd946189b08db53559bc8cfdd48071eb14",
"5eff28f1a18a616b04b7d337868679f6dd84f9a7b3d7b6f8af276c19611a541d",
"ed56bcf695b734142c24ecb1fc1bb64d08f175eb243a31f37b3d9bb4407f3b96" },
{ NID_X9_62_prime256v1,
"49c503ba6c4fa605182e186b5e81113f075bc11dcfd51c932fb21e951eee2fa1",
"8af706ff0922d87b3f0c5e4e31d8b259aeb260a9269643ed520a13bb25da5924",
"b2f3600df3368ef8a0bb85ab22f41fc0e5f4fdd54be8167a5c3cd4b08db04903",
"69c627625b36a429c398b45c38677cb35d8beb1cf78a571e40e99fe4eac1cd4e",
"81690112b0a88f20f7136b28d7d47e5fbc2ada3c8edd87589bc19ec9590637bd",
"bc5c7055089fc9d6c89f83c1ea1ada879d9934b2ea28fcf4e4a7e984b28ad2cf" },
{ NID_X9_62_prime256v1,
"19b38de39fdd2f70f7091631a4f75d1993740ba9429162c2a45312401636b29c",
"09aed7232b28e060941741b6828bcdfa2bc49cc844f3773611504f82a390a5ae",
"4002534307f8b62a9bf67ff641ddc60fef593b17c3341239e95bdb3e579bfdc8",
"5fe964671315a18aa68a2a6e3dd1fde7e23b8ce7181471cfac43c99e1ae80262",
"d5827be282e62c84de531b963884ba832db5d6b2c3a256f0e604fe7e6b8a7f72",
"9a4e8e657f6b0e097f47954a63c75d74fcba71a30d83651e3e5a91aa7ccd8343" },
{ NID_X9_62_prime256v1,
"2c91c61f33adfe9311c942fdbff6ba47020feff416b7bb63cec13faf9b099954",
"6cab31b06419e5221fca014fb84ec870622a1b12bab5ae43682aa7ea73ea08d0",
"4dfa12defc60319021b681b3ff84a10a511958c850939ed45635934ba4979147",
"c9b2b8496f1440bd4a2d1e52752fd372835b364885e154a7dac49295f281ec7c",
"fbe6b926a8a4de26ccc83b802b1212400754be25d9f3eeaf008b09870ae76321",
"3ca1fc7ad858fb1a6aba232542f3e2a749ffc7203a2374a3f3d3267f1fc97b78" },
{ NID_X9_62_prime256v1,
"a28a2edf58025668f724aaf83a50956b7ac1cfbbff79b08c3bf87dfd2828d767",
"dfa7bfffd4c766b86abeaf5c99b6e50cb9ccc9d9d00b7ffc7804b0491b67bc03",
"1331f6d874a4ed3bc4a2c6e9c74331d3039796314beee3b7152fcdba5556304e",
"59e1e101521046ad9cf1d082e9d2ec7dd22530cce064991f1e55c5bcf5fcb591",
"482f4f673176c8fdaa0bb6e59b15a3e47454e3a04297d3863c9338d98add1f37",
"1aaabe7ee6e4a6fa732291202433a237df1b49bc53866bfbe00db96a0f58224f" },
{ NID_X9_62_prime256v1,
"a2ef857a081f9d6eb206a81c4cf78a802bdf598ae380c8886ecd85fdc1ed7644",
"563c4c20419f07bc17d0539fade1855e34839515b892c0f5d26561f97fa04d1a",
"dd5e9f70ae740073ca0204df60763fb6036c45709bf4a7bb4e671412fad65da3",
"30b9db2e2e977bcdc98cb87dd736cbd8e78552121925cf16e1933657c2fb2314",
"6a45028800b81291bce5c2e1fed7ded650620ebbe6050c6f3a7f0dfb4673ab5c",
"430e6a4fba4449d700d2733e557f66a3bf3d50517c1271b1ddae1161b7ac798c" },
{ NID_X9_62_prime256v1,
"ccd8a2d86bc92f2e01bce4d6922cf7fe1626aed044685e95e2eebd464505f01f",
"e9ddd583a9635a667777d5b8a8f31b0f79eba12c75023410b54b8567dddc0f38",
"5ae026cfc060d55600717e55b8a12e116d1d0df34af831979057607c2d9c2f76",
"46c9ebd1a4a3c8c0b6d572b5dcfba12467603208a9cb5d2acfbb733c40cf6391",
"46c913a27d044185d38b467ace011e04d4d9bbbb8cb9ae25fa92aaf15a595e86",
"1ce9e6740529499f98d1f1d71329147a33df1d05e4765b539b11cf615d6974d3" },
{ NID_X9_62_prime256v1,
"c188ffc8947f7301fb7b53e36746097c2134bf9cc981ba74b4e9c4361f595e4e",
"bf7d2f2056e72421ef393f0c0f2b0e00130e3cac4abbcc00286168e85ec55051",
"b601ac425d5dbf9e1735c5e2d5bdb79ca98b3d5be4a2cfd6f2273f150e064d9d",
"7c9e950841d26c8dde8994398b8f5d475a022bc63de7773fcf8d552e01f1ba0a",
"cc42b9885c9b3bee0f8d8c57d3a8f6355016c019c4062fa22cff2f209b5cc2e1",
"4690e3743c07d643f1bc183636ab2a9cb936a60a802113c49bb1b3f2d0661660" },
{ NID_X9_62_prime256v1,
"317e1020ff53fccef18bf47bb7f2dd7707fb7b7a7578e04f35b3beed222a0eb6",
"09420ce5a19d77c6fe1ee587e6a49fbaf8f280e8df033d75403302e5a27db2ae",
"fefb1dda1845312b5fce6b81b2be205af2f3a274f5a212f66c0d9fc33d7ae535",
"38b54db85500cb20c61056edd3d88b6a9dc26780a047f213a6e1b900f76596eb",
"6387e4e5781571e4eb8ae62991a33b5dc33301c5bc7e125d53794a39160d8fd0",
"30c2261bd0004e61feda2c16aa5e21ffa8d7e7f7dbf6ec379a43b48e4b36aeb0" },
{ NID_X9_62_prime256v1,
"45fb02b2ceb9d7c79d9c2fa93e9c7967c2fa4df5789f9640b24264b1e524fcb1",
"5c6e8ecf1f7d3023893b7b1ca1e4d178972ee2a230757ddc564ffe37f5c5a321",
"334ae0c4693d23935a7e8e043ebbde21e168a7cba3fa507c9be41d7681e049ce",
"3f2bf1589abf3047bf3e54ac9a95379bff95f8f55405f64eca36a7eebe8ffca7",
"5212a94e66c5ae9a8991872f66a72723d80ec5b2e925745c456f5371943b3a06",
"2adae4a138a239dcd93c243a3803c3e4cf96e37fe14e6a9b717be9599959b11c" },
{ NID_X9_62_prime256v1,
"a19ef7bff98ada781842fbfc51a47aff39b5935a1c7d9625c8d323d511c92de6",
"e9c184df75c955e02e02e400ffe45f78f339e1afe6d056fb3245f4700ce606ef",
"2c4bde40214fcc3bfc47d4cf434b629acbe9157f8fd0282540331de7942cf09d",
"29c0807f10cbc42fb45c9989da50681eead716daa7b9e91fd32e062f5eb92ca0",
"ff1d6d1955d7376b2da24fe1163a271659136341bc2eb1195fc706dc62e7f34d",
"2e277ec30f5ea07d6ce513149b9479b96e07f4b6913b1b5c11305c1444a1bc0b" },
{ NID_X9_62_prime256v1,
"356c5a444c049a52fee0adeb7e5d82ae5aa83030bfff31bbf8ce2096cf161c4b",
"57d128de8b2a57a094d1a001e572173f96e8866ae352bf29cddaf92fc85b2f92",
"85a268f9d7772f990c36b42b0a331adc92b5941de0b862d5d89a347cbf8faab0",
"9cf4b98581ca1779453cc816ff28b4100af56cf1bf2e5bc312d83b6b1b21d333",
"7a5504fcac5231a0d12d658218284868229c844a04a3450d6c7381abe080bf3b",
"1e51373bd2c6044c129c436e742a55be2a668a85ae08441b6756445df5493857" },
{ NID_secp384r1,
"a7c76b970c3b5fe8b05d2838ae04ab47697b9eaf52e764592efda27fe7513272"
"734466b400091adbf2d68c58e0c50066",
"ac68f19f2e1cb879aed43a9969b91a0839c4c38a49749b661efedf243451915e"
"d0905a32b060992b468c64766fc8437a",
"3cc3122a68f0d95027ad38c067916ba0eb8c38894d22e1b15618b6818a661774"
"ad463b205da88cf699ab4d43c9cf98a1",
"9803807f2f6d2fd966cdd0290bd410c0190352fbec7ff6247de1302df86f25d3"
"4fe4a97bef60cff548355c015dbb3e5f",
"ba26ca69ec2f5b5d9dad20cc9da711383a9dbe34ea3fa5a2af75b46502629ad5"
"4dd8b7d73a8abb06a3a3be47d650cc99",
"5f9d29dc5e31a163060356213669c8ce132e22f57c9a04f40ba7fcead493b457"
"e5621e766c40a2e3d4d6a04b25e533f1" },
{ NID_secp384r1,
"30f43fcf2b6b00de53f624f1543090681839717d53c7c955d1d69efaf0349b73"
"63acb447240101cbb3af6641ce4b88e0",
"25e46c0c54f0162a77efcc27b6ea792002ae2ba82714299c860857a68153ab62"
"e525ec0530d81b5aa15897981e858757",
"92860c21bde06165f8e900c687f8ef0a05d14f290b3f07d8b3a8cc6404366e5d"
"5119cd6d03fb12dc58e89f13df9cd783",
"ea4018f5a307c379180bf6a62fd2ceceebeeb7d4df063a66fb838aa352434197"
"91f7e2c9d4803c9319aa0eb03c416b66",
"68835a91484f05ef028284df6436fb88ffebabcdd69ab0133e6735a1bcfb3720"
"3d10d340a8328a7b68770ca75878a1a6",
"a23742a2c267d7425fda94b93f93bbcc24791ac51cd8fd501a238d40812f4cbf"
"c59aac9520d758cf789c76300c69d2ff" },
{ NID_secp384r1,
"1aefbfa2c6c8c855a1a216774550b79a24cda37607bb1f7cc906650ee4b3816d"
"68f6a9c75da6e4242cebfb6652f65180",
"419d28b723ebadb7658fcebb9ad9b7adea674f1da3dc6b6397b55da0f61a3edd"
"acb4acdb14441cb214b04a0844c02fa3",
"12cf6a223a72352543830f3f18530d5cb37f26880a0b294482c8a8ef8afad09a"
"a78b7dc2f2789a78c66af5d1cc553853",
"fcfcea085e8cf74d0dced1620ba8423694f903a219bbf901b0b59d6ac81baad3"
"16a242ba32bde85cb248119b852fab66",
"972e3c68c7ab402c5836f2a16ed451a33120a7750a6039f3ff15388ee622b706"
"5f7122bf6d51aefbc29b37b03404581b",
"3d2e640f350805eed1ff43b40a72b2abed0a518bcebe8f2d15b111b6773223da"
"3c3489121db173d414b5bd5ad7153435" },
{ NID_secp384r1,
"8bc089326ec55b9cf59b34f0eb754d93596ca290fcb3444c83d4de3a5607037e"
"c397683f8cef07eab2fe357eae36c449",
"d9d16ce8ac85b3f1e94568521aae534e67139e310ec72693526aa2e927b5b322"
"c95a1a033c229cb6770c957cd3148dd7",
"8dd48063a3a058c334b5cc7a4ce07d02e5ee6d8f1f3c51a1600962cbab462690"
"ae3cd974fb39e40b0e843daa0fd32de1",
"e38c9846248123c3421861ea4d32669a7b5c3c08376ad28104399494c84ff5ef"
"a3894adb2c6cbe8c3c913ef2eec5bd3c",
"9fa84024a1028796df84021f7b6c9d02f0f4bd1a612a03cbf75a0beea43fef8a"
"e84b48c60172aadf09c1ad016d0bf3ce",
"6a42cfc392aba0bfd3d17b7ccf062b91fc09bbf3417612d02a90bdde62ae40c5"
"4bb2e56e167d6b70db670097eb8db854" },
{ NID_secp384r1,
"eb952e2d9ac0c20c6cc48fb225c2ad154f53c8750b003fd3b4ed8ed1dc0defac"
"61bcdde02a2bcfee7067d75d342ed2b0",
"f1828205baece82d1b267d0d7ff2f9c9e15b69a72df47058a97f3891005d1fb3"
"8858f5603de840e591dfa4f6e7d489e1",
"84ece6cc3429309bd5b23e959793ed2b111ec5cb43b6c18085fcaea9efa0685d"
"98a6262ee0d330ee250bc8a67d0e733f",
"3222063a2997b302ee60ee1961108ff4c7acf1c0ef1d5fb0d164b84bce71c431"
"705cb9aea9a45f5d73806655a058bee3",
"e61fa9e7fbe7cd43abf99596a3d3a039e99fa9dc93b0bdd9cad81966d17eeaf5"
"57068afa7c78466bb5b22032d1100fa6",
"ce7ba454d4412729a32bb833a2d1fd2ae612d4667c3a900e069214818613447d"
"f8c611de66da200db7c375cf913e4405" },
{ NID_secp384r1,
"441d029e244eb7168d647d4df50db5f4e4974ab3fdaf022aff058b3695d0b8c8"
"14cc88da6285dc6df1ac55c553885003",
"e8025ac23a41d4b1ea2aa46c50c6e479946b59b6d76497cd9249977e0bfe4a62"
"62622f13d42a3c43d66bdbb30403c345",
"68fce2121dc3a1e37b10f1dde309f9e2e18fac47cd1770951451c3484cdb77cb"
"136d00e731260597cc2859601c01a25b",
"868be0e694841830e424d913d8e7d86b84ee1021d82b0ecf523f09fe89a76c0c"
"95c49f2dfbcf829c1e39709d55efbb3b",
"9195eb183675b40fd92f51f37713317e4a9b4f715c8ab22e0773b1bc71d3a219"
"f05b8116074658ee86b52e36f3897116",
"ba69f0acdf3e1ca95caaac4ecaf475bbe51b54777efce01ca381f45370e486fe"
"87f9f419b150c61e329a286d1aa265ec" },
{ NID_secp384r1,
"3d4e6bf08a73404accc1629873468e4269e82d90d832e58ad72142639b5a056a"
"d8d35c66c60e8149fac0c797bceb7c2f",
"9b0308dc7f0e6d29f8c277acbc65a21e5adb83d11e6873bc0a07fda0997f4825"
"04602f59e10bc5cb476b83d0a4f75e71",
"b1764c54897e7aae6de9e7751f2f37de849291f88f0f91093155b858d1cc32a3"
"a87980f706b86cc83f927bdfdbeae0bd",
"c371222feaa6770c6f3ea3e0dac9740def4fcf821378b7f91ff937c21e0470f7"
"0f3a31d5c6b2912195f10926942b48ae",
"047d6b4d765123563f81116bc665b7b8cc6207830d805fd84da7cb805a65baa7"
"c12fd592d1b5b5e3e65d9672a9ef7662",
"1a6688ee1d6e59865d8e3ada37781d36bb0c2717eef92e61964d3927cb765c29"
"65ea80f7f63e58c322ba0397faeaf62b" },
{ NID_secp384r1,
"f5f6bef1d110da03be0017eac760cc34b24d092f736f237bc7054b3865312a81"
"3bcb62d297fb10a4f7abf54708fe2d3d",
"06fdf8d7dc032f4e10010bf19cbf6159321252ff415fb91920d438f24e67e60c"
"2eb0463204679fa356af44cea9c9ebf5",
"f0f7a96e70d98fd5a30ad6406cf56eb5b72a510e9f192f50e1f84524dbf3d243"
"9f7287bb36f5aa912a79deaab4adea82",
"99c8c41cb1ab5e0854a346e4b08a537c1706a61553387c8d94943ab15196d40d"
"baa55b8210a77a5d00915f2c4ea69eab",
"5531065bdcf17bfb3cb55a02e41a57c7f694c383ad289f900fbd656c2233a93c"
"92e933e7a26f54cbb56f0ad875c51bb0",
"d06a568bf2336b90cbac325161be7695eacb2295f599500d787f072612aca313"
"ee5d874f807ddef6c1f023fe2b6e7cd0" },
{ NID_secp384r1,
"7cdec77e0737ea37c67b89b7137fe38818010f4464438ee4d1d35a0c488cad3f"
"de2f37d00885d36d3b795b9f93d23a67",
"28c42ee8d6027c56cf979ba4c229fdb01d234944f8ac433650112c3cf0f02844"
"e888a3569dfef7828a8a884589aa055e",
"9efb87ddc61d43c482ba66e1b143aef678fbd0d1bebc2000941fabe677fe5b70"
"6bf78fce36d100b17cc787ead74bbca2",
"4c34efee8f0c95565d2065d1bbac2a2dd25ae964320eb6bccedc5f3a9b42a881"
"a1afca1bb6b880584fa27b01c193cd92",
"d8fb01dbf7cd0a3868c26b951f393c3c56c2858cee901f7793ff5d271925d13a"
"41f8e52409f4eba1990f33acb0bac669",
"bb3b1eda9c6560d82ff5bee403339f1e80342338a991344853b56b24f109a4d9"
"4b92f654f0425edd4c205903d7586104" },
{ NID_secp384r1,
"8eeea3a319c8df99fbc29cb55f243a720d95509515ee5cc587a5c5ae22fbbd00"
"9e626db3e911def0b99a4f7ae304b1ba",
"73877dc94db9adddc0d9a4b24e8976c22d73c844370e1ee857f8d1b129a3bd5f"
"63f40caf3bd0533e38a5f5777074ff9e",
"d787a57fde22ec656a0a525cf3c738b30d73af61e743ea90893ecb2d7b622add"
"2f94ee25c2171467afb093f3f84d0018",
"171546923b87b2cbbad664f01ce932bf09d6a6118168678446bfa9f0938608cb"
"4667a98f4ec8ac1462285c2508f74862",
"fa41cb4db68ae71f1f8a3e8939dc52c2dec61a83c983beb2a02baf29ec492780"
"88882ed0cf56c74b5c173b552ccf63cf",
"1e97b60add7cb35c7403dd884c0a75795b7683fff8b49f9d8672a8206bfdcf0a"
"106b8768f983258c74167422e44e4d14" },
{ NID_secp384r1,
"a721f6a2d4527411834b13d4d3a33c29beb83ab7682465c6cbaf6624aca6ea58"
"c30eb0f29dd842886695400d7254f20f",
"14ba6e26355109ad35129366d5e3a640ae798505a7fa55a96a36b5dad33de004"
"74f6670f522214dd7952140ab0a7eb68",
"83d70f7b164d9f4c227c767046b20eb34dfc778f5387e32e834b1e6daec20edb"
"8ca5bb4192093f543b68e6aeb7ce788b",
"57cd770f3bbcbe0c78c770eab0b169bc45e139f86378ffae1c2b16966727c2f2"
"eb724572b8f3eb228d130db4ff862c63",
"7ec5c8813b685558d83e924f14bc719f6eb7ae0cbb2c474227c5bda88637a4f2"
"6c64817929af999592da6f787490332f",
"1023478840e54775bfc69293a3cf97f5bc914726455c66538eb5623e218feef7"
"df4befa23e09d77145ad577db32b41f9" },
{ NID_secp384r1,
"d882a8505c2d5cb9b8851fc676677bb0087681ad53faceba1738286b45827561"
"e7da37b880276c656cfc38b32ade847e",
"34b314bdc134575654573cffaf40445da2e6aaf987f7e913cd4c309152305898"
"4a25d8f21da8326192456c6a0fa5f60c",
"8f558e05818b88ed383d5fca962e53413db1a0e4637eda194f761944cbea114a"
"b9d5da175a7d57882550b0e432f395a9",
"9a2f57f4867ce753d72b0d95195df6f96c1fae934f602efd7b6a54582f556cfa"
"539d89005ca2edac08ad9b72dd1f60ba",
"d9b94ee82da9cc601f346044998ba387aee56404dc6ecc8ab2b590443319d0b2"
"b6176f9d0eac2d44678ed561607d09a9",
"6ad6b9dc8a6cf0d3691c501cbb967867f6e4bbb764b60dbff8fcff3ed42dbba3"
"9d63cf325b4b4078858495ddee75f954" },
{ NID_secp384r1,
"815c9d773dbf5fb6a1b86799966247f4006a23c92e68c55e9eaa998b17d8832d"
"d4d84d927d831d4f68dac67c6488219f",
"e79269948b2611484560fd490feec887cb55ef99a4b524880fa7499d6a07283a"
"ae2afa33feab97deca40bc606c4d8764",
"0f5dee0affa7bbf239d5dff32987ebb7cf84fcceed643e1d3c62d0b3352aec23"
"b6e5ac7fa4105c8cb26126ad2d1892cb",
"23346bdfbc9d7c7c736e02bdf607671ff6082fdd27334a8bc75f3b23681ebe61"
"4d0597dd614fae58677c835a9f0b273b",
"82ba36290d2f94db41479eb45ab4eaf67928a2315138d59eecc9b5285dfddd67"
"14f77557216ea44cc6fc119d8243efaf",
"cc9e063566d46b357b3fcae21827377331e5e290a36e60cd7c39102b828ae0b9"
"18dc5a02216b07fe6f1958d834e42437" },
{ NID_secp384r1,
"1c0eeda7a2be000c5bdcda0478aed4db733d2a9e341224379123ad847030f29e"
"3b168fa18e89a3c0fba2a6ce1c28fc3b",
"ec8c1c83c118c4dbea94271869f2d868eb65e8b44e21e6f14b0f4d9b38c068da"
"efa27114255b9a41d084cc4a1ad85456",
"037b633b5b8ba857c0fc85656868232e2febf59578718391b81da8541a00bfe5"
"3c30ae04151847f27499f8d7abad8cf4",
"8878ac8a947f7d5cb2b47aad24fbb8210d86126585399a2871f84aa9c5fde307"
"4ae540c6bf82275ca822d0feb862bc74",
"632f5cd2f900c2711c32f8930728eb647d31edd8d650f9654e7d33e5ed1b4754"
"89d08daa30d8cbcba6bfc3b60d9b5a37",
"deff7f03bd09865baf945e73edff6d5122c03fb561db87dec8662e09bed4340b"
"28a9efe118337bb7d3d4f7f568635ff9" },
{ NID_secp384r1,
"c95c185e256bf997f30b311548ae7f768a38dee43eeeef43083f3077be70e2bf"
"39ac1d4daf360c514c8c6be623443d1a",
"3e63a663eaf75d8a765ab2b9a35513d7933fa5e26420a5244550ec6c3b6f033b"
"96db2aca3d6ac6aab052ce929595aea5",
"e3d07106bedcc096e7d91630ffd3094df2c7859db8d7edbb2e37b4ac47f429a6"
"37d06a67d2fba33838764ef203464991",
"e74a1a2b85f1cbf8dbbdf050cf1aff8acb02fda2fb6591f9d3cfe4e79d0ae938"
"a9c1483e7b75f8db24505d65065cdb18",
"1773ee591822f7abaa856a1a60bc0a5203548dbd1cb5025466eff8481bd07614"
"eaa04a16c3db76905913e972a5b6b59d",
"c8b1038f735ad3bb3e4637c3e47eab487637911a6b7950a4e461948329d3923b"
"969e5db663675623611a457fcda35a71" },
{ NID_secp384r1,
"3497238a7e6ad166df2dac039aa4dac8d17aa925e7c7631eb3b56e3aaa1c545f"
"cd54d2e5985807910fb202b1fc191d2a",
"a49e5c487dcc7aa40a8f234c979446040d9174e3ad357d404d7765183195aed3"
"f913641b90c81a306ebf0d8913861316",
"f3f9b0c65a49a506632c8a45b10f66b5316f9eeb06fae218f2da62333f999051"
"17b141c760e8974efc4af10570635791",
"a4ad77aa7d86e5361118a6b921710c820721210712f4c347985fdee58aa4effa"
"1e28be80a17b120b139f96300f89b49b",
"1ddf22e07e03f1560d8f45a480094560dba9fae7f9531130c1b57ebb95982496"
"524f31d3797793396fa823f22bdb4328",
"d337eaa32b9f716b8747b005b97a553c59dab0c51df41a2d49039cdae705aa75"
"c7b9e7bc0b6a0e8c578c902bc4fff23e" },
{ NID_secp384r1,
"90a34737d45b1aa65f74e0bd0659bc118f8e4b774b761944ffa6573c6df4f41d"
"ec0d11b697abd934d390871d4b453240",
"9b590719bb3307c149a7817be355d684893a307764b512eeffe07cb699edb5a6"
"ffbf8d6032e6c79d5e93e94212c2aa4e",
"59fce7fad7de28bac0230690c95710c720e528f9a4e54d3a6a8cd5fc5c5f2163"
"7031ce1c5b4e3d39647d8dcb9b794664",
"9c43bf971edf09402876ee742095381f78b1bd3aa39b5132af75dbfe7e98bd78"
"bde10fe2e903c2b6379e1deee175a1b0",
"a6c58ecea5a477bb01bd543b339f1cc49f1371a2cda4d46eb4e53e2505979423"
"51a99665a122ffea9bde0636c375daf2",
"32d292b695a4488e42a7b7922e1ae537d76a3d21a0b2e36875f60e9f6d3e8779"
"c2afb3a413b9dd79ae18e70b47d337c1" },
{ NID_secp384r1,
"dda546acfc8f903d11e2e3920669636d44b2068aeb66ff07aa266f0030e1535b"
"0ed0203cb8a460ac990f1394faf22f1d",
"15bbb2597913035faadf413476f4c70f7279769a40c986f470c427b4ee4962ab"
"df8173bbad81874772925fd32f0b159f",
"3e49fbf950a424c5d80228dc4bc35e9f6c6c0c1d04440998da0a609a877575db"
"e437d6a5cedaa2ddd2a1a17fd112aded",
"5a949594228b1a3d6f599eb3db0d06070fbc551c657b58234ba164ce3fe415fa"
"5f3eb823c08dc29b8c341219c77b6b3d",
"2baad447c8c290cfed25edd9031c41d0b76921457327f42db31122b81f337bbf"
"0b1039ec830ce9061a3761953c75e4a8",
"1220e7e6cad7b25df98e5bbdcc6c0b65ca6c2a50c5ff6c41dca71e475646fd48"
"9615979ca92fb4389aeadefde79a24f1" },
{ NID_secp384r1,
"788be2336c52f4454d63ee944b1e49bfb619a08371048e6da92e584eae70bde1"
"f171c4df378bd1f3c0ab03048a237802",
"4673ebd8db604eaf41711748bab2968a23ca4476ce144e728247f08af7529291"
"57b5830f1e26067466bdfa8b65145a33",
"50ccc1f7076e92f4638e85f2db98e0b483e6e2204c92bdd440a6deea04e37a07"
"c6e72791c190ad4e4e86e01efba84269",
"756c07df0ce32c839dac9fb4733c9c28b70113a676a7057c38d223f22a3a9095"
"a8d564653af528e04c7e1824be4a6512",
"17c2ce6962cbd2a2e066297b39d57dd9bb4680f0191d390f70b4e461419b2972"
"ce68ad46127fdda6c39195774ea86df3",
"793bb9cd22a93cf468faf804a38d12b78cb12189ec679ddd2e9aa21fa9a5a0b0"
"49ab16a23574fe04c1c3c02343b91beb" },
{ NID_secp384r1,
"d09bb822eb99e38060954747c82bb3278cf96bbf36fece3400f4c873838a40c1"
"35eb3babb9293bd1001bf3ecdee7bf26",
"d416db6e1b87bbb7427788a3b6c7a7ab2c165b1e366f9608df512037584f213a"
"648d47f16ac326e19aae972f63fd76c9",
"06f132b71f74d87bf99857e1e4350a594e5fe35533b888552ceccbc0d8923c90"
"2e36141d7691e28631b8bc9bafe5e064",
"2a3cc6b8ff5cde926e7e3a189a1bd029c9b586351af8838f4f201cb8f4b70ef3"
"b0da06d352c80fc26baf8f42b784459e",
"bf9985960176da6d23c7452a2954ffcbbcb24249b43019a2a023e0b3dabd461f"
"19ad3e775c364f3f11ad49f3099400d3",
"012d191cf7404a523678c6fc075de8285b243720a903047708bb33e501e0dbee"
"5bcc40d7c3ef6c6da39ea24d830da1e8" },
{ NID_secp384r1,
"13741262ede5861dad71063dfd204b91ea1d3b7c631df68eb949969527d79a1d"
"c59295ef7d2bca6743e8cd77b04d1b58",
"0baaeadc7e19d74a8a04451a135f1be1b02fe299f9dc00bfdf201e83d995c695"
"0bcc1cb89d6f7b30bf54656b9a4da586",
"12048ebb4331ec19a1e23f1a2c773b664ccfe90a28bfb846fc12f81dff44b744"
"3c77647164bf1e9e67fd2c07a6766241",
"bc18836bc7a9fdf54b5352f37d7528ab8fa8ec544a8c6180511cbfdd49cce377"
"c39e34c031b5240dc9980503ed2f262c",
"8086cbe338191080f0b7a16c7afc4c7b0326f9ac66f58552ef4bb9d24de3429e"
"d5d3277ed58fcf48f2b5f61326bec6c6",
"ad0fd3ddffe8884b9263f3c15fe1f07f2a5a22ffdc7e967085eea45f0cd959f2"
"0f18f522763e28bcc925e496a52dda98" },
{ NID_secp384r1,
"9e22cbc18657f516a864b37b783348b66f1aa9626cd631f4fa1bd32ad88cf11d"
"b52057c660860d39d11fbf024fabd444",
"6b0d53c79681c28116df71e9cee74fd56c8b7f04b39f1198cc72284e98be9562"
"e35926fb4f48a9fbecafe729309e8b6f",
"34d61a699ca576169fcdc0cc7e44e4e1221db0fe63d16850c8104029f7d48449"
"714b9884328cae189978754ab460b486",
"867f81104ccd6b163a7902b670ef406042cb0cce7dcdc63d1dfc91b2c40e3cdf"
"7595834bf9eceb79849f1636fc8462fc",
"9d4bde8e875ec49697d258d1d59465f8431c6f5531e1c59e9f9ebe3cf164a8d9"
"ce10a12f1979283a959bad244dd83863",
"dc4ca392dc15e20185f2c6a8ea5ec31dfc96f56153a47394b3072b13d0015f5d"
"4ae13beb3bed54d65848f9b8383e6c95" },
{ NID_secp384r1,
"2db5da5f940eaa884f4db5ec2139b0469f38e4e6fbbcc52df15c0f7cf7fcb180"
"8c749764b6be85d2fdc5b16f58ad5dc0",
"22e8b02dcf33e1b5a083849545f84ad5e43f77cb71546dbbac0d11bdb2ee202e"
"9d3872e8d028c08990746c5e1dde9989",
"dc60fa8736d702135ff16aab992bb88eac397f5972456c72ec447374d0d8ce61"
"153831bfc86ad5a6eb5b60bfb96a862c",
"b69beede85d0f829fec1b893ccb9c3e052ff692e13b974537bc5b0f9feaf7b22"
"e84f03231629b24866bdb4b8cf908914",
"66f85e2bfcaba2843285b0e14ebc07ef7dafff8b424416fee647b59897b619f2"
"0eed95a632e6a4206bf7da429c04c560",
"d765b208112d2b9ed5ad10c4046e2e3b0dbf57c469329519e239ac28b25c7d85"
"2bf757d5de0ee271cadd021d86cfd347" },
{ NID_secp384r1,
"329647baa354224eb4414829c5368c82d7893b39804e08cbb2180f459befc4b3"
"47a389a70c91a23bd9d30c83be5295d3",
"cc8f61923fad2aa8e505d6cfa126b9fabd5af9dce290b75660ef06d1caa73681"
"d06089c33bc4246b3aa30dbcd2435b12",
"6fa6a1c704730987aa634b0516a826aba8c6d6411d3a4c89772d7a62610256a2"
"e2f289f5c3440b0ec1e70fa339e251ce",
"53de1fc1328e8de14aecab29ad8a40d6b13768f86f7d298433d20fec791f86f8"
"bc73f358098b256a298bb488de257bf4",
"ac28944fd27f17b82946c04c66c41f0053d3692f275da55cd8739a95bd8cd3af"
"2f96e4de959ea8344d8945375905858b",
"d3778850aeb58804fbe9dfe6f38b9fa8e20c2ca4e0dec335aafceca0333e3f24"
"90b53c0c1a14a831ba37c4b9d74be0f2" },
{ NID_secp384r1,
"29d8a36d22200a75b7aea1bb47cdfcb1b7fd66de967041434728ab5d533a060d"
"f732130600fe6f75852a871fb2938e39",
"e19b53db528395de897a45108967715eb8cb55c3fcbf23379372c0873a058d57"
"544b102ecce722b2ccabb1a603774fd5",
"74ad8386c1cb2ca0fcdeb31e0869bb3f48c036afe2ef110ca302bc8b910f621c"
"9fcc54cec32bb89ec7caa84c7b8e54a8",
"27a3e83cfb9d5122e73129d801615857da7cc089cccc9c54ab3032a19e0a0a9f"
"677346e37f08a0b3ed8da6e5dd691063",
"8d60e44aa5e0fd30c918456796af37f0e41957901645e5c596c6d989f5859b03"
"a0bd7d1f4e77936fff3c74d204e5388e",
"81e1e71575bb4505498de097350186430a6242fa6c57b85a5f984a23371123d2"
"d1424eefbf804258392bc723e4ef1e35" },
{ NID_secp521r1,
"000000685a48e86c79f0f0875f7bc18d25eb5fc8c0b07e5da4f4370f3a949034"
"0854334b1e1b87fa395464c60626124a4e70d0f785601d37c09870ebf1766668"
"77a2046d",
"000001ba52c56fc8776d9e8f5db4f0cc27636d0b741bbe05400697942e80b739"
"884a83bde99e0f6716939e632bc8986fa18dccd443a348b6c3e522497955a4f3"
"c302f676",
"0000017eecc07ab4b329068fba65e56a1f8890aa935e57134ae0ffcce8027351"
"51f4eac6564f6ee9974c5e6887a1fefee5743ae2241bfeb95d5ce31ddcb6f9ed"
"b4d6fc47",
"000000602f9d0cf9e526b29e22381c203c48a886c2b0673033366314f1ffbcba"
"240ba42f4ef38a76174635f91e6b4ed34275eb01c8467d05ca80315bf1a7bbd9"
"45f550a5",
"000001b7c85f26f5d4b2d7355cf6b02117659943762b6d1db5ab4f1dbc44ce7b"
"2946eb6c7de342962893fd387d1b73d7a8672d1f236961170b7eb3579953ee5c"
"dc88cd2d",
"005fc70477c3e63bc3954bd0df3ea0d1f41ee21746ed95fc5e1fdf90930d5e13"
"6672d72cc770742d1711c3c3a4c334a0ad9759436a4d3c5bf6e74b9578fac148"
"c831" },
{ NID_secp521r1,
"000001df277c152108349bc34d539ee0cf06b24f5d3500677b4445453ccc2140"
"9453aafb8a72a0be9ebe54d12270aa51b3ab7f316aa5e74a951c5e53f74cd95f"
"c29aee7a",
"0000013d52f33a9f3c14384d1587fa8abe7aed74bc33749ad9c570b471776422"
"c7d4505d9b0a96b3bfac041e4c6a6990ae7f700e5b4a6640229112deafa0cd8b"
"b0d089b0",
"000000816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dceb"
"bbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620c"
"d905cfb8",
"000000d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fb"
"bd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8"
"ba45d255",
"000001425332844e592b440c0027972ad1526431c06732df19cd46a242172d4d"
"d67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed"
"8ce3a7fa",
"000b3920ac830ade812c8f96805da2236e002acbbf13596a9ab254d44d0e91b6"
"255ebf1229f366fb5a05c5884ef46032c26d42189273ca4efa4c3db6bd12a685"
"3759" },
{ NID_secp521r1,
"00000092db3142564d27a5f0006f819908fba1b85038a5bc2509906a497daac6"
"7fd7aee0fc2daba4e4334eeaef0e0019204b471cd88024f82115d8149cc0cf4f"
"7ce1a4d5",
"0000016bad0623f517b158d9881841d2571efbad63f85cbe2e581960c5d67060"
"1a6760272675a548996217e4ab2b8ebce31d71fca63fcc3c08e91c1d8edd91cf"
"6fe845f8",
"0000012f2e0c6d9e9d117ceb9723bced02eb3d4eebf5feeaf8ee0113ccd8057b"
"13ddd416e0b74280c2d0ba8ed291c443bc1b141caf8afb3a71f97f57c225c03e"
"1e4d42b0",
"000000717fcb3d4a40d103871ede044dc803db508aaa4ae74b70b9fb8d8dfd84"
"bfecfad17871879698c292d2fd5e17b4f9343636c531a4fac68a35a93665546b"
"9a878679",
"000000f3d96a8637036993ab5d244500fff9d2772112826f6436603d3eb234a4"
"4d5c4e5c577234679c4f9df725ee5b9118f23d8a58d0cc01096daf70e8dfec01"
"28bdc2e8",
"006b380a6e95679277cfee4e8353bf96ef2a1ebdd060749f2f046fe571053740"
"bbcc9a0b55790bc9ab56c3208aa05ddf746a10a3ad694daae00d980d944aabc6"
"a08f" },
{ NID_secp521r1,
"000000fdd40d9e9d974027cb3bae682162eac1328ad61bc4353c45bf5afe76bf"
"607d2894c8cce23695d920f2464fda4773d4693be4b3773584691bdb0329b7f4"
"c86cc299",
"00000034ceac6a3fef1c3e1c494bfe8d872b183832219a7e14da414d4e347457"
"3671ec19b033be831b915435905925b44947c592959945b4eb7c951c3b9c8cf5"
"2530ba23",
"000000e548a79d8b05f923b9825d11b656f222e8cb98b0f89de1d317184dc5a6"
"98f7c71161ee7dc11cd31f4f4f8ae3a981e1a3e78bdebb97d7c204b9261b4ef9"
"2e0918e0",
"0000000ce800217ed243dd10a79ad73df578aa8a3f9194af528cd1094bbfee27"
"a3b5481ad5862c8876c0c3f91294c0ab3aa806d9020cbaa2ed72b7fecdc5a09a"
"6dad6f32",
"000001543c9ab45b12469232918e21d5a351f9a4b9cbf9efb2afcc402fa9b316"
"50bec2d641a05c440d35331c0893d11fb13151335988b303341301a73dc5f61d"
"574e67d9",
"00fbbcd0b8d05331fef6086f22a6cce4d35724ab7a2f49dd8458d0bfd57a0b8b"
"70f246c17c4468c076874b0dff7a0336823b19e98bf1cec05e4beffb0591f977"
"13c6" },
{ NID_secp521r1,
"00000098d99dee0816550e84dbfced7e88137fddcf581a725a455021115fe49f"
"8dc3cf233cd9ea0e6f039dc7919da973cdceaca205da39e0bd98c8062536c47f"
"258f44b5",
"000000cd225c8797371be0c4297d2b457740100c774141d8f214c23b61aa2b6c"
"d4806b9b70722aa4965fb622f42b7391e27e5ec21c5679c5b06b59127372997d"
"421adc1e",
"000001c8aae94bb10b8ca4f7be577b4fb32bb2381032c4942c24fc2d753e7cc5"
"e47b483389d9f3b956d20ee9001b1eef9f23545f72c5602140046839e963313c"
"3decc864",
"00000106a14e2ee8ff970aa8ab0c79b97a33bba2958e070b75b94736b77bbe3f"
"777324fa52872771aa88a63a9e8490c3378df4dc760cd14d62be700779dd1a43"
"77943656",
"0000002366ce3941e0b284b1aa81215d0d3b9778fce23c8cd1e4ed6fa0abf621"
"56c91d4b3eb55999c3471bed275e9e60e5aa9d690d310bfb15c9c5bbd6f5e9eb"
"39682b74",
"0145cfa38f25943516c96a5fd4bfebb2f645d10520117aa51971eff442808a23"
"b4e23c187e639ff928c3725fbd1c0c2ad0d4aeb207bc1a6fb6cb6d467888dc04"
"4b3c" },
{ NID_secp521r1,
"0000007ae115adaaf041691ab6b7fb8c921f99d8ed32d283d67084e80b9ad9c4"
"0c56cd98389fb0a849d9ecf7268c297b6f93406119f40e32b5773ed25a28a9a8"
"5c4a7588",
"000001a28e004e37eeaefe1f4dbb71f1878696141af3a10a9691c4ed93487214"
"643b761fa4b0fbeeb247cf6d3fba7a60697536ad03f49b80a9d1cb0796736549"
"77c5fa94",
"0000009b0af137c9696c75b7e6df7b73156bb2d45f482e5a4217324f478b10ce"
"b76af09724cf86afa316e7f89918d31d54824a5c33107a483c15c15b96edc661"
"340b1c0e",
"000000748cdbb875d35f4bccb62abe20e82d32e4c14dc2feb5b87da2d0ccb11c"
"9b6d4b7737b6c46f0dfb4d896e2db92fcf53cdbbae2a404c0babd564ad7adeac"
"6273efa3",
"000001984acab8d8f173323de0bb60274b228871609373bb22a17287e9dec749"
"5873abc09a8915b54c8455c8e02f654f602e23a2bbd7a9ebb74f3009bd65ecc6"
"50814cc0",
"005c5721e96c273319fd60ecc46b5962f698e974b429f28fe6962f4ac656be2e"
"b8674c4aafc037eab48ece612953b1e8d861016b6ad0c79805784c67f73ada96"
"f351" },
{ NID_secp521r1,
"0000012588115e6f7f7bdcfdf57f03b169b479758baafdaf569d04135987b2ce"
"6164c02a57685eb5276b5dae6295d3fe90620f38b5535c6d2260c173e61eb888"
"ca920203",
"000001542c169cf97c2596fe2ddd848a222e367c5f7e6267ebc1bcd9ab5dcf49"
"158f1a48e4af29a897b7e6a82091c2db874d8e7abf0f58064691344154f396db"
"aed188b6",
"000001e48faacee6dec83ffcde944cf6bdf4ce4bae72747888ebafee455b1e91"
"584971efb49127976a52f4142952f7c207ec0265f2b718cf3ead96ea4f62c752"
"e4f7acd3",
"0000010eb1b4d9172bcc23f4f20cc9560fc54928c3f34ea61c00391dc766c76e"
"d9fa608449377d1e4fadd1236025417330b4b91086704ace3e4e6484c606e2a9"
"43478c86",
"00000149413864069825ee1d0828da9f4a97713005e9bd1adbc3b38c5b946900"
"721a960fe96ad2c1b3a44fe3de9156136d44cb17cbc2415729bb782e16bfe2de"
"b3069e43",
"01736d9717429b4f412e903febe2f9e0fffd81355d6ce2c06ff3f66a3be15cee"
"c6e65e308347593f00d7f33591da4043c30763d72749f72cdceebe825e4b34ec"
"d570" },
{ NID_secp521r1,
"00000169491d55bd09049fdf4c2a53a660480fee4c03a0538675d1cd09b5bba7"
"8dac48543ef118a1173b3fbf8b20e39ce0e6b890a163c50f9645b3d21d1cbb3b"
"60a6fff4",
"00000083494b2eba76910fed33c761804515011fab50e3b377abd8a8a045d886"
"d2238d2c268ac1b6ec88bd71b7ba78e2c33c152e4bf7da5d565e4acbecf5e92c"
"7ad662bb",
"000000c29aa223ea8d64b4a1eda27f39d3bc98ea0148dd98c1cbe595f8fd2bfb"
"de119c9e017a50f5d1fc121c08c1cef31b758859556eb3e0e042d8dd6aaac57a"
"05ca61e3",
"0000001511c848ef60d5419a98d10204db0fe58224124370061bcfa4e9249d50"
"618c56bf3722471b259f38263bb7b280d23caf2a1ee8737f9371cdb2732cdc95"
"8369930c",
"000001d461681ae6d8c49b4c5f4d6016143fb1bd7491573e3ed0e6c48b82e821"
"644f87f82f0e5f08fd16f1f98fa17586200ab02ed8c627b35c3f27617ec5fd92"
"f456203f",
"018f2ae9476c771726a77780208dedfefa205488996b18fecc50bfd4c132753f"
"5766b2cd744afa9918606de2e016effc63622e9029e76dc6e3f0c69f7aeced56"
"5c2c" },
{ NID_secp521r1,
"0000008415f5bbd0eee387d6c09d0ef8acaf29c66db45d6ba101860ae45d3c60"
"e1e0e3f7247a4626a60fdd404965c3566c79f6449e856ce0bf94619f97da8da2"
"4bd2cfb6",
"000000fdd7c59c58c361bc50a7a5d0d36f723b17c4f2ad2b03c24d42dc50f74a"
"8c465a0afc4683f10fab84652dfe9e928c2626b5456453e1573ff60be1507467"
"d431fbb2",
"00000028692be2bf5c4b48939846fb3d5bce74654bb2646e15f8389e23708a1a"
"fadf561511ea0d9957d0b53453819d60fba8f65a18f7b29df021b1bb01cd1632"
"93acc3cc",
"000001cfdc10c799f5c79cb6930a65fba351748e07567993e5e410ef4cacc4cd"
"8a25784991eb4674e41050f930c7190ac812b9245f48a7973b658daf408822fe"
"5b85f668",
"00000180d9ddfc9af77b9c4a6f02a834db15e535e0b3845b2cce30388301b51c"
"ecbe3276307ef439b5c9e6a72dc2d94d879bc395052dbb4a5787d06efb280210"
"fb8be037",
"0105a346988b92ed8c7a25ce4d79d21bc86cfcc7f99c6cd19dbb4a39f48ab943"
"b79e4f0647348da0b80bd864b85c6b8d92536d6aa544dc7537a00c858f8b6631"
"9e25" },
{ NID_secp521r1,
"000001c721eea805a5cba29f34ba5758775be0cf6160e6c08723f5ab17bf96a1"
"ff2bd9427961a4f34b07fc0b14ca4b2bf6845debd5a869f124ebfa7aa72fe565"
"050b7f18",
"000000b6e89eb0e1dcf181236f7c548fd1a8c16b258b52c1a9bfd3fe8f22841b"
"26763265f074c4ccf2d634ae97b701956f67a11006c52d97197d92f585f5748b"
"c2672eeb",
"000001194d1ee613f5366cbc44b504d21a0cf6715e209cd358f2dd5f3e71cc0d"
"67d0e964168c42a084ebda746f9863a86bacffc819f1edf1b8c727ccfb304724"
"0a57c435",
"0000016bd15c8a58d366f7f2b2f298cc87b7485e9ee70d11d12448b8377c0a82"
"c7626f67aff7f97be7a3546bf417eeeddf75a93c130191c84108042ea2fca17f"
"d3f80d14",
"000001560502d04b74fce1743aab477a9d1eac93e5226981fdb97a7478ce4ce5"
"66ff7243931284fad850b0c2bcae0ddd2d97790160c1a2e77c3ed6c95ecc44b8"
"9e2637fc",
"004531b3d2c6cd12f21604c8610e6723dbf4daf80b5a459d6ba5814397d1c1f7"
"a21d7c114be964e27376aaebe3a7bc3d6af7a7f8c7befb611afe487ff032921f"
"750f" },
{ NID_secp521r1,
"000001c35823e440a9363ab98d9fc7a7bc0c0532dc7977a79165599bf1a9cc64"
"c00fb387b42cca365286e8430360bfad3643bc31354eda50dc936c329ecdb609"
"05c40fcb",
"000000d9e7f433531e44df4f6d514201cbaabb06badd6783e01111726d815531"
"d233c5cdb722893ffbb2027259d594de77438809738120c6f783934f926c3fb6"
"9b40c409",
"000001fd90e3e416e98aa3f2b6afa7f3bf368e451ad9ca5bd54b5b14aee2ed67"
"23dde5181f5085b68169b09fbec721372ccf6b284713f9a6356b8d560a8ff78c"
"a3737c88",
"000001ebea1b10d3e3b971b7efb69fc878de11c7f472e4e4d384c31b8d6288d8"
"071517acade9b39796c7af5163bcf71aeda777533f382c6cf0a4d9bbb938c85f"
"44b78037",
"0000016b0e3e19c2996b2cbd1ff64730e7ca90edca1984f9b2951333535e5748"
"baa34a99f61ff4d5f812079e0f01e87789f34efdad8098015ee74a4f846dd190"
"d16dc6e1",
"0100c8935969077bae0ba89ef0df8161d975ec5870ac811ae7e65ca5394efba4"
"f0633d41bf79ea5e5b9496bbd7aae000b0594baa82ef8f244e6984ae87ae1ed1"
"24b7" },
{ NID_secp521r1,
"000000093057fb862f2ad2e82e581baeb3324e7b32946f2ba845a9beeed87d69"
"95f54918ec6619b9931955d5a89d4d74adf1046bb362192f2ef6bd3e3d2d04dd"
"1f87054a",
"000000aa3fb2448335f694e3cda4ae0cc71b1b2f2a206fa802d7262f19983c44"
"674fe15327acaac1fa40424c395a6556cb8167312527fae5865ecffc14bbdc17"
"da78cdcf",
"0000009012ecfdadc85ced630afea534cdc8e9d1ab8be5f3753dcf5f2b09b40e"
"da66fc6858549bc36e6f8df55998cfa9a0703aecf6c42799c245011064f530c0"
"9db98369",
"000000234e32be0a907131d2d128a6477e0caceb86f02479745e0fe245cb332d"
"e631c078871160482eeef584e274df7fa412cea3e1e91f71ecba8781d9205d48"
"386341ad",
"000001cf86455b09b1c005cffba8d76289a3759628c874beea462f51f30bd581"
"e3803134307dedbb771b3334ee15be2e242cd79c3407d2f58935456c6941dd9b"
"6d155a46",
"017f36af19303841d13a389d95ec0b801c7f9a679a823146c75c17bc44256e9a"
"d422a4f8b31f14647b2c7d317b933f7c2946c4b8abd1d56d620fab1b5ff1a3ad"
"c71f" },
{ NID_secp521r1,
"00000083192ed0b1cb31f75817794937f66ad91cf74552cd510cedb9fd641310"
"422af5d09f221cad249ee814d16dd7ac84ded9eacdc28340fcfc9c0c06abe30a"
"2fc28cd8",
"0000002212ed868c9ba0fb2c91e2c39ba93996a3e4ebf45f2852d0928c48930e"
"875cc7b428d0e7f3f4d503e5d60c68cb49b13c2480cd486bed9200caddaddfe4"
"ff8e3562",
"000001b5ff847f8eff20b88cfad42c06e58c3742f2f8f1fdfd64b539ba48c259"
"26926bd5e332b45649c0b184f77255e9d58fe8afa1a6d968e2cb1d4637777120"
"c765c128",
"000001de3dc9263bc8c4969dc684be0eec54befd9a9f3dba194d8658a789341b"
"f0d78d84da6735227cafaf09351951691197573c8c360a11e5285712b8bbdf5a"
"c91b977c",
"000000812de58cd095ec2e5a9b247eb3ed41d8bef6aeace194a7a05b65aa5d28"
"9fbc9b1770ec84bb6be0c2c64cc37c1d54a7f5d71377a9adbe20f26f6f2b544a"
"821ea831",
"00062f9fc29ae1a68b2ee0dcf956cbd38c88ae5f645eaa546b00ebe87a7260bf"
"724be20d34b9d02076655c933d056b21e304c24ddb1dedf1dd76de611fc4a234"
"0336" },
{ NID_secp521r1,
"000001a89b636a93e5d2ba6c2292bf23033a84f06a3ac1220ea71e806afbe097"
"a804cc67e9baa514cfb6c12c9194be30212bf7aae7fdf6d376c212f0554e6564"
"63ffab7e",
"00000182efcaf70fc412d336602e014da47256a0b606f2addcce8053bf817ac8"
"656bb4e42f14c8cbf2a68f488ab35dcdf64056271dee1f606a440ba4bd4e5a11"
"b8b8e54f",
"0000011a6347d4e801c91923488354cc533e7e35fddf81ff0fb7f56bb0726e0c"
"29ee5dcdc5f394ba54cf57269048aab6e055895c8da24b8b0639a742314390cc"
"04190ed6",
"000000fe30267f33ba5cdefc25cbb3c9320dad9ccb1d7d376644620ca4fadee5"
"626a3cede25ad254624def727a7048f7145f76162aa98042f9b123b2076f8e8c"
"f59b3fdf",
"0000001145dc6631953b6e2945e94301d6cbb098fe4b04f7ee9b09411df104dc"
"82d7d79ec46a01ed0f2d3e7db6eb680694bdeb107c1078aec6cabd9ebee3d342"
"fe7e54df",
"0128ab09bfec5406799e610f772ba17e892249fa8e0e7b18a04b9197034b250b"
"48294f1867fb9641518f92766066a07a8b917b0e76879e1011e51ccbd9f540c5"
"4d4f" },
{ NID_secp521r1,
"0000017200b3f16a68cbaed2bf78ba8cddfb6cffac262bba00fbc25f9dc72a07"
"ce59372904899f364c44cb264c097b647d4412bee3e519892d534d9129f8a28f"
"7500fee7",
"000000baba8d672a4f4a3b63de48b96f56e18df5d68f7d70d5109833f43770d6"
"732e06b39ad60d93e5b43db8789f1ec0aba47286a39ea584235acea757dbf13d"
"53b58364",
"00000022b6d2a22d71dfaa811d2d9f9f31fbed27f2e1f3d239538ddf3e4cc8c3"
"9a330266db25b7bc0a9704f17bde7f3592bf5f1f2d4b56013aacc3d8d1bc02f0"
"0d3146cc",
"000000ba38cfbf9fd2518a3f61d43549e7a6a6d28b2be57ffd3e0faceb636b34"
"ed17e044a9f249dae8fc132e937e2d9349cd2ed77bb1049ceb692a2ec5b17ad6"
"1502a64c",
"0000001ec91d3058573fa6c0564a02a1a010160c313bc7c73510dc983e546168"
"2b5be00dbce7e2c682ad73f29ca822cdc111f68fabe33a7b384a648342c3cdb9"
"f050bcdb",
"0101e462e9d9159968f6440e956f11dcf2227ae4aea81667122b6af9239a291e"
"b5d6cf5a4087f358525fcacfa46bb2db01a75af1ba519b2d31da33eda87a9d56"
"5748" },
{ NID_secp521r1,
"0000004efd5dbd2f979e3831ce98f82355d6ca14a5757842875882990ab85ab9"
"b7352dd6b9b2f4ea9a1e95c3880d65d1f3602f9ca653dc346fac858658d75626"
"f4d4fb08",
"00000061cf15dbdaa7f31589c98400373da284506d70c89f074ed262a9e28140"
"796b7236c2eef99016085e71552ff488c72b7339fefb7915c38459cb20ab85ae"
"c4e45052",
"0000005bacfff268acf6553c3c583b464ea36a1d35e2b257a5d49eb3419d5a09"
"5087c2fb4d15cf5bf5af816d0f3ff7586490ccd3ddc1a98b39ce63749c6288ce"
"0dbdac7d",
"00000036e488da7581472a9d8e628c58d6ad727311b7e6a3f6ae33a8544f34b0"
"9280249020be7196916fafd90e2ec54b66b5468d2361b99b56fa00d7ac37abb8"
"c6f16653",
"0000011edb9fb8adb6a43f4f5f5fdc1421c9fe04fc8ba46c9b66334e3af927c8"
"befb4307104f299acec4e30f812d9345c9720d19869dbfffd4ca3e7d2713eb5f"
"c3f42615",
"0141d6a4b719ab67eaf04a92c0a41e2dda78f4354fb90bdc35202cc7699b9b04"
"d49616f82255debf7bbec045ae58f982a66905fcfae69d689785e38c868eb4a2"
"7e7b" },
{ NID_secp521r1,
"00000129891de0cf3cf82e8c2cf1bf90bb296fe00ab08ca45bb7892e0e227a50"
"4fdd05d2381a4448b68adff9c4153c87eacb78330d8bd52515f9f9a0b58e85f4"
"46bb4e10",
"0000009edd679696d3d1d0ef327f200383253f6413683d9e4fcc87bb35f112c2"
"f110098d15e5701d7ceee416291ff5fed85e687f727388b9afe26a4f6feed560"
"b218e6bb",
"0000008e2c93c5423876223a637cad367c8589da69a2d0fc68612f31923ae502"
"19df2452e7cc92615b67f17b57ffd2f52b19154bb40d7715336420fde2e89fee"
"244f59dc",
"000000fa3b35118d6c422570f724a26f90b2833b19239174cea081c53133f64d"
"b60d6940ea1261299c04c1f4587cdb0c4c39616479c1bb0c146799a118032dcf"
"98f899c0",
"00000069f040229006151fa32b51f679c8816f7c17506b403809dc77cd58a2ae"
"c430d94d13b6c916de99f355aa45fcfbc6853d686c71be496a067d24bfaea481"
"8fc51f75",
"00345e26e0abb1aac12b75f3a9cf41efe1c336396dffa4a067a4c2cfeb878c68"
"b2b045faa4e5b4e6fa4678f5b603c351903b14bf9a6a70c439257199a640890b"
"61d1" },
{ NID_secp521r1,
"000001a3c20240e59f5b7a3e17c275d2314ba1741210ad58b71036f8c83cc1f6"
"b0f409dfdd9113e94b67ec39c3291426c23ffcc447054670d2908ff8fe67dc23"
"06034c5c",
"000001d2825bfd3af8b1e13205780c137fe938f84fde40188e61ea02cead81ba"
"dfdb425c29f7d7fb0324debadc10bbb93de68f62c35069268283f5265865db57"
"a79f7bf7",
"00000004d49d39d40d8111bf16d28c5936554326b197353eebbcf47545393bc8"
"d3aaf98f14f5be7074bfb38e6cc97b989754074daddb3045f4e4ce745669fdb3"
"ec0d5fa8",
"0000012ec226d050ce07c79b3df4d0f0891f9f7adf462e8c98dbc1a2a14f5e53"
"a3f5ad894433587cc429a8be9ea1d84fa33b1803690dae04da7218d30026157f"
"c995cf52",
"0000004837dfbf3426f57b5c793269130abb9a38f618532211931154db4eeb9a"
"ede88e57290f842ea0f2ea9a5f74c6203a3920fe4e305f6118f676b154e1d75b"
"9cb5eb88",
"006fe9de6fb8e672e7fd150fdc5e617fabb0d43906354ccfd224757c7276f7a1"
"010091b17ed072074f8d10a5ec971eb35a5cb7076603b7bc38d432cbc059f80f"
"9488" },
{ NID_secp521r1,
"0000007e2d138f2832e345ae8ff65957e40e5ec7163f016bdf6d24a2243daa63"
"1d878a4a16783990c722382130f9e51f0c1bd6ff5ac96780e48b68f5dec95f42"
"e6144bb5",
"000000b0de5c896791f52886b0f09913e26e78dd0b69798fc4df6d95e3ca708e"
"cbcbcce1c1895f5561bbabaae372e9e67e6e1a3be60e19b470cdf673ec1fc393"
"d3426e20",
"0000011a5d1cc79cd2bf73ea106f0e60a5ace220813b53e27b739864334a07c0"
"3367efda7a4619fa6eef3a9746492283b3c445610a023a9cc49bf4591140384f"
"ca5c8bb5",
"000000eb07c7332eedb7d3036059d35f7d2288d4377d5f42337ad3964079fb12"
"0ccd4c8bd384b585621055217023acd9a94fcb3b965bfb394675e788ade41a1d"
"e73e620c",
"000000491a835de2e6e7deb7e090f4a11f2c460c0b1f3d5e94ee8d751014dc72"
"0784fd3b54500c86ebaef18429f09e8e876d5d1538968a030d7715dde99f0d8f"
"06e29d59",
"01e4e759ecedce1013baf73e6fcc0b92451d03bdd50489b78871c333114990c9"
"ba6a9b2fc7b1a2d9a1794c1b60d9279af6f146f0bbfb0683140403bfa4ccdb52"
"4a29" },
{ NID_secp521r1,
"000000118c36022209b1af8ebad1a12b566fc48744576e1199fe80de1cdf851c"
"df03e5b9091a8f7e079e83b7f827259b691d0c22ee29d6bdf73ec7bbfd746f2c"
"d97a357d",
"000000da5ff4904548a342e2e7ba6a1f4ee5f840411a96cf63e6fe622f22c13e"
"614e0a847c11a1ab3f1d12cc850c32e095614ca8f7e2721477b486e9ff403729"
"77c3f65c",
"0000010c908caf1be74c616b625fc8c1f514446a6aec83b5937141d6afbb0a8c"
"7666a7746fa1f7a6664a2123e8cdf6cd8bf836c56d3c0ebdcc980e43a186f938"
"f3a78ae7",
"00000031890f4c7abec3f723362285d77d2636f876817db3bbc88b01e773597b"
"969ff6f013ea470c854ab4a7739004eb8cbea69b82ddf36acadd406871798ecb"
"2ac3aa7f",
"000000d8b429ae3250266b9643c0c765a60dc10155bc2531cf8627296f4978b6"
"640a9e600e19d0037d58503fa80799546a814d7478a550aa90e5ebeb052527fa"
"aeae5d08",
"0163c9191d651039a5fe985a0eea1eba018a40ab1937fcd2b61220820ee8f230"
"2e9799f6edfc3f5174f369d672d377ea8954a8d0c8b851e81a56fda95212a657"
"8f0e" },
{ NID_secp521r1,
"000001780edff1ca1c03cfbe593edc6c049bcb2860294a92c355489d9afb2e70"
"2075ade1c953895a456230a0cde905de4a3f38573dbfcccd67ad6e7e93f0b558"
"1e926a5d",
"000000a5481962c9162962e7f0ebdec936935d0eaa813e8226d40d7f6119bfd9"
"40602380c86721e61db1830f51e139f210000bcec0d8edd39e54d73a9a129f95"
"cd5fa979",
"000001b37d6b7288de671360425d3e5ac1ccb21815079d8d73431e9b74a6f0e7"
"ae004a357575b11ad66642ce8b775593eba9d98bf25c75ef0b4d3a2098bbc641"
"f59a2b77",
"000000189a5ee34de7e35aefeaeef9220c18071b4c29a4c3bd9d954458bd3e82"
"a7a34da34cff5579b8101c065b1f2f527cf4581501e28ef5671873e65267733d"
"003520af",
"000001eb4bc50a7b4d4599d7e3fa773ddb9eb252c9b3422872e544bdf75c7bf6"
"0f5166ddc11eb08fa7c30822dabaee373ab468eb2d922e484e2a527fff2ebb80"
"4b7d9a37",
"015d613e267a36342e0d125cdad643d80d97ed0600afb9e6b9545c9e64a98cc6"
"da7c5aaa3a8da0bdd9dd3b97e9788218a80abafc106ef065c8f1c4e1119ef58d"
"298b" },
{ NID_secp521r1,
"0000016dacffa183e5303083a334f765de724ec5ec9402026d4797884a9828a0"
"d321a8cfac74ab737fe20a7d6befcfc73b6a35c1c7b01d373e31abc192d48a42"
"41a35803",
"0000011e5327cac22d305e7156e559176e19bee7e4f2f59e86f1a9d0b6603b6a"
"7df1069bde6387feb71587b8ffce5b266e1bae86de29378a34e5c74b6724c4d4"
"0a719923",
"000000f2661ac762f60c5fff23be5d969ccd4ec6f98e4e72618d12bdcdb9b410"
"2162333788c0bae59f91cdfc172c7a1681ee44d96ab2135a6e5f3415ebbcd551"
"65b1afb0",
"000000a8e25a6902d687b4787cdc94c364ac7cecc5c495483ed363dc0aa95ee2"
"bd739c4c4d46b17006c728b076350d7d7e54c6822f52f47162a25109aaaba690"
"cab696ec",
"00000168d2f08fe19e4dc9ee7a195b03c9f7fe6676f9f520b6270557504e72ca"
"4394a2c6918625e15ac0c51b8f95cd560123653fb8e8ee6db961e2c4c62cc54e"
"92e2a2a9",
"014d6082a3b5ced1ab8ca265a8106f302146c4acb8c30bb14a4c991e3c82a973"
"1288bdb91e0e85bda313912d06384fc44f2153fb13506fa9cf43c9aab5750988"
"c943" },
{ NID_secp521r1,
"000000a091421d3703e3b341e9f1e7d58f8cf7bdbd1798d001967b801d1cec27"
"e605c580b2387c1cb464f55ce7ac80334102ab03cfb86d88af76c9f4129c01be"
"dd3bbfc4",
"0000008c9c577a8e6fc446815e9d40baa66025f15dae285f19eb668ee60ae9c9"
"8e7ecdbf2b2a68e22928059f67db188007161d3ecf397e0883f0c4eb7eaf7827"
"a62205cc",
"000000f430ca1261f09681a9282e9e970a9234227b1d5e58d558c3cc6eff44d1"
"bdf53de16ad5ee2b18b92d62fc79586116b0efc15f79340fb7eaf5ce6c44341d"
"cf8dde27",
"0000006c1d9b5eca87de1fb871a0a32f807c725adccde9b3967453a71347d608"
"f0c030cd09e338cdecbf4a02015bc8a6e8d3e2595fe773ffc2fc4e4a55d0b1a2"
"cc00323b",
"000001141b2109e7f4981c952aa818a2b9f6f5c41feccdb7a7a45b9b4b672937"
"771b008cae5f934dfe3fed10d383ab1f38769c92ce88d9be5414817ecb073a31"
"ab368ccb",
"0020c00747cb8d492fd497e0fec54644bf027d418ab686381f109712a99cabe3"
"28b9743d2225836f9ad66e5d7fed1de247e0da92f60d5b31f9e47672e57f7105"
"98f4" },
{ NID_secp521r1,
"0000004f38816681771289ce0cb83a5e29a1ab06fc91f786994b23708ff08a08"
"a0f675b809ae99e9f9967eb1a49f196057d69e50d6dedb4dd2d9a81c02bdcc8f"
"7f518460",
"0000009efb244c8b91087de1eed766500f0e81530752d469256ef79f6b965d8a"
"2232a0c2dbc4e8e1d09214bab38485be6e357c4200d073b52f04e4a16fc6f524"
"7187aecb",
"0000005dc33aeda03c2eb233014ee468dff753b72f73b00991043ea353828ae6"
"9d4cd0fadeda7bb278b535d7c57406ff2e6e473a5a4ff98e90f90d6dadd25100"
"e8d85666",
"000000c825ba307373cec8dd2498eef82e21fd9862168dbfeb83593980ca9f82"
"875333899fe94f137daf1c4189eb502937c3a367ea7951ed8b0f3377fcdf2922"
"021d46a5",
"0000016b8a2540d5e65493888bc337249e67c0a68774f3e8d81e3b4574a01251"
"65f0bd58b8af9de74b35832539f95c3cd9f1b759408560aa6851ae3ac7555347"
"b0d3b13b",
"00c2bfafcd7fbd3e2fd1c750fdea61e70bd4787a7e68468c574ee99ebc47eede"
"f064e8944a73bcb7913dbab5d93dca660d216c553622362794f7a2acc71022bd"
"b16f" },
{ NID_secp521r1,
"000001a32099b02c0bd85371f60b0dd20890e6c7af048c8179890fda308b359d"
"bbc2b7a832bb8c6526c4af99a7ea3f0b3cb96ae1eb7684132795c478ad6f962e"
"4a6f446d",
"0000017627357b39e9d7632a1370b3e93c1afb5c851b910eb4ead0c9d387df67"
"cde85003e0e427552f1cd09059aad0262e235cce5fba8cedc4fdc1463da76dcd"
"4b6d1a46",
"000000df14b1f1432a7b0fb053965fd8643afee26b2451ecb6a8a53a655d5fbe"
"16e4c64ce8647225eb11e7fdcb23627471dffc5c2523bd2ae89957cba3a57a23"
"933e5a78",
"0000004e8583bbbb2ecd93f0714c332dff5ab3bc6396e62f3c560229664329ba"
"a5138c3bb1c36428abd4e23d17fcb7a2cfcc224b2e734c8941f6f121722d7b6b"
"94154576",
"000001cf0874f204b0363f020864672fadbf87c8811eb147758b254b74b14fae"
"742159f0f671a018212bbf25b8519e126d4cad778cfff50d288fd39ceb0cac63"
"5b175ec0",
"01aaf24e5d47e4080c18c55ea35581cd8da30f1a079565045d2008d51b12d0ab"
"b4411cda7a0785b15d149ed301a3697062f42da237aa7f07e0af3fd00eb1800d"
"9c41" }
#ifndef OPENSSL_NO_EC2M
/* curves over binary fields go here */
, { NID_sect163k1,
"0000000574236f1428c432130946783a5b3aabb6c27ea5d6",
"00000007908c251b8da021cbac281f123f7af4fac5b3dbb8",
"6653b6077398fadc7bf5e60158170148c3dc4527",
"000000071f8b2877d6027d9c1ade4244f2dea12692ef23d5",
"00000005c15ee776221c72b84b347ce383f38067b89c3e9a",
"04325bff38f1b0c83c27f554a6c972a80f14bc23bc" },
{ NID_sect163k1,
"00000001699744092fe2b5fe7ecbf6987b7aea0a06fd2cb0",
"000000035de441df9408d91f0e021df8f0526b8063031495",
"00000003aef44754d0ca97d42b4e97aa92156263c0e078f6",
"00000001b0108c786bf4d340f0505bdfc7d45b514611ad94",
"000000022c9c39d5fb9456b8a2221cea4f058f6a8d2cd84a",
"05f9ac3a3dd88429600958386c55bef4b1aa5f0c24" },
{ NID_sect163k1,
"00000002965db159171f5cb7e7a1bcc61611aeaca8c52c9b",
"00000006871d1e9c1fe845268076a995803a6d49cd075554",
"000000031172342e6d37cc1e062a4494c39cba48f9ad9a8c",
"00000003a27ecaec2b66feac2040f6890128bd0058d31924",
"000000014007e3209b6d7127b0f393e5e58b1590b9f40be2",
"022e0290eda5d348894129f7455d1c766d32d5c2c2" },
{ NID_sect163k1,
"000000055b68c0c2c246fe0f2cd5484b58814c65213ea541",
"0000000539c11d2592a2f6393b6e86c54df909b95fe0d5a8",
"000000032a511cdcd4bfc567ceac8c24ed04e8894df78ddf",
"00000006978dacaa47d8f3bc90b41ec7f4f8ac79a86ddd07",
"00000007f8b0ef4270760376bc2d5faed83da7872631d09f",
"037f659f430009fcdae4e9f6e6316b0f5dbb268212" },
{ NID_sect163k1,
"00000006b8ef5a62d3b636a5a76bfeb1ef8ff4d8b3d9e2fc",
"0000000675a757266718398d8af66d2971798478e2f37d28",
"00000002c6f64fe609eb8eeb5b53fab6308898e63ff2e3f6",
"0000000549e1a82ec284bf77d528627e52d832e236c92ad3",
"000000019883aa9b458b35bd544d6882812150c1497d31d4",
"00503bbb9b62f50ae7a8dfd74a1741826f09290651" },
{ NID_sect163k1,
"000000056c4a3586acb03099d52b2cd4ac59269cf51b8730",
"00000002426561cbd9da1b23a6003de0e5f7c4a065a5c2b8",
"000000026a56867513ddd8ca94d7923baa1f7fb00daa38fa",
"00000006c28a40dc4e5503d2c4b8ab0b6b7046e8e25ac09f",
"0000000121911654a5836005d8036d976585ff1d831e587b",
"012cf17799fdefa2940b18d56e80d44414c5b13884" },
{ NID_sect163k1,
"0000000741c69a4edb386c94f819d1b5ddd0281e4ff29765",
"00000000d32f972abac91be85a709eba07f5d16215ae602d",
"0000000386811079c8021c2d79f4de952cb2e599c42e19ed",
"000000060aa42a62e21eea37e362b4d3de837f0c49d3ac13",
"000000069b20d6fd16d13b1883df05629ac7d1b82386b344",
"062a2f926ab435ac14e05d44c27b46b6820b713aee" },
{ NID_sect163k1,
"00000001ef47795fb0e380405ab5e88defc3ced9a92514a6",
"00000000be6181d7fc03ca8bfdf11869cea28cfa0e5f5f64",
"e46e9c965268647f2048474c7b1a54dffe728f1f",
"00000007a984ead440310cef2e1338972ff2dddb65cac3d2",
"0000000333c1a93427fe6ac502760b7778898a8bb6a40ad9",
"0399b9294e895486bdefbaad7a729353ce09586357" },
{ NID_sect163k1,
"0000000374d7f9ba8cda8a68de7279d3ff8674032fd47c02",
"00000003ede995c3a4e8a6fe21cd1e4cd4ca3812c0d692a5",
"000000027334971405b0461c3ede67f2ba336734451a8378",
"0000000767c31ee9303b1b2cd3059f81507ef304ebd3102c",
"0000000251e0d430dc3f63f3a37bab1e7a957652cf67e22c",
"022325a9a769a902c2e64c80a1d35429ced42ae0a4" },
{ NID_sect163k1,
"00000006577df54e11c7e76202f94f564e6137b23ce6e441",
"000000068936600aadcb25fd4024ed3e845b2bbf807280e6",
"000000019bb480739011235c6d5c6e74d6a7bb4f20f61b7a",
"0000000093549075704d79dae772317dd65244fa772569eb",
"00000002a8a2821dd39d7e7653ca71cfc1a9ed857801a39b",
"051392d5377016358405030b48744003db66440a2d" },
{ NID_sect163k1,
"0000000261d15345ceb492229a8d74597e7dfd19aeb6848a",
"0000000114a122ce28ca15620f7b40a1f26b4234c956bdc1",
"f4edb58bcc3d6e9d317229420a733281eccff1cf",
"000000027183609b7593b1845365c081d45ff66c9ab5e370",
"000000069b981236fe930947b6b77f374282a18e4be993cb",
"045dac076e79de2fc631315465d3ef6245f26647e5" },
{ NID_sect163k1,
"000000070e380f49370a0027954a4ea880bc1929b28c5329",
"000000046fe3b454af9420a811f1e15f774da5ae1a40b459",
"00000001b990491a12fdee231aa2a116e1e3c1c91d0fd478",
"00000003da869d09c4e4545ac1689fc72316012632d0abd9",
"00000002c820f40310e5ffd2f8bf439fba879bb2ef621b2a",
"014f7a46847ed6a7ff605b0e52c616e4ad3f0d5029" },
{ NID_sect163k1,
"00000006e60af77419b9fe0fc5c79ca1a22a1011402405b6",
"000000069bca34005b578cd7a7a6929bd3f6ce29943b5ed9",
"e829b9942fd96487f6012908fe04f6d8eaaf1966",
"00000005ab2074c04df57160167735f7fc2d8f629d34ff18",
"000000012e9da6d05bb3e2acbe5ba4afb4a0dd72db07d6ac",
"00eacabc34555956995623e60482e5c118e34e2094" },
{ NID_sect163k1,
"00000004f750e27500e10f0a176b83f14bc26d6bd71ebd74",
"000000039e5009067c0ee2c8f55b7e84da7a391f08af7504",
"0000000157ce8f0b6ce92e426ec99f223ad82763e4bd3ff3",
"00000005d3989cca4ae732de93672b25c9260861b4c0dce3",
"0000000436a331ead24f2807b55260f9dc3de668cfbfebb7",
"0414a622645107f115576f51cdf39d1393a2d7851f" },
{ NID_sect163k1,
"00000002ab9f5ba94102d21a706761eac0092190f1cdad04",
"00000004addd77e199c132d18ac541b117748d2319db7fe5",
"0000000379885f45f2d707be1c11d86c41bada493b2a5603",
"00000005ae31cb29b31d24f5f94c30e9c02f07f38bff0ac8",
"00000004d8d8e39bf87f058543dc8990a91214da416cc558",
"056be002daff11c4066e10acd046a85e170fa4c122" },
{ NID_sect163k1,
"000000043d25d2de9293b84d351a33cb1a52f5930a4c8b76",
"00000003d259d8236e9c8d6437f41e6d54611c52238fe2d5",
"ba8c5864db3efd768b9376fc2b6c1f85f46f6af2",
"000000062f622149823f255b4f86906666f3a3556af080ea",
"0000000274ca32c10f9add61a026d20ad3ad56b17fb06a46",
"021fef8e473daeda8ef6bf07814d7b9b613e3076a3" },
{ NID_sect163k1,
"00000000560e1a421865118bea16cdad6b67aba384ef387b",
"000000058b213ec2ab3942f8f6ad60a956955b589066b856",
"00000003e5080484d3730b2248ccc48260d4bd1857605ad1",
"000000058aea6e40b8cb25e6622a7be4ff01b79c92de72a5",
"000000043f6776b6deff3d29b4c703899d705c7fecf525c4",
"03a287fd1cca68db47a3c74c12627fc3728568dd66" },
{ NID_sect163k1,
"000000038e485de92e41f1caca6c0eb9d811a5aca89bf345",
"0000000331a1677c46a68e964811a9cc5e4e53ea71e23129",
"5d052ba1abea724978caef1879245672d5aef891",
"000000036b84a77337a9de5c1dd7ae3c899381382f0fffa4",
"000000056d4ac39fe881fdb8e60d4559658aaade45663ee5",
"029558b41b8b92387bc22c868f51bb7acb6e4ee2e3" },
{ NID_sect163k1,
"000000064259e500476dda3e97e25e491d466c2b7958bd49",
"00000003c2e53281393641a518d1dceffabee8b29bde1402",
"000000039180187a9eddcf38dc264f055b07d20b9f9a8bc4",
"00000004b292d1fa09dfc5e6a3ad99fd02feb74d480e34f2",
"00000006e1888009a0a0491c0be6abfac943d377f0b4863b",
"0530020c8f6362312bfbe5c1c605b40dc2e032e81c" },
{ NID_sect163k1,
"00000003714276997b4478e2d8b59af5f2e63e22bc4c31e4",
"0000000673f28d962abfedee62eab47c3b4579a1e5168336",
"000000016d37862b195763c6a01d5e39b9459a32507c2b21",
"000000033440e460c475f2058a767ec466ca18bce41f830e",
"0000000372aee323d063fa89acbffbf55024ae24e4929f19",
"0521673006a1d9608911d54536e122d809e919d804" },
{ NID_sect163k1,
"0000000275ec15f27dd2da6e44dfe6235472d5bd3a2502f8",
"000000058fd02262b27c185dde26b2c77d5a4f4d50dc9928",
"6c658794b039c820a8b033008fa8ac7556bcaec3",
"00000004cbfb286691e415081a1785ec6b0aacdb1d231d1d",
"00000005dd6acfe91d68a8ec23686478c0ee8c89277aef14",
"0460579beca16cccce314ff3040de4785336fc358c" },
{ NID_sect163k1,
"0000000233af36103039226f416dd22e1a26b73f9093d38a",
"0000000734258a175c97768a9f72b824b99a91f5cf8e3d96",
"0000000169c8da22c35a855495047a104be00b1575b652ab",
"000000045efed9c8bd2a4e429588f344f49d1e63e668bd01",
"000000025d1af85ac21d59822d7df8f0e4bebadf3b5d4401",
"05ba66964483fe473ccbd00c37ad3ba40cc5969f62" },
{ NID_sect163k1,
"00000006d032152240f28be7f74df8f6d2a450c1229a5a95",
"00000007aadac77cc4448985d1794636bc1d582f3d101a33",
"032fc790864632630c49a29e9ad0fb6d10f2b58c",
"0000000779cfb3e17c902a2584ed3382a8bed8262db98424",
"000000004af273875f8a2ab9a94ac0d1e4a23390b2bb505c",
"0277c4a76e1613b2ede699a675c1645a786075009e" },
{ NID_sect163k1,
"00000001f8581ec61df1409227aab7a015f2c71d29e3716c",
"00000001c1f51cc4185b68a260e31b4b00c03a4403f65c25",
"00000003c1de5bb40e70933ed7db84ce2cb468cbba299b3a",
"00000005ffe0f16018bd4bdee5f73bfdad04d713f2216f50",
"000000042361c881f0081cb0544efab0c3b34f59eaadeec4",
"03c6481dac387af39e8c09a553068ac496eea03691" },
{ NID_sect163k1,
"00000002ba22fbdaaaa806c8570f14ad4c882a610ccb8d84",
"00000006d4438e528ca887b05bd2564df93bef9bf660da78",
"00000003881275ba48bea0becc0211903467f5d0aae321aa",
"0000000776e40fe7149985337ef1b6c9b830cb3608752aa6",
"000000058e6ecbb27b0b2d3cd0e3a7ba538de3576fd5b9f6",
"07b5d096d06d41c3ad6458cc93417e6facc99bc7b8" },
{ NID_sect233k1,
"000001f40e34b3ed4a1b2d40c056fb75f2ad543c897cfd82f542cf746a0f202f",
"000000c130a1abe92bc4c977c800777996ccc50b90df991a2e81dd515c188599",
"000000135a5b8c3ce047fbc5df26277d3bf83ac33ddadb5cf4a050ca82be48f0",
"000001a53e5c138b3d83905d563aa1db01274633c986b52f78225a92e33e7952",
"000000ecabd3e2e26729a965604e560ed4498a22b31c39642e1cf99b1dde3ec7",
"00a822b141ca1f5ad32899e68c54d1fec3df8100df485ebf1c5868a9ac89" },
{ NID_sect233k1,
"000000c864c2a462a9363a4ac3d818211bca0369472d186288a27567433bda45",
"000000689d4d0006eba054dc69fcc0786780fb5f74d3989213504e2f6e666980",
"00000051be6fbcd4878c55439b0bcbbe5ea8e84bc9db89e70a8e8ebf34782da8",
"000001c5a1e5d3ee516e3ede723fa2d5cd3456b116326303c5ee49273a5604c4",
"000000568d0fe7130295541bfa265074147546e9733736ba007559d716d8e094",
"01662682bec2dfae05e38587c8e6a4d18aef4cb3416989c47c11bbe2810f" },
{ NID_sect233k1,
"000001782d82fcd211c0247c87e657efcc5d2ff6b05eb935330a53903fb3bfa3",
"000000cce830a515d690ab98149579ad3481384859e565d07fa61f50ebd669a2",
"0000002ecca595e55e6c85c5af78c59540fdb749003ff4ec361c38b48e7da6bc",
"0000005a48fac476c31cad0c68e64e65e687ae4418fb5d3b4bb2abb990dd0de4",
"0000002d9add706626f2859ece110df2dde89faf3e8aac433e2595e23c274082",
"00215d511cb95e0e073ee999908a7a844afd75c9acb7a9d724f7fd322b01" },
{ NID_sect233k1,
"0000008d800d3767abf5731695754ee8829b858ff4eb604a448ad66490b49c19",
"000001bc0f0339649ad4d7b7cff3fca9e965a38625e8f45bc9602a33c0798a33",
"0000006a7c03892df184d56cdccb9d5e9a16483a6c9388ae212aa926c8fdfb5e",
"0000014aaf880e81db69aba2b403bbda7f361e3339b483ce2699f30bf5281ead",
"000001b71559bd7d9384e517b87f1138a696fbceb3510d8c41c2158d4aa3e5b2",
"01394e02c70104f2a5308b2d101b02c70ef2d13540602b8e8f82dc6d569f" },
{ NID_sect233k1,
"0000014a3e121add7a5267f5cad204b3f49215084786b23f8d94d9fda02e0f19",
"000000394fea175dad9b34d525434654d0c86637926cac3a3292a2e4a514b5f5",
"0000002e2ff8791bc64c00f3b0f1d5d5cfb9ddb3b193814599f7dbddedefcfa3",
"0000018045cc9e65f6e275e322a62c18efe2d00cf93995feb53561273a3f1306",
"00000164e0073c0d4b3e12e22f837bd3fec421e3bb09e0c0dd997422830f6403",
"008556a4c3a8906ddbcb946099ca5dbe7bdb6cd8f37fbb50c96fcefed32d" },
{ NID_sect233k1,
"00000089667888f8425c5a623134622f1ea9d9af36df9772c410d6e31f2b4db8",
"00000084430fa47164d1c0eb97042a44cbef400bbb545faea4ef49ba5e3bef42",
"00000066972e71566746f2f76c87793774054ea275e2a7e27ab7c2d05c5f2412",
"00000020226dd73e318e4fc8d49dd43e59e260193d1bb248cbe4c06b4d6b8389",
"000000ed12a4f389696ab31c93ea3ec4d8eaf18be097fc9152e2c42b73ff4528",
"004ea6e0e34ec7c9bbad47f0f6f8ec0608e736d91e0e56cf3e5cffe8c370" },
{ NID_sect233k1,
"00000164da099225eb3c641fc83c77204a396eab9495b12a22f68e7a4b8399d5",
"000000cd98f2704c7494e6d20375e74528c8f56f867e9dd763298142ea01724b",
"0000001e53baa16bc0262b5329a711b0eb188a1bca7ef4b5c85061225d41d4a9",
"0000007d6d785fa323174eb9cde5b705428e4019244835bc94702f280c25ffe5",
"0000019aa0ef433074c484d14e611372f03ef8912f1a8246ceb1e90c817db3db",
"0160d0b9b92a4acd089738fd489ae39734551e888fd05a020ce26498270a" },
{ NID_sect233k1,
"00000033a8b08a3c33c343032ced1c0f5e826f932dee879ec1607a2af5d46298",
"0000006c4f27a49b51a89f6d0960160ba5b8fec08dd2cd4bc909a490aebe4f7b",
"00000042a8032a11d1657755c49e477033b0d341da2fe993a4577b41a40cee1a",
"000001f6629697da620d597fc1f51c83374213f37e952fc117ee65a9e766aefb",
"0000002b36dedc787ac951d2879d72414da2e7575a6cd7c42e0fa20b32d461f7",
"0038381b342efaa70bb79adb76ceb775de5f45f863559ecaee1ddbbd0313" },
{ NID_sect233k1,
"000000cfe15f861aa0153485f38ac033df9c8d812afde167b8918bb94a08d963",
"000001bebf067f85126d114932162164201b1374bf1840aa11d5e250639d0608",
"00000043e5770978195f917152f057ba1fb0156d894d32e8bb54c7f62f7340a6",
"000001487d1fdabccd7d89da25685b042980ab170aee3c11f31180e3b7c50a4a",
"0000017e383dd65a1ec8a409007f75035e5b161335d9c7756ed970490fbd171a",
"0122169f1dff445ec663270375dfe914016c38ce6c2d40d0b8098abc60ac" },
{ NID_sect233k1,
"000000763e286be50740b7f8bd78fa70bcac880df3d7371eb33fda2453b3ed23",
"00000057be6c5f7d990b75439868339ae327af04a049b38b92332b9cb8cb27d9",
"0000004c67c6103e62124600a0d9e923dc217a022f57c6feb219c703334ff339",
"0000002352fe9341e62c609fc1538e0270405e7001d747b87500e644a112c5d9",
"00000041f3b15b714a6f7ef647e23665ea530efcbe19b0740436cda812e83939",
"0054d47c9d0a9fee258122326be25daf35f0ba0b8449e16b4623a8c0fd7e" },
{ NID_sect233k1,
"000000bc8a71ad4c1134def026e4723e310223fb2c5859bc7594054c894da552",
"000000c3650563505535033c7a6c448d73bfa08fb8370234c7fdbac1b34daa22",
"00000019e54da872995eb3dcdccc50418ec351400889fae75a0ba4dcff25f1f9",
"0000015e67eaebe52ba37f5b73a199d950812cec1012fd410581444bbf23e0c8",
"00000022055ef821df33042fb8316ddad76485dbd2590e2f5498a914e4f0ad39",
"0071aed39f5c44a7ff72db3e0f8284da39dfb2d894f278d2006f9d2686e3" },
{ NID_sect233k1,
"0000016cc1ae13fb348252493021cd6146d531f0b722842a44c7979689f1ff38",
"0000018c0963ff0ea37048c9f6f47644f2a7c8c503863c27cf21ee6e0a3224ea",
"00000013a5ffc9a0f7069c1c66148699612e5cfab7e2bf7b3255f181a0227192",
"0000018de4dc4f6a4de5c3638ebba24dc7064983b159f55b139c7680a1cb90d1",
"00000135532d8148af3e227d4a8960e768c565f72c1ac0a1c9a7bd185cf994d0",
"01ca68ead4eddc8847a3a661cc6628e076bdd4b45047ece72245d094dd3b" },
{ NID_sect233k1,
"000000e49e182ac5d932be8b05fe340e8cb72df35647decd679a8c59b5d8fbfa",
"00000181b95a965abd16ec2430c26dd071984e854a967ff114ee7831bd314b2a",
"0000002f5d2a7e0877a4c99073732386e8d59734a23dd7f0df7fcd54d941e760",
"0000014798094680cbd32fb1ee9dcaa6b8739a556305235933fb27157d319e57",
"000001c855f0d453c1ffb5f668b32a8b3e309e0e8101bc39b6dbe7de214015e3",
"017a893b2e090780ff8daaf3588f9dfc0ac4dfe1f1e263697a9d1f398ab3" },
{ NID_sect233k1,
"000001598b2fdb5bf1a3951fb9ec016ecb4d28f66c2e9d13596786593585d719",
"000001ef65caf15795d14a0be89cac7c680323bc59803ba874cb2968672cb8a9",
"000000652a11f6c3117f1326fa6877405cec7331c4f146a97f74ab0c44de01b7",
"0000002cd6d4c1d2cc5e34205eadb94f4cfd35bb569da722c4d9b19b8d5cc2de",
"000000ea3004e5b0930df7f8bda314c8bc1145463eb60022cd2dcf6c0c824e50",
"0041fa5fdf495b885699249b7746334b76c59e1c917bfc1ae371b96941f4" },
{ NID_sect233k1,
"000001b6cff3b7fa215e378605c93f86f5cd3845f45fbde8be079dec29bc8862",
"00000166222efa5dba9e858c245dbb5da668239ab5ba728618fb85a90ddc760a",
"0000002ad5f71c6384af62689b35c24c4ddfb35acf8106cb0c19502c2ca184af",
"000000fe1b52408a712841bd62f0ee51307f26331d402bcc3a5ab0405d1c5e80",
"0000010a731a7d6a6a4f5b40b2eaa810c1902db27b28d297bc05f3714cacafc0",
"015f5adba59d1ee01696cecce4b63e78e68508303ee496ff5abcea25ad3b" },
{ NID_sect233k1,
"000000cf402aebc3e4247a9ab43da9755176a810e011f9fd977de1be2fd534fb",
"000001bac45fa42d605ad3479c7c43e724910716737953cc8504af14f331d34f",
"0000006f01cb54781cbda6d88deb59843ae0836b1af683efc75650be84f208a7",
"0000004d00a8f0820da9097fe50e8e7defdac29607dd4cb1dd881d4e61f1e78b",
"0000008a4a8e9c811b444367952752ab8c2a5198efb28fbedbf3fbd701a857a9",
"003d5c29b3753e89ce5064575393392b377ca657a0b73872c82165fc43ae" },
{ NID_sect233k1,
"000000f38ccccf08e5bdff3bb35f7e75bdced68d3791dcf7843ca88ff092136d",
"0000015ed7697a4b8c99d0147828f6c861ffc9cfb0f33dce9d14b0731e1da262",
"0000005dc1ba1839f5d1fea85ab3614c55a9c5fe600853c71a61983c7dc82de2",
"000000b6cb6ffa4e2eabcf7b987ebb520165a8ec9a22a6f9ffb100f38172a0fb",
"000000d39814e1852476e56e89ce8cdd64372840c01570a86940ace24bb9cf6a",
"007c01f906caa590898a09f46b6f5383658e7fee656aca0f111f22939960" },
{ NID_sect233k1,
"000001e328571df933acfd4c96f3c4bde71e9175cbcd62aeecd76384744a0f3f",
"0000019ff48aae0c252eda8d340b25c4dda01a2f21aaa35d39baf036696a1101",
"000000241e1df5587031dddae196891c28821cc7879ad35832ae718f6e792e66",
"000001c172cee2b76503eb4d90b39ddace825b23c32375cb68eaecd7348490a3",
"000000c246ef9c6e2fadac77c73ee9dd5adee828b7918417395b5997be1a0278",
"019eece7d3fafc9274d361c6fafd9efd9ee485cbacb3baaf6834feb4df6a" },
{ NID_sect233k1,
"000000f4aa7f9340a9da46c4f06728753a4adc5af53a4dcb467f70b4873da785",
"0000007f321e2bc4e29a68ac23c77cedd3bbcde0bf7b92a27ffa76496988981d",
"000000044ac55a913a8c7f7ed7fc5679f52f47cbb9730325be21b7993779d187",
"0000009794861017b3debeff302e425327fe269d78753b73bc1bfb3a77f716dc",
"00000002581a49c1269f5ec868dc6d7f5c2d8e749632d47ab6d9e68dbad985f0",
"01e4b7e89fb1b51179b8792f5cd581c3917e11246d3846f6344ee82eed66" },
{ NID_sect233k1,
"00000068d9e55e7a105b7bb44b21d669bb0ef657a91437ad84bf6d5853270c98",
"000000143c8bedb54db07df8f67083c59a0aa7cd8a0efa42f42fd62e442e0b62",
"0000002bc136778531089da5c2fab3caeec256c54b0b35fc2c65f7b8ee6161c3",
"000001fb258a31d166bef9cd664cd7b66cd8c186e7025c77f0bae731587e9ef6",
"00000060dfd4e475e92805d1935d0382dc1767067915cc00ed3b24f65382d21a",
"0145710c3ab0780ec233424d4e28b38d29f886965bbcac49fa300e1ed886" },
{ NID_sect233k1,
"00000099eb91cda98620103c3205d6489e68ad7e57d0a51dc502d6e30588f418",
"0000003fbf829929edd28e906f58f87abed6d6d177f436f0dd940dda25eaf188",
"0000000d56595471435d95fec37df622f18ee7dabb24379c82bbf714c5abc5e3",
"000001a52940a452aaf420b37b5f32c2c337306894a882feea7addadc01927ee",
"000000771b9f62a2a6fa892503225275490388b8bfc2df77df3e806bedba7d88",
"006941a2a531083563dd886b06c0860770a4724bb04a4ebb2afb1ba2636b" },
{ NID_sect233k1,
"000000dccaa22b43391dc052597ae3bd07c6e5f021f39e987756f6548171ee94",
"00000128efd49af3a6b32dc16797a978f0ad4ab0db66ababd6ad5672f4f812c9",
"00000019c8ab2b32f2ee93bf2ff6bc44378b60872bdaeb6ba56b514c8f388ba7",
"00000083530fa3df315a8740ac52f4d394b80c4a5f210baba0b6dc2205e12493",
"00000037b9d02ed43e9d41d0dbb8403b9021b4d2c1bd360ee53c31c27b492005",
"001d754ee5351d4582974734072abac23376e24348370934e7b864db0f52" },
{ NID_sect233k1,
"00000170917b33b37b8eaff2461e5f9eb8f0797b13aabd915a60706cd4f32cb6",
"0000007651e0742c0d83d4b68552e9b7abec3644ba9755cffe6d4e56943a6b9b",
"000000503160104d88a0c0f63956e7c3bba702963f9f1b53fc119a592eeea4f5",
"000001463c78e498abf34033ec3e1d973dc12509e2d234fb91403715e42f61f7",
"000000ade7abb98a0308886696353aad33c05bab5cf3c0d4e969cbf4c4ceec93",
"011346b83791e4bea7f6ba6b1265e5050895d84027c106f77353418f75d7" },
{ NID_sect233k1,
"000000d8ed318382b85c2525a02c22c67f5bf366335d94767eb5cb45739664c5",
"0000017d8fde7bbc568fdc802a3e3455f3cf35602df70684c8acdda165a02656",
"0000004547eaf9be1ce5af1386e311046ec83260b84a2ca91055f60668b946e0",
"000001504938c167680afb8b6d5858cfaa191c40196fc4e500c662c5346ecc90",
"00000137d1ba942228dae68c450b1a033a2c810a995971f01c24089e4a6fdcc5",
"00b4938ed1ed012a9a53892ed9949397cdc4e4a612d54dcf80cdb039f47b" },
{ NID_sect233k1,
"0000017f87f13f6dfee6081bb5cca532fe268c271d2756b31bdf643297cf695b",
"000000f3a746955e12dd0b71919edbf23b2322cab328dd09bdf87bcafdcd2884",
"00000042fbe554862f3595184a45510ca53df97c45175584b5d2de042723358e",
"00000131b8d61b9cfb0536c588214e45888ebe48391eeecb4d7fb5be8eff4acf",
"00000165da49557a0aa9d45dd378d5f899272cc697682276ae91d2c0b675c469",
"01b3d2578bde3066a253db5322c85cf9487ce77b67ece955e281b0d7d0e7" },
{ NID_sect283k1,
"03f075c24c35a9dc9952be6fd32b761dce63f4720a22408e3a14bbd097e012b5"
"694c22a0",
"0675825b40202e95be7dab5a826147e04b8c51a09b0034577c1f31f8c16a70c8"
"e1c85b89",
"015fde49b802542a52c70b23a0b1784e5f8780b56853f9a5f8c3a5266e8727dc"
"e97d4a17",
"0611edc045dbe43ecc4ef6b324cd51f70fe3d7ddf877ec68b798909c3c456175"
"6aa30e5f",
"00833b25511704af09b62d9f7cbac59814e75bbb9c735f55538491dbfa60c1e0"
"115efe42",
"0745552817b5d729310b7dbebae687648714a9ae695dad20ca1ab6111c3d0546"
"70f21132" },
{ NID_sect283k1,
"0799b430e92320ffeabf2d6cc87399e30c0aa84420ff8eba2309b99487b742d7"
"22e8b7a5",
"0217362801fd6d2d286e5cdf375cd0ae569b700005312e37e8e35b1592efb9b5"
"eaf47b3a",
"013b911f62f3aa884354634547ee622807d5d106020330ae2b9798c0c4cd0ead"
"b10ba948",
"078d2ecd4d902332b6b3c7bd4ba7d200fc34c45eda30998b6025ed47b1f4f8e6"
"8f328624",
"04d5e53647dddf2fccc8816dac8bc70c29807622cc95539a72aa3a9b230ca1d2"
"5ee7b516",
"02eb0c1ceb6179232e91cff91fc8a30553c6ed7e0a71deb1bda0a10735a84593"
"dd903636" },
{ NID_sect283k1,
"00ce47a743d48b86fefd6b5c02f2a97b2762a2fe57e0bdf85c1d6a29de8862c4"
"c99ed53a",
"0322e596069f916568ca248ced57efe90534af4a9f90a4f40f797e4529670317"
"26bf41d7",
"0177632b69e7edda3cf007307504343cc2162326f62017cbddf360a876dc93b8"
"1f04c58e",
"03815ab6480e4ad24a6628275ef2ee0ce7d58699239dbce23338842bc58c42cc"
"a94d2412",
"02de833cc664cac90d30fbeac603efbbce9276d4f16ab1c46e7e11c81a9aa9e2"
"5c82969a",
"04a9dd2cf5076814e5329c518c4f27b429dbe01d46682d476e7e78880de368b0"
"64236ba9" },
{ NID_sect283k1,
"0728975839b42c62036a7afffaddefc3024b7258407bed565caea939be33d16a"
"c94445c7",
"07712630790b05ae04d8d7d9f2365dae9ad24c4c61b3eb20c0a7987e6a4c4b0f"
"598c371f",
"003bfe9a1c985386e5ba2b31553a55151e78ddc38f07432b5c42a1cd2da278fd"
"0b68e047",
"01d9c3337da95ec6e5a4bff1cc92783989b66c9230107870d4a578699338e38e"
"b2d92eff",
"00cdaad7d0eb0f445aa763a5dfb8f38f55355777ce24f753b5ad3d3cbab125f4"
"91698d56",
"044e2cd2bc164d21cf4b9833c0aa62ed059282e62b82f4500aeb422d17e1f6e7"
"e8bbd500" },
{ NID_sect283k1,
"055672d73998451089e2b7c7104b42247dddd132d40ad087b588d6a385da64f5"
"a2f46838",
"02b4cb1581f9e2b378eb7a4f64f5a7d4320b2ca3d3474726f670c3883bb8da47"
"f3d745be",
"00d95af52a708e692d02677b21032f7aead6003f124e72013f37c06e0bbc20e3"
"532b3cea",
"06e487f91e73bdd344fb8bc8f4c1f476e727fb2671e9d6c8fbd775f1aaa24caf"
"2e9a36f5",
"0663e1cff8099757bb9ff1b87890283aa49cff0f7b12fe184ed2a428375d2796"
"cd81de91",
"04d4f04d2fcf1bcd8150eaded90e467d3d38f753b6fb54eed8f9d29cd3dcc7be"
"2c83de11" },
{ NID_sect283k1,
"02cc28a4cb76d147d98dfa677dca14e1771347b9681c65cdb540f22c907613fd"
"ccb0c8da",
"07d4065f990c8fc37d100ece38fbf574ce444dc37355e0702b80d1eb1bdd6709"
"97e8f271",
"00c733d9094032cc7aed6c54a8ced753eaf2a48882285a3b4c7e6021f26bece0"
"722840ad",
"026896b039d7068d98a326710ebb7a978bd47661154645ae30cd83d60535067e"
"05151ccb",
"00d83a263bdbd8c8abf0310bfbfc83917a86b0d8c4be0b155ab7b9e2c7056056"
"28bbcdd9",
"01c343540541604f68ddbd63c483760d824ded5c18be7e56e6d36a9ac6d25772"
"afb0a90a" },
{ NID_sect283k1,
"063880eb538c7275ecba4db53d9b68c287fb3778bef514974d1e7e31a9ae365a"
"2181415f",
"04af9f2cf92542e1ff8ff28f8e7c8e809584e243a4902949a765a284986c750b"
"1b06c89a",
"00db39d7536072dc3448cd7d2160e50c811f648358eb0db1d5428e81aa7a686b"
"7865adfd",
"03a721906ad13dc15c311fd4e552f3bc87b7d92ceeedbb0c316a952785ba4689"
"fc0ba270",
"029514f3873bbc3b9e217061f7a6261fdc6268685f9656f1d5eea472cc2db5a8"
"c162e6e9",
"05e38079815477b8a79096ce339c4a255f8b213be74715ea61ef7dd0c0b5f161"
"d9de7521" },
{ NID_sect283k1,
"05bfd2895a2e66366db7a83788c72bce48f79b5c9524a08ae273c78ceb39ae97"
"559d5ac3",
"04a2b0a55f80155a1a330fde6cb6d97eddb0a9dcb66c49b392904abe8b381f91"
"090dbb21",
"006649bfd641dabf1b9d499d4fb04beb099475d0aa15d5ef6848b734d2d41300"
"8b604308",
"008f6576d62affc71836d19adbbc3d504210f12efb61c42057824515290c502f"
"2e09b6d8",
"0021643be87ae6e549b0d5fbb558c1303d14b1ccd77703ec74f9602f35ca8d7a"
"5139bce7",
"0531ccf51d1096982f7c2ec513a92bf51c7ac5069cb15c5e2a053ceae7e55509"
"08a19101" },
{ NID_sect283k1,
"063547f7570bd6959733c03d2e6c4c88971f314adcf28bc851dc52ed4e8c1a4e"
"a06f8702",
"0122d3773b0934e900fba7ebfe1ad5ed5bec0fb1a9ddcf4eeb61cbed04007431"
"3c0b3170",
"0081860a653d6d94446d7766164ff92c6c5c1545c735304b3ad4d5178c8b14d0"
"181e9471",
"06b68815bb83691d16749c4be16125e2a6d6dae94252739ba7bf0db0d50198ea"
"2fe43ddf",
"039e0d93018a46125620f6ffaca5a0668343c57025a60c31a9d6e51191cab338"
"993b46b5",
"06ffe79d2b7664ee2d8303ffe0ceca8c49a581fcdb49c4af6a060ff204eea74f"
"4cf39cef" },
{ NID_sect283k1,
"009047f7d77397db70e39fe9e4ba9d97a995a7ee066ecf538179e937ac86cacd"
"ac510950",
"007cd875167f06a2fb9a819e2cbdacefc16cae0eef2cbb0b2d49beae109db753"
"c9506170",
"002243e8919bd7a97cef0e9cde63c76d4e107150294fcf8dd7676451ca3bfa5c"
"5edb964c",
"03e439e3ebdfa7a23a9deb09de141905c653c4f202edf2cf5f09faef88ba3113"
"701e49f0",
"071d071b86ed0f468fc6019de23fe4ba2cb3b50032be35e92d2e5af40de706ab"
"524e82ab",
"0311c430db78b6203e27b52988e1e9dae890c655dac4acefa7ee9612bec32e3e"
"5f52be55" },
{ NID_sect283k1,
"04bdec19300c8afdeed86499d2703922df57b2ffec37e45c03a5e2909de3c333"
"bd06a5e1",
"01aa4f40844f2413f1fcbded003b1d15c9f1df7548de2a2bbf71b516657ad8d8"
"c77cf72d",
"00512a42841e1227fc9fed51c2268731684136f225cfbf45648987e2453a7186"
"f6a7edef",
"022f76e5ab714fdf78571e84c2b6ea3a17f12999be483bc67e1b843d209bdfec"
"0347a43e",
"02eec1fc0e85f330c53dad7bff4862d8afff8aa14f94756e95b8f01fd7eeb8fc"
"54527787",
"0701d92ed8687138014b4379f1c34677e1744f6ae8c89958a5962f14408d587b"
"95472db3" },
{ NID_sect283k1,
"0611f53af4b488990e7a52e5c73856a1e74279bb0f36d3ab1989b2ccd99391b6"
"c6b3a13d",
"054ea95a234f65897195bc97b03fa6d246ea5ab5f41da22c08ed817aa7c04adf"
"372982b3",
"002a8af497d1a3dac0732a393dedf75394a3f519ce07faed3f77dc0e669f3a1b"
"1c6ddadb",
"0571f0c87f88888ec0738961834021765cc4f5c8db2b1f9ea9b8fe9847f89643"
"49fdc44f",
"04ef7c8044a609694746ccaafe87fc7f9f1a78d00f8354f5da7ee2f5da7235ac"
"1ad4b57c",
"04f2301ed85a5c91c31a7fd125854904340a55e34976a20743bd33d95e476450"
"f301ee62" },
{ NID_sect283k1,
"012706ec0a0e76425d8ab4e0d55930a4416e4dd0a1af6d97987252988da0ac96"
"27577cbe",
"04215e8715129cc76301791701dc5fe1abcd672b6aa19ba4c7e532ee7a913eea"
"60dbc9d0",
"01de9fba4ab24d06e74ae5ad36ae195c2360c728eb38c50ef533329e70c5ae19"
"f489b6d5",
"048d61e0b9b8064bcca8ce40d4f9e68b23684137726a44ea75c8f2f8850f0333"
"fbe985e6",
"05fcaba38d51e2112b6b9f34e6779c10c0c559c3ecd156022966cf92a8c7f650"
"20a79ebd",
"0643900f337ed362815f181e0628ed5184dad3e66a1f030e947f116696312d83"
"5f7f6e7b" },
{ NID_sect283k1,
"05bb20bea4fd85d0162689c550054001409b6c712d356a52f793d78aa2d8261a"
"43c5b6de",
"031be5cafc8aaef19b861503413a7b73b60b37b0180493d82e9426f47b658739"
"3d08de08",
"015d3a222d5709cb339d93cd29650664f39bf3201c5d1e86d3aef8f795b9fddf"
"47d8c4a8",
"01e2b88de3772b09c63d036e0dbba435246987497b6283dab8ccf1002486de07"
"30277b43",
"03ce182b7f0cea21a06a1d4de8722cbfc59b9d9d79bc760b9d17d85671561aea"
"add54941",
"063b1a3db331f91abd0af837db9d5f040620d1ddd7fccf8b58e0df43698351ea"
"1942548e" },
{ NID_sect283k1,
"010a3ca2435b135ffea08792b7f19b4ee181207c29be1ce1fdeacdb69a669f9c"
"dde9181a",
"024908274b1e98c6d197ed2783c3c953c1b3b34fa43a8b2f5742584e37fea407"
"269b43bf",
"0098c570666792efda65fc9e7909931158dfd4477be93332e493d69866b6602c"
"4951de6f",
"04dc6774fe46ab0ed2768d379e7564a37c6bb1dd1bfc555727ad94c20f4732ca"
"bf2a2c82",
"06c6cf0f421f91fca22b4871216a9f1fe3878f07914e96ae94ac770b6762f9dc"
"e08ffa2d",
"0516da1d64bc4b25ce4763e6438257d62fb1ffdeae16d68701d63b603ad53e85"
"87927669" },
{ NID_sect283k1,
"053a0dd6135e43a114e5000aec40ba2709b3a613730f1cc2006b446935e237bf"
"ccc394d8",
"03b66ce6cf01507d462eeefff6211bd4c56070116c6907468f7c76fe01140bf0"
"d5fb7b79",
"00f4b6db4a87cdd30029cc3be89e40b9bcb014d010a91a252c56cb28671f354a"
"804cb4d8",
"066ddf04831fd1c72bc48b709061c1aeaaad19c9da3d8c1506fa775d4f5a5412"
"eee0286d",
"03aa1d13146ff192792b74a5c64ad3150fae344fa830e0f44733d867f4e0ae05"
"3526c62b",
"049c68c333b96705eee4a3def0d568b0d4faf24df2fc2f1bf40da0af0946240c"
"38e97f74" },
{ NID_sect283k1,
"06d4a6f3e87b6d8c49cbe517a975d2ab8c6339135596d6b30cc65cc80c128450"
"8f49789b",
"02963b356f2434ec249bcb6589ede4de36cecd3450e6f5e477bfcdc29ada4aef"
"0f45ac53",
"01ab82c5a62ae47ecbccf666cc3323b35128c52d17be11baf3bdb56006e5d568"
"baad8bbc",
"00a04ad7a583666a40437f968b02cac7946745b4ca949021c5443deb70183f88"
"e1778fe0",
"02bb591c32f0db3430342f0e37c45449c293c54f6b7df6f797c0992c2829858b"
"680f2bdc",
"04dd44c1a30edac2e39a5bc9902625880a18516385c90a9cc6b94c4f111e0260"
"863ccab2" },
{ NID_sect283k1,
"076452e19d7a10b885123d503f5d0433e163df134fffb8558f8ac26cfb30629f"
"8cfb093e",
"06b3a24b2a4b077770d396bbf154af41eee3503573a6de9afe0f6d18b02fc976"
"1ca1643d",
"001254af1791cc75694ce590bb518a770a750446171a30edd6c0382a17e6880a"
"1aea5b81",
"02b766c993b398d2426a7a0a49e9d001079d0fc32197181c56eac1805e4f87c9"
"df055dea",
"036e7bbd3be9139d4d43a8655ef7d51a062d9947d1a48010ef1ea10eedeb27f0"
"d1ffe765",
"0049c165339e9aeb2b516684b442921f1fef3091cf781e03fb3f56e93af1f3d6"
"e500c81f" },
{ NID_sect283k1,
"018e0bb7516d2c42e9dd96caaff5f20bfddf3e8623fc947d4d70491536790b87"
"41cdd372",
"032c0fffbda2fa863cb9d15c36545020d5bb24d930daf2fea4555f7c24d6aefb"
"b2c01d92",
"012017b9a0599fbf13cee10850a8f8bd06ccc00bd29ac6779f1bd93346b22c98"
"327e0fa7",
"0421c62dcab54ba800eafac232fc730ce70f6d5cc53ff53d371269cf046daeaf"
"451b33e7",
"03d635f55233da3c490a959c6e63a94fcdbe471fbfca19d2c5a3fd12b04db380"
"c3c895cc",
"0645d7f4c5479baff5bc0cba654a3dcfda56c0e9d19f50f9d8d8c6357c09a140"
"effbf223" },
{ NID_sect283k1,
"024abb155e49124282ea32e5b544621ae9b513aa0476da3bddb75260d5f5fa2e"
"7b898987",
"01bdfb0a079a55bcfce1ca8bce3019cbcae6164003384166ebbb0bb733539565"
"adc446f3",
"004f197c85432cb42a1777249ae411ef4bb2657ba4bad35ae538635a151c8d6a"
"564f9cca",
"040c88924d5a24a853fae408aea5b3bc827d7315fbb58e6ea1f6a65677dd4c4d"
"304bd75f",
"054b82869ada4433f7208f8570f24f06cb64046e8ac086ac57d3707fc882c635"
"2733dff6",
"028017c2a0240fd746ee72a0bcae1e53e05b7af254298094c381e735523854ea"
"5fdd4f5c" },
{ NID_sect283k1,
"07527512bc934938cc5240ce70ef65222db85c13c961c1f31f914205067d64b1"
"a4c85314",
"02aabdb81ffed2c001acbb4d0b7be539304e32e431e02df8b192ad74ed1b4b06"
"06bfc90b",
"014e893483d1d8b7621cf48bd24bc8a1b95bb40a08c16c32874a652b59a22521"
"39428dac",
"01574e17ce26311c40abf3243f4889a2eae74a8341aa7838551056f4395b8f02"
"bdc327be",
"0086e59f985348f3f8d7953800b1d75e141521249c43fe0616913db5d1d4bd54"
"00abce55",
"02603c00998deba52db12814b1f77b2120cbc1dca59009c0d6ea40dcbcabca32"
"c50380d8" },
{ NID_sect283k1,
"07ec29da2f304ceba8d5e249eb6054a4e4f59534ee59d25c1dc0e12cc38f768b"
"83daffee",
"0112c7d4a37fec842271a0a822d37637e6ed55190713001aefe11b06f7e1d34e"
"00fcdecb",
"01eb6f6c91a880a5462185c6a700e8637b8f447d09d1b251460fe57f1bf462ef"
"ddddaec0",
"031b3026104388374cfb7c7b4ef64211a47e20b9561a3bbca53516040b7bda28"
"37309454",
"024f8aeb23a35e1c22225967c7911868c84efdd873dbbccbc763ead67e72a232"
"4aa4c6f2",
"026a719bff31da4b4ebaed7bd043064f9c3930b5774c4a99809332c808aacba4"
"b9e3733a" },
{ NID_sect283k1,
"061ef59389edf8f8273a662a4195411e9448bb1b77fb0800be525eb5a6a03b19"
"665719a9",
"029686f8477fb5c769efb082cb3f1a0c79db55cb264e2112c0e779e7b558f700"
"45816a10",
"0147be4e38667e32a6a61ab980ced92e42695925b113c694a7960aedea2e1d57"
"1a42d3de",
"06f599f0c149457a32f1a2ffabd4dff916259382912b6402b50cdf5c235fdd1b"
"790e5eaf",
"04ccf1d8a4bfeb77ff3290e65ac601ee5b97fc1b1869a2eb9f0b76277e8066c0"
"86776c40",
"048c48c993040619536f45482c494a39b32e75fe69e478ba06e376228b79eb83"
"d3ff9168" },
{ NID_sect283k1,
"079d5760ee6ef978518bbce536b031c655a8acf5604497ba43de0beb6877a547"
"c3edd458",
"0421b3051dd36396d20ffcd7cf34fca022516dd4bffac73fc995ae9ea814ce0e"
"4027f7c6",
"01e1900be61adb7e55559d99a0b7d9354456f5151e2fd7b83c005b10b16004eb"
"e876c068",
"042ecc99ff48b53f6619b484af8fa59b234a981c9c3e9107bbd1cdaacce81885"
"d06e02a9",
"0183da0d7fee7f3e70e117f0e8a4a742cad10aefcdc4aab9bb31458237686afb"
"4facf3a9",
"05d85b16bb2a0d32c73d1402838bdfa512d744fa88c74d3d90cf714c2480e033"
"63d5c6ec" },
{ NID_sect283k1,
"024784d3d3d5e8021ffed8a2709a9f54d5395d98fa442a655a05dd94262b6035"
"96f8bff1",
"03e8e39e08cce55e1bed2dfe0d2f8c141b06401dba037ecb384744930c8178d1"
"46416324",
"0077e41ab2d09c34c588abc76d4312602e71f60019027b986e0ded372535c2b6"
"a933a533",
"02923323f170074222d3a6a287adafd3d1fe12715d57b91b1ff476a2b4fcc385"
"de261ecc",
"04cc498d67c6267cc7c4c2d40a56cdc2a6e715edd8b2a9614eeb33d0b6fd162c"
"bb85a714",
"066abb838b5f12b6fc15ceb745600686bc2d5773e53469c2ee920cfba5459a1c"
"ab20d153" },
{ NID_sect409k1,
"0177f736f6116320cafbb5b4dec202d40508182fe011189b81e1f3998f540860"
"7a46bb150ac47bcaaafde47b8a7b72f478bc22d2",
"01df4ef4b37e0124e55b67f3586de24a88a6c5d98854007d4b0c4b4ccd68d51f"
"afa7638bbe555d60b74def217c6a63c5b4068fb7",
"00084b711e3c60822e70fa6828b5abfb0e448888b35b0c8bb09f806616dc1ecf"
"22dd86237d937c1bfde62b75ae655953fc6b2f7e",
"0068a3f8b12e02d10e2f52095526bc4048b8f6ac3a84531772870789938f1aef"
"f813e05e509ea9587d2b7e4aa14344bac3ec46f0",
"00d1ceb40c7d5f3297e2955f0f3eb1422b3e6bbbfbf7eb518b9c17ae8d40feb8"
"4aaf36f5e5bd96075b2b4dbe538ac011962ac705",
"0176bc5c4036ce5125493a58dd265f04d190f028366f7799f70aedf29ac67b5b"
"37c37238593377a47944f5b639f43856dbd560ec" },
{ NID_sect409k1,
"010c4c68a9f1a62a326556b6d977a79cd9c4476c05b1add4a2cfd3068249a3c3"
"923822428d352c5d74e5d64acceedbdaa6efbe4c",
"00866ae940dd31b5e6e3f20b3b4d87a6a02c78173c80aa510a6edff852c629e6"
"064df5d7c600fd98e58e8e8c662bb4b96c8ba905",
"0065188bb7796e451f44727a1a0674440dd33d258ad2fdc7b98faf64b11e7e8c"
"e5e8c21e799f1ff2fd29d4c94aa158962068a59f",
"0032c5768452f3c1f3bc54879379ad420891267742b37fb096ee7b8c21ceed00"
"41e9470cec3bedcb799e90bdbb31192083ff0344",
"00f9c6122927fb824246d1dc1ce0fde71a6849a82d41065da1d85256a9b1979b"
"f7f286366fc8b324893ebe34e59c046007399414",
"00575d9e7f70a4a1c5c807b6b5d6b7330bdd764db2aa60f3bfe497e6bfe90f03"
"8fb4f6acf7ac06efc3d157c3dc907b2ae093c6a2" },
{ NID_sect409k1,
"01e4d580d5e9ad81671c6cd662d5569bafe4d75aa4f449aed56bd800619520c9"
"f32c4e230c4d91b1c411f9086d5291ba137014a2",
"000c8ffb42392ff397bbd467972f3ed251d5a079965da0b1d2a3cc16c31d255d"
"ce9886937b2dc941eab0d8be8bbcd15aa6ed96d6",
"006cb17c3fc21ab48e5c3717c791118d4761e2c51986bf147942554dc5a18bf9"
"bb6c67bdbba908a1e8ba8e7790f59a397134f683",
"002b890418afc5797c9746a44ca059367ae0663bcf058156860c613ee05e11da"
"3f2f799c70a68fe72fd5dac2469daa18107029de",
"01356904b197bf9e0657f4349d252bbb375c66206fc0d8312599bdbefee8608e"
"c948dce486807baa535ed06adac9c797634711ab",
"00ce87aa5e7700384df59d3f1075d282c1aa511391c42ef609b8de1264eca8f7"
"737df91565c73ee884ea882d47c56d979141f0f2" },
{ NID_sect409k1,
"00b7d19354cadcc94708267aed8b23e484e32a03814b026a800f5ba01e9204c4"
"3052e4d47c6fcd92329654e0e9015b012f79344a",
"017995c15796c5ae93e0a207a2707004fbb1a49a0d47fd404f12d57849d8397c"
"d4d2c6d2b4b90f864403d4acd16a32b7ff4877b4",
"0011d43bc08da9ce5defc94b4ef90d9324de080347ff4df86645d325603a2dff"
"d28ecaf0775ec53caf5a554eaf8b68487df88654",
"01257b6abd470d294b59ddaedacd545dcf43808af890f576288803342fc61eb3"
"96f560af74342e10bb94d224c24d8e5900e5b972",
"01dccad97ecef4387a1cf512b16dd5bc7ab615fbc5087ac19d5fc2762f615b49"
"04ea39343bbb185db64a19f7f70ecf0d557b15e8",
"00691dd6b5177702d6a0b1f8b07f3b018478680de7ee079272ff75659335c96a"
"fcea7650caa01f996aa37946b78e14a83e579fb4" },
{ NID_sect409k1,
"00f2a11ccd3a53c95ea98f3144fb77d4a684f9a1f423eb81e3a8bfbe22b680f2"
"1870f58caeb6946c6b3b873699cffd314063f408",
"00fdf26eede6cba7248240720906ce076cc4322d18bc7683d2240ba68476ce79"
"022780b2fa54e0f7c76528b77fa631fe5abb5b95",
"000d6b259656d526777dedb5246a192f0c05c7270a3b4e64a9d6c877cd06d296"
"2a1ac84ec2d89765f967f6044f2dfa56903107f3",
"0193afa13bd1e081cee5df1286fe44a293b7d1b10c290a5f2ae7be2d02736009"
"a26d83aaaa9017a8c8bf60efa15fcead07767d48",
"01d02fd66a7806c4c8445fa615254ff32bb9c1d85a3904f939c1061e250d3eb6"
"413130a2a5570994795310e96dc3aff3b8218ad3",
"0136f5c04cf9a56db24ad99bd286feb800aea38d44f819be1c2a9dba15c635c4"
"e122893570233a4c5754a41499eafa39a35aa57e" },
{ NID_sect409k1,
"0117449fbea6b2d5f4e8e4d39a7228424cf06f456bf3ae39bc1fb2a99e4183b7"
"16e194fc507465664d009d5bcee3a426ba932c10",
"01146d32b70f09e65fcf69eb9ae66162d10bd04369de8e8187fa9c3d1b5dda26"
"f10b469cd4925ca37e0994415757e6895e588145",
"004bf7351b195875d01f6306ca127db8a1a5f597719c0d10e1d68f5d4855bf07"
"605790691fcd0d8b5db137d3fc2679de75a06781",
"01d386645aaa48e2fd0950e6a9ace9dff62c8f5e94cdba45bd73c6be6bf7b763"
"a2c9a807846312da3ab821c049ac0861f82337f0",
"002a6436ef8a1261aecc38c821da774a391fdcc7750c9437d9dfe64c82335081"
"3999f0fd4f07f1d6d98074098612bc52044249d4",
"004f684f9d559d16485f0023bf012006265ed81f06fbc1441334a559e5500a3f"
"77603565013694023e0d8f44fd12dcf69eb8d654" },
{ NID_sect409k1,
"0119980f11149dee5e2c2d00561d3c26a42a5a44e874765ddda4d818ea704edb"
"ba23abed5e08be92d655d79e55c5bc54787b4dd4",
"01366b3dda3e9879c4481ddc367e51c1c0541945964636d5021687c285c47d40"
"e79ff7f0bb56a93ac560be8dcb970f58b23b10a7",
"0069da659010345c6900fdecb31df9babedbe4253398290b34012fb134bc5914"
"7572e62a60f5cacced87b0f8d1ff7c049dfe9692",
"0038687019f7c219ddd9567b20f5ea1e8a50451dd40bf5b65f7b2e133de6f36e"
"4a3f8fa2f977efe920f845d176c8a57023cc55c2",
"0149397fbc42bacf85c59e04535df1d52715761eea997d4ff87204866cdc3d4a"
"54c2425ad214a7a0dd592f4a991ab768c8f404be",
"00137894f637460a63576824536944cddb42dfe63169c84040a0345ad7516ec4"
"f1ad00bb4de20ea6ea43824b9b0f74dfa6881cfc" },
{ NID_sect409k1,
"01fa39b5d3375d43247ac9500061ebff7a0c15b8c5dfe9c751784386c981860d"
"e6e1b9584da0f42119417f32338290910a9a259e",
"002bdecd502ba64a6f21d08fa4250389d4270324456e9441657495c72ad760fb"
"348325f89b7a5404a2c21c2aa07711bcf5f30412",
"0006dfdab3ca1b2a2821cefdb5872bb95f023161ae4e2d549d0fb1f382563413"
"584491657db101c323514832c363f636a9e69e83",
"003e9a9b5f282066e233870dcb00c4aed2d73a331f79d49c8d5c2d93908b0ef5"
"e72b748814d1b8840642d75b7a9a55301b1e7c82",
"01085f57691e04afac6e884e2fdbd8df802f4d435bce611231ab3274761ead5e"
"2e6a344a53f33c0fa156e3132062f72bcda3fc0c",
"00f03b0b43a351311689eb1d3fc457013f294a7d02ad850c72e4ff9b64ce68a4"
"7beb49bc5bcbdc828534f8c8a5e13de5fe522eb0" },
{ NID_sect409k1,
"01b255d5bb75d25970301de9e0e3959a12205d511f8e64f042a01c950db471b1"
"d6d5847f75669eeb0bf187f1559db3b22aeec096",
"017e590cfa855349136198c2ddd8a5210882473c9dd591c02e202ca0404bbc9f"
"6391d73ae011dac9965155d2650139fe2e54ec67",
"0029b2fcb308596a975c5b4cd1e75267c5424e00774114ec2051a571b2997661"
"89fad24e92f96e3d527736ea480367bdbdd0530e",
"014c757399be201e08afd8b4a671e7d3b6d7f8844498ab592e1bf69315347ce8"
"2dbd785d45922660d4d0d27fa2b0ac62e707fcec",
"0098f0773d3efe9c290a992eca05875d3463f0736b2dfef4affd9ff00f96ade5"
"3399917dea074c798fc535738f0c5689a2447f86",
"018f55b81f15f862aed042f37433050ac61718c9939d432b2a20e12d647f9975"
"3b8dd5127cf8963247fe7e1d5ade1442229bc646" },
{ NID_sect409k1,
"00ecf7064f528fadae380cb382984811047a0d7dd9a8de8e76f8178aa60069e7"
"7a948acfa74d2c77a76851659a98197054da8d44",
"00b98e13497f776072711c42c18dbfc8eb8c8523ff633af988a1f242ed3c3c56"
"5d18cf224f8751f2942e360ba16e0f5830952919",
"001b98015c0202ea16417971a37304250839bd6a6e5d83497f7f93f0f7472a21"
"fce4be5be776e90959dbc41a0e85ed225837e8d5",
"01fec09f94571614e7cd8e958ebcd7a2fcd8c248d408cdba359630545c313839"
"22774d3b24e20591d8b41e954e16654fe85cbaca",
"0031e0eb1dd1ce467a8b78d10d25b9de92cfdc2773831e6e28a152d02ae2a5a5"
"10994cc010462254441ea41121c0677fb4178bda",
"002b560d1949297dc7e1bbe8ce49a595762924afcf0271e9c493c18ad5cbfcea"
"5f3900c7b793ae5dd44f48884b0bc3b52c66e05a" },
{ NID_sect409k1,
"004e05c34dac44e6e1b08cdfae6357c20db7a544dc253dff1c23d4dba871b967"
"81b6a61638d73865dafe0a9443c3ec328857d23e",
"01226c427778bb224624cd215493d7a4f32a4f141979236409505d8cf58d81df"
"d3c793e59543a780314f3cd8ee17664dc2e4639e",
"00473bcecb137711e5e89763a40f77dbe2ea8c2509d209064e39cf905afaa901"
"085f8e795c9b8017c9a5d0a1b96812c124a3ffbf",
"01c8e9adc4816e6606ffff5e1a7d48a7854c35aaf055d31833f0cabde8bbc4d2"
"458e3cd3c82a4af80745f595b3ba12f8b5c0ce90",
"00fc43f193b5589aee62985735e3628374dd45a86a61baaf78c21fa6e787856e"
"a6b8b88316540571825865ce6b8578add5faa69f",
"000b43cb539bb4bb42f195ffdbcdeb482b69301c0155a840cd381f55c465a8e5"
"7ec51d6555871537b56bf84a1544cae2b2b8eb38" },
{ NID_sect409k1,
"016f6960fd2357d2f70b5f778be5e0aa71556b9d2f4cceb14f7812da858ab872"
"818b4610d41a8f66200b4343422227d9fddf712e",
"00aaf592a725e7738388896b9be9f78c1c3d6972b9f99034d02cc0f9776a9f6c"
"2f9b7d501f75be18599b088c4c5881c66146e5b9",
"0020dddd67134a418378baa0ddfc9111c0a2ed492b289569dd0061bf1226d235"
"bdaa5203d3efa2bd0141d2ace27c3ae8e6daf11f",
"0167d577b2a43cc1a7d88a6be883c28dbf48c3e1fbf21ad83e7a7e3d753fb0b6"
"d3f80cd1376fd98be260f494757cdc063256d5b2",
"015ed7003b7d2bd5e0359303660add090049039cf7df396989ea18c702f704c4"
"5cf6fde7ad072d31253d1d5295e9c5d1d5c62c3b",
"0113dd2cf8732ceb8a893e149f13d52026e5d829322d0f1233a624fd6b74d56e"
"7e6374d70942a25152ce5073831660333fb3e070" },
{ NID_sect409k1,
"00f549c47dc8e92fecd38b5750895880e449f1e31abe0bb1eacc84298f836108"
"e5a308ccb9578dcbd4be6177752eb231e78f011c",
"0093663ec3fcb54d676897bfc95db5e54ad6eea1ec7b46ca4bf3d2535839f101"
"cb3e6d5f11b6a36bf40363c31c9f88137862674f",
"00607a5a6532177b52f23492717dd0a7b2af98e04884f77075e4604410c5044a"
"08461ecf37c4efa3edc2cb667c84b86415936b70",
"000a5677ac6c00d2646054dbebfc536db0a9b351a2408a73e083ad62d182fb87"
"cb80322c539553ecdbc213ce84c66ddf8dc1d234",
"01327a0a3769240fda45f94bb07361c74aa8c8d119414a7b5666e25a3ab68819"
"75396325a77f541a1ba268012a82c5110d2a49e2",
"00c8e62ac25c11e86b98642e4ec7adde9d9436f9337369fb065abc9ea784f90b"
"8b8bebae35da92185486191dd9f49370b1148ce6" },
{ NID_sect409k1,
"00411e5d4c96e35de9b541da5fac691336462c882d8e8ce4d6eb7121417e7095"
"0c4d9502f64565d5a6cfa735c90eef83c7b861e2",
"0096b904e37ca1c2db59a54615627e1c3356160fe175284aadc3b2fa06ba0b30"
"aaa07c84e64e48652e5feb303595066e0f8468f7",
"0034da9a453711f04a0b1ea1b9af701e0dc3a55cdd585e43e3ecf41e934ecaf8"
"80ff1614dce5cc992a69addfc408dae1b09b8d05",
"01f7bff435547a89516d017d1bdac4cda36041a0d3dfd03258562b2e28f40cd6"
"4f6ae2b70457773f9675cffc40c021e4702b08d6",
"0013c59a72f0c83f5bb90a0bfee798952fb91ee329c98c4b5914f445ae7c8483"
"767052b5f529974621545ddcd6377f5e387d573c",
"012505746f1a40ef75f950595211ce04f87f1daffffdf8c12600a9e2994c8c1d"
"8b19c0e0559adf9a94762cb983569de6d0d8baca" },
{ NID_sect409k1,
"000fa8243f000a3398808a1f88ffc5a342968fee5c7b26a9e1ffa26efa885e74"
"e1c562027d95db08cc15bd25a3fc11ab4dc13ca2",
"00fed687c7197ff1aeb980e72a3a7c318142052c2389b0866db3b87e5c8025e7"
"9bb4f4f996fa6352ab9cb20172ef78d6ffca906f",
"003141afbba8b4d9f0cbe8297f365873196739465e3e20a89af9fdf8b01d195a"
"a1052e6176b5fad856136b6b320eebfc08c1cd01",
"01805ffc576e8a45f06297b2335d03abc8adfd15ad37e76d80d3b4180d5f72ef"
"c90f3f2b036acd817f40fd49064aa25ea383c82e",
"01f22da6b50ac5628943f05b141493cacc0f02bcdf3bffdb43582343b6861576"
"1a180bd7d1ab1ddc15f5374a8f665d13b4b91272",
"019a71ab576546e2351aa92b6075e8229813e6a2cb3647147b192b4597f12172"
"23e7197d846c0d65ea0d4aa4c503bd000ba312ba" },
{ NID_sect409k1,
"00be7d58043263ab2f42252d41b582d862c2b243ce18576081bd6edd2f63f016"
"4f365cae67268d227f3944677e1c146af864b8ae",
"01a4bcbc6416d86597a148ca4d610ee656a00026ce6047bd9fbd40d89530196a"
"4693ae595d69956503b9d2ab4aabe7c958a14c69",
"004e517796cac9d7c75316eb5e68963fe6324781fab986e940200e711ddbf988"
"2d99a620a976352e2496748cfb61dccbf6d659cc",
"0056a452fb1d558079c3e91bf22f86884ca89788806fe7d6d6ca40b5485079d7"
"7dc43e466a71259792c65ff6ab7204066c0e67a8",
"01f29b723d9f7d4de6ccc2f9708079c5d30ae5d960e62a7c4f6dc98bfc95b4f5"
"31f197c39486705432594203c25147156dfd5b5c",
"014f4b7ea93c9dd846d2228c2b6a8dfe616057232b7af845a570cb6cacf9feef"
"2d8ef4fafb285b38e63cce0a09b4d82dbe43a390" },
{ NID_sect409k1,
"011fea58d9e36cf8ed4ef3b42f77ccea93bf542ac92141dc2c094061985f3df7"
"86d192a57bee072550b302583f0f9428301b1b76",
"01b3dcc1b8a3545264427386329eb81fe992654040694781c0d8b27c1e49442b"
"99bab93ef9666fea14d4843ee4bc5b045ac50c11",
"001c80b64d51e8025699e7be2c4b983cfa4b7e91b112e2eca5f9d0cb7e3d4f85"
"aff7b33a921eaa124cb7002eab62973d65e16bc9",
"01fd0e4eafb26c08c9f8e747d4991f468c76b4864166e37642b583db285a4bc4"
"c33979917d9129a91cb0a75c1aee7cd4fbab73ce",
"00468efabcf448fcce821f3de81e994d79a7d99ea989ac81fa135f7ac88b154c"
"767909c681f7e48c00b2e66bbaeb8f8688f44672",
"001fe2ed30ad4143c5eeb0b7622e6aa49e4e4d51c1ddc467b3fc54215dae931b"
"e0b6b6443e716895acb6570cdc21fcbdae46e5d6" },
{ NID_sect409k1,
"00ca809340bd13354b6071d073e65b9b0d2bac82e22abfcac7e70afd9d224852"
"f0e212976e5ec823eb8950e02bc759ecf56f79a8",
"0031281e8976401aab58fa8eaf8636feb013170bcab5781be0a28d27339e9470"
"e166c7f685f2ea9143310dca1b3ab8e1c8e60592",
"0043c96c32cf648b036112421adbaa925cd54175abad39e5681bfc9eb4b1b649"
"aec1c876ec1ec4610f1b3b06514a48e6ea7a4a25",
"00de181e81b9e7776d474694a2d124d0b876d9548f20ee3386304945d9131f90"
"457d9b938df098b035bedaaf80ed6d979404fc70",
"0181a3516dbea9da97d6ececdb10f96d54469d273ab366e89a40fdcedcf1bda8"
"37d5c14bd10c0b6a2a9c8a47810125c764dd35ef",
"01610efb48fd22261921f7484ed6382fceb6bdf28f3bc2340a175b7971b93ed5"
"ff357ed55e5307bbf42e40a5b3fabdaed0ce19a2" },
{ NID_sect409k1,
"0074795b0a9ca070491fb54a3bc249981defbec037e4040f76656428b1538b97"
"8503f81f80ad9ef97c5e127ba51ec040584b9a20",
"003ece27f3daefe7bdffdfa727b2af95af8591af946cddfe37e85643b8d179ca"
"8b9529106f9c5f3a95a8819225f9d7d4a730fd22",
"003636854b8ee0254bb2d0ebedc720b66b20129a21f1a4fe39118cfdd4d137db"
"e5e570ebe2c48a7f9ac21cff3e5adf47434697db",
"01efc0cd1a86ce7544f25f44e63a0913c11fd6b08bc09ad8cd82f3af7e32a7a7"
"ecacd56e25526589313879d4a7fd4382d4114e4a",
"005a34ef7403599c2f83f3e83299524893f2418ff95d6c2fdc0a3db970e62fdd"
"cf4cda182aa78b54fd8c2e818fb1ee2dd2776763",
"008d990982aac8d5371b867de21e09064fef30e73321337dc24f19ad5ddb6c4a"
"d217136b7c61e360a73fa7571d526c8f514a06d4" },
{ NID_sect409k1,
"011eb64ed4249e1195b2d1307a35a514d66d29ba6f9044f9c02b4b2d3cb3e3d4"
"c0cdc5489cddfb96226c9ce3e36fb8ff2eef208c",
"0099880b0d0d43c5c579ad77ddae68f2c917f4b062ea8d777b9cdf465cbb5910"
"7e70992714e8cbfac76296d5ede99c48d38a8973",
"004998a062a32170bb358954d2c2496da886200827fa13566836ae26e38d5192"
"6ca3d202589f7bfa27ea22d399973db6f9fde9f4",
"00f71590b04290b5f3cd9ba0e394a3be5a1514f45e53497f6cdedbf839728e02"
"88135d769e4b28932c875823fe256e891997c476",
"009d16ba726a5a9e09103bc94a09d8079ac8edf23410c8469f79f55f3355cfb3"
"ad703624ec6d75eceae3881da20903c71de1f5ac",
"0155dc98729c8c1bc65eb8a3ec09135f46bfa313bf56aa3169e312db8991abda"
"338f8ac7a75bce42884068efb7e6e625939d2b88" },
{ NID_sect409k1,
"00a15e96a776eadb8f8a0b61360335cb5017d7d97116489341e995157f1adf17"
"8e5628bad3e830bee54433119164886db5c34654",
"00551ca5605e4ae0534534a0ab343d039a3ba7a1cce832c4d65e26bae7ab8e5f"
"9c74b3d421a528e559778ab27b59aae1a916d4eb",
"005a3f805fe3c3266feb3e0bb7da6761bb117618bc57af357b53f199e6e4cbc1"
"281975321403ea6de618ec32e86b8ca1e10d7c43",
"01ae460e1248504d33d67ed750f1d618e53728d55e390dfc18d94b56dbb3d3c0"
"bdc96c92ca1eca9f44fb8a58cf36dcfcc0588cbe",
"00f7011fc321ef6258dcfc1fdc2c0a4e54c86ec939bc9ceca6c291750c1ff540"
"b34a418793842a2c5cab6061dbbe9b5be3fa6115",
"0109e85c684d027a625ec5e6df952e2f20a14ed5b092d1b1b38435251303844d"
"230fffc53d84b923555e1e1cbebe20b5d68c3bc6" },
{ NID_sect409k1,
"016427e72bc57d26a910a6722eac2c78fba8abffccbc11a9f8377bfe213ed9ad"
"64bde2ae8687f8ff1dfdb29b5dcecd02269828c2",
"00ad4f9abc21da0d31f19659cd3b0c185581436ac08b15c0b48a7ac39eed03e0"
"ee97e164cfaa5abc774412cbfff94a9ea2a9636a",
"0055901e9b6586b7f3372660ebcfe90249900c902d7c632a8d17fae21d3fde30"
"37325b5775eac5a174a1ee2b3ff2bc5ce69d8cc1",
"00ba952233531b6a6c7ade6f338d24fc65777b5d305297e66d32cb1bc506c5bc"
"a2287d3acd33fe19653d6c88a06eca3712ce9caa",
"00716beb14f02233630f34603e309bf6e2572f0b791dfa4c582af6a37abcdd64"
"e8d785a95ddff59bbc6fbe1b7fc735725efcf0ba",
"01ae814e02c4684c21dd7e58a65ec51ec68c37e59e299ce65608186c0acce08e"
"41c8320b1941a611fe66b1921b558d7f402d0eb0" },
{ NID_sect409k1,
"012e89dccdf975851accf0294cf4bde1259c907a6d3acef69f1939b558c4d211"
"522e4eaac613e3ac8491c93deb6d344a9f87acbe",
"01a52608ead09d2db123a0dc782ab20ddb793d5bb70ac95c58e62146beb62bb6"
"68fd57f92038e4585cde1f91ee8c52526afeb1b5",
"00044ae43bd247e75afa7bd8dc28e75bdb9ddd99df56668c831454dc28f3e9a4"
"4ecfd47ba8420a286f1ef372fd29b365df9b82f1",
"00202694f378d70965d42828ad5f37137bf8b63cec2c0d158e5ba94cab1f8e61"
"e5a300986ba349b3adf3efc05e65670af88cd3d6",
"00baf0da4aedb972f88a215dfbff64e4290fadc25da3f0d83f35e65bc4177d30"
"25d71d8eeb9c41470f3c719e00ef1fb7552e6a89",
"0140e7db3f6415d884822ccc7316a329dfed177b76c0117abd722feca889bee4"
"e14e65d26c6cc935c0e94205f05fc1a7abfb0348" },
{ NID_sect409k1,
"00aba93ae1d1552880b31f503fc4be9f91d10247f14c816015ffb2bad29ab818"
"0e7b50a27144e01c21e63c3dafcd251308bac768",
"00e4ab66e514bd02abeae1c7123788a692584ddb4a909a217fb35de66588233d"
"adef7036ff9d9f24eba3772e2fa3037bbae63cfe",
"0056d73730753ada70fd801c749c2f1f1a61ef5bd6ecb796a9e15efe9bbe6158"
"f669542787350f4d643bda6f3e8c6423b817b530",
"0025a06b71a0ae252f2f905221983ebfce21ad96121a5c0dcc5ef0d0fec301ec"
"77ef4b915818fedcda7f3fd733c7f9e529079cb6",
"00026890d5303b619c7f81f60fb82b26b0b98d8f24c45cab41a44eeb3a3a3129"
"44e889b4035e04360b305043e30d0cb9041a89de",
"002ec4deac3e83d60ad39969f2f93b49f31875831ecd51ea5c37ca48de081c0c"
"8cc660edc53a222f3043447f9cb752763be7494a" },
{ NID_sect409k1,
"00aa4eb898443cce3ed2c072d858775ac221c24e33eca6f31579663544bb33a4"
"a068a86d13f167b65304c5f7f25f895f65b2f428",
"0083cded30211b66f1adf17318b6de50d7724c0584995e068b724703ae08ed71"
"a32b334987a7b31d6c2637152917327d37accd33",
"0062b026d49720660cf6a4f569be98dfa108c8eba08234ae9a87f3c88b6c6593"
"4b996815322a16f9aabed13317bf7725bea5808e",
"000f52925394cb52bc330e06390c0c0a2e10ed9797149fbcc88d80fbcaec173e"
"24a05daef98401d5e47f3b765bedbb8246312856",
"013d99c1710805d5fc7db7259ac9e134b411d00d73fb0762e3d211cdc56bf7f7"
"14512d04a630c8732551ee734287476cf511e836",
"01c9cc05d19f96c4d233039cfbc43ab68d657bb507f46a353091fe98fc0f422a"
"8e7593c195d326977a2be6bbd2cb44eb1fe81650" },
{ NID_sect571k1,
"03106a5c1d923a0990ea8c6008c36c366b53e5622b98464044741fbc7840284d"
"b8bbf602866c30ccbf5f9b7e59cc1d9bfcc5b970fa624da9b15f6cb336f5dda7"
"e6b9924d5dce4543",
"005c5c7bbd5a789ac4c6283deb0d0d37c4852baa57d6bc2b0ac6337feb09704c"
"44d1b385b70cc394fa235d83e6e7111787e57d0902c0cb132a190a6e62f39851"
"1c0c2c4cd50d4570",
"0173cd1631e18ece01b73b3572ffaa7495c4bc81f4078ae50d69cb1e338acf13"
"469117112921166ddf2d29f3a9f8e10c67e88c9a99203a834565be76ac591264"
"36739a6afa029cc5",
"03fbfbbcfba609157f68a23126d805f7c75efb19befb595e3a975e08ff46bd34"
"c8b87b9645c0e86ea0ad915465d5c856c69bb9b722b0d17bf97ad95c4602dea1"
"7c6b512054cb22d8",
"071c16df71e1b71b4bd3d9938827d3959093b9db1ff86bed73944a42dcb67cc3"
"3102e28c1d0e9804a6450656f4bf33ad72ecf7bb83bd282cde4bc15d4e48064a"
"a8ad2f02979f5f3f",
"003198a6b5d6cce847e24348a6a6ceff7a89ed3794d7acedc4e858c80ad04a74"
"dbc02c7038e05ab26b2a299ec92ee0d2c7e66a81872a5157fbc5d4d37ad598d6"
"ddee995ed28a2d74" },
{ NID_sect571k1,
"0211223c4b729b206be01f8085a997e1dde5cdb27c048925a27369bcca6a3e2f"
"bfc65637f1eceb133be749679a17b1ce58821f46bd1844a89cf0042c8043cb10"
"5e01a3fc948d2663",
"02b1ec2e6e2c2375b464b0a502c5053b5b348bd08178c72c603105d0468196a4"
"695dc267d6e109f1b1274453b6eff14ddf3783969e8825648debc216afff9258"
"f644d77ecd9911cf",
"00937edb3aa29563d2248591c9fb448985095f913a7458315593cfce87e68fb0"
"f1a525b7310a101176e34d45c1004538954e2044543817cab0d563df6cb0d5e8"
"617bbba150e755e1",
"02363cc5624b06df1956befa597d4c757cc2b1001a3e1544d24408290f694877"
"455ba92e56088462f0ffacbd393cf835b56b7046a15d4b724dc6c3573cb156c0"
"df298aa8b1255cb8",
"0409f773b98d5edc2734d835953281b82ac0e15d902d887a7c6ba75629a37671"
"b101d18ddfdc4193d98b18551414c49173004530f7976d27c273a73ddbb898fc"
"b5fade9c0bb7883f",
"00577147459262e5ad42f222827f20ed574b2118924205bcdbd339ce20cfb085"
"d072fd70f4ca1f5768fafaeb5710f7ccbea4fc2ae5377b0cff20a889a2201739"
"139bf788a9bf2d7d" },
{ NID_sect571k1,
"004d48be599ebb1ed602472d7a87f4cd2080f44ec28855fecc3a9cdde2555178"
"7abd27cc1da7e77817e94c9c0289c005a0e36e3bcfb0d381e8cc9684b6f7dd05"
"177f16f63f8721ca",
"062cf71af0a2f8e35c4d7f9312bd34a846a380f63f0dc7294c18877103357e20"
"d1f0eeff312a993deb2a1ecfc80aea06a5b71e4f8b9cefaebcd32626919064f8"
"8af416d86e3e7af3",
"0034099b0773f021ee0d3dd185c704b5158a94328daa09768fad5804df1da2fc"
"067190cf1028c30237bf2a48da13abae35a25c3e6387d3993f9b568305b8bf08"
"18ff527dd8205df4",
"0674dcc4f755c44fdabdc078488107bb64a460ba932c7e185484ccd27fa87003"
"1107e9955204b0630b9b4d3608d9aa931d7c766cc2e45878eb6d8cd96bdf711b"
"2fe8b47b8d233ed5",
"05d96be6b7e2ba74c8032af19ca2f2b39d2fd4e8c89b156b6b25c2ea4f71f74a"
"02ca7da2a463acd7605d5350fd16a9c9052534e7e81d648e4060a2b01c459c26"
"0cb6567da1fc5314",
"014662b261d0bc2168642bfa4f80c4b3fe8176f604ad3703f443ec7aaa3dcf3c"
"5465b869a8fcea60b8f55ce7118806c5d28a04848bd961db0061209b59bc0297"
"9acce9324d7c0c31" },
{ NID_sect571k1,
"06bf252e62c9969171a9717671da0f7032e9520a497ec831f4dc776ac87e0194"
"af99546c41d08048ea06da9235cf1369c3ea53e6b8cbb7a7fd4296354548d44e"
"df463f77ad341b02",
"0294d5f7e736dcd8990198e4e0f0b398b8ac6a87764af601596234a2e162c9c6"
"67e47eb3d987efbaeb03b5e3699a38ef953c74fb28fd7d8a4ec5a36319ccc44a"
"19aa88201ddacbf8",
"001547438df76fcb5e2ae6925845bbfb03b4fbe8255616ec7fbd97b48f112692"
"219f4f1275e6d2453d5bcf3bac4106f0161b8119f487d88b5f8c8e08b3aa17b8"
"3fe01102d76392d3",
"0427e2dc11ee5223bd9c3d9418c79114682f91dda06e7d88c339a7e56e0dfb63"
"6b6e63fde8a381146ecb705ca202d2b73df408451763c5166066a97ff4e4f32f"
"0b4cc942344b0b2d",
"0760c8a388e2eea27ef6838c7d45052e38cbee2096cbe89f774774134076658d"
"f90c62c7dc0e3fde995d7a99090993009ab6c535677dbdb376f183eb5092d2cb"
"6a8837b6bea35dcd",
"051ec4db0622b7b1c798366453c70f959376ea3942aed2e931ff62a4019eb12b"
"a5ff119214c8bfd8bdb66e62b562400f2d3d48a84b1b3baad3667f735ad4d0f1"
"83bdb91aaedcf1f1" },
{ NID_sect571k1,
"05701e63b01c16c4eb19938265ba134cac7316278e2f1eb40a04775448bded97"
"e7a37d01fed8a4e0b43ff4dba21a47759ccd45bf9671dd22eec65b4aff8b8db8"
"9dfe3e490c0ac9d6",
"02dd97b6415aee2b01cfeb3cd2a03578abfed9ca87be9a26d899595a87bcbd97"
"2748fa6a0be4eb557e69c6d28e2bba1580dc74e2751d7ccd918c46b4be6875a4"
"e4c290d959c23c12",
"00c7b4252ca9b192c5feaa9a210fd84e2e48320271f10f67ea9eb30b0de8086d"
"59dae04259fd12b086d890e22d45d27d7c8455dcf7ada796e35e3a3138342cc7"
"36bc3ed3781c4119",
"0325623838e8b18d81b68060734254eb02b8ebb2264556fc9850c36d3035449a"
"a764f351dbaf7bbca9b9adb11f27cc88a1ac6fb71aa10ef8d0d09392b0ca7eaa"
"7a5cc14078cc18bb",
"0098fc7656d9de3a51923dba290ecbe413ef8d951f24e9248cb552309f97127f"
"b9429ecf6dd07b6de894e16ab60e33b4ee73024ccbe866de5e17f1b478dc7727"
"a1bb42371820b12d",
"05b355eb5c47d8027b6c5301d2463b99c636db207792e2975ab1a53c1cbb1312"
"80288432a79a3b47271d6a2bd777298baf8a675f66be9dc72c3588d299df8b52"
"e7840322b43c2071" },
{ NID_sect571k1,
"032fa1816fd2317c16b5b19a25d46fa5e45ab15ee9f2b1d1274c2a06023994db"
"309fad56f60b3ce57f32dfc7d045a84b7d805232be34c7e759514c30a25207ba"
"800215b2060f04c2",
"041469593d5748072b9ac8fde023095289bcdf65ab1bfc0856f83e9ae06c8973"
"03bd16f5e45823d65fec8310fd4332b65cff47a799af4f7c8638e2d7f85948c4"
"3f10534c980ccb62",
"0066cc51980d3851b488c2c181496c83505fb957b1ec4a84df1e105e30d002bc"
"b978b6d0bdc3b7644ed3dfbc33ca6bfe4362cd8cc541740b0de8cf2edcce4592"
"e34fa11ac26ec922",
"0771fa29e5930d6dfd36d3a9e7159675fd23d0b5e1fd9ae6454aca9e8127f1e7"
"e3f5322b5c16b095573b3266d08f0dc33043ffb3d7b08e4e052ed3f0349a3290"
"25ea6ff3e1668547",
"022f994f9974692dbb6e58cc7ae5f90652ee231e0a3961569dc646d114522a37"
"77410c1b352d668079f80010bb540e4c28408665810fe61fd60e70d30c688eab"
"8fde04364dee5c9b",
"052bd78bf1326c6d91840a351d4874d36b147139882356c595b8607f99987730"
"92a99adf70adeed19e122d4d2fec16285f000161145135d96355cba039a96335"
"e7716724c249f88b" },
{ NID_sect571k1,
"03e63dd4c98c151361c9902b763ae32f2d6de75953fa3d6838c1d613d448fca7"
"3bf302d30212a96d32b9549e17c5cf395c565191f6a22dac4da7c1e1a9d9bae8"
"6ebfb72c82ea199a",
"041609ab9c12c15e5127005ebeff6fd1f73b6912ed070af87f5ffc21df903dde"
"1d715582dd2f699040200045cdba9ecd758ac4d084d4c8d78219f6fad94d341a"
"d77daccdabb54a2b",
"01990d15fa2cc90e783d432201784bab56b6d29d1f2665a76cd013eb96f6300e"
"d8f762b78a5596ac7e8c1e76167f107c20443b1ac732101e9f0aca12551a536d"
"152df2b3db0f20de",
"076c3d72f0e715f2491bc9d99278a8ef3c390b3a96e9997b37e5b7bd8a5f07af"
"68f8e0ee3892b63ff112a73a849f0e84a782d4fb426eb5f2f15adacce9e5476a"
"6daccf3a7fa9a291",
"0540a763823599e0c86027bacc8cbb30e3a2467276fc4f7e5fd4ed385dfc6f88"
"3fed7bca69df21a0668b55ebd292da8fd6356a3ec5cd1c762c01473aa067004c"
"acedad564fe06910",
"0226c28e5a6bc735935f9df2c1b02d096d4dee41ffb95a67905aab8de1b2d8c6"
"6e2bb471293091438d3f05df7e48003e58a958b72f839f7f2e2c54287fa3cadc"
"d41a2542ae4ec03a" },
{ NID_sect571k1,
"06f91a7ce11ba9bf2de1fe070f9dc843bb717c306d9c63b5078d2a11323f20c9"
"c0d7b7743d311ddacdcf5dd00f498b199672c78ae25e6864d62bdc16935d6fb8"
"dad2082d3676ebf3",
"04593c5bad12c3d655c6611c7ca9711f9e32a28fee54b3b8243962a3c55d41f2"
"c185e4c58b7a2998e978021b95b724635daccbd7fc30d20720797bc291362c55"
"b024acb2bdcf3d59",
"002b0937e731f59ddddf0e94fba92bb1a6ceb819e7659bcf6edd4b4af49c2ef2"
"5c5b6039256f928363e18404b1653d3998054c2c25a3f83a0c5548a139e3e6a1"
"80756746cd34ee29",
"0270c4c00de2709010c7cf047a0ce69b87f41dca48d35b71fba4b258886d73ae"
"42defb8653951c1bd3eb4ce0e6175a946c67afa67753475c51fd525b0fd9f5a2"
"6dafca319faa5e15",
"06680bbdc281505f5d3fbe29744a999e07ff612576993f6f8be3113db1ee6cf2"
"3799867bbc80a140376a9b6327451f98bf8fd1db46f9d9cc05e88704d5712d45"
"67e1df40d39e99ef",
"051a3deb052d3e99bb6ab6c6b284db2c998e9bee543e02e57f1b13fe9fafbfe5"
"3a89658c58eb947dbd178aea2f6cb28e305c9867bd65bb26f71793f90c984ca1"
"1113e1a8dbc8f7d1" },
{ NID_sect571k1,
"05ab2a7f10ac89f98c409580abc11ad90c93360e6ab282920b59d316ca9f2b23"
"aeb50876cb1bcbe8ee9ae6b5533fdcd11ad4f86d8918d66389da87c98bf1d632"
"3bd0947d8099083b",
"0689e1947276791dcb9527183e32a08072b7e03dcad175fe3cfd7beefc848dce"
"f483380c6005411385c7027c9a52b60a6e537a875380d25bc47c7bf2364dd68a"
"66f21d0f57866a42",
"01cd41cff762402a834e7e0ab908fc54940f697b50022a4dfed8cf0b13d7e0ee"
"523fbf33ee9693895f918d94e15b084655d61b2294ca51c4123fe5e0868e9d0d"
"1cac2138f0577a17",
"0610797bbc6d9131180ae54ab66e6780849258369741470e076cf05e0785bb4e"
"7900b908d38d8dab3b9427b952add20efb758cff80aeb641c4dde1eeda5509f3"
"86d5658559609cef",
"068d2515f425a0e3037547342f1b6ff931763f5052e536ea4f78377b5c941459"
"c8c2201482afcf3cda7390e9e5d319451864ca03683541ab2cd77a9d88fd7a61"
"0ca845ee5cd3d498",
"00697c751ddbca7034fb4d3fc1b2618daf78cdae464e8332d1215020c8f896f4"
"864c7a6f2c61a363f730f58fd3bdb4f78a90b40aeb83b4fbc1d8d37cf6a27a6f"
"722c68a82979fa16" },
{ NID_sect571k1,
"0034091c3ac6fc5299df18f162eaf7a207fc1543aa498e7272e15a92772f5777"
"2229069456e219c9c2872bd53783b0fb1345f5e84674c4344129a314146b7030"
"fc75197a20c588aa",
"049e3a3f5ee65875e1401089970638b807df97568a5995c8fe2f502473b83f58"
"c556c5f214ed6f03ef8ece01401a2134bc041f66922fcc4e3938e0c6d302eb42"
"200678a97139f291",
"019dff0d72a8b042c4e92f1dae7407bf4a106cda564db7508e5a76b03130c91d"
"5e5cbcf2f578c2e9dee43849f911d7773d4c267e282c277b731f88a6ef0eeddd"
"520f57e743ebf965",
"05bb60a5fe8e3b173cf8413eaf413a3286a5a7aa378f21446c61057696012746"
"d02d10a831f785c9c96561ffc6ad4f9ecdf4937fffd8e698408e660fe896f7ed"
"44af6b3b42ea849f",
"037e3a35e48aa66bd851c59f851d4a1ff334e0e589dac30986acd06d6eb8ce23"
"6f2a9688f278a14dcfe0660b5fa0e97ecfcebbf5b40d3d3f5150a5545acba623"
"9c00419ac72dc2cc",
"0322517da30e010aeaa2ec9bad2745d8e67f906294ecd6b1d16808be3837f790"
"70d0e1bbbd617f4b8b031d3b51ea2acc59de408a130138c78571f8800fa907ca"
"f550d23323d1c818" },
{ NID_sect571k1,
"057b7c65bc51e87bdad37c2b4dae67fb008ce71fd3072e41b77c562d7c417488"
"72a20bef8517ba4be89637dde98e2ba1b3b01f63940713e2823d8dab68a5cc78"
"561de14085e4cf87",
"00ba77430a5560089dfac4f68b4f34937a384dd607bcbb5fab5677a7fae09ed0"
"7cfade399e87ce9fdd9397c681aa3378ce3bc82b007f6de4f7cb96dadf55a4c8"
"734a37f39a5c2f25",
"01e1416d429926cabea547bb2776710a52f7130393081020312b3962195eb6ed"
"17c6d436bc46a5b47a7aaacf8f8117fea3cafa16665cc1845b0ec94faf687579"
"b1c116ba183e825f",
"065660a58688a16588a9c16b8272040a30afe3150630676023fe165686dfbda6"
"4fc85995ddc18c9c5b029bffbd4dffa8f62989c639a68623eca78009cb088ee1"
"cb42c4855b79d302",
"0492c3867f137bf2787a7ab0568d3079b8d9a1e0b0ba5d29d0c7ba616d0bb277"
"25da2ca6bc67bf084fab52599ed42b0ef48743423cbc6f4135692c309ae2630c"
"c4a5390be93f274b",
"000911ec1cf82a22c849b401dfe56453a06f4af32644ea8b63135b68a979236d"
"05968eeadca7f0cd339d295cc58967a7f38cfad6e947a71295733e42ca3c1ba9"
"b4ff6195607bb530" },
{ NID_sect571k1,
"06fa7477edec5f1e742881f8d7b2af56375113e992b797fd387eb5b53c33c6ba"
"7236417b2c7e6e346267f1b8c6d7857d6e08f9a60e86de23da4b368424fb003f"
"96b4c89f5d244a74",
"073e1fedf62e8c81283622b53eb2cdb27b64c3c1dd78da0c90dd6c3c776ad146"
"302e43aba541379bc8f3bddc2e19ff15d96664ce2d09eb6fb5b13848a82b31b4"
"52d8e84da3b85318",
"0196363eef1a0e5be97d8f7601fe40ff4010f4949f016908a906ed5cdaf1221d"
"3a593b3a4676beafd1fa14bc0f7c533b17086f207f9c484cfc2fbc3db2be4123"
"a8e86f3b4911cce3",
"01b12e38914ee0075a888d6d61cdc7570c511d90a9e3a0e2738c3a9981ab9aba"
"9a6c61460bad079a28429a5207d2c801af2fdceda366440a11686765e9ba77f7"
"a6bc55012d4c9510",
"070ede5877665fd636adcfd07220d745ed7ac0a9b0202159f450c9f6c1b83719"
"2a69ee6ad955327eb9cd326a0588b59723db4e8fd258b11db888a53eb14f2be0"
"8512688329059892",
"0724c979affb3ab8d307529759bae5fa67319d441851e5817fef014350e3014e"
"068428c9dac395c5e7b9e5b8877457b3e4625ef49ede4ae3626755eefc3fb3cf"
"09c23e8a5a9f8c25" },
{ NID_sect571k1,
"018bb6cbfcbfbaed468564b368f0b0abc3fbca47dcc19f2c846bfa287370e1b9"
"12f6b70e08519f577f0cac325b79fd66b6b23aa1e2ae262bcd2e7a8b2c2d98d9"
"ed77a54c7295f98d",
"05be9bbd91772bb42266aba9c893e56670cfb66cafbe4401ca2cb5765b469504"
"848597c7f446e99814746787158a83ebf8e3796857363a8e04f8742a09d7eca1"
"6386d60fd7c858df",
"00a19a0edf508347f4402cecbce127dc6410b1967d3f89e6b3ba08b48aad08cd"
"6ca5e5d1228cdcc41a1c380f2ae9052d73db7550e7a3c1d857056c98947f5b2c"
"71c33c4eebc1210c",
"0629f70558308708e6929b1ad0fe3128a8af7f96591b47cb8ea2c3454120a6d3"
"93ed989d13231c661966a378b967efa64d3c0938e9c0b8b16c99d7349bdd59e2"
"d44804f8fee1fb47",
"06a5e50fd5024d8953e32242823250e998ca602b52599405129735a874e833b3"
"bd73d7a9dc53adea092ba8d24207f5ea5657a29919b88a6d63fd0a943b56dde4"
"c8478481b57723e4",
"005a526588a3a2ce08b20925e83987eb0a1e68f997102df7f9af83823ac8e06a"
"bbd29c04cb1f974ba9c9ac49b48b5af37679a39b532d359cdec3d41b3f80a1ee"
"12c80276256b738d" },
{ NID_sect571k1,
"032184b6863e2cb5bc71baff5b6b57a10594831cc11a9e5eedec4804e2016e3d"
"d064cffd12a1eea0f6932911ded345ace5c1ff250b9648d93b953386dae9b562"
"8c3c62527b890519",
"07f783e0341a871e6256da349ebb539f88767d7dac1511e3c3e4d43b0fd31d5d"
"d2c2f0f176eac544a871f42b983f8fba4df67ab6a239b7df997226304b73165d"
"962f4e1d2d18de9f",
"004cac3fcc00734442cdd80eaf824412c20ea9eeb03d43b999d49de618736020"
"20a2b3c47965f6f453b91b7a2c1d93e13a89544533e35a122cfc8612c8690b69"
"bb7a557875f960b2",
"03e211c3b4986927c4388d1680cb4770dee6c78266724582c66ccc50c6cb2823"
"9474d521facc7206af6bb29cced733edbbc0d20b9264ce63d9437188e3d31c0e"
"0bc3e9f9d88429e4",
"037a7c59012a82d59cc1e2f0fd4fd751e5737acb77f2a0799e0af38996ab5e11"
"090a6396cc480e6f2aabd8fad44611691e5822115fd49d2a000c9b49d1f4964e"
"24d43fbb81fa879f",
"049db68dc9fb4cfbad8247ca4fe7c573c0640abead8f319194d665ecaf4f04b6"
"1f84f5df0d8a6386f6df04ca1a685a7394567eba5deb9f739b1e623ed6507021"
"593f0e22e2dfc3f6" },
{ NID_sect571k1,
"071e167e59e2a709ebf4be3d83fb9dc69ed749e3ab8a54e202c35f8d45deaa2b"
"da86c2afa1b0a04754d18898fcdd9b185f1d8ba2e180a47ac291bb4aad8f997f"
"73b1423bcd7e9b92",
"057119085bc7cb2023d23f88101420f9f508f0db94f8dfbedd5cbe88cec80a9d"
"c708df6cccdf815d75b146280d7cd2eb97cf1a7dd550be523824f932a777679f"
"2ee9f66d4258dda6",
"00d514144d4548bcfcbcf57009f7e8ee104b15456f491826bdfd9ba67e871fdb"
"d8fc8490ecbcb269091fc7529e5e55713a81de20c0ed01ecb3159ae61424bdbc"
"5653732587d1e94f",
"03ee5f877b737dae40baf91e0cc581dfe8d291f8c451d5bfc0b690df7025875d"
"9569d52021b3b6890e01a2ba95899e2928a902cd5dc8143c07ea26749a9c9406"
"8b5c34c596b0943e",
"058e1ba516a818cae9b37086287e088083e2b421fef0b59ba816ab031375d09d"
"7af7d57866744687be3bb41ce2276d3a38f97bbb9fb59f24a92f0085b04ee5ed"
"1ac0efa671394f73",
"0343c45daab4f91e02ef9bd6e1cd157b00ab0ab0a3e0d9734918a1d896cdf7cc"
"1212bf74d7bb9bf96bd4abf42df325756c407217f44a5950c2b66af820692742"
"ed7ebe14e48d2d88" },
{ NID_sect571k1,
"074f1a7b5cfb0eeef1e15e63512c73188dafbe88e8e9c42073b2b652b9f02821"
"4f0bec79142d8889416abf7a83e29f479e7bc3ca657ef0a10c2ea3ade3117c0d"
"369dacc2339d1c12",
"00e8992a54076753029f2c0e9d8c166e6ba84896a4785ffff598c4823e5461ff"
"005490bb7fb6d878ac34f427fd9db48cbdf12eb9826d68fd2cf171d4d61c3f27"
"5d44947d4df4c752",
"00ccc6dca5a985583ce00812c3d07822f6341c79d78c16b2e7ae4bbf5bffac1a"
"cd9deab678193f8f89b0e2aae52e30311444dd11253f96d62db3abfb17e423f0"
"ddf0e991081154c3",
"03826215343cfd4ad968d572bab2dee2279f9e8effa0ff80b0df5dd2ea822b50"
"2274e507c87d2429dd8bbdba6eb8ab433b1ee1cad3a97c7d244194fd9a43f3e1"
"ff33144e2db80864",
"070f4508ae391ce24154b38873af0082d95895ac92fd1aa321ba93beef404a63"
"f7b1afa1feec997885523a6688ada94dd45eb32ca7f1bb87e63c4de97493196c"
"3b53cf83d218dc37",
"04a565cb3e15236a7f6c413afeb419c082427b10a6d07ff87e81740716433c06"
"b3254414381e4ff9860340dd6201ab6621d162cd12047a5515ab1d65f20c97eb"
"3d7132642f8ad58a" },
{ NID_sect571k1,
"004b54b3cefd415f5eaaca4ae4e5dacfbce20cba1932a2f50549bcd31630017a"
"d21475df154ff37be13ca61a4c60336b33d0ffc762aa9e9e9fc6e6fd17250b5e"
"4022b55141d23fbf",
"056f7c8d65c568de95bd1664fff71429ec738987697f217de5adf36d14a80b6f"
"e585e4685e03c81838abedfdc05a1e01407af4ab989fc1d1273ba8a182c46185"
"6d5effe705d7dfe5",
"01886213658bd17e7dc334dd8003926a447c34a197ee5d6d0bbc46e85ec1cfa6"
"802858d1c367276ca572ba27aa7a5d1e216902416b48af6e4277945e465d7d84"
"0dff1438543caa46",
"047f6cc42107c40c168dc679a864f969b53f756257113b7502796efa54cdcce7"
"04b9344ee4bf964752d68910262bd26ab6b347084404b28306ca3425f29894ce"
"6fd4293c5973522f",
"060cfdb5467675a789923be973c6645dbe26d00a39d4e81255217291a3882cfa"
"8f91f4aa8214d3524c95ef6a24e47b3b9d0ef55f670756ae4a4d9c65f075f417"
"0b2d18aafbca0265",
"047265831f1f589b5f30806e2fb80aa7844cbf32b6993384beaac7d992b327b9"
"7dfd0bb89ca09e711507e846ed4ad003e7115fa8843b23d38f320e43b5eb506b"
"de48fbd7af4983b9" },
{ NID_sect571k1,
"07ec71bea081190a9c4cdff809ed2b65a77800cd1b3beffd1e4004d126ac352d"
"24235c797a5a567daef7393d276638132ea7f0f61e550dc251d341f66102f96c"
"2abf7ee37c0fc9ed",
"00efc2ac8705b2f9c9c06a910a304c42b1ad53101aeb0d146319dc24815c7cc1"
"983b1cad91d5f9c6d5eef1677a1f2d2bdd75a1fb4c5796a4c56964aa3e43f3da"
"26c737edd9cb0910",
"004c0dd3715e8888dc2222069e7f611801685140303e16b8b443433d5e18a4b1"
"803d5680416aebda7ae7e9449154be346a7dcb36c1db22744673fb3b245e5844"
"0787ed3dec6d3db5",
"02fb241eb2c28a1b0675b5760fe5663efa603eb0590842f455973f0573e148a4"
"7e63f97e8df9a570b0655d5afc42019fe95fe44fdb02a68271d82df580010f91"
"dff0cb3d9bda8992",
"033f93a9dc39d87403b6a94dc0632dec6757842d0aaf8ad8c41ebb637058bfc1"
"1c19a3a9abddf204201ef4f96fe9629233a5070a08794d14470091e30cdd876a"
"af65407627233234",
"059b62c25c96955b8fb4deddcf90ebe6845ee71ea357739273d6d67f21a0c47d"
"154add9d5d4d2b657fe1988ad614b0b4902faa92fe999abd754ad33cd6b92fe2"
"f6a68a6f2c1eeb27" },
{ NID_sect571k1,
"06708686b4f5ad2fec457aad5ac4a3dc4867a477eb54fc0d493511b5561ea151"
"dd4caf5d4311983500b48c8043af09e3f4042d5a07ebf050a4e801daeef3317b"
"e093955020452b29",
"0525c8682583b55f7ecec59b920846f75d11d021e9ffb20018639f6ab9302247"
"2c192d398e150cdc630a11fcf942e5d238cd6c14b30f44a24d2f843ec5d135dd"
"c7abda56047abc21",
"007d54194fc226cc39f640d3d17b9b95b70b51f98ad5ca1991566108d839e377"
"e21ba48cbf441530b3341ddc61b0a58141aaa66530241fa529505d70804b2560"
"c5be481310b9962d",
"02ed5f3a2efa4ab0f9db5fced7b1300de4d457a9ad0827457e5e1c4bc15ebd18"
"3775de4b73c1f820dd4033366100e48b4164d04e9fb6cf1a4bdb55122a86005f"
"bd0bd2cddbc95fa7",
"0327fe654ef68563cc8888acca85163c2b154fb70b0f4a2b58c36388a0c25f80"
"a4c887977d46000dc4d86e95cfd8f9065c00eb28653c8fb477bbb5c63dd47b83"
"ca5e0f871e9eed3d",
"02777c72853b76b29f69d3aa27a1659789a025af0633d833b22b57bf328d231e"
"bd128bf96a4c8a7ffd2ee7a51e5ebb7a8e5bca20e4ad49671a2123dfbc0d6c40"
"594e04765186de06" },
{ NID_sect571k1,
"07ce7674403dfc62895d71e2ab587ce735f279f12f7df3161335be43fc2908ea"
"736f6f58b932d793aff66f332735d4d38f05cb03cf275ca0e00da1f57381e08b"
"feb5017877342272",
"07d6649f3d91e7bf5f8de611bd971818106df2e37935bb464cd9e7469629c6ae"
"7e7f2b2240276cb0eedb7a26d0c7d377f4009a1dd48a793cc993fb0d4a04db1d"
"bad4493304bc5c0e",
"010740b958285242045cd5358d7ff9232b7d7d413af7e205c285f88492ef27a2"
"fb850e0567ec24c480c75ad32f70342025c86267dbe4ff80a2c509e5b9a45130"
"e99e7c7cc8cc6ece",
"03f3f585cafd46a663b6cf8b8323ef9159d5195d3118f3edf38732ca0ff73b2d"
"065d9e69ae1e3978b2ce6dc61500f7b8bbf6f6a70b47bb64cc4fd195bba6ac93"
"2b70beafe174148a",
"00b1566fe619f2cc00aba05e24a6cccbc91338b2eef553da0d477d6c8c0ac4c6"
"56e134dbcf31ffb15c67d589bd2918f1174909e5428c71c90e38c4e11b56236a"
"bfa1de6a8579eb4d",
"02c2ec1632e83416182a9a438f7360b88061bab84f5bded3dd8a0c87baf44507"
"df94fdcf99353b107e61cfcfc8af071b3aa8cec7b34a542bf2ab8ea0bd9db67d"
"66b428c9a6c14458" },
{ NID_sect571k1,
"0483ad7382e348afc7f271d50d8d39b814b7d6dc0c562a6ba556568045bd2d62"
"0906ab1106f9137ff725892e8436a8cd7b88892a32f19ab269e2ad30d7f0ec00"
"e3a052fbbc466307",
"041cc4b0f195dc73c4a8e10605f2a382923abd2381f24e4abbd401e087c50d18"
"f6dab01a25db7e89dfff68c663494fb4d087a816b85444d882bec2ac25e42fde"
"78ebcca79a6fddf0",
"00c85e5d2ded5bc3b6b553fe0a02311b72bc5cdc8e96df179ce57511c26ac9e8"
"73fc1f76cdde9a7d8e52a7e9be5c7753620331e8977a98902b48ae9899ce8a6a"
"6636611276ae2383",
"0289aa5209fe7b1ad7b9c5e0e630ba5e02929ea1b1f114d30a0648012bf029e0"
"66453f2d28e1d503665dd0833f0ba37e4583b434dd9956100a1ae6e54f96d934"
"7d806741d3a76e31",
"033afe87b29edef447ff5a02e63f64905b5f53ac856cfd7755ad542812ecdd56"
"8e8ae1f9d32fea0f02018dcfd0e16d6a6a2797b7e3dc855bfdb6b0d0b2525e14"
"3678d539bf8c0672",
"07e1d202a54d34020939f7aed56931f21b206761e4fc79b9a7b320f81077be32"
"2ae7809446b5b3ea701618ecdb0a1796ab80407a281bdbcb4d580131b61f8743"
"bfef7a4d9c5941f1" },
{ NID_sect571k1,
"07a5e8eb4968497a11b90c60e13d5f3c61c6868573a6b6db7c208a856d54e74f"
"4368e28100b9e0bf49fc3104e146fbda784623a36d9f01f23ebadfab04d7f48f"
"f66506c698bedd11",
"013db968fc7cd338cb8e3042a171fa306f9ab6f6c865ddc5ba5fe994a30d8fc1"
"fa127191f08e4e14b9aa086a52fbcaa46d22107fd6df53108b53fe0bb96bc974"
"c03a8c6528f9792d",
"0053a48cfda8ee232cea3549927b22f375d6096560025e213161d43eed02d073"
"65d9ede7c93d457ea51ea2369e87463eddbf25a06bb1f080fb4763074a8283dd"
"3d69f1de865295e3",
"04790f9db600b9a0a57e03d274a3d23a55aa0d86b2d6fa07fafe3c9d4c339377"
"1dde89c70a6470a31bad105c21d4844cd7bfc3b59738f9d6c528c414d524f88e"
"0c862e4e17aff454",
"05dc12db04e2489db8a46cdeff9f8d9d2e00d024f656c781eb4d2db167624b3a"
"70addaaa158ca00601d4cad065917bebe766912faba9987fcc5fc8a78dd21643"
"aa650e6a4a7e2061",
"07f49ee5d822b17e3f1ec9946fad8d0a0a6b327242afe675806b3e6b7541745e"
"21cd1b70df926af057a9f8deae4cb9a1edc782014426152e8aa4cf6a4080dad4"
"678dc8ff0d9e1af9" },
{ NID_sect571k1,
"013caaf8ce2e2321cf256f2b64aa89add6968c298624a22bd38ef94deb3a70ea"
"44ce87a948ea56bf0ee9407134f8c97b17b1f54561ff7747e3f6b656f80d6077"
"8d05b8c4cbbbcf3c",
"0047a2dca3eb6754b0a9fd16b081fca497b29dd2ec9e6a7596d06b059c2ab189"
"00fcc58715247276e390df1dbab26ba81235a4dc6738237fcefd3812b7ab436c"
"926c50c600e6e907",
"015a5e5946fe2c9cae6d412c618c1bd07724432b2f1dedb1327d8a99ce830e6b"
"030f4025c14b4e3d1912ea9a78290a1cfc7d0189a30c614010c873146a182f63"
"9193a2912edcd04a",
"03140887e87039797869f5d9db50d91ba69d0bfdc5a677c700610562f680d951"
"a5e0517cb2f966367d48e423b046db4e68bc1c4b3183dc80bee126e89014994c"
"df83c4312a3e5ea7",
"07b8d706962cb192f0ed14c4da710d1b1b073fd8ca497a94379a7454c9c3d4ce"
"6e5fd2e6386852a77c5435abb23536dcc83986cedd4512752f295ca500f055f4"
"62763c29fb678caa",
"058cd5608dd9d64d4d822baeca123358a4d7e56d3777ecdf569a149c2f85ed35"
"479eaeaababd0b026dc3b56aedafedfc8491040413f85b669d8512a3ef7bc8fe"
"8706b5c7585370aa" },
{ NID_sect571k1,
"0743b3c965a83ee9f6bdb9901a1dcc1f78196544a88b9cf8117f89ed1574e5c5"
"d804fc451112c257877e12b0a66c693c6655c12bba4535d99d62405f4a9dcebc"
"056d8b7cbbada120",
"03efa58aa3a8c6a24f43c5581fec041442ae955275dbc1d46d10156059d2637b"
"9a82994b024a247d2a66724ba90d02787b168b1fa1f4b6749645406c438f8d31"
"6d670f1e0d8b0301",
"00bd58e19c05df7e99bd962070e0b4c7576042858447e023b41bb29745a89a48"
"74dfe325a15d38d2fb9e870f419dd15f4aaac65dbbc5ac2c540f57cdb0e45bc8"
"6621726d922d14aa",
"01e4b2a277ddd78f2f119c05b6ae1ea7a2a744961e08940f6569ee8808c53bc7"
"a12138064ed5c8c222eef2774e70c28bce3a6c05f3a654e121006ab62bc94381"
"d01ca0d1b08234d6",
"07eed8cd7a8a3549b0d9ef8786879efdc9c0f4ce90b3991a33cbbb1d3704db93"
"513138b19a50ecac880e578de21046f03a200048180884bc42cf9aafe58cc1ea"
"f536d6d25f1541d8",
"03bf7a59bbdd688682c45664d20c19cb2d24fcca6772120cbeed1cde762d449e"
"bf22855627eb6b2be6e7f7c0f0034d02686f2a4488549f8cb198e02b46972bcb"
"88914bea66dd6400" },
{ NID_sect571k1,
"0722f1e7a0607750dae2d62c5d3d470f006c3254558eaaa294eeedbca8d30bf4"
"abb955deb62e4179925f6cbadf3bf8776f15dcae3556addf797105a77b7f6f71"
"206ca0e6ea91e188",
"035d108ca0d620cab96b7cbf617d1b5ac06e37792629886564fd147c58e55e42"
"3344ff4f1fba4af0fe34152b384b7685caad15d3bc270e43422ad874e71e408a"
"71a6c8a90d2ad978",
"011463070fcb4a28be4e2a67c29c7fa48a4c585a307405d06a1a0678e909dd6e"
"afb898662cdd8bcc019deb14e5d92d172ba1c438ef0f64d80107c7e8e68029f4"
"e0aa814a1099ca38",
"00939398e463886f0dbb48a74f573a1215000668e10b57989dc300b2f9a8c08c"
"d43d6cbb7f46ec77c1c294b23f86299027d2b93fd6eb18210a8230bf46e3921f"
"182c9260c30847ab",
"03d48ec633b9da1650ea762656b3e31f26aec07e7ca6aafc1ed7cb466eaaf399"
"3e0467048c967bb1e9b4ae073a230c1e2f74e2e618666cf56a06f2b65ec3955b"
"6ffbb06a908cf616",
"06d410e9ba6b8b87b00d0f676de8ba27f6afe7e308c2e992f318fc14cba0a447"
"316ad86e8e6c1d3345d8e4035735232c2c597e760b8800a89a521567b09408f9"
"c7be279c137c963f" },
{ NID_sect163r2,
"00000003a647ba32dac71ec6780b0638a70cd24fc3bd4c8e",
"00000002e69e961541844a4aa33769a7bce710f6640a560c",
"00000003edae173de8fa0cf0412d6a7bdc81fdbd0617adf8",
"000000035466701d0b0030d098b6ed2343d355c24c907271",
"00000000d8bc02f341d261860dfb65f0cb7f0b488d8296cc",
"0100fb42d177ffe6c31378e2e04e0da7376ffe8765" },
{ NID_sect163r2,
"00000001282898936486dc2e3cd1585f32d5544264e191e4",
"00000005e9e98bb7499bf895f77f8fc8301d6e1c7a9f6191",
"0000000178dcc8216425d4bf71c8f2925dd1af86dc04a268",
"000000011e49430cdd06f2e765b8f2cc067cd424e2e75485",
"0000000083af15b22cd7dfd1dff7396bf3f3038f50524991",
"0681c9e59eb7eba769f5b6f2b06ddf1efd12997995" },
{ NID_sect163r2,
"00000005874fcc8c484c014173102dcb70c624ee6108d31d",
"0000000049693f4edc714b0d0baa5bfc5d8bc6ac04089de4",
"00000003ea1e79e52a070898d6a3c4e748e95ac8710d77f6",
"0000000137860ba3458af13c22af8225f561e01331cd87a8",
"00000007720356e15dc73f9fee7a1c021feca97cd41204e3",
"01e0749a21fc508f76dade85435bbbe12c448bd8c4" },
{ NID_sect163r2,
"000000003748d798f140268f1e718b3b23aa2acc0333c074",
"00000000c42a927ab579696123095575ac949b07a7d1d4bc",
"00000001ad5ca9abc8bcdcc482995ad1a977e4727150bb36",
"000000025ae78311b0fcf369566a319f89849546aeaec305",
"0000000640eb0fdf520480afbeb9f2674feb1d6df482d7f5",
"0320398f7acf791e0d602d7b94742cce58e9fddbac" },
{ NID_sect163r2,
"0000000380db3df2b1c0154a8e8cb304aecd581d35f315cd",
"000000071534ec2e8b357d9e069d7f1fa98bd44ed8b06826",
"00000002d28a8aa1d89fa3e5e596ffd1808254ee17a0d0fa",
"00000006e6c52494ab63c89c9788556f716677f3b48042a0",
"00000004e98258b9c56f02d3edb4ca5b0aeeaa9daaa6fe0f",
"03e4de43de85223d818e5be6549c29cdfa1afe1782" },
{ NID_sect163r2,
"0000000136e0d05b4f398b827e198046148b2f41573fc07c",
"0000000739934cec10572852e1f619222e2f5ec4e0fa5aa6",
"00000002e170f7f4dc152fe4706f99d9be229e1317d82bbd",
"00000007900dac251de8a944cf0a1bf2eb2efeee14676e9b",
"0000000091e7df67f77622729d59b7e34b947127e7fa2e5d",
"037b178aab014d5abab305e37deed7f4798cdb862c" },
{ NID_sect163r2,
"000000076c3ae4a781673627d0e9bcb615f626a160a55dda",
"000000058c0ec8f2649c2ddcd9c24b643433b14d907c5903",
"00000002923d2c802cec42def2633debdca759d59744d3e8",
"00000002cdcb4f91ed7d17768db80be2b3ac9e0956b1d971",
"000000032433f455a6cd253e91582d2f6f5a712655da1d69",
"00958b2aaa6061222dd248a6b9700fb6839dacdc99" },
{ NID_sect163r2,
"00000000d65f0516c1b3eed9220e59b3d049dd1153179ac5",
"000000020bfe107a89a7360cd2e217534d6df298cc4bc458",
"000000025b17bd6e4207d9fb1a3af02fd5db26af8348aeb0",
"00000006f6f5b1f3b18f45db4fb3777e6840fb5a5b61a914",
"0000000737ce14aeb24e0591585a7417b89256749f461de6",
"0393387e1dab35748f20d506a0e2b4dc0ee6c3ff39" },
{ NID_sect163r2,
"000000040d903ce2b30f70a6a03849b0e1758fef8887bd31",
"00000004abd8bdb7c1327c99b33820dbe18ae114fb435949",
"137e8132ad288923e64811e92298f5c0dcc95705",
"00000006f2cdd1d630dd731ed77f901c7b0e735515e26d4e",
"00000001062f2f715c4d2af97bb1be8b6cfa2e3ee314253e",
"0212358d3f8bce69b662447333b3edbbc9b2f7e805" },
{ NID_sect163r2,
"000000022ed24643f0cec68c8e4ad1aa2c4369d8aa03f594",
"00000005ccca62b6dd1d316dedbd0f1d530bed6e556b3ad8",
"00000001c48c50b7d3ecdf3b901bad0eefc3e3826e3cea9f",
"000000019175573117dd851e6eebfd9fb1e5a884ebfefee5",
"00000003adf37e4ded52573fa57c8cb2bfca6c65c3674462",
"023472fa59846f7be07cf060cdd69a9fbb27d4fe44" },
{ NID_sect163r2,
"0000000793f4b31172eee66f2769eb305d03b5c3f7cfff8b",
"00000001f3ecec6bbda9bde8a4da14db3e5ff934b9835b17",
"00000001162d9ed3a660455e8c015d1e45d1515749a3dcd2",
"00000004283eb0e5085d198b378fc95f6fb4c3198b4d3c78",
"0000000107a1168f2f47b963e4b3a9024e0c357a5ebdf92c",
"0173a056c4c9ef6707cd23928999c4680f42b71f7c" },
{ NID_sect163r2,
"00000002ea7a50834602f112f6dd0e6d25f064f9d05eff26",
"00000001bf3f69d14acc8333533a88c2e8824863a47ae027",
"000000019a1d16f4a572f3c1b51ea2ace69280e7137b8f8c",
"00000005cede96a70f714cd68963f2d6ca236269a938f311",
"00000006cdadd54b6f733c80934787e28c2ccf58b1227bc0",
"03d34f411a297d7c990fa4a83b5f54759607f9d33f" },
{ NID_sect163r2,
"00000006dd1305349e8aa08020073a0de5afc5dc1b6a62d3",
"00000003497eb7bf4089ef02cd0a5dd0f86bd8798a44c56c",
"00000002efd4400dad3cfad8d1637fa9290c4b758a3015b6",
"0000000513131b4bcb72ef68ab043ee84fc8cb03b6d8f187",
"0000000120b7d5772bbb17ecb1c9e80c36f808fd54a93aae",
"06120aed8d4c1e506710e2cfb98ca2022e642ca89f" },
{ NID_sect163r2,
"00000005a0e341118e69827d6a7f8282fbf0b94400f08240",
"0000000423b993d4367fbf4f6504d9e09a64123a3b53d128",
"000000012b0d64977cfc13b48345ef7072d1a3890eafb95b",
"00000001b9363cf48735676878d80ce1481b8588683f7444",
"0000000768fa7327cd7252c8f696ed4947868915ada1fb5d",
"021a58087968c5df57afd7c343a4cfa2ee8e7073f1" },
{ NID_sect163r2,
"000000001a923d6191634306124c1e267309b07dba32decb",
"00000005a3517f5426a3411a727eddc29a3ec229558368d1",
"000000033ac953803d0446b3cda4ebd071b4eb027c11bfd8",
"00000005c446e9896ca44cca733e9f4e5b64afddc0537211",
"00000006bad1b2522692f970b38be6935dc7d1c09dcd206f",
"03da9c0879219e48c3df56174898fab9ee5b0a6bcd" },
{ NID_sect163r2,
"00000002fa8baf0d6128add9b902aa181c81e24298451e2e",
"00000002b93d1f6913914ffe1559c7c114c631bb6b29617e",
"00000001bd79145ae7f42c6b25d1c38965ec08fd27533a7a",
"00000000e9d8fc3a026925c8add508f920fa2e5ff5282688",
"00000005b7bf631259ac7d36936c130ff206d820b13bde81",
"05b33fe3874d32aed99919265cc0074902e538fe54" },
{ NID_sect163r2,
"0000000353e2da45ab7c4930280c3edb4ba90012d56df62f",
"000000026931e30b97ff5ef7bacc0de4d9490708522e3b2b",
"0000000330ca1f5ad77d7a66d87423328020c91ec79f3764",
"00000005ba37d36997c4f2abe603dfe042232738e82b0b3a",
"000000073c8cd950044972a005c6f1af8e4306e0ccefb946",
"053dbce9826af4d290036feb46875e975b7848a9c4" },
{ NID_sect163r2,
"0000000721670884daa8cd627638ec90f3448efb0f2489ba",
"00000004f84a983bec6b2889c8211bf231149b5bebcc75e0",
"00000002d23140074d6eddd5bc099b17de12afb9ddf2ecbe",
"00000006e06cc7c30f5ed7e686c3a75a1d44257770601cb2",
"000000030dc414c4afb390ed467af471aa9bd2b75f32dfd8",
"00d49b971cab937f40908913fe259849679ca076d9" },
{ NID_sect163r2,
"00000001d6319ec2dc5c08f0261aed0231418d6dc3d0cda7",
"000000038e64953f7cdac71d052e55855746b43d44181b91",
"00000002449c1b9ff09e7a9a03b17f5ff461115f5f3f1a7f",
"000000073f9ddddc4650933deccc9546d392a35dbbc66a76",
"00000004de7558dde649f72322b39e31c8e29ce6f599485e",
"0483ad0b7f8a716273f624b8979c19126705266e4b" },
{ NID_sect163r2,
"00000004f167907bf4b98e8696d81da7d2c1056efa0dc14c",
"00000006cb9ab65143832b9cefd5d9ce69ec4db2edd067aa",
"d08b95d9a4ce724ec462cce12701fd8c3d53fdcd",
"0000000026a770d86e1c89ba7a86aef649ba7ea86fc7d5b2",
"00000001db1020e0f764df54a53c23c938cec98d9a77ad1d",
"00f69dcb547119fc9b8c454335aab184c3ada5f1c6" },
{ NID_sect163r2,
"000000079b6d14c743271402d1323603215feb3c68b14455",
"00000004e3905686a538c25a02bea92f42184021b5ea2593",
"00000003808efe6ad50d250d87192e16499ce3259428f3b8",
"0000000013a02e25fc927875afa557bd673f65870459e671",
"00000004038dbae5c5e54084708a24bc3fd072e769c12377",
"01bc5ee5261b2bba55b10cbaa6cc3c97b98d00ffea" },
{ NID_sect163r2,
"0000000772f42d272a057de0ff926c9f94605c6675d21526",
"0000000602e7e53255de9bf58c057eefb79bce431b5c3808",
"00000002ad232a7a41e6cc2495538d87b023cdec7b6e1f23",
"0000000549e30780d93f796fdcf691905575d85c66453bdb",
"00000002162a885bea31344543f5d06191369dec6e70e967",
"008574d838d3de87965fc1b4343fe4f078588c4ea1" },
{ NID_sect163r2,
"000000050b2429460971739a9d6d5670bc6d759e5656768b",
"0000000492bc2d3f638d4978e4ca58ca5a4ef19c5eccea8d",
"dc99b19f3d8847875190e9588b2bbd830dbd3a95",
"00000000f65d984d71dcc18bf172abe4d3993ce0f7cf324c",
"000000001b49e6a2cf1173aadac3af6c09e966f31141abd9",
"04579b477a92ed961cfdb2014407e88e7716452a4b" },
{ NID_sect163r2,
"000000017d52116f0c95587f1b7b06c76e98d99c82dcf20c",
"000000024ea22bdd990bd79e63e735b21282ae1b5ea66648",
"0000000356ab85b04d0851b8f66b4a796526d3f3e3882844",
"0000000776a2e1af932d74519070bfa941eaa93e9ff5e97a",
"00000005abe9ed46245fd0146250d2a563c46ebf7acd2342",
"035a8c10e64403c52ef8d17c5f4dead0df81fb1f21" },
{ NID_sect163r2,
"00000003a7ea10ba1d6aa545700b40b737951a9e736dfa0c",
"00000004f9352fb2ac2444e928754e3655fd62e3a42564e8",
"7a7b547550c758a9de7f06e2f38e55f5e9e44ce6",
"000000045952c0b517e685cab09470327f9d4b212751b049",
"000000044a429a6efb04bcea0240ab5805de740aa61f994e",
"000142615e3607ac148c4de8f334be849235d01cdb" },
{ NID_sect233r1,
"0000004756baddefc3dc337ab27b5452eb10affd9e31f5b55c330e90f0f686a2",
"0000012a79f65232308a21c98c01555ccafc7dce15c8fed3025a760cbd6c2327",
"0000003c3ee474ac0d0bc1df567e3c35f5f766c5332b2d6730ff0e4d8e75aedb",
"00000061e8a9b517fd05a026ec376616229fd8639a1fa76defe5398022f9d9c8",
"000000706b5cb08738a94552fee584b1372fead4af79040909fcf6f50084bbfa",
"00e9f3d8c4f1bec0f920e763ea1bb7415899f01734609e7547dc425ec946" },
{ NID_sect233r1,
"000001186a028f9a18db927f63253c203eb26aa3aba0d40b1a3abc64e47a22ad",
"000000cbd8b95f89e421128bc73a43c5cc254e3867096ab89d788b2ed3b90a96",
"000000aa41a5a01a4e66a67997b0be16f56b160b0561ad07f3af2964386461d0",
"0000002d91402446557068c40fc075dee93916b0f1a9392e47e56b747125ae1f",
"0000013ab0915e4acf779516826fa1dc1885a06abc5d0809c92240ccf9c3d8a4",
"00f1fbecfadb158d62eb1109c085124fad67a8795b58815eb396c95db4b9" },
{ NID_sect233r1,
"00000093bf85621602238e98d09c98828d51a49460362c23c5141d3d1b235296",
"0000008497152187a8b3b2958a1d0a2eecff4492251807cbfd03d5f2685bca37",
"000000c6677c28068b462e34862ce6c9d8ad8c1b3c7efe80cbab41da419278e4",
"00000042cb311dcff2482a2cece696c1eb64c69ac2aa599209a5c18763a3150a",
"000001b0329f36c135d002f08be3e3ffa9da18c5d6a70c360f4f871f12bf3f95",
"019ea831c51d88a7cf754495a1c474082ed481c8eb83190a77defb09d479" },
{ NID_sect233r1,
"0000004549648692af95d88e4e1d4914d8c9769aadac5a0f75783265f3eb9657",
"000001b094b4802f397663d0e682fabf1c94c4e214e48327b95eefcb92b771fd",
"0000009c61024b3dff219b37f1be6701804adf247414448dd0f0dc51293ac913",
"000000124120d8409850e71e33c9e2d9c40ea32bed11d77804786e9b076892ab",
"0000006dae1ba4817296ff63073bac9ce065d4331ba1a5c899cc1c07405dae3e",
"00088425fb04c2ce408f08d81385a322703a077bf00ba0791e4e79b80419" },
{ NID_sect233r1,
"00000073c5cf4a01d09e3b41b5e7778c6b9ba52daf88fc404f8e2fd09db4027e",
"00000070391edaa76f0e3970394cac0338061058858c3c73d5cb512e5326304f",
"0000006e69d064dbd9a794f68e699a0e941bdda6a53a1ceca3b3db82925b6f8b",
"000000c57d61fcb1fee90d5d8c97cbf188c8ef8259b0ae2587ecf1ff8cd2e2fa",
"000000b8ad86c6805a4ab44513dbba2f5098b9e9c1e05b679f52937aece2b182",
"019b5efb23bc18a4f18c22fe2fd5cdbd02372cabde5e5c9f4b4f9a49438f" },
{ NID_sect233r1,
"00000123a6b081a761e86c042e1914af47f093b2655543e564584b60642539a9",
"000000518ee3c1ae546404df1eccd69aa6856431d1c8881cf0578cff4eb8c11b",
"0000005ae5de30c7c3171813a2dd3e3ea2c5ceaa0473c39457e9929071e1a420",
"0000017cf9fca05d4a55e4b68fee7a3bd43f047303f2a266d81bb5e1ec7e2558",
"0000003b0af43de05003397de1d4b27827ad2fcd675cbf61a445a1ec40a569b6",
"01f36d9519c3d47f030eeac3338db583b96fefa551a4b56cc5567f2d9d7a" },
{ NID_sect233r1,
"00000141fbbf2b361c2c8ce5edabfa22aa4755581e5b1a66600362a0ee7bc574",
"000001aea3cac203f8c780475a2609b2970cc86f96ea4011c348da8262b334aa",
"000000c68796955b68b5f8827e38ac0782b1ac2c4552caef0c60958467cd85c1",
"00000034789fbc60f1086034c8f2ce86fd4aa335194c9146890357dc475699e4",
"000001d37f796327f71ec31510468463d0b2905488a4a60267870dfee567c250",
"00e54b1c916ff3ba1aa0b2b99f0ebde4f1a4cc6a10d959bb2f7f4c777b84" },
{ NID_sect233r1,
"00000096a0d3f36e8f753791074cea697b2471627e0c9e7a294a029a9d3b9429",
"000000b767174a2920b62f1f02fa79097845d51d93e0c8104410831a2dd55c3c",
"00000074245cc97dd450935689ea3fca7b0b30c1d67ce6e8be17cb1192575caf",
"000001e1c570acc653c706fd7740194a554de7f3799a12b820d6a941197f761d",
"000001e2225e8d0d41c808f6ead7af320fb25fed29a99098a0f0e11cd869e53c",
"00bc0dcf7585753cc79aa412d2740b4b2d1c644fc9755cb0550286bcf68e" },
{ NID_sect233r1,
"00000166be2426b3bf8e6d05a24d7d1f2c0e329e4120cfc8e6ff52486f095586",
"0000007371e288145fc25a5a9cb5f2a386034f2f328c6eaa24c8b096e8ab1f0c",
"00000097beed4b738a6205cc9ea046b448b523128b93101a02d964435eb17806",
"0000018358da94079a700a10b20a2325d33d80e95eb4fc4a98101c312635939c",
"0000000c4f442d0071c7bd1d217cf235fd031dec309e85ea2014e68b50fc2ba0",
"01b7ef3148be331115321b1c2a68832fdfb991b26224a60dddce3e060d27" },
{ NID_sect233r1,
"00000181f3bb0b097713277c5f3b46cef02aa9cbe29ab95c76e9b60a1f7a51e5",
"0000002e2fb672d72bf78f7cfedc40d3726c6b4fb585417c7476b655e32bbd3b",
"000000759c55da55e1fdb5ba7f8b893abaae5925b9b08184a3d554957acf3ec0",
"0000002af25f810e18a81b69da254a65b8a6c7ab80ddc27c85622e2348add132",
"00000128b753e4b21a8c3acf85aab92a9aa6a7b33f2cb69d7024baf8e8b07142",
"0041249865c913b287a253150b207e2682efd96057cb0709e9bbb48c0fc9" },
{ NID_sect233r1,
"00000065aa4115e59e6045aaf99ee1beca1fab923bbdc919206e0931620ba996",
"00000128d00b775899a58a59bcb2ab79d609e2dcda98e6523bb67168554f84e6",
"000000ee639d89f0e433c075e2ef57cc243581e95b261f8a93b8ef6f5ebf8015",
"00000006638f6bcd85043395d01d767ff77e9d677f37ef400f2e16fee86dbaf2",
"0000006c12496266debb1d8343b9684e27c5f7129c17024a8e6704672a5f3d63",
"01cf480fbc2be2c2c4448c88890972c7ff9cbe08a75e26c3809596b8b5c0" },
{ NID_sect233r1,
"0000013576e700f36367fb741842f231889f36822aab2933c245eed57b9dacad",
"0000017910e9071a3e42e7f21b363f0e687d289810a4ec29c36ece14854e1dd1",
"000000929b09b67b29aa4ff15d6779a1733065049faeb2c227012c49f277ed51",
"000000ca0403d95d85f0cb0ae4d2aeae18e187b79c201ed68c14ad24ed003922",
"000000cf6b0a502b290d0aeee820661accf6ea597687c45c7f93a773d25f62a6",
"01ce8abf3c8ccfa30e5f35ddb75f5e106aab1e67086156a1ededa1717b77" },
{ NID_sect233r1,
"000000e9fba71a64abb177fa436cb9739c9f68c0155adc897139c1bf3df99a53",
"0000019af1131be47de08870835da14946fed73034179f809298d0149b16dd36",
"000000e27af04efe2d86ffed6ecdf718fc0b8e049ed222e7600c3ce31ce4e97a",
"00000145ec0db5fe62b92547792012268af21ba928a8fd98d0a1dee3d8fb2559",
"0000010a031cea56b183e93093008ab705cc9099e5b65c5cb4407324b96fee90",
"0025df759a20312361b9f6767efe8e8d69979e34639469a91fed9fce04f8" },
{ NID_sect233r1,
"0000011f994a416cc1990b8c61767a3d68fbea73af7b48b655e47470fccc791f",
"0000015de988835d6812f0bdd7007a895971e1a06f4d22ce1303c9f55efe647c",
"0000001a726d7b9928691eb0149ca8f0edee47bd0c734113ab6003241ee193de",
"0000007426bfa8878fe59b16a9b8c63910a1e2fbc6b07ba995ba04c31402112e",
"000000944e9616676cb2fc7fa0f9e1b87a358748243e80fb62264284645a6a4d",
"00437ab4a53756ff678a1f580c0fd1f33b23021d62060808453b4aabe627" },
{ NID_sect233r1,
"0000010513620aee0d0478872438e99b23ea4900153f9366eb17d61bdf35aa19",
"000001136dfbc8401bbda0d675ca06a0cff6bdd467c0ac9a978293300728e7dc",
"000000f459c7672169c1259e4e199333964c1fffbce75ad30dde1264f5cb86d1",
"000001b44a81895d2105fa16a6e09526c09ae7f6cbdbce210870f4e33db8b6f4",
"000000b1e072c62a2642975f06c687c6467da295ef93f04d1c5494a624683c80",
"01ebd55823c57d1fc7b36cf1ed2051ead64db6d114014d3407186f50d957" },
{ NID_sect233r1,
"00000035dffec9117ed7167627a24a3ebddd49a3f45d91ad18401d3d449b2fef",
"000001931754ce5cf557a1c1acedfe5e9a7b0b91f81643da8586a6865885f042",
"000000656a47b8772b08b1d907c823fb6c45c65f9f18f8b43f3a61e6c74611e1",
"00000153cdbad92eb8d20da0c1c7aad46d08336cbc976e8d6f83947e4f4d6616",
"000001c977b97a5e1205ca66545df3a526b6e325e087c0e070839fe7ec1ee788",
"006d07f6e08b11a060ccec43b07ca7d9eaf6c3ece06f4785519284bf6f0a" },
{ NID_sect233r1,
"0000004845ce661b1eae34c1699f1bfe38dc87ef28b8b0a7771ff366dc21d863",
"000001096b1954b06eaa7073ed939801aa2974da1d60d66e97c31df0f6876faf",
"000000f14f5ec4efaf86e43fece65f17ff91b1a8d61be3416eeeb884f4e2d14e",
"000001d9f8c01e9c20f6150ec7620a75e39e96f9247bece137b0365bec54254c",
"0000006008373b9e087805294dadae00894667fdb9f6b8a4d16295e5b9d21a6d",
"00aea594f092b4052f7564b2e5651bcf43ef7e336a064d6bfb1a89cf5e51" },
{ NID_sect233r1,
"0000014734192165c96fbdb794cab1e2d1ef111e1a20a7205db01aa803a032a2",
"000001ecdfc3940b7d0618cd6315441751f663df74d356492ef934b4ba2b2ad1",
"0000001fa5cbd88a146f6ccf5f79dfbc70868fd9bb4c8115976c96270ff7bc5e",
"0000014d276f4281cb50a26b29ec81fced96d0e909994b2285433855256d58db",
"000000ac4792af62a0dc4fd4eec384fbf3fbb82c8347486bc1eb1338bc7f3ab0",
"0099d6d076e14ccfee15ed7e7ef384bfee12deba8c9ae8f6cca3486a1494" },
{ NID_sect233r1,
"0000007e1f3251e2a0aa6de1f8df86b85ed9d11da5eb7136add45ea7d25c867c",
"000000d96281e0756de9daa55d2ef6573bb2fe2dd09b71d91191a5a043bae0f3",
"000000f58684ea14a68fefb8cc26b267a13419c62d7261bad14e5368a9819a18",
"0000009a65a85394070fe0e5a108164eb289cc3d77ed0848fd57f384e62caa20",
"000000e7f56f2c27be4faeb20e274c2604c6dc2d88597030ad2164fad03cb904",
"01b1e977c43afd203132c085b95db0e2046a4b6ac2c046ee9ad665050578" },
{ NID_sect233r1,
"000000be1ee750f2712b2acb20c45e97357c50db3be895b33f830c71bc9f4f3d",
"0000015fec810cdb179fcd1ce8e4dc1a2499e40de8a4a49a9420f00e56110cf4",
"000000eefb24789b32b436ce39622c114c39a6cd1e58ec9443c8870e5ee2f801",
"0000013fb1ca9ed709bb386fba02cc7862fd6c64e1087be5f61ea733946c1634",
"000001cb4097e44a730700debfe8143fbf9bca3a3d6c46985a27cd5043b2ca5a",
"000e4cb704355cba1b40cee3da102cb048519a91b4c789b3757cfdd933aa" },
{ NID_sect233r1,
"0000015c2e2ce0bc722cea4cbc7c3352cbe0d28b5b002e44d93705895d791afc",
"0000014f616983ad08e745315c4767b0ae21a6fd8a629c258ce7aefa4c17a8e0",
"00000017524d506616bd205cb3978bc75e3a3476233e49b6dc206f9711697557",
"00000150a17327845e7bc79d8ece12930dc2b77654caa1082b57b0cf8e05b1ac",
"000000151c76822d8df5effd8c6943395b6a8d538431d42e846e9ff8de7eaee6",
"00d8c13bc5e819c6101daef3f6fb5be6bccecf233c4b7fc65054e8e8d3bc" },
{ NID_sect233r1,
"000000bafa9bba92725eef0c4a0afcbd4263e55f5155645b5c58a96bc3e9e965",
"000000d1b3d0e35d617e09e078c571a5f41ea22dfd112d67a94d8dfbba66e9a9",
"000000a6b05d30a703f1179a80f8a864b34ca15c453e82808a1095e435e9bacb",
"00000093b3252251fd9d6d9c81d78cf1f134cdd554d63c2a1e2f1afa14e2d4e4",
"0000008aeb0a8ab3ff5e4fb023f7e1917f0108890af11abca7da027fadacc3b4",
"0129af50fa085133771753f297a313bba0d2f5882e7634b7ef5adce760ff" },
{ NID_sect233r1,
"000000798bf5ab761bb6acfed0cef1cd71b3ef46f2504323cafc4081592dd6f6",
"0000016277aeb3e1cac0121b07d9378a3a0cbc6567b48423929e36dc855e9d1a",
"000000168d09809eb9f6acf31134eb5eb1af966e212b9b6be68cfd22401425e9",
"000001710a05f02b5505729516b1ac73d45f3cf08f1c5134d2f73d12570243c9",
"0000018611b10dab507583f2be10fd4296f537d4af09576f96979f1eadfe291c",
"0077c4ea1095fadc4cb4190a3fd530c7d15325e5d79b8e8a2b708e2344cf" },
{ NID_sect233r1,
"0000015f723da9a38c2da5062c17d0b837522f7c69c793f79c17fb6965d44a03",
"00000132b17760ac2e2bb9f813ed7790c5cd3aa0d38ab64e2e272ddf4a4c2c1a",
"0000003824f71ec3255bbd03642d782cc6794e1e54aa8fa5f2a331ee13f78450",
"000001a4e35a8c32717f2aaa3eeef177848e580e0fed6c8096868f6acc4e1c09",
"0000013727604e81d3a9d93d243fe79e2db8a442334a8ea1852b9f83cae1bc3e",
"00d9eb3c79cf442595dad03ed4a38daf358b97d5dfc01cb61ff200a47958" },
{ NID_sect233r1,
"00000051b70bb8b8e2341b86821d54b974b696bda443acb7ea65965d27d2ac70",
"000000c7784eef889c471c9d26b3e0de24ad2b4bf8bbba6fe18f51a412188058",
"00000090adc0b207dae381622cf92e04bce7479180ec6e1771662f5c3179bd99",
"00000106adbf9bbfdb3083598a7f6db2e91d2e7c174f705fc216631b7d05edf2",
"00000190d84ca6f4695fdbca40d26a74998a05c3d761dbf08981b645c0ea239e",
"0124c19cffc0b9549bfa378a548e8ce11ee7fca28d2d898de49ae1f2ff61" },
{ NID_sect283r1,
"02504e1a17819d39f010a4a69a0568299402b58f944a384c7d1a62c9c93ea4d1"
"ff300e13",
"0265132f7b4c64b74b9179ed0f2e211f4328d625405022f554170da932b80fdf"
"7c1aab12",
"02f43455842246a2cc8ec068e9d6c6e4160f6ba4e3b5d831d93c1daa8fd3d5a9"
"660c7bb1",
"0561e495563018169804d4c8e2435b4afd85da376d914b69d39246f8e06113aa"
"32e642d2",
"0781a7f59de7f42f5f9d6c3481f33fc5deb357c6ecf4c758e370d2435de3d8ee"
"737703f4",
"065194e26090e74047ee75f13f9769d20e1b52189650011e283daa090732cc53"
"755dc366" },
{ NID_sect283r1,
"01623a9675e8c40366e26131e47b1af06c8b33acf5e92f54644816dcb844382c"
"944cc21f",
"029d280f4d4c0c5fd70f7e24095950128bea3cae3ca46f6a5f70b739fe1a9902"
"68804e38",
"02b941e692e0a984c5ffa883c9f9f8256a43ab1fd1ad9782a42e429a94e910e4"
"82b91c23",
"07b90af116b737d9008e4c18f6ad539d29ee1790008a1daf2e856fa672eca4aa"
"fc96ca63",
"06aaf78d0f20657b77b97cca30eab79b679a3aaa90b10907f979cde988ce7184"
"91010c2a",
"075c535cc70de19c92d7314afa2f33200903431f6990ad40ac31dadaf4e492a7"
"99b75b05" },
{ NID_sect283r1,
"07b8369728432f7528d3eec8a6788e69cd2eb88162c47512742ee0f027ccb415"
"7a28a223",
"05986eb7f109aa1f8556eba2bdc88e4913b65effb944eae639636cba7e01dc37"
"18bcb361",
"0287de172ba50f327bfc7d5a8c0156d25a1f0b9f71d389852f2e3b587406cb74"
"ef3bd041",
"00a03490765fc90c23553c0e2b79dfa232b51a73f21554e5eb18da4c994d925f"
"8ed2bbef",
"0304ffd41c5b0ab2a70b82188e8f1578d6ab7d3ce3ce34fa45dcc32207f163e9"
"1c5d6814",
"02956f63d48a49a330e2068955cc2886dbfd5bf72a81b10ed83f2d758dd315ec"
"a172927d" },
{ NID_sect283r1,
"073b092a2a4d7c9a17bb88e75b40a9e4e43b99813cf61682d49b92905c2dd606"
"790aed39",
"0566ad452a2d8ef0a327ce8e2856146fecaf09e4431ccc04256a077f60701ce4"
"476b6dac",
"0153bbb8a3ce4a1b99960f56186ab50207f588f30c94beef28408423ba44fc87"
"5faf38d8",
"04f2c2454899623af13b65820aba145738407f77186abafa52d24b35bfdf5808"
"ffeae076",
"0111f448460ad2430aaec788de291548475a1e5836dac520d8e493c9f601275e"
"70ea29d2",
"068a3f6938c44b797524377508585842c6a7f1af5ffe9131dd3ff786ae56e173"
"9345d3d7" },
{ NID_sect283r1,
"0455e87bc230ce7fc586312dd207c529e47e3c74cc0ce5d073fbf4b1c957f8cb"
"bd9113bc",
"021ffbf62fb2531db39ef2d0bdce0d9c141c92e9cdca627caa39b593fc4a0210"
"e8ee481f",
"032ac0dcb9aa3972401f9f58845ed765da36b7d6f77355779bfb2439827ff355"
"6a75781c",
"07159c86b9c6adb2160c28d86118f84564a90c149ede28329463677a4c87729f"
"897c2f98",
"008a78167e1690625992b0efc2e0ef6f6d61e81837c8ecdfdab51d15340e37e7"
"d8d05120",
"019b48d5eeaeb05b58801ae8f345ad9bacb91daac885e506949b849ebc67bcbf"
"a308aab7" },
{ NID_sect283r1,
"0652ccc8921f439af42a2301236b5843a42f1fd99ecfe1b4134c3de014cdc760"
"35347cc0",
"03341d80749f1a5ec9f7ac6252384fefd38b6f2bbcdc18febe86c160f5e78c00"
"3f066e06",
"02689bf21475d32fe71a7355efd9a7787caa9545ebeb853e5184ce4215242905"
"1f40cbc4",
"00d7e5bcfac578fcd728180645176d7e088b68d330a209f18b968662fed16342"
"b3921a20",
"06f750b3b5e98e0099b695965aa1d16475d1074f9231127ed703e2696d4b56af"
"debbceaa",
"061b3bef1766460f6296ed47d39ebf5a710d202d2b7e7cac0f0d3b235405eece"
"99aa30d7" },
{ NID_sect283r1,
"062331b933afb4384fa3a4d224551ae8120bc55fc7ea73f2be749e217afc4e1b"
"a79e760f",
"02bf51c44f8361c3054cad640f92446fe3820b063cf4bb22ca17c0a274fd46f5"
"0504fbec",
"01052042988dddf470d0a2e36fff5b93ec69f4d240a8e37c064cc4d599467ba2"
"7af3c9f1",
"00c7c9ff77e018b8801bddf886702556b126a6d9a1831a1f60f35872e524c134"
"d553e4a4",
"0035d767b58b499d9fb54562c3830411af59e7088a4a3333d5dc7fe5b0f7f1e1"
"c5e3ac2b",
"055d579458860a3dd92ac6570847632f04460755c22a4c432cf4dde9611d2ce1"
"608ca185" },
{ NID_sect283r1,
"021e82d6af6d321198176ff8986c2bc786a0081326cc85f026b71b32ac06c0ba"
"e6b4cba2",
"01e9733fa9d29961269420db24edc0d5ae285d78c9ae14b38b1019f13652f190"
"277dc47f",
"03bb9ad5fa552d38d1a77cb553c631e2d0940db6b04f0bd7011ea735be50d045"
"da9a9c1d",
"0687071805c25a7d0b1739f7cf681b2f295c4f9d8937351d21d1d43f634e9a57"
"105bf127",
"0633ba21872e379c50e448372b1c0e65e85d07edd712d7dc06fa69a299f6037d"
"ece660dc",
"054fa7c6c84fb89e5892d9194540860ea31ae2b6e37a86971344230ea512a3f6"
"c0569216" },
{ NID_sect283r1,
"045d62d01db5ef173d0cff315a92a9a105d1ad784ff9b08e721f3580e06265ff"
"538a194b",
"06b764c1ff76985496b94451b756c4f30fdfc638d8990312bbeccbfbd73e8c5a"
"855adb75",
"0133aa445dc80d7d5a097d1da11d510e6571a783b4fb235402717d68ba8fd145"
"4e6b319f",
"02d26e46a6ed9fcf1d2f89c63d80e0172dedb4f5aeddff092836aac859909488"
"5557ead9",
"07d6713974701c160aedec8f94e6446bf7d3c790cbff8702cc7840a7818e5b62"
"6271f723",
"0353ff03afda3772984aadc4000e1275656607154b06c3a59c664945fa6fde1c"
"255ffa86" },
{ NID_sect283r1,
"04a561b5184aded9c7bd9868f3043b5e2de51908f9c03d5e6b08a3088bcc50ee"
"3203e263",
"05815b579ff5dec6fac977ba7088b333bf4c0231da021874ee00d71fe25d3f4d"
"50a57ac3",
"004661f107a9b570045ddbb0738ab69b1c17a9acc11da5dac7fd864b3dfc36a2"
"5282d6aa",
"061babbefee5211c4917506ce5f9f9e3d1e52b2506f38ca096e1b653ca9fb69f"
"46105702",
"0014bfd2ef228b5a03e26230c1e897ad081a704013cee55166ca46de395fc52f"
"5d21203a",
"050795ba093d2e02398c358951f20c9e3b4f60628a96a4d0c46cb8fc0005e533"
"1b38a09a" },
{ NID_sect283r1,
"01d7d7536cd8383e1c0b1b8aae02baa9fd2c4e68b21808c1754d0b151361157f"
"81245930",
"073034da416797da95a3836eef27b1fa271f59a434848e980bad2fdd53ffd1e3"
"66ff6917",
"0036bd21f84ab9db6f4bddc94635f19f80acb2813da5399e0777832c2febdc71"
"862abe33",
"068ee3245754d51df7780046af39acb407c4998c620bff94fb374faf4b498006"
"eea0cf88",
"0366a449f09ecfbaecc49d880307f57246c11c5bea00af42718677a8def15e59"
"26da1822",
"02ab08d63cdb4be2502558e67eab27570f2d029e7f981d153b973080585d01e4"
"2f7187d9" },
{ NID_sect283r1,
"02042f5a3fe5e3d3335bb7bcdb9dcbd8716ed18d7fc2ff4297bc1feb7cca3100"
"22e2213d",
"07bebb6c0e046d5afdbfa87ea98ca7f55e9cdbb055d0cc549b4458d6998bdbb3"
"45177388",
"016597ae6e49e79d069034972a63525a3c3e2d2c253b9e1dd3f37816812cf54a"
"d65c546a",
"050ea073522dbe51408f85f0a6086bd4c8efe572f80aadadd7e70ebb4b728bfd"
"bfd4f1bc",
"07da520017c7ad2916a2719b8558958f77c712d352cff9c0ad99fbc98a0e065e"
"b7ac7feb",
"0599757e3ffeb484b32d3b47828b6823d46786d35477082ceacf3a5a11552394"
"fe58f53b" },
{ NID_sect283r1,
"067afdf788f8f4831c3c7d7604d07a5bdc59da42d932731faf5eaf0753280966"
"ab693790",
"001b39d1d872b65e31251c1f584e4fe3ed75d53ad90e836fe90c8db94fe77cef"
"0bca7204",
"015ea8567c7b82b483fa365e8e681c0a635f563a1c81470b4dfe44f194fa91eb"
"7842181e",
"07afe2b22b54fe895c242c20c054989fa804e591970dda8a7ce109d6bd31b6da"
"a8f2fc74",
"060733bd5a4ea9b5ea7090acfee918106b7f25272f3f7cb36eda38bacd213756"
"10cde928",
"005e331af55e96153d8a7b906a4a19016a26381977b49f80b9d70db099053c6a"
"3b8e80d5" },
{ NID_sect283r1,
"018866a4fa2f7c2534e563a291de871a8b3052a674f5dbc23b9dea0e8cefda06"
"abc32c8f",
"058dc4cf1bf985d1b566970847cba6b8a4f40c7e62a5808b0720bbb8cdf3b453"
"1e380be7",
"002911d938d9508aeccb9877e127d1b1461acdaed035f20e0f744c774f1c7270"
"3b5c4b49",
"0386bfdfe60373be114b417c4dceb443223fde67c0fef29ed0f867b5a15f5ea0"
"ccb4dcca",
"02fac38ec8494cf7576233ec8282de384b67f0ca8048084201039d194c8bda4f"
"6e0aff3e",
"07e132ea71a16c7cc261b9d6ff6fc52cc490da616b07d92f9e591fc1e630d344"
"2572338f" },
{ NID_sect283r1,
"000571d7bef056089172f13423a585ab979f4b8f77e752c042c0c65263b47698"
"1e5f3157",
"044bca693e9d3b1a7fa6ad42db7f36b1a65712d09ef3bb715e2640a182f43662"
"0686c0a4",
"01662f554856c0208a31b195148f828e0b5c92a4ea4c033248bebf957b586b40"
"9ed59850",
"07055264c3de3a622d26fe7ad700bdea045d4b3ce718f4e6ae44cf376c3a96a2"
"650b3221",
"00f45cc1138668adc8150d37c072bb4245660c18785683c7b17aa1fb8591ba6c"
"da23657a",
"010f26817098ce1bbd6743784d6fb65e60699c14933a2c8d854027aa58b58db9"
"e66a53a7" },
{ NID_sect283r1,
"016eb4bbb3c386e0f42fb037bee478c4c0dbfbe55cc68e33fdb029b9e5e724af"
"f4fd8bf6",
"0251432f84568a44971e86ab715d3879e614e10725735ef8fb6652d079c7908f"
"11bd1f01",
"012c0100a9963ee17d7acf4ddf8e02d8ae75f3b99114f5366afb4a00ade9a3c0"
"ee39a887",
"07794fa19c6b10d399e0f52d36f483c7851848e62bacf95b5af51eca09ad445e"
"e19ef34d",
"06140d2ee16cd0a6cb1960509a7ccc664be97644a95ae16f4a173d9a867015f0"
"837f0560",
"00bdd8ccd1b40c5bc2efc1c105999350fefaf784710914ff639582f127767869"
"9491140c" },
{ NID_sect283r1,
"02417c65694d850c7c866f7e11639a5f8718ca9aabb392fa8610e2d5d7dda337"
"5a607f9b",
"05133938dc99144d16ea7525c3fe4e32e320ed075b96527e13b2a99c9f27ade9"
"ef9edcb6",
"0345c276b05ece9e7c86811f8c8af48b22db41d4066275009611b880d7d2cef3"
"29c50e82",
"007afffcfa31c110aab3bb394530a41c416af566bfba8f159f984437e799ddda"
"af8cdfd2",
"065fb3c68446a74068bab7e36ab80e984707e39a4a143f5a46d646342f9f12f2"
"6a32291b",
"014a83e747c90aec6101c0a752d92eef7475b00051ecad3d7c2e50cf4eba1ef3"
"c80b8c94" },
{ NID_sect283r1,
"00c5d6149f87174ba37f4c1c6f67f6905abb319f526b7aa1be1dd205df930ab1"
"c91bb1f8",
"00c2e21e1206cd4bb5b622abe97ca3f252cbc68d054a77f8ebabad593fb18633"
"06928bf7",
"03afd5affa346b5259697d9217952afcd03ddfec04631bd995c10ac2583b0ca8"
"d2461f5d",
"06b4c2c3615b266543de189c896cff77b5557c782c215961ac7324185fc9a810"
"98f2ebea",
"047fef1960739ae0aee39a3ffdb82e890d4236fc22dad395d490bc3a5eea58e8"
"cd03edbb",
"00afd29e352779a39021536ea50c24fa264c599f8f8fe8f2ccf0615a6547a064"
"d7c1a150" },
{ NID_sect283r1,
"0173044e5be63997d7925e431bbf004cf0f0ba85aa295a341e8f5857a120be89"
"d77653e9",
"0737cc049690f970824a7b0c2022439682c9d82f4f23e48e5f07fea96267ca3b"
"d4d730a5",
"03d5771f8485c3b8be62a56f3936513e3b631a561a942613df95140f473214df"
"617c4c4e",
"05906cc4529b220228efbb0545bf55ec03c86f87e2f4e3a3cbf404e07b73a5b1"
"a5f528cd",
"016588e480c4856cd2ee9aaf1e302812fbc0b33f527c29b77ce0f4878ea089d0"
"25a440c0",
"0477990f17d65589289c28e54a56a83bc05ef4ea6863c5ebe840925c9fbef64c"
"cd6e69a4" },
{ NID_sect283r1,
"068587e69deddf4b55ac51f2a17dd8bfd6f94e721003214215bfb24b248281e7"
"5a3c6594",
"044eee9c702bc4c1e210c7cc214524592568ac0f9fd67d6ea02b4dc3efb42cfb"
"b2263dac",
"00e2c0c602fb132399ee9f31008365ea22cc1260f79fe3ae61089b8a6fa4559c"
"ac91aec8",
"06e6e318c0c4c0b661dfd3e722090ecd32fdc9ca3d168d9c7174c1d40adbb2ce"
"672d9252",
"040bdc1dbc7b163f7c9551f47daa8294ac2dc4fe0d472c4e2f2cfefc95d523ff"
"59e0e880",
"067a661346fe052ca27f3f03e75bbdfc8fe6d0d85c62c8f79525252aa241ae9d"
"e97d56c3" },
{ NID_sect283r1,
"03f1226d802c575f871a213b8150f7818bbd625663b73e720a737f071896086d"
"a0b14cd9",
"07d1cb0ce19c98a63aaf7b314f1f5720e32887053384ac0f5eb69b6c471a8e3d"
"3d16e76f",
"032d573fdeb85a4da2297896631414518d4ba07dc4dd72f731728890d0b44d36"
"f2309c0e",
"06f6ffea0a87bd9eeb539c48a3fcbf388159862259c7f7840e64809fbedb01a8"
"3812c0c6",
"07c795b8f2847fc39fa56c2de1e6cbbf4945087cb2e3b919dc776b4cc1c83e4b"
"1c79b8ba",
"06476b0620eef165941a4507e6d798d6f150ab29333c0552281b629170d3291b"
"2f9b3f41" },
{ NID_sect283r1,
"02a911e7e6d2fc770d1eabc7df701bb119084a685900d22d52d598fe1d28fc89"
"1b31b487",
"01b8dc6713ca453e91b2ec4e4d1f834b08eebc7e8886c3a458e70925242c4b22"
"bf0b2053",
"00a6aacb5dd3e835814f452d8207d15a533638f70e94f87c06196eff8838d48e"
"ed2e2674",
"02dd0093a8d419831f34bac6c60a570c51d08e699b181c964b667d0d17ed72a4"
"9119acd9",
"01a91976be5d5e037f22350d67ab7bfab51bbc4fa6026d347d28fb4407bccc40"
"dd10a00e",
"0746719f2ad08f8a8d6d6fbf15723f336285ce75d3a2fcbd5a0c54c577517a22"
"bc264161" },
{ NID_sect283r1,
"07541aa51d7302e2bb557c27ec15d7f9c3ae3b76ec2f86cb95e8dead7fa06b57"
"8397f1f1",
"017ea22f6b5474f0f5f0f4ead54172064051538d3e232a530dfca5f2a0dc6774"
"6c8bb1da",
"00112fb2ab56443765676a1e41b3cb91eb1a6790e964ee900cfc9295636ba4c6"
"fa87aad2",
"03f507d99cc2498e2c7f54fb3c9c032f382548e2e3168fa140125a526048568f"
"3bb3e5a1",
"05270df77efc7d6c55f9259bc82273c9b6bdf3676e13c3601b1b3022b962de11"
"29cb3b14",
"03cda4b5f44b5d3dc248310f994419fbcbd665115d1876046652251ad4aeeb1d"
"cf184288" },
{ NID_sect283r1,
"021fb14e52cd4243a520f630229b1dd6961c49bd96f43fa9cae37add84da7ae7"
"2dc3078e",
"00dd638bf9053fad6aa4ff2d330b8a4a20bfe3020f40b9692302d0b0a3c2d877"
"856ec46a",
"03e4f1c4f30e2a8d6fd559f7fe8820e886949de87c01d8eb64c7b40f1548cb61"
"7a926033",
"05e3fc56ec162885c1291e4ae9c19c8eb2bb559eb7ecd5817549b5a2ea3a66d9"
"51880aa6",
"04c004f2ae4db4f748b437bc115e06ea2017a87798298dd6004616fcffdcc7ec"
"2dfd6db9",
"015c892f95768a96ab5a4f9523b7fd466e101f63b88ad8f1fecb3027cd70aa00"
"735dcc90" },
{ NID_sect283r1,
"00d08ed3856abef7d4a62243c92d6e670ceb3af32357fdb9d39c19175a10d1cb"
"ab36ce78",
"05db9fad7fc8afe79c8b9ce48e62ffa0d46b805a9e5821e2761c25c0edba92b1"
"20b063f2",
"00ae7eb3d40354f9f8fed18f2162dee38156cae0535b55370da3638f01668aec"
"f9708be6",
"061e8858e368d9c917f129d932ddc4cca521ff419f1d74230e8aa5b1b3e9ce67"
"f41c4b4c",
"02b0d7fbdc636a3bc34bbdd2a89291b567b0fb2af32383868bd40d4ba4cac988"
"0c2540b8",
"01adf5a96358e18d69fd383b4dc7b20dd646b68a5c9f1417bcf426240ca22b8f"
"32bdf1a4" },
{ NID_sect409r1,
"0146989a50297be373dd665c45455a2ae4c221da5cd424007bd97f9e8e846f96"
"740f3fa58c3c94129671cdd4d7ea650a2aade9d7",
"01b42bffda843946a14ad6080f95b8fc6b7e173528d08ed36fe640aaf85aa00f"
"b5edd5905a38b3c7961b7722b77b8dcb44bb25f5",
"00ace92103ffe262ac17ad42a46d4366f4cb4c580eff3ab1dde6bddfdbb73748"
"11d52b1fa99320b4af5d4e9208c14eb8efa8916c",
"004ebc4d4acf9b404dabc3af3e8cbea8b88b32999d3ecb7f367b12eb3a6280b8"
"40038e22681637a7d16436e014f69616abf72e45",
"009e24109541c8024217e9ab2c963fa9e373640095a6c25a26eefac58e4342c0"
"c85448b2709592a12402fe2b68a793c558ce8cd6",
"01d48a586be9285fa38dd3e70b0330b0ffebd327ceefef88fdc1521ef2fd61cb"
"c9124e03b0c926e70fa56acb3edb54c3c48fab2b" },
{ NID_sect409r1,
"017e9f01b1d6e5702328330d232a1dd3f2c592cc409f6caef0708440837f3597"
"510f111954aa51e5646ccf47eff1f07a4f8ae1cb",
"003714f6ea1fd143ce751e2d85baf54c5523976108ed482fd6ae103743131ca7"
"16026b16a1e496231f991cdc8f6db447f5f95f8e",
"003ff22f7d7c049989a43e0ea3f5d61798159c178aa792d79d1ffebff8db70ee"
"1fde040a4b5f1ed33fb3ff23c44e7c6b21b0623b",
"01d5c9260e73ea36e4deaaa4b8f4541f678066b690771a86f0dadc580fdb8959"
"81e6dd02dd264ed9f9c1763bd54a6052a2d3dba7",
"011a706826365ece28e38b33620bca016d2d9338518dfd6868370476dacb41e3"
"b947465769ebe81b620731673576f77451d0fe14",
"01856c92b46d671d8a7f6cc468efb60a61093d006c95bb931c1fccc336d4a849"
"0fe17fe163c972bac39fe728f24534a0c34d2d21" },
{ NID_sect409r1,
"0183ee355a93cd13aff1756a08e58e2195a826298d43f6d07bb1c382b4e568d0"
"080939260009c6afcbed0f23252e01d6d14c6d8f",
"01b2309b3819c2454a48ad253ac97bce3c79b51f50ed6803cf05464b74a5a1de"
"22113e23c018c5ced9186ddb981c629e2e9db3ee",
"0096de2c3929c4085f9cc1d3778c2dbf3db7f0f77e7ba7bbc4e408c7d65e2c8b"
"88b0755f160badb524e7697c50e60c8d99e56da4",
"019c47d79914c8bdae754ec5ec1e81c8ff329a938e6971eee3c945c4ebf489e1"
"4b15e6135616c898c80b7b06b8af67061c769ab5",
"000088022b4fb0e754ec4fab8cf4fc636255426755fa99b56805c15eac043251"
"55dccbfa4145e161c40f189bdbaa3dd3e0c3d6c9",
"01972e225e08b47512e92c0da9a1bdddb1802be402222cac5788b322e101feeb"
"06b66b2fe726c1cd8aec92e02f37d15f4c97e64d" },
{ NID_sect409r1,
"00e85de9d63e34e5c7bba6ff9b16f4c84d95f11dfe92107b1fbecae98ce6eff3"
"db96d86900bfd22cd423dbce1e5726be8e597933",
"00b7141771f7c816d55ec8c53822d2e7a192fa54a17e5b99b2d90961b54a99fe"
"d53aba4bda1a4074ad3d23f9c911205795b5450b",
"00abd5d61cde31180301c269d52af856baa39b89f5ef45367f5519210c71d77b"
"318d053ec0c2f49bf46de05cabf23c7d2bd7d23f",
"01a7ef3d17c301e8661ba66c1cdee82a9b44d716909e3663b423dc06ef6be4f6"
"16cd179321ce7a572da4bca2e89b768edc8459b3",
"00df743849a20bc3026062b420d3942f18e2d6c5307e6e1955e33b09d5951dc5"
"9b31a2b1d58c233e2c896e2d9ccaa8eeb8e8f113",
"00b6661a866abbf1843dea8f220e360fe7cd7d9e85c316138fd2532a57d7d2a6"
"bfe6e5518019c603a2d0e338ac6a8690093c2883" },
{ NID_sect409r1,
"00ca870acbe4eb3ae65edd95d6944eb090e0e550712be3b1369e473203f52b18"
"38654f7a4342bd8309704fed6933ae9d162ccd7d",
"01796cc286bf3d53ad636977374f8356e45730b7aa43805fb52801f73be3e9b3"
"2808984aaebbed7be5e39e51335b0dff34782948",
"00f323c8ee433c9ba15d3708069834acc4d937be5017e1d182ec76466aba282c"
"73b5e3e96fe106143641402c72c62484ba1f12f2",
"00b74f52520119fc08536cea584220de9b062401e64ff6359305c2e6b0c04a95"
"f77baf53e23c326aee76211495c30b2c150b9275",
"01540588e2fd5688d1b35763908c1f823eeeca8942f6216ce04cef66ed6991df"
"6a22fb74411b13d06513a65b64e62815ee020697",
"010889037c707d90b833d03256ff2e8a5ffce16fb3613486221494a4fee82e74"
"625a93d966c2028d0930115494f9456cec4d2b6d" },
{ NID_sect409r1,
"007eb61dfddfc3c0d083fe2213967986381d9e30e684afdf2bac8f1a362e8c6d"
"6358df95930600427dfc1eb14118fd1239b67b69",
"015ba87f98114cec8b2cb45bba3dcf006b287e07e3bef1da27ce08da9e4f48bd"
"241f59a1f9c93c837884715750f4085f913f4f7a",
"00133da2ba54b36244c8042f0e2da3718e56dbd2848ef427bddb24177f624475"
"b53400afdcb18879e8fe6b4609a4f7bbc2152b13",
"00e3a2f4e63cfbc1ee844745ab3e1e5be573204609aece5e28b8fb8ab8ae0689"
"8467a95a7b59c0898a414abff2703ccbcdc09209",
"010d73c43b630170395104acad6c1a563d3296632332a1481ddc2c31836bd1a3"
"ee1a7364d7f5b8295db95a3745b4bbbeb8095bc2",
"010a8aafbb243fc9466bf381eae173c01be95d88a9c131b07ed54d2f117cd3af"
"4019ffb196ebe8290b1269622f9df26763ffa211" },
{ NID_sect409r1,
"0082f148ec34d1d08b26e79e3772e12d659598b73b6fff0bab1845e9a5b50714"
"49ef2759fed63aa80624b83a6b2e9d739b83f6db",
"0109cea048a720ba749fc522c85af5fe783751c39fe8d0515ba0f0d3dcd19f18"
"c22da3909f02d78735aa11b2feba0f8d330c5703",
"00df7554c0132fd4e4a2b9217875f9924a55cab319b76a7c179cf02229375799"
"96cf94920bafd453e52f5d2fc48001329fbd78c4",
"0160851cff947ce72a118aab4dad4ce2c3ce9bc330ce1d06efad7f630e45bbcf"
"37097d94051d9d310abffa8d96ed22a847cbe693",
"0079a3ddde636bc62af41e6ec0e073fe6462e38ad4b9e3a36ecc8113a2c6394c"
"ed21abdc8ec5969e58e009ea13dbe929a96709ca",
"01e17b8844c4c757553a628d6f4c48f3a337ed2bbb6e4047dbfcfbfd02bb81c6"
"e096f8ccbb7f2e5d10ee9cbcc960e3a99e79bd09" },
{ NID_sect409r1,
"0083ca04df8458e5e6ce6e13b937dab498521d826fb9541234567e995f0683c8"
"0f438516eeff0cf8918a5f8b5262ccdca3997417",
"005f8b3c20e3fe2559efe0e85a12276df922ef0f4257fe703be2529f6effb6f2"
"99a1a251c01e38d43ca6ca576ef1e0beb6c9121e",
"0032735dd7f118d29f9f3cab3a072db8c886d42fa5de7bea65036ed3c8d44a11"
"e8f96f4e1a6f254888cab214305191a26dd1dad1",
"002d39e0f89fb875151ee3b354f8ea159e7fba6f23f8a764d49e07ef43f18d3c"
"f86e1baaae0ad79d4000709a50252f1ce3603135",
"00ce44a9b775b03cf42b310249660794c25e0422b03ad9babaa23610613251fe"
"0e54046e04f9210436dd376003d18f98dfdae189",
"01167edf7a3c50e13be126eb2caf6b5f8f761cc8dba413246423b877df74a3aa"
"3f48144b44cd133ad9f2d05ef97a08f7ca511d7f" },
{ NID_sect409r1,
"01311536a9745b7475e6c2fd724c23d9ea66803a139b47e3ae263b0fb7e42e33"
"16279bbf622ae262531b2e2283ecc1a6127c9b09",
"01d48ccc781f0bdec3130910044b76909a9abd7fcb18407dc42f63912fa26672"
"08003ab2d28102adcfb93ddc053760e53c2daa78",
"00b04f33b68799630d62f44337c77c5a6b6e0f7606b5c87244aa4e7da698cc8f"
"f1d3311b48ee7c9a6812baf9054379aeb61c0c13",
"01c5940c2de2b3735824ae2994c15086fa958750e4d83123af047e9b3c264746"
"c9b5d919da215355d8c28b2808a37d0cc5f2f6a1",
"000abfe6f1510a182eff78dd802e9ba21e668aea5732c732ddfc5df9301f5899"
"f02bae80f8282601ef3eefe414ef2c726fe00258",
"015c0d202bfdee2dfbd4be91625171992e6c6b1a1d06cc1b2b66ed64c9d928bd"
"4f062912900d3f89045c7190f513d3b019a634f5" },
{ NID_sect409r1,
"010c273530f54fe174bbbd5c2771a55a42e64050c3bf2523e6082af476eb0257"
"87696edf6e438dd056b598f5000633c264fd7ba5",
"00443e72da93b0c7825f4223c796826fd1322345ea25adf3df1a2c6958908c0f"
"d9b13e93cc005f4ecb155a2fff7ac54fa8180785",
"00d4ebc31c9a65ee3b1abd9d6e6495780c54e633f5a2a9f61c8408d767d0916d"
"91cb54cfcd937538df92cfc45938e33b77d724f2",
"014dfaaa70518f367cdfca89795a0db374bb7b407a58caac24ba46824dce7850"
"1067d7e0467d30b9e1fdbb0a7eace15fb0c208cf",
"019d62be2b12a17a78f6c9f7e703669765f763c6235fe7af78f25044e99c4b1b"
"90653640b3f0ae481a55d47d1eb17b86c5bada1b",
"007c32383aae80e1111207894c8cc5be66fe538af4a19195742a94a4c3f5c765"
"d9776a56177c485ddb53c038b70478959d374627" },
{ NID_sect409r1,
"013beb8d36d1e7f53d80beea33efc3e0098deaeaa17977da8f9aae9c576e7920"
"e8f6da55a20930ce60fd490b4fb0154d49277d99",
"011dc1d87f352e12bdb41a1b7a1f1e516629ed323c5d5b263ff036f023f0ff5f"
"722d056c24a411f53b347d0786d84f7be879105a",
"0026176aaf98a6433566f1dcc1919e94453e9cbf3c97e069b4a17426449167f6"
"a1089ac16a102a4b3e432a978bfb46255dc43d1a",
"01535fc949b49030308bc0da9793d57088766ac8cf22e8d6c276d8f3f7650f30"
"135e1f6c00300c1344e2f0306ea0e270b09a80af",
"00b8fc3fa61dc22c55501f2a6b2944946d99f7bbfefbec7acf4fb200c1002e32"
"2c39172ec0a2b6ce0807f1e3ebb1ea3400353143",
"01166107ab98db1dbe22c5888a70c992af4faf4623ef593802aedfe433809c53"
"ef4ab0b2dc4dc2546488b356ef3265356055d8f5" },
{ NID_sect409r1,
"01690c74649e92e1c1004f43fd6e4690be595904c56d2acd85a49af0a17d3436"
"8c8768d039ede9c92ad26b26306b5ffdef7bfd19",
"0081275f7e2ff068a6c1b92dd38c034256ed7322b027702994c74f5b818124d3"
"4a190987fd658892fc99e7acb9877bd6fe946919",
"00bf3e7395c72aa84c0960e5c69022ce39067404534473c4c7829424f81f1d44"
"b31f20e2b982e251cf9ffb327a7d834f59d1948a",
"011cbc4ed9036a27effc89ffd55fa1e3ead0fb93bacfa0a78bcafe3914ab1a97"
"860fec1334caaba07243591603e67791aea4bcb7",
"0101074c444627630ad0a5258e24438d71f26ab94d05bb47d1ab97858c4b92c6"
"ff1cb9be66b984fe8e16e44f393e63f9d64281c8",
"007e7a249094eb52bee0115b8bd5545f81bf0b7d66998fe124c9a3dd3c5715d0"
"3b2f973d47c19af5108a2ae005fcca65e61f337d" },
{ NID_sect409r1,
"005c24f4ad9bdcb1460685a22da54dbddd1507ef6de469da4170ce30147579a5"
"4945dbb1bce9f02e470033bb15fc1a70f831e79b",
"017ca932b90a08ca2e3f55c50cc0e13d279d7bc9119c573c3f741410bb7c1cad"
"1076c3ba42aed1ce69d56228b082fb6de0eefb68",
"0096d403b0fa601c9a75aa7de9fe9e11d42efa93d96dd35102da05d3ac807e44"
"194e18e79c8b5be11c5fb39c8bd4e312325afaf2",
"0009833946294d4aeecdb6f7254ca489c0ff13af2dc6e2ca5626835d5dd22241"
"440c37a63690cd11867581ff61b7252d07afb8ff",
"006183fee6f4d6ef5b723c53c96c5c1ecdd84652e379c937878d766f83370500"
"412359c22d4778bdf807b3c84e5b83350910a1a9",
"00b9d8b68642b2729340d8b7c5ed3b3a8913c4a3f6b947473017c0e105bc7edc"
"60daa9b0732772220f93eca4878085f756e3adad" },
{ NID_sect409r1,
"00aabf6aabb3e90f956d7004ffc893c70f8e90cdc31fc0c7a88f16320541d584"
"43af39405d888d9676557cdd394b27dc5449f945",
"0127f26dba06c33f8fb45d955cfdb5cedda93dd8a45db42ee0b9264a054c16a8"
"7bedad45c0d9a0f35bbc6aa7a1295622e83ebe8b",
"0067125ec309ab5dc7ea568f8815a2b30cfac3366bb4f0160d53738ab995ce75"
"681fcd5e492f3a9725b4cf75ba4301a786049342",
"01f1d1aee5fc594ca4a22b81bad707d821bef3253966f5d77956157483961696"
"f4c60476a42b452b89c1ecb3615475ec9c96dc87",
"00755c5ef55889b415cefa0e881a3efc9be86f36c67615423b452eab4cd5611a"
"ef4198ddb31aecb434eeeec12edd05913af19fc4",
"017d60394c7ee64ba73db91484713370daa821255807349c237e5849411bf0ba"
"b3a1b353be3cd07eeddc5c2ffc74336225dae6f7" },
{ NID_sect409r1,
"001f4ffbf22f67c1591b0a770e563c0aba66fe01561c5e227e522b5dde23c748"
"cacf8f4a02290de26b47767d388a5c836d3eff4b",
"002d273f2e8516e508388f8ed2015ec9fe67c66f832cf2b261dfad5856128042"
"fb4a61a91a37b341de4296d4bf63bf67a3458a74",
"006b2cc2387f69afd43978b7f66bd17666257081ba4d66ee6a9a82b7c87c4ac5"
"f0eba6bc2d981ca1da9ff202ba72cb7fe9c06cf0",
"0086a44d6ee4e8c50d1e10d7d1d113a9610750210679e0e4cab8c62267842938"
"ad5d933c980eef9d4644791bbfd35bbac649d213",
"011da63212631605fea0e93f5826b1929b2bd1db950615fcb05eb47bd9cb69ea"
"e03b1c33d7a9e47b335a40498238fedb8999b04d",
"00b19e052edd44421ee2f5ba845911fed9183d885da85d51dc819ca565ce574f"
"7db257509876377b40c5a08349019563b60e13e9" },
{ NID_sect409r1,
"01b0833eb3440450e3fa5148c25c2df2e0020626f2407422217e4ecb8bd8a751"
"a72bab2ec5642ae90fd29d8c4d79e9cc191b5ba5",
"0023078905b6a33009ffea1a1977db943579afbeb871970059696b29ef90dd84"
"61776b343a09c853a538e4f22fdf854fcbf3b734",
"003e098f3f195e89da71d6367000f804079adca3275b2e793e8d312c8e402cf0"
"d0ce5331742f87515f4dd9cc668246194b9572b6",
"010af4ae334ba40bd6538e0f095aa56f61a2bd2b5f38e954b7617d92ba10603c"
"dcca836554d0242ddb37d5e1576b0be69f0eece7",
"01b335521aec305f314d7f23ed28cc0c4d23f33a6785fc6c6de93e5fabce2713"
"02f9557f6d2ae77c52720eda5a2e15436443dfd2",
"01697512676ae56ff5ab778c411042d217ad24a24ea05bbc253e4395fecc8a07"
"fe77ae0ca4ed977459f1a14d9b83931bccf46107" },
{ NID_sect409r1,
"0174bd233f861c7b853cca8f5a383574849ef2cd76ef22bc0e159f713a1d0738"
"7c4203b11f4c339b669674fcf1dac199703beb07",
"01e2c778cca64963d87329e57c8bc96d0f6737041fd087dafc07dd670e2ce725"
"547e1a261c43fbc54e14c3473ebdbb31fda8473a",
"007d849313c6499dae472b0bddb76dec45806f82e098723301df33b6bbb97f79"
"4bf26879fc33c2973f86c1551549641a819b5711",
"004812af1937630b8ea7d0ff723cbb05b7a2740fc4c9be792db204f929674c32"
"e47d85e4770b903d3290a6d62c274cb257b76837",
"008c6f61711786bf5c54eb0c1b3126d641b24a6662b67b257302a9a61aa8cd50"
"3846bcbb1b14fa5c97454368b6c27dd2de2ae80b",
"015960ea8b92bd77d52874e3ea82ed1763440189d68728d3974d4c01d6aafdbb"
"5274648f6f3eaa4faf3fc72d09892ab038cb2fb7" },
{ NID_sect409r1,
"00c1dcb737d253035bb91d2a4a85f37d00142be81fc9278cb23a4d1d79d27c8d"
"3c4440b2c842bc1e21f6924e14dc831b0abfb845",
"000c73d5687b0490ccc07f654101acddb36cd0c2eecce165df276f83be211d01"
"d30ff5c243f0900572ee6df07f539df6a4689b0b",
"00bfa594856c67c2836b7fb171b67c7a41ae43ef3450898024a9313654fcf31e"
"1e1fbac7ad52b2bc4358975a5c61ab9f4e3e4e9e",
"00e1b5309a44800a916ad8a4d19b82a58b00ee048248050a6ed6c33ce1bc9701"
"547e93d7c9042f8490654b73a2cd7d73f733c0bf",
"0180b20338746351faccfb9a3711a4e138457550bbf58316034c6f216a537492"
"63dffe2359bddcdc89ec6446a9a4a9f4ef90c86d",
"01127491ff33a67ffc4757416cd02a081cafb723aff52af35b069b89963e8e3e"
"f5bc19c5a093ccf511e3c3c19be789280e986809" },
{ NID_sect409r1,
"013d96a267d1a2a9ea83aeb1b01d8ace22e251c82f5f5fc3ef5997a3011a74a1"
"0115df60e98d139cdd360e74d76fa522eeb56f4b",
"016b655ab7cd0d39f588fbefec54e4f45047664c8b3be8e57ab113770f5fe0c6"
"2300f4a09fa2899e73bbc9823265f55d5cf4ae18",
"004a020e06c400ef2498c111cde15087cda48a6fb2ecc01d985b57f0d3921920"
"e92c43f3ab688129dc01ad29fc31d68e9622319b",
"0167227f62849594ed63f247f780b2d11dd9a2c2c71bd6b71294cf8b59ce690b"
"fe00da9bc1db8d1daac9bff8c00e7bdf071fe0d3",
"0136c3ea77d093d9739fbe6891318b14959778599bd1e7d5a97bfc82ffe85fd5"
"a9a01b82f72e11fad96d2f5cb5798f59efea15ed",
"01254508553eab09fbc2fafe13fa9b324d9217d7d0ba4cedbe5dc869ad68de4f"
"87774dd17d6428ed242c71956f252969e6bd5837" },
{ NID_sect409r1,
"01787b30b3b204e298690b9d711ffeef167adc5792068b5c8d422ec90f94c2bd"
"d284cdbf8bee642f70bd7be2da906b9edbbc2cd1",
"0043078f912110290a13d90160f0e71582fa39c0e75d8190eb811d450220044c"
"c6d680d956a98860e6fc85bb86d65990a160c5b8",
"00c19b391665f50353547fc72c9ed019f5311690ee41e7c895aa7ef92c60fb9f"
"3454dfac575245a6869f1fdec745d63ea56c8922",
"0053a7a62a8b4044b60af76efa5b44429bf65f65987d6a062163dd55f08dc9a9"
"1b8bb9b6270f8a026123f99eb9372ccbdd27ca3b",
"00add46f7ea7092f48ddaa2feb96cb24bf92d2628fb6e4f7cddf523e5f84011c"
"f8aababd6009a13f29a63b6b7ee664c66f3829f3",
"004b9accc21d7122835fc21410ed1d83767c47a54ffee5f0c180fc55f3d0e848"
"4af3ad38020294be92f02f0ba7e2b4f4eb1db07f" },
{ NID_sect409r1,
"01e9da0ad1a15ac3c431f220954ed2e502af7b746c3fd57b2eceb7748658020a"
"095664878354df0aa181e57e5ead2c985ad3023d",
"009cce73a54708348b48f8f3f674bb7654f441f283d4e8a4ec8f8592ef52395f"
"24c112d5942d3ae08ffe8d999efde399888a7cf3",
"006c9098b53d10f2ac0284a99902658f667ea4cab28698af3fa07006a1bb4636"
"3b103c4aa4c92c1c3fe7539097fa70b8a4fa46c5",
"00d3edf652f43f9c9a92a2e4d34ba83f5d7e950c28346a2a6851bf7554705014"
"0a4e9c1c1b500e1d2ad364c306b9a44af503a621",
"0099b26c64367f1903da95df51562d25042c01a1adda75bba58bdb0d8aab350b"
"52ecfbe98488c2619de01cd70f5e008953bca547",
"0093e2581c159d74d11f8667ee03399208b5c1a4ee5b20070ce8d97d251ef123"
"6dc81dd688b2f07a730e6b8aeca0c193a28b178f" },
{ NID_sect409r1,
"00c49294fb712942221a2500324af7bd8c7ec1cd1b8094ded1bac0010a869608"
"3f7efaecaa5103d6762499e1be4857d320030281",
"00564fa1110b393925dfbb24ba9a6b3373f4624ecbc3e12f9706f3ab0542992d"
"8db6c8d8bb25fa0614d486f6d1ac9f3d98b9edfe",
"00a7fa38a8ab8030d6b497a23bde5e5007e39d14da9f82dc564ae3cdb4af5fcf"
"41bcfef7adadb59171e6d7d3d3c3ac67f7be7073",
"0013bb3ba91d5d2488af572d995cef8fffb1fd85d113421e8d2c0c3aa97cdb8a"
"933fc0d3f05f4646ce841ebdcf1a98604bffa3df",
"01f2e04ea16a012d4864cf2ca7564846de73a33f24578dc4d221359c4f2f86ca"
"823cb0596bfe4760e9eadcb4ad508ab1a171ecbd",
"008e2f1c4bad19c46a5134afccf7f4ec14ab591c8b8ea48d9c3d1e7354ab43ba"
"20aa39a65fd92cdc176cf3dedecbf9da49a8d855" },
{ NID_sect409r1,
"0134add2c499172df792d94a9b3895e245b84073c325263a858c1e9f7cf30a44"
"f268d3f8358411dc0a9caab505c0abc016130bf5",
"0031c236b143ca036c883641f7f9b957f4f798a31667c41560340279fce0962a"
"21bd8bb52fa23db71a84f35a5794ef5e075972dd",
"00ce9f827bd24c014c3ee59edef747178d6c030c19669ad8e718ba1302bef4b5"
"ad2c1233448f5275b29a896c0b2e7b0da92068be",
"0176e31012d9c604b2d1a1922a28d8a574f060cc36388b2816d2f8117da20c06"
"99ab0a08f76fbaa476f0a9c424bf4c952b4754fd",
"011fedc3e8f8e828e0ffbf02fd85d29c0201fd0f53bf2614c10ae51ccb58cbc4"
"900c38cc4c9a52d86d89f9b8c2de4e227f4e228e",
"0190a1693eebe287ec980236d8762804d23fdb6f222763a0efc364f9280fdd53"
"394c2badcc51ff09557f3b97cae7f70d790bf9df" },
{ NID_sect409r1,
"00f0ec972dc9fdfd08cd8dfcba7298b4df2dbd80c20b2889e663ac58cc348cbf"
"8f9ffd31ffb50618d6c38d72a99d5c5d2eacc001",
"00bb0b48893cdb915e65cd5d797804802017a295343654246a37fe3a60d7de98"
"7e6a9a10aaf063d96b10184612ccd26407d7e03e",
"00e36f3b9a1341995b13fe70bc545d279e6db1482c92b13ce8cc0da1c100ea2f"
"aa803a64a58cc7eb1cfd167570835c522f659347",
"00d1ca82393b8d50bd1898a909bf39333eca3bde98b0b0dced66f828630e69e6"
"eb128b7cec23f07260047073260a765331dd6f57",
"006c535ff943a0fe750fc6c39904a6912ba1ebc0f46c1b0823e4013c77475ea2"
"9b3f32481966f1b165bedba6c17a1494fb6d4f3d",
"001469dabcf2210aa7de0040b201221eb4d1a4725431fb5a93212a66ddea4187"
"e078f5e3d82606f6cdfc0ffe6b69574d1d0ba643" },
{ NID_sect409r1,
"01378444e0deecff3aec5ab6e74e8123ba98d8b91a507cfca0d85097aad944c1"
"5b4fd89c8cbe2c7451d8ec641045421b4bf6978b",
"016447c213c9035de7bcc29bdd61d6ee6ed5579c36bec56bc6b44f9286bf9e99"
"fac97f356708cd0310dbf6338f9af8d7b1359102",
"0008a06716ed6f4cf728f9019928f367c77a9052490b9a8ba87a59cdca84e77c"
"6a299853f5496febe652f4ba333501c4fcf2ba2f",
"00a045b5e6bbb7950495f6d5d645a2b7d72006725d0223c7ff75534022c9260a"
"b0d2d8d333789a3dccfc3a89502ca500bd0c1f61",
"01ec556e1b1621ec1893654e198d5923e311478a8bd2ffff280c9092ffc07372"
"89a997492b6e9ebf931947634ef7f43b429cf36a",
"005c701a93d7790322aa7c67440fdd9ee8057a0dae86d1e856ae89e7893da178"
"bd67777f86db2be5c8e31dc50ed8a440aabc342d" },
{ NID_sect571r1,
"03b63f5fa112ae6b5f113c765144fe4cbd6020e26d400c11609a3a634b9a325f"
"416b0e3d3215734c68a1c2c8fad1d0bb9eb3939a41af22421f68781e7eb0664b"
"9df5cea448deaa3b",
"008e6cc77bcddc816e84cfc1f626824fa24d3d5fd33d8093cbfe1fc4d881b63b"
"494123bc759670edcb1887bb3b9d5a8b516bc503828163709d4dacb594d277a1"
"5a92c064e5770d1b",
"0344f22be87999b95b2287f67430ea8fe646c62fe38b7ce61f1f956597c27bdd"
"d9902e20d4436abf3bebd8243ec29a00481a8a2c19f550e99641b5f14aafbb5b"
"da953a7559f8653a",
"06af71fcec1a2904116fe14878663764c1ec74870e5d2d53919f0b635912db80"
"dd5460d9e699458ff8494c5bfc74fba8d3b12f65f015e8def10de33f1800191f"
"4cb502d21938b951",
"019584177b189c6641ffb678b6d7833d8d4bb25dee5018dda4e4c0d219048c01"
"cd0da9eaffe346d53cf1a07b33b3dbdd4bc3acabe4832f9981eff2660991aac8"
"52147985eea3a51e",
"06775e1b99a236e02b020bc73666e5751c1210dcb6e9b02a69f4075376e49f7a"
"1476d2209e861abb73f5e3ad189d268e035b1de93d47b3a64de5783c9a09bc22"
"3e1cc612f26dcdf1" },
{ NID_sect571r1,
"0575cbb059f423309f993b6c06ac71d7bcc5d1e6a19afe72811cb612a6238c9c"
"cc331e67da0c10b88cc2a5f1ef2ff6d6b744065d242f598da2d6335d4c3becf5"
"c3953940c60efcc7",
"06b433652e3a36a07018aa8ad3d2ff31ed785ce5601716eff7710fc13c6ff9ff"
"75c7f3701d459fd8fe70c0b4afceda08681717db9821d8c858fd39e274ff3777"
"2f8e84856e706745",
"02f4d2b7e63660e6c20949e06dc670be8aaf82530e0b6eafe21011fe9d0f4407"
"c8549515734528cda299e9fcf738a97fbf43c4bba26744b327531b40143e158b"
"c8645909ea888456",
"06ea711827ad8ed589b709ef35f6a9cd4625798bd887e5fe59c51f0f41c328b7"
"ecdf84736c43fb70e3986ee5e5f986e009f641158a75cce6b39f53a8bf068283"
"0194e4007148deef",
"04c6b9f2a6099fc0367fa9609394c3221ad8c6fb111d2bdc4305053804788d32"
"eaf76431406e768a448cb5c8e34c81225eec9015abbd92725c002712ed3192d8"
"07b36afea853f722",
"03a80ea8cfecb858f9b77bdb46b6cda26320ee8c561a2fd6b7e0a2b62201fbfe"
"60f577780c75a98a11a69de4c4ee911930d2200b6972bc3123d7f278615ecc65"
"984a59fe352a1cec" },
{ NID_sect571r1,
"064aa66830ff44324a67ae8a907896897b507566cf52dfe13e3adbb1e793665d"
"2b718358754efe809e4496218502feb5604dbfbc04a1107ca9ec4eadc7d10a9d"
"6d1474cedf578145",
"06f63f69f8c18b67f11051b3d30236a1a249088b2bcab5cff830cdb9eb3e75c1"
"e87252e5d8e61bb1a66348fb681e962d65abc54d5dea2dd72c554590740074f7"
"c66c4b8dfd307561",
"012b6313b56853cf8d0273049cf7ed2ab8e632e59256ed043366857648f3f2a9"
"674caeb6fb0fcd5fbab0bbabbce17a0fc4a78148499c389af57486374641695b"
"0e852f3152eec724",
"040a78763d170459dd34b5c04ec782e698cbe903a5a348551c5248d9dacf19bc"
"b9a498ea05e80e2d6cc1f3ea5ba3a43855b801c8c0356fe3e29ee224bb91f4ed"
"0c85678379b72542",
"01ff49ce0a62e9edae6aa63a9848e44f185412d0feb46b87f91424bdaffed516"
"8321ed76f235f75d33667f6d7d6a9c857bb4f85442fc40f9a20c04ae06362a46"
"eceea15c45d69beb",
"03edea7e47ded7c2ab1115f4ebcbb42677c7fba6e0cfd811602896251ada1d5a"
"0b461aaf4e000f4d4231b96d8dee7630d9f1b7860e6418dac8c3b07b66af6fd1"
"acdb44b2683b29b4" },
{ NID_sect571r1,
"050671af65cbef92f305e5facb4288cc04a4c6978a3b78afe4049c6a995fe8c3"
"c0bb609abe49d152b1eed6c714d254fe6eff159a9ebd24ad16919ef76f447005"
"7eb7c265a4bd96e8",
"051d08e21d264d8e4dbc73408842ab57cd78d323e7deb625b3741994b8affe01"
"af4461622db419afeead045845f6c3db6d982f45b692bea11cf25d18aca3c83b"
"ec840c7582a7062d",
"021997b5481c0cf6cf436bfe360c3b119b9e4dd56f3c2847affb2021cbac4b57"
"dc18f5075d678af2ba6e9eefbc4138d818053f2df32a10e8ae5d6409f5b2f1f3"
"cabf36f808fdc07c",
"0560cf91328c26bba13f71c9b5dddd05c185969d88bd0e9d34a3607a923b23a5"
"b675452167003ae2f0add5141ea4be41ebae91d3a6aa15c393dbf585ad6c9214"
"b269e86b4f054bf5",
"02e32ec240418a9a4f9017e632f8a77897a2233d6f1f45b8f7aa818f847ddb3c"
"eab5a5a12c754fce8d57b0320a076b53441dcf9f65ef3204e089191ef156ff76"
"2294897a72fca932",
"005b640015330f8416f2bbbf8b5660e01a7abba8b0197a29e52bb535d62f89ad"
"0443e08b6e0d1d15f4eb03c0fe35e3e43bd7739cb692092698a2cd13126cee44"
"32831ec7423b3434" },
{ NID_sect571r1,
"039ac9e91af594074dcd338da4f5240574f01e413a49b92246ba3d6de855e3de"
"df6e7fdeda9ab7f7f8476e770ce9bbc3a9a5eb984543dcc37f5f11be6e28a1d1"
"090931f5c5b5a351",
"0780d32dbb134899bda2e98848941878387aba6665fd24252160ce3123f68f9b"
"5bd8f254a38b84ec536525fe007a863b6fcc489f937a05a5fd946d62825328a0"
"9f83a7cba27fea5e",
"02b539acc770758799f439670eae85b9ba34a8b4f371cc935a20ce8c566521ee"
"cd8c4f5aff116ae0db2ad6eae1a3384434c599379821ad05d81ada0548299dfd"
"98cfd6d3f1573524",
"06dae538c820443977415cef4e79974ba762b69b434810200cc6fff326a2344c"
"d21be19c153642df82a3e57a5531a8bf19767e1995d2728fcb661d58ec561ef2"
"3a34d8607971490d",
"0504243c792b903184ea725a947ca89218ca9c8fa1e09a7dd68de88eae90f9bd"
"2a8df414dd69a8b2b1a2ded2c6d7f514c8907997624eb0bc9ea933a2d474ef8f"
"83baea3243834de2",
"027af05ecd0332784d64b0b1bdb45c310fd445c5a6d6b34f35f4eaa3fa3e171a"
"b98763d243a1dedf46aa29864620a47d05eeaefd748186bcbcf187c01e7ce36e"
"2a53ded071036b59" },
{ NID_sect571r1,
"06f6588491060a1e88148e4bdee38bc674713fe384d7cfdbf5bd90c9dbb6e158"
"7e459dce6e0d69b8b2cfeb5055bee56a73c13436060198ad4750dae8253ea839"
"a2e246d541459775",
"05b61b8f7d8d6c8162a2269e7287d459034b8faac0360fcf99fb21da34a314e6"
"735319b9d03626b9268369345f3a624acadb219b207188d0e945cbc67c982068"
"d32613fc21f8b0f4",
"0318a96e382782d4476f1bebf697a1076f22e1d2ec84747f9fc42505d5547daa"
"a08d814721759659958685cf4ea4bba12fffb66af09f6694521f11c09b6626c8"
"ae52fbfb336a52a1",
"06770f2fcd2e9b7f8bc5c292d283abad85155071fe37ef7ce84f34c7616da3db"
"e1bdce9ab04cea7bc4bc258c5d2ab77239d3d084568b2dff779988288d9fc6bb"
"364f519d0e855ad3",
"04f6a1f4e5fe00fe9a25d8459b88803988ef2bf2fef5a23f13e7a7e7f3459abf"
"c3d5c00303abcc5080fab81b09d5be0320ef990519a06af13c29562ee955715a"
"82cc0daef2c5e0eb",
"0763c0d659a7c080912005a2afd60ce57e610619b388ef3d5dd3c9386ab12069"
"c6ef3a8e72eb741cba2da5c6f9267f6c09fada6459690ed4e432445d6f0f72db"
"cb059c87df36f665" },
{ NID_sect571r1,
"05a52cebf68103cab0266cf2c689c48f080549fffc70db9809c2a46f908b7289"
"be597329f39ee1e4cca398664ffa9bdcf01293f43593d188e12411d57e559b3f"
"6a30e9554869f049",
"014e137165fb0d530e8653d7cb2a84618dd3afcfa3f08560179142aae972790c"
"e746a2fd4469d41558744378c640ae73a489bb7f81cdca6b1bb167c794c26d62"
"38a0d256afc3ba21",
"028b4319eb7054cff6382820c52f9c332eae670d1f07cfc8f1472e9260f5e47a"
"385768016cd2006700ca7bdc5d1d567d92460af7c2a425dd0d78aeee3d15fb28"
"d71167e6486b81c4",
"05b1b114cef13aa5df306ce74197d680f9b8c9d8f6753a09db88466a6bb04eaf"
"1eb873836022d7504f45fae85a8e4a5417edd7ce3a0e5eb9e79264884ed78357"
"7b3fc52d825f0b57",
"018e3226e36b4b336799c4684bba505e984dc8819166f17ceb840e36125b283a"
"8c8635ddf7e770406d9856d82b37cff1fbcc5d3f5cf4b55eca41ee131f21ea7b"
"cb19ce05f6564245",
"0428413f2d2aad4d5288885c2edc8b976321ae1dd4fc6b41275fb88b8c5e7776"
"165effce79025163538a0e83c919220a407ead6cefd616b4b05294488c2ef5d3"
"0ab8caa55ccbd1b1" },
{ NID_sect571r1,
"026e2f1ee64e7958e902547a7db0a1e14866f3d2c0127c2bb9b09ee232d3d951"
"8ee44ae8f5bb433a088069fa386cd5c8902711b762ac0da3a7a3420472c47e85"
"0f988dd60a636d7d",
"0677ff510052d4f460849fb8ef0d4f3519cd238e4e1c688b736cf6e3759550d1"
"34a1e6ca3cb479d68b4dc5d0bba1aee178bd6fe15ec196fb1f627d87079394f6"
"f7854e053228dee5",
"020115d17e41e13178b42a004c01d5e4ef1c76241049c7d31bf0ea85d6e070a2"
"e2b92080e61de546fccbd4d991236bb360ef3f206ee16d8843a0ddc803463664"
"a8ccdc2d87a10277",
"06c8ac34364acae35e3c417160333e48641868fcca04c0d577be06f58ab0a55f"
"d7db779fe737779da33d009f57b5bad49702eacf575acbaf27df833070cd893a"
"7924770c92eff3a0",
"061b82e545d41c62fef068b34cdbf01396115d2a1417f9719483d26986b6d52f"
"8f6de06837795f6d9dd7cd095741114318c6e8a6206b3deeef014f0e44b0dc66"
"84e100e4ac361650",
"031bd2a84369e93dfa00581446d52762100d985cc7bb91c4fa8be7472e2e8e97"
"81c52b19a54330442441bacae23f4bdc76486eb475d51f26aafbfb272a5ab5db"
"184a4d3c3006e5d1" },
{ NID_sect571r1,
"023ee4f9ec24dee203acfb658631313c7ad4394c47f1794d08b599ffc15f0e5d"
"ab2911d97e030ddf7cb4bbadf8a5bce05c35358fbd0cf95d3d5c7ff3cd8ee6b5"
"4e379d8d0123939b",
"0606be23e7c5746dbd38404fd607fb7f278ee249dc8e2740cf1bb9b1c07b1cf7"
"e0a50a432567d1869799a803122510db437981a2aa126eb9aaf3c7be05a80fac"
"1495e1c40ca1c106",
"00847b545ef49615671f08be73a49147063184493340111ea4dce13c2f921f07"
"bfacffc8441f4c7c9d0479f57f3a13f4c33c63ed47c3a43fb2f06d06a9780e5c"
"0b3ac30410adc491",
"06994ddc5ae2c5b6f45dc32b710f1a49391a47f3a0f8c2d7846552fe487ef01c"
"ca0431155bb54533b067a29e8367373af95d6a7f0bf98d869b708f48f95f1b88"
"a1530fe22547e97e",
"04f6288d4d704f33a898031e7d0046fbf1e34a72c8af190f4d33163343c897ba"
"0c0d8af8a86236a1c3b655b979dc4522d33d66a665b3b6501570f076322af0ad"
"2bbaaa04ea2e995d",
"04df20154fa49a1d6e04dc2ba6e55a7f2ae575de5e2c6e4091a4d2c36aa93ca9"
"699b890f0ee4df53aa75d0d9babad68605bc027ec67c187a6826aac0f4bc596b"
"aae788b376110216" },
{ NID_sect571r1,
"00d4a0b11c1739bed094e72d7a6923836836d9215746c72cc680045a36d81adf"
"5e25394f269a2ada1d9439ebc33bb931d6fa595a25261c244a1e17b046fb10fb"
"54bb312288cf2e8d",
"075204f50d32ab8a6abbff982d1fe372b8c5415bb5b726b346aa4f08be32f8ca"
"282c1ef6e152423360d97b728a074e6b3cf3b912718b1692cd983019741a2541"
"824234bdc8c323f9",
"034c2458302b43857f12ad8bd9a875237641a21e21ca3cf9a0956d3cfeded96a"
"5e1f533d827b528fbb586da93eefbb66d0778b19b1a7fb6f17bbf9e79b9acefc"
"dd7b9605e7898f26",
"032d3a7a4099f089fea9189211f7366f2edc4abfb316c5c05948d8de57fca023"
"bfb6a11b102ea4120ba62192c0df610bd8d2f63fc57727f4a6b640abf8d299fa"
"c56c4c7af88349ea",
"04e6399f1ced2669d3a5506d35ea2bebfccf0cec84bc97383aadc3b48347f629"
"626e6096f890435e5933675048fdcefcdede3ed616e6560d42e9e17c5492e30b"
"c2de4689c0592ecb",
"037a380f525590582658e2dd272a32de67fc0cf5390b37f4d33c1359f075d446"
"1ea38a55027317892a3d1d22f5ea333ad437667d2f3eb8781c39504036ae33e4"
"b0a26b6894722f0b" },
{ NID_sect571r1,
"03bb84032b7fffce27accf354b89dddf646cdcb56634df0f8520a7730f8abeb0"
"5f9933d8a4352d1c7767cc3f9b80ceffcdd0cb3a97b59283fd0a674dc4fd2403"
"33f020c82b4804c5",
"074499336ac3a805430789902768252026b526ece54ac28e8cc878f18baf9fab"
"42ba4ce34e4968aac1ee6a0bb15c9a709882a5372af56ea0b36817385fbbfeac"
"4b906069e53fbfba",
"012db785a03c26be3a6e9a582e5c32a89570ad4308b713ce5471ea193dec1f32"
"d68b4fcdfb1600fdb1ecb6769e26a0e057812dbbf0ed495592665e6b8e9a9737"
"8a30b5c660fbadc1",
"07edf7ee0ec77f5a6c3c9ec4ed8fd3cb814a342e9cc6470b54781ed6c141e211"
"5c86dbd7ba27993eb7ebed7a38be488f96fddfa982f3691aa1c2a697f7706bff"
"3d1add7396066194",
"07b3824b7f7b266fa42fe536adc2ac79b9d1e5b408e7217b3a99ddeb992f3123"
"ff2d168774d300a818a32692e265afc6f6f578d9bd3121132b5979841f7a2d06"
"0e8948901d657c1c",
"0420de313bddce87d07321e3f0af404d9d13e5369b79506e807178711153c9b1"
"837cd055562eff3aadfc5954a221eeebb1bec1696d3df1cccfb8b61172a50d83"
"cee95f4140ba070b" },
{ NID_sect571r1,
"06556a4cc98466794a93d03388536776f7a4b3344c3dc4eb960a4a6458fc7869"
"cd4e45b2f140c468a7d4ebba84c9482337a2a8adaac88a9a629da03dd2475266"
"42b0ab71fb7a8c70",
"054b97d952b19f742856dacf4e50df0c3103baf253f4de65a3d9cace63fe8290"
"6d2c8e8a3312fb535e00f9b5ca69f87dbc7fa3f7d87fe024536604aafe464059"
"3cccfef6fac028a6",
"0202606a76b6a13d6e29280bc1613e115025770b245f5561d5883e135e159cc4"
"37b1c9355b2eee2b3babef229fe545aab2bcca155e8972495f1974bdb1ec0e60"
"c4e6c79c48f26a46",
"06e74dba4e0702f186d334d3c49e2578e1edfac564645dda8c4a588158f8d7a3"
"ef63243653c0d507427734fb4cc87adf4a36bd5abca1f920b9bd6e3bfa51c916"
"d5710884594e9485",
"05b92147a2db48a3830ccfa28951a2b7e8eb84313b99b0a99031c7834c633f86"
"5a2f9844952528ae5dee02428a824cdfb7e20928ffc53420df38ead0b4240d06"
"59d5adb1ff2e2dcb",
"0606228f5a05077aeefbefac23c0d5bac7a6062bfc2b02ce8bba6698ea96b456"
"b1f0d32c6e05dbb9be61a83090428eedea18c74f41238edede9e3a12e28722d2"
"f314613c2e84d6db" },
{ NID_sect571r1,
"01005182b029a48528eef5ffd0221ad87085abac6a72705203a3c1689abbbc0e"
"12927a5e83b352a1bad97706101f44a1022ccc0d5522dc5d1ca1433de03a2ba1"
"df864875f522be61",
"018b02a98f0b3e4ccf44a96939a2083ab1f2a04dafd5bdcee3cff438bb08bff1"
"2043aa192c5fcf34e13b5c29742c5d864b9cac46bea6e96df2b1be4493acf950"
"224d71737f990658",
"0048678348ac33b92f2c59677103ea409946b5593d105fc4983351c4ede929c4"
"b93bfc695876555e3ace417b82ac05b832676ac23e2955a09ee64a20a5f98e62"
"499f43ba7f7fc8e1",
"031dd4808d2b341b8881f5e50a2dcce38df839009f92185978dfd9a60cdaee00"
"5cdba82655647736d407afb90c67cddb13ba2b01618f45e8a274317e02f770f8"
"0ef87bbbc1b11056",
"050a0671c9c0ce57a494e6911f1376cf1fc3393885ba8c26f6ddcbb536187686"
"0a35afc1f4560f2970c30db3f1c817dbc8af2b025daed3a9da12d2fae9d714ce"
"ad80445e6a0a0813",
"052669336019db5eddef5eab2336abeb60bbc7295e4bb663ab43e373fb6d888d"
"7433ec89a487a91d4a59c289a9509ddd1bab33cd02a7bf37aaad78dbedf0b4ae"
"5f2f35d15cb4e628" },
{ NID_sect571r1,
"07fab4e59328c700f74649bd90a7d51ff28958fe720daaab328cfc9b002aa706"
"ceb39934db9ccf81deec95689ce8c776b4fc6542a82358cc51ebbc6d8e5322cb"
"3fa6e4695e170fc1",
"05acd45cffa29ddb34ee42e7410026798e37a8d1a9ce9f9294da5198164b6901"
"0c68c53281ccbfc407d141097da137e7849f228fdc1a07aa298be26ca771f47a"
"c4feb2723d5a6666",
"0017bab72d788f8b78b9bfc4912863c5a48922fe69e8a4cf5e6e91763efd5477"
"a1cd439dedd0afea504e3b3af6823ea3089c0374ed9aee24a88516c8cf3afabe"
"995b9b9675f3b5ab",
"0161c14bbc84e42ec7677a8c3770065ecd1f0f44eac8242a715a61971e7e4fff"
"f78ff57a1bf1b95cbfc2ed957d1195f9ea50809715c2439c7543e57352013542"
"6d47535b8bfc8533",
"01253633d02251464edcc53ed9e8a9ed9329320ef5eeaf35d64c59b9735c96e0"
"7f1a62ec17bcee4f04cd9a85a3eb504aaf37bb388c6c7d08d90aa0b68556b5c0"
"68ecbf0a5984460d",
"062de5aa98b440c6cb7a1428f6b5e47452b30454eec4d651982b531121febbd5"
"a3833b180017f7ddb5ce38d7bb1c842de1a8a8fc7fc981e24733b7662813fd01"
"0a4e757ca4ea5c28" },
{ NID_sect571r1,
"072676302ad18731b76202bc51429ebf7eccf6325f4e084c2f92e3288ed29048"
"8b9e36720e29daa2db1993a7d17ce8ef9d8ccec61de8a407176e2674c25d57bf"
"f2c46596358b3605",
"03c0022d53229091e14af0f7450deca1cb5db821e71590608fe0986d73e88c91"
"5e5ee8dfebc8955913d9164f992f56394a662ef11c8214e8ada85df1b17b0b97"
"414cdd662d188b5d",
"02ab2d43027b08f8abfa3598ef0144399a60b6037b17a3ae413d422efa2167e9"
"ea4f19d7eca98d85c67c1fe85fbcbc1f12bafa30a85dbdf542466889315f1532"
"defc5d181509f008",
"0328c0d67fd552ea10e5bdf7b87d50bf4dcba34dca569aeb869c5c7dc7d832ce"
"30feed32e25a723793f97c557e2f978c5e1349e69b73ef9916001ffb0d6cdb2c"
"6343e34538386e6e",
"01d151b46ed004263cd9a5c0d46a840d03222631f92ff9280e95a35746cdbcaf"
"d9fed6811c7614b9d50aa2828dc7a275b39d3d418a349dd1e2b73211f4de9a34"
"b42fca11b9760eca",
"07c7eb4892816cc3388ebcdfb412984e05910c112dd15b8e5481719401701ace"
"ba22fcf35aab0c3b040096161011f6177097c505395d9d6d8a713f6a5100fb47"
"6adbe7b9cdf4b68b" },
{ NID_sect571r1,
"06cd7931fcf1935f81f301479ed9ad0c6f9a05becf4e573a2ff409bafc442ec1"
"95f7e3fdfd08e58161d4e0fd37f62a969421b19cd48fe848a5d7f74b8137a7c7"
"26a9cbd37a2cf3b4",
"04b5b2cd83b27895751c34d3ac5b960a133ec18b039c2e128d3441db4f76e8b7"
"5064094619b122e5fb2f1c2796559ad953c711e330dc7bf55edf29f095cae455"
"57b7c8d5843d89bd",
"0049c6e4c05a197b24afd2707243ffbfd55b0088fd33d87dae4d21048f75f2b8"
"62563075241d2f36fdd0e9405ab42aa55cbf2095dabc3daedfae9deb92222078"
"3e8591cfd67600b1",
"001fe29a4c2dd000bbed129121b88edbb5c39b34003f170ac19fa9a85c5fe587"
"aab821361f4963440f25acb49758810552f06b719a9eb43b720e9b7ad6ef9d41"
"248d5f335f99515a",
"01499db95808c719d24eb05c633db8b05cf969ca0bf656435b1fdf1b0928290f"
"6a6bf880adb9fd53c86ec76e0f62ce89cbeb4c266f64a876d778231a0030c38a"
"a00d66c6bd680785",
"05c638349000ec30881cd190c067e7f12b6b42d5842a8285a8ff0dc7e9c9eaf4"
"83309e48314fdc2ce7f9da6a468e549c8e70a50b68d07aee29708a98172209e5"
"cd2e8c09cb66d982" },
{ NID_sect571r1,
"02984b653074c36a259ad956d5556512c2c731fa50f2005d0049a9d977de5c00"
"b7a054c960cdd707896321490be433bd5effd44c564eaa2d5021175050c5bfc1"
"63cdb1e81df1335a",
"01a786d29098b334f5c1c4ae86a41bf275cc6787da7206916557a4f433192141"
"034567e041d55d794a7707c7aaf28842d5c8f590375a43656918aa80e55b0285"
"347cce8ffe1f15e8",
"0186b31ce490c7f28f2793075a4ae645acb39e71ffe944ee62bf82587f1c3cbe"
"288ce6024d8d035f107d9a4faed57a7b21ee1d6e7129a098004f22ccd52740c0"
"34a6df37b53d0732",
"06b15f1a859e3d80924611b20c1b94dff6bd0574fef81937f1e54d148d2d31f8"
"c21b0ea9ce031c9455706f085a69fd492418558c7de9aadc2c9a996e7ed1feda"
"329c7d7609bb6b22",
"032910544cb136e2c29aa33572aa6c3471a52ebca6b228bee749fa9ffe29296a"
"4a5b6aa0c6dc9f095216e7b1513d81cba00794a3f558f74a1b541c73b2308f4f"
"8e74028b5c2bcdf3",
"007a40a59b6632156a43158565a4eeaf80618e501c5ac5afdab4ce3cb76ac99a"
"0bcd17e9eec549373ace8c96aac78e2af6600483a2c49ec81298a083d5237118"
"de96a953999beb26" },
{ NID_sect571r1,
"01a8682e09eccd1868da202916a561ee8513c0d73470cd341aee79ed93556a3a"
"6e7c7b20302ec74a0c5170a8e37d78a9b5d0de3900eb2a663a7247cf7943fd38"
"1d95b3aafd156167",
"052fecc68f7695d4e41a080c47650d202874da163a1748e550373958e31bd0aa"
"e520996d30f384730f4854f5e54e68cc24958adc52e2a4c407356514f3ea7166"
"056dc67e4d118fa8",
"0341f8e86182de4fc3f43857250a929a41994d331da154c0249fa0d1c26a6de0"
"e835fa08a8cc524e3dac286383f90bd2f4d2c75142f1d38108d9c062143c8e6e"
"dbbda0af87a76ad5",
"02c5c5eb7327402672573c37b492890343ab422b51bc65b600766ec1d07908ff"
"03bcfde7694d832bcde52946339df0aab4074ae07a89f821f5a1130d2b73db0c"
"423ae7a023ae2c18",
"0476ed3dbd936d1c36987a43512c8f0562e316122d05a7edd4e4248984c11f6e"
"b85215d5aaa0262a95f20666c9dbf45248ae177d2dfffa3a6a950533298b5c3f"
"4a1b62da1eafcd51",
"021fd2726973405fc30d2a1f2115907cbd0de90bb6bcb0496452e389b1b10ccf"
"38e2400617040cf0dbb188f345337678b0ad8603dcfe926582d4321f384daec0"
"943e2cd267f48343" },
{ NID_sect571r1,
"02cdaf139a0cda2800d61128ffe4d7323b34a0fcf48c9400479ff4c8291cbf46"
"f16c41e4409aaedf14bc60a642b2d7baacde8e0051dd8ae01bf5ad2e6e6490c7"
"7cd406a999c565e6",
"078edd29db6a3b87a11505b57c543ffb746a5b40fb83d7206180f3ae9fcb222c"
"5411a77476660c7b311b646310905889a95a0f2fdc35d30fc61cc5560a291423"
"2d62ad36386b9179",
"0207a7382d8a22571226e0c06c2681d09bca19b5db7e7bbfc13ac208389df816"
"8d77615e30ca86103936e53dd9af01cdfe24f508ec609399775ce84c8689f8d5"
"f96f652e014e0de8",
"04608dc0512bc55c734cd562ac5825f7ca38b793f8ece9b981cc1c4032ddd803"
"9164d0c646b42b2fd453b5a1d3a74ae23c32c7d584007de3cd34e33121b90fab"
"3ada6621b3ac9785",
"06aa9ffbfd65c509370846707674ac723dac24a6f33a1e0bbcdf8b24ba32cf7b"
"dec8fdc9233b757bc073d64dedf484c6fa01ef28e874fb0d34f58b0e32b18645"
"c30bdcb516ee3841",
"07a47bdc7d54ecd391672f131b3214d0efc4d40195db1ec993a62fe9da875eff"
"f5403bd708fa491a01a94f4bddc7d516baffff9fbdd213ca1a4905f9aa679d65"
"da25c0f1fd2afb0a" },
{ NID_sect571r1,
"00051512e4a0dbc535c97be10ffa7425758382883040466601d5391bcb3582c1"
"1525293249f24497cc807216b34c92c1e075781c8391c3f6d3d14f88a1d50ea9"
"fc75ff8d51ccf933",
"039da46cac866ab347617ac5a8b4f1657034e3b8ddb66bc4273e2e1ce01641ec"
"e636979de8b2492dc69e88537c36b1c3ad0d35227f867e43df9c8917dce9f8c1"
"ef3ba3cb5ca8ba52",
"006ba8f12cc6e0e78df8cc6298848a740025e72c62d099e92584ac76f595ac1f"
"c724cb06a85a07f0d4440faf3ddea2f265f2015dd059a16a03a29915b8731d60"
"4512ceef22b841f3",
"0636f435e80600666108737300773a8ed6ffa8ebf8307c81ff5f44353e91bad0"
"86331b8feff3f1cdb86e061bde5f71c5fb938f117e2226a97d2b66b098e9ff52"
"5182c816e702c6a9",
"01c1bd8afae6a94108fc2c755d5de3fa2a4b3471fc2a5cdf4adda68529bf180f"
"f28db154ab4311247b392e93a335bbe8796608bbd6013f43cdcc846ec2226742"
"3c3cfda2ce8a3d96",
"07326196a7decc92c81ae5a0779c9a42f53d94cfa4c3a13f19dbb554138e0e86"
"4eee6bc93e39214e2f74705a4b172aab510444c93b5b3e62517bbb7279337102"
"db1c61de349d9747" },
{ NID_sect571r1,
"004c2de5642431bcc6eb82efd4355540a8b5d23b12b0df7d31ad69425b945498"
"77443ee8dd7c09cfbbed86f13665931d4b2a21759c33e10b4acfc63ba1ef61ac"
"aaa18c94e3cfc933",
"01765b7a37eb806d43196d2931da1a1953742d3e0da7ccb67e0dfdba5e034914"
"cce3ee6393bfde40670f406196067da8b293c6843593dd221c89bf97963676bd"
"044e8c8ab8e717ad",
"010716f2e774f27f42de3f6c9694d8eca2179823091d202f2ba1629193a1c987"
"00693398ffc83157f7ce4858e7535e3990d219bc249de164558cac807ee15977"
"8a012da19e5012bf",
"0150b3adde162a7f09350dacf460419fe86b99dcd94f44283fba3e43d281b93b"
"b54282812ce52265a94838968d67a9d6ecdc1b6cb64cf1594521c4749ea43d8e"
"4ec045e645ff238b",
"07b43321b6118b87c46c7b52288df5dd1cf7da6183ece5633b4c17cae362d821"
"191f7d57923928339aadf7d85f7f19de9486709e4d2ddef42c55bb4d76a3cb50"
"cad2a098ead5952a",
"059052d3e1c66efa4b7dd39e74299e886367d8fe49d7cab90e4f051bec103164"
"38fb29b1290dfdaec169decd622a1010cf0a0275008814f4861b4d83ba78515a"
"8768d978be430011" },
{ NID_sect571r1,
"025038a0e72ae8c16e36e3e3b504ed7341ef709b9fec8be90177346d76ca7bc7"
"133d0ec280acf066005c5cc10b52aa654335fe820a6617e560e270903ff1c2cc"
"8af1398f24dfe2b0",
"031074ca3931801a6acb765b6e9144172ed81d999ed9e835bd35526b03ef2a13"
"f78376032b0eb8146c23132365fce176a7cbdca44b35aa379859f688ac26dc64"
"c8149a4322d083d1",
"01d0103fc7948af107e51f4d2cc0392b66808059d1f26cba05be6a381f522d4c"
"b854137934accd1cea3360948e406d3108c943769dc700b4c9cc0cc1d84bab58"
"a35e27eb240475f0",
"012bda8ded3ed7e8b6d39b5855a58d725b65e3857c2a674996eb393a3e3f9159"
"5bbfa87253a56ebac2b10ed406af9dbff53b22265fbeb5a769cace2b60b45dbf"
"97ceed2b0a04db50",
"026454827efe29b324ae3f2d4c0dca3a3a95491511c531645acf545b45ef6ac4"
"a50c09d3d21f213ca76b96fb18242ecbe08af68755de4e1077173475826eaabe"
"d26a75c369cd7b0f",
"03acfa4b3d1c2a6b62af23bdff6a215a416d4437ce6cc114d17dc4201195987a"
"5d7301da11b913254702d7172e31d64e59b24deaa3270f20445e51dc484f7a2b"
"8c3cbeb0bb9efb28" },
{ NID_sect571r1,
"01bdfffd69c2e08fb03c853ef2ebd088e68d233fdb95f0b246de7955d615077d"
"fd0b0ff02c64d01de793359096b85e057b1b7f9f59262dc2757f18243e182e1a"
"0bfe9dcbb027d68b",
"0218be7d956029f139c19d2da346773b16d7afc858ab8dcb60d7e484aecec309"
"cb3fea96af3903637e5db4db678bb5db9b0b18d83cf9ebc1b1aaf24f4367ec53"
"3684ce9d56582d43",
"032d2f557fe47b8d280f682e24fda627dd7a58e9b00822a3aaf6eb7a014f476c"
"17941adc5e2238a3080d706f1e16a451b7e92942779930c5670a473281cac78b"
"858d1f1cc99b0aff",
"040f3130e74b1c8eb265e7c4e6921411eb971418267e8dea879c2e8b563864f2"
"3a61b23422c9a06fa178a8a155e3e78457597587f3e35b79f19d0c2e185aef46"
"db95819cbe127b10",
"01c91d27c2ae7113eb03be98e94d3ad6dec791fac2fe0d2c8c98b71371b058a6"
"49fa9c3fa3ccdbba932395c27affa20d95ac041bc9978e3f530829a2c64c89b1"
"bcceac06854fb903",
"067a58e5b3287bb9aa83ed9ca2d718cf7165fb574b6a446c3019849cd1584673"
"d561b574bc8f68419437c5e8113e060847cad3b5ddc2f67ad75bc1e3f04554e6"
"3a5e4945cfcb65f5" },
{ NID_sect571r1,
"008fc3b414f3412b403f01c253bd2226150225ddaab34d201089f49d79e5dcc2"
"e3b68216faa66dac44529c7fe3ba4d28d815b088235955713bb7721383533b5d"
"94221b4ed1e162b8",
"02b32201de272b1b32b6a6a58ea22411c48f5dc5cf0f95872e6751ed622ceece"
"a22a556975de6003869ae20af39b42ba8871789c82e8f3ad3cf6006f43bc4c7d"
"4102032c43f8f797",
"03eee29196a8be70eb3a310464059cc0c4c42f13487ab1a0762c2cbe304ebe63"
"503e6c7068a7f4bc197f81f65b4295c14b210f3cb2378b67401fcf52bec02c13"
"b61b6de14e1b7e5b",
"0177acc5fe9f42f4de2d27ab9bf6f7e0eace303c266ff8b3469082aba9367e66"
"440bd6b1bd8b6e1aec92b65e35aea8f007f09d4cd67eea5d6000736cabbb9dcc"
"c943ebb5656a0586",
"0716f1898e2a8c27319de7a2698f21d5de58a4b8b8dd02b5e433110d3977fee8"
"ec5c089d170af02a4ad3c1fab44b0d1e2a3beba9e0719cd8bf8364478d686c4e"
"35f7457d24d021d6",
"06b272ca3330c0cdfbe60a1746bc0ddea6257536cdd8e976f2517eb541460a3f"
"0e6ea7fec2b495e0f57712c8cac35e8a7d64d876c29851bbfeb6fe726d57e0be"
"43dc76a584ef9c93" },
{ NID_sect571r1,
"0565a82994d7e6f53eeb6bf67523ee680ffb770118673c3e15c3200e6c8d1f26"
"cabaf00c1da48e6374316497cba5f19f17420f267633f40e5b06362789bff11a"
"df596d5b1cf768ef",
"016b2d4daaca9c6bed976b2064ef54352a58ae34367835a6210e1578291c1de8"
"d67c20bc3d6ffa620c87b3098a2b9f3abb8d2cacd5b2ee2b68399eac4e8f65ce"
"bdd66300fd049b5b",
"0169a2d87586944c3173bf9a2275e3080003db648c2d1e1c56e2c37ce0d7cd9f"
"818ea6b7bba343f774ef0f334ea5c12ef0be7593d04ed945458d71e17112eb01"
"d9041d2133b13473",
"051e521764265af7f01bcd9c3fd022dfdb2d4a2c58b3b23d2e550302c42aadd5"
"7d1df6fc18e465bd98442495eed22f3fd6700284c9fa7833b5165149b8e1a91e"
"0e099a0a5732d5c2",
"0198e7e7d094e207528c583865d262a918fc2a39261e95c07dcbd044efd39818"
"99078af3eb97398201a4650f0dccbf19f922c8dbc3839bf6be0053f84531c718"
"43a9e6a102ab58d6",
"02da266a269bdc8d8b2a0c6bb5762f102fc801c8d5394a9271539136bd81d4b6"
"9cfbb7525cd0a983fb7f7e9deec583b8f8e574c6184b2d79831ec770649e484d"
"c006fa35b0bffd0b" }
#endif
};
#endif /* ECDHTEST_CAVS_H */
|
127590cb342c097a98e990675d014677a687774d
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/weston/src/desktop-shell/input-panel.c
|
8292f20a6c1f7cbc3292e332bd244dc4299b325c
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"BSD-3-Clause"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 11,883
|
c
|
input-panel.c
|
/*
* Copyright © 2010-2012 Intel Corporation
* Copyright © 2011-2012 Collabora, Ltd.
* Copyright © 2013 Raspberry Pi Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "shell.h"
#include "input-method-unstable-v1-server-protocol.h"
#include "shared/helpers.h"
struct input_panel_surface {
struct wl_resource *resource;
struct wl_signal destroy_signal;
struct desktop_shell *shell;
struct wl_list link;
struct weston_surface *surface;
struct weston_view *view;
struct wl_listener surface_destroy_listener;
struct weston_view_animation *anim;
struct weston_output *output;
uint32_t panel;
};
static void
input_panel_slide_done(struct weston_view_animation *animation, void *data)
{
struct input_panel_surface *ipsurf = data;
ipsurf->anim = NULL;
}
static void
show_input_panel_surface(struct input_panel_surface *ipsurf)
{
struct desktop_shell *shell = ipsurf->shell;
struct weston_seat *seat;
struct weston_surface *focus;
float x, y;
wl_list_for_each(seat, &shell->compositor->seat_list, link) {
struct weston_keyboard *keyboard =
weston_seat_get_keyboard(seat);
if (!keyboard || !keyboard->focus)
continue;
focus = weston_surface_get_main_surface(keyboard->focus);
if (!focus)
continue;
ipsurf->output = focus->output;
x = ipsurf->output->x + (ipsurf->output->width - ipsurf->surface->width) / 2;
y = ipsurf->output->y + ipsurf->output->height - ipsurf->surface->height;
weston_view_set_position(ipsurf->view, x, y);
}
weston_layer_entry_insert(&shell->input_panel_layer.view_list,
&ipsurf->view->layer_link);
weston_view_geometry_dirty(ipsurf->view);
weston_view_update_transform(ipsurf->view);
ipsurf->surface->is_mapped = true;
ipsurf->view->is_mapped = true;
weston_surface_damage(ipsurf->surface);
if (ipsurf->anim)
weston_view_animation_destroy(ipsurf->anim);
ipsurf->anim =
weston_slide_run(ipsurf->view,
ipsurf->surface->height * 0.9, 0,
input_panel_slide_done, ipsurf);
}
static void
show_input_panels(struct wl_listener *listener, void *data)
{
struct desktop_shell *shell =
container_of(listener, struct desktop_shell,
show_input_panel_listener);
struct input_panel_surface *ipsurf, *next;
shell->text_input.surface = (struct weston_surface*)data;
if (shell->showing_input_panels)
return;
shell->showing_input_panels = true;
if (!shell->locked)
weston_layer_set_position(&shell->input_panel_layer,
WESTON_LAYER_POSITION_TOP_UI);
wl_list_for_each_safe(ipsurf, next,
&shell->input_panel.surfaces, link) {
if (ipsurf->surface->width == 0)
continue;
show_input_panel_surface(ipsurf);
}
}
static void
hide_input_panels(struct wl_listener *listener, void *data)
{
struct desktop_shell *shell =
container_of(listener, struct desktop_shell,
hide_input_panel_listener);
struct weston_view *view, *next;
if (!shell->showing_input_panels)
return;
shell->showing_input_panels = false;
if (!shell->locked)
weston_layer_unset_position(&shell->input_panel_layer);
wl_list_for_each_safe(view, next,
&shell->input_panel_layer.view_list.link,
layer_link.link)
weston_view_unmap(view);
}
static void
update_input_panels(struct wl_listener *listener, void *data)
{
struct desktop_shell *shell =
container_of(listener, struct desktop_shell,
update_input_panel_listener);
memcpy(&shell->text_input.cursor_rectangle, data, sizeof(pixman_box32_t));
}
static int
input_panel_get_label(struct weston_surface *surface, char *buf, size_t len)
{
return snprintf(buf, len, "input panel");
}
static void
input_panel_committed(struct weston_surface *surface, int32_t sx, int32_t sy)
{
struct input_panel_surface *ip_surface = surface->committed_private;
struct desktop_shell *shell = ip_surface->shell;
struct weston_view *view;
float x, y;
if (surface->width == 0)
return;
if (ip_surface->panel) {
view = get_default_view(shell->text_input.surface);
if (view == NULL)
return;
x = view->geometry.x + shell->text_input.cursor_rectangle.x2;
y = view->geometry.y + shell->text_input.cursor_rectangle.y2;
} else {
x = ip_surface->output->x + (ip_surface->output->width - surface->width) / 2;
y = ip_surface->output->y + ip_surface->output->height - surface->height;
}
weston_view_set_position(ip_surface->view, x, y);
if (!weston_surface_is_mapped(surface) && shell->showing_input_panels)
show_input_panel_surface(ip_surface);
}
static void
destroy_input_panel_surface(struct input_panel_surface *input_panel_surface)
{
wl_signal_emit(&input_panel_surface->destroy_signal, input_panel_surface);
wl_list_remove(&input_panel_surface->surface_destroy_listener.link);
wl_list_remove(&input_panel_surface->link);
input_panel_surface->surface->committed = NULL;
weston_surface_set_label_func(input_panel_surface->surface, NULL);
weston_view_destroy(input_panel_surface->view);
free(input_panel_surface);
}
static struct input_panel_surface *
get_input_panel_surface(struct weston_surface *surface)
{
if (surface->committed == input_panel_committed) {
return surface->committed_private;
} else {
return NULL;
}
}
static void
input_panel_handle_surface_destroy(struct wl_listener *listener, void *data)
{
struct input_panel_surface *ipsurface = container_of(listener,
struct input_panel_surface,
surface_destroy_listener);
if (ipsurface->resource) {
wl_resource_destroy(ipsurface->resource);
} else {
destroy_input_panel_surface(ipsurface);
}
}
static struct input_panel_surface *
create_input_panel_surface(struct desktop_shell *shell,
struct weston_surface *surface)
{
struct input_panel_surface *input_panel_surface;
input_panel_surface = calloc(1, sizeof *input_panel_surface);
if (!input_panel_surface)
return NULL;
surface->committed = input_panel_committed;
surface->committed_private = input_panel_surface;
weston_surface_set_label_func(surface, input_panel_get_label);
input_panel_surface->shell = shell;
input_panel_surface->surface = surface;
input_panel_surface->view = weston_view_create(surface);
wl_signal_init(&input_panel_surface->destroy_signal);
input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
wl_signal_add(&surface->destroy_signal,
&input_panel_surface->surface_destroy_listener);
wl_list_init(&input_panel_surface->link);
return input_panel_surface;
}
static void
input_panel_surface_set_toplevel(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *output_resource,
uint32_t position)
{
struct input_panel_surface *input_panel_surface =
wl_resource_get_user_data(resource);
struct desktop_shell *shell = input_panel_surface->shell;
struct weston_head *head;
wl_list_insert(&shell->input_panel.surfaces,
&input_panel_surface->link);
head = weston_head_from_resource(output_resource);
input_panel_surface->output = head->output;
input_panel_surface->panel = 0;
}
static void
input_panel_surface_set_overlay_panel(struct wl_client *client,
struct wl_resource *resource)
{
struct input_panel_surface *input_panel_surface =
wl_resource_get_user_data(resource);
struct desktop_shell *shell = input_panel_surface->shell;
wl_list_insert(&shell->input_panel.surfaces,
&input_panel_surface->link);
input_panel_surface->panel = 1;
}
static const struct zwp_input_panel_surface_v1_interface input_panel_surface_implementation = {
input_panel_surface_set_toplevel,
input_panel_surface_set_overlay_panel
};
static void
destroy_input_panel_surface_resource(struct wl_resource *resource)
{
struct input_panel_surface *ipsurf =
wl_resource_get_user_data(resource);
destroy_input_panel_surface(ipsurf);
}
static void
input_panel_get_input_panel_surface(struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *surface_resource)
{
struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct desktop_shell *shell = wl_resource_get_user_data(resource);
struct input_panel_surface *ipsurf;
if (get_input_panel_surface(surface)) {
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"wl_input_panel::get_input_panel_surface already requested");
return;
}
ipsurf = create_input_panel_surface(shell, surface);
if (!ipsurf) {
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"surface->committed already set");
return;
}
ipsurf->resource =
wl_resource_create(client,
&zwp_input_panel_surface_v1_interface,
1,
id);
wl_resource_set_implementation(ipsurf->resource,
&input_panel_surface_implementation,
ipsurf,
destroy_input_panel_surface_resource);
}
static const struct zwp_input_panel_v1_interface input_panel_implementation = {
input_panel_get_input_panel_surface
};
static void
unbind_input_panel(struct wl_resource *resource)
{
struct desktop_shell *shell = wl_resource_get_user_data(resource);
shell->input_panel.binding = NULL;
}
static void
bind_input_panel(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
struct desktop_shell *shell = data;
struct wl_resource *resource;
resource = wl_resource_create(client,
&zwp_input_panel_v1_interface, 1, id);
if (shell->input_panel.binding == NULL) {
wl_resource_set_implementation(resource,
&input_panel_implementation,
shell, unbind_input_panel);
shell->input_panel.binding = resource;
return;
}
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"interface object already bound");
}
void
input_panel_destroy(struct desktop_shell *shell)
{
wl_list_remove(&shell->show_input_panel_listener.link);
wl_list_remove(&shell->hide_input_panel_listener.link);
}
int
input_panel_setup(struct desktop_shell *shell)
{
struct weston_compositor *ec = shell->compositor;
shell->show_input_panel_listener.notify = show_input_panels;
wl_signal_add(&ec->show_input_panel_signal,
&shell->show_input_panel_listener);
shell->hide_input_panel_listener.notify = hide_input_panels;
wl_signal_add(&ec->hide_input_panel_signal,
&shell->hide_input_panel_listener);
shell->update_input_panel_listener.notify = update_input_panels;
wl_signal_add(&ec->update_input_panel_signal,
&shell->update_input_panel_listener);
wl_list_init(&shell->input_panel.surfaces);
if (wl_global_create(shell->compositor->wl_display,
&zwp_input_panel_v1_interface, 1,
shell, bind_input_panel) == NULL)
return -1;
return 0;
}
|
0d83e6a997dc8c97e883d51b83c4e3fdf8b574d4
|
dfb59af794367d02891de53923aa3b67f7073472
|
/src/php/objects/php_vector.h
|
43399e65d3a70c75a715d39e7ecd69437eaa183b
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
php-ds/ext-ds
|
b31df34b05ad14af53a0d23ba7a7a15437f4004a
|
d42750d69beb684ec3ef7b3da48fba769ce57ffc
|
refs/heads/master
| 2023-08-26T11:28:53.328205
| 2023-07-29T04:04:32
| 2023-07-29T04:04:32
| 50,824,235
| 625
| 40
|
MIT
| 2023-07-29T04:04:33
| 2016-02-01T08:05:07
|
C
|
UTF-8
|
C
| false
| false
| 1,257
|
h
|
php_vector.h
|
#ifndef PHP_DS_VECTOR_H
#define PHP_DS_VECTOR_H
#include "../../ds/ds_vector.h"
typedef struct php_ds_vector {
ds_vector_t *vector;
zend_object std;
} php_ds_vector_t;
static inline php_ds_vector_t *php_ds_vector_fetch_object(zend_object *obj) {
return (php_ds_vector_t *)((char*)(obj) - XtOffsetOf(php_ds_vector_t, std));
}
#define Z_DS_VECTOR(z) (php_ds_vector_fetch_object(Z_OBJ(z))->vector)
#define Z_DS_VECTOR_P(z) Z_DS_VECTOR(*z)
#define THIS_DS_VECTOR() Z_DS_VECTOR_P(getThis())
#define ZVAL_DS_VECTOR(z, v) ZVAL_OBJ(z, php_ds_vector_create_object_ex(v))
#define RETURN_DS_VECTOR(v) \
do { \
ds_vector_t *_v = v; \
if (_v) { \
ZVAL_DS_VECTOR(return_value, _v); \
} else { \
ZVAL_NULL(return_value); \
} \
return; \
} while(0)
zend_object *php_ds_vector_create_object_ex(ds_vector_t *vector);
zend_object *php_ds_vector_create_object(zend_class_entry *ce);
zend_object *php_ds_vector_create_clone(ds_vector_t *vector);
PHP_DS_SERIALIZE_FUNCIONS(php_ds_vector);
#endif
|
f2a7a67d7d6058d45e5873059b4b3d41282f2cc2
|
83e7dc1281874779c46dfadcc15b2bb66d8e599c
|
/src/core/lv_obj_draw.h
|
cfecb1b0ea84aab35d14d2a902aa15e211a9e28a
|
[
"MIT"
] |
permissive
|
lvgl/lvgl
|
7d51d6774d6ac71df7101fc7ded56fea4b70be01
|
5c984b4a5364b6455966eb3a860153806c51626f
|
refs/heads/master
| 2023-08-30T22:39:20.283922
| 2023-08-30T19:55:29
| 2023-08-30T19:55:29
| 60,667,730
| 9,296
| 2,218
|
MIT
| 2023-09-14T17:59:34
| 2016-06-08T04:14:34
|
C
|
UTF-8
|
C
| false
| false
| 4,338
|
h
|
lv_obj_draw.h
|
/**
* @file lv_obj_draw.h
*
*/
#ifndef LV_OBJ_DRAW_H
#define LV_OBJ_DRAW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../draw/lv_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_obj_t;
struct _lv_obj_class_t;
typedef enum {
LV_LAYER_TYPE_NONE,
LV_LAYER_TYPE_SIMPLE,
LV_LAYER_TYPE_TRANSFORM,
} lv_layer_type_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize a rectangle draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized.
* Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`.
* @note Only the relevant fields will be set.
* E.g. if `border width == 0` the other border properties won't be evaluated.
*/
void lv_obj_init_draw_rect_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc);
/**
* Initialize a label draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
* Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_label_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc);
/**
* Initialize an image draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc);
/**
* Initialize a line draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_line_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc);
/**
* Initialize an arc draw descriptor from an object's styles in its current state
* @param obj pointer to an object
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
* @param draw_dsc the descriptor to initialize.
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc);
/**
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
* @param obj pointer to an object
* @param part part of the object
* @return the extra size required around the object
*/
lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part);
/**
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
* The result will be saved in `obj`.
* @param obj pointer to an object
*/
void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj);
/**
* Get the extended draw area of an object.
* @param obj pointer to an object
* @return the size extended draw area around the real coordinates
*/
lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
lv_layer_type_t _lv_obj_get_layer_type(const struct _lv_obj_t * obj);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OBJ_DRAW_H*/
|
8eed48d832280c6fd6ca947b73f88019af802326
|
1231e1bf4117cfaaa54bd4752cca1bdb71290cec
|
/ext/stub/constantsinterface.zep.c
|
e6ed8ba17263c5af68b2a1e129b643f81634ace5
|
[
"MIT"
] |
permissive
|
zephir-lang/zephir
|
ac53ec68e35d19860a4d80224d94f38a6a5e04b5
|
6773f19d9b272cafee96b9a30f9b152c28e982ea
|
refs/heads/development
| 2023-08-31T10:33:38.621586
| 2023-02-28T10:27:43
| 2023-02-28T10:27:43
| 11,478,636
| 291
| 47
|
MIT
| 2023-08-28T22:07:11
| 2013-07-17T14:49:27
|
PHP
|
UTF-8
|
C
| false
| true
| 2,068
|
c
|
constantsinterface.zep.c
|
#ifdef HAVE_CONFIG_H
#include "../ext_config.h"
#endif
#include <php.h>
#include "../php_ext.h"
#include "../ext.h"
#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>
#include "kernel/main.h"
#include "kernel/object.h"
ZEPHIR_INIT_CLASS(Stub_ConstantsInterface)
{
ZEPHIR_REGISTER_CLASS(Stub, ConstantsInterface, stub, constantsinterface, stub_constantsinterface_method_entry, 0);
zend_class_implements(stub_constantsinterface_ce, 1, stub_testinterface_ce);
return SUCCESS;
}
PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant1)
{
zval *this_ptr = getThis();
RETURN_NULL();
}
PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant2)
{
zval *this_ptr = getThis();
RETURN_BOOL(0);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant3)
{
zval *this_ptr = getThis();
RETURN_BOOL(1);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant4)
{
zval *this_ptr = getThis();
RETURN_LONG(10);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant5)
{
zval *this_ptr = getThis();
RETURN_DOUBLE(10.25);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInterfaceConstant6)
{
zval *this_ptr = getThis();
RETURN_STRING("test");
}
PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant1)
{
zval *this_ptr = getThis();
RETURN_NULL();
}
PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant2)
{
zval *this_ptr = getThis();
RETURN_BOOL(0);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant3)
{
zval *this_ptr = getThis();
RETURN_BOOL(1);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant4)
{
zval *this_ptr = getThis();
RETURN_LONG(10);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant5)
{
zval *this_ptr = getThis();
RETURN_DOUBLE(10.25);
}
PHP_METHOD(Stub_ConstantsInterface, testReadInheritanceFromInterfaceConstant6)
{
zval *this_ptr = getThis();
RETURN_STRING("test");
}
|
b6aae1ce9b50deef1834c10c8f708915a0ee379b
|
f47cb02269307e83d86373d9ab4bfb8b46283d22
|
/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.h
|
9271151f9986101e3e4f9f6dc6cb753864b32bde
|
[
"Apache-2.0"
] |
permissive
|
apache/guacamole-server
|
7c8adf3f389f0539df353ef8f7ea6d44144ffb16
|
fe24e2d45ac0ac90588f64b43da6e0d518e59177
|
refs/heads/master
| 2023-09-04T02:42:34.907413
| 2023-08-30T22:57:11
| 2023-08-30T22:57:11
| 54,452,627
| 2,019
| 580
|
Apache-2.0
| 2023-09-13T00:15:57
| 2016-03-22T07:00:06
|
C
|
UTF-8
|
C
| false
| false
| 4,968
|
h
|
rdpsnd-messages.h
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef GUAC_RDP_CHANNELS_RDPSND_MESSAGES_H
#define GUAC_RDP_CHANNELS_RDPSND_MESSAGES_H
#include "channels/common-svc.h"
#include <winpr/stream.h>
/**
* The header common to all RDPSND PDUs.
*/
typedef struct guac_rdpsnd_pdu_header {
/**
* The type of message represented by this PDU (SNDC_WAVE, etc.)
*/
int message_type;
/**
* The size of the remainder of the message.
*/
int body_size;
} guac_rdpsnd_pdu_header;
/**
* Handler for the SNDC_FORMATS (Server Audio Formats and Version) PDU. The
* SNDC_FORMATS PDU describes all audio formats supported by the RDP server, as
* well as the version of RDPSND implemented.
*
* @param svc
* The RDPSND channel receiving the SNDC_FORMATS PDU.
*
* @param input_stream
* The FreeRDP input stream containing the remaining raw bytes (after the
* common header) of the SNDC_FORMATS PDU.
*
* @param header
* The header content of the SNDC_FORMATS PDU. All RDPSND messages contain
* the same header information.
*/
void guac_rdpsnd_formats_handler(guac_rdp_common_svc* svc,
wStream* input_stream, guac_rdpsnd_pdu_header* header);
/**
* Handler for the SNDC_TRAINING (Training) PDU. The SNDC_TRAINING PDU is used
* to by RDP servers to test audio streaming latency, etc. without actually
* sending audio data. See:
*
* https://msdn.microsoft.com/en-us/library/cc240961.aspx
*
* @param svc
* The RDPSND channel receiving the SNDC_TRAINING PDU.
*
* @param input_stream
* The FreeRDP input stream containing the remaining raw bytes (after the
* common header) of the SNDC_TRAINING PDU.
*
* @param header
* The header content of the SNDC_TRAINING PDU. All RDPSND messages contain
* the same header information.
*/
void guac_rdpsnd_training_handler(guac_rdp_common_svc* svc,
wStream* input_stream, guac_rdpsnd_pdu_header* header);
/**
* Handler for the SNDC_WAVE (WaveInfo) PDU. The SNDC_WAVE immediately precedes
* a SNDWAV PDU and describes the data about to be received. It also (very
* strangely) contains exactly 4 bytes of audio data. The following SNDWAV PDU
* then contains 4 bytes of padding prior to the audio data where it would make
* perfect sense for this data to go. See:
*
* https://msdn.microsoft.com/en-us/library/cc240963.aspx
*
* @param svc
* The RDPSND channel receiving the SNDC_WAVE PDU.
*
* @param input_stream
* The FreeRDP input stream containing the remaining raw bytes (after the
* common header) of the SNDC_WAVE PDU.
*
* @param header
* The header content of the SNDC_WAVE PDU. All RDPSND messages contain
* the same header information.
*/
void guac_rdpsnd_wave_info_handler(guac_rdp_common_svc* svc,
wStream* input_stream, guac_rdpsnd_pdu_header* header);
/**
* Handler for the SNDWAV (Wave) PDU which follows any WaveInfo PDU. The SNDWAV
* PDU contains the actual audio data, less the four bytes of audio data
* included in the SNDC_WAVE PDU.
*
* @param svc
* The RDPSND channel receiving the SNDWAV PDU.
*
* @param input_stream
* The FreeRDP input stream containing the remaining raw bytes (after the
* common header) of the SNDWAV PDU.
*
* @param header
* The header content of the SNDWAV PDU. All RDPSND messages contain
* the same header information.
*/
void guac_rdpsnd_wave_handler(guac_rdp_common_svc* svc,
wStream* input_stream, guac_rdpsnd_pdu_header* header);
/**
* Handler for the SNDC_CLOSE (Close) PDU. This PDU is sent when audio
* streaming has stopped. This PDU is currently ignored by Guacamole. See:
*
* https://msdn.microsoft.com/en-us/library/cc240970.aspx
*
* @param svc
* The RDPSND channel receiving the SNDC_CLOSE PDU.
*
* @param input_stream
* The FreeRDP input stream containing the remaining raw bytes (after the
* common header) of the SNDC_CLOSE PDU.
*
* @param header
* The header content of the SNDC_CLOSE PDU. All RDPSND messages contain
* the same header information.
*/
void guac_rdpsnd_close_handler(guac_rdp_common_svc* svc,
wStream* input_stream, guac_rdpsnd_pdu_header* header);
#endif
|
d9803cdb20d992ffe3abb0e520174c9450f9a2b7
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/usr.sbin/makefs/cd9660.h
|
f3b8d2238bead659ca308f20eea633c18b2214ed
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 10,178
|
h
|
cd9660.h
|
/* $OpenBSD: cd9660.h,v 1.15 2021/09/01 15:19:00 deraadt Exp $ */
/* $NetBSD: cd9660.h,v 1.21 2015/12/24 15:52:37 christos Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
* Perez-Rathke and Ram Vedam. All rights reserved.
*
* This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys,
* Alan Perez-Rathke and Ram Vedam.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY DANIEL WATT, WALTER DEIGNAN, RYAN
* GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN
* GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
#ifndef _MAKEFS_CD9660_H
#define _MAKEFS_CD9660_H
#include <sys/queue.h>
#include <sys/endian.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <limits.h>
#include "makefs.h"
#include "cd9660/iso.h"
#include "cd9660/iso_rrip.h"
#include "cd9660/cd9660_eltorito.h"
#ifdef DEBUG
#define INODE_WARNX(__x) warnx __x
#else /* DEBUG */
#define INODE_WARNX(__x)
#endif /* DEBUG */
/******** STRUCTURES **********/
#define ISO_VOLUME_DESCRIPTOR_STANDARD_ID "CD001"
#define ISO_VOLUME_DESCRIPTOR_BOOT 0
#define ISO_VOLUME_DESCRIPTOR_PVD 1
#define ISO_VOLUME_DESCRIPTOR_TERMINATOR 255
/*30 for name and extension, as well as version number and padding bit*/
#define ISO_FILENAME_MAXLENGTH_BEFORE_VERSION 30
#define ISO_FILENAME_MAXLENGTH 36
#define ISO_FILENAME_MAXLENGTH_WITH_PADDING 37
#define ISO_FLAG_CLEAR 0x00
#define ISO_FLAG_HIDDEN 0x01
#define ISO_FLAG_DIRECTORY 0x02
#define ISO_FLAG_ASSOCIATED 0x04
#define ISO_FLAG_PERMISSIONS 0x08
#define ISO_FLAG_RESERVED5 0x10
#define ISO_FLAG_RESERVED6 0x20
#define ISO_FLAG_FINAL_RECORD 0x40
#define ISO_PATHTABLE_ENTRY_BASESIZE 8
#define ISO_RRIP_DEFAULT_MOVE_DIR_NAME "RR_MOVED"
#define RRIP_DEFAULT_MOVE_DIR_NAME ".rr_moved"
#define CD9660_BLOCKS(__sector_size, __bytes) \
howmany((__bytes), (__sector_size))
#define CD9660_MEM_ALLOC_ERROR(_F) \
err(1, "%s, %s l. %d", _F, __FILE__, __LINE__)
#define CD9660_TYPE_FILE 0x01
#define CD9660_TYPE_DIR 0x02
#define CD9660_TYPE_DOT 0x04
#define CD9660_TYPE_DOTDOT 0x08
#define CD9660_TYPE_VIRTUAL 0x80
#define CD9660_INODE_HASH_SIZE 1024
#define CD9660_SECTOR_SIZE 2048
#define CD9660_END_PADDING 150
/* Slight modification of the ISO structure in iso.h */
typedef struct _iso_directory_record_cd9660 {
u_char length [ISODCL (1, 1)]; /* 711 */
u_char ext_attr_length [ISODCL (2, 2)]; /* 711 */
u_char extent [ISODCL (3, 10)]; /* 733 */
u_char size [ISODCL (11, 18)]; /* 733 */
u_char date [ISODCL (19, 25)]; /* 7 by 711 */
u_char flags [ISODCL (26, 26)];
u_char file_unit_size [ISODCL (27, 27)]; /* 711 */
u_char interleave [ISODCL (28, 28)]; /* 711 */
u_char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
u_char name_len [ISODCL (33, 33)]; /* 711 */
char name [ISO_FILENAME_MAXLENGTH_WITH_PADDING];
} iso_directory_record_cd9660;
/* TODO: Lots of optimization of this structure */
typedef struct _cd9660node {
u_char type;/* Used internally */
/* Tree structure */
struct _cd9660node *parent; /* parent (NULL if root) */
TAILQ_HEAD(cd9660_children_head, _cd9660node) cn_children;
TAILQ_ENTRY(_cd9660node) cn_next_child;
struct _cd9660node *dot_record; /* For directories, used mainly in RRIP */
struct _cd9660node *dot_dot_record;
fsnode *node; /* pointer to fsnode */
struct _iso_directory_record_cd9660 *isoDirRecord;
struct iso_extended_attributes *isoExtAttributes;
/***** SIZE CALCULATION *****/
/*already stored in isoDirRecord, but this is an int version, and will be
copied to isoDirRecord on writing*/
uint32_t fileDataSector;
/*
* same thing, though some notes:
* If a file, this is the file size
* If a directory, this is the size of all its children's
* directory records
* plus necessary padding
*/
int64_t fileDataLength;
int64_t fileSectorsUsed;
int fileRecordSize;/*copy of a variable, int for quicker calculations*/
/* Old name, used for renaming - needs to be optimized but low priority */
char o_name [ISO_FILENAME_MAXLENGTH_WITH_PADDING];
/***** SPACE RESERVED FOR EXTENSIONS *****/
/* For memory efficiency's sake - we should move this to a separate struct
and point to null if not needed */
/* For Rock Ridge */
struct _cd9660node *rr_real_parent, *rr_relocated;
int64_t susp_entry_size;
int64_t susp_dot_entry_size;
int64_t susp_dot_dot_entry_size;
/* Continuation area stuff */
int64_t susp_entry_ce_start;
int64_t susp_dot_ce_start;
int64_t susp_dot_dot_ce_start;
int64_t susp_entry_ce_length;
int64_t susp_dot_ce_length;
int64_t susp_dot_dot_ce_length;
/* Data to put at the end of the System Use field */
int64_t su_tail_size;
char *su_tail_data;
/*** PATH TABLE STUFF ***/
int level; /*depth*/
int ptnumber;
struct _cd9660node *ptnext, *ptprev, *ptlast;
/* SUSP entries */
TAILQ_HEAD(susp_linked_list, ISO_SUSP_ATTRIBUTES) head;
} cd9660node;
typedef struct _path_table_entry
{
u_char length[ISODCL (1, 1)];
u_char extended_attribute_length[ISODCL (2, 2)];
u_char first_sector[ISODCL (3, 6)];
u_char parent_number[ISODCL (7, 8)];
u_char name[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
} path_table_entry;
typedef struct _volume_descriptor
{
u_char *volumeDescriptorData; /*ALWAYS 2048 bytes long*/
int64_t sector;
struct _volume_descriptor *next;
} volume_descriptor;
typedef struct _iso9660_disk {
int sectorSize;
struct iso_primary_descriptor primaryDescriptor;
struct iso_supplementary_descriptor supplementaryDescriptor;
volume_descriptor *firstVolumeDescriptor;
cd9660node *rootNode;
/* Important sector numbers here */
/* primaryDescriptor.type_l_path_table*/
int64_t primaryBigEndianTableSector;
/* primaryDescriptor.type_m_path_table*/
int64_t primaryLittleEndianTableSector;
/* primaryDescriptor.opt_type_l_path_table*/
int64_t secondaryBigEndianTableSector;
/* primaryDescriptor.opt_type_m_path_table*/
int64_t secondaryLittleEndianTableSector;
/* primaryDescriptor.path_table_size*/
int pathTableLength;
int64_t dataFirstSector;
int64_t totalSectors;
/* OPTIONS GO HERE */
int isoLevel;
int include_padding_areas;
/* SUSP options and variables */
int64_t susp_continuation_area_start_sector;
int64_t susp_continuation_area_size;
int64_t susp_continuation_area_current_free;
int rock_ridge_enabled;
/* Other Rock Ridge Variables */
char *rock_ridge_renamed_dir_name;
int rock_ridge_move_count;
cd9660node *rr_moved_dir;
/* Spec breaking options */
int allow_deep_trees;
int allow_multidot;
int omit_trailing_period;
/* BOOT INFORMATION HERE */
int has_generic_bootimage; /* Default to 0 */
char *generic_bootimage;
int is_bootable;/* Default to 0 */
int64_t boot_catalog_sector;
boot_volume_descriptor *boot_descriptor;
TAILQ_HEAD(boot_image_list,cd9660_boot_image) boot_images;
int image_serialno;
LIST_HEAD(boot_catalog_entries,boot_catalog_entry) boot_entries;
} iso9660_disk;
/************ FUNCTIONS **************/
int cd9660_valid_a_chars(const char *);
int cd9660_valid_d_chars(const char *);
void cd9660_uppercase_characters(char *, size_t);
/* ISO Data Types */
void cd9660_721(uint16_t, unsigned char *);
void cd9660_731(uint32_t, unsigned char *);
void cd9660_722(uint16_t, unsigned char *);
void cd9660_732(uint32_t, unsigned char *);
void cd9660_bothendian_dword(uint32_t dw, unsigned char *);
void cd9660_bothendian_word(uint16_t dw, unsigned char *);
void cd9660_set_date(char *, time_t);
void cd9660_time_8426(unsigned char *, time_t);
void cd9660_time_915(unsigned char *, time_t);
/*** Boot Functions ***/
int cd9660_write_generic_bootimage(FILE *);
int cd9660_write_boot(iso9660_disk *, FILE *);
int cd9660_add_boot_disk(iso9660_disk *, const char *);
int cd9660_eltorito_add_boot_option(iso9660_disk *, const char *,
const char *);
int cd9660_setup_boot(iso9660_disk *, int);
int cd9660_setup_boot_volume_descriptor(iso9660_disk *,
volume_descriptor *);
/*** Write Functions ***/
int cd9660_write_image(iso9660_disk *, const char *image);
int cd9660_copy_file(iso9660_disk *, FILE *, off_t, const char *);
char *cd9660_compute_full_filename(cd9660node *);
int cd9660_compute_record_size(iso9660_disk *, cd9660node *);
/* Debugging functions */
void debug_print_tree(iso9660_disk *, cd9660node *,int);
void debug_print_path_tree(cd9660node *);
void debug_print_volume_descriptor_information(iso9660_disk *);
void debug_dump_to_xml_ptentry(path_table_entry *,int, int);
void debug_dump_to_xml_path_table(FILE *, off_t, int, int);
void debug_dump_to_xml(FILE *);
int debug_get_encoded_number(unsigned char *, int);
void debug_dump_integer(const char *, char *,int);
void debug_dump_string(const char *,unsigned char *,int);
void debug_dump_directory_record_9_1(unsigned char *);
void debug_dump_to_xml_volume_descriptor(unsigned char *,int);
void cd9660_pad_string_spaces(char *, int);
#endif
|
ca30e4992c669aa1c348f230d8357b40615292c4
|
515a17dfa8acffb7dbc076dca5be7ef3ddc2952f
|
/tools/external/srapath/srapath.c
|
9332a25d6fb0c5fabba4583b44842d43fb99c0df
|
[
"LicenseRef-scancode-ncbi",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-us-govt-public-domain"
] |
permissive
|
ncbi/sra-tools
|
d54d2fe00214d9471b6dbd0b90c2fe0062f87cdd
|
1bb9cd2f317a232eb8f1e1d33cfc3582c71b3eec
|
refs/heads/master
| 2023-09-01T11:46:59.189830
| 2023-08-29T16:34:24
| 2023-08-29T16:34:24
| 23,203,598
| 991
| 271
|
NOASSERTION
| 2023-09-14T19:43:38
| 2014-08-21T21:25:38
|
C
|
UTF-8
|
C
| false
| false
| 25,337
|
c
|
srapath.c
|
/*===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
*/
#include "srapath.h" /* OPTION_PARAM */
#include "services.h" /* names_request */
#include "helper.h"
#include "line_iter.h"
#include <vfs/manager.h>
#include <vfs/path.h>
#include <vfs/resolver-priv.h> /* VResolverGetProject */
#include <vfs/services.h> /* KServiceMake */
#include <vfs/services-priv.h> /* KServiceGetQuality */
#include <kfs/directory.h>
#include <kapp/main.h>
#include <kapp/args.h>
#include <klib/log.h>
#include <klib/out.h>
#include <klib/printf.h> /* string_printf */
#include <klib/rc.h>
#include <klib/status.h> /* STSMSG */
#include <klib/text.h>
#include <klib/vector.h>
#include <sysalloc.h>
#include <limits.h> /* PATH_MAX */
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
#define RELEASE(type, obj) do { rc_t rc2 = type##Release(obj); \
if (rc2 && !rc) { rc = rc2; } obj = NULL; } while (false)
#define DEF_PROTO "https"
static const char * proto_usage[]
= { "protocol (fasp; http; https; fasp,http; ...) default=" DEF_PROTO, NULL };
#define OPTION_PROTO "protocol"
#define ALIAS_PROTO "a"
static const char * cache_usage[] = { "resolve cache location along with remote"
" when performing names function", NULL };
#define ALIAS_CACHE "c"
static const char * cart_usage[] = { "PATH to jwt cart file", NULL };
#define OPTION_CART "perm"
#define ALIAS_CART NULL
static const char * prj_usage[]
= { "use numeric [dbGaP] project-id in names-cgi-call", NULL };
#define ALIAS_PRJ "d"
static const char * vers_usage[] = { "version-string for cgi-calls", NULL };
#define OPTION_VERS "vers"
#define ALIAS_VERS "e"
static const char * func_usage[] = { "function to perform "
"(" FUNCTION_RESOLVE ", " FUNCTION_NAMES ", " FUNCTION_SEARCH ") "
"default=" FUNCTION_RESOLVE
" or " FUNCTION_NAMES " if " OPTION_PROTO " is specified", NULL };
#define OPTION_FUNC "function"
#define ALIAS_FUNC "f"
static const char * locn_usage[] = { "location of data", NULL };
#define OPTION_LOCN "location"
#define ALIAS_LOCN NULL
static const char * ngc_usage[] = { "PATH to ngc file", NULL };
#define OPTION_NGC "ngc"
#define ALIAS_NGC NULL
static const char * path_usage[]
= { "print path of object: names function-only", NULL };
#define OPTION_PATH "path"
#define ALIAS_PATH "P"
static const char * param_usage[]
= { "param to be added to cgi-call (tic=XXXXX): raw-only", NULL };
#define ALIAS_PARAM "p"
static const char * raw_usage[] = { "print the raw reply (instead of parsing it)", NULL };
#define ALIAS_RAW "r"
static const char * json_usage[] = { "print the reply in JSON", NULL };
#define ALIAS_JSON "j"
static const char * timeout_usage[] = { "timeout-value for request", NULL };
#define OPTION_TIMEOUT "timeout"
#define ALIAS_TIMEOUT "t"
static const char * url_usage[] = { "url to be used for cgi-calls", NULL };
#define OPTION_URL "url"
#define ALIAS_URL "u"
OptDef ToolOptions[] =
{ /* needs_value, required */
{ OPTION_FUNC , ALIAS_FUNC , NULL, func_usage , 1, true, false },
{ OPTION_LOCN , ALIAS_LOCN , NULL, locn_usage , 1, true, false },
{ OPTION_TIMEOUT, ALIAS_TIMEOUT, NULL, timeout_usage, 1, true, false },
{ OPTION_PROTO , ALIAS_PROTO , NULL, proto_usage , 1, true, false },
{ OPTION_VERS , ALIAS_VERS , NULL, vers_usage , 1, true, false },
{ OPTION_URL , ALIAS_URL , NULL, url_usage , 1, true, false },
{ OPTION_PARAM , ALIAS_PARAM , NULL, param_usage , 10, true, false },
{ OPTION_RAW , ALIAS_RAW , NULL, raw_usage , 1, false, false },
{ OPTION_JSON , ALIAS_JSON , NULL, json_usage , 1, false, false },
{ OPTION_PRJ , ALIAS_PRJ , NULL, prj_usage , 10, true , false },
{ OPTION_CACHE , ALIAS_CACHE , NULL, cache_usage , 1, false, false },
{ OPTION_PATH , ALIAS_PATH , NULL, path_usage , 1, false, false },
{ OPTION_CART , ALIAS_CART , NULL, cart_usage , 1, true , false },
{ OPTION_NGC , ALIAS_NGC , NULL, ngc_usage , 1, true , false },
};
const char UsageDefaultName[] = "srapath";
rc_t CC UsageSummary( const char * progname )
{
return OUTMSG(("\n"
"Usage:\n"
" %s [options] <accession> ...\n\n"
"Summary:\n"
" Tool to produce a list of full paths to files\n"
" (SRA and WGS runs, refseqs: reference sequences)\n"
" from list of NCBI accessions.\n"
"\n", progname));
}
rc_t CC Usage( const Args *args )
{
rc_t rc;
uint32_t idx, count = ( sizeof ToolOptions ) / ( sizeof ToolOptions[ 0 ] );
const char * progname = UsageDefaultName;
const char * fullpath = UsageDefaultName;
if ( args == NULL )
rc = RC ( rcExe, rcArgv, rcAccessing, rcSelf, rcNull );
else
rc = ArgsProgram( args, &fullpath, &progname );
if ( rc != 0 )
progname = fullpath = UsageDefaultName;
UsageSummary( progname );
OUTMSG((
" Output paths are ordered according to accession list.\n"
"\n"
" The accession search path will be determined according to the\n"
" configuration. It will attempt to find files in local and site\n"
" repositories, and will also check remote repositories for run\n"
" location.\n"));
OUTMSG((
" This tool produces a path that is 'likely' to be a run, in that\n"
" an entry exists in the file system at the location predicted.\n"
" It is possible that this path will fail to produce success upon\n"
" opening a run if the path does not point to a valid object.\n\n"));
OUTMSG(( "Options:\n" ));
for ( idx = 0; idx < count; ++idx ) {
/* start with 1, do not advertize row-range-option*/
const char * param = NULL;
if (ToolOptions[idx].aliases == NULL) {
if (strcmp(ToolOptions[idx].name, OPTION_NGC) == 0 ||
strcmp(ToolOptions[idx].name, OPTION_CART) == 0)
{
param = "PATH";
}
}
HelpOptionLine( ToolOptions[ idx ].aliases, ToolOptions[ idx ].name,
param, ToolOptions[ idx ].help );
}
OUTMSG(( "\n" ));
HelpOptionsStandard();
HelpVersion( fullpath, KAppVersion() );
return rc;
}
static rc_t KSrvRun_Print(
const KSrvRun * self, const char * arg, VQuality preferred)
{
const VPath * local = NULL;
const VPath * remote = NULL;
const VPath * path = NULL;
const String * tmp = NULL;
rc_t rc = KSrvRunQuery(self, &local, &remote, NULL, NULL);
if (rc == 0) {
if (local != NULL)
path = local;
else if (remote != NULL)
path = remote;
}
if (path != NULL) {
VQuality q = VPathGetQuality(path);
if (q < eQualLast) {
if (q == eQualNo || q == eQualFull) {
char msg[256] = "";
string_printf(msg, sizeof msg, NULL,
"'%s' is an SRA %s file%s:",
arg,
q == eQualNo ? "Lite" : "Normalized Format",
preferred == q ? "" :
", if this is different from your "
"preference, it may be due to current file availability");
STSMSG(1, (msg));
}
}
rc = VPathMakeString(path, &tmp);
if (rc == 0) {
OUTMSG(("%S\n", tmp));
free((void *)tmp);
}
}
RELEASE(VPath, local);
RELEASE(VPath, remote);
return rc;
}
static rc_t KSrvRespFile_Print(const KSrvRespFile * self) {
const VPath * path = NULL;
const String * tmp = NULL;
rc_t rc = KSrvRespFileGetLocal(self, &path);
if (rc != 0) {
KSrvRespFileIterator * fi = NULL;
rc = KSrvRespFileMakeIterator(self, &fi);
if (rc == 0)
rc = KSrvRespFileIteratorNextPath(fi, &path);
RELEASE(KSrvRespFileIterator, fi);
}
if (path != NULL) {
rc = VPathMakeString(path, &tmp);
if (rc == 0) {
OUTMSG(("%S\n", tmp));
free((void *)tmp);
}
}
RELEASE(VPath, path);
return rc;
}
static rc_t resolve_one_argument( VFSManager * mgr, VResolver * resolver,
const char * pc, const char * location,
const char * cart, const char * ngc )
{
bool found = true;
rc_t rc = 0;
if ( true ) {
found = false;
KService * service = NULL;
rc = KServiceMake ( & service );
if ( rc == 0 ) {
if ( pc != NULL )
rc = KServiceAddId ( service, pc );
else if (cart != NULL) {
rc = KServiceSetJwtKartFile(service, cart);
if (rc != 0)
PLOGERR(klogErr, (klogErr, rc,
"cannot use '$(perm)' as jwt cart file",
"perm=%s", cart));
}
else
rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInsufficient);
}
if (rc == 0 && location != NULL)
rc = KServiceSetLocation(service, location);
if (rc == 0) {
uint32_t project = 0;
rc = VResolverGetProject(resolver, &project);
if (rc == 0 && project != 0)
rc = KServiceAddProject(service, project);
if (rc == 0 && ngc != NULL) {
rc = KServiceSetNgcFile(service, ngc);
if (rc != 0)
PLOGERR(klogErr, (klogErr, rc,
"cannot use '$(ngc)' as ngc file",
"ngc=%s", ngc));
}
}
if ( rc == 0 ) {
VQuality q = eQualLast;
VRemoteProtocols protocol = eProtocolHttps;
const KSrvResponse * response = NULL;
rc = KServiceNamesQuery ( service, protocol, & response );
{
const char * quality = NULL;
rc_t r2 = KServiceGetQuality(service, &quality);
if (r2 != 0) {
if (rc == 0)
rc = r2;
}
else if (quality != NULL) {
const char * msg = NULL;
switch (quality[0]) {
case 'Z':
q = eQualNo;
msg = "Current preference is set to retrieve SRA "
"Lite files with simplified base quality scores.";
break;
case 'R':
q = eQualFull;
msg = "Current preference is set to retrieve SRA "
"Normalized Format files with full base quality scores.";
break;
}
if (msg != NULL)
STSMSG(1, (msg));
}
}
if ( rc == 0 ) {
KSrvRunIterator * ri = NULL;
const KSrvRun * run = NULL;
uint32_t i = 0;
uint32_t l = KSrvResponseLength ( response );
rc = KSrvResponseMakeRunIterator ( response, & ri );
if ( rc == 0 ) {
rc = KSrvRunIteratorNextRun ( ri, & run );
if ( rc == 0 && run != NULL ) {
rc = KSrvRun_Print ( run, pc, q );
found = true;
}
for ( i = 0; !found && i < l && rc == 0; ++ i ) {
const KSrvRespObj * obj = NULL;
KSrvRespObjIterator * it = NULL;
KSrvRespFile * file = NULL;
ESrvFileFormat type = eSFFInvalid;
rc = KSrvResponseGetObjByIdx ( response, i, & obj );
if ( rc == 0 )
rc = KSrvRespObjMakeIterator ( obj, & it );
while ( rc == 0 ) {
rc_t r2 = 0;
rc = KSrvRespObjIteratorNextFile ( it, & file );
if ( rc != 0 || file == NULL )
break;
r2 = KSrvRespFileGetFormat(file, &type);
if (r2 != 0 || type != eSFFVdbcache) {
rc = KSrvRespFile_Print(file);
found = true;
}
RELEASE ( KSrvRespFile, file );
}
RELEASE ( KSrvRespObjIterator, it );
RELEASE ( KSrvRespObj, obj );
}
}
RELEASE ( KSrvRun, run );
RELEASE ( KSrvRunIterator, ri );
KSrvResponseRelease ( response );
}
}
KServiceRelease ( service );
}
else {
const VPath * upath = NULL;
rc = VFSManagerMakePath( mgr, ( VPath** )&upath, "%s", pc );
if ( rc != 0 )
PLOGMSG( klogErr, ( klogErr,
"failed to create VPath-object from '$(name)'",
"name=%s", pc ) );
else {
const VPath * local;
const VPath * remote;
rc = VResolverQuery( resolver, 0, upath, &local, &remote, NULL );
if ( rc == 0 ) {
const String * s;
if ( local != NULL )
rc = VPathMakeString( local, &s );
else
rc = VPathMakeString( remote, &s );
if ( rc == 0 ) {
OUTMSG(("%S\n", s));
free( ( void* )s );
}
VPathRelease( local );
VPathRelease( remote );
}
else
found = false;
VPathRelease( upath );
}
}
if ( ! found ) {
KDirectory * cwd = NULL;
rc_t orc = VFSManagerGetCWD( mgr, &cwd );
if ( orc == 0 ) {
KPathType kpt = KDirectoryPathType( cwd, "%s", pc );
switch ( kpt &= ~kptAlias ) {
case kptNotFound : STSMSG( 1, ( "'%s': not found while "
"searching the file system",
pc ) );
break;
case kptBadPath : STSMSG( 1, ( "'%s': bad path while "
"searching the file system",
pc ) );
break;
default : STSMSG( 1, ( "'%s': "
"found in the file system",
pc ) );
rc = 0;
break;
}
}
if ( orc == 0 && rc == 0 ) {
if ( rc != 0 )
{
PLOGMSG( klogErr, ( klogErr, "'$(name)': not found",
"name=%s", pc ) );
}
else
{
char resolved[ PATH_MAX ] = "";
rc = KDirectoryResolvePath( cwd, true, resolved,
sizeof resolved, "%s", pc );
if ( rc == 0 )
{
STSMSG( 1, ( "'%s': found in "
"the current directory at '%s'",
pc, resolved ) );
OUTMSG(( "%s\n", resolved ));
}
else
{
STSMSG( 1, ( "'%s': cannot resolve "
"in the current directory",
pc ) );
OUTMSG(( "./%s\n", pc ));
}
}
}
KDirectoryRelease( cwd );
}
return rc;
}
static rc_t resolve_arguments( Args * args )
{
uint32_t acount;
rc_t rc = 0;
uint32_t idx = 0;
const char * cart = NULL;
rc = ArgsOptionCount(args, OPTION_CART, &idx);
if (rc == 0 && idx > 0)
rc = ArgsOptionValue(args, OPTION_CART, 0, (const void**)&cart);
if (rc == 0)
rc = ArgsParamCount(args, &acount);
if ( rc != 0 )
LOGERR ( klogInt, rc, "failed to count parameters" );
else if ( acount < 1 && cart == NULL )
{
MiniUsage( args );
rc = RC( rcExe, rcArgv, rcParsing, rcParam, rcInsufficient );
}
else
{
VFSManager * mgr;
rc = VFSManagerMake( &mgr );
if ( rc != 0 )
LOGERR ( klogErr, rc, "failed to create VFSManager object" );
else
{
VResolver * resolver;
rc = VFSManagerGetResolver( mgr, &resolver );
if ( rc != 0 )
LOGERR ( klogErr, rc, "failed to get VResolver object" );
else
{
rc_t r2 = 0;
const char * location = get_str_option(args, OPTION_LOCN, NULL);
const char * ngc = get_str_option(args, OPTION_NGC, NULL);
rc = ArgsOptionCount ( args, OPTION_PROTO, & idx );
if ( rc == 0 && idx == 0 )
rc = ArgsOptionCount ( args, OPTION_VERS, & idx );
if ( rc == 0 && idx == 0 )
rc = ArgsOptionCount ( args, OPTION_URL, & idx );
if ( rc == 0 && idx == 0 )
rc = ArgsOptionCount ( args, OPTION_PARAM, & idx );
if ( rc == 0 && idx == 0 )
rc = ArgsOptionCount ( args, OPTION_RAW, & idx );
if ( rc == 0 && idx == 0 )
rc = ArgsOptionCount ( args, OPTION_PRJ, & idx );
if ( rc == 0 && idx == 0 )
rc = ArgsOptionCount ( args, OPTION_CACHE, & idx );
if ( rc == 0 && idx > 0 )
LOGMSG ( klogWarn, "all the options are ignored "
"when running '" FUNCTION_RESOLVE "' function" );
for ( idx = 0; rc == 0 && idx < acount; ++ idx )
{
const char * pc;
rc = ArgsParamValue( args, idx, ( const void ** )&pc );
if ( rc != 0 )
LOGERR( klogInt, rc, "failed to retrieve parameter value" );
else {
rc_t rx = resolve_one_argument(
mgr, resolver, pc, location, NULL, ngc );
if ( rx != 0 && r2 == 0)
r2 = rx;
}
}
if (cart != NULL) {
rc_t rx = resolve_one_argument(
mgr, resolver, NULL, location, cart, ngc);
if (rx != 0 && r2 == 0)
r2 = rx;
}
if (r2 != 0 && rc == 0)
rc = r2;
VResolverRelease( resolver );
}
VFSManagerRelease( mgr );
}
}
return rc;
}
/* ---------------------------------------------------------------------------- */
static rc_t on_reply_line( const String * line, void * data )
{
return KOutMsg( "%S\n", line );
}
typedef struct out_fmt
{
bool raw, cache, path, json;
} out_fmt;
static rc_t prepare_request( const Args * args, request_params * r, out_fmt * fmt,
bool for_names )
{
rc_t rc = 0;
assert ( r );
memset ( r, 0, sizeof * r );
args_to_ptrs( args, &r->terms );
if ( rc == 0 )
rc = options_to_ptrs( args, OPTION_PARAM, &r->params );
if ( rc == 0 )
rc = options_to_nums ( args, OPTION_PRJ, & r -> projects );
fmt->cache = get_bool_option( args, OPTION_CACHE );
fmt->path = get_bool_option( args, OPTION_PATH );
if ( rc == 0 )
{
if ( for_names )
{
r->names_url = get_str_option( args, OPTION_URL, NULL );
r->names_ver = get_str_option( args, OPTION_VERS, NULL );
r->proto = get_str_option( args, OPTION_PROTO, DEF_PROTO );
r->location = get_str_option( args, OPTION_LOCN, NULL );
r->search_url = NULL;
r->search_ver = NULL;
}
else
{
uint32_t count = 0;
r->names_url = NULL;
r->names_ver = NULL;
r->search_url = get_str_option( args, OPTION_URL, NULL );
r->search_ver = get_str_option( args, OPTION_VERS, NULL );
if ( fmt -> cache )
LOGMSG ( klogWarn, "'--" OPTION_CACHE
"' is ignored when running '" FUNCTION_SEARCH "' function" );
if ( r -> projects != NULL && * r -> projects != 0 )
LOGMSG ( klogWarn, "'--" OPTION_PRJ
"' is ignored when running '" FUNCTION_SEARCH "' function" );
rc = ArgsOptionCount ( args, OPTION_PROTO, & count );
if ( rc == 0 && count > 0 )
LOGMSG ( klogWarn, "'--" OPTION_PROTO
"' is ignored when running '" FUNCTION_SEARCH "' function" );
}
r->buffer_size = 4096;
r->timeout_ms = get_uint32_t_option( args, OPTION_TIMEOUT, 5000 );
}
fmt->raw = get_bool_option( args, OPTION_RAW );
fmt->json = get_bool_option( args, OPTION_JSON );
r->cart = get_str_option(args, OPTION_CART, NULL);
r->ngc = get_str_option(args, OPTION_NGC, NULL);
return rc;
}
static void destroy_request ( request_params * self ) {
assert ( self );
free ( ( void * ) self -> params );
free ( self -> projects );
free ( ( void * ) self -> terms );
memset ( self, 0, sizeof * self );
}
static rc_t names_cgi( const Args * args )
{
request_params r;
out_fmt fmt;
rc_t rc = prepare_request( args, &r, &fmt, true );
if ( rc == 0 )
{
uint32_t rslt_code;
if ( fmt.raw ) {
if ( fmt . cache )
LOGMSG ( klogWarn, "'--" OPTION_CACHE
"' is ignored with '--" OPTION_RAW "'" );
rc = raw_names_request( &r, on_reply_line, &rslt_code, NULL );
}
else if (fmt.json) {
rc = names_request_json ( & r, fmt . cache, fmt . path );
}
else
rc = names_request ( & r, fmt . cache, fmt . path );
destroy_request ( & r );
}
return rc;
}
static rc_t search_cgi( const Args * args )
{
request_params r;
out_fmt fmt;
rc_t rc = prepare_request( args, &r, &fmt, false );
if ( rc == 0 )
{
uint32_t rslt_code;
if ( fmt.raw )
rc = raw_search_request( &r, on_reply_line, &rslt_code, NULL );
else
rc = search_request ( & r );
destroy_request ( & r );
}
return rc;
}
/* ---------------------------------------------------------------------------- */
rc_t CC KMain( int argc, char *argv [] )
{
Args * args;
uint32_t num_options = sizeof ToolOptions / sizeof ToolOptions [ 0 ];
rc_t rc = ArgsMakeAndHandle ( &args, argc, argv, 1, ToolOptions, num_options );
if ( rc != 0 )
LOGERR( klogInt, rc, "failed to parse arguments" );
else
{
const char * f = get_str_option( args, OPTION_FUNC, NULL );
func_t ft = get_func_t( f );
const char * p = get_str_option( args, OPTION_PROTO, NULL );
if ( f == NULL && p != NULL )
ft = ft_names;
switch ( ft )
{
case ft_resolve : rc = resolve_arguments( args ); break;
case ft_names : rc = names_cgi( args ); break;
case ft_search : rc = search_cgi( args ); break;
}
ArgsWhack( args );
}
return rc;
}
|
11f7a036a069eb2ac39de574d2d8a4ab067bd03d
|
55540f3e86f1d5d86ef6b5d295a63518e274efe3
|
/components/platform/soc/bl602/bl602_std/bl602_std/RISCV/Core/Include/cmsis_compatible_gcc.h
|
351cb3f5bce3a823d55c9a270c5602152cca0f2e
|
[
"Apache-2.0"
] |
permissive
|
bouffalolab/bl_iot_sdk
|
bc5eaf036b70f8c65dd389439062b169f8d09daa
|
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
|
refs/heads/master
| 2023-08-31T03:38:03.369853
| 2023-08-16T08:50:33
| 2023-08-18T09:13:27
| 307,347,250
| 244
| 101
|
Apache-2.0
| 2023-08-28T06:29:02
| 2020-10-26T11:16:30
|
C
|
UTF-8
|
C
| false
| false
| 4,344
|
h
|
cmsis_compatible_gcc.h
|
#ifndef __CMSIS_COMPATIBLE_GCC_H
#define __CMSIS_COMPATIBLE_GCC_H
/* CMSIS compiler specific defines */
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __ALWAYS_INLINE
#define __ALWAYS_INLINE inline __attribute__((always_inline))
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __attribute__((noreturn))
#endif
#ifndef __USED
#define __USED __attribute__((used))
#endif
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
#ifndef __PACKED
#define __PACKED __attribute__((packed, aligned(1)))
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION union __attribute__((packed, aligned(1)))
#endif
#ifndef __IRQ
#define __IRQ __attribute__((interrupt))
#endif
#ifndef __IRQ_ALIGN64
#define __IRQ_ALIGN64 __attribute__((interrupt,aligned(64)))
#endif
#ifndef ALIGN4
#define ALIGN4 __attribute((aligned (4)))
#endif
/**
\brief No Operation
\details No Operation does nothing. This instruction can be used for code alignment purposes.
*/
//__attribute__((always_inline)) __STATIC_INLINE void __NOP(void)
//{
// __ASM volatile ("nop");
//}
#define __NOP() __ASM volatile ("nop") /* This implementation generates debug information */
/**
\brief Wait For Interrupt
\details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
*/
//__attribute__((always_inline)) __STATIC_INLINE void __WFI(void)
//{
// __ASM volatile ("wfi");
//}
#define __WFI() __ASM volatile ("wfi") /* This implementation generates debug information */
/**
\brief Wait For Event
\details Wait For Event is a hint instruction that permits the processor to enter
a low-power state until one of a number of events occurs.
*/
//__attribute__((always_inline)) __STATIC_INLINE void __WFE(void)
//{
// __ASM volatile ("wfe");
//}
#define __WFE() __ASM volatile ("wfe") /* This implementation generates debug information */
/**
\brief Send Event
\details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
*/
//__attribute__((always_inline)) __STATIC_INLINE void __SEV(void)
//{
// __ASM volatile ("sev");
//}
#define __SEV() __ASM volatile ("sev") /* This implementation generates debug information */
__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void)
{
__ASM volatile ("csrsi mstatus, 8");
}
__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)
{
__ASM volatile ("csrci mstatus, 8");
}
__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV(uint32_t value)
{
//return __builtin_bswap32(value);
uint32_t res = 0;
res = (value << 24) | (value >> 24);
res &= 0xFF0000FF; /* only for sure */
res |= ((value >> 8) & 0x0000FF00) | ((value << 8) & 0x00FF0000);
return res;
}
__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value)
{
return __builtin_bswap16(value);
}
extern void clic_enable_interrupt (uint32_t source);
extern void clic_disable_interrupt ( uint32_t source);
extern void clic_set_pending(uint32_t source);
extern void clic_clear_pending(uint32_t source);
#define NVIC_EnableIRQ clic_enable_interrupt
#define NVIC_DisableIRQ clic_disable_interrupt
#define NVIC_ClearPendingIRQ clic_clear_pending
//#define __set_MSP(val) __ASM volatile ("lw sp,0(%0)":: "r"(val))
#define __set_MSP(msp) __ASM volatile ("add sp, x0, %0":: "r"(msp))
#endif /* __CMSIS_COMPATIBLE_GCC_H */
|
b7469b2150755ec2cbc2dcfd6ba9f02878d4d641
|
0cc343d927d5db6693006018986715c43acab961
|
/tests/errors/if_while_component_pure.c
|
7a107a2a0a0e56d9360670aad8fc4df8fa817fbb
|
[
"MIT"
] |
permissive
|
verifast/verifast
|
ec0101fc4a69bd33c5f66be4444169c4e060ead8
|
d152da790c7ebf72ce616533a6c83082629adbdb
|
refs/heads/master
| 2023-08-25T00:13:51.464802
| 2023-08-13T10:00:00
| 2023-08-13T10:00:00
| 14,519,163
| 325
| 64
|
NOASSERTION
| 2023-08-10T21:16:08
| 2013-11-19T08:57:02
|
OCaml
|
UTF-8
|
C
| false
| false
| 1,056
|
c
|
if_while_component_pure.c
|
void ifTest()
//@ requires true;
//@ ensures true;
{
int x = 0;
if (2 == 3)
//@ assert true; //~ should_fail
x = 4;
assert(x == 4);
}
void elseTest()
//@ requires true;
//@ ensures true;
{
int x = 0;
if (2 == 2);
else
//@ assert true; //~ should_fail
x = 4;
assert(x == 4);
}
void whileTest()
//@ requires true;
//@ ensures true;
{
int x = 0;
while (2 == 3)
//@ invariant true;
//@ decreases 0;
//@ assert true; //~ should_fail
x = 4;
assert(x == 4);
}
void forTest()
//@ requires true;
//@ ensures true;
{
int x = 0;
for (x = 1; 2 == 3; x++)
//@ invariant true;
//@ decreases 0;
//@ assert true; //~ should_fail
x = 4;
assert(x == 4);
}
void forSpecTest()
//@ requires true;
//@ ensures true;
{
int x = 0;
for (x = 1; 2 == 3; x++)
//@ requires true;
//@ ensures true;
//@ decreases 0;
//@ assert true; //~ should_fail
x = 4;
assert(x == 4);
}
|
85d58bcdd94b7d5f7292a10bdca7ae55b5128961
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/wasi/libc-top-half/musl/include/sys/vfs.h
|
a899db276342327aa41c34c81629e85dffcd1f7c
|
[
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-musl-exception",
"MIT",
"LLVM-exception",
"Apache-2.0",
"NCSA"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 24
|
h
|
vfs.h
|
#include <sys/statfs.h>
|
862d304c113e8c7b3126a402eee5764c85946cec
|
f6e5f3c038fb15cb1bfd2e0a6e8038324656bd28
|
/3rdparty/openssl-win32/openssl/bn.h
|
54d59dad3aed213c8fcfb21d1ef6de8c1cfb1a4e
|
[
"OpenSSL",
"MIT"
] |
permissive
|
vslavik/winsparkle
|
c838830255f0fc0d0d1c4c6251e450ebf0eb9a45
|
415acf557e8c15a12d8168d298b3b577fdbc6d54
|
refs/heads/master
| 2023-09-01T13:39:55.053989
| 2023-08-31T16:20:45
| 2023-08-31T17:17:37
| 467,582
| 1,105
| 279
|
NOASSERTION
| 2023-09-13T21:46:13
| 2010-01-11T16:13:10
|
C++
|
UTF-8
|
C
| false
| false
| 40
|
h
|
bn.h
|
#include "../../openssl/crypto/bn/bn.h"
|
690ed6d04e36829b2c63ad0aeece987158751584
|
ea9ac7578bc8a8fc83377f651b80e19920338fda
|
/src/intel/vulkan/anv_gem_stubs.c
|
0f4a3f5da00147dd60aaa006f9c0996a59fed9c4
|
[] |
no_license
|
yuq/mesa-lima
|
9d263945e23118c7aa997bb9fcb87ae6bf7ddf0d
|
2adeaa87e813644dcf70f903c0ac909d65ef2972
|
refs/heads/lima-18.1
| 2021-01-25T11:03:44.405200
| 2018-05-27T12:53:15
| 2018-05-27T12:53:15
| 93,909,976
| 186
| 21
| null | 2018-06-05T01:32:44
| 2017-06-10T02:07:43
|
C
|
UTF-8
|
C
| false
| false
| 5,428
|
c
|
anv_gem_stubs.c
|
/*
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <linux/memfd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include "anv_private.h"
#ifndef HAVE_MEMFD_CREATE
static inline int
memfd_create(const char *name, unsigned int flags)
{
return syscall(SYS_memfd_create, name, flags);
}
#endif
uint32_t
anv_gem_create(struct anv_device *device, uint64_t size)
{
int fd = memfd_create("fake bo", MFD_CLOEXEC);
if (fd == -1)
return 0;
assert(fd != 0);
if (ftruncate(fd, size) == -1)
return 0;
return fd;
}
void
anv_gem_close(struct anv_device *device, uint32_t gem_handle)
{
close(gem_handle);
}
void*
anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,
uint64_t offset, uint64_t size, uint32_t flags)
{
/* Ignore flags, as they're specific to I915_GEM_MMAP. */
(void) flags;
return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
gem_handle, offset);
}
/* This is just a wrapper around munmap, but it also notifies valgrind that
* this map is no longer valid. Pair this with anv_gem_mmap().
*/
void
anv_gem_munmap(void *p, uint64_t size)
{
munmap(p, size);
}
uint32_t
anv_gem_userptr(struct anv_device *device, void *mem, size_t size)
{
return -1;
}
int
anv_gem_busy(struct anv_device *device, uint32_t gem_handle)
{
return 0;
}
int
anv_gem_wait(struct anv_device *device, uint32_t gem_handle, int64_t *timeout_ns)
{
return 0;
}
int
anv_gem_execbuffer(struct anv_device *device,
struct drm_i915_gem_execbuffer2 *execbuf)
{
return 0;
}
int
anv_gem_set_tiling(struct anv_device *device,
uint32_t gem_handle, uint32_t stride, uint32_t tiling)
{
return 0;
}
int
anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle,
uint32_t caching)
{
return 0;
}
int
anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,
uint32_t read_domains, uint32_t write_domain)
{
return 0;
}
int
anv_gem_get_param(int fd, uint32_t param)
{
unreachable("Unused");
}
bool
anv_gem_get_bit6_swizzle(int fd, uint32_t tiling)
{
unreachable("Unused");
}
int
anv_gem_create_context(struct anv_device *device)
{
unreachable("Unused");
}
int
anv_gem_destroy_context(struct anv_device *device, int context)
{
unreachable("Unused");
}
int
anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value)
{
unreachable("Unused");
}
int
anv_gem_get_context_param(int fd, int context, uint32_t param, uint64_t *value)
{
unreachable("Unused");
}
bool
anv_gem_has_context_priority(int fd)
{
unreachable("Unused");
}
int
anv_gem_get_aperture(int fd, uint64_t *size)
{
unreachable("Unused");
}
bool
anv_gem_supports_48b_addresses(int fd)
{
unreachable("Unused");
}
int
anv_gem_gpu_get_reset_stats(struct anv_device *device,
uint32_t *active, uint32_t *pending)
{
unreachable("Unused");
}
int
anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle)
{
unreachable("Unused");
}
uint32_t
anv_gem_fd_to_handle(struct anv_device *device, int fd)
{
unreachable("Unused");
}
int
anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2)
{
unreachable("Unused");
}
int
anv_gem_syncobj_export_sync_file(struct anv_device *device, uint32_t handle)
{
unreachable("Unused");
}
int
anv_gem_syncobj_import_sync_file(struct anv_device *device,
uint32_t handle, int fd)
{
unreachable("Unused");
}
uint32_t
anv_gem_syncobj_create(struct anv_device *device, uint32_t flags)
{
unreachable("Unused");
}
void
anv_gem_syncobj_destroy(struct anv_device *device, uint32_t handle)
{
unreachable("Unused");
}
int
anv_gem_syncobj_handle_to_fd(struct anv_device *device, uint32_t handle)
{
unreachable("Unused");
}
uint32_t
anv_gem_syncobj_fd_to_handle(struct anv_device *device, int fd)
{
unreachable("Unused");
}
void
anv_gem_syncobj_reset(struct anv_device *device, uint32_t handle)
{
unreachable("Unused");
}
bool
anv_gem_supports_syncobj_wait(int fd)
{
return false;
}
int
anv_gem_syncobj_wait(struct anv_device *device,
uint32_t *handles, uint32_t num_handles,
int64_t abs_timeout_ns, bool wait_all)
{
unreachable("Unused");
}
|
6405eff8818cefdfabecbd5eb017a252e7b2421b
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/components/libc/posix/pthreads/pthread_attr.c
|
3255ac09f0313f4c965015a1d18f207ca747bc00
|
[
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 23,939
|
c
|
pthread_attr.c
|
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2010-10-26 Bernard the first version
*/
#include <rtthread.h>
#include "pthread.h"
#include "sched.h"
#include <string.h>
#define DEFAULT_STACK_SIZE 2048
#define DEFAULT_PRIORITY (RT_THREAD_PRIORITY_MAX/2 + RT_THREAD_PRIORITY_MAX/4)
const pthread_attr_t pthread_default_attr =
{
0, /* stack base */
DEFAULT_STACK_SIZE, /* stack size */
PTHREAD_INHERIT_SCHED, /* Inherit parent prio/policy */
SCHED_FIFO, /* scheduler policy */
{
DEFAULT_PRIORITY, /* scheduler priority */
},
PTHREAD_CREATE_JOINABLE, /* detach state */
};
/**
* @brief This function will initialize thread attributes object.
*
* @note The pthread_attr_t type should be treated as opaque: any access to the object other
* than via pthreads functions is nonportable and produces undefined results.
* The resulting attribute object (possibly modified by setting individual attribute values),
* when used by pthread_create(), defines the attributes of the thread created. A single attributes
* object can be used in multiple simultaneous calls to pthread_create().
*
* @see pthread_create()
*
* @param attr is a thread attributes object.
*
* @return Upon successful completion, pthread_attr_init() return a value of 0.
* Otherwise, it means that the event detach failed.
*
* @warning This function will fail if attr is null.
*/
int pthread_attr_init(pthread_attr_t *attr)
{
RT_ASSERT(attr != RT_NULL);
*attr = pthread_default_attr;
return 0;
}
RTM_EXPORT(pthread_attr_init);
/**
* @brief This function will destroy thread attributes object.
*
* @note When a thread attributes object is no longer required, it should be destroyed
* using the pthread_attr_destroy() function. Destroying a thread attributes object
* has no effect on threads that were created using that object.
* Once a thread attributes object has been destroyed, it can be reinitialized using pthread_attr_init().
* Any other use of a destroyed thread attributes object has undefined results.
*
* @see pthread_attr_init(), pthread_attr_getdetachstate(), pthread_create()
*
* @param attr is a thread attributes object.
*
* @return Upon successful completion, pthread_attr_destroy() and shall return a value of 0;
* Otherwise, an error number shall be returned to indicate the error.
*
* @warning This function will fail if attr is null.
*/
int pthread_attr_destroy(pthread_attr_t *attr)
{
RT_ASSERT(attr != RT_NULL);
memset(attr, 0, sizeof(pthread_attr_t));
return 0;
}
RTM_EXPORT(pthread_attr_destroy);
/**
* @brief This function set detach state attribute in thread attributes object.
*
* @note This function sets the detach state attribute of the thread attributes object
* referred to by attr to the value specified in detachstate. The detach state
* attribute determines whether a thread created using the thread attributes
* object attr will be created in a joinable or a detached state.
*
* @see pthread_attr_init(), pthread_create(), pthread_detach(), pthread_join(), pthreads()
*
* @param attr is a thread attributes object.
*
* @param state is attribute in the attr object.
* attribute controls whether the thread is created in a detached state.
* The detachstate can be ONE of the following values:
*
* PTHREAD_CREATE_DETACHED It causes all threads created with attr to be in the detached state.
*
* PTHREAD_CREATE_JOINABLE Default value, it causes all threads created with attr to be in the joinable state.
*
* @return Upon successful completion, pthread_attr_setdetachstate() and return a value of 0.
* Otherwise, an error number is returned to indicate the error.
*
* @warning The pthread_attr_setdetachstate() function will fail if:
* [EINVAL]
* The value of detach state was not valid
*/
int pthread_attr_setdetachstate(pthread_attr_t *attr, int state)
{
RT_ASSERT(attr != RT_NULL);
if (state != PTHREAD_CREATE_JOINABLE && state != PTHREAD_CREATE_DETACHED)
return EINVAL;
attr->detachstate = state;
return 0;
}
RTM_EXPORT(pthread_attr_setdetachstate);
/**
* @brief This function get detach state attribute in thread attributes object.
*
* @note The detachstate attribute controls whether the thread is created in a detached state.
* If the thread is created detached, then use of the ID of the newly created thread by
* the pthread_detach() or pthread_join() function is an error.
*
* @see pthread_attr_destroy(), pthread_attr_getstackaddr(), pthread_attr_getstacksize(), pthread_create()
*
* @param attr is a thread attributes object.
*
* @param state is attribute in the attr object.
* attribute controls whether the thread is created in a detached state.
* The detachstate can be ONE of the following values:
*
* PTHREAD_CREATE_DETACHED It causes all threads created with attr to be in the detached state.
*
* PTHREAD_CREATE_JOINABLE Default value, it causes all threads created with attr to be in the joinable state.
*
* @return Upon successful completion, pthread_attr_getdetachstate() and shall return a value of 0;
* otherwise, an error number shall be returned to indicate the error.
*
* The pthread_attr_getdetachstate() function stores the value of the detachstate
* attribute in detachstate if successful.
*/
int pthread_attr_getdetachstate(pthread_attr_t const *attr, int *state)
{
RT_ASSERT(attr != RT_NULL);
*state = (int)attr->detachstate;
return 0;
}
RTM_EXPORT(pthread_attr_getdetachstate);
/**
* @brief This function sets schedpolicy attribute.
*
* @note The function function sets the scheduling policy attribute of the thread
* attributes object referred to by attr to the value specified in policy.
*
* @see pthread_attr_init(), pthread_attr_setscope(), pthread_attr_setinheritsched(), pthread_attr_setschedparam(), pthread_create()
*
* @param attr is a thread attributes object.
*
* @param policy is attribute in the attr object.
* The policy can be ONE of the following values:
*
* SCHED_FIFO First in-first out scheduling.
*
* SCHED_RR Round-robin scheduling.
*
* SCHED_OTHER Default Linux time-sharing scheduling.
*
* @return On success, these functions return 0.
*/
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
RT_ASSERT(attr != RT_NULL);
attr->schedpolicy = policy;
return 0;
}
RTM_EXPORT(pthread_attr_setschedpolicy);
/**
* @brief This function gets schedpolicy attribute.
*
* @note The function gets the schedpolicy attribute in the attr argument.
*
* @see pthread_attr_destroy(), pthread_attr_getscope(), pthread_attr_getinheritsched(), pthread_attr_getschedparam(), pthread_create()
*
* @param attr is a thread attributes object.
*
* @param policy is attribute in the attr object.
* The policy can be ONE of the following values:
*
* SCHED_FIFO First in-first out scheduling.
*
* SCHED_RR Round-robin scheduling.
*
* SCHED_OTHER Default Linux time-sharing scheduling.
*
* @return On success, these functions return 0.
*/
int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
{
RT_ASSERT(attr != RT_NULL);
*policy = (int)attr->schedpolicy;
return 0;
}
RTM_EXPORT(pthread_attr_getschedpolicy);
/**
* @brief This function set the scheduling parameter attributes in the attr argument.
* @see pthread_attr_init(), pthread_attr_setscope(), pthread_attr_setinheritsched(), pthread_attr_setschedpolicy()
*
* @param attr is a thread attributes object.
*
* @param param is scheduling parameter attributes in the attr argument.
* The contents of the param structure are defined in <pthread.h>.
* For the SCHED_FIFO and SCHED_RR policies, the only required member of param is sched_priority.
*
* @return On success, these functions return 0.
*/
int pthread_attr_setschedparam(pthread_attr_t *attr,
struct sched_param const *param)
{
RT_ASSERT(attr != RT_NULL);
RT_ASSERT(param != RT_NULL);
attr->schedparam.sched_priority = param->sched_priority;
return 0;
}
RTM_EXPORT(pthread_attr_setschedparam);
/**
* @brief This function get the scheduling parameter attributes in the attr argument.
* @see pthread_attr_init(), pthread_attr_setscope(), pthread_attr_setinheritsched(), pthread_attr_setschedpolicy()
*
* @param attr is a thread attributes object.
*
* @param param is scheduling parameter attributes in the attr argument.
* The contents of the param structure are defined in <pthread.h>.
* For the SCHED_FIFO and SCHED_RR policies, the only required member of param is sched_priority.
*
* @return On success, these functions return 0.
*/
int pthread_attr_getschedparam(pthread_attr_t const *attr,
struct sched_param *param)
{
RT_ASSERT(attr != RT_NULL);
RT_ASSERT(param != RT_NULL);
param->sched_priority = attr->schedparam.sched_priority;
return 0;
}
RTM_EXPORT(pthread_attr_getschedparam);
/**
* @brief This function set the thread creation stacksize attribute in the attr object.
*
* @see pthread_attr_init(), pthread_attr_setstackaddr(), pthread_attr_setdetachstate()
*
* @param attr is a thread attributes object.
*
* @param stack_size is the minimum stack size (in bytes) allocated for the created threads stack.
*
* @return Upon successful completion, This function return a value of 0.
*/
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size)
{
RT_ASSERT(attr != RT_NULL);
attr->stacksize = stack_size;
return 0;
}
RTM_EXPORT(pthread_attr_setstacksize);
/**
* @brief This function get the thread creation stacksize attribute in the attr object.
*
* @see pthread_attr_init(), pthread_attr_getstackaddr(), pthread_attr_getdetachstate()
*
* @param attr is a thread attributes object.
*
* @param stack_size is the minimum stack size (in bytes) allocated for the created threads stack.
*
* @return Upon successful completion, This function return a value of 0.
*/
int pthread_attr_getstacksize(pthread_attr_t const *attr, size_t *stack_size)
{
RT_ASSERT(attr != RT_NULL);
*stack_size = attr->stacksize;
return 0;
}
RTM_EXPORT(pthread_attr_getstacksize);
/**
* @brief This function sets the thread creation stackaddr attribute in the attr object.
*
* @see pthread_attr_init(), pthread_attr_setdetachstate(), pthread_attr_setstacksize()
*
* @param attr is a thread attributes object.
*
* @param The stack_addr attribute specifies the location of storage to be used for the created
* thread's stack.
*
* @return Upon successful completion, This function return a value of 0.
*/
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack_addr)
{
RT_ASSERT(attr != RT_NULL);
return EOPNOTSUPP;
}
RTM_EXPORT(pthread_attr_setstackaddr);
/**
* @brief This function gets the thread creation stackaddr attribute in the attr object.
*
* @see pthread_attr_init(), pthread_attr_setdetachstate(), pthread_attr_setstacksize()
*
* @param attr is a thread attributes object.
*
* @param The stack_addr attribute specifies the location of storage to be used for the created
* thread's stack.
*
* @return Upon successful completion, This function return a value of 0.
*/
int pthread_attr_getstackaddr(pthread_attr_t const *attr, void **stack_addr)
{
RT_ASSERT(attr != RT_NULL);
return EOPNOTSUPP;
}
RTM_EXPORT(pthread_attr_getstackaddr);
/**
* @brief This function set the thread creation stack attributes stackaddr and stacksize in the attr object.
*
* @note The stack attributes specify the area of storage to be used for the created thread's stack.
* The base (lowest addressable byte) of the storage shall be stack_base, and the size of the storage
* shall be stack_size bytes.
* All pages within the stack described by stackaddr and stacksize shall be both readable
* and writable by the thread.
*
* @see pthread_attr_destroy, pthread_attr_getdetachstate, pthread_attr_getstacksize, pthread_create
*
* @param attr is a thread attributes object.
*
* @param stack_base is the base (lowest addressable byte) of the storage.
*
* @param stack_size is the size of the storage.
*
* @return Upon successful completion, these functions shall return a value of 0;
* otherwise, an error number shall be returned to indicate the error.
*
* @warning The behavior is undefined if the value specified by the attr argument to or pthread_attr_setstack()
* does not refer to an initialized thread attributes object.
*/
int pthread_attr_setstack(pthread_attr_t *attr,
void *stack_base,
size_t stack_size)
{
RT_ASSERT(attr != RT_NULL);
attr->stackaddr = stack_base;
attr->stacksize = RT_ALIGN_DOWN(stack_size, RT_ALIGN_SIZE);
return 0;
}
RTM_EXPORT(pthread_attr_setstack);
/**
* @brief This function shall get the thread creation stack attributes stackaddr and stacksize in the attr object.
*
* @note The stack attributes specify the area of storage to be used for the created thread's stack.
* The base (lowest addressable byte) of the storage shall be stack_base, and the size of the storage
* shall be stack_size bytes.
* All pages within the stack described by stack_base and stack_size shall be both readable
* and writable by the thread.
*
* @see pthread_attr_destroy, pthread_attr_getdetachstate, pthread_attr_getstacksize, pthread_create
*
* @param attr is a thread attributes object.
*
* @param stack_base is the base (lowest addressable byte) of the storage.
*
* @param stack_size is the size of the storage.
*
* @return Upon successful completion, these functions shall return a value of 0;
* otherwise, an error number shall be returned to indicate the error.
* This function shall store the stack attribute values in stack_base and stack_size if successful.
*/
int pthread_attr_getstack(pthread_attr_t const *attr,
void **stack_base,
size_t *stack_size)
{
RT_ASSERT(attr != RT_NULL);
*stack_base = attr->stackaddr;
*stack_size = attr->stacksize;
return 0;
}
RTM_EXPORT(pthread_attr_getstack);
/**
* @brief This function shall set the guardsize attribute in the attr object.
*
* @note The guardsize attribute controls the size of the guard area for the created thread's stack.
* The guardsize attribute provides protection against overflow of the stack pointer.
* If a thread's stack is created with guard protection, the implementation allocates extra
* memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer.
* If an application overflows into this buffer an error shall result (possibly in a SIGSEGV signal
* being delivered to the thread).
*
* @see <pthread.h>, <sys/mman.h>
*
* @param attr is a thread attributes object.
*
* @param guard_size is the size of the guard area for the created thread's stack.
*
* @return Upon successful completion, these functions shall return a value of 0;
*
* @warning The guardsize attribute is provided to the application for two reasons:
*
* 1. Overflow protection can potentially result in wasted system resources.
* An application that creates a large number of threads, and which knows its threads
* never overflow their stack, can save system resources by turning off guard areas.
*
* 2. When threads allocate large data structures on the stack, large guard areas may be
* needed to detect stack overflow.
*
* The default size of the guard area is left implementation-defined since on systems
* supporting very large page sizes, the overhead might be substantial if at least one guard
* page is required by default.
*/
int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guard_size)
{
return EOPNOTSUPP;
}
/**
* @brief This function get the guardsize attribute in the attr object.
* This attribute shall be returned in the guard_size parameter.
*
* @note The guardsize attribute controls the size of the guard area for the created thread's stack.
* The guardsize attribute provides protection against overflow of the stack pointer.
* If a thread's stack is created with guard protection, the implementation allocates extra
* memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer.
*
* @see <pthread.h>, <sys/mman.h>
*
* @param attr is a thread attributes object.
*
* @param guard_size is the size of the guard area for the created thread's stack.
*
* @return Upon successful completion, these functions shall return a value of 0;
*
* @warning The guardsize attribute is provided to the application for two reasons:
*
* 1. Overflow protection can potentially result in wasted system resources.
* An application that creates a large number of threads, and which knows its threads
* never overflow their stack, can save system resources by turning off guard areas.
*
* 2. When threads allocate large data structures on the stack, large guard areas may be
* needed to detect stack overflow.
*
* The default size of the guard area is left implementation-defined since on systems
* supporting very large page sizes, the overhead might be substantial if at least one guard
* page is required by default.
*/
int pthread_attr_getguardsize(pthread_attr_t const *attr, size_t *guard_size)
{
return EOPNOTSUPP;
}
RTM_EXPORT(pthread_attr_getguardsize);
/**
* @brief This function sets inherit-scheduler attribute in thread attributes object.
*
* @note The function sets the inherit-scheduler attribute of the thread attributes object
* referred to by attr to the value specified in inheritsched.
* The inherit-scheduler attribute determines whether a thread created using the thread
* attributes object attr will inherit its scheduling attributes from the calling thread
* or whether it will take them from attr.
*
* @see pthread_attr_init(), pthread_attr_setschedpolicy(), pthread_attr_setschedparam()
*
* @param attr is a thread attributes object.
*
* @param inheritsched the inheritsched attribute determines how the other scheduling attributes of the created thread are to be set:
* The policy can be ONE of the following values:
*
* PTHREAD_INHERIT_SCHED Specifies that the scheduling policy and associated attributes are
* to be inherited from the creating thread, and the scheduling attributes
* in this attr argument are to be ignored.
*
* PTHREAD_EXPLICIT_SCHED Specifies that the scheduling policy and associated attributes are to be
* set to the corresponding values from this attribute object.
*
* @return Upon successful completion, these functions shall return a value of 0;
*/
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched)
{
RT_ASSERT(attr != RT_NULL);
attr->inheritsched = inheritsched;
return 0;
}
RTM_EXPORT(pthread_attr_setinheritsched);
/**
* @brief This function get and set the inheritsched attribute in the attr argument.
*
* @note The function sets the inherit-scheduler attribute of the thread attributes object
* referred to by attr to the value specified in inheritsched.
* The inherit-scheduler attribute determines whether a thread created using the thread
* attributes object attr will inherit its scheduling attributes from the calling thread
* or whether it will take them from attr.
*
* @see pthread_attr_init(), pthread_attr_getschedpolicy(), pthread_attr_getschedparam()
*
* @param attr is a thread attributes object.
*
* @param inheritsched the inheritsched attribute determines how the other scheduling attributes of the created thread are to be set:
* The inheritsched can be ONE of the following values:
*
* PTHREAD_INHERIT_SCHED Specifies that the scheduling policy and associated attributes are
* to be inherited from the creating thread, and the scheduling attributes
* in this attr argument are to be ignored.
*
* PTHREAD_EXPLICIT_SCHED Specifies that the scheduling policy and associated attributes are to be
* set to the corresponding values from this attribute object.
*
* @return Upon successful completion, these functions shall return a value of 0;
*/
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
{
RT_ASSERT(attr != RT_NULL);
*inheritsched = attr->inheritsched;
return 0;
}
RTM_EXPORT(pthread_attr_getinheritsched);
/**
* @brief This function set contentionscope attribute.
*
* @note The function are used to set the contentionscope attribute in the attr object.
*
* @param attr is a thread attributes object.
*
* @param scope is the value of contentionscope attribute.
* The scope can be ONE of the following values:
*
* PTHREAD_SCOPE_SYSTEM signifying system scheduling contention scope.
*
* PTHREAD_SCOPE_PROCESS signifying process scheduling contention scope.
*
* @return Upon successful completion, these functions shall return a value of 0;
*/
int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
if (scope == PTHREAD_SCOPE_SYSTEM)
return 0;
if (scope == PTHREAD_SCOPE_PROCESS)
return EOPNOTSUPP;
return EINVAL;
}
RTM_EXPORT(pthread_attr_setscope);
/**
* @brief This function get contentionscope attribute.
*
* @note The function are used to get the contentionscope attribute in the attr object.
*
* @param attr is a thread attributes object.
*
* @param scope is the value of contentionscope attribute.
* The scope can be ONE of the following values:
*
* PTHREAD_SCOPE_SYSTEM signifying system scheduling contention scope.
*
* PTHREAD_SCOPE_PROCESS signifying process scheduling contention scope.
*
* @return Upon successful completion, these functions shall return a value of 0;
*/
int pthread_attr_getscope(pthread_attr_t const *attr, int *scope)
{
return PTHREAD_SCOPE_SYSTEM;
}
RTM_EXPORT(pthread_attr_getscope);
|
cf7515c949836eec8b724861b9f2f9ffdaeb22d5
|
4ce56f791d898fadc8fee56c362b5c26322dbfda
|
/libraries/TheGreatEscape/include/TheGreatEscape/Main.h
|
9a1e3fc3e44e4852bf09256708aeac94fad78981
|
[] |
no_license
|
dpt/The-Great-Escape-in-C
|
7dbeb2d308b6bfcbc40bd46b5c457617069d8b32
|
f17b488c83de06374c6a8bfdb6fbc95a8866c2dc
|
refs/heads/master
| 2022-10-28T00:06:17.642644
| 2022-10-19T18:36:05
| 2022-10-19T18:36:05
| 25,271,138
| 110
| 13
| null | 2022-04-19T23:44:07
| 2014-10-15T19:57:53
|
C
|
UTF-8
|
C
| false
| false
| 14,670
|
h
|
Main.h
|
/**
* Main.h
*
* This file is part of "The Great Escape in C".
*
* This project recreates the 48K ZX Spectrum version of the prison escape
* game "The Great Escape" in portable C code. It is free software provided
* without warranty in the interests of education and software preservation.
*
* "The Great Escape" was created by Denton Designs and published in 1986 by
* Ocean Software Limited.
*
* The original game is copyright (c) 1986 Ocean Software Ltd.
* The original game design is copyright (c) 1986 Denton Designs Ltd.
* The recreated version is copyright (c) 2012-2019 David Thomas
*/
#ifndef MAIN_H
#define MAIN_H
/* ----------------------------------------------------------------------- */
#include "C99/Types.h"
#include "ZXSpectrum/Spectrum.h"
#include "TheGreatEscape/TheGreatEscape.h"
#include "TheGreatEscape/Types.h"
#include "TheGreatEscape/Doors.h"
#include "TheGreatEscape/InteriorObjects.h"
#include "TheGreatEscape/Routes.h"
#include "TheGreatEscape/SuperTiles.h"
#include "TheGreatEscape/Tiles.h"
/* ----------------------------------------------------------------------- */
// FORWARD REFERENCES
//
// (in original file order)
/* $6000 onwards */
void transition(tgestate_t *state, const mappos8_t *mappos);
void enter_room(tgestate_t *state);
void squash_stack_goto_main(tgestate_t *state);
void set_hero_sprite_for_room(tgestate_t *state);
void setup_movable_items(tgestate_t *state);
void setup_movable_item(tgestate_t *state,
const movableitem_t *movableitem,
character_t character);
void reset_nonplayer_visible_characters(tgestate_t *state);
void setup_doors(tgestate_t *state);
const door_t *get_door(doorindex_t index);
void wipe_visible_tiles(tgestate_t *state);
void setup_room(tgestate_t *state);
void expand_object(tgestate_t *state, object_t index, uint8_t *output);
void plot_interior_tiles(tgestate_t *state);
/* $7000 onwards */
extern const roomdef_address_t beds[beds_LENGTH];
extern const door_t doors[door_MAX * 2];
void process_player_input_fire(tgestate_t *state, input_t input);
void use_item_B(tgestate_t *state);
void use_item_A(tgestate_t *state);
void use_item_common(tgestate_t *state, item_t item);
void pick_up_item(tgestate_t *state);
void drop_item(tgestate_t *state);
void drop_item_tail(tgestate_t *state, item_t item);
void calc_exterior_item_isopos(itemstruct_t *itemstr);
void calc_interior_item_isopos(itemstruct_t *itemstr);
void draw_all_items(tgestate_t *state);
void draw_item(tgestate_t *state, item_t item, size_t dstoff);
itemstruct_t *find_nearby_item(tgestate_t *state);
void plot_bitmap(tgestate_t *state,
const uint8_t *src,
uint8_t *dst,
uint8_t width,
uint8_t height);
void screen_wipe(tgestate_t *state,
uint8_t *dst,
uint8_t width,
uint8_t height);
uint8_t *get_next_scanline(tgestate_t *state, uint8_t *slp);
/* $8000 onwards */
/* $9000 onwards */
void main_loop(tgestate_t *state);
void check_morale(tgestate_t *state);
void keyscan_break(tgestate_t *state);
void process_player_input(tgestate_t *state);
void picking_lock(tgestate_t *state);
void cutting_wire(tgestate_t *state);
void in_permitted_area(tgestate_t *state);
int in_permitted_area_end_bit(tgestate_t *state, uint8_t room_and_flags);
int within_camp_bounds(uint8_t index, const mappos8_t *mappos);
/* $A000 onwards */
void wave_morale_flag(tgestate_t *state);
void set_morale_flag_screen_attributes(tgestate_t *state, attribute_t attrs);
uint8_t *get_prev_scanline(tgestate_t *state, uint8_t *addr);
void interior_delay_loop(tgestate_t *state);
void ring_bell(tgestate_t *state);
void plot_ringer(tgestate_t *state, const uint8_t *src);
void increase_morale(tgestate_t *state, uint8_t delta);
void decrease_morale(tgestate_t *state, uint8_t delta);
void increase_morale_by_10_score_by_50(tgestate_t *state);
void increase_morale_by_5_score_by_5(tgestate_t *state);
void increase_score(tgestate_t *state, uint8_t delta);
void plot_score(tgestate_t *state);
void play_speaker(tgestate_t *state, sound_t sound);
void set_game_window_attributes(tgestate_t *state, attribute_t attrs);
/* event routines would be placed here but are now in Events.[ch]. */
void screen_reset(tgestate_t *state);
void escaped(tgestate_t *state);
uint8_t keyscan_all(tgestate_t *state);
INLINE escapeitem_t item_to_escapeitem(item_t item);
const screenlocstring_t *screenlocstring_plot(tgestate_t *state,
const screenlocstring_t *slstring);
void get_supertiles(tgestate_t *state);
void plot_bottommost_tiles(tgestate_t *state);
void plot_topmost_tiles(tgestate_t *state);
void plot_horizontal_tiles_common(tgestate_t *state,
tileindex_t *vistiles,
const supertileindex_t *maptiles,
uint8_t y,
uint8_t *window);
void plot_all_tiles(tgestate_t *state);
void plot_rightmost_tiles(tgestate_t *state);
void plot_leftmost_tiles(tgestate_t *state);
void plot_vertical_tiles_common(tgestate_t *state,
tileindex_t *vistiles,
const supertileindex_t *maptiles,
uint8_t x,
uint8_t *window);
INLINE uint8_t *plot_tile_then_advance(tgestate_t *state,
tileindex_t tile_index,
const supertileindex_t *psupertileindex,
uint8_t *scr);
uint8_t *plot_tile(tgestate_t *state,
tileindex_t tile_index,
const supertileindex_t *psupertileindex,
uint8_t *scr);
void shunt_map_left(tgestate_t *state);
void shunt_map_right(tgestate_t *state);
void shunt_map_up_right(tgestate_t *state);
void shunt_map_up(tgestate_t *state);
void shunt_map_down(tgestate_t *state);
void shunt_map_down_left(tgestate_t *state);
void move_map(tgestate_t *state);
void move_map_up_left(tgestate_t *state, uint8_t *pmove_map_y);
void move_map_up_right(tgestate_t *state, uint8_t *pmove_map_y);
void move_map_down_right(tgestate_t *state, uint8_t *pmove_map_y);
void move_map_down_left(tgestate_t *state, uint8_t *pmove_map_y);
attribute_t choose_game_window_attributes(tgestate_t *state);
/* zoombox routines would be placed here but are now in zoombox.[ch]. */
void nighttime(tgestate_t *state);
void searchlight_movement(searchlight_movement_t *slstate);
void searchlight_caught(tgestate_t *state,
const searchlight_movement_t *slstate);
void searchlight_plot(tgestate_t *state,
attribute_t *attrs,
int clip_left);
int touch(tgestate_t *state, vischar_t *vischar, spriteindex_t sprite_index);
int collision(tgestate_t *state);
/* $B000 onwards */
void accept_bribe(tgestate_t *state);
int bounds_check(tgestate_t *state, vischar_t *vischar);
int is_door_locked(tgestate_t *state);
void door_handling(tgestate_t *state, vischar_t *vischar);
int door_in_range(tgestate_t *state, const door_t *door);
int interior_bounds_check(tgestate_t *state, vischar_t *vischar);
void reset_outdoors(tgestate_t *state);
void door_handling_interior(tgestate_t *state, vischar_t *vischar);
void action_red_cross_parcel(tgestate_t *state);
void action_bribe(tgestate_t *state);
void action_poison(tgestate_t *state);
void action_uniform(tgestate_t *state);
void action_shovel(tgestate_t *state);
void action_lockpick(tgestate_t *state);
void action_red_key(tgestate_t *state);
void action_yellow_key(tgestate_t *state);
void action_green_key(tgestate_t *state);
void action_key(tgestate_t *state, room_t room_of_key);
doorindex_t *get_nearest_door(tgestate_t *state);
void action_wiresnips(tgestate_t *state);
extern const wall_t walls[24];
void animate(tgestate_t *state);
void calc_vischar_isopos_from_vischar(tgestate_t *state, vischar_t *vischar);
void calc_vischar_isopos_from_state(tgestate_t *state, vischar_t *vischar);
void reset_game(tgestate_t *state);
void reset_map_and_characters(tgestate_t *state);
void searchlight_mask_test(tgestate_t *state, vischar_t *vischar);
void plot_sprites(tgestate_t *state);
int get_next_drawable(tgestate_t *state,
uint8_t *pindex,
vischar_t **pvischar,
itemstruct_t **pitemstruct);
void render_mask_buffer(tgestate_t *state);
uint16_t multiply(uint8_t left, uint8_t right);
void mask_against_tile(tileindex_t index, tilerow_t *dst);
int vischar_visible(tgestate_t *state,
const vischar_t *vischar,
uint8_t *left_skip,
uint8_t *clipped_width,
uint8_t *top_skip,
uint8_t *clipped_height);
void restore_tiles(tgestate_t *state);
const tile_t *select_tile_set(tgestate_t *state,
uint8_t x_shift,
uint8_t y_shift);
/* $C000 onwards */
void spawn_characters(tgestate_t *state);
void purge_invisible_characters(tgestate_t *state);
void spawn_character(tgestate_t *state, characterstruct_t *charstr);
void reset_visible_character(tgestate_t *state, vischar_t *vischar);
#define get_target_LOCATION 0
#define get_target_DOOR 128
#define get_target_ROUTE_ENDS 255
uint8_t get_target(tgestate_t *state,
route_t *route,
const mappos8_t **doormappos,
const pos8_t **location);
void move_a_character(tgestate_t *state);
int move_towards(int8_t max,
int rc,
const uint8_t *second,
uint8_t *first);
void character_event(tgestate_t *state, route_t *route);
charevnt_handler_t charevnt_solitary_ends;
charevnt_handler_t charevnt_commandant_to_yard;
charevnt_handler_t charevnt_hero_release;
charevnt_handler_t charevnt_wander_left;
charevnt_handler_t charevnt_wander_yard;
charevnt_handler_t charevnt_wander_top;
charevnt_handler_t charevnt_bed;
charevnt_handler_t charevnt_breakfast;
charevnt_handler_t charevnt_exit_hut2;
charevnt_handler_t charevnt_hero_sits;
charevnt_handler_t charevnt_hero_sleeps;
void automatics(tgestate_t *state);
void character_behaviour(tgestate_t *state,
vischar_t *vischar);
void character_behaviour_set_input(tgestate_t *state,
vischar_t *vischar,
uint8_t new_input);
input_t vischar_move_u(tgestate_t *state,
vischar_t *vischar,
int scale);
input_t vischar_move_v(tgestate_t *state,
vischar_t *vischar,
int scale);
void target_reached(tgestate_t *state, vischar_t *vischar);
void get_target_assign_pos(tgestate_t *state,
vischar_t *vischar,
route_t *route);
void route_ended(tgestate_t *state, vischar_t *vischar, route_t *route);
/** Byte which terminates a route. */
#define routebyte_END 255
INLINE const uint8_t *get_route(routeindex_t A);
uint8_t random_nibble(tgestate_t *state);
void solitary(tgestate_t *state);
void guards_follow_suspicious_character(tgestate_t *state,
vischar_t *vischar);
void hostiles_pursue(tgestate_t *state);
void is_item_discoverable(tgestate_t *state);
int is_item_discoverable_interior(tgestate_t *state,
room_t room,
item_t *pitem);
void item_discovered(tgestate_t *state, item_t item);
extern const default_item_location_t default_item_locations[item__LIMIT];
extern const character_class_data_t character_class_data[4];
#define animations__LIMIT 24
extern const anim_t *animations[animations__LIMIT];
/* $D000 onwards */
void mark_nearby_items(tgestate_t *state);
uint8_t get_next_drawable_itemstruct(tgestate_t *state,
item_t item_and_flag,
uint16_t x,
uint16_t y,
itemstruct_t **pitemstr);
uint8_t setup_item_plotting(tgestate_t *state,
itemstruct_t *itemstr,
item_t item);
uint8_t item_visible(tgestate_t *state,
uint8_t *left_skip,
uint8_t *clipped_width,
uint8_t *top_skip,
uint8_t *clipped_height);
extern const spritedef_t item_definitions[item__LIMIT];
/* $E000 onwards */
extern const size_t masked_sprite_plotter_16_enables[2 * 3];
void plot_masked_sprite_24px(tgestate_t *state, vischar_t *vischar);
void plot_masked_sprite_16px_x_is_zero(tgestate_t *state);
void plot_masked_sprite_16px(tgestate_t *state, vischar_t *vischar);
void plot_masked_sprite_16px_right(tgestate_t *state, uint8_t x);
void plot_masked_sprite_16px_left(tgestate_t *state, uint8_t x);
void flip_24_masked_pixels(tgestate_t *state,
uint8_t *pE,
uint8_t *pC,
uint8_t *pB,
uint8_t *pEdash,
uint8_t *pCdash,
uint8_t *pBdash);
void flip_16_masked_pixels(tgestate_t *state,
uint8_t *pD,
uint8_t *pE,
uint8_t *pDdash,
uint8_t *pEdash);
int setup_vischar_plotting(tgestate_t *state, vischar_t *vischar);
void scale_mappos_down(const mappos16_t *in, mappos8_t *out);
void plot_game_window(tgestate_t *state);
timedevent_handler_t event_roll_call;
void action_papers(tgestate_t *state);
int user_confirm(tgestate_t *state);
/* $F000 onwards */
void wipe_full_screen_and_attributes(tgestate_t *state);
/* ----------------------------------------------------------------------- */
#endif /* MAIN_H */
// vim: ts=8 sts=2 sw=2 et
|
9fb96f9a78f5fd9787400730173d11399f5441e2
|
1b90be9561c10508eea59cb36c1f1665d0ef947f
|
/lib/tbb_2020.3/include/tbb/machine/mic_common.h
|
8c844f1dced6006566b9cd43b4dc111fa8dfc480
|
[
"Apache-2.0",
"BSD-3-Clause",
"GPL-2.0-only"
] |
permissive
|
stan-dev/math
|
473e7c1eaf11f84eaf2032c2455e12ba65feef39
|
bdf281f4e7f8034f47974d14dea7f09e600ac02a
|
refs/heads/develop
| 2023-08-31T09:02:59.224115
| 2023-08-29T15:17:01
| 2023-08-29T15:17:01
| 38,388,440
| 732
| 240
|
BSD-3-Clause
| 2023-09-14T19:44:20
| 2015-07-01T18:40:54
|
C++
|
UTF-8
|
C
| false
| false
| 1,898
|
h
|
mic_common.h
|
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __TBB_mic_common_H
#define __TBB_mic_common_H
#ifndef __TBB_machine_H
#error Do not #include this internal file directly; use public TBB headers instead.
#endif
#if ! __TBB_DEFINE_MIC
#error mic_common.h should be included only when building for Intel(R) Many Integrated Core Architecture
#endif
#ifndef __TBB_PREFETCHING
#define __TBB_PREFETCHING 1
#endif
#if __TBB_PREFETCHING
#include <immintrin.h>
#define __TBB_cl_prefetch(p) _mm_prefetch((const char*)p, _MM_HINT_T1)
#define __TBB_cl_evict(p) _mm_clevict(p, _MM_HINT_T1)
#endif
/** Intel(R) Many Integrated Core Architecture does not support mfence and pause instructions **/
#define __TBB_full_memory_fence() __asm__ __volatile__("lock; addl $0,(%%rsp)":::"memory")
#define __TBB_Pause(x) _mm_delay_32(16*(x))
#define __TBB_STEALING_PAUSE 1500/16
#include <sched.h>
#define __TBB_Yield() sched_yield()
/** Specifics **/
#define __TBB_STEALING_ABORT_ON_CONTENTION 1
#define __TBB_YIELD2P 1
#define __TBB_HOARD_NONLOCAL_TASKS 1
#if ! ( __FreeBSD__ || __linux__ )
#error Intel(R) Many Integrated Core Compiler does not define __FreeBSD__ or __linux__ anymore. Check for the __TBB_XXX_BROKEN defined under __FreeBSD__ or __linux__.
#endif /* ! ( __FreeBSD__ || __linux__ ) */
#endif /* __TBB_mic_common_H */
|
a80d768bb8ee769bc507e99edaa81a8ce7f0b011
|
8447eb38a4fc71b32b6b82a99f7828a2c50621aa
|
/ppu/librt/lock.c
|
d5373aecb3c2ec7d74b37056bc58bc3af8fb5785
|
[
"MIT"
] |
permissive
|
ps3dev/PSL1GHT
|
9ecc1f0a2996b39d35cc98303c58c79966b9388b
|
5bc0961c66a3615c74f15e0c29bbeaa33f867ab3
|
refs/heads/master
| 2023-08-04T06:50:55.256801
| 2023-07-30T13:34:19
| 2023-07-30T13:34:19
| 1,541,223
| 159
| 357
|
MIT
| 2023-07-23T07:26:09
| 2011-03-29T12:34:15
|
C
|
UTF-8
|
C
| false
| false
| 771
|
c
|
lock.c
|
#include <stdio.h>
#include <_ansi.h>
#include <_syslist.h>
#include <sys/reent.h>
#include <sys/errno.h>
#include <sys/mutex.h>
int __librt_sys_lwmutex_create_r(struct _reent *r,sys_lwmutex_t *lwmutex,const sys_lwmutex_attr_t *attr)
{
return sysLwMutexCreate(lwmutex,attr);
}
int __librt_sys_lwmutex_destroy_r(struct _reent *r,sys_lwmutex_t *lwmutex)
{
return sysLwMutexDestroy(lwmutex);
}
int __librt_sys_lwmutex_lock_r(struct _reent *r,sys_lwmutex_t *lwmutex,unsigned long long timeout)
{
return sysLwMutexLock(lwmutex,timeout);
}
int __librt_sys_lwmutex_trylock_r(struct _reent *r,sys_lwmutex_t *lwmutex)
{
return sysLwMutexTryLock(lwmutex);
}
int __librt_sys_lwmutex_unlock_r(struct _reent *r,sys_lwmutex_t *lwmutex)
{
return sysLwMutexUnlock(lwmutex);
}
|
21600a55e91a7c02d23d72b04c63c6d10928c53b
|
50e95229b9a1161ac294137120aaba94c9eb06bc
|
/sources/ippcp/crypto_mb/include/internal/sm4/sm4_mb.h
|
7d5ca82403a6ceccd924834c4a2a01bf59c89df6
|
[
"Apache-2.0",
"Intel"
] |
permissive
|
intel/ipp-crypto
|
f0f05b87203705e82603db67bed5f8def13a5ee8
|
36e76e2388f3dd10cc440e213dfcf6ef59a0dfb8
|
refs/heads/develop
| 2023-09-04T08:15:06.851373
| 2023-07-27T12:47:12
| 2023-07-27T12:47:12
| 140,034,345
| 304
| 81
|
Apache-2.0
| 2023-08-30T17:18:36
| 2018-07-06T22:16:28
|
C
|
UTF-8
|
C
| false
| false
| 40,854
|
h
|
sm4_mb.h
|
/*******************************************************************************
* Copyright (C) 2021 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*
*******************************************************************************/
#if !defined(_SM4_GFNI_MB_H)
#define _SM4_GFNI_MB_H
#include <crypto_mb/defs.h>
#include <crypto_mb/sm4.h>
#include <immintrin.h>
#ifndef M128
#define M128(mem) (*((__m128i*)(mem)))
#endif
#ifndef M256
#define M256(mem) (*((__m256i*)(mem)))
#endif
#ifndef M512
#define M512(mem) (*((__m512i*)(mem)))
#endif
#define loadu _mm512_loadu_si512
#define storeu _mm512_storeu_si512
#define mask_storeu_epi64 _mm512_mask_storeu_epi64
#define maskz_expandloadu_epi32 _mm512_maskz_expandloadu_epi32
#define mask_storeu_epi8 _mm512_mask_storeu_epi8
#define maskz_loadu_epi8 _mm512_maskz_loadu_epi8
#define srli_epi64 _mm512_srli_epi64
#define slli_epi64 _mm512_slli_epi64
#define bsrli_epi128 _mm512_bsrli_epi128
#define bslli_epi128 _mm512_bslli_epi128
#define shuffle_epi8 _mm512_shuffle_epi8
#define shuffle_epi32 _mm512_shuffle_epi32
#define set1_epi32 _mm512_set1_epi32
#define set1_epi64 _mm512_set1_epi64
#define setzero _mm512_setzero_si512
#define cmpeq_epi32_mask _mm512_cmpeq_epi32_mask
#define cmp_epi32_mask _mm512_cmp_epi32_mask
#define cmp_epi64_mask _mm512_cmp_epi64_mask
#define mask_set1_epi32 _mm512_mask_set1_epi32
#define mask_sub_epi32 _mm512_mask_sub_epi32
#define mask_add_epi32 _mm512_mask_add_epi32
#define mask_add_epi64 _mm512_mask_add_epi64
#define add_epi32 _mm512_add_epi32
#define sub_epi32 _mm512_sub_epi32
#define add_epi64 _mm512_add_epi64
#define or _mm512_or_si512
#define and _mm512_and_si512
#define xor _mm512_xor_si512
#define clmul _mm512_clmulepi64_epi128
#define unpacklo_epi32 _mm512_unpacklo_epi32
#define unpackhi_epi32 _mm512_unpackhi_epi32
#define unpacklo_epi64 _mm512_unpacklo_epi64
#define unpackhi_epi64 _mm512_unpackhi_epi64
#define insert32x4 _mm512_inserti32x4
#define sll_epi32 _mm512_sll_epi32
#define srli_epi32 _mm512_srli_epi32
#define mask_cmp_epi32_mask _mm512_mask_cmp_epi32_mask
#define broadcast_i64x2 _mm512_broadcast_i64x2
/*
// Constants
*/
static __ALIGN64 const int8u permMask_in[] = {
0,0x00,0x00,0x00, 4,0x00,0x00,0x00, 8,0x00,0x00,0x00, 12,0x00,0x00,0x00,
1,0x00,0x00,0x00, 5,0x00,0x00,0x00, 9,0x00,0x00,0x00, 13,0x00,0x00,0x00,
2,0x00,0x00,0x00, 6,0x00,0x00,0x00, 10,0x00,0x00,0x00, 14,0x00,0x00,0x00,
3,0x00,0x00,0x00, 7,0x00,0x00,0x00, 11,0x00,0x00,0x00, 15,0x00,0x00,0x00
};
static __ALIGN64 const int8u permMask_out[] = {
12,0x00,0x00,0x00, 8,0x00,0x00,0x00, 4,0x00,0x00,0x00, 0,0x00,0x00,0x00,
13,0x00,0x00,0x00, 9,0x00,0x00,0x00, 5,0x00,0x00,0x00, 1,0x00,0x00,0x00,
14,0x00,0x00,0x00, 10,0x00,0x00,0x00, 6,0x00,0x00,0x00, 2,0x00,0x00,0x00,
15,0x00,0x00,0x00, 11,0x00,0x00,0x00, 7,0x00,0x00,0x00, 3,0x00,0x00,0x00
};
static __ALIGN64 const int8u affineIn[] = {
0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34, 0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34,
0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34, 0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34,
0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34, 0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34,
0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34, 0x52,0xBC,0x2D,0x02,0x9E,0x25,0xAC,0x34
};
static __ALIGN64 const int8u affineOut[] = {
0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7, 0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7,
0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7, 0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7,
0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7, 0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7,
0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7, 0x19,0x8b,0x6c,0x1e,0x51,0x8e,0x2d,0xd7
};
// Constant for swapping the bytes inside the words
static __ALIGN64 const int8u swapBytes[] = {
3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12,
3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12,
3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12,
3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12
};
// Constant for swapping the endianness
static __ALIGN64 const int8u swapEndianness[] = {
15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0,
15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0,
15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0,
15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0
};
// Constant for swapping the order of words
static __ALIGN64 const int8u swapWordsOrder[] = {
12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3,
12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3,
12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3,
12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3
};
static __ALIGN64 const int64u idx_0_3[] = {
0x0000000000000000, 0x0000000000000000, 0x0000000100000001, 0x0000000100000001,
0x0000000200000002, 0x0000000200000002, 0x0000000300000003, 0x0000000300000003
};
static __ALIGN64 const int64u idx_4_7[] = {
0x0000000400000004, 0x0000000400000004, 0x0000000500000005, 0x0000000500000005,
0x0000000600000006, 0x0000000600000006, 0x0000000700000007, 0x0000000700000007
};
static __ALIGN64 const int64u idx_8_b[] = {
0x0000000800000008, 0x0000000800000008, 0x0000000900000009, 0x0000000900000009,
0x0000000a0000000a, 0x0000000a0000000a, 0x0000000b0000000b, 0x0000000b0000000b
};
static __ALIGN64 const int64u idx_c_f[] = {
0x0000000c0000000c, 0x0000000c0000000c, 0x0000000d0000000d, 0x0000000d0000000d,
0x0000000e0000000e, 0x0000000e0000000e, 0x0000000f0000000f, 0x0000000f0000000f
};
static __ALIGN64 const int8u firstInc[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
static __ALIGN64 const int8u nextInc[] = {
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
static __ALIGN64 const int8u shuf8[] = {
0x01, 0x02, 0x03, 0x00, 0x05, 0x06, 0x07, 0x04,
0x09, 0x0A, 0x0B, 0x08, 0x0D, 0x0E, 0x0F, 0x0C,
0x01, 0x02, 0x03, 0x00, 0x05, 0x06, 0x07, 0x04,
0x09, 0x0A, 0x0B, 0x08, 0x0D, 0x0E, 0x0F, 0x0C,
0x01, 0x02, 0x03, 0x00, 0x05, 0x06, 0x07, 0x04,
0x09, 0x0A, 0x0B, 0x08, 0x0D, 0x0E, 0x0F, 0x0C,
0x01, 0x02, 0x03, 0x00, 0x05, 0x06, 0x07, 0x04,
0x09, 0x0A, 0x0B, 0x08, 0x0D, 0x0E, 0x0F, 0x0C,
};
/* For SM4-XTS */
static __ALIGN64 const int64u xts_poly[] = {
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87
};
static __ALIGN64 const int8u xts_shuf_mask[] = {
15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
15, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
static __ALIGN64 const int64u xts_const_dq3210[] = {
0, 0, 1, 1, 2, 2, 3, 3
};
static __ALIGN64 const int64u xts_const_dq5678[] = {
8, 8, 7, 7, 6, 6, 5, 5
};
static __ALIGN64 const int32u xts_full_block_mask[] = {
0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0,
0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0
};
static __ALIGN64 const int32u xts_partial_block_mask[] = {
0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f,
0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f
};
static __ALIGN64 const int32u xts_dw0_7_to_qw_idx[] = {
0, 0xFF, 1, 0xFF, 2, 0xFF, 3, 0xFF,
4, 0xFF, 5, 0xFF, 6, 0xFF, 7, 0xFF
};
static __ALIGN64 const int32u xts_dw8_15_to_qw_idx[] = {
8, 0xFF, 9, 0xFF, 10, 0xFF, 11, 0xFF,
12, 0xFF, 13, 0xFF, 14, 0xFF, 15, 0xFF
};
static __ALIGN64 const int64u xts_tweak_permq[] = {
2, 3, 0, 1, 0xFF, 0xFF, 0xFF, 0xFF,
0, 1, 4, 5, 2, 3, 0xFF, 0xFF,
0, 1, 2, 3, 6, 7, 4, 5,
0, 1, 2, 3, 4, 5, 10, 11 /* for vpermi2q */
};
static __ALIGN64 const int64u xts_next_tweak_permq[] = {
0, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2, 3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
4, 5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
14, 15, 0, 1, 0xFF, 0xFF, 0xFF, 0xFF /* for vpermi2q */
};
static __ALIGN64 const int64u xts_next_tweak_permq_enc[] = {
2, 3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
4, 5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
6, 7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};
#define SM4_ONE_ROUND(X0, X1, X2, X3, TMP, RK) { \
/* (Xi+1 ^ Xi+2 ^ Xi+3 ^ rki) */ \
TMP = _mm512_ternarylogic_epi32 (X1, X2, X3, 0x96); \
TMP = _mm512_xor_epi32(TMP, _mm512_loadu_si512(RK)); \
/* T(Xi+1 ^ Xi+2 ^ Xi+3 ^ rki) */ \
TMP = sBox512(TMP); \
X0 = _mm512_ternarylogic_epi64 (X0, TMP, Lblock512(TMP), 0x96); \
}
#define SM4_FOUR_ROUNDS(X0, X1, X2, X3, TMP, RK, sign) { \
SM4_ONE_ROUND(X0, X1, X2, X3, TMP, RK); \
SM4_ONE_ROUND(X1, X2, X3, X0, TMP, (RK + sign * 1)); \
SM4_ONE_ROUND(X2, X3, X0, X1, TMP, (RK + sign * 2)); \
SM4_ONE_ROUND(X3, X0, X1, X2, TMP, (RK + sign * 3)); \
}
#define SM4_ONE_ROUND_MASKED(X0, X1, X2, X3, TMP, MASK, RK) { \
/* (Xi+1 ^ Xi+2 ^ Xi+3 ^ rki) */ \
TMP = _mm512_xor_epi32(_mm512_xor_epi32(_mm512_xor_epi32(X1, X2), X3), _mm512_loadu_si512(RK)); \
/* T(Xi+1 ^ Xi+2 ^ Xi+3 ^ rki) */ \
TMP = sBox512(TMP); \
TMP = _mm512_xor_epi32(TMP, Lblock512(TMP)); \
/* Xi+4 = Xi ^ T(Xi+1 ^ Xi+2 ^ Xi+3 ^ rki) */ \
X0 = _mm512_mask_xor_epi32(X0, MASK, X0, TMP); \
}
#define SM4_FOUR_ROUNDS_MASKED(X0, X1, X2, X3, TMP, MASK, RK, sign) { \
SM4_ONE_ROUND_MASKED(X0, X1, X2, X3, TMP, MASK, RK); \
SM4_ONE_ROUND_MASKED(X1, X2, X3, X0, TMP, MASK, (RK + sign * 1)); \
SM4_ONE_ROUND_MASKED(X2, X3, X0, X1, TMP, MASK, (RK + sign * 2)); \
SM4_ONE_ROUND_MASKED(X3, X0, X1, X2, TMP, MASK, (RK + sign * 3)); \
}
#define EXPAND_ONE_RKEY(X, p_rk) { \
X[0] = _mm512_permutexvar_epi32(M512(idx_0_3), _mm512_loadu_si512(p_rk)); \
X[1] = _mm512_permutexvar_epi32(M512(idx_4_7), _mm512_loadu_si512(p_rk)); \
X[2] = _mm512_permutexvar_epi32(M512(idx_8_b), _mm512_loadu_si512(p_rk)); \
X[3] = _mm512_permutexvar_epi32(M512(idx_c_f), _mm512_loadu_si512(p_rk)); \
}
#define ENDIANNESS_16x32(x) _mm512_shuffle_epi8((x), M512(swapBytes));
#define CHANGE_ORDER_BLOCKS(x) _mm512_shuffle_epi8((x), M512(swapEndianness));
/* Workaround for gcc91, got the error: implicit declaration of function ‘_mm512_div_epi32’ */
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#define GET_NUM_BLOCKS(OUT, LEN, BLOCK_SIZE) \
{ \
int32u blocks[SM4_LINES]; \
for (int i = 0; i < SM4_LINES; i++) \
blocks[i] = (LEN)[i] / (BLOCK_SIZE); \
(OUT) = _mm512_loadu_si512(blocks); \
}
#else
#define GET_NUM_BLOCKS(OUT, LEN, BLOCK_SIZE) (OUT) = _mm512_div_epi32(_mm512_loadu_si512(LEN), _mm512_set1_epi32(BLOCK_SIZE))
#endif
#define UPDATE_STREAM_MASK_16(MASK, p_len) \
MASK = *p_len < (16) ? (*p_len <= 0 ? 0 : ((int64u)1 << *p_len) - 1) : (__mmask64)(0xFFFF); p_len++;
#define UPDATE_STREAM_MASK_64(MASK, p_len) MASK = *p_len < (4 * 16) ? (*p_len <= 0 ? 0 : ((int64u)1 << *p_len) - 1) : (__mmask64)(-1); p_len++;
#define SM4_ENC (1)
#define SM4_DEC (-1)
/*
// Internal functions
*/
EXTERN_C void sm4_ecb_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], __mmask16 mb_mask, int operation);
EXTERN_C void sm4_cbc_enc_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], __mmask16 mb_mask, const int8u* pa_iv[SM4_LINES]);
EXTERN_C void sm4_cbc_dec_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], __mmask16 mb_mask, const int8u* pa_iv[SM4_LINES]);
EXTERN_C void sm4_cbc_mac_kernel_mb16(__m128i pa_out[SM4_LINES], const int8u *const pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], __mmask16 mb_mask, const int8u* pa_iv[SM4_LINES]);
EXTERN_C void sm4_ctr128_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], __mmask16 mb_mask, int8u* pa_ctr[SM4_LINES]);
EXTERN_C void sm4_ofb_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], __mmask16 mb_mask, int8u* pa_iv[SM4_LINES]);
EXTERN_C void sm4_cfb128_enc_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], const int8u* pa_iv[SM4_LINES], __mmask16 mb_mask);
EXTERN_C void sm4_cfb128_dec_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES], const int32u* key_sched[SM4_ROUNDS], const int8u* pa_iv[SM4_LINES], __mmask16 mb_mask);
EXTERN_C void sm4_set_round_keys_mb16(int32u* key_sched[SM4_ROUNDS], const int8u* pa_inp_key[SM4_LINES], __mmask16 mb_mask);
EXTERN_C void sm4_xts_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES],
const int32u* key_sched1[SM4_ROUNDS], const int32u* key_sched2[SM4_ROUNDS],
const int8u* pa_tweak[SM4_LINES], __mmask16 mb_mask, const int dir);
// The transformation based on SM4 sbox algebraic structure, parameters were computed manually
__INLINE __m512i sBox512(__m512i block)
{
block = _mm512_gf2p8affine_epi64_epi8(block, M512(affineIn), 0x65);
block = _mm512_gf2p8affineinv_epi64_epi8(block, M512(affineOut), 0xd3);
return block;
}
__INLINE __m512i Lblock512(__m512i x)
{
return _mm512_ternarylogic_epi32(_mm512_xor_si512(_mm512_rol_epi32(x, 2), _mm512_rol_epi32(x, 10)), _mm512_rol_epi32(x, 18),
_mm512_shuffle_epi8 (x, _mm512_loadu_si512(shuf8)), 0x96);
}
__INLINE __m512i Lkey512(__m512i x)
{
return _mm512_xor_epi32(_mm512_rol_epi32(x, 13), _mm512_rol_epi32(x, 23));
}
__INLINE __m512i IncBlock512(__m512i x, const int8u* increment)
{
__m512i t = _mm512_add_epi64(x, M512(increment));
__mmask8 carryMask = _mm512_cmplt_epu64_mask(t, x);
carryMask = (__mmask8)(carryMask << 1);
t = _mm512_add_epi64(t, _mm512_mask_set1_epi64(_mm512_setzero_si512(), carryMask, 1));
return t;
}
#define SM4_KERNEL(TMP, p_rk, iterator) \
for (int itr = 0, j = 0; itr < 8; itr++, j++) { \
/* initial xors */ \
EXPAND_ONE_RKEY(TMP, p_rk); p_rk+=iterator; \
TMP[0] = _mm512_ternarylogic_epi32 (TMP[0], TMP[5], TMP[6], 0x96); \
TMP[0] = _mm512_xor_si512(TMP[0], TMP[7]); \
TMP[1] = _mm512_ternarylogic_epi32 (TMP[1], TMP[9], TMP[10], 0x96); \
TMP[1] = _mm512_xor_si512(TMP[1], TMP[11]); \
TMP[2] = _mm512_ternarylogic_epi32 (TMP[2], TMP[13], TMP[14], 0x96); \
TMP[2] = _mm512_xor_si512(TMP[2], TMP[15]); \
TMP[3] = _mm512_ternarylogic_epi32 (TMP[3], TMP[17], TMP[18], 0x96); \
TMP[3] = _mm512_xor_si512(TMP[3], TMP[19]); \
/* Sbox */ \
TMP[0] = sBox512(TMP[0]); \
TMP[1] = sBox512(TMP[1]); \
TMP[2] = sBox512(TMP[2]); \
TMP[3] = sBox512(TMP[3]); \
/* Sbox done, now L */ \
TMP[4] = _mm512_ternarylogic_epi32(TMP[4], TMP[0], Lblock512(TMP[0]), 0x96); \
TMP[8] = _mm512_ternarylogic_epi32(TMP[8], TMP[1], Lblock512(TMP[1]), 0x96); \
TMP[12] = _mm512_ternarylogic_epi32(TMP[12], TMP[2], Lblock512(TMP[2]), 0x96); \
TMP[16] = _mm512_ternarylogic_epi32(TMP[16], TMP[3], Lblock512(TMP[3]), 0x96); \
/* initial xors */ \
EXPAND_ONE_RKEY(TMP, p_rk); p_rk+=iterator; \
TMP[0] = _mm512_ternarylogic_epi32 (TMP[0], TMP[6], TMP[7], 0x96); \
TMP[0] = _mm512_xor_si512(TMP[0], TMP[4]); \
TMP[1] = _mm512_ternarylogic_epi32 (TMP[1], TMP[10], TMP[11], 0x96); \
TMP[1] = _mm512_xor_si512(TMP[1], TMP[8]); \
TMP[2] = _mm512_ternarylogic_epi32 (TMP[2], TMP[14], TMP[15], 0x96); \
TMP[2] = _mm512_xor_si512(TMP[2], TMP[12]); \
TMP[3] = _mm512_ternarylogic_epi32 (TMP[3], TMP[18], TMP[19], 0x96); \
TMP[3] = _mm512_xor_si512(TMP[3], TMP[16]); \
/* Sbox */ \
TMP[0] = sBox512(TMP[0]); \
TMP[1] = sBox512(TMP[1]); \
TMP[2] = sBox512(TMP[2]); \
TMP[3] = sBox512(TMP[3]); \
/* Sbox done, now L */ \
TMP[5] = _mm512_ternarylogic_epi32(TMP[5], TMP[0], Lblock512(TMP[0]), 0x96); \
TMP[9] = _mm512_ternarylogic_epi32(TMP[9], TMP[1], Lblock512(TMP[1]), 0x96); \
TMP[13] = _mm512_ternarylogic_epi32(TMP[13], TMP[2], Lblock512(TMP[2]), 0x96); \
TMP[17] = _mm512_ternarylogic_epi32(TMP[17], TMP[3], Lblock512(TMP[3]), 0x96); \
\
/* initial xors */ \
EXPAND_ONE_RKEY(TMP, p_rk); p_rk+=iterator; \
TMP[0] = _mm512_ternarylogic_epi32 (TMP[0], TMP[7], TMP[4], 0x96); \
TMP[0] = _mm512_xor_si512(TMP[0], TMP[5]); \
TMP[1] = _mm512_ternarylogic_epi32 (TMP[1], TMP[11], TMP[8], 0x96); \
TMP[1] = _mm512_xor_si512(TMP[1], TMP[9]); \
TMP[2] = _mm512_ternarylogic_epi32 (TMP[2], TMP[15], TMP[12], 0x96); \
TMP[2] = _mm512_xor_si512(TMP[2], TMP[13]); \
TMP[3] = _mm512_ternarylogic_epi32 (TMP[3], TMP[19], TMP[16], 0x96); \
TMP[3] = _mm512_xor_si512(TMP[3], TMP[17]); \
/* Sbox */ \
TMP[0] = sBox512(TMP[0]); \
TMP[1] = sBox512(TMP[1]); \
TMP[2] = sBox512(TMP[2]); \
TMP[3] = sBox512(TMP[3]); \
/* Sbox done, now L */ \
TMP[6] = _mm512_ternarylogic_epi32(TMP[6], TMP[0], Lblock512(TMP[0]), 0x96); \
TMP[10] = _mm512_ternarylogic_epi32(TMP[10], TMP[1], Lblock512(TMP[1]), 0x96); \
TMP[14] = _mm512_ternarylogic_epi32(TMP[14], TMP[2], Lblock512(TMP[2]), 0x96); \
TMP[18] = _mm512_ternarylogic_epi32(TMP[18], TMP[3], Lblock512(TMP[3]), 0x96); \
\
/* initial xors */ \
EXPAND_ONE_RKEY(TMP, p_rk); p_rk+=iterator; \
TMP[0] = _mm512_ternarylogic_epi32 (TMP[0], TMP[4], TMP[5], 0x96); \
TMP[0] = _mm512_xor_si512(TMP[0], TMP[6]); \
TMP[1] = _mm512_ternarylogic_epi32 (TMP[1], TMP[8], TMP[9], 0x96); \
TMP[1] = _mm512_xor_si512(TMP[1], TMP[10]); \
TMP[2] = _mm512_ternarylogic_epi32 (TMP[2], TMP[12], TMP[13], 0x96); \
TMP[2] = _mm512_xor_si512(TMP[2], TMP[14]); \
TMP[3] = _mm512_ternarylogic_epi32 (TMP[3], TMP[16], TMP[17], 0x96); \
TMP[3] = _mm512_xor_si512(TMP[3], TMP[18]); \
/* Sbox */ \
TMP[0] = sBox512(TMP[0]); \
TMP[1] = sBox512(TMP[1]); \
TMP[2] = sBox512(TMP[2]); \
TMP[3] = sBox512(TMP[3]); \
/* Sbox done, now L */ \
TMP[7] = _mm512_ternarylogic_epi32(TMP[7], TMP[0], Lblock512(TMP[0]), 0x96); \
TMP[11] = _mm512_ternarylogic_epi32(TMP[11], TMP[1], Lblock512(TMP[1]), 0x96); \
TMP[15] = _mm512_ternarylogic_epi32(TMP[15], TMP[2], Lblock512(TMP[2]), 0x96); \
TMP[19] = _mm512_ternarylogic_epi32(TMP[19], TMP[3], Lblock512(TMP[3]), 0x96); \
}
/*
// Transpose functions
*/
#define TRANSPOSE_INP_512(K0,K1,K2,K3, T0,T1,T2,T3) \
K0 = _mm512_unpacklo_epi32(T0, T1); \
K1 = _mm512_unpacklo_epi32(T2, T3); \
K2 = _mm512_unpackhi_epi32(T0, T1); \
K3 = _mm512_unpackhi_epi32(T2, T3); \
\
T0 = _mm512_unpacklo_epi64(K0, K1); \
T1 = _mm512_unpacklo_epi64(K2, K3); \
T2 = _mm512_unpackhi_epi64(K0, K1); \
T3 = _mm512_unpackhi_epi64(K2, K3); \
\
K2 = _mm512_permutexvar_epi32(M512(permMask_in), T1); \
K1 = _mm512_permutexvar_epi32(M512(permMask_in), T2); \
K3 = _mm512_permutexvar_epi32(M512(permMask_in), T3); \
K0 = _mm512_permutexvar_epi32(M512(permMask_in), T0)
#define TRANSPOSE_OUT_512(T0,T1,T2,T3, K0,K1,K2,K3) \
T0 = _mm512_shuffle_i32x4(K0, K1, 0x44); \
T1 = _mm512_shuffle_i32x4(K0, K1, 0xee); \
T2 = _mm512_shuffle_i32x4(K2, K3, 0x44); \
T3 = _mm512_shuffle_i32x4(K2, K3, 0xee); \
\
K0 = _mm512_shuffle_i32x4(T0, T2, 0x88); \
K1 = _mm512_shuffle_i32x4(T0, T2, 0xdd); \
K2 = _mm512_shuffle_i32x4(T1, T3, 0x88); \
K3 = _mm512_shuffle_i32x4(T1, T3, 0xdd); \
\
K0 = _mm512_permutexvar_epi32(M512(permMask_out), K0);\
K1 = _mm512_permutexvar_epi32(M512(permMask_out), K1);\
K2 = _mm512_permutexvar_epi32(M512(permMask_out), K2);\
K3 = _mm512_permutexvar_epi32(M512(permMask_out), K3);\
\
T0=K0,T1=K1,T2=K2,T3=K3
__INLINE void TRANSPOSE_16x4_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, const int8u* p_inp[16], __mmask16 mb_mask) {
__mmask16 loc_mb_mask = mb_mask;
// L0 - L3
__m512i z0 = _mm512_maskz_loadu_epi32(0x000F * (0x1&loc_mb_mask), p_inp[0]); loc_mb_mask >>= 1;
__m512i z1 = _mm512_maskz_loadu_epi32(0x000F * (0x1&loc_mb_mask), p_inp[1]); loc_mb_mask >>= 1;
__m512i z2 = _mm512_maskz_loadu_epi32(0x000F * (0x1&loc_mb_mask), p_inp[2]); loc_mb_mask >>= 1;
__m512i z3 = _mm512_maskz_loadu_epi32(0x000F * (0x1&loc_mb_mask), p_inp[3]); loc_mb_mask >>= 1;
// L4 - L7
z0 = _mm512_mask_loadu_epi32(z0, 0x00F0 * (0x1&loc_mb_mask), (__m128i*)p_inp[4] - 1); loc_mb_mask >>= 1;
z1 = _mm512_mask_loadu_epi32(z1, 0x00F0 * (0x1&loc_mb_mask), (__m128i*)p_inp[5] - 1); loc_mb_mask >>= 1;
z2 = _mm512_mask_loadu_epi32(z2, 0x00F0 * (0x1&loc_mb_mask), (__m128i*)p_inp[6] - 1); loc_mb_mask >>= 1;
z3 = _mm512_mask_loadu_epi32(z3, 0x00F0 * (0x1&loc_mb_mask), (__m128i*)p_inp[7] - 1); loc_mb_mask >>= 1;
// L8 - Lb
z0 = _mm512_mask_loadu_epi32(z0, 0x0F00 * (0x1&loc_mb_mask), (__m128i*)p_inp[8] - 2); loc_mb_mask >>= 1;
z1 = _mm512_mask_loadu_epi32(z1, 0x0F00 * (0x1&loc_mb_mask), (__m128i*)p_inp[9] - 2); loc_mb_mask >>= 1;
z2 = _mm512_mask_loadu_epi32(z2, 0x0F00 * (0x1&loc_mb_mask), (__m128i*)p_inp[10] - 2); loc_mb_mask >>= 1;
z3 = _mm512_mask_loadu_epi32(z3, 0x0F00 * (0x1&loc_mb_mask), (__m128i*)p_inp[11] - 2); loc_mb_mask >>= 1;
// Lc - Lf
*t0 = ENDIANNESS_16x32(_mm512_mask_loadu_epi32(z0, 0xF000 * (0x1&loc_mb_mask), (__m128i*)p_inp[12] - 3)); loc_mb_mask >>= 1;
*t1 = ENDIANNESS_16x32(_mm512_mask_loadu_epi32(z1, 0xF000 * (0x1&loc_mb_mask), (__m128i*)p_inp[13] - 3)); loc_mb_mask >>= 1;
*t2 = ENDIANNESS_16x32(_mm512_mask_loadu_epi32(z2, 0xF000 * (0x1&loc_mb_mask), (__m128i*)p_inp[14] - 3)); loc_mb_mask >>= 1;
*t3 = ENDIANNESS_16x32(_mm512_mask_loadu_epi32(z3, 0xF000 * (0x1&loc_mb_mask), (__m128i*)p_inp[15] - 3)); loc_mb_mask >>= 1;
z0 = _mm512_unpacklo_epi32(*t0, *t1);
z1 = _mm512_unpackhi_epi32(*t0, *t1);
z2 = _mm512_unpacklo_epi32(*t2, *t3);
z3 = _mm512_unpackhi_epi32(*t2, *t3);
*t0 = _mm512_unpacklo_epi64(z0, z2);
*t1 = _mm512_unpackhi_epi64(z0, z2);
*t2 = _mm512_unpacklo_epi64(z1, z3);
*t3 = _mm512_unpackhi_epi64(z1, z3);
}
__INLINE void TRANSPOSE_16x4_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, const __m128i in[16]) {
// L0 - L3
__m512i z0 = _mm512_castsi128_si512(in[0]);
__m512i z1 = _mm512_castsi128_si512(in[1]);
__m512i z2 = _mm512_castsi128_si512(in[2]);
__m512i z3 = _mm512_castsi128_si512(in[3]);
// L4 - L7
z0 = _mm512_inserti64x2(z0, in[4], 1);
z1 = _mm512_inserti64x2(z1, in[5], 1);
z2 = _mm512_inserti64x2(z2, in[6], 1);
z3 = _mm512_inserti64x2(z3, in[7], 1);
// L8 - Lb
z0 = _mm512_inserti64x2(z0, in[8], 2);
z1 = _mm512_inserti64x2(z1, in[9], 2);
z2 = _mm512_inserti64x2(z2, in[10], 2);
z3 = _mm512_inserti64x2(z3, in[11], 2);
// Lc - Lf
*t0 = ENDIANNESS_16x32(_mm512_inserti64x2(z0, in[12], 3));
*t1 = ENDIANNESS_16x32(_mm512_inserti64x2(z1, in[13], 3));
*t2 = ENDIANNESS_16x32(_mm512_inserti64x2(z2, in[14], 3));
*t3 = ENDIANNESS_16x32(_mm512_inserti64x2(z3, in[15], 3));
z0 = _mm512_unpacklo_epi32(*t0, *t1);
z1 = _mm512_unpackhi_epi32(*t0, *t1);
z2 = _mm512_unpacklo_epi32(*t2, *t3);
z3 = _mm512_unpackhi_epi32(*t2, *t3);
*t0 = _mm512_unpacklo_epi64(z0, z2);
*t1 = _mm512_unpackhi_epi64(z0, z2);
*t2 = _mm512_unpacklo_epi64(z1, z3);
*t3 = _mm512_unpackhi_epi64(z1, z3);
}
__INLINE void TRANSPOSE_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, int8u* p_out[16], __mmask16 mb_mask) {
#define STORE_RESULT(OUT, store_mask, loc_mb_mask, Ti) \
_mm512_mask_storeu_epi32(OUT, store_mask * (0x1&loc_mb_mask), Ti); \
loc_mb_mask >>= 1;
__mmask16 loc_mb_mask = mb_mask;
__m512i z0 = _mm512_unpacklo_epi32(*t0, *t1);
__m512i z1 = _mm512_unpackhi_epi32(*t0, *t1);
__m512i z2 = _mm512_unpacklo_epi32(*t2, *t3);
__m512i z3 = _mm512_unpackhi_epi32(*t2, *t3);
/* Get the right endianness and do (Y0, Y1, Y2, Y3) = R(X32, X33, X34, X35) = (X35, X34, X33, X32) */
*t0 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z0, z2));
*t1 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z0, z2));
*t2 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z1, z3));
*t3 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z1, z3));
// L0 - L3
STORE_RESULT(p_out[0], 0x000F, loc_mb_mask, *t0);
STORE_RESULT(p_out[1], 0x000F, loc_mb_mask, *t1);
STORE_RESULT(p_out[2], 0x000F, loc_mb_mask, *t2);
STORE_RESULT(p_out[3], 0x000F, loc_mb_mask, *t3);
// L4 - L7
STORE_RESULT((__m128i*)p_out[4] - 1, 0x00F0, loc_mb_mask, *t0);
STORE_RESULT((__m128i*)p_out[5] - 1, 0x00F0, loc_mb_mask, *t1);
STORE_RESULT((__m128i*)p_out[6] - 1, 0x00F0, loc_mb_mask, *t2);
STORE_RESULT((__m128i*)p_out[7] - 1, 0x00F0, loc_mb_mask, *t3);
// L8 - Lb
STORE_RESULT((__m128i*)p_out[8] - 2, 0x0F00, loc_mb_mask, *t0);
STORE_RESULT((__m128i*)p_out[9] - 2, 0x0F00, loc_mb_mask, *t1);
STORE_RESULT((__m128i*)p_out[10] - 2, 0x0F00, loc_mb_mask, *t2);
STORE_RESULT((__m128i*)p_out[11] - 2, 0x0F00, loc_mb_mask, *t3);
// Lc - Lf
STORE_RESULT((__m128i*)p_out[12] - 3, 0xF000, loc_mb_mask, *t0);
STORE_RESULT((__m128i*)p_out[13] - 3, 0xF000, loc_mb_mask, *t1);
STORE_RESULT((__m128i*)p_out[14] - 3, 0xF000, loc_mb_mask, *t2);
STORE_RESULT((__m128i*)p_out[15] - 3, 0xF000, loc_mb_mask, *t3);
}
__INLINE void TRANSPOSE_4x16_I32_XMM_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, __m128i out[16]) {
__m512i z0 = _mm512_unpacklo_epi32(*t0, *t1);
__m512i z1 = _mm512_unpackhi_epi32(*t0, *t1);
__m512i z2 = _mm512_unpacklo_epi32(*t2, *t3);
__m512i z3 = _mm512_unpackhi_epi32(*t2, *t3);
/* Get the right endianness and do (Y0, Y1, Y2, Y3) = R(X32, X33, X34, X35) = (X35, X34, X33, X32) */
*t0 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z0, z2));
*t1 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z0, z2));
*t2 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z1, z3));
*t3 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z1, z3));
// L0 - L3
out[0] = _mm512_extracti64x2_epi64(*t0, 0);
out[1] = _mm512_extracti64x2_epi64(*t1, 0);
out[2] = _mm512_extracti64x2_epi64(*t2, 0);
out[3] = _mm512_extracti64x2_epi64(*t3, 0);
// L4 - L7
out[4] = _mm512_extracti64x2_epi64(*t0, 1);
out[5] = _mm512_extracti64x2_epi64(*t1, 1);
out[6] = _mm512_extracti64x2_epi64(*t2, 1);
out[7] = _mm512_extracti64x2_epi64(*t3, 1);
// L8 - Lb
out[8] = _mm512_extracti64x2_epi64(*t0, 2);
out[9] = _mm512_extracti64x2_epi64(*t1, 2);
out[10] = _mm512_extracti64x2_epi64(*t2, 2);
out[11] = _mm512_extracti64x2_epi64(*t3, 2);
// Lc - Lf
out[12] = _mm512_extracti64x2_epi64(*t0, 3);
out[13] = _mm512_extracti64x2_epi64(*t1, 3);
out[14] = _mm512_extracti64x2_epi64(*t2, 3);
out[15] = _mm512_extracti64x2_epi64(*t3, 3);
}
__INLINE void TRANSPOSE_4x16_I32_O128_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, __m128i p_out[16], __mmask16 mb_mask) {
#define STORE_RESULT(OUT, store_mask, loc_mb_mask, Ti) \
_mm512_mask_storeu_epi32(OUT, store_mask * (0x1&loc_mb_mask), Ti); \
loc_mb_mask >>= 1;
__mmask16 loc_mb_mask = mb_mask;
__m512i z0 = _mm512_unpacklo_epi32(*t0, *t1);
__m512i z1 = _mm512_unpackhi_epi32(*t0, *t1);
__m512i z2 = _mm512_unpacklo_epi32(*t2, *t3);
__m512i z3 = _mm512_unpackhi_epi32(*t2, *t3);
/* Get the right endianness and do (Y0, Y1, Y2, Y3) = R(X32, X33, X34, X35) = (X35, X34, X33, X32) */
*t0 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z0, z2));
*t1 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z0, z2));
*t2 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z1, z3));
*t3 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z1, z3));
// L0 - L3
STORE_RESULT(&p_out[0], 0x000F, loc_mb_mask, *t0);
STORE_RESULT(&p_out[1], 0x000F, loc_mb_mask, *t1);
STORE_RESULT(&p_out[2], 0x000F, loc_mb_mask, *t2);
STORE_RESULT(&p_out[3], 0x000F, loc_mb_mask, *t3);
// L4 - L7
STORE_RESULT(&p_out[4] - 1, 0x00F0, loc_mb_mask, *t0);
STORE_RESULT(&p_out[5] - 1, 0x00F0, loc_mb_mask, *t1);
STORE_RESULT(&p_out[6] - 1, 0x00F0, loc_mb_mask, *t2);
STORE_RESULT(&p_out[7] - 1, 0x00F0, loc_mb_mask, *t3);
// L8 - Lb
STORE_RESULT(&p_out[8] - 2, 0x0F00, loc_mb_mask, *t0);
STORE_RESULT(&p_out[9] - 2, 0x0F00, loc_mb_mask, *t1);
STORE_RESULT(&p_out[10] - 2, 0x0F00, loc_mb_mask, *t2);
STORE_RESULT(&p_out[11] - 2, 0x0F00, loc_mb_mask, *t3);
// Lc - Lf
STORE_RESULT(&p_out[12] - 3, 0xF000, loc_mb_mask, *t0);
STORE_RESULT(&p_out[13] - 3, 0xF000, loc_mb_mask, *t1);
STORE_RESULT(&p_out[14] - 3, 0xF000, loc_mb_mask, *t2);
STORE_RESULT(&p_out[15] - 3, 0xF000, loc_mb_mask, *t3);
}
__INLINE void TRANSPOSE_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __m512i t3, int8u* p_out[16], int* p_loc_len, __mmask16 mb_mask) {
#define STORE_RESULT_EPI8(OUT, store_mask, loc_mb_mask, Ti) \
_mm512_mask_storeu_epi8(OUT, store_mask * (0x1&loc_mb_mask), Ti); \
loc_mb_mask >>= 1;
__mmask16 loc_mb_mask = mb_mask;
/* Mask for data loading */
__mmask64 stream_mask;
__m512i z0 = _mm512_unpacklo_epi32(t0, t1);
__m512i z1 = _mm512_unpackhi_epi32(t0, t1);
__m512i z2 = _mm512_unpacklo_epi32(t2, t3);
__m512i z3 = _mm512_unpackhi_epi32(t2, t3);
/* Get the right endianness */
t0 = ENDIANNESS_16x32(_mm512_unpacklo_epi64(z0, z2));
t1 = ENDIANNESS_16x32(_mm512_unpackhi_epi64(z0, z2));
t2 = ENDIANNESS_16x32(_mm512_unpacklo_epi64(z1, z3));
t3 = ENDIANNESS_16x32(_mm512_unpackhi_epi64(z1, z3));
// L0 - L3
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8(p_out[0], stream_mask, loc_mb_mask, t0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8(p_out[1], stream_mask, loc_mb_mask, t1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8(p_out[2], stream_mask, loc_mb_mask, t2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8(p_out[3], stream_mask, loc_mb_mask, t3);
// L4 - L7
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[4] - 1, stream_mask << 16, loc_mb_mask, t0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[5] - 1, stream_mask << 16, loc_mb_mask, t1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[6] - 1, stream_mask << 16, loc_mb_mask, t2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[7] - 1, stream_mask << 16, loc_mb_mask, t3);
// L8 - Lb
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[8] - 2, stream_mask << 32, loc_mb_mask, t0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[9] - 2, stream_mask << 32, loc_mb_mask, t1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[10] - 2, stream_mask << 32, loc_mb_mask, t2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[11] - 2, stream_mask << 32, loc_mb_mask, t3);
// Lc - Lf
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[12] - 3, stream_mask << 48, loc_mb_mask, t0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[13] - 3, stream_mask << 48, loc_mb_mask, t1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[14] - 3, stream_mask << 48, loc_mb_mask, t2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
STORE_RESULT_EPI8((__m128i*)p_out[15] - 3, stream_mask << 48, loc_mb_mask, t3);
}
__INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI32(__m512i* t0, __m512i* t1, __m512i* t2, __m512i* t3, int8u* p_out[16], const int8u* p_iv[16], __mmask16 mb_mask) {
#define XOR_AND_STORE_RESULT(OUT, store_mask, loc_mb_mask, Ti, IV, TMP) \
TMP = _mm512_maskz_loadu_epi32(store_mask * (0x1&loc_mb_mask), IV); \
_mm512_mask_storeu_epi32(OUT, store_mask * (0x1&loc_mb_mask), _mm512_xor_epi32(Ti, TMP)); \
loc_mb_mask >>= 1;
__m512i z0 = _mm512_setzero_si512();
__m512i z1 = _mm512_setzero_si512();
__m512i z2 = _mm512_setzero_si512();
__m512i z3 = _mm512_setzero_si512();
__mmask16 loc_mb_mask = mb_mask;
z0 = _mm512_unpacklo_epi32(*t0, *t1);
z1 = _mm512_unpackhi_epi32(*t0, *t1);
z2 = _mm512_unpacklo_epi32(*t2, *t3);
z3 = _mm512_unpackhi_epi32(*t2, *t3);
/* Get the right endianness and do (Y0, Y1, Y2, Y3) = R(X32, X33, X34, X35) = (X35, X34, X33, X32) */
*t0 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z0, z2));
*t1 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z0, z2));
*t2 = CHANGE_ORDER_BLOCKS(_mm512_unpacklo_epi64(z1, z3));
*t3 = CHANGE_ORDER_BLOCKS(_mm512_unpackhi_epi64(z1, z3));
// L0 - L3
XOR_AND_STORE_RESULT(p_out[0], 0x000F, loc_mb_mask, *t0, p_iv[0], z0);
XOR_AND_STORE_RESULT(p_out[1], 0x000F, loc_mb_mask, *t1, p_iv[1], z1);
XOR_AND_STORE_RESULT(p_out[2], 0x000F, loc_mb_mask, *t2, p_iv[2], z2);
XOR_AND_STORE_RESULT(p_out[3], 0x000F, loc_mb_mask, *t3, p_iv[3], z3);
// L4 - L7
XOR_AND_STORE_RESULT((__m128i*)p_out[4] - 1, 0x00F0, loc_mb_mask, *t0, (__m128i*)p_iv[4] - 1, z0);
XOR_AND_STORE_RESULT((__m128i*)p_out[5] - 1, 0x00F0, loc_mb_mask, *t1, (__m128i*)p_iv[5] - 1, z1);
XOR_AND_STORE_RESULT((__m128i*)p_out[6] - 1, 0x00F0, loc_mb_mask, *t2, (__m128i*)p_iv[6] - 1, z2);
XOR_AND_STORE_RESULT((__m128i*)p_out[7] - 1, 0x00F0, loc_mb_mask, *t3, (__m128i*)p_iv[7] - 1, z3);
// L8 - Lb
XOR_AND_STORE_RESULT((__m128i*)p_out[8] - 2, 0x0F00, loc_mb_mask, *t0, (__m128i*)p_iv[8] - 2, z0);
XOR_AND_STORE_RESULT((__m128i*)p_out[9] - 2, 0x0F00, loc_mb_mask, *t1, (__m128i*)p_iv[9] - 2, z1);
XOR_AND_STORE_RESULT((__m128i*)p_out[10] - 2, 0x0F00, loc_mb_mask, *t2, (__m128i*)p_iv[10] - 2, z2);
XOR_AND_STORE_RESULT((__m128i*)p_out[11] - 2, 0x0F00, loc_mb_mask, *t3, (__m128i*)p_iv[11] - 2, z3);
// Lc - Lf
XOR_AND_STORE_RESULT((__m128i*)p_out[12] - 3, 0xF000, loc_mb_mask, *t0, (__m128i*)p_iv[12] - 3, z0);
XOR_AND_STORE_RESULT((__m128i*)p_out[13] - 3, 0xF000, loc_mb_mask, *t1, (__m128i*)p_iv[13] - 3, z1);
XOR_AND_STORE_RESULT((__m128i*)p_out[14] - 3, 0xF000, loc_mb_mask, *t2, (__m128i*)p_iv[14] - 3, z2);
XOR_AND_STORE_RESULT((__m128i*)p_out[15] - 3, 0xF000, loc_mb_mask, *t3, (__m128i*)p_iv[15] - 3, z3);
}
__INLINE void TRANSPOSE_AND_XOR_4x16_I32_EPI8(__m512i t0, __m512i t1, __m512i t2, __m512i t3, int8u* p_out[16], const int8u* p_iv[16], int* p_loc_len, __mmask16 mb_mask) {
#define XOR_AND_STORE_RESULT_EPI8(OUT, store_mask, loc_mb_mask, Ti, IV, TMP) \
TMP = _mm512_maskz_loadu_epi8(store_mask * (0x1&loc_mb_mask), IV); \
_mm512_mask_storeu_epi8(OUT, store_mask * (0x1&loc_mb_mask), _mm512_xor_epi32(Ti, TMP)); \
loc_mb_mask >>= 1;
__m512i z0 = _mm512_setzero_si512();
__m512i z1 = _mm512_setzero_si512();
__m512i z2 = _mm512_setzero_si512();
__m512i z3 = _mm512_setzero_si512();
__mmask16 loc_mb_mask = mb_mask;
/* Mask for data loading */
__mmask64 stream_mask;
z0 = _mm512_unpacklo_epi32(t0, t1);
z1 = _mm512_unpackhi_epi32(t0, t1);
z2 = _mm512_unpacklo_epi32(t2, t3);
z3 = _mm512_unpackhi_epi32(t2, t3);
/* Get the right endianness */
t0 = ENDIANNESS_16x32(_mm512_unpacklo_epi64(z0, z2));
t1 = ENDIANNESS_16x32(_mm512_unpackhi_epi64(z0, z2));
t2 = ENDIANNESS_16x32(_mm512_unpacklo_epi64(z1, z3));
t3 = ENDIANNESS_16x32(_mm512_unpackhi_epi64(z1, z3));
// L0 - L3
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8(p_out[0], stream_mask, loc_mb_mask, t0, p_iv[0], z0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8(p_out[1], stream_mask, loc_mb_mask, t1, p_iv[1], z1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8(p_out[2], stream_mask, loc_mb_mask, t2, p_iv[2], z2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8(p_out[3], stream_mask, loc_mb_mask, t3, p_iv[3], z3);
// L4 - L7
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[4] - 1, stream_mask << 16, loc_mb_mask, t0, (__m128i*)p_iv[4] - 1, z0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[5] - 1, stream_mask << 16, loc_mb_mask, t1, (__m128i*)p_iv[5] - 1, z1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[6] - 1, stream_mask << 16, loc_mb_mask, t2, (__m128i*)p_iv[6] - 1, z2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[7] - 1, stream_mask << 16, loc_mb_mask, t3, (__m128i*)p_iv[7] - 1, z3);
// L8 - Lb
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[8] - 2, stream_mask << 32, loc_mb_mask, t0, (__m128i*)p_iv[8] - 2, z0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[9] - 2, stream_mask << 32, loc_mb_mask, t1, (__m128i*)p_iv[9] - 2, z1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[10] - 2, stream_mask << 32, loc_mb_mask, t2, (__m128i*)p_iv[10] - 2, z2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[11] - 2, stream_mask << 32, loc_mb_mask, t3, (__m128i*)p_iv[11] - 2, z3);
// Lc - Lf
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[12] - 3, stream_mask << 48, loc_mb_mask, t0, (__m128i*)p_iv[12] - 3, z0);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[13] - 3, stream_mask << 48, loc_mb_mask, t1, (__m128i*)p_iv[13] - 3, z1);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[14] - 3, stream_mask << 48, loc_mb_mask, t2, (__m128i*)p_iv[14] - 3, z2);
UPDATE_STREAM_MASK_16(stream_mask, p_loc_len)
XOR_AND_STORE_RESULT_EPI8((__m128i*)p_out[15] - 3, stream_mask << 48, loc_mb_mask, t3, (__m128i*)p_iv[15] - 3, z3);
}
#endif /* _SM4_GFNI_MB_H */
|
e4f4e1847a23d4c9ae3b81685a364ed66e5faee9
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/security/pam-pgsql/files/patch-src_backend__pgsql.c
|
24cdc4e63fbc1499aed9acda5eb60262668d634f
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 2,780
|
c
|
patch-src_backend__pgsql.c
|
--- src/backend_pgsql.c.orig 2023-08-02 16:34:32 UTC
+++ src/backend_pgsql.c
@@ -1,6 +1,6 @@
/*
* PAM authentication module for PostgreSQL
- *
+ *
* Based in part on pam_unix.c of FreeBSD. See COPYRIGHT
* for licensing details.
*
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <netdb.h>
#include <arpa/inet.h>
+#include <sys/socket.h>
#include <gcrypt.h>
@@ -57,7 +58,7 @@ build_conninfo(modopt_t *options)
if(options->port) {
strncat(str, " port=", strlen(" port="));
strncat(str, options->port, strlen(options->port));
- }
+ }
if(options->timeout) {
strncat(str, " connect_timeout=", strlen(" connect_timeout="));
strncat(str, options->timeout, strlen(options->timeout));
@@ -102,7 +103,7 @@ expand_query (char **command, const char** values, con
char *p, *q, *res;
unsigned int len;
unsigned int nparm=0;
-
+
if (!query) {
*command = NULL;
return 0;
@@ -121,7 +122,7 @@ expand_query (char **command, const char** values, con
}
}
len++;
- p++;
+ p++;
}
res = malloc (len + 1);
if (!res) {
@@ -181,15 +182,15 @@ expand_query (char **command, const char** values, con
} else *q++ = *p++;
}
*q = 0;
-
+
*command = res;
- values[nparm] = NULL;
+ values[nparm] = NULL;
return nparm;
}
/* private: execute query */
int
-pg_execParam(PGconn *conn, PGresult **res,
+pg_execParam(PGconn *conn, PGresult **res,
const char *query, const char *service, const char *user, const char *passwd, const char *rhost)
{
int nparm = 0;
@@ -197,26 +198,26 @@ pg_execParam(PGconn *conn, PGresult **res,
char *command, *raddr;
struct hostent *hentry;
- if (!conn)
+ if (!conn)
return PAM_AUTHINFO_UNAVAIL;
bzero(values, sizeof(*values));
-
+
raddr = NULL;
-
+
if(rhost != NULL && (hentry = gethostbyname(rhost)) != NULL) {
/* Make IP string */
raddr = malloc(INET_ADDRSTRLEN);
inet_ntop(AF_INET, hentry->h_addr_list[0], raddr, INET_ADDRSTRLEN);
}
-
+
nparm = expand_query(&command, values, query, service, user, passwd, rhost, raddr);
- if (command == NULL)
+ if (command == NULL)
return PAM_AUTH_ERR;
-
+
*res = PQexecParams(conn, command, nparm, 0, values, 0, 0, 0);
free (command);
free (raddr);
-
+
if(PQresultStatus(*res) != PGRES_COMMAND_OK && PQresultStatus(*res) != PGRES_TUPLES_OK) {
SYSLOG("PostgreSQL query failed: '%s'", PQresultErrorMessage(*res));
return PAM_AUTHINFO_UNAVAIL;
@@ -254,7 +255,7 @@ backend_authenticate(const char *service, const char *
return PAM_AUTH_ERR;
DBGLOG("query: %s", options->query_auth);
- rc = PAM_AUTH_ERR;
+ rc = PAM_AUTH_ERR;
if(pg_execParam(conn, &res, options->query_auth, service, user, passwd, rhost) == PAM_SUCCESS) {
if(PQntuples(res) == 0) {
rc = PAM_USER_UNKNOWN;
|
fadcd11710b271765e69f1261f07dec1c8439b83
|
7df190df28da7e4ff166e55dc8ce780f11236a9f
|
/src/router/open-plc-utils/mdio/mdiogen.c
|
6854202ffe1797368c43d36d6a31b60b000cdd49
|
[
"BSD-3-Clause-Clear"
] |
permissive
|
mirror/dd-wrt
|
25416946e6132aa54b35809de61834a1825a9a36
|
8f2934a5a2adfbb59b471375aa3a38de5d036531
|
refs/heads/master
| 2023-08-31T14:54:47.496685
| 2023-08-30T17:40:54
| 2023-08-30T17:40:54
| 7,470,282
| 520
| 281
| null | 2023-05-29T20:56:24
| 2013-01-06T17:21:29
| null |
UTF-8
|
C
| false
| false
| 6,814
|
c
|
mdiogen.c
|
/*====================================================================*
*
* Copyright (c) 2013 Qualcomm Atheros, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted (subject to the limitations
* in the disclaimer below) provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* * Neither the name of Qualcomm Atheros nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*--------------------------------------------------------------------*/
/*====================================================================*"
*
* mdiogen.c -
*
*
* Contributor(s):
* Charles Maier <cmaier@qca.qualcomm.com>
* Nathaniel Houghton <nhoughto@qca.qualcomm.com>
*
*--------------------------------------------------------------------*/
/*====================================================================*
* system header files;
*--------------------------------------------------------------------*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/stat.h>
/*====================================================================*
* custom header files;
*--------------------------------------------------------------------*/
#include "../tools/number.h"
#include "../tools/memory.h"
#include "../tools/endian.h"
#include "../tools/error.h"
#include "../mdio/mdio.h"
/*====================================================================*
* custom source files;
*--------------------------------------------------------------------*/
#ifndef MAKEFILE
#include "../tools/error.c"
#endif
/*====================================================================*
* program variables;
*--------------------------------------------------------------------*/
const char * program_name;
/*====================================================================*
*
* void regview (void const * memory, uint16_t offset, uint16_t length, FILE *fp);
*
* memory.h
*
* print memory as a binary dump showing absolute memory offsets and
* 16-bit binary register maps; sample output looks like:
*
* ADDR DATA 5432-1098-7654-3210
* 0000 0000 0000-0000-0000-0000
* 0002 0000 0000-0000-0000-0000
* 0004 0000 0000-0000-0000-0000
* 0008 0000 0000-0000-0000-0000
* 0010 0000 0000-0000-0000-0000
*
*
*--------------------------------------------------------------------*/
static void regview (void const * memory, uint16_t offset, uint16_t extent, FILE *fp)
{
uint16_t * origin = (uint16_t *)(memory);
printf ("ADDR DATA 5432-1098-7654-3210\n");
while (extent >= sizeof (* origin))
{
signed bit = sizeof (* origin) << 3;
printf ("%04u ", offset);
printf ("%04X ", LE16TOH (*origin));
while (bit--)
{
putc (((* origin >> bit) & 1)? '1': '0', fp);
if ((bit) && !(bit%4))
{
putc ('-', fp);
}
}
putc ('\n', fp);
offset += sizeof (* origin);
extent -= sizeof (* origin);
origin++;
}
return;
}
/*====================================================================*
*
* int main (int argc, const char * argv []);
*
* this is a basic program that produces an MDIO program block
* using macros defined in mdio.h; the output filename is fixed;
*
* declare your MDIO program by editing array program [] based on
* the MDIO program rules defined in the Atheros PLC Firmware TRM
* under the description of the VS_MOD_OP;
*
*
*--------------------------------------------------------------------*/
#define MDIO_PROGRAM "mdio.bin"
int main (int argc, const char * argv [])
{
uint16_t program [] =
{
#if 1
MDIO16_START (1, 0, 9),
MDIO16_INSTR (1, 1, 0x18, 0x00, 2),
0x0000,
0xFFFF,
MDIO16_INSTR (1, 1, 0x10, 0x16, 2),
0x003F,
0xFFFF,
MDIO16_INSTR (1, 1, 0x10, 0x17, 2),
0x7E3F,
0xFFFF,
MDIO16_INSTR (1, 1, 0x18, 0x00, 2),
0x0000,
0xFFFF,
MDIO16_INSTR (1, 1, 0x10, 0x02, 2),
0x0700,
0xFFFF,
MDIO16_INSTR (1, 1, 0x10, 0x03, 2),
0x0000,
0xFFFF,
MDIO16_INSTR (1, 1, 0x18, 0x00, 2),
0x0000,
0xFFFF,
MDIO16_INSTR (1, 1, 0x14, 0x00, 2),
0x007D,
0xFFFF,
MDIO16_INSTR (1, 1, 0x14, 0x01, 2),
0x0000,
0xFFFF,
#else
MDIO16_START (1, 0, 24),
MDIO32_INSTR (0x2c, 0x7e3f003f, 0xffffffff),
MDIO32_INSTR (0x8, 0x500, 0xffffffff),
MDIO32_INSTR (0x100, 0x7d, 0xffffffff),
MDIO32_INSTR (0x30, 0x19f005f2, 0xffffffff),
MDIO32_INSTR (0x200, 0x7d, 0xffffffff),
MDIO32_INSTR (0x300, 0x7d, 0xffffffff),
MDIO32_INSTR (0x400, 0x7d, 0xffffffff),
MDIO32_INSTR (0x500, 0x7d, 0xffffffff),
#endif
};
signed fd;
program_name = * argv;
if (--argc)
{
error (1, ECANCELED, "Too many command line arguments");
}
regview (&program, 0, sizeof (program), stdout);
if ((fd = open (MDIO_PROGRAM, O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU | S_IRGRP | S_IROTH)) == -1)
{
error (1, errno, "Can't open %s", MDIO_PROGRAM);
}
if (write (fd, program, sizeof (program)) != sizeof (program))
{
unlink (MDIO_PROGRAM);
error (1, errno, "Can't write %s", MDIO_PROGRAM);
}
if (sizeof (program) % sizeof (uint32_t))
{
uint32_t zeros = 0;
ssize_t count = sizeof (uint32_t) - sizeof (program) % sizeof (uint32_t);
if (write (fd, &zeros, count) != count)
{
unlink (MDIO_PROGRAM);
error (1, errno, "Can't write %s", MDIO_PROGRAM);
}
}
close (fd);
return (0);
}
|
e1d2edeb6dc5b908ec3ff99c8511b883826bb9da
|
971b2cea2d1c3001aadc8ca1a48110b7db1ed5f2
|
/deps/abc/src/misc/extra/extraUtilPerm.c
|
3e8505fdd045b18aafbc47e1153207fcb7454233
|
[
"MIT-Modern-Variant",
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] |
permissive
|
emsec/hal
|
70ad2921739967d914dd458984bd7d6d497d3b0a
|
e4fae37bec9168a61100eacfda37a1f291b4d0be
|
refs/heads/master
| 2023-09-02T20:27:32.909426
| 2023-09-01T13:03:24
| 2023-09-01T13:03:24
| 169,076,171
| 510
| 72
|
MIT
| 2023-09-01T13:03:26
| 2019-02-04T12:37:20
|
C++
|
UTF-8
|
C
| false
| false
| 31,271
|
c
|
extraUtilPerm.c
|
/**CFile****************************************************************
FileName [extraUtilPerm.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [extra]
Synopsis [Permutation computation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: extraUtilPerm.c,v 1.0 2003/02/01 00:00:00 alanmi Exp $]
***********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "aig/gia/gia.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
typedef enum
{
ABC_ZDD_OPER_NONE,
ABC_ZDD_OPER_DIFF,
ABC_ZDD_OPER_UNION,
ABC_ZDD_OPER_MIN_UNION,
ABC_ZDD_OPER_INTER,
ABC_ZDD_OPER_PERM,
ABC_ZDD_OPER_PERM_PROD,
ABC_ZDD_OPER_COF0,
ABC_ZDD_OPER_COF1,
ABC_ZDD_OPER_THRESH,
ABC_ZDD_OPER_DOT_PROD,
ABC_ZDD_OPER_DOT_PROD_6,
ABC_ZDD_OPER_INSERT,
ABC_ZDD_OPER_PATHS,
ABC_ZDD_OPER_NODES,
ABC_ZDD_OPER_ITE
} Abc_ZddOper;
typedef struct Abc_ZddObj_ Abc_ZddObj;
struct Abc_ZddObj_
{
unsigned Var : 31;
unsigned Mark : 1;
unsigned True;
unsigned False;
};
typedef struct Abc_ZddEnt_ Abc_ZddEnt;
struct Abc_ZddEnt_
{
int Arg0;
int Arg1;
int Arg2;
int Res;
};
typedef struct Abc_ZddMan_ Abc_ZddMan;
struct Abc_ZddMan_
{
int nVars;
int nObjs;
int nObjsAlloc;
int nPermSize;
unsigned nUniqueMask;
unsigned nCacheMask;
int * pUnique;
int * pNexts;
Abc_ZddEnt * pCache;
Abc_ZddObj * pObjs;
int nCacheLookups;
int nCacheMisses;
word nMemory;
int * pV2TI;
int * pV2TJ;
int * pT2V;
};
static inline int Abc_ZddIthVar( int i ) { return i + 2; }
static inline unsigned Abc_ZddHash( int Arg0, int Arg1, int Arg2 ) { return 12582917 * Arg0 + 4256249 * Arg1 + 741457 * Arg2; }
static inline Abc_ZddObj * Abc_ZddNode( Abc_ZddMan * p, int i ) { return p->pObjs + i; }
static inline int Abc_ZddObjId( Abc_ZddMan * p, Abc_ZddObj * pObj ) { return pObj - p->pObjs; }
static inline int Abc_ZddObjVar( Abc_ZddMan * p, int i ) { return Abc_ZddNode(p, i)->Var; }
static inline void Abc_ZddSetVarIJ( Abc_ZddMan * p, int i, int j, int v ) { assert( i < j ); p->pT2V[i * p->nPermSize + j] = v; }
static inline int Abc_ZddVarIJ( Abc_ZddMan * p, int i, int j ) { assert( i < j ); return p->pT2V[i * p->nPermSize + j]; }
static inline int Abc_ZddVarsClash( Abc_ZddMan * p, int v0, int v1 ) { return p->pV2TI[v0] == p->pV2TI[v1] || p->pV2TJ[v0] == p->pV2TJ[v1] || p->pV2TI[v0] == p->pV2TJ[v1] || p->pV2TJ[v0] == p->pV2TI[v1]; }
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline int Abc_ZddCacheLookup( Abc_ZddMan * p, int Arg0, int Arg1, int Arg2 )
{
Abc_ZddEnt * pEnt = p->pCache + (Abc_ZddHash(Arg0, Arg1, Arg2) & p->nCacheMask);
p->nCacheLookups++;
return (pEnt->Arg0 == Arg0 && pEnt->Arg1 == Arg1 && pEnt->Arg2 == Arg2) ? pEnt->Res : -1;
}
static inline int Abc_ZddCacheInsert( Abc_ZddMan * p, int Arg0, int Arg1, int Arg2, int Res )
{
Abc_ZddEnt * pEnt = p->pCache + (Abc_ZddHash(Arg0, Arg1, Arg2) & p->nCacheMask);
pEnt->Arg0 = Arg0; pEnt->Arg1 = Arg1; pEnt->Arg2 = Arg2; pEnt->Res = Res;
p->nCacheMisses++;
assert( Res >= 0 );
return Res;
}
static inline int Abc_ZddUniqueLookup( Abc_ZddMan * p, int Var, int True, int False )
{
int *q = p->pUnique + (Abc_ZddHash(Var, True, False) & p->nUniqueMask);
for ( ; *q; q = p->pNexts + *q )
if ( p->pObjs[*q].Var == (unsigned)Var && p->pObjs[*q].True == (unsigned)True && p->pObjs[*q].False == (unsigned)False )
return *q;
return 0;
}
static inline int Abc_ZddUniqueCreate( Abc_ZddMan * p, int Var, int True, int False )
{
assert( Var >= 0 && Var < p->nVars );
assert( Var < Abc_ZddObjVar(p, True) );
assert( Var < Abc_ZddObjVar(p, False) );
if ( True == 0 )
return False;
{
int *q = p->pUnique + (Abc_ZddHash(Var, True, False) & p->nUniqueMask);
for ( ; *q; q = p->pNexts + *q )
if ( p->pObjs[*q].Var == (unsigned)Var && p->pObjs[*q].True == (unsigned)True && p->pObjs[*q].False == (unsigned)False )
return *q;
if ( p->nObjs == p->nObjsAlloc )
printf( "Aborting because the number of nodes exceeded %d.\n", p->nObjsAlloc ), fflush(stdout);
assert( p->nObjs < p->nObjsAlloc );
*q = p->nObjs++;
p->pObjs[*q].Var = Var;
p->pObjs[*q].True = True;
p->pObjs[*q].False = False;
// printf( "Added node %3d: Var = %3d. True = %3d. False = %3d\n", *q, Var, True, False );
return *q;
}
}
int Abc_ZddBuildSet( Abc_ZddMan * p, int * pSet, int Size )
{
int i, Res = 1;
Vec_IntSelectSort( pSet, Size );
for ( i = Size - 1; i >= 0; i-- )
Res = Abc_ZddUniqueCreate( p, pSet[i], Res, 0 );
return Res;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_ZddMan * Abc_ZddManAlloc( int nVars, int nObjs )
{
Abc_ZddMan * p; int i;
p = ABC_CALLOC( Abc_ZddMan, 1 );
p->nVars = nVars;
p->nObjsAlloc = nObjs;
p->nUniqueMask = (1 << Abc_Base2Log(nObjs)) - 1;
p->nCacheMask = (1 << Abc_Base2Log(nObjs)) - 1;
p->pUnique = ABC_CALLOC( int, p->nUniqueMask + 1 );
p->pNexts = ABC_CALLOC( int, p->nObjsAlloc );
p->pCache = ABC_CALLOC( Abc_ZddEnt, p->nCacheMask + 1 );
p->pObjs = ABC_CALLOC( Abc_ZddObj, p->nObjsAlloc );
p->nObjs = 2;
memset( p->pObjs, 0xff, sizeof(Abc_ZddObj) * 2 );
p->pObjs[0].Var = nVars;
p->pObjs[1].Var = nVars;
for ( i = 0; i < nVars; i++ )
Abc_ZddUniqueCreate( p, i, 1, 0 );
assert( p->nObjs == nVars + 2 );
p->nMemory = sizeof(Abc_ZddMan)/4 +
p->nUniqueMask + 1 + p->nObjsAlloc +
(p->nCacheMask + 1) * sizeof(Abc_ZddEnt)/4 +
p->nObjsAlloc * sizeof(Abc_ZddObj)/4;
return p;
}
void Abc_ZddManCreatePerms( Abc_ZddMan * p, int nPermSize )
{
int i, j, v = 0;
assert( 2 * p->nVars == nPermSize * (nPermSize - 1) );
assert( p->nPermSize == 0 );
p->nPermSize = nPermSize;
p->pV2TI = ABC_FALLOC( int, p->nVars );
p->pV2TJ = ABC_FALLOC( int, p->nVars );
p->pT2V = ABC_FALLOC( int, p->nPermSize * p->nPermSize );
for ( i = 0; i < nPermSize; i++ )
for ( j = i + 1; j < nPermSize; j++ )
{
p->pV2TI[v] = i;
p->pV2TJ[v] = j;
Abc_ZddSetVarIJ( p, i, j, v++ );
}
assert( v == p->nVars );
}
void Abc_ZddManFree( Abc_ZddMan * p )
{
printf( "ZDD stats: Var = %d Obj = %d Alloc = %d Hit = %d Miss = %d ",
p->nVars, p->nObjs, p->nObjsAlloc, p->nCacheLookups-p->nCacheMisses, p->nCacheMisses );
printf( "Mem = %.2f MB\n", 4.0*(int)(p->nMemory/(1<<20)) );
ABC_FREE( p->pT2V );
ABC_FREE( p->pV2TI );
ABC_FREE( p->pV2TJ );
ABC_FREE( p->pUnique );
ABC_FREE( p->pNexts );
ABC_FREE( p->pCache );
ABC_FREE( p->pObjs );
ABC_FREE( p );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_ZddDiff( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A, * B;
int r0, r1, r;
if ( a == 0 ) return 0;
if ( b == 0 ) return a;
if ( a == b ) return 0;
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_DIFF)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
B = Abc_ZddNode( p, b );
if ( A->Var < B->Var )
r0 = Abc_ZddDiff( p, A->False, b ),
r = Abc_ZddUniqueCreate( p, A->Var, A->True, r0 );
else if ( A->Var > B->Var )
r = Abc_ZddDiff( p, a, B->False );
else
r0 = Abc_ZddDiff( p, A->False, B->False ),
r1 = Abc_ZddDiff( p, A->True, B->True ),
r = Abc_ZddUniqueCreate( p, A->Var, r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_DIFF, r );
}
int Abc_ZddUnion( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A, * B;
int r0, r1, r;
if ( a == 0 ) return b;
if ( b == 0 ) return a;
if ( a == b ) return a;
if ( a > b ) return Abc_ZddUnion( p, b, a );
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_UNION)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
B = Abc_ZddNode( p, b );
if ( A->Var < B->Var )
r0 = Abc_ZddUnion( p, A->False, b ),
r1 = A->True;
else if ( A->Var > B->Var )
r0 = Abc_ZddUnion( p, a, B->False ),
r1 = B->True;
else
r0 = Abc_ZddUnion( p, A->False, B->False ),
r1 = Abc_ZddUnion( p, A->True, B->True );
r = Abc_ZddUniqueCreate( p, Abc_MinInt(A->Var, B->Var), r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_UNION, r );
}
int Abc_ZddMinUnion( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A, * B;
int r0, r1, r;
if ( a == 0 ) return b;
if ( b == 0 ) return a;
if ( a == b ) return a;
if ( a > b ) return Abc_ZddMinUnion( p, b, a );
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_MIN_UNION)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
B = Abc_ZddNode( p, b );
if ( A->Var < B->Var )
r0 = Abc_ZddMinUnion( p, A->False, b ),
r1 = A->True;
else if ( A->Var > B->Var )
r0 = Abc_ZddMinUnion( p, a, B->False ),
r1 = B->True;
else
r0 = Abc_ZddMinUnion( p, A->False, B->False ),
r1 = Abc_ZddMinUnion( p, A->True, B->True );
r1 = Abc_ZddDiff( p, r1, r0 ); // assume args are minimal
r = Abc_ZddUniqueCreate( p, Abc_MinInt(A->Var, B->Var), r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_MIN_UNION, r );
}
int Abc_ZddIntersect( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A, * B;
int r0, r1, r;
if ( a == 0 ) return 0;
if ( b == 0 ) return 0;
if ( a == b ) return a;
if ( a > b ) return Abc_ZddIntersect( p, b, a );
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_INTER)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
B = Abc_ZddNode( p, b );
if ( A->Var < B->Var )
r0 = Abc_ZddIntersect( p, A->False, b ),
r1 = A->True;
else if ( A->Var > B->Var )
r0 = Abc_ZddIntersect( p, a, B->False ),
r1 = B->True;
else
r0 = Abc_ZddIntersect( p, A->False, B->False ),
r1 = Abc_ZddIntersect( p, A->True, B->True );
r = Abc_ZddUniqueCreate( p, Abc_MinInt(A->Var, B->Var), r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_INTER, r );
}
int Abc_ZddCof0( Abc_ZddMan * p, int a, int Var )
{
Abc_ZddObj * A;
int r0, r1, r;
if ( a < 2 ) return a;
A = Abc_ZddNode( p, a );
if ( (int)A->Var > Var )
return a;
if ( (r = Abc_ZddCacheLookup(p, a, Var, ABC_ZDD_OPER_COF0)) >= 0 )
return r;
if ( (int)A->Var < Var )
r0 = Abc_ZddCof0( p, A->False, Var ),
r1 = Abc_ZddCof0( p, A->True, Var ),
r = Abc_ZddUniqueCreate( p, A->Var, r1, r0 );
else
r = Abc_ZddCof0( p, A->False, Var );
return Abc_ZddCacheInsert( p, a, Var, ABC_ZDD_OPER_COF0, r );
}
int Abc_ZddCof1( Abc_ZddMan * p, int a, int Var )
{
Abc_ZddObj * A;
int r0, r1, r;
if ( a < 2 ) return a;
A = Abc_ZddNode( p, a );
if ( (int)A->Var > Var )
return a;
if ( (r = Abc_ZddCacheLookup(p, a, Var, ABC_ZDD_OPER_COF1)) >= 0 )
return r;
if ( (int)A->Var < Var )
r0 = Abc_ZddCof1( p, A->False, Var ),
r1 = Abc_ZddCof1( p, A->True, Var );
else
r0 = 0,
r1 = Abc_ZddCof1( p, A->True, Var );
r = Abc_ZddUniqueCreate( p, A->Var, r1, r0 );
return Abc_ZddCacheInsert( p, a, Var, ABC_ZDD_OPER_COF1, r );
}
int Abc_ZddCountPaths( Abc_ZddMan * p, int a )
{
Abc_ZddObj * A;
int r;
if ( a < 2 ) return a;
if ( (r = Abc_ZddCacheLookup(p, a, 0, ABC_ZDD_OPER_PATHS)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
r = Abc_ZddCountPaths( p, A->False ) + Abc_ZddCountPaths( p, A->True );
return Abc_ZddCacheInsert( p, a, 0, ABC_ZDD_OPER_PATHS, r );
}
/*
int Abc_ZddCountNodes( Abc_ZddMan * p, int a )
{
Abc_ZddObj * A;
int r;
if ( a < 2 ) return 0;
if ( (r = Abc_ZddCacheLookup(p, a, 0, ABC_ZDD_OPER_NODES)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
r = 1 + Abc_ZddCountNodes( p, A->False ) + Abc_ZddCountNodes( p, A->True );
return Abc_ZddCacheInsert( p, a, 0, ABC_ZDD_OPER_NODES, r );
}
*/
int Abc_ZddCount_rec( Abc_ZddMan * p, int i )
{
Abc_ZddObj * A;
if ( i < 2 )
return 0;
A = Abc_ZddNode( p, i );
if ( A->Mark )
return 0;
A->Mark = 1;
return 1 + Abc_ZddCount_rec(p, A->False) + Abc_ZddCount_rec(p, A->True);
}
void Abc_ZddUnmark_rec( Abc_ZddMan * p, int i )
{
Abc_ZddObj * A;
if ( i < 2 )
return;
A = Abc_ZddNode( p, i );
if ( !A->Mark )
return;
A->Mark = 0;
Abc_ZddUnmark_rec( p, A->False );
Abc_ZddUnmark_rec( p, A->True );
}
int Abc_ZddCountNodes( Abc_ZddMan * p, int i )
{
int Count = Abc_ZddCount_rec( p, i );
Abc_ZddUnmark_rec( p, i );
return Count;
}
int Abc_ZddCountNodesArray( Abc_ZddMan * p, Vec_Int_t * vNodes )
{
int i, Id, Count = 0;
Vec_IntForEachEntry( vNodes, Id, i )
Count += Abc_ZddCount_rec( p, Id );
Vec_IntForEachEntry( vNodes, Id, i )
Abc_ZddUnmark_rec( p, Id );
return Count;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_ZddThresh( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A;
int r0, r1, r;
if ( a < 2 ) return a;
if ( b == 0 ) return 0;
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_THRESH)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
r0 = Abc_ZddThresh( p, A->False, b ),
r1 = Abc_ZddThresh( p, A->True, b-1 );
r = Abc_ZddUniqueCreate( p, A->Var, r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_THRESH, r );
}
int Abc_ZddDotProduct( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A, * B;
int r0, r1, b2, t1, t2, r;
if ( a == 0 ) return 0;
if ( b == 0 ) return 0;
if ( a == 1 ) return b;
if ( b == 1 ) return a;
if ( a > b ) return Abc_ZddDotProduct( p, b, a );
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_DOT_PROD)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
B = Abc_ZddNode( p, b );
if ( A->Var < B->Var )
r0 = Abc_ZddDotProduct( p, A->False, b ),
r1 = Abc_ZddDotProduct( p, A->True, b );
else if ( A->Var > B->Var )
r0 = Abc_ZddDotProduct( p, a, B->False ),
r1 = Abc_ZddDotProduct( p, a, B->True );
else
r0 = Abc_ZddDotProduct( p, A->False, B->False ),
b2 = Abc_ZddUnion( p, B->False, B->True ),
t1 = Abc_ZddDotProduct( p, A->True, b2 ),
t2 = Abc_ZddDotProduct( p, A->False, B->True ),
r1 = Abc_ZddUnion( p, t1, t2 );
r = Abc_ZddUniqueCreate( p, Abc_MinInt(A->Var, B->Var), r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_DOT_PROD, r );
}
int Abc_ZddDotMinProduct6( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * A, * B;
int r0, r1, b2, t1, t2, r;
if ( a == 0 ) return 0;
if ( b == 0 ) return 0;
if ( a == 1 ) return b;
if ( b == 1 ) return a;
if ( a > b ) return Abc_ZddDotMinProduct6( p, b, a );
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_DOT_PROD_6)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
B = Abc_ZddNode( p, b );
if ( A->Var < B->Var )
r0 = Abc_ZddDotMinProduct6( p, A->False, b ),
r1 = Abc_ZddDotMinProduct6( p, A->True, b );
else if ( A->Var > B->Var )
r0 = Abc_ZddDotMinProduct6( p, a, B->False ),
r1 = Abc_ZddDotMinProduct6( p, a, B->True );
else
r0 = Abc_ZddDotMinProduct6( p, A->False, B->False ),
b2 = Abc_ZddMinUnion( p, B->False, B->True ),
t1 = Abc_ZddDotMinProduct6( p, A->True, b2 ),
t2 = Abc_ZddDotMinProduct6( p, A->False, B->True ),
r1 = Abc_ZddMinUnion( p, t1, t2 );
r1 = Abc_ZddThresh( p, r1, 5 ),
r1 = Abc_ZddDiff( p, r1, r0 );
r = Abc_ZddUniqueCreate( p, Abc_MinInt(A->Var, B->Var), r1, r0 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_DOT_PROD_6, r );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_ZddPerm( Abc_ZddMan * p, int a, int Var )
{
Abc_ZddObj * A;
int r0, r1, r;
assert( Var < p->nVars );
if ( a == 0 ) return 0;
if ( a == 1 ) return Abc_ZddIthVar(Var);
if ( (r = Abc_ZddCacheLookup(p, a, Var, ABC_ZDD_OPER_PERM)) >= 0 )
return r;
A = Abc_ZddNode( p, a );
if ( p->pV2TI[A->Var] > p->pV2TI[Var] ) // Ai > Bi
r = Abc_ZddUniqueCreate( p, Var, a, 0 );
else if ( (int)A->Var == Var ) // Ai == Bi && Aj == Bj
r0 = Abc_ZddPerm( p, A->False, Var ),
r = Abc_ZddUnion( p, r0, A->True );
else
{
int VarPerm, VarTop;
int Ai = p->pV2TI[A->Var];
int Aj = p->pV2TJ[A->Var];
int Bi = p->pV2TI[Var];
int Bj = p->pV2TJ[Var];
assert( Ai < Aj && Bi < Bj && Ai <= Bi );
if ( Aj == Bi )
VarPerm = Var,
VarTop = Abc_ZddVarIJ(p, Ai, Bj);
else if ( Aj == Bj )
VarPerm = Var,
VarTop = Abc_ZddVarIJ(p, Ai, Bi);
else if ( Ai == Bi )
VarPerm = Abc_ZddVarIJ(p, Abc_MinInt(Aj, Bj), Abc_MaxInt(Aj, Bj)),
VarTop = A->Var;
else // no clash
VarPerm = Var,
VarTop = A->Var;
assert( p->pV2TI[VarPerm] > p->pV2TI[VarTop] );
r0 = Abc_ZddPerm( p, A->False, Var );
r1 = Abc_ZddPerm( p, A->True, VarPerm );
assert( Abc_ZddObjVar(p, r1) > VarTop );
if ( Abc_ZddObjVar(p, r0) > VarTop )
r = Abc_ZddUniqueCreate( p, VarTop, r1, r0 );
else
r1 = Abc_ZddUniqueCreate( p, VarTop, r1, 0 ),
r = Abc_ZddUnion( p, r0, r1 );
}
return Abc_ZddCacheInsert( p, a, Var, ABC_ZDD_OPER_PERM, r );
}
int Abc_ZddPermProduct( Abc_ZddMan * p, int a, int b )
{
Abc_ZddObj * B;
int r0, r1, r;
if ( a == 0 ) return 0;
if ( a == 1 ) return b;
if ( b == 0 ) return 0;
if ( b == 1 ) return a;
if ( (r = Abc_ZddCacheLookup(p, a, b, ABC_ZDD_OPER_PERM_PROD)) >= 0 )
return r;
B = Abc_ZddNode( p, b );
r0 = Abc_ZddPermProduct( p, a, B->False );
r1 = Abc_ZddPermProduct( p, a, B->True );
r1 = Abc_ZddPerm( p, r1, B->Var );
r = Abc_ZddUnion( p, r0, r1 );
return Abc_ZddCacheInsert( p, a, b, ABC_ZDD_OPER_PERM_PROD, r );
}
/**Function*************************************************************
Synopsis [Printing permutations and transpositions.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_ZddPermPrint( int * pPerm, int Size )
{
int i;
printf( "{" );
for ( i = 0; i < Size; i++ )
printf( " %2d", pPerm[i] );
printf( " }\n" );
}
void Abc_ZddCombPrint( int * pComb, int nTrans )
{
int i;
if ( nTrans == 0 )
printf( "Empty set" );
for ( i = 0; i < nTrans; i++ )
printf( "(%d %d)", pComb[i] >> 16, pComb[i] & 0xffff );
printf( "\n" );
}
int Abc_ZddPerm2Comb( int * pPerm, int Size, int * pComb )
{
int i, j, nTrans = 0;
for ( i = 0; i < Size; i++ )
if ( i != pPerm[i] )
{
for ( j = i+1; j < Size; j++ )
if ( i == pPerm[j] )
break;
pComb[nTrans++] = (i << 16) | j;
ABC_SWAP( int, pPerm[i], pPerm[j] );
assert( i == pPerm[i] );
}
return nTrans;
}
void Abc_ZddComb2Perm( int * pComb, int nTrans, int * pPerm, int Size )
{
int v;
for ( v = 0; v < Size; v++ )
pPerm[v] = v;
for ( v = nTrans-1; v >= 0; v-- )
ABC_SWAP( int, pPerm[pComb[v] >> 16], pPerm[pComb[v] & 0xffff] );
}
void Abc_ZddPermCombTest()
{
int Size = 10;
int pPerm[10] = { 6, 5, 7, 0, 3, 2, 1, 8, 9, 4 };
int pComb[10], nTrans;
Abc_ZddPermPrint( pPerm, Size );
nTrans = Abc_ZddPerm2Comb( pPerm, Size, pComb );
Abc_ZddCombPrint( pComb, nTrans );
Abc_ZddComb2Perm( pComb, nTrans, pPerm, Size );
Abc_ZddPermPrint( pPerm, Size );
Size = 0;
}
/**Function*************************************************************
Synopsis [Printing ZDDs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_ZddPrint_rec( Abc_ZddMan * p, int a, int * pPath, int Size )
{
Abc_ZddObj * A;
if ( a == 0 ) return;
// if ( a == 1 ) { Abc_ZddPermPrint( pPath, Size ); return; }
if ( a == 1 )
{
int pPerm[24], pComb[24], i;
assert( p->nPermSize <= 24 );
for ( i = 0; i < Size; i++ )
pComb[i] = (p->pV2TI[pPath[i]] << 16) | p->pV2TJ[pPath[i]];
Abc_ZddCombPrint( pComb, Size );
Abc_ZddComb2Perm( pComb, Size, pPerm, p->nPermSize );
Abc_ZddPermPrint( pPerm, p->nPermSize );
return;
}
A = Abc_ZddNode( p, a );
Abc_ZddPrint_rec( p, A->False, pPath, Size );
pPath[Size] = A->Var;
Abc_ZddPrint_rec( p, A->True, pPath, Size + 1 );
}
void Abc_ZddPrint( Abc_ZddMan * p, int a )
{
int * pPath = ABC_CALLOC( int, p->nVars );
Abc_ZddPrint_rec( p, a, pPath, 0 );
ABC_FREE( pPath );
}
void Abc_ZddPrintTest( Abc_ZddMan * p )
{
// int nSets = 2;
// int Size = 2;
// int pSets[2][2] = { {5, 0}, {3, 11} };
int nSets = 3;
int Size = 5;
int pSets[3][5] = { {5, 0, 2, 10, 7}, {3, 11, 10, 7, 2}, {0, 2, 5, 10, 7} };
int i, Set, Union = 0;
for ( i = 0; i < nSets; i++ )
{
Abc_ZddPermPrint( pSets[i], Size );
Set = Abc_ZddBuildSet( p, pSets[i], Size );
Union = Abc_ZddUnion( p, Union, Set );
}
printf( "Resulting set:\n" );
Abc_ZddPrint( p, Union );
printf( "\n" );
printf( "Nodes = %d. Path = %d.\n", Abc_ZddCountNodes(p, Union), Abc_ZddCountPaths(p, Union) );
Size = 0;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_ZddGiaTest( Gia_Man_t * pGia )
{
Abc_ZddMan * p;
Gia_Obj_t * pObj;
Vec_Int_t * vNodes;
int i, r, Paths = 0;
p = Abc_ZddManAlloc( Gia_ManObjNum(pGia), 1 << 24 ); // 576 MB (36 B/node)
Gia_ManFillValue( pGia );
Gia_ManForEachCi( pGia, pObj, i )
pObj->Value = Abc_ZddIthVar( Gia_ObjId(pGia, pObj) );
vNodes = Vec_IntAlloc( Gia_ManAndNum(pGia) );
Gia_ManForEachAnd( pGia, pObj, i )
{
r = Abc_ZddDotMinProduct6( p, Gia_ObjFanin0(pObj)->Value, Gia_ObjFanin1(pObj)->Value );
r = Abc_ZddUnion( p, r, Abc_ZddIthVar(i) );
pObj->Value = r;
Vec_IntPush( vNodes, r );
// print
// printf( "Node %d:\n", i );
// Abc_ZddPrint( p, r );
// printf( "Node %d ZddNodes = %d\n", i, Abc_ZddCountNodes(p, r) );
}
Gia_ManForEachAnd( pGia, pObj, i )
Paths += Abc_ZddCountPaths(p, pObj->Value);
printf( "Paths = %d. Shared nodes = %d.\n", Paths, Abc_ZddCountNodesArray(p, vNodes) );
Vec_IntFree( vNodes );
Abc_ZddManFree( p );
}
/*
abc 01> &r pj1.aig; &ps; &test
pj1 : i/o = 1769/ 1063 and = 16285 lev = 156 (12.91) mem = 0.23 MB
Paths = 839934. Shared nodes = 770999.
ZDD stats: Var = 19118 Obj = 11578174 All = 16777216 Hits = 25617277 Miss = 40231476 Mem = 576.00 MB
*/
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_ZddPermTestInt( Abc_ZddMan * p )
{
int nPerms = 3;
int Size = 5;
int pPerms[3][5] = { {1, 0, 2, 4, 3}, {1, 2, 4, 0, 3}, {0, 3, 2, 1, 4} };
int pComb[5], nTrans;
int i, k, Set, Union = 0, iPivot;
for ( i = 0; i < nPerms; i++ )
Abc_ZddPermPrint( pPerms[i], Size );
for ( i = 0; i < nPerms; i++ )
{
printf( "Perm %d:\n", i );
Abc_ZddPermPrint( pPerms[i], Size );
nTrans = Abc_ZddPerm2Comb( pPerms[i], Size, pComb );
Abc_ZddCombPrint( pComb, nTrans );
for ( k = 0; k < nTrans; k++ )
pComb[k] = Abc_ZddVarIJ( p, pComb[k] >> 16, pComb[k] & 0xFFFF );
Abc_ZddPermPrint( pComb, nTrans );
// add to ZDD
Set = Abc_ZddBuildSet( p, pComb, nTrans );
Union = Abc_ZddUnion( p, Union, Set );
}
printf( "\nResulting set of permutations:\n" );
Abc_ZddPrint( p, Union );
printf( "Nodes = %d. Path = %d.\n", Abc_ZddCountNodes(p, Union), Abc_ZddCountPaths(p, Union) );
iPivot = Abc_ZddVarIJ( p, 3, 4 );
Union = Abc_ZddPerm( p, Union, iPivot );
printf( "\nResulting set of permutations:\n" );
Abc_ZddPrint( p, Union );
printf( "Nodes = %d. Path = %d.\n", Abc_ZddCountNodes(p, Union), Abc_ZddCountPaths(p, Union) );
printf( "\n" );
}
void Abc_ZddPermTest()
{
Abc_ZddMan * p;
p = Abc_ZddManAlloc( 10, 1 << 20 );
Abc_ZddManCreatePerms( p, 5 );
Abc_ZddPermTestInt( p );
Abc_ZddManFree( p );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_EnumerateCubeStatesZdd()
{
int pXYZ[3][9][2] = {
{ {3, 5}, {3,17}, {3,15}, {1, 6}, {1,16}, {1,14}, {2, 4}, {2,18}, {2,13} },
{ {2,14}, {2,24}, {2,12}, {3,13}, {3,23}, {3,10}, {1,15}, {1,22}, {1,11} },
{ {1,10}, {1, 7}, {1, 4}, {3,12}, {3, 9}, {3, 6}, {2,11}, {2, 8}, {2, 5} } };
#ifdef WIN32
int LogObj = 24;
#else
int LogObj = 27;
#endif
Abc_ZddMan * p;
int i, k, pComb[9], pPerm[24], nSize;
int ZddTurn1, ZddTurn2, ZddTurn3, ZddTurns, ZddAll;
abctime clk = Abc_Clock();
printf( "Enumerating states of 2x2x2 cube.\n" );
p = Abc_ZddManAlloc( 24 * 23 / 2, 1 << LogObj ); // finished with 2^27 (4 GB)
Abc_ZddManCreatePerms( p, 24 );
// init state
printf( "Iter %2d -> %8d Nodes = %7d Used = %10d ", 0, 1, 0, 2 );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
// first 9 states
ZddTurns = 1;
for ( i = 0; i < 3; i++ )
{
for ( k = 0; k < 24; k++ )
pPerm[k] = k;
for ( k = 0; k < 9; k++ )
ABC_SWAP( int, pPerm[pXYZ[i][k][0]-1], pPerm[pXYZ[i][k][1]-1] );
nSize = Abc_ZddPerm2Comb( pPerm, 24, pComb );
assert( nSize == 9 );
for ( k = 0; k < 9; k++ )
pComb[k] = Abc_ZddVarIJ( p, pComb[k] >> 16, pComb[k] & 0xffff );
// add first turn
ZddTurn1 = Abc_ZddBuildSet( p, pComb, 9 );
ZddTurns = Abc_ZddUnion( p, ZddTurns, ZddTurn1 );
//Abc_ZddPrint( p, ZddTurn1 );
// add second turn
ZddTurn2 = Abc_ZddPermProduct( p, ZddTurn1, ZddTurn1 );
ZddTurns = Abc_ZddUnion( p, ZddTurns, ZddTurn2 );
//Abc_ZddPrint( p, ZddTurn2 );
// add third turn
ZddTurn3 = Abc_ZddPermProduct( p, ZddTurn2, ZddTurn1 );
ZddTurns = Abc_ZddUnion( p, ZddTurns, ZddTurn3 );
//Abc_ZddPrint( p, ZddTurn3 );
//printf( "\n" );
}
//Abc_ZddPrint( p, ZddTurns );
printf( "Iter %2d -> %8d Nodes = %7d Used = %10d ", 1, Abc_ZddCountPaths(p, ZddTurns), Abc_ZddCountNodes(p, ZddTurns), p->nObjs );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
// other states
ZddAll = ZddTurns;
for ( i = 2; i <= 100; i++ )
{
int ZddAllPrev = ZddAll;
ZddAll = Abc_ZddPermProduct( p, ZddAll, ZddTurns );
printf( "Iter %2d -> %8d Nodes = %7d Used = %10d ", i, Abc_ZddCountPaths(p, ZddAll), Abc_ZddCountNodes(p, ZddAll), p->nObjs );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
if ( ZddAllPrev == ZddAll )
break;
}
Abc_ZddManFree( p );
}
/*
Enumerating states of 2x2x2 cube.
Iter 0 -> 1 Nodes = 0 Used = 2 Time = 0.00 sec
Iter 1 -> 10 Nodes = 63 Used = 577 Time = 0.00 sec
Iter 2 -> 64 Nodes = 443 Used = 4349 Time = 0.03 sec
Iter 3 -> 385 Nodes = 2018 Used = 26654 Time = 0.14 sec
Iter 4 -> 2232 Nodes = 7451 Used = 119442 Time = 0.45 sec
Iter 5 -> 12224 Nodes = 25178 Used = 490038 Time = 1.10 sec
Iter 6 -> 62360 Nodes = 83955 Used = 1919750 Time = 1.79 sec
Iter 7 -> 289896 Nodes = 290863 Used = 7182932 Time = 3.15 sec
Iter 8 -> 1159968 Nodes = 614845 Used = 25301123 Time = 8.03 sec
Iter 9 -> 3047716 Nodes = 585664 Used = 66228369 Time = 20.22 sec
Iter 10 -> 3671516 Nodes = 19430 Used = 102292452 Time = 33.41 sec
Iter 11 -> 3674160 Nodes = 511 Used = 103545878 Time = 33.92 sec
Iter 12 -> 3674160 Nodes = 511 Used = 103566266 Time = 33.93 sec
ZDD stats: Var = 276 Obj = 103566266 Alloc = 134217728 Hit = 63996630 Miss = 141768893 Mem = 4608.00 MB
*/
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
|
108c9aa20fe602a37e3cd7d0a1589da715489a6f
|
cff4428975e403e4ef02d75498b78cd1a610a01a
|
/src/lib/core/diag.c
|
2eda31ae913798418921e0c8030c9e210c09c7a9
|
[
"BSD-2-Clause"
] |
permissive
|
tarantool/tarantool
|
c1f252b642d223af62485dc21165c7f7c3354e7e
|
f58cc96f2798ddc5f492223897d0b77e4f902128
|
refs/heads/master
| 2023-09-03T15:16:29.144171
| 2023-08-31T11:39:28
| 2023-09-01T12:39:29
| 911,980
| 3,205
| 490
|
NOASSERTION
| 2023-09-14T17:58:17
| 2010-09-15T07:59:26
|
Lua
|
UTF-8
|
C
| false
| false
| 4,353
|
c
|
diag.c
|
/*
* Copyright 2010-2016, Tarantool AUTHORS, please see AUTHORS file.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "diag.h"
#include "fiber.h"
void
error_ref(struct error *e)
{
assert(e->refs >= 0);
if (e->refs >= INT64_MAX)
panic("too many references to error object");
e->refs++;
}
void
error_unref(struct error *e)
{
assert(e->refs > 0);
struct error *to_delete = e;
while (--to_delete->refs == 0) {
/* Unlink error from lists completely.*/
struct error *cause = to_delete->cause;
assert(to_delete->effect == NULL);
if (to_delete->cause != NULL) {
to_delete->cause->effect = NULL;
to_delete->cause = NULL;
}
error_payload_destroy(&to_delete->payload);
to_delete->destroy(to_delete);
if (cause == NULL)
return;
to_delete = cause;
}
}
const struct error_field *
error_find_field(const struct error *e, const char *name)
{
return error_payload_find(&e->payload, name);
}
int
error_set_prev(struct error *e, struct error *prev)
{
/*
* Make sure that adding error won't result in cycles.
* Don't bother with sophisticated cycle-detection
* algorithms, simple iteration is OK since as a rule
* list contains a dozen errors at maximum.
*/
if (prev != NULL) {
if (e == prev)
return -1;
if (prev->effect != NULL || e->effect != NULL) {
/*
* e and prev are already compared, so start
* from prev->cause.
*/
struct error *tmp = prev->cause;
while (tmp != NULL) {
if (tmp == e)
return -1;
tmp = tmp->cause;
}
/*
* Unlink new 'effect' node from its old
* list of 'cause' errors.
*/
error_unlink_effect(prev);
}
error_ref(prev);
prev->effect = e;
}
/*
* At once error can feature only one reason.
* So unlink previous 'cause' node.
*/
if (e->cause != NULL) {
e->cause->effect = NULL;
error_unref(e->cause);
}
/* Set new 'prev' node. */
e->cause = prev;
return 0;
}
void
error_create(struct error *e,
error_f destroy, error_f raise, error_f log,
const struct type_info *type, const char *file, unsigned line)
{
e->destroy = destroy;
e->raise = raise;
e->log = log;
e->type = type;
e->refs = 0;
e->saved_errno = 0;
e->code = 0;
error_payload_create(&e->payload);
if (file == NULL)
file = "";
error_set_location(e, file, line);
e->errmsg[0] = '\0';
e->cause = NULL;
e->effect = NULL;
}
void
error_set_location(struct error *e, const char *file, int line)
{
snprintf(e->file, sizeof(e->file), "%s", file);
e->line = line;
}
struct diag *
diag_get(void)
{
return &fiber()->diag;
}
void
error_format_msg(struct error *e, const char *format, ...)
{
va_list ap;
va_start(ap, format);
error_vformat_msg(e, format, ap);
va_end(ap);
}
void
error_append_msg(struct error *e, const char *format, ...)
{
va_list ap;
va_start(ap, format);
int prefix_len = strlen(e->errmsg);
char *msg = e->errmsg + prefix_len;
vsnprintf(msg, sizeof(e->errmsg) - prefix_len, format, ap);
va_end(ap);
}
void
error_vformat_msg(struct error *e, const char *format, va_list ap)
{
vsnprintf(e->errmsg, sizeof(e->errmsg), format, ap);
}
|
19bbfac4d249190bd6fb6d4f7335ea8cb1f4ee51
|
1375d29606289d8f78498723d91f8af4f27820de
|
/tests/test_memcpy.c
|
31d159cfcd0e29a9270e7ba8c1c981e9380147b0
|
[
"Apache-2.0",
"LicenseRef-scancode-commercial-license",
"AGPL-3.0-or-later"
] |
permissive
|
trailofbits/polytracker
|
8b5b7638d58d8846a44326bab127b53a900a9fd8
|
7f8e4972d8a8716634e2c3bbdbd912336b8d88e5
|
refs/heads/master
| 2023-09-01T00:01:15.884403
| 2023-08-18T16:19:21
| 2023-08-18T16:19:21
| 218,835,361
| 435
| 41
|
Apache-2.0
| 2023-08-18T16:19:23
| 2019-10-31T18:37:16
|
C++
|
UTF-8
|
C
| false
| false
| 946
|
c
|
test_memcpy.c
|
#include <fcntl.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
void touch_copied_byte(char * other_buff) {
if (other_buff == NULL) {
printf("Other buff is null!");
return;
}
//In the testcase, don't process this. We should see the label as canonical
//Processing will produce a false positive potentially, so look at taint_sets
if (other_buff[0] == 'a') {
printf("Other buff is a!");
return;
}
return;
}
int main(int argc, char * argv[]) {
if (argc < 2) {
printf("Error, no file specified!");
}
int fd = open(argv[1], O_RDONLY);
if (fd == -1) {
printf("Could not open file!\n");
}
else {
char buff[2048];
memset(buff, 0, sizeof(buff));
char other_buff[2048];
memset(other_buff, 0, sizeof(other_buff));
int bytes_read = read(fd, buff, 10);
memcpy(other_buff, buff, sizeof(other_buff));
touch_copied_byte(other_buff);
close(fd);
}
return 0;
}
|
2c4d4846d5d7792a7365c4b9b9ba9579edd63b0b
|
b4c2b8dc89417e966a67a433267ebb9c156dbff4
|
/src/vehicles/sounds/CaboverCATknockSlow.h
|
05320e8a4cfbac935383cc5313024d2fabfbac0a
|
[] |
no_license
|
TheDIYGuy999/Rc_Engine_Sound_ESP32
|
92134030dbc047627310d54ccf1fd34fb3cad791
|
eeeb47964861b66f8e1db34bffe35657846d8b20
|
refs/heads/master
| 2023-08-31T00:17:03.698027
| 2023-05-04T19:46:51
| 2023-05-04T19:46:51
| 225,658,413
| 230
| 105
| null | 2023-08-26T14:38:39
| 2019-12-03T15:51:13
|
C
|
UTF-8
|
C
| false
| false
| 5,872
|
h
|
CaboverCATknockSlow.h
|
const unsigned int knockSampleRate = 22050;
const unsigned int knockSampleCount = 1282;
const signed char knockSamples[] = {
0, -1, -1, -2, -6, -9, -7, -4, -2, -3, -8, -15, -25, -30, -33, -34,
-35, -39, -42, -44, -44, -44, -42, -39, -38, -38, -34, -30, -24, -17, -17, -18,
-22, -25, -26, -24, -23, -23, -21, -21, -18, -16, -16, -17, -21, -26, -31, -30,
-26, -22, -17, -14, -14, -14, -14, -14, -14, -16, -18, -20, -21, -22, -24, -28,
-31, -32, -32, -32, -30, -29, -28, -26, -27, -29, -34, -39, -42, -44, -47, -49,
-52, -53, -53, -52, -51, -52, -53, -54, -55, -55, -54, -53, -53, -55, -56, -57,
-57, -54, -51, -50, -50, -50, -47, -45, -42, -38, -36, -36, -37, -37, -34, -32,
-31, -32, -36, -36, -36, -33, -30, -29, -31, -33, -33, -33, -33, -32, -33, -35,
-36, -37, -38, -38, -41, -44, -47, -53, -57, -58, -57, -55, -53, -54, -59, -63,
-67, -69, -70, -71, -72, -73, -74, -76, -79, -85, -89, -91, -92, -92, -91, -90,
-92, -97, -104, -110, -116, -117, -115, -113, -111, -108, -107, -106, -105, -104, -103, -105,
-108, -111, -113, -115, -114, -114, -115, -115, -114, -112, -110, -106, -105, -104, -104, -103,
-100, -97, -95, -94, -94, -96, -99, -100, -102, -104, -106, -105, -103, -102, -103, -106,
-108, -110, -114, -115, -114, -112, -110, -105, -102, -99, -96, -92, -87, -79, -73, -68,
-65, -63, -62, -63, -64, -66, -69, -71, -72, -73, -71, -68, -65, -61, -55, -53,
-51, -51, -53, -57, -62, -66, -67, -67, -67, -64, -64, -67, -71, -76, -80, -84,
-88, -91, -94, -97, -99, -101, -101, -101, -101, -99, -97, -94, -92, -90, -89, -89,
-88, -87, -88, -90, -92, -93, -94, -92, -90, -89, -88, -88, -88, -88, -86, -84,
-81, -78, -76, -74, -73, -72, -71, -71, -70, -71, -73, -76, -81, -83, -82, -79,
-78, -77, -78, -80, -79, -76, -72, -64, -62, -60, -61, -62, -61, -59, -58, -57,
-58, -60, -61, -60, -59, -56, -54, -52, -49, -46, -41, -36, -31, -29, -25, -22,
-18, -13, -6, -1, 3, 4, 5, 6, 9, 13, 15, 14, 11, 8, 6, 7,
9, 10, 10, 10, 10, 11, 13, 15, 16, 17, 20, 20, 19, 18, 17, 17,
17, 17, 16, 15, 15, 15, 14, 13, 12, 10, 7, 4, 3, 4, 5, 6,
7, 7, 7, 7, 7, 7, 5, 0, -2, -3, -5, -5, -9, -14, -17, -20,
-22, -22, -23, -24, -26, -28, -29, -29, -27, -26, -26, -26, -26, -25, -24, -23,
-24, -25, -26, -28, -27, -26, -23, -22, -23, -29, -33, -36, -37, -36, -33, -33,
-34, -34, -34, -34, -34, -35, -37, -39, -42, -45, -46, -46, -44, -42, -40, -35,
-32, -26, -21, -16, -13, -10, -8, -6, -3, -1, 2, 3, 3, 2, -2, -6,
-9, -7, -4, 1, 5, 7, 8, 7, 7, 7, 5, 1, -3, -6, -10, -13,
-14, -15, -16, -17, -17, -17, -14, -11, -9, -6, -5, -4, -4, -4, -4, -3,
-3, -3, -1, 1, 3, 5, 8, 11, 16, 19, 21, 21, 19, 13, 10, 6,
2, -1, -3, -5, -6, -8, -11, -15, -18, -21, -22, -23, -23, -24, -24, -25,
-26, -26, -26, -26, -25, -24, -21, -18, -12, -6, 3, 9, 11, 12, 12, 11,
12, 13, 15, 18, 20, 25, 29, 34, 39, 43, 45, 48, 49, 49, 47, 44,
40, 37, 36, 34, 33, 32, 31, 30, 29, 25, 21, 17, 13, 14, 16, 19,
22, 26, 27, 29, 31, 33, 37, 41, 43, 44, 44, 42, 39, 37, 35, 33,
30, 28, 26, 26, 26, 26, 25, 20, 15, 15, 17, 19, 19, 16, 12, 10,
11, 12, 14, 12, 9, 5, 3, 3, 3, 2, 1, 1, 1, 2, 6, 10,
15, 20, 24, 29, 34, 38, 41, 45, 46, 45, 43, 43, 45, 47, 50, 50,
49, 48, 44, 39, 33, 24, 21, 19, 19, 19, 19, 17, 15, 14, 14, 14,
12, 10, 6, 1, -3, -7, -10, -11, -11, -11, -8, -5, 1, 4, 6, 10,
13, 17, 20, 21, 23, 24, 26, 27, 26, 24, 20, 16, 12, 10, 12, 14,
16, 16, 13, 10, 7, 5, 5, 6, 10, 13, 15, 16, 17, 18, 20, 21,
21, 22, 25, 31, 36, 38, 38, 37, 34, 28, 25, 21, 17, 15, 14, 12,
11, 10, 10, 10, 14, 18, 22, 26, 28, 28, 25, 23, 20, 16, 12, 4,
-2, -10, -17, -25, -33, -41, -45, -47, -47, -46, -45, -44, -46, -48, -49, -47,
-39, -34, -30, -27, -25, -24, -23, -21, -19, -16, -12, -9, -4, -1, 3, 8,
13, 21, 27, 32, 36, 39, 39, 38, 36, 35, 35, 36, 40, 43, 44, 42,
38, 35, 32, 33, 35, 36, 36, 35, 36, 37, 40, 41, 40, 38, 34, 33,
34, 35, 35, 34, 34, 34, 36, 37, 38, 41, 44, 46, 48, 51, 55, 59,
62, 63, 64, 65, 64, 64, 60, 55, 50, 45, 39, 36, 31, 27, 22, 20,
20, 19, 18, 15, 11, 5, 2, 0, -1, -2, -2, 1, 2, 2, 1, 1,
1, 1, 1, 0, -1, -3, -6, -6, -5, -4, -1, 3, 12, 19, 27, 36,
43, 49, 57, 62, 68, 72, 74, 74, 72, 70, 69, 68, 69, 66, 61, 56,
52, 51, 54, 58, 59, 59, 59, 60, 62, 66, 70, 73, 76, 77, 78, 78,
77, 75, 71, 61, 54, 48, 44, 42, 39, 30, 22, 14, 7, 3, -1, -8,
-13, -15, -15, -15, -12, -11, -11, -13, -14, -15, -15, -13, -12, -13, -14, -17,
-21, -22, -21, -18, -13, -8, -6, -5, -5, -2, 2, 8, 11, 13, 15, 16,
17, 18, 17, 16, 14, 14, 16, 18, 19, 20, 20, 18, 18, 19, 21, 23,
26, 26, 25, 23, 22, 22, 24, 30, 35, 39, 43, 49, 56, 64, 69, 73,
75, 77, 80, 84, 86, 89, 90, 91, 91, 90, 91, 95, 102, 109, 119, 123,
124, 123, 122, 121, 116, 111, 104, 98, 94, 90, 89, 90, 91, 92, 93, 95,
94, 92, 90, 89, 89, 90, 92, 93, 94, 93, 88, 86, 87, 92, 100, 107,
114, 117, 120, 124, 127, 127, 123, 118, 113, 112, 112, 111, 105, 99, 92, 88,
87, 89, 91, 92, 93, 93, 93, 93, 93, 92, 90, 87, 83, 81, 82, 81,
82, 81, 80, 81, 84, 88, 92, 95, 94, 91, 90, 90, 90, 92, 91, 89,
88, 88, 89, 90, 88, 84, 78, 71, 59, 52, 47, 43, 40, 35, 22, 15,
10, 9, 10, 10, 7, 1, -6, -10, -10, -7, -5, -4, -5, -5, -4, -2,
2, 6, 9, 12, 14, 18, 19, 19, 17, 15, 13, 16, 21, 28, 34, 37,
37, 38, 41, 47, 52, 55, 53, 47, 43, 41, 43, 47, 48, 49, 49, 50,
53, 57, 61, 63, 62, 59, 53, 43, 37, 33, 30, 26, 20, 16, 14, 14,
15, 16, 14, 11, 9, 6, 5, 6, 10, 12, 14, 15, 15, 13, 10, 8,
4, 1, 1, 4, 8, 11, 13, 10, 4, 0, -1, -1, 0, 0, -3, -6,
-8, -12, -16, -20, -26, -29, -30, -30, -28, -21, -18, -17, -18, -21, -24, -26,
-25, -24, -22, -22, -22, -21, -21, -20, -18, -17, -14, -11, -7, -2, 5, 12,
15, 15, 16, 17, 20, 22, 22, 20, 17, 15, 14, 18, 21, 23, 23, 20,
17, 16, 18, 19, 19, 17, 14, 10, 9, 9, 6, 3, -1, -2, 0, 5,
12, 18, 23, 23, 21, 17, 14, 13, 14, 16, 18, 18, 18, 16, 14, 13,
10, 7, 5, 6, 8, 10, 13, 14, 14, 14, 14, 14, 14, 13, 10, 7,
3, 0, };
|
33c65abe055dba482b3fdd213c164aa11efbf0e2
|
20e1c2f5cfac01f6b007124fa7792dd69751a6bb
|
/src/ut-stubs/osapi-countsem-stubs.c
|
86718dc9e83faf6152c5e0904a5906664cb446b0
|
[
"Apache-2.0"
] |
permissive
|
nasa/osal
|
71f159b767ba4a8c39df48f238b4f296cc571ac8
|
99e3b4007da51031b521d90390526e123ff740b4
|
refs/heads/main
| 2023-09-01T06:33:53.932829
| 2023-08-18T14:27:02
| 2023-08-18T14:27:02
| 4,814,601
| 493
| 229
|
Apache-2.0
| 2023-09-13T13:57:40
| 2012-06-27T23:10:37
|
C
|
UTF-8
|
C
| false
| false
| 5,433
|
c
|
osapi-countsem-stubs.c
|
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
************************************************************************/
/**
* @file
*
* Auto-Generated stub implementations for functions defined in osapi-countsem header
*/
#include "osapi-countsem.h"
#include "utgenstub.h"
void UT_DefaultHandler_OS_CountSemCreate(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_OS_CountSemDelete(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_OS_CountSemGetIdByName(void *, UT_EntryKey_t, const UT_StubContext_t *);
void UT_DefaultHandler_OS_CountSemGetInfo(void *, UT_EntryKey_t, const UT_StubContext_t *);
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemCreate()
* ----------------------------------------------------
*/
int32 OS_CountSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_initial_value, uint32 options)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemCreate, int32);
UT_GenStub_AddParam(OS_CountSemCreate, osal_id_t *, sem_id);
UT_GenStub_AddParam(OS_CountSemCreate, const char *, sem_name);
UT_GenStub_AddParam(OS_CountSemCreate, uint32, sem_initial_value);
UT_GenStub_AddParam(OS_CountSemCreate, uint32, options);
UT_GenStub_Execute(OS_CountSemCreate, Basic, UT_DefaultHandler_OS_CountSemCreate);
return UT_GenStub_GetReturnValue(OS_CountSemCreate, int32);
}
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemDelete()
* ----------------------------------------------------
*/
int32 OS_CountSemDelete(osal_id_t sem_id)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemDelete, int32);
UT_GenStub_AddParam(OS_CountSemDelete, osal_id_t, sem_id);
UT_GenStub_Execute(OS_CountSemDelete, Basic, UT_DefaultHandler_OS_CountSemDelete);
return UT_GenStub_GetReturnValue(OS_CountSemDelete, int32);
}
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemGetIdByName()
* ----------------------------------------------------
*/
int32 OS_CountSemGetIdByName(osal_id_t *sem_id, const char *sem_name)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemGetIdByName, int32);
UT_GenStub_AddParam(OS_CountSemGetIdByName, osal_id_t *, sem_id);
UT_GenStub_AddParam(OS_CountSemGetIdByName, const char *, sem_name);
UT_GenStub_Execute(OS_CountSemGetIdByName, Basic, UT_DefaultHandler_OS_CountSemGetIdByName);
return UT_GenStub_GetReturnValue(OS_CountSemGetIdByName, int32);
}
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemGetInfo()
* ----------------------------------------------------
*/
int32 OS_CountSemGetInfo(osal_id_t sem_id, OS_count_sem_prop_t *count_prop)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemGetInfo, int32);
UT_GenStub_AddParam(OS_CountSemGetInfo, osal_id_t, sem_id);
UT_GenStub_AddParam(OS_CountSemGetInfo, OS_count_sem_prop_t *, count_prop);
UT_GenStub_Execute(OS_CountSemGetInfo, Basic, UT_DefaultHandler_OS_CountSemGetInfo);
return UT_GenStub_GetReturnValue(OS_CountSemGetInfo, int32);
}
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemGive()
* ----------------------------------------------------
*/
int32 OS_CountSemGive(osal_id_t sem_id)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemGive, int32);
UT_GenStub_AddParam(OS_CountSemGive, osal_id_t, sem_id);
UT_GenStub_Execute(OS_CountSemGive, Basic, NULL);
return UT_GenStub_GetReturnValue(OS_CountSemGive, int32);
}
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemTake()
* ----------------------------------------------------
*/
int32 OS_CountSemTake(osal_id_t sem_id)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemTake, int32);
UT_GenStub_AddParam(OS_CountSemTake, osal_id_t, sem_id);
UT_GenStub_Execute(OS_CountSemTake, Basic, NULL);
return UT_GenStub_GetReturnValue(OS_CountSemTake, int32);
}
/*
* ----------------------------------------------------
* Generated stub function for OS_CountSemTimedWait()
* ----------------------------------------------------
*/
int32 OS_CountSemTimedWait(osal_id_t sem_id, uint32 msecs)
{
UT_GenStub_SetupReturnBuffer(OS_CountSemTimedWait, int32);
UT_GenStub_AddParam(OS_CountSemTimedWait, osal_id_t, sem_id);
UT_GenStub_AddParam(OS_CountSemTimedWait, uint32, msecs);
UT_GenStub_Execute(OS_CountSemTimedWait, Basic, NULL);
return UT_GenStub_GetReturnValue(OS_CountSemTimedWait, int32);
}
|
145ef78dcd81fcae2ed5bbf670a1a04e44d580e2
|
f8c0a188d1cf8ae5221c4cd11552c221a86e259a
|
/Firmware/bleStack/sdp.c
|
eb4f6f24369fdcfc0710522659ba89cb76956c83
|
[
"BSD-2-Clause",
"CC-BY-3.0"
] |
permissive
|
digitalinteraction/openmovement
|
6310abf35b379655073485e84719cc2521733c0e
|
9c2ee2eeb5eae457673e60699b2842c6df82abb1
|
refs/heads/master
| 2023-08-03T23:48:42.973605
| 2023-07-26T17:52:37
| 2023-07-26T17:52:37
| 27,082,024
| 135
| 86
| null | 2018-06-21T23:32:43
| 2014-11-24T15:38:43
|
C
|
UTF-8
|
C
| false
| false
| 26,094
|
c
|
sdp.c
|
// Based on Smalltooth SDP code (see below).
// Changes Copyright Newcastle university (see below).
/*
* Copyright (c) 2013-2014, Newcastle University, UK.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright 2012 Guillem Vinals Gangolells <guillem@guillem.co.uk>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Bluetooth RFCOMM layer
// Guillem Vinals Gangolells <guillem@guillem.co.uk>
// Changes: Karim Ladha, 2013-2014
// Changes:
// * modified for no dynamic allocation and minimal memory
// * long uuid search support added for BT uuid types
#include <stdlib.h>
#include "l2cap + le.h"
#include "sdp.h"
#include "bt config.h"
#include "debug.h"
// DEBUG
#if DEBUG_SDP
static const char* file = "sdp.c";
#define ASSERT(X) DBG_assert(X, file, __LINE__)
#define DBG_INFO(X, ...) DBG_info(file,X, ##__VA_ARGS__);
#define DBG_DUMP(X, Y) DBG_dump(X, Y);
#define DBG_ERROR(X, ...) DBG_error(file,X, ##__VA_ARGS__);
#else
#define DBG_INFO(X, ...)
#define DBG_DUMP(X, Y)
#if DBG_ALL_ERRORS // Leave only errors and assertions on
static const char* file = "sdp.c";
#define DBG_ERROR(X, ...) DBG_error(file,X, ##__VA_ARGS__);
#define ASSERT(X) DBG_assert(X, file, __LINE__)
#else
#define DBG_ERROR(X, ...)
#define ASSERT(X)
#endif
#endif
// Is it a bt sig uuid, expects big endian ptr
unsigned char IsBtSigUuid(const unsigned char* uuid)
{
unsigned char i = 0;
const unsigned char bt_sig_uuid[] = {0,0,0,0, 0,0, 0x10,0x00, 0x80,0x00, 0x00,0x80,0x5f,0x9b,0x34,0xfb};
for(i=4;i<16;i++)
{
if(uuid[i] != bt_sig_uuid[i]) return FALSE_;
}
return TRUE_;
}
#ifdef SDP_SERVICE_RFCOMM_ENABLE
const unsigned char aRFCOMMAttr0_Val[] = {
/*UUID 32 bit*/
(SDP_DATA_T_UINT|SDP_DATA_S_32),
0x00, 0x01, 0x00, 0x01
};
const unsigned char aRFCOMMAttr1_Val[] = {
/*3 byte element data sequence*/
SDP_DATA_T_DES|SDP_DATA_S_1B, 0x11,
/*UUID 16 bits*/
SDP_DATA_T_UUID|SDP_DATA_S_128,
0x00, 0x00, 0x11, 0x01,
0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80,
0x5F, 0x9B, 0x34, 0xFB
};
const unsigned char aRFCOMMAttr2_Val[] = {
/*12 byte element data sequence*/
SDP_DATA_T_DES|SDP_DATA_S_1B, 0x0C,
/*
* L2CAP protocol descriptor:
* UUID = 0x0100
*/
SDP_DATA_T_DES|SDP_DATA_S_1B, 0x03,
SDP_DATA_T_UUID|SDP_DATA_S_16,
0x01, 0x00,
/*
* RFCOMM protocol descriptor:
* UUID = 0x0003
* CHANNEL = RFCOMM_CH_NUM
*/
SDP_DATA_T_DES|SDP_DATA_S_1B, 0x05,
SDP_DATA_T_UUID|SDP_DATA_S_16,
0x00, 0x03,
SDP_DATA_T_UINT|SDP_DATA_S_8,
RFCOMM_CH_DATA
};
const unsigned char aRFCOMMAttr3_Val[] = {
/*3 byte element data sequence*/
SDP_DATA_T_DES|SDP_DATA_S_1B, 0x03,
/*UUID 16 bits (Public Browse Group)*/
SDP_DATA_T_UUID|SDP_DATA_S_16,
0x10, 0x02
};
const unsigned char aRFCOMMAttr4_Val[] = {
/* 9 byte element data sequence */
SDP_DATA_T_DES|SDP_DATA_S_1B, 0x09,
/*
* Natural language ID.
*/
SDP_DATA_T_UINT|SDP_DATA_S_16,
'e', 'n',
/*
* Language encoding:
* unsigned short = 0x6A (UTF-8)
*/
SDP_DATA_T_UINT|SDP_DATA_S_16,
0x00, 0x6A,
/*
* Base attribute ID for the language in the Service Record:
* unsigned short = 0x0100
*/
SDP_DATA_T_UINT|SDP_DATA_S_16,
0x01, 0x00
};
const unsigned char aRFCOMMAttr5_Val[] = {
/* 11 byte data element sequence */
SDP_DATA_T_STR|SDP_DATA_S_1B, 0x05,
/* Service record name string */
'C', 'O', 'M', '1', 0x00
};
const SDP_SERVICE_ATTRIBUTE aRFCOMMAttrs[] = {
/*
* RFCOMM Attribute 0: Handler
* ID 0x0000
* Value:
* Service handler (UUID32bit)
*/
{ .uID = 0x0000, .uValueLen = 5, .pValue = (unsigned char *)aRFCOMMAttr0_Val },
/*
* RFCOMM Attribute 1: Service Class ID List
* ID 0x0001
* Value:
* Data element sequence of service classes (UUID16bit) that
* the service record conforms to.
*/
{ .uID = 0x0001, .uValueLen = 19, .pValue = (unsigned char *)aRFCOMMAttr1_Val },
/*
* RFCOMM Attribute 2: Protocol Descriptor List
* ID 0x0004
* Value:
* Data element sequence of protocol stacks that can be used to
* access the service described by the record.
*/
{ .uID = 0x0004, .uValueLen = 14, .pValue = (unsigned char *)aRFCOMMAttr2_Val },
/*
* RFCOMM Attribute 3: Service Class ID List
* ID 0x0005
* Value:
* Data element sequence of browse groups (UUID16bit) the
* service record belongs to.
*/
{ .uID = 0x0005, .uValueLen = 5, .pValue = (unsigned char *)aRFCOMMAttr3_Val },
/*
* RFCOMM Attribute 4: Language Base ID Attribute List
* ID 0x0005
* Value:
* A list of language bases. It contains a language identifier,
* a character encoding indentifier and a base attribute ID for
* the languages used in the service record.
*/
{ .uID = 0x0006, .uValueLen = 11, .pValue = (unsigned char *)aRFCOMMAttr4_Val },
/*
* RFCOMM Attribute 5: Service Name
* ID 0x0000 + BaseAttributeID offset
* Value:
* String containing the name of the service specified in the
* service record.
*/
{ .uID = 0x0100, .uValueLen = 7, .pValue = (unsigned char *)aRFCOMMAttr5_Val }
};
#endif /*SDP_SERVICE_RFCOMM_ENABLE*/
#ifdef SDP_SERVICE_RFCOMM_ENABLE
const SDP_SERVICE sServiceRFCOMM = {
.pcName = "RFCOMM",
.uNumAttrs = 6,
.pAttrs = (SDP_SERVICE_ATTRIBUTE *)aRFCOMMAttrs
};
#endif /*SDP_SERVICE_RFCOMM_ENABLE*/
static SDP_CONTROL_BLOCK gSDPCB;
static SDP_CONTROL_BLOCK *gpsSDPCB = NULL;
/*
* SDP public functions implementation
*/
unsigned char SDP_create()
{
unsigned short i;
gpsSDPCB = &gSDPCB;
/* Initialise the control block structure */
gpsSDPCB->bInitialised = TRUE_;
for (i = 0; i < SDP_SERVICE_COUNT; ++i)
{
gpsSDPCB->pService[i] = NULL;
}
#ifdef SDP_SERVICE_RFCOMM_ENABLE
gpsSDPCB->pService[0] = (SDP_SERVICE *)&sServiceRFCOMM;
#else
#error
#endif /*SDP_SERVICE_RFCOMM_ENABLE*/
L2capInstallSdp(SDP_API_putPetition);
return TRUE_;
}
/*
* SDP API functions implementation
*/
unsigned char SDP_API_putPetition(const unsigned char * pData, unsigned short uLen)
{
unsigned char bPDUID;
unsigned short uTID, uParameterLen;
unsigned char bRetVal = FALSE_;
/* SDP CB memory not allocated */
ASSERT(NULL != gpsSDPCB);
/* SDP not initialised */
if (!gpsSDPCB->bInitialised)
{
DBG_ERROR("no init\n");
return FALSE_;
}
/* Check the PDU data length */
if (NULL == pData || uLen < SDP_HDR_LEN)
{
DBG_ERROR( "pdu err\n");
return FALSE_;
}
/* Read the PDU header */
bPDUID = pData[0];
uTID = BT_READBE16(&pData[1]);
uParameterLen = BT_READBE16(&pData[3]);
/* Handle the petition */
bRetVal = _SDP_handlePetition(bPDUID, uTID, &pData[SDP_HDR_LEN],
uParameterLen);
return bRetVal;
}
/*
* SDP private functions implementation
*/
unsigned char _SDP_handlePetition(unsigned char bPDUID, unsigned short uTID, const unsigned char *pData,
unsigned short uLen)
{
unsigned char bRetVal = FALSE_;
switch(bPDUID)
{
case SDP_ERR_PDU:
DBG_INFO( "err pdu\n");
bRetVal = FALSE_;
break;
case SDP_SS_PDU:
/* Input data length check. */
if ((NULL == pData) || (uLen < SDP_SS_REQ_MIN_LEN))
{
DBG_ERROR( "req frame err\n");
}
DBG_INFO( "SSR.uTID=%02X\n", uTID);
DBG_DUMP(pData, uLen);
bRetVal = _SDP_sendSSResp(uTID, pData, uLen);
break;
case SDP_SA_PDU:
/* Input data length check. */
if ((NULL == pData) || (uLen < SDP_SA_REQ_MIN_LEN))
{
DBG_ERROR( "req frame err\n");
}
DBG_INFO( "SAR.uTID=%02X\n", uTID);
DBG_DUMP(pData, uLen);
bRetVal = _SDP_sendSAResp(uTID, pData, uLen);
break;
case SDP_SSA_PDU:
/* Input data length check. */
if ((NULL == pData) || (uLen < SDP_SSA_REQ_MIN_LEN))
{
DBG_ERROR( "req frame err\n");
}
DBG_INFO( "SSAR.uTID=%02X\n", uTID);
DBG_DUMP(pData,uLen);
bRetVal = _SDP_sendSSAResp(uTID, pData, uLen);
break;
default:
DBG_ERROR( "pdu id!\n");
bRetVal = FALSE_;
break;
}
return bRetVal;
}
unsigned char _SDP_sendSSResp(unsigned short uTID, const unsigned char *pData, unsigned short uLen)
{
// unsigned char pRspData[SDP_MAX_FRAME_SIZE];
unsigned char* pRspData = L2capGetSendBuffer();
unsigned char bRetVal = FALSE_;
unsigned long au32UUID[12], uServiceRecordHandler;
unsigned short uNumUUID, uRspDataLen, i;
unsigned short uTServiceRecordCount, uCServiceRecordCount;
SDP_SERVICE *apsServiceList[SDP_SERVICE_COUNT];
uTServiceRecordCount = uCServiceRecordCount = 0;
/*
* Prepare the ServiceRecordHandleList:
* Get the UUIDs from the ServiceSearchPattern and match them with
* the services in the database.
*/
/* Get the UUIDs from the ServiceSearchPattern. */
uNumUUID = _SDP_getUUIDs(pData, au32UUID, NULL);
/*
* Get the ServiceRecordCount and store the ServiceRecordHandleList
* in the Response data frame.
*/
uCServiceRecordCount =
_SDP_getServiceRecordList(au32UUID, uNumUUID, apsServiceList);
uTServiceRecordCount = uCServiceRecordCount;
uRspDataLen = SDP_SS_RSP_MIN_LEN + 4*uCServiceRecordCount;
/*
* Fill the Response frame.
*/
/* Header: PDU ID, Transaction ID and PDU data length. */
pRspData[0] = SDP_SSR_PDU;
BT_WRITEBE16(&pRspData[1],uTID);
BT_WRITEBE16(&pRspData[3],uRspDataLen);
/* TotalServiceRecordCount and CurrentServiceRecordCount. */
BT_WRITEBE16(&pRspData[5],uTServiceRecordCount);
BT_WRITEBE16(&pRspData[7],uCServiceRecordCount);
/* ServiceRecordHandleList: Already stored. */
for (i = 0; i < uCServiceRecordCount; ++i)
{
if (NULL != apsServiceList[i])
{
uServiceRecordHandler = BT_READBE32(&apsServiceList[i]->pAttrs[0].pValue[1]);
BT_WRITEBE32(&pRspData[9 + (4*i)],uServiceRecordHandler);
}
}
/* ContinuationState (the last byte) */
pRspData[SDP_HDR_LEN + uRspDataLen - 1] = 0x00;
/*
* Send the Response frame.
*/
DBG_INFO( "SSResp.\n");
//bRetVal = gpsSDPCB->L2CAPsendData(L2CAP_SDP_PSM,pRspData, SDP_HDR_LEN + uRspDataLen);
L2capSendPsm (pRspData, SDP_HDR_LEN + uRspDataLen, L2CAP_PSM_SDP);
return bRetVal;
}
unsigned char _SDP_sendSSAResp(unsigned short uTID, const unsigned char *pData, unsigned short uLen)
{
// unsigned char pRspData[SDP_MAX_FRAME_SIZE];
unsigned char* pRspData = L2capGetSendBuffer();
unsigned char bRetVal;
unsigned short uRspDataLen, uAttrByteCount, uAttrListsByteCount, uNumUUID,
uNumServices, i, uReqOffset, uRspOffset;
unsigned long au32UUID[12];
SDP_SERVICE *apsServiceList[SDP_SERVICE_COUNT];
uAttrListsByteCount = uAttrByteCount = uNumUUID = 0;
uReqOffset = uRspOffset = 0;
bRetVal = FALSE_;
/*
* Prepare the AttributeLists:
*/
/*
* Attribute list sequence:
* Empty sequence
*/
uAttrListsByteCount = 0x0002;
pRspData[7] = SDP_DATA_T_DES|SDP_DATA_S_1B;
pRspData[8] = 0x00;
/*
* Get the UUIDs from the ServiceSearchPattern and match them with
* the services in the database.
*/
uNumUUID = _SDP_getUUIDs(pData, au32UUID, &uReqOffset);
uNumServices = _SDP_getServiceRecordList(au32UUID, uNumUUID, apsServiceList);
/*
* Fill the Attribute Lists with the attributes of each service (each
* service is represented with a data element sequence containing its
* attributes)
*/
/*Set the offset to the Attribute ID List contained in the request*/
uReqOffset += 2;
for (i = 0; i < uNumServices; ++i)
{
if (NULL != apsServiceList[i])
{
/* Get the IDs and fill the AttributeList. */
uAttrByteCount = _SDP_getAttrList(apsServiceList[i],
&pData[uReqOffset], &pRspData[9]);
}
uAttrListsByteCount += uAttrByteCount;
}
uRspDataLen = SDP_SSA_RSP_MIN_LEN + uAttrListsByteCount;
pRspData[8] = uAttrListsByteCount - 2;
/*
* Fill the Response frame.
*/
/* Header: PDU ID, Transaction ID and PDU data length. */
pRspData[0] = SDP_SSAR_PDU;
BT_WRITEBE16(&pRspData[1],uTID);
BT_WRITEBE16(&pRspData[3],uRspDataLen);
/* AttributeListsByteCount and AttributeList (already stored) */
BT_WRITEBE16(&pRspData[5],uAttrListsByteCount);
/* ContinuationSate. */
pRspData[SDP_HDR_LEN + uRspDataLen - 1] = 0x00;
/*
* Send the Response frame.
*/
DBG_INFO( "SSAResp.\n");
//bRetVal = gpsSDPCB->L2CAPsendData(L2CAP_SDP_PSM,pRspData, SDP_HDR_LEN + uRspDataLen);
L2capSendPsm (pRspData, SDP_HDR_LEN + uRspDataLen, L2CAP_PSM_SDP);
return bRetVal;
}
unsigned char _SDP_sendSAResp(unsigned short uTID, const unsigned char *pData, unsigned short uLen)
{
// unsigned char pRspData[SDP_MAX_FRAME_SIZE];
unsigned char* pRspData = L2capGetSendBuffer();
unsigned char bFound, bRetVal = FALSE_;
unsigned short uRspDataLen, uAttrListByteCount, i;
unsigned long uReqSrvHandle, uLocalSrvHandle;
SDP_SERVICE *pService = NULL;
/*
* Prepare the AttributeList:
* Get the IDs and ID ranges from the AttributeIDList and store the
* requested attributes into the Response Data frame.
*/
bFound = FALSE_;
for (i = 0; (i < SDP_SERVICE_COUNT) && !bFound; ++i)
{
uReqSrvHandle = BT_READBE32(&pData[0]);
uLocalSrvHandle = BT_READBE32(&gpsSDPCB->pService[i]->pAttrs[0].pValue[1]);
if (uReqSrvHandle == uLocalSrvHandle)
{
bFound = TRUE_;
pService = (SDP_SERVICE *) gpsSDPCB->pService[i];
}
}
/* Get the IDs from the AttributeIDList and create the AttributeList. */
uAttrListByteCount = _SDP_getAttrList(pService, &pData[6], &pRspData[7]);
uRspDataLen = SDP_SA_RSP_MIN_LEN + uAttrListByteCount;
/*
* Fill the Response frame.
*/
/* Header: PDU ID, Transaction ID and PDU data length. */
pRspData[0] = SDP_SAR_PDU;
BT_WRITEBE16(&pRspData[1],uTID);
BT_WRITEBE16(&pRspData[3],uRspDataLen);
/* AttributeListByteCount and AttributeList (already stored) */
BT_WRITEBE16(&pRspData[5],uAttrListByteCount);
/* ContinuationSate. */
pRspData[SDP_HDR_LEN + uRspDataLen - 1] = 0x00;
/*
* Send the Response frame.
*/
DBG_INFO( "SAResp.\n");
// bRetVal = gpsSDPCB->L2CAPsendData(L2CAP_SDP_PSM,pRspData,
// SDP_HDR_LEN + uRspDataLen);
L2capSendPsm (pRspData, SDP_HDR_LEN + uRspDataLen, L2CAP_PSM_SDP);
return bRetVal;
}
unsigned short _SDP_getUUIDs(const unsigned char *pServiceSearchPattern,
unsigned long *pUUID, unsigned short *pReqOffset)
{
unsigned char bDataDescriptor;
unsigned short uNumUUID, i, uDataLen, uOffset;
uNumUUID = uDataLen = i = uOffset = 0;
/*
* NOTICE: It is a assumed that pUUID is at least a 12 element array.
*/
if (NULL == pServiceSearchPattern)
{
DBG_ERROR("search err1\n");
return 0;
}
/* Get the pattern length and the offset */
switch (pServiceSearchPattern[0])
{
case SDP_DATA_T_DES|SDP_DATA_S_1B:
uDataLen = pServiceSearchPattern[1];
uOffset = 2;
break;
case SDP_DATA_T_DES|SDP_DATA_S_2B:
uDataLen = BT_READBE16(&pServiceSearchPattern[1]);
uOffset = 3;
break;
default:
DBG_ERROR("search err2\n");
return 0;
break;
}
while (i < uDataLen)
{
bDataDescriptor = pServiceSearchPattern[uOffset + i];
switch(bDataDescriptor)
{
/* 16 bit UUID */
case SDP_DATA_T_UUID|SDP_DATA_S_16:
pUUID[uNumUUID] = BT_READBE16(&pServiceSearchPattern[uOffset + i + 1]);
i+=3;
++uNumUUID;
break;
/* 32 bit UUID */
case SDP_DATA_T_UUID|SDP_DATA_S_32:
pUUID[uNumUUID] = BT_READBE32(&pServiceSearchPattern[uOffset + i + 1]);
i+=5;
++uNumUUID;
break;
/* 128 bit UUID */
case SDP_DATA_T_UUID|SDP_DATA_S_128:
/* Not supported */
// Check if its a bluetooth uuid
if(IsBtSigUuid(&pServiceSearchPattern[uOffset + i + 1]))
{
pUUID[uNumUUID] = BT_READBE32(&pServiceSearchPattern[uOffset + i + 1]); // 32 bit uuid from bytes 16 - 12
i+=17;
++uNumUUID;
}
else // Just skip it
{
i+=17;
}
//return uNumUUID; // Old behaviour
break;
default:
return uNumUUID;
break;
}
}
/* Return the Offset to to next parameter in the request */
if(NULL != pReqOffset)
{
*pReqOffset = uOffset + uDataLen;
}
return uNumUUID;
}
unsigned short _SDP_getServiceRecordList(const unsigned long *pUUID, unsigned short uLen,
SDP_SERVICE *ppsServiceList[])
{
unsigned short i;
unsigned short uNumServices = 0;
unsigned char bDiscarded = FALSE_;
/* Do a sanity check on the input variables */
if (NULL == pUUID ||
NULL == ppsServiceList)
{
DBG_ERROR("param err\n");
return FALSE_;
}
#ifdef SDP_SERVICE_RFCOMM_ENABLE
ppsServiceList[0] = NULL;
bDiscarded = FALSE_;
/* Discard the services according to the UUID list */
for(i = 0; (i < uLen) && !bDiscarded; ++i)
{
if (pUUID[i] != 0x00000003 &&
pUUID[i] != 0x00000100 &&
pUUID[i] != 0x00001101 &&
pUUID[i] != 0x00001002 )
{
bDiscarded = TRUE_;
}
}
if ((uLen > 0) && !bDiscarded)
{
/* Populate the ServiceList with the RFCOMM */
ppsServiceList[0] = (SDP_SERVICE *) gpsSDPCB->pService[0];
++uNumServices;
}
#endif
return uNumServices;
}
unsigned short _SDP_getAttrList(const SDP_SERVICE *pService, const unsigned char *pAttrIDList,
unsigned char *pAttrList)
{
unsigned short i, j = 0, k, uAttrListByteCount, uInOffset = 0, uOutOffset, uLen = 0;
unsigned short uID, uIDRangeHigh, uIDRangeLow;
unsigned char bDataDescriptor;
unsigned char bFound = FALSE_;
/* Do a sanity check on the input variables */
if (NULL == pAttrIDList ||
NULL == pAttrList)
{
DBG_ERROR( "param err\n");
return FALSE_;
}
/* The first 2 bytes will contain a data element sequence descriptor */
uOutOffset = 2;
uAttrListByteCount = 0;
/* In case of a NULL service, return an empty list */
if (NULL == pService)
{
/* Fill the first 2 bytes (data element sequence descriptor) */
pAttrList[0] = SDP_DATA_T_DES|SDP_DATA_S_1B;
pAttrList[1] = uAttrListByteCount;
return uAttrListByteCount + uOutOffset;
}
/* Get the list length and the offset. */
bDataDescriptor = pAttrIDList[0];
switch (bDataDescriptor)
{
case SDP_DATA_T_DES|SDP_DATA_S_1B:
uLen = pAttrIDList[1];
uInOffset = 2;
break;
case SDP_DATA_T_DES|SDP_DATA_S_2B:
uLen = BT_READBE16(&pAttrIDList[1]);
uInOffset = 3;
break;
default:
break;
}
i = 0;
while(i < uLen)
{
/*
* Depending on the descriptor the data will be stored as a single ID
* or as an ID range.
*/
bDataDescriptor = pAttrIDList[uInOffset + i];
switch(bDataDescriptor)
{
/* 16 bit ID (single ID) */
case SDP_DATA_T_UINT|SDP_DATA_S_16:
uID = BT_READBE16(&pAttrIDList[uInOffset + j + 1]);
bFound = FALSE_;
/* Search for that AttrID in the service record */
for (j = 0; (j < pService->uNumAttrs) && !bFound; ++j)
{
if (pService->pAttrs[j].uID == uID)
{
/*
* Fill the AttrList
*/
/* Store the attribute ID (as an unsigned short) */
pAttrList[uOutOffset + uAttrListByteCount] =
SDP_DATA_T_UINT|SDP_DATA_S_16;
BT_WRITEBE16(&pAttrList[uOutOffset + uAttrListByteCount + 1],pService->pAttrs[j].uID);
uAttrListByteCount += 3;
/* Store the attribute value */
for(k = 0; k < pService->pAttrs[j].uValueLen; ++k)
{
pAttrList[uOutOffset + uAttrListByteCount + k] =
pService->pAttrs[j].pValue[k];
}
uAttrListByteCount += k;
bFound = TRUE_;
}
}
i+=3;
break;
/* 32 bit ID (range of IDs) */
case SDP_DATA_T_UINT|SDP_DATA_S_32:
uIDRangeLow = BT_READBE16(&pAttrIDList[uInOffset + i + 1]);
uIDRangeHigh = BT_READBE16(&pAttrIDList[uInOffset + i + 1 + 2]);
/* Search for the AttrID in the service record */
for (j = 0; j < pService->uNumAttrs; ++j)
{
uID = pService->pAttrs[j].uID;
if ((uID >= uIDRangeLow) &&
(uID <= uIDRangeHigh))
{
/*
* Fill the AttrList
*/
/* Store the attribute ID (as an unsigned short) */
pAttrList[uOutOffset + uAttrListByteCount] =
SDP_DATA_T_UINT|SDP_DATA_S_16;
BT_WRITEBE16(&pAttrList[uOutOffset + uAttrListByteCount + 1],pService->pAttrs[j].uID);
uAttrListByteCount += 3;
/* Store the attribute value */
for(k = 0; k < pService->pAttrs[j].uValueLen; ++k)
{
pAttrList[uOutOffset + uAttrListByteCount + k] =
pService->pAttrs[j].pValue[k];
}
uAttrListByteCount += k;
}
}
i+=5;
break;
/* Error, the element is not an ID */
default:
return FALSE_;
break;
}
}
/* Fill the first 2 bytes (data element sequence descriptor) */
pAttrList[0] = SDP_DATA_T_DES|SDP_DATA_S_1B;
pAttrList[1] = uAttrListByteCount;
return uAttrListByteCount + uOutOffset;
}
|
9ffe28df37c305f34492d9951a9642f02a290830
|
c9bc99866cfab223c777cfb741083be3e9439d81
|
/product/morello/module/morello_pcie/include/internal/pcie_ctrl_apb_reg.h
|
1939836860362d7768b6b5a84a96cc634ec5c6d4
|
[
"BSD-3-Clause"
] |
permissive
|
ARM-software/SCP-firmware
|
4738ca86ce42d82588ddafc2226a1f353ff2c797
|
f6bcca436768359ffeadd84d65e8ea0c3efc7ef1
|
refs/heads/master
| 2023-09-01T16:13:36.962036
| 2023-08-17T13:00:20
| 2023-08-31T07:43:37
| 134,399,880
| 211
| 165
|
NOASSERTION
| 2023-09-13T14:27:10
| 2018-05-22T10:35:56
|
C
|
UTF-8
|
C
| false
| false
| 7,220
|
h
|
pcie_ctrl_apb_reg.h
|
/*
* Arm SCP/MCP Software
* Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Description:
* PCIe controller configuration registers.
*/
#ifndef INTERNAL_PCIE_CTRL_APB_REG_H
#define INTERNAL_PCIE_CTRL_APB_REG_H
#include <fwk_macros.h>
#include <stdint.h>
/*!
* \brief PCIe APB register definitions
*/
struct pcie_ctrl_apb_reg {
FWK_W uint32_t RESET_CTRL;
FWK_R uint32_t RESET_STATUS;
uint8_t RESERVED0[0x1000 - 0x8];
FWK_RW uint32_t INT_CTRL;
uint32_t RESERVED1;
uint32_t RESERVED2;
uint32_t RESERVED3;
FWK_RW uint32_t RP_CONFIG_IN;
FWK_R uint32_t RP_CONFIG_OUT;
uint32_t RESERVED4;
FWK_RW uint32_t RP_ERROR_CTRL;
FWK_R uint32_t RP_DEBUG;
FWK_RW uint32_t RP_L1_EXIT_CTRL;
FWK_R uint32_t RP_LTSSM_STATE;
FWK_R uint32_t PIPE_STATUS;
FWK_R uint32_t PM_STATUS;
uint32_t RESERVED5;
uint32_t RESERVED6;
uint32_t RESERVED7;
FWK_R uint32_t PMA_COMMON_STATUS;
FWK_R uint32_t PMA_LANE_STATUS;
uint8_t RESERVED8[0x3000 - 0x1048];
FWK_RW uint32_t MODE_CTRL;
FWK_RW uint32_t PWR_STATE_CHANGE_CTRL;
FWK_R uint32_t VF_PWR_STATE;
FWK_RW uint32_t HOT_RESET_INT_CTRL;
FWK_RW uint32_t FLR_RESET_INT_CTRL;
FWK_RW uint32_t EP_MISC_CTRL;
FWK_R uint32_t EP_MISC_STATUS;
FWK_R uint32_t PF_TPH_STATUS;
FWK_R uint32_t VF_TPH_STATUS;
FWK_RW uint32_t CCIX_CTRL;
uint8_t RESERVED9[0xFFD0 - 0x3028];
FWK_R uint32_t PID4;
FWK_R uint32_t PID0;
FWK_R uint32_t PID1;
FWK_R uint32_t PID2;
FWK_R uint32_t PID3;
FWK_R uint32_t CID0;
FWK_R uint32_t CID1;
FWK_R uint32_t CID2;
FWK_R uint32_t CID3;
};
#define RESET_CTRL_PHY_REL_POS UINT32_C(0)
#define RESET_CTRL_RC_REL_POS UINT32_C(1)
#define RESET_CTRL_HOT_RESET_POS UINT32_C(3)
#define RESET_CTRL_PHY_REL_MASK (1 << RESET_CTRL_PHY_REL_POS)
#define RESET_CTRL_RC_REL_MASK (1 << RESET_CTRL_RC_REL_POS)
#define RESET_CTRL_HOT_RESET_MASK (1 << RESET_CTRL_HOT_RESET_POS)
#define RESET_STATUS_PLL_ST_POS UINT32_C(0)
#define RESET_STATUS_PHY_REL_ST_POS UINT32_C(1)
#define RESET_STATUS_RC_ST_POS UINT32_C(2)
#define RESET_STATUS_RC_REL_ST_POS UINT32_C(4)
#define RESET_STATUS_HOT_RESET_ST_POS UINT32_C(5)
#define RESET_STATUS_PM_ST_POS UINT32_C(6)
#define RESET_STATUS_PLL_ST_MASK (1 << RESET_STATUS_PLL_ST_POS)
#define RESET_STATUS_PHY_REL_ST_MASK (1 << RESET_STATUS_PHY_REL_ST_POS)
#define RESET_STATUS_RC_ST_MASK (1 << RESET_STATUS_RC_ST_POS)
#define RESET_STATUS_RC_REL_ST_MASK (1 << RESET_STATUS_RC_REL_ST_POS)
#define RESET_STATUS_HOT_RESET_ST_MASK (1 << RESET_STATUS_HOT_RESET_ST_POS)
#define RESET_STATUS_PM_ST_MASK (1 << RESET_STATUS_PM_ST_POS)
#define INT_CTRL_NEGOTIATED_SPD_IRQ_EN_POS UINT32_C(0)
#define INT_CTRL_LINK_TRNG_DONE_IRQ_EN_POS UINT32_C(1)
#define INT_CTRL_PLL_STATUS_IRQ_EN_POS UINT32_C(2)
#define INT_CTRL_NEGOTIATED_SPD_IRQ_EN_MASK \
(1 << INT_CTRL_NEGOTIATED_SPD_IRQ_EN_POS)
#define INT_CTRL_LINK_TRNG_DONE_IRQ_EN_MASK \
(1 << INT_CTRL_LINK_TRNG_DONE_IRQ_EN_POS)
#define INT_CTRL_PLL_STATUS_IRQ_EN_MASK (1 << INT_CTRL_PLL_STATUS_IRQ_EN_POS)
#define RP_CONFIG_IN_CLIENT_REQ_EXIT_L2_POS UINT32_C(0)
#define RP_CONFIG_IN_LINK_TRNG_EN_POS UINT32_C(1)
#define RP_CONFIG_IN_ARI_EN_POS UINT32_C(2)
#define RP_CONFIG_IN_LANE_CNT_IN_POS UINT32_C(3)
#define RP_CONFIG_IN_PCIE_GEN_SEL_POS UINT32_C(6)
#define RP_CONFIG_IN_SR_IOV_EN_POS UINT32_C(8)
#define RP_CONFIG_IN_GEN3_DC_BAL_DIS_POS UINT32_C(9)
#define RP_CONFIG_IN_SRIS_EN_POS UINT32_C(10)
#define RP_CONFIG_IN_PMA_CMN_EXT_REFCLK_DET_POS UINT32_C(11)
#define RP_CONFIG_IN_PMA_CMN_EXT_REFCLK_TERMEN_POS UINT32_C(12)
#define RP_CONFIG_IN_NON_POSTED_REJ_POS UINT32_C(13)
#define RP_CONFIG_IN_CLIENT_REQ_EXIT_L2_MASK \
(1 << RP_CONFIG_IN_CLIENT_REQ_EXIT_L2_POS)
#define RP_CONFIG_IN_LINK_TRNG_EN_MASK (1 << RP_CONFIG_IN_LINK_TRNG_EN_POS)
#define RP_CONFIG_IN_ARI_EN_MASK (1 << RP_CONFIG_IN_ARI_EN_POS)
#define RP_CONFIG_IN_LANE_CNT_IN_MASK (0x7 << RP_CONFIG_IN_LANE_CNT_IN_POS)
#define RP_CONFIG_IN_PCIE_GEN_SEL_MASK (0x3 << RP_CONFIG_IN_PCIE_GEN_SEL_POS)
#define RP_CONFIG_IN_SR_IOV_EN_MASK (1 << RP_CONFIG_IN_SR_IOV_EN_POS)
#define RP_CONFIG_IN_GEN3_DC_BAL_DIS_MASK \
(1 << RP_CONFIG_IN_GEN3_DC_BAL_DIS_POS)
#define RP_CONFIG_IN_SRIS_EN_MASK (1 << RP_CONFIG_IN_SRIS_EN_POS)
#define RP_CONFIG_IN_PMA_CMN_EXT_REFCLK_DET_MASK \
(1 << RP_CONFIG_IN_PMA_CMN_EXT_REFCLK_DET_POS)
#define RP_CONFIG_IN_PMA_CMN_EXT_REFCLK_TERMEN_MASK \
(1 << RP_CONFIG_IN_PMA_CMN_EXT_REFCLK_TERMEN_POS)
#define RP_CONFIG_IN_NON_POSTED_REJ_MASK (1 << RP_CONFIG_IN_NON_POSTED_REJ_POS)
#define RP_CONFIG_OUT_OBFF_EN_POS UINT32_C(0)
#define RP_CONFIG_OUT_RCB_STATUS_POS UINT32_C(2)
#define RP_CONFIG_OUT_MAX_PAYLOAD_SIZE_POS UINT32_C(3)
#define RP_CONFIG_OUT_MAX_READREQ_SIZE_POS UINT32_C(6)
#define RP_CONFIG_OUT_LINK_PWR_STATE_POS UINT32_C(9)
#define RP_CONFIG_OUT_FN_PWR_STATE_POS UINT32_C(16)
#define RP_CONFIG_OUT_NEGOTIATED_SPD_POS UINT32_C(20)
#define RP_CONFIG_OUT_NEGOTIATED_LINK_WIDTH_POS UINT32_C(22)
#define RP_CONFIG_OUT_LINK_STATUS_POS UINT32_C(25)
#define RP_CONFIG_OUT_OBFF_EN_MASK (0x3 << RP_CONFIG_OUT_OBFF_EN_POS)
#define RP_CONFIG_OUT_RCB_STATUS_MASK (1 << RP_CONFIG_OUT_RCB_STATUS_POS)
#define RP_CONFIG_OUT_MAX_PAYLOAD_SIZE_MASK \
(0x7 << RP_CONFIG_OUT_MAX_PAYLOAD_SIZE_POS)
#define RP_CONFIG_OUT_MAX_READREQ_SIZE_MASK \
(0x7 << RP_CONFIG_OUT_MAX_READREQ_SIZE_POS)
#define RP_CONFIG_OUT_LINK_PWR_STATE_MASK \
(0xF << RP_CONFIG_OUT_LINK_PWR_STATE_POS)
#define RP_CONFIG_OUT_FN_PWR_STATE_MASK (0x7 << RP_CONFIG_OUT_FN_PWR_STATE_POS)
#define RP_CONFIG_OUT_NEGOTIATED_SPD_MASK \
(0x3 << RP_CONFIG_OUT_NEGOTIATED_SPD_POS)
#define RP_CONFIG_OUT_NEGOTIATED_LINK_WIDTH_MASK \
(0x7 << RP_CONFIG_OUT_NEGOTIATED_LINK_WIDTH_POS)
#define RP_CONFIG_OUT_LINK_STATUS_MASK (0x3 << RP_CONFIG_OUT_LINK_STATUS_POS)
#define RP_ERROR_CTRL_UNCORRECTABLE_ERROR_IN_POS UINT32_C(0)
#define RP_ERROR_CTRL_CORRECTABLE_ERROR_IN_POS UINT32_C(1)
#define RP_ERROR_CTRL_UNCORRECTABLE_ERROR_IN_MASK \
(1 << RP_ERROR_CTRL_UNCORRECTABLE_ERROR_IN_POS)
#define RP_ERROR_CTRL_CORRECTABLE_ERROR_IN_MASK \
(1 << RP_ERROR_CTRL_CORRECTABLE_ERROR_IN_POS)
#define RP_LTSSM_STATE_POS UINT32_C(0)
#define RP_LTSSM_STATE_MASK (0x3F << RP_LTSSM_STATE_POS)
#define PIPE_STATUS_PIPE_RATE_POS UINT32_C(0)
#define PIPE_STATUS_PIPE_RATE_MASK (0x3 << PIPE_STATUS_PIPE_RATE_POS)
#define PM_STATUS_L1_PM_SUBSTATE_POS UINT32_C(0)
#define PM_STATUS_L1_PM_SUBSTATE_MASK (0x7 << PM_STATUS_L1_PM_SUBSTATE_POS)
#define MODE_CTRL_MODE_SELECT_EP UINT32_C(0)
#define MODE_CTRL_MODE_SELECT_RP UINT32_C(1)
#define EP_MISC_CTRL_REQ_PM_L23_READY_POS UINT32_C(0)
#define EP_MISC_CTRL_CONFIG_EN_POS UINT32_C(8)
#define EP_MISC_CTRL_REQ_PM_L23_READY_MASK \
(0x1 << EP_MISC_CTRL_REQ_PM_L23_READY_POS)
#define EP_MISC_CTRL_CONFIG_EN_MASK (0x1 << EP_MISC_CTRL_CONFIG_EN_POS)
#endif /* INTERNAL_PCIE_CTRL_APB_REG_H */
|
4eb659ecbb87017c9222ee8cd4b0e76d5ac7e8b8
|
fb8c77957e6a9d8382c08751ebd76779b6bdb7ce
|
/test/unit/test_vad.c
|
b85cfb16a9acc606c3fed8c6a579f636f3f11b6b
|
[
"BSD-3-Clause",
"BSD-2-Clause",
"MIT",
"LicenseRef-scancode-other-permissive"
] |
permissive
|
cmusphinx/pocketsphinx
|
f9680355ed5e7e6323e7719faa56e2ce01fb7065
|
445a7796c2dc19dbe2bbf2a67781f14daecb89b5
|
refs/heads/master
| 2023-08-23T16:25:54.571001
| 2023-07-31T12:09:35
| 2023-07-31T12:09:35
| 18,513,454
| 3,726
| 832
|
NOASSERTION
| 2023-07-31T12:09:36
| 2014-04-07T10:28:32
|
C
|
UTF-8
|
C
| false
| false
| 3,950
|
c
|
test_vad.c
|
/* Test voice activity detection.
*
* MIT license (c) 2022, see LICENSE for more information.
*
* Author: David Huggins-Daines <dhdaines@gmail.com>
*/
#include <pocketsphinx.h>
#include "util/ckd_alloc.h"
#include "test_macros.h"
static const char *expecteds[] = {
"011110111111111111111111111100",
"011110111111111111111111111100",
"000000111111111111111111110000",
"000000111111111111111100000000"
};
static const int n_modes = sizeof(expecteds)/sizeof(expecteds[0]);
static int sample_rates[] = {
8000,
16000,
32000,
48000,
11025,
22050,
44100
};
static const int n_sample_rates = sizeof(sample_rates)/sizeof(sample_rates[0]);
static FILE *
open_data(int sample_rate)
{
char *soxcmd;
int len;
FILE *sox;
#define SOXCMD "sox -q -r 8000 -c 1 -b 16 -e signed-integer -t raw -D -G " \
DATADIR "/vad/test-audio.raw -r %d -t raw -"
if (sample_rate == 8000)
return fopen(DATADIR "/vad/test-audio.raw", "rb");
len = snprintf(NULL, 0, SOXCMD, sample_rate);
if ((soxcmd = malloc(len + 1)) == NULL)
E_FATAL_SYSTEM("Failed to allocate string");
if (snprintf(soxcmd, len + 1, SOXCMD, sample_rate) != len)
E_FATAL_SYSTEM("snprintf() failed");
if ((sox = popen(soxcmd, "r")) == NULL)
E_FATAL_SYSTEM("Failed to popen(%s)", soxcmd);
free(soxcmd);
return sox;
}
static void
close_data(FILE *fh, int sample_rate)
{
if (sample_rate == 8000)
fclose(fh);
else
pclose(fh);
}
static int
test_sample_rate(int sample_rate)
{
ps_vad_t *vader;
short *frame;
int i;
/* Test VAD modes with py-webrtcvad test data. */
for (i = 0; i < n_modes; ++i) {
FILE *fh;
size_t frame_size;
char *classification, *c;
E_INFO("Sample rate %d, mode %d\n", sample_rate, i);
/* Extra space for approximate rates */
c = classification = ckd_calloc(1, strlen(expecteds[i]) * 2);
vader = ps_vad_init(i, sample_rate, 0.03);
TEST_ASSERT(vader);
frame_size = ps_vad_frame_size(vader);
frame = ckd_calloc(sizeof(*frame), frame_size);
TEST_ASSERT(frame);
fh = open_data(sample_rate);
TEST_ASSERT(fh);
while (fread(frame, sizeof(*frame), frame_size, fh) == frame_size) {
int is_speech = ps_vad_classify(vader, frame);
TEST_ASSERT(is_speech != PS_VAD_ERROR);
*c++ = (is_speech == PS_VAD_SPEECH) ? '1' : '0';
}
E_INFO("true: %s\n", expecteds[i]);
E_INFO("pred: %s\n", classification);
if (sample_rate != 48000 /* Has Problems for some reason */
&& ps_vad_frame_length(vader) == 0.03) /* skip approximate rates */
TEST_EQUAL(0, strcmp(expecteds[i], classification));
ckd_free(classification);
ps_vad_free(vader);
ckd_free(frame);
close_data(fh, sample_rate);
}
return 0;
}
int
main(int argc, char *argv[])
{
ps_vad_t *vader;
int i;
(void)argc; (void)argv;
err_set_loglevel(ERR_INFO);
/* Test initialization with default parameters. */
vader = ps_vad_init(0, 0, 0);
TEST_ASSERT(vader);
/* Retain and release, should still be there. */
TEST_ASSERT((vader = ps_vad_retain(vader)));
TEST_ASSERT(ps_vad_free(vader));
/* Test default frame size. */
TEST_EQUAL(ps_vad_frame_size(vader),
(int)(PS_VAD_DEFAULT_SAMPLE_RATE * PS_VAD_DEFAULT_FRAME_LENGTH));
TEST_EQUAL_FLOAT(ps_vad_frame_length(vader), PS_VAD_DEFAULT_FRAME_LENGTH);
TEST_ASSERT(ps_vad_free(vader) == 0);
/* Test a variety of sample rates. */
for (i = 0; i < n_sample_rates; ++i)
test_sample_rate(sample_rates[i]);
/* Test rejection of unreasonable sample rates. */
vader = ps_vad_init(0, 42, 0.03);
TEST_ASSERT(vader == NULL);
vader = ps_vad_init(0, 96000, 0.03);
TEST_ASSERT(vader == NULL);
return 0;
}
|
dd85c8445cc6804bcf8b3d8863ec902893f2b02d
|
83e7dc1281874779c46dfadcc15b2bb66d8e599c
|
/src/font/lv_symbol_def.h
|
696daf18912932d60a42290973b72492b7ebcee6
|
[
"MIT"
] |
permissive
|
lvgl/lvgl
|
7d51d6774d6ac71df7101fc7ded56fea4b70be01
|
5c984b4a5364b6455966eb3a860153806c51626f
|
refs/heads/master
| 2023-08-30T22:39:20.283922
| 2023-08-30T19:55:29
| 2023-08-30T19:55:29
| 60,667,730
| 9,296
| 2,218
|
MIT
| 2023-09-14T17:59:34
| 2016-06-08T04:14:34
|
C
|
UTF-8
|
C
| false
| false
| 9,428
|
h
|
lv_symbol_def.h
|
#ifndef LV_SYMBOL_DEF_H
#define LV_SYMBOL_DEF_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../lv_conf_internal.h"
/*-------------------------------
* Symbols from "normal" font
*-----------------------------*/
#if !defined LV_SYMBOL_BULLET
#define LV_SYMBOL_BULLET "\xE2\x80\xA2" /*20042, 0x2022*/
#endif
/*-------------------------------
* Symbols from FontAwesome font
*-----------------------------*/
/*In the font converter use this list as range:
61441, 61448, 61451, 61452, 61453, 61457, 61459, 61461, 61465, 61468,
61473, 61478, 61479, 61480, 61502, 61507, 61512, 61515, 61516, 61517,
61521, 61522, 61523, 61524, 61543, 61544, 61550, 61552, 61553, 61556,
61559, 61560, 61561, 61563, 61587, 61589, 61636, 61637, 61639, 61641,
61664, 61671, 61674, 61683, 61724, 61732, 61787, 61931, 62016, 62017,
62018, 62019, 62020, 62087, 62099, 62189, 62212, 62810, 63426, 63650
*/
/* These symbols can be prefined in the lv_conf.h file.
* If they are not predefined, they will use the following values
*/
#if !defined LV_SYMBOL_AUDIO
#define LV_SYMBOL_AUDIO "\xEF\x80\x81" /*61441, 0xF001*/
#endif
#if !defined LV_SYMBOL_VIDEO
#define LV_SYMBOL_VIDEO "\xEF\x80\x88" /*61448, 0xF008*/
#endif
#if !defined LV_SYMBOL_LIST
#define LV_SYMBOL_LIST "\xEF\x80\x8B" /*61451, 0xF00B*/
#endif
#if !defined LV_SYMBOL_OK
#define LV_SYMBOL_OK "\xEF\x80\x8C" /*61452, 0xF00C*/
#endif
#if !defined LV_SYMBOL_CLOSE
#define LV_SYMBOL_CLOSE "\xEF\x80\x8D" /*61453, 0xF00D*/
#endif
#if !defined LV_SYMBOL_POWER
#define LV_SYMBOL_POWER "\xEF\x80\x91" /*61457, 0xF011*/
#endif
#if !defined LV_SYMBOL_SETTINGS
#define LV_SYMBOL_SETTINGS "\xEF\x80\x93" /*61459, 0xF013*/
#endif
#if !defined LV_SYMBOL_HOME
#define LV_SYMBOL_HOME "\xEF\x80\x95" /*61461, 0xF015*/
#endif
#if !defined LV_SYMBOL_DOWNLOAD
#define LV_SYMBOL_DOWNLOAD "\xEF\x80\x99" /*61465, 0xF019*/
#endif
#if !defined LV_SYMBOL_DRIVE
#define LV_SYMBOL_DRIVE "\xEF\x80\x9C" /*61468, 0xF01C*/
#endif
#if !defined LV_SYMBOL_REFRESH
#define LV_SYMBOL_REFRESH "\xEF\x80\xA1" /*61473, 0xF021*/
#endif
#if !defined LV_SYMBOL_MUTE
#define LV_SYMBOL_MUTE "\xEF\x80\xA6" /*61478, 0xF026*/
#endif
#if !defined LV_SYMBOL_VOLUME_MID
#define LV_SYMBOL_VOLUME_MID "\xEF\x80\xA7" /*61479, 0xF027*/
#endif
#if !defined LV_SYMBOL_VOLUME_MAX
#define LV_SYMBOL_VOLUME_MAX "\xEF\x80\xA8" /*61480, 0xF028*/
#endif
#if !defined LV_SYMBOL_IMAGE
#define LV_SYMBOL_IMAGE "\xEF\x80\xBE" /*61502, 0xF03E*/
#endif
#if !defined LV_SYMBOL_TINT
#define LV_SYMBOL_TINT "\xEF\x81\x83" /*61507, 0xF043*/
#endif
#if !defined LV_SYMBOL_PREV
#define LV_SYMBOL_PREV "\xEF\x81\x88" /*61512, 0xF048*/
#endif
#if !defined LV_SYMBOL_PLAY
#define LV_SYMBOL_PLAY "\xEF\x81\x8B" /*61515, 0xF04B*/
#endif
#if !defined LV_SYMBOL_PAUSE
#define LV_SYMBOL_PAUSE "\xEF\x81\x8C" /*61516, 0xF04C*/
#endif
#if !defined LV_SYMBOL_STOP
#define LV_SYMBOL_STOP "\xEF\x81\x8D" /*61517, 0xF04D*/
#endif
#if !defined LV_SYMBOL_NEXT
#define LV_SYMBOL_NEXT "\xEF\x81\x91" /*61521, 0xF051*/
#endif
#if !defined LV_SYMBOL_EJECT
#define LV_SYMBOL_EJECT "\xEF\x81\x92" /*61522, 0xF052*/
#endif
#if !defined LV_SYMBOL_LEFT
#define LV_SYMBOL_LEFT "\xEF\x81\x93" /*61523, 0xF053*/
#endif
#if !defined LV_SYMBOL_RIGHT
#define LV_SYMBOL_RIGHT "\xEF\x81\x94" /*61524, 0xF054*/
#endif
#if !defined LV_SYMBOL_PLUS
#define LV_SYMBOL_PLUS "\xEF\x81\xA7" /*61543, 0xF067*/
#endif
#if !defined LV_SYMBOL_MINUS
#define LV_SYMBOL_MINUS "\xEF\x81\xA8" /*61544, 0xF068*/
#endif
#if !defined LV_SYMBOL_EYE_OPEN
#define LV_SYMBOL_EYE_OPEN "\xEF\x81\xAE" /*61550, 0xF06E*/
#endif
#if !defined LV_SYMBOL_EYE_CLOSE
#define LV_SYMBOL_EYE_CLOSE "\xEF\x81\xB0" /*61552, 0xF070*/
#endif
#if !defined LV_SYMBOL_WARNING
#define LV_SYMBOL_WARNING "\xEF\x81\xB1" /*61553, 0xF071*/
#endif
#if !defined LV_SYMBOL_SHUFFLE
#define LV_SYMBOL_SHUFFLE "\xEF\x81\xB4" /*61556, 0xF074*/
#endif
#if !defined LV_SYMBOL_UP
#define LV_SYMBOL_UP "\xEF\x81\xB7" /*61559, 0xF077*/
#endif
#if !defined LV_SYMBOL_DOWN
#define LV_SYMBOL_DOWN "\xEF\x81\xB8" /*61560, 0xF078*/
#endif
#if !defined LV_SYMBOL_LOOP
#define LV_SYMBOL_LOOP "\xEF\x81\xB9" /*61561, 0xF079*/
#endif
#if !defined LV_SYMBOL_DIRECTORY
#define LV_SYMBOL_DIRECTORY "\xEF\x81\xBB" /*61563, 0xF07B*/
#endif
#if !defined LV_SYMBOL_UPLOAD
#define LV_SYMBOL_UPLOAD "\xEF\x82\x93" /*61587, 0xF093*/
#endif
#if !defined LV_SYMBOL_CALL
#define LV_SYMBOL_CALL "\xEF\x82\x95" /*61589, 0xF095*/
#endif
#if !defined LV_SYMBOL_CUT
#define LV_SYMBOL_CUT "\xEF\x83\x84" /*61636, 0xF0C4*/
#endif
#if !defined LV_SYMBOL_COPY
#define LV_SYMBOL_COPY "\xEF\x83\x85" /*61637, 0xF0C5*/
#endif
#if !defined LV_SYMBOL_SAVE
#define LV_SYMBOL_SAVE "\xEF\x83\x87" /*61639, 0xF0C7*/
#endif
#if !defined LV_SYMBOL_BARS
#define LV_SYMBOL_BARS "\xEF\x83\x89" /*61641, 0xF0C9*/
#endif
#if !defined LV_SYMBOL_ENVELOPE
#define LV_SYMBOL_ENVELOPE "\xEF\x83\xA0" /*61664, 0xF0E0*/
#endif
#if !defined LV_SYMBOL_CHARGE
#define LV_SYMBOL_CHARGE "\xEF\x83\xA7" /*61671, 0xF0E7*/
#endif
#if !defined LV_SYMBOL_PASTE
#define LV_SYMBOL_PASTE "\xEF\x83\xAA" /*61674, 0xF0EA*/
#endif
#if !defined LV_SYMBOL_BELL
#define LV_SYMBOL_BELL "\xEF\x83\xB3" /*61683, 0xF0F3*/
#endif
#if !defined LV_SYMBOL_KEYBOARD
#define LV_SYMBOL_KEYBOARD "\xEF\x84\x9C" /*61724, 0xF11C*/
#endif
#if !defined LV_SYMBOL_GPS
#define LV_SYMBOL_GPS "\xEF\x84\xA4" /*61732, 0xF124*/
#endif
#if !defined LV_SYMBOL_FILE
#define LV_SYMBOL_FILE "\xEF\x85\x9B" /*61787, 0xF158*/
#endif
#if !defined LV_SYMBOL_WIFI
#define LV_SYMBOL_WIFI "\xEF\x87\xAB" /*61931, 0xF1EB*/
#endif
#if !defined LV_SYMBOL_BATTERY_FULL
#define LV_SYMBOL_BATTERY_FULL "\xEF\x89\x80" /*62016, 0xF240*/
#endif
#if !defined LV_SYMBOL_BATTERY_3
#define LV_SYMBOL_BATTERY_3 "\xEF\x89\x81" /*62017, 0xF241*/
#endif
#if !defined LV_SYMBOL_BATTERY_2
#define LV_SYMBOL_BATTERY_2 "\xEF\x89\x82" /*62018, 0xF242*/
#endif
#if !defined LV_SYMBOL_BATTERY_1
#define LV_SYMBOL_BATTERY_1 "\xEF\x89\x83" /*62019, 0xF243*/
#endif
#if !defined LV_SYMBOL_BATTERY_EMPTY
#define LV_SYMBOL_BATTERY_EMPTY "\xEF\x89\x84" /*62020, 0xF244*/
#endif
#if !defined LV_SYMBOL_USB
#define LV_SYMBOL_USB "\xEF\x8a\x87" /*62087, 0xF287*/
#endif
#if !defined LV_SYMBOL_BLUETOOTH
#define LV_SYMBOL_BLUETOOTH "\xEF\x8a\x93" /*62099, 0xF293*/
#endif
#if !defined LV_SYMBOL_TRASH
#define LV_SYMBOL_TRASH "\xEF\x8B\xAD" /*62189, 0xF2ED*/
#endif
#if !defined LV_SYMBOL_EDIT
#define LV_SYMBOL_EDIT "\xEF\x8C\x84" /*62212, 0xF304*/
#endif
#if !defined LV_SYMBOL_BACKSPACE
#define LV_SYMBOL_BACKSPACE "\xEF\x95\x9A" /*62810, 0xF55A*/
#endif
#if !defined LV_SYMBOL_SD_CARD
#define LV_SYMBOL_SD_CARD "\xEF\x9F\x82" /*63426, 0xF7C2*/
#endif
#if !defined LV_SYMBOL_NEW_LINE
#define LV_SYMBOL_NEW_LINE "\xEF\xA2\xA2" /*63650, 0xF8A2*/
#endif
#if !defined LV_SYMBOL_DUMMY
/** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/
#define LV_SYMBOL_DUMMY "\xEF\xA3\xBF"
#endif
/*
* The following list is generated using
* cat src/font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ _LV_STR_\1,/p'
*/
enum {
_LV_STR_SYMBOL_BULLET,
_LV_STR_SYMBOL_AUDIO,
_LV_STR_SYMBOL_VIDEO,
_LV_STR_SYMBOL_LIST,
_LV_STR_SYMBOL_OK,
_LV_STR_SYMBOL_CLOSE,
_LV_STR_SYMBOL_POWER,
_LV_STR_SYMBOL_SETTINGS,
_LV_STR_SYMBOL_HOME,
_LV_STR_SYMBOL_DOWNLOAD,
_LV_STR_SYMBOL_DRIVE,
_LV_STR_SYMBOL_REFRESH,
_LV_STR_SYMBOL_MUTE,
_LV_STR_SYMBOL_VOLUME_MID,
_LV_STR_SYMBOL_VOLUME_MAX,
_LV_STR_SYMBOL_IMAGE,
_LV_STR_SYMBOL_TINT,
_LV_STR_SYMBOL_PREV,
_LV_STR_SYMBOL_PLAY,
_LV_STR_SYMBOL_PAUSE,
_LV_STR_SYMBOL_STOP,
_LV_STR_SYMBOL_NEXT,
_LV_STR_SYMBOL_EJECT,
_LV_STR_SYMBOL_LEFT,
_LV_STR_SYMBOL_RIGHT,
_LV_STR_SYMBOL_PLUS,
_LV_STR_SYMBOL_MINUS,
_LV_STR_SYMBOL_EYE_OPEN,
_LV_STR_SYMBOL_EYE_CLOSE,
_LV_STR_SYMBOL_WARNING,
_LV_STR_SYMBOL_SHUFFLE,
_LV_STR_SYMBOL_UP,
_LV_STR_SYMBOL_DOWN,
_LV_STR_SYMBOL_LOOP,
_LV_STR_SYMBOL_DIRECTORY,
_LV_STR_SYMBOL_UPLOAD,
_LV_STR_SYMBOL_CALL,
_LV_STR_SYMBOL_CUT,
_LV_STR_SYMBOL_COPY,
_LV_STR_SYMBOL_SAVE,
_LV_STR_SYMBOL_BARS,
_LV_STR_SYMBOL_ENVELOPE,
_LV_STR_SYMBOL_CHARGE,
_LV_STR_SYMBOL_PASTE,
_LV_STR_SYMBOL_BELL,
_LV_STR_SYMBOL_KEYBOARD,
_LV_STR_SYMBOL_GPS,
_LV_STR_SYMBOL_FILE,
_LV_STR_SYMBOL_WIFI,
_LV_STR_SYMBOL_BATTERY_FULL,
_LV_STR_SYMBOL_BATTERY_3,
_LV_STR_SYMBOL_BATTERY_2,
_LV_STR_SYMBOL_BATTERY_1,
_LV_STR_SYMBOL_BATTERY_EMPTY,
_LV_STR_SYMBOL_USB,
_LV_STR_SYMBOL_BLUETOOTH,
_LV_STR_SYMBOL_TRASH,
_LV_STR_SYMBOL_EDIT,
_LV_STR_SYMBOL_BACKSPACE,
_LV_STR_SYMBOL_SD_CARD,
_LV_STR_SYMBOL_NEW_LINE,
_LV_STR_SYMBOL_DUMMY,
};
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SYMBOL_DEF_H*/
|
e1d132cf4e815caed9a1631b40a7ed4497c42613
|
4b10e24e61b6d82f3a98ab8048dbd4c0de4c8d69
|
/debugger/dbtoolbar.c
|
2866001c1ae5461af063e56df17d58f3d02ebc57
|
[
"MIT"
] |
permissive
|
sputt/wabbitemu
|
85ce3d996139e0366cd65517faeaa7e0221293f0
|
48c2dc0e6d1d87bb5cf9611efbeb0d048b19c422
|
refs/heads/master
| 2023-02-07T07:23:30.216097
| 2022-12-31T19:14:36
| 2022-12-31T19:16:44
| 88,875,113
| 264
| 41
|
MIT
| 2023-01-21T06:03:56
| 2017-04-20T14:29:43
|
C
|
UTF-8
|
C
| false
| false
| 33,803
|
c
|
dbtoolbar.c
|
#include "stdafx.h"
#include "dbtoolbar.h"
#include "guicontext.h"
#include "label.h"
#include "calc.h"
extern HINSTANCE g_hInst;
static WNDPROC OldButtonProc;
#define FADE_SOLID 10
#define FADE_SPEED 20
void InitBitmapInfo(BITMAPINFO *pbmi, ULONG cbInfo, LONG cx, LONG cy, WORD bpp)
{
ZeroMemory(pbmi, cbInfo);
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biPlanes = 1;
pbmi->bmiHeader.biCompression = BI_RGB;
pbmi->bmiHeader.biWidth = cx;
pbmi->bmiHeader.biHeight = cy;
pbmi->bmiHeader.biBitCount = bpp;
}
HRESULT AddBitmapToMenuItem(HMENU hmenu, int iItem, BOOL fByPosition, HBITMAP hbmp)
{
HRESULT hr = E_FAIL;
MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_BITMAP;
mii.hbmpItem = hbmp;
if (SetMenuItemInfo(hmenu, iItem, fByPosition, &mii)) {
hr = S_OK;
}
return hr;
}
HRESULT ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE sizImage, int cxRow)
{
BITMAPINFO bmi;
InitBitmapInfo(&bmi, sizeof(bmi), sizImage.cx, sizImage.cy, 32);
HRESULT hr = E_OUTOFMEMORY;
HANDLE hHeap = GetProcessHeap();
void *pvBits = HeapAlloc(hHeap, 0, bmi.bmiHeader.biWidth * 4 * bmi.bmiHeader.biHeight);
if (pvBits) {
hr = E_UNEXPECTED;
if (GetDIBits(hdc, hbmp, 0, bmi.bmiHeader.biHeight, pvBits, &bmi, DIB_RGB_COLORS) == bmi.bmiHeader.biHeight) {
ULONG cxDelta = cxRow - bmi.bmiHeader.biWidth;
ARGB *pargbMask = (ARGB*)pvBits;
ULONG y;
for (y = bmi.bmiHeader.biHeight; y; y--) {
ULONG x;
for (x = bmi.bmiHeader.biWidth; x; x--) {
if (*pargbMask++) {
// transparent pixel
*pargb++ = 0;
} else {
// opaque pixel
*pargb++ |= 0xFF000000;
}
}
pargb += cxDelta;
}
hr = S_OK;
}
HeapFree(hHeap, 0, pvBits);
}
return hr;
}
BOOL HasAlpha(ARGB *pargb, SIZE sizImage, int cxRow)
{
ULONG cxDelta = cxRow - sizImage.cx;
ULONG y;
for (y = sizImage.cy; y; y--) {
ULONG x;
for (x = sizImage.cx; x; x--) {
if (*pargb++ & 0xFF000000) {
return TRUE;
}
}
pargb += cxDelta;
}
return FALSE;
}
static BOOL IsWindows7OrGreater() {
return TRUE;
}
void PaintToolbarBackground(HWND hwndToolbar, HDC hdc, LPRECT r) {
RECT rc;
GetClientRect(hwndToolbar, &rc);
HDC hdcBuf = CreateCompatibleDC(hdc);
HBITMAP hbmBuf = CreateCompatibleBitmap(hdc, r->right - r->left, r->bottom - r->top);
SelectObject(hdcBuf, hbmBuf);
HDC hdcRight = CreateCompatibleDC(hdcBuf);
HBITMAP hbmRight;
if (IsAppThemed()) {
const BOOL isWindows7OrGreater = IsWindows7OrGreater();
if (isWindows7OrGreater)
{
hbmRight = LoadBitmap(g_hInst, _T("TBRIGHT7"));
}
else
{
hbmRight = LoadBitmap(g_hInst, _T("TBRIGHT"));
}
SelectObject(hdcRight, hbmRight);
StretchBlt(hdcBuf, 0, 0, r->right - r->left, r->bottom - r->top,
hdcRight, 0, r->top, 1, r->bottom - r->top, SRCCOPY);
DeleteObject(hbmRight);
DeleteDC(hdcRight);
// Set up the alpha function for the bitmap with alpha values
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
// Create the header for the bitmap with alpha values
BITMAPINFO bmi;
ZeroMemory(&bmi, sizeof(BITMAPINFO));
BITMAPINFOHEADER *bi = &bmi.bmiHeader;
bi->biSize = sizeof(BITMAPINFOHEADER);
bi->biWidth = r->right - r->left;
bi->biHeight = 1;
bi->biPlanes = 1;
bi->biBitCount = 32;
bi->biCompression = BI_RGB;
int width = bi->biWidth;
int height = bi->biHeight;
if (!isWindows7OrGreater)
{
HDC hdcGrad = CreateCompatibleDC(hdc);
// Create a solid brush of the gradient color
HBRUSH hbrGrad = CreateSolidBrush(RGB(0, 190, 0));
SelectObject(hdcGrad, hbrGrad);
SelectObject(hdcGrad, GetStockObject(DC_PEN));
SetDCPenColor(hdcGrad, RGB(0, 190, 0));
BYTE *pBits;
HBITMAP hbmGrad = CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void**) &pBits, NULL, 0);
SelectObject(hdcGrad, hbmGrad);
// Fill it with green
Rectangle(hdcGrad, 0, 0, width, height);
int x;
BYTE * pPixel = pBits;
for (x = r->left; x < r->right; x++, pPixel+=4) {
pPixel[3] = (BYTE) (255*(x+1)/rc.right/8);
pPixel[0] = pPixel[0] * pPixel[3] / 0xFF;
pPixel[1] = pPixel[1] * pPixel[3] / 0xFF;
pPixel[2] = pPixel[2] * pPixel[3] / 0xFF;
}
AlphaBlend( hdcBuf, 0, 0, r->right - r->left, r->bottom - r->top,
hdcGrad, 0, 0, r->right - r->left, 1,
bf);
DeleteObject(hbrGrad);
DeleteObject(hbmGrad);
DeleteDC(hdcGrad);
}
} else {
FillRect(hdcBuf, &rc, GetSysColorBrush(COLOR_MENU));
}
BitBlt(hdc, 0, 0, r->right - r->left, r->bottom - r->top, hdcBuf, 0, 0, SRCCOPY);
DeleteObject(hbmBuf);
DeleteDC(hdcBuf);
}
VOID CALLBACK ButtonFadeProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) {
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
InvalidateRect(hwnd, NULL, FALSE);
if (tbb->bHotLit) {
if (tbb->trans_state < FADE_SOLID) {
tbb->trans_state++;
return;
}
} else {
if (tbb->trans_state > 0) {
tbb->trans_state--;
return;
}
}
tbb->bFading = FALSE;
KillTimer(hwnd, idEvent);
}
LRESULT CALLBACK ToolbarButtonProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
static int timer = 0;
switch (Message) {
case WM_CREATE:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
tbb->trans_state = 0;
tbb->bFading = FALSE;
break;
}
case WM_COMMAND:
{
TBBTN *tbb = (TBBTN *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch(wParam)
{
case DB_GOTO:
case DB_MEMPOINT_READ:
case DB_MEMPOINT_WRITE:
SendMessage(tbb->lpDebugInfo->hwndLastFocus, WM_COMMAND, wParam, 0);
break;
}
break;
}
case WM_MOUSEMOVE:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
RECT wr;
GetWindowRect(hwnd, &wr);
POINT p = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
ClientToScreen(hwnd, &p);
if (PtInRect(&wr, p)) {
if (tbb->bHotLit == FALSE) {
tbb->bHotLit = TRUE;
if (tbb->bFading == FALSE) {
tbb->bFading = TRUE;
SetTimer(hwnd, timer++, FADE_SPEED, ButtonFadeProc);
}
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
tme.dwHoverTime = 1;
TrackMouseEvent(&tme);
}
} else {
tbb->bHotLit = TRUE;
tbb->MouseState = MOUSE_UP;
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
return 0;
}
case WM_KEYDOWN:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (tbb->MouseState != MOUSE_UP)
return 0;
switch (wParam) {
case VK_LEFT:
if (tbb->prev != NULL)
SetFocus(tbb->prev->hwnd);
else {
TBBTN *last = tbb;
while (last->next != NULL)
last = last->next;
SetFocus(last->hwnd);
}
break;
case VK_RIGHT:
if (tbb->next != NULL)
SetFocus(tbb->next->hwnd);
else {
TBBTN *last = tbb;
while (last->prev != NULL)
last = last->prev;
SetFocus(last->hwnd);
}
break;
case VK_SPACE:
case VK_RETURN:
tbb->MouseState = MOUSE_DOWN;
InvalidateRect(hwnd, NULL, TRUE);
break;
}
return 0;
}
case WM_KEYUP:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (wParam) {
case VK_SPACE:
case VK_RETURN:
tbb->MouseState = MOUSE_UP;
InvalidateRect(hwnd, NULL, TRUE);
int ID = (int) GetWindowLongPtr(hwnd, GWL_ID);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(ID, BN_CLICKED), (LPARAM) hwnd);
break;
}
return 0;
}
case WM_SETFOCUS:
{
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
return 0;
}
case WM_MOUSELEAVE:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
tbb->bHotLit = FALSE;
if (tbb->bFading == FALSE) {
tbb->bFading = TRUE;
SetTimer(hwnd, timer++, FADE_SPEED, ButtonFadeProc);
}
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
return 0;
}
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
int xPos = GET_X_LPARAM(lParam);
RECT rc;
GetClientRect(hwnd, &rc);
if (xPos > rc.right - 24 && tbb->bSplitButton) {
tbb->MouseState = MOUSE_DOWN_SPLIT;
} else {
tbb->MouseState = MOUSE_DOWN;
}
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
SetCapture(hwnd);
SetFocus(hwnd);
return 0;
}
case WM_SIZE:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (tbb->next == NULL)
return 0;
RECT pr;
GetWindowRect(GetParent(hwnd), &pr);
RECT rc;
GetWindowRect(hwnd, &rc);
HWND hwndChevron;
TBBTN *chv = tbb->next;
while (chv->next != NULL)
chv = chv->next;
hwndChevron = chv->hwnd;
TCHAR buf[256];
GetWindowText(hwnd, buf, sizeof(buf));
// Did it transect the boundary
if ((rc.right > pr.right) && (rc.left < pr.right)) {
// If so, immediately hidden
ShowWindow(hwnd, SW_HIDE);
// Is there room for a chevron?
if (pr.right - rc.left > (4 + 16 + 4)) {
SetWindowPos(hwndChevron, NULL, rc.left - pr.left, rc.top - pr.top,
0, 0, SWP_NOSIZE | SWP_NOZORDER);
ShowWindow(hwndChevron, SW_SHOW);
}
// Is it past the boundary?
} else if (rc.left >= pr.right) {
ShowWindow(hwnd, SW_HIDE);
} else if ((tbb->next->hwnd != hwndChevron) && (rc.right + 4 + 4+ 16 + 4) >= pr.right) {
ShowWindow(hwnd, SW_HIDE);
SetWindowPos(hwndChevron, NULL, rc.left - pr.left, rc.top - pr.top,
0, 0, SWP_NOSIZE | SWP_NOZORDER);
ShowWindow(hwndChevron, SW_SHOW);
} else {
ShowWindow(hwnd, SW_SHOW);
ShowWindow(hwndChevron, SW_HIDE);
}
return 0;
}
case WM_LBUTTONUP:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
tbb->MouseState = MOUSE_UP;
ReleaseCapture();
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
RECT wr, rect;
GetWindowRect(hwnd, &wr);
CopyRect(&rect, &wr);
if (tbb->bSplitButton) {
wr.right -= 24;
rect.left = rect.right - 24;
}
POINT p = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
ClientToScreen(hwnd, &p);
if (PtInRect(&wr, p)) {
int ID = (int) GetWindowLongPtr(hwnd, GWL_ID);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(ID, BN_CLICKED), (LPARAM) hwnd);
}
if (PtInRect(&rect, p) && tbb->bSplitButton) {
HMENU hMenuTrackPopup = GetSubMenu(tbb->hMenu, 0);
TrackPopupMenu(hMenuTrackPopup,
TPM_LEFTALIGN | TPM_RIGHTBUTTON,
wr.left, wr.bottom + 1, 0, hwnd, NULL);
}
return 0;
}
case WM_SETTEXT:
{
SendMessage(hwnd, WM_SETREDRAW, FALSE, NULL);
DefWindowProc(hwnd, Message, wParam, lParam);
SendMessage(hwnd, WM_SETREDRAW, TRUE, NULL);
return 0;
}
case WM_PAINT:
{
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, (int) GWLP_USERDATA);
HDC hdc;
PAINTSTRUCT ps;
RECT rc;
GetClientRect(hwnd, &rc);
hdc = BeginPaint(hwnd, &ps);
HDC hdcBuf = CreateCompatibleDC(hdc);
HBITMAP hbmBuf = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);
SelectObject(hdcBuf, hbmBuf);
// Set up the alpha function for the bitmap with alpha values
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
RECT scr;
GetWindowRect(hwnd, &scr);
POINT p = { scr.left, scr.top };
ScreenToClient(GetParent(hwnd), &p);
OffsetRect(&scr, p.x - scr.left, p.y - scr.top);
// Fill the background
PaintToolbarBackground(GetParent(hwnd), hdcBuf, &scr);
if (tbb->MouseState == MOUSE_DOWN) {
HDC hdcFrame = CreateCompatibleDC(hdc);
HBITMAP hbmFrame = LoadBitmap(g_hInst, _T("TBFrameRight"));
SelectObject(hdcFrame, hbmFrame);
bf.SourceConstantAlpha = 200;
AlphaBlend( hdcBuf, 4, 0, rc.right - 8, rc.bottom,
hdcFrame, 0, 0, 1, 24,
bf);
AlphaBlend( hdcBuf, rc.right - 4, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
HBITMAP hbmFrameLeft = LoadBitmap(g_hInst, _T("TBFrameLeft"));
SelectObject(hdcFrame, hbmFrameLeft);
DeleteObject(hbmFrame);
AlphaBlend( hdcBuf, 0, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameLeft);
if (tbb->bSplitButton)
{
HBITMAP hbmFrameMiddle = LoadBitmap(g_hInst, _T("TBFrameMiddle"));
SelectObject(hdcFrame, hbmFrameMiddle);
AlphaBlend( hdcBuf, rc.right - 24, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameMiddle);
}
DeleteDC(hdcFrame);
}
else if (tbb->MouseState == MOUSE_DOWN_SPLIT) {
HDC hdcFrame = CreateCompatibleDC(hdc);
HBITMAP hbmFrame = LoadBitmap(g_hInst, _T("TBFrameRight"));
SelectObject(hdcFrame, hbmFrame);
bf.SourceConstantAlpha = 200;
AlphaBlend( hdcBuf, rc.right - 24, 0, 20, rc.bottom,
hdcFrame, 0, 0, 1, 24,
bf);
AlphaBlend( hdcBuf, rc.right - 4, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrame);
HBITMAP hbmFrameMiddle = LoadBitmap(g_hInst, _T("TBFrameMiddle"));
SelectObject(hdcFrame, hbmFrameMiddle);
AlphaBlend( hdcBuf, rc.right - 24, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameMiddle);
hbmFrame = LoadBitmap(g_hInst, _T("TBHotFrame"));
SelectObject(hdcFrame, hbmFrame);
if (hwnd == GetFocus()) {
bf.SourceConstantAlpha = 100;
} else {
bf.SourceConstantAlpha = (BYTE) (100 * tbb->trans_state / FADE_SOLID);
}
AlphaBlend( hdcBuf, 4, 0, rc.right - 8, rc.bottom,
hdcFrame, 0, 0, 1, 24,
bf);
AlphaBlend( hdcBuf, rc.right - 4, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
HBITMAP hbmFrameLeft = LoadBitmap(g_hInst, _T("TBHotFrameLeft"));
SelectObject(hdcFrame, hbmFrameLeft);
DeleteObject(hbmFrame);
AlphaBlend( hdcBuf, 0, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameLeft);
if (tbb->bSplitButton)
{
HBITMAP hbmFrameMiddle = LoadBitmap(g_hInst, _T("TBHotFrameMiddle"));
SelectObject(hdcFrame, hbmFrameMiddle);
AlphaBlend( hdcBuf, rc.right - 24, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameMiddle);
}
DeleteDC(hdcFrame);
} else {
if (tbb->bHotLit || hwnd == GetFocus() || tbb->bFading) {
HDC hdcFrame = CreateCompatibleDC(hdc);
HBITMAP hbmFrame = LoadBitmap(g_hInst, _T("TBHotFrame"));
SelectObject(hdcFrame, hbmFrame);
if (hwnd == GetFocus()) {
bf.SourceConstantAlpha = 100;
} else {
bf.SourceConstantAlpha = (BYTE) (100 * tbb->trans_state / FADE_SOLID);
}
AlphaBlend( hdcBuf, 4, 0, rc.right - 8, rc.bottom,
hdcFrame, 0, 0, 1, 24,
bf);
AlphaBlend( hdcBuf, rc.right - 4, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
HBITMAP hbmFrameLeft = LoadBitmap(g_hInst, _T("TBHotFrameLeft"));
SelectObject(hdcFrame, hbmFrameLeft);
DeleteObject(hbmFrame);
AlphaBlend( hdcBuf, 0, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameLeft);
if (tbb->bSplitButton)
{
HBITMAP hbmFrameMiddle = LoadBitmap(g_hInst, _T("TBHotFrameMiddle"));
SelectObject(hdcFrame, hbmFrameMiddle);
AlphaBlend( hdcBuf, rc.right - 24, 0, 4, rc.bottom,
hdcFrame, 0, 0, 4, 24,
bf);
DeleteObject(hbmFrameMiddle);
}
DeleteDC(hdcFrame);
}
if (tbb->bHotLit || tbb->bFading) {
// Create the header for the bitmap with alpha values
BITMAPINFO bmi;
ZeroMemory(&bmi, sizeof(BITMAPINFO));
BITMAPINFOHEADER *bi = &bmi.bmiHeader;
bi->biSize = sizeof(BITMAPINFOHEADER);
bi->biWidth = 1;
bi->biHeight = rc.bottom - 4;
bi->biPlanes = 1;
bi->biBitCount = 32;
bi->biCompression = BI_RGB;
int width = bi->biWidth;
int height = bi->biHeight;
HDC hdcGrad = CreateCompatibleDC(hdcBuf);
// Create a solid brush of the gradient color
SelectObject(hdcGrad, GetStockObject(WHITE_BRUSH));
SelectObject(hdcGrad, GetStockObject(DC_PEN));
SetDCPenColor(hdcGrad, RGB(255, 255, 255));
BYTE *pBits;
HBITMAP hbmGrad = CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void **) &pBits, NULL, 0);
SelectObject(hdcGrad, hbmGrad);
Rectangle(hdcGrad, 0, 0, width, height);
int y;
BYTE * pPixel = pBits;
for (y = 0; y < height; y++, pPixel+=4) {
pPixel[3] = (BYTE)(255 * (y + 1) / height / 3);
pPixel[0] = pPixel[0] * pPixel[3] / 0xFF;
pPixel[1] = pPixel[1] * pPixel[3] / 0xFF;
pPixel[2] = pPixel[2] * pPixel[3] / 0xFF;
}
bf.SourceConstantAlpha = (BYTE)(100 * tbb->trans_state / FADE_SOLID);
AlphaBlend( hdcBuf, 2, 2, rc.right - 4, rc.bottom - 4,
hdcGrad, 0, 0, 1, height,
bf);
DeleteObject(hbmGrad);
DeleteDC(hdcGrad);
}
}
bf.SourceConstantAlpha = 255;
int ox = 0, oy = 0;
if (tbb->MouseState == MOUSE_DOWN || tbb->MouseState == MOUSE_DOWN_SPLIT)
ox = oy = 1;
const BOOL isWindows7OrGreater = IsWindows7OrGreater();
if (tbb->bSplitButton)
{
HDC hdcDownBtn = CreateCompatibleDC(hdc);
HBITMAP hbmDownArrow;
if (isWindows7OrGreater) {
hbmDownArrow = LoadBitmap(g_hInst, _T("TBDownArrow7"));
} else {
hbmDownArrow = LoadBitmap(g_hInst, _T("TBDownArrow"));
}
SelectObject(hdcDownBtn, hbmDownArrow);
AlphaBlend( hdcBuf, rc.right - 20 + ox, 3 + oy, 16, 16,
hdcDownBtn, 0, 0, 16, 16,
bf);
DeleteBitmap(hbmDownArrow);
DeleteDC(hdcDownBtn);
}
if (tbb->MouseState == MOUSE_DOWN_SPLIT)
ox = oy = 0;
HDC hdcBtn = CreateCompatibleDC(hdc);
HBITMAP hbmPrior = (HBITMAP) SelectObject(hdcBtn, tbb->hbmIcon);
AlphaBlend( hdcBuf, 4 + ox, 4 + oy, 16, 16,
hdcBtn, 0, 0, 16, 16,
bf);
SetBkMode(hdcBuf, TRANSPARENT);
SelectObject(hdcBuf, tbb->lpDebugInfo->hfontSegoe);
TCHAR szTitle[32];
GetWindowText(hwnd, szTitle, 32);
RECT r = {16 + 9 + ox, 2 + oy, 400 + ox, 24 + oy};
if (!isWindows7OrGreater) {
SetTextColor(hdcBuf, RGB(30, 57, 91));
} else {
SetTextColor(hdcBuf, RGB(0, 0, 0));
}
DrawText(hdcBuf, szTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_VCENTER);
if (!isWindows7OrGreater) {
OffsetRect(&r, -1, -1);
SetTextColor(hdcBuf, RGB(255, 255, 255));
DrawText(hdcBuf, szTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_VCENTER);
}
SelectObject(hdcBtn, hbmPrior);
DeleteDC(hdcBtn);
BitBlt(hdc, 0, 0, rc.right, rc.bottom, hdcBuf, 0, 0, SRCCOPY);
DeleteObject(hbmBuf);
DeleteDC(hdcBuf);
EndPaint(hwnd, &ps);
return 0;
}
case WM_CLOSE:
DestroyWindow(hwnd);
return 0;
case WM_DESTROY: {
TBBTN *tbb = (TBBTN *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
DeleteObject(tbb->hbmIcon);
free(tbb);
return 0;
}
default:
return CallWindowProc(OldButtonProc, hwnd, Message, wParam, lParam);
}
return CallWindowProc(OldButtonProc, hwnd, Message, wParam, lParam);
}
static TBBTN *prevBtn = NULL;
int CreateToolbarButton(HWND hwndParent, LPDEBUGWINDOWINFO lpDebugInfo, TCHAR *szCaption, TCHAR *szTooltip,
TCHAR *szIcon, int x, int y, int ID, BOOL splitButton = FALSE, HMENU hMenu = NULL)
{
static HWND hwndTip = NULL;
TBBTN *tbb = (TBBTN *) malloc(sizeof(TBBTN));
memset(tbb, 0, sizeof(TBBTN));
tbb->hbmIcon = LoadBitmap(g_hInst, szIcon);
tbb->bHotLit = FALSE;
tbb->MouseState = MOUSE_UP;
tbb->bSplitButton = splitButton;
tbb->prev = prevBtn;
tbb->lpDebugInfo = lpDebugInfo;
if (prevBtn)
prevBtn->next = tbb;
tbb->next = NULL;
HWND hwndBtn = CreateWindow(
_T("BUTTON"),
szCaption,
WS_CHILD | BS_PUSHBUTTON,
x, y, 60, 24,
hwndParent, (HMENU) ID, g_hInst, NULL);
SetWindowFont(hwndBtn, lpDebugInfo->hfontSegoe, FALSE);
tbb->hwnd = hwndBtn;
prevBtn = tbb;
HDC hdc = GetDC(hwndBtn);
RECT r = {0, 0, 0, 0};
SelectObject(hdc, lpDebugInfo->hfontSegoe);
DrawText(hdc, szCaption, (int) _tcslen(szCaption), &r, DT_CALCRECT);
ReleaseDC(hwndBtn, hdc);
int img_sz_seperator = 8;
if (_tcslen(szCaption) == 0)
img_sz_seperator = 0;
int splitSize = 0;
if (tbb->bSplitButton) {
splitSize = 20;
tbb->hMenu = hMenu;
}
MoveWindow(hwndBtn, x, y, 4 + 16 + img_sz_seperator + splitSize + r.right + 4, 24, FALSE);
ShowWindow(hwndBtn, SW_SHOW);
OldButtonProc = (WNDPROC) GetWindowLongPtr(hwndBtn, GWLP_WNDPROC);
SetWindowLongPtr(hwndBtn, GWLP_WNDPROC, (LONG_PTR) ToolbarButtonProc);
SetWindowLongPtr(hwndBtn, GWLP_USERDATA, (LONG_PTR) tbb);
if (hwndTip == NULL) {
hwndTip = CreateWindowEx(
(DWORD)NULL,
TOOLTIPS_CLASS,
NULL, WS_POPUP | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwndParent, NULL, g_hInst, NULL);
SetWindowPos(hwndTip, HWND_TOPMOST,0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
SendMessage(hwndTip, TTM_ACTIVATE, TRUE, 0);
}
TOOLINFO toolInfo = {0};
toolInfo.cbSize = sizeof(toolInfo);
toolInfo.hwnd = hwndParent;
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
toolInfo.uId = (UINT_PTR) hwndBtn;
toolInfo.lpszText = szTooltip;
SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM) &toolInfo);
return x + 4 + 16 + 8 + r.right + 4 + 4 + splitSize;
}
BOOL CALLBACK EnumToolbarRedraw(HWND hwndChild, LPARAM) {
SendMessage(hwndChild, WM_SIZE, 0, 0);
InvalidateRect(hwndChild, NULL, FALSE);
UpdateWindow(hwndChild);
return TRUE;
}
static HMENU rewindmenu;
HMENU CreateRewindMenu() {
rewindmenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_DISASM_REWIND_MENU));
return rewindmenu;
}
const TCHAR *stopText = _T("Stop");
const TCHAR *runText = _T("Run");
void ChangeRunButtonIconAndText(LPCALC lpCalc, LPVOID lParam) {
// this will change so the run/stop button says Stop
HWND hButton = FindWindowEx((HWND) lParam, NULL, WC_BUTTON, lpCalc->running ? runText : stopText);
TBBTN *tbb = (TBBTN *)GetWindowLongPtr(hButton, GWLP_USERDATA);
if (tbb == NULL) {
return;
}
if (tbb->hbmIcon)
DeleteObject(tbb->hbmIcon);
if (lpCalc->running) {
tbb->hbmIcon = LoadBitmap(g_hInst, _T("DBStop"));
Edit_SetText(tbb->hwnd, stopText);
} else {
tbb->hbmIcon = LoadBitmap(g_hInst, _T("DBRun"));
Edit_SetText(tbb->hwnd, runText);
}
RECT rc;
GetClientRect(tbb->hwnd, &rc);
InvalidateRect(tbb->hwnd, &rc, TRUE);
}
enum {
RUN_ID = 999,
BREAK_ID,
MEM_BREAK_ID,
STEP_ID,
STEP_OVER_ID,
STEP_BACK_ID,
GOTO_ID,
CHEVRON_ID
};
LRESULT CALLBACK ToolBarProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
LPDEBUGWINDOWINFO lpDebugInfo = (LPDEBUGWINDOWINFO) GetWindowLongPtr(hwnd, GWLP_USERDATA);
LPCALC lpCalc = NULL;
if (lpDebugInfo != NULL) {
lpCalc = lpDebugInfo->lpCalc;
}
switch (Message) {
case WM_CREATE: {
lpDebugInfo = (LPDEBUGWINDOWINFO) ((LPCREATESTRUCT) lParam)->lpCreateParams;
LPCALC lpCalc = lpDebugInfo->lpCalc;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)lpDebugInfo);
prevBtn = NULL;
SelectObject(GetDC(hwnd), lpDebugInfo->hfontSegoe);
int next = 4;
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Run"),
_T("Run the calculator."),
_T("DBRun"),
next,
4,
RUN_ID);
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Toggle Breakpoint"),
_T("Toggle the breakpoint on the current selection."),
_T("DBBreak"),
next,
4,
BREAK_ID);
HMENU hmenu = LoadMenu(g_hInst, (LPCTSTR) IDR_DISASM_WATCH_MENU);
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Toggle Watchpoint"),
_T("Toggle a memory breakpoint at the current selection."),
_T("DBMemBreak"),
next,
4,
MEM_BREAK_ID,
TRUE,
hmenu);
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Step"),
_T("Run a single command."),
_T("DBStep"),
next,
4,
STEP_ID);
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Step Over"),
_T("Run a single line."),
_T("DBStepOver"),
next,
4,
STEP_OVER_ID);
#ifdef WITH_REVERSE
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Step Back"),
_T("Reverses a single command."),
_T("DBStepBack"),
next,
4,
STEP_BACK_ID);
#endif
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T("Goto"),
_T("Goto an address in RAM or Flash."),
_T("DBGoto"),
next,
4,
GOTO_ID);
TCHAR *szChevronBMP;
if (IsWindows7OrGreater()) {
szChevronBMP = _T("CHEVRON7");
} else {
szChevronBMP = _T("CHEVRON");
}
next = CreateToolbarButton(hwnd,
lpDebugInfo,
_T(""),
_T("Display additional commands."),
szChevronBMP,
next,
4,
CHEVRON_ID);
calc_register_event(lpCalc, ROM_RUNNING_EVENT, &ChangeRunButtonIconAndText, hwnd);
return 0;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case DB_BREAKPOINT:
case DB_MEMPOINT_READ:
case DB_MEMPOINT_WRITE:
SendMessage(lpDebugInfo->hwndLastFocus, WM_COMMAND, wParam, 0);
break;
case RUN_ID: {
if (lpCalc->running) {
SendMessage(GetParent(hwnd), WM_COMMAND, DB_STOP, 0);
} else {
SendMessage(GetParent(hwnd), WM_COMMAND, DB_RUN, 0);
}
break;
}
case BREAK_ID:
SendMessage(GetParent(hwnd), WM_COMMAND, DB_BREAKPOINT, 0);
break;
case MEM_BREAK_ID:
SendMessage(GetParent(hwnd), WM_COMMAND, DB_MEMPOINT_WRITE, 0);
break;
case STEP_ID:
SendMessage(GetParent(hwnd), WM_COMMAND, DB_STEP, 0);
break;
case STEP_OVER_ID:
SendMessage(GetParent(hwnd), WM_COMMAND, DB_STEPOVER, 0);
break;
case GOTO_ID:
SendMessage(GetParent(hwnd), WM_COMMAND, DB_GOTO, 0);
break;
case STEP_BACK_ID:
SendMessage(GetParent(hwnd), WM_COMMAND, DB_STEPBACK, 0);
break;
case CHEVRON_ID:
{
HMENU hmenu = CreatePopupMenu();
MENUITEMINFO mii;
BITMAPINFO biMenu;
biMenu.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
biMenu.bmiHeader.biPlanes = 1;
biMenu.bmiHeader.biCompression = BI_RGB;
biMenu.bmiHeader.biWidth = 16;
biMenu.bmiHeader.biHeight = 16;
biMenu.bmiHeader.biBitCount = 32;
biMenu.bmiHeader.biSizeImage = 0;
biMenu.bmiHeader.biXPelsPerMeter = 0;
biMenu.bmiHeader.biYPelsPerMeter = 0;
biMenu.bmiHeader.biClrUsed = 0;
biMenu.bmiHeader.biClrImportant = 0;
void **ppvBits;
CreateDIBSection(GetDC(hwnd), &biMenu, DIB_RGB_COLORS, (void **) &ppvBits, NULL, 0);
TCHAR WindowText[256];
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STATE | MIIM_ID | MIIM_STRING | MIIM_BITMAP;
mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED;
mii.hSubMenu = NULL;
mii.hbmpChecked = NULL;
mii.hbmpUnchecked = NULL;
mii.dwItemData = 0;
mii.dwTypeData = WindowText;
TBBTN *tbb = (TBBTN *) GetWindowLongPtr((HWND) lParam, GWLP_USERDATA);
//tbb->bMouseDown = TRUE;
tbb = tbb->prev;
BITMAPINFO *pbmi = (BITMAPINFO *) malloc(sizeof(BITMAPINFO));
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biWidth = 16;
pbmi->bmiHeader.biHeight = 16;
pbmi->bmiHeader.biPlanes = 1;
pbmi->bmiHeader.biBitCount = 32;
pbmi->bmiHeader.biCompression = BI_RGB;
pbmi->bmiHeader.biSizeImage = 0;
pbmi->bmiHeader.biXPelsPerMeter = 90;
pbmi->bmiHeader.biYPelsPerMeter = 90;
pbmi->bmiHeader.biClrUsed = 0;
pbmi->bmiHeader.biClrImportant = 0;
void *pvBits;
HDC hdcTemp = CreateCompatibleDC(GetDC(hwnd));
//DeleteDC(hdcTemp);
int i;
for (i = 0; tbb != NULL && !IsWindowVisible(tbb->hwnd); i++, tbb = tbb->prev) {
if (tbb->bSplitButton)
{
GetWindowText(tbb->hwnd, WindowText, sizeof(WindowText));
HMENU hMenuToAdd = GetSubMenu(tbb->hMenu, 0);
InsertMenu(hmenu, mii.wID, MF_POPUP | MF_STRING| MF_BYPOSITION, (UINT) hMenuToAdd, WindowText);
} else {
mii.cch = GetWindowText(tbb->hwnd, WindowText, sizeof(WindowText));
mii.wID = 1005-i;
HBITMAP hbmDIB = CreateDIBSection(
GetDC(hwnd),
pbmi,
DIB_RGB_COLORS,
&pvBits,
NULL,
0
);
if (hbmDIB == NULL) {
MessageBox(NULL, _T("fuck"), _T("fuck"), MB_OK);
break;
}
HBITMAP hbmBackup = (HBITMAP) SelectObject(hdcTemp, hbmDIB);
HDC hdcIcon = CreateCompatibleDC(GetDC(hwnd));
HBITMAP hbmBackup2 = (HBITMAP) SelectObject(hdcIcon, tbb->hbmIcon);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
BitBlt( hdcTemp, 0, 0, 16, 16,
hdcIcon, 0, 0,
SRCCOPY);
SelectObject(hdcIcon, hbmBackup2);
DeleteDC(hdcIcon);
SelectObject(hdcTemp, hbmBackup);
mii.hbmpItem = hbmDIB;
if (InsertMenuItem(hmenu, 0, TRUE, &mii) == FALSE) {
_tprintf_s(_T("Failed to insert\n"));
}
}
}
RECT r;
GetWindowRect((HWND) lParam, &r);
OnContextMenu(hwnd, r.left, r.bottom, hmenu);
break;
}
}
return 0;
case WM_NOTIFY: {
return 0;
}
case WM_PAINT: {
RECT rc;
GetClientRect(hwnd, &rc);
const BOOL isWindows7OrGreater = IsWindows7OrGreater();
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd, &ps);
HDC hdcBuf = CreateCompatibleDC(hdc);
HBITMAP hbmBuf = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);
SelectObject(hdcBuf, hbmBuf);
if (IsAppThemed()) {
HDC hdcRight = CreateCompatibleDC(hdcBuf);
HBITMAP hbmRight = LoadBitmap(g_hInst, isWindows7OrGreater ? _T("TBRIGHT7") : _T("TBRIGHT"));
SelectObject(hdcRight, hbmRight);
if (rc.right > 3 + 120) {
StretchBlt(hdcBuf, 3, 0, rc.right - 123, 32, hdcRight, 0, 0, 1, 32, SRCCOPY);
}
BitBlt(hdcBuf, rc.right - 120, 0, 120, 32, hdcRight, 0, 0, SRCCOPY);
DeleteObject(hbmRight);
DeleteDC(hdcRight);
HDC hdcLeft = CreateCompatibleDC(hdcBuf);
HBITMAP hbmLeft = LoadBitmap(g_hInst, isWindows7OrGreater ? _T("TBLEFT7") : _T("TBLEFT"));
SelectObject(hdcLeft, hbmLeft);
BitBlt(hdcBuf, 0, 0, 3, 32, hdcLeft, 0, 0, SRCCOPY);
DeleteObject(hbmLeft);
DeleteDC(hdcLeft);
} else {
FillRect(hdcBuf, &rc, GetSysColorBrush(COLOR_MENU));
}
// Set up the alpha function for the bitmap with alpha values
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
// Create the header for the bitmap with alpha values
BITMAPINFO bmi;
ZeroMemory(&bmi, sizeof(BITMAPINFO));
BITMAPINFOHEADER *bi = &bmi.bmiHeader;
bi->biSize = sizeof(BITMAPINFOHEADER);
bi->biWidth = rc.right;
bi->biHeight = 1;
bi->biPlanes = 1;
bi->biBitCount = 32;
bi->biCompression = BI_RGB;
int width = bi->biWidth;
int height = bi->biHeight;
if (!isWindows7OrGreater)
{
HDC hdcGrad = CreateCompatibleDC(hdc);
// Create a solid brush of the gradient color
HBRUSH hbrGrad = CreateSolidBrush(RGB(0, 190, 0));
SelectObject(hdcGrad, hbrGrad);
SelectObject(hdcGrad, GetStockObject(DC_PEN));
SetDCPenColor(hdcGrad, RGB(0, 190, 0));
BYTE *pBits;
HBITMAP hbmGrad = CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void**) &pBits, NULL, 0);
SelectObject(hdcGrad, hbmGrad);
// Fill it with green
Rectangle(hdcGrad, 0, 0, width, height);
int x;
BYTE * pPixel = pBits;
for (x = 0; x < width; x++, pPixel+=4) {
pPixel[3] = (BYTE)(255 * (x + 1) / width / 8);
pPixel[0] = pPixel[0] * pPixel[3] / 0xFF;
pPixel[1] = pPixel[1] * pPixel[3] / 0xFF;
pPixel[2] = pPixel[2] * pPixel[3] / 0xFF;
}
AlphaBlend( hdcBuf, 0, 0, rc.right, rc.bottom,
hdcGrad, 0, 0, width, 1,
bf);
DeleteObject(hbmGrad);
DeleteObject(hbrGrad);
DeleteDC(hdcGrad);
}
BitBlt(hdc, 0, 0, rc.right, rc.bottom, hdcBuf, 0, 0, SRCCOPY);
DeleteObject(hbmBuf);
DeleteDC(hdcBuf);
EndPaint(hwnd, &ps);
break;
}
case WM_ERASEBKGND:
return 0;
case WM_SIZE:
InvalidateRect(hwnd, NULL, FALSE);
UpdateWindow(hwnd);
EnumChildWindows(hwnd, EnumToolbarRedraw, 0);
return 0;
case WM_USER:
InvalidateRect(hwnd, NULL, FALSE);
return 0;
case WM_DESTROY:
calc_unregister_event(lpCalc, ROM_RUNNING_EVENT, &ChangeRunButtonIconAndText, hwnd);
return 0;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
|
95c8143b21a70f3baeefbe7de2fbaaaa09477385
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/VBox/Devices/Network/slirp/bsd/kern/kern_mbuf.c
|
c908e2fdffddfc686aef8c13403bc19dad647b67
|
[
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL",
"BSD-2-Clause",
"MIT"
] |
permissive
|
thalium/icebox
|
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
|
6f78952d58da52ea4f0e55b2ab297f28e80c1160
|
refs/heads/master
| 2022-08-14T00:19:36.984579
| 2022-02-22T13:10:31
| 2022-02-22T13:10:31
| 190,019,914
| 585
| 109
|
MIT
| 2022-01-13T20:58:15
| 2019-06-03T14:18:12
|
C++
|
UTF-8
|
C
| false
| false
| 21,503
|
c
|
kern_mbuf.c
|
/*-
* Copyright (c) 2004, 2005,
* Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice unmodified, this list of conditions and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef VBOX
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/kern/kern_mbuf.c,v 1.32.2.5.2.1 2009/04/15 03:14:26 kensmith Exp $");
#include "opt_mac.h"
#include "opt_param.h"
#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/protosw.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
#include <vm/uma_dbg.h>
#else
# include <iprt/param.h>
# include <slirp.h>
# define IN_BSD
# include "ext.h"
#endif
/*
* In FreeBSD, Mbufs and Mbuf Clusters are allocated from UMA
* Zones.
*
* Mbuf Clusters (2K, contiguous) are allocated from the Cluster
* Zone. The Zone can be capped at kern.ipc.nmbclusters, if the
* administrator so desires.
*
* Mbufs are allocated from a UMA Master Zone called the Mbuf
* Zone.
*
* Additionally, FreeBSD provides a Packet Zone, which it
* configures as a Secondary Zone to the Mbuf Master Zone,
* thus sharing backend Slab kegs with the Mbuf Master Zone.
*
* Thus common-case allocations and locking are simplified:
*
* m_clget() m_getcl()
* | |
* | .------------>[(Packet Cache)] m_get(), m_gethdr()
* | | [ Packet ] |
* [(Cluster Cache)] [ Secondary ] [ (Mbuf Cache) ]
* [ Cluster Zone ] [ Zone ] [ Mbuf Master Zone ]
* | \________ |
* [ Cluster Keg ] \ /
* | [ Mbuf Keg ]
* [ Cluster Slabs ] |
* | [ Mbuf Slabs ]
* \____________(VM)_________________/
*
*
* Whenever an object is allocated with uma_zalloc() out of
* one of the Zones its _ctor_ function is executed. The same
* for any deallocation through uma_zfree() the _dtor_ function
* is executed.
*
* Caches are per-CPU and are filled from the Master Zone.
*
* Whenever an object is allocated from the underlying global
* memory pool it gets pre-initialized with the _zinit_ functions.
* When the Keg's are overfull objects get decomissioned with
* _zfini_ functions and free'd back to the global memory pool.
*
*/
#ifndef VBOX
int nmbclusters; /* limits number of mbuf clusters */
int nmbjumbop; /* limits number of page size jumbo clusters */
int nmbjumbo9; /* limits number of 9k jumbo clusters */
int nmbjumbo16; /* limits number of 16k jumbo clusters */
struct mbstat mbstat;
#endif
/*
* tunable_mbinit() has to be run before init_maxsockets() thus
* the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets()
* runs at SI_ORDER_ANY.
*/
static void
tunable_mbinit(void *dummy)
{
#ifdef VBOX
PNATState pData = (PNATState)dummy;
#endif
/* This has to be done before VM init. */
nmbclusters = 1024 + maxusers * 64;
nmbjumbop = nmbclusters / 2;
nmbjumbo9 = nmbjumbop / 2;
nmbjumbo16 = nmbjumbo9 / 2;
TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
}
SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
#ifndef VBOX
/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
static int
sysctl_nmbclusters(SYSCTL_HANDLER_ARGS)
{
int error, newnmbclusters;
newnmbclusters = nmbclusters;
error = sysctl_handle_int(oidp, &newnmbclusters, 0, req);
if (error == 0 && req->newptr) {
if (newnmbclusters > nmbclusters) {
nmbclusters = newnmbclusters;
uma_zone_set_max(zone_clust, nmbclusters);
EVENTHANDLER_INVOKE(nmbclusters_change);
} else
error = EINVAL;
}
return (error);
}
SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbclusters, CTLTYPE_INT|CTLFLAG_RW,
&nmbclusters, 0, sysctl_nmbclusters, "IU",
"Maximum number of mbuf clusters allowed");
static int
sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS)
{
int error, newnmbjumbop;
newnmbjumbop = nmbjumbop;
error = sysctl_handle_int(oidp, &newnmbjumbop, 0, req);
if (error == 0 && req->newptr) {
if (newnmbjumbop> nmbjumbop) {
nmbjumbop = newnmbjumbop;
uma_zone_set_max(zone_jumbop, nmbjumbop);
} else
error = EINVAL;
}
return (error);
}
SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumbop, CTLTYPE_INT|CTLFLAG_RW,
&nmbjumbop, 0, sysctl_nmbjumbop, "IU",
"Maximum number of mbuf page size jumbo clusters allowed");
static int
sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS)
{
int error, newnmbjumbo9;
newnmbjumbo9 = nmbjumbo9;
error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req);
if (error == 0 && req->newptr) {
if (newnmbjumbo9> nmbjumbo9) {
nmbjumbo9 = newnmbjumbo9;
uma_zone_set_max(zone_jumbo9, nmbjumbo9);
} else
error = EINVAL;
}
return (error);
}
SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumbo9, CTLTYPE_INT|CTLFLAG_RW,
&nmbjumbo9, 0, sysctl_nmbjumbo9, "IU",
"Maximum number of mbuf 9k jumbo clusters allowed");
static int
sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS)
{
int error, newnmbjumbo16;
newnmbjumbo16 = nmbjumbo16;
error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req);
if (error == 0 && req->newptr) {
if (newnmbjumbo16> nmbjumbo16) {
nmbjumbo16 = newnmbjumbo16;
uma_zone_set_max(zone_jumbo16, nmbjumbo16);
} else
error = EINVAL;
}
return (error);
}
SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumbo16, CTLTYPE_INT|CTLFLAG_RW,
&nmbjumbo16, 0, sysctl_nmbjumbo16, "IU",
"Maximum number of mbuf 16k jumbo clusters allowed");
SYSCTL_STRUCT(_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD, &mbstat, mbstat,
"Mbuf general information and statistics");
/*
* Zones from which we allocate.
*/
uma_zone_t zone_mbuf;
uma_zone_t zone_clust;
uma_zone_t zone_pack;
uma_zone_t zone_jumbop;
uma_zone_t zone_jumbo9;
uma_zone_t zone_jumbo16;
uma_zone_t zone_ext_refcnt;
/*
* Local prototypes.
*/
static int mb_ctor_mbuf(void *, int, void *, int);
static int mb_ctor_clust(void *, int, void *, int);
static int mb_ctor_pack(void *, int, void *, int);
static void mb_dtor_mbuf(void *, int, void *);
static void mb_dtor_clust(void *, int, void *);
static void mb_dtor_pack(void *, int, void *);
static int mb_zinit_pack(void *, int, int);
static void mb_zfini_pack(void *, int);
#else
/*
* Local prototypes.
*/
static int mb_ctor_mbuf(PNATState, void *, int, void *, int);
static int mb_ctor_clust(PNATState, void *, int, void *, int);
static int mb_ctor_pack(PNATState, void *, int, void *, int);
static void mb_dtor_mbuf(PNATState, void *, int, void *);
static void mb_dtor_clust(PNATState, void *, int, void *);
static void mb_dtor_pack(PNATState, void *, int, void *);
static int mb_zinit_pack(PNATState, void *, int, int);
static void mb_zfini_pack(PNATState, void *, int);
#endif
/*static void mb_reclaim(void *); - unused */
#ifndef VBOX
static void mbuf_init(void *);
static void *mbuf_jumbo_alloc(uma_zone_t, int, u_int8_t *, int);
static void mbuf_jumbo_free(void *, int, u_int8_t);
#endif
#ifndef VBOX
static MALLOC_DEFINE(M_JUMBOFRAME, "jumboframes", "mbuf jumbo frame buffers");
/* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */
CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE);
#else
#define uma_zcreate(a0, a1, a2, a3, a4, a5, a6, a7) \
uma_zcreate(pData, a0, a1, a2, a3, a4, a5, a6, a7)
#endif
/*
* Initialize FreeBSD Network buffer allocation.
*/
SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL);
#ifndef VBOX
static void
#else
void
#endif
mbuf_init(void *dummy)
{
/*
* Configure UMA zones for Mbufs, Clusters, and Packets.
*/
#ifndef VBOX
zone_mbuf = uma_zcreate(MBUF_MEM_NAME, MSIZE,
mb_ctor_mbuf, mb_dtor_mbuf,
#ifdef INVARIANTS
trash_init, trash_fini,
#else
NULL, NULL,
#endif
MSIZE - 1, UMA_ZONE_MAXBUCKET);
zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES,
mb_ctor_clust, mb_dtor_clust,
#ifdef INVARIANTS
trash_init, trash_fini,
#else
NULL, NULL,
#endif
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
#else /*!VBOX*/
PNATState pData = (PNATState)dummy;
tunable_mbinit(pData);
zone_mbuf = uma_zcreate(MBUF_MEM_NAME, MSIZE,
mb_ctor_mbuf, mb_dtor_mbuf,
NULL, NULL,
MSIZE - 1, UMA_ZONE_MAXBUCKET);
if (nmbclusters > 0)
uma_zone_set_max(zone_mbuf, nmbclusters);
zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES,
mb_ctor_clust, mb_dtor_clust,
NULL, NULL,
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
#endif /*VBOX*/
if (nmbclusters > 0)
uma_zone_set_max(zone_clust, nmbclusters);
zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack,
mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf);
/* Make jumbo frame zone too. Page size, 9k and 16k. */
#ifndef VBOX
zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE,
mb_ctor_clust, mb_dtor_clust,
#ifdef INVARIANTS
trash_init, trash_fini,
#else
NULL, NULL,
#endif
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbop > 0)
uma_zone_set_max(zone_jumbop, nmbjumbop);
zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES,
mb_ctor_clust, mb_dtor_clust,
#ifdef INVARIANTS
trash_init, trash_fini,
#else
NULL, NULL,
#endif
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbo9 > 0)
uma_zone_set_max(zone_jumbo9, nmbjumbo9);
uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc);
uma_zone_set_freef(zone_jumbo9, mbuf_jumbo_free);
zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES,
mb_ctor_clust, mb_dtor_clust,
#ifdef INVARIANTS
trash_init, trash_fini,
#else
NULL, NULL,
#endif
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbo16 > 0)
uma_zone_set_max(zone_jumbo16, nmbjumbo16);
#else /*!VBOX*/
zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE,
mb_ctor_clust, mb_dtor_clust,
NULL, NULL,
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbop > 0)
uma_zone_set_max(zone_jumbop, nmbjumbop);
zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES,
mb_ctor_clust, mb_dtor_clust,
NULL, NULL,
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbo9 > 0)
uma_zone_set_max(zone_jumbo9, nmbjumbo9);
zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES,
mb_ctor_clust, mb_dtor_clust,
NULL, NULL,
UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
if (nmbjumbo16 > 0)
uma_zone_set_max(zone_jumbo16, nmbjumbo16);
#endif /*VBOX*/
zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int),
NULL, NULL,
NULL, NULL,
UMA_ALIGN_PTR, UMA_ZONE_ZINIT);
/* uma_prealloc() goes here... */
/*
* Hook event handler for low-memory situation, used to
* drain protocols and push data back to the caches (UMA
* later pushes it back to VM).
*/
EVENTHANDLER_REGISTER(vm_lowmem, mb_reclaim, NULL,
EVENTHANDLER_PRI_FIRST);
/*
* [Re]set counters and local statistics knobs.
* XXX Some of these should go and be replaced, but UMA stat
* gathering needs to be revised.
*/
mbstat.m_mbufs = 0;
mbstat.m_mclusts = 0;
mbstat.m_drain = 0;
mbstat.m_msize = MSIZE;
mbstat.m_mclbytes = MCLBYTES;
mbstat.m_minclsize = MINCLSIZE;
mbstat.m_mlen = MLEN;
mbstat.m_mhlen = MHLEN;
mbstat.m_numtypes = MT_NTYPES;
mbstat.m_mcfail = mbstat.m_mpfail = 0;
mbstat.sf_iocnt = 0;
mbstat.sf_allocwait = mbstat.sf_allocfail = 0;
}
#ifndef VBOX
/*
* UMA backend page allocator for the jumbo frame zones.
*
* Allocates kernel virtual memory that is backed by contiguous physical
* pages.
*/
static void *
mbuf_jumbo_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int fWait)
{
/* Inform UMA that this allocator uses kernel_map/object. */
*flags = UMA_SLAB_KERNEL;
return (contigmalloc(bytes, M_JUMBOFRAME, fWait, (vm_paddr_t)0,
~(vm_paddr_t)0, 1, 0));
}
/*
* UMA backend page deallocator for the jumbo frame zones.
*/
static void
mbuf_jumbo_free(void *mem, int size, u_int8_t flags)
{
contigfree(mem, size, M_JUMBOFRAME);
}
#endif
/*
* Constructor for Mbuf master zone.
*
* The 'arg' pointer points to a mb_args structure which
* contains call-specific information required to support the
* mbuf allocation API. See mbuf.h.
*/
static int
#ifndef VBOX
mb_ctor_mbuf(void *mem, int size, void *arg, int how)
#else
mb_ctor_mbuf(PNATState pData, void *mem, int size, void *arg, int how)
#endif
{
struct mbuf *m;
struct mb_args *args;
#ifdef MAC
int error;
#endif
int flags;
short type;
#ifdef VBOX
NOREF(pData);
#endif
#ifdef INVARIANTS
trash_ctor(mem, size, arg, how);
#elif defined(VBOX)
NOREF(size);
NOREF(how);
#endif
m = (struct mbuf *)mem;
args = (struct mb_args *)arg;
flags = args->flags;
type = args->type;
/*
* The mbuf is initialized later. The caller has the
* responsibility to set up any MAC labels too.
*/
if (type == MT_NOINIT)
return (0);
m->m_next = NULL;
m->m_nextpkt = NULL;
m->m_len = 0;
m->m_flags = flags;
m->m_type = type;
if (flags & M_PKTHDR) {
m->m_data = m->m_pktdat;
m->m_pkthdr.rcvif = NULL;
m->m_pkthdr.len = 0;
m->m_pkthdr.header = NULL;
m->m_pkthdr.csum_flags = 0;
m->m_pkthdr.csum_data = 0;
m->m_pkthdr.tso_segsz = 0;
m->m_pkthdr.ether_vtag = 0;
SLIST_INIT(&m->m_pkthdr.tags);
#ifdef MAC
/* If the label init fails, fail the alloc */
error = mac_init_mbuf(m, how);
if (error)
return (error);
#endif
} else
m->m_data = m->m_dat;
return (0);
}
/*
* The Mbuf master zone destructor.
*/
static void
#ifndef VBOX
mb_dtor_mbuf(void *mem, int size, void *arg)
#else
mb_dtor_mbuf(PNATState pData, void *mem, int size, void *arg)
#endif
{
struct mbuf *m;
uintptr_t flags;
#ifdef VBOX
NOREF(pData);
#endif
m = (struct mbuf *)mem;
flags = (uintptr_t)arg;
if ((flags & MB_NOTAGS) == 0 && (m->m_flags & M_PKTHDR) != 0)
m_tag_delete_chain(m, NULL);
KASSERT((m->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__));
KASSERT((m->m_flags & M_NOFREE) == 0, ("%s: M_NOFREE set", __func__));
#ifdef INVARIANTS
trash_dtor(mem, size, arg);
#elif defined(VBOX)
NOREF(size);
NOREF(arg);
#endif
}
/*
* The Mbuf Packet zone destructor.
*/
static void
#ifndef VBOX
mb_dtor_pack(void *mem, int size, void *arg)
#else
mb_dtor_pack(PNATState pData, void *mem, int size, void *arg)
#endif
{
struct mbuf *m;
m = (struct mbuf *)mem;
if ((m->m_flags & M_PKTHDR) != 0)
m_tag_delete_chain(m, NULL);
/* Make sure we've got a clean cluster back. */
KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__));
KASSERT(m->m_ext.ext_buf != NULL, ("%s: ext_buf == NULL", __func__));
KASSERT(m->m_ext.ext_free == NULL, ("%s: ext_free != NULL", __func__));
KASSERT(m->m_ext.ext_args == NULL, ("%s: ext_args != NULL", __func__));
KASSERT(m->m_ext.ext_size == MCLBYTES, ("%s: ext_size != MCLBYTES", __func__));
KASSERT(m->m_ext.ext_type == EXT_PACKET, ("%s: ext_type != EXT_PACKET", __func__));
KASSERT(*m->m_ext.ref_cnt == 1, ("%s: ref_cnt != 1", __func__));
#ifdef INVARIANTS
trash_dtor(m->m_ext.ext_buf, MCLBYTES, arg);
#elif defined(VBOX)
NOREF(size);
NOREF(arg);
#endif
/*
* If there are processes blocked on zone_clust, waiting for pages to be freed up,
* cause them to be woken up by draining the packet zone. We are exposed to a race here
* (in the check for the UMA_ZFLAG_FULL) where we might miss the flag set, but that is
* deliberate. We don't want to acquire the zone lock for every mbuf free.
*/
if (uma_zone_exhausted_nolock(zone_clust))
zone_drain(zone_pack);
}
/*
* The Cluster and Jumbo[PAGESIZE|9|16] zone constructor.
*
* Here the 'arg' pointer points to the Mbuf which we
* are configuring cluster storage for. If 'arg' is
* empty we allocate just the cluster without setting
* the mbuf to it. See mbuf.h.
*/
static int
#ifndef VBOX
mb_ctor_clust(void *mem, int size, void *arg, int how)
#else
mb_ctor_clust(PNATState pData, void *mem, int size, void *arg, int how)
#endif
{
struct mbuf *m;
u_int *refcnt;
int type;
uma_zone_t zone;
#ifdef VBOX
NOREF(how);
#endif
#ifdef INVARIANTS
trash_ctor(mem, size, arg, how);
#elif defined(VBOX)
NOREF(how);
#endif
switch (size) {
case MCLBYTES:
type = EXT_CLUSTER;
zone = zone_clust;
break;
#if MJUMPAGESIZE != MCLBYTES
case MJUMPAGESIZE:
type = EXT_JUMBOP;
zone = zone_jumbop;
break;
#endif
case MJUM9BYTES:
type = EXT_JUMBO9;
zone = zone_jumbo9;
break;
case MJUM16BYTES:
type = EXT_JUMBO16;
zone = zone_jumbo16;
break;
default:
panic("unknown cluster size");
break;
}
m = (struct mbuf *)arg;
refcnt = uma_find_refcnt(zone, mem);
*refcnt = 1;
if (m != NULL) {
m->m_ext.ext_buf = (caddr_t)mem;
m->m_data = m->m_ext.ext_buf;
m->m_flags |= M_EXT;
m->m_ext.ext_free = NULL;
m->m_ext.ext_args = NULL;
m->m_ext.ext_size = size;
m->m_ext.ext_type = type;
m->m_ext.ref_cnt = refcnt;
}
return (0);
}
/*
* The Mbuf Cluster zone destructor.
*/
static void
#ifndef VBOX
mb_dtor_clust(void *mem, int size, void *arg)
#else
mb_dtor_clust(PNATState pData, void *mem, int size, void *arg)
#endif
{
#ifdef INVARIANTS
uma_zone_t zone;
zone = m_getzone(size);
KASSERT(*(uma_find_refcnt(zone, mem)) <= 1,
("%s: refcnt incorrect %u", __func__,
*(uma_find_refcnt(zone, mem))) );
trash_dtor(mem, size, arg);
#elif defined(VBOX)
NOREF(pData);
NOREF(mem);
NOREF(size);
NOREF(arg);
#endif
}
/*
* The Packet secondary zone's init routine, executed on the
* object's transition from mbuf keg slab to zone cache.
*/
static int
#ifndef VBOX
mb_zinit_pack(void *mem, int size, int how)
#else
mb_zinit_pack(PNATState pData, void *mem, int size, int how)
#endif
{
struct mbuf *m;
m = (struct mbuf *)mem; /* m is virgin. */
if (uma_zalloc_arg(zone_clust, m, how) == NULL ||
m->m_ext.ext_buf == NULL)
return (ENOMEM);
m->m_ext.ext_type = EXT_PACKET; /* Override. */
#ifdef INVARIANTS
trash_init(m->m_ext.ext_buf, MCLBYTES, how);
#elif defined(VBOX)
NOREF(size);
#endif
return (0);
}
/*
* The Packet secondary zone's fini routine, executed on the
* object's transition from zone cache to keg slab.
*/
static void
#ifndef VBOX
mb_zfini_pack(void *mem, int size)
#else
mb_zfini_pack(PNATState pData, void *mem, int size)
#endif
{
struct mbuf *m;
m = (struct mbuf *)mem;
#ifdef INVARIANTS
trash_fini(m->m_ext.ext_buf, MCLBYTES);
#endif
uma_zfree_arg(zone_clust, m->m_ext.ext_buf, NULL);
#ifdef INVARIANTS
trash_dtor(mem, size, NULL);
#elif defined(VBOX)
NOREF(size);
#endif
}
/*
* The "packet" keg constructor.
*/
static int
#ifndef VBOX
mb_ctor_pack(void *mem, int size, void *arg, int how)
#else
mb_ctor_pack(PNATState pData, void *mem, int size, void *arg, int how)
#endif
{
struct mbuf *m;
struct mb_args *args;
#ifdef MAC
int error;
#endif
int flags;
short type;
#ifdef VBOX
NOREF(pData);
NOREF(size);
#endif
m = (struct mbuf *)mem;
args = (struct mb_args *)arg;
flags = args->flags;
type = args->type;
#ifdef INVARIANTS
trash_ctor(m->m_ext.ext_buf, MCLBYTES, arg, how);
#elif defined(VBOX)
NOREF(how);
#endif
m->m_next = NULL;
m->m_nextpkt = NULL;
m->m_data = m->m_ext.ext_buf;
m->m_len = 0;
m->m_flags = (flags | M_EXT);
m->m_type = type;
if (flags & M_PKTHDR) {
m->m_pkthdr.rcvif = NULL;
m->m_pkthdr.len = 0;
m->m_pkthdr.header = NULL;
m->m_pkthdr.csum_flags = 0;
m->m_pkthdr.csum_data = 0;
m->m_pkthdr.tso_segsz = 0;
m->m_pkthdr.ether_vtag = 0;
SLIST_INIT(&m->m_pkthdr.tags);
#ifdef MAC
/* If the label init fails, fail the alloc */
error = mac_init_mbuf(m, how);
if (error)
return (error);
#endif
}
/* m_ext is already initialized. */
return (0);
}
#if 0 /* unused */
/*
* This is the protocol drain routine.
*
* No locks should be held when this is called. The drain routines have to
* presently acquire some locks which raises the possibility of lock order
* reversal.
*/
static void
mb_reclaim(void *junk)
{
#ifndef VBOX
struct domain *dp;
struct protosw *pr;
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK | WARN_PANIC, NULL,
"mb_reclaim()");
for (dp = domains; dp != NULL; dp = dp->dom_next)
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
if (pr->pr_drain != NULL)
(*pr->pr_drain)();
#else
NOREF(junk);
#endif
}
#endif /* unused */
|
65beeba634cf58fff0d79cd8dcd6da40f9548c42
|
55540f3e86f1d5d86ef6b5d295a63518e274efe3
|
/components/platform/soc/bl808/bl808_e907_std/bl808_bsp_driver/regs/osd_draw_reg.h
|
1f1f2dd49f5ef2054150b96fc85bb00a3eadfef0
|
[
"Apache-2.0"
] |
permissive
|
bouffalolab/bl_iot_sdk
|
bc5eaf036b70f8c65dd389439062b169f8d09daa
|
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
|
refs/heads/master
| 2023-08-31T03:38:03.369853
| 2023-08-16T08:50:33
| 2023-08-18T09:13:27
| 307,347,250
| 244
| 101
|
Apache-2.0
| 2023-08-28T06:29:02
| 2020-10-26T11:16:30
|
C
|
UTF-8
|
C
| false
| false
| 87,831
|
h
|
osd_draw_reg.h
|
/*
* Copyright (c) 2016-2023 Bouffalolab.
*
* This file is part of
* *** Bouffalolab Software Dev Kit ***
* (see www.bouffalolab.com).
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of Bouffalo Lab nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __OSD_REG_H__
#define __OSD_REG_H__
#include "bl808.h"
/* 0x0 : osd_draw_config */
#define OSD_DRAW_CONFIG_OFFSET (0x0)
#define OSD_REG_DRAW_EN_L OSD_REG_DRAW_EN_L
#define OSD_REG_DRAW_EN_L_POS (0U)
#define OSD_REG_DRAW_EN_L_LEN (16U)
#define OSD_REG_DRAW_EN_L_MSK (((1U << OSD_REG_DRAW_EN_L_LEN) - 1) << OSD_REG_DRAW_EN_L_POS)
#define OSD_REG_DRAW_EN_L_UMSK (~(((1U << OSD_REG_DRAW_EN_L_LEN) - 1) << OSD_REG_DRAW_EN_L_POS))
#define OSD_REG_DRAW_TYPE_L OSD_REG_DRAW_TYPE_L
#define OSD_REG_DRAW_TYPE_L_POS (16U)
#define OSD_REG_DRAW_TYPE_L_LEN (16U)
#define OSD_REG_DRAW_TYPE_L_MSK (((1U << OSD_REG_DRAW_TYPE_L_LEN) - 1) << OSD_REG_DRAW_TYPE_L_POS)
#define OSD_REG_DRAW_TYPE_L_UMSK (~(((1U << OSD_REG_DRAW_TYPE_L_LEN) - 1) << OSD_REG_DRAW_TYPE_L_POS))
/* 0x4 : draw_partial_yuv_config0 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG0_OFFSET (0x4)
#define OSD_REG_DRAW_TH_00 OSD_REG_DRAW_TH_00
#define OSD_REG_DRAW_TH_00_POS (0U)
#define OSD_REG_DRAW_TH_00_LEN (8U)
#define OSD_REG_DRAW_TH_00_MSK (((1U << OSD_REG_DRAW_TH_00_LEN) - 1) << OSD_REG_DRAW_TH_00_POS)
#define OSD_REG_DRAW_TH_00_UMSK (~(((1U << OSD_REG_DRAW_TH_00_LEN) - 1) << OSD_REG_DRAW_TH_00_POS))
#define OSD_REG_DRAW_V_00 OSD_REG_DRAW_V_00
#define OSD_REG_DRAW_V_00_POS (8U)
#define OSD_REG_DRAW_V_00_LEN (8U)
#define OSD_REG_DRAW_V_00_MSK (((1U << OSD_REG_DRAW_V_00_LEN) - 1) << OSD_REG_DRAW_V_00_POS)
#define OSD_REG_DRAW_V_00_UMSK (~(((1U << OSD_REG_DRAW_V_00_LEN) - 1) << OSD_REG_DRAW_V_00_POS))
#define OSD_REG_DRAW_U_00 OSD_REG_DRAW_U_00
#define OSD_REG_DRAW_U_00_POS (16U)
#define OSD_REG_DRAW_U_00_LEN (8U)
#define OSD_REG_DRAW_U_00_MSK (((1U << OSD_REG_DRAW_U_00_LEN) - 1) << OSD_REG_DRAW_U_00_POS)
#define OSD_REG_DRAW_U_00_UMSK (~(((1U << OSD_REG_DRAW_U_00_LEN) - 1) << OSD_REG_DRAW_U_00_POS))
#define OSD_REG_DRAW_Y_00 OSD_REG_DRAW_Y_00
#define OSD_REG_DRAW_Y_00_POS (24U)
#define OSD_REG_DRAW_Y_00_LEN (8U)
#define OSD_REG_DRAW_Y_00_MSK (((1U << OSD_REG_DRAW_Y_00_LEN) - 1) << OSD_REG_DRAW_Y_00_POS)
#define OSD_REG_DRAW_Y_00_UMSK (~(((1U << OSD_REG_DRAW_Y_00_LEN) - 1) << OSD_REG_DRAW_Y_00_POS))
/* 0x8 : draw_partial_x_config0 */
#define OSD_DRAW_PARTIAL_X_CONFIG0_OFFSET (0x8)
#define OSD_REG_DRAW_X_MIN_00 OSD_REG_DRAW_X_MIN_00
#define OSD_REG_DRAW_X_MIN_00_POS (0U)
#define OSD_REG_DRAW_X_MIN_00_LEN (11U)
#define OSD_REG_DRAW_X_MIN_00_MSK (((1U << OSD_REG_DRAW_X_MIN_00_LEN) - 1) << OSD_REG_DRAW_X_MIN_00_POS)
#define OSD_REG_DRAW_X_MIN_00_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_00_LEN) - 1) << OSD_REG_DRAW_X_MIN_00_POS))
#define OSD_REG_DRAW_X_MAX_00 OSD_REG_DRAW_X_MAX_00
#define OSD_REG_DRAW_X_MAX_00_POS (16U)
#define OSD_REG_DRAW_X_MAX_00_LEN (11U)
#define OSD_REG_DRAW_X_MAX_00_MSK (((1U << OSD_REG_DRAW_X_MAX_00_LEN) - 1) << OSD_REG_DRAW_X_MAX_00_POS)
#define OSD_REG_DRAW_X_MAX_00_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_00_LEN) - 1) << OSD_REG_DRAW_X_MAX_00_POS))
/* 0xC : draw_partial_y_config0 */
#define OSD_DRAW_PARTIAL_Y_CONFIG0_OFFSET (0xC)
#define OSD_REG_DRAW_Y_MIN_00 OSD_REG_DRAW_Y_MIN_00
#define OSD_REG_DRAW_Y_MIN_00_POS (0U)
#define OSD_REG_DRAW_Y_MIN_00_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_00_MSK (((1U << OSD_REG_DRAW_Y_MIN_00_LEN) - 1) << OSD_REG_DRAW_Y_MIN_00_POS)
#define OSD_REG_DRAW_Y_MIN_00_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_00_LEN) - 1) << OSD_REG_DRAW_Y_MIN_00_POS))
#define OSD_REG_DRAW_Y_MAX_00 OSD_REG_DRAW_Y_MAX_00
#define OSD_REG_DRAW_Y_MAX_00_POS (16U)
#define OSD_REG_DRAW_Y_MAX_00_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_00_MSK (((1U << OSD_REG_DRAW_Y_MAX_00_LEN) - 1) << OSD_REG_DRAW_Y_MAX_00_POS)
#define OSD_REG_DRAW_Y_MAX_00_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_00_LEN) - 1) << OSD_REG_DRAW_Y_MAX_00_POS))
/* 0x10 : draw_partial_yuv_config1 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG1_OFFSET (0x10)
#define OSD_REG_DRAW_TH_01 OSD_REG_DRAW_TH_01
#define OSD_REG_DRAW_TH_01_POS (0U)
#define OSD_REG_DRAW_TH_01_LEN (8U)
#define OSD_REG_DRAW_TH_01_MSK (((1U << OSD_REG_DRAW_TH_01_LEN) - 1) << OSD_REG_DRAW_TH_01_POS)
#define OSD_REG_DRAW_TH_01_UMSK (~(((1U << OSD_REG_DRAW_TH_01_LEN) - 1) << OSD_REG_DRAW_TH_01_POS))
#define OSD_REG_DRAW_V_01 OSD_REG_DRAW_V_01
#define OSD_REG_DRAW_V_01_POS (8U)
#define OSD_REG_DRAW_V_01_LEN (8U)
#define OSD_REG_DRAW_V_01_MSK (((1U << OSD_REG_DRAW_V_01_LEN) - 1) << OSD_REG_DRAW_V_01_POS)
#define OSD_REG_DRAW_V_01_UMSK (~(((1U << OSD_REG_DRAW_V_01_LEN) - 1) << OSD_REG_DRAW_V_01_POS))
#define OSD_REG_DRAW_U_01 OSD_REG_DRAW_U_01
#define OSD_REG_DRAW_U_01_POS (16U)
#define OSD_REG_DRAW_U_01_LEN (8U)
#define OSD_REG_DRAW_U_01_MSK (((1U << OSD_REG_DRAW_U_01_LEN) - 1) << OSD_REG_DRAW_U_01_POS)
#define OSD_REG_DRAW_U_01_UMSK (~(((1U << OSD_REG_DRAW_U_01_LEN) - 1) << OSD_REG_DRAW_U_01_POS))
#define OSD_REG_DRAW_Y_01 OSD_REG_DRAW_Y_01
#define OSD_REG_DRAW_Y_01_POS (24U)
#define OSD_REG_DRAW_Y_01_LEN (8U)
#define OSD_REG_DRAW_Y_01_MSK (((1U << OSD_REG_DRAW_Y_01_LEN) - 1) << OSD_REG_DRAW_Y_01_POS)
#define OSD_REG_DRAW_Y_01_UMSK (~(((1U << OSD_REG_DRAW_Y_01_LEN) - 1) << OSD_REG_DRAW_Y_01_POS))
/* 0x14 : draw_partial_x_config1 */
#define OSD_DRAW_PARTIAL_X_CONFIG1_OFFSET (0x14)
#define OSD_REG_DRAW_X_MIN_01 OSD_REG_DRAW_X_MIN_01
#define OSD_REG_DRAW_X_MIN_01_POS (0U)
#define OSD_REG_DRAW_X_MIN_01_LEN (11U)
#define OSD_REG_DRAW_X_MIN_01_MSK (((1U << OSD_REG_DRAW_X_MIN_01_LEN) - 1) << OSD_REG_DRAW_X_MIN_01_POS)
#define OSD_REG_DRAW_X_MIN_01_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_01_LEN) - 1) << OSD_REG_DRAW_X_MIN_01_POS))
#define OSD_REG_DRAW_X_MAX_01 OSD_REG_DRAW_X_MAX_01
#define OSD_REG_DRAW_X_MAX_01_POS (16U)
#define OSD_REG_DRAW_X_MAX_01_LEN (11U)
#define OSD_REG_DRAW_X_MAX_01_MSK (((1U << OSD_REG_DRAW_X_MAX_01_LEN) - 1) << OSD_REG_DRAW_X_MAX_01_POS)
#define OSD_REG_DRAW_X_MAX_01_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_01_LEN) - 1) << OSD_REG_DRAW_X_MAX_01_POS))
/* 0x18 : draw_partial_y_config1 */
#define OSD_DRAW_PARTIAL_Y_CONFIG1_OFFSET (0x18)
#define OSD_REG_DRAW_Y_MIN_01 OSD_REG_DRAW_Y_MIN_01
#define OSD_REG_DRAW_Y_MIN_01_POS (0U)
#define OSD_REG_DRAW_Y_MIN_01_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_01_MSK (((1U << OSD_REG_DRAW_Y_MIN_01_LEN) - 1) << OSD_REG_DRAW_Y_MIN_01_POS)
#define OSD_REG_DRAW_Y_MIN_01_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_01_LEN) - 1) << OSD_REG_DRAW_Y_MIN_01_POS))
#define OSD_REG_DRAW_Y_MAX_01 OSD_REG_DRAW_Y_MAX_01
#define OSD_REG_DRAW_Y_MAX_01_POS (16U)
#define OSD_REG_DRAW_Y_MAX_01_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_01_MSK (((1U << OSD_REG_DRAW_Y_MAX_01_LEN) - 1) << OSD_REG_DRAW_Y_MAX_01_POS)
#define OSD_REG_DRAW_Y_MAX_01_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_01_LEN) - 1) << OSD_REG_DRAW_Y_MAX_01_POS))
/* 0x1C : draw_partial_yuv_config2 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG2_OFFSET (0x1C)
#define OSD_REG_DRAW_TH_02 OSD_REG_DRAW_TH_02
#define OSD_REG_DRAW_TH_02_POS (0U)
#define OSD_REG_DRAW_TH_02_LEN (8U)
#define OSD_REG_DRAW_TH_02_MSK (((1U << OSD_REG_DRAW_TH_02_LEN) - 1) << OSD_REG_DRAW_TH_02_POS)
#define OSD_REG_DRAW_TH_02_UMSK (~(((1U << OSD_REG_DRAW_TH_02_LEN) - 1) << OSD_REG_DRAW_TH_02_POS))
#define OSD_REG_DRAW_V_02 OSD_REG_DRAW_V_02
#define OSD_REG_DRAW_V_02_POS (8U)
#define OSD_REG_DRAW_V_02_LEN (8U)
#define OSD_REG_DRAW_V_02_MSK (((1U << OSD_REG_DRAW_V_02_LEN) - 1) << OSD_REG_DRAW_V_02_POS)
#define OSD_REG_DRAW_V_02_UMSK (~(((1U << OSD_REG_DRAW_V_02_LEN) - 1) << OSD_REG_DRAW_V_02_POS))
#define OSD_REG_DRAW_U_02 OSD_REG_DRAW_U_02
#define OSD_REG_DRAW_U_02_POS (16U)
#define OSD_REG_DRAW_U_02_LEN (8U)
#define OSD_REG_DRAW_U_02_MSK (((1U << OSD_REG_DRAW_U_02_LEN) - 1) << OSD_REG_DRAW_U_02_POS)
#define OSD_REG_DRAW_U_02_UMSK (~(((1U << OSD_REG_DRAW_U_02_LEN) - 1) << OSD_REG_DRAW_U_02_POS))
#define OSD_REG_DRAW_Y_02 OSD_REG_DRAW_Y_02
#define OSD_REG_DRAW_Y_02_POS (24U)
#define OSD_REG_DRAW_Y_02_LEN (8U)
#define OSD_REG_DRAW_Y_02_MSK (((1U << OSD_REG_DRAW_Y_02_LEN) - 1) << OSD_REG_DRAW_Y_02_POS)
#define OSD_REG_DRAW_Y_02_UMSK (~(((1U << OSD_REG_DRAW_Y_02_LEN) - 1) << OSD_REG_DRAW_Y_02_POS))
/* 0x20 : draw_partial_x_config2 */
#define OSD_DRAW_PARTIAL_X_CONFIG2_OFFSET (0x20)
#define OSD_REG_DRAW_X_MIN_02 OSD_REG_DRAW_X_MIN_02
#define OSD_REG_DRAW_X_MIN_02_POS (0U)
#define OSD_REG_DRAW_X_MIN_02_LEN (11U)
#define OSD_REG_DRAW_X_MIN_02_MSK (((1U << OSD_REG_DRAW_X_MIN_02_LEN) - 1) << OSD_REG_DRAW_X_MIN_02_POS)
#define OSD_REG_DRAW_X_MIN_02_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_02_LEN) - 1) << OSD_REG_DRAW_X_MIN_02_POS))
#define OSD_REG_DRAW_X_MAX_02 OSD_REG_DRAW_X_MAX_02
#define OSD_REG_DRAW_X_MAX_02_POS (16U)
#define OSD_REG_DRAW_X_MAX_02_LEN (11U)
#define OSD_REG_DRAW_X_MAX_02_MSK (((1U << OSD_REG_DRAW_X_MAX_02_LEN) - 1) << OSD_REG_DRAW_X_MAX_02_POS)
#define OSD_REG_DRAW_X_MAX_02_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_02_LEN) - 1) << OSD_REG_DRAW_X_MAX_02_POS))
/* 0x24 : draw_partial_y_config2 */
#define OSD_DRAW_PARTIAL_Y_CONFIG2_OFFSET (0x24)
#define OSD_REG_DRAW_Y_MIN_02 OSD_REG_DRAW_Y_MIN_02
#define OSD_REG_DRAW_Y_MIN_02_POS (0U)
#define OSD_REG_DRAW_Y_MIN_02_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_02_MSK (((1U << OSD_REG_DRAW_Y_MIN_02_LEN) - 1) << OSD_REG_DRAW_Y_MIN_02_POS)
#define OSD_REG_DRAW_Y_MIN_02_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_02_LEN) - 1) << OSD_REG_DRAW_Y_MIN_02_POS))
#define OSD_REG_DRAW_Y_MAX_02 OSD_REG_DRAW_Y_MAX_02
#define OSD_REG_DRAW_Y_MAX_02_POS (16U)
#define OSD_REG_DRAW_Y_MAX_02_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_02_MSK (((1U << OSD_REG_DRAW_Y_MAX_02_LEN) - 1) << OSD_REG_DRAW_Y_MAX_02_POS)
#define OSD_REG_DRAW_Y_MAX_02_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_02_LEN) - 1) << OSD_REG_DRAW_Y_MAX_02_POS))
/* 0x28 : draw_partial_yuv_config3 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG3_OFFSET (0x28)
#define OSD_REG_DRAW_TH_03 OSD_REG_DRAW_TH_03
#define OSD_REG_DRAW_TH_03_POS (0U)
#define OSD_REG_DRAW_TH_03_LEN (8U)
#define OSD_REG_DRAW_TH_03_MSK (((1U << OSD_REG_DRAW_TH_03_LEN) - 1) << OSD_REG_DRAW_TH_03_POS)
#define OSD_REG_DRAW_TH_03_UMSK (~(((1U << OSD_REG_DRAW_TH_03_LEN) - 1) << OSD_REG_DRAW_TH_03_POS))
#define OSD_REG_DRAW_V_03 OSD_REG_DRAW_V_03
#define OSD_REG_DRAW_V_03_POS (8U)
#define OSD_REG_DRAW_V_03_LEN (8U)
#define OSD_REG_DRAW_V_03_MSK (((1U << OSD_REG_DRAW_V_03_LEN) - 1) << OSD_REG_DRAW_V_03_POS)
#define OSD_REG_DRAW_V_03_UMSK (~(((1U << OSD_REG_DRAW_V_03_LEN) - 1) << OSD_REG_DRAW_V_03_POS))
#define OSD_REG_DRAW_U_03 OSD_REG_DRAW_U_03
#define OSD_REG_DRAW_U_03_POS (16U)
#define OSD_REG_DRAW_U_03_LEN (8U)
#define OSD_REG_DRAW_U_03_MSK (((1U << OSD_REG_DRAW_U_03_LEN) - 1) << OSD_REG_DRAW_U_03_POS)
#define OSD_REG_DRAW_U_03_UMSK (~(((1U << OSD_REG_DRAW_U_03_LEN) - 1) << OSD_REG_DRAW_U_03_POS))
#define OSD_REG_DRAW_Y_03 OSD_REG_DRAW_Y_03
#define OSD_REG_DRAW_Y_03_POS (24U)
#define OSD_REG_DRAW_Y_03_LEN (8U)
#define OSD_REG_DRAW_Y_03_MSK (((1U << OSD_REG_DRAW_Y_03_LEN) - 1) << OSD_REG_DRAW_Y_03_POS)
#define OSD_REG_DRAW_Y_03_UMSK (~(((1U << OSD_REG_DRAW_Y_03_LEN) - 1) << OSD_REG_DRAW_Y_03_POS))
/* 0x2C : draw_partial_x_config3 */
#define OSD_DRAW_PARTIAL_X_CONFIG3_OFFSET (0x2C)
#define OSD_REG_DRAW_X_MIN_03 OSD_REG_DRAW_X_MIN_03
#define OSD_REG_DRAW_X_MIN_03_POS (0U)
#define OSD_REG_DRAW_X_MIN_03_LEN (11U)
#define OSD_REG_DRAW_X_MIN_03_MSK (((1U << OSD_REG_DRAW_X_MIN_03_LEN) - 1) << OSD_REG_DRAW_X_MIN_03_POS)
#define OSD_REG_DRAW_X_MIN_03_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_03_LEN) - 1) << OSD_REG_DRAW_X_MIN_03_POS))
#define OSD_REG_DRAW_X_MAX_03 OSD_REG_DRAW_X_MAX_03
#define OSD_REG_DRAW_X_MAX_03_POS (16U)
#define OSD_REG_DRAW_X_MAX_03_LEN (11U)
#define OSD_REG_DRAW_X_MAX_03_MSK (((1U << OSD_REG_DRAW_X_MAX_03_LEN) - 1) << OSD_REG_DRAW_X_MAX_03_POS)
#define OSD_REG_DRAW_X_MAX_03_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_03_LEN) - 1) << OSD_REG_DRAW_X_MAX_03_POS))
/* 0x30 : draw_partial_y_config3 */
#define OSD_DRAW_PARTIAL_Y_CONFIG3_OFFSET (0x30)
#define OSD_REG_DRAW_Y_MIN_03 OSD_REG_DRAW_Y_MIN_03
#define OSD_REG_DRAW_Y_MIN_03_POS (0U)
#define OSD_REG_DRAW_Y_MIN_03_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_03_MSK (((1U << OSD_REG_DRAW_Y_MIN_03_LEN) - 1) << OSD_REG_DRAW_Y_MIN_03_POS)
#define OSD_REG_DRAW_Y_MIN_03_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_03_LEN) - 1) << OSD_REG_DRAW_Y_MIN_03_POS))
#define OSD_REG_DRAW_Y_MAX_03 OSD_REG_DRAW_Y_MAX_03
#define OSD_REG_DRAW_Y_MAX_03_POS (16U)
#define OSD_REG_DRAW_Y_MAX_03_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_03_MSK (((1U << OSD_REG_DRAW_Y_MAX_03_LEN) - 1) << OSD_REG_DRAW_Y_MAX_03_POS)
#define OSD_REG_DRAW_Y_MAX_03_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_03_LEN) - 1) << OSD_REG_DRAW_Y_MAX_03_POS))
/* 0x34 : draw_partial_yuv_config4 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG4_OFFSET (0x34)
#define OSD_REG_DRAW_TH_04 OSD_REG_DRAW_TH_04
#define OSD_REG_DRAW_TH_04_POS (0U)
#define OSD_REG_DRAW_TH_04_LEN (8U)
#define OSD_REG_DRAW_TH_04_MSK (((1U << OSD_REG_DRAW_TH_04_LEN) - 1) << OSD_REG_DRAW_TH_04_POS)
#define OSD_REG_DRAW_TH_04_UMSK (~(((1U << OSD_REG_DRAW_TH_04_LEN) - 1) << OSD_REG_DRAW_TH_04_POS))
#define OSD_REG_DRAW_V_04 OSD_REG_DRAW_V_04
#define OSD_REG_DRAW_V_04_POS (8U)
#define OSD_REG_DRAW_V_04_LEN (8U)
#define OSD_REG_DRAW_V_04_MSK (((1U << OSD_REG_DRAW_V_04_LEN) - 1) << OSD_REG_DRAW_V_04_POS)
#define OSD_REG_DRAW_V_04_UMSK (~(((1U << OSD_REG_DRAW_V_04_LEN) - 1) << OSD_REG_DRAW_V_04_POS))
#define OSD_REG_DRAW_U_04 OSD_REG_DRAW_U_04
#define OSD_REG_DRAW_U_04_POS (16U)
#define OSD_REG_DRAW_U_04_LEN (8U)
#define OSD_REG_DRAW_U_04_MSK (((1U << OSD_REG_DRAW_U_04_LEN) - 1) << OSD_REG_DRAW_U_04_POS)
#define OSD_REG_DRAW_U_04_UMSK (~(((1U << OSD_REG_DRAW_U_04_LEN) - 1) << OSD_REG_DRAW_U_04_POS))
#define OSD_REG_DRAW_Y_04 OSD_REG_DRAW_Y_04
#define OSD_REG_DRAW_Y_04_POS (24U)
#define OSD_REG_DRAW_Y_04_LEN (8U)
#define OSD_REG_DRAW_Y_04_MSK (((1U << OSD_REG_DRAW_Y_04_LEN) - 1) << OSD_REG_DRAW_Y_04_POS)
#define OSD_REG_DRAW_Y_04_UMSK (~(((1U << OSD_REG_DRAW_Y_04_LEN) - 1) << OSD_REG_DRAW_Y_04_POS))
/* 0x38 : draw_partial_x_config4 */
#define OSD_DRAW_PARTIAL_X_CONFIG4_OFFSET (0x38)
#define OSD_REG_DRAW_X_MIN_04 OSD_REG_DRAW_X_MIN_04
#define OSD_REG_DRAW_X_MIN_04_POS (0U)
#define OSD_REG_DRAW_X_MIN_04_LEN (11U)
#define OSD_REG_DRAW_X_MIN_04_MSK (((1U << OSD_REG_DRAW_X_MIN_04_LEN) - 1) << OSD_REG_DRAW_X_MIN_04_POS)
#define OSD_REG_DRAW_X_MIN_04_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_04_LEN) - 1) << OSD_REG_DRAW_X_MIN_04_POS))
#define OSD_REG_DRAW_X_MAX_04 OSD_REG_DRAW_X_MAX_04
#define OSD_REG_DRAW_X_MAX_04_POS (16U)
#define OSD_REG_DRAW_X_MAX_04_LEN (11U)
#define OSD_REG_DRAW_X_MAX_04_MSK (((1U << OSD_REG_DRAW_X_MAX_04_LEN) - 1) << OSD_REG_DRAW_X_MAX_04_POS)
#define OSD_REG_DRAW_X_MAX_04_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_04_LEN) - 1) << OSD_REG_DRAW_X_MAX_04_POS))
/* 0x3C : draw_partial_y_config4 */
#define OSD_DRAW_PARTIAL_Y_CONFIG4_OFFSET (0x3C)
#define OSD_REG_DRAW_Y_MIN_04 OSD_REG_DRAW_Y_MIN_04
#define OSD_REG_DRAW_Y_MIN_04_POS (0U)
#define OSD_REG_DRAW_Y_MIN_04_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_04_MSK (((1U << OSD_REG_DRAW_Y_MIN_04_LEN) - 1) << OSD_REG_DRAW_Y_MIN_04_POS)
#define OSD_REG_DRAW_Y_MIN_04_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_04_LEN) - 1) << OSD_REG_DRAW_Y_MIN_04_POS))
#define OSD_REG_DRAW_Y_MAX_04 OSD_REG_DRAW_Y_MAX_04
#define OSD_REG_DRAW_Y_MAX_04_POS (16U)
#define OSD_REG_DRAW_Y_MAX_04_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_04_MSK (((1U << OSD_REG_DRAW_Y_MAX_04_LEN) - 1) << OSD_REG_DRAW_Y_MAX_04_POS)
#define OSD_REG_DRAW_Y_MAX_04_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_04_LEN) - 1) << OSD_REG_DRAW_Y_MAX_04_POS))
/* 0x40 : draw_partial_yuv_config5 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG5_OFFSET (0x40)
#define OSD_REG_DRAW_TH_05 OSD_REG_DRAW_TH_05
#define OSD_REG_DRAW_TH_05_POS (0U)
#define OSD_REG_DRAW_TH_05_LEN (8U)
#define OSD_REG_DRAW_TH_05_MSK (((1U << OSD_REG_DRAW_TH_05_LEN) - 1) << OSD_REG_DRAW_TH_05_POS)
#define OSD_REG_DRAW_TH_05_UMSK (~(((1U << OSD_REG_DRAW_TH_05_LEN) - 1) << OSD_REG_DRAW_TH_05_POS))
#define OSD_REG_DRAW_V_05 OSD_REG_DRAW_V_05
#define OSD_REG_DRAW_V_05_POS (8U)
#define OSD_REG_DRAW_V_05_LEN (8U)
#define OSD_REG_DRAW_V_05_MSK (((1U << OSD_REG_DRAW_V_05_LEN) - 1) << OSD_REG_DRAW_V_05_POS)
#define OSD_REG_DRAW_V_05_UMSK (~(((1U << OSD_REG_DRAW_V_05_LEN) - 1) << OSD_REG_DRAW_V_05_POS))
#define OSD_REG_DRAW_U_05 OSD_REG_DRAW_U_05
#define OSD_REG_DRAW_U_05_POS (16U)
#define OSD_REG_DRAW_U_05_LEN (8U)
#define OSD_REG_DRAW_U_05_MSK (((1U << OSD_REG_DRAW_U_05_LEN) - 1) << OSD_REG_DRAW_U_05_POS)
#define OSD_REG_DRAW_U_05_UMSK (~(((1U << OSD_REG_DRAW_U_05_LEN) - 1) << OSD_REG_DRAW_U_05_POS))
#define OSD_REG_DRAW_Y_05 OSD_REG_DRAW_Y_05
#define OSD_REG_DRAW_Y_05_POS (24U)
#define OSD_REG_DRAW_Y_05_LEN (8U)
#define OSD_REG_DRAW_Y_05_MSK (((1U << OSD_REG_DRAW_Y_05_LEN) - 1) << OSD_REG_DRAW_Y_05_POS)
#define OSD_REG_DRAW_Y_05_UMSK (~(((1U << OSD_REG_DRAW_Y_05_LEN) - 1) << OSD_REG_DRAW_Y_05_POS))
/* 0x44 : draw_partial_x_config5 */
#define OSD_DRAW_PARTIAL_X_CONFIG5_OFFSET (0x44)
#define OSD_REG_DRAW_X_MIN_05 OSD_REG_DRAW_X_MIN_05
#define OSD_REG_DRAW_X_MIN_05_POS (0U)
#define OSD_REG_DRAW_X_MIN_05_LEN (11U)
#define OSD_REG_DRAW_X_MIN_05_MSK (((1U << OSD_REG_DRAW_X_MIN_05_LEN) - 1) << OSD_REG_DRAW_X_MIN_05_POS)
#define OSD_REG_DRAW_X_MIN_05_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_05_LEN) - 1) << OSD_REG_DRAW_X_MIN_05_POS))
#define OSD_REG_DRAW_X_MAX_05 OSD_REG_DRAW_X_MAX_05
#define OSD_REG_DRAW_X_MAX_05_POS (16U)
#define OSD_REG_DRAW_X_MAX_05_LEN (11U)
#define OSD_REG_DRAW_X_MAX_05_MSK (((1U << OSD_REG_DRAW_X_MAX_05_LEN) - 1) << OSD_REG_DRAW_X_MAX_05_POS)
#define OSD_REG_DRAW_X_MAX_05_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_05_LEN) - 1) << OSD_REG_DRAW_X_MAX_05_POS))
/* 0x48 : draw_partial_y_config5 */
#define OSD_DRAW_PARTIAL_Y_CONFIG5_OFFSET (0x48)
#define OSD_REG_DRAW_Y_MIN_05 OSD_REG_DRAW_Y_MIN_05
#define OSD_REG_DRAW_Y_MIN_05_POS (0U)
#define OSD_REG_DRAW_Y_MIN_05_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_05_MSK (((1U << OSD_REG_DRAW_Y_MIN_05_LEN) - 1) << OSD_REG_DRAW_Y_MIN_05_POS)
#define OSD_REG_DRAW_Y_MIN_05_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_05_LEN) - 1) << OSD_REG_DRAW_Y_MIN_05_POS))
#define OSD_REG_DRAW_Y_MAX_05 OSD_REG_DRAW_Y_MAX_05
#define OSD_REG_DRAW_Y_MAX_05_POS (16U)
#define OSD_REG_DRAW_Y_MAX_05_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_05_MSK (((1U << OSD_REG_DRAW_Y_MAX_05_LEN) - 1) << OSD_REG_DRAW_Y_MAX_05_POS)
#define OSD_REG_DRAW_Y_MAX_05_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_05_LEN) - 1) << OSD_REG_DRAW_Y_MAX_05_POS))
/* 0x4C : draw_partial_yuv_config6 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG6_OFFSET (0x4C)
#define OSD_REG_DRAW_TH_06 OSD_REG_DRAW_TH_06
#define OSD_REG_DRAW_TH_06_POS (0U)
#define OSD_REG_DRAW_TH_06_LEN (8U)
#define OSD_REG_DRAW_TH_06_MSK (((1U << OSD_REG_DRAW_TH_06_LEN) - 1) << OSD_REG_DRAW_TH_06_POS)
#define OSD_REG_DRAW_TH_06_UMSK (~(((1U << OSD_REG_DRAW_TH_06_LEN) - 1) << OSD_REG_DRAW_TH_06_POS))
#define OSD_REG_DRAW_V_06 OSD_REG_DRAW_V_06
#define OSD_REG_DRAW_V_06_POS (8U)
#define OSD_REG_DRAW_V_06_LEN (8U)
#define OSD_REG_DRAW_V_06_MSK (((1U << OSD_REG_DRAW_V_06_LEN) - 1) << OSD_REG_DRAW_V_06_POS)
#define OSD_REG_DRAW_V_06_UMSK (~(((1U << OSD_REG_DRAW_V_06_LEN) - 1) << OSD_REG_DRAW_V_06_POS))
#define OSD_REG_DRAW_U_06 OSD_REG_DRAW_U_06
#define OSD_REG_DRAW_U_06_POS (16U)
#define OSD_REG_DRAW_U_06_LEN (8U)
#define OSD_REG_DRAW_U_06_MSK (((1U << OSD_REG_DRAW_U_06_LEN) - 1) << OSD_REG_DRAW_U_06_POS)
#define OSD_REG_DRAW_U_06_UMSK (~(((1U << OSD_REG_DRAW_U_06_LEN) - 1) << OSD_REG_DRAW_U_06_POS))
#define OSD_REG_DRAW_Y_06 OSD_REG_DRAW_Y_06
#define OSD_REG_DRAW_Y_06_POS (24U)
#define OSD_REG_DRAW_Y_06_LEN (8U)
#define OSD_REG_DRAW_Y_06_MSK (((1U << OSD_REG_DRAW_Y_06_LEN) - 1) << OSD_REG_DRAW_Y_06_POS)
#define OSD_REG_DRAW_Y_06_UMSK (~(((1U << OSD_REG_DRAW_Y_06_LEN) - 1) << OSD_REG_DRAW_Y_06_POS))
/* 0x50 : draw_partial_x_config6 */
#define OSD_DRAW_PARTIAL_X_CONFIG6_OFFSET (0x50)
#define OSD_REG_DRAW_X_MIN_06 OSD_REG_DRAW_X_MIN_06
#define OSD_REG_DRAW_X_MIN_06_POS (0U)
#define OSD_REG_DRAW_X_MIN_06_LEN (11U)
#define OSD_REG_DRAW_X_MIN_06_MSK (((1U << OSD_REG_DRAW_X_MIN_06_LEN) - 1) << OSD_REG_DRAW_X_MIN_06_POS)
#define OSD_REG_DRAW_X_MIN_06_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_06_LEN) - 1) << OSD_REG_DRAW_X_MIN_06_POS))
#define OSD_REG_DRAW_X_MAX_06 OSD_REG_DRAW_X_MAX_06
#define OSD_REG_DRAW_X_MAX_06_POS (16U)
#define OSD_REG_DRAW_X_MAX_06_LEN (11U)
#define OSD_REG_DRAW_X_MAX_06_MSK (((1U << OSD_REG_DRAW_X_MAX_06_LEN) - 1) << OSD_REG_DRAW_X_MAX_06_POS)
#define OSD_REG_DRAW_X_MAX_06_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_06_LEN) - 1) << OSD_REG_DRAW_X_MAX_06_POS))
/* 0x54 : draw_partial_y_config6 */
#define OSD_DRAW_PARTIAL_Y_CONFIG6_OFFSET (0x54)
#define OSD_REG_DRAW_Y_MIN_06 OSD_REG_DRAW_Y_MIN_06
#define OSD_REG_DRAW_Y_MIN_06_POS (0U)
#define OSD_REG_DRAW_Y_MIN_06_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_06_MSK (((1U << OSD_REG_DRAW_Y_MIN_06_LEN) - 1) << OSD_REG_DRAW_Y_MIN_06_POS)
#define OSD_REG_DRAW_Y_MIN_06_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_06_LEN) - 1) << OSD_REG_DRAW_Y_MIN_06_POS))
#define OSD_REG_DRAW_Y_MAX_06 OSD_REG_DRAW_Y_MAX_06
#define OSD_REG_DRAW_Y_MAX_06_POS (16U)
#define OSD_REG_DRAW_Y_MAX_06_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_06_MSK (((1U << OSD_REG_DRAW_Y_MAX_06_LEN) - 1) << OSD_REG_DRAW_Y_MAX_06_POS)
#define OSD_REG_DRAW_Y_MAX_06_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_06_LEN) - 1) << OSD_REG_DRAW_Y_MAX_06_POS))
/* 0x58 : draw_partial_yuv_config7 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG7_OFFSET (0x58)
#define OSD_REG_DRAW_TH_07 OSD_REG_DRAW_TH_07
#define OSD_REG_DRAW_TH_07_POS (0U)
#define OSD_REG_DRAW_TH_07_LEN (8U)
#define OSD_REG_DRAW_TH_07_MSK (((1U << OSD_REG_DRAW_TH_07_LEN) - 1) << OSD_REG_DRAW_TH_07_POS)
#define OSD_REG_DRAW_TH_07_UMSK (~(((1U << OSD_REG_DRAW_TH_07_LEN) - 1) << OSD_REG_DRAW_TH_07_POS))
#define OSD_REG_DRAW_V_07 OSD_REG_DRAW_V_07
#define OSD_REG_DRAW_V_07_POS (8U)
#define OSD_REG_DRAW_V_07_LEN (8U)
#define OSD_REG_DRAW_V_07_MSK (((1U << OSD_REG_DRAW_V_07_LEN) - 1) << OSD_REG_DRAW_V_07_POS)
#define OSD_REG_DRAW_V_07_UMSK (~(((1U << OSD_REG_DRAW_V_07_LEN) - 1) << OSD_REG_DRAW_V_07_POS))
#define OSD_REG_DRAW_U_07 OSD_REG_DRAW_U_07
#define OSD_REG_DRAW_U_07_POS (16U)
#define OSD_REG_DRAW_U_07_LEN (8U)
#define OSD_REG_DRAW_U_07_MSK (((1U << OSD_REG_DRAW_U_07_LEN) - 1) << OSD_REG_DRAW_U_07_POS)
#define OSD_REG_DRAW_U_07_UMSK (~(((1U << OSD_REG_DRAW_U_07_LEN) - 1) << OSD_REG_DRAW_U_07_POS))
#define OSD_REG_DRAW_Y_07 OSD_REG_DRAW_Y_07
#define OSD_REG_DRAW_Y_07_POS (24U)
#define OSD_REG_DRAW_Y_07_LEN (8U)
#define OSD_REG_DRAW_Y_07_MSK (((1U << OSD_REG_DRAW_Y_07_LEN) - 1) << OSD_REG_DRAW_Y_07_POS)
#define OSD_REG_DRAW_Y_07_UMSK (~(((1U << OSD_REG_DRAW_Y_07_LEN) - 1) << OSD_REG_DRAW_Y_07_POS))
/* 0x5C : draw_partial_x_config7 */
#define OSD_DRAW_PARTIAL_X_CONFIG7_OFFSET (0x5C)
#define OSD_REG_DRAW_X_MIN_07 OSD_REG_DRAW_X_MIN_07
#define OSD_REG_DRAW_X_MIN_07_POS (0U)
#define OSD_REG_DRAW_X_MIN_07_LEN (11U)
#define OSD_REG_DRAW_X_MIN_07_MSK (((1U << OSD_REG_DRAW_X_MIN_07_LEN) - 1) << OSD_REG_DRAW_X_MIN_07_POS)
#define OSD_REG_DRAW_X_MIN_07_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_07_LEN) - 1) << OSD_REG_DRAW_X_MIN_07_POS))
#define OSD_REG_DRAW_X_MAX_07 OSD_REG_DRAW_X_MAX_07
#define OSD_REG_DRAW_X_MAX_07_POS (16U)
#define OSD_REG_DRAW_X_MAX_07_LEN (11U)
#define OSD_REG_DRAW_X_MAX_07_MSK (((1U << OSD_REG_DRAW_X_MAX_07_LEN) - 1) << OSD_REG_DRAW_X_MAX_07_POS)
#define OSD_REG_DRAW_X_MAX_07_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_07_LEN) - 1) << OSD_REG_DRAW_X_MAX_07_POS))
/* 0x60 : draw_partial_y_config7 */
#define OSD_DRAW_PARTIAL_Y_CONFIG7_OFFSET (0x60)
#define OSD_REG_DRAW_Y_MIN_07 OSD_REG_DRAW_Y_MIN_07
#define OSD_REG_DRAW_Y_MIN_07_POS (0U)
#define OSD_REG_DRAW_Y_MIN_07_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_07_MSK (((1U << OSD_REG_DRAW_Y_MIN_07_LEN) - 1) << OSD_REG_DRAW_Y_MIN_07_POS)
#define OSD_REG_DRAW_Y_MIN_07_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_07_LEN) - 1) << OSD_REG_DRAW_Y_MIN_07_POS))
#define OSD_REG_DRAW_Y_MAX_07 OSD_REG_DRAW_Y_MAX_07
#define OSD_REG_DRAW_Y_MAX_07_POS (16U)
#define OSD_REG_DRAW_Y_MAX_07_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_07_MSK (((1U << OSD_REG_DRAW_Y_MAX_07_LEN) - 1) << OSD_REG_DRAW_Y_MAX_07_POS)
#define OSD_REG_DRAW_Y_MAX_07_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_07_LEN) - 1) << OSD_REG_DRAW_Y_MAX_07_POS))
/* 0x64 : draw_partial_yuv_config8 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG8_OFFSET (0x64)
#define OSD_REG_DRAW_TH_08 OSD_REG_DRAW_TH_08
#define OSD_REG_DRAW_TH_08_POS (0U)
#define OSD_REG_DRAW_TH_08_LEN (8U)
#define OSD_REG_DRAW_TH_08_MSK (((1U << OSD_REG_DRAW_TH_08_LEN) - 1) << OSD_REG_DRAW_TH_08_POS)
#define OSD_REG_DRAW_TH_08_UMSK (~(((1U << OSD_REG_DRAW_TH_08_LEN) - 1) << OSD_REG_DRAW_TH_08_POS))
#define OSD_REG_DRAW_V_08 OSD_REG_DRAW_V_08
#define OSD_REG_DRAW_V_08_POS (8U)
#define OSD_REG_DRAW_V_08_LEN (8U)
#define OSD_REG_DRAW_V_08_MSK (((1U << OSD_REG_DRAW_V_08_LEN) - 1) << OSD_REG_DRAW_V_08_POS)
#define OSD_REG_DRAW_V_08_UMSK (~(((1U << OSD_REG_DRAW_V_08_LEN) - 1) << OSD_REG_DRAW_V_08_POS))
#define OSD_REG_DRAW_U_08 OSD_REG_DRAW_U_08
#define OSD_REG_DRAW_U_08_POS (16U)
#define OSD_REG_DRAW_U_08_LEN (8U)
#define OSD_REG_DRAW_U_08_MSK (((1U << OSD_REG_DRAW_U_08_LEN) - 1) << OSD_REG_DRAW_U_08_POS)
#define OSD_REG_DRAW_U_08_UMSK (~(((1U << OSD_REG_DRAW_U_08_LEN) - 1) << OSD_REG_DRAW_U_08_POS))
#define OSD_REG_DRAW_Y_08 OSD_REG_DRAW_Y_08
#define OSD_REG_DRAW_Y_08_POS (24U)
#define OSD_REG_DRAW_Y_08_LEN (8U)
#define OSD_REG_DRAW_Y_08_MSK (((1U << OSD_REG_DRAW_Y_08_LEN) - 1) << OSD_REG_DRAW_Y_08_POS)
#define OSD_REG_DRAW_Y_08_UMSK (~(((1U << OSD_REG_DRAW_Y_08_LEN) - 1) << OSD_REG_DRAW_Y_08_POS))
/* 0x68 : draw_partial_x_config8 */
#define OSD_DRAW_PARTIAL_X_CONFIG8_OFFSET (0x68)
#define OSD_REG_DRAW_X_MIN_08 OSD_REG_DRAW_X_MIN_08
#define OSD_REG_DRAW_X_MIN_08_POS (0U)
#define OSD_REG_DRAW_X_MIN_08_LEN (11U)
#define OSD_REG_DRAW_X_MIN_08_MSK (((1U << OSD_REG_DRAW_X_MIN_08_LEN) - 1) << OSD_REG_DRAW_X_MIN_08_POS)
#define OSD_REG_DRAW_X_MIN_08_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_08_LEN) - 1) << OSD_REG_DRAW_X_MIN_08_POS))
#define OSD_REG_DRAW_X_MAX_08 OSD_REG_DRAW_X_MAX_08
#define OSD_REG_DRAW_X_MAX_08_POS (16U)
#define OSD_REG_DRAW_X_MAX_08_LEN (11U)
#define OSD_REG_DRAW_X_MAX_08_MSK (((1U << OSD_REG_DRAW_X_MAX_08_LEN) - 1) << OSD_REG_DRAW_X_MAX_08_POS)
#define OSD_REG_DRAW_X_MAX_08_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_08_LEN) - 1) << OSD_REG_DRAW_X_MAX_08_POS))
/* 0x6C : draw_partial_y_config8 */
#define OSD_DRAW_PARTIAL_Y_CONFIG8_OFFSET (0x6C)
#define OSD_REG_DRAW_Y_MIN_08 OSD_REG_DRAW_Y_MIN_08
#define OSD_REG_DRAW_Y_MIN_08_POS (0U)
#define OSD_REG_DRAW_Y_MIN_08_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_08_MSK (((1U << OSD_REG_DRAW_Y_MIN_08_LEN) - 1) << OSD_REG_DRAW_Y_MIN_08_POS)
#define OSD_REG_DRAW_Y_MIN_08_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_08_LEN) - 1) << OSD_REG_DRAW_Y_MIN_08_POS))
#define OSD_REG_DRAW_Y_MAX_08 OSD_REG_DRAW_Y_MAX_08
#define OSD_REG_DRAW_Y_MAX_08_POS (16U)
#define OSD_REG_DRAW_Y_MAX_08_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_08_MSK (((1U << OSD_REG_DRAW_Y_MAX_08_LEN) - 1) << OSD_REG_DRAW_Y_MAX_08_POS)
#define OSD_REG_DRAW_Y_MAX_08_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_08_LEN) - 1) << OSD_REG_DRAW_Y_MAX_08_POS))
/* 0x70 : draw_partial_yuv_config9 */
#define OSD_DRAW_PARTIAL_YUV_CONFIG9_OFFSET (0x70)
#define OSD_REG_DRAW_TH_09 OSD_REG_DRAW_TH_09
#define OSD_REG_DRAW_TH_09_POS (0U)
#define OSD_REG_DRAW_TH_09_LEN (8U)
#define OSD_REG_DRAW_TH_09_MSK (((1U << OSD_REG_DRAW_TH_09_LEN) - 1) << OSD_REG_DRAW_TH_09_POS)
#define OSD_REG_DRAW_TH_09_UMSK (~(((1U << OSD_REG_DRAW_TH_09_LEN) - 1) << OSD_REG_DRAW_TH_09_POS))
#define OSD_REG_DRAW_V_09 OSD_REG_DRAW_V_09
#define OSD_REG_DRAW_V_09_POS (8U)
#define OSD_REG_DRAW_V_09_LEN (8U)
#define OSD_REG_DRAW_V_09_MSK (((1U << OSD_REG_DRAW_V_09_LEN) - 1) << OSD_REG_DRAW_V_09_POS)
#define OSD_REG_DRAW_V_09_UMSK (~(((1U << OSD_REG_DRAW_V_09_LEN) - 1) << OSD_REG_DRAW_V_09_POS))
#define OSD_REG_DRAW_U_09 OSD_REG_DRAW_U_09
#define OSD_REG_DRAW_U_09_POS (16U)
#define OSD_REG_DRAW_U_09_LEN (8U)
#define OSD_REG_DRAW_U_09_MSK (((1U << OSD_REG_DRAW_U_09_LEN) - 1) << OSD_REG_DRAW_U_09_POS)
#define OSD_REG_DRAW_U_09_UMSK (~(((1U << OSD_REG_DRAW_U_09_LEN) - 1) << OSD_REG_DRAW_U_09_POS))
#define OSD_REG_DRAW_Y_09 OSD_REG_DRAW_Y_09
#define OSD_REG_DRAW_Y_09_POS (24U)
#define OSD_REG_DRAW_Y_09_LEN (8U)
#define OSD_REG_DRAW_Y_09_MSK (((1U << OSD_REG_DRAW_Y_09_LEN) - 1) << OSD_REG_DRAW_Y_09_POS)
#define OSD_REG_DRAW_Y_09_UMSK (~(((1U << OSD_REG_DRAW_Y_09_LEN) - 1) << OSD_REG_DRAW_Y_09_POS))
/* 0x74 : draw_partial_x_config9 */
#define OSD_DRAW_PARTIAL_X_CONFIG9_OFFSET (0x74)
#define OSD_REG_DRAW_X_MIN_09 OSD_REG_DRAW_X_MIN_09
#define OSD_REG_DRAW_X_MIN_09_POS (0U)
#define OSD_REG_DRAW_X_MIN_09_LEN (11U)
#define OSD_REG_DRAW_X_MIN_09_MSK (((1U << OSD_REG_DRAW_X_MIN_09_LEN) - 1) << OSD_REG_DRAW_X_MIN_09_POS)
#define OSD_REG_DRAW_X_MIN_09_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_09_LEN) - 1) << OSD_REG_DRAW_X_MIN_09_POS))
#define OSD_REG_DRAW_X_MAX_09 OSD_REG_DRAW_X_MAX_09
#define OSD_REG_DRAW_X_MAX_09_POS (16U)
#define OSD_REG_DRAW_X_MAX_09_LEN (11U)
#define OSD_REG_DRAW_X_MAX_09_MSK (((1U << OSD_REG_DRAW_X_MAX_09_LEN) - 1) << OSD_REG_DRAW_X_MAX_09_POS)
#define OSD_REG_DRAW_X_MAX_09_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_09_LEN) - 1) << OSD_REG_DRAW_X_MAX_09_POS))
/* 0x78 : draw_partial_y_config9 */
#define OSD_DRAW_PARTIAL_Y_CONFIG9_OFFSET (0x78)
#define OSD_REG_DRAW_Y_MIN_09 OSD_REG_DRAW_Y_MIN_09
#define OSD_REG_DRAW_Y_MIN_09_POS (0U)
#define OSD_REG_DRAW_Y_MIN_09_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_09_MSK (((1U << OSD_REG_DRAW_Y_MIN_09_LEN) - 1) << OSD_REG_DRAW_Y_MIN_09_POS)
#define OSD_REG_DRAW_Y_MIN_09_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_09_LEN) - 1) << OSD_REG_DRAW_Y_MIN_09_POS))
#define OSD_REG_DRAW_Y_MAX_09 OSD_REG_DRAW_Y_MAX_09
#define OSD_REG_DRAW_Y_MAX_09_POS (16U)
#define OSD_REG_DRAW_Y_MAX_09_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_09_MSK (((1U << OSD_REG_DRAW_Y_MAX_09_LEN) - 1) << OSD_REG_DRAW_Y_MAX_09_POS)
#define OSD_REG_DRAW_Y_MAX_09_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_09_LEN) - 1) << OSD_REG_DRAW_Y_MAX_09_POS))
/* 0x7C : draw_partial_yuv_configa */
#define OSD_DRAW_PARTIAL_YUV_CONFIGA_OFFSET (0x7C)
#define OSD_REG_DRAW_TH_0A OSD_REG_DRAW_TH_0A
#define OSD_REG_DRAW_TH_0A_POS (0U)
#define OSD_REG_DRAW_TH_0A_LEN (8U)
#define OSD_REG_DRAW_TH_0A_MSK (((1U << OSD_REG_DRAW_TH_0A_LEN) - 1) << OSD_REG_DRAW_TH_0A_POS)
#define OSD_REG_DRAW_TH_0A_UMSK (~(((1U << OSD_REG_DRAW_TH_0A_LEN) - 1) << OSD_REG_DRAW_TH_0A_POS))
#define OSD_REG_DRAW_V_0A OSD_REG_DRAW_V_0A
#define OSD_REG_DRAW_V_0A_POS (8U)
#define OSD_REG_DRAW_V_0A_LEN (8U)
#define OSD_REG_DRAW_V_0A_MSK (((1U << OSD_REG_DRAW_V_0A_LEN) - 1) << OSD_REG_DRAW_V_0A_POS)
#define OSD_REG_DRAW_V_0A_UMSK (~(((1U << OSD_REG_DRAW_V_0A_LEN) - 1) << OSD_REG_DRAW_V_0A_POS))
#define OSD_REG_DRAW_U_0A OSD_REG_DRAW_U_0A
#define OSD_REG_DRAW_U_0A_POS (16U)
#define OSD_REG_DRAW_U_0A_LEN (8U)
#define OSD_REG_DRAW_U_0A_MSK (((1U << OSD_REG_DRAW_U_0A_LEN) - 1) << OSD_REG_DRAW_U_0A_POS)
#define OSD_REG_DRAW_U_0A_UMSK (~(((1U << OSD_REG_DRAW_U_0A_LEN) - 1) << OSD_REG_DRAW_U_0A_POS))
#define OSD_REG_DRAW_Y_0A OSD_REG_DRAW_Y_0A
#define OSD_REG_DRAW_Y_0A_POS (24U)
#define OSD_REG_DRAW_Y_0A_LEN (8U)
#define OSD_REG_DRAW_Y_0A_MSK (((1U << OSD_REG_DRAW_Y_0A_LEN) - 1) << OSD_REG_DRAW_Y_0A_POS)
#define OSD_REG_DRAW_Y_0A_UMSK (~(((1U << OSD_REG_DRAW_Y_0A_LEN) - 1) << OSD_REG_DRAW_Y_0A_POS))
/* 0x80 : draw_partial_x_configa */
#define OSD_DRAW_PARTIAL_X_CONFIGA_OFFSET (0x80)
#define OSD_REG_DRAW_X_MIN_0A OSD_REG_DRAW_X_MIN_0A
#define OSD_REG_DRAW_X_MIN_0A_POS (0U)
#define OSD_REG_DRAW_X_MIN_0A_LEN (11U)
#define OSD_REG_DRAW_X_MIN_0A_MSK (((1U << OSD_REG_DRAW_X_MIN_0A_LEN) - 1) << OSD_REG_DRAW_X_MIN_0A_POS)
#define OSD_REG_DRAW_X_MIN_0A_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_0A_LEN) - 1) << OSD_REG_DRAW_X_MIN_0A_POS))
#define OSD_REG_DRAW_X_MAX_0A OSD_REG_DRAW_X_MAX_0A
#define OSD_REG_DRAW_X_MAX_0A_POS (16U)
#define OSD_REG_DRAW_X_MAX_0A_LEN (11U)
#define OSD_REG_DRAW_X_MAX_0A_MSK (((1U << OSD_REG_DRAW_X_MAX_0A_LEN) - 1) << OSD_REG_DRAW_X_MAX_0A_POS)
#define OSD_REG_DRAW_X_MAX_0A_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_0A_LEN) - 1) << OSD_REG_DRAW_X_MAX_0A_POS))
/* 0x84 : draw_partial_y_configa */
#define OSD_DRAW_PARTIAL_Y_CONFIGA_OFFSET (0x84)
#define OSD_REG_DRAW_Y_MIN_0A OSD_REG_DRAW_Y_MIN_0A
#define OSD_REG_DRAW_Y_MIN_0A_POS (0U)
#define OSD_REG_DRAW_Y_MIN_0A_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_0A_MSK (((1U << OSD_REG_DRAW_Y_MIN_0A_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0A_POS)
#define OSD_REG_DRAW_Y_MIN_0A_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_0A_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0A_POS))
#define OSD_REG_DRAW_Y_MAX_0A OSD_REG_DRAW_Y_MAX_0A
#define OSD_REG_DRAW_Y_MAX_0A_POS (16U)
#define OSD_REG_DRAW_Y_MAX_0A_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_0A_MSK (((1U << OSD_REG_DRAW_Y_MAX_0A_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0A_POS)
#define OSD_REG_DRAW_Y_MAX_0A_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_0A_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0A_POS))
/* 0x88 : draw_partial_yuv_configb */
#define OSD_DRAW_PARTIAL_YUV_CONFIGB_OFFSET (0x88)
#define OSD_REG_DRAW_TH_0B OSD_REG_DRAW_TH_0B
#define OSD_REG_DRAW_TH_0B_POS (0U)
#define OSD_REG_DRAW_TH_0B_LEN (8U)
#define OSD_REG_DRAW_TH_0B_MSK (((1U << OSD_REG_DRAW_TH_0B_LEN) - 1) << OSD_REG_DRAW_TH_0B_POS)
#define OSD_REG_DRAW_TH_0B_UMSK (~(((1U << OSD_REG_DRAW_TH_0B_LEN) - 1) << OSD_REG_DRAW_TH_0B_POS))
#define OSD_REG_DRAW_V_0B OSD_REG_DRAW_V_0B
#define OSD_REG_DRAW_V_0B_POS (8U)
#define OSD_REG_DRAW_V_0B_LEN (8U)
#define OSD_REG_DRAW_V_0B_MSK (((1U << OSD_REG_DRAW_V_0B_LEN) - 1) << OSD_REG_DRAW_V_0B_POS)
#define OSD_REG_DRAW_V_0B_UMSK (~(((1U << OSD_REG_DRAW_V_0B_LEN) - 1) << OSD_REG_DRAW_V_0B_POS))
#define OSD_REG_DRAW_U_0B OSD_REG_DRAW_U_0B
#define OSD_REG_DRAW_U_0B_POS (16U)
#define OSD_REG_DRAW_U_0B_LEN (8U)
#define OSD_REG_DRAW_U_0B_MSK (((1U << OSD_REG_DRAW_U_0B_LEN) - 1) << OSD_REG_DRAW_U_0B_POS)
#define OSD_REG_DRAW_U_0B_UMSK (~(((1U << OSD_REG_DRAW_U_0B_LEN) - 1) << OSD_REG_DRAW_U_0B_POS))
#define OSD_REG_DRAW_Y_0B OSD_REG_DRAW_Y_0B
#define OSD_REG_DRAW_Y_0B_POS (24U)
#define OSD_REG_DRAW_Y_0B_LEN (8U)
#define OSD_REG_DRAW_Y_0B_MSK (((1U << OSD_REG_DRAW_Y_0B_LEN) - 1) << OSD_REG_DRAW_Y_0B_POS)
#define OSD_REG_DRAW_Y_0B_UMSK (~(((1U << OSD_REG_DRAW_Y_0B_LEN) - 1) << OSD_REG_DRAW_Y_0B_POS))
/* 0x8C : draw_partial_x_configb */
#define OSD_DRAW_PARTIAL_X_CONFIGB_OFFSET (0x8C)
#define OSD_REG_DRAW_X_MIN_0B OSD_REG_DRAW_X_MIN_0B
#define OSD_REG_DRAW_X_MIN_0B_POS (0U)
#define OSD_REG_DRAW_X_MIN_0B_LEN (11U)
#define OSD_REG_DRAW_X_MIN_0B_MSK (((1U << OSD_REG_DRAW_X_MIN_0B_LEN) - 1) << OSD_REG_DRAW_X_MIN_0B_POS)
#define OSD_REG_DRAW_X_MIN_0B_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_0B_LEN) - 1) << OSD_REG_DRAW_X_MIN_0B_POS))
#define OSD_REG_DRAW_X_MAX_0B OSD_REG_DRAW_X_MAX_0B
#define OSD_REG_DRAW_X_MAX_0B_POS (16U)
#define OSD_REG_DRAW_X_MAX_0B_LEN (11U)
#define OSD_REG_DRAW_X_MAX_0B_MSK (((1U << OSD_REG_DRAW_X_MAX_0B_LEN) - 1) << OSD_REG_DRAW_X_MAX_0B_POS)
#define OSD_REG_DRAW_X_MAX_0B_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_0B_LEN) - 1) << OSD_REG_DRAW_X_MAX_0B_POS))
/* 0x90 : draw_partial_y_configb */
#define OSD_DRAW_PARTIAL_Y_CONFIGB_OFFSET (0x90)
#define OSD_REG_DRAW_Y_MIN_0B OSD_REG_DRAW_Y_MIN_0B
#define OSD_REG_DRAW_Y_MIN_0B_POS (0U)
#define OSD_REG_DRAW_Y_MIN_0B_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_0B_MSK (((1U << OSD_REG_DRAW_Y_MIN_0B_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0B_POS)
#define OSD_REG_DRAW_Y_MIN_0B_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_0B_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0B_POS))
#define OSD_REG_DRAW_Y_MAX_0B OSD_REG_DRAW_Y_MAX_0B
#define OSD_REG_DRAW_Y_MAX_0B_POS (16U)
#define OSD_REG_DRAW_Y_MAX_0B_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_0B_MSK (((1U << OSD_REG_DRAW_Y_MAX_0B_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0B_POS)
#define OSD_REG_DRAW_Y_MAX_0B_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_0B_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0B_POS))
/* 0x94 : draw_partial_yuv_configc */
#define OSD_DRAW_PARTIAL_YUV_CONFIGC_OFFSET (0x94)
#define OSD_REG_DRAW_TH_0C OSD_REG_DRAW_TH_0C
#define OSD_REG_DRAW_TH_0C_POS (0U)
#define OSD_REG_DRAW_TH_0C_LEN (8U)
#define OSD_REG_DRAW_TH_0C_MSK (((1U << OSD_REG_DRAW_TH_0C_LEN) - 1) << OSD_REG_DRAW_TH_0C_POS)
#define OSD_REG_DRAW_TH_0C_UMSK (~(((1U << OSD_REG_DRAW_TH_0C_LEN) - 1) << OSD_REG_DRAW_TH_0C_POS))
#define OSD_REG_DRAW_V_0C OSD_REG_DRAW_V_0C
#define OSD_REG_DRAW_V_0C_POS (8U)
#define OSD_REG_DRAW_V_0C_LEN (8U)
#define OSD_REG_DRAW_V_0C_MSK (((1U << OSD_REG_DRAW_V_0C_LEN) - 1) << OSD_REG_DRAW_V_0C_POS)
#define OSD_REG_DRAW_V_0C_UMSK (~(((1U << OSD_REG_DRAW_V_0C_LEN) - 1) << OSD_REG_DRAW_V_0C_POS))
#define OSD_REG_DRAW_U_0C OSD_REG_DRAW_U_0C
#define OSD_REG_DRAW_U_0C_POS (16U)
#define OSD_REG_DRAW_U_0C_LEN (8U)
#define OSD_REG_DRAW_U_0C_MSK (((1U << OSD_REG_DRAW_U_0C_LEN) - 1) << OSD_REG_DRAW_U_0C_POS)
#define OSD_REG_DRAW_U_0C_UMSK (~(((1U << OSD_REG_DRAW_U_0C_LEN) - 1) << OSD_REG_DRAW_U_0C_POS))
#define OSD_REG_DRAW_Y_0C OSD_REG_DRAW_Y_0C
#define OSD_REG_DRAW_Y_0C_POS (24U)
#define OSD_REG_DRAW_Y_0C_LEN (8U)
#define OSD_REG_DRAW_Y_0C_MSK (((1U << OSD_REG_DRAW_Y_0C_LEN) - 1) << OSD_REG_DRAW_Y_0C_POS)
#define OSD_REG_DRAW_Y_0C_UMSK (~(((1U << OSD_REG_DRAW_Y_0C_LEN) - 1) << OSD_REG_DRAW_Y_0C_POS))
/* 0x98 : draw_partial_x_configc */
#define OSD_DRAW_PARTIAL_X_CONFIGC_OFFSET (0x98)
#define OSD_REG_DRAW_X_MIN_0C OSD_REG_DRAW_X_MIN_0C
#define OSD_REG_DRAW_X_MIN_0C_POS (0U)
#define OSD_REG_DRAW_X_MIN_0C_LEN (11U)
#define OSD_REG_DRAW_X_MIN_0C_MSK (((1U << OSD_REG_DRAW_X_MIN_0C_LEN) - 1) << OSD_REG_DRAW_X_MIN_0C_POS)
#define OSD_REG_DRAW_X_MIN_0C_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_0C_LEN) - 1) << OSD_REG_DRAW_X_MIN_0C_POS))
#define OSD_REG_DRAW_X_MAX_0C OSD_REG_DRAW_X_MAX_0C
#define OSD_REG_DRAW_X_MAX_0C_POS (16U)
#define OSD_REG_DRAW_X_MAX_0C_LEN (11U)
#define OSD_REG_DRAW_X_MAX_0C_MSK (((1U << OSD_REG_DRAW_X_MAX_0C_LEN) - 1) << OSD_REG_DRAW_X_MAX_0C_POS)
#define OSD_REG_DRAW_X_MAX_0C_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_0C_LEN) - 1) << OSD_REG_DRAW_X_MAX_0C_POS))
/* 0x9C : draw_partial_y_configc */
#define OSD_DRAW_PARTIAL_Y_CONFIGC_OFFSET (0x9C)
#define OSD_REG_DRAW_Y_MIN_0C OSD_REG_DRAW_Y_MIN_0C
#define OSD_REG_DRAW_Y_MIN_0C_POS (0U)
#define OSD_REG_DRAW_Y_MIN_0C_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_0C_MSK (((1U << OSD_REG_DRAW_Y_MIN_0C_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0C_POS)
#define OSD_REG_DRAW_Y_MIN_0C_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_0C_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0C_POS))
#define OSD_REG_DRAW_Y_MAX_0C OSD_REG_DRAW_Y_MAX_0C
#define OSD_REG_DRAW_Y_MAX_0C_POS (16U)
#define OSD_REG_DRAW_Y_MAX_0C_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_0C_MSK (((1U << OSD_REG_DRAW_Y_MAX_0C_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0C_POS)
#define OSD_REG_DRAW_Y_MAX_0C_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_0C_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0C_POS))
/* 0xA0 : draw_partial_yuv_configd */
#define OSD_DRAW_PARTIAL_YUV_CONFIGD_OFFSET (0xA0)
#define OSD_REG_DRAW_TH_0D OSD_REG_DRAW_TH_0D
#define OSD_REG_DRAW_TH_0D_POS (0U)
#define OSD_REG_DRAW_TH_0D_LEN (8U)
#define OSD_REG_DRAW_TH_0D_MSK (((1U << OSD_REG_DRAW_TH_0D_LEN) - 1) << OSD_REG_DRAW_TH_0D_POS)
#define OSD_REG_DRAW_TH_0D_UMSK (~(((1U << OSD_REG_DRAW_TH_0D_LEN) - 1) << OSD_REG_DRAW_TH_0D_POS))
#define OSD_REG_DRAW_V_0D OSD_REG_DRAW_V_0D
#define OSD_REG_DRAW_V_0D_POS (8U)
#define OSD_REG_DRAW_V_0D_LEN (8U)
#define OSD_REG_DRAW_V_0D_MSK (((1U << OSD_REG_DRAW_V_0D_LEN) - 1) << OSD_REG_DRAW_V_0D_POS)
#define OSD_REG_DRAW_V_0D_UMSK (~(((1U << OSD_REG_DRAW_V_0D_LEN) - 1) << OSD_REG_DRAW_V_0D_POS))
#define OSD_REG_DRAW_U_0D OSD_REG_DRAW_U_0D
#define OSD_REG_DRAW_U_0D_POS (16U)
#define OSD_REG_DRAW_U_0D_LEN (8U)
#define OSD_REG_DRAW_U_0D_MSK (((1U << OSD_REG_DRAW_U_0D_LEN) - 1) << OSD_REG_DRAW_U_0D_POS)
#define OSD_REG_DRAW_U_0D_UMSK (~(((1U << OSD_REG_DRAW_U_0D_LEN) - 1) << OSD_REG_DRAW_U_0D_POS))
#define OSD_REG_DRAW_Y_0D OSD_REG_DRAW_Y_0D
#define OSD_REG_DRAW_Y_0D_POS (24U)
#define OSD_REG_DRAW_Y_0D_LEN (8U)
#define OSD_REG_DRAW_Y_0D_MSK (((1U << OSD_REG_DRAW_Y_0D_LEN) - 1) << OSD_REG_DRAW_Y_0D_POS)
#define OSD_REG_DRAW_Y_0D_UMSK (~(((1U << OSD_REG_DRAW_Y_0D_LEN) - 1) << OSD_REG_DRAW_Y_0D_POS))
/* 0xA4 : draw_partial_x_configd */
#define OSD_DRAW_PARTIAL_X_CONFIGD_OFFSET (0xA4)
#define OSD_REG_DRAW_X_MIN_0D OSD_REG_DRAW_X_MIN_0D
#define OSD_REG_DRAW_X_MIN_0D_POS (0U)
#define OSD_REG_DRAW_X_MIN_0D_LEN (11U)
#define OSD_REG_DRAW_X_MIN_0D_MSK (((1U << OSD_REG_DRAW_X_MIN_0D_LEN) - 1) << OSD_REG_DRAW_X_MIN_0D_POS)
#define OSD_REG_DRAW_X_MIN_0D_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_0D_LEN) - 1) << OSD_REG_DRAW_X_MIN_0D_POS))
#define OSD_REG_DRAW_X_MAX_0D OSD_REG_DRAW_X_MAX_0D
#define OSD_REG_DRAW_X_MAX_0D_POS (16U)
#define OSD_REG_DRAW_X_MAX_0D_LEN (11U)
#define OSD_REG_DRAW_X_MAX_0D_MSK (((1U << OSD_REG_DRAW_X_MAX_0D_LEN) - 1) << OSD_REG_DRAW_X_MAX_0D_POS)
#define OSD_REG_DRAW_X_MAX_0D_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_0D_LEN) - 1) << OSD_REG_DRAW_X_MAX_0D_POS))
/* 0xA8 : draw_partial_y_configd */
#define OSD_DRAW_PARTIAL_Y_CONFIGD_OFFSET (0xA8)
#define OSD_REG_DRAW_Y_MIN_0D OSD_REG_DRAW_Y_MIN_0D
#define OSD_REG_DRAW_Y_MIN_0D_POS (0U)
#define OSD_REG_DRAW_Y_MIN_0D_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_0D_MSK (((1U << OSD_REG_DRAW_Y_MIN_0D_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0D_POS)
#define OSD_REG_DRAW_Y_MIN_0D_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_0D_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0D_POS))
#define OSD_REG_DRAW_Y_MAX_0D OSD_REG_DRAW_Y_MAX_0D
#define OSD_REG_DRAW_Y_MAX_0D_POS (16U)
#define OSD_REG_DRAW_Y_MAX_0D_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_0D_MSK (((1U << OSD_REG_DRAW_Y_MAX_0D_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0D_POS)
#define OSD_REG_DRAW_Y_MAX_0D_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_0D_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0D_POS))
/* 0xAC : draw_partial_yuv_confige */
#define OSD_DRAW_PARTIAL_YUV_CONFIGE_OFFSET (0xAC)
#define OSD_REG_DRAW_TH_0E OSD_REG_DRAW_TH_0E
#define OSD_REG_DRAW_TH_0E_POS (0U)
#define OSD_REG_DRAW_TH_0E_LEN (8U)
#define OSD_REG_DRAW_TH_0E_MSK (((1U << OSD_REG_DRAW_TH_0E_LEN) - 1) << OSD_REG_DRAW_TH_0E_POS)
#define OSD_REG_DRAW_TH_0E_UMSK (~(((1U << OSD_REG_DRAW_TH_0E_LEN) - 1) << OSD_REG_DRAW_TH_0E_POS))
#define OSD_REG_DRAW_V_0E OSD_REG_DRAW_V_0E
#define OSD_REG_DRAW_V_0E_POS (8U)
#define OSD_REG_DRAW_V_0E_LEN (8U)
#define OSD_REG_DRAW_V_0E_MSK (((1U << OSD_REG_DRAW_V_0E_LEN) - 1) << OSD_REG_DRAW_V_0E_POS)
#define OSD_REG_DRAW_V_0E_UMSK (~(((1U << OSD_REG_DRAW_V_0E_LEN) - 1) << OSD_REG_DRAW_V_0E_POS))
#define OSD_REG_DRAW_U_0E OSD_REG_DRAW_U_0E
#define OSD_REG_DRAW_U_0E_POS (16U)
#define OSD_REG_DRAW_U_0E_LEN (8U)
#define OSD_REG_DRAW_U_0E_MSK (((1U << OSD_REG_DRAW_U_0E_LEN) - 1) << OSD_REG_DRAW_U_0E_POS)
#define OSD_REG_DRAW_U_0E_UMSK (~(((1U << OSD_REG_DRAW_U_0E_LEN) - 1) << OSD_REG_DRAW_U_0E_POS))
#define OSD_REG_DRAW_Y_0E OSD_REG_DRAW_Y_0E
#define OSD_REG_DRAW_Y_0E_POS (24U)
#define OSD_REG_DRAW_Y_0E_LEN (8U)
#define OSD_REG_DRAW_Y_0E_MSK (((1U << OSD_REG_DRAW_Y_0E_LEN) - 1) << OSD_REG_DRAW_Y_0E_POS)
#define OSD_REG_DRAW_Y_0E_UMSK (~(((1U << OSD_REG_DRAW_Y_0E_LEN) - 1) << OSD_REG_DRAW_Y_0E_POS))
/* 0xB0 : draw_partial_x_confige */
#define OSD_DRAW_PARTIAL_X_CONFIGE_OFFSET (0xB0)
#define OSD_REG_DRAW_X_MIN_0E OSD_REG_DRAW_X_MIN_0E
#define OSD_REG_DRAW_X_MIN_0E_POS (0U)
#define OSD_REG_DRAW_X_MIN_0E_LEN (11U)
#define OSD_REG_DRAW_X_MIN_0E_MSK (((1U << OSD_REG_DRAW_X_MIN_0E_LEN) - 1) << OSD_REG_DRAW_X_MIN_0E_POS)
#define OSD_REG_DRAW_X_MIN_0E_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_0E_LEN) - 1) << OSD_REG_DRAW_X_MIN_0E_POS))
#define OSD_REG_DRAW_X_MAX_0E OSD_REG_DRAW_X_MAX_0E
#define OSD_REG_DRAW_X_MAX_0E_POS (16U)
#define OSD_REG_DRAW_X_MAX_0E_LEN (11U)
#define OSD_REG_DRAW_X_MAX_0E_MSK (((1U << OSD_REG_DRAW_X_MAX_0E_LEN) - 1) << OSD_REG_DRAW_X_MAX_0E_POS)
#define OSD_REG_DRAW_X_MAX_0E_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_0E_LEN) - 1) << OSD_REG_DRAW_X_MAX_0E_POS))
/* 0xB4 : draw_partial_y_confige */
#define OSD_DRAW_PARTIAL_Y_CONFIGE_OFFSET (0xB4)
#define OSD_REG_DRAW_Y_MIN_0E OSD_REG_DRAW_Y_MIN_0E
#define OSD_REG_DRAW_Y_MIN_0E_POS (0U)
#define OSD_REG_DRAW_Y_MIN_0E_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_0E_MSK (((1U << OSD_REG_DRAW_Y_MIN_0E_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0E_POS)
#define OSD_REG_DRAW_Y_MIN_0E_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_0E_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0E_POS))
#define OSD_REG_DRAW_Y_MAX_0E OSD_REG_DRAW_Y_MAX_0E
#define OSD_REG_DRAW_Y_MAX_0E_POS (16U)
#define OSD_REG_DRAW_Y_MAX_0E_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_0E_MSK (((1U << OSD_REG_DRAW_Y_MAX_0E_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0E_POS)
#define OSD_REG_DRAW_Y_MAX_0E_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_0E_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0E_POS))
/* 0xB8 : draw_partial_yuv_configf */
#define OSD_DRAW_PARTIAL_YUV_CONFIGF_OFFSET (0xB8)
#define OSD_REG_DRAW_TH_0F OSD_REG_DRAW_TH_0F
#define OSD_REG_DRAW_TH_0F_POS (0U)
#define OSD_REG_DRAW_TH_0F_LEN (8U)
#define OSD_REG_DRAW_TH_0F_MSK (((1U << OSD_REG_DRAW_TH_0F_LEN) - 1) << OSD_REG_DRAW_TH_0F_POS)
#define OSD_REG_DRAW_TH_0F_UMSK (~(((1U << OSD_REG_DRAW_TH_0F_LEN) - 1) << OSD_REG_DRAW_TH_0F_POS))
#define OSD_REG_DRAW_V_0F OSD_REG_DRAW_V_0F
#define OSD_REG_DRAW_V_0F_POS (8U)
#define OSD_REG_DRAW_V_0F_LEN (8U)
#define OSD_REG_DRAW_V_0F_MSK (((1U << OSD_REG_DRAW_V_0F_LEN) - 1) << OSD_REG_DRAW_V_0F_POS)
#define OSD_REG_DRAW_V_0F_UMSK (~(((1U << OSD_REG_DRAW_V_0F_LEN) - 1) << OSD_REG_DRAW_V_0F_POS))
#define OSD_REG_DRAW_U_0F OSD_REG_DRAW_U_0F
#define OSD_REG_DRAW_U_0F_POS (16U)
#define OSD_REG_DRAW_U_0F_LEN (8U)
#define OSD_REG_DRAW_U_0F_MSK (((1U << OSD_REG_DRAW_U_0F_LEN) - 1) << OSD_REG_DRAW_U_0F_POS)
#define OSD_REG_DRAW_U_0F_UMSK (~(((1U << OSD_REG_DRAW_U_0F_LEN) - 1) << OSD_REG_DRAW_U_0F_POS))
#define OSD_REG_DRAW_Y_0F OSD_REG_DRAW_Y_0F
#define OSD_REG_DRAW_Y_0F_POS (24U)
#define OSD_REG_DRAW_Y_0F_LEN (8U)
#define OSD_REG_DRAW_Y_0F_MSK (((1U << OSD_REG_DRAW_Y_0F_LEN) - 1) << OSD_REG_DRAW_Y_0F_POS)
#define OSD_REG_DRAW_Y_0F_UMSK (~(((1U << OSD_REG_DRAW_Y_0F_LEN) - 1) << OSD_REG_DRAW_Y_0F_POS))
/* 0xBC : draw_partial_x_configf */
#define OSD_DRAW_PARTIAL_X_CONFIGF_OFFSET (0xBC)
#define OSD_REG_DRAW_X_MIN_0F OSD_REG_DRAW_X_MIN_0F
#define OSD_REG_DRAW_X_MIN_0F_POS (0U)
#define OSD_REG_DRAW_X_MIN_0F_LEN (11U)
#define OSD_REG_DRAW_X_MIN_0F_MSK (((1U << OSD_REG_DRAW_X_MIN_0F_LEN) - 1) << OSD_REG_DRAW_X_MIN_0F_POS)
#define OSD_REG_DRAW_X_MIN_0F_UMSK (~(((1U << OSD_REG_DRAW_X_MIN_0F_LEN) - 1) << OSD_REG_DRAW_X_MIN_0F_POS))
#define OSD_REG_DRAW_X_MAX_0F OSD_REG_DRAW_X_MAX_0F
#define OSD_REG_DRAW_X_MAX_0F_POS (16U)
#define OSD_REG_DRAW_X_MAX_0F_LEN (11U)
#define OSD_REG_DRAW_X_MAX_0F_MSK (((1U << OSD_REG_DRAW_X_MAX_0F_LEN) - 1) << OSD_REG_DRAW_X_MAX_0F_POS)
#define OSD_REG_DRAW_X_MAX_0F_UMSK (~(((1U << OSD_REG_DRAW_X_MAX_0F_LEN) - 1) << OSD_REG_DRAW_X_MAX_0F_POS))
/* 0xC0 : draw_partial_y_configf */
#define OSD_DRAW_PARTIAL_Y_CONFIGF_OFFSET (0xC0)
#define OSD_REG_DRAW_Y_MIN_0F OSD_REG_DRAW_Y_MIN_0F
#define OSD_REG_DRAW_Y_MIN_0F_POS (0U)
#define OSD_REG_DRAW_Y_MIN_0F_LEN (11U)
#define OSD_REG_DRAW_Y_MIN_0F_MSK (((1U << OSD_REG_DRAW_Y_MIN_0F_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0F_POS)
#define OSD_REG_DRAW_Y_MIN_0F_UMSK (~(((1U << OSD_REG_DRAW_Y_MIN_0F_LEN) - 1) << OSD_REG_DRAW_Y_MIN_0F_POS))
#define OSD_REG_DRAW_Y_MAX_0F OSD_REG_DRAW_Y_MAX_0F
#define OSD_REG_DRAW_Y_MAX_0F_POS (16U)
#define OSD_REG_DRAW_Y_MAX_0F_LEN (11U)
#define OSD_REG_DRAW_Y_MAX_0F_MSK (((1U << OSD_REG_DRAW_Y_MAX_0F_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0F_POS)
#define OSD_REG_DRAW_Y_MAX_0F_UMSK (~(((1U << OSD_REG_DRAW_Y_MAX_0F_LEN) - 1) << OSD_REG_DRAW_Y_MAX_0F_POS))
/* 0xF8 : osd_int_sts */
#define OSD_DRAW_INT_STS_OFFSET (0xF8)
#define OSD_DRAW_REG_SEOF_INT_CLR_W OSD_DRAW_REG_SEOF_INT_CLR_W
#define OSD_DRAW_REG_SEOF_INT_CLR_W_POS (0U)
#define OSD_DRAW_REG_SEOF_INT_CLR_W_LEN (1U)
#define OSD_DRAW_REG_SEOF_INT_CLR_W_MSK (((1U << OSD_DRAW_REG_SEOF_INT_CLR_W_LEN) - 1) << OSD_DRAW_REG_SEOF_INT_CLR_W_POS)
#define OSD_DRAW_REG_SEOF_INT_CLR_W_UMSK (~(((1U << OSD_DRAW_REG_SEOF_INT_CLR_W_LEN) - 1) << OSD_DRAW_REG_SEOF_INT_CLR_W_POS))
#define OSD_DRAW_REG_SEOF_INT_MASK_W OSD_DRAW_REG_SEOF_INT_MASK_W
#define OSD_DRAW_REG_SEOF_INT_MASK_W_POS (1U)
#define OSD_DRAW_REG_SEOF_INT_MASK_W_LEN (1U)
#define OSD_DRAW_REG_SEOF_INT_MASK_W_MSK (((1U << OSD_DRAW_REG_SEOF_INT_MASK_W_LEN) - 1) << OSD_DRAW_REG_SEOF_INT_MASK_W_POS)
#define OSD_DRAW_REG_SEOF_INT_MASK_W_UMSK (~(((1U << OSD_DRAW_REG_SEOF_INT_MASK_W_LEN) - 1) << OSD_DRAW_REG_SEOF_INT_MASK_W_POS))
#define OSD_DRAW_REG_SEOF_INT_EDGE_W OSD_DRAW_REG_SEOF_INT_EDGE_W
#define OSD_DRAW_REG_SEOF_INT_EDGE_W_POS (2U)
#define OSD_DRAW_REG_SEOF_INT_EDGE_W_LEN (1U)
#define OSD_DRAW_REG_SEOF_INT_EDGE_W_MSK (((1U << OSD_DRAW_REG_SEOF_INT_EDGE_W_LEN) - 1) << OSD_DRAW_REG_SEOF_INT_EDGE_W_POS)
#define OSD_DRAW_REG_SEOF_INT_EDGE_W_UMSK (~(((1U << OSD_DRAW_REG_SEOF_INT_EDGE_W_LEN) - 1) << OSD_DRAW_REG_SEOF_INT_EDGE_W_POS))
#define OSD_DRAW_STS_DRAIN_INT_R OSD_DRAW_STS_DRAIN_INT_R
#define OSD_DRAW_STS_DRAIN_INT_R_POS (16U)
#define OSD_DRAW_STS_DRAIN_INT_R_LEN (4U)
#define OSD_DRAW_STS_DRAIN_INT_R_MSK (((1U << OSD_DRAW_STS_DRAIN_INT_R_LEN) - 1) << OSD_DRAW_STS_DRAIN_INT_R_POS)
#define OSD_DRAW_STS_DRAIN_INT_R_UMSK (~(((1U << OSD_DRAW_STS_DRAIN_INT_R_LEN) - 1) << OSD_DRAW_STS_DRAIN_INT_R_POS))
#define OSD_DRAW_STS_SEOF_INT_R OSD_DRAW_STS_SEOF_INT_R
#define OSD_DRAW_STS_SEOF_INT_R_POS (20U)
#define OSD_DRAW_STS_SEOF_INT_R_LEN (1U)
#define OSD_DRAW_STS_SEOF_INT_R_MSK (((1U << OSD_DRAW_STS_SEOF_INT_R_LEN) - 1) << OSD_DRAW_STS_SEOF_INT_R_POS)
#define OSD_DRAW_STS_SEOF_INT_R_UMSK (~(((1U << OSD_DRAW_STS_SEOF_INT_R_LEN) - 1) << OSD_DRAW_STS_SEOF_INT_R_POS))
/* 0xFC : osd_misc */
#define OSD_DRAW_MISC_OFFSET (0xFC)
#define OSD_DRAW_REG_BUS_STRT_W OSD_DRAW_REG_BUS_STRT_W
#define OSD_DRAW_REG_BUS_STRT_W_POS (0U)
#define OSD_DRAW_REG_BUS_STRT_W_LEN (1U)
#define OSD_DRAW_REG_BUS_STRT_W_MSK (((1U << OSD_DRAW_REG_BUS_STRT_W_LEN) - 1) << OSD_DRAW_REG_BUS_STRT_W_POS)
#define OSD_DRAW_REG_BUS_STRT_W_UMSK (~(((1U << OSD_DRAW_REG_BUS_STRT_W_LEN) - 1) << OSD_DRAW_REG_BUS_STRT_W_POS))
#define OSD_DRAW_REG_FIFO_AUTO_CLR_W OSD_DRAW_REG_FIFO_AUTO_CLR_W
#define OSD_DRAW_REG_FIFO_AUTO_CLR_W_POS (1U)
#define OSD_DRAW_REG_FIFO_AUTO_CLR_W_LEN (1U)
#define OSD_DRAW_REG_FIFO_AUTO_CLR_W_MSK (((1U << OSD_DRAW_REG_FIFO_AUTO_CLR_W_LEN) - 1) << OSD_DRAW_REG_FIFO_AUTO_CLR_W_POS)
#define OSD_DRAW_REG_FIFO_AUTO_CLR_W_UMSK (~(((1U << OSD_DRAW_REG_FIFO_AUTO_CLR_W_LEN) - 1) << OSD_DRAW_REG_FIFO_AUTO_CLR_W_POS))
#define OSD_DRAW_REG_QOS_SW_MODE_W OSD_DRAW_REG_QOS_SW_MODE_W
#define OSD_DRAW_REG_QOS_SW_MODE_W_POS (4U)
#define OSD_DRAW_REG_QOS_SW_MODE_W_LEN (1U)
#define OSD_DRAW_REG_QOS_SW_MODE_W_MSK (((1U << OSD_DRAW_REG_QOS_SW_MODE_W_LEN) - 1) << OSD_DRAW_REG_QOS_SW_MODE_W_POS)
#define OSD_DRAW_REG_QOS_SW_MODE_W_UMSK (~(((1U << OSD_DRAW_REG_QOS_SW_MODE_W_LEN) - 1) << OSD_DRAW_REG_QOS_SW_MODE_W_POS))
#define OSD_DRAW_REG_QOS_SW_W OSD_DRAW_REG_QOS_SW_W
#define OSD_DRAW_REG_QOS_SW_W_POS (5U)
#define OSD_DRAW_REG_QOS_SW_W_LEN (1U)
#define OSD_DRAW_REG_QOS_SW_W_MSK (((1U << OSD_DRAW_REG_QOS_SW_W_LEN) - 1) << OSD_DRAW_REG_QOS_SW_W_POS)
#define OSD_DRAW_REG_QOS_SW_W_UMSK (~(((1U << OSD_DRAW_REG_QOS_SW_W_LEN) - 1) << OSD_DRAW_REG_QOS_SW_W_POS))
#define OSD_DRAW_REG_OSTD_MAX_W OSD_DRAW_REG_OSTD_MAX_W
#define OSD_DRAW_REG_OSTD_MAX_W_POS (8U)
#define OSD_DRAW_REG_OSTD_MAX_W_LEN (2U)
#define OSD_DRAW_REG_OSTD_MAX_W_MSK (((1U << OSD_DRAW_REG_OSTD_MAX_W_LEN) - 1) << OSD_DRAW_REG_OSTD_MAX_W_POS)
#define OSD_DRAW_REG_OSTD_MAX_W_UMSK (~(((1U << OSD_DRAW_REG_OSTD_MAX_W_LEN) - 1) << OSD_DRAW_REG_OSTD_MAX_W_POS))
#define OSD_DRAW_REG_XLEN_W OSD_DRAW_REG_XLEN_W
#define OSD_DRAW_REG_XLEN_W_POS (12U)
#define OSD_DRAW_REG_XLEN_W_LEN (3U)
#define OSD_DRAW_REG_XLEN_W_MSK (((1U << OSD_DRAW_REG_XLEN_W_LEN) - 1) << OSD_DRAW_REG_XLEN_W_POS)
#define OSD_DRAW_REG_XLEN_W_UMSK (~(((1U << OSD_DRAW_REG_XLEN_W_LEN) - 1) << OSD_DRAW_REG_XLEN_W_POS))
#define OSD_DRAW_STS_L0_CMD_IDLE_R OSD_DRAW_STS_L0_CMD_IDLE_R
#define OSD_DRAW_STS_L0_CMD_IDLE_R_POS (16U)
#define OSD_DRAW_STS_L0_CMD_IDLE_R_LEN (1U)
#define OSD_DRAW_STS_L0_CMD_IDLE_R_MSK (((1U << OSD_DRAW_STS_L0_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L0_CMD_IDLE_R_POS)
#define OSD_DRAW_STS_L0_CMD_IDLE_R_UMSK (~(((1U << OSD_DRAW_STS_L0_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L0_CMD_IDLE_R_POS))
#define OSD_DRAW_STS_L1_CMD_IDLE_R OSD_DRAW_STS_L1_CMD_IDLE_R
#define OSD_DRAW_STS_L1_CMD_IDLE_R_POS (17U)
#define OSD_DRAW_STS_L1_CMD_IDLE_R_LEN (1U)
#define OSD_DRAW_STS_L1_CMD_IDLE_R_MSK (((1U << OSD_DRAW_STS_L1_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L1_CMD_IDLE_R_POS)
#define OSD_DRAW_STS_L1_CMD_IDLE_R_UMSK (~(((1U << OSD_DRAW_STS_L1_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L1_CMD_IDLE_R_POS))
#define OSD_DRAW_STS_L2_CMD_IDLE_R OSD_DRAW_STS_L2_CMD_IDLE_R
#define OSD_DRAW_STS_L2_CMD_IDLE_R_POS (18U)
#define OSD_DRAW_STS_L2_CMD_IDLE_R_LEN (1U)
#define OSD_DRAW_STS_L2_CMD_IDLE_R_MSK (((1U << OSD_DRAW_STS_L2_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L2_CMD_IDLE_R_POS)
#define OSD_DRAW_STS_L2_CMD_IDLE_R_UMSK (~(((1U << OSD_DRAW_STS_L2_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L2_CMD_IDLE_R_POS))
#define OSD_DRAW_STS_L3_CMD_IDLE_R OSD_DRAW_STS_L3_CMD_IDLE_R
#define OSD_DRAW_STS_L3_CMD_IDLE_R_POS (19U)
#define OSD_DRAW_STS_L3_CMD_IDLE_R_LEN (1U)
#define OSD_DRAW_STS_L3_CMD_IDLE_R_MSK (((1U << OSD_DRAW_STS_L3_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L3_CMD_IDLE_R_POS)
#define OSD_DRAW_STS_L3_CMD_IDLE_R_UMSK (~(((1U << OSD_DRAW_STS_L3_CMD_IDLE_R_LEN) - 1) << OSD_DRAW_STS_L3_CMD_IDLE_R_POS))
#define OSD_DRAW_STS_AXI_IDLE_R OSD_DRAW_STS_AXI_IDLE_R
#define OSD_DRAW_STS_AXI_IDLE_R_POS (20U)
#define OSD_DRAW_STS_AXI_IDLE_R_LEN (1U)
#define OSD_DRAW_STS_AXI_IDLE_R_MSK (((1U << OSD_DRAW_STS_AXI_IDLE_R_LEN) - 1) << OSD_DRAW_STS_AXI_IDLE_R_POS)
#define OSD_DRAW_STS_AXI_IDLE_R_UMSK (~(((1U << OSD_DRAW_STS_AXI_IDLE_R_LEN) - 1) << OSD_DRAW_STS_AXI_IDLE_R_POS))
#define OSD_DRAW_REG_PCLK_FORCE_ON_W OSD_DRAW_REG_PCLK_FORCE_ON_W
#define OSD_DRAW_REG_PCLK_FORCE_ON_W_POS (24U)
#define OSD_DRAW_REG_PCLK_FORCE_ON_W_LEN (8U)
#define OSD_DRAW_REG_PCLK_FORCE_ON_W_MSK (((1U << OSD_DRAW_REG_PCLK_FORCE_ON_W_LEN) - 1) << OSD_DRAW_REG_PCLK_FORCE_ON_W_POS)
#define OSD_DRAW_REG_PCLK_FORCE_ON_W_UMSK (~(((1U << OSD_DRAW_REG_PCLK_FORCE_ON_W_LEN) - 1) << OSD_DRAW_REG_PCLK_FORCE_ON_W_POS))
struct osd_draw_reg {
/* 0x0 : osd_draw_config */
union {
struct {
uint32_t reg_draw_en_l : 16; /* [15: 0], r/w, 0x0 */
uint32_t reg_draw_type_l : 16; /* [31:16], r/w, 0x0 */
} BF;
uint32_t WORD;
} osd_draw_config;
/* 0x4 : draw_partial_yuv_config0 */
union {
struct {
uint32_t reg_draw_th_00 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_00 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_00 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_00 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config0;
/* 0x8 : draw_partial_x_config0 */
union {
struct {
uint32_t reg_draw_x_min_00 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_00 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config0;
/* 0xC : draw_partial_y_config0 */
union {
struct {
uint32_t reg_draw_y_min_00 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_00 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config0;
/* 0x10 : draw_partial_yuv_config1 */
union {
struct {
uint32_t reg_draw_th_01 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_01 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_01 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_01 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config1;
/* 0x14 : draw_partial_x_config1 */
union {
struct {
uint32_t reg_draw_x_min_01 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_01 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config1;
/* 0x18 : draw_partial_y_config1 */
union {
struct {
uint32_t reg_draw_y_min_01 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_01 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config1;
/* 0x1C : draw_partial_yuv_config2 */
union {
struct {
uint32_t reg_draw_th_02 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_02 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_02 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_02 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config2;
/* 0x20 : draw_partial_x_config2 */
union {
struct {
uint32_t reg_draw_x_min_02 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_02 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config2;
/* 0x24 : draw_partial_y_config2 */
union {
struct {
uint32_t reg_draw_y_min_02 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_02 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config2;
/* 0x28 : draw_partial_yuv_config3 */
union {
struct {
uint32_t reg_draw_th_03 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_03 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_03 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_03 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config3;
/* 0x2C : draw_partial_x_config3 */
union {
struct {
uint32_t reg_draw_x_min_03 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_03 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config3;
/* 0x30 : draw_partial_y_config3 */
union {
struct {
uint32_t reg_draw_y_min_03 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_03 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config3;
/* 0x34 : draw_partial_yuv_config4 */
union {
struct {
uint32_t reg_draw_th_04 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_04 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_04 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_04 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config4;
/* 0x38 : draw_partial_x_config4 */
union {
struct {
uint32_t reg_draw_x_min_04 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_04 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config4;
/* 0x3C : draw_partial_y_config4 */
union {
struct {
uint32_t reg_draw_y_min_04 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_04 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config4;
/* 0x40 : draw_partial_yuv_config5 */
union {
struct {
uint32_t reg_draw_th_05 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_05 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_05 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_05 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config5;
/* 0x44 : draw_partial_x_config5 */
union {
struct {
uint32_t reg_draw_x_min_05 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_05 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config5;
/* 0x48 : draw_partial_y_config5 */
union {
struct {
uint32_t reg_draw_y_min_05 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_05 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config5;
/* 0x4C : draw_partial_yuv_config6 */
union {
struct {
uint32_t reg_draw_th_06 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_06 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_06 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_06 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config6;
/* 0x50 : draw_partial_x_config6 */
union {
struct {
uint32_t reg_draw_x_min_06 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_06 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config6;
/* 0x54 : draw_partial_y_config6 */
union {
struct {
uint32_t reg_draw_y_min_06 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_06 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config6;
/* 0x58 : draw_partial_yuv_config7 */
union {
struct {
uint32_t reg_draw_th_07 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_07 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_07 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_07 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config7;
/* 0x5C : draw_partial_x_config7 */
union {
struct {
uint32_t reg_draw_x_min_07 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_07 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config7;
/* 0x60 : draw_partial_y_config7 */
union {
struct {
uint32_t reg_draw_y_min_07 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_07 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config7;
/* 0x64 : draw_partial_yuv_config8 */
union {
struct {
uint32_t reg_draw_th_08 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_08 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_08 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_08 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config8;
/* 0x68 : draw_partial_x_config8 */
union {
struct {
uint32_t reg_draw_x_min_08 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_08 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config8;
/* 0x6C : draw_partial_y_config8 */
union {
struct {
uint32_t reg_draw_y_min_08 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_08 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config8;
/* 0x70 : draw_partial_yuv_config9 */
union {
struct {
uint32_t reg_draw_th_09 : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_09 : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_09 : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_09 : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_config9;
/* 0x74 : draw_partial_x_config9 */
union {
struct {
uint32_t reg_draw_x_min_09 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_09 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_config9;
/* 0x78 : draw_partial_y_config9 */
union {
struct {
uint32_t reg_draw_y_min_09 : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_09 : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_config9;
/* 0x7C : draw_partial_yuv_configa */
union {
struct {
uint32_t reg_draw_th_0a : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_0a : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_0a : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_0a : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_configa;
/* 0x80 : draw_partial_x_configa */
union {
struct {
uint32_t reg_draw_x_min_0a : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_0a : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_configa;
/* 0x84 : draw_partial_y_configa */
union {
struct {
uint32_t reg_draw_y_min_0a : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_0a : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_configa;
/* 0x88 : draw_partial_yuv_configb */
union {
struct {
uint32_t reg_draw_th_0b : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_0b : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_0b : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_0b : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_configb;
/* 0x8C : draw_partial_x_configb */
union {
struct {
uint32_t reg_draw_x_min_0b : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_0b : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_configb;
/* 0x90 : draw_partial_y_configb */
union {
struct {
uint32_t reg_draw_y_min_0b : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_0b : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_configb;
/* 0x94 : draw_partial_yuv_configc */
union {
struct {
uint32_t reg_draw_th_0c : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_0c : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_0c : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_0c : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_configc;
/* 0x98 : draw_partial_x_configc */
union {
struct {
uint32_t reg_draw_x_min_0c : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_0c : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_configc;
/* 0x9C : draw_partial_y_configc */
union {
struct {
uint32_t reg_draw_y_min_0c : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_0c : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_configc;
/* 0xA0 : draw_partial_yuv_configd */
union {
struct {
uint32_t reg_draw_th_0d : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_0d : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_0d : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_0d : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_configd;
/* 0xA4 : draw_partial_x_configd */
union {
struct {
uint32_t reg_draw_x_min_0d : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_0d : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_configd;
/* 0xA8 : draw_partial_y_configd */
union {
struct {
uint32_t reg_draw_y_min_0d : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_0d : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_configd;
/* 0xAC : draw_partial_yuv_confige */
union {
struct {
uint32_t reg_draw_th_0e : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_0e : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_0e : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_0e : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_confige;
/* 0xB0 : draw_partial_x_confige */
union {
struct {
uint32_t reg_draw_x_min_0e : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_0e : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_confige;
/* 0xB4 : draw_partial_y_confige */
union {
struct {
uint32_t reg_draw_y_min_0e : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_0e : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_confige;
/* 0xB8 : draw_partial_yuv_configf */
union {
struct {
uint32_t reg_draw_th_0f : 8; /* [ 7: 0], r/w, 0x0 */
uint32_t reg_draw_v_0f : 8; /* [15: 8], r/w, 0x0 */
uint32_t reg_draw_u_0f : 8; /* [23:16], r/w, 0x0 */
uint32_t reg_draw_y_0f : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_yuv_configf;
/* 0xBC : draw_partial_x_configf */
union {
struct {
uint32_t reg_draw_x_min_0f : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_x_max_0f : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_x_configf;
/* 0xC0 : draw_partial_y_configf */
union {
struct {
uint32_t reg_draw_y_min_0f : 11; /* [10: 0], r/w, 0x0 */
uint32_t reserved_11_15 : 5; /* [15:11], rsvd, 0x0 */
uint32_t reg_draw_y_max_0f : 11; /* [26:16], r/w, 0x0 */
uint32_t reserved_27_31 : 5; /* [31:27], rsvd, 0x0 */
} BF;
uint32_t WORD;
} draw_partial_y_configf;
/* 0xc4 reserved */
uint8_t RESERVED0xc4[52];
/* 0xF8 : osd_int_sts */
union {
struct {
uint32_t reg_seof_int_clr_w : 1; /* [ 0], w1p, 0x0 */
uint32_t reg_seof_int_mask_w : 1; /* [ 1], r/w, 0x0 */
uint32_t reg_seof_int_edge_w : 1; /* [ 2], r/w, 0x0 */
uint32_t reserved_3_15 : 13; /* [15: 3], rsvd, 0x0 */
uint32_t sts_drain_int_r : 4; /* [19:16], r, 0x0 */
uint32_t sts_seof_int_r : 1; /* [ 20], r, 0x0 */
uint32_t reserved_21_31 : 11; /* [31:21], rsvd, 0x0 */
} BF;
uint32_t WORD;
} osd_int_sts;
/* 0xFC : osd_misc */
union {
struct {
uint32_t reg_bus_strt_w : 1; /* [ 0], w1p, 0x0 */
uint32_t reg_fifo_auto_clr_w : 1; /* [ 1], r/w, 0x1 */
uint32_t reserved_2_3 : 2; /* [ 3: 2], rsvd, 0x0 */
uint32_t reg_qos_sw_mode_w : 1; /* [ 4], r/w, 0x0 */
uint32_t reg_qos_sw_w : 1; /* [ 5], r/w, 0x0 */
uint32_t reserved_6_7 : 2; /* [ 7: 6], rsvd, 0x0 */
uint32_t reg_ostd_max_w : 2; /* [ 9: 8], r/w, 0x3 */
uint32_t reserved_10_11 : 2; /* [11:10], rsvd, 0x0 */
uint32_t reg_xlen_w : 3; /* [14:12], r/w, 0x4 */
uint32_t reserved_15 : 1; /* [ 15], rsvd, 0x0 */
uint32_t sts_l0_cmd_idle_r : 1; /* [ 16], r, 0x0 */
uint32_t sts_l1_cmd_idle_r : 1; /* [ 17], r, 0x0 */
uint32_t sts_l2_cmd_idle_r : 1; /* [ 18], r, 0x0 */
uint32_t sts_l3_cmd_idle_r : 1; /* [ 19], r, 0x0 */
uint32_t sts_axi_idle_r : 1; /* [ 20], r, 0x0 */
uint32_t reserved_21_23 : 3; /* [23:21], rsvd, 0x0 */
uint32_t reg_pclk_force_on_w : 8; /* [31:24], r/w, 0x0 */
} BF;
uint32_t WORD;
} osd_misc;
};
typedef volatile struct osd_draw_reg osd_draw_reg_t;
#endif /* __OSD_REG_H__ */
|
5018dba70bb5b3ad94f45e3ba75c54626530d02a
|
5eff7a36d9a9917dce9111f0c3074375fe6f7656
|
/driver/xf86-input-acecad/src/acecad.h
|
a2b5c669be609d2f0c6f50b7576bea60ac3577b9
|
[
"MIT"
] |
permissive
|
openbsd/xenocara
|
cb392d02ebba06f6ff7d826fd8a89aa3b8401779
|
a012b5de33ea0b977095d77316a521195b26cc6b
|
refs/heads/master
| 2023-08-25T12:16:58.862008
| 2023-08-12T16:16:25
| 2023-08-12T16:16:25
| 66,967,384
| 177
| 66
| null | 2023-07-22T18:12:37
| 2016-08-30T18:36:01
|
C
|
UTF-8
|
C
| false
| false
| 4,605
|
h
|
acecad.h
|
/*
* Copyright (c) 2001 Edouard TISSERANT <tissered@esstin.u-nancy.fr>
* Parts inspired from Shane Watts <shane@bofh.asn.au> Xfree 3 Acecad Driver
* Thanks to Emily, from AceCad, For giving me documents.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#ifndef _ACECAD_H_
#define _ACECAD_H_
/******************************************************************************
* Definitions
* structs, typedefs, #defines, enums
*****************************************************************************/
#define ACECAD_PACKET_SIZE 7
#define ACECAD_CONFIG "a" /* Send configuration (max coords) */
#define ACECAD_ABSOLUTE 'F' /* Absolute mode */
#define ACECAD_RELATIVE 'E' /* Relative mode */
#define ACECAD_UPPER_ORIGIN "b" /* Origin upper left */
#define ACECAD_PROMPT_MODE "B" /* Prompt mode */
#define ACECAD_STREAM_MODE "@" /* Stream mode */
#define ACECAD_INCREMENT 'I' /* Set increment */
#define ACECAD_BINARY_FMT "zb" /* Binary reporting */
#define ACECAD_PROMPT "P" /* Prompt for current position */
#define PHASING_BIT 0x80
#define PROXIMITY_BIT 0x40
#define TABID_BIT 0x20
#define XSIGN_BIT 0x10
#define YSIGN_BIT 0x08
#define BUTTON_BITS 0x07
#define COORD_BITS 0x7f
#define ABSOLUTE_FLAG 1
#define USB_FLAG 2
#define AUTODEV_FLAG 4
#define AVAIL_FLAG 8
#define NOTAVAIL ((errno == ENODEV) || (errno == ENXIO) || (errno == ENOENT))
#define milisleep(ms) usleep (ms * 1000)
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
static const char * acecad_initstr = ACECAD_BINARY_FMT ACECAD_STREAM_MODE;
typedef struct
{
XISBuffer *buffer;
int acecadInc; /* increment between transmits */
int acecadOldX; /* previous X position */
int acecadOldY; /* previous Y position */
int acecadOldZ; /* previous Z position */
int acecadOldProximity; /* previous proximity */
int acecadOldButtons; /* previous buttons state */
int acecadMaxX; /* max X value */
int acecadMaxY; /* max Y value */
int acecadMaxZ; /* max Y value */
char acecadReportSpeed; /* report speed */
int flags; /* various flags */
int packeti; /* number of bytes read */
int PacketSize; /* number of bytes read */
unsigned char packet[ACECAD_PACKET_SIZE]; /* data read on the device */
} AceCadPrivateRec, *AceCadPrivatePtr;
/******************************************************************************
* Declarations
*****************************************************************************/
#ifdef XFree86LOADER
static MODULESETUPPROTO( SetupProc );
static void TearDownProc (void *);
#endif
static Bool DeviceControl (DeviceIntPtr, int);
static Bool DeviceOn (DeviceIntPtr);
static Bool DeviceOff (DeviceIntPtr);
static Bool DeviceClose (DeviceIntPtr);
static Bool DeviceInit (DeviceIntPtr);
static void ReadInput (InputInfoPtr);
static Bool ConvertProc (InputInfoPtr, int, int, int, int, int, int, int, int, int *, int *);
static Bool ReverseConvertProc(InputInfoPtr , int , int , int*);
static Bool QueryHardware (AceCadPrivatePtr);
static void NewPacket (AceCadPrivatePtr priv);
static Bool AceCadGetPacket (AceCadPrivatePtr);
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
static InputInfoPtr AceCadPreInit(InputDriverPtr, IDevPtr , int);
#else
static int AceCadPreInit(InputDriverPtr, InputInfoPtr , int);
#endif
#ifdef HAVE_LINUX_INPUT_H
static void USBReadInput (InputInfoPtr);
static Bool USBQueryHardware (InputInfoPtr);
static int IsUSBLine(int);
static Bool fd_query_acecad(int, char*);
static Bool AceCadAutoDevProbe(InputInfoPtr, int);
#endif
#endif
|
8b222164b55be2e286e58654392014131abbc9c9
|
8e9b21f8b0e8bae10e333b2cdc45c0c70df361fe
|
/kernel/arch/x86/interrupt.c
|
14c751be484d61e7bedd903f0b4d6c37f78a0855
|
[
"GPL-3.0-only"
] |
permissive
|
tyler569/nightingale
|
6173abf28d1e5399d77ec3d9977ab7c9562d0913
|
ea07ccb768105d942b4391c79fde2089c06dcea7
|
refs/heads/master
| 2023-08-04T20:49:28.852042
| 2023-07-27T16:31:20
| 2023-07-27T17:06:43
| 80,633,386
| 147
| 13
|
MIT
| 2019-04-12T01:31:33
| 2017-02-01T15:28:03
|
C
|
UTF-8
|
C
| false
| false
| 12,609
|
c
|
interrupt.c
|
#include <basic.h>
#include <assert.h>
#include <ng/debug.h>
#include <ng/irq.h>
#include <ng/panic.h>
#include <ng/signal.h>
#include <ng/syscall.h>
#include <ng/thread.h>
#include <ng/vmm.h>
#include <stdio.h>
#include <string.h>
#include <x86/apic.h>
#include <x86/cpu.h>
#include <x86/interrupt.h>
#include <x86/pic.h>
#include <x86/pit.h>
#include <x86/uart.h>
#define USING_PIC 0
#if USING_PIC
#define send_eoi pic_send_eoi
#else
#define send_eoi lapic_eoi
#endif
// Stack dumps are not particularly helpful in the general case. This could be
// a runtime option though, it's a good candidate for that system when it
// happens.
#define DO_STACK_DUMP 0
static void print_error_dump(interrupt_frame *r);
bool do_perf_trace = false;
void raw_set_idt_gate(uint64_t *idt, int index, void (*handler)(void),
uint64_t flags, uint64_t cs, uint64_t ist)
{
uint64_t *at = idt + index * 2;
uint64_t h = (uint64_t)handler;
uint64_t handler_low = h & 0xFFFF;
uint64_t handler_med = (h >> 16) & 0xFFFF;
uint64_t handler_high = h >> 32;
at[0] = handler_low | (cs << 16) | (ist << 32) | (flags << 40)
| (handler_med << 48);
at[1] = handler_high;
}
enum idt_gate_flags {
NONE = 0,
USER_MODE = (1 << 0),
STOP_IRQS = (1 << 1),
};
void register_idt_gate(int index, void (*handler)(void), int opts, int ist)
{
// TODO put these in a header
uint16_t selector = 8; // kernel CS
uint8_t rpl = (opts & USER_MODE) ? 3 : 0;
uint8_t type = (opts & STOP_IRQS) ? 0xe : 0xf; // interrupt vs trap gates
uint64_t flags = 0x80 | rpl << 5 | type;
extern uint64_t idt[];
raw_set_idt_gate(idt, index, handler, flags, selector, ist);
}
bool doing_exception_print = false;
void panic_trap_handler(interrupt_frame *r);
void halt_trap_handler(interrupt_frame *r);
__USED
void c_interrupt_shim(interrupt_frame *r)
{
running_thread->irq_disable_depth += 1;
bool from_usermode = false;
assert(r->ss == 0x23 || r->ss == 0);
if (r->ds > 0) {
from_usermode = true;
running_thread->user_sp = r->user_sp;
running_thread->user_ctx = r;
running_thread->flags |= TF_USER_CTX_VALID;
}
if (r->interrupt_number == 1 && running_thread->tracer) {
trace_report_trap(1);
} else if (r->interrupt_number == 3 && running_thread->tracer) {
trace_report_trap(3);
} else if (r->interrupt_number == 14) {
page_fault(r);
} else if (r->interrupt_number == 127) {
asm volatile("movl $0, %esp");
} else if (r->interrupt_number == 128) {
syscall_handler(r);
} else if (r->interrupt_number == 130) {
panic_trap_handler(r);
} else if (r->interrupt_number == 131) {
halt_trap_handler(r);
} else if (r->interrupt_number < 32) {
generic_exception(r);
} else if (r->interrupt_number == 32) {
if (do_perf_trace)
print_perf_trace(r->bp, r->ip);
// timer interrupt needs to EOI first
send_eoi(r->interrupt_number - 32);
irq_handler(r);
} else if (r->interrupt_number < 32 + NIRQS) {
irq_handler(r);
send_eoi(r->interrupt_number - 32);
}
if (from_usermode)
running_thread->flags &= ~TF_USER_CTX_VALID;
assert(r->ss == 0x23 || r->ss == 0);
running_thread->irq_disable_depth -= 1;
}
void syscall_handler(interrupt_frame *r) { do_syscall(r); }
void panic_trap_handler(interrupt_frame *r)
{
disable_irqs();
printf("\n");
printf("panic: trap at %#lx\n", r->ip);
print_error_dump(r);
panic();
}
void halt_trap_handler(interrupt_frame *r)
{
disable_irqs();
printf("\nhalt: trap cpu %i at %#lx\n", cpu_id(), r->ip);
// Cannot use panic() or halt() since those will send more IPIs
while (true)
asm volatile("hlt");
}
static void print_error_dump(interrupt_frame *r)
{
static spinlock_t lock = { 0 };
spin_lock(&lock);
uintptr_t ip = r->ip;
uintptr_t bp = r->bp;
printf("(CPU %i) Fault occurred at %#lx\n", cpu_id(), ip);
print_registers(r);
// printf("backtrace from: %#lx\n", bp);
backtrace_from_with_ip(bp, ip);
if (r != running_thread->user_ctx
&& running_thread->flags & TF_USER_CTX_VALID) {
// printf("user backtrace from: %#lx\n", running_thread->user_ctx->bp);
backtrace_from_with_ip(
running_thread->user_ctx->bp, running_thread->user_ctx->ip);
}
#if DO_STACK_DUMP
printf("Stack dump: (sp at %#lx)\n", real_sp);
dump_mem((char *)real_sp - 64, 128);
#endif
spin_unlock(&lock);
}
static noreturn void kill_for_unhandled_interrupt(interrupt_frame *r)
{
if ((r->cs & 3) > 0) {
// died in usermode
signal_self(SIGSEGV);
} else if (running_process->pid > 0) {
// died in kernel mode in a user process
printf("Would signal SEGV, but we decided that was a bad idea\n");
kill_process(running_process, 128 + SIGSEGV);
} else {
// died in kernel mode
panic();
}
UNREACHABLE();
}
void page_fault(interrupt_frame *r)
{
uintptr_t fault_addr;
int code = r->error_code;
const char *reason, *rw, *mode, *type;
asm volatile("mov %%cr2, %0" : "=r"(fault_addr));
if (vmm_do_page_fault(fault_addr, code) == FAULT_CONTINUE) {
// handled and able to return
return;
}
if (r->error_code & F_RESERVED) {
printf("Fault was caused by writing to a reserved field\n");
}
reason = code & F_PRESENT ? "protection violation" : "page not present";
rw = code & F_WRITE ? "writing" : "reading";
mode = code & F_USERMODE ? "user" : "kernel";
type = code & F_IFETCH ? "instruction" : "data";
printf("Thread: [%i:%i] (\"%s\") performed an access violation\n",
running_process->pid, running_thread->tid, running_process->comm);
const char *sentence = "Fault %s %s:%#lx because %s from %s mode.\n";
printf(sentence, rw, type, fault_addr, reason, mode);
if (fault_addr < 0x1000)
printf("NULL pointer access?\n");
break_point();
print_error_dump(r);
if (code & F_USERMODE)
signal_self(SIGSEGV);
kill_for_unhandled_interrupt(r);
}
void generic_exception(interrupt_frame *r)
{
printf("Thread: [%i:%i] (\"%s\") experienced a fault\n",
running_process->pid, running_thread->tid, running_process->comm);
printf("Unhandled exception at %#lx\n", r->ip);
printf("Fault: %s (%s), error code: %#04lx\n",
exception_codes[r->interrupt_number],
exception_reasons[r->interrupt_number], r->error_code);
break_point();
print_error_dump(r);
kill_for_unhandled_interrupt(r);
}
void unhandled_interrupt_handler(interrupt_frame *r) { }
/* Utility functions */
void enable_irqs(void)
{
// printf("[e%i]", running_thread->irq_disable_depth);
running_thread->irq_disable_depth -= 1;
assert(running_thread->irq_disable_depth >= 0);
if (running_thread->irq_disable_depth == 0)
asm volatile("sti");
}
void disable_irqs(void)
{
// printf("[d%i]", running_thread->irq_disable_depth);
asm volatile("cli");
running_thread->irq_disable_depth += 1;
}
bool irqs_are_disabled(void)
{
long flags;
asm volatile("pushfq; pop %0" : "=r"(flags));
if (flags & 0x200) {
assert(running_thread->irq_disable_depth == 0);
return false;
} else {
assert(running_thread->irq_disable_depth > 0);
return true;
}
}
const char *exception_codes[] = {
"#DE",
"#DB",
"NMI",
"#BP",
"#OF",
"#BR",
"#UD",
"#NM",
"#DF",
"<none>",
"#TS",
"#NP",
"#SS",
"#GP",
"#PF",
"<reserved>",
"#MF",
"#AC",
"#MC",
"#XM",
"#VE",
"<reserved>",
"<reserved>",
"<reserved>",
"<reserved>",
"<reserved>",
"<reserved>",
"<reserved>",
"<reserved>",
"<reserved>",
"#SX",
"<reserved>",
};
const char *exception_reasons[] = {
"Divide by zero",
"Debug",
"Non-maskable Interrupt",
"Breakpoint",
"Overflow Trap",
"Bound Range Exceeded",
"Invalid Opcode",
"Device Not Available",
"Double Fault",
"Coprocessor Segment Overrun (Deprecated)",
"Invalid TSS",
"Segment Not Present",
"Stack-Segment Fault",
"General Protection Fault",
"Page Fault",
"Reserved",
"x87 Floating Point Exception",
"Alignment Check",
"Machine Check",
"SIMD Floating-Point Exception",
"Virtualization Exception",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Security Exception",
"Reserved",
};
extern void isr0(void);
extern void isr1(void);
extern void isr2(void);
extern void isr3(void);
extern void isr4(void);
extern void isr5(void);
extern void isr6(void);
extern void isr7(void);
extern void isr8(void);
extern void isr9(void);
extern void isr10(void);
extern void isr11(void);
extern void isr12(void);
extern void isr13(void);
extern void isr14(void);
extern void isr15(void);
extern void isr16(void);
extern void isr17(void);
extern void isr18(void);
extern void isr19(void);
extern void isr20(void);
extern void isr21(void);
extern void isr22(void);
extern void isr23(void);
extern void isr24(void);
extern void isr25(void);
extern void isr26(void);
extern void isr27(void);
extern void isr28(void);
extern void isr29(void);
extern void isr30(void);
extern void isr31(void);
extern void irq0(void);
extern void irq1(void);
extern void irq2(void);
extern void irq3(void);
extern void irq4(void);
extern void irq5(void);
extern void irq6(void);
extern void irq7(void);
extern void irq8(void);
extern void irq9(void);
extern void irq10(void);
extern void irq11(void);
extern void irq12(void);
extern void irq13(void);
extern void irq14(void);
extern void irq15(void);
extern void isr_double_fault(void);
extern void isr_syscall(void);
extern void isr_yield(void);
extern void isr_panic(void);
extern void isr_halt(void);
extern void break_point(void);
void idt_install()
{
register_idt_gate(0, isr0, STOP_IRQS, 0);
register_idt_gate(1, isr1, STOP_IRQS, 0);
register_idt_gate(2, isr2, STOP_IRQS, 0);
register_idt_gate(3, isr3, STOP_IRQS, 0);
register_idt_gate(4, isr4, STOP_IRQS, 0);
register_idt_gate(5, isr5, STOP_IRQS, 0);
register_idt_gate(6, isr6, STOP_IRQS, 0);
register_idt_gate(7, isr7, STOP_IRQS, 0);
register_idt_gate(8, isr8, STOP_IRQS, 1);
register_idt_gate(9, isr9, STOP_IRQS, 0);
register_idt_gate(10, isr10, STOP_IRQS, 0);
register_idt_gate(11, isr11, STOP_IRQS, 0);
register_idt_gate(12, isr12, STOP_IRQS, 0);
register_idt_gate(13, isr13, STOP_IRQS, 0);
register_idt_gate(14, isr14, STOP_IRQS, 0);
register_idt_gate(15, isr15, STOP_IRQS, 0);
register_idt_gate(16, isr16, STOP_IRQS, 0);
register_idt_gate(17, isr17, STOP_IRQS, 0);
register_idt_gate(18, isr18, STOP_IRQS, 0);
register_idt_gate(19, isr19, STOP_IRQS, 0);
register_idt_gate(20, isr20, STOP_IRQS, 0);
register_idt_gate(21, isr21, STOP_IRQS, 0);
register_idt_gate(22, isr22, STOP_IRQS, 0);
register_idt_gate(23, isr23, STOP_IRQS, 0);
register_idt_gate(24, isr24, STOP_IRQS, 0);
register_idt_gate(25, isr25, STOP_IRQS, 0);
register_idt_gate(26, isr26, STOP_IRQS, 0);
register_idt_gate(27, isr27, STOP_IRQS, 0);
register_idt_gate(28, isr28, STOP_IRQS, 0);
register_idt_gate(29, isr29, STOP_IRQS, 0);
register_idt_gate(30, isr30, STOP_IRQS, 0);
register_idt_gate(31, isr31, STOP_IRQS, 0);
register_idt_gate(32, irq0, STOP_IRQS, 0);
register_idt_gate(33, irq1, STOP_IRQS, 0);
register_idt_gate(34, irq2, STOP_IRQS, 0);
register_idt_gate(35, irq3, STOP_IRQS, 0);
register_idt_gate(36, irq4, STOP_IRQS, 0);
register_idt_gate(37, irq5, STOP_IRQS, 0);
register_idt_gate(38, irq6, STOP_IRQS, 0);
register_idt_gate(39, irq7, STOP_IRQS, 0);
register_idt_gate(40, irq8, STOP_IRQS, 0);
register_idt_gate(41, irq9, STOP_IRQS, 0);
register_idt_gate(42, irq10, STOP_IRQS, 0);
register_idt_gate(43, irq11, STOP_IRQS, 0);
register_idt_gate(44, irq12, STOP_IRQS, 0);
register_idt_gate(45, irq13, STOP_IRQS, 0);
register_idt_gate(46, irq14, STOP_IRQS, 0);
register_idt_gate(47, irq15, STOP_IRQS, 0);
register_idt_gate(127, isr_double_fault, STOP_IRQS, 0);
register_idt_gate(128, isr_syscall, STOP_IRQS | USER_MODE, 0);
register_idt_gate(130, isr_panic, STOP_IRQS, 0);
register_idt_gate(131, isr_halt, STOP_IRQS, 0);
}
|
520a9c0d66187b9302aa3b4faa8692c6d99c5347
|
68e115d504decf90cf8adaf1c373a220c059d8d7
|
/Include/Library/QcomSsbiLib.h
|
d1c5d92cffecf6179cc4ce53c27e140c90989c31
|
[
"GPL-1.0-or-later",
"GPL-2.0-only",
"BSD-2-Clause"
] |
permissive
|
WOA-Project/Lumia950XLPkg
|
24fcad187d71488270b853d08fcdff542bbac5a2
|
0e7e24adb2ac80672ade1e56f9b538d99941328f
|
refs/heads/master
| 2023-08-11T09:20:00.600571
| 2022-09-14T09:09:51
| 2022-09-14T09:09:51
| 132,070,715
| 264
| 64
|
BSD-2-Clause
| 2022-12-18T20:27:21
| 2018-05-04T01:44:48
|
C
|
UTF-8
|
C
| false
| false
| 210
|
h
|
QcomSsbiLib.h
|
#ifndef __LIBRARY_QCOM_SSBI_LIB_H__
#define __LIBRARY_QCOM_SSBI_LIB_H__
#include <Protocol/QcomSsbi.h>
RETURN_STATUS
EFIAPI
SsbiImplLibInitialize(VOID);
extern QCOM_SSBI_PROTOCOL *gSSBI;
#endif
|
19b326989e0c4fc743b17796cc8fc3df4c148a0c
|
117aaf186609e48230bff9f4f4e96546d3484963
|
/questions/68795702/3rdParty/OpenSAEJ1939/SAE_J1939/SAE_J1939-81_Network_Management_Layer/Address_Claimed.c
|
17d06572cccb372193ac8b37364559683b4aac55
|
[
"MIT"
] |
permissive
|
eyllanesc/stackoverflow
|
8d1c4b075e578496ea8deecbb78ef0e08bcc092e
|
db738fbe10e8573b324d1f86e9add314f02c884d
|
refs/heads/master
| 2022-08-19T22:23:34.697232
| 2022-08-10T20:59:17
| 2022-08-10T20:59:17
| 76,124,222
| 355
| 433
|
MIT
| 2022-08-10T20:59:18
| 2016-12-10T16:29:34
|
C++
|
UTF-8
|
C
| false
| false
| 2,743
|
c
|
Address_Claimed.c
|
/*
* SAE_J1939_Address_Claimed.c
*
* Created on: 14 juli 2021
* Author: Daniel Mårtensson
*/
#include "../SAE_J1939-81_Network_Management_Layer/Network_Management_Layer.h"
/*
* Send request address claimed to other ECU
* PGN: 0x00EE00 (60928)
*/
ENUM_J1939_STATUS_CODES SAE_J1939_Send_Request_Address_Claimed(J1939 *j1939, uint8_t DA) {
return SAE_J1939_Send_Request(j1939, DA, PGN_ADDRESS_CLAIMED);
}
/*
* Response the request address claimed about this ECU to all ECU - Broadcast. This function must be called at the ECU start up according to J1939 standard
* PGN: 0x00EE00 (60928)
*/
ENUM_J1939_STATUS_CODES SAE_J1939_Response_Request_Address_Claimed(J1939 *j1939) {
uint32_t ID = (0x18EEFF << 8) | j1939->this_ECU_address;
uint8_t data[8];
data[0] = j1939->this_name.identity_number;
data[1] = j1939->this_name.identity_number >> 8;
data[2] = (j1939->this_name.identity_number >> 16) | (j1939->this_name.manufacturer_code << 5);
data[3] = j1939->this_name.manufacturer_code >> 3;
data[4] = (j1939->this_name.function_instance << 3) | j1939->this_name.ECU_instance;
data[5] = j1939->this_name.function;
data[6] = j1939->this_name.vehicle_system << 1;
data[7] = (j1939->this_name.arbitrary_address_capable << 7) | (j1939->this_name.industry_group << 4) | j1939->this_name.vehicle_system_instance;
return CAN_Send_Message(ID, data, 0); /* 0 ms delay */
}
/*
* Store the address claimed information about other ECU
* PGN: 0x00EE00 (60928)
*/
void SAE_J1939_Read_Response_Request_Address_Claimed(J1939 *j1939, uint8_t SA, uint8_t data[]) {
/* Check if it's the same address */
if(j1939->this_ECU_address == SA){
SAE_J1939_Send_Address_Not_Claimed(j1939);
return;
}
/* If not, then store the temporary information */
j1939->from_other_ecu_name.identity_number = ((data[2] & 0b00011111) << 16) | (data[1] << 8) | data[0];
j1939->from_other_ecu_name.manufacturer_code = (data[3] << 3) | (data[2] >> 5);
j1939->from_other_ecu_name.function_instance = data[4] >> 3;
j1939->from_other_ecu_name.ECU_instance = data[4] & 0b00000111;
j1939->from_other_ecu_name.function = data[5];
j1939->from_other_ecu_name.vehicle_system = data[6] >> 1;
j1939->from_other_ecu_name.arbitrary_address_capable = data[7] >> 7;
j1939->from_other_ecu_name.industry_group = (data[7] >> 4) & 0b0111;
j1939->from_other_ecu_name.vehicle_system_instance = data[7] & 0b00001111;
j1939->from_other_ecu_name.from_ecu_address = SA;
/* Remember the source address of the ECU */
bool exist = false;
for (uint8_t i = 0; i < 255; i++)
if (j1939->other_ECU_address[i] == SA)
exist = true;
if (!exist)
j1939->other_ECU_address[j1939->number_of_other_ECU++] = SA; /* For every new ECU address, count how many ECU */
}
|
db5065e24e3a0eeedc87779f9f3e8a1618fbd39a
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h
|
852f8eed7f3f117a44986a933db1aebb6c206ca0
|
[
"LicenseRef-scancode-inner-net-2.0",
"LGPL-2.1-or-later",
"BSD-3-Clause",
"HPND",
"LicenseRef-scancode-pcre",
"LicenseRef-scancode-other-copyleft",
"ISC",
"LicenseRef-scancode-other-permissive",
"Spencer-94",
"SunPro",
"CMU-Mach",
"MIT"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 203
|
h
|
sysdep.h
|
/* 4 instruction cycles not accessing cache and TLB are needed after
trapa instruction to avoid an SH-4 silicon bug. */
#define NEED_SYSCALL_INST_PAD
#include <sysdeps/unix/sysv/linux/sh/sysdep.h>
|
614c31aab5addeebebf6f5fae65ff8705ad5f730
|
06f2e78f4d736c8ac9cb7e98a5abcc28ed4f25b2
|
/engine/common/soundlib/libmpg/libmpg.c
|
3397dc0d8b7db139c7db1c69dfb655485d03a4ac
|
[] |
no_license
|
FWGS/xash3d-fwgs
|
07a1002396f43754b49521681cc771c0d89051ed
|
435b95fc5ab3fc5b1a79212ffdc901a47769d056
|
refs/heads/master
| 2023-09-01T05:20:48.112400
| 2023-08-31T05:40:24
| 2023-08-31T05:40:24
| 127,814,982
| 1,078
| 275
| null | 2023-09-12T17:49:04
| 2018-04-02T21:33:02
|
C
|
UTF-8
|
C
| false
| false
| 3,198
|
c
|
libmpg.c
|
/*
libmpg.c - compact version of famous library mpg123
Copyright (C) 2017 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "mpg123.h"
#include "libmpg.h"
void *create_decoder( int *error )
{
void *mpg;
int ret;
if( error ) *error = 0;
mpg123_init();
mpg = mpg123_new( &ret );
if( !mpg ) return NULL;
ret = mpg123_param( mpg, MPG123_FLAGS, MPG123_FUZZY|MPG123_SEEKBUFFER|MPG123_GAPLESS );
if( ret != MPG123_OK && error )
*error = 1;
// let the seek index auto-grow and contain an entry for every frame
ret = mpg123_param( mpg, MPG123_INDEX_SIZE, -1 );
if( ret != MPG123_OK && error )
*error = 1;
return mpg;
}
int feed_mpeg_header( void *mpg, const byte *data, long bufsize, long streamsize, wavinfo_t *sc )
{
mpg123_handle_t *mh = (mpg123_handle_t *)mpg;
int ret, no;
if( !mh || !sc ) return 0;
ret = mpg123_open_feed( mh );
if( ret != MPG123_OK )
return 0;
// feed input chunk and get first chunk of decoded audio.
ret = mpg123_decode( mh, data, bufsize, NULL, 0, NULL );
if( ret != MPG123_NEW_FORMAT )
return 0; // there were errors
mpg123_getformat( mh, &sc->rate, &sc->channels, &no );
mpg123_format_none( mh );
mpg123_format( mh, sc->rate, sc->channels, MPG123_ENC_SIGNED_16 );
// some hacking to get function get_songlen to working properly
mh->rdat.filelen = streamsize;
sc->playtime = get_songlen( mh, -1 ) * 1000;
return 1;
}
int feed_mpeg_stream( void *mpg, const byte *data, long bufsize, byte *outbuf, size_t *outsize )
{
switch( mpg123_decode( mpg, data, bufsize, outbuf, OUTBUF_SIZE, outsize ))
{
case MPG123_NEED_MORE:
return MP3_NEED_MORE;
case MPG123_OK:
return MP3_OK;
default:
return MP3_ERR;
}
}
int open_mpeg_stream( void *mpg, void *file, pfread f_read, pfseek f_seek, wavinfo_t *sc )
{
mpg123_handle_t *mh = (mpg123_handle_t *)mpg;
int ret, no;
if( !mh || !sc ) return 0;
ret = mpg123_replace_reader_handle( mh, (void *)f_read, (void *)f_seek, NULL );
if( ret != MPG123_OK )
return 0;
ret = mpg123_open_handle( mh, file );
if( ret != MPG123_OK )
return 0;
ret = mpg123_getformat( mh, &sc->rate, &sc->channels, &no );
if( ret != MPG123_OK )
return 0;
mpg123_format_none( mh );
mpg123_format( mh, sc->rate, sc->channels, MPG123_ENC_SIGNED_16 );
sc->playtime = get_songlen( mh, -1 ) * 1000;
return 1;
}
int read_mpeg_stream( void *mpg, byte *outbuf, size_t *outsize )
{
switch( mpg123_read( mpg, outbuf, OUTBUF_SIZE, outsize ))
{
case MPG123_OK:
return MP3_OK;
default:
return MP3_ERR;
}
}
int get_stream_pos( void *mpg )
{
return mpg123_tell( mpg );
}
int set_stream_pos( void *mpg, int curpos )
{
return mpg123_seek( mpg, curpos, SEEK_SET );
}
void close_decoder( void *mpg )
{
mpg123_delete( mpg );
mpg123_exit();
}
|
1a9e4e2c927ceee24b455b401e8527ca59daf078
|
bdc27c22522a99b5bff2ec4cfa95fadcba65747d
|
/thirdparty/ffs/ffs/ffs/tests/io_align_test.c
|
ec1a8e1b32af88943756fc32ccfaf339a438f402
|
[
"Apache-2.0"
] |
permissive
|
ornladios/ADIOS2
|
a34e257b28adb26e6563b800502266ebb0c9088c
|
c8b7b66ed21b03bfb773bd972d5aeaaf10231e67
|
refs/heads/master
| 2023-08-31T18:11:22.186415
| 2023-08-29T20:45:03
| 2023-08-29T20:45:03
| 75,750,830
| 243
| 140
|
Apache-2.0
| 2023-09-14T11:15:00
| 2016-12-06T16:39:55
|
C++
|
UTF-8
|
C
| false
| false
| 1,504
|
c
|
io_align_test.c
|
#include "config.h"
#include <assert.h>
#include <fcntl.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <string.h>
#include "ffs.h"
#include "test_funcs.h"
static int verbose = 0;
extern void
local_align_field_list(FMFieldList field_list, int pointer_size);
void
do_test(FMContext c, char *name, FMFieldList fields)
{
int i = 0;
FMFieldList tmp = copy_field_list(fields);
local_align_field_list(tmp, sizeof(char*));
while(fields[i].field_name != NULL) {
if (fields[i].field_offset != tmp[i].field_offset) {
printf("Failed alignment of field %s in format %s, got %d, expected %d\n",
fields[i].field_name, name, tmp[i].field_offset,
fields[i].field_offset);
}
i++;
}
}
int
main(argc, argv)
int argc;
char **argv;
{
FMContext c;
do_test(c, "first format", field_list);
do_test(c, "string format", field_list2);
do_test(c, "two string format", field_list3);
do_test(c, "internal array format", field_list4);
do_test(c, "embedded", embedded_field_list);
do_test(c, "structured array format", field_list5);
do_test(c, "variant array format", field_list6);
do_test(c, "later format", later_field_list);
do_test(c, "nested format", nested_field_list);
do_test(c, "EventVecElem", event_vec_elem_fields);
do_test(c, "EventV", field_list9);
do_test(c, "string_array", string_array_field_list);
return 0;
}
|
2dc3a8ebb54f56d20a5499ba33ae028132c3707d
|
e814383d36a10839104efaa4df277996ab220fa3
|
/ompi/win/win.c
|
70e70c978e8c9b0547aeebf21dabb59e8711d5fd
|
[
"mpich2",
"BSD-3-Clause-Open-MPI"
] |
permissive
|
open-mpi/ompi
|
a1d7483ae1d83dd8fd8ae3ee95e832e0a0ee04e3
|
1edfdb025c4450f694600083ad871cf06c8d45cd
|
refs/heads/main
| 2023-09-01T01:30:02.040705
| 2023-08-29T17:32:18
| 2023-08-29T17:32:18
| 24,107,001
| 2,008
| 973
|
NOASSERTION
| 2023-09-14T20:59:26
| 2014-09-16T16:08:30
|
C
|
UTF-8
|
C
| false
| false
| 14,009
|
c
|
win.c
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2017 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018-2019 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "opal/util/info_subscriber.h"
#include "opal/util/string_copy.h"
#include "mpi.h"
#include "ompi/win/win.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/constants.h"
#include "ompi/attribute/attribute.h"
#include "ompi/group/group.h"
#include "ompi/info/info.h"
#include "ompi/mca/osc/base/base.h"
#include "ompi/mca/osc/osc.h"
#include "ompi/runtime/params.h"
/*
* Table for Fortran <-> C communicator handle conversion. Note that
* these are not necessarily global.
*/
opal_pointer_array_t ompi_mpi_windows = {{0}};
ompi_predefined_win_t ompi_mpi_win_null = {{{{0}}}};
ompi_predefined_win_t *ompi_mpi_win_null_addr = &ompi_mpi_win_null;
mca_base_var_enum_t *ompi_win_accumulate_ops = NULL;
mca_base_var_enum_flag_t *ompi_win_accumulate_order = NULL;
static const mca_base_var_enum_value_t accumulate_ops_values[] = {
{.value = OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP, .string = "same_op_no_op",},
{.value = OMPI_WIN_ACCUMULATE_OPS_SAME_OP, .string = "same_op",},
{.value = -1, .string = NULL},
};
static const mca_base_var_enum_value_flag_t accumulate_order_flags[] = {
{.flag = OMPI_WIN_ACC_ORDER_NONE, .string = "none", .conflicting_flag = OMPI_WIN_ACC_ORDER_RAR |
OMPI_WIN_ACC_ORDER_WAR | OMPI_WIN_ACC_ORDER_RAW | OMPI_WIN_ACC_ORDER_WAW},
{.flag = OMPI_WIN_ACC_ORDER_RAR, .string = "rar", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
{.flag = OMPI_WIN_ACC_ORDER_WAR, .string = "war", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
{.flag = OMPI_WIN_ACC_ORDER_RAW, .string = "raw", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
{.flag = OMPI_WIN_ACC_ORDER_WAW, .string = "waw", .conflicting_flag = OMPI_WIN_ACC_ORDER_NONE},
{0},
};
static void ompi_win_construct(ompi_win_t *win);
static void ompi_win_destruct(ompi_win_t *win);
OBJ_CLASS_INSTANCE(ompi_win_t, opal_infosubscriber_t,
ompi_win_construct, ompi_win_destruct);
static void ompi_win_dump (ompi_win_t *win)
{
opal_output(0, "Dumping information for window: %s\n", win->w_name);
opal_output(0," Fortran window handle: %d, window size: %d\n",
win->w_f_to_c_index, ompi_group_size (win->w_group));
}
static int ompi_win_finalize(void)
{
size_t size = opal_pointer_array_get_size (&ompi_mpi_windows);
/* start at 1 to skip win null */
for (size_t i = 1 ; i < size ; ++i) {
ompi_win_t *win =
(ompi_win_t *) opal_pointer_array_get_item (&ompi_mpi_windows, i);
if (NULL != win) {
if (ompi_debug_show_handle_leaks && !ompi_win_invalid(win)){
opal_output(0,"WARNING: MPI_Win still allocated in MPI_Finalize\n");
ompi_win_dump (win);
}
ompi_win_free (win);
}
}
OBJ_DESTRUCT(&ompi_mpi_win_null.win);
OBJ_DESTRUCT(&ompi_mpi_windows);
OBJ_RELEASE(ompi_win_accumulate_ops);
OBJ_RELEASE(ompi_win_accumulate_order);
/* release a reference to the attributes subsys */
return ompi_attr_put_ref();
}
int ompi_win_init (void)
{
int ret;
assert (sizeof (ompi_predefined_win_t) >= sizeof (ompi_win_t));
/* setup window Fortran array */
OBJ_CONSTRUCT(&ompi_mpi_windows, opal_pointer_array_t);
if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_mpi_windows, 4,
OMPI_FORTRAN_HANDLE_MAX, 16) ) {
return OMPI_ERROR;
}
/* Setup MPI_WIN_NULL */
OBJ_CONSTRUCT(&ompi_mpi_win_null.win, ompi_win_t);
ompi_mpi_win_null.win.w_flags = OMPI_WIN_INVALID;
ompi_mpi_win_null.win.w_group = &ompi_mpi_group_null.group;
OBJ_RETAIN(&ompi_mpi_group_null);
ompi_win_set_name(&ompi_mpi_win_null.win, "MPI_WIN_NULL");
opal_pointer_array_set_item(&ompi_mpi_windows, 0, &ompi_mpi_win_null.win);
ret = mca_base_var_enum_create ("accumulate_ops", accumulate_ops_values, &ompi_win_accumulate_ops);
if (OPAL_SUCCESS != ret) {
return ret;
}
ret = mca_base_var_enum_create_flag ("accumulate_order", accumulate_order_flags, &ompi_win_accumulate_order);
if (OPAL_SUCCESS != ret) {
return ret;
}
ret = ompi_attr_get_ref();
if (OMPI_SUCCESS != ret) {
return ret;
}
ompi_mpi_instance_append_finalize (ompi_win_finalize);
return OMPI_SUCCESS;
}
static int alloc_window(struct ompi_communicator_t *comm, opal_info_t *info, int flavor, ompi_win_t **win_out)
{
ompi_win_t *win;
ompi_group_t *group;
int acc_ops, acc_order, flag, ret;
/* create the object */
win = OBJ_NEW(ompi_win_t);
if (NULL == win) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
/* Copy the info for the info layer */
win->super.s_info = OBJ_NEW(opal_info_t);
if (info) {
opal_info_dup(info, &(win->super.s_info));
}
ret = opal_info_get_value_enum (win->super.s_info, "accumulate_ops", &acc_ops,
OMPI_WIN_ACCUMULATE_OPS_SAME_OP_NO_OP,
ompi_win_accumulate_ops, &flag);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
win->w_acc_ops = (ompi_win_accumulate_ops_t)acc_ops;
ret = opal_info_get_value_enum (win->super.s_info, "accumulate_order", &acc_order,
OMPI_WIN_ACC_ORDER_RAR | OMPI_WIN_ACC_ORDER_WAR |
OMPI_WIN_ACC_ORDER_RAW | OMPI_WIN_ACC_ORDER_WAW,
&(ompi_win_accumulate_order->super), &flag);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
win->w_acc_order = acc_order;
win->w_flavor = flavor;
/* setup data that is independent of osc component */
group = comm->c_local_group;
OBJ_RETAIN(group);
win->w_group = group;
*win_out = win;
return OMPI_SUCCESS;
}
static int
config_window(void *base, size_t size, int disp_unit,
int flavor, int model, ompi_win_t *win)
{
int ret;
ret = ompi_attr_set_c(WIN_ATTR, win, &win->w_keyhash,
MPI_WIN_BASE, base, true);
if (OMPI_SUCCESS != ret) return ret;
ret = ompi_attr_set_aint(WIN_ATTR, win,
&win->w_keyhash,
MPI_WIN_SIZE, size, true);
if (OMPI_SUCCESS != ret) return ret;
ret = ompi_attr_set_int(WIN_ATTR, win,
&win->w_keyhash,
MPI_WIN_DISP_UNIT, disp_unit,
true);
if (OMPI_SUCCESS != ret) return ret;
ret = ompi_attr_set_int(WIN_ATTR, win,
&win->w_keyhash,
MPI_WIN_CREATE_FLAVOR, flavor, true);
if (OMPI_SUCCESS != ret) return ret;
ret = ompi_attr_set_int(WIN_ATTR, win,
&win->w_keyhash,
MPI_WIN_MODEL, model, true);
if (OMPI_SUCCESS != ret) return ret;
win->w_f_to_c_index = opal_pointer_array_add(&ompi_mpi_windows, win);
if (-1 == win->w_f_to_c_index) return OMPI_ERR_OUT_OF_RESOURCE;
return OMPI_SUCCESS;
}
int
ompi_win_create(void *base, size_t size,
int disp_unit, ompi_communicator_t *comm,
opal_info_t *info,
ompi_win_t** newwin)
{
ompi_win_t *win;
int model;
int ret;
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_CREATE, &win);
if (OMPI_SUCCESS != ret) {
return ret;
}
ret = ompi_osc_base_select(win, &base, size, disp_unit, comm, MPI_WIN_FLAVOR_CREATE, &model);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
ret = config_window(base, size, disp_unit, MPI_WIN_FLAVOR_CREATE, model, win);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
/* MPI-4 §12.2.7 requires us to remove all unknown keys from the info object */
opal_info_remove_unreferenced(win->super.s_info);
*newwin = win;
return OMPI_SUCCESS;
}
int
ompi_win_allocate(size_t size, int disp_unit, opal_info_t *info,
ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin)
{
ompi_win_t *win;
int model;
int ret;
void *base;
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_ALLOCATE, &win);
if (OMPI_SUCCESS != ret) {
return ret;
}
ret = ompi_osc_base_select(win, &base, size, disp_unit, comm, MPI_WIN_FLAVOR_ALLOCATE, &model);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
ret = config_window(base, size, disp_unit, MPI_WIN_FLAVOR_ALLOCATE, model, win);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
/* MPI-4 §12.2.7 requires us to remove all unknown keys from the info object */
opal_info_remove_unreferenced(win->super.s_info);
*((void**) baseptr) = base;
*newwin = win;
return OMPI_SUCCESS;
}
int
ompi_win_allocate_shared(size_t size, int disp_unit, opal_info_t *info,
ompi_communicator_t *comm, void *baseptr, ompi_win_t **newwin)
{
ompi_win_t *win;
int model;
int ret;
void *base;
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_SHARED, &win);
if (OMPI_SUCCESS != ret) {
return ret;
}
ret = ompi_osc_base_select(win, &base, size, disp_unit, comm, MPI_WIN_FLAVOR_SHARED, &model);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
ret = config_window(base, size, disp_unit, MPI_WIN_FLAVOR_SHARED, model, win);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
/* MPI-4 §12.2.7 requires us to remove all unknown keys from the info object */
opal_info_remove_unreferenced(win->super.s_info);
*((void**) baseptr) = base;
*newwin = win;
return OMPI_SUCCESS;
}
int
ompi_win_create_dynamic(opal_info_t *info, ompi_communicator_t *comm, ompi_win_t **newwin)
{
ompi_win_t *win;
int model;
int ret;
ret = alloc_window (comm, info, MPI_WIN_FLAVOR_DYNAMIC, &win);
if (OMPI_SUCCESS != ret) {
return ret;
}
ret = ompi_osc_base_select(win, MPI_BOTTOM, 0, 1, comm, MPI_WIN_FLAVOR_DYNAMIC, &model);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
ret = config_window(MPI_BOTTOM, 0, 1, MPI_WIN_FLAVOR_DYNAMIC, model, win);
if (OMPI_SUCCESS != ret) {
OBJ_RELEASE(win);
return ret;
}
/* MPI-4 §12.2.7 requires us to remove all unknown keys from the info object */
opal_info_remove_unreferenced(win->super.s_info);
*newwin = win;
return OMPI_SUCCESS;
}
int
ompi_win_free(ompi_win_t *win)
{
int ret = win->w_osc_module->osc_free(win);
if (-1 != win->w_f_to_c_index) {
opal_pointer_array_set_item(&ompi_mpi_windows,
win->w_f_to_c_index,
NULL);
}
if (NULL != (win->super.s_info)) {
OBJ_RELEASE(win->super.s_info);
}
if (OMPI_SUCCESS == ret) {
OBJ_RELEASE(win);
}
return ret;
}
int
ompi_win_set_name(ompi_win_t *win, const char *win_name)
{
OPAL_THREAD_LOCK(&(win->w_lock));
opal_string_copy(win->w_name, win_name, MPI_MAX_OBJECT_NAME);
OPAL_THREAD_UNLOCK(&(win->w_lock));
return OMPI_SUCCESS;
}
int
ompi_win_get_name(ompi_win_t *win, char *win_name, int *length)
{
OPAL_THREAD_LOCK(&(win->w_lock));
opal_string_copy(win_name, win->w_name, MPI_MAX_OBJECT_NAME);
*length = (int)strlen(win->w_name);
OPAL_THREAD_UNLOCK(&(win->w_lock));
return OMPI_SUCCESS;
}
int
ompi_win_group(ompi_win_t *win, ompi_group_t **group) {
OBJ_RETAIN(win->w_group);
*group = win->w_group;
return OMPI_SUCCESS;
}
static void
ompi_win_construct(ompi_win_t *win)
{
OBJ_CONSTRUCT(&win->w_lock, opal_mutex_t);
win->w_name[0] = '\0';
win->w_group = NULL;
win->w_keyhash = NULL;
win->w_f_to_c_index = 0;
/* every new window defaults to MPI_ERRORS_ARE_FATAL (MPI-2 6.6.1,
pg. 137) */
OBJ_RETAIN(&ompi_mpi_errors_are_fatal.eh);
win->error_handler = &ompi_mpi_errors_are_fatal.eh;
win->errhandler_type = OMPI_ERRHANDLER_TYPE_WIN;
win->w_flags = 0;
win->w_osc_module = NULL;
}
static void
ompi_win_destruct(ompi_win_t *win)
{
if (NULL != win->w_keyhash) {
ompi_attr_delete_all(WIN_ATTR, win, win->w_keyhash);
OBJ_RELEASE(win->w_keyhash);
}
if (NULL != win->error_handler) {
OBJ_RELEASE(win->error_handler);
}
if (NULL != win->w_group) {
OBJ_RELEASE(win->w_group);
}
OBJ_DESTRUCT(&win->w_lock);
}
|
c71119a610ccc2b813d0e76ae480d147e283e9a5
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/include/mapfs/kzn_17_hit.h
|
623450b82e8b575463ede962713ecca59cddae26
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 1,919
|
h
|
kzn_17_hit.h
|
#define COLLIDER_Root 0x2B
#define COLLIDER_g127 0x2A
#define COLLIDER_o932 0x29
#define COLLIDER_g112 0x28
#define COLLIDER_o896 0x27
#define COLLIDER_g100 0x26
#define COLLIDER_o869 0x25
#define COLLIDER_o893 0x24
#define COLLIDER_g96 0x23
#define COLLIDER_o840 0x22
#define COLLIDER_g89 0x21
#define COLLIDER_o826 0x20
#define COLLIDER_kaidan 0x1F
#define COLLIDER_o263 0x1E
#define COLLIDER_o280 0x1D
#define COLLIDER_o273 0x1C
#define COLLIDER_o894 0x1B
#define COLLIDER_g75 0x1A
#define COLLIDER_o389 0x19
#define COLLIDER_o396 0x18
#define COLLIDER_o281 0x17
#define COLLIDER_s2 0x16
#define COLLIDER_o368 0x15
#define COLLIDER_o377 0x14
#define COLLIDER_o408 0x13
#define COLLIDER_s1 0x12
#define COLLIDER_o818 0x11
#define COLLIDER_o418 0x10
#define COLLIDER_g67 0xF
#define COLLIDER_o286 0xE
#define COLLIDER_o283 0xD
#define COLLIDER_o419 0xC
#define COLLIDER_o816 0xB
#define COLLIDER_o274 0xA
#define COLLIDER_g83 0x9
#define COLLIDER_o416 0x8
#define COLLIDER_g84 0x7
#define COLLIDER_gogo 0x6
#define COLLIDER_o369 0x5
#define COLLIDER_o842 0x4
#define COLLIDER_deilit2 0x3
#define COLLIDER_deili2 0x2
#define COLLIDER_deilit1 0x1
#define COLLIDER_deili1 0x0
#define ZONE_Root 0x6
#define ZONE_g77 0x5
#define ZONE_o421 0x4
#define ZONE_o422 0x3
#define ZONE_o423 0x2
#define ZONE_g73 0x1
#define ZONE_o369 0x0
|
736219b438d531083380c2647c61049ddfd96ac8
|
a209da157b4911a999eaab36ab007dc1e788a77d
|
/src/4-check-for-ambiguity.h
|
5073db3fd3eb505b6c1e6649add627937d664589
|
[
"MIT"
] |
permissive
|
ianh/owl
|
dccdde2bd34405236a52f96c877138e5d837bdd1
|
27fca39aa8d2e4c40e5d6f13170463bb21e3acaa
|
refs/heads/master
| 2023-08-15T21:28:28.522128
| 2023-07-19T23:00:15
| 2023-07-19T23:00:15
| 142,875,118
| 715
| 32
|
MIT
| 2023-06-13T21:41:01
| 2018-07-30T12:51:28
|
C
|
UTF-8
|
C
| false
| false
| 755
|
h
|
4-check-for-ambiguity.h
|
#ifndef CHECK_FOR_AMBIGUITY_H
#define CHECK_FOR_AMBIGUITY_H
#include "3-combine.h"
// STEP 4 - CHECK FOR AMBIGUITY
// In step 4, we look for a sequence of tokens which can cause two different
// parse trees to be created. If we find one, we return it as a
// `struct ambiguity`.
struct ambiguity_path {
uint16_t *actions;
uint32_t number_of_actions;
// These are the offsets into the `tokens` array corresponding to each
// action.
uint32_t *offsets;
};
struct ambiguity {
bool has_ambiguity;
struct ambiguity_path paths[2];
symbol_id *tokens;
uint32_t tokens_allocated_bytes;
uint32_t number_of_tokens;
};
void check_for_ambiguity(struct combined_grammar *combined,
struct ambiguity *ambiguity);
#endif
|
959eb4296cf1dda7b45086026d927834cabe462d
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/hwmon/da9055-hwmon.c
|
1b275a2881d6749b18a9e57bd7272de5e1d2e889
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 8,625
|
c
|
da9055-hwmon.c
|
/*
* HWMON Driver for Dialog DA9055
*
* Copyright(c) 2012 Dialog Semiconductor Ltd.
*
* Author: David Dajun Chen <dchen@diasemi.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*/
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/completion.h>
#include <linux/mfd/da9055/core.h>
#include <linux/mfd/da9055/reg.h>
#define DA9055_ADCIN_DIV 102
#define DA9055_VSYS_DIV 85
#define DA9055_ADC_VSYS 0
#define DA9055_ADC_ADCIN1 1
#define DA9055_ADC_ADCIN2 2
#define DA9055_ADC_ADCIN3 3
#define DA9055_ADC_TJUNC 4
struct da9055_hwmon {
struct da9055 *da9055;
struct device *class_device;
struct mutex hwmon_lock;
struct mutex irq_lock;
struct completion done;
};
static const char * const input_names[] = {
[DA9055_ADC_VSYS] = "VSYS",
[DA9055_ADC_ADCIN1] = "ADC IN1",
[DA9055_ADC_ADCIN2] = "ADC IN2",
[DA9055_ADC_ADCIN3] = "ADC IN3",
[DA9055_ADC_TJUNC] = "CHIP TEMP",
};
static const u8 chan_mux[DA9055_ADC_TJUNC + 1] = {
[DA9055_ADC_VSYS] = DA9055_ADC_MUX_VSYS,
[DA9055_ADC_ADCIN1] = DA9055_ADC_MUX_ADCIN1,
[DA9055_ADC_ADCIN2] = DA9055_ADC_MUX_ADCIN2,
[DA9055_ADC_ADCIN3] = DA9055_ADC_MUX_ADCIN3,
[DA9055_ADC_TJUNC] = DA9055_ADC_MUX_T_SENSE,
};
static int da9055_adc_manual_read(struct da9055_hwmon *hwmon,
unsigned char channel)
{
int ret;
unsigned short calc_data;
unsigned short data;
unsigned char mux_sel;
struct da9055 *da9055 = hwmon->da9055;
if (channel > DA9055_ADC_TJUNC)
return -EINVAL;
mutex_lock(&hwmon->irq_lock);
/* Selects desired MUX for manual conversion */
mux_sel = chan_mux[channel] | DA9055_ADC_MAN_CONV;
ret = da9055_reg_write(da9055, DA9055_REG_ADC_MAN, mux_sel);
if (ret < 0)
goto err;
/* Wait for an interrupt */
if (!wait_for_completion_timeout(&hwmon->done,
msecs_to_jiffies(500))) {
dev_err(da9055->dev,
"timeout waiting for ADC conversion interrupt\n");
ret = -ETIMEDOUT;
goto err;
}
ret = da9055_reg_read(da9055, DA9055_REG_ADC_RES_H);
if (ret < 0)
goto err;
calc_data = (unsigned short)ret;
data = calc_data << 2;
ret = da9055_reg_read(da9055, DA9055_REG_ADC_RES_L);
if (ret < 0)
goto err;
calc_data = (unsigned short)(ret & DA9055_ADC_LSB_MASK);
data |= calc_data;
ret = data;
err:
mutex_unlock(&hwmon->irq_lock);
return ret;
}
static irqreturn_t da9055_auxadc_irq(int irq, void *irq_data)
{
struct da9055_hwmon *hwmon = irq_data;
complete(&hwmon->done);
return IRQ_HANDLED;
}
/* Conversion function for VSYS and ADCINx */
static inline int volt_reg_to_mv(int value, int channel)
{
if (channel == DA9055_ADC_VSYS)
return DIV_ROUND_CLOSEST(value * 1000, DA9055_VSYS_DIV) + 2500;
else
return DIV_ROUND_CLOSEST(value * 1000, DA9055_ADCIN_DIV);
}
static int da9055_enable_auto_mode(struct da9055 *da9055, int channel)
{
return da9055_reg_update(da9055, DA9055_REG_ADC_CONT, 1 << channel,
1 << channel);
}
static int da9055_disable_auto_mode(struct da9055 *da9055, int channel)
{
return da9055_reg_update(da9055, DA9055_REG_ADC_CONT, 1 << channel, 0);
}
static ssize_t da9055_read_auto_ch(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct da9055_hwmon *hwmon = dev_get_drvdata(dev);
int ret, adc;
int channel = to_sensor_dev_attr(devattr)->index;
mutex_lock(&hwmon->hwmon_lock);
ret = da9055_enable_auto_mode(hwmon->da9055, channel);
if (ret < 0)
goto hwmon_err;
usleep_range(10000, 10500);
adc = da9055_reg_read(hwmon->da9055, DA9055_REG_VSYS_RES + channel);
if (adc < 0) {
ret = adc;
goto hwmon_err_release;
}
ret = da9055_disable_auto_mode(hwmon->da9055, channel);
if (ret < 0)
goto hwmon_err;
mutex_unlock(&hwmon->hwmon_lock);
return sprintf(buf, "%d\n", volt_reg_to_mv(adc, channel));
hwmon_err_release:
da9055_disable_auto_mode(hwmon->da9055, channel);
hwmon_err:
mutex_unlock(&hwmon->hwmon_lock);
return ret;
}
static ssize_t da9055_read_tjunc(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct da9055_hwmon *hwmon = dev_get_drvdata(dev);
int tjunc;
int toffset;
tjunc = da9055_adc_manual_read(hwmon, DA9055_ADC_TJUNC);
if (tjunc < 0)
return tjunc;
toffset = da9055_reg_read(hwmon->da9055, DA9055_REG_T_OFFSET);
if (toffset < 0)
return toffset;
/*
* Degrees celsius = -0.4084 * (ADC_RES - T_OFFSET) + 307.6332
* T_OFFSET is a trim value used to improve accuracy of the result
*/
return sprintf(buf, "%d\n", DIV_ROUND_CLOSEST(-4084 * (tjunc - toffset)
+ 3076332, 10000));
}
static ssize_t da9055_hwmon_show_name(struct device *dev,
struct device_attribute *devattr,
char *buf)
{
return sprintf(buf, "da9055\n");
}
static ssize_t show_label(struct device *dev,
struct device_attribute *devattr, char *buf)
{
return sprintf(buf, "%s\n",
input_names[to_sensor_dev_attr(devattr)->index]);
}
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, da9055_read_auto_ch, NULL,
DA9055_ADC_VSYS);
static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL,
DA9055_ADC_VSYS);
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, da9055_read_auto_ch, NULL,
DA9055_ADC_ADCIN1);
static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL,
DA9055_ADC_ADCIN1);
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, da9055_read_auto_ch, NULL,
DA9055_ADC_ADCIN2);
static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL,
DA9055_ADC_ADCIN2);
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, da9055_read_auto_ch, NULL,
DA9055_ADC_ADCIN3);
static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL,
DA9055_ADC_ADCIN3);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, da9055_read_tjunc, NULL,
DA9055_ADC_TJUNC);
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL,
DA9055_ADC_TJUNC);
static DEVICE_ATTR(name, S_IRUGO, da9055_hwmon_show_name, NULL);
static struct attribute *da9055_attr[] = {
&dev_attr_name.attr,
&sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in0_label.dev_attr.attr,
&sensor_dev_attr_in1_input.dev_attr.attr,
&sensor_dev_attr_in1_label.dev_attr.attr,
&sensor_dev_attr_in2_input.dev_attr.attr,
&sensor_dev_attr_in2_label.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
&sensor_dev_attr_in3_label.dev_attr.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp1_label.dev_attr.attr,
NULL
};
static const struct attribute_group da9055_attr_group = {.attrs = da9055_attr};
static int da9055_hwmon_probe(struct platform_device *pdev)
{
struct da9055_hwmon *hwmon;
int hwmon_irq, ret;
hwmon = devm_kzalloc(&pdev->dev, sizeof(struct da9055_hwmon),
GFP_KERNEL);
if (!hwmon)
return -ENOMEM;
mutex_init(&hwmon->hwmon_lock);
mutex_init(&hwmon->irq_lock);
init_completion(&hwmon->done);
hwmon->da9055 = dev_get_drvdata(pdev->dev.parent);
platform_set_drvdata(pdev, hwmon);
hwmon_irq = platform_get_irq_byname(pdev, "HWMON");
if (hwmon_irq < 0)
return hwmon_irq;
hwmon_irq = regmap_irq_get_virq(hwmon->da9055->irq_data, hwmon_irq);
if (hwmon_irq < 0)
return hwmon_irq;
ret = devm_request_threaded_irq(&pdev->dev, hwmon_irq,
NULL, da9055_auxadc_irq,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
"adc-irq", hwmon);
if (ret != 0) {
dev_err(hwmon->da9055->dev, "DA9055 ADC IRQ failed ret=%d\n",
ret);
return ret;
}
ret = sysfs_create_group(&pdev->dev.kobj, &da9055_attr_group);
if (ret)
return ret;
hwmon->class_device = hwmon_device_register(&pdev->dev);
if (IS_ERR(hwmon->class_device)) {
ret = PTR_ERR(hwmon->class_device);
goto err;
}
return 0;
err:
sysfs_remove_group(&pdev->dev.kobj, &da9055_attr_group);
return ret;
}
static int da9055_hwmon_remove(struct platform_device *pdev)
{
struct da9055_hwmon *hwmon = platform_get_drvdata(pdev);
sysfs_remove_group(&pdev->dev.kobj, &da9055_attr_group);
hwmon_device_unregister(hwmon->class_device);
return 0;
}
static struct platform_driver da9055_hwmon_driver = {
.probe = da9055_hwmon_probe,
.remove = da9055_hwmon_remove,
.driver = {
.name = "da9055-hwmon",
.owner = THIS_MODULE,
},
};
module_platform_driver(da9055_hwmon_driver);
MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
MODULE_DESCRIPTION("DA9055 HWMON driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:da9055-hwmon");
|
560aff0c8039ec1d702732519ac78a3cecdde81a
|
fb1c39f90a51622be3afe84e964b42411547ac05
|
/src/firebird/include/firebird/impl/msg/gstat.h
|
6fe4f0620976e5f75b427913193fdb62cde39feb
|
[
"MIT",
"LGPL-2.0-or-later"
] |
permissive
|
mariuz/flamerobin
|
b2cd177c517c306b77fc54b01de96950e9bdc98d
|
cada827397280f03d07d578b98fa22e3af385a67
|
refs/heads/master
| 2023-07-24T01:17:56.282024
| 2023-07-14T09:22:12
| 2023-07-14T09:22:12
| 46,420,463
| 199
| 78
|
MIT
| 2023-07-14T09:22:13
| 2015-11-18T13:28:05
|
C++
|
UTF-8
|
C
| false
| false
| 4,797
|
h
|
gstat.h
|
FB_IMPL_MSG(GSTAT, 1, gstat_unknown_switch, -901, "00", "000", "found unknown switch")
FB_IMPL_MSG(GSTAT, 2, gstat_retry, -901, "00", "000", "please retry, giving a database name")
FB_IMPL_MSG(GSTAT, 3, gstat_wrong_ods, -901, "00", "000", "Wrong ODS version, expected @1, encountered @2")
FB_IMPL_MSG(GSTAT, 4, gstat_unexpected_eof, -901, "00", "000", "Unexpected end of database file.")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 5, "gstat version @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 6, "\nDatabase \"@1\"")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 7, "\n\nDatabase file sequence:")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 8, "File @1 continues as file @2")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 9, "File @1 is the @2 file")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 10, "\nAnalyzing database pages ...")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 11, " Primary pointer page: @1, Index root page: @2")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 12, " Data pages: @1, data page slots: @2, average fill: @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 13, " Fill distribution:")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 14, " Index @1 (@2)")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 15, " Depth: @1, leaf buckets: @2, nodes: @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 16, " Average data length: @1, total dup: @2, max dup: @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 17, " Fill distribution:")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 18, " Expected data on page @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 19, " Expected b-tree bucket on page @1 from @2")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 20, "unknown switch \"@1\"")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 21, "Available switches:")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 22, " -a analyze data and index pages")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 23, " -d analyze data pages")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 24, " -h analyze header page ONLY")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 25, " -i analyze index leaf pages")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 26, " -l analyze log page")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 27, " -s analyze system relations in addition to user tables")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 28, " -z display version number")
FB_IMPL_MSG(GSTAT, 29, gstat_open_err, -901, "00", "000", "Can't open database file @1")
FB_IMPL_MSG(GSTAT, 30, gstat_read_err, -901, "00", "000", "Can't read a database page")
FB_IMPL_MSG(GSTAT, 31, gstat_sysmemex, -901, "00", "000", "System memory exhausted")
FB_IMPL_MSG_SYMBOL(GSTAT, 32, gstat_username, " -u username")
FB_IMPL_MSG_SYMBOL(GSTAT, 33, gstat_password, " -p password")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 34, " -r analyze average record and version length")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 35, " -t tablename <tablename2...> (case sensitive)")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 36, " -tr use trusted authentication")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 37, " -fetch fetch password from file")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 38, "option -h is incompatible with options -a, -d, -i, -r, -s and -t")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 39, "usage: gstat [options] <database> or gstat <database> [options]")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 40, "database name was already specified")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 41, "option -t needs a table name")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 42, "option -t got a too long table name @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 43, "option -t accepts several table names only if used after <database>")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 44, "table \"@1\" not found")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 45, "use gstat -? to get help")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 46, " Primary pages: @1, secondary pages: @2, swept pages: @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 47, " Big record pages: @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 48, " Blobs: @1, total length: @2, blob pages: @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 49, " Level 0: @1, Level 1: @2, Level 2: @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 50, "option -e is incompatible with options -a, -d, -h, -i, -r, -s and -t")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 51, " -e analyze database encryption")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 52, "Data pages: total @1, encrypted @2, non-crypted @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 53, "Index pages: total @1, encrypted @2, non-crypted @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 54, "Blob pages: total @1, encrypted @2, non-crypted @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 55, "no encrypted database support, only -e and -h can be used")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 56, " Empty pages: @1, full pages: @2")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 57, " -role SQL role name")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 58, "Other pages: total @1, ENCRYPTED @2 (DB problem!), non-crypted @3")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 59, "Gstat execution time @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 60, "Gstat completion time @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 61, " Expected page inventory page @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 62, "Generator pages: total @1, encrypted @2, non-crypted @3")
|
53c89b589b9c90c462bb1f92d388a92698de53aa
|
de21f9075f55640514c29ef0f1fe3f0690845764
|
/regression/ansi-c/Function_parameters2/main.c
|
db7c2f0c8709a18dce218569798a317ce8a2171d
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-4-Clause"
] |
permissive
|
diffblue/cbmc
|
975a074ac445febb3b5715f8792beb545522dc18
|
decd2839c2f51a54b2ad0f3e89fdc1b4bf78cd16
|
refs/heads/develop
| 2023-08-31T05:52:05.342195
| 2023-08-30T13:31:51
| 2023-08-30T13:31:51
| 51,877,056
| 589
| 309
|
NOASSERTION
| 2023-09-14T18:49:17
| 2016-02-16T23:03:52
|
C++
|
UTF-8
|
C
| false
| false
| 90
|
c
|
main.c
|
int foo();
int bar(int a, int b);
int main()
{
_Bool x;
return (x?foo:bar)(x, x);
}
|
be2c1646300460179285b235fff57725ed21dd89
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/acpi/acpica/hwacpi.c
|
579c3a53ac87ede953e7610dab23f1270c6bafcc
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 5,654
|
c
|
hwacpi.c
|
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwacpi")
#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
/******************************************************************************
*
* FUNCTION: acpi_hw_set_mode
*
* PARAMETERS: mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
*
* RETURN: Status
*
* DESCRIPTION: Transitions the system into the requested mode.
*
******************************************************************************/
acpi_status acpi_hw_set_mode(u32 mode)
{
acpi_status status;
ACPI_FUNCTION_TRACE(hw_set_mode);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) {
return_ACPI_STATUS(AE_OK);
}
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
if (!acpi_gbl_FADT.smi_command) {
ACPI_ERROR((AE_INFO,
"No SMI_CMD in FADT, mode transition failed"));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
}
/*
* ACPI 2.0 clarified the meaning of ACPI_ENABLE and ACPI_DISABLE
* in FADT: If it is zero, enabling or disabling is not supported.
* As old systems may have used zero for mode transition,
* we make sure both the numbers are zero to determine these
* transitions are not supported.
*/
if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) {
ACPI_ERROR((AE_INFO,
"No ACPI mode transition supported in this system "
"(enable/disable both zero)"));
return_ACPI_STATUS(AE_OK);
}
switch (mode) {
case ACPI_SYS_MODE_ACPI:
/* BIOS should have disabled ALL fixed and GP events */
status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
(u32) acpi_gbl_FADT.acpi_enable, 8);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Attempting to enable ACPI mode\n"));
break;
case ACPI_SYS_MODE_LEGACY:
/*
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
*/
status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
(u32)acpi_gbl_FADT.acpi_disable, 8);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
break;
default:
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Could not write ACPI mode change"));
return_ACPI_STATUS(status);
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_hw_get_mode
*
* PARAMETERS: none
*
* RETURN: SYS_MODE_ACPI or SYS_MODE_LEGACY
*
* DESCRIPTION: Return current operating state of system. Determined by
* querying the SCI_EN bit.
*
******************************************************************************/
u32 acpi_hw_get_mode(void)
{
acpi_status status;
u32 value;
ACPI_FUNCTION_TRACE(hw_get_mode);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (acpi_gbl_reduced_hardware) {
return_UINT32(ACPI_SYS_MODE_ACPI);
}
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
if (!acpi_gbl_FADT.smi_command) {
return_UINT32(ACPI_SYS_MODE_ACPI);
}
status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value);
if (ACPI_FAILURE(status)) {
return_UINT32(ACPI_SYS_MODE_LEGACY);
}
if (value) {
return_UINT32(ACPI_SYS_MODE_ACPI);
} else {
return_UINT32(ACPI_SYS_MODE_LEGACY);
}
}
#endif /* !ACPI_REDUCED_HARDWARE */
|
78f990c46ba9bfc5114e728f6121b28fa0e9bc92
|
2fb6e11034c6d2252b98446cbca74b1e97b5588b
|
/test/stdlib/atoi.c
|
a8635d7d60a69238eaf9c11a8742d02639235451
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
embeddedartistry/libc
|
67994cfee6bf0def31820c23d3b46e0a5974407d
|
01472251c5d2ea2d6532b63665ded46285dd58be
|
refs/heads/master
| 2023-05-28T05:07:45.496796
| 2023-05-15T22:50:02
| 2023-05-15T22:50:02
| 88,765,798
| 438
| 66
|
MIT
| 2022-11-16T23:44:23
| 2017-04-19T16:18:26
|
C
|
UTF-8
|
C
| false
| false
| 1,286
|
c
|
atoi.c
|
/*
* Copyright © 2017 Embedded Artistry LLC.
* License: MIT. See LICENSE file for details.
*/
#include "stdlib_tests.h"
#include <stdlib.h>
// Cmocka needs these
// clang-format off
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <cmocka.h>
// clang-format on
#pragma mark - Private Functions -
static void atoi_test(void** state)
{
// Integer tests
assert_int_equal(atoi("0"), 0);
assert_int_equal(atoi("10"), 10);
assert_int_equal(atoi("12345"), 12345);
assert_int_equal(atoi("-1"), -1);
assert_int_equal(atoi("-2147483647"), -2147483647);
// INT_MAX
assert_int_equal(atoi("2147483647"), 2147483647);
// UINT_MAX
assert_int_equal((unsigned)atoi("4294967295"), 4294967295);
// Stop at decimal
assert_int_equal(atoi("0.1"), 0);
assert_int_equal(atoi("1.1"), 1);
assert_int_equal(atoi("2147483647.1232"), 2147483647);
// Hex doesn't work with atoi
assert_int_equal(atoi("0xFFEE"), 0);
// Bad input
assert_int_equal(atoi("12-a"), 12);
assert_int_equal(atoi("-a"), 0);
assert_int_equal(atoi("102xxa"), 102);
assert_int_equal(atoi("a13"), 0);
}
#pragma mark - Public Functions -
int atoi_tests(void)
{
const struct CMUnitTest atoi_tests[] = {cmocka_unit_test(atoi_test)};
return cmocka_run_group_tests(atoi_tests, NULL, NULL);
}
|
aad77dc5246f79a5a775c5a520b55c167f12a5c2
|
c6759b857e55991fea3ef0b465dbcee53fa38714
|
/libs/openmp/tests/for_variable/for_variable.c
|
2395e18e65b16523251579c59fced635ff6e3141
|
[
"Apache-2.0"
] |
permissive
|
GreenWaves-Technologies/gap_sdk
|
1b343bba97b7a5ce62a24162bd72eef5cc67e269
|
3fea306d52ee33f923f2423c5a75d9eb1c07e904
|
refs/heads/master
| 2023-09-01T14:38:34.270427
| 2023-08-10T09:04:44
| 2023-08-10T09:04:44
| 133,324,605
| 145
| 96
|
Apache-2.0
| 2023-08-27T19:03:52
| 2018-05-14T07:50:29
|
C
|
UTF-8
|
C
| false
| false
| 2,303
|
c
|
for_variable.c
|
/* PMSIS includes */
#include "pmsis.h"
#include "omp.h"
static uint32_t errors = 0;
/* Cluster main entry, executed by core 0. */
void cluster_delegate(void *arg)
{
printf("Cluster master core entry\n");
uint32_t a[64] = {0};
int32_t sum = 0;
int32_t max = 0;
#pragma omp parallel num_threads(4)
{
printf("[%d %d] Fork entry\n", pi_cluster_id(), omp_get_thread_num() );
#pragma omp for
for (int i=0; i<64; i++)
{
a[i] = omp_get_thread_num();
}
#pragma omp for
for (int i = 0; i < 64; i++)
{
#pragma omp atomic
sum += a[i];
}
#pragma omp barrier
#pragma omp for
for (int j = 0; j < sum; j++)
{
printf("[%d] - for index %d\n", omp_get_thread_num(), j);
#pragma omp critical
{
if (j > max)
{
max = j;
}
}
}
}
printf("Sum: %d\n", sum);
printf("max: %d\n", max);
if (sum - 1 != max)
{
errors++;
}
printf("Cluster master core exit\n");
}
void helloworld(void)
{
printf("Entering main controller\n");
uint32_t core_id = pi_core_id(), cluster_id = pi_cluster_id();
printf("[%d %d] Hello World!\n", cluster_id, core_id);
struct pi_device cluster_dev;
struct pi_cluster_conf cl_conf;
/* Init cluster configuration structure. */
pi_cluster_conf_init(&cl_conf);
cl_conf.id = 0; /* Set cluster ID. */
/* Configure & open cluster. */
pi_open_from_conf(&cluster_dev, &cl_conf);
if (pi_cluster_open(&cluster_dev))
{
printf("Cluster open failed !\n");
pmsis_exit(-1);
}
/* Prepare cluster task and send it to cluster. */
struct pi_cluster_task cl_task;
pi_cluster_task(&cl_task, cluster_delegate, NULL);
pi_cluster_send_task_to_cl(&cluster_dev, &cl_task);
pi_cluster_close(&cluster_dev);
if (errors)
{
printf("Test failed!\n");
}
else
{
printf("Test success !\n");
}
pmsis_exit(errors);
}
/* Program Entry. */
int main(void)
{
printf("\n\n\t *** PMSIS HelloWorld ***\n\n");
return pmsis_kickoff((void *) helloworld);
}
|
306c5638dc05f9b7f2101ea34c54f4416508bfe2
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/x86/kernel/apic/es7000_32.c
|
0874799a98c6fbe37ee34baaad7cbdc3bd616744
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 17,501
|
c
|
es7000_32.c
|
/*
* Written by: Garry Forsgren, Unisys Corporation
* Natalie Protasevich, Unisys Corporation
*
* This file contains the code to configure and interface
* with Unisys ES7000 series hardware system manager.
*
* Copyright (c) 2003 Unisys Corporation.
* Copyright (C) 2009, Red Hat, Inc., Ingo Molnar
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Contact information: Unisys Corporation, Township Line & Union Meeting
* Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
*
* http://www.unisys.com
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/notifier.h>
#include <linux/spinlock.h>
#include <linux/cpumask.h>
#include <linux/threads.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/acpi.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/nmi.h>
#include <linux/smp.h>
#include <linux/io.h>
#include <asm/apicdef.h>
#include <linux/atomic.h>
#include <asm/fixmap.h>
#include <asm/mpspec.h>
#include <asm/setup.h>
#include <asm/apic.h>
#include <asm/ipi.h>
/*
* ES7000 chipsets
*/
#define NON_UNISYS 0
#define ES7000_CLASSIC 1
#define ES7000_ZORRO 2
#define MIP_REG 1
#define MIP_PSAI_REG 4
#define MIP_BUSY 1
#define MIP_SPIN 0xf0000
#define MIP_VALID 0x0100000000000000ULL
#define MIP_SW_APIC 0x1020b
#define MIP_PORT(val) ((val >> 32) & 0xffff)
#define MIP_RD_LO(val) (val & 0xffffffff)
struct mip_reg {
unsigned long long off_0x00;
unsigned long long off_0x08;
unsigned long long off_0x10;
unsigned long long off_0x18;
unsigned long long off_0x20;
unsigned long long off_0x28;
unsigned long long off_0x30;
unsigned long long off_0x38;
};
struct mip_reg_info {
unsigned long long mip_info;
unsigned long long delivery_info;
unsigned long long host_reg;
unsigned long long mip_reg;
};
struct psai {
unsigned long long entry_type;
unsigned long long addr;
unsigned long long bep_addr;
};
#ifdef CONFIG_ACPI
struct es7000_oem_table {
struct acpi_table_header Header;
u32 OEMTableAddr;
u32 OEMTableSize;
};
static unsigned long oem_addrX;
static unsigned long oem_size;
#endif
/*
* ES7000 Globals
*/
static volatile unsigned long *psai;
static struct mip_reg *mip_reg;
static struct mip_reg *host_reg;
static int mip_port;
static unsigned long mip_addr;
static unsigned long host_addr;
int es7000_plat;
/*
* GSI override for ES7000 platforms.
*/
static int __cpuinit wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
{
unsigned long vect = 0, psaival = 0;
if (psai == NULL)
return -1;
vect = ((unsigned long)__pa(eip)/0x1000) << 16;
psaival = (0x1000000 | vect | cpu);
while (*psai & 0x1000000)
;
*psai = psaival;
return 0;
}
static int es7000_apic_is_cluster(void)
{
/* MPENTIUMIII */
if (boot_cpu_data.x86 == 6 &&
(boot_cpu_data.x86_model >= 7 && boot_cpu_data.x86_model <= 11))
return 1;
return 0;
}
static void setup_unisys(void)
{
/*
* Determine the generation of the ES7000 currently running.
*
* es7000_plat = 1 if the machine is a 5xx ES7000 box
* es7000_plat = 2 if the machine is a x86_64 ES7000 box
*
*/
if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
es7000_plat = ES7000_ZORRO;
else
es7000_plat = ES7000_CLASSIC;
}
/*
* Parse the OEM Table:
*/
static int parse_unisys_oem(char *oemptr)
{
int i;
int success = 0;
unsigned char type, size;
unsigned long val;
char *tp = NULL;
struct psai *psaip = NULL;
struct mip_reg_info *mi;
struct mip_reg *host, *mip;
tp = oemptr;
tp += 8;
for (i = 0; i <= 6; i++) {
type = *tp++;
size = *tp++;
tp -= 2;
switch (type) {
case MIP_REG:
mi = (struct mip_reg_info *)tp;
val = MIP_RD_LO(mi->host_reg);
host_addr = val;
host = (struct mip_reg *)val;
host_reg = __va(host);
val = MIP_RD_LO(mi->mip_reg);
mip_port = MIP_PORT(mi->mip_info);
mip_addr = val;
mip = (struct mip_reg *)val;
mip_reg = __va(mip);
pr_debug("host_reg = 0x%lx\n",
(unsigned long)host_reg);
pr_debug("mip_reg = 0x%lx\n",
(unsigned long)mip_reg);
success++;
break;
case MIP_PSAI_REG:
psaip = (struct psai *)tp;
if (tp != NULL) {
if (psaip->addr)
psai = __va(psaip->addr);
else
psai = NULL;
success++;
}
break;
default:
break;
}
tp += size;
}
if (success < 2)
es7000_plat = NON_UNISYS;
else
setup_unisys();
return es7000_plat;
}
#ifdef CONFIG_ACPI
static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
{
struct acpi_table_header *header = NULL;
struct es7000_oem_table *table;
acpi_size tbl_size;
acpi_status ret;
int i = 0;
for (;;) {
ret = acpi_get_table_with_size("OEM1", i++, &header, &tbl_size);
if (!ACPI_SUCCESS(ret))
return -1;
if (!memcmp((char *) &header->oem_id, "UNISYS", 6))
break;
early_acpi_os_unmap_memory(header, tbl_size);
}
table = (void *)header;
oem_addrX = table->OEMTableAddr;
oem_size = table->OEMTableSize;
early_acpi_os_unmap_memory(header, tbl_size);
*oem_addr = (unsigned long)__acpi_map_table(oem_addrX, oem_size);
return 0;
}
static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
{
if (!oem_addr)
return;
__acpi_unmap_table((char *)oem_addr, oem_size);
}
static int es7000_check_dsdt(void)
{
struct acpi_table_header header;
if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
!strncmp(header.oem_id, "UNISYS", 6))
return 1;
return 0;
}
static int es7000_acpi_ret;
/* Hook from generic ACPI tables.c */
static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
unsigned long oem_addr = 0;
int check_dsdt;
int ret = 0;
/* check dsdt at first to avoid clear fix_map for oem_addr */
check_dsdt = es7000_check_dsdt();
if (!find_unisys_acpi_oem_table(&oem_addr)) {
if (check_dsdt) {
ret = parse_unisys_oem((char *)oem_addr);
} else {
setup_unisys();
ret = 1;
}
/*
* we need to unmap it
*/
unmap_unisys_acpi_oem_table(oem_addr);
}
es7000_acpi_ret = ret;
return ret && !es7000_apic_is_cluster();
}
static int es7000_acpi_madt_oem_check_cluster(char *oem_id, char *oem_table_id)
{
int ret = es7000_acpi_ret;
return ret && es7000_apic_is_cluster();
}
#else /* !CONFIG_ACPI: */
static int es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
return 0;
}
static int es7000_acpi_madt_oem_check_cluster(char *oem_id, char *oem_table_id)
{
return 0;
}
#endif /* !CONFIG_ACPI */
static void es7000_spin(int n)
{
int i = 0;
while (i++ < n)
rep_nop();
}
static int es7000_mip_write(struct mip_reg *mip_reg)
{
int status = 0;
int spin;
spin = MIP_SPIN;
while ((host_reg->off_0x38 & MIP_VALID) != 0) {
if (--spin <= 0) {
WARN(1, "Timeout waiting for Host Valid Flag\n");
return -1;
}
es7000_spin(MIP_SPIN);
}
memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
outb(1, mip_port);
spin = MIP_SPIN;
while ((mip_reg->off_0x38 & MIP_VALID) == 0) {
if (--spin <= 0) {
WARN(1, "Timeout waiting for MIP Valid Flag\n");
return -1;
}
es7000_spin(MIP_SPIN);
}
status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48;
mip_reg->off_0x38 &= ~MIP_VALID;
return status;
}
static void es7000_enable_apic_mode(void)
{
struct mip_reg es7000_mip_reg;
int mip_status;
if (!es7000_plat)
return;
pr_info("Enabling APIC mode.\n");
memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
es7000_mip_reg.off_0x00 = MIP_SW_APIC;
es7000_mip_reg.off_0x38 = MIP_VALID;
while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
WARN(1, "Command failed, status = %x\n", mip_status);
}
static void es7000_wait_for_init_deassert(atomic_t *deassert)
{
while (!atomic_read(deassert))
cpu_relax();
}
static unsigned int es7000_get_apic_id(unsigned long x)
{
return (x >> 24) & 0xFF;
}
static void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
{
default_send_IPI_mask_sequence_phys(mask, vector);
}
static void es7000_send_IPI_allbutself(int vector)
{
default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
}
static void es7000_send_IPI_all(int vector)
{
es7000_send_IPI_mask(cpu_online_mask, vector);
}
static int es7000_apic_id_registered(void)
{
return 1;
}
static const struct cpumask *target_cpus_cluster(void)
{
return cpu_all_mask;
}
static const struct cpumask *es7000_target_cpus(void)
{
return cpumask_of(smp_processor_id());
}
static unsigned long es7000_check_apicid_used(physid_mask_t *map, int apicid)
{
return 0;
}
static unsigned long es7000_check_apicid_present(int bit)
{
return physid_isset(bit, phys_cpu_present_map);
}
static int es7000_early_logical_apicid(int cpu)
{
/* on es7000, logical apicid is the same as physical */
return early_per_cpu(x86_bios_cpu_apicid, cpu);
}
static unsigned long calculate_ldr(int cpu)
{
unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu);
return SET_APIC_LOGICAL_ID(id);
}
/*
* Set up the logical destination ID.
*
* Intel recommends to set DFR, LdR and TPR before enabling
* an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
* document number 292116). So here it goes...
*/
static void es7000_init_apic_ldr_cluster(void)
{
unsigned long val;
int cpu = smp_processor_id();
apic_write(APIC_DFR, APIC_DFR_CLUSTER);
val = calculate_ldr(cpu);
apic_write(APIC_LDR, val);
}
static void es7000_init_apic_ldr(void)
{
unsigned long val;
int cpu = smp_processor_id();
apic_write(APIC_DFR, APIC_DFR_FLAT);
val = calculate_ldr(cpu);
apic_write(APIC_LDR, val);
}
static void es7000_setup_apic_routing(void)
{
int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
pr_info("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
(apic_version[apic] == 0x14) ?
"Physical Cluster" : "Logical Cluster",
nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
}
static int es7000_cpu_present_to_apicid(int mps_cpu)
{
if (!mps_cpu)
return boot_cpu_physical_apicid;
else if (mps_cpu < nr_cpu_ids)
return per_cpu(x86_bios_cpu_apicid, mps_cpu);
else
return BAD_APICID;
}
static int cpu_id;
static void es7000_apicid_to_cpu_present(int phys_apicid, physid_mask_t *retmap)
{
physid_set_mask_of_physid(cpu_id, retmap);
++cpu_id;
}
static void es7000_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap)
{
/* For clustered we don't have a good way to do this yet - hack */
physids_promote(0xFFL, retmap);
}
static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
{
boot_cpu_physical_apicid = read_apic_id();
return 1;
}
static inline int
es7000_cpu_mask_to_apicid(const struct cpumask *cpumask, unsigned int *dest_id)
{
unsigned int round = 0;
unsigned int cpu, uninitialized_var(apicid);
/*
* The cpus in the mask must all be on the apic cluster.
*/
for_each_cpu_and(cpu, cpumask, cpu_online_mask) {
int new_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
if (round && APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
WARN(1, "Not a valid mask!");
return -EINVAL;
}
apicid |= new_apicid;
round++;
}
if (!round)
return -EINVAL;
*dest_id = apicid;
return 0;
}
static int
es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
const struct cpumask *andmask,
unsigned int *apicid)
{
cpumask_var_t cpumask;
*apicid = early_per_cpu(x86_cpu_to_logical_apicid, 0);
if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
return 0;
cpumask_and(cpumask, inmask, andmask);
es7000_cpu_mask_to_apicid(cpumask, apicid);
free_cpumask_var(cpumask);
return 0;
}
static int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
{
return cpuid_apic >> index_msb;
}
static int probe_es7000(void)
{
/* probed later in mptable/ACPI hooks */
return 0;
}
static int es7000_mps_ret;
static int es7000_mps_oem_check(struct mpc_table *mpc, char *oem,
char *productid)
{
int ret = 0;
if (mpc->oemptr) {
struct mpc_oemtable *oem_table =
(struct mpc_oemtable *)mpc->oemptr;
if (!strncmp(oem, "UNISYS", 6))
ret = parse_unisys_oem((char *)oem_table);
}
es7000_mps_ret = ret;
return ret && !es7000_apic_is_cluster();
}
static int es7000_mps_oem_check_cluster(struct mpc_table *mpc, char *oem,
char *productid)
{
int ret = es7000_mps_ret;
return ret && es7000_apic_is_cluster();
}
/* We've been warned by a false positive warning.Use __refdata to keep calm. */
static struct apic __refdata apic_es7000_cluster = {
.name = "es7000",
.probe = probe_es7000,
.acpi_madt_oem_check = es7000_acpi_madt_oem_check_cluster,
.apic_id_valid = default_apic_id_valid,
.apic_id_registered = es7000_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio,
/* logical delivery broadcast to all procs: */
.irq_dest_mode = 1,
.target_cpus = target_cpus_cluster,
.disable_esr = 1,
.dest_logical = 0,
.check_apicid_used = es7000_check_apicid_used,
.check_apicid_present = es7000_check_apicid_present,
.vector_allocation_domain = flat_vector_allocation_domain,
.init_apic_ldr = es7000_init_apic_ldr_cluster,
.ioapic_phys_id_map = es7000_ioapic_phys_id_map,
.setup_apic_routing = es7000_setup_apic_routing,
.multi_timer_check = NULL,
.cpu_present_to_apicid = es7000_cpu_present_to_apicid,
.apicid_to_cpu_present = es7000_apicid_to_cpu_present,
.setup_portio_remap = NULL,
.check_phys_apicid_present = es7000_check_phys_apicid_present,
.enable_apic_mode = es7000_enable_apic_mode,
.phys_pkg_id = es7000_phys_pkg_id,
.mps_oem_check = es7000_mps_oem_check_cluster,
.get_apic_id = es7000_get_apic_id,
.set_apic_id = NULL,
.apic_id_mask = 0xFF << 24,
.cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
.send_IPI_mask = es7000_send_IPI_mask,
.send_IPI_mask_allbutself = NULL,
.send_IPI_allbutself = es7000_send_IPI_allbutself,
.send_IPI_all = es7000_send_IPI_all,
.send_IPI_self = default_send_IPI_self,
.wakeup_secondary_cpu = wakeup_secondary_cpu_via_mip,
.trampoline_phys_low = 0x467,
.trampoline_phys_high = 0x469,
.wait_for_init_deassert = NULL,
/* Nothing to do for most platforms, since cleared by the INIT cycle: */
.smp_callin_clear_local_apic = NULL,
.inquire_remote_apic = default_inquire_remote_apic,
.read = native_apic_mem_read,
.write = native_apic_mem_write,
.eoi_write = native_apic_mem_write,
.icr_read = native_apic_icr_read,
.icr_write = native_apic_icr_write,
.wait_icr_idle = native_apic_wait_icr_idle,
.safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
.x86_32_early_logical_apicid = es7000_early_logical_apicid,
};
static struct apic __refdata apic_es7000 = {
.name = "es7000",
.probe = probe_es7000,
.acpi_madt_oem_check = es7000_acpi_madt_oem_check,
.apic_id_valid = default_apic_id_valid,
.apic_id_registered = es7000_apic_id_registered,
.irq_delivery_mode = dest_Fixed,
/* phys delivery to target CPUs: */
.irq_dest_mode = 0,
.target_cpus = es7000_target_cpus,
.disable_esr = 1,
.dest_logical = 0,
.check_apicid_used = es7000_check_apicid_used,
.check_apicid_present = es7000_check_apicid_present,
.vector_allocation_domain = flat_vector_allocation_domain,
.init_apic_ldr = es7000_init_apic_ldr,
.ioapic_phys_id_map = es7000_ioapic_phys_id_map,
.setup_apic_routing = es7000_setup_apic_routing,
.multi_timer_check = NULL,
.cpu_present_to_apicid = es7000_cpu_present_to_apicid,
.apicid_to_cpu_present = es7000_apicid_to_cpu_present,
.setup_portio_remap = NULL,
.check_phys_apicid_present = es7000_check_phys_apicid_present,
.enable_apic_mode = es7000_enable_apic_mode,
.phys_pkg_id = es7000_phys_pkg_id,
.mps_oem_check = es7000_mps_oem_check,
.get_apic_id = es7000_get_apic_id,
.set_apic_id = NULL,
.apic_id_mask = 0xFF << 24,
.cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and,
.send_IPI_mask = es7000_send_IPI_mask,
.send_IPI_mask_allbutself = NULL,
.send_IPI_allbutself = es7000_send_IPI_allbutself,
.send_IPI_all = es7000_send_IPI_all,
.send_IPI_self = default_send_IPI_self,
.trampoline_phys_low = 0x467,
.trampoline_phys_high = 0x469,
.wait_for_init_deassert = es7000_wait_for_init_deassert,
/* Nothing to do for most platforms, since cleared by the INIT cycle: */
.smp_callin_clear_local_apic = NULL,
.inquire_remote_apic = default_inquire_remote_apic,
.read = native_apic_mem_read,
.write = native_apic_mem_write,
.eoi_write = native_apic_mem_write,
.icr_read = native_apic_icr_read,
.icr_write = native_apic_icr_write,
.wait_icr_idle = native_apic_wait_icr_idle,
.safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
.x86_32_early_logical_apicid = es7000_early_logical_apicid,
};
/*
* Need to check for es7000 followed by es7000_cluster, so this order
* in apic_drivers is important.
*/
apic_drivers(apic_es7000, apic_es7000_cluster);
|
0ae1b2e709b78ecd2f719669b7739cdcf4e765c5
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/mail/opensmtpd/patches/patch-usr.sbin_smtpd_proxy.c
|
49bace983279a08beb4d0c08403996f5f141fc99
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 1,152
|
c
|
patch-usr.sbin_smtpd_proxy.c
|
$NetBSD: patch-usr.sbin_smtpd_proxy.c,v 1.1 2023/08/24 15:26:40 vins Exp $
Rename local variables to avoid name clash on SmartOS.
--- usr.sbin/smtpd/proxy.c.orig 2020-05-21 19:06:04.000000000 +0000
+++ usr.sbin/smtpd/proxy.c
@@ -341,7 +341,7 @@ proxy_translate_ss(struct proxy_session
{
struct sockaddr_in *sin = (struct sockaddr_in *) &s->ss;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &s->ss;
- struct sockaddr_un *sun = (struct sockaddr_un *) &s->ss;
+ struct sockaddr_un *lsun = (struct sockaddr_un *) &s->ss;
size_t sun_len;
switch (s->hdr.fam) {
@@ -370,13 +370,13 @@ proxy_translate_ss(struct proxy_session
memset(&s->ss, 0, sizeof(s->ss));
sun_len = strnlen(s->addr.un.src_addr,
sizeof(s->addr.un.src_addr));
- if (sun_len > sizeof(sun->sun_path)) {
+ if (sun_len > sizeof(lsun->sun_path)) {
proxy_error(s, "address translation", "Unix socket path"
" longer than supported");
return (-1);
}
- sun->sun_family = AF_UNIX;
- memcpy(sun->sun_path, s->addr.un.src_addr, sun_len);
+ lsun->sun_family = AF_UNIX;
+ memcpy(lsun->sun_path, s->addr.un.src_addr, sun_len);
break;
default:
|
f631938264dc47e47fa954a2528a8ae092ba0184
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/audio/libopenshot-audio/files/patch-JuceLibraryCode_modules_juce__core_threads_juce__Process.h
|
a7bd060484eb928eb0a1c0dc674ca82695e36531
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 617
|
h
|
patch-JuceLibraryCode_modules_juce__core_threads_juce__Process.h
|
--- JuceLibraryCode/modules/juce_core/threads/juce_Process.h.orig 2019-04-17 16:56:20 UTC
+++ JuceLibraryCode/modules/juce_core/threads/juce_Process.h
@@ -139,7 +139,7 @@ class JUCE_API Process (public)
static void setDockIconVisible (bool isVisible);
#endif
- #if JUCE_MAC || JUCE_LINUX || DOXYGEN
+ #if JUCE_BSD || JUCE_MAC || JUCE_LINUX || DOXYGEN
//==============================================================================
/** UNIX ONLY - Attempts to use setrlimit to change the maximum number of file
handles that the app can open. Pass 0 or less as the parameter to mean
|
44a7c6b6893ffcf2fcb8d9162f60d6ec812d59e4
|
2ff8c59ae7c7ef805b1e89191a459f614e0f9c4d
|
/src/libmongoc/src/mongoc/mongoc-database-private.h
|
640264303ff2c5f7f1a0a77f03c4dab610363d0b
|
[
"Apache-2.0"
] |
permissive
|
mongodb/mongo-c-driver
|
e02c40e01fb921a29750cf1c0205678f9c86a741
|
5c101ce5a565ffa9d160b6e44fb276b502b57157
|
refs/heads/master
| 2023-09-06T09:32:54.594891
| 2023-09-01T19:21:01
| 2023-09-01T19:21:01
| 9,735,077
| 811
| 506
|
Apache-2.0
| 2023-09-14T18:10:00
| 2013-04-28T19:34:36
|
C
|
UTF-8
|
C
| false
| false
| 4,168
|
h
|
mongoc-database-private.h
|
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mongoc-prelude.h"
#ifndef MONGOC_DATABASE_PRIVATE_H
#define MONGOC_DATABASE_PRIVATE_H
#include <bson/bson.h>
#include "mongoc-client.h"
#include "mongoc-read-prefs.h"
#include "mongoc-read-concern.h"
#include "mongoc-write-concern.h"
BSON_BEGIN_DECLS
struct _mongoc_database_t {
mongoc_client_t *client;
char *name;
mongoc_read_prefs_t *read_prefs;
mongoc_read_concern_t *read_concern;
mongoc_write_concern_t *write_concern;
};
mongoc_database_t *
_mongoc_database_new (mongoc_client_t *client,
const char *name,
const mongoc_read_prefs_t *read_prefs,
const mongoc_read_concern_t *read_concern,
const mongoc_write_concern_t *write_concern);
/* _mongoc_get_encryptedFields_from_map checks the collection has an
* encryptedFields set on the client encryptedFieldsMap.
* encryptedFields is always initialized on return.
*/
bool
_mongoc_get_encryptedFields_from_map (mongoc_client_t *client,
const char *dbName,
const char *collName,
bson_t *encryptedFields,
bson_error_t *error);
/* _mongoc_get_encryptedFields_from_map checks the collection has an
* encryptedFields by running listCollections.
* encryptedFields is always initialized on return.
*/
bool
_mongoc_get_encryptedFields_from_server (mongoc_client_t *client,
const char *dbName,
const char *collName,
bson_t *encryptedFields,
bson_error_t *error);
/**
* @brief Look up the encryptedFields to use for the given collection.
*
* If the collection options contains an encryptedFields, those are returned.
* If the client has an encryptedFieldsMap entry for the collection within the
* given database, those are returned. If neither, an empty document is
* returned.
*
* @param client The client with which to search an encryptedFieldsMap
* @param dbName The name of the database where the collection will/does live
* @param collName The name of the collection
* @param opts (Optional) The collection options, which may contain the
* fields
* @param checkEncryptedFieldsMap If false, the encryptedFieldsMap will not be
* checked.
* @param[out] encryptedFields An output where a view of the encryptedFields
* will be written
* @param[out] error An error output
* @retval true If there was no error
* @retval false Otherwise
*
* @note Upon returning `true`, check whether `*encryptedFields` is empty to
* determine whether fields have been found.
*/
bool
_mongoc_get_collection_encryptedFields (mongoc_client_t *client,
const char *dbName,
const char *collName,
const bson_t *opts,
bool checkEncryptedFieldsMap,
bson_t *encryptedFields,
bson_error_t *error);
/* _mongoc_get_encryptedField_state_collection returns the state collection
* name. Returns NULL on error. */
char *
_mongoc_get_encryptedField_state_collection (
const bson_t *encryptedFields,
const char *data_collection,
const char *state_collection_suffix,
bson_error_t *error);
BSON_END_DECLS
#endif /* MONGOC_DATABASE_PRIVATE_H */
|
5bf89ae5097ede4a549368bade3d2642d7ea063f
|
af8fe84a9a43f5d7309cca301a791e9a1da6edf2
|
/src/usb/usb_frame.h
|
9f7d92d90df6bcc6f62c092d92002b7998d4afbc
|
[
"Apache-2.0"
] |
permissive
|
digitalbitbox/bitbox02-firmware
|
c2581b02088009385d7c40066ad940a469eca761
|
12cfa59f05c200a72fa204961e3a5f8b3d3c0ba0
|
refs/heads/master
| 2023-08-31T22:14:19.307352
| 2023-08-31T09:29:16
| 2023-08-31T09:29:16
| 190,549,724
| 219
| 87
|
Apache-2.0
| 2023-09-14T07:10:09
| 2019-06-06T09:00:23
|
C
|
UTF-8
|
C
| false
| false
| 4,663
|
h
|
usb_frame.h
|
// Copyright 2019 Shift Cryptosecurity AG
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _USB_FRAME_H_
#define _USB_FRAME_H_
#include <stdint.h>
#include "queue.h"
#include <usb/class/usb_desc.h>
#define FRAME_TYPE_MASK 0x80 // Frame type mask
#define FRAME_TYPE_INIT 0x80 // Initial frame identifier
#define FRAME_TYPE_CONT 0x00 // Continuation frame identifier
#define FRAME_TYPE(f) ((f).type & FRAME_TYPE_MASK)
#define FRAME_CMD(f) ((f).init.cmd & ~FRAME_TYPE_MASK)
#define FRAME_SEQ(f) ((f).cont.seq & ~FRAME_TYPE_MASK)
#define FRAME_MSG_LEN(f) (((f).init.bcnth << 8) + (f).init.bcntl)
#define FRAME_MSG (FRAME_TYPE_INIT | 0x03) // Send FRAME message frame
#define FRAME_ERROR (FRAME_TYPE_INIT | 0x3f) // Error response
#define FRAME_ERR_INVALID_CMD 0x01
#define FRAME_ERR_INVALID_PAR 0x02
#define FRAME_ERR_INVALID_LEN 0x03
#define FRAME_ERR_INVALID_SEQ 0x04
#define FRAME_ERR_MSG_TIMEOUT 0x05
#define FRAME_ERR_CHANNEL_BUSY 0x06
#define FRAME_ERR_OTHER 0x7f
// Internal error message to ignore a frame
#define FRAME_ERR_IGNORE 0x80
// https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-hid-protocol-v1.2-ps-20170411.html
//
// Packets are one of two types, initialization packets and continuation packets.
// As the name suggests, the first packet sent in a message is an initialization
// packet, which also becomes the start of a transaction. If the entire message
// does not fit into one packet (including the U2FHID protocol overhead), one or
// more continuation packets have to be sent in strict ascending order to complete
// the message transfer.
//
// With this approach, a message with a payload less or equal to (s - 7) may be
// sent as one packet. A larger message is then divided into one or more
// continuation packets, starting with sequence number 0, which then increments
// by one to a maximum of 127.
//
// With a packet size of 64 bytes (max for full-speed devices), this means that
// the maximum message payload length is 64 - 7 + 128 * (64 - 5) = 7609 bytes.
#define USB_DATA_MAX_LEN 7609U
#define HID_VENDOR_FIRST (FRAME_TYPE_INIT | 0x40) // First vendor defined command
#define HID_VENDOR_LAST (FRAME_TYPE_INIT | 0x7f) // Last vendor defined command
__extension__ typedef struct {
uint32_t cid; // Channel identifier
union {
uint8_t type; // Frame type - bit 7 defines type
struct {
uint8_t cmd; // Command - bit 7 set
uint8_t bcnth; // Message byte count - high
uint8_t bcntl; // Message byte count - low
uint8_t data[USB_REPORT_SIZE - 7]; // Data payload
} init;
struct {
uint8_t seq; // Sequence number - bit 7 cleared
uint8_t data[USB_REPORT_SIZE - 5]; // Data payload
} cont;
};
} USB_FRAME;
/**
* Holds the data, pointer into the buffer, data length, cmd, channel id and sequence
* number in order to collect multiple frames into a processable command.
*/
typedef struct {
uint8_t data[USB_DATA_MAX_LEN];
uint8_t* buf_ptr;
uint32_t len;
uint8_t seq;
uint8_t cmd;
uint32_t cid;
uint8_t initialized;
} State;
/**
* Prepares frames and calls the add_frame_callback.
* @param[in] cmd The HID command.
* @param[in] data The data send to the host.
* @param[in] len The length of the data.
* @param[in] cid The channel ID.
* @param[in] add_frame_callback The callback to which the prepared frames are passed to.
*/
queue_error_t usb_frame_reply(
uint8_t cmd,
const uint8_t* data,
uint32_t len,
uint32_t cid,
struct queue* queue);
/**
* Prepares an error USB frame, containing the channel id
* and error code and adds it to the given callback.
* @param[in] cid The channel id.
* @param[in] err The error send to the host.
* @param[in] add_frame_callback The callback to which we add the frame.
*/
queue_error_t usb_frame_prepare_err(uint8_t err, uint32_t cid, struct queue* queue);
/**
* Processes usb frame requests.
* @param[in] frame The frame that is processed.
* @param[in] state The frame processing state.
*/
int32_t usb_frame_process(const USB_FRAME* frame, State* state);
#endif
|
7a9636da662fabeaa62a0cd312af9b6d602a2cf8
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/wch/risc-v/Libraries/ch32v30x_libraries/ch32v307_hal/include/ch32v30x_rtc.h
|
60e90ee07e0c4872000311655cbad86286d30e3d
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 1,877
|
h
|
ch32v30x_rtc.h
|
/********************************** (C) COPYRIGHT *******************************
* File Name : ch32v30x_rtc.h
* Author : WCH
* Version : V1.0.0
* Date : 2021/06/06
* Description : This file contains all the functions prototypes for the RTC
* firmware library.
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/
#ifndef __CH32V30x_RTC_H
#define __CH32V30x_RTC_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ch32v30x.h"
/* RTC_interrupts_define */
#define RTC_IT_OW ((uint16_t)0x0004) /* Overflow interrupt */
#define RTC_IT_ALR ((uint16_t)0x0002) /* Alarm interrupt */
#define RTC_IT_SEC ((uint16_t)0x0001) /* Second interrupt */
/* RTC_interrupts_flags */
#define RTC_FLAG_RTOFF ((uint16_t)0x0020) /* RTC Operation OFF flag */
#define RTC_FLAG_RSF ((uint16_t)0x0008) /* Registers Synchronized flag */
#define RTC_FLAG_OW ((uint16_t)0x0004) /* Overflow flag */
#define RTC_FLAG_ALR ((uint16_t)0x0002) /* Alarm flag */
#define RTC_FLAG_SEC ((uint16_t)0x0001) /* Second flag */
void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState);
void RTC_EnterConfigMode(void);
void RTC_ExitConfigMode(void);
uint32_t RTC_GetCounter(void);
void RTC_SetCounter(uint32_t CounterValue);
void RTC_SetPrescaler(uint32_t PrescalerValue);
void RTC_SetAlarm(uint32_t AlarmValue);
uint32_t RTC_GetDivider(void);
void RTC_WaitForLastTask(void);
void RTC_WaitForSynchro(void);
FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
void RTC_ClearFlag(uint16_t RTC_FLAG);
ITStatus RTC_GetITStatus(uint16_t RTC_IT);
void RTC_ClearITPendingBit(uint16_t RTC_IT);
#ifdef __cplusplus
}
#endif
#endif
|
4f1f01ced7d1666dbff98b730c86dc599da92bc1
|
549270020f6c8724e2ef1b12e38d11b025579f8d
|
/recipes/libdrm/all/test_package/test_package.c
|
9de39b71a65f152b0d2497952075f1d8fe0eb40d
|
[
"MIT"
] |
permissive
|
conan-io/conan-center-index
|
1bcec065ccd65aa38b1fed93fbd94d9d5fe6bc43
|
3b17e69bb4e5601a850b6e006e44775e690bac33
|
refs/heads/master
| 2023-08-31T11:34:45.403978
| 2023-08-31T11:13:23
| 2023-08-31T11:13:23
| 204,671,232
| 844
| 1,820
|
MIT
| 2023-09-14T21:22:42
| 2019-08-27T09:43:58
|
Python
|
UTF-8
|
C
| false
| false
| 278
|
c
|
test_package.c
|
#include <stdio.h>
#include "xf86drm.h"
int main()
{
drmVersionPtr v = drmGetLibVersion(0);
printf("drm version: %d.%d.%d\n", v->version_major, v->version_minor, v->version_patchlevel);
drmFree(v);
printf("drm available: %d\n", drmAvailable());
return 0;
}
|
9a41e2fcea949fef1f5fc8a5775c90b6d260d19c
|
3a30cfb29aac91e5c75d4dbcefddfd1f34d5f18c
|
/c-tests/new/array-address-in-initializer.c
|
18f4b962ca7ba59b5841a78409c521f13e5cf63a
|
[
"MIT",
"MPL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LGPL-2.0-only"
] |
permissive
|
vnmakarov/mir
|
a1725bc9c828e8580df6b7ae94e04175db8abe93
|
928e28fb3acaa50d051a906e76a55cc48a556574
|
refs/heads/master
| 2023-09-02T11:10:37.434581
| 2023-08-25T19:25:40
| 2023-08-25T19:25:40
| 178,932,492
| 2,005
| 156
|
MIT
| 2023-08-01T20:29:59
| 2019-04-01T19:24:56
|
C
|
UTF-8
|
C
| false
| false
| 101
|
c
|
array-address-in-initializer.c
|
static int regs_saved_in_regs[4];
static int *a = ®s_saved_in_regs;
int main (void) { return 0; }
|
801b8389a9140acc8739266b8584183013937920
|
f53891174b71e3b52497b3ab56b30ca7056ef1b7
|
/src/elle/cryptography/modules/dopenssl/src/dopenssl/all.h
|
8aed4408d43cab50a2e885289330209510608c7b
|
[
"Apache-2.0",
"OpenSSL"
] |
permissive
|
infinit/elle
|
050e0a3825a585add8899cf8dd8e25b0531c67ce
|
1a8f3df18500a9854a514cbaf9824784293ca17a
|
refs/heads/master
| 2023-09-04T01:15:06.820585
| 2022-09-17T08:43:45
| 2022-09-17T08:43:45
| 51,672,792
| 533
| 51
|
Apache-2.0
| 2023-05-22T21:35:50
| 2016-02-14T00:38:23
|
C++
|
UTF-8
|
C
| false
| false
| 453
|
h
|
all.h
|
/*
* Copyright (c) 2013, infinit.io
*
* This software is provided "as is" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of fitness for a particular purpose.
*
* See the LICENSE file for more information on the terms and
* conditions.
*/
#ifndef DOPENSSL_ALL_H
# define DOPENSSL_ALL_H
# include <dopenssl/bn.h>
# include <dopenssl/rand.h>
# include <dopenssl/rsa.h>
#endif
|
29fc83e75e4772a9d108e04b0446a9a143c9e5ad
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/libc/calls/fadvise-nt.c
|
2e1c9c7caf3cde12b2aa57f1cad98ba3310f7dba
|
[
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 3,687
|
c
|
fadvise-nt.c
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2020 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for │
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/calls/internal.h"
#include "libc/calls/state.internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/nt/createfile.h"
#include "libc/nt/enum/fileflagandattributes.h"
#include "libc/nt/enum/filetype.h"
#include "libc/nt/files.h"
#include "libc/nt/runtime.h"
#include "libc/sysv/consts/madv.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/errfuns.h"
textwindows int sys_fadvise_nt(int fd, uint64_t offset, uint64_t len,
int advice) {
int64_t h1, h2;
int rc, flags, mode;
uint32_t perm, share, attr;
if ((int64_t)len < 0) return einval();
if (!__isfdkind(fd, kFdFile)) return ebadf();
h1 = g_fds.p[fd].handle;
mode = g_fds.p[fd].mode;
flags = g_fds.p[fd].flags;
flags &= ~(O_SEQUENTIAL | O_RANDOM);
switch (advice) {
case MADV_NORMAL:
break;
case MADV_RANDOM:
flags |= O_RANDOM;
break;
case MADV_WILLNEED:
case MADV_SEQUENTIAL:
flags |= O_SEQUENTIAL;
break;
default:
return einval();
}
if (GetNtOpenFlags(flags, mode, &perm, &share, 0, &attr) == -1) {
return -1;
}
if (GetFileType(h1) == kNtFileTypePipe) {
return espipe();
}
// MSDN says only these are allowed, otherwise it returns EINVAL.
attr &= kNtFileFlagBackupSemantics | kNtFileFlagDeleteOnClose |
kNtFileFlagNoBuffering | kNtFileFlagOpenNoRecall |
kNtFileFlagOpenReparsePoint | kNtFileFlagOverlapped |
kNtFileFlagPosixSemantics | kNtFileFlagRandomAccess |
kNtFileFlagSequentialScan | kNtFileFlagWriteThrough;
__fds_lock();
if ((h2 = ReOpenFile(h1, perm, share, attr)) != -1) {
if (h2 != h1) {
CloseHandle(h1);
g_fds.p[fd].handle = h2;
}
g_fds.p[fd].flags = flags;
rc = 0;
} else {
rc = __winerr();
}
__fds_unlock();
return rc;
}
|
257bd06872b82351f01b33a0bc61608453ed7dee
|
9de0cec678bc4a3bec2b4adabef9f39ff5b4afac
|
/PWGPP/EMCAL/TeCMacros/rotateTree.C
|
3067444c836243ab750493ead577668a2e9657f7
|
[] |
permissive
|
alisw/AliPhysics
|
91bf1bd01ab2af656a25ff10b25e618a63667d3e
|
5df28b2b415e78e81273b0d9bf5c1b99feda3348
|
refs/heads/master
| 2023-08-31T20:41:44.927176
| 2023-08-31T14:51:12
| 2023-08-31T14:51:12
| 61,661,378
| 129
| 1,150
|
BSD-3-Clause
| 2023-09-14T18:48:45
| 2016-06-21T19:31:29
|
C++
|
UTF-8
|
C
| false
| false
| 3,436
|
c
|
rotateTree.C
|
#if !defined(__CINT__) || defined(__MAKECINT__)
#include <AliEMCALGeometry.h>
#include <AliOADBContainer.h>
#include <TCanvas.h>
#include <TClonesArray.h>
#include <TDatime.h>
#include <TFile.h>
#include <TGraphErrors.h>
#include <TGrid.h>
#include <TH2F.h>
#include <TLegend.h>
#include <TMap.h>
#include <TNtuple.h>
#include <TObject.h>
#include <TProfile.h>
#include <TProfile2D.h>
#include <TSystem.h>
#include <TString.h>
#include <TRandom3.h>
#include "createTree.C"
#endif
class TCalRun : public TObject {
public:
TCalRun() : fLedM(-1), fLedR(-1), fMonM(-1), fMonR(-1), fSMT(-1), fLength(0), fRunNo(-1), fBad(0) {;}
virtual ~TCalRun() {;}
Double32_t fLedM; //[0,0,16] led mean
Double32_t fLedR; //[0,0,16] led rms
Double32_t fMonM; //[0,0,16] mon mean
Double32_t fMonR; //[0,0,16] mon rms
Double32_t fSMT; //[0,0,16] sm T
UInt_t fLength; // run length in seconds
Int_t fRunNo; // run number
Short_t fBad; // bad cell
ClassDef(TCalRun, 1); // CalRun class
};
class TCalCellInfo : public TObject {
public:
TCalCellInfo() : fCellId(-1), fRuns("TCalRun") {}
virtual ~TCalCellInfo() {;}
Int_t fCellId; // cell IDs
TClonesArray fRuns;
ClassDef(TCalCellInfo, 1); // CalCellInfo class
};
void rotateTree( const char *ifile ="treefile.root",
const char *ofile ="treefile.root",
Int_t referenceRun = -1
) {
// Load EMCAL geometry for reference run
AliEMCALGeometry *g = AliEMCALGeometry::GetInstanceFromRunNumber(referenceRun);
const Int_t kSM = g->GetNumberOfSuperModules();
const Int_t kNcells = g->GetNCells();
// initialize info from tree created by $ALICE_PHYSICS/PWGPP/EMCAL/TeCMacros/createTree.C
TCalInfo *info = 0;
TFile *in = TFile::Open(ifile,"read");
TTree *treeRuns = (TTree*)in->Get("tcal");
treeRuns->SetBranchAddress("event",&info);
treeRuns->Branch("event", &info, 32000, 99);
Int_t Nev=treeRuns->GetEntries();
TCalCellInfo *cellinfo = new TCalCellInfo;
TFile *out = TFile::Open(ofile,"recreate");
out->SetCompressionLevel(9);
TTree* treeCells = new TTree("tcalcell", "Temp calibration cell tree");
treeCells->SetDirectory(out);
treeCells->Branch("cells", &cellinfo, 32000, 99);
TClonesArray &cRunArr = cellinfo->fRuns;
for (Int_t k = 0; k < kNcells; k++){
if (k%50 == 0)
cout << "starting with cell " << k << "/" << kNcells << endl;
cellinfo->fCellId = k;
cRunArr.Clear();
cRunArr.ExpandCreate(Nev);
for (Int_t i=0;i<Nev;++i) {
treeRuns->GetEvent(i);
TCalRun *run = (TCalRun*)cRunArr.At(i);
run->fLength = ((ULong_t)info->fLastTime-(ULong_t)info->fFirstTime); // run length in seconds
run->fRunNo = info->fRunNo;
TClonesArray &cells = info->fCells;
TCalCell *cell = static_cast<TCalCell*>(cells.At(k));
if (cell->fId != k){
cout << "missmatch for cell " << k << "\t" << cell->fId << endl;
continue;
}
run->fSMT = cell->fSMT;
run->fBad = cell->fBad;
run->fLedM = cell->fLedM;
run->fLedR = cell->fLedR;
run->fMonM = cell->fMonM;
run->fMonR = cell->fMonR;
}
treeCells->Fill();
}
out->cd();
treeCells->Write();
out->Close();
}
|
7564f8bd97bc2ed6e740e3b6aa9e14443826fd9c
|
25b7cd3e4b750803565c374e59f8179c8aab276d
|
/hd_edition/hde_mod/hde/structures/swapmgr.h
|
54a5a6ee66c192868d5c95dca8bc95778c0054c8
|
[
"MIT"
] |
permissive
|
potmdehex/homm3tools
|
320ce70e0d22dc597df440ec7c63fde9844f7dbe
|
6b36d1f92ea67f5ad6d4847aeaf2dfb1766d3cc5
|
refs/heads/master
| 2023-08-06T02:56:53.534443
| 2022-09-19T12:42:50
| 2022-09-19T12:42:50
| 40,399,205
| 141
| 29
|
MIT
| 2019-12-06T12:11:43
| 2015-08-08T10:15:08
|
C
|
UTF-8
|
C
| false
| false
| 779
|
h
|
swapmgr.h
|
// Created by John Åkerblom 2015-03-13
#ifndef __SWAPMGR_H_DEF__
#define __SWAPMGR_H_DEF__
#include "hero.h"
#include "mgr.h"
#include <stdint.h>
#pragma pack(push, 1)
struct HDE_SWAPMGR
{
struct HDE_MGR base;
uint32_t unknown1; // value 1 observed
void **ftable1;
void **ftable2;
struct HDE_HERO *hero_left;
struct HDE_HERO *hero_right;
uint32_t selected_owner; // 0 if owner of selected stack is left, 1 if right
uint32_t inspected_owner; // 0 if owner of inspected stack is left, 1 if right
uint32_t selected_slot; // slot of selected stack
uint32_t inspected_slot; // slot of inspected stack
uint32_t state; // -1 if no ongoing action, 0 if stack being selected/inspected
// unknown2[??]
};
#pragma pack(pop)
#endif
|
7c00bc77b3fd5a5fc66cdade7a8b112d7194a2da
|
a1d5df246d39000f30a1d128bc53d2f0fbbb3250
|
/SETUP/CUSTDLL/SRC/UI-HOOK.H
|
50614d1e41925b083735b0eef9db1d86c6552330
|
[
"MIT"
] |
permissive
|
microsoft/Microsoft-3D-Movie-Maker
|
0873a4a5bef74792f5c787b9661fe7d8d0fabe5a
|
104b2653e68046c2f6373186169f281006db35b1
|
refs/heads/main
| 2022-05-07T21:09:40.479649
| 2022-05-04T04:12:08
| 2022-05-04T04:12:08
| 481,732,253
| 3,544
| 251
| null | null | null | null |
UTF-8
|
C
| false
| false
| 1,080
|
h
|
UI-HOOK.H
|
/* Copyright (c) Microsoft Corporation.
Licensed under the MIT License. */
////////////////////////////////////////////////////////////////////////////////
// File: SAMPHOOK.H
// Purpose: Header file for sample hook routines for replacing the
// standard acme ui
////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <acmhook.h>
#include <setupapi.h>
#include <stdtypes.h>
#include <setupkit.h>
#include <ctl3d.h>
#include "resource.h"
#include "ownrdraw.h"
#if !defined(IDC_STATIC)
#define IDC_STATIC -1
#endif //!IDC_STATIC
extern "C" HINSTANCE hinst;
extern HWND HwndGetDlgOwner(VOID);
extern BOOL CALLBACK GenericHookDlgProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern VOID FetchIdcPath(HWND hdlg, int idc, LPSTR sz, LONG cb);
extern VOID SetIdcPath(HWND hdlg, int idc, LPSTR sz);
extern BOOL FLoadIds(LONG ids, CHAR *prgchIdsText, LONG cbIdsText);
extern LONG CchChopText(LPSTR sz, INT dx, HDC hdc, LONG cch);
extern BOOL FMsgBox(HWND hwnd, LONG idsText, UINT uType, int *pidRet);
|
1bfb26c58d3f4d3ac170a952901e5ed810fbecc8
|
129f39703b10b5684825ce8626d3a4e908970fad
|
/tests/cpp-compiler/c-compile-shared-library.c
|
5ae61d65b32854e4e1a01466f77089c73315c896
|
[
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] |
permissive
|
shader-slang/slang
|
80f417524c9e023ff6e4f4b0210964bf46c76278
|
f94b2f7a328a898c5e3dc1389d08e0b7ce6e092e
|
refs/heads/master
| 2023-08-19T03:17:26.436967
| 2023-08-18T19:48:46
| 2023-08-18T19:48:46
| 93,882,897
| 1,269
| 117
|
MIT
| 2023-09-14T20:57:11
| 2017-06-09T17:42:49
|
C++
|
UTF-8
|
C
| false
| false
| 572
|
c
|
c-compile-shared-library.c
|
//TEST(smoke,shared-library):CPP_COMPILER_SHARED_LIBRARY:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(_MSC_VER)
# define DLL_EXPORT __declspec(dllexport)
#else
//# define DLL_EXPORT
# define DLL_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default")))
#endif
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif
EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue)
{
strcpy(outTextValue, textValue);
return intValue;
}
|
4390bf2d102ddf6bb45de0dd3e5824f9bdc2ff75
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/libs/xpcom18a4/xpcom/build/malloc.c
|
9669182978da664e2c22f1d414d7b7fd099a1e70
|
[
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL"
] |
permissive
|
thalium/icebox
|
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
|
6f78952d58da52ea4f0e55b2ab297f28e80c1160
|
refs/heads/master
| 2022-08-14T00:19:36.984579
| 2022-02-22T13:10:31
| 2022-02-22T13:10:31
| 190,019,914
| 585
| 109
|
MIT
| 2022-01-13T20:58:15
| 2019-06-03T14:18:12
|
C++
|
UTF-8
|
C
| false
| false
| 163,115
|
c
|
malloc.c
|
#define USE_MALLOC_LOCK
#define DEFAULT_TRIM_THRESHOLD (256 * 1024)
/* ---------- To make a malloc.h, start cutting here ------------ */
/*
****************************************************************
* THIS IS A PRERELEASE. It has not yet been tested adequately. *
* If you use it, please send back comments, suggestions, *
* performance reports, etc. *
****************************************************************
*/
/*
A version (aka dlmalloc) of malloc/free/realloc written by Doug
Lea and released to the public domain. Use this code without
permission or acknowledgement in any way you wish. Send questions,
comments, complaints, performance data, etc to dl@cs.oswego.edu
* VERSION 2.7.0pre7 Wed Jan 10 13:33:01 2001 Doug Lea (dl at gee)
Note: There may be an updated version of this malloc obtainable at
ftp://gee.cs.oswego.edu/pub/misc/malloc.c
Check before installing!
* Quickstart
This library is all in one file to simplify the most common usage:
ftp it, compile it (-O), and link it into another program. All
of the compile-time options default to reasonable values for use on
most unix platforms. Compile -DWIN32 for reasonable defaults on windows.
You might later want to step through various compile options.
* Why use this malloc?
This is not the fastest, most space-conserving, most portable, or
most tunable malloc ever written. However it is among the fastest
while also being among the most space-conserving, portable and tunable.
Consistent balance across these factors results in a good general-purpose
allocator for malloc-intensive programs.
The main properties of the algorithms are:
* For large (>= 512 bytes) requests, it is a pure best-fit allocator,
with ties normally decided via FIFO (i.e. least recently used).
* For small (<= 64 bytes by default) requests, it is a caching
allocator, that maintains pools of quickly recycled chunks.
* In between, and for combinations of large and small requests, it does
the best it can trying to meet both goals at once.
Compared to 2.6.X versions, this version is generally faster,
especially for programs that allocate and free many small chunks.
For a longer but slightly out of date high-level description, see
http://gee.cs.oswego.edu/dl/html/malloc.html
You may already by default be using a c library containing a malloc
that is somehow based on some version of this malloc (for example in
linux). You might still want to use the one in this file in order to
customize settings or to avoid overheads associated with library
versions.
* Synopsis of public routines
(Much fuller descriptions are contained in the program documentation below.)
malloc(size_t n);
Return a pointer to a newly allocated chunk of at least n bytes, or null
if no space is available.
free(Void_t* p);
Release the chunk of memory pointed to by p, or no effect if p is null.
realloc(Void_t* p, size_t n);
Return a pointer to a chunk of size n that contains the same data
as does chunk p up to the minimum of (n, p's size) bytes, or null
if no space is available. The returned pointer may or may not be
the same as p. If p is null, equivalent to malloc. Unless the
#define REALLOC_ZERO_BYTES_FREES below is set, realloc with a
size argument of zero (re)allocates a minimum-sized chunk.
memalign(size_t alignment, size_t n);
Return a pointer to a newly allocated chunk of n bytes, aligned
in accord with the alignment argument, which must be a power of
two.
valloc(size_t n);
Equivalent to memalign(pagesize, n), where pagesize is the page
size of the system (or as near to this as can be figured out from
all the includes/defines below.)
pvalloc(size_t n);
Equivalent to valloc(minimum-page-that-holds(n)), that is,
round up n to nearest pagesize.
calloc(size_t unit, size_t quantity);
Returns a pointer to quantity * unit bytes, with all locations
set to zero.
cfree(Void_t* p);
Equivalent to free(p).
malloc_trim(size_t pad);
Release all but pad bytes of freed top-most memory back
to the system. Return 1 if successful, else 0.
malloc_usable_size(Void_t* p);
Report the number usable allocated bytes associated with allocated
chunk p. This may or may not report more bytes than were requested,
due to alignment and minimum size constraints.
malloc_stats();
Prints brief summary statistics on stderr.
mallinfo()
Returns (by copy) a struct containing various summary statistics.
mallopt(int parameter_number, int parameter_value)
Changes one of the tunable parameters described below. Returns
1 if successful in changing the parameter, else 0.
* Vital statistics:
Assumed pointer representation: 4 or 8 bytes
(Thanks to Wolfram Gloger for contributing most of the
changes supporting dual 4/8.)
Assumed size_t representation: 4 or 8 bytes
Note that size_t is allowed to be 4 bytes even if pointers are 8.
You can adjust this by defining INTERNAL_SIZE_T
Alignment: 2 * sizeof(size_t)
(i.e., 8 byte alignment with 4byte size_t). This suffices for
nearly all current machines and C compilers. However, you can
define MALLOC_ALIGNMENT to be wider than this if necessary.
Minimum overhead per allocated chunk: 4 or 8 bytes
Each malloced chunk has a hidden word of overhead holding size
and status information.
Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead)
8-byte ptrs: 24/32 bytes (including, 4/8 overhead)
When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte
ptrs but 4 byte size) or 24 (for 8/8) additional bytes are
needed; 4 (8) for a trailing size field and 8 (16) bytes for
free list pointers. Thus, the minimum allocatable size is
16/24/32 bytes.
Even a request for zero bytes (i.e., malloc(0)) returns a
pointer to something of the minimum allocatable size.
The maximum overhead wastage (i.e., number of extra bytes
allocated than were requested in malloc) is less than or equal
to the minimum size, except for requests >= mmap_threshold that
are serviced via mmap(), where the worst case wastage is 2 *
sizeof(size_t) bytes plus the remainder from a system page (the
minimal mmap unit); typically 4096 bytes.
Maximum allocated size: 4-byte size_t: 2^31 minus about two pages
8-byte size_t: 2^63 minus about two pages
It is assumed that (possibly signed) size_t values suffice
to represent chunk sizes. `Possibly signed' is due to the fact
that `size_t' may be defined on a system as either a signed or
an unsigned type. The ISO C standard says that it must be
unsigned, but a few systems are known not to adhere to this.
Additionally, even when size_t is unsigned, sbrk (which is by
default used to obtain memory from system) accepts signed
arguments, and may not be able to handle size_t-wide arguments
with negative sign bit. To be conservative, values that would
appear as negative after accounting for overhead and alignment
are rejected.
Requests for sizes outside this range will perform an optional
failure action and then return null. (Requests may also
also fail because a system is out of memory.)
Thread-safety: NOT thread-safe unless USE_MALLOC_LOCK defined
When USE_MALLOC_LOCK is defined, wrappers are created to
surround every public call with either a pthread mutex or
a win32 critical section (depending on WIN32). This is not
especially fast, and can be a major bottleneck in programs with
many threads. It is designed only to provide minimal protection
in concurrent environments, and to provide a basis for
extensions. If you are using malloc in a concurrent program,
you would be far better off obtaining ptmalloc, which is
derived from a version of this malloc, and is well-tuned for
concurrent programs. (See http://www.malloc.de)
Compliance: I believe it is compliant with the 1997 Single Unix Specification
(See http://www.opennc.org). Probably other standards as well.
* Limitations
Here are some features that are NOT currently supported
* No automated mechanism for fully checking that all accesses
to malloced memory stay within their bounds. However, there
are several add-ons and adaptations of this or other mallocs
available that do this.
* No support for compaction.
* Synopsis of compile-time options:
People have reported using previous versions of this malloc on all
versions of Unix, sometimes by tweaking some of the defines
below. It has been tested most extensively on Solaris and
Linux. It is also reported to work on WIN32 platforms.
People also report using it in stand-alone embedded systems.
The implementation is in straight, hand-tuned ANSI C. It is not
at all modular. (Sorry!) It uses a lot of macros. To be at all
usable, this code should be compiled using an optimizing compiler
(for example gcc -O3) that can simplify expressions and control
paths. (FAQ: some macros import variables as arguments rather than
declare locals because people reported that some debuggers
otherwise get confused.)
OPTION DEFAULT VALUE
Compilation Environment options:
__STD_C derived from C compiler defines
WIN32 NOT defined
HAVE_MEMCPY defined
USE_MEMCPY 1 if HAVE_MEMCPY is defined
HAVE_MMAP defined as 1
MMAP_AS_MORECORE_SIZE (1024 * 1024)
HAVE_MREMAP defined as 0 unless linux defined
malloc_getpagesize derived from system #includes, or 4096 if not
HAVE_USR_INCLUDE_MALLOC_H NOT defined
LACKS_UNISTD_H NOT defined unless WIN32
LACKS_SYS_PARAM_H NOT defined unless WIN32
LACKS_SYS_MMAN_H NOT defined unless WIN32
Changing default word sizes:
INTERNAL_SIZE_T size_t
MALLOC_ALIGNMENT 2 * sizeof(INTERNAL_SIZE_T)
Configuration and functionality options:
USE_DL_PREFIX NOT defined
USE_PUBLIC_MALLOC_WRAPPERS NOT defined
USE_MALLOC_LOCK NOT defined
DEBUG NOT defined
REALLOC_ZERO_BYTES_FREES NOT defined
MALLOC_FAILURE_ACTION errno = ENOMEM, if __STD_C defined, else no-op
TRIM_FASTBINS 0
Options for customizing MORECORE:
MORECORE sbrk
MORECORE_CONTIGUOUS 1
Tuning options that are also dynamically changeable via mallopt:
DEFAULT_MXFAST 64
DEFAULT_TRIM_THRESHOLD 128 * 1024
DEFAULT_TOP_PAD 0
DEFAULT_MMAP_THRESHOLD 128 * 1024
DEFAULT_MMAP_MAX 256
There are several other #defined constants and macros that you
probably don't want to touch unless you are extending or adapting malloc.
*/
#include "xpcom-private.h"
/*
WIN32 sets up defaults for MS environment and compilers.
Otherwise defaults are for unix.
*/
/* #define WIN32 */
#ifdef WIN32
#include <windows.h>
/* Win32 doesn't supply or need the following headers */
#define LACKS_UNISTD_H
#define LACKS_SYS_PARAM_H
#define LACKS_SYS_MMAN_H
/* Use the supplied emulation of sbrk */
#define MORECORE sbrk
#define MORECORE_CONTIGUOUS 1
#define MORECORE_FAILURE ((void*)(-1))
/* Use the supplied emulation mmap, munmap */
#define HAVE_MMAP 1
#define MUNMAP_FAILURE (-1)
/* These values don't really matter in windows mmap emulation */
#define MAP_PRIVATE 1
#define MAP_ANONYMOUS 2
#define PROT_READ 1
#define PROT_WRITE 2
/* Emulation functions defined at the end of this file */
/* If USE_MALLOC_LOCK, use supplied critical-section-based lock functions */
#ifdef USE_MALLOC_LOCK
static int slwait(int *sl);
static int slrelease(int *sl);
#endif
static long getpagesize(void);
static long getregionsize(void);
static void *sbrk(long size);
static void *mmap(void *ptr, long size, long prot, long type, long handle, long arg);
static long munmap(void *ptr, long size);
static void vminfo (unsigned long *free, unsigned long *reserved, unsigned long *committed);
static int cpuinfo (int whole, unsigned long *kernel, unsigned long *user);
#endif
/*
__STD_C should be nonzero if using ANSI-standard C compiler, a C++
compiler, or a C compiler sufficiently close to ANSI to get away
with it.
*/
#ifndef __STD_C
#ifdef __STDC__
#define __STD_C 1
#else
#if __cplusplus
#define __STD_C 1
#else
#define __STD_C 0
#endif /*__cplusplus*/
#endif /*__STDC__*/
#endif /*__STD_C*/
/*
Void_t* is the pointer type that malloc should say it returns
*/
#ifndef Void_t
#if (__STD_C || defined(WIN32))
#define Void_t void
#else
#define Void_t char
#endif
#endif /*Void_t*/
#if __STD_C
#include <stddef.h> /* for size_t */
#else
#include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* define LACKS_UNISTD_H if your system does not have a <unistd.h>. */
/* #define LACKS_UNISTD_H */
#ifndef LACKS_UNISTD_H
#include <unistd.h>
#endif
/* define LACKS_SYS_PARAM_H if your system does not have a <sys/param.h>. */
/* #define LACKS_SYS_PARAM_H */
#include <stdio.h> /* needed for malloc_stats */
#include <errno.h> /* needed for optional MALLOC_FAILURE_ACTION */
/*
Debugging:
Because freed chunks may be overwritten with bookkeeping fields, this
malloc will often die when freed memory is overwritten by user
programs. This can be very effective (albeit in an annoying way)
in helping track down dangling pointers.
If you compile with -DDEBUG, a number of assertion checks are
enabled that will catch more memory errors. You probably won't be
able to make much sense of the actual assertion errors, but they
should help you locate incorrectly overwritten memory. The
checking is fairly extensive, and will slow down execution
noticeably. Calling malloc_stats or mallinfo with DEBUG set will
attempt to check every non-mmapped allocated and free chunk in the
course of computing the summmaries. (By nature, mmapped regions
cannot be checked very much automatically.)
Setting DEBUG may also be helpful if you are trying to modify
this code. The assertions in the check routines spell out in more
detail the assumptions and invariants underlying the algorithms.
*/
#if DEBUG
#include <assert.h>
#else
#define assert(x) ((void)0)
#endif
/*
INTERNAL_SIZE_T is the word-size used for internal bookkeeping
of chunk sizes.
The default version is the same as size_t.
While not strictly necessary, it is best to define this as an
unsigned type, even if size_t is a signed type. This may avoid some
artificial size limitations on some systems.
On a 64-bit machine, you may be able to reduce malloc overhead by
defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the
expense of not being able to handle more than 2^32 of malloced
space. If this limitation is acceptable, you are encouraged to set
this unless you are on a platform requiring 16byte alignments. In
this case the alignment requirements turn out to negate any
potential advantages of decreasing size_t word size.
Note to implementors: To deal with all this, comparisons and
difference computations among INTERNAL_SIZE_Ts should normally cast
INTERNAL_SIZE_T's to long or unsigned long, as appropriate, being
aware of the fact that casting an unsigned int to a wider long does not
sign-extend. (This also makes checking for negative numbers awkward.)
*/
#ifndef INTERNAL_SIZE_T
#define INTERNAL_SIZE_T size_t
#endif
/* The corresponding word size */
#define SIZE_SZ (sizeof(INTERNAL_SIZE_T))
/*
MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks.
It must be a power of two at least 2 * SIZE_SZ, even on machines
for which smaller alignments would suffice. It may be defined as
larger than this though. (Note however that code and data structures
are optimized for the case of 8-byte alignment.)
*/
/* #define MALLOC_ALIGNMENT 16 */
#ifndef MALLOC_ALIGNMENT
#define MALLOC_ALIGNMENT (2 * SIZE_SZ)
#endif
/* The corresponding bit mask value */
#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1)
/*
REALLOC_ZERO_BYTES_FREES should be set if a call to
realloc with zero bytes should be the same as a call to free.
Some people think it should. Otherwise, since this malloc
returns a unique pointer for malloc(0), so does realloc(p, 0).
*/
/* #define REALLOC_ZERO_BYTES_FREES */
/*
USE_DL_PREFIX will prefix all public routines with the string 'dl'.
This is necessary when you only want to use this malloc in one part
of a program, using your regular system malloc elsewhere.
*/
/* #define USE_DL_PREFIX */
/*
USE_MALLOC_LOCK causes wrapper functions to surround each
callable routine with pthread mutex lock/unlock.
USE_MALLOC_LOCK forces USE_PUBLIC_MALLOC_WRAPPERS to be defined
*/
/* #define USE_MALLOC_LOCK */
/*
If USE_PUBLIC_MALLOC_WRAPPERS is defined, every public routine is
actually a wrapper function that first calls MALLOC_PREACTION, then
calls the internal routine, and follows it with
MALLOC_POSTACTION. This is needed for locking, but you can also use
this, without USE_MALLOC_LOCK, for purposes of interception,
instrumentation, etc. It is a sad fact that using wrappers often
noticeably degrades performance of malloc-intensive programs.
*/
#ifdef USE_MALLOC_LOCK
#define USE_PUBLIC_MALLOC_WRAPPERS
#else
/* #define USE_PUBLIC_MALLOC_WRAPPERS */
#endif
/*
HAVE_MEMCPY should be defined if you are not otherwise using
ANSI STD C, but still have memcpy and memset in your C library
and want to use them in calloc and realloc. Otherwise simple
macro versions are defined below.
USE_MEMCPY should be defined as 1 if you actually want to
have memset and memcpy called. People report that the macro
versions are faster than libc versions on some systems.
Even if USE_MEMCPY is set to 1, loops to copy/clear small chunks
(of <= 36 bytes) are manually unrolled in realloc and calloc.
*/
#define HAVE_MEMCPY
#ifndef USE_MEMCPY
#ifdef HAVE_MEMCPY
#define USE_MEMCPY 1
#else
#define USE_MEMCPY 0
#endif
#endif
#if (__STD_C || defined(HAVE_MEMCPY))
#ifdef WIN32
/*
On Win32 platforms, 'memset()' and 'memcpy()' are already declared in
'windows.h'
*/
#else
#if __STD_C
void* memset(void*, int, size_t);
void* memcpy(void*, const void*, size_t);
void* memmove(void*, const void*, size_t);
#else
Void_t* memset();
Void_t* memcpy();
Void_t* memmove();
#endif
#endif
#endif
/*
MALLOC_FAILURE_ACTION is the action to take before "return 0" when
malloc fails to be able to return memory, either because memory is
exhausted or because of illegal arguments.
By default, sets errno if running on STD_C platform, else does nothing.
*/
#ifndef MALLOC_FAILURE_ACTION
#if __STD_C
#define MALLOC_FAILURE_ACTION \
errno = ENOMEM;
#else
#define MALLOC_FAILURE_ACTION
#endif
#endif
/*
Define HAVE_MMAP as true to optionally make malloc() use mmap() to
allocate very large blocks. These will be returned to the
operating system immediately after a free(). Also, if mmap
is available, it is used as a backup strategy in cases where
MORECORE fails to provide space from system.
This malloc is best tuned to work with mmap for large requests.
If you do not have mmap, allocation of very large chunks (1MB
or so) may be slower than you'd like.
*/
#ifndef HAVE_MMAP
#define HAVE_MMAP 1
#endif
/*
MMAP_AS_MORECORE_SIZE is the minimum mmap size argument to use if
sbrk fails, and mmap is used as a backup (which is done only if
HAVE_MMAP). The value must be a multiple of page size. This
backup strategy generally applies only when systems have "holes" in
address space, so sbrk cannot perform contiguous expansion, but
there is still space available on system. On systems for which
this is known to be useful (i.e. most linux kernels), this occurs
only when programs allocate huge amounts of memory. Between this,
and the fact that mmap regions tend to be limited, the size should
be large, to avoid too many mmap calls and thus avoid running out
of kernel resources.
*/
#ifndef MMAP_AS_MORECORE_SIZE
#define MMAP_AS_MORECORE_SIZE (1024 * 1024)
#endif
/*
Define HAVE_MREMAP to make realloc() use mremap() to re-allocate
large blocks. This is currently only possible on Linux with
kernel versions newer than 1.3.77.
*/
#ifndef HAVE_MREMAP
#ifdef linux
#define HAVE_MREMAP 1
#else
#define HAVE_MREMAP 0
#endif
#endif /* HAVE_MMAP */
/*
This version of malloc supports the standard SVID/XPG mallinfo
routine that returns a struct containing usage properties and
statistics. It should work on any SVID/XPG compliant system that has
a /usr/include/malloc.h defining struct mallinfo. (If you'd like to
install such a thing yourself, cut out the preliminary declarations
as described above and below and save them in a malloc.h file. But
there's no compelling reason to bother to do this.)
The main declaration needed is the mallinfo struct that is returned
(by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a
bunch of field that are not even meaningful in this version of
malloc. These fields are are instead filled by mallinfo() with
other numbers that might be of interest.
HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
/usr/include/malloc.h file that includes a declaration of struct
mallinfo. If so, it is included; else an SVID2/XPG2 compliant
version is declared below. These must be precisely the same for
mallinfo() to work.
*/
/* #define HAVE_USR_INCLUDE_MALLOC_H */
#ifdef HAVE_USR_INCLUDE_MALLOC_H
#include "/usr/include/malloc.h"
#else
/* SVID2/XPG mallinfo structure */
struct mallinfo {
int arena; /* non-mmapped space allocated from system */
int ordblks; /* number of free chunks */
int smblks; /* number of fastbin blocks */
int hblks; /* number of mmapped regions */
int hblkhd; /* space in mmapped regions */
int usmblks; /* maximum total allocated space */
int fsmblks; /* space available in freed fastbin blocks */
int uordblks; /* total allocated space */
int fordblks; /* total free space */
int keepcost; /* top-most, releasable (via malloc_trim) space */
};
/* SVID2/XPG mallopt options */
#define M_MXFAST 1 /* Set maximum fastbin size */
#define M_NLBLKS 2 /* UNUSED in this malloc */
#define M_GRAIN 3 /* UNUSED in this malloc */
#define M_KEEP 4 /* UNUSED in this malloc */
#endif
/* Additional mallopt options supported in this malloc */
#ifndef M_TRIM_THRESHOLD
#define M_TRIM_THRESHOLD -1
#endif
#ifndef M_TOP_PAD
#define M_TOP_PAD -2
#endif
#ifndef M_MMAP_THRESHOLD
#define M_MMAP_THRESHOLD -3
#endif
#ifndef M_MMAP_MAX
#define M_MMAP_MAX -4
#endif
/*
MXFAST is the maximum request size used for "fastbins", special bins
that hold returned chunks without consolidating their spaces. This
enables future requests for chunks of the same size to be handled
very quickly, but can increase fragmentation, and thus increase the
overall memory footprint of a program.
This malloc manages fastbins very conservatively yet still
efficiently, so fragmentation is rarely a problem for values less
than or equal to the default. The maximum supported value of MXFAST
is 80. You wouldn't want it any higher than this anyway. Fastbins
are designed especially for use with many small structs, objects or
strings -- the default handles structs/objects/arrays with sizes up
to 8 4byte fields, or small strings representing words, tokens,
etc. Using fastbins for larger objects normally worsens
fragmentation without improving speed.
MXFAST is set in REQUEST size units. It is internally used in
chunksize units, which adds padding and alignment. You can reduce
MXFAST to 0 to disable all use of fastbins. This causes the malloc
algorithm to be a close approximation of fifo-best-fit in all cases,
not just for larger requests, but will generally cause it to be
slower.
*/
#ifndef DEFAULT_MXFAST
#define DEFAULT_MXFAST 64
#endif
/*
M_TRIM_THRESHOLD is the maximum amount of unused top-most memory
to keep before releasing via malloc_trim in free().
Automatic trimming is mainly useful in long-lived programs.
Because trimming via sbrk can be slow on some systems, and can
sometimes be wasteful (in cases where programs immediately
afterward allocate more large chunks) the value should be high
enough so that your overall system performance would improve by
releasing.
The trim threshold and the mmap control parameters (see below)
can be traded off with one another. Trimming and mmapping are
two different ways of releasing unused memory back to the
system. Between these two, it is often possible to keep
system-level demands of a long-lived program down to a bare
minimum. For example, in one test suite of sessions measuring
the XF86 X server on Linux, using a trim threshold of 128K and a
mmap threshold of 192K led to near-minimal long term resource
consumption.
If you are using this malloc in a long-lived program, it should
pay to experiment with these values. As a rough guide, you
might set to a value close to the average size of a process
(program) running on your system. Releasing this much memory
would allow such a process to run in memory. Generally, it's
worth it to tune for trimming rather tham memory mapping when a
program undergoes phases where several large chunks are
allocated and released in ways that can reuse each other's
storage, perhaps mixed with phases where there are no such
chunks at all. And in well-behaved long-lived programs,
controlling release of large blocks via trimming versus mapping
is usually faster.
However, in most programs, these parameters serve mainly as
protection against the system-level effects of carrying around
massive amounts of unneeded memory. Since frequent calls to
sbrk, mmap, and munmap otherwise degrade performance, the default
parameters are set to relatively high values that serve only as
safeguards.
The default trim value is high enough to cause trimming only in
fairly extreme (by current memory consumption standards) cases.
It must be greater than page size to have any useful effect. To
disable trimming completely, you can set to (unsigned long)(-1);
Trim settings interact with fastbin (MXFAST) settings: Unless
TRIM_FASTBINS is defined, automatic trimming never takes place upon
freeing a chunk with size less than or equal to MXFAST. Trimming is
instead delayed until subsequent freeing of larger chunks. However,
you can still force an attempted trim by calling malloc_trim.
Also, trimming is not generally possible in cases where
the main arena is obtained via mmap.
*/
#ifndef DEFAULT_TRIM_THRESHOLD
#define DEFAULT_TRIM_THRESHOLD (128 * 1024)
#endif
/*
M_TOP_PAD is the amount of extra `padding' space to allocate or
retain whenever sbrk is called. It is used in two ways internally:
* When sbrk is called to extend the top of the arena to satisfy
a new malloc request, this much padding is added to the sbrk
request.
* When malloc_trim is called automatically from free(),
it is used as the `pad' argument.
In both cases, the actual amount of padding is rounded
so that the end of the arena is always a system page boundary.
The main reason for using padding is to avoid calling sbrk so
often. Having even a small pad greatly reduces the likelihood
that nearly every malloc request during program start-up (or
after trimming) will invoke sbrk, which needlessly wastes
time.
Automatic rounding-up to page-size units is normally sufficient
to avoid measurable overhead, so the default is 0. However, in
systems where sbrk is relatively slow, it can pay to increase
this value, at the expense of carrying around more memory than
the program needs.
*/
#ifndef DEFAULT_TOP_PAD
#define DEFAULT_TOP_PAD (0)
#endif
/*
M_MMAP_THRESHOLD is the request size threshold for using mmap()
to service a request. Requests of at least this size that cannot
be allocated using already-existing space will be serviced via mmap.
(If enough normal freed space already exists it is used instead.)
Using mmap segregates relatively large chunks of memory so that
they can be individually obtained and released from the host
system. A request serviced through mmap is never reused by any
other request (at least not directly; the system may just so
happen to remap successive requests to the same locations).
Segregating space in this way has the benefit that mmapped space
can ALWAYS be individually released back to the system, which
helps keep the system level memory demands of a long-lived
program low. Mapped memory can never become `locked' between
other chunks, as can happen with normally allocated chunks, which
means that even trimming via malloc_trim would not release them.
However, it has the disadvantages that:
1. The space cannot be reclaimed, consolidated, and then
used to service later requests, as happens with normal chunks.
2. It can lead to more wastage because of mmap page alignment
requirements
3. It causes malloc performance to be more dependent on host
system memory management support routines which may vary in
implementation quality and may impose arbitrary
limitations. Generally, servicing a request via normal
malloc steps is faster than going through a system's mmap.
All together, these considerations should lead you to use mmap
only for relatively large requests.
*/
#ifndef DEFAULT_MMAP_THRESHOLD
#define DEFAULT_MMAP_THRESHOLD (128 * 1024)
#endif
/*
M_MMAP_MAX is the maximum number of requests to simultaneously
service using mmap. This parameter exists because:
1. Some systems have a limited number of internal tables for
use by mmap.
2. In most systems, overreliance on mmap can degrade overall
performance.
3. If a program allocates many large regions, it is probably
better off using normal sbrk-based allocation routines that
can reclaim and reallocate normal heap memory.
Setting to 0 disables use of mmap for servicing large requests. If
HAVE_MMAP is not set, the default value is 0, and attempts to set it
to non-zero values in mallopt will fail.
*/
#ifndef DEFAULT_MMAP_MAX
#if HAVE_MMAP
#define DEFAULT_MMAP_MAX (256)
#else
#define DEFAULT_MMAP_MAX (0)
#endif
#endif
/*
TRIM_FASTBINS controls whether free() of a very small chunk can
immediately lead to trimming. Setting to true (1) can reduce memory
footprint, but will almost always slow down (by a few percent)
programs that use a lot of small chunks.
Define this only if you are willing to give up some speed to more
aggressively reduce system-level memory footprint when releasing
memory in programs that use many small chunks. You can get
essentially the same effect by setting MXFAST to 0, but this can
lead to even greater slowdowns in programs using many small chunks.
TRIM_FASTBINS is an in-between compile-time option, that disables
only those chunks bordering topmost memory from being placed in
fastbins.
*/
#ifndef TRIM_FASTBINS
#define TRIM_FASTBINS 0
#endif
/*
MORECORE-related declarations. By default, rely on sbrk
*/
#ifdef LACKS_UNISTD_H
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#if __STD_C
extern Void_t* sbrk(ptrdiff_t);
#else
extern Void_t* sbrk();
#endif
#endif
#endif
/*
MORECORE is the name of the routine to call to obtain more memory
from the system. See below for general guidance on writing
alternative MORECORE functions, as well as a version for WIN32 and a
sample version for pre-OSX macos.
*/
#ifndef MORECORE
#define MORECORE sbrk
#endif
/*
MORECORE_FAILURE is the value returned upon failure of MORECORE
as well as mmap. Since it cannot be an otherwise valid memory address,
and must reflect values of standard sys calls, you probably ought not
try to redefine it.
*/
#ifndef MORECORE_FAILURE
#define MORECORE_FAILURE (-1)
#endif
/*
If MORECORE_CONTIGUOUS is true, take advantage of fact that
consecutive calls to MORECORE with positive arguments always return
contiguous increasing addresses. This is true of unix sbrk. Even
if not defined, when regions happen to be contiguous, malloc will
permit allocations spanning regions obtained from different
calls. But defining this when applicable enables some stronger
consistency checks and space efficiencies.
*/
#ifndef MORECORE_CONTIGUOUS
#define MORECORE_CONTIGUOUS 1
#endif
/*
The system page size. To the extent possible, this malloc manages
memory from the system in page-size units. Note that this value is
cached during initialization into a field of malloc_state. So even
if malloc_getpagesize is a function, it is only called once.
The following mechanics for getpagesize were adapted from bsd/gnu
getpagesize.h. If none of the system-probes here apply, a value of
4096 is used, which should be OK: If they don't apply, then using
the actual value probably doesn't impact performance.
*/
#ifndef malloc_getpagesize
#ifndef LACKS_UNISTD_H
# include <unistd.h>
#endif
# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */
# ifndef _SC_PAGE_SIZE
# define _SC_PAGE_SIZE _SC_PAGESIZE
# endif
# endif
# ifdef _SC_PAGE_SIZE
# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
# else
# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
extern size_t getpagesize();
# define malloc_getpagesize getpagesize()
# else
# ifdef WIN32 /* use supplied emulation of getpagesize */
# define malloc_getpagesize getpagesize()
# else
# ifndef LACKS_SYS_PARAM_H
# include <sys/param.h>
# endif
# ifdef EXEC_PAGESIZE
# define malloc_getpagesize EXEC_PAGESIZE
# else
# ifdef NBPG
# ifndef CLSIZE
# define malloc_getpagesize NBPG
# else
# define malloc_getpagesize (NBPG * CLSIZE)
# endif
# else
# ifdef NBPC
# define malloc_getpagesize NBPC
# else
# ifdef PAGESIZE
# define malloc_getpagesize PAGESIZE
# else /* just guess */
# define malloc_getpagesize (4096)
# endif
# endif
# endif
# endif
# endif
# endif
# endif
#endif
/* Two-phase Name mangling */
#ifndef USE_PUBLIC_MALLOC_WRAPPERS
#define cALLOc public_cALLOc
#define fREe public_fREe
#define cFREe public_cFREe
#define mALLOc public_mALLOc
#define mEMALIGn public_mEMALIGn
#define rEALLOc public_rEALLOc
#define vALLOc public_vALLOc
#define pVALLOc public_pVALLOc
#define mALLINFo public_mALLINFo
#define mALLOPt public_mALLOPt
#define mTRIm public_mTRIm
#define mSTATs public_mSTATs
#define mUSABLe public_mUSABLe
#endif
#ifdef USE_DL_PREFIX
#define public_cALLOc dlcalloc
#define public_fREe dlfree
#define public_cFREe dlcfree
#define public_mALLOc dlmalloc
#define public_mEMALIGn dlmemalign
#define public_rEALLOc dlrealloc
#define public_vALLOc dlvalloc
#define public_pVALLOc dlpvalloc
#define public_mALLINFo dlmallinfo
#define public_mALLOPt dlmallopt
#define public_mTRIm dlmalloc_trim
#define public_mSTATs dlmalloc_stats
#define public_mUSABLe dlmalloc_usable_size
#else /* USE_DL_PREFIX */
#define public_cALLOc calloc
#define public_fREe free
#define public_cFREe cfree
#define public_mALLOc malloc
#define public_mEMALIGn memalign
#define public_rEALLOc realloc
#define public_vALLOc valloc
#define public_pVALLOc pvalloc
#define public_mALLINFo mallinfo
#define public_mALLOPt mallopt
#define public_mTRIm malloc_trim
#define public_mSTATs malloc_stats
#define public_mUSABLe malloc_usable_size
#endif /* USE_DL_PREFIX */
#if __STD_C
Void_t* public_mALLOc(size_t);
void public_fREe(Void_t*);
Void_t* public_rEALLOc(Void_t*, size_t);
Void_t* public_mEMALIGn(size_t, size_t);
Void_t* public_vALLOc(size_t);
Void_t* public_pVALLOc(size_t);
Void_t* public_cALLOc(size_t, size_t);
void public_cFREe(Void_t*);
int public_mTRIm(size_t);
size_t public_mUSABLe(Void_t*);
void public_mSTATs();
int public_mALLOPt(int, int);
struct mallinfo public_mALLINFo(void);
#else
Void_t* public_mALLOc();
void public_fREe();
Void_t* public_rEALLOc();
Void_t* public_mEMALIGn();
Void_t* public_vALLOc();
Void_t* public_pVALLOc();
Void_t* public_cALLOc();
void public_cFREe();
int public_mTRIm();
size_t public_mUSABLe();
void public_mSTATs();
int public_mALLOPt();
struct mallinfo public_mALLINFo();
#endif
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
/* ---------- To make a malloc.h, end cutting here ------------ */
/* Declarations of internal utilities defined below */
#ifdef USE_PUBLIC_MALLOC_WRAPPERS
#if __STD_C
static Void_t* mALLOc(size_t);
static void fREe(Void_t*);
static Void_t* rEALLOc(Void_t*, size_t);
static Void_t* mEMALIGn(size_t, size_t);
static Void_t* vALLOc(size_t);
static Void_t* pVALLOc(size_t);
static Void_t* cALLOc(size_t, size_t);
static void cFREe(Void_t*);
static int mTRIm(size_t);
static size_t mUSABLe(Void_t*);
static void mSTATs();
static int mALLOPt(int, int);
static struct mallinfo mALLINFo(void);
#else
static Void_t* mALLOc();
static void fREe();
static Void_t* rEALLOc();
static Void_t* mEMALIGn();
static Void_t* vALLOc();
static Void_t* pVALLOc();
static Void_t* cALLOc();
static void cFREe();
static int mTRIm();
static size_t mUSABLe();
static void mSTATs();
static int mALLOPt();
static struct mallinfo mALLINFo();
#endif
#endif
/* ---------- public wrappers --------------- */
#ifdef USE_PUBLIC_MALLOC_WRAPPERS
/*
MALLOC_PREACTION and MALLOC_POSTACTION should be
defined to return 0 on success, and nonzero on failure.
The return value of MALLOC_POSTACTION is currently ignored
in wrapper functions since there is no reasonable default
action to take on failure.
*/
#ifdef USE_MALLOC_LOCK
#ifdef WIN32
static int mALLOC_MUTEx;
#define MALLOC_PREACTION slwait(&mALLOC_MUTEx)
#define MALLOC_POSTACTION slrelease(&mALLOC_MUTEx)
#else
#include <pthread.h>
static pthread_mutex_t mALLOC_MUTEx = PTHREAD_MUTEX_INITIALIZER;
#define MALLOC_PREACTION pthread_mutex_lock(&mALLOC_MUTEx)
#define MALLOC_POSTACTION pthread_mutex_unlock(&mALLOC_MUTEx)
#endif /* USE_MALLOC_LOCK */
#else
/* Substitute anything you like for these */
#define MALLOC_PREACTION (0)
#define MALLOC_POSTACTION (0)
#endif
Void_t* public_mALLOc(size_t bytes) {
Void_t* m;
if (MALLOC_PREACTION != 0) {
return 0;
}
m = mALLOc(bytes);
if (MALLOC_POSTACTION != 0) {
}
return m;
}
void public_fREe(Void_t* m) {
if (MALLOC_PREACTION != 0) {
return;
}
fREe(m);
if (MALLOC_POSTACTION != 0) {
}
}
Void_t* public_rEALLOc(Void_t* m, size_t bytes) {
if (MALLOC_PREACTION != 0) {
return 0;
}
m = rEALLOc(m, bytes);
if (MALLOC_POSTACTION != 0) {
}
return m;
}
Void_t* public_mEMALIGn(size_t alignment, size_t bytes) {
Void_t* m;
if (MALLOC_PREACTION != 0) {
return 0;
}
m = mEMALIGn(alignment, bytes);
if (MALLOC_POSTACTION != 0) {
}
return m;
}
Void_t* public_vALLOc(size_t bytes) {
Void_t* m;
if (MALLOC_PREACTION != 0) {
return 0;
}
m = vALLOc(bytes);
if (MALLOC_POSTACTION != 0) {
}
return m;
}
Void_t* public_pVALLOc(size_t bytes) {
Void_t* m;
if (MALLOC_PREACTION != 0) {
return 0;
}
m = pVALLOc(bytes);
if (MALLOC_POSTACTION != 0) {
}
return m;
}
Void_t* public_cALLOc(size_t n, size_t elem_size) {
Void_t* m;
if (MALLOC_PREACTION != 0) {
return 0;
}
m = cALLOc(n, elem_size);
if (MALLOC_POSTACTION != 0) {
}
return m;
}
void public_cFREe(Void_t* m) {
if (MALLOC_PREACTION != 0) {
return;
}
cFREe(m);
if (MALLOC_POSTACTION != 0) {
}
}
int public_mTRIm(size_t s) {
int result;
if (MALLOC_PREACTION != 0) {
return 0;
}
result = mTRIm(s);
if (MALLOC_POSTACTION != 0) {
}
return result;
}
size_t public_mUSABLe(Void_t* m) {
size_t result;
if (MALLOC_PREACTION != 0) {
return 0;
}
result = mUSABLe(m);
if (MALLOC_POSTACTION != 0) {
}
return result;
}
void public_mSTATs() {
if (MALLOC_PREACTION != 0) {
return;
}
mSTATs();
if (MALLOC_POSTACTION != 0) {
}
}
struct mallinfo public_mALLINFo() {
struct mallinfo m;
if (MALLOC_PREACTION != 0) {
return m;
}
m = mALLINFo();
if (MALLOC_POSTACTION != 0) {
}
return m;
}
int public_mALLOPt(int p, int v) {
int result;
if (MALLOC_PREACTION != 0) {
return 0;
}
result = mALLOPt(p, v);
if (MALLOC_POSTACTION != 0) {
}
return result;
}
#endif
/* ------------- Optional versions of memcopy ---------------- */
#if USE_MEMCPY
#define MALLOC_COPY(dest, src, nbytes, overlap) \
((overlap) ? memmove(dest, src, nbytes) : memcpy(dest, src, nbytes))
#define MALLOC_ZERO(dest, nbytes) memset(dest, 0, nbytes)
#else /* !USE_MEMCPY */
/* Use Duff's device for good zeroing/copying performance. */
#define MALLOC_ZERO(charp, nbytes) \
do { \
INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \
long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \
if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \
switch (mctmp) { \
case 0: for(;;) { *mzp++ = 0; \
case 7: *mzp++ = 0; \
case 6: *mzp++ = 0; \
case 5: *mzp++ = 0; \
case 4: *mzp++ = 0; \
case 3: *mzp++ = 0; \
case 2: *mzp++ = 0; \
case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \
} \
} while(0)
/* For overlapping case, dest is always _below_ src. */
#define MALLOC_COPY(dest,src,nbytes,overlap) \
do { \
INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \
INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \
long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T), mcn; \
if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \
switch (mctmp) { \
case 0: for(;;) { *mcdst++ = *mcsrc++; \
case 7: *mcdst++ = *mcsrc++; \
case 6: *mcdst++ = *mcsrc++; \
case 5: *mcdst++ = *mcsrc++; \
case 4: *mcdst++ = *mcsrc++; \
case 3: *mcdst++ = *mcsrc++; \
case 2: *mcdst++ = *mcsrc++; \
case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \
} \
} while(0)
#endif
/* ------------------ MMAP support ------------------ */
#if HAVE_MMAP
#include <fcntl.h>
#ifndef LACKS_SYS_MMAN_H
#include <sys/mman.h>
#endif
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
#define MAP_ANONYMOUS MAP_ANON
#endif
/*
Nearly all versions of mmap support MAP_ANONYMOUS,
so the following is unlikely to be needed, but is
supplied just in case.
*/
#ifndef MAP_ANONYMOUS
static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
#define MMAP(addr, size, prot, flags) ((dev_zero_fd < 0) ? \
(dev_zero_fd = open("/dev/zero", O_RDWR), \
mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) : \
mmap((addr), (size), (prot), (flags), dev_zero_fd, 0))
#else
#define MMAP(addr, size, prot, flags) \
(mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS, -1, 0))
#endif
#endif /* HAVE_MMAP */
/* ---------- Alternative MORECORE functions ------------ */
/*
General Requirements for MORECORE.
The MORECORE function must have the following properties:
If MORECORE_CONTIGUOUS is false:
* MORECORE must allocate in multiples of pagesize. It will
only be called with arguments that are multiples of pagesize.
* MORECORE must page-align. That is, MORECORE(0) must
return an address at a page boundary.
else (i.e. If MORECORE_CONTIGUOUS is true):
* Consecutive calls to MORECORE with positive arguments
return increasing addresses, indicating that space has been
contiguously extended.
* MORECORE need not allocate in multiples of pagesize.
Calls to MORECORE need not have args of multiples of pagesize.
* MORECORE need not page-align.
In either case:
* MORECORE may allocate more memory than requested. (Or even less,
but this will generally result in a malloc failure.)
* MORECORE must not allocate memory when given argument zero, but
instead return one past the end address of memory from previous
nonzero call. This malloc does NOT call MORECORE(0)
until at least one call with positive arguments is made, so
the initial value returned is not important.
* Even though consecutive calls to MORECORE need not return contiguous
addresses, it must be OK for malloc'ed chunks to span multiple
regions in those cases where they do happen to be contiguous.
* MORECORE need not handle negative arguments -- it may instead
just return MORECORE_FAILURE when given negative arguments.
Negative arguments are always multiples of pagesize. MORECORE
must not misinterpret negative args as large positive unsigned
args.
There is some variation across systems about the type of the
argument to sbrk/MORECORE. If size_t is unsigned, then it cannot
actually be size_t, because sbrk supports negative args, so it is
normally the signed type of the same width as size_t (sometimes
declared as "intptr_t", and sometimes "ptrdiff_t"). It doesn't much
matter though. Internally, we use "long" as arguments, which should
work across all reasonable possibilities.
Additionally, if MORECORE ever returns failure for a positive
request, and HAVE_MMAP is true, then mmap is used as a noncontiguous
system allocator. This is a useful backup strategy for systems with
holes in address spaces -- in this case sbrk cannot contiguously
expand the heap, but mmap may be able to map noncontiguous space.
If you'd like mmap to ALWAYS be used, you can define MORECORE to be
a function that always returns MORECORE_FAILURE.
If you are using this malloc with something other than unix sbrk to
supply memory regions, you probably want to set MORECORE_CONTIGUOUS
as false. As an example, here is a custom allocator kindly
contributed for pre-OSX macOS. It uses virtually but not
necessarily physically contiguous non-paged memory (locked in,
present and won't get swapped out). You can use it by uncommenting
this section, adding some #includes, and setting up the appropriate
defines above:
#define MORECORE osMoreCore
#define MORECORE_CONTIGUOUS 0
There is also a shutdown routine that should somehow be called for
cleanup upon program exit.
#define MAX_POOL_ENTRIES 100
#define MINIMUM_MORECORE_SIZE (64 * 1024)
static int next_os_pool;
void *our_os_pools[MAX_POOL_ENTRIES];
void *osMoreCore(int size)
{
void *ptr = 0;
static void *sbrk_top = 0;
if (size > 0)
{
if (size < MINIMUM_MORECORE_SIZE)
size = MINIMUM_MORECORE_SIZE;
if (CurrentExecutionLevel() == kTaskLevel)
ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
if (ptr == 0)
{
return (void *) MORECORE_FAILURE;
}
// save ptrs so they can be freed during cleanup
our_os_pools[next_os_pool] = ptr;
next_os_pool++;
ptr = (void *) ((((unsigned long) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
sbrk_top = (char *) ptr + size;
return ptr;
}
else if (size < 0)
{
// we don't currently support shrink behavior
return (void *) MORECORE_FAILURE;
}
else
{
return sbrk_top;
}
}
// cleanup any allocated memory pools
// called as last thing before shutting down driver
void osCleanupMem(void)
{
void **ptr;
for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
if (*ptr)
{
PoolDeallocate(*ptr);
*ptr = 0;
}
}
*/
/*
----------------------- Chunk representations -----------------------
*/
/*
This struct declaration is misleading (but accurate and necessary).
It declares a "view" into memory allowing access to necessary
fields at known offsets from a given base. See explanation below.
*/
struct malloc_chunk {
INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */
INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */
struct malloc_chunk* fd; /* double links -- used only if free. */
struct malloc_chunk* bk;
};
typedef struct malloc_chunk* mchunkptr;
/*
malloc_chunk details:
(The following includes lightly edited explanations by Colin Plumb.)
Chunks of memory are maintained using a `boundary tag' method as
described in e.g., Knuth or Standish. (See the paper by Paul
Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a
survey of such techniques.) Sizes of free chunks are stored both
in the front of each chunk and at the end. This makes
consolidating fragmented chunks into bigger chunks very fast. The
size fields also hold bits representing whether chunks are free or
in use.
An allocated chunk looks like this:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk, if allocated | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of chunk, in bytes |P|
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| User data starts here... .
. .
. (malloc_usable_space() bytes) .
. |
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Where "chunk" is the front of the chunk for the purpose of most of
the malloc code, but "mem" is the pointer that is returned to the
user. "Nextchunk" is the beginning of the next contiguous chunk.
Chunks always begin on even word boundries, so the mem portion
(which is returned to the user) is also on an even word boundary, and
thus double-word aligned.
Free chunks are stored in circular doubly-linked lists, and look like this:
chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Size of previous chunk |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`head:' | Size of chunk, in bytes |P|
mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forward pointer to next chunk in list |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Back pointer to previous chunk in list |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space (may be 0 bytes long) .
. .
. |
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`foot:' | Size of chunk, in bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The P (PREV_INUSE) bit, stored in the unused low-order bit of the
chunk size (which is always a multiple of two words), is an in-use
bit for the *previous* chunk. If that bit is *clear*, then the
word before the current chunk size contains the previous chunk
size, and can be used to find the front of the previous chunk.
The very first chunk allocated always has this bit set,
preventing access to non-existent (or non-owned) memory. If
prev_inuse is set for any given chunk, then you CANNOT determine
the size of the previous chunk, and might even get a memory
addressing fault when trying to do so.
Note that the `foot' of the current chunk is actually represented
as the prev_size of the NEXT chunk. (This makes it easier to
deal with alignments etc).
The two exceptions to all this are
1. The special chunk `top' doesn't bother using the
trailing size field since there is no next contiguous chunk
that would have to index off it. After initialization, `top'
is forced to always exist. If it would become less than
MINSIZE bytes long, it is replenished.
2. Chunks allocated via mmap, which have the second-lowest-order
bit (IS_MMAPPED) set in their size fields. Because they are
allocated one-by-one, each must contain its own trailing size field.
*/
/*
Size and alignment checks and conversions
*/
/* conversion from malloc headers to user pointers, and back */
#define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ))
#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ))
/* The smallest possible chunk */
#define MIN_CHUNK_SIZE (sizeof(struct malloc_chunk))
/* The smallest size we can malloc is an aligned minimal chunk */
#define MINSIZE ((MIN_CHUNK_SIZE+MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)
/* Check if m has acceptable alignment */
#define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0)
/*
Check for negative/huge sizes.
This cannot just test for < 0 because argument might
be an unsigned type of uncertain width.
*/
#define IS_NEGATIVE(x) \
((unsigned long)x >= \
(unsigned long)((((INTERNAL_SIZE_T)(1)) << ((SIZE_SZ)*8 - 1))))
/* pad request bytes into a usable size -- internal version */
#define request2size(req) \
(((req) + SIZE_SZ + MALLOC_ALIGN_MASK < MINSIZE) ? \
MINSIZE : \
((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)
/*
Same, except check for negative/huge arguments.
This lets through args that are positive but wrap into
negatives when padded. However, these are trapped
elsewhere.
*/
#define checked_request2size(req, sz) \
if (IS_NEGATIVE(req)) { \
MALLOC_FAILURE_ACTION; \
return 0; \
} \
(sz) = request2size(req);
/*
Physical chunk operations
*/
/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */
#define PREV_INUSE 0x1
/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */
#define IS_MMAPPED 0x2
/* Bits to mask off when extracting size */
#define SIZE_BITS (PREV_INUSE|IS_MMAPPED)
/* Ptr to next physical malloc_chunk. */
#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) ))
/* Ptr to previous physical malloc_chunk */
#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) ))
/* Treat space at ptr + offset as a chunk */
#define chunk_at_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
/*
Dealing with use bits
Note: IS_MMAPPED is intentionally not masked off from size field in
macros for which mmapped chunks should never be seen. This should
cause helpful core dumps to occur if it is tried by accident by
people extending or adapting this malloc.
*/
/* extract p's inuse bit */
#define inuse(p)\
((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE)
/* extract inuse bit of previous chunk */
#define prev_inuse(p) ((p)->size & PREV_INUSE)
/* check for mmap()'ed chunk */
#define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED)
/* set/clear chunk as being inuse without otherwise disturbing */
#define set_inuse(p)\
((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE
#define clear_inuse(p)\
((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE)
/* check/set/clear inuse bits in known places */
#define inuse_bit_at_offset(p, s)\
(((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE)
#define set_inuse_bit_at_offset(p, s)\
(((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE)
#define clear_inuse_bit_at_offset(p, s)\
(((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE))
/*
Dealing with size fields
*/
/* Get size, ignoring use bits */
#define chunksize(p) ((p)->size & ~(SIZE_BITS))
/* Set size at head, without disturbing its use bit */
#define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s)))
/* Set size/use field */
#define set_head(p, s) ((p)->size = (s))
/* Set size at footer (only when chunk is not in use) */
#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_size = (s))
/*
------------------ Internal data structures --------------------
All internal state is held in an instance of malloc_state defined
below. There are no other static variables, except in two optional
cases:
* If USE_MALLOC_LOCK is defined, the mALLOC_MUTEx declared
above.
* If HAVE_MMAP is true, but mmap doesn't support
MAP_ANONYMOUS, a dummy file descriptor for mmap.
Beware of lots of tricks that minimize the total space
requirements. The result is a little over 1K bytes (for 4byte
pointers and size_t.)
*/
/*
Bins
An array of bin headers for free chunks. Each bin is doubly
linked. The bins are approximately proportionally (log) spaced.
There are a lot of these bins (128). This may look excessive, but
works very well in practice. Most bins hold sizes that are
unusual as malloc request sizes, but are more usual for fragments
and consolidated sets of chunks, which is what these bins hold, so
they can be found quickly. All procedures maintain the invariant
that no consolidated chunk physically borders another one, so each
chunk in a list is known to be preceeded and followed by either
inuse chunks or the ends of memory.
Chunks in bins are kept in size order, with ties going to the
approximately least recently used chunk. Ordering is irrelevant
for the small bins, which all contain the same-sized chunks, but
facilitates best-fit allocation for larger chunks. (These lists
are just sequential. Keeping them in order almost never requires
enough traversal to warrant using fancier ordered data
structures.) Chunks of the same size are linked with the most
recently freed at the front, and allocations are taken from the
back. This results in LRU (FIFO) allocation order, which tends
to give each chunk an equal opportunity to be consolidated with
adjacent freed chunks, resulting in larger free chunks and less
fragmentation.
To simplify use in double-linked lists, each bin header acts
as a malloc_chunk. This avoids special-casing for headers.
But to conserve space and (mainly) improve locality, we allocate
only the fd/bk pointers of bins, and then use repositioning tricks
to treat these as the fields of a malloc_chunk*.
*/
typedef struct malloc_chunk* mbinptr;
#define NBINS 128
/* addressing -- note that bin_at(0) does not exist */
#define bin_at(m, i) ((mbinptr)((char*)&((m)->bins[(i)<<1]) - (SIZE_SZ<<1)))
/* analog of ++bin */
#define next_bin(b) ((mbinptr)((char*)(b) + (sizeof(mchunkptr)<<1)))
/* Reminders about list directionality within bins */
#define first(b) ((b)->fd)
#define last(b) ((b)->bk)
/*
Take a chunk off a bin list
*/
#define unlink(P, BK, FD) { \
FD = P->fd; \
BK = P->bk; \
FD->bk = BK; \
BK->fd = FD; \
}
/*
Indexing bins
Bins for sizes < 512 bytes contain chunks of all the same size, spaced
8 bytes apart. Larger bins are approximately logarithmically spaced:
64 bins of size 8
32 bins of size 64
16 bins of size 512
8 bins of size 4096
4 bins of size 32768
2 bins of size 262144
1 bin of size what's left
There is actually a little bit of slop in the numbers in bin_index
for the sake of speed. This makes no difference elsewhere.
The bins top out at around 1mb because we expect to service large
chunks via mmap.
*/
/* The first NSMALLBIN bins (and fastbins) hold only one size */
#define NSMALLBINS 64
#define SMALLBIN_WIDTH 8
#define MIN_LARGE_SIZE 512
#define in_smallbin_range(sz) ((sz) < MIN_LARGE_SIZE)
#define smallbin_index(sz) (((unsigned)(sz)) >> 3)
#define largebin_index(sz) \
(((((unsigned long)(sz)) >> 6) <= 32)? 56 + (((unsigned long)(sz)) >> 6): \
((((unsigned long)(sz)) >> 9) <= 20)? 91 + (((unsigned long)(sz)) >> 9): \
((((unsigned long)(sz)) >> 12) <= 10)? 110 + (((unsigned long)(sz)) >> 12): \
((((unsigned long)(sz)) >> 15) <= 4)? 119 + (((unsigned long)(sz)) >> 15): \
((((unsigned long)(sz)) >> 18) <= 2)? 124 + (((unsigned long)(sz)) >> 18): \
126)
#define bin_index(sz) \
((in_smallbin_range(sz)) ? smallbin_index(sz) : largebin_index(sz))
/*
Unsorted chunks
All remainders from chunk splits, as well as all returned chunks,
are first placed in the "unsorted" bin. They are then placed
in regular bins after malloc gives them ONE chance to be used before
binning. So, basically, the unsorted_chunks list acts as a queue,
with chunks being placed on it in free (and malloc_consolidate),
and taken off (to be either used or placed in bins) in malloc.
*/
/* The otherwise unindexable 1-bin is used to hold unsorted chunks. */
#define unsorted_chunks(M) (bin_at(M, 1))
/*
Top
The top-most available chunk (i.e., the one bordering the end of
available memory) is treated specially. It is never included in
any bin, is used only if no other chunk is available, and is
released back to the system if it is very large (see
M_TRIM_THRESHOLD). `top' is never properly linked to its bin
since it is always handled specially. Because top initially
points to its own bin with initial zero size, thus forcing
extension on the first malloc request, we avoid having any special
code in malloc to check whether it even exists yet. But we still
need to do so when getting memory from system, so we make
initial_top treat the bin as a legal but unusable chunk during the
interval between initialization and the first call to
sYSMALLOc. (This is somewhat delicate, since it relies on
the 2 preceding words to be zero during this interval as well.)
*/
/* Conveniently, the unsorted bin can be used as dummy top on first call */
#define initial_top(M) (unsorted_chunks(M))
/*
Binmap
To help compensate for the large number of bins, a one-level index
structure is used for bin-by-bin searching. `binmap' is a
bitvector recording whether bins are definitely empty so they can
be skipped over during during traversals. The bits are NOT always
cleared as soon as bins are empty, but instead only
when they are noticed to be empty during traversal in malloc.
*/
/* Conservatively use 32 bits per map word, even if on 64bit system */
#define BINMAPSHIFT 5
#define BITSPERMAP (1U << BINMAPSHIFT)
#define BINMAPSIZE (NBINS / BITSPERMAP)
#define idx2block(i) ((i) >> BINMAPSHIFT)
#define idx2bit(i) ((1U << ((i) & ((1U << BINMAPSHIFT)-1))))
#define mark_bin(m,i) ((m)->binmap[idx2block(i)] |= idx2bit(i))
#define unmark_bin(m,i) ((m)->binmap[idx2block(i)] &= ~(idx2bit(i)))
#define get_binmap(m,i) ((m)->binmap[idx2block(i)] & idx2bit(i))
/*
Fastbins
An array of lists holding recently freed small chunks. Fastbins
are not doubly linked. It is faster to single-link them, and
since chunks are never removed from the middles of these lists,
double linking is not necessary.
Chunks in fastbins keep their inuse bit set, so they cannot
be consolidated with other free chunks. malloc_consolidate
releases all chunks in fastbins and consolidates them with
other free chunks.
*/
typedef struct malloc_chunk* mfastbinptr;
/* offset 2 to use otherwise unindexable first 2 bins */
#define fastbin_index(sz) ((((unsigned int)(sz)) >> 3) - 2)
/* The maximum fastbin request size we support */
#define MAX_FAST_SIZE 80
#define NFASTBINS (fastbin_index(request2size(MAX_FAST_SIZE))+1)
/*
Flag bit held in max_fast indicating that there probably are some
fastbin chunks . It is set true on entering a chunk into any fastbin,
and cleared only in malloc_consolidate.
The truth value is inverted so that have_fastchunks will be true
upon startup (since statics are zero-filled).
*/
#define have_fastchunks(M) (((M)->max_fast & 1U) == 0)
#define clear_fastchunks(M) ((M)->max_fast |= 1U)
#define set_fastchunks(M) ((M)->max_fast &= ~1U)
/*
Initialization value of max_fast.
Use impossibly small value if 0.
Value also has flag bit clear.
*/
#define req2max_fast(s) (((((s) == 0)? SMALLBIN_WIDTH: request2size(s))) | 1U)
/*
NONCONTIGUOUS_REGIONS is a special value for sbrk_base indicating that
MORECORE does not return contiguous regions. In this case, we do not check
or assume that the address of each chunk is at least sbrk_base. Otherwise,
contiguity is exploited in merging together, when possible, results
from consecutive MORECORE calls.
The possible values for sbrk_base are:
MORECORE_FAILURE:
MORECORE has not yet been called, but we expect contiguous space
NONCONTIGUOUS_REGIONS:
we don't expect or rely on contiguous space
any other legal address:
the first address returned by MORECORE when contiguous
*/
#define NONCONTIGUOUS_REGIONS ((char*)(-3))
/*
----------- Internal state representation and initialization -----------
*/
struct malloc_state {
/* The maximum chunk size to be eligible for fastbin */
INTERNAL_SIZE_T max_fast; /* low bit used as fastbin flag */
/* Base of the topmost chunk -- not otherwise kept in a bin */
mchunkptr top;
/* The remainder from the most recent split of a small request */
mchunkptr last_remainder;
/* Fastbins */
mfastbinptr fastbins[NFASTBINS];
/* Normal bins packed as described above */
mchunkptr bins[NBINS * 2];
/* Bitmap of bins */
unsigned int binmap[BINMAPSIZE];
/* Tunable parameters */
unsigned long trim_threshold;
INTERNAL_SIZE_T top_pad;
INTERNAL_SIZE_T mmap_threshold;
/* Memory map support */
int n_mmaps;
int n_mmaps_max;
int max_n_mmaps;
/* Bookkeeping for sbrk */
unsigned int pagesize; /* Cache malloc_getpagesize */
char* sbrk_base; /* first address returned by sbrk,
or NONCONTIGUOUS_REGIONS */
/* Statistics */
INTERNAL_SIZE_T mmapped_mem;
INTERNAL_SIZE_T sbrked_mem;
INTERNAL_SIZE_T max_sbrked_mem;
INTERNAL_SIZE_T max_mmapped_mem;
INTERNAL_SIZE_T max_total_mem;
};
typedef struct malloc_state *mstate;
/*
There is exactly one instance of this struct in this malloc.
If you are adapting this malloc in a way that does NOT use a static
malloc_state, you MUST explicitly zero-fill it before using. This
malloc relies on the property that malloc_state is initialized to
all zeroes (as is true of C statics).
*/
static struct malloc_state av_; /* never directly referenced */
/*
All uses of av_ are via get_malloc_state().
This simplifies construction of multithreaded, etc extensions.
At most one call to get_malloc_state is made per invocation of
the public versions of malloc, free, and all other routines
except realloc, valloc, and vpalloc. Also, it is called
in check* routines if DEBUG is set.
*/
#define get_malloc_state() (&(av_))
/*
Initialize a malloc_state struct.
This is called only from within malloc_consolidate, which needs
be called in the same contexts anyway. It is never called directly
outside of malloc_consolidate because some optimizing compilers try
to inline it at all call points, which turns out not to be an
optimization at all. (Inlining it only in malloc_consolidate is fine though.)
*/
#if __STD_C
static void malloc_init_state(mstate av)
#else
static void malloc_init_state(av) mstate av;
#endif
{
int i;
mbinptr bin;
/* Uncomment this if you are not using a static av */
/* MALLOC_ZERO(av, sizeof(struct malloc_state); */
/* Establish circular links for normal bins */
for (i = 1; i < NBINS; ++i) {
bin = bin_at(av,i);
bin->fd = bin->bk = bin;
}
av->max_fast = req2max_fast(DEFAULT_MXFAST);
av->top_pad = DEFAULT_TOP_PAD;
av->n_mmaps_max = DEFAULT_MMAP_MAX;
av->mmap_threshold = DEFAULT_MMAP_THRESHOLD;
#if MORECORE_CONTIGUOUS
av->trim_threshold = DEFAULT_TRIM_THRESHOLD;
av->sbrk_base = (char*)MORECORE_FAILURE;
#else
av->trim_threshold = (unsigned long)(-1);
av->sbrk_base = NONCONTIGUOUS_REGIONS;
#endif
av->top = initial_top(av);
av->pagesize = malloc_getpagesize;
}
/*
Other internal utilities operating on mstates
*/
#if __STD_C
static Void_t* sYSMALLOc(INTERNAL_SIZE_T, mstate);
static int sYSTRIm(size_t, mstate);
static void malloc_consolidate(mstate);
#else
static Void_t* sYSMALLOc();
static int sYSTRIm();
static void malloc_consolidate();
#endif
/*
Debugging support
These routines make a number of assertions about the states
of data structures that should be true at all times. If any
are not true, it's very likely that a user program has somehow
trashed memory. (It's also possible that there is a coding error
in malloc. In which case, please report it!)
*/
#if ! DEBUG
#define check_chunk(P)
#define check_free_chunk(P)
#define check_inuse_chunk(P)
#define check_remalloced_chunk(P,N)
#define check_malloced_chunk(P,N)
#define check_malloc_state()
#else
#define check_chunk(P) do_check_chunk(P)
#define check_free_chunk(P) do_check_free_chunk(P)
#define check_inuse_chunk(P) do_check_inuse_chunk(P)
#define check_remalloced_chunk(P,N) do_check_remalloced_chunk(P,N)
#define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N)
#define check_malloc_state() do_check_malloc_state()
/*
Properties of all chunks
*/
#if __STD_C
static void do_check_chunk(mchunkptr p)
#else
static void do_check_chunk(p) mchunkptr p;
#endif
{
mstate av = get_malloc_state();
unsigned long sz = chunksize(p);
if (!chunk_is_mmapped(p)) {
/* Has legal address ... */
if (av->sbrk_base != NONCONTIGUOUS_REGIONS) {
assert(((char*)p) >= ((char*)(av->sbrk_base)));
}
if (p != av->top) {
if (av->sbrk_base != NONCONTIGUOUS_REGIONS) {
assert(((char*)p + sz) <= ((char*)(av->top)));
}
}
else {
if (av->sbrk_base != NONCONTIGUOUS_REGIONS) {
assert(((char*)p + sz) <= ((char*)(av->sbrk_base) + av->sbrked_mem));
}
/* top size is always at least MINSIZE */
assert((long)(sz) >= (long)(MINSIZE));
/* top predecessor always marked inuse */
assert(prev_inuse(p));
}
}
else {
#if HAVE_MMAP
/* address is outside main heap */
/* unless mmap has been used as sbrk backup */
if (av->sbrk_base != NONCONTIGUOUS_REGIONS) {
assert(! (((char*)p) >= ((char*)av->sbrk_base) &&
((char*)p) < ((char*)(av->sbrk_base) + av->sbrked_mem)));
}
/* chunk is page-aligned */
assert(((p->prev_size + sz) & (av->pagesize-1)) == 0);
/* mem is aligned */
assert(aligned_OK(chunk2mem(p)));
#else
/* force an appropriate assert violation if debug set */
assert(!chunk_is_mmapped(p));
#endif
}
}
/*
Properties of free chunks
*/
#if __STD_C
static void do_check_free_chunk(mchunkptr p)
#else
static void do_check_free_chunk(p) mchunkptr p;
#endif
{
mstate av = get_malloc_state();
INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE;
mchunkptr next = chunk_at_offset(p, sz);
do_check_chunk(p);
/* Chunk must claim to be free ... */
assert(!inuse(p));
assert (!chunk_is_mmapped(p));
/* Unless a special marker, must have OK fields */
if ((unsigned long)sz >= (unsigned long)MINSIZE)
{
assert((sz & MALLOC_ALIGN_MASK) == 0);
assert(aligned_OK(chunk2mem(p)));
/* ... matching footer field */
assert(next->prev_size == sz);
/* ... and is fully consolidated */
assert(prev_inuse(p));
assert (next == av->top || inuse(next));
/* ... and has minimally sane links */
assert(p->fd->bk == p);
assert(p->bk->fd == p);
}
else /* markers are always of size SIZE_SZ */
assert(sz == SIZE_SZ);
}
/*
Properties of inuse chunks
*/
#if __STD_C
static void do_check_inuse_chunk(mchunkptr p)
#else
static void do_check_inuse_chunk(p) mchunkptr p;
#endif
{
mstate av = get_malloc_state();
mchunkptr next;
do_check_chunk(p);
if (chunk_is_mmapped(p))
return; /* mmapped chunks have no next/prev */
/* Check whether it claims to be in use ... */
assert(inuse(p));
next = next_chunk(p);
/* ... and is surrounded by OK chunks.
Since more things can be checked with free chunks than inuse ones,
if an inuse chunk borders them and debug is on, it's worth doing them.
*/
if (!prev_inuse(p)) {
/* Note that we cannot even look at prev unless it is not inuse */
mchunkptr prv = prev_chunk(p);
assert(next_chunk(prv) == p);
do_check_free_chunk(prv);
}
if (next == av->top) {
assert(prev_inuse(next));
assert(chunksize(next) >= MINSIZE);
}
else if (!inuse(next))
do_check_free_chunk(next);
}
/*
Properties of chunks recycled from fastbins
*/
#if __STD_C
static void do_check_remalloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)
#else
static void do_check_remalloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;
#endif
{
INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE;
do_check_inuse_chunk(p);
/* Legal size ... */
assert((sz & MALLOC_ALIGN_MASK) == 0);
assert((long)sz - (long)MINSIZE >= 0);
assert((long)sz - (long)s >= 0);
assert((long)sz - (long)(s + MINSIZE) < 0);
/* ... and alignment */
assert(aligned_OK(chunk2mem(p)));
}
/*
Properties of nonrecycled chunks at the point they are malloced
*/
#if __STD_C
static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)
#else
static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;
#endif
{
/* same as recycled case ... */
do_check_remalloced_chunk(p, s);
/*
... plus, must obey implementation invariant that prev_inuse is
always true of any allocated chunk; i.e., that each allocated
chunk borders either a previously allocated and still in-use
chunk, or the base of its memory arena. This is ensured
by making all allocations from the the `lowest' part of any found
chunk. This does not necessarily hold however for chunks
recycled via fastbins.
*/
assert(prev_inuse(p));
}
/*
Properties of malloc_state.
This may be useful for debugging malloc, as well as detecting user
programmer errors that somehow write into malloc_state.
*/
static void do_check_malloc_state()
{
mstate av = get_malloc_state();
int i;
mchunkptr p;
mchunkptr q;
mbinptr b;
unsigned int biton;
int empty;
unsigned int idx;
INTERNAL_SIZE_T size;
unsigned long total = 0;
int max_fast_bin;
/* internal size_t must be no wider than pointer type */
assert(sizeof(INTERNAL_SIZE_T) <= sizeof(char*));
/* alignment is a power of 2 */
assert((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-1)) == 0);
/* cannot run remaining checks until fully initialized */
if (av->top == 0 || av->top == initial_top(av))
return;
/* pagesize is a power of 2 */
assert((av->pagesize & (av->pagesize-1)) == 0);
/* properties of fastbins */
/* max_fast is in allowed range */
assert((av->max_fast & ~1) <= request2size(MAX_FAST_SIZE));
max_fast_bin = fastbin_index(av->max_fast);
for (i = 0; i < NFASTBINS; ++i) {
p = av->fastbins[i];
/* all bins past max_fast are empty */
if (i > max_fast_bin)
assert(p == 0);
while (p != 0) {
/* each chunk claims to be inuse */
do_check_inuse_chunk(p);
total += chunksize(p);
/* chunk belongs in this bin */
assert(fastbin_index(chunksize(p)) == i);
p = p->fd;
}
}
if (total != 0)
assert(have_fastchunks(av));
/* check normal bins */
for (i = 1; i < NBINS; ++i) {
b = bin_at(av,i);
/* binmap is accurate (except for bin 1 == unsorted_chunks) */
if (i >= 2) {
biton = get_binmap(av,i);
empty = last(b) == b;
if (!biton)
assert(empty);
else if (!empty)
assert(biton);
}
for (p = last(b); p != b; p = p->bk) {
/* each chunk claims to be free */
do_check_free_chunk(p);
size = chunksize(p);
total += size;
if (i >= 2) {
/* chunk belongs in bin */
idx = bin_index(size);
assert(idx == i);
/* lists are sorted */
assert(p->bk == b || chunksize(p->bk) >= chunksize(p));
}
/* chunk is followed by a legal chain of inuse chunks */
for (q = next_chunk(p);
q != av->top && inuse(q) && (long)(chunksize(q)) >= (long)MINSIZE;
q = next_chunk(q))
do_check_inuse_chunk(q);
}
}
/* top chunk is OK */
check_chunk(av->top);
/* sanity checks for statistics */
assert(total <= (unsigned long)(av->max_total_mem));
assert(av->n_mmaps >= 0);
assert(av->n_mmaps <= av->n_mmaps_max);
assert(av->n_mmaps <= av->max_n_mmaps);
assert(av->max_n_mmaps <= av->n_mmaps_max);
assert((unsigned long)(av->sbrked_mem) <=
(unsigned long)(av->max_sbrked_mem));
assert((unsigned long)(av->mmapped_mem) <=
(unsigned long)(av->max_mmapped_mem));
assert((unsigned long)(av->max_total_mem) >=
(unsigned long)(av->mmapped_mem) + (unsigned long)(av->sbrked_mem));
}
#endif
/* ----------- Routines dealing with system allocation -------------- */
/*
Handle malloc cases requiring more memory from system.
malloc relays to sYSMALLOc if it cannot allocate out of
existing memory.
On entry, it is assumed that av->top does not have enough
space to service request for nb bytes, thus requiring more meory
from system.
*/
#if __STD_C
static Void_t* sYSMALLOc(INTERNAL_SIZE_T nb, mstate av)
#else
static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
#endif
{
mchunkptr old_top; /* incoming value of av->top */
INTERNAL_SIZE_T old_size; /* its size */
char* old_end; /* its end address */
long size; /* arg to first MORECORE or mmap call */
char* brk; /* return value from MORECORE */
char* mm; /* return value from mmap call*/
long correction; /* arg to 2nd MORECORE call */
char* snd_brk; /* 2nd return val */
INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of new space */
INTERNAL_SIZE_T end_misalign; /* partial page left at end of new space */
char* aligned_brk; /* aligned offset into brk */
mchunkptr p; /* the allocated/returned chunk */
mchunkptr remainder; /* remainder from allocation */
long remainder_size; /* its size */
unsigned long sum; /* for updating stats */
size_t pagemask = av->pagesize - 1;
/*
If have mmap, and the request size meets the mmap threshold, and
the system supports mmap, and there are few enough currently
allocated mmapped regions, and a call to mmap succeeds, try to
directly map this request rather than expanding top.
*/
#if HAVE_MMAP
if ((unsigned long)nb >= (unsigned long)(av->mmap_threshold) &&
(av->n_mmaps < av->n_mmaps_max)) {
/*
Round up size to nearest page. For mmapped chunks, the overhead
is one SIZE_SZ unit larger than for normal chunks, because there
is no following chunk whose prev_size field could be used.
*/
size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask;
mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
if (mm != (char*)(MORECORE_FAILURE)) {
/*
The offset to the start of the mmapped region is stored
in the prev_size field of the chunk. This allows us to adjust
returned start address to meet alignment requirements here
and in memalign(), and still be able to compute proper
address argument for later munmap in free() and realloc().
*/
front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK;
if (front_misalign > 0) {
correction = MALLOC_ALIGNMENT - front_misalign;
p = (mchunkptr)(mm + correction);
p->prev_size = correction;
set_head(p, (size - correction) |IS_MMAPPED);
}
else {
p = (mchunkptr)mm;
set_head(p, size|IS_MMAPPED);
}
check_chunk(p);
/* update statistics */
if (++av->n_mmaps > av->max_n_mmaps)
av->max_n_mmaps = av->n_mmaps;
sum = av->mmapped_mem += size;
if (sum > (unsigned long)(av->max_mmapped_mem))
av->max_mmapped_mem = sum;
sum += av->sbrked_mem;
if (sum > (unsigned long)(av->max_total_mem))
av->max_total_mem = sum;
return chunk2mem(p);
}
}
#endif
/* record incoming configuration of top */
old_top = av->top;
old_size = chunksize(old_top);
old_end = (char*)(chunk_at_offset(old_top, old_size));
brk = snd_brk = (char*)(MORECORE_FAILURE);
/*
If not the first time through, we require old_size to be
at least MINSIZE and to have prev_inuse set.
*/
assert(old_top == initial_top(av) ||
((unsigned long) (old_size) >= (unsigned long)(MINSIZE) &&
prev_inuse(old_top)));
/* Request enough space for nb + pad + overhead */
size = nb + av->top_pad + MINSIZE;
/*
If contiguous, we can subtract out existing space that we hope to
combine with new space. We add it back later only if
we don't actually get contiguous space.
*/
if (av->sbrk_base != NONCONTIGUOUS_REGIONS)
size -= old_size;
/*
Round to a multiple of page size.
If MORECORE is not contiguous, this ensures that we only call it
with whole-page arguments. And if MORECORE is contiguous and
this is not first time through, this preserves page-alignment of
previous calls. Otherwise, we re-correct anyway to page-align below.
*/
size = (size + pagemask) & ~pagemask;
/*
Don't try to call MORECORE if argument is so big as to appear
negative. Note that since mmap takes size_t arg, it may succeed
below even if we cannot call MORECORE.
*/
if (size > 0)
brk = (char*)(MORECORE(size));
/*
If have mmap, try using it as a backup when MORECORE fails. This
is worth doing on systems that have "holes" in address space, so
sbrk cannot extend to give contiguous space, but space is available
elsewhere. Note that we ignore mmap max count and threshold limits,
since there is no reason to artificially limit use here.
*/
#if HAVE_MMAP
if (brk == (char*)(MORECORE_FAILURE)) {
/* Cannot merge with old top, so add its size back in */
if (av->sbrk_base != NONCONTIGUOUS_REGIONS)
size = (size + old_size + pagemask) & ~pagemask;
/* If we are relying on mmap as backup, then use larger units */
if ((unsigned long)size < (unsigned long)MMAP_AS_MORECORE_SIZE)
size = MMAP_AS_MORECORE_SIZE;
brk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
if (brk != (char*)(MORECORE_FAILURE)) {
/* We do not need, and cannot use, another sbrk call to find end */
snd_brk = brk + size;
/*
Record that we no longer have a contiguous sbrk region.
After the first time mmap is used as backup, we cannot
ever rely on contiguous space.
*/
av->sbrk_base = NONCONTIGUOUS_REGIONS;
}
}
#endif
if (brk != (char*)(MORECORE_FAILURE)) {
av->sbrked_mem += size;
/*
If MORECORE extends previous space, we can likewise extend top size.
*/
if (brk == old_end && snd_brk == (char*)(MORECORE_FAILURE)) {
set_head(old_top, (size + old_size) | PREV_INUSE);
}
/*
Otherwise, make adjustments guided by the special values of
av->sbrk_base (MORECORE_FAILURE or NONCONTIGUOUS_REGIONS):
* If the first time through or noncontiguous, we need to call sbrk
just to find out where the end of memory lies.
* We need to ensure that all returned chunks from malloc will meet
MALLOC_ALIGNMENT
* If there was an intervening foreign sbrk, we need to adjust sbrk
request size to account for fact that we will not be able to
combine new space with existing space in old_top.
* Almost all systems internally allocate whole pages at a time, in
which case we might as well use the whole last page of request.
So we allocate enough more memory to hit a page boundary now,
which in turn causes future contiguous calls to page-align.
*/
else {
front_misalign = 0;
end_misalign = 0;
correction = 0;
aligned_brk = brk;
/* handle contiguous cases */
if (av->sbrk_base != NONCONTIGUOUS_REGIONS) {
/* Guarantee alignment of first new chunk made from this space */
front_misalign = (INTERNAL_SIZE_T)chunk2mem(brk) & MALLOC_ALIGN_MASK;
if (front_misalign > 0) {
/*
Skip over some bytes to arrive at an aligned position.
We don't need to specially mark these wasted front bytes.
They will never be accessed anyway because
prev_inuse of av->top (and any chunk created from its start)
is always true after initialization.
*/
correction = MALLOC_ALIGNMENT - front_misalign;
aligned_brk += correction;
}
/*
If this isn't adjacent to a previous sbrk, then we will not
be able to merge with old_top space, so must add to 2nd request.
*/
correction += old_size;
/* Pad out to hit a page boundary */
end_misalign = (INTERNAL_SIZE_T)(brk + size + correction);
correction += ((end_misalign + pagemask) & ~pagemask) - end_misalign;
assert(correction >= 0);
snd_brk = (char*)(MORECORE(correction));
/*
If can't allocate correction, try to at least find out current
brk. It might be enough to proceed without failing.
Note that if second sbrk did NOT fail, we assume that space
is contiguous with first sbrk. This is a safe assumption unless
program is multithreaded but doesn't use locks and a foreign sbrk
occurred between our first and second calls.
*/
if (snd_brk == (char*)(MORECORE_FAILURE)) {
correction = 0;
snd_brk = (char*)(MORECORE(0));
}
}
/* handle non-contiguous cases */
else {
/* MORECORE/mmap must correctly align etc */
assert(((unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK) == 0);
/* Find out current end of memory */
if (snd_brk == (char*)(MORECORE_FAILURE)) {
snd_brk = (char*)(MORECORE(0));
}
/* This must lie on a page boundary */
if (snd_brk != (char*)(MORECORE_FAILURE)) {
assert(((INTERNAL_SIZE_T)(snd_brk) & pagemask) == 0);
}
}
/* Adjust top based on results of second sbrk */
if (snd_brk != (char*)(MORECORE_FAILURE)) {
av->top = (mchunkptr)aligned_brk;
set_head(av->top, (snd_brk - aligned_brk + correction) | PREV_INUSE);
av->sbrked_mem += correction;
/* If first time through and contiguous, record base */
if (old_top == initial_top(av)) {
if (av->sbrk_base == (char*)(MORECORE_FAILURE))
av->sbrk_base = brk;
}
/*
Otherwise, we either have a gap due to foreign sbrk or a
non-contiguous region. Insert a double fencepost at old_top
to prevent consolidation with space we don't own. These
fenceposts are artificial chunks that are marked as inuse
and are in any case too small to use. We need two to make
sizes and alignments work out.
*/
else {
/*
Shrink old_top to insert fenceposts, keeping size a
multiple of MALLOC_ALIGNMENT.
*/
old_size = (old_size - 3*SIZE_SZ) & ~MALLOC_ALIGN_MASK;
set_head(old_top, old_size | PREV_INUSE);
/*
Note that the following assignments overwrite old_top when
old_size was previously MINSIZE. This is intentional. We
need the fencepost, even if old_top otherwise gets lost.
*/
chunk_at_offset(old_top, old_size )->size =
SIZE_SZ|PREV_INUSE;
chunk_at_offset(old_top, old_size + SIZE_SZ)->size =
SIZE_SZ|PREV_INUSE;
/* If possible, release the rest. */
if (old_size >= MINSIZE)
fREe(chunk2mem(old_top));
}
}
}
/* Update statistics */
sum = av->sbrked_mem;
if (sum > (unsigned long)(av->max_sbrked_mem))
av->max_sbrked_mem = sum;
sum += av->mmapped_mem;
if (sum > (unsigned long)(av->max_total_mem))
av->max_total_mem = sum;
check_malloc_state();
/* finally, do the allocation */
p = av->top;
size = chunksize(p);
remainder_size = (long)size - (long)nb;
/* check that one of the above allocation paths succeeded */
if (remainder_size >= (long)MINSIZE) {
remainder = chunk_at_offset(p, nb);
av->top = remainder;
set_head(p, nb | PREV_INUSE);
set_head(remainder, remainder_size | PREV_INUSE);
check_malloced_chunk(p, nb);
return chunk2mem(p);
}
}
/* catch all failure paths */
MALLOC_FAILURE_ACTION;
return 0;
}
/*
sYSTRIm is an inverse of sorts to sYSMALLOc.
It gives memory back to the system (via negative
arguments to sbrk) if there is unused memory at the `high' end of
the malloc pool. It is called automatically by free()
when top space exceeds the trim threshold.
returns 1 if it actually released any memory, else 0.
*/
#if __STD_C
static int sYSTRIm(size_t pad, mstate av)
#else
static int sYSTRIm(pad, av) size_t pad; mstate av;
#endif
{
long top_size; /* Amount of top-most memory */
long extra; /* Amount to release */
long released; /* Amount actually released */
char* current_brk; /* address returned by pre-check sbrk call */
char* new_brk; /* address returned by post-check sbrk call */
size_t pagesz;
/* Don't bother trying if sbrk doesn't provide contiguous regions */
if (av->sbrk_base != NONCONTIGUOUS_REGIONS) {
pagesz = av->pagesize;
top_size = chunksize(av->top);
/* Release in pagesize units, keeping at least one page */
extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz;
if (extra > 0) {
/*
Only proceed if end of memory is where we last set it.
This avoids problems if there were foreign sbrk calls.
*/
current_brk = (char*)(MORECORE(0));
if (current_brk == (char*)(av->top) + top_size) {
/*
Attempt to release memory. We ignore return value,
and instead call again to find out where new end of memory is.
This avoids problems if first call releases less than we asked,
of if failure somehow altered brk value. (We could still
encounter problems if it altered brk in some very bad way,
but the only thing we can do is adjust anyway, which will cause
some downstream failure.)
*/
MORECORE(-extra);
new_brk = (char*)(MORECORE(0));
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
if (released != 0) {
/* Success. Adjust top. */
av->sbrked_mem -= released;
set_head(av->top, (top_size - released) | PREV_INUSE);
check_malloc_state();
return 1;
}
}
}
}
}
return 0;
}
/* ----------------------- Main public routines ----------------------- */
/*
Malloc routine. See running comments for algorithm description.
*/
#if __STD_C
Void_t* mALLOc(size_t bytes)
#else
Void_t* mALLOc(bytes) size_t bytes;
#endif
{
mstate av = get_malloc_state();
INTERNAL_SIZE_T nb; /* normalized request size */
unsigned int idx; /* associated bin index */
mbinptr bin; /* associated bin */
mfastbinptr* fb; /* associated fastbin */
mchunkptr victim; /* inspected/selected chunk */
INTERNAL_SIZE_T size; /* its size */
int victim_index; /* its bin index */
mchunkptr remainder; /* remainder from a split */
long remainder_size; /* its size */
unsigned int block; /* bit map traverser */
unsigned int bit; /* bit map traverser */
unsigned int map; /* current word of binmap */
mchunkptr fwd; /* misc temp for linking */
mchunkptr bck; /* misc temp for linking */
/*
Check request for legality and convert to internal form, nb.
This rejects negative arguments when size_t is treated as
signed. It also rejects arguments that are so large that the size
appears negative when aligned and padded. The converted form
adds SIZE_T bytes overhead plus possibly more to obtain necessary
alignment and/or to obtain a size of at least MINSIZE, the
smallest allocatable size.
*/
checked_request2size(bytes, nb);
/*
If the size qualifies as a fastbin, first check corresponding bin.
This code is safe to execute even if av not yet initialized, so we
can try it first, which saves some time on this fast path.
*/
if (nb <= av->max_fast) {
fb = &(av->fastbins[(fastbin_index(nb))]);
if ( (victim = *fb) != 0) {
*fb = victim->fd;
check_remalloced_chunk(victim, nb);
return chunk2mem(victim);
}
}
/*
If a small request, check regular bin. Since these "smallbins"
hold one size each, no searching within bins is necessary.
(If a large request, we need to wait until unsorted chunks are
processed to find best fit. But for small ones, fits are exact
anyway, so we can check now, which is faster.)
*/
if (in_smallbin_range(nb)) {
idx = smallbin_index(nb);
bin = bin_at(av,idx);
if ( (victim = last(bin)) != bin) {
if (victim == 0) /* initialization check */
malloc_consolidate(av);
else {
bck = victim->bk;
set_inuse_bit_at_offset(victim, nb);
bin->bk = bck;
bck->fd = bin;
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
}
}
/*
If a large request, consolidate fastbins before continuing.
While it might look excessive to kill all fastbins before
even seeing if there is space available, this avoids
fragmentation problems normally associated with fastbins.
Also, in practice, programs tend to have runs of either small or
large requests, but less often mixtures, so consolidation is not
usually invoked all that often.
*/
else {
idx = largebin_index(nb);
if (have_fastchunks(av)) /* consolidation/initialization check */
malloc_consolidate(av);
}
/*
Process recently freed or remaindered chunks, taking one only if
it is exact fit, or, if a small request, it is the remainder from
the most recent non-exact fit. Place other traversed chunks in
bins. Note that this step is the only place in any routine where
chunks are placed in bins.
The outer loop here is needed because we might not realize until
near the end of malloc that we should have consolidated, so must
do so and retry. This happens at most once, and only when we would
otherwise need to expand memory to service a "small" request.
*/
for(;;) {
while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) {
bck = victim->bk;
size = chunksize(victim);
/*
If a small request, try to use last remainder if it is the
only chunk in unsorted bin. This helps promote locality for
runs of consecutive small requests. This is the only
exception to best-fit.
*/
if (in_smallbin_range(nb) &&
victim == av->last_remainder &&
bck == unsorted_chunks(av) &&
(remainder_size = (long)size - (long)nb) >= (long)MINSIZE) {
/* split and reattach remainder */
remainder = chunk_at_offset(victim, nb);
unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
av->last_remainder = remainder;
remainder->bk = remainder->fd = unsorted_chunks(av);
set_head(victim, nb | PREV_INUSE);
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
/* remove from unsorted list */
unsorted_chunks(av)->bk = bck;
bck->fd = unsorted_chunks(av);
/* Take now instead of binning if exact fit */
if (size == nb) {
set_inuse_bit_at_offset(victim, size);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
/* place chunk in bin */
if (in_smallbin_range(size)) {
victim_index = smallbin_index(size);
bck = bin_at(av, victim_index);
fwd = bck->fd;
}
else {
victim_index = largebin_index(size);
bck = bin_at(av, victim_index);
fwd = bck->fd;
/* maintain large bins in sorted order */
if (fwd != bck) {
/* if smaller than smallest, bypass loop below */
if ((unsigned long)size <=
(unsigned long)(chunksize(bck->bk))) {
fwd = bck;
bck = bck->bk;
}
else {
while (fwd != bck &&
(unsigned long)size < (unsigned long)(chunksize(fwd))) {
fwd = fwd->fd;
}
bck = fwd->bk;
}
}
}
mark_bin(av, victim_index);
victim->bk = bck;
victim->fd = fwd;
fwd->bk = victim;
bck->fd = victim;
}
/*
If a large request, scan through the chunks of current bin in
sorted order to find smallest that fits. This is the only step
where an unbounded number of chunks might be scanned without doing
anything useful with them. However the lists tend to be very
short.
*/
if (!in_smallbin_range(nb)) {
bin = bin_at(av, idx);
/* skip scan if largest chunk is too small */
if ((victim = last(bin)) != bin &&
(long)(chunksize(first(bin))) - (long)(nb) >= 0) {
do {
size = chunksize(victim);
remainder_size = (long)size - (long)nb;
if (remainder_size >= 0) {
unlink(victim, bck, fwd);
/* Exhaust */
if (remainder_size < (long)MINSIZE) {
set_inuse_bit_at_offset(victim, size);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
/* Split */
else {
remainder = chunk_at_offset(victim, nb);
unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
remainder->bk = remainder->fd = unsorted_chunks(av);
set_head(victim, nb | PREV_INUSE);
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
}
} while ( (victim = victim->bk) != bin);
}
}
/*
Search for a chunk by scanning bins, starting with next largest
bin. This search is strictly by best-fit; i.e., the smallest
(with ties going to approximately the least recently used) chunk
that fits is selected.
The bitmap avoids needing to check that most blocks are nonempty.
The particular case of skipping all bins during warm-up phases
when no chunks have been returned yet is faster than it might look.
*/
++idx;
bin = bin_at(av,idx);
block = idx2block(idx);
map = av->binmap[block];
bit = idx2bit(idx);
for (;;) {
/*
Skip rest of block if there are no more set bits in this block.
*/
if (bit > map || bit == 0) {
for (;;) {
if (++block >= BINMAPSIZE) /* out of bins */
break;
else if ( (map = av->binmap[block]) != 0) {
bin = bin_at(av, (block << BINMAPSHIFT));
bit = 1;
break;
}
}
/* Optimizers seem to like this double-break better than goto */
if (block >= BINMAPSIZE)
break;
}
/* Advance to bin with set bit. There must be one. */
while ((bit & map) == 0) {
bin = next_bin(bin);
bit <<= 1;
}
victim = last(bin);
/* False alarm -- the bin is empty. Clear the bit. */
if (victim == bin) {
av->binmap[block] = map &= ~bit; /* Write through */
bin = next_bin(bin);
bit <<= 1;
}
/* We know the first chunk in this bin is big enough to use. */
else {
size = chunksize(victim);
remainder_size = (long)size - (long)nb;
assert(remainder_size >= 0);
/* unlink */
bck = victim->bk;
bin->bk = bck;
bck->fd = bin;
/* Exhaust */
if (remainder_size < (long)MINSIZE) {
set_inuse_bit_at_offset(victim, size);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
/* Split */
else {
remainder = chunk_at_offset(victim, nb);
unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
remainder->bk = remainder->fd = unsorted_chunks(av);
/* advertise as last remainder */
if (in_smallbin_range(nb))
av->last_remainder = remainder;
set_head(victim, nb | PREV_INUSE);
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
}
}
/*
If large enough, split off the chunk bordering the end of memory
("top"). Note that this use of top is in accord with the best-fit search
rule. In effect, top is treated as larger (and thus less well
fitting) than any other available chunk since it can be extended
to be as large as necessary (up to system limitations).
We require that "top" always exists (i.e., has size >= MINSIZE)
after initialization, so if it would otherwise be exhuasted by
current request, it is replenished. (Among the reasons for
ensuring it exists is that we may need MINSIZE space to put in
fenceposts in sysmalloc.)
*/
victim = av->top;
size = chunksize(victim);
remainder_size = (long)size - (long)nb;
if (remainder_size >= (long)MINSIZE) {
remainder = chunk_at_offset(victim, nb);
av->top = remainder;
set_head(victim, nb | PREV_INUSE);
set_head(remainder, remainder_size | PREV_INUSE);
check_malloced_chunk(victim, nb);
return chunk2mem(victim);
}
/*
If there is space available in fastbins, consolidate and retry,
to possibly avoid expanding memory. This can occur only if nb is
in smallbin range so we didn't consolidate upon entry.
*/
else if (have_fastchunks(av)) {
assert(in_smallbin_range(nb));
idx = smallbin_index(nb); /* restore original bin index */
malloc_consolidate(av);
}
/*
Otherwise, relay to handle system-dependent cases
*/
else
return sYSMALLOc(nb, av);
}
}
/*
Free routine. See running comments for algorithm description.
*/
#if __STD_C
void fREe(Void_t* mem)
#else
void fREe(mem) Void_t* mem;
#endif
{
mstate av = get_malloc_state();
mchunkptr p; /* chunk corresponding to mem */
INTERNAL_SIZE_T size; /* its size */
mfastbinptr* fb; /* associated fastbin */
mchunkptr nextchunk; /* next contiguous chunk */
INTERNAL_SIZE_T nextsize; /* its size */
int nextinuse; /* true if nextchunk is used */
INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */
mchunkptr bck; /* misc temp for linking */
mchunkptr fwd; /* misc temp for linking */
/* free(0) has no effect */
if (mem != 0) {
p = mem2chunk(mem);
check_inuse_chunk(p);
size = chunksize(p);
/*
If eligible, place chunk on a fastbin so it can be found
and used quickly in malloc.
*/
if ((unsigned long)size <= (unsigned long)av->max_fast
#if TRIM_FASTBINS
/*
If TRIM_FASTBINS set, don't place chunks
bordering top into fastbins
*/
&& (chunk_at_offset(p, size) != av->top)
#endif
) {
set_fastchunks(av);
fb = &(av->fastbins[fastbin_index(size)]);
p->fd = *fb;
*fb = p;
}
/*
Consolidate non-mmapped chunks as they arrive.
*/
else if (!chunk_is_mmapped(p)) {
nextchunk = chunk_at_offset(p, size);
/* consolidate backward */
if (!prev_inuse(p)) {
prevsize = p->prev_size;
size += prevsize;
p = chunk_at_offset(p, -((long) prevsize));
unlink(p, bck, fwd);
}
nextsize = chunksize(nextchunk);
if (nextchunk != av->top) {
/* get and clear inuse bit */
nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
set_head(nextchunk, nextsize);
/* consolidate forward */
if (!nextinuse) {
unlink(nextchunk, bck, fwd);
size += nextsize;
}
/*
Place chunk in unsorted chunk list. Chunks are
not placed into regular bins until after they have
been given one chance to be used in malloc.
*/
bck = unsorted_chunks(av);
fwd = bck->fd;
p->bk = bck;
p->fd = fwd;
bck->fd = p;
fwd->bk = p;
set_head(p, size | PREV_INUSE);
set_foot(p, size);
}
/*
If the chunk borders the current high end of memory,
consolidate into top
*/
else {
size += nextsize;
set_head(p, size | PREV_INUSE);
av->top = p;
/*
If the total unused topmost memory exceeds trim
threshold, ask malloc_trim to reduce top.
Unless max_fast is 0, we don't know if there are fastbins
bordering top, so we cannot tell for sure whether threshold has
been reached unless fastbins are consolidated. But we don't
want to consolidate on each free. As a compromise,
consolidation is performed if half the threshold is
reached.
*/
if ((unsigned long)(size) > (unsigned long)(av->trim_threshold / 2)) {
if (have_fastchunks(av)) {
malloc_consolidate(av);
size = chunksize(av->top);
}
if ((unsigned long)(size) > (unsigned long)(av->trim_threshold))
sYSTRIm(av->top_pad, av);
}
}
}
/*
If the chunk was allocated via mmap, release via munmap()
Note that if HAVE_MMAP is false but chunk_is_mmapped is
true, then user must have overwritten memory. There's nothing
we can do to catch this error unless DEBUG is set, in which case
check_inuse_chunk (above) will have triggered error.
*/
else {
#if HAVE_MMAP
int ret;
INTERNAL_SIZE_T offset = p->prev_size;
av->n_mmaps--;
av->mmapped_mem -= (size + offset);
ret = munmap((char*)p - offset, size + offset);
/* munmap returns non-zero on failure */
assert(ret == 0);
#endif
}
}
}
/*
malloc_consolidate is a specialized version of free() that tears
down chunks held in fastbins. Free itself cannot be used for this
purpose since, among other things, it might place chunks back onto
fastbins. So, instead, we need to use a minor variant of the same
code.
Also, because this routine needs to be called the first time through
malloc anyway, it turns out to be the perfect place to bury
initialization code.
*/
#if __STD_C
static void malloc_consolidate(mstate av)
#else
static void malloc_consolidate(av) mstate av;
#endif
{
mfastbinptr* fb;
mfastbinptr* maxfb;
mchunkptr p;
mchunkptr nextp;
mchunkptr unsorted_bin;
mchunkptr first_unsorted;
/* These have same use as in free() */
mchunkptr nextchunk;
INTERNAL_SIZE_T size;
INTERNAL_SIZE_T nextsize;
INTERNAL_SIZE_T prevsize;
int nextinuse;
mchunkptr bck;
mchunkptr fwd;
/*
If max_fast is 0, we know that malloc hasn't
yet been initialized, in which case do so.
*/
if (av->max_fast == 0) {
malloc_init_state(av);
check_malloc_state();
}
else if (have_fastchunks(av)) {
clear_fastchunks(av);
unsorted_bin = unsorted_chunks(av);
/*
Remove each chunk from fast bin and consolidate it, placing it
then in unsorted bin. Among other reasons for doing this,
placing in unsorted bin avoids needing to calculate actual bins
until malloc is sure that chunks aren't immediately going to be
reused anyway.
*/
maxfb = &(av->fastbins[fastbin_index(av->max_fast)]);
fb = &(av->fastbins[0]);
do {
if ( (p = *fb) != 0) {
*fb = 0;
do {
check_inuse_chunk(p);
nextp = p->fd;
/* Slightly streamlined version of consolidation code in free() */
size = p->size & ~PREV_INUSE;
nextchunk = chunk_at_offset(p, size);
if (!prev_inuse(p)) {
prevsize = p->prev_size;
size += prevsize;
p = chunk_at_offset(p, -((long) prevsize));
unlink(p, bck, fwd);
}
nextsize = chunksize(nextchunk);
if (nextchunk != av->top) {
nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
set_head(nextchunk, nextsize);
if (!nextinuse) {
size += nextsize;
unlink(nextchunk, bck, fwd);
}
first_unsorted = unsorted_bin->fd;
unsorted_bin->fd = p;
first_unsorted->bk = p;
set_head(p, size | PREV_INUSE);
p->bk = unsorted_bin;
p->fd = first_unsorted;
set_foot(p, size);
}
else {
size += nextsize;
set_head(p, size | PREV_INUSE);
av->top = p;
}
} while ( (p = nextp) != 0);
}
} while (fb++ != maxfb);
}
}
/*
Realloc algorithm cases:
* Chunks that were obtained via mmap cannot be extended or shrunk
unless HAVE_MREMAP is defined, in which case mremap is used.
Otherwise, if the reallocation is for additional space, they are
copied. If for less, they are just left alone.
* Otherwise, if the reallocation is for additional space, and the
chunk can be extended, it is, else a malloc-copy-free sequence is
taken. There are several different ways that a chunk could be
extended. All are tried:
* Extending forward into following adjacent free chunk.
* Shifting backwards, joining preceding adjacent space
* Both shifting backwards and extending forward.
* Extending into newly sbrked space
* If there is not enough memory available to realloc, realloc
returns null, but does NOT free the existing space.
* If the reallocation is for less space, the newly unused space is
lopped off and freed. Unless the #define REALLOC_ZERO_BYTES_FREES
is set, realloc with a size argument of zero (re)allocates a
minimum-sized chunk.
The old unix realloc convention of allowing the last-free'd chunk
to be used as an argument to realloc is no longer supported.
I don't know of any programs still relying on this feature,
and allowing it would also allow too many other incorrect
usages of realloc to be sensible.
*/
#if __STD_C
Void_t* rEALLOc(Void_t* oldmem, size_t bytes)
#else
Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
#endif
{
mstate av = get_malloc_state();
INTERNAL_SIZE_T nb; /* padded request size */
mchunkptr oldp; /* chunk corresponding to oldmem */
INTERNAL_SIZE_T oldsize; /* its size */
mchunkptr newp; /* chunk to return */
INTERNAL_SIZE_T newsize; /* its size */
Void_t* newmem; /* corresponding user mem */
mchunkptr next; /* next contiguous chunk after oldp */
mchunkptr prev; /* previous contiguous chunk before oldp */
mchunkptr remainder; /* extra space at end of newp */
long remainder_size; /* its size */
mchunkptr bck; /* misc temp for linking */
mchunkptr fwd; /* misc temp for linking */
INTERNAL_SIZE_T copysize; /* bytes to copy */
int ncopies; /* INTERNAL_SIZE_T words to copy */
INTERNAL_SIZE_T* s; /* copy source */
INTERNAL_SIZE_T* d; /* copy destination */
#ifdef REALLOC_ZERO_BYTES_FREES
if (bytes == 0) {
fREe(oldmem);
return 0;
}
#endif
/* realloc of null is supposed to be same as malloc */
if (oldmem == 0) return mALLOc(bytes);
checked_request2size(bytes, nb);
oldp = mem2chunk(oldmem);
oldsize = chunksize(oldp);
check_inuse_chunk(oldp);
if (!chunk_is_mmapped(oldp)) {
if ((unsigned long)(oldsize) >= (unsigned long)(nb)) {
/* already big enough; split below */
newp = oldp;
newsize = oldsize;
}
else {
newp = 0;
newsize = 0;
next = chunk_at_offset(oldp, oldsize);
if (next == av->top) { /* Expand forward into top */
newsize = oldsize + chunksize(next);
if ((unsigned long)(newsize) >= (unsigned long)(nb + MINSIZE)) {
set_head_size(oldp, nb);
av->top = chunk_at_offset(oldp, nb);
set_head(av->top, (newsize - nb) | PREV_INUSE);
return chunk2mem(oldp);
}
else if (!prev_inuse(oldp)) { /* Shift backwards + top */
prev = prev_chunk(oldp);
newsize += chunksize(prev);
if ((unsigned long)(newsize) >= (unsigned long)(nb + MINSIZE)) {
newp = prev;
unlink(prev, bck, fwd);
av->top = chunk_at_offset(newp, nb);
set_head(av->top, (newsize - nb) | PREV_INUSE);
newsize = nb;
}
}
}
else if (!inuse(next)) { /* Forward into next chunk */
newsize = oldsize + chunksize(next);
if (((unsigned long)(newsize) >= (unsigned long)(nb))) {
newp = oldp;
unlink(next, bck, fwd);
}
else if (!prev_inuse(oldp)) { /* Forward + backward */
prev = prev_chunk(oldp);
newsize += chunksize(prev);
if (((unsigned long)(newsize) >= (unsigned long)(nb))) {
newp = prev;
unlink(prev, bck, fwd);
unlink(next, bck, fwd);
}
}
}
else if (!prev_inuse(oldp)) { /* Backward only */
prev = prev_chunk(oldp);
newsize = oldsize + chunksize(prev);
if ((unsigned long)(newsize) >= (unsigned long)(nb)) {
newp = prev;
unlink(prev, bck, fwd);
}
}
if (newp != 0) {
if (newp != oldp) {
/* Backward copies are not worth unrolling */
MALLOC_COPY(chunk2mem(newp), oldmem, oldsize - SIZE_SZ, 1);
}
}
/* Must allocate */
else {
newmem = mALLOc(nb - MALLOC_ALIGN_MASK);
if (newmem == 0)
return 0; /* propagate failure */
newp = mem2chunk(newmem);
newsize = chunksize(newp);
/*
Avoid copy if newp is next chunk after oldp.
*/
if (newp == next) {
newsize += oldsize;
newp = oldp;
}
else {
/*
Unroll copy of <= 36 bytes (72 if 8byte sizes)
We know that contents have an odd number of
INTERNAL_SIZE_T-sized words; minimally 3.
*/
copysize = oldsize - SIZE_SZ;
s = (INTERNAL_SIZE_T*)oldmem;
d = (INTERNAL_SIZE_T*)(chunk2mem(newp));
ncopies = copysize / sizeof(INTERNAL_SIZE_T);
assert(ncopies >= 3);
if (ncopies > 9)
MALLOC_COPY(d, s, copysize, 0);
else {
*(d+0) = *(s+0);
*(d+1) = *(s+1);
*(d+2) = *(s+2);
if (ncopies > 4) {
*(d+3) = *(s+3);
*(d+4) = *(s+4);
if (ncopies > 6) {
*(d+5) = *(s+5);
*(d+6) = *(s+6);
if (ncopies > 8) {
*(d+7) = *(s+7);
*(d+8) = *(s+8);
}
}
}
}
fREe(oldmem);
check_inuse_chunk(newp);
return chunk2mem(newp);
}
}
}
/* If possible, free extra space in old or extended chunk */
remainder_size = (long)newsize - (long)nb;
assert(remainder_size >= 0);
if (remainder_size >= (long)MINSIZE) { /* split remainder */
remainder = chunk_at_offset(newp, nb);
set_head_size(newp, nb);
set_head(remainder, remainder_size | PREV_INUSE);
/* Mark remainder as inuse so free() won't complain */
set_inuse_bit_at_offset(remainder, remainder_size);
fREe(chunk2mem(remainder));
}
else { /* not enough extra to split off */
set_head_size(newp, newsize);
set_inuse_bit_at_offset(newp, newsize);
}
check_inuse_chunk(newp);
return chunk2mem(newp);
}
/*
Handle mmap cases
*/
else {
#if HAVE_MMAP
#if HAVE_MREMAP
INTERNAL_SIZE_T offset = oldp->prev_size;
size_t pagemask = av->pagesize - 1;
char *cp;
unsigned long sum;
/* Note the extra SIZE_SZ overhead */
newsize = (nb + offset + SIZE_SZ + pagemask) & ~pagemask;
/* don't need to remap if still within same page */
if (oldsize == newsize - offset)
return oldmem;
cp = (char*)mremap((char*)oldp - offset, oldsize + offset, newsize, 1);
if (cp != (char*)MORECORE_FAILURE) {
newp = (mchunkptr)(cp + offset);
set_head(newp, (newsize - offset)|IS_MMAPPED);
assert(aligned_OK(chunk2mem(newp)));
assert((newp->prev_size == offset));
/* update statistics */
sum = av->mmapped_mem += newsize - oldsize;
if (sum > (unsigned long)(av->max_mmapped_mem))
av->max_mmapped_mem = sum;
sum += av->sbrked_mem;
if (sum > (unsigned long)(av->max_total_mem))
av->max_total_mem = sum;
return chunk2mem(newp);
}
#endif
/* Note the extra SIZE_SZ overhead. */
if ((long)oldsize - (long)SIZE_SZ >= (long)nb)
newmem = oldmem; /* do nothing */
else {
/* Must alloc, copy, free. */
newmem = mALLOc(nb - MALLOC_ALIGN_MASK);
if (newmem != 0) {
MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ, 0);
fREe(oldmem);
}
}
return newmem;
#else
/* If !HAVE_MMAP, but chunk_is_mmapped, user must have overwritten mem */
check_malloc_state();
MALLOC_FAILURE_ACTION;
return 0;
#endif
}
}
/*
memalign requests more than enough space from malloc, finds a spot
within that chunk that meets the alignment request, and then
possibly frees the leading and trailing space.
Alignments must be powers of two. If the argument is not a
power of two, the nearest greater power is used.
8-byte alignment is guaranteed by normal malloc calls, so don't
bother calling memalign with an argument of 8 or less.
Overreliance on memalign is a sure way to fragment space.
*/
#if __STD_C
Void_t* mEMALIGn(size_t alignment, size_t bytes)
#else
Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
#endif
{
INTERNAL_SIZE_T nb; /* padded request size */
char* m; /* memory returned by malloc call */
mchunkptr p; /* corresponding chunk */
char* brk; /* alignment point within p */
mchunkptr newp; /* chunk to return */
INTERNAL_SIZE_T newsize; /* its size */
INTERNAL_SIZE_T leadsize; /* leading space befor alignment point */
mchunkptr remainder; /* spare room at end to split off */
long remainder_size; /* its size */
/* If need less alignment than we give anyway, just relay to malloc */
if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes);
/* Otherwise, ensure that it is at least a minimum chunk size */
if (alignment < MINSIZE) alignment = MINSIZE;
/* Make sure alignment is power of 2 (in case MINSIZE is not). */
if ((alignment & (alignment - 1)) != 0) {
size_t a = MALLOC_ALIGNMENT * 2;
while ((unsigned long)a < (unsigned long)alignment) a <<= 1;
alignment = a;
}
checked_request2size(bytes, nb);
/* Call malloc with worst case padding to hit alignment. */
m = (char*)(mALLOc(nb + alignment + MINSIZE));
if (m == 0) return 0; /* propagate failure */
p = mem2chunk(m);
if ((((unsigned long)(m)) % alignment) != 0) { /* misaligned */
/*
Find an aligned spot inside chunk. Since we need to give back
leading space in a chunk of at least MINSIZE, if the first
calculation places us at a spot with less than MINSIZE leader,
we can move to the next aligned spot -- we've allocated enough
total room so that this is always possible.
*/
brk = (char*)mem2chunk(((unsigned long)(m + alignment - 1)) &
-((signed long) alignment));
if ((long)(brk - (char*)(p)) < (long)MINSIZE)
brk = brk + alignment;
newp = (mchunkptr)brk;
leadsize = brk - (char*)(p);
newsize = chunksize(p) - leadsize;
/* For mmapped chunks, just adjust offset */
if (chunk_is_mmapped(p)) {
newp->prev_size = p->prev_size + leadsize;
set_head(newp, newsize|IS_MMAPPED);
return chunk2mem(newp);
}
/* Otherwise, give back leader, use the rest */
set_head(newp, newsize | PREV_INUSE);
set_inuse_bit_at_offset(newp, newsize);
set_head_size(p, leadsize);
fREe(chunk2mem(p));
p = newp;
assert (newsize >= nb &&
(((unsigned long)(chunk2mem(p))) % alignment) == 0);
}
/* Also give back spare room at the end */
if (!chunk_is_mmapped(p)) {
remainder_size = (long)(chunksize(p)) - (long)nb;
if (remainder_size >= (long)MINSIZE) {
remainder = chunk_at_offset(p, nb);
set_head(remainder, remainder_size | PREV_INUSE);
set_head_size(p, nb);
fREe(chunk2mem(remainder));
}
}
check_inuse_chunk(p);
return chunk2mem(p);
}
/*
calloc calls malloc, then zeroes out the allocated chunk.
*/
#if __STD_C
Void_t* cALLOc(size_t n_elements, size_t elem_size)
#else
Void_t* cALLOc(n_elements, elem_size) size_t n_elements; size_t elem_size;
#endif
{
mchunkptr p;
INTERNAL_SIZE_T clearsize;
int nclears;
INTERNAL_SIZE_T* d;
Void_t* mem = mALLOc(n_elements * elem_size);
if (mem != 0) {
p = mem2chunk(mem);
if (!chunk_is_mmapped(p)) { /* don't need to clear mmapped space */
/*
Unroll clear of <= 36 bytes (72 if 8byte sizes)
We know that contents have an odd number of
INTERNAL_SIZE_T-sized words; minimally 3.
*/
d = (INTERNAL_SIZE_T*)mem;
clearsize = chunksize(p) - SIZE_SZ;
nclears = clearsize / sizeof(INTERNAL_SIZE_T);
assert(nclears >= 3);
if (nclears > 9)
MALLOC_ZERO(d, clearsize);
else {
*(d+0) = 0;
*(d+1) = 0;
*(d+2) = 0;
if (nclears > 4) {
*(d+3) = 0;
*(d+4) = 0;
if (nclears > 6) {
*(d+5) = 0;
*(d+6) = 0;
if (nclears > 8) {
*(d+7) = 0;
*(d+8) = 0;
}
}
}
}
}
}
return mem;
}
/*
cfree just calls free. It is needed/defined on some systems
that pair it with calloc, presumably for odd historical reasons
(such as: cfree is used in example code in first edition of K&R).
*/
#if __STD_C
void cFREe(Void_t *mem)
#else
void cFREe(mem) Void_t *mem;
#endif
{
fREe(mem);
}
/*
valloc just invokes memalign with alignment argument equal
to the page size of the system (or as near to this as can
be figured out from all the includes/defines above.)
*/
#if __STD_C
Void_t* vALLOc(size_t bytes)
#else
Void_t* vALLOc(bytes) size_t bytes;
#endif
{
/* Ensure initialization/consolidation */
mstate av = get_malloc_state();
malloc_consolidate(av);
return mEMALIGn(av->pagesize, bytes);
}
/*
pvalloc just invokes valloc for the nearest pagesize
that will accommodate request
*/
#if __STD_C
Void_t* pVALLOc(size_t bytes)
#else
Void_t* pVALLOc(bytes) size_t bytes;
#endif
{
mstate av = get_malloc_state();
size_t pagesz;
/* Ensure initialization/consolidation */
malloc_consolidate(av);
pagesz = av->pagesize;
return mEMALIGn(pagesz, (bytes + pagesz - 1) & ~(pagesz - 1));
}
/*
Malloc_Trim gives memory back to the system (via negative
arguments to sbrk) if there is unused memory at the `high' end of
the malloc pool. You can call this after freeing large blocks of
memory to potentially reduce the system-level memory requirements
of a program. However, it cannot guarantee to reduce memory. Under
some allocation patterns, some large free blocks of memory will be
locked between two used chunks, so they cannot be given back to
the system.
The `pad' argument to malloc_trim represents the amount of free
trailing space to leave untrimmed. If this argument is zero,
only the minimum amount of memory to maintain internal data
structures will be left (one page or less). Non-zero arguments
can be supplied to maintain enough trailing space to service
future expected allocations without having to re-obtain memory
from the system.
Malloc_trim returns 1 if it actually released any memory, else 0.
*/
#if __STD_C
int mTRIm(size_t pad)
#else
int mTRIm(pad) size_t pad;
#endif
{
mstate av = get_malloc_state();
/* Ensure initialization/consolidation */
malloc_consolidate(av);
return sYSTRIm(pad, av);
}
/*
malloc_usable_size tells you how many bytes you can actually use in
an allocated chunk, which may be more than you requested (although
often not). You can use this many bytes without worrying about
overwriting other allocated objects. Not a particularly great
programming practice, but still sometimes useful.
*/
#if __STD_C
size_t mUSABLe(Void_t* mem)
#else
size_t mUSABLe(mem) Void_t* mem;
#endif
{
mchunkptr p;
if (mem != 0) {
p = mem2chunk(mem);
if (chunk_is_mmapped(p))
return chunksize(p) - 2*SIZE_SZ;
else if (inuse(p))
return chunksize(p) - SIZE_SZ;
}
return 0;
}
/*
mallinfo returns a copy of updated current mallinfo.
*/
struct mallinfo mALLINFo()
{
mstate av = get_malloc_state();
struct mallinfo mi;
int i;
mbinptr b;
mchunkptr p;
INTERNAL_SIZE_T avail;
int navail;
int nfastblocks;
int fastbytes;
/* Ensure initialization */
if (av->top == 0) malloc_consolidate(av);
check_malloc_state();
/* Account for top */
avail = chunksize(av->top);
navail = 1; /* top always exists */
/* traverse fastbins */
nfastblocks = 0;
fastbytes = 0;
for (i = 0; i < NFASTBINS; ++i) {
for (p = av->fastbins[i]; p != 0; p = p->fd) {
++nfastblocks;
fastbytes += chunksize(p);
}
}
avail += fastbytes;
/* traverse regular bins */
for (i = 1; i < NBINS; ++i) {
b = bin_at(av, i);
for (p = last(b); p != b; p = p->bk) {
avail += chunksize(p);
navail++;
}
}
mi.smblks = nfastblocks;
mi.ordblks = navail;
mi.fordblks = avail;
mi.uordblks = av->sbrked_mem - avail;
mi.arena = av->sbrked_mem;
mi.hblks = av->n_mmaps;
mi.hblkhd = av->mmapped_mem;
mi.fsmblks = fastbytes;
mi.keepcost = chunksize(av->top);
mi.usmblks = av->max_total_mem;
return mi;
}
/*
malloc_stats prints on stderr the amount of space obtained from the
system (both via sbrk and mmap), the maximum amount (which may be
more than current if malloc_trim and/or munmap got called), and the
current number of bytes allocated via malloc (or realloc, etc) but
not yet freed. Note that this is the number of bytes allocated, not
the number requested. It will be larger than the number requested
because of alignment and bookkeeping overhead. Because it includes
alignment wastage as being in use, this figure may be greater than zero
even when no user-level chunks are allocated.
The reported current and maximum system memory can be inaccurate if
a program makes other calls to system memory allocation functions
(normally sbrk) outside of malloc.
malloc_stats prints only the most commonly interesting statistics.
More information can be obtained by calling mallinfo.
*/
void mSTATs()
{
struct mallinfo mi = mALLINFo();
#ifdef WIN32
{
unsigned long free, reserved, committed;
vminfo (&free, &reserved, &committed);
fprintf(stderr, "free bytes = %10lu\n",
free);
fprintf(stderr, "reserved bytes = %10lu\n",
reserved);
fprintf(stderr, "committed bytes = %10lu\n",
committed);
}
#endif
fprintf(stderr, "max system bytes = %10lu\n",
(unsigned long)(mi.usmblks));
fprintf(stderr, "system bytes = %10lu\n",
(unsigned long)(mi.arena + mi.hblkhd));
fprintf(stderr, "in use bytes = %10lu\n",
(unsigned long)(mi.uordblks + mi.hblkhd));
#ifdef WIN32
{
unsigned long kernel, user;
if (cpuinfo (TRUE, &kernel, &user)) {
fprintf(stderr, "kernel ms = %10lu\n",
kernel);
fprintf(stderr, "user ms = %10lu\n",
user);
}
}
#endif
}
/*
mallopt is the general SVID/XPG interface to tunable parameters.
The format is to provide a (parameter-number, parameter-value)
pair. mallopt then sets the corresponding parameter to the
argument value if it can (i.e., so long as the value is
meaningful), and returns 1 if successful else 0. See descriptions
of tunable parameters above for meanings.
*/
#if __STD_C
int mALLOPt(int param_number, int value)
#else
int mALLOPt(param_number, value) int param_number; int value;
#endif
{
mstate av = get_malloc_state();
/* Ensure initialization/consolidation */
malloc_consolidate(av);
switch(param_number) {
case M_MXFAST:
if (value >= 0 && value <= MAX_FAST_SIZE) {
av->max_fast = req2max_fast(value);
return 1;
}
else
return 0;
case M_TRIM_THRESHOLD:
av->trim_threshold = value;
return 1;
case M_TOP_PAD:
av->top_pad = value;
return 1;
case M_MMAP_THRESHOLD:
av->mmap_threshold = value;
return 1;
case M_MMAP_MAX:
#if HAVE_MMAP
av->n_mmaps_max = value;
return 1;
#else
if (value != 0)
return 0;
else {
av->n_mmaps_max = value;
return 1;
}
#endif
default:
return 0;
}
}
/* -------------------------------------------------------------- */
/*
Emulation of sbrk for win32.
Donated by J. Walter <Walter@GeNeSys-e.de>.
For additional information about this code, and malloc on Win32, see
http://www.genesys-e.de/jwalter/
*/
#ifdef WIN32
#ifdef _DEBUG
/* #define TRACE */
#endif
/* Support for USE_MALLOC_LOCK */
#ifdef USE_MALLOC_LOCK
/* Wait for spin lock */
static int slwait (int *sl) {
while (InterlockedCompareExchange ((void **) sl, (void *) 1, (void *) 0) != 0)
Sleep (0);
return 0;
}
/* Release spin lock */
static int slrelease (int *sl) {
InterlockedExchange (sl, 0);
return 0;
}
#ifdef NEEDED
/* Spin lock for emulation code */
static int g_sl;
#endif
#endif /* USE_MALLOC_LOCK */
/* getpagesize for windows */
static long getpagesize (void) {
static long g_pagesize = 0;
if (! g_pagesize) {
SYSTEM_INFO system_info;
GetSystemInfo (&system_info);
g_pagesize = system_info.dwPageSize;
}
return g_pagesize;
}
static long getregionsize (void) {
static long g_regionsize = 0;
if (! g_regionsize) {
SYSTEM_INFO system_info;
GetSystemInfo (&system_info);
g_regionsize = system_info.dwAllocationGranularity;
}
return g_regionsize;
}
/* A region list entry */
typedef struct _region_list_entry {
void *top_allocated;
void *top_committed;
void *top_reserved;
long reserve_size;
struct _region_list_entry *previous;
} region_list_entry;
/* Allocate and link a region entry in the region list */
static int region_list_append (region_list_entry **last, void *base_reserved, long reserve_size) {
region_list_entry *next = HeapAlloc (GetProcessHeap (), 0, sizeof (region_list_entry));
if (! next)
return FALSE;
next->top_allocated = (char *) base_reserved;
next->top_committed = (char *) base_reserved;
next->top_reserved = (char *) base_reserved + reserve_size;
next->reserve_size = reserve_size;
next->previous = *last;
*last = next;
return TRUE;
}
/* Free and unlink the last region entry from the region list */
static int region_list_remove (region_list_entry **last) {
region_list_entry *previous = (*last)->previous;
if (! HeapFree (GetProcessHeap (), sizeof (region_list_entry), *last))
return FALSE;
*last = previous;
return TRUE;
}
#define CEIL(size,to) (((size)+(to)-1)&~((to)-1))
#define FLOOR(size,to) ((size)&~((to)-1))
#define SBRK_SCALE 0
/* #define SBRK_SCALE 1 */
/* #define SBRK_SCALE 2 */
/* #define SBRK_SCALE 4 */
/* sbrk for windows */
static void *sbrk (long size) {
static long g_pagesize, g_my_pagesize;
static long g_regionsize, g_my_regionsize;
static region_list_entry *g_last;
void *result = (void *) MORECORE_FAILURE;
#ifdef TRACE
printf ("sbrk %d\n", size);
#endif
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Wait for spin lock */
slwait (&g_sl);
#endif
/* First time initialization */
if (! g_pagesize) {
g_pagesize = getpagesize ();
g_my_pagesize = g_pagesize << SBRK_SCALE;
}
if (! g_regionsize) {
g_regionsize = getregionsize ();
g_my_regionsize = g_regionsize << SBRK_SCALE;
}
if (! g_last) {
if (! region_list_append (&g_last, 0, 0))
goto sbrk_exit;
}
/* Assert invariants */
assert (g_last);
assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated &&
g_last->top_allocated <= g_last->top_committed);
assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed &&
g_last->top_committed <= g_last->top_reserved &&
(unsigned) g_last->top_committed % g_pagesize == 0);
assert ((unsigned) g_last->top_reserved % g_regionsize == 0);
assert ((unsigned) g_last->reserve_size % g_regionsize == 0);
/* Allocation requested? */
if (size >= 0) {
/* Allocation size is the requested size */
long allocate_size = size;
/* Compute the size to commit */
long to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;
/* Do we reach the commit limit? */
if (to_commit > 0) {
/* Round size to commit */
long commit_size = CEIL (to_commit, g_my_pagesize);
/* Compute the size to reserve */
long to_reserve = (char *) g_last->top_committed + commit_size - (char *) g_last->top_reserved;
/* Do we reach the reserve limit? */
if (to_reserve > 0) {
/* Compute the remaining size to commit in the current region */
long remaining_commit_size = (char *) g_last->top_reserved - (char *) g_last->top_committed;
if (remaining_commit_size > 0) {
/* Assert preconditions */
assert ((unsigned) g_last->top_committed % g_pagesize == 0);
assert (0 < remaining_commit_size && remaining_commit_size % g_pagesize == 0); {
/* Commit this */
void *base_committed = VirtualAlloc (g_last->top_committed, remaining_commit_size,
MEM_COMMIT, PAGE_READWRITE);
/* Check returned pointer for consistency */
if (base_committed != g_last->top_committed)
goto sbrk_exit;
/* Assert postconditions */
assert ((unsigned) base_committed % g_pagesize == 0);
#ifdef TRACE
printf ("Commit %p %d\n", base_committed, remaining_commit_size);
#endif
/* Adjust the regions commit top */
g_last->top_committed = (char *) base_committed + remaining_commit_size;
}
} {
/* Now we are going to search and reserve. */
int contiguous = -1;
int found = FALSE;
MEMORY_BASIC_INFORMATION memory_info;
void *base_reserved;
long reserve_size;
do {
/* Assume contiguous memory */
contiguous = TRUE;
/* Round size to reserve */
reserve_size = CEIL (to_reserve, g_my_regionsize);
/* Start with the current region's top */
memory_info.BaseAddress = g_last->top_reserved;
/* Assert preconditions */
assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);
assert (0 < reserve_size && reserve_size % g_regionsize == 0);
while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) {
/* Assert postconditions */
assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);
#ifdef TRACE
printf ("Query %p %d %s\n", memory_info.BaseAddress, memory_info.RegionSize,
memory_info.State == MEM_FREE ? "FREE":
(memory_info.State == MEM_RESERVE ? "RESERVED":
(memory_info.State == MEM_COMMIT ? "COMMITTED": "?")));
#endif
/* Region is free, well aligned and big enough: we are done */
if (memory_info.State == MEM_FREE &&
(unsigned) memory_info.BaseAddress % g_regionsize == 0 &&
memory_info.RegionSize >= (unsigned) reserve_size) {
found = TRUE;
break;
}
/* From now on we can't get contiguous memory! */
contiguous = FALSE;
/* Recompute size to reserve */
reserve_size = CEIL (allocate_size, g_my_regionsize);
memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize;
/* Assert preconditions */
assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);
assert (0 < reserve_size && reserve_size % g_regionsize == 0);
}
/* Search failed? */
if (! found)
goto sbrk_exit;
/* Assert preconditions */
assert ((unsigned) memory_info.BaseAddress % g_regionsize == 0);
assert (0 < reserve_size && reserve_size % g_regionsize == 0);
/* Try to reserve this */
base_reserved = VirtualAlloc (memory_info.BaseAddress, reserve_size,
MEM_RESERVE, PAGE_NOACCESS);
if (! base_reserved) {
int rc = GetLastError ();
if (rc != ERROR_INVALID_ADDRESS)
goto sbrk_exit;
}
/* A null pointer signals (hopefully) a race condition with another thread. */
/* In this case, we try again. */
} while (! base_reserved);
/* Check returned pointer for consistency */
if (memory_info.BaseAddress && base_reserved != memory_info.BaseAddress)
goto sbrk_exit;
/* Assert postconditions */
assert ((unsigned) base_reserved % g_regionsize == 0);
#ifdef TRACE
printf ("Reserve %p %d\n", base_reserved, reserve_size);
#endif
/* Did we get contiguous memory? */
if (contiguous) {
long start_size = (char *) g_last->top_committed - (char *) g_last->top_allocated;
/* Adjust allocation size */
allocate_size -= start_size;
/* Adjust the regions allocation top */
g_last->top_allocated = g_last->top_committed;
/* Recompute the size to commit */
to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;
/* Round size to commit */
commit_size = CEIL (to_commit, g_my_pagesize);
}
/* Append the new region to the list */
if (! region_list_append (&g_last, base_reserved, reserve_size))
goto sbrk_exit;
/* Didn't we get contiguous memory? */
if (! contiguous) {
/* Recompute the size to commit */
to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;
/* Round size to commit */
commit_size = CEIL (to_commit, g_my_pagesize);
}
}
}
/* Assert preconditions */
assert ((unsigned) g_last->top_committed % g_pagesize == 0);
assert (0 < commit_size && commit_size % g_pagesize == 0); {
/* Commit this */
void *base_committed = VirtualAlloc (g_last->top_committed, commit_size,
MEM_COMMIT, PAGE_READWRITE);
/* Check returned pointer for consistency */
if (base_committed != g_last->top_committed)
goto sbrk_exit;
/* Assert postconditions */
assert ((unsigned) base_committed % g_pagesize == 0);
#ifdef TRACE
printf ("Commit %p %d\n", base_committed, commit_size);
#endif
/* Adjust the regions commit top */
g_last->top_committed = (char *) base_committed + commit_size;
}
}
/* Adjust the regions allocation top */
g_last->top_allocated = (char *) g_last->top_allocated + allocate_size;
result = (char *) g_last->top_allocated - size;
/* Deallocation requested? */
} else if (size < 0) {
long deallocate_size = - size;
/* As long as we have a region to release */
while ((char *) g_last->top_allocated - deallocate_size < (char *) g_last->top_reserved - g_last->reserve_size) {
/* Get the size to release */
long release_size = g_last->reserve_size;
/* Get the base address */
void *base_reserved = (char *) g_last->top_reserved - release_size;
/* Assert preconditions */
assert ((unsigned) base_reserved % g_regionsize == 0);
assert (0 < release_size && release_size % g_regionsize == 0); {
/* Release this */
int rc = VirtualFree (base_reserved, 0,
MEM_RELEASE);
/* Check returned code for consistency */
if (! rc)
goto sbrk_exit;
#ifdef TRACE
printf ("Release %p %d\n", base_reserved, release_size);
#endif
}
/* Adjust deallocation size */
deallocate_size -= (char *) g_last->top_allocated - (char *) base_reserved;
/* Remove the old region from the list */
if (! region_list_remove (&g_last))
goto sbrk_exit;
} {
/* Compute the size to decommit */
long to_decommit = (char *) g_last->top_committed - ((char *) g_last->top_allocated - deallocate_size);
if (to_decommit >= g_my_pagesize) {
/* Compute the size to decommit */
long decommit_size = FLOOR (to_decommit, g_my_pagesize);
/* Compute the base address */
void *base_committed = (char *) g_last->top_committed - decommit_size;
/* Assert preconditions */
assert ((unsigned) base_committed % g_pagesize == 0);
assert (0 < decommit_size && decommit_size % g_pagesize == 0); {
/* Decommit this */
int rc = VirtualFree ((char *) base_committed, decommit_size,
MEM_DECOMMIT);
/* Check returned code for consistency */
if (! rc)
goto sbrk_exit;
#ifdef TRACE
printf ("Decommit %p %d\n", base_committed, decommit_size);
#endif
}
/* Adjust deallocation size and regions commit and allocate top */
deallocate_size -= (char *) g_last->top_allocated - (char *) base_committed;
g_last->top_committed = base_committed;
g_last->top_allocated = base_committed;
}
}
/* Adjust regions allocate top */
g_last->top_allocated = (char *) g_last->top_allocated - deallocate_size;
/* Check for underflow */
if ((char *) g_last->top_reserved - g_last->reserve_size > (char *) g_last->top_allocated ||
g_last->top_allocated > g_last->top_committed) {
/* Adjust regions allocate top */
g_last->top_allocated = (char *) g_last->top_reserved - g_last->reserve_size;
goto sbrk_exit;
}
result = g_last->top_allocated;
}
/* Assert invariants */
assert (g_last);
assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated &&
g_last->top_allocated <= g_last->top_committed);
assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed &&
g_last->top_committed <= g_last->top_reserved &&
(unsigned) g_last->top_committed % g_pagesize == 0);
assert ((unsigned) g_last->top_reserved % g_regionsize == 0);
assert ((unsigned) g_last->reserve_size % g_regionsize == 0);
sbrk_exit:
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Release spin lock */
slrelease (&g_sl);
#endif
return result;
}
/* mmap for windows */
static void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) {
static long g_pagesize;
static long g_regionsize;
#ifdef TRACE
printf ("mmap %d\n", size);
#endif
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Wait for spin lock */
slwait (&g_sl);
#endif
/* First time initialization */
if (! g_pagesize)
g_pagesize = getpagesize ();
if (! g_regionsize)
g_regionsize = getregionsize ();
/* Assert preconditions */
assert ((unsigned) ptr % g_regionsize == 0);
assert (size % g_pagesize == 0);
/* Allocate this */
ptr = VirtualAlloc (ptr, size,
MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE);
if (! ptr) {
ptr = (void *) MORECORE_FAILURE;
goto mmap_exit;
}
/* Assert postconditions */
assert ((unsigned) ptr % g_regionsize == 0);
#ifdef TRACE
printf ("Commit %p %d\n", ptr, size);
#endif
mmap_exit:
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Release spin lock */
slrelease (&g_sl);
#endif
return ptr;
}
/* munmap for windows */
static long munmap (void *ptr, long size) {
static long g_pagesize;
static long g_regionsize;
int rc = MUNMAP_FAILURE;
#ifdef TRACE
printf ("munmap %p %d\n", ptr, size);
#endif
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Wait for spin lock */
slwait (&g_sl);
#endif
/* First time initialization */
if (! g_pagesize)
g_pagesize = getpagesize ();
if (! g_regionsize)
g_regionsize = getregionsize ();
/* Assert preconditions */
assert ((unsigned) ptr % g_regionsize == 0);
assert (size % g_pagesize == 0);
/* Free this */
if (! VirtualFree (ptr, 0,
MEM_RELEASE))
goto munmap_exit;
rc = 0;
#ifdef TRACE
printf ("Release %p %d\n", ptr, size);
#endif
munmap_exit:
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Release spin lock */
slrelease (&g_sl);
#endif
return rc;
}
static void vminfo (unsigned long *free, unsigned long *reserved, unsigned long *committed) {
MEMORY_BASIC_INFORMATION memory_info;
memory_info.BaseAddress = 0;
*free = *reserved = *committed = 0;
while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) {
switch (memory_info.State) {
case MEM_FREE:
*free += memory_info.RegionSize;
break;
case MEM_RESERVE:
*reserved += memory_info.RegionSize;
break;
case MEM_COMMIT:
*committed += memory_info.RegionSize;
break;
}
memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize;
}
}
static int cpuinfo (int whole, unsigned long *kernel, unsigned long *user) {
if (whole) {
__int64 creation64, exit64, kernel64, user64;
int rc = GetProcessTimes (GetCurrentProcess (),
(FILETIME *) &creation64,
(FILETIME *) &exit64,
(FILETIME *) &kernel64,
(FILETIME *) &user64);
if (! rc) {
*kernel = 0;
*user = 0;
return FALSE;
}
*kernel = (unsigned long) (kernel64 / 10000);
*user = (unsigned long) (user64 / 10000);
return TRUE;
} else {
__int64 creation64, exit64, kernel64, user64;
int rc = GetThreadTimes (GetCurrentThread (),
(FILETIME *) &creation64,
(FILETIME *) &exit64,
(FILETIME *) &kernel64,
(FILETIME *) &user64);
if (! rc) {
*kernel = 0;
*user = 0;
return FALSE;
}
*kernel = (unsigned long) (kernel64 / 10000);
*user = (unsigned long) (user64 / 10000);
return TRUE;
}
}
#endif /* WIN32 */
/*
History:
V2.7.0
* new WIN32 sbrk, mmap, munmap, lock code from <Walter@GeNeSys-e.de>.
* Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for
helping test this.)
* memalign: check alignment arg
* realloc: use memmove when regions may overlap.
* Collect all cases in malloc requiring system memory into sYSMALLOc
* Use mmap as backup to sbrk, if available; fold these mmap-related
operations into others.
* Place all internal state in malloc_state
* Introduce fastbins (although similar to 2.5.1)
* Many minor tunings and cosmetic improvements
* Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK
* Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
Thanks to Tony E. Bennett <tbennett@nvidia.com> and others.
* Adjust request2size to fit with MALLOC_FAILURE_ACTION.
* Include errno.h to support default failure action.
* Further improve WIN32 'sbrk()' emulation's 'findRegion()' routine
to avoid infinite loop when allocating initial memory larger
than RESERVED_SIZE and/or subsequent memory larger than
NEXT_SIZE. Thanks to Andreas Mueller <a.mueller at paradatec.de>
for finding this one.
V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee)
* return null for negative arguments
* Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
* Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
(e.g. WIN32 platforms)
* Cleanup header file inclusion for WIN32 platforms
* Cleanup code to avoid Microsoft Visual C++ compiler complaints
* Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
memory allocation routines
* Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
* Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
usage of 'assert' in non-WIN32 code
* Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
avoid infinite loop
* Always call 'fREe()' rather than 'free()'
V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee)
* Fixed ordering problem with boundary-stamping
V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee)
* Added pvalloc, as recommended by H.J. Liu
* Added 64bit pointer support mainly from Wolfram Gloger
* Added anonymously donated WIN32 sbrk emulation
* Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
* malloc_extend_top: fix mask error that caused wastage after
foreign sbrks
* Add linux mremap support code from HJ Liu
V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee)
* Integrated most documentation with the code.
* Add support for mmap, with help from
Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
* Use last_remainder in more cases.
* Pack bins using idea from colin@nyx10.cs.du.edu
* Use ordered bins instead of best-fit threshhold
* Eliminate block-local decls to simplify tracing and debugging.
* Support another case of realloc via move into top
* Fix error occuring when initial sbrk_base not word-aligned.
* Rely on page size for units instead of SBRK_UNIT to
avoid surprises about sbrk alignment conventions.
* Add mallinfo, mallopt. Thanks to Raymond Nijssen
(raymond@es.ele.tue.nl) for the suggestion.
* Add `pad' argument to malloc_trim and top_pad mallopt parameter.
* More precautions for cases where other routines call sbrk,
courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
* Added macros etc., allowing use in linux libc from
H.J. Lu (hjl@gnu.ai.mit.edu)
* Inverted this history list
V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee)
* Re-tuned and fixed to behave more nicely with V2.6.0 changes.
* Removed all preallocation code since under current scheme
the work required to undo bad preallocations exceeds
the work saved in good cases for most test programs.
* No longer use return list or unconsolidated bins since
no scheme using them consistently outperforms those that don't
given above changes.
* Use best fit for very large chunks to prevent some worst-cases.
* Added some support for debugging
V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee)
* Removed footers when chunks are in use. Thanks to
Paul Wilson (wilson@cs.texas.edu) for the suggestion.
V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee)
* Added malloc_trim, with help from Wolfram Gloger
(wmglo@Dent.MED.Uni-Muenchen.DE).
V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g)
V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g)
* realloc: try to expand in both directions
* malloc: swap order of clean-bin strategy;
* realloc: only conditionally expand backwards
* Try not to scavenge used bins
* Use bin counts as a guide to preallocation
* Occasionally bin return list chunks in first scan
* Add a few optimizations from colin@nyx10.cs.du.edu
V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g)
* faster bin computation & slightly different binning
* merged all consolidations to one part of malloc proper
(eliminating old malloc_find_space & malloc_clean_bin)
* Scan 2 returns chunks (not just 1)
* Propagate failure in realloc if malloc returns 0
* Add stuff to allow compilation on non-ANSI compilers
from kpv@research.att.com
V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu)
* removed potential for odd address access in prev_chunk
* removed dependency on getpagesize.h
* misc cosmetics and a bit more internal documentation
* anticosmetics: mangled names in macros to evade debugger strangeness
* tested on sparc, hp-700, dec-mips, rs6000
with gcc & native cc (hp, dec only) allowing
Detlefs & Zorn comparison study (in SIGPLAN Notices.)
Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu)
* Based loosely on libg++-1.2X malloc. (It retains some of the overall
structure of old version, but most details differ.)
*/
|
3759a71300c902dee91202c8e983f73af1c4c727
|
7f6c235b0598353549959c18f69eefd20b766907
|
/src/appmake/mz2500.c
|
20d544646cf6eaa6b20bb08aff44b03bf3f38792
|
[
"ClArtistic"
] |
permissive
|
z88dk/z88dk
|
46dfd4905f36d99333173cadd0a660839befc9f0
|
8b07f37cc43c5d9ffe69b563c80763491d8faff7
|
refs/heads/master
| 2023-09-04T19:29:49.254958
| 2023-09-03T20:51:24
| 2023-09-03T20:51:24
| 54,035,569
| 820
| 263
|
NOASSERTION
| 2023-09-05T11:09:04
| 2016-03-16T13:48:16
|
Assembly
|
UTF-8
|
C
| false
| false
| 4,540
|
c
|
mz2500.c
|
/*
* Create a 320KB boot disk image compatible to the Sharp MZ2500 computer family
*
* $Id: mz2500.c $
*/
#include "appmake.h"
#include <string.h>
#include <ctype.h>
static char *binname = NULL;
static char *crtfile = NULL;
static char *outfile = NULL;
static char *blockname = NULL;
static char help = 0;
/* Options that are available for this module */
option_t mz2500_options[] = {
{ 'h', "help", "Display this help", OPT_BOOL, &help},
{ 'b', "binfile", "Linked binary file", OPT_STR, &binname },
{ 'o', "output", "Name of output file", OPT_STR, &outfile },
{ 0 , "blockname", "Name for the code block", OPT_STR, &blockname},
{ 0, NULL, NULL, OPT_NONE, NULL }
};
static disc_spec spec = {
.name = "MZ2500",
.sectors_per_track = 16,
.tracks = 40,
.sides = 2,
.sector_size = 256,
.gap3_length = 0x17,
.filler_byte = 0xe5,
.first_sector_offset = 1,
.alternate_sides = 1
};
static uint8_t sectorbuf[256];
void write_sector(disc_handle *h, int track, int sector, int head)
{
int i;
for ( i = 0; i < sizeof(sectorbuf);i++ ) {
sectorbuf[i] ^= 0xff;
}
disc_write_sector(h, track, sector, head, sectorbuf);
}
/*
* Execution starts here
*/
int mz2500_exec(char* target)
{
char filename[FILENAME_MAX + 1];
FILE* fpin;
int len;
int i;
int track, sector, head;
size_t bytes_read;
int bytes_to_write;
disc_handle *h;
if (help)
return -1;
if (binname == NULL ) {
return -1;
}
if (outfile == NULL) {
strcpy(filename, binname);
} else {
strcpy(filename, outfile);
}
suffix_change(filename, ".dsk");
if (strcmp(binname, filename) == 0) {
exit_log(1, "Input and output file names must be different\n");
}
if (blockname == NULL)
blockname = zbasename(binname);
if ((fpin = fopen_bin(binname, crtfile)) == NULL) {
exit_log(1, "Can't open input file %s\n", binname);
}
suffix_change(blockname, "");
if (fseek(fpin, 0, SEEK_END)) {
fclose(fpin);
exit_log(1,"Couldn't determine size of file\n");
}
len = ftell(fpin);
fseek(fpin, 0L, SEEK_SET);
h = disc_create(&spec);
/* Disk block #2 (directory) */
memset(sectorbuf, 0, sizeof(sectorbuf));
sectorbuf[0] = 1; /* OBJ (machine language program) */
memcpy(sectorbuf + 1,"IPLPRO", 6);
/* Now the filename from offset 8 */
for ( i = 7 ; i < 20; i++ ) {
int slen = i - 7;
sectorbuf[i] = strlen(blockname) > slen ? blockname[slen] : ' ';
}
sectorbuf[20] = 0x0d; // Terminate name
// sectorbuf[22] = 0; //
// sectorbuf[23] = 0x80;
sectorbuf[24] = 0; // Load address
sectorbuf[25] = 0x80;
sectorbuf[30] = 0x30; // Start sector
sectorbuf[31] = 0x00;
sectorbuf[32] = 12; // Memory bank for $2000...$e000
sectorbuf[33] = 13; // Next bank
sectorbuf[34] = 14; // Next bank
sectorbuf[35] = 0xff; // Terminate
// Banking at start of execution
sectorbuf[48] = 8; // for $000
sectorbuf[49] = 9;
sectorbuf[50] = 10;
sectorbuf[51] = 11;
sectorbuf[52] = 12;
sectorbuf[53] = 13;
sectorbuf[54] = 14;
sectorbuf[55] = 15;
write_sector(h, 0, 0, 1);
// Write info from input file to dsk per sector (in blocks of 256)
// Append trailing blanks if bytes_read is smaller than the size of a sector
// Start writing on track 2, first sector (block 0x30)
track = 1; sector = 0; head = 0;
bytes_to_write = len;
while ( 0 < bytes_to_write ) {
memset(sectorbuf, 0, sizeof(sector)); // Fill sector buffer with data (and evt trailing blanks)
bytes_read = fread(sectorbuf, sizeof(uint8_t), 256, fpin);
if (bytes_read == 0) { fclose(fpin); exit_log(1, "Could not read required data from <%s>\n", binname); }
write_sector(h, track, sector, head); // Write sector buffer to sector on dsk
bytes_to_write -= bytes_read;
sector++; // Adjust track, sector, head to write next
if ( sector == 16 ) {
sector = 0;
head ^= 1;
if ( head == 1 ) track++;
}
}
fclose(fpin);
disc_write_edsk(h, filename);
disc_free(h);
return 0;
}
|
94c9aacd222c971ba2a189e84cb89974bf0ac746
|
7e41167bfae6d2c38689b7e0993b308e045cbd05
|
/less-34/less/position.h
|
a0b20c5b6f3a7cda9a52b94dfadc212efd3a8a5c
|
[
"BSD-3-Clause",
"curl",
"GPL-1.0-or-later",
"MIT",
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"GPL-3.0-or-later"
] |
permissive
|
holzschu/ios_system
|
7b18993dbcb33331c353e0257ca54847a5d1b1bb
|
6a83eb1c6c383a562fbe33a7e97677e88d305b51
|
refs/heads/master
| 2023-08-14T09:11:40.627903
| 2023-04-18T15:12:29
| 2023-04-18T15:12:29
| 113,187,304
| 882
| 155
|
BSD-3-Clause
| 2023-08-19T19:15:35
| 2017-12-05T13:42:50
|
C
|
UTF-8
|
C
| false
| false
| 414
|
h
|
position.h
|
/*
* Copyright (C) 1984-2016 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
* For more information, see the README file.
*/
/*
* Include file for interfacing to position.c modules.
*/
#define TOP (0)
#define TOP_PLUS_ONE (1)
#define BOTTOM (-1)
#define BOTTOM_PLUS_ONE (-2)
#define MIDDLE (-3)
|
56298898eb11bab8f9f83752f3b51bfced126fec
|
673b3a4e8be3cc5e6997cd215cb5b9e2eaeca8b6
|
/devices/lpc43xx/lpc43xx_uart.c
|
1c32c61d5eaad8a2dd7afd49ee5bb26a0f93391f
|
[
"Apache-2.0"
] |
permissive
|
adamgreen/mri
|
c0bf4c1610003fd216fe506e8cb79a735442daa4
|
5d7e4dfcef0f5c59d78844bf63ae11136cd1656e
|
refs/heads/master
| 2023-08-19T18:22:30.128341
| 2023-08-14T20:56:29
| 2023-08-14T20:56:29
| 4,280,328
| 124
| 47
|
Apache-2.0
| 2023-07-01T07:40:30
| 2012-05-10T04:40:49
|
C
|
UTF-8
|
C
| false
| false
| 23,547
|
c
|
lpc43xx_uart.c
|
/* Copyright 2020 Adam Green (https://github.com/adamgreen/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/* Routines used to provide LPC43xx UART functionality to the mri debugger. */
#include <string.h>
#include <stdlib.h>
#include <core/platforms.h>
#include "lpc43xx_init.h"
#include <architectures/armv7-m/armv7-m.h>
#include <architectures/armv7-m/debug_cm3.h>
static const UartConfiguration g_uartConfigurations[] =
{
{
LPC_USART0,
CLK_BASE_UART0,
CLK_MX_UART0,
CLK_APB0_UART0,
SCU_PIN(6, 4),
SCU_MODE_FUNC2,
SCU_PIN(6, 5),
SCU_MODE_FUNC2
},
{
LPC_UART1,
CLK_BASE_UART1,
CLK_MX_UART1,
CLK_APB0_UART1,
SCU_PIN(5, 6),
SCU_MODE_FUNC4,
SCU_PIN(1, 14),
SCU_MODE_FUNC1
},
{
LPC_USART2,
CLK_BASE_UART2,
CLK_MX_UART2,
CLK_APB2_UART2,
SCU_PIN(2, 10),
SCU_MODE_FUNC2,
SCU_PIN(2, 11),
SCU_MODE_FUNC2
},
{
LPC_USART3,
CLK_BASE_UART3,
CLK_MX_UART3,
CLK_APB2_UART3,
SCU_PIN(2, 3),
SCU_MODE_FUNC2,
SCU_PIN(2, 4),
SCU_MODE_FUNC2
}
};
static UartConfiguration g_customUart;
typedef struct
{
const UartConfiguration* pUart;
uint32_t baudRate;
} UartParameters;
typedef struct
{
uint32_t integerBaudRateDivisor;
uint32_t fractionalBaudRateDivisor;
} BaudRateDivisors;
typedef struct
{
uint32_t desiredRatio;
uint32_t mul;
uint32_t divAdd;
uint32_t closestDivisor;
uint32_t closestMul;
uint32_t closestDivAdd;
uint32_t closestDelta;
} CalculateDivisors;
static void parseUartParameters(Token* pParameterTokens, UartConfiguration* pUart, UartParameters* pParameters);
static void saveUartToBeUsedByDebugger(const UartConfiguration* pUart);
static uint32_t uint32FromString(const char* pString);
static uint32_t getDecimalDigit(char currChar);
static void configureUartForExclusiveUseOfDebugger(UartParameters* pParameters);
static void setUartPeripheralClockToPLL1(void);
static void enableUartClocks(void);
static void enableCCUClock(CCU_CLK_T clockToEnable);
static void clearUartFractionalBaudDivisor(void);
static void enableUartFifoAndDisableDma(void);
static void setUartTo8N1(void);
static void setUartBaudRate(UartParameters* pParameters);
static void setDivisors(BaudRateDivisors* pDivisors);
static void setDivisorLatchBit(void);
static void clearDivisorLatchBit(void);
static BaudRateDivisors calculateBaudRateDivisors(uint32_t baudRate, uint32_t peripheralRate);
static void initCalculateDivisorsStruct(CalculateDivisors* pThis, uint32_t baudRate, uint32_t peripheralRate);
static uint32_t fixupPeripheralRateFor16XOversampling(uint32_t actualPeripheralRate);
static int isNoFractionalDivisorRequired(CalculateDivisors* pThis);
static BaudRateDivisors closestDivisors(CalculateDivisors* pThis);
static BaudRateDivisors calculateFractionalBaudRateDivisors(CalculateDivisors* pThis);
static void checkTheseFractionalDivisors(CalculateDivisors* pThis);
static void selectUartPins(void);
static void enableUartToInterruptOnReceivedChar(void);
static void configureNVICForUartInterrupt(void);
static int commUartIndex(void);
void mriLpc43xxUart_Init(Token* pParameterTokens)
{
UartParameters parameters = {NULL, 0};
parseUartParameters(pParameterTokens, &g_customUart, ¶meters);
saveUartToBeUsedByDebugger(parameters.pUart);
configureUartForExclusiveUseOfDebugger(¶meters);
}
static void parseUartParameters(Token* pParameterTokens, UartConfiguration* pUart, UartParameters* pParameters)
{
static const char baudRatePrefix[] = "MRI_UART_BAUD=";
const char* pMatchingPrefix = NULL;
LPC_USART_T* pRxUartRegisters = NULL;
/* Parse TX pins */
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P1_13"))
{
/* {P1_13, UART_1, (SCU_PINIO_UART_TX | 1)}, */
pUart->pUartRegisters = LPC_UART1;
pUart->txPin = SCU_PIN(1, 13);
pUart->txFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P1_15"))
{
/* {P1_15, UART_2, (SCU_PINIO_UART_TX | 1)}, */
pUart->pUartRegisters = LPC_USART2;
pUart->txPin = SCU_PIN(1, 15);
pUart->txFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P2_0"))
{
/* {P2_0, UART_0, (SCU_PINIO_UART_TX | 1)}, */
pUart->pUartRegisters = LPC_USART0;
pUart->txPin = SCU_PIN(2, 0);
pUart->txFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P2_3"))
{
/* {P2_3, UART_3, (SCU_PINIO_UART_TX | 2)}, */
pUart->pUartRegisters = LPC_USART3;
pUart->txPin = SCU_PIN(2, 3);
pUart->txFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P2_10"))
{
/* {P2_10, UART_2, (SCU_PINIO_UART_TX | 2)}, */
pUart->pUartRegisters = LPC_USART2;
pUart->txPin = SCU_PIN(2, 10);
pUart->txFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P3_4"))
{
/* {P3_4, UART_1, (SCU_PINIO_UART_TX | 4)}, */
pUart->pUartRegisters = LPC_UART1;
pUart->txPin = SCU_PIN(3, 4);
pUart->txFunction = SCU_MODE_FUNC4;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P4_1"))
{
/* {P4_1, UART_3, (SCU_PINIO_UART_TX | 6)}, */
pUart->pUartRegisters = LPC_USART3;
pUart->txPin = SCU_PIN(4, 1);
pUart->txFunction = SCU_MODE_FUNC6;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P5_6"))
{
/* {P5_6, UART_1, (SCU_PINIO_UART_TX | 4)}, */
pUart->pUartRegisters = LPC_UART1;
pUart->txPin = SCU_PIN(5, 6);
pUart->txFunction = SCU_MODE_FUNC4;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P6_4"))
{
/* {P6_4, UART_0, (SCU_PINIO_UART_TX | 2)}, */
pUart->pUartRegisters = LPC_USART0;
pUart->txPin = SCU_PIN(6, 4);
pUart->txFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P7_1"))
{
/* {P7_1, UART_2, (SCU_PINIO_UART_TX | 6)}, */
pUart->pUartRegisters = LPC_USART2;
pUart->txPin = SCU_PIN(7, 1);
pUart->txFunction = SCU_MODE_FUNC6;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P9_3"))
{
/* {P9_3, UART_3, (SCU_PINIO_UART_TX | 7)}, */
pUart->pUartRegisters = LPC_USART3;
pUart->txPin = SCU_PIN(9, 3);
pUart->txFunction = SCU_MODE_FUNC7;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_P9_5"))
{
/* {P9_5, UART_0, (SCU_PINIO_UART_TX | 7)}, */
pUart->pUartRegisters = LPC_USART0;
pUart->txPin = SCU_PIN(9, 5);
pUart->txFunction = SCU_MODE_FUNC7;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_PA_1"))
{
/* {PA_1, UART_2, (SCU_PINIO_UART_TX | 3)}, */
pUart->pUartRegisters = LPC_USART2;
pUart->txPin = SCU_PIN(0xA, 1);
pUart->txFunction = SCU_MODE_FUNC3;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_PC_13"))
{
/* {PC_13, UART_1, (SCU_PINIO_UART_TX | 2)}, */
pUart->pUartRegisters = LPC_UART1;
pUart->txPin = SCU_PIN(0xC, 13);
pUart->txFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_PE_11"))
{
/* {PE_11, UART_1, (SCU_PINIO_UART_TX | 2)}, */
pUart->pUartRegisters = LPC_UART1;
pUart->txPin = SCU_PIN(0xE, 11);
pUart->txFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_PF_2"))
{
/* {PF_2, UART_3, (SCU_PINIO_UART_TX | 1)}, */
pUart->pUartRegisters = LPC_USART3;
pUart->txPin = SCU_PIN(0xF, 2);
pUart->txFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_TX_PF_10"))
{
/* {PF_10, UART_0, (SCU_PINIO_UART_TX | 1)}, */
pUart->pUartRegisters = LPC_USART0;
pUart->txPin = SCU_PIN(0xF, 10);
pUart->txFunction = SCU_MODE_FUNC1;
}
/* Parse RX pins */
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P1_14"))
{
/* {P1_14, UART_1, (SCU_PINIO_UART_RX | 1)}, */
pRxUartRegisters = LPC_UART1;
pUart->rxPin = SCU_PIN(1, 14);
pUart->rxFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P1_16"))
{
/* {P1_16, UART_2, (SCU_PINIO_UART_RX | 1)}, */
pRxUartRegisters = LPC_USART2;
pUart->rxPin = SCU_PIN(1, 16);
pUart->rxFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P2_1"))
{
/* {P2_1, UART_0, (SCU_PINIO_UART_RX | 1)}, */
pRxUartRegisters = LPC_USART0;
pUart->rxPin = SCU_PIN(2, 1);
pUart->rxFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P2_4"))
{
/* {P2_4, UART_3, (SCU_PINIO_UART_RX | 2)}, */
pRxUartRegisters = LPC_USART3;
pUart->rxPin = SCU_PIN(2, 4);
pUart->rxFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P2_11"))
{
/* {P2_11, UART_2, (SCU_PINIO_UART_RX | 2)}, */
pRxUartRegisters = LPC_USART2;
pUart->rxPin = SCU_PIN(2, 11);
pUart->rxFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P3_5"))
{
/* {P3_5, UART_1, (SCU_PINIO_UART_RX | 4)}, */
pRxUartRegisters = LPC_UART1;
pUart->rxPin = SCU_PIN(3, 5);
pUart->rxFunction = SCU_MODE_FUNC4;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P4_2"))
{
/* {P4_2, UART_3, (SCU_PINIO_UART_RX | 6)}, */
pRxUartRegisters = LPC_USART3;
pUart->rxPin = SCU_PIN(4, 2);
pUart->rxFunction = SCU_MODE_FUNC6;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P5_7"))
{
/* {P5_7, UART_1, (SCU_PINIO_UART_RX | 4)}, */
pRxUartRegisters = LPC_UART1;
pUart->rxPin = SCU_PIN(5, 7);
pUart->rxFunction = SCU_MODE_FUNC4;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P6_5"))
{
/* {P6_5, UART_0, (SCU_PINIO_UART_RX | 2)}, */
pRxUartRegisters = LPC_USART0;
pUart->rxPin = SCU_PIN(6, 5);
pUart->rxFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P7_2"))
{
/* {P7_2, UART_2, (SCU_PINIO_UART_RX | 6)}, */
pRxUartRegisters = LPC_USART2;
pUart->rxPin = SCU_PIN(7, 2);
pUart->rxFunction = SCU_MODE_FUNC6;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P9_4"))
{
/* {P9_4, UART_3, (SCU_PINIO_UART_RX | 7)}, */
pRxUartRegisters = LPC_USART3;
pUart->rxPin = SCU_PIN(9, 4);
pUart->rxFunction = SCU_MODE_FUNC7;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_P9_6"))
{
/* {P9_6, UART_0, (SCU_PINIO_UART_RX | 7)}, */
pRxUartRegisters = LPC_USART0;
pUart->rxPin = SCU_PIN(9, 6);
pUart->rxFunction = SCU_MODE_FUNC7;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_PA_2"))
{
/* {PA_2, UART_2, (SCU_PINIO_UART_RX | 3)}, */
pRxUartRegisters = LPC_USART2;
pUart->rxPin = SCU_PIN(0xA, 2);
pUart->rxFunction = SCU_MODE_FUNC3;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_PC_14"))
{
/* {PC_14, UART_1, (SCU_PINIO_UART_RX | 2)}, */
pRxUartRegisters = LPC_UART1;
pUart->rxPin = SCU_PIN(0xC, 14);
pUart->rxFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_PE_12"))
{
/* {PE_12, UART_1, (SCU_PINIO_UART_RX | 2)}, */
pRxUartRegisters = LPC_UART1;
pUart->rxPin = SCU_PIN(0xE, 12);
pUart->rxFunction = SCU_MODE_FUNC2;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_PF_3"))
{
/* {PF_3, UART_3, (SCU_PINIO_UART_RX | 1)}, */
pRxUartRegisters = LPC_USART3;
pUart->rxPin = SCU_PIN(0xF, 3);
pUart->rxFunction = SCU_MODE_FUNC1;
}
if (Token_MatchingString(pParameterTokens, "MRI_UART_RX_PF_11"))
{
/* {PF_11, UART_0, (SCU_PINIO_UART_RX | 1)}, */
pRxUartRegisters = LPC_USART0;
pUart->rxPin = SCU_PIN(0xF, 11);
pUart->rxFunction = SCU_MODE_FUNC1;
}
/* Remember this UART if Tx and Rx pin matched to the same UART peripherals. */
if (pUart->pUartRegisters == pRxUartRegisters)
pParameters->pUart = pUart;
/* The Bambino210E only exposes a single set of pins per UART so these are specific to that board. */
if (Token_MatchingString(pParameterTokens, "MRI_UART_MBED_USB"))
pParameters->pUart = &g_uartConfigurations[2];
if (Token_MatchingString(pParameterTokens, "MRI_UART_0"))
pParameters->pUart = &g_uartConfigurations[0];
if (Token_MatchingString(pParameterTokens, "MRI_UART_1"))
pParameters->pUart = &g_uartConfigurations[1];
if (Token_MatchingString(pParameterTokens, "MRI_UART_2"))
pParameters->pUart = &g_uartConfigurations[2];
if (Token_MatchingString(pParameterTokens, "MRI_UART_3"))
pParameters->pUart = &g_uartConfigurations[3];
/* Default to MRI_UART_MBED_USB if nothing else was specified. */
if (!pParameters->pUart)
pParameters->pUart = &g_uartConfigurations[2];
if ((pMatchingPrefix = Token_MatchingStringPrefix(pParameterTokens, baudRatePrefix)) != NULL)
pParameters->baudRate = uint32FromString(pMatchingPrefix + sizeof(baudRatePrefix)-1);
else
pParameters->baudRate = 230400;
}
static void saveUartToBeUsedByDebugger(const UartConfiguration* pUart)
{
mriLpc43xxState.pCurrentUart = pUart;
}
static uint32_t uint32FromString(const char* pString)
{
uint32_t value = 0;
while (*pString)
{
uint32_t digit;
__try
{
digit = getDecimalDigit(*pString++);
}
__catch
{
clearExceptionCode();
break;
}
value = value * 10 + digit;
}
return value;
}
static uint32_t getDecimalDigit(char currChar)
{
if (currChar >= '0' && currChar <= '9')
return currChar - '0';
else
__throw_and_return(invalidDecDigitException, 0);
}
static void configureUartForExclusiveUseOfDebugger(UartParameters* pParameters)
{
setUartPeripheralClockToPLL1();
enableUartClocks();
clearUartFractionalBaudDivisor();
enableUartFifoAndDisableDma();
setUartTo8N1();
setUartBaudRate(pParameters);
selectUartPins();
enableUartToInterruptOnReceivedChar();
configureNVICForUartInterrupt();
}
static void setUartPeripheralClockToPLL1(void)
{
static const uint32_t autoBlockBit = 1 << 11;
static const uint32_t pll1Bit = 0x09 << 24;
LPC_CGU->BASE_CLK[mriLpc43xxState.pCurrentUart->baseClock] = autoBlockBit | pll1Bit;
}
static void enableUartClocks(void)
{
enableCCUClock(mriLpc43xxState.pCurrentUart->registerClock);
enableCCUClock(mriLpc43xxState.pCurrentUart->peripheralClock);
}
static void enableCCUClock(CCU_CLK_T clockToEnable)
{
static const uint32_t runBit = 1 << 0;
if (clockToEnable < CLK_CCU2_START)
LPC_CCU1->CLKCCU[clockToEnable].CFG = runBit;
else
LPC_CCU2->CLKCCU[clockToEnable - CLK_CCU2_START].CFG = runBit;
}
static void clearUartFractionalBaudDivisor(void)
{
mriLpc43xxState.pCurrentUart->pUartRegisters->FDR = 0x10;
}
static void enableUartFifoAndDisableDma(void)
{
static const uint32_t enableFifoDisableDmaSetReceiveInterruptThresholdTo0 = 0x01;
mriLpc43xxState.pCurrentUart->pUartRegisters->FCR = enableFifoDisableDmaSetReceiveInterruptThresholdTo0;
}
static void setUartTo8N1(void)
{
static const uint8_t wordLength8Bit = 0x3;
static const uint8_t stopBit1 = 0 << 2;
static const uint8_t disableParity = 0 << 3;
static const uint8_t lineControlValueFor8N1 = wordLength8Bit | disableParity | stopBit1;
mriLpc43xxState.pCurrentUart->pUartRegisters->LCR = lineControlValueFor8N1;
}
static void setUartBaudRate(UartParameters* pParameters)
{
BaudRateDivisors divisors;
divisors = calculateBaudRateDivisors(pParameters->baudRate, SystemCoreClock);
setDivisors(&divisors);
}
static BaudRateDivisors calculateBaudRateDivisors(uint32_t baudRate, uint32_t peripheralRate)
{
CalculateDivisors calcDivisors;
initCalculateDivisorsStruct(&calcDivisors, baudRate, peripheralRate);
if (isNoFractionalDivisorRequired(&calcDivisors))
return closestDivisors(&calcDivisors);
return calculateFractionalBaudRateDivisors(&calcDivisors);
}
static void initCalculateDivisorsStruct(CalculateDivisors* pThis, uint32_t baudRate, uint32_t peripheralRate)
{
/* Calculate desired clock to baud ratio in 17.15 fixed format.
This code can handle peripheralRates which are less <512MHz since
2^29 / 16 = 2^29 / 2^4 = 2^25 and (2^25 << 7) fits in 32-bit value.
If you divide by a low baud rate like 300 (>2^8) then mantissa only needs 25 - 8 = 17 bits. */
pThis->desiredRatio = ((fixupPeripheralRateFor16XOversampling(peripheralRate) << 7) / baudRate) << 8;
pThis->mul = 1;
pThis->divAdd = 0;
pThis->closestDelta = ~0U;
pThis->closestDivisor = pThis->desiredRatio >> 15;
pThis->closestMul = 1;
pThis->closestDivAdd = 0;
}
static uint32_t fixupPeripheralRateFor16XOversampling(uint32_t actualPeripheralRate)
{
return actualPeripheralRate / 16;
}
static int isNoFractionalDivisorRequired(CalculateDivisors* pThis)
{
/* Check for no fractional bits in the 17.15 fixed format. */
return (pThis->desiredRatio & 0x7FFF) == 0;
}
static BaudRateDivisors closestDivisors(CalculateDivisors* pThis)
{
BaudRateDivisors divisors;
divisors.integerBaudRateDivisor = pThis->closestDivisor;
divisors.fractionalBaudRateDivisor = (pThis->closestMul << 4) | pThis->closestDivAdd;
return divisors;
}
static BaudRateDivisors calculateFractionalBaudRateDivisors(CalculateDivisors* pThis)
{
for (pThis->mul = 1 ; pThis->mul <= 15 ; pThis->mul++)
{
for (pThis->divAdd = 1 ; pThis->divAdd < pThis->mul ; pThis->divAdd++)
checkTheseFractionalDivisors(pThis);
}
return closestDivisors(pThis);
}
static void checkTheseFractionalDivisors(CalculateDivisors* pThis)
{
static const uint32_t fixedOne = (1 << 15);
uint32_t fixedScale;
uint32_t testDivisor;
uint32_t fixedRatio;
uint32_t fixedDelta;
fixedScale = fixedOne + ((pThis->divAdd << 15) / pThis->mul);
testDivisor = pThis->desiredRatio / fixedScale;
fixedRatio = testDivisor * fixedScale;
fixedDelta = abs((int32_t)fixedRatio - (int32_t)pThis->desiredRatio);
if (fixedDelta < pThis->closestDelta)
{
pThis->closestDelta = fixedDelta;
pThis->closestDivisor = testDivisor;
pThis->closestMul = pThis->mul;
pThis->closestDivAdd = pThis->divAdd;
}
}
static void setDivisors(BaudRateDivisors* pDivisors)
{
LPC_USART_T* pUartRegisters = mriLpc43xxState.pCurrentUart->pUartRegisters;
setDivisorLatchBit();
pUartRegisters->DLL = pDivisors->integerBaudRateDivisor & 0xFF;
pUartRegisters->DLM = pDivisors->integerBaudRateDivisor >> 8;
pUartRegisters->FDR = pDivisors->fractionalBaudRateDivisor;
clearDivisorLatchBit();
}
#define LPC176x_UART_LCR_DLAB (1 << 7)
static void setDivisorLatchBit(void)
{
mriLpc43xxState.pCurrentUart->pUartRegisters->LCR |= LPC176x_UART_LCR_DLAB;
}
static void clearDivisorLatchBit(void)
{
mriLpc43xxState.pCurrentUart->pUartRegisters->LCR &= ~LPC176x_UART_LCR_DLAB;
}
static void selectUartPins(void)
{
const UartConfiguration* pUart = mriLpc43xxState.pCurrentUart;
uint32_t txPin = pUart->txPin;
uint32_t rxPin = pUart->rxPin;
LPC_SCU->SFSP[txPin >> 16][txPin & 0xFFFF] = pUart->txFunction;
LPC_SCU->SFSP[rxPin >> 16][rxPin & 0xFFFF] = pUart->rxFunction | SCU_PINIO_PULLNONE;
}
static void enableUartToInterruptOnReceivedChar(void)
{
static const uint32_t baudDivisorLatchBit = (1 << 7);
static const uint32_t enableReceiveDataInterrupt = (1 << 0);
uint32_t originalLCR;
originalLCR = mriLpc43xxState.pCurrentUart->pUartRegisters->LCR;
mriLpc43xxState.pCurrentUart->pUartRegisters->LCR &= ~baudDivisorLatchBit;
mriLpc43xxState.pCurrentUart->pUartRegisters->IER = enableReceiveDataInterrupt;
mriLpc43xxState.pCurrentUart->pUartRegisters->LCR = originalLCR;
}
static void configureNVICForUartInterrupt(void)
{
IRQn_Type uart0BaseIRQ = USART0_IRQn;
IRQn_Type currentUartIRQ;
currentUartIRQ = (IRQn_Type)((int)uart0BaseIRQ + commUartIndex());
mriCortexMSetPriority(currentUartIRQ, 0, 0);
NVIC_EnableIRQ(currentUartIRQ);
}
static int commUartIndex(void)
{
if (mriLpc43xxState.pCurrentUart->pUartRegisters == LPC_USART0)
return 0;
else if (mriLpc43xxState.pCurrentUart->pUartRegisters == LPC_UART1)
return 1;
else if (mriLpc43xxState.pCurrentUart->pUartRegisters == LPC_USART2)
return 2;
else if (mriLpc43xxState.pCurrentUart->pUartRegisters == LPC_USART3)
return 3;
else
return -1;
}
uint32_t Platform_CommHasReceiveData(void)
{
static const uint8_t receiverDataReadyBit = 1 << 0;
return mriLpc43xxState.pCurrentUart->pUartRegisters->LSR & receiverDataReadyBit;
}
uint32_t Platform_CommHasTransmitCompleted(void)
{
static const uint8_t transmitterEmpty = 1 << 6;
return mriLpc43xxState.pCurrentUart->pUartRegisters->LSR & transmitterEmpty;
}
static void waitForUartToReceiveData(void);
int Platform_CommReceiveChar(void)
{
waitForUartToReceiveData();
return (int)mriLpc43xxState.pCurrentUart->pUartRegisters->RBR;
}
static void waitForUartToReceiveData(void)
{
while (!Platform_CommHasReceiveData())
{
}
}
static void waitForUartToAllowTransmit(void);
static uint32_t targetUartCanTransmit(void);
void Platform_CommSendChar(int Character)
{
waitForUartToAllowTransmit();
mriLpc43xxState.pCurrentUart->pUartRegisters->THR = (uint8_t)Character;
}
static void waitForUartToAllowTransmit(void)
{
while (!targetUartCanTransmit())
{
}
}
static uint32_t targetUartCanTransmit(void)
{
static const uint8_t transmitterHoldRegisterEmptyBit = 1 << 5;
return mriLpc43xxState.pCurrentUart->pUartRegisters->LSR & transmitterHoldRegisterEmptyBit;
}
|
835f7c0ef787e5f6371b9b2486abd1dec29efd67
|
59d39d30e3e53b6cc206a83198ac73f8b32ca169
|
/src/hpdf_mmgr.c
|
3069a0552f39ae896966d87816dc5a269471429c
|
[
"Zlib"
] |
permissive
|
libharu/libharu
|
edc87e89643cf5ebfaef718f0868b437a7fc82c1
|
8dbcfe470581edc4bc52c3ef132d410e66cadc20
|
refs/heads/master
| 2023-08-22T09:24:33.029440
| 2022-10-14T10:04:02
| 2022-10-14T10:04:02
| 96,269
| 1,447
| 483
|
Zlib
| 2023-08-18T15:35:44
| 2008-12-24T09:01:25
|
C
|
UTF-8
|
C
| false
| false
| 5,892
|
c
|
hpdf_mmgr.c
|
/*
* << Haru Free PDF Library >> -- hpdf_mmgr.c
*
* URL: http://libharu.org
*
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
* Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
* It is provided "as is" without express or implied warranty.
*
*/
#include "hpdf_conf.h"
#include "hpdf_consts.h"
#include "hpdf_mmgr.h"
#include "hpdf_utils.h"
#ifndef HPDF_STDCALL
#ifdef HPDF_DLL_MAKE
#define HPDF_STDCALL __stdcall
#else
#ifdef HPDF_DLL
#define HPDF_STDCALL __stdcall
#else
#define HPDF_STDCALL
#endif
#endif
#endif
static void * HPDF_STDCALL
InternalGetMem (HPDF_UINT size);
static void HPDF_STDCALL
InternalFreeMem (void* aptr);
HPDF_MMgr
HPDF_MMgr_New (HPDF_Error error,
HPDF_UINT buf_size,
HPDF_Alloc_Func alloc_fn,
HPDF_Free_Func free_fn)
{
HPDF_MMgr mmgr;
HPDF_PTRACE((" HPDF_MMgr_New\n"));
if (alloc_fn)
mmgr = (HPDF_MMgr)alloc_fn (sizeof(HPDF_MMgr_Rec));
else
mmgr = (HPDF_MMgr)InternalGetMem (sizeof(HPDF_MMgr_Rec));
HPDF_PTRACE(("+%p mmgr-new\n", mmgr));
if (mmgr != NULL) {
/* initialize mmgr object */
mmgr->error = error;
#ifdef HPDF_MEM_DEBUG
mmgr->alloc_cnt = 0;
mmgr->free_cnt = 0;
#endif
/*
* if alloc_fn and free_fn are specified, these function is
* used. if not, default function (maybe these will be "malloc" and
* "free") is used.
*/
if (alloc_fn && free_fn) {
mmgr->alloc_fn = alloc_fn;
mmgr->free_fn = free_fn;
} else {
mmgr->alloc_fn = InternalGetMem;
mmgr->free_fn = InternalFreeMem;
}
/*
* if buf_size parameter is specified, this object is configured
* to be using memory-pool.
*
*/
if (!buf_size)
mmgr->mpool = NULL;
else {
HPDF_MPool_Node node;
node = (HPDF_MPool_Node)mmgr->alloc_fn (sizeof(HPDF_MPool_Node_Rec) +
buf_size);
HPDF_PTRACE(("+%p mmgr-node-new\n", node));
if (node == NULL) {
HPDF_SetError (error, HPDF_FAILD_TO_ALLOC_MEM, HPDF_NOERROR);
mmgr->free_fn(mmgr);
mmgr = NULL;
} else {
mmgr->mpool = node;
node->buf = (HPDF_BYTE *)node + sizeof(HPDF_MPool_Node_Rec);
node->size = buf_size;
node->used_size = 0;
node->next_node = NULL;
}
#ifdef HPDF_MEM_DEBUG
if (mmgr) {
mmgr->alloc_cnt += 1;
}
#endif
}
if (mmgr) {
mmgr->buf_size = buf_size;
}
} else
HPDF_SetError(error, HPDF_FAILD_TO_ALLOC_MEM, HPDF_NOERROR);
return mmgr;
}
void
HPDF_MMgr_Free (HPDF_MMgr mmgr)
{
HPDF_MPool_Node node;
HPDF_PTRACE((" HPDF_MMgr_Free\n"));
if (mmgr == NULL)
return;
node = mmgr->mpool;
/* delete all nodes recursively */
while (node != NULL) {
HPDF_MPool_Node tmp = node;
node = tmp->next_node;
HPDF_PTRACE(("-%p mmgr-node-free\n", tmp));
mmgr->free_fn (tmp);
#ifdef HPDF_MEM_DEBUG
mmgr->free_cnt++;
#endif
}
#ifdef HPDF_MEM_DEBUG
HPDF_PRINTF ("# HPDF_MMgr alloc-cnt=%u, free-cnt=%u\n",
mmgr->alloc_cnt, mmgr->free_cnt);
if (mmgr->alloc_cnt != mmgr->free_cnt)
HPDF_PRINTF ("# ERROR #\n");
#endif
HPDF_PTRACE(("-%p mmgr-free\n", mmgr));
mmgr->free_fn (mmgr);
}
void*
HPDF_GetMem (HPDF_MMgr mmgr,
HPDF_UINT size)
{
void * ptr;
if (mmgr->mpool) {
HPDF_MPool_Node node = mmgr->mpool;
#ifdef HPDF_ALINMENT_SIZ
size = (size + (HPDF_ALINMENT_SIZ - 1)) / HPDF_ALINMENT_SIZ;
size *= HPDF_ALINMENT_SIZ;
#endif
if (node->size - node->used_size >= size) {
ptr = (HPDF_BYTE*)node->buf + node->used_size;
node->used_size += size;
return ptr;
} else {
HPDF_UINT tmp_buf_siz = (mmgr->buf_size < size) ? size :
mmgr->buf_size;
node = (HPDF_MPool_Node)mmgr->alloc_fn (sizeof(HPDF_MPool_Node_Rec)
+ tmp_buf_siz);
HPDF_PTRACE(("+%p mmgr-new-node\n", node));
if (!node) {
HPDF_SetError (mmgr->error, HPDF_FAILD_TO_ALLOC_MEM,
HPDF_NOERROR);
return NULL;
}
node->size = tmp_buf_siz;
}
node->next_node = mmgr->mpool;
mmgr->mpool = node;
node->used_size = size;
node->buf = (HPDF_BYTE*)node + sizeof(HPDF_MPool_Node_Rec);
ptr = node->buf;
} else {
ptr = mmgr->alloc_fn (size);
HPDF_PTRACE(("+%p mmgr-alloc_fn size=%u\n", ptr, size));
if (ptr == NULL)
HPDF_SetError (mmgr->error, HPDF_FAILD_TO_ALLOC_MEM, HPDF_NOERROR);
}
#ifdef HPDF_MEM_DEBUG
if (ptr)
mmgr->alloc_cnt++;
#endif
return ptr;
}
void
HPDF_FreeMem (HPDF_MMgr mmgr,
void *aptr)
{
if (!aptr)
return;
if (!mmgr->mpool) {
HPDF_PTRACE(("-%p mmgr-free-mem\n", aptr));
mmgr->free_fn(aptr);
#ifdef HPDF_MEM_DEBUG
mmgr->free_cnt++;
#endif
}
return;
}
static void * HPDF_STDCALL
InternalGetMem (HPDF_UINT size)
{
return HPDF_MALLOC (size);
}
static void HPDF_STDCALL
InternalFreeMem (void* aptr)
{
HPDF_FREE (aptr);
}
|
ad76f833ab2ad790caa9a139058ee2a81bc0c21c
|
d6ad41fd61abf03ecf0d7ed8528cf0814d10712a
|
/platforms/embedded/fomu/include/usb-desc.h
|
6ad6771fa5d52431d1188fcd7e301bcd8b72ef9c
|
[
"MIT"
] |
permissive
|
wasm3/wasm3
|
1a21775d63b3c6b0ac71586cce3146398ad37c2a
|
772f8f4648fcba75f77f894a6050db121e7651a2
|
refs/heads/main
| 2023-08-24T21:46:17.842356
| 2023-03-26T17:23:54
| 2023-03-26T17:23:54
| 212,152,900
| 6,339
| 449
|
MIT
| 2023-08-07T11:27:56
| 2019-10-01T17:06:03
|
C
|
UTF-8
|
C
| false
| false
| 3,099
|
h
|
usb-desc.h
|
/* Teensyduino Core Library
* http://www.pjrc.com/teensy/
* Copyright (c) 2013 PJRC.COM, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* 1. The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 2. If the Software is incorporated into a build system that allows
* selection among a list of target devices, then similar target
* devices manufactured by PJRC.COM must be included in the list of
* target devices and selectable in the same manner.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _usb_desc_h_
#define _usb_desc_h_
#include <stdint.h>
#include <stddef.h>
#include <webusb-defs.h>
struct usb_setup_request {
union {
struct {
uint8_t bmRequestType;
uint8_t bRequest;
};
uint16_t wRequestAndType;
};
uint16_t wValue;
uint16_t wIndex;
uint16_t wLength;
};
struct usb_string_descriptor_struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wString[];
};
#define NUM_USB_BUFFERS 8
#define VENDOR_ID 0x1209 // pid.codes
#define PRODUCT_ID 0x5bf0 // Assigned to Fomu project
#define DEVICE_VER 0x0101 // Bootloader version
#define MANUFACTURER_NAME u"Foosn"
#define MANUFACTURER_NAME_LEN sizeof(MANUFACTURER_NAME)
#define PRODUCT_NAME u"Fomu App " GIT_VERSION
#define PRODUCT_NAME_LEN sizeof(PRODUCT_NAME)
// Microsoft Compatible ID Feature Descriptor
#define MSFT_VENDOR_CODE '~' // Arbitrary, but should be printable ASCII
#define MSFT_WCID_LEN 40
extern const uint8_t usb_microsoft_wcid[MSFT_WCID_LEN];
typedef struct {
uint16_t wValue;
uint16_t length;
const uint8_t *addr;
} usb_descriptor_list_t;
extern const usb_descriptor_list_t usb_descriptor_list[];
// WebUSB Landing page URL descriptor
#define WEBUSB_VENDOR_CODE 2
#ifndef LANDING_PAGE_URL
#define LANDING_PAGE_URL "dfu.tomu.im"
#endif
#define LANDING_PAGE_DESCRIPTOR_SIZE (WEBUSB_DT_URL_DESCRIPTOR_SIZE \
+ sizeof(LANDING_PAGE_URL) - 1)
extern const struct webusb_url_descriptor landing_url_descriptor;
#endif
|
960b3d7a7f3c8705b25ea481e8a1f0c2a8cd9ff4
|
4dbe74e208988015fd7b6cffed86163328c1d35e
|
/src/crt/vcruntime/ehassert.h
|
d1e3a2c55d76b96ac05b814f6eb5c934c76c2f3e
|
[
"MIT",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
MiroKaku/ucxxrt
|
c27abdcdfda7ac71b8781e2b2f65045a2169378c
|
bd8cafa60823afd03a0533f7bcb23171f1565fb1
|
refs/heads/main
| 2023-08-31T03:50:03.968791
| 2023-08-25T13:57:31
| 2023-08-25T13:57:31
| 243,931,531
| 287
| 87
|
MIT
| 2023-07-04T02:31:46
| 2020-02-29T08:24:52
|
C++
|
UTF-8
|
C
| false
| false
| 636
|
h
|
ehassert.h
|
/***
*ehassert.h - our own little versions of the assert macros.
*
* Copyright (c) 1993-2001, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Versions of the assert macros for exception handling.
*
****/
#pragma once
#define EHTRACE_RESET
#define EHTRACE_SAVE_LEVEL
#define EHTRACE_RESTORE_LEVEL(x)
#define EHTRACE_ENTER
#define EHTRACE_ENTER_MSG(x)
#define EHTRACE_ENTER_FMT1(x,y)
#define EHTRACE_ENTER_FMT2(x,y,z)
#define EHTRACE_MSG(x)
#define EHTRACE_FMT1(x,y)
#define EHTRACE_FMT2(x,y,z)
#define EHTRACE_EXCEPT(x) (x)
#define EHTRACE_EXIT
#define EHTRACE_HANDLER_EXIT(x)
#define _VCRT_VERIFY ASSERT
|
7b3393f6991dede4121d9608ed97d8b80b4e9cee
|
de0c523399eaf24544f7c0cbd61fe8d3c69c84f8
|
/utils/argv_fuzzing/argv-fuzz-inl.h
|
cb0af2bc798bb1088b5b510db146724057479efa
|
[
"Apache-2.0"
] |
permissive
|
AFLplusplus/AFLplusplus
|
d45b697b8f2f767d29f4d886a2f9c5bd9ad6c032
|
11a622c63d70c9ca16c9847418b88992139aa892
|
refs/heads/stable
| 2023-09-01T16:24:45.928708
| 2023-08-31T12:51:42
| 2023-08-31T12:51:42
| 189,044,704
| 3,470
| 872
|
Apache-2.0
| 2023-09-13T13:56:14
| 2019-05-28T14:29:06
|
C
|
UTF-8
|
C
| false
| false
| 3,895
|
h
|
argv-fuzz-inl.h
|
/*
american fuzzy lop++ - sample argv fuzzing wrapper
------------------------------------------------
Originally written by Michal Zalewski
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
This file shows a simple way to fuzz command-line parameters with stock
afl-fuzz. To use, add:
#include "/path/to/argv-fuzz-inl.h"
...to the file containing main(), ideally placing it after all the
standard includes. Next, put AFL_INIT_ARGV(); near the very beginning of
main().
This will cause the program to read NUL-delimited input from stdin and
put it in argv[]. Two subsequent NULs terminate the array. Empty
params are encoded as a lone 0x02. Lone 0x02 can't be generated, but
that shouldn't matter in real life.
If you would like to always preserve argv[0], use this instead:
AFL_INIT_SET0("prog_name");
To enable persistent fuzzing, use the AFL_INIT_ARGV_PERSISTENT macro with
buf as argument, or use AFL_INIT_SET0_PERSISTENT("prog_name", buf)
to preserver argv[0]. buf is a pointer to a buffer containing
the input data for the current test case being processed defined as:
unsigned char *buf = __AFL_FUZZ_TESTCASE_BUF;
*/
#ifndef _HAVE_ARGV_FUZZ_INL
#define _HAVE_ARGV_FUZZ_INL
#include <stdlib.h>
#include <unistd.h>
#define AFL_INIT_ARGV() \
do { \
\
argv = afl_init_argv(&argc); \
\
} while (0)
#define AFL_INIT_SET0(_p) \
do { \
\
argv = afl_init_argv(&argc); \
argv[0] = (_p); \
if (!argc) argc = 1; \
\
} while (0)
#define AFL_INIT_ARGV_PERSISTENT(persistent_buff) \
do { \
\
argv = afl_init_argv_persistent(&argc, persistent_buff); \
\
} while (0)
#define AFL_INIT_SET0_PERSISTENT(_p, persistent_buff) \
do { \
\
argv = afl_init_argv_persistent(&argc, persistent_buff); \
argv[0] = (_p); \
if (!argc) argc = 1; \
\
} while (0)
#define MAX_CMDLINE_LEN 100000
#define MAX_CMDLINE_PAR 50000
static char **afl_init_argv(int *argc) {
static char in_buf[MAX_CMDLINE_LEN];
static char *ret[MAX_CMDLINE_PAR];
char *ptr = in_buf;
int rc = 0;
ssize_t num = read(0, in_buf, MAX_CMDLINE_LEN - 2);
if (num < 1) { _exit(1); }
in_buf[num] = '\0';
in_buf[num + 1] = '\0';
while (*ptr && rc < MAX_CMDLINE_PAR) {
ret[rc] = ptr;
if (ret[rc][0] == 0x02 && !ret[rc][1]) ret[rc]++;
rc++;
while (*ptr)
ptr++;
ptr++;
}
*argc = rc;
return ret;
}
static char **afl_init_argv_persistent(int *argc,
unsigned char *persistent_buff) {
static char *ret[MAX_CMDLINE_PAR];
unsigned char *ptr = persistent_buff;
int rc = 0;
while (*ptr && rc < MAX_CMDLINE_PAR) {
ret[rc] = (char *)ptr;
if (ret[rc][0] == 0x02 && !ret[rc][1]) ret[rc]++;
rc++;
while (*ptr)
ptr++;
ptr++;
}
*argc = rc;
return ret;
}
#undef MAX_CMDLINE_LEN
#undef MAX_CMDLINE_PAR
#endif /* !_HAVE_ARGV_FUZZ_INL */
|
8ec29def334451b3f2e3bd4cc3e8b2e740797991
|
e1cddfd754d952134e72dfd03522c5ea4fb6008e
|
/src/vnet/ipsec/ipsec_cli.c
|
6cb9aba4d8ac2fc1c016391ea49b4bbcc6a689ff
|
[
"Apache-2.0"
] |
permissive
|
FDio/vpp
|
0ad30fa1bec2975ffa6b66b45c9f4f32163123b6
|
f234b0d4626d7e686422cc9dfd25958584f4931e
|
refs/heads/master
| 2023-08-31T16:09:04.068646
| 2022-03-14T09:49:15
| 2023-08-31T09:50:00
| 96,556,718
| 1,048
| 630
|
Apache-2.0
| 2023-06-21T05:39:17
| 2017-07-07T16:29:40
|
C
|
UTF-8
|
C
| false
| false
| 26,485
|
c
|
ipsec_cli.c
|
/*
* decap.c : IPSec tunnel support
*
* Copyright (c) 2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vnet/vnet.h>
#include <vnet/api_errno.h>
#include <vnet/ip/ip.h>
#include <vnet/interface.h>
#include <vnet/fib/fib.h>
#include <vnet/ipip/ipip.h>
#include <vnet/ipsec/ipsec.h>
#include <vnet/ipsec/ipsec_tun.h>
static clib_error_t *
set_interface_spd_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
ipsec_main_t *im = &ipsec_main;
u32 sw_if_index = (u32) ~ 0;
u32 spd_id;
int is_add = 1;
clib_error_t *error = NULL;
int err;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
if (unformat
(line_input, "%U %u", unformat_vnet_sw_interface, im->vnet_main,
&sw_if_index, &spd_id))
;
else if (unformat (line_input, "del"))
is_add = 0;
else
{
error = clib_error_return (0, "parse error: '%U'",
format_unformat_error, line_input);
goto done;
}
err = ipsec_set_interface_spd (vm, sw_if_index, spd_id, is_add);
switch (err)
{
case VNET_API_ERROR_SYSCALL_ERROR_1:
error = clib_error_return (0, "no such spd-id");
break;
case VNET_API_ERROR_SYSCALL_ERROR_2:
error = clib_error_return (0, "spd already assigned");
break;
}
done:
unformat_free (line_input);
return error;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (set_interface_spd_command, static) = {
.path = "set interface ipsec spd",
.short_help =
"set interface ipsec spd <int> <id>",
.function = set_interface_spd_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_sa_add_del_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
ipsec_crypto_alg_t crypto_alg;
ipsec_integ_alg_t integ_alg;
ipsec_protocol_t proto;
ipsec_sa_flags_t flags;
clib_error_t *error;
ipsec_key_t ck = { 0 };
ipsec_key_t ik = { 0 };
u32 id, spi, salt, sai;
int i = 0;
u16 udp_src, udp_dst;
int is_add, rv;
u32 m_args = 0;
tunnel_t tun = {};
salt = 0;
error = NULL;
is_add = 0;
flags = IPSEC_SA_FLAG_NONE;
proto = IPSEC_PROTOCOL_ESP;
integ_alg = IPSEC_INTEG_ALG_NONE;
crypto_alg = IPSEC_CRYPTO_ALG_NONE;
udp_src = udp_dst = IPSEC_UDP_PORT_NONE;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "add %u", &id))
{
is_add = 1;
m_args |= 1 << 0;
}
else if (unformat (line_input, "del %u", &id))
{
is_add = 0;
m_args |= 1 << 0;
}
else if (unformat (line_input, "spi %u", &spi))
m_args |= 1 << 1;
else if (unformat (line_input, "salt 0x%x", &salt))
;
else if (unformat (line_input, "esp"))
proto = IPSEC_PROTOCOL_ESP;
else if (unformat (line_input, "ah"))
proto = IPSEC_PROTOCOL_AH;
else if (unformat (line_input, "crypto-key %U",
unformat_ipsec_key, &ck))
;
else if (unformat (line_input, "crypto-alg %U",
unformat_ipsec_crypto_alg, &crypto_alg))
;
else if (unformat (line_input, "integ-key %U", unformat_ipsec_key, &ik))
;
else if (unformat (line_input, "integ-alg %U",
unformat_ipsec_integ_alg, &integ_alg))
;
else if (unformat (line_input, "%U", unformat_tunnel, &tun))
{
flags |= IPSEC_SA_FLAG_IS_TUNNEL;
if (AF_IP6 == tunnel_get_af (&tun))
flags |= IPSEC_SA_FLAG_IS_TUNNEL_V6;
}
else if (unformat (line_input, "udp-src-port %d", &i))
udp_src = i;
else if (unformat (line_input, "udp-dst-port %d", &i))
udp_dst = i;
else if (unformat (line_input, "inbound"))
flags |= IPSEC_SA_FLAG_IS_INBOUND;
else if (unformat (line_input, "use-anti-replay"))
flags |= IPSEC_SA_FLAG_USE_ANTI_REPLAY;
else if (unformat (line_input, "use-esn"))
flags |= IPSEC_SA_FLAG_USE_ESN;
else if (unformat (line_input, "udp-encap"))
flags |= IPSEC_SA_FLAG_UDP_ENCAP;
else if (unformat (line_input, "async"))
flags |= IPSEC_SA_FLAG_IS_ASYNC;
else
{
error = clib_error_return (0, "parse error: '%U'",
format_unformat_error, line_input);
goto done;
}
}
if (!(m_args & 1))
{
error = clib_error_return (0, "missing id");
goto done;
}
if (is_add)
{
if (!(m_args & 2))
{
error = clib_error_return (0, "missing spi");
goto done;
}
rv = ipsec_sa_add_and_lock (id, spi, proto, crypto_alg, &ck, integ_alg,
&ik, flags, clib_host_to_net_u32 (salt),
udp_src, udp_dst, &tun, &sai);
}
else
{
rv = ipsec_sa_unlock_id (id);
}
if (rv)
error = clib_error_return (0, "failed: %d", rv);
done:
unformat_free (line_input);
return error;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_sa_add_del_command, static) = {
.path = "ipsec sa",
.short_help =
"ipsec sa [add|del]",
.function = ipsec_sa_add_del_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_sa_bind_cli (vlib_main_t *vm, unformat_input_t *input,
vlib_cli_command_t *cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
u32 id = ~0;
u32 worker = ~0;
bool bind = 1;
int rv;
clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "unbind"))
bind = 0;
else if (id == ~0 && unformat (line_input, "%u", &id))
;
else if (unformat (line_input, "%u", &worker))
;
else
{
error = clib_error_return (0, "parse error: '%U'",
format_unformat_error, line_input);
goto done;
}
}
if (id == ~0)
{
error = clib_error_return (0, "please specify SA ID");
goto done;
}
if (bind && ~0 == worker)
{
error = clib_error_return (0, "please specify worker to bind to");
goto done;
}
rv = ipsec_sa_bind (id, worker, bind);
switch (rv)
{
case VNET_API_ERROR_INVALID_VALUE:
error = clib_error_return (0, "please specify a valid SA ID");
break;
case VNET_API_ERROR_INVALID_WORKER:
error = clib_error_return (0, "please specify a valid worker index");
break;
}
done:
unformat_free (line_input);
return error;
}
VLIB_CLI_COMMAND (ipsec_sa_bind_cmd, static) = {
.path = "ipsec sa bind",
.short_help = "ipsec sa [unbind] <sa-id> <worker>",
.function = ipsec_sa_bind_cli,
};
static clib_error_t *
ipsec_spd_add_del_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
u32 spd_id = ~0;
int is_add = ~0;
clib_error_t *error = NULL;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "add"))
is_add = 1;
else if (unformat (line_input, "del"))
is_add = 0;
else if (unformat (line_input, "%u", &spd_id))
;
else
{
error = clib_error_return (0, "parse error: '%U'",
format_unformat_error, line_input);
goto done;
}
}
if (spd_id == ~0)
{
error = clib_error_return (0, "please specify SPD ID");
goto done;
}
ipsec_add_del_spd (vm, spd_id, is_add);
done:
unformat_free (line_input);
return error;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_spd_add_del_command, static) = {
.path = "ipsec spd",
.short_help =
"ipsec spd [add|del] <id>",
.function = ipsec_spd_add_del_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_policy_add_del_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
ipsec_policy_t p;
int rv, is_add = 0;
u32 tmp, tmp2, stat_index, local_range_set, remote_range_set;
clib_error_t *error = NULL;
u32 is_outbound;
clib_memset (&p, 0, sizeof (p));
p.lport.stop = p.rport.stop = ~0;
remote_range_set = local_range_set = is_outbound = 0;
p.protocol = IPSEC_POLICY_PROTOCOL_ANY;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "add"))
is_add = 1;
else if (unformat (line_input, "del"))
is_add = 0;
else if (unformat (line_input, "ip6"))
p.is_ipv6 = 1;
else if (unformat (line_input, "spd %u", &p.id))
;
else if (unformat (line_input, "inbound"))
is_outbound = 0;
else if (unformat (line_input, "outbound"))
is_outbound = 1;
else if (unformat (line_input, "priority %d", &p.priority))
;
else if (unformat (line_input, "protocol %u", &tmp))
p.protocol = (u8) tmp;
else
if (unformat
(line_input, "action %U", unformat_ipsec_policy_action,
&p.policy))
{
if (p.policy == IPSEC_POLICY_ACTION_RESOLVE)
{
error = clib_error_return (0, "unsupported action: 'resolve'");
goto done;
}
}
else if (unformat (line_input, "sa %u", &p.sa_id))
;
else if (unformat (line_input, "local-ip-range %U - %U",
unformat_ip4_address, &p.laddr.start.ip4,
unformat_ip4_address, &p.laddr.stop.ip4))
local_range_set = 1;
else if (unformat (line_input, "remote-ip-range %U - %U",
unformat_ip4_address, &p.raddr.start.ip4,
unformat_ip4_address, &p.raddr.stop.ip4))
remote_range_set = 1;
else if (unformat (line_input, "local-ip-range %U - %U",
unformat_ip6_address, &p.laddr.start.ip6,
unformat_ip6_address, &p.laddr.stop.ip6))
{
p.is_ipv6 = 1;
local_range_set = 1;
}
else if (unformat (line_input, "remote-ip-range %U - %U",
unformat_ip6_address, &p.raddr.start.ip6,
unformat_ip6_address, &p.raddr.stop.ip6))
{
p.is_ipv6 = 1;
remote_range_set = 1;
}
else if (unformat (line_input, "local-port-range %u - %u", &tmp, &tmp2))
{
p.lport.start = tmp;
p.lport.stop = tmp2;
}
else
if (unformat (line_input, "remote-port-range %u - %u", &tmp, &tmp2))
{
p.rport.start = tmp;
p.rport.stop = tmp2;
}
else
{
error = clib_error_return (0, "parse error: '%U'",
format_unformat_error, line_input);
goto done;
}
}
if (!remote_range_set)
{
if (p.is_ipv6)
clib_memset (&p.raddr.stop.ip6, 0xff, 16);
else
clib_memset (&p.raddr.stop.ip4, 0xff, 4);
}
if (!local_range_set)
{
if (p.is_ipv6)
clib_memset (&p.laddr.stop.ip6, 0xff, 16);
else
clib_memset (&p.laddr.stop.ip4, 0xff, 4);
}
rv = ipsec_policy_mk_type (is_outbound, p.is_ipv6, p.policy, &p.type);
if (rv)
{
error = clib_error_return (0, "unsupported policy type for:",
" outboud:%s %s action:%U",
(is_outbound ? "yes" : "no"),
(p.is_ipv6 ? "IPv4" : "IPv6"),
format_ipsec_policy_action, p.policy);
goto done;
}
rv = ipsec_add_del_policy (vm, &p, is_add, &stat_index);
if (!rv)
vlib_cli_output (vm, "policy-index:%d", stat_index);
else
vlib_cli_output (vm, "error:%d", rv);
done:
unformat_free (line_input);
return error;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_policy_add_del_command, static) = {
.path = "ipsec policy",
.short_help =
"ipsec policy [add|del] spd <id> priority <n> ",
.function = ipsec_policy_add_del_command_fn,
};
/* *INDENT-ON* */
static void
ipsec_sa_show_all (vlib_main_t * vm, ipsec_main_t * im, u8 detail)
{
u32 sai;
/* *INDENT-OFF* */
pool_foreach_index (sai, ipsec_sa_pool)
{
vlib_cli_output (vm, "%U", format_ipsec_sa, sai,
(detail ? IPSEC_FORMAT_DETAIL : IPSEC_FORMAT_BRIEF));
}
/* *INDENT-ON* */
}
static void
ipsec_spd_show_all (vlib_main_t * vm, ipsec_main_t * im)
{
u32 spdi;
/* *INDENT-OFF* */
pool_foreach_index (spdi, im->spds) {
vlib_cli_output(vm, "%U", format_ipsec_spd, spdi);
}
if (im->output_flow_cache_flag)
{
vlib_cli_output (vm, "%U", format_ipsec_out_spd_flow_cache);
}
if (im->input_flow_cache_flag)
{
vlib_cli_output (vm, "%U", format_ipsec_in_spd_flow_cache);
}
/* *INDENT-ON* */
}
static void
ipsec_spd_bindings_show_all (vlib_main_t * vm, ipsec_main_t * im)
{
u32 spd_id, sw_if_index;
ipsec_spd_t *spd;
vlib_cli_output (vm, "SPD Bindings:");
/* *INDENT-OFF* */
hash_foreach(sw_if_index, spd_id, im->spd_index_by_sw_if_index, ({
spd = pool_elt_at_index (im->spds, spd_id);
vlib_cli_output (vm, " %d -> %U", spd->id,
format_vnet_sw_if_index_name, im->vnet_main,
sw_if_index);
}));
/* *INDENT-ON* */
}
static walk_rc_t
ipsec_tun_protect_show_one (index_t itpi, void *ctx)
{
vlib_cli_output (ctx, "%U", format_ipsec_tun_protect_index, itpi);
return (WALK_CONTINUE);
}
static void
ipsec_tunnel_show_all (vlib_main_t * vm)
{
ipsec_tun_protect_walk (ipsec_tun_protect_show_one, vm);
}
static clib_error_t *
show_ipsec_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
ipsec_main_t *im = &ipsec_main;
ipsec_sa_show_all (vm, im, 0);
ipsec_spd_show_all (vm, im);
ipsec_spd_bindings_show_all (vm, im);
ipsec_tun_protect_walk (ipsec_tun_protect_show_one, vm);
vlib_cli_output (vm, "IPSec async mode: %s",
(im->async_mode ? "on" : "off"));
return 0;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_ipsec_command, static) = {
.path = "show ipsec all",
.short_help = "show ipsec all",
.function = show_ipsec_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
show_ipsec_sa_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
ipsec_main_t *im = &ipsec_main;
u32 sai = ~0;
u8 detail = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "%u", &sai))
;
if (unformat (input, "detail"))
detail = 1;
else
break;
}
if (~0 == sai)
ipsec_sa_show_all (vm, im, detail);
else
vlib_cli_output (vm, "%U", format_ipsec_sa, sai,
IPSEC_FORMAT_DETAIL | IPSEC_FORMAT_INSECURE);
return 0;
}
static clib_error_t *
clear_ipsec_sa_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
u32 sai = ~0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "%u", &sai))
;
else
break;
}
if (~0 == sai)
{
/* *INDENT-OFF* */
pool_foreach_index (sai, ipsec_sa_pool)
{
ipsec_sa_clear (sai);
}
/* *INDENT-ON* */
}
else
{
if (pool_is_free_index (ipsec_sa_pool, sai))
return clib_error_return (0, "unknown SA index: %d", sai);
else
ipsec_sa_clear (sai);
}
return 0;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_ipsec_sa_command, static) = {
.path = "show ipsec sa",
.short_help = "show ipsec sa [index]",
.function = show_ipsec_sa_command_fn,
};
VLIB_CLI_COMMAND (clear_ipsec_sa_command, static) = {
.path = "clear ipsec sa",
.short_help = "clear ipsec sa [index]",
.function = clear_ipsec_sa_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
show_ipsec_spd_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
ipsec_main_t *im = &ipsec_main;
u8 show_bindings = 0;
u32 spdi = ~0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "%u", &spdi))
;
else if (unformat (input, "bindings"))
show_bindings = 1;
else
break;
}
if (show_bindings)
ipsec_spd_bindings_show_all (vm, im);
else if (~0 != spdi)
vlib_cli_output (vm, "%U", format_ipsec_spd, spdi);
else
ipsec_spd_show_all (vm, im);
return 0;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_ipsec_spd_command, static) = {
.path = "show ipsec spd",
.short_help = "show ipsec spd [index]",
.function = show_ipsec_spd_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
show_ipsec_tunnel_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
ipsec_tunnel_show_all (vm);
return 0;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_ipsec_tunnel_command, static) = {
.path = "show ipsec tunnel",
.short_help = "show ipsec tunnel",
.function = show_ipsec_tunnel_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_show_backends_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
ipsec_main_t *im = &ipsec_main;
u32 verbose = 0;
(void) unformat (input, "verbose %u", &verbose);
vlib_cli_output (vm, "IPsec AH backends available:");
u8 *s = format (NULL, "%=25s %=25s %=10s\n", "Name", "Index", "Active");
ipsec_ah_backend_t *ab;
/* *INDENT-OFF* */
pool_foreach (ab, im->ah_backends) {
s = format (s, "%=25s %=25u %=10s\n", ab->name, ab - im->ah_backends,
ab - im->ah_backends == im->ah_current_backend ? "yes" : "no");
if (verbose) {
vlib_node_t *n;
n = vlib_get_node (vm, ab->ah4_encrypt_node_index);
s = format (s, " enc4 %s (next %d)\n", n->name, ab->ah4_encrypt_next_index);
n = vlib_get_node (vm, ab->ah4_decrypt_node_index);
s = format (s, " dec4 %s (next %d)\n", n->name, ab->ah4_decrypt_next_index);
n = vlib_get_node (vm, ab->ah6_encrypt_node_index);
s = format (s, " enc6 %s (next %d)\n", n->name, ab->ah6_encrypt_next_index);
n = vlib_get_node (vm, ab->ah6_decrypt_node_index);
s = format (s, " dec6 %s (next %d)\n", n->name, ab->ah6_decrypt_next_index);
}
}
/* *INDENT-ON* */
vlib_cli_output (vm, "%v", s);
vec_set_len (s, 0);
vlib_cli_output (vm, "IPsec ESP backends available:");
s = format (s, "%=25s %=25s %=10s\n", "Name", "Index", "Active");
ipsec_esp_backend_t *eb;
/* *INDENT-OFF* */
pool_foreach (eb, im->esp_backends) {
s = format (s, "%=25s %=25u %=10s\n", eb->name, eb - im->esp_backends,
eb - im->esp_backends == im->esp_current_backend ? "yes"
: "no");
if (verbose) {
vlib_node_t *n;
n = vlib_get_node (vm, eb->esp4_encrypt_node_index);
s = format (s, " enc4 %s (next %d)\n", n->name, eb->esp4_encrypt_next_index);
n = vlib_get_node (vm, eb->esp4_decrypt_node_index);
s = format (s, " dec4 %s (next %d)\n", n->name, eb->esp4_decrypt_next_index);
n = vlib_get_node (vm, eb->esp6_encrypt_node_index);
s = format (s, " enc6 %s (next %d)\n", n->name, eb->esp6_encrypt_next_index);
n = vlib_get_node (vm, eb->esp6_decrypt_node_index);
s = format (s, " dec6 %s (next %d)\n", n->name, eb->esp6_decrypt_next_index);
}
}
/* *INDENT-ON* */
vlib_cli_output (vm, "%v", s);
vec_free (s);
return 0;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_show_backends_command, static) = {
.path = "show ipsec backends",
.short_help = "show ipsec backends",
.function = ipsec_show_backends_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_select_backend_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
ipsec_main_t *im = &ipsec_main;
clib_error_t *error;
u32 backend_index;
error = ipsec_rsc_in_use (im);
if (error)
return error;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
if (unformat (line_input, "ah"))
{
if (unformat (line_input, "%u", &backend_index))
{
if (ipsec_select_ah_backend (im, backend_index) < 0)
{
return clib_error_return (0, "Invalid AH backend index `%u'",
backend_index);
}
}
else
{
return clib_error_return (0, "Invalid backend index `%U'",
format_unformat_error, line_input);
}
}
else if (unformat (line_input, "esp"))
{
if (unformat (line_input, "%u", &backend_index))
{
if (ipsec_select_esp_backend (im, backend_index) < 0)
{
return clib_error_return (0, "Invalid ESP backend index `%u'",
backend_index);
}
}
else
{
return clib_error_return (0, "Invalid backend index `%U'",
format_unformat_error, line_input);
}
}
else
{
return clib_error_return (0, "Unknown input `%U'",
format_unformat_error, line_input);
}
return 0;
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_select_backend_command, static) = {
.path = "ipsec select backend",
.short_help = "ipsec select backend <ah|esp> <backend index>",
.function = ipsec_select_backend_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
clear_ipsec_counters_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
vlib_clear_combined_counters (&ipsec_spd_policy_counters);
vlib_clear_combined_counters (&ipsec_sa_counters);
for (int i = 0; i < IPSEC_SA_N_ERRORS; i++)
vlib_clear_simple_counters (&ipsec_sa_err_counters[i]);
return (NULL);
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (clear_ipsec_counters_command, static) = {
.path = "clear ipsec counters",
.short_help = "clear ipsec counters",
.function = clear_ipsec_counters_command_fn,
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_tun_protect_cmd (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
u32 sw_if_index, is_del, sa_in, sa_out, *sa_ins = NULL;
ip_address_t peer = { };
vnet_main_t *vnm;
is_del = 0;
sw_if_index = ~0;
vnm = vnet_get_main ();
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "del"))
is_del = 1;
else if (unformat (line_input, "add"))
is_del = 0;
else if (unformat (line_input, "sa-in %d", &sa_in))
vec_add1 (sa_ins, sa_in);
else if (unformat (line_input, "sa-out %d", &sa_out))
;
else if (unformat (line_input, "%U",
unformat_vnet_sw_interface, vnm, &sw_if_index))
;
else if (unformat (line_input, "%U", unformat_ip_address, &peer))
;
else
return (clib_error_return (0, "unknown input '%U'",
format_unformat_error, line_input));
}
if (!is_del)
ipsec_tun_protect_update (sw_if_index, &peer, sa_out, sa_ins);
else
ipsec_tun_protect_del (sw_if_index, &peer);
unformat_free (line_input);
return NULL;
}
/**
* Protect tunnel with IPSEC
*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_tun_protect_cmd_node, static) =
{
.path = "ipsec tunnel protect",
.function = ipsec_tun_protect_cmd,
.short_help = "ipsec tunnel protect <interface> input-sa <SA> output-sa <SA> [add|del]",
// this is not MP safe
};
/* *INDENT-ON* */
static clib_error_t *
ipsec_tun_protect_show (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
ipsec_tun_protect_walk (ipsec_tun_protect_show_one, vm);
return NULL;
}
/**
* show IPSEC tunnel protection
*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_tun_protect_show_node, static) =
{
.path = "show ipsec protect",
.function = ipsec_tun_protect_show,
.short_help = "show ipsec protect",
};
/* *INDENT-ON* */
static int
ipsec_tun_protect4_hash_show_one (clib_bihash_kv_8_16_t * kv, void *arg)
{
ipsec4_tunnel_kv_t *ikv = (ipsec4_tunnel_kv_t *) kv;
vlib_main_t *vm = arg;
vlib_cli_output (vm, " %U", format_ipsec4_tunnel_kv, ikv);
return (BIHASH_WALK_CONTINUE);
}
static int
ipsec_tun_protect6_hash_show_one (clib_bihash_kv_24_16_t * kv, void *arg)
{
ipsec6_tunnel_kv_t *ikv = (ipsec6_tunnel_kv_t *) kv;
vlib_main_t *vm = arg;
vlib_cli_output (vm, " %U", format_ipsec6_tunnel_kv, ikv);
return (BIHASH_WALK_CONTINUE);
}
static clib_error_t *
ipsec_tun_protect_hash_show (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
ipsec_main_t *im = &ipsec_main;
{
vlib_cli_output (vm, "IPv4:");
clib_bihash_foreach_key_value_pair_8_16
(&im->tun4_protect_by_key, ipsec_tun_protect4_hash_show_one, vm);
vlib_cli_output (vm, "IPv6:");
clib_bihash_foreach_key_value_pair_24_16
(&im->tun6_protect_by_key, ipsec_tun_protect6_hash_show_one, vm);
}
return NULL;
}
/**
* show IPSEC tunnel protection hash tables
*/
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (ipsec_tun_protect_hash_show_node, static) =
{
.path = "show ipsec protect-hash",
.function = ipsec_tun_protect_hash_show,
.short_help = "show ipsec protect-hash",
};
/* *INDENT-ON* */
clib_error_t *
ipsec_cli_init (vlib_main_t * vm)
{
return 0;
}
VLIB_INIT_FUNCTION (ipsec_cli_init);
static clib_error_t *
set_async_mode_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
int async_enable = 0;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "on"))
async_enable = 1;
else if (unformat (line_input, "off"))
async_enable = 0;
else
return (clib_error_return (0, "unknown input '%U'",
format_unformat_error, line_input));
}
ipsec_set_async_mode (async_enable);
unformat_free (line_input);
return (NULL);
}
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (set_async_mode_command, static) = {
.path = "set ipsec async mode",
.short_help = "set ipsec async mode on|off",
.function = set_async_mode_command_fn,
};
/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|
b68d843823bfa10eb1018a311c2564b6896ff871
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/usr.bin/ldap/ldapclient.c
|
a2cfb134f62819af22aeae214ce272e16ff1a8b3
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 18,903
|
c
|
ldapclient.c
|
/* $OpenBSD: ldapclient.c,v 1.13 2021/09/02 21:09:29 deraadt Exp $ */
/*
* Copyright (c) 2018 Reyk Floeter <reyk@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/tree.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <event.h>
#include <fcntl.h>
#include <limits.h>
#include <netdb.h>
#include <pwd.h>
#include <readpassphrase.h>
#include <resolv.h>
#include <signal.h>
#include <string.h>
#include <vis.h>
#include "aldap.h"
#include "log.h"
#define F_STARTTLS 0x01
#define F_TLS 0x02
#define F_NEEDAUTH 0x04
#define F_LDIF 0x08
#define LDAPHOST "localhost"
#define LDAPFILTER "(objectClass=*)"
#define LDIF_LINELENGTH 79
#define LDAPPASSMAX 1024
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
struct ldapc {
struct aldap *ldap_al;
char *ldap_host;
int ldap_port;
const char *ldap_capath;
char *ldap_binddn;
char *ldap_secret;
unsigned int ldap_flags;
enum protocol_op ldap_req;
enum aldap_protocol ldap_protocol;
struct aldap_url ldap_url;
};
struct ldapc_search {
int ls_sizelimit;
int ls_timelimit;
char *ls_basedn;
char *ls_filter;
int ls_scope;
char **ls_attr;
};
__dead void usage(void);
int ldapc_connect(struct ldapc *);
int ldapc_search(struct ldapc *, struct ldapc_search *);
int ldapc_printattr(struct ldapc *, const char *,
const struct ber_octetstring *);
void ldapc_disconnect(struct ldapc *);
int ldapc_parseurl(struct ldapc *, struct ldapc_search *,
const char *);
const char *ldapc_resultcode(enum result_code);
const char *url_decode(char *);
__dead void
usage(void)
{
extern char *__progname;
fprintf(stderr,
"usage: %s search [-LvWxZ] [-b basedn] [-c CAfile] [-D binddn] [-H host]\n"
" [-l timelimit] [-s scope] [-w secret] [-y secretfile] [-z sizelimit]\n"
" [filter] [attributes ...]\n",
__progname);
exit(1);
}
int
main(int argc, char *argv[])
{
char passbuf[LDAPPASSMAX];
const char *errstr, *url = NULL, *secretfile = NULL;
struct stat st;
struct ldapc ldap;
struct ldapc_search ls;
int ch;
int verbose = 1;
FILE *fp;
if (pledge("stdio inet unix tty rpath dns", NULL) == -1)
err(1, "pledge");
log_init(verbose, 0);
memset(&ldap, 0, sizeof(ldap));
memset(&ls, 0, sizeof(ls));
ls.ls_scope = -1;
ldap.ldap_port = -1;
/*
* Check the command. Currently only "search" is supported but
* it could be extended with others such as add, modify, or delete.
*/
if (argc < 2)
usage();
else if (strcmp("search", argv[1]) == 0)
ldap.ldap_req = LDAP_REQ_SEARCH;
else
usage();
argc--;
argv++;
while ((ch = getopt(argc, argv, "b:c:D:H:Ll:s:vWw:xy:Zz:")) != -1) {
switch (ch) {
case 'b':
ls.ls_basedn = optarg;
break;
case 'c':
ldap.ldap_capath = optarg;
break;
case 'D':
ldap.ldap_binddn = optarg;
ldap.ldap_flags |= F_NEEDAUTH;
break;
case 'H':
url = optarg;
break;
case 'L':
ldap.ldap_flags |= F_LDIF;
break;
case 'l':
ls.ls_timelimit = strtonum(optarg, 0, INT_MAX,
&errstr);
if (errstr != NULL)
errx(1, "timelimit %s", errstr);
break;
case 's':
if (strcasecmp("base", optarg) == 0)
ls.ls_scope = LDAP_SCOPE_BASE;
else if (strcasecmp("one", optarg) == 0)
ls.ls_scope = LDAP_SCOPE_ONELEVEL;
else if (strcasecmp("sub", optarg) == 0)
ls.ls_scope = LDAP_SCOPE_SUBTREE;
else
errx(1, "invalid scope: %s", optarg);
break;
case 'v':
verbose++;
break;
case 'w':
ldap.ldap_secret = optarg;
ldap.ldap_flags |= F_NEEDAUTH;
break;
case 'W':
ldap.ldap_flags |= F_NEEDAUTH;
break;
case 'x':
/* provided for compatibility */
break;
case 'y':
secretfile = optarg;
ldap.ldap_flags |= F_NEEDAUTH;
break;
case 'Z':
ldap.ldap_flags |= F_STARTTLS;
break;
case 'z':
ls.ls_sizelimit = strtonum(optarg, 0, INT_MAX,
&errstr);
if (errstr != NULL)
errx(1, "sizelimit %s", errstr);
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
log_setverbose(verbose);
if (url != NULL && ldapc_parseurl(&ldap, &ls, url) == -1)
errx(1, "ldapurl");
/* Set the default after parsing URL and/or options */
if (ldap.ldap_host == NULL)
ldap.ldap_host = LDAPHOST;
if (ldap.ldap_port == -1)
ldap.ldap_port = ldap.ldap_protocol == LDAPS ?
LDAPS_PORT : LDAP_PORT;
if (ldap.ldap_protocol == LDAP && (ldap.ldap_flags & F_STARTTLS))
ldap.ldap_protocol = LDAPTLS;
if (ldap.ldap_capath == NULL)
ldap.ldap_capath = tls_default_ca_cert_file();
if (ls.ls_basedn == NULL)
ls.ls_basedn = "";
if (ls.ls_scope == -1)
ls.ls_scope = LDAP_SCOPE_SUBTREE;
if (ls.ls_filter == NULL)
ls.ls_filter = LDAPFILTER;
if (ldap.ldap_flags & F_NEEDAUTH) {
if (ldap.ldap_binddn == NULL) {
log_warnx("missing -D binddn");
usage();
}
if (secretfile != NULL) {
if (ldap.ldap_secret != NULL)
errx(1, "conflicting -w/-y options");
/* read password from stdin or file (first line) */
if (strcmp(secretfile, "-") == 0)
fp = stdin;
else if (stat(secretfile, &st) == -1)
err(1, "failed to access %s", secretfile);
else if (S_ISREG(st.st_mode) && (st.st_mode & S_IROTH))
errx(1, "%s is world-readable", secretfile);
else if ((fp = fopen(secretfile, "r")) == NULL)
err(1, "failed to open %s", secretfile);
if (fgets(passbuf, sizeof(passbuf), fp) == NULL)
err(1, "failed to read %s", secretfile);
if (fp != stdin)
fclose(fp);
passbuf[strcspn(passbuf, "\n")] = '\0';
ldap.ldap_secret = passbuf;
}
if (ldap.ldap_secret == NULL) {
if (readpassphrase("Password: ",
passbuf, sizeof(passbuf), RPP_REQUIRE_TTY) == NULL)
errx(1, "failed to read LDAP password");
ldap.ldap_secret = passbuf;
}
}
if (pledge("stdio inet unix rpath dns", NULL) == -1)
err(1, "pledge");
/* optional search filter */
if (argc && strchr(argv[0], '=') != NULL) {
ls.ls_filter = argv[0];
argc--;
argv++;
}
/* search attributes */
if (argc)
ls.ls_attr = argv;
if (ldapc_connect(&ldap) == -1)
errx(1, "LDAP connection failed");
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
if (ldapc_search(&ldap, &ls) == -1)
errx(1, "LDAP search failed");
ldapc_disconnect(&ldap);
aldap_free_url(&ldap.ldap_url);
return (0);
}
int
ldapc_search(struct ldapc *ldap, struct ldapc_search *ls)
{
struct aldap_page_control *pg = NULL;
struct aldap_message *m;
const char *errstr;
const char *searchdn, *dn = NULL;
char *outkey;
struct aldap_stringset *outvalues;
int ret, code, fail = 0;
size_t i;
if (ldap->ldap_flags & F_LDIF)
printf("version: 1\n");
do {
if (aldap_search(ldap->ldap_al, ls->ls_basedn, ls->ls_scope,
ls->ls_filter, ls->ls_attr, 0, ls->ls_sizelimit,
ls->ls_timelimit, pg) == -1) {
aldap_get_errno(ldap->ldap_al, &errstr);
log_warnx("LDAP search failed: %s", errstr);
return (-1);
}
if (pg != NULL) {
aldap_freepage(pg);
pg = NULL;
}
while ((m = aldap_parse(ldap->ldap_al)) != NULL) {
if (ldap->ldap_al->msgid != m->msgid) {
goto fail;
}
if ((code = aldap_get_resultcode(m)) != LDAP_SUCCESS) {
log_warnx("LDAP search failed: %s(%d)",
ldapc_resultcode(code), code);
break;
}
if (m->message_type == LDAP_RES_SEARCH_RESULT) {
if (m->page != NULL && m->page->cookie_len != 0)
pg = m->page;
else
pg = NULL;
aldap_freemsg(m);
break;
}
if (m->message_type != LDAP_RES_SEARCH_ENTRY) {
goto fail;
}
if (aldap_count_attrs(m) < 1) {
aldap_freemsg(m);
continue;
}
if ((searchdn = aldap_get_dn(m)) == NULL)
goto fail;
if (dn != NULL)
printf("\n");
else
dn = ls->ls_basedn;
if (strcmp(dn, searchdn) != 0)
printf("dn: %s\n", searchdn);
for (ret = aldap_first_attr(m, &outkey, &outvalues);
ret != -1;
ret = aldap_next_attr(m, &outkey, &outvalues)) {
for (i = 0; i < outvalues->len; i++) {
if (ldapc_printattr(ldap, outkey,
&(outvalues->str[i])) == -1) {
fail = 1;
break;
}
}
}
free(outkey);
aldap_free_attr(outvalues);
aldap_freemsg(m);
}
} while (pg != NULL && fail == 0);
if (fail)
return (-1);
return (0);
fail:
ldapc_disconnect(ldap);
return (-1);
}
int
ldapc_printattr(struct ldapc *ldap, const char *key,
const struct ber_octetstring *value)
{
char *p = NULL, *out;
const unsigned char *cp;
int encode;
size_t i, inlen, outlen, left;
if (ldap->ldap_flags & F_LDIF) {
/* OpenLDAP encodes the userPassword by default */
if (strcasecmp("userPassword", key) == 0)
encode = 1;
else
encode = 0;
/*
* The LDIF format a set of characters that can be included
* in SAFE-STRINGs. String value that do not match the
* criteria must be encoded as Base64.
*/
cp = (const unsigned char *)value->ostr_val;
/* !SAFE-INIT-CHAR: SAFE-CHAR minus %x20 %x3A %x3C */
if (*cp == ' ' ||
*cp == ':' ||
*cp == '<')
encode = 1;
for (i = 0; encode == 0 && i < value->ostr_len - 1; i++) {
/* !SAFE-CHAR %x01-09 / %x0B-0C / %x0E-7F */
if (cp[i] > 127 ||
cp[i] == '\0' ||
cp[i] == '\n' ||
cp[i] == '\r')
encode = 1;
}
if (!encode) {
if (asprintf(&p, "%s: %s", key,
(const char *)value->ostr_val) == -1) {
log_warnx("asprintf");
return (-1);
}
} else {
outlen = (((value->ostr_len + 2) / 3) * 4) + 1;
if ((out = calloc(1, outlen)) == NULL ||
b64_ntop(value->ostr_val, value->ostr_len, out,
outlen) == -1) {
log_warnx("Base64 encoding failed");
free(p);
return (-1);
}
/* Base64 is indicated with a double-colon */
if (asprintf(&p, "%s:: %s", key, out) == -1) {
log_warnx("asprintf");
free(out);
return (-1);
}
free(out);
}
/* Wrap lines */
for (outlen = 0, inlen = strlen(p);
outlen < inlen;
outlen += LDIF_LINELENGTH - 1) {
if (outlen)
putchar(' ');
if (outlen > LDIF_LINELENGTH)
outlen--;
/* max. line length - newline - optional indent */
left = MINIMUM(inlen - outlen, outlen ?
LDIF_LINELENGTH - 2 :
LDIF_LINELENGTH - 1);
fwrite(p + outlen, left, 1, stdout);
putchar('\n');
}
} else {
/*
* Use vis(1) instead of base64 encoding of non-printable
* values. This is much nicer as it always prdocues a
* human-readable visual output. This can safely be done
* on all values no matter if they include non-printable
* characters.
*/
p = calloc(1, 4 * value->ostr_len + 1);
if (strvisx(p, value->ostr_val, value->ostr_len,
VIS_SAFE|VIS_NL) == -1) {
log_warn("visual encoding failed");
return (-1);
}
printf("%s: %s\n", key, p);
}
free(p);
return (0);
}
int
ldapc_connect(struct ldapc *ldap)
{
struct addrinfo ai, *res, *res0;
struct sockaddr_un un;
int ret = -1, saved_errno, fd = -1, code;
struct aldap_message *m;
const char *errstr;
struct tls_config *tls_config;
char port[6];
if (ldap->ldap_protocol == LDAPI) {
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;
if (strlcpy(un.sun_path, ldap->ldap_host,
sizeof(un.sun_path)) >= sizeof(un.sun_path)) {
log_warnx("socket '%s' too long", ldap->ldap_host);
goto done;
}
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1 ||
connect(fd, (struct sockaddr *)&un, sizeof(un)) == -1)
goto done;
goto init;
}
memset(&ai, 0, sizeof(ai));
ai.ai_family = AF_UNSPEC;
ai.ai_socktype = SOCK_STREAM;
ai.ai_protocol = IPPROTO_TCP;
(void)snprintf(port, sizeof(port), "%u", ldap->ldap_port);
if ((code = getaddrinfo(ldap->ldap_host, port,
&ai, &res0)) != 0) {
log_warnx("%s", gai_strerror(code));
goto done;
}
for (res = res0; res; res = res->ai_next, fd = -1) {
if ((fd = socket(res->ai_family, res->ai_socktype,
res->ai_protocol)) == -1)
continue;
if (connect(fd, res->ai_addr, res->ai_addrlen) >= 0)
break;
saved_errno = errno;
close(fd);
errno = saved_errno;
}
freeaddrinfo(res0);
if (fd == -1)
goto done;
init:
if ((ldap->ldap_al = aldap_init(fd)) == NULL) {
warn("LDAP init failed");
close(fd);
goto done;
}
if (ldap->ldap_flags & F_STARTTLS) {
log_debug("%s: requesting STARTTLS", __func__);
if (aldap_req_starttls(ldap->ldap_al) == -1) {
log_warnx("failed to request STARTTLS");
goto done;
}
if ((m = aldap_parse(ldap->ldap_al)) == NULL) {
log_warnx("failed to parse STARTTLS response");
goto done;
}
if (ldap->ldap_al->msgid != m->msgid ||
(code = aldap_get_resultcode(m)) != LDAP_SUCCESS) {
log_warnx("STARTTLS failed: %s(%d)",
ldapc_resultcode(code), code);
aldap_freemsg(m);
goto done;
}
aldap_freemsg(m);
}
if (ldap->ldap_flags & (F_STARTTLS | F_TLS)) {
log_debug("%s: starting TLS", __func__);
if ((tls_config = tls_config_new()) == NULL) {
log_warnx("TLS config failed");
goto done;
}
if (tls_config_set_ca_file(tls_config,
ldap->ldap_capath) == -1) {
log_warnx("unable to set CA %s", ldap->ldap_capath);
goto done;
}
if (aldap_tls(ldap->ldap_al, tls_config, ldap->ldap_host) < 0) {
aldap_get_errno(ldap->ldap_al, &errstr);
log_warnx("TLS failed: %s", errstr);
goto done;
}
}
if (ldap->ldap_flags & F_NEEDAUTH) {
log_debug("%s: bind request", __func__);
if (aldap_bind(ldap->ldap_al, ldap->ldap_binddn,
ldap->ldap_secret) == -1) {
log_warnx("bind request failed");
goto done;
}
if ((m = aldap_parse(ldap->ldap_al)) == NULL) {
log_warnx("failed to parse bind response");
goto done;
}
if (ldap->ldap_al->msgid != m->msgid ||
(code = aldap_get_resultcode(m)) != LDAP_SUCCESS) {
log_warnx("bind failed: %s(%d)",
ldapc_resultcode(code), code);
aldap_freemsg(m);
goto done;
}
aldap_freemsg(m);
}
log_debug("%s: connected", __func__);
ret = 0;
done:
if (ret != 0)
ldapc_disconnect(ldap);
if (ldap->ldap_secret != NULL)
explicit_bzero(ldap->ldap_secret,
strlen(ldap->ldap_secret));
return (ret);
}
void
ldapc_disconnect(struct ldapc *ldap)
{
if (ldap->ldap_al == NULL)
return;
aldap_close(ldap->ldap_al);
ldap->ldap_al = NULL;
}
const char *
ldapc_resultcode(enum result_code code)
{
#define CODE(_X) case _X:return (#_X)
switch (code) {
CODE(LDAP_SUCCESS);
CODE(LDAP_OPERATIONS_ERROR);
CODE(LDAP_PROTOCOL_ERROR);
CODE(LDAP_TIMELIMIT_EXCEEDED);
CODE(LDAP_SIZELIMIT_EXCEEDED);
CODE(LDAP_COMPARE_FALSE);
CODE(LDAP_COMPARE_TRUE);
CODE(LDAP_STRONG_AUTH_NOT_SUPPORTED);
CODE(LDAP_STRONG_AUTH_REQUIRED);
CODE(LDAP_REFERRAL);
CODE(LDAP_ADMINLIMIT_EXCEEDED);
CODE(LDAP_UNAVAILABLE_CRITICAL_EXTENSION);
CODE(LDAP_CONFIDENTIALITY_REQUIRED);
CODE(LDAP_SASL_BIND_IN_PROGRESS);
CODE(LDAP_NO_SUCH_ATTRIBUTE);
CODE(LDAP_UNDEFINED_TYPE);
CODE(LDAP_INAPPROPRIATE_MATCHING);
CODE(LDAP_CONSTRAINT_VIOLATION);
CODE(LDAP_TYPE_OR_VALUE_EXISTS);
CODE(LDAP_INVALID_SYNTAX);
CODE(LDAP_NO_SUCH_OBJECT);
CODE(LDAP_ALIAS_PROBLEM);
CODE(LDAP_INVALID_DN_SYNTAX);
CODE(LDAP_ALIAS_DEREF_PROBLEM);
CODE(LDAP_INAPPROPRIATE_AUTH);
CODE(LDAP_INVALID_CREDENTIALS);
CODE(LDAP_INSUFFICIENT_ACCESS);
CODE(LDAP_BUSY);
CODE(LDAP_UNAVAILABLE);
CODE(LDAP_UNWILLING_TO_PERFORM);
CODE(LDAP_LOOP_DETECT);
CODE(LDAP_NAMING_VIOLATION);
CODE(LDAP_OBJECT_CLASS_VIOLATION);
CODE(LDAP_NOT_ALLOWED_ON_NONLEAF);
CODE(LDAP_NOT_ALLOWED_ON_RDN);
CODE(LDAP_ALREADY_EXISTS);
CODE(LDAP_NO_OBJECT_CLASS_MODS);
CODE(LDAP_AFFECTS_MULTIPLE_DSAS);
CODE(LDAP_OTHER);
default:
return ("UNKNOWN_ERROR");
}
};
int
ldapc_parseurl(struct ldapc *ldap, struct ldapc_search *ls, const char *url)
{
struct aldap_url *lu = &ldap->ldap_url;
size_t i;
memset(lu, 0, sizeof(*lu));
lu->scope = -1;
if (aldap_parse_url(url, lu) == -1) {
log_warnx("failed to parse LDAP URL");
return (-1);
}
/* The protocol part is optional and we default to ldap:// */
if (lu->protocol == -1)
lu->protocol = LDAP;
else if (lu->protocol == LDAPI) {
if (lu->port != 0 ||
url_decode(lu->host) == NULL) {
log_warnx("invalid ldapi:// URL");
return (-1);
}
} else if ((ldap->ldap_flags & F_STARTTLS) &&
lu->protocol != LDAPTLS) {
log_warnx("conflicting protocol arguments");
return (-1);
} else if (lu->protocol == LDAPTLS)
ldap->ldap_flags |= F_TLS|F_STARTTLS;
else if (lu->protocol == LDAPS)
ldap->ldap_flags |= F_TLS;
ldap->ldap_protocol = lu->protocol;
ldap->ldap_host = lu->host;
if (lu->port)
ldap->ldap_port = lu->port;
/* The distinguished name has to be URL-encoded */
if (lu->dn != NULL && ls->ls_basedn != NULL &&
strcasecmp(ls->ls_basedn, lu->dn) != 0) {
log_warnx("conflicting basedn arguments");
return (-1);
}
if (lu->dn != NULL) {
if (url_decode(lu->dn) == NULL)
return (-1);
ls->ls_basedn = lu->dn;
}
if (lu->scope != -1) {
if (ls->ls_scope != -1 && (ls->ls_scope != lu->scope)) {
log_warnx("conflicting scope arguments");
return (-1);
}
ls->ls_scope = lu->scope;
}
/* URL-decode optional attributes and the search filter */
if (lu->attributes[0] != NULL) {
for (i = 0; i < MAXATTR && lu->attributes[i] != NULL; i++)
if (url_decode(lu->attributes[i]) == NULL)
return (-1);
ls->ls_attr = lu->attributes;
}
if (lu->filter != NULL) {
if (url_decode(lu->filter) == NULL)
return (-1);
ls->ls_filter = lu->filter;
}
return (0);
}
/* From usr.sbin/httpd/httpd.c */
const char *
url_decode(char *url)
{
char *p, *q;
char hex[3];
unsigned long x;
hex[2] = '\0';
p = q = url;
while (*p != '\0') {
switch (*p) {
case '%':
/* Encoding character is followed by two hex chars */
if (!(isxdigit((unsigned char)p[1]) &&
isxdigit((unsigned char)p[2])))
return (NULL);
hex[0] = p[1];
hex[1] = p[2];
/*
* We don't have to validate "hex" because it is
* guaranteed to include two hex chars followed by nul.
*/
x = strtoul(hex, NULL, 16);
*q = (char)x;
p += 2;
break;
default:
*q = *p;
break;
}
p++;
q++;
}
*q = '\0';
return (url);
}
|
bcda36687200b257ae441fbd2208fff2a6eb0a3e
|
549f66608f0cb4e50cee2e51c53206e798ab82cd
|
/test/Feature/GetValue.c
|
d2b046f4fd34ab148bbed406ecd759ff6445aad2
|
[
"NCSA"
] |
permissive
|
klee/klee
|
c8da2f9668ee199af47cd2c784cea979017d7704
|
7082eafd05b4f268132ab94772c0243dbebf5087
|
refs/heads/master
| 2023-08-04T08:10:38.619540
| 2023-06-23T21:34:12
| 2023-07-21T09:00:02
| 11,568,417
| 2,339
| 679
|
NOASSERTION
| 2023-09-11T10:23:26
| 2013-07-21T22:03:03
|
C++
|
UTF-8
|
C
| false
| false
| 400
|
c
|
GetValue.c
|
// RUN: %clang -emit-llvm -c -o %t1.bc %s
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
#include <stdio.h>
#include <assert.h>
int main() {
int x = klee_int("x");
klee_assume(x > 10);
klee_assume(x < 20);
assert(!klee_is_symbolic(klee_get_value_i32(x)));
assert(klee_get_value_i32(x) > 10);
assert(klee_get_value_i32(x) < 20);
return 0;
}
|
820659b457d3e3cc57a4e964c36e4b1f7143c3d8
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/comms/java-simple-serial-connector/files/patch-src_cpp_jssc__SerialNativeInterface.h
|
a8d47509d3222fb12742e27bf6364ff15036f85a
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 544
|
h
|
patch-src_cpp_jssc__SerialNativeInterface.h
|
--- src/cpp/jssc_SerialNativeInterface.h.orig 2016-10-24 19:47:55 UTC
+++ src/cpp/jssc_SerialNativeInterface.h
@@ -43,6 +43,8 @@ extern "C" {
#define jssc_SerialNativeInterface_OS_SOLARIS 2L
#undef jssc_SerialNativeInterface_OS_MAC_OS_X
#define jssc_SerialNativeInterface_OS_MAC_OS_X 3L
+#undef jssc_SerialNativeInterface_OS_FREEBSD
+#define jssc_SerialNativeInterface_OS_FREEBSD 4L
#undef jssc_SerialNativeInterface_ERR_PORT_BUSY
#define jssc_SerialNativeInterface_ERR_PORT_BUSY -1LL
#undef jssc_SerialNativeInterface_ERR_PORT_NOT_FOUND
|
c61820caa94e6a446e290fb2bebbe1f3f627e93f
|
736e760612f2b431c4b2524fe1a4a8e4083c72a1
|
/libmov/source/mov-mdhd.c
|
26833dd87c3cd0d8779436d206e8e3bd84fee67d
|
[
"MIT"
] |
permissive
|
ireader/media-server
|
7f86da8ff0c8694876a2043d50a1260f315dad8a
|
3d8647f50fe832856f42b03d1e5b0fe2eafe5796
|
refs/heads/master
| 2023-09-03T17:53:13.722595
| 2023-09-02T03:38:19
| 2023-09-02T03:38:19
| 15,598,496
| 2,785
| 1,015
|
MIT
| 2023-08-30T03:45:24
| 2014-01-03T01:43:35
|
C
|
UTF-8
|
C
| false
| false
| 2,219
|
c
|
mov-mdhd.c
|
#include "mov-internal.h"
#include <assert.h>
// 8.4.2 Media Header Box (p35)
// Box Type: 'mdhd'
// Container: Media Box ('mdia')
// Mandatory: Yes
// Quantity: Exactly one
/*
aligned(8) class MediaHeaderBox extends FullBox('mdhd', version, 0) {
if (version==1) {
unsigned int(64) creation_time;
unsigned int(64) modification_time;
unsigned int(32) timescale;
unsigned int(64) duration;
} else { // version==0
unsigned int(32) creation_time;
unsigned int(32) modification_time;
unsigned int(32) timescale;
unsigned int(32) duration;
}
bit(1) pad = 0;
unsigned int(5)[3] language; // ISO-639-2/T language code
unsigned int(16) pre_defined = 0;
}
*/
int mov_read_mdhd(struct mov_t* mov, const struct mov_box_t* box)
{
uint32_t val;
struct mov_mdhd_t* mdhd = &mov->track->mdhd;
mdhd->version = mov_buffer_r8(&mov->io);
mdhd->flags = mov_buffer_r24(&mov->io);
if (1 == mdhd->version)
{
mdhd->creation_time = mov_buffer_r64(&mov->io);
mdhd->modification_time = mov_buffer_r64(&mov->io);
mdhd->timescale = mov_buffer_r32(&mov->io);
mdhd->duration = mov_buffer_r64(&mov->io);
}
else
{
assert(0 == mdhd->version);
mdhd->creation_time = mov_buffer_r32(&mov->io);
mdhd->modification_time = mov_buffer_r32(&mov->io);
mdhd->timescale = mov_buffer_r32(&mov->io);
mdhd->duration = mov_buffer_r32(&mov->io);
}
val = mov_buffer_r32(&mov->io);
mdhd->language = (val >> 16) & 0x7FFF;
mdhd->pre_defined = val & 0xFFFF;
(void)box;
return mov_buffer_error(&mov->io);
}
size_t mov_write_mdhd(const struct mov_t* mov)
{
const struct mov_mdhd_t* mdhd = &mov->track->mdhd;
mov_buffer_w32(&mov->io, 32); /* size */
mov_buffer_write(&mov->io, "mdhd", 4);
mov_buffer_w32(&mov->io, 0); /* version 1 & flags */
mov_buffer_w32(&mov->io, (uint32_t)mdhd->creation_time); /* creation_time */
mov_buffer_w32(&mov->io, (uint32_t)mdhd->modification_time); /* modification_time */
mov_buffer_w32(&mov->io, mdhd->timescale); /* timescale */
mov_buffer_w32(&mov->io, (uint32_t)mdhd->duration); /* duration */
mov_buffer_w16(&mov->io, (uint16_t)mdhd->language); /* ISO-639-2/T language code */
mov_buffer_w16(&mov->io, 0); /* pre_defined (quality) */
return 32;
}
|
98cfe77101e5db06eaea860a9fc78d69bd21cacb
|
f35e35ec94ad455ffb8e327beca5c1067a34f559
|
/bdr_locks.c
|
c613f5232278111e44953aa6ce39af0ff64c98dd
|
[] |
no_license
|
2ndQuadrant/bdr
|
8c0600ab226988a38f4af438eeb5fd4c0a30e879
|
3577b71296c29301fb331caccd07b7628480454b
|
refs/heads/bdr-plugin/REL1_0_STABLE
| 2023-03-08T23:56:49.350387
| 2019-11-13T13:08:52
| 2019-11-13T13:08:52
| 31,722,200
| 394
| 87
| null | 2019-02-18T03:13:54
| 2015-03-05T16:00:54
|
C
|
UTF-8
|
C
| false
| false
| 52,853
|
c
|
bdr_locks.c
|
/* -------------------------------------------------------------------------
*
* bdr_locks.c
* global ddl/dml interlocking locks
*
*
* Copyright (C) 2014-2015, PostgreSQL Global Development Group
*
* NOTES
*
* A relatively simple distributed DDL locking implementation:
*
* Locks are acquired on a database granularity and can only be held by a
* single node. That choice was made to reduce both, the complexity of the
* implementation, and to reduce the likelihood of inter node deadlocks.
*
* Because DDL locks have to acquired inside transactions the inter node
* communication can't be done via a queue table streamed out via logical
* decoding - other nodes would only see the result once the the
* transaction commits... Instead the 'messaging' feature is used which
* allows to inject transactional and nontransactional messages in the
* changestream.
*
* There are really two levels of DDL lock - the global lock that only
* one node can hold, and individual local DDL locks on each node. If
* a node holds the global DDL lock then it owns the local DDL locks on each
* node.
*
* DDL lock acquiration basically works like this:
*
* 1) A utility command notices that it needs the global ddl lock and the local
* node doesn't already hold it. If there already is a local ddl lock
* it'll ERROR out, as this indicates another node already holds or is
* trying to acquire the global DDL lock.
*
* 2) It sends out a 'acquire_lock' message to all other nodes.
*
* 3) When another node receives a 'acquire_lock' message it checks whether
* the local ddl lock is already held. If so it'll send a 'decline_lock'
* message back causing the lock acquiration to fail.
*
* 4) If a 'acquire_lock' message is received and the local DDL lock is not
* held it'll be acquired and an entry into the 'bdr_global_locks' table
* will be made marking the lock to be in the 'catchup' phase.
*
* 5) All concurrent user transactions will be cancelled (after a grace period,
* and if DML write cancel is required for this lock type).
*
* 6) A 'request_replay_confirm' message will be sent to all other nodes
* containing a lsn that has to be replayed.
*
* 7) When a 'request_replay_confirm' message is received, a
* 'replay_confirm' message will be sent back.
*
* 8) Once all other nodes have replied with 'replay_confirm' the DDL lock
* has been successfully acquired on the node reading the 'acquire_lock'
* message (from 3)). The corresponding bdr_global_locks entry will be
* updated to the 'acquired' state and a 'confirm_lock' message will be sent out.
*
* 9) Once all nodes have replied with 'confirm_lock' messages the ddl lock
* has been acquired.
*
* There's some additional complications to handle crash safety:
*
* Everytime a node crashes it sends out a 'startup' message causing all
* other nodes to release locks held by it before the crash.
* Then the bdr_global_locks table is read. All existing locks are
* acquired. If a lock still is in 'catchup' phase the lock acquiration
* process is re-started at step 6)
*
* IDENTIFICATION
* bdr_locks.c
*
* -------------------------------------------------------------------------
*/
#include "postgres.h"
#include "bdr.h"
#include "bdr_locks.h"
#include "miscadmin.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "commands/dbcommands.h"
#include "catalog/indexing.h"
#include "executor/executor.h"
#include "libpq/pqformat.h"
#include "replication/replication_identifier.h"
#include "replication/slot.h"
#include "storage/barrier.h"
#include "storage/ipc.h"
#include "storage/lwlock.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "storage/shmem.h"
#include "storage/sinvaladt.h"
#include "storage/standby.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/snapmgr.h"
#define LOCKTRACE "DDL LOCK TRACE: "
/* GUCs */
bool bdr_permit_ddl_locking = false;
/* -1 means use max_standby_streaming_delay */
int bdr_max_ddl_lock_delay = -1;
/* -1 means use lock_timeout/statement_timeout */
int bdr_ddl_lock_timeout = -1;
typedef struct BDRLockWaiter {
PGPROC *proc;
slist_node node;
} BDRLockWaiter;
typedef struct BdrLocksDBState {
/* db slot used */
bool in_use;
/* db this slot is reserved for */
Oid dboid;
/* number of nodes we're connected to */
Size nnodes;
/* has startup progressed far enough to allow writes? */
bool locked_and_loaded;
int lockcount;
RepNodeId lock_holder;
BDRLockType lock_type;
/* progress of lock acquiration */
int acquire_confirmed;
int acquire_declined;
/* progress of replay confirmation */
int replay_confirmed;
XLogRecPtr replay_confirmed_lsn;
Latch *requestor;
slist_head waiters; /* list of waiting PGPROCs */
} BdrLocksDBState;
typedef struct BdrLocksCtl {
LWLock *lock;
BdrLocksDBState *dbstate;
BDRLockWaiter *waiters;
} BdrLocksCtl;
static BdrLocksDBState * bdr_locks_find_database(Oid dbid, bool create);
static void bdr_locks_find_my_database(bool create);
static void bdr_prepare_message(StringInfo s, BdrMessageType message_type);
static char *bdr_lock_type_to_name(BDRLockType lock_type);
static BDRLockType bdr_lock_name_to_type(const char *lock_type);
static void bdr_request_replay_confirmation(void);
static void bdr_send_confirm_lock(void);
static void bdr_locks_addwaiter(PGPROC *proc);
static void bdr_locks_on_unlock(void);
static int ddl_lock_log_level(int);
static BdrLocksCtl *bdr_locks_ctl;
/* shmem init hook to chain to on startup, if any */
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
/* this database's state */
static BdrLocksDBState *bdr_my_locks_database = NULL;
static bool this_xact_acquired_lock = false;
static size_t
bdr_locks_shmem_size(void)
{
Size size = 0;
uint32 TotalProcs = MaxBackends + NUM_AUXILIARY_PROCS;
size = add_size(size, sizeof(BdrLocksCtl));
size = add_size(size, mul_size(sizeof(BdrLocksDBState), bdr_max_databases));
size = add_size(size, mul_size(sizeof(BDRLockWaiter), TotalProcs));
return size;
}
static void
bdr_locks_shmem_startup(void)
{
bool found;
if (prev_shmem_startup_hook != NULL)
prev_shmem_startup_hook();
LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE);
bdr_locks_ctl = ShmemInitStruct("bdr_locks",
bdr_locks_shmem_size(),
&found);
if (!found)
{
memset(bdr_locks_ctl, 0, bdr_locks_shmem_size());
bdr_locks_ctl->lock = LWLockAssign();
bdr_locks_ctl->dbstate = (BdrLocksDBState *) bdr_locks_ctl + sizeof(BdrLocksCtl);
bdr_locks_ctl->waiters = (BDRLockWaiter *) bdr_locks_ctl + sizeof(BdrLocksCtl) +
mul_size(sizeof(BdrLocksDBState), bdr_max_databases);
}
LWLockRelease(AddinShmemInitLock);
}
/* Needs to be called from a shared_preload_library _PG_init() */
void
bdr_locks_shmem_init()
{
/* Must be called from postmaster its self */
Assert(IsPostmasterEnvironment && !IsUnderPostmaster);
bdr_locks_ctl = NULL;
RequestAddinShmemSpace(bdr_locks_shmem_size());
RequestAddinLWLocks(1);
prev_shmem_startup_hook = shmem_startup_hook;
shmem_startup_hook = bdr_locks_shmem_startup;
}
/* Waiter manipulation. */
void
bdr_locks_addwaiter(PGPROC *proc)
{
BDRLockWaiter *waiter = &bdr_locks_ctl->waiters[proc->pgprocno];
slist_iter iter;
waiter->proc = proc;
/*
* The waiter list shouldn't be huge, and compared to the expense of a DDL
* lock it's cheap to check if we're already registered. After all, we're
* just adding ourselves to a wait-notification list. slist has no guard
* against adding a cycle, and we'd infinite-loop in bdr_locks_on_unlock
* otherwise. See #130.
*/
slist_foreach(iter, &bdr_my_locks_database->waiters)
{
if (iter.cur == &waiter->node)
{
elog(WARNING, LOCKTRACE "backend %d already registered as waiter for DDL lock release",
MyProcPid);
Assert(false); /* crash in debug builds */
return;
}
}
slist_push_head(&bdr_my_locks_database->waiters, &waiter->node);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG), LOCKTRACE "backend started waiting on DDL lock");
}
void
bdr_locks_on_unlock(void)
{
while (!slist_is_empty(&bdr_my_locks_database->waiters))
{
slist_node *node;
BDRLockWaiter *waiter;
PGPROC *proc;
node = slist_pop_head_node(&bdr_my_locks_database->waiters);
/*
* Detect a self-referencing node and bail out by tossing the rest of
* the list. This shouldn't be necessary, it's an emergency bailout
* to stop us going into an infinite loop while holding a LWLock.
*
* We have to PANIC here so we force shmem and lwlock state to be
* re-inited. We could possibly just clobber the list and exit, leaving
* waiters dangling. But since this should be guarded against by
* bdr_locks_addwaiter, it shouldn't happen anyway.
* (See: #130)
*/
if (slist_has_next(&bdr_my_locks_database->waiters, node)
&& slist_next_node(&bdr_my_locks_database->waiters, node) == node)
elog(PANIC, "cycle detected in DDL lock waiter linked list");
waiter = slist_container(BDRLockWaiter, node, node);
proc = waiter->proc;
SetLatch(&proc->procLatch);
}
}
/*
* Turn a DDL lock level into an elog level using the bdr.ddl_lock_trace_level
* setting.
*/
static int
ddl_lock_log_level(int ddl_lock_trace_level)
{
return ddl_lock_trace_level >= bdr_trace_ddl_locks_level ? LOG : DEBUG1;
}
/*
* Find, and create if necessary, the lock state entry for dboid.
*/
static BdrLocksDBState*
bdr_locks_find_database(Oid dboid, bool create)
{
int off;
int free_off = -1;
for(off = 0; off < bdr_max_databases; off++)
{
BdrLocksDBState *db = &bdr_locks_ctl->dbstate[off];
if (db->in_use && db->dboid == MyDatabaseId)
{
bdr_my_locks_database = db;
return db;
}
if (!db->in_use && free_off == -1)
free_off = off;
}
if (!create)
/*
* We can't call get_databse_name here as the catalogs may not be
* accessible, so we can only report the oid of the database.
*/
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("database with oid=%u is not configured for bdr or bdr is still starting up",
dboid)));
if (free_off != -1)
{
BdrLocksDBState *db = &bdr_locks_ctl->dbstate[free_off];
memset(db, 0, sizeof(BdrLocksDBState));
db->dboid = MyDatabaseId;
db->in_use = true;
return db;
}
ereport(ERROR,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
errmsg("Too many databases BDR-enabled for bdr.max_databases"),
errhint("Increase bdr.max_databases above the current limit of %d", bdr_max_databases)));
}
static void
bdr_locks_find_my_database(bool create)
{
Assert(IsUnderPostmaster);
Assert(OidIsValid(MyDatabaseId));
if (bdr_my_locks_database != NULL)
return;
bdr_my_locks_database = bdr_locks_find_database(MyDatabaseId, create);
Assert(bdr_my_locks_database != NULL);
}
/*
* This node has just started up. Init its local state and send a startup
* announcement message.
*
* Called from the per-db worker.
*/
void
bdr_locks_startup()
{
Relation rel;
ScanKey key;
SysScanDesc scan;
Snapshot snap;
HeapTuple tuple;
XLogRecPtr lsn;
StringInfoData s;
MemoryContext old_ctx;
Assert(IsUnderPostmaster);
Assert(!IsTransactionState());
Assert(bdr_worker_type == BDR_WORKER_PERDB);
bdr_locks_find_my_database(true);
/*
* Don't initialize database level lock state twice. An crash requiring
* that has to be severe enough to trigger a crash-restart cycle.
*/
if (bdr_my_locks_database->locked_and_loaded)
return;
slist_init(&bdr_my_locks_database->waiters);
/* We haven't yet established how many nodes we're connected to. */
bdr_my_locks_database->nnodes = 0;
initStringInfo(&s);
/*
* Send restart message causing all other backends to release global locks
* possibly held by us. We don't necessarily remember sending the request
* out.
*/
bdr_prepare_message(&s, BDR_MESSAGE_START);
elog(DEBUG1, "sending global lock startup message");
lsn = LogStandbyMessage(s.data, s.len, false);
resetStringInfo(&s);
XLogFlush(lsn);
/* reacquire all old ddl locks in table */
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
snap = RegisterSnapshot(GetLatestSnapshot());
rel = heap_open(BdrLocksRelid, RowExclusiveLock);
key = (ScanKey) palloc(sizeof(ScanKeyData) * 1);
ScanKeyInit(&key[0],
8,
BTEqualStrategyNumber, F_OIDEQ,
bdr_my_locks_database->dboid);
scan = systable_beginscan(rel, 0, true, snap, 1, key);
/* TODO: support multiple locks */
while ((tuple = systable_getnext(scan)) != NULL)
{
Datum values[10];
bool isnull[10];
const char *state;
uint64 sysid;
RepNodeId node_id;
BDRLockType lock_type;
heap_deform_tuple(tuple, RelationGetDescr(rel),
values, isnull);
/* lookup the lock owner's node id */
state = TextDatumGetCString(values[9]);
if (sscanf(TextDatumGetCString(values[1]), UINT64_FORMAT, &sysid) != 1)
elog(ERROR, "could not parse sysid %s",
TextDatumGetCString(values[1]));
node_id = bdr_fetch_node_id_via_sysid(
sysid, DatumGetObjectId(values[2]), DatumGetObjectId(values[3]));
lock_type = bdr_lock_name_to_type(TextDatumGetCString(values[0]));
if (strcmp(state, "acquired") == 0)
{
bdr_my_locks_database->lock_holder = node_id;
bdr_my_locks_database->lockcount++;
bdr_my_locks_database->lock_type = lock_type;
/* A remote node might have held the local lock before restart */
elog(DEBUG1, "reacquiring local lock held before shutdown");
}
else if (strcmp(state, "catchup") == 0)
{
XLogRecPtr wait_for_lsn;
/*
* Restart the catchup period. There shouldn't be any need to
* kickof sessions here, because we're starting early.
*/
wait_for_lsn = GetXLogInsertRecPtr();
bdr_prepare_message(&s, BDR_MESSAGE_REQUEST_REPLAY_CONFIRM);
pq_sendint64(&s, wait_for_lsn);
lsn = LogStandbyMessage(s.data, s.len, false);
XLogFlush(lsn);
resetStringInfo(&s);
bdr_my_locks_database->lock_holder = node_id;
bdr_my_locks_database->lockcount++;
bdr_my_locks_database->lock_type = lock_type;
bdr_my_locks_database->replay_confirmed = 0;
bdr_my_locks_database->replay_confirmed_lsn = wait_for_lsn;
elog(DEBUG1, "restarting global lock replay catchup phase");
}
else
elog(PANIC, "unknown lockstate '%s'", state);
}
systable_endscan(scan);
UnregisterSnapshot(snap);
heap_close(rel, NoLock);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
elog(DEBUG2, "global locking startup completed, local DML enabled");
/* allow local DML */
bdr_my_locks_database->locked_and_loaded = true;
}
void
bdr_locks_set_nnodes(Size nnodes)
{
Assert(IsBackgroundWorker);
Assert(bdr_my_locks_database != NULL);
/*
* XXX DYNCONF No protection against node addition during DDL lock acquire
*
* Node counts are currently grabbed straight from the perdb worker's shmem
* and could change whenever someone adds a worker, with no locking or
* protection.
*
* We could acquire the local DDL lock before setting the nodecount, which
* would cause requests from other nodes to get rejected and cause other
* local tx's to fail to request the global DDL lock. However, we'd have to
* acquire it when we committed to adding the new worker, which happens in
* a user backend, and release it from the perdb worker once the new worker
* is registered. Fragile.
*
* Doing so also fails to solve the other half of the problem, which is
* that DDL locking expects there to be one bdr walsender for each apply
* worker, i.e. each connection should be reciprocal. We could connect to
* the other end and register a connection back to us, but that's getting
* complicated for what's always going to be a temporary option before a
* full part/join protocol is added.
*
* So we're just going to cross our fingers. Worst case is that DDL locking
* gets stuck and we have to restart all the nodes.
*
* The full part/join protocol will solve this by acquiring the DDL lock
* before joining.
*/
bdr_my_locks_database->nnodes = nnodes;
}
static void
bdr_prepare_message(StringInfo s, BdrMessageType message_type)
{
/* channel */
pq_sendint(s, strlen("bdr"), 4);
pq_sendbytes(s, "bdr", strlen("bdr"));
/* message type */
pq_sendint(s, message_type, 4);
/* node identifier */
pq_sendint64(s, GetSystemIdentifier()); /* sysid */
pq_sendint(s, ThisTimeLineID, 4); /* tli */
pq_sendint(s, MyDatabaseId, 4); /* database */
pq_sendint(s, 0, 4); /* name, always empty for now */
/* caller's data will follow */
}
static void
bdr_lock_xact_callback(XactEvent event, void *arg)
{
if (!this_xact_acquired_lock)
return;
if (event == XACT_EVENT_ABORT || event == XACT_EVENT_COMMIT)
{
XLogRecPtr lsn;
StringInfoData s;
elog(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE), LOCKTRACE "releasing owned ddl lock on xact %s",
event == XACT_EVENT_ABORT ? "abort" : "commit");
initStringInfo(&s);
bdr_prepare_message(&s, BDR_MESSAGE_RELEASE_LOCK);
/* no lock_type, finished transaction releases all locks it held */
pq_sendint64(&s, GetSystemIdentifier()); /* sysid */
pq_sendint(&s, ThisTimeLineID, 4); /* tli */
pq_sendint(&s, MyDatabaseId, 4); /* database */
/* no name! locks are db wide */
lsn = LogStandbyMessage(s.data, s.len, false);
XLogFlush(lsn);
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
if (bdr_my_locks_database->lockcount > 0)
bdr_my_locks_database->lockcount--;
else
elog(WARNING, "Releasing unacquired global lock");
this_xact_acquired_lock = false;
bdr_my_locks_database->lock_type = BDR_LOCK_NOLOCK;
bdr_my_locks_database->replay_confirmed = 0;
bdr_my_locks_database->replay_confirmed_lsn = InvalidXLogRecPtr;
bdr_my_locks_database->requestor = NULL;
if (bdr_my_locks_database->lockcount == 0)
bdr_locks_on_unlock();
LWLockRelease(bdr_locks_ctl->lock);
}
}
static void
register_xact_callback()
{
static bool registered;
if (!registered)
{
RegisterXactCallback(bdr_lock_xact_callback, NULL);
registered = true;
}
}
static SysScanDesc
locks_begin_scan(Relation rel, Snapshot snap, uint64 sysid, TimeLineID tli, Oid datid)
{
ScanKey key;
char buf[30];
key = (ScanKey) palloc(sizeof(ScanKeyData) * 4);
sprintf(buf, UINT64_FORMAT, sysid);
ScanKeyInit(&key[0],
2,
BTEqualStrategyNumber, F_TEXTEQ,
CStringGetTextDatum(buf));
ScanKeyInit(&key[1],
3,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(tli));
ScanKeyInit(&key[2],
4,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(datid));
return systable_beginscan(rel, 0, true, snap, 3, key);
}
/*
* Acquire DDL lock on the side that wants to perform DDL.
*
* Called from a user backend when the command filter spots a DDL attempt; runs
* in the user backend.
*/
void
bdr_acquire_ddl_lock(BDRLockType lock_type)
{
XLogRecPtr lsn;
StringInfoData s;
Assert(IsTransactionState());
/* Not called from within a BDR worker */
Assert(bdr_worker_type == BDR_WORKER_EMPTY_SLOT);
/* We don't support other types of the lock yet. */
Assert(lock_type == BDR_LOCK_DDL || lock_type == BDR_LOCK_WRITE);
bdr_locks_find_my_database(false);
/* No need to do anything if already holding requested lock. */
if (this_xact_acquired_lock &&
bdr_my_locks_database->lock_type >= lock_type)
return;
/*
* If this is the first time in current transaction that we are trying to
* acquire DDL lock, do the sanity checking first.
*/
if (!this_xact_acquired_lock)
{
if (!bdr_permit_ddl_locking)
{
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("Global DDL locking attempt rejected by configuration"),
errdetail("bdr.permit_ddl_locking is false and the attempted command "
"would require the global lock to be acquired. "
"Command rejected."),
errhint("See the 'DDL replication' chapter of the documentation.")));
}
if (bdr_my_locks_database->nnodes == 0)
{
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("No peer nodes or peer node count unknown, cannot acquire global lock"),
errhint("BDR is probably still starting up, wait a while")));
}
}
if (this_xact_acquired_lock)
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_STATEMENT),
LOCKTRACE "acquiring in mode <%s> (upgrading from <%s>) for (" BDR_LOCALID_FORMAT ") [tracelevel=%s]",
bdr_lock_type_to_name(lock_type),
bdr_lock_type_to_name(bdr_my_locks_database->lock_type),
BDR_LOCALID_FORMAT_ARGS, GetConfigOption("bdr.trace_ddl_locks_level", false, false) );
}
else
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_STATEMENT),
LOCKTRACE "acquiring in mode <%s> for (" BDR_LOCALID_FORMAT ") [tracelevel=%s]",
bdr_lock_type_to_name(lock_type),
BDR_LOCALID_FORMAT_ARGS, GetConfigOption("bdr.trace_ddl_locks_level", false, false) );
}
/* register an XactCallback to release the lock */
register_xact_callback();
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
/* check whether the lock can actually be acquired */
if (!this_xact_acquired_lock && bdr_my_locks_database->lockcount > 0)
{
uint64 holder_sysid;
TimeLineID holder_tli;
Oid holder_datid;
bdr_fetch_sysid_via_node_id(bdr_my_locks_database->lock_holder,
&holder_sysid, &holder_tli,
&holder_datid);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE),
LOCKTRACE "lock already held by (" BDR_LOCALID_FORMAT ")",
holder_sysid, holder_tli, holder_datid, "");
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("database is locked against ddl by another node"),
errhint("Node ("UINT64_FORMAT",%u,%u) in the cluster is already performing DDL",
holder_sysid, holder_tli, holder_datid)));
}
/*
* There should be nobody waiting to be notified if the DDL lock isn't
* held, and now we hold bdr_locks_ctl->lock and know the lock is free.
*/
Assert(slist_is_empty(&bdr_my_locks_database->waiters));
/* send message about ddl lock */
initStringInfo(&s);
bdr_prepare_message(&s, BDR_MESSAGE_ACQUIRE_LOCK);
/* Add lock type */
pq_sendint(&s, lock_type, 4);
START_CRIT_SECTION();
/*
* NB: We need to setup the shmem state as if we'd have already acquired
* the lock before we release the LWLock on bdr_locks_ctl->lock. Otherwise
* concurrent transactions could acquire the lock, and we wouldn't send a
* release message when we fail to fully acquire the lock.
*/
if (!this_xact_acquired_lock)
{
bdr_my_locks_database->lockcount++;
this_xact_acquired_lock = true;
}
bdr_my_locks_database->acquire_confirmed = 0;
bdr_my_locks_database->acquire_declined = 0;
bdr_my_locks_database->requestor = &MyProc->procLatch;
bdr_my_locks_database->lock_type = lock_type;
/* lock looks to be free, try to acquire it */
lsn = LogStandbyMessage(s.data, s.len, false);
XLogFlush(lsn);
END_CRIT_SECTION();
LWLockRelease(bdr_locks_ctl->lock);
/* ---
* Now wait for standbys to ack ddl lock
* ---
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "sent DDL lock mode %s request for (" BDR_LOCALID_FORMAT "), waiting for confirmation",
bdr_lock_type_to_name(lock_type),
BDR_LOCALID_FORMAT_ARGS);
while (true)
{
int rc;
ResetLatch(&MyProc->procLatch);
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
/* check for confirmations in shared memory */
if (bdr_my_locks_database->acquire_declined > 0)
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE), LOCKTRACE "acquire declined by another node");
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("could not acquire global lock - another node has declined our lock request"),
errhint("Likely the other node is acquiring the global lock itself.")));
}
/* wait till all have given their consent */
if (bdr_my_locks_database->acquire_confirmed >= bdr_my_locks_database->nnodes)
{
LWLockRelease(bdr_locks_ctl->lock);
break;
}
LWLockRelease(bdr_locks_ctl->lock);
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
10000L);
/* emergency bailout if postmaster has died */
if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
CHECK_FOR_INTERRUPTS();
}
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
/* TODO: recheck it's ours */
bdr_my_locks_database->acquire_confirmed = 0;
bdr_my_locks_database->acquire_declined = 0;
bdr_my_locks_database->requestor = NULL;
elog(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE),
LOCKTRACE "DDL lock acquired in mode mode %s (" BDR_LOCALID_FORMAT ")",
bdr_lock_type_to_name(lock_type),
BDR_LOCALID_FORMAT_ARGS);
LWLockRelease(bdr_locks_ctl->lock);
}
static bool
check_is_my_origin_node(uint64 sysid, TimeLineID tli, Oid datid)
{
uint64 replay_sysid;
TimeLineID replay_tli;
Oid replay_datid;
MemoryContext old_ctx;
Assert(!IsTransactionState());
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
bdr_fetch_sysid_via_node_id(replication_origin_id, &replay_sysid,
&replay_tli, &replay_datid);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
if (sysid != replay_sysid ||
tli != replay_tli ||
datid != replay_datid)
return false;
return true;
}
static bool
check_is_my_node(uint64 sysid, TimeLineID tli, Oid datid)
{
if (sysid != GetSystemIdentifier() ||
tli != ThisTimeLineID ||
datid != MyDatabaseId)
return false;
return true;
}
/*
* Kill any writing transactions while giving them some grace period for
* finishing.
*
* Caller is responsible for ensuring that no new writes can be started during
* the execution of this function.
*/
static bool
cancel_conflicting_transactions(void)
{
VirtualTransactionId *conflict;
TimestampTz killtime,
canceltime;
int waittime = 1000;
killtime = TimestampTzPlusMilliseconds(GetCurrentTimestamp(),
bdr_max_ddl_lock_delay > 0 ?
bdr_max_ddl_lock_delay : max_standby_streaming_delay);
if (bdr_ddl_lock_timeout > 0 || LockTimeout > 0)
canceltime = TimestampTzPlusMilliseconds(GetCurrentTimestamp(),
bdr_ddl_lock_timeout > 0 ? bdr_ddl_lock_timeout : LockTimeout);
else
TIMESTAMP_NOEND(canceltime);
conflict = GetConflictingVirtualXIDs(InvalidTransactionId, MyDatabaseId);
while (conflict->backendId != InvalidBackendId)
{
PGPROC *pgproc = BackendIdGetProc(conflict->backendId);
PGXACT *pgxact;
if (pgproc == NULL)
{
conflict++;
continue;
}
pgxact = &ProcGlobal->allPgXact[pgproc->pgprocno];
/* Skip the transactions that didn't do any writes. */
if (!TransactionIdIsValid(pgxact->xid))
{
conflict++;
continue;
}
/* If here is writing transaction give it time to finish */
if (!TIMESTAMP_IS_NOEND(canceltime) &&
GetCurrentTimestamp() < canceltime)
{
return false;
}
else if (GetCurrentTimestamp() < killtime)
{
int rc;
/* Increasing backoff interval for wait time with limit of 1s */
pg_usleep(waittime);
waittime *= 2;
if (waittime > 1000000)
waittime = 1000000;
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
waittime);
ResetLatch(&MyProc->procLatch);
/* emergency bailout if postmaster has died */
if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
}
else
{
/* We reached timeout so lets kill the writing transaction */
pid_t p = CancelVirtualTransaction(*conflict, PROCSIG_RECOVERY_CONFLICT_LOCK);
/*
* Either confirm kill or sleep a bit to prevent the other node
* being busy with signal processing.
*/
if (p == 0)
conflict++;
else
pg_usleep(1000);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "signalling pid %d to terminate because of global DDL lock acquisition", p);
}
}
return true;
}
static void
bdr_request_replay_confirmation(void)
{
StringInfoData s;
XLogRecPtr lsn,
wait_for_lsn;
initStringInfo(&s);
wait_for_lsn = GetXLogInsertRecPtr();
bdr_prepare_message(&s, BDR_MESSAGE_REQUEST_REPLAY_CONFIRM);
pq_sendint64(&s, wait_for_lsn);
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
lsn = LogStandbyMessage(s.data, s.len, false);
XLogFlush(lsn);
bdr_my_locks_database->replay_confirmed = 0;
bdr_my_locks_database->replay_confirmed_lsn = wait_for_lsn;
LWLockRelease(bdr_locks_ctl->lock);
resetStringInfo(&s);
}
/*
* Another node has asked for a DDL lock. Try to acquire the local ddl lock.
*
* Runs in the apply worker.
*/
void
bdr_process_acquire_ddl_lock(uint64 sysid, TimeLineID tli, Oid datid, BDRLockType lock_type)
{
StringInfoData s;
const char *lock_name = bdr_lock_type_to_name(lock_type);
MemoryContext old_ctx;
Assert(!IsTransactionState());
Assert(bdr_worker_type == BDR_WORKER_APPLY);
/* Don't care about locks acquired locally. Already held. */
if (!check_is_my_origin_node(sysid, tli, datid))
return;
bdr_locks_find_my_database(false);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "%s lock requested by node ("UINT64_FORMAT",%u,%u)",
lock_name, sysid, tli, datid);
initStringInfo(&s);
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
if (bdr_my_locks_database->lockcount == 0)
{
Relation rel;
Datum values[10];
bool nulls[10];
HeapTuple tup;
/*
* No previous DDL lock found. Start acquiring it.
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "no prior global lock found, acquiring global lock locally");
/* Add a row to bdr_locks */
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
memset(nulls, 0, sizeof(nulls));
rel = heap_open(BdrLocksRelid, RowExclusiveLock);
values[0] = CStringGetTextDatum(lock_name);
appendStringInfo(&s, UINT64_FORMAT, sysid);
values[1] = CStringGetTextDatum(s.data);
resetStringInfo(&s);
values[2] = ObjectIdGetDatum(tli);
values[3] = ObjectIdGetDatum(datid);
values[4] = TimestampTzGetDatum(GetCurrentTimestamp());
appendStringInfo(&s, UINT64_FORMAT, GetSystemIdentifier());
values[5] = CStringGetTextDatum(s.data);
resetStringInfo(&s);
values[6] = ObjectIdGetDatum(ThisTimeLineID);
values[7] = ObjectIdGetDatum(MyDatabaseId);
nulls[8] = true;
values[9] = PointerGetDatum(cstring_to_text("catchup"));
PG_TRY();
{
tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
simple_heap_insert(rel, tup);
CatalogUpdateIndexes(rel, tup);
ForceSyncCommit(); /* async commit would be too complicated */
heap_close(rel, NoLock);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
}
PG_CATCH();
{
if (geterrcode() == ERRCODE_UNIQUE_VIOLATION)
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "declining global lock because a conflicting global lock exists in bdr_global_locks");
AbortOutOfAnyTransaction();
(void) MemoryContextSwitchTo(old_ctx);
goto decline;
}
else
PG_RE_THROW();
}
PG_END_TRY();
/* setup ddl lock */
bdr_my_locks_database->lockcount++;
bdr_my_locks_database->lock_type = lock_type;
bdr_my_locks_database->lock_holder = replication_origin_id;
LWLockRelease(bdr_locks_ctl->lock);
if (lock_type >= BDR_LOCK_WRITE)
{
/*
* Now kill all local processes that are still writing. We can't just
* prevent them from writing via the acquired lock as they are still
* running.
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "terminating any local processes that conflict with the global lock");
if (!cancel_conflicting_transactions())
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "failed to terminate, declining the lock");
goto decline;
}
/*
* We now have to wait till all our local pending changes have been
* streamed out. We do this by sending a message which is then acked
* by all other nodes. When the required number of messages is back we
* can confirm the lock to the original requestor
* (c.f. bdr_process_replay_confirm()).
*
* If we didn't wait for everyone to replay local changes then a DDL
* change that caused those local changes not to apply on remote
* nodes might occur, causing a divergent conflict.
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "requesting replay confirmation from all other nodes before confirming global lock granted");
bdr_request_replay_confirmation();
} else {
/*
* Simple DDL locks that are not conflicting with existing
* transactions can be just confirmed immediatelly.
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "non-conflicting lock requested, logging confirmation of this node's acquisition of global lock");
bdr_send_confirm_lock();
}
elog(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE),
LOCKTRACE "global lock granted to remote node (" BDR_LOCALID_FORMAT ")",
sysid, tli, datid, "");
}
else if (bdr_my_locks_database->lock_holder == replication_origin_id &&
lock_type > bdr_my_locks_database->lock_type)
{
Relation rel;
SysScanDesc scan;
Snapshot snap;
HeapTuple tuple;
uint64 replay_sysid;
TimeLineID replay_tli;
Oid replay_datid;
bool found = false;
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "prior lesser lock from same lock holder, upgrading the global lock locally");
Assert(!IsTransactionState());
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
bdr_fetch_sysid_via_node_id(bdr_my_locks_database->lock_holder,
&replay_sysid, &replay_tli,
&replay_datid);
/*
* Update state of lock.
*/
/* Scan for a matching lock whose state needs to be updated */
snap = RegisterSnapshot(GetLatestSnapshot());
rel = heap_open(BdrLocksRelid, RowExclusiveLock);
scan = locks_begin_scan(rel, snap, replay_sysid, replay_tli, replay_datid);
while ((tuple = systable_getnext(scan)) != NULL)
{
HeapTuple newtuple;
Datum values[10];
bool isnull[10];
if (found)
elog(PANIC, "Duplicate lock?");
heap_deform_tuple(tuple, RelationGetDescr(rel),
values, isnull);
/* lock_type column */
values[0] = CStringGetTextDatum(lock_name);
newtuple = heap_form_tuple(RelationGetDescr(rel),
values, isnull);
simple_heap_update(rel, &tuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
found = true;
}
if (!found)
elog(PANIC, "got lock in memory without corresponding lock table entry");
systable_endscan(scan);
UnregisterSnapshot(snap);
heap_close(rel, NoLock);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
LWLockRelease(bdr_locks_ctl->lock);
if (lock_type >= BDR_LOCK_WRITE)
{
/*
* Now kill all local processes that are still writing. We can't just
* prevent them from writing via the acquired lock as they are still
* running.
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "terminating any local processes that conflict with the global lock");
if (!cancel_conflicting_transactions())
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "failed to terminate, declining the lock");
goto decline;
}
/* update inmemory lock state */
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
bdr_my_locks_database->lock_type = lock_type;
LWLockRelease(bdr_locks_ctl->lock);
/*
* We now have to wait till all our local pending changes have been
* streamed out. We do this by sending a message which is then acked
* by all other nodes. When the required number of messages is back we
* can confirm the lock to the original requestor
* (c.f. bdr_process_replay_confirm()).
*
* If we didn't wait for everyone to replay local changes then a DDL
* change that caused those local changes not to apply on remote
* nodes might occur, causing a divergent conflict.
*/
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "requesting replay confirmation from all other nodes before confirming global lock granted");
bdr_request_replay_confirmation();
} else {
/*
* Simple DDL locks that are not conflicting with existing
* transactions can be just confirmed immediatelly.
*/
/* update inmemory lock state */
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
bdr_my_locks_database->lock_type = lock_type;
LWLockRelease(bdr_locks_ctl->lock);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "non-conflicting lock requested, logging confirmation of this node's acquisition of global lock");
bdr_send_confirm_lock();
}
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "global lock granted to remote node (" BDR_LOCALID_FORMAT ")",
sysid, tli, datid, "");
}
else
{
uint64 replay_sysid;
TimeLineID replay_tli;
Oid replay_datid;
XLogRecPtr lsn;
LWLockRelease(bdr_locks_ctl->lock);
decline:
ereport(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE),
(errmsg(LOCKTRACE "declining remote global lock request, this node is already locked by origin=%u at level %s",
bdr_my_locks_database->lock_holder,
bdr_lock_type_to_name(bdr_my_locks_database->lock_type))));
bdr_prepare_message(&s, BDR_MESSAGE_DECLINE_LOCK);
Assert(!IsTransactionState());
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
bdr_fetch_sysid_via_node_id(bdr_my_locks_database->lock_holder,
&replay_sysid, &replay_tli,
&replay_datid);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
pq_sendint64(&s, replay_sysid); /* sysid */
pq_sendint(&s, replay_tli, 4); /* tli */
pq_sendint(&s, replay_datid, 4); /* database */
/* no name! locks are db wide */
pq_sendint(&s, lock_type, 4);
lsn = LogStandbyMessage(s.data, s.len, false);
XLogFlush(lsn);
resetStringInfo(&s);
}
}
/*
* Another node has released the global DDL lock, update our local state.
*
* Runs in the apply worker.
*/
void
bdr_process_release_ddl_lock(uint64 origin_sysid, TimeLineID origin_tli, Oid origin_datid,
uint64 lock_sysid, TimeLineID lock_tli, Oid lock_datid)
{
Relation rel;
Snapshot snap;
SysScanDesc scan;
HeapTuple tuple;
bool found = false;
Latch *latch;
StringInfoData s;
MemoryContext old_ctx;
Assert(bdr_worker_type == BDR_WORKER_APPLY);
if (!check_is_my_origin_node(origin_sysid, origin_tli, origin_datid))
return;
/* FIXME: check db */
bdr_locks_find_my_database(false);
initStringInfo(&s);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "global lock released by (" BDR_LOCALID_FORMAT ")",
lock_sysid, lock_tli, lock_datid, "");
/*
* Remove row from bdr_locks *before* releasing the in memory lock. If we
* crash we'll replay the event again.
*/
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
snap = RegisterSnapshot(GetLatestSnapshot());
rel = heap_open(BdrLocksRelid, RowExclusiveLock);
scan = locks_begin_scan(rel, snap, origin_sysid, origin_tli, origin_datid);
while ((tuple = systable_getnext(scan)) != NULL)
{
elog(DEBUG2, "found global lock entry to delete in response to global lock release message");
simple_heap_delete(rel, &tuple->t_self);
ForceSyncCommit(); /* async commit would be too complicated */
found = true;
}
systable_endscan(scan);
UnregisterSnapshot(snap);
heap_close(rel, NoLock);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
/*
* Note that it's not unexpected to receive release requests for locks
* this node hasn't acquired. It e.g. happens if lock acquisition failed
* halfway through.
*/
if (!found)
{
ereport(WARNING,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("Did not find global lock entry locally for a remotely released global lock"),
errdetail("node ("BDR_LOCALID_FORMAT") sent a release message but the lock isn't held locally",
lock_sysid, lock_tli, lock_datid, "")));
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "missing local lock entry for remotely released global lock from (" BDR_LOCALID_FORMAT ")",
lock_sysid, lock_tli, lock_datid, "");
}
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
if (bdr_my_locks_database->lockcount > 0)
{
bdr_my_locks_database->lockcount--;
bdr_my_locks_database->lock_holder = InvalidRepNodeId;
/* XXX: recheck owner of lock */
}
latch = bdr_my_locks_database->requestor;
bdr_my_locks_database->lock_type = BDR_LOCK_NOLOCK;
bdr_my_locks_database->replay_confirmed = 0;
bdr_my_locks_database->replay_confirmed_lsn = InvalidXLogRecPtr;
bdr_my_locks_database->requestor = NULL;
if (bdr_my_locks_database->lockcount == 0)
bdr_locks_on_unlock();
LWLockRelease(bdr_locks_ctl->lock);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "global lock released locally");
/* notify an eventual waiter */
if(latch)
SetLatch(latch);
}
/*
* Another node has confirmed that a node has acquired the DDL lock
* successfully. If the acquiring node was us, change shared memory state and
* wake up the user backend that was trying to acquire the lock.
*
* Runs in the apply worker.
*/
void
bdr_process_confirm_ddl_lock(uint64 origin_sysid, TimeLineID origin_tli, Oid origin_datid,
uint64 lock_sysid, TimeLineID lock_tli, Oid lock_datid,
BDRLockType lock_type)
{
Latch *latch;
Assert(bdr_worker_type == BDR_WORKER_APPLY);
if (!check_is_my_origin_node(origin_sysid, origin_tli, origin_datid))
return;
/* don't care if another database has gotten the lock */
if (!check_is_my_node(lock_sysid, lock_tli, lock_datid))
return;
bdr_locks_find_my_database(false);
if (bdr_my_locks_database->lock_type != lock_type)
{
elog(WARNING,
LOCKTRACE "received global lock confirmation with unexpected lock type (%d), waiting for (%d)",
lock_type, bdr_my_locks_database->lock_type);
return;
}
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
bdr_my_locks_database->acquire_confirmed++;
latch = bdr_my_locks_database->requestor;
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "received global lock confirmation number %d/%zu from ("BDR_LOCALID_FORMAT")",
bdr_my_locks_database->acquire_confirmed, bdr_my_locks_database->nnodes,
origin_sysid, origin_tli, origin_datid, "");
LWLockRelease(bdr_locks_ctl->lock);
if(latch)
SetLatch(latch);
}
/*
* Another node has declined a lock. If it was us, change shared memory state
* and wakeup the user backend that tried to acquire the lock.
*
* Runs in the apply worker.
*/
void
bdr_process_decline_ddl_lock(uint64 origin_sysid, TimeLineID origin_tli, Oid origin_datid,
uint64 lock_sysid, TimeLineID lock_tli, Oid lock_datid,
BDRLockType lock_type)
{
Latch *latch;
Assert(bdr_worker_type == BDR_WORKER_APPLY);
/* don't care if another database has been declined a lock */
if (!check_is_my_origin_node(origin_sysid, origin_tli, origin_datid))
return;
bdr_locks_find_my_database(false);
if (bdr_my_locks_database->lock_type != lock_type)
{
elog(WARNING,
LOCKTRACE "received global lock confirmation with unexpected lock type (%d), waiting for (%d)",
lock_type, bdr_my_locks_database->lock_type);
return;
}
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
bdr_my_locks_database->acquire_declined++;
latch = bdr_my_locks_database->requestor;
LWLockRelease(bdr_locks_ctl->lock);
if(latch)
SetLatch(latch);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_ACQUIRE_RELEASE),
LOCKTRACE "global lock request declined by node ("BDR_LOCALID_FORMAT")",
origin_sysid, origin_tli, origin_datid, "");
}
/*
* Another node has asked us to confirm that we've replayed up to a given LSN.
* We've seen the request message, so send the requested confirmation.
*
* Runs in the apply worker.
*/
void
bdr_process_request_replay_confirm(uint64 sysid, TimeLineID tli,
Oid datid, XLogRecPtr request_lsn)
{
XLogRecPtr lsn;
StringInfoData s;
Assert(bdr_worker_type == BDR_WORKER_APPLY);
if (!check_is_my_origin_node(sysid, tli, datid))
return;
bdr_locks_find_my_database(false);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "replay confirmation requested by node ("BDR_LOCALID_FORMAT"); sending",
sysid, tli, datid, "");
initStringInfo(&s);
bdr_prepare_message(&s, BDR_MESSAGE_REPLAY_CONFIRM);
pq_sendint64(&s, request_lsn);
lsn = LogStandbyMessage(s.data, s.len, false);
XLogFlush(lsn);
}
static void
bdr_send_confirm_lock(void)
{
Relation rel;
SysScanDesc scan;
Snapshot snap;
HeapTuple tuple;
uint64 replay_sysid;
TimeLineID replay_tli;
Oid replay_datid;
StringInfoData s;
bool found = false;
MemoryContext old_ctx;
initStringInfo(&s);
bdr_my_locks_database->replay_confirmed = 0;
bdr_my_locks_database->replay_confirmed_lsn = InvalidXLogRecPtr;
bdr_my_locks_database->requestor = NULL;
bdr_prepare_message(&s, BDR_MESSAGE_CONFIRM_LOCK);
Assert(!IsTransactionState());
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
bdr_fetch_sysid_via_node_id(bdr_my_locks_database->lock_holder,
&replay_sysid, &replay_tli,
&replay_datid);
pq_sendint64(&s, replay_sysid); /* sysid */
pq_sendint(&s, replay_tli, 4); /* tli */
pq_sendint(&s, replay_datid, 4); /* database */
/* no name! locks are db wide */
pq_sendint(&s, bdr_my_locks_database->lock_type, 4);
LogStandbyMessage(s.data, s.len, true); /* transactional */
/*
* Update state of lock. Do so in the same xact that confirms the
* lock. That way we're safe against crashes.
*/
/* Scan for a matching lock whose state needs to be updated */
snap = RegisterSnapshot(GetLatestSnapshot());
rel = heap_open(BdrLocksRelid, RowExclusiveLock);
scan = locks_begin_scan(rel, snap, replay_sysid, replay_tli, replay_datid);
while ((tuple = systable_getnext(scan)) != NULL)
{
HeapTuple newtuple;
Datum values[10];
bool isnull[10];
if (found)
elog(PANIC, "Duplicate lock?");
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "updating global lock state from 'catchup' to 'acquired'");
heap_deform_tuple(tuple, RelationGetDescr(rel),
values, isnull);
/* status column */
values[9] = CStringGetTextDatum("acquired");
newtuple = heap_form_tuple(RelationGetDescr(rel),
values, isnull);
simple_heap_update(rel, &tuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
found = true;
}
if (!found)
elog(PANIC, "got confirmation for unknown lock");
systable_endscan(scan);
UnregisterSnapshot(snap);
heap_close(rel, NoLock);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
}
/*
* A remote node has seen a replay confirmation request and replied to it.
*
* If we sent the original request, update local state appropriately.
*
* If a DDL lock request has reached quorum as a result of this confirmation,
* write a log acquisition confirmation and bdr_global_locks update to xlog.
*
* Runs in the apply worker.
*/
void
bdr_process_replay_confirm(uint64 sysid, TimeLineID tli,
Oid datid, XLogRecPtr request_lsn)
{
bool quorum_reached = false;
Assert(bdr_worker_type == BDR_WORKER_APPLY);
if (!check_is_my_origin_node(sysid, tli, datid))
return;
bdr_locks_find_my_database(false);
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "processing replay confirmation from node ("BDR_LOCALID_FORMAT") for request %X/%X at %X/%X",
sysid, tli, datid, "",
(uint32)(bdr_my_locks_database->replay_confirmed_lsn >> 32),
(uint32)bdr_my_locks_database->replay_confirmed_lsn,
(uint32)(request_lsn >> 32),
(uint32)request_lsn);
/* request matches the one we're interested in */
if (bdr_my_locks_database->replay_confirmed_lsn == request_lsn)
{
bdr_my_locks_database->replay_confirmed++;
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "confirming replay %u/%zu",
bdr_my_locks_database->replay_confirmed,
bdr_my_locks_database->nnodes);
quorum_reached =
bdr_my_locks_database->replay_confirmed >= bdr_my_locks_database->nnodes;
}
if (quorum_reached)
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "global lock quorum reached, logging confirmation of this node's acquisition of global lock");
bdr_send_confirm_lock();
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "sent confirmation of successful global lock acquisition");
}
LWLockRelease(bdr_locks_ctl->lock);
}
/*
* A remote node has sent a startup message. Update any appropriate local state
* like any locally held DDL locks for it.
*
* Runs in the apply worker.
*/
void
bdr_locks_process_remote_startup(uint64 sysid, TimeLineID tli, Oid datid)
{
Relation rel;
Snapshot snap;
SysScanDesc scan;
HeapTuple tuple;
StringInfoData s;
MemoryContext old_ctx;
Assert(bdr_worker_type == BDR_WORKER_APPLY);
bdr_locks_find_my_database(false);
initStringInfo(&s);
elog(ddl_lock_log_level(DDL_LOCK_TRACE_PEERS),
LOCKTRACE "got startup message from node ("BDR_LOCALID_FORMAT"), clearing any locks it held",
sysid, tli, datid, "");
old_ctx = CurrentMemoryContext;
StartTransactionCommand();
snap = RegisterSnapshot(GetLatestSnapshot());
rel = heap_open(BdrLocksRelid, RowExclusiveLock);
scan = locks_begin_scan(rel, snap, sysid, tli, datid);
while ((tuple = systable_getnext(scan)) != NULL)
{
elog(ddl_lock_log_level(DDL_LOCK_TRACE_DEBUG),
LOCKTRACE "found remote lock to delete (after remote restart)");
simple_heap_delete(rel, &tuple->t_self);
LWLockAcquire(bdr_locks_ctl->lock, LW_EXCLUSIVE);
if (bdr_my_locks_database->lockcount == 0)
elog(WARNING, "bdr_global_locks row exists without corresponding in memory state");
else
{
bdr_my_locks_database->lockcount--;
bdr_my_locks_database->lock_holder = InvalidRepNodeId;
bdr_my_locks_database->lock_type = BDR_LOCK_NOLOCK;
bdr_my_locks_database->replay_confirmed = 0;
bdr_my_locks_database->replay_confirmed_lsn = InvalidXLogRecPtr;
}
if (bdr_my_locks_database->lockcount == 0)
bdr_locks_on_unlock();
LWLockRelease(bdr_locks_ctl->lock);
}
systable_endscan(scan);
UnregisterSnapshot(snap);
heap_close(rel, NoLock);
CommitTransactionCommand();
(void) MemoryContextSwitchTo(old_ctx);
}
/*
* Function for checking if there is no conflicting BDR lock.
*
* Should be caled from ExecutorStart_hook.
*/
void
bdr_locks_check_dml(void)
{
if (bdr_skip_ddl_locking)
return;
bdr_locks_find_my_database(false);
/*
* The bdr is still starting up and hasn't loaded locks, wait for it.
* The statement_timeout will kill us if necessary.
*/
while (!bdr_my_locks_database->locked_and_loaded)
{
CHECK_FOR_INTERRUPTS();
/* Probably can't use latch here easily, since init didn't happen yet. */
pg_usleep(10000L);
}
/* Is this database locked against user initiated dml? */
pg_memory_barrier();
if (bdr_my_locks_database->lockcount > 0 && !this_xact_acquired_lock &&
bdr_my_locks_database->lock_type >= BDR_LOCK_WRITE)
{
TimestampTz canceltime;
bdr_locks_addwaiter(MyProc);
if (bdr_ddl_lock_timeout > 0 || LockTimeout > 0)
canceltime = TimestampTzPlusMilliseconds(GetCurrentTimestamp(),
bdr_ddl_lock_timeout > 0 ? bdr_ddl_lock_timeout : LockTimeout);
else
TIMESTAMP_NOEND(canceltime);
/* Wait for lock to be released. */
for (;;)
{
int rc;
if (!TIMESTAMP_IS_NOEND(canceltime) &&
GetCurrentTimestamp() < canceltime)
{
ereport(ERROR,
(errcode(ERRCODE_LOCK_NOT_AVAILABLE),
errmsg("canceling statement due to global lock timeout")));
}
CHECK_FOR_INTERRUPTS();
pg_memory_barrier();
if (bdr_my_locks_database->lockcount == 0 ||
bdr_my_locks_database->lock_type < BDR_LOCK_WRITE)
break;
rc = WaitLatch(&MyProc->procLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
10000L);
ResetLatch(&MyProc->procLatch);
/* emergency bailout if postmaster has died */
if (rc & WL_POSTMASTER_DEATH)
proc_exit(1);
}
}
}
/* Lock type conversion functions */
static char *
bdr_lock_type_to_name(BDRLockType lock_type)
{
switch (lock_type)
{
case BDR_LOCK_NOLOCK:
return "nolock";
case BDR_LOCK_DDL:
return "ddl_lock";
case BDR_LOCK_WRITE:
return "write_lock";
default:
elog(ERROR, "unknown lock type %d", lock_type);
}
}
static BDRLockType
bdr_lock_name_to_type(const char *lock_type)
{
if (strcmp(lock_type, "nolock") == 0)
return BDR_LOCK_NOLOCK;
else if (strcmp(lock_type, "ddl_lock") == 0)
return BDR_LOCK_DDL;
else if (strcmp(lock_type, "write_lock") == 0)
return BDR_LOCK_WRITE;
else
elog(ERROR, "unknown lock type %s", lock_type);
}
|
58769fd3c42a28061f3707f5192ce845deb9bff6
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/third_party/blink/web_tests/animations/interpolation/border-image-slice-interpolation-stability.html
|
46db6835b9de46c4889add1484877af3c09ffcf9
|
[
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C
| false
| false
| 510
|
html
|
border-image-slice-interpolation-stability.html
|
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="target"></div>
<script>
test(function() {
var player = target.animate([
{borderImageSlice: '50'},
{borderImageSlice: '50'},
], {
duration: 1,
fill: 'forwards',
easing: 'cubic-bezier(0, 1.5, 1, 1.5)',
});
player.pause();
player.currentTime = 0.6345195996109396
assert_equals(getComputedStyle(target).borderImageSlice, '50');
});
</script>
|
83421f62d67011096f630df8386087a021ea363e
|
a6f47c6b702055aa2cc1a9ee051017320a8c602b
|
/thirdparty/libvpx/vpx_dsp/arm/idct32x32_add_neon.c
|
025437eb963bc044a116e46f05be4d648a36064c
|
[
"FTL",
"Zlib",
"MIT",
"BSD-3-Clause",
"Bitstream-Vera",
"CC0-1.0",
"MPL-2.0",
"OFL-1.1",
"CC-BY-4.0",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown",
"Libpng"
] |
permissive
|
Stary2001/godot
|
849ca3045a687d9b34de7cc24a8b6d26f89f95bc
|
00c6ce9716ed542997bc2b59136bceb3729db970
|
refs/heads/3.5.2-stable_switch
| 2023-05-25T08:38:55.387308
| 2023-04-14T23:07:10
| 2023-04-23T20:32:29
| 148,190,960
| 306
| 38
|
MIT
| 2023-05-19T20:10:22
| 2018-09-10T17:11:15
|
C++
|
UTF-8
|
C
| false
| false
| 27,444
|
c
|
idct32x32_add_neon.c
|
/*
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <arm_neon.h>
#include "./vpx_config.h"
#include "vpx_dsp/txfm_common.h"
#define LOAD_FROM_TRANSPOSED(prev, first, second) \
q14s16 = vld1q_s16(trans_buf + first * 8); \
q13s16 = vld1q_s16(trans_buf + second * 8);
#define LOAD_FROM_OUTPUT(prev, first, second, qA, qB) \
qA = vld1q_s16(out + first * 32); \
qB = vld1q_s16(out + second * 32);
#define STORE_IN_OUTPUT(prev, first, second, qA, qB) \
vst1q_s16(out + first * 32, qA); \
vst1q_s16(out + second * 32, qB);
#define STORE_COMBINE_CENTER_RESULTS(r10, r9) \
__STORE_COMBINE_CENTER_RESULTS(r10, r9, stride, \
q6s16, q7s16, q8s16, q9s16);
static INLINE void __STORE_COMBINE_CENTER_RESULTS(
uint8_t *p1,
uint8_t *p2,
int stride,
int16x8_t q6s16,
int16x8_t q7s16,
int16x8_t q8s16,
int16x8_t q9s16) {
int16x4_t d8s16, d9s16, d10s16, d11s16;
d8s16 = vld1_s16((int16_t *)p1);
p1 += stride;
d11s16 = vld1_s16((int16_t *)p2);
p2 -= stride;
d9s16 = vld1_s16((int16_t *)p1);
d10s16 = vld1_s16((int16_t *)p2);
q7s16 = vrshrq_n_s16(q7s16, 6);
q8s16 = vrshrq_n_s16(q8s16, 6);
q9s16 = vrshrq_n_s16(q9s16, 6);
q6s16 = vrshrq_n_s16(q6s16, 6);
q7s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q7s16),
vreinterpret_u8_s16(d9s16)));
q8s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q8s16),
vreinterpret_u8_s16(d10s16)));
q9s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q9s16),
vreinterpret_u8_s16(d11s16)));
q6s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q6s16),
vreinterpret_u8_s16(d8s16)));
d9s16 = vreinterpret_s16_u8(vqmovun_s16(q7s16));
d10s16 = vreinterpret_s16_u8(vqmovun_s16(q8s16));
d11s16 = vreinterpret_s16_u8(vqmovun_s16(q9s16));
d8s16 = vreinterpret_s16_u8(vqmovun_s16(q6s16));
vst1_s16((int16_t *)p1, d9s16);
p1 -= stride;
vst1_s16((int16_t *)p2, d10s16);
p2 += stride;
vst1_s16((int16_t *)p1, d8s16);
vst1_s16((int16_t *)p2, d11s16);
return;
}
#define STORE_COMBINE_EXTREME_RESULTS(r7, r6); \
__STORE_COMBINE_EXTREME_RESULTS(r7, r6, stride, \
q4s16, q5s16, q6s16, q7s16);
static INLINE void __STORE_COMBINE_EXTREME_RESULTS(
uint8_t *p1,
uint8_t *p2,
int stride,
int16x8_t q4s16,
int16x8_t q5s16,
int16x8_t q6s16,
int16x8_t q7s16) {
int16x4_t d4s16, d5s16, d6s16, d7s16;
d4s16 = vld1_s16((int16_t *)p1);
p1 += stride;
d7s16 = vld1_s16((int16_t *)p2);
p2 -= stride;
d5s16 = vld1_s16((int16_t *)p1);
d6s16 = vld1_s16((int16_t *)p2);
q5s16 = vrshrq_n_s16(q5s16, 6);
q6s16 = vrshrq_n_s16(q6s16, 6);
q7s16 = vrshrq_n_s16(q7s16, 6);
q4s16 = vrshrq_n_s16(q4s16, 6);
q5s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q5s16),
vreinterpret_u8_s16(d5s16)));
q6s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q6s16),
vreinterpret_u8_s16(d6s16)));
q7s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q7s16),
vreinterpret_u8_s16(d7s16)));
q4s16 = vreinterpretq_s16_u16(vaddw_u8(vreinterpretq_u16_s16(q4s16),
vreinterpret_u8_s16(d4s16)));
d5s16 = vreinterpret_s16_u8(vqmovun_s16(q5s16));
d6s16 = vreinterpret_s16_u8(vqmovun_s16(q6s16));
d7s16 = vreinterpret_s16_u8(vqmovun_s16(q7s16));
d4s16 = vreinterpret_s16_u8(vqmovun_s16(q4s16));
vst1_s16((int16_t *)p1, d5s16);
p1 -= stride;
vst1_s16((int16_t *)p2, d6s16);
p2 += stride;
vst1_s16((int16_t *)p2, d7s16);
vst1_s16((int16_t *)p1, d4s16);
return;
}
#define DO_BUTTERFLY_STD(const_1, const_2, qA, qB) \
DO_BUTTERFLY(q14s16, q13s16, const_1, const_2, qA, qB);
static INLINE void DO_BUTTERFLY(
int16x8_t q14s16,
int16x8_t q13s16,
int16_t first_const,
int16_t second_const,
int16x8_t *qAs16,
int16x8_t *qBs16) {
int16x4_t d30s16, d31s16;
int32x4_t q8s32, q9s32, q10s32, q11s32, q12s32, q15s32;
int16x4_t dCs16, dDs16, dAs16, dBs16;
dCs16 = vget_low_s16(q14s16);
dDs16 = vget_high_s16(q14s16);
dAs16 = vget_low_s16(q13s16);
dBs16 = vget_high_s16(q13s16);
d30s16 = vdup_n_s16(first_const);
d31s16 = vdup_n_s16(second_const);
q8s32 = vmull_s16(dCs16, d30s16);
q10s32 = vmull_s16(dAs16, d31s16);
q9s32 = vmull_s16(dDs16, d30s16);
q11s32 = vmull_s16(dBs16, d31s16);
q12s32 = vmull_s16(dCs16, d31s16);
q8s32 = vsubq_s32(q8s32, q10s32);
q9s32 = vsubq_s32(q9s32, q11s32);
q10s32 = vmull_s16(dDs16, d31s16);
q11s32 = vmull_s16(dAs16, d30s16);
q15s32 = vmull_s16(dBs16, d30s16);
q11s32 = vaddq_s32(q12s32, q11s32);
q10s32 = vaddq_s32(q10s32, q15s32);
*qAs16 = vcombine_s16(vqrshrn_n_s32(q8s32, 14),
vqrshrn_n_s32(q9s32, 14));
*qBs16 = vcombine_s16(vqrshrn_n_s32(q11s32, 14),
vqrshrn_n_s32(q10s32, 14));
return;
}
static INLINE void idct32_transpose_pair(
int16_t *input,
int16_t *t_buf) {
int16_t *in;
int i;
const int stride = 32;
int16x4_t d16s16, d17s16, d18s16, d19s16, d20s16, d21s16, d22s16, d23s16;
int16x4_t d24s16, d25s16, d26s16, d27s16, d28s16, d29s16, d30s16, d31s16;
int16x8_t q8s16, q9s16, q10s16, q11s16, q12s16, q13s16, q14s16, q15s16;
int32x4x2_t q0x2s32, q1x2s32, q2x2s32, q3x2s32;
int16x8x2_t q0x2s16, q1x2s16, q2x2s16, q3x2s16;
for (i = 0; i < 4; i++, input += 8) {
in = input;
q8s16 = vld1q_s16(in);
in += stride;
q9s16 = vld1q_s16(in);
in += stride;
q10s16 = vld1q_s16(in);
in += stride;
q11s16 = vld1q_s16(in);
in += stride;
q12s16 = vld1q_s16(in);
in += stride;
q13s16 = vld1q_s16(in);
in += stride;
q14s16 = vld1q_s16(in);
in += stride;
q15s16 = vld1q_s16(in);
d16s16 = vget_low_s16(q8s16);
d17s16 = vget_high_s16(q8s16);
d18s16 = vget_low_s16(q9s16);
d19s16 = vget_high_s16(q9s16);
d20s16 = vget_low_s16(q10s16);
d21s16 = vget_high_s16(q10s16);
d22s16 = vget_low_s16(q11s16);
d23s16 = vget_high_s16(q11s16);
d24s16 = vget_low_s16(q12s16);
d25s16 = vget_high_s16(q12s16);
d26s16 = vget_low_s16(q13s16);
d27s16 = vget_high_s16(q13s16);
d28s16 = vget_low_s16(q14s16);
d29s16 = vget_high_s16(q14s16);
d30s16 = vget_low_s16(q15s16);
d31s16 = vget_high_s16(q15s16);
q8s16 = vcombine_s16(d16s16, d24s16); // vswp d17, d24
q9s16 = vcombine_s16(d18s16, d26s16); // vswp d19, d26
q10s16 = vcombine_s16(d20s16, d28s16); // vswp d21, d28
q11s16 = vcombine_s16(d22s16, d30s16); // vswp d23, d30
q12s16 = vcombine_s16(d17s16, d25s16);
q13s16 = vcombine_s16(d19s16, d27s16);
q14s16 = vcombine_s16(d21s16, d29s16);
q15s16 = vcombine_s16(d23s16, d31s16);
q0x2s32 = vtrnq_s32(vreinterpretq_s32_s16(q8s16),
vreinterpretq_s32_s16(q10s16));
q1x2s32 = vtrnq_s32(vreinterpretq_s32_s16(q9s16),
vreinterpretq_s32_s16(q11s16));
q2x2s32 = vtrnq_s32(vreinterpretq_s32_s16(q12s16),
vreinterpretq_s32_s16(q14s16));
q3x2s32 = vtrnq_s32(vreinterpretq_s32_s16(q13s16),
vreinterpretq_s32_s16(q15s16));
q0x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q0x2s32.val[0]), // q8
vreinterpretq_s16_s32(q1x2s32.val[0])); // q9
q1x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q0x2s32.val[1]), // q10
vreinterpretq_s16_s32(q1x2s32.val[1])); // q11
q2x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q2x2s32.val[0]), // q12
vreinterpretq_s16_s32(q3x2s32.val[0])); // q13
q3x2s16 = vtrnq_s16(vreinterpretq_s16_s32(q2x2s32.val[1]), // q14
vreinterpretq_s16_s32(q3x2s32.val[1])); // q15
vst1q_s16(t_buf, q0x2s16.val[0]);
t_buf += 8;
vst1q_s16(t_buf, q0x2s16.val[1]);
t_buf += 8;
vst1q_s16(t_buf, q1x2s16.val[0]);
t_buf += 8;
vst1q_s16(t_buf, q1x2s16.val[1]);
t_buf += 8;
vst1q_s16(t_buf, q2x2s16.val[0]);
t_buf += 8;
vst1q_s16(t_buf, q2x2s16.val[1]);
t_buf += 8;
vst1q_s16(t_buf, q3x2s16.val[0]);
t_buf += 8;
vst1q_s16(t_buf, q3x2s16.val[1]);
t_buf += 8;
}
return;
}
static INLINE void idct32_bands_end_1st_pass(
int16_t *out,
int16x8_t q2s16,
int16x8_t q3s16,
int16x8_t q6s16,
int16x8_t q7s16,
int16x8_t q8s16,
int16x8_t q9s16,
int16x8_t q10s16,
int16x8_t q11s16,
int16x8_t q12s16,
int16x8_t q13s16,
int16x8_t q14s16,
int16x8_t q15s16) {
int16x8_t q0s16, q1s16, q4s16, q5s16;
STORE_IN_OUTPUT(17, 16, 17, q6s16, q7s16);
STORE_IN_OUTPUT(17, 14, 15, q8s16, q9s16);
LOAD_FROM_OUTPUT(15, 30, 31, q0s16, q1s16);
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_IN_OUTPUT(31, 30, 31, q6s16, q7s16);
STORE_IN_OUTPUT(31, 0, 1, q4s16, q5s16);
LOAD_FROM_OUTPUT(1, 12, 13, q0s16, q1s16);
q2s16 = vaddq_s16(q10s16, q1s16);
q3s16 = vaddq_s16(q11s16, q0s16);
q4s16 = vsubq_s16(q11s16, q0s16);
q5s16 = vsubq_s16(q10s16, q1s16);
LOAD_FROM_OUTPUT(13, 18, 19, q0s16, q1s16);
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
STORE_IN_OUTPUT(19, 18, 19, q6s16, q7s16);
STORE_IN_OUTPUT(19, 12, 13, q8s16, q9s16);
LOAD_FROM_OUTPUT(13, 28, 29, q0s16, q1s16);
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_IN_OUTPUT(29, 28, 29, q6s16, q7s16);
STORE_IN_OUTPUT(29, 2, 3, q4s16, q5s16);
LOAD_FROM_OUTPUT(3, 10, 11, q0s16, q1s16);
q2s16 = vaddq_s16(q12s16, q1s16);
q3s16 = vaddq_s16(q13s16, q0s16);
q4s16 = vsubq_s16(q13s16, q0s16);
q5s16 = vsubq_s16(q12s16, q1s16);
LOAD_FROM_OUTPUT(11, 20, 21, q0s16, q1s16);
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
STORE_IN_OUTPUT(21, 20, 21, q6s16, q7s16);
STORE_IN_OUTPUT(21, 10, 11, q8s16, q9s16);
LOAD_FROM_OUTPUT(11, 26, 27, q0s16, q1s16);
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_IN_OUTPUT(27, 26, 27, q6s16, q7s16);
STORE_IN_OUTPUT(27, 4, 5, q4s16, q5s16);
LOAD_FROM_OUTPUT(5, 8, 9, q0s16, q1s16);
q2s16 = vaddq_s16(q14s16, q1s16);
q3s16 = vaddq_s16(q15s16, q0s16);
q4s16 = vsubq_s16(q15s16, q0s16);
q5s16 = vsubq_s16(q14s16, q1s16);
LOAD_FROM_OUTPUT(9, 22, 23, q0s16, q1s16);
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
STORE_IN_OUTPUT(23, 22, 23, q6s16, q7s16);
STORE_IN_OUTPUT(23, 8, 9, q8s16, q9s16);
LOAD_FROM_OUTPUT(9, 24, 25, q0s16, q1s16);
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_IN_OUTPUT(25, 24, 25, q6s16, q7s16);
STORE_IN_OUTPUT(25, 6, 7, q4s16, q5s16);
return;
}
static INLINE void idct32_bands_end_2nd_pass(
int16_t *out,
uint8_t *dest,
int stride,
int16x8_t q2s16,
int16x8_t q3s16,
int16x8_t q6s16,
int16x8_t q7s16,
int16x8_t q8s16,
int16x8_t q9s16,
int16x8_t q10s16,
int16x8_t q11s16,
int16x8_t q12s16,
int16x8_t q13s16,
int16x8_t q14s16,
int16x8_t q15s16) {
uint8_t *r6 = dest + 31 * stride;
uint8_t *r7 = dest/* + 0 * stride*/;
uint8_t *r9 = dest + 15 * stride;
uint8_t *r10 = dest + 16 * stride;
int str2 = stride << 1;
int16x8_t q0s16, q1s16, q4s16, q5s16;
STORE_COMBINE_CENTER_RESULTS(r10, r9);
r10 += str2; r9 -= str2;
LOAD_FROM_OUTPUT(17, 30, 31, q0s16, q1s16)
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_COMBINE_EXTREME_RESULTS(r7, r6);
r7 += str2; r6 -= str2;
LOAD_FROM_OUTPUT(31, 12, 13, q0s16, q1s16)
q2s16 = vaddq_s16(q10s16, q1s16);
q3s16 = vaddq_s16(q11s16, q0s16);
q4s16 = vsubq_s16(q11s16, q0s16);
q5s16 = vsubq_s16(q10s16, q1s16);
LOAD_FROM_OUTPUT(13, 18, 19, q0s16, q1s16)
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
STORE_COMBINE_CENTER_RESULTS(r10, r9);
r10 += str2; r9 -= str2;
LOAD_FROM_OUTPUT(19, 28, 29, q0s16, q1s16)
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_COMBINE_EXTREME_RESULTS(r7, r6);
r7 += str2; r6 -= str2;
LOAD_FROM_OUTPUT(29, 10, 11, q0s16, q1s16)
q2s16 = vaddq_s16(q12s16, q1s16);
q3s16 = vaddq_s16(q13s16, q0s16);
q4s16 = vsubq_s16(q13s16, q0s16);
q5s16 = vsubq_s16(q12s16, q1s16);
LOAD_FROM_OUTPUT(11, 20, 21, q0s16, q1s16)
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
STORE_COMBINE_CENTER_RESULTS(r10, r9);
r10 += str2; r9 -= str2;
LOAD_FROM_OUTPUT(21, 26, 27, q0s16, q1s16)
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_COMBINE_EXTREME_RESULTS(r7, r6);
r7 += str2; r6 -= str2;
LOAD_FROM_OUTPUT(27, 8, 9, q0s16, q1s16)
q2s16 = vaddq_s16(q14s16, q1s16);
q3s16 = vaddq_s16(q15s16, q0s16);
q4s16 = vsubq_s16(q15s16, q0s16);
q5s16 = vsubq_s16(q14s16, q1s16);
LOAD_FROM_OUTPUT(9, 22, 23, q0s16, q1s16)
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
STORE_COMBINE_CENTER_RESULTS(r10, r9);
LOAD_FROM_OUTPUT(23, 24, 25, q0s16, q1s16)
q4s16 = vaddq_s16(q2s16, q1s16);
q5s16 = vaddq_s16(q3s16, q0s16);
q6s16 = vsubq_s16(q3s16, q0s16);
q7s16 = vsubq_s16(q2s16, q1s16);
STORE_COMBINE_EXTREME_RESULTS(r7, r6);
return;
}
void vpx_idct32x32_1024_add_neon(
int16_t *input,
uint8_t *dest,
int stride) {
int i, idct32_pass_loop;
int16_t trans_buf[32 * 8];
int16_t pass1[32 * 32];
int16_t pass2[32 * 32];
int16_t *out;
int16x8_t q0s16, q1s16, q2s16, q3s16, q4s16, q5s16, q6s16, q7s16;
int16x8_t q8s16, q9s16, q10s16, q11s16, q12s16, q13s16, q14s16, q15s16;
for (idct32_pass_loop = 0, out = pass1;
idct32_pass_loop < 2;
idct32_pass_loop++,
input = pass1, // the input of pass2 is the result of pass1
out = pass2) {
for (i = 0;
i < 4; i++,
input += 32 * 8, out += 8) { // idct32_bands_loop
idct32_transpose_pair(input, trans_buf);
// -----------------------------------------
// BLOCK A: 16-19,28-31
// -----------------------------------------
// generate 16,17,30,31
// part of stage 1
LOAD_FROM_TRANSPOSED(0, 1, 31)
DO_BUTTERFLY_STD(cospi_31_64, cospi_1_64, &q0s16, &q2s16)
LOAD_FROM_TRANSPOSED(31, 17, 15)
DO_BUTTERFLY_STD(cospi_15_64, cospi_17_64, &q1s16, &q3s16)
// part of stage 2
q4s16 = vaddq_s16(q0s16, q1s16);
q13s16 = vsubq_s16(q0s16, q1s16);
q6s16 = vaddq_s16(q2s16, q3s16);
q14s16 = vsubq_s16(q2s16, q3s16);
// part of stage 3
DO_BUTTERFLY_STD(cospi_28_64, cospi_4_64, &q5s16, &q7s16)
// generate 18,19,28,29
// part of stage 1
LOAD_FROM_TRANSPOSED(15, 9, 23)
DO_BUTTERFLY_STD(cospi_23_64, cospi_9_64, &q0s16, &q2s16)
LOAD_FROM_TRANSPOSED(23, 25, 7)
DO_BUTTERFLY_STD(cospi_7_64, cospi_25_64, &q1s16, &q3s16)
// part of stage 2
q13s16 = vsubq_s16(q3s16, q2s16);
q3s16 = vaddq_s16(q3s16, q2s16);
q14s16 = vsubq_s16(q1s16, q0s16);
q2s16 = vaddq_s16(q1s16, q0s16);
// part of stage 3
DO_BUTTERFLY_STD(-cospi_4_64, -cospi_28_64, &q1s16, &q0s16)
// part of stage 4
q8s16 = vaddq_s16(q4s16, q2s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q10s16 = vaddq_s16(q7s16, q1s16);
q15s16 = vaddq_s16(q6s16, q3s16);
q13s16 = vsubq_s16(q5s16, q0s16);
q14s16 = vsubq_s16(q7s16, q1s16);
STORE_IN_OUTPUT(0, 16, 31, q8s16, q15s16)
STORE_IN_OUTPUT(31, 17, 30, q9s16, q10s16)
// part of stage 5
DO_BUTTERFLY_STD(cospi_24_64, cospi_8_64, &q0s16, &q1s16)
STORE_IN_OUTPUT(30, 29, 18, q1s16, q0s16)
// part of stage 4
q13s16 = vsubq_s16(q4s16, q2s16);
q14s16 = vsubq_s16(q6s16, q3s16);
// part of stage 5
DO_BUTTERFLY_STD(cospi_24_64, cospi_8_64, &q4s16, &q6s16)
STORE_IN_OUTPUT(18, 19, 28, q4s16, q6s16)
// -----------------------------------------
// BLOCK B: 20-23,24-27
// -----------------------------------------
// generate 20,21,26,27
// part of stage 1
LOAD_FROM_TRANSPOSED(7, 5, 27)
DO_BUTTERFLY_STD(cospi_27_64, cospi_5_64, &q0s16, &q2s16)
LOAD_FROM_TRANSPOSED(27, 21, 11)
DO_BUTTERFLY_STD(cospi_11_64, cospi_21_64, &q1s16, &q3s16)
// part of stage 2
q13s16 = vsubq_s16(q0s16, q1s16);
q0s16 = vaddq_s16(q0s16, q1s16);
q14s16 = vsubq_s16(q2s16, q3s16);
q2s16 = vaddq_s16(q2s16, q3s16);
// part of stage 3
DO_BUTTERFLY_STD(cospi_12_64, cospi_20_64, &q1s16, &q3s16)
// generate 22,23,24,25
// part of stage 1
LOAD_FROM_TRANSPOSED(11, 13, 19)
DO_BUTTERFLY_STD(cospi_19_64, cospi_13_64, &q5s16, &q7s16)
LOAD_FROM_TRANSPOSED(19, 29, 3)
DO_BUTTERFLY_STD(cospi_3_64, cospi_29_64, &q4s16, &q6s16)
// part of stage 2
q14s16 = vsubq_s16(q4s16, q5s16);
q5s16 = vaddq_s16(q4s16, q5s16);
q13s16 = vsubq_s16(q6s16, q7s16);
q6s16 = vaddq_s16(q6s16, q7s16);
// part of stage 3
DO_BUTTERFLY_STD(-cospi_20_64, -cospi_12_64, &q4s16, &q7s16)
// part of stage 4
q10s16 = vaddq_s16(q7s16, q1s16);
q11s16 = vaddq_s16(q5s16, q0s16);
q12s16 = vaddq_s16(q6s16, q2s16);
q15s16 = vaddq_s16(q4s16, q3s16);
// part of stage 6
LOAD_FROM_OUTPUT(28, 16, 17, q14s16, q13s16)
q8s16 = vaddq_s16(q14s16, q11s16);
q9s16 = vaddq_s16(q13s16, q10s16);
q13s16 = vsubq_s16(q13s16, q10s16);
q11s16 = vsubq_s16(q14s16, q11s16);
STORE_IN_OUTPUT(17, 17, 16, q9s16, q8s16)
LOAD_FROM_OUTPUT(16, 30, 31, q14s16, q9s16)
q8s16 = vsubq_s16(q9s16, q12s16);
q10s16 = vaddq_s16(q14s16, q15s16);
q14s16 = vsubq_s16(q14s16, q15s16);
q12s16 = vaddq_s16(q9s16, q12s16);
STORE_IN_OUTPUT(31, 30, 31, q10s16, q12s16)
// part of stage 7
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q13s16, &q14s16)
STORE_IN_OUTPUT(31, 25, 22, q14s16, q13s16)
q13s16 = q11s16;
q14s16 = q8s16;
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q13s16, &q14s16)
STORE_IN_OUTPUT(22, 24, 23, q14s16, q13s16)
// part of stage 4
q14s16 = vsubq_s16(q5s16, q0s16);
q13s16 = vsubq_s16(q6s16, q2s16);
DO_BUTTERFLY_STD(-cospi_8_64, -cospi_24_64, &q5s16, &q6s16);
q14s16 = vsubq_s16(q7s16, q1s16);
q13s16 = vsubq_s16(q4s16, q3s16);
DO_BUTTERFLY_STD(-cospi_8_64, -cospi_24_64, &q0s16, &q1s16);
// part of stage 6
LOAD_FROM_OUTPUT(23, 18, 19, q14s16, q13s16)
q8s16 = vaddq_s16(q14s16, q1s16);
q9s16 = vaddq_s16(q13s16, q6s16);
q13s16 = vsubq_s16(q13s16, q6s16);
q1s16 = vsubq_s16(q14s16, q1s16);
STORE_IN_OUTPUT(19, 18, 19, q8s16, q9s16)
LOAD_FROM_OUTPUT(19, 28, 29, q8s16, q9s16)
q14s16 = vsubq_s16(q8s16, q5s16);
q10s16 = vaddq_s16(q8s16, q5s16);
q11s16 = vaddq_s16(q9s16, q0s16);
q0s16 = vsubq_s16(q9s16, q0s16);
STORE_IN_OUTPUT(29, 28, 29, q10s16, q11s16)
// part of stage 7
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q13s16, &q14s16)
STORE_IN_OUTPUT(29, 20, 27, q13s16, q14s16)
DO_BUTTERFLY(q0s16, q1s16, cospi_16_64, cospi_16_64,
&q1s16, &q0s16);
STORE_IN_OUTPUT(27, 21, 26, q1s16, q0s16)
// -----------------------------------------
// BLOCK C: 8-10,11-15
// -----------------------------------------
// generate 8,9,14,15
// part of stage 2
LOAD_FROM_TRANSPOSED(3, 2, 30)
DO_BUTTERFLY_STD(cospi_30_64, cospi_2_64, &q0s16, &q2s16)
LOAD_FROM_TRANSPOSED(30, 18, 14)
DO_BUTTERFLY_STD(cospi_14_64, cospi_18_64, &q1s16, &q3s16)
// part of stage 3
q13s16 = vsubq_s16(q0s16, q1s16);
q0s16 = vaddq_s16(q0s16, q1s16);
q14s16 = vsubq_s16(q2s16, q3s16);
q2s16 = vaddq_s16(q2s16, q3s16);
// part of stage 4
DO_BUTTERFLY_STD(cospi_24_64, cospi_8_64, &q1s16, &q3s16)
// generate 10,11,12,13
// part of stage 2
LOAD_FROM_TRANSPOSED(14, 10, 22)
DO_BUTTERFLY_STD(cospi_22_64, cospi_10_64, &q5s16, &q7s16)
LOAD_FROM_TRANSPOSED(22, 26, 6)
DO_BUTTERFLY_STD(cospi_6_64, cospi_26_64, &q4s16, &q6s16)
// part of stage 3
q14s16 = vsubq_s16(q4s16, q5s16);
q5s16 = vaddq_s16(q4s16, q5s16);
q13s16 = vsubq_s16(q6s16, q7s16);
q6s16 = vaddq_s16(q6s16, q7s16);
// part of stage 4
DO_BUTTERFLY_STD(-cospi_8_64, -cospi_24_64, &q4s16, &q7s16)
// part of stage 5
q8s16 = vaddq_s16(q0s16, q5s16);
q9s16 = vaddq_s16(q1s16, q7s16);
q13s16 = vsubq_s16(q1s16, q7s16);
q14s16 = vsubq_s16(q3s16, q4s16);
q10s16 = vaddq_s16(q3s16, q4s16);
q15s16 = vaddq_s16(q2s16, q6s16);
STORE_IN_OUTPUT(26, 8, 15, q8s16, q15s16)
STORE_IN_OUTPUT(15, 9, 14, q9s16, q10s16)
// part of stage 6
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q1s16, &q3s16)
STORE_IN_OUTPUT(14, 13, 10, q3s16, q1s16)
q13s16 = vsubq_s16(q0s16, q5s16);
q14s16 = vsubq_s16(q2s16, q6s16);
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q1s16, &q3s16)
STORE_IN_OUTPUT(10, 11, 12, q1s16, q3s16)
// -----------------------------------------
// BLOCK D: 0-3,4-7
// -----------------------------------------
// generate 4,5,6,7
// part of stage 3
LOAD_FROM_TRANSPOSED(6, 4, 28)
DO_BUTTERFLY_STD(cospi_28_64, cospi_4_64, &q0s16, &q2s16)
LOAD_FROM_TRANSPOSED(28, 20, 12)
DO_BUTTERFLY_STD(cospi_12_64, cospi_20_64, &q1s16, &q3s16)
// part of stage 4
q13s16 = vsubq_s16(q0s16, q1s16);
q0s16 = vaddq_s16(q0s16, q1s16);
q14s16 = vsubq_s16(q2s16, q3s16);
q2s16 = vaddq_s16(q2s16, q3s16);
// part of stage 5
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q1s16, &q3s16)
// generate 0,1,2,3
// part of stage 4
LOAD_FROM_TRANSPOSED(12, 0, 16)
DO_BUTTERFLY_STD(cospi_16_64, cospi_16_64, &q5s16, &q7s16)
LOAD_FROM_TRANSPOSED(16, 8, 24)
DO_BUTTERFLY_STD(cospi_24_64, cospi_8_64, &q14s16, &q6s16)
// part of stage 5
q4s16 = vaddq_s16(q7s16, q6s16);
q7s16 = vsubq_s16(q7s16, q6s16);
q6s16 = vsubq_s16(q5s16, q14s16);
q5s16 = vaddq_s16(q5s16, q14s16);
// part of stage 6
q8s16 = vaddq_s16(q4s16, q2s16);
q9s16 = vaddq_s16(q5s16, q3s16);
q10s16 = vaddq_s16(q6s16, q1s16);
q11s16 = vaddq_s16(q7s16, q0s16);
q12s16 = vsubq_s16(q7s16, q0s16);
q13s16 = vsubq_s16(q6s16, q1s16);
q14s16 = vsubq_s16(q5s16, q3s16);
q15s16 = vsubq_s16(q4s16, q2s16);
// part of stage 7
LOAD_FROM_OUTPUT(12, 14, 15, q0s16, q1s16)
q2s16 = vaddq_s16(q8s16, q1s16);
q3s16 = vaddq_s16(q9s16, q0s16);
q4s16 = vsubq_s16(q9s16, q0s16);
q5s16 = vsubq_s16(q8s16, q1s16);
LOAD_FROM_OUTPUT(15, 16, 17, q0s16, q1s16)
q8s16 = vaddq_s16(q4s16, q1s16);
q9s16 = vaddq_s16(q5s16, q0s16);
q6s16 = vsubq_s16(q5s16, q0s16);
q7s16 = vsubq_s16(q4s16, q1s16);
if (idct32_pass_loop == 0) {
idct32_bands_end_1st_pass(out,
q2s16, q3s16, q6s16, q7s16, q8s16, q9s16,
q10s16, q11s16, q12s16, q13s16, q14s16, q15s16);
} else {
idct32_bands_end_2nd_pass(out, dest, stride,
q2s16, q3s16, q6s16, q7s16, q8s16, q9s16,
q10s16, q11s16, q12s16, q13s16, q14s16, q15s16);
dest += 8;
}
}
}
return;
}
|
68885133a16087aa8d28f07cc52db1d1f01707bb
|
ae31542273a142210a1ff30fb76ed9d45d38eba9
|
/src/bin/scripts/common.h
|
76399510d11130f1cf82b6a91548eb1cdf09d5d2
|
[
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"PostgreSQL",
"OpenSSL",
"LicenseRef-scancode-stream-benchmark",
"ISC",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-ssleay-windows",
"BSD-2-Clause",
"Python-2.0"
] |
permissive
|
greenplum-db/gpdb
|
8334837bceb2d5d51a684500793d11b190117c6a
|
2c0f8f0fb24a2d7a7da114dc80f5f5a2712fca50
|
refs/heads/main
| 2023-08-22T02:03:03.806269
| 2023-08-21T22:59:53
| 2023-08-22T01:17:10
| 44,781,140
| 6,417
| 2,082
|
Apache-2.0
| 2023-09-14T20:33:42
| 2015-10-23T00:25:17
|
C
|
UTF-8
|
C
| false
| false
| 2,259
|
h
|
common.h
|
/*
* common.h
* Common support routines for bin/scripts/
*
* Copyright (c) 2003-2019, PostgreSQL Global Development Group
*
* src/bin/scripts/common.h
*/
#ifndef COMMON_H
#define COMMON_H
#include "common/username.h"
#include "libpq-fe.h"
#include "getopt_long.h" /* pgrminclude ignore */
#include "pqexpbuffer.h" /* pgrminclude ignore */
enum trivalue
{
TRI_DEFAULT,
TRI_NO,
TRI_YES
};
extern bool CancelRequested;
/* Parameters needed by connectDatabase/connectMaintenanceDatabase */
typedef struct _connParams
{
/* These fields record the actual command line parameters */
const char *dbname; /* this may be a connstring! */
const char *pghost;
const char *pgport;
const char *pguser;
enum trivalue prompt_password;
/* If not NULL, this overrides the dbname obtained from command line */
/* (but *only* the DB name, not anything else in the connstring) */
const char *override_dbname;
} ConnParams;
typedef void (*help_handler) (const char *progname);
extern void handle_help_version_opts(int argc, char *argv[],
const char *fixed_progname,
help_handler hlp);
extern PGconn *connectDatabase(const ConnParams *cparams,
const char *progname,
bool echo, bool fail_ok,
bool allow_password_reuse);
extern PGconn *connectMaintenanceDatabase(ConnParams *cparams,
const char *progname, bool echo);
extern PGresult *executeQuery(PGconn *conn, const char *query,
const char *progname, bool echo);
extern void executeCommand(PGconn *conn, const char *query,
const char *progname, bool echo);
extern bool executeMaintenanceCommand(PGconn *conn, const char *query,
bool echo);
extern void splitTableColumnsSpec(const char *spec, int encoding,
char **table, const char **columns);
extern void appendQualifiedRelation(PQExpBuffer buf, const char *name,
PGconn *conn, const char *progname, bool echo);
extern void appendQualifiedRelation(PQExpBuffer buf, const char *name,
PGconn *conn, const char *progname, bool echo);
extern bool yesno_prompt(const char *question);
extern void setup_cancel_handler(void);
extern void SetCancelConn(PGconn *conn);
extern void ResetCancelConn(void);
#endif /* COMMON_H */
|
7769226b697286c118a4cf1116848dce15a1f477
|
2898fa4f2ad766afa0495a837f59fe95daa081a7
|
/examples/c/error-codes/undefined/UB-EIO4-good.c
|
660c0d89a22c676fd0192d0df414507b52363d95
|
[
"NCSA"
] |
permissive
|
kframework/c-semantics
|
12fcc1b1bf1f7792636d1c37f6f7bb1b89a392b5
|
e6879d14455771aa0cb3e3d201131d4d763a73a2
|
refs/heads/master
| 2023-07-31T23:57:03.316456
| 2022-02-01T17:50:31
| 2022-02-01T17:50:31
| 11,747,541
| 312
| 52
|
NOASSERTION
| 2022-02-01T17:50:33
| 2013-07-29T19:13:25
|
C
|
UTF-8
|
C
| false
| false
| 175
|
c
|
UB-EIO4-good.c
|
// Copyright (c) 2015 Runtime Verification, Inc. (RV-Match team). All Rights Reserved.
int main() {
volatile int x;
volatile char *y = (char*)&x;
*y = 5;
return 0;
}
|
430dcc88a05abf02a0fcff0069ab3a92d532d848
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/thermal/sunxi_ths.c
|
44ab80ab760360cdb8ee8dfd699df68d01c5bcbe
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 14,600
|
c
|
sunxi_ths.c
|
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/input.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/thermal.h>
#include <linux/of_platform.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#ifdef CONFIG_PM
#include <linux/pm.h>
#endif
#include "sunxi_ths.h"
u32 thermal_debug_mask = 0;
extern struct sunxi_ths_sensor_ops sunxi_ths_ops;
static struct sunxi_ths_data *ths_data;
static struct workqueue_struct *thermal_wq;
static long save_tmp = 20;
static unsigned int ths_suspending = 0;
static unsigned int ths_emu = 0;
static ssize_t sunxi_ths_input_delay_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
thsprintk(DEBUG_DATA_INFO, "%d, %s\n", atomic_read(&ths_data->input_delay), __FUNCTION__);
return sprintf(buf, "%d\n", atomic_read(&ths_data->input_delay));
}
static ssize_t sunxi_ths_input_delay_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long data;
int error;
error = strict_strtoul(buf, 10, &data);
if (error)
return error;
if (data > THERMAL_DATA_DELAY)
data = THERMAL_DATA_DELAY;
atomic_set(&ths_data->input_delay, (unsigned int) data);
return count;
}
static ssize_t sunxi_ths_input_enable_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
thsprintk(DEBUG_DATA_INFO, "%d, %s\n", atomic_read(&ths_data->input_enable), __FUNCTION__);
return sprintf(buf, "%d\n", atomic_read(&ths_data->input_enable));
}
static void sunxi_ths_input_set_enable(struct device *dev, int enable)
{
int pre_enable = atomic_read(&ths_data->input_enable);
mutex_lock(&ths_data->input_enable_mutex);
if (enable) {
if (pre_enable == 0) {
schedule_delayed_work(&ths_data->input_work,
msecs_to_jiffies(atomic_read(&ths_data->input_delay)));
atomic_set(&ths_data->input_enable, 1);
}
} else {
if (pre_enable == 1) {
cancel_delayed_work_sync(&ths_data->input_work);
atomic_set(&ths_data->input_enable, 0);
}
}
mutex_unlock(&ths_data->input_enable_mutex);
}
static ssize_t sunxi_ths_input_enable_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long data;
int error;
error = strict_strtoul(buf, 10, &data);
if (error)
return error;
if ((data == 0)||(data==1)) {
sunxi_ths_input_set_enable(dev,data);
}
return count;
}
static ssize_t sunxi_ths_show_emu(struct device *dev,
struct device_attribute *attr, char *buf)
{
thsprintk(DEBUG_DATA_INFO, "%d, %s\n", ths_emu, __FUNCTION__);
return sprintf(buf, "%d\n", ths_emu);
}
static ssize_t sunxi_ths_set_emu(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long data;
int error;
error = strict_strtoul(buf, 10, &data);
if (error)
return error;
ths_emu = (unsigned int) data;
return count;
}
static ssize_t sunxi_ths_set_emutemp(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned long data;
int error;
error = strict_strtoul(buf, 10, &data);
if (error)
return error;
save_tmp = data;
return count;
}
static DEVICE_ATTR(delay, S_IRUGO|S_IWUSR|S_IWGRP,
sunxi_ths_input_delay_show, sunxi_ths_input_delay_store);
static DEVICE_ATTR(enable, S_IRUGO|S_IWUSR|S_IWGRP,
sunxi_ths_input_enable_show, sunxi_ths_input_enable_store);
static DEVICE_ATTR(emulate, S_IRUGO|S_IWUSR|S_IWGRP,
sunxi_ths_show_emu, sunxi_ths_set_emu);
static DEVICE_ATTR(temperature, S_IRUGO|S_IWUSR|S_IWGRP,
NULL, sunxi_ths_set_emutemp);
static struct attribute *sunxi_ths_input_attributes[] = {
&dev_attr_delay.attr,
&dev_attr_enable.attr,
&dev_attr_emulate.attr,
&dev_attr_temperature.attr,
NULL
};
static struct attribute_group sunxi_ths_input_attribute_group = {
.attrs = sunxi_ths_input_attributes
};
static void sunxi_ths_input_work_func(struct work_struct *work)
{
static long tempetature = 5;
struct sunxi_ths_data *data = container_of((struct delayed_work *)work,
struct sunxi_ths_data, input_work);
unsigned long delay = msecs_to_jiffies(atomic_read(&data->input_delay));
thermal_zone_get_temp(data->tz, &tempetature);
input_report_abs(data->ths_input_dev, ABS_MISC, tempetature);
input_sync(data->ths_input_dev);
thsprintk(DEBUG_DATA_INFO, "%s: temperature %ld\n", __func__, tempetature);
schedule_delayed_work(&data->input_work, delay);
}
static int sunxi_ths_input_init(struct sunxi_ths_data *data)
{
int err = 0;
data->ths_input_dev = input_allocate_device();
if (IS_ERR_OR_NULL(data->ths_input_dev)) {
printk(KERN_ERR "temp_dev: not enough memory for input device\n");
err = -ENOMEM;
goto fail1;
}
data->ths_input_dev->name = "sunxi-ths";
data->ths_input_dev->phys = "sunxiths/input0";
data->ths_input_dev->id.bustype = BUS_HOST;
data->ths_input_dev->id.vendor = 0x0001;
data->ths_input_dev->id.product = 0x0001;
data->ths_input_dev->id.version = 0x0100;
input_set_capability(data->ths_input_dev, EV_ABS, ABS_MISC);
input_set_abs_params(data->ths_input_dev, ABS_MISC, -50, 180, 0, 0);
err = input_register_device(data->ths_input_dev);
if (0 < err) {
pr_err("%s: could not register input device\n", __func__);
input_free_device(data->ths_input_dev);
goto fail2;
}
INIT_DELAYED_WORK(&data->input_work, sunxi_ths_input_work_func);
mutex_init(&data->input_enable_mutex);
atomic_set(&data->input_enable, 0);
atomic_set(&data->input_delay, THERMAL_DATA_DELAY);
err = sysfs_create_group(&data->ths_input_dev->dev.kobj,
&sunxi_ths_input_attribute_group);
if (err < 0)
{
pr_err("%s: sysfs_create_group err\n", __func__);
goto fail3;
}
return err;
fail3:
input_unregister_device(data->ths_input_dev);
fail2:
kfree(data->ths_input_dev);
fail1:
return err;
}
static void sunxi_ths_input_exit(struct sunxi_ths_data *data)
{
//sysfs_remove_group(&data->ths_input_dev->dev.kobj, &sunxi_ths_input_attribute_group);
input_unregister_device(data->ths_input_dev);
}
static void ths_enable(void)
{
ths_data->ops->enable(ths_data);
}
static void ths_disable(void)
{
ths_data->ops->disable(ths_data);
}
static void ths_clk_cfg(void)
{
unsigned long rate = 0;
rate = clk_get_rate(ths_data->pclk);
thsprintk(DEBUG_INIT, "%s: get ths_clk_source rate %dHZ\n", __func__, (__u32)rate);
if(clk_set_parent(ths_data->mclk, ths_data->pclk))
pr_err("%s: set ths_clk parent to ths_clk_source failed!\n", __func__);
if (clk_set_rate(ths_data->mclk, THS_CLK)) {
pr_err("set ths clock freq to 4M failed!\n");
}
rate = clk_get_rate(ths_data->mclk);
thsprintk(DEBUG_INIT, "%s: get ths_clk rate %dHZ\n", __func__, (__u32)rate);
if (clk_prepare_enable(ths_data->mclk)) {
pr_err("try to enable ths_clk failed!\n");
}
return;
}
static void ths_clk_uncfg(void)
{
if(NULL == ths_data->mclk || IS_ERR(ths_data->mclk)) {
pr_err("ths_clk handle is invalid, just return!\n");
return;
} else {
clk_disable_unprepare(ths_data->mclk);
clk_put(ths_data->mclk);
ths_data->mclk = NULL;
}
if(NULL == ths_data->pclk || IS_ERR(ths_data->pclk)) {
pr_err("ths_clk_source handle is invalid, just return!\n");
return;
} else {
clk_put(ths_data->pclk);
ths_data->pclk = NULL;
}
return;
}
static void ths_irq_work_func(struct work_struct *work)
{
thsprintk(DEBUG_INT, "%s enter\n", __func__);
thermal_zone_device_update(ths_data->tz);
return;
}
static irqreturn_t sunxi_ths_irq(int irq, void *dev_id)
{
u32 intsta;
thsprintk(DEBUG_INT, "THS IRQ Serve\n");
intsta = ths_data->ops->get_int(ths_data);
ths_data->ops->clear_int(ths_data);
if (intsta & (THS_INTS_SHT0|THS_INTS_SHT1|THS_INTS_SHT2|THS_INTS_SHT3)){
queue_work(thermal_wq, &ths_data->irq_work);
}
return IRQ_HANDLED;
}
static void ths_sensor_init(void)
{
thsprintk(DEBUG_INIT, "ths_sensor_init: ths setup start!!\n");
ths_data->ops->init_reg(ths_data);
thsprintk(DEBUG_INIT, "ths_sensor_init: ths setup end!!\n");
return;
}
static void ths_sensor_exit(void)
{
thsprintk(DEBUG_INIT, "ths_sensor_exit: ths exit start!!\n");
ths_data->ops->clear_reg(ths_data);
thsprintk(DEBUG_INIT, "ths_sensor_exit: ths exir end!!\n");
return;
}
static int sunxi_ths_startup(struct platform_device *pdev)
{
struct device_node *np =NULL;
int ret = 0;
ths_data = kzalloc(sizeof(*ths_data), GFP_KERNEL);
if (IS_ERR_OR_NULL(ths_data)) {
pr_err("ths_data: not enough memory for ths data\n");
return -ENOMEM;
}
np = pdev->dev.of_node;
ths_data->base_addr= of_iomap(np, 0);
if (NULL == ths_data->base_addr) {
pr_err("%s:Failed to ioremap() io memory region.\n",__func__);
ret = -EBUSY;
}else
thsprintk(DEBUG_INIT, "ths base: %p !\n", ths_data->base_addr);
ths_data->irq_num= irq_of_parse_and_map(np, 0);
if (0 == ths_data->irq_num) {
pr_err("%s:Failed to map irq.\n", __func__);
ret = -EBUSY;
}else
thsprintk(DEBUG_INIT, "ths irq num: %d !\n", ths_data->irq_num);
if (of_property_read_u32(np, "sensor_num", &ths_data->sensor_cnt)) {
pr_err("%s: get sensor_num failed\n", __func__);
ret = -EBUSY;
}
if (of_property_read_u32(np, "int_temp", &ths_data->int_temp)) {
pr_err("%s: get int temp failed\n", __func__);
ths_data->int_temp = 120;
}
ths_data->pclk = of_clk_get(np, 0);
ths_data->mclk = of_clk_get(np, 1);
if (NULL==ths_data->pclk||IS_ERR(ths_data->pclk)
||NULL==ths_data->mclk||IS_ERR(ths_data->mclk)) {
pr_err("%s:Failed to get clk.\n", __func__);
ret = -EBUSY;
}
ths_data->ops = &sunxi_ths_ops;
return ret;
}
int sunxi_get_sensor_temp(u32 sensor_num, long *temperature)
{
long temp = 0;
int ret = -1;
if(sensor_num < ths_data->sensor_cnt){
temp = ths_data->ops->get_temp(ths_data, sensor_num);
if((temp > -20) && (temp < 180 )){
*temperature = temp;
ret = 0;
}
}
return ret;
}
EXPORT_SYMBOL(sunxi_get_sensor_temp);
static int sunxi_ths_get_temp(void *data, long *temperature)
{
struct sunxi_ths_data *pdata = data;
u32 i ;
long temp = 0, taget;
if (IS_ERR(pdata))
return PTR_ERR(pdata);
if((!ths_suspending) && (!ths_emu)){
switch(pdata->mode){
case MAX_TEMP:
for(i = 0, taget = -20; i < pdata->sensor_cnt; i++){
temp = pdata->ops->get_temp(pdata, i);
if(temp > taget)
taget = temp;
}
break;
case AVG_TMP:
for(i = 0, taget = 0; i < pdata->sensor_cnt; i++){
temp = pdata->ops->get_temp(pdata, i);
taget += temp;
}
do_div(taget, pdata->sensor_cnt);
break;
case MIN_TMP:
for(i = 0, taget = 180; i < pdata->sensor_cnt; i++){
temp = pdata->ops->get_temp(pdata, i);
if(temp < taget)
taget = temp;
}
break;
default:
break;
}
*temperature = taget;
save_tmp = taget;
}else{
*temperature = save_tmp;
}
thsprintk(DEBUG_DATA_INFO, "%s: get temp %ld\n", __func__, (*temperature));
return 0;
}
static int sunxi_ths_probe(struct platform_device *pdev)
{
int err = 0;
thsprintk(DEBUG_INIT, "sunxi ths sensor probe start !\n");
if (pdev->dev.of_node) {
// get dt and sysconfig
err = sunxi_ths_startup(pdev);
}else{
pr_err("sunxi ths device tree err!\n");
return -EBUSY;
}
ths_data->tz = thermal_zone_of_sensor_register(&pdev->dev,
0,
ths_data,
sunxi_ths_get_temp, NULL);
if(IS_ERR(ths_data->tz)){
pr_err("sunxi ths sensor register err!\n");
goto err_allocate_device;
}
platform_set_drvdata(pdev, ths_data);
ths_clk_cfg();
ths_sensor_init();
sunxi_ths_input_init(ths_data);
INIT_WORK(&ths_data->irq_work, ths_irq_work_func);
thermal_wq = create_singlethread_workqueue("thermal_wq");
if (!thermal_wq) {
pr_err(KERN_ALERT "Creat thermal_wq failed.\n");
goto err_allocate_device;
}
flush_workqueue(thermal_wq);
if (request_irq(ths_data->irq_num, sunxi_ths_irq, 0, "Thermal Sensor",
ths_data->tz)) {
pr_err("%s: request irq fail.\n", __func__);
err = -EBUSY;
goto err_request_irq;
}
ths_enable();
/* enable here */
if(ths_data->tz->ops->set_mode)
ths_data->tz->ops->set_mode(ths_data->tz, THERMAL_DEVICE_ENABLED);
else
thermal_zone_device_update(ths_data->tz);
thsprintk(DEBUG_INIT, "ths probe end!\n");
return 0;
err_request_irq:
platform_set_drvdata(pdev, NULL);
sunxi_ths_input_exit(ths_data);
err_allocate_device:
if(ths_data)
kfree(ths_data);
return err;
}
static int sunxi_ths_remove(struct platform_device *pdev)
{
cancel_delayed_work_sync(&ths_data->input_work);
ths_disable();
free_irq(ths_data->irq_num, ths_data->tz);
ths_sensor_exit();
ths_clk_uncfg();
sunxi_ths_input_exit(ths_data);
kfree(ths_data);
return 0;
}
#ifdef CONFIG_OF
/* Translate OpenFirmware node properties into platform_data */
static struct of_device_id sunxi_ths_of_match[] = {
{ .compatible = "allwinner,thermal_sensor", },
{ },
};
MODULE_DEVICE_TABLE(of, sunxi_ths_of_match);
#else /* !CONFIG_OF */
#endif
#ifdef CONFIG_PM
static int sunxi_ths_suspend(struct device *dev)
{
thsprintk(DEBUG_SUSPEND, "enter: sunxi_ths_suspend. \n");
mutex_lock(&ths_data->input_enable_mutex);
if (atomic_read(&ths_data->input_enable)== 1) {
cancel_delayed_work_sync(&ths_data->input_work);
}
mutex_unlock(&ths_data->input_enable_mutex);
ths_disable();
disable_irq_nosync(ths_data->irq_num);
ths_suspending = 1;
ths_sensor_exit();
if(NULL == ths_data->mclk || IS_ERR(ths_data->mclk)) {
thsprintk(DEBUG_SUSPEND,"ths_clk handle is invalid\n");
} else {
clk_disable_unprepare(ths_data->mclk);
}
return 0;
}
static int sunxi_ths_resume(struct device *dev)
{
thsprintk(DEBUG_SUSPEND, "enter: sunxi_ths_resume. \n");
clk_prepare_enable(ths_data->mclk);
ths_sensor_init();
enable_irq(ths_data->irq_num);
ths_enable();
mutex_lock(&ths_data->input_enable_mutex);
if (atomic_read(&ths_data->input_enable)== 1) {
schedule_delayed_work(&ths_data->input_work,
msecs_to_jiffies(atomic_read(&ths_data->input_delay)));
}
mutex_unlock(&ths_data->input_enable_mutex);
ths_suspending = 0;
return 0;
}
static const struct dev_pm_ops sunxi_ths_pm_ops = {
.suspend = sunxi_ths_suspend,
.resume = sunxi_ths_resume,
};
#endif
static struct platform_driver sunxi_ths_driver = {
.probe = sunxi_ths_probe,
.remove = sunxi_ths_remove,
.driver = {
.name = SUNXI_THS_NAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(sunxi_ths_of_match),
#ifdef CONFIG_PM
.pm = &sunxi_ths_pm_ops,
#endif
},
};
module_platform_driver(sunxi_ths_driver);
module_param_named(debug_mask, thermal_debug_mask, int, 0644);
MODULE_DESCRIPTION("SUNXI thermal sensor driver");
MODULE_AUTHOR("QIn");
MODULE_LICENSE("GPL v2");
|
73ceb51b5a7d1432e4435ed12ceaf7b999c5d630
|
6e1cde66aa5a649138babe297293962cdf97743e
|
/src/pl-setup.c
|
7454fcbe0cf1a280390e55745a86839f6a1df229
|
[
"BSD-2-Clause"
] |
permissive
|
SWI-Prolog/swipl-devel
|
db56676481984addc09f4f228bc1c41f7f53759f
|
41ac4a569c8e6c3d3b93a21449403962e3de1ece
|
refs/heads/master
| 2023-09-01T03:49:40.696481
| 2023-08-30T18:12:56
| 2023-08-30T18:12:56
| 17,516,793
| 935
| 328
|
NOASSERTION
| 2023-08-26T14:32:33
| 2014-03-07T14:43:14
|
C
|
UTF-8
|
C
| false
| false
| 45,998
|
c
|
pl-setup.c
|
/* Part of SWI-Prolog
Author: Jan Wielemaker
E-mail: J.Wielemaker@vu.nl
WWW: http://www.swi-prolog.org
Copyright (c) 1985-2022, University of Amsterdam
VU University Amsterdam
CWI, Amsterdam
SWI-Prolog Solutions b.v.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*#define O_DEBUG 1*/
#define GLOBAL /* allocate global variables here */
#include "pl-setup.h"
#include "pl-comp.h"
#include "pl-arith.h"
#include "os/pl-cstack.h"
#include "os/pl-ctype.h"
#include "os/pl-prologflag.h"
#include "pl-dbref.h"
#include "pl-trie.h"
#include "pl-tabling.h"
#include "pl-undo.h"
#include "pl-event.h"
#include "pl-fli.h"
#include "pl-funct.h"
#include "pl-modul.h"
#include "pl-rec.h"
#include "pl-flag.h"
#include "pl-ext.h"
#include "pl-op.h"
#include "pl-trace.h"
#include "pl-read.h"
#include "pl-wam.h"
#include "pl-gc.h"
#include "pl-proc.h"
#include "pl-pro.h"
#include "pl-gvar.h"
#include "pl-coverage.h"
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#undef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#undef K
#undef MB
#define K * 1024
#define MB * (1024L * 1024L)
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This module initialises the system and defines the global variables. It
also holds the code for dynamically expanding stacks based on MMU
access. Finally it holds the code to handle signals transparently for
foreign language code or packages with which Prolog was linked together.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#if USE_LD_MACROS
#define allocStacks(_) LDFUNC(allocStacks, _)
#define initSignals(_) LDFUNC(initSignals, _)
#endif
#define LDFUNC_DECLARATIONS
static int allocStacks(void);
static void initSignals(void);
static void gcPolicy(Stack s, int policy);
#undef LDFUNC_DECLARATIONS
int
setupProlog(void)
{ GET_LD
DEBUG(1, Sdprintf("Starting Heap Initialisation\n"));
#ifdef O_LOGICAL_UPDATE
next_generation(NULL);
#endif
LD->critical = 0;
LD->magic = LD_MAGIC;
for (int i = 0; i < SIGMASK_WORDS; i++)
LD->signal.pending[i] = 0;
LD->statistics.start_time = WallTime();
DEBUG(1, Sdprintf("wam_table ...\n"));
initWamTable();
DEBUG(1, Sdprintf("character types ...\n"));
initCharTypes();
DEBUG(1, Sdprintf("foreign predicates ...\n"));
initForeign();
DEBUG(1, Sdprintf("Prolog Signal Handling ...\n"));
initSignals();
DEBUG(1, Sdprintf("Stacks ...\n"));
if ( !initPrologStacks(GD->options.stackLimit) )
outOfCore();
GD->combined_stack.name = "stack";
GD->combined_stack.gc = TRUE;
GD->combined_stack.overflow_id = STACK_OVERFLOW;
initPrologLocalData();
DEBUG(1, Sdprintf("Atoms ...\n"));
initAtoms();
DEBUG(1, Sdprintf("Features ...\n"));
initPrologFlags();
DEBUG(1, Sdprintf("Functors ...\n"));
initFunctors();
DEBUG(1, Sdprintf("Modules ...\n"));
initModules();
/* initModules may be called before */
/* LD is present in the MT version */
LD->modules.typein = MODULE_user;
LD->modules.source = MODULE_user;
DEBUG(1, Sdprintf("Records ...\n"));
initDBRef();
initRecords();
DEBUG(1, Sdprintf("Tries ...\n"));
initTries();
DEBUG(1, Sdprintf("Tabling ...\n"));
initTabling();
DEBUG(1, Sdprintf("Flags ...\n"));
initFlags();
DEBUG(1, Sdprintf("Foreign Predicates ...\n"));
initBuildIns();
DEBUG(1, Sdprintf("Malloc binding ...\n"));
initMalloc();
DEBUG(1, Sdprintf("Operators ...\n"));
initOperators();
DEBUG(1, Sdprintf("GMP ...\n"));
initGMP();
DEBUG(1, Sdprintf("Arithmetic ...\n"));
initArith();
DEBUG(1, Sdprintf("Tracer ...\n"));
initTracer();
debugstatus.styleCheck = SINGLETON_CHECK;
DEBUG(1, Sdprintf("IO ...\n"));
initIO();
initCharConversion();
#ifdef O_LOCALE
initLocale();
#endif
setABIVersionPrologFlag();
GD->io_initialised = TRUE;
GD->clauses.cgc_space_factor = 8;
GD->clauses.cgc_stack_factor = 0.03;
GD->clauses.cgc_clause_factor = 1.0;
DEBUG(1, Sdprintf("Heap Initialised\n"));
return TRUE;
}
void
initPrologLocalData(DECL_LD)
{
#ifdef O_LIMIT_DEPTH
LD->depth_info.limit = DEPTH_NO_LIMIT;
#endif
#ifdef O_INFERENCE_LIMIT
LD->inference_limit.limit = INFERENCE_NO_LIMIT;
#endif
LD->break_level = -1;
LD->prolog_flag.write_attributes = PL_WRT_ATTVAR_IGNORE;
#ifdef O_PLMT
simpleMutexInit(&LD->thread.scan_lock);
LD->transaction.gen_base = GEN_INFINITE;
#endif
#if STDC_CV_ALERT
cnd_init(&LD->signal.alert_cv);
mtx_init(&LD->signal.alert_mtx, mtx_plain);
#endif
updateAlerted(LD);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SIGNAL HANDLING
SWI-Prolog catches a number of signals:
- SIGINT is caught to allow the user to interrupt normal execution.
- SIGUSR2 is caught using an empty handler to break blocking system
calls and allow handling of Prolog signals from them.
- SIGTERM, SIGABRT and SIGQUIT are caught to cleanup before killing
the process again using the same signal.
- SIGSEGV, SIGILL, SIGBUS and SIGSYS are caught by
os/pl-cstack.c to print a backtrace and exit.
- SIGHUP is caught and causes the process to exit with status 2 after
cleanup.
If the system is started using --nosignals, only SIGUSR2 is modified.
Note that library(time) uses SIGUSR1.
Code in SWI-Prolog should call PL_signal() rather than signal() to
install signal handlers. SWI-Prolog assumes the handler function is a
void function. On some systems this gives some compiler warnings as
they define signal handlers to be int functions. This should be fixed
some day.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define PLSIG_USERFLAGS 0x0000ffff /* range of API-visible flags */
#define PLSIG_STATEFLAGS 0xffff0000 /* range of internal flags */
#define PLSIG_PREPARED 0x00010000 /* signal is prepared */
#define PLSIG_IGNORED 0x00020000 /* signal is ignored */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Define the signals and their properties. This could be nicer, but
different systems provide different signals, and above all, MS systems
provide very few.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
static struct signame
{ int sig;
const char *name;
int flags;
} signames[] =
{
#ifdef HAVE_OS_SIGNALS
#ifdef SIGHUP
{ SIGHUP, "hup", 0},
#endif
{ SIGINT, "int", 0},
#ifdef SIGQUIT
{ SIGQUIT, "quit", 0},
#endif
{ SIGILL, "ill", 0},
{ SIGABRT, "abrt", 0},
{ SIGFPE, "fpe", PLSIG_THROW},
#ifdef SIGKILL
{ SIGKILL, "kill", 0},
#endif
{ SIGSEGV, "segv", 0},
#ifdef SIGPIPE
{ SIGPIPE, "pipe", PLSIG_IGNORE},
#endif
#ifdef SIGALRM
{ SIGALRM, "alrm", PLSIG_THROW},
#endif
{ SIGTERM, "term", 0},
#ifdef SIGUSR1
{ SIGUSR1, "usr1", 0},
#endif
#ifdef SIGUSR2
{ SIGUSR2, "usr2", 0},
#endif
#ifdef SIGCHLD
{ SIGCHLD, "chld", 0},
#endif
#ifdef SIGCONT
{ SIGCONT, "cont", 0},
#endif
#ifdef SIGSTOP
{ SIGSTOP, "stop", 0},
#endif
#ifdef SIGTSTP
{ SIGTSTP, "tstp", 0},
#endif
#ifdef SIGTTIN
{ SIGTTIN, "ttin", 0},
#endif
#ifdef SIGTTOU
{ SIGTTOU, "ttou", 0},
#endif
#ifdef SIGTRAP
{ SIGTRAP, "trap", 0},
#endif
#ifdef SIGBUS
{ SIGBUS, "bus", 0},
#endif
#ifdef SIGSTKFLT
{ SIGSTKFLT, "stkflt", 0},
#endif
#ifdef SIGURG
{ SIGURG, "urg", 0},
#endif
#ifdef SIGIO
{ SIGIO, "io", 0},
#endif
#ifdef SIGPOLL
{ SIGPOLL, "poll", 0},
#endif
#ifdef SIGXCPU
{ SIGXCPU, "xcpu", PLSIG_THROW},
#endif
#ifdef SIGXFSZ
{ SIGXFSZ, "xfsz", PLSIG_THROW},
#endif
#ifdef SIGVTALRM
{ SIGVTALRM, "vtalrm", PLSIG_THROW},
#endif
#ifdef SIGPROF
{ SIGPROF, "prof", 0},
#endif
#ifdef SIGPWR
{ SIGPWR, "pwr", 0},
#endif
#endif /*HAVE_OS_SIGNALS*/
/* The signals below here are recorded as Prolog interrupts, but
not supported by OS signals. They start at offset 32.
*/
#ifdef SIG_ATOM_GC
{ SIG_ATOM_GC, "prolog:atom_gc", 0 },
#endif
{ SIG_GC, "prolog:gc", 0 },
#ifdef SIG_THREAD_SIGNAL
{ SIG_THREAD_SIGNAL, "prolog:thread_signal", 0 },
#endif
{ SIG_CLAUSE_GC, "prolog:clause_gc", 0 },
{ SIG_PLABORT, "prolog:abort", 0 },
{ -1, NULL, 0}
};
const char *
signal_name(int sig)
{ struct signame *sn = signames;
for( ; sn->name; sn++ )
{ if ( sn->sig == sig )
return sn->name;
}
return "unknown";
}
static int
signal_index(const char *name)
{ struct signame *sn = signames;
char tmp[12];
if ( strncmp(name, "SIG", 3) == 0 && strlen(name) < 12 )
{ strcpy(tmp, name+3);
strlwr(tmp);
name = tmp;
}
for( ; sn->name; sn++ )
{ if ( streq(sn->name, name) )
return sn->sig;
}
return -1;
}
int
PL_get_signum_ex(term_t sig, int *n)
{ GET_LD
char *s;
int i = -1;
if ( PL_get_integer(sig, &i) )
{
} else if ( PL_get_chars(sig, &s, CVT_ATOM) )
{ i = signal_index(s);
} else
{ return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_signal, sig);
}
if ( i > 0 && i < 32 ) /* where to get these? */
{ *n = i;
return TRUE;
}
return PL_error(NULL, 0, NULL, ERR_DOMAIN, ATOM_signal, sig);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SWI-Prolog main signal handler. Any signal arrives here first, after
which it is dispatched to the real handler. The task of the handler is
to ensure it is safe to start a query.
There are a few possible problems:
* The system is writing the body-arguments from the next clause.
In this case it is working above `lTop'. So we raise this to the
maximum offset.
* The system is performing a garbage collection. We should block
signals while in garbage-collection and non-blockable signals should
raise a fatal error.
* The system is in a `critical section'. These are insufficiently
flagged at the moment.
The sync-argument is TRUE when called from PL_handle_signals(), and
FALSE otherwise. It is used to delay signals marked with PLSIG_SYNC.
If we are running in the MT environment, we may get signals from threads
not having a Prolog engine. If there is a registered handler we call it.
This also deals with Control-C in Windows console apps, calling
interruptHandler() in pl-trace.c which in turn re-routes the interrupt
to the main thread.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#undef LD
#define LD LOCAL_LD
static int
is_fatal_signal(int sig)
{ switch(sig)
{
#ifdef SIGFPE
case SIGFPE:
#endif
#ifdef SIGSEGV
case SIGSEGV:
#if defined(SIGBUS) && SIGBUS != SIGSEGV
case SIGBUS:
#endif
#endif
#ifdef SIGILL
case SIGILL:
#endif
#ifdef SIGSYS
case SIGSYS:
#endif
return TRUE;
}
return FALSE;
}
void
dispatch_signal(int sig, int sync)
{ GET_LD
SigHandler sh = &GD->signals.handlers[SIGNAL_INDEX(sig)];
fid_t fid;
term_t lTopSave;
int saved_current_signal;
int saved_sync;
#ifdef O_PLMT
if ( !LD )
{ if ( sh->handler )
(*sh->handler)(sig);
return; /* what else?? */
}
DEBUG(MSG_SIGNAL,
{ const pl_wchar_t *name = L"";
int tid = LD->thread.info->pl_tid;
atom_t alias;
if ( PL_get_thread_alias(tid, &alias) )
name = PL_atom_wchars(alias, NULL);
SdprintfX("Got signal %d in thread %d (%Ws) %s\n",
sig, tid, name,
sync ? " (sync)" : " (async)");
});
#else
DEBUG(MSG_SIGNAL,
Sdprintf("Got signal %d %s\n",
sig, sync ? " (sync)" : " (async)"));
#endif
if ( true(sh, PLSIG_NOFRAME) && sh->handler )
{ (*sh->handler)(sig);
return;
}
lTopSave = consTermRef(lTop);
saved_current_signal = LD->signal.current;
saved_sync = LD->signal.is_sync;
if ( is_fatal_signal(sig) && sig == LD->signal.current )
sysError("Recursively received fatal signal %d", sig);
if ( gc_status.active && !IS_VSIG(sig) )
{ fatalError("Received signal %d (%s) while in %ld-th garbage collection",
sig, signal_name(sig), LD->gc.stats.totals.collections);
}
if ( (LD->critical || (true(sh, PLSIG_SYNC) && !sync))
&& sh->handler != PL_interrupt
&& !is_fatal_signal(sig) )
{ PL_raise(sig); /* wait for better times! */
return;
}
if ( !(fid = PL_open_signal_foreign_frame(sync)) )
{ if ( is_fatal_signal(sig) )
sigCrashHandler(sig); /* should not return */
PL_raise(sig); /* no space; wait */
return;
}
if ( !sync )
blockGC(0);
LD->signal.current = sig;
LD->signal.is_sync = sync;
DEBUG(MSG_SIGNAL,
Sdprintf("Handling signal %d, pred = %p, handler = %p\n",
sig, sh->predicate, sh->handler));
if ( sh->predicate )
{ term_t sigterm = PL_new_term_ref();
qid_t qid;
#ifdef O_LIMIT_DEPTH
size_t olimit = LD->depth_info.limit;
LD->depth_info.limit = DEPTH_NO_LIMIT;
#endif
PL_put_atom_chars(sigterm, signal_name(sig));
qid = PL_open_query(NULL,
PL_Q_PASS_EXCEPTION,
sh->predicate,
sigterm);
if ( PL_next_solution(qid) ) {}; /* cannot ignore return */
PL_cut_query(qid);
#ifdef O_LIMIT_DEPTH
LD->depth_info.limit = olimit;
#endif
} else if ( true(sh, PLSIG_THROW) )
{ char *predname;
int arity;
if ( environment_frame )
{ predname = stringAtom(environment_frame->predicate->functor->name);
arity = environment_frame->predicate->functor->arity;
} else
{ predname = NULL;
arity = 0;
}
PL_error(predname, arity, NULL, ERR_SIGNALLED, sig, signal_name(sig));
} else if ( sh->handler )
{ int ex_pending = (exception_term && !sync);
#ifdef O_LIMIT_DEPTH
uintptr_t olimit = LD->depth_info.limit;
LD->depth_info.limit = DEPTH_NO_LIMIT;
#endif
(*sh->handler)(sig);
#ifdef O_LIMIT_DEPTH
LD->depth_info.limit = olimit;
#endif
DEBUG(MSG_SIGNAL,
Sdprintf("Handler %p finished (pending=0x%"PRIxFAST32",0x%"PRIxFAST32")\n",
sh->handler, LD->signal.pending[0], SIGMASK_WORDS > 1 ? LD->signal.pending[1] : 0));
if ( !ex_pending && exception_term && !sync ) /* handler: PL_raise_exception() */
fatalError("Async exception handler for signal %s (%d) raised "
"an exception", signal_name(sig), sig);
}
LD->signal.current = saved_current_signal;
LD->signal.is_sync = saved_sync;
if ( sync )
PL_close_foreign_frame(fid);
else
PL_discard_foreign_frame(fid);
lTop = (LocalFrame)valTermRef(lTopSave);
if ( !sync )
unblockGC(0);
/* we cannot return. First try */
/* longjmp. If that fails, crash */
if ( is_fatal_signal(sig) )
{ if ( exception_term )
{ PL_rethrow();
sigCrashHandler(sig);
}
exit(4);
}
}
static void
pl_signal_handler(int sig)
{ dispatch_signal(sig, FALSE);
}
#ifndef SA_RESTART
#define SA_RESTART 0
#endif
handler_t
set_sighandler(int sig, handler_t func)
{
#ifdef HAVE_SIGACTION
struct sigaction old;
struct sigaction new;
memset(&new, 0, sizeof(new)); /* deal with other fields */
new.sa_handler = func;
/*new.sa_flags = SA_RESTART; all blocking functions are restarted */
if ( sigaction(sig, &new, &old) == 0 )
return old.sa_handler;
else
return SIG_DFL;
#elif defined(HAVE_SIGNAL)
#ifdef __WINDOWS__
switch( sig ) /* Current Windows versions crash */
{ case SIGABRT: /* when given a non-supported value */
case SIGFPE:
case SIGILL:
case SIGINT:
case SIGSEGV:
case SIGTERM:
break;
default:
return SIG_IGN;
}
#endif /*__WINDOWS__*/
return signal(sig, func);
#else
return NULL;
#endif
}
static SigHandler
prepareSignal(int sig, int plsig_flags)
{ SigHandler sh = &GD->signals.handlers[SIGNAL_INDEX(sig)];
int current_state = sh->flags & PLSIG_STATEFLAGS;
int desired_state = (plsig_flags & PLSIG_IGNORE) ? PLSIG_IGNORED : PLSIG_PREPARED;
plsig_flags &= ~(PLSIG_STATEFLAGS | PLSIG_IGNORE);
if ( current_state != desired_state )
{ clearFlags(sh);
set(sh, desired_state | plsig_flags);
if ( !IS_VSIG(sig) )
{ handler_t old_handler = set_sighandler(sig, desired_state == PLSIG_IGNORED ? SIG_IGN : pl_signal_handler);
if ( current_state == 0 )
sh->saved_handler = old_handler;
}
} else
{ sh->flags = (sh->flags & ~PLSIG_USERFLAGS) | plsig_flags;
}
return sh;
}
static void
unprepareSignal(int sig)
{ SigHandler sh = &GD->signals.handlers[SIGNAL_INDEX(sig)];
if ( true(sh, PLSIG_STATEFLAGS) )
{ if ( !IS_VSIG(sig) )
set_sighandler(sig, sh->saved_handler);
sh->flags = 0;
sh->handler = NULL;
sh->predicate = NULL;
sh->saved_handler = NULL;
}
}
#if O_SIGNALS
#ifdef SIGHUP
static void
hupHandler(int sig)
{ (void)sig;
PL_halt(128+sig);
}
#endif
/* terminate_handler() is called on termination signals like SIGTERM.
It runs hooks registered using PL_exit_hook() and then kills itself.
The hooks are called with the exit status `3`.
*/
static void
terminate_handler(int sig)
{ signal(sig, SIG_DFL);
run_on_halt(&GD->os.exit_hooks, 128+sig);
#if defined(HAVE_KILL) && defined(HAVE_GETPID)
kill(getpid(), sig);
#else
switch( sig )
{
#ifdef SIGTERM
case SIGTERM:
exit(128+SIGTERM);
#endif
#ifdef SIGQUIT
case SIGQUIT:
exit(128+SIGQUIT);
#endif
#ifdef SIGABRT
case SIGABRT:
abort();
#endif
default:
assert(0); /* not reached */
}
#endif
}
void
terminate_on_signal(int signo)
{ PL_signal(signo, terminate_handler);
}
static void
initTerminationSignals(void)
{
#ifdef SIGTERM
terminate_on_signal(SIGTERM);
#endif
#ifdef SIGABRT
terminate_on_signal(SIGABRT);
#endif
#ifdef SIGQUIT
terminate_on_signal(SIGQUIT);
#endif
}
#endif /*O_SIGNALS*/
#ifdef O_C_STACK_GUARDED
static void
alt_segv_handler(int sig)
{ GET_LD
(void)sig;
DEBUG(MSG_SIGNAL,
Sdprintf("Got C-stack overflow; critical = %d\n",
LD->signal.sig_critical));
if ( LD->signal.sig_critical )
{ longjmp(LD->signal.context, TRUE);
/*NORETURN*/
}
sigCrashHandler(sig);
}
#endif
int
initGuardCStack(void)
{
#ifdef O_C_STACK_GUARDED
GET_LD
stack_t ss = {0};
if ( (LD->signal.alt_stack = malloc(SIGSTKSZ)) )
{ ss.ss_sp = LD->signal.alt_stack;
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
if ( sigaltstack(&ss, NULL) == 0)
{ DEBUG(MSG_SIGNAL, Sdprintf("Setup altstack (%zd bytes)\n", SIGSTKSZ));
if ( LD == &PL_local_data ) /* main thread, only need this once */
{ struct sigaction sa = {0};
sa.sa_flags = SA_ONSTACK;
sa.sa_handler = alt_segv_handler;
sigemptyset(&sa.sa_mask);
if ( sigaction(SIGSEGV, &sa, NULL) == 0 )
{ DEBUG(MSG_SIGNAL, Sdprintf("Setup SEGV on altstack\n"));
return TRUE;
}
}
}
}
#endif
return FALSE;
}
static void
agc_handler(int sig)
{ GET_LD
(void)sig;
if ( GD->statistics.atoms >= GD->atoms.non_garbage + GD->atoms.margin &&
!gc_status.blocked )
pl_garbage_collect_atoms();
}
static void
gc_handler(int sig)
{ (void)sig;
garbageCollect(0);
}
static void
gc_tune_handler(int sig)
{ (void)sig;
call_tune_gc_hook();
}
static void
cgc_handler(int sig)
{ (void)sig;
pl_garbage_collect_clauses();
}
static void
abort_handler(int sig)
{ (void)sig;
abortProlog();
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The idea behind alert_handler() is to make blocking system calls return
with EINTR and thus make them interruptable for thread-signals.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifdef SIG_ALERT
static void
alert_handler(int sig)
{ SigHandler sh = &GD->signals.handlers[SIGNAL_INDEX(sig)];
DEBUG(MSG_THREAD_SIGNAL, Sdprintf("[%d]: received alert\n", PL_thread_self()));
if ( sh->saved_handler &&
sh->saved_handler != SIG_IGN &&
sh->saved_handler != SIG_DFL )
(*sh->saved_handler)(sig);
}
#endif
static void
initSignals(DECL_LD)
{
#if O_SIGNALS
/* This is general signal handling that is not strictly needed */
if ( truePrologFlag(PLFLAG_SIGNALS) )
{ struct signame *sn = signames;
#ifdef HAVE_OS_SIGNALS
initTerminationSignals();
initGuardCStack();
#endif /*HAVE_OS_SIGNALS*/
initBackTrace();
for( ; sn->name; sn++)
{
#ifdef HAVE_BOEHM_GC
if ( sn->sig == GC_get_suspend_signal() ||
sn->sig == GC_get_thr_restart_signal() )
sn->flags = 0;
#endif
if ( sn->flags )
prepareSignal(sn->sig, sn->flags);
}
#ifdef SIGHUP
PL_signal(SIGHUP|PL_SIGSYNC, hupHandler);
#endif
}
/* We do need alerting to make thread signals work while the */
/* system is blocked in a system call. Can be controlled with --sigalert=N */
#ifdef SIG_ALERT
if ( GD->signals.sig_alert )
PL_signal(GD->signals.sig_alert|PL_SIGNOFRAME, alert_handler);
#endif
#endif /*O_SIGNALS*/
/* these signals are not related to Unix signals and can thus */
/* be enabled always */
PL_signal(SIG_GC|PL_SIGSYNC, gc_handler);
PL_signal(SIG_TUNE_GC|PL_SIGSYNC, gc_tune_handler);
PL_signal(SIG_CLAUSE_GC|PL_SIGSYNC, cgc_handler);
PL_signal(SIG_PLABORT|PL_SIGSYNC, abort_handler);
#ifdef SIG_THREAD_SIGNAL
PL_signal(SIG_THREAD_SIGNAL|PL_SIGSYNC, executeThreadSignals);
#endif
#ifdef SIG_ATOM_GC
PL_signal(SIG_ATOM_GC|PL_SIGSYNC, agc_handler);
#endif
}
void
cleanupSignals(void)
{ struct signame *sn = signames;
for( ; sn->name; sn++)
unprepareSignal(sn->sig);
}
void
resetSignals(void)
{ GET_LD
LD->signal.current = 0;
for (int i = 0; i < SIGMASK_WORDS; i++)
LD->signal.pending[i] = 0;
}
#if defined(O_PLMT) && defined(HAVE_PTHREAD_SIGMASK)
#ifndef HAVE_SIGPROCMASK
#define HAVE_SIGPROCMASK 1
#endif
#define sigprocmask(how, new, old) pthread_sigmask(how, new, old)
#endif
#if O_SIGNALS && defined(HAVE_SIGPROCMASK)
void
allSignalMask(sigset_t *set)
{ static sigset_t allmask;
static int done = FALSE;
if ( !done )
{ sigset_t tmp;
sigfillset(&tmp);
sigdelset(&tmp, SIGSTOP);
sigdelset(&tmp, SIGCONT);
sigdelset(&tmp, SIGQUIT);
sigdelset(&tmp, SIGSEGV);
sigdelset(&tmp, SIGBUS);
#ifdef O_PROFILE
sigdelset(&tmp, SIGPROF);
#endif
allmask = tmp;
done = TRUE;
}
*set = allmask;
}
#if 0
static void
listBlocked()
{ sigset_t current;
int i;
sigprocmask(SIG_BLOCK, NULL, ¤t);
Sdprintf("Blocked: ");
for(i=1; i<32; i++)
{ if ( sigismember(¤t, i) )
Sdprintf(" %d", i);
}
Sdprintf("\n");
Sdprintf("UnBlocked: ");
for(i=1; i<32; i++)
{ if ( !sigismember(¤t, i) )
Sdprintf(" %d", i);
}
Sdprintf("\n\n");
}
#endif
void
blockSignals(sigset_t *old)
{ sigset_t set;
allSignalMask(&set);
sigprocmask(SIG_BLOCK, &set, old);
DEBUG(1, Sdprintf("Blocked all signals\n"));
}
void
unblockSignals(sigset_t *old)
{ if ( old )
{ sigprocmask(SIG_SETMASK, old, NULL);
DEBUG(1, Sdprintf("Restored signal mask\n"));
} else
{ sigset_t set;
allSignalMask(&set);
sigprocmask(SIG_UNBLOCK, &set, NULL);
DEBUG(1, Sdprintf("UnBlocked all signals\n"));
}
}
void
unblockSignal(int sig)
{ sigset_t set;
sigemptyset(&set);
sigaddset(&set, sig);
sigprocmask(SIG_UNBLOCK, &set, NULL);
DEBUG(1, Sdprintf("Unblocked signal %d\n", sig));
}
void
blockSignal(int sig)
{ sigset_t set;
sigemptyset(&set);
sigaddset(&set, sig);
sigprocmask(SIG_BLOCK, &set, NULL);
DEBUG(1, Sdprintf("signal %d\n", sig));
}
#else /*O_SIGNALS && defined(HAVE_SIGPROCMASK)*/
void blockSignals(sigset_t *old) {}
void unblockSignals(sigset_t *old) {}
void unblockSignal(int sig) {}
void blockSignal(int sig) {}
#endif
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BUG: The interface of PL_signal() is broken as it does not return the
current flags associated with the signal and therefore we cannot restore
the signal safely. We should design a struct based API similar to
sigaction().
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
int
PL_sigaction(int sig, pl_sigaction_t *act, pl_sigaction_t *old)
{ SigHandler sh = NULL;
if ( sig && !IS_VALID_SIGNAL(sig) )
{ errno = EINVAL;
return -1;
}
if ( sig == 0 )
{ for(sig=SIG_USER_OFFSET; sig<=MAXSIGNAL; sig++)
{ sh = &GD->signals.handlers[SIGNAL_INDEX(sig)];
if ( sh->flags == 0 )
break;
}
if ( !sh )
{ errno = EBUSY;
return -2;
}
} else
{ sh = &GD->signals.handlers[SIGNAL_INDEX(sig)];
}
if ( old )
{ memset(old, 0, sizeof(*old));
old->sa_cfunction = sh->handler;
old->sa_predicate = sh->predicate;
old->sa_flags = sh->flags;
}
if ( act && act != old )
{ int active = FALSE;
if ( (act->sa_flags&PLSIG_THROW) || act->sa_predicate )
{ if ( ((act->sa_flags&PLSIG_THROW) && act->sa_predicate) ||
act->sa_cfunction )
{ errno = EINVAL;
return -1;
}
active = TRUE;
} else if ( act->sa_cfunction &&
(false(sh, PLSIG_PREPARED)||act->sa_cfunction!=sh->saved_handler) )
{ active = TRUE;
}
if ( active )
{ sh->handler = act->sa_cfunction;
sh->predicate = act->sa_predicate;
sh->flags = (sh->flags&~PLSIG_USERFLAGS)|act->sa_flags;
prepareSignal(sig, act->sa_flags);
} else
{ unprepareSignal(sig);
sh->handler = NULL;
sh->predicate = NULL;
sh->flags = 0;
}
}
return sig;
}
#ifndef SIG_DFL
#define SIG_DFL (handler_t)-1
#endif
handler_t
PL_signal(int sigandflags, handler_t func)
{ pl_sigaction_t act = {0};
pl_sigaction_t old;
act.sa_cfunction = func;
if ( (sigandflags&PL_SIGSYNC) )
act.sa_flags |= PLSIG_SYNC;
if ( (sigandflags&PL_SIGNOFRAME) )
act.sa_flags |= PLSIG_NOFRAME;
if ( PL_sigaction((sigandflags & PLSIG_USERFLAGS), &act, &old) >= 0 )
{ if ( (old.sa_flags&PLSIG_PREPARED) && old.sa_cfunction )
return old.sa_cfunction;
return SIG_DFL;
}
return NULL;
}
/* return: -1: exception in handler, otherwise number of handled signals
*/
int
PL_handle_signals(void)
{ GET_LD
if ( !is_signalled() )
return 0;
else
return handleSignals();
}
#ifndef __unix__
#define handleSigInt(_) LDFUNC(handleSigInt, _)
static int
handleSigInt(DECL_LD)
{ if ( LD->signal.forced == SIGINT && WSIGMASK_ISSET(LD->signal.pending, SIGINT) )
{ WSIGMASK_CLEAR(LD->signal.pending, SIGINT);
LD->signal.forced = 0;
dispatch_signal(SIGINT, TRUE);
if ( exception_term )
return -1;
updateAlerted(LD);
return 1;
}
return 0;
}
#endif
int
handleSignals(DECL_LD)
{ int done = 0;
int i;
if ( !is_signalled() )
return 0;
if ( !HAS_LD )
return 0;
if ( exception_term )
return -1;
#ifndef __unix__ /* on Unix we ask to signal twice */
if ( (done=handleSigInt()) )
return done;
#endif
if ( LD->critical )
{ DEBUG(MSG_THREAD_SIGNAL,
Sdprintf("[%d]: ignoring signal (critical = %d)\n",
PL_thread_self(), LD->critical));
return 0;
}
for(i=0; i<SIGMASK_WORDS; i++)
{ while( LD->signal.pending[i] )
{ int sig = MINSIGNAL+SIGMASK_WIDTH*i;
sigmask_t mask = 1;
for( ; mask ; mask <<= 1, sig++ )
{ if ( LD->signal.pending[i] & mask )
{ ATOMIC_AND(&LD->signal.pending[i], ~mask);
done++;
dispatch_signal(sig, TRUE);
if ( exception_term )
return -1;
}
}
}
}
if ( done )
updateAlerted(LD);
return done;
}
#ifdef SIG_ALERT
static
PRED_IMPL("prolog_alert_signal", 2, prolog_alert_signal, 0)
{ PRED_LD
const char *sname = signal_name(GD->signals.sig_alert);
int rc;
if ( strcmp(sname, "unknown") == 0 )
rc = PL_unify_integer(A1, GD->signals.sig_alert);
else
rc = PL_unify_atom_chars(A1, sname);
if ( rc )
{ if ( PL_compare(A1,A2) == CMP_EQUAL )
{ return TRUE;
} else
{ int new;
if ( (PL_get_integer(A2, &new) && new == 0) ||
PL_get_signum_ex(A2, &new) )
{ if ( GD->signals.sig_alert )
{ unprepareSignal(GD->signals.sig_alert);
GD->signals.sig_alert = 0;
}
if ( new )
{ GD->signals.sig_alert = new;
PL_signal(GD->signals.sig_alert|PL_SIGNOFRAME, alert_handler);
}
return TRUE;
}
}
}
return FALSE;
}
#endif
void
startCritical(DECL_LD)
{ LD->critical++;
}
int
endCritical(DECL_LD)
{ if ( --LD->critical == 0 && LD->alerted && exception_term )
return FALSE;
return TRUE;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
on_signal(?SigNum, ?SigName, :OldHandler, :NewHandler)
Assign NewHandler to be called if signal arrives.
We always support this even when compiled without OS-level signal support,
because of internal virtual signal handling.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
static int
get_meta_arg(term_t arg, term_t m, term_t t)
{ GET_LD
if ( PL_is_functor(arg, FUNCTOR_colon2) )
{ _PL_get_arg(1, arg, m);
_PL_get_arg(2, arg, t);
return TRUE;
}
return PL_error(NULL, 0, NULL, ERR_TYPE,
ATOM_meta_argument, arg);
}
static int
get_module(term_t t, Module *m)
{ GET_LD
atom_t a;
if ( !PL_get_atom_ex(t, &a) )
return FALSE;
*m = PL_new_module(a);
return TRUE;
}
static
PRED_IMPL("$on_signal", 4, on_signal, 0)
{ PRED_LD
int sign = -1;
SigHandler sh;
char *sn;
atom_t a;
term_t mold = PL_new_term_ref();
term_t mnew = PL_new_term_ref();
term_t sig = A1;
term_t name = A2;
term_t old = A3;
term_t new = A4;
if ( !get_meta_arg(old, mold, old) ||
!get_meta_arg(new, mnew, new) )
return FALSE;
if ( PL_get_integer(sig, &sign) && IS_VALID_SIGNAL(sign) )
{ TRY(PL_unify_atom_chars(name, signal_name(sign)));
} else if ( PL_get_atom_chars(name, &sn) )
{ if ( (sign = signal_index(sn)) != -1 )
{ TRY(PL_unify_integer(sig, sign));
} else
return PL_error(NULL, 0, NULL, ERR_DOMAIN, ATOM_signal, name);
} else
return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_signal, sig);
sh = &GD->signals.handlers[SIGNAL_INDEX(sign)];
if ( false(sh, PLSIG_STATEFLAGS) ) /* not handled */
{ TRY(PL_unify_atom(old, ATOM_default));
} else if ( true(sh, PLSIG_IGNORED) ) /* signal ignored */
{ TRY(PL_unify_atom(old, ATOM_ignore));
} else if ( true(sh, PLSIG_THROW) ) /* throw exception */
{ TRY(PL_unify_atom(old, ATOM_throw));
} else if ( sh->predicate ) /* call predicate */
{ Definition def = sh->predicate->definition;
if ( PL_unify_atom(mold, def->module->name) )
{ if ( !PL_unify_atom(old, def->functor->name) )
return FALSE;
} else
{ if ( !PL_unify_term(old, PL_FUNCTOR, FUNCTOR_colon2,
PL_ATOM, def->module->name,
PL_ATOM, def->functor->name) )
return FALSE;
}
} else if ( sh->handler )
{ if ( sh->handler == PL_interrupt )
{ TRY(PL_unify_atom(old, ATOM_debug));
} else
{ TRY(PL_unify_term(old,
PL_FUNCTOR, FUNCTOR_foreign_function1,
PL_POINTER, sh->handler));
}
}
if ( PL_compare(old, new) == 0 &&
PL_compare(mold, mnew) == 0 )
succeed; /* no change */
if ( PL_get_atom(new, &a) )
{ if ( a == ATOM_default )
{ unprepareSignal(sign);
} else if ( a == ATOM_ignore )
{ prepareSignal(sign, PLSIG_IGNORE); /* request to ignore this signal */
} else if ( a == ATOM_throw )
{ sh = prepareSignal(sign, PLSIG_THROW|PLSIG_SYNC);
sh->handler = NULL;
sh->predicate = NULL;
} else if ( a == ATOM_debug )
{ sh = prepareSignal(sign, 0);
sh->handler = PL_interrupt;
sh->predicate = NULL;
} else
{ Module m;
predicate_t pred;
if ( !get_module(mnew, &m) )
return FALSE;
pred = lookupProcedure(PL_new_functor(a, 1), m);
sh = prepareSignal(sign, PLSIG_SYNC);
sh->handler = NULL;
sh->predicate = pred;
}
} else if ( PL_is_functor(new, FUNCTOR_foreign_function1) )
{ term_t a = PL_new_term_ref();
void *f;
_PL_get_arg(1, new, a);
if ( PL_get_pointer(a, &f) )
{ sh = prepareSignal(sign, 0);
sh->handler = (handler_t)(intptr_t)f;
sh->predicate = NULL;
succeed;
}
return PL_error(NULL, 0, NULL, ERR_DOMAIN, ATOM_signal_handler, new);
} else
return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_signal_handler, new);
succeed;
}
/*******************************
* STACKS *
*******************************/
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
initPrologStacks() creates the stacks for the calling thread. It is used
both at system startup to create the stack for the main thread as from
pl-thread.c to create stacks for Prolog threads.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
int
initPrologStacks(size_t limit)
{ GET_LD
LD->stacks.limit = limit;
if ( !allocStacks() )
return FALSE;
LD->stacks.local.overflow_id = LOCAL_OVERFLOW;
LD->stacks.global.overflow_id = GLOBAL_OVERFLOW;
LD->stacks.trail.overflow_id = TRAIL_OVERFLOW;
LD->stacks.argument.overflow_id = ARGUMENT_OVERFLOW;
base_addresses[STG_LOCAL] = (uintptr_t)lBase;
base_addresses[STG_GLOBAL] = (uintptr_t)gBase;
base_addresses[STG_TRAIL] = (uintptr_t)tBase;
*gBase++ = MARK_MASK; /* see sweep_global_mark() */
gMax--; /* */
tMax--;
emptyStacks();
DEBUG(1, Sdprintf("base_addresses[STG_LOCAL] = %p\n",
base_addresses[STG_LOCAL]));
DEBUG(1, Sdprintf("base_addresses[STG_GLOBAL] = %p\n",
base_addresses[STG_GLOBAL]));
DEBUG(1, Sdprintf("base_addresses[STG_TRAIL] = %p\n",
base_addresses[STG_TRAIL]));
return TRUE;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Create nice empty stacks. exception_bin and exception_printed are two
term-references that must be low on the stack to ensure they remain
valid while the stack is unrolled after an exception.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
static void
emptyStack(Stack s)
{ s->top = s->base;
s->gced_size = 0L;
}
void
emptyStacks(void)
{ GET_LD
environment_frame = NULL;
fli_context = NULL;
LD->query = NULL;
emptyStack((Stack)&LD->stacks.local);
emptyStack((Stack)&LD->stacks.global);
emptyStack((Stack)&LD->stacks.trail);
emptyStack((Stack)&LD->stacks.argument);
LD->mark_bar = gTop;
if ( lTop && gTop )
{ int i;
PL_open_foreign_frame();
exception_term = 0;
exception_bin = PL_new_term_ref();
exception_printed = PL_new_term_ref();
LD->exception.tmp = PL_new_term_ref();
LD->exception.pending = PL_new_term_ref();
LD->trim.dummy = PL_new_term_ref();
#ifdef O_ATTVAR
LD->attvar.head = PL_new_term_ref();
LD->attvar.tail = PL_new_term_ref();
LD->attvar.gc_attvars = PL_new_term_ref();
DEBUG(3, Sdprintf("attvar.tail at %p\n", valTermRef(LD->attvar.tail)));
#endif
LD->undo.undo_list = init_undo_list(); /* must be first. See __do_undo() */
LD->tabling.delay_list = init_delay_list();
LD->tabling.idg_current = PL_new_term_ref();
#ifdef O_GVAR
destroyGlobalVars();
#endif
for(i=0; i<TMP_PTR_SIZE; i++)
LD->tmp.h[i] = PL_new_term_ref();
LD->tmp.top = 0;
}
}
/********************************
* STACK ALLOCATION *
*********************************/
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
init_stack() initializes the stack straucture. Params:
- name is the name of the stack (for diagnostic purposes)
- size is the allocated size
- spare is the amount of spare stack we reserve
- gc indicates whether gc can collect data on the stack
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
static void
init_stack(Stack s, char *name, size_t size, size_t spare, int gc)
{ s->name = name;
s->top = s->base;
s->spare = spare;
s->def_spare = spare;
s->min_free = 256*sizeof(word);
s->max = addPointer(s->base, size - spare);
s->gced_size = 0L; /* size after last gc */
s->gc = gc;
gcPolicy(s, GC_FAST_POLICY);
}
static int
allocStacks(DECL_LD)
{ size_t minglobal = 8*SIZEOF_VOIDP K;
size_t minlocal = 4*SIZEOF_VOIDP K;
size_t mintrail = 4*SIZEOF_VOIDP K;
size_t minarg = 1*SIZEOF_VOIDP K;
size_t itrail = nextStackSizeAbove(mintrail-1);
size_t iglobal = nextStackSizeAbove(minglobal-1);
size_t ilocal = nextStackSizeAbove(minlocal-1);
itrail = stack_nalloc(itrail);
minarg = stack_nalloc(minarg);
iglobal = stack_nalloc(iglobal+ilocal)-ilocal;
gBase = NULL;
tBase = NULL;
aBase = NULL;
gBase = (Word) stack_malloc(iglobal + ilocal);
tBase = (TrailEntry) stack_malloc(itrail);
aBase = (Word *) stack_malloc(minarg);
if ( !gBase || !tBase || !aBase )
{ if ( gBase )
*gBase++ = MARK_MASK; /* compensate for freeStacks */
freeStacks();
return FALSE;
}
lBase = (LocalFrame) addPointer(gBase, iglobal);
init_stack((Stack)&LD->stacks.global,
"global", iglobal, 512*SIZEOF_VOIDP, TRUE);
init_stack((Stack)&LD->stacks.local,
"local", ilocal, 512*SIZEOF_VOIDP + LOCAL_MARGIN, FALSE);
init_stack((Stack)&LD->stacks.trail,
"trail", itrail, 256*SIZEOF_VOIDP, TRUE);
init_stack((Stack)&LD->stacks.argument,
"argument", minarg, 0, FALSE);
LD->stacks.local.min_free = LOCAL_MARGIN;
return TRUE;
}
void
freeStacks(DECL_LD)
{ if ( gBase )
{ gBase--;
stack_free(gBase);
gTop = NULL; gBase = NULL;
lTop = NULL; lBase = NULL;
}
if ( tBase )
{ stack_free(tBase);
tTop = NULL;
tBase = NULL;
}
if ( aBase )
{ stack_free(aBase);
aTop = NULL;
aBase = NULL;
}
}
int
trim_stack(Stack s)
{ if ( s->spare < s->def_spare )
{ ssize_t reduce = s->def_spare - s->spare;
ssize_t room = roomStackP(s);
DEBUG(MSG_SPARE_STACK, Sdprintf("Reset spare for %s (%zd->%zd)\n",
s->name, s->spare, s->def_spare));
if ( room > 0 && room < reduce )
{ DEBUG(MSG_SPARE_STACK,
Sdprintf("Only %d spare for %s-stack\n", room, s->name));
reduce = room;
}
s->max = addPointer(s->max, -reduce);
s->spare += reduce;
}
return FALSE;
}
/********************************
* STACK TRIMMING & LIMITS *
*********************************/
static void
gcPolicy(Stack s, int policy)
{ GET_LD
s->gc = ((s == (Stack) &LD->stacks.global ||
s == (Stack) &LD->stacks.trail) ? TRUE : FALSE);
if ( s->gc )
{ s->small = SMALLSTACK;
s->factor = 3;
s->policy = policy;
} else
{ s->small = 0;
s->factor = 0;
s->policy = 0;
}
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
trimStacks() reclaims all unused space on the stack.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void
trimStacks(DECL_LD int resize)
{ LD->trim_stack_requested = FALSE;
if ( resize )
{ growStacks(GROW_TRIM, GROW_TRIM, GROW_TRIM);
} else
{ trim_stack((Stack) &LD->stacks.local);
trim_stack((Stack) &LD->stacks.global);
trim_stack((Stack) &LD->stacks.trail);
}
#ifdef SECURE_GC
{ Word p; /* clear the stacks */
for(p=gTop; p<gMax; p++)
*p = 0xbfbfbfbf;
for(p=(Word)lTop; p<(Word)lMax; p++)
*p = 0xbfbfbfbf;
}
#endif
DEBUG(CHK_SECURE,
{ scan_global(FALSE);
checkStacks(NULL);
});
}
static
PRED_IMPL("trim_stacks", 0, trim_stacks, 0)
{ PRED_LD
trimStacks(TRUE);
succeed;
}
/*******************************
* LOCAL DATA *
*******************************/
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
In the end, this should do nice cleanup of all local data and be called
both by PL_cleanup() and when destroying a thread. There is still a lot
of work to do.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
void
freePrologLocalData(PL_local_data_t *ld)
{ discardBuffer(&ld->fli._discardable_buffer);
discardStringStack(&ld->fli.string_buffers);
freeVarDefs(ld);
#ifdef O_GVAR
if ( ld->gvar.nb_vars )
destroyHTable(ld->gvar.nb_vars);
#endif
if ( ld->bags.default_bag )
{ PL_free(ld->bags.default_bag);
#if defined(O_ATOMGC) && defined(O_PLMT)
simpleMutexDelete(&ld->bags.mutex);
#endif
}
#ifdef O_CYCLIC
clearSegStack(&ld->cycle.lstack);
clearSegStack(&ld->cycle.vstack);
#endif
freeArithLocalData(ld);
#ifdef O_PLMT
if ( ld->prolog_flag.table )
{ PL_LOCK(L_PLFLAG);
destroyHTable(ld->prolog_flag.table);
PL_UNLOCK(L_PLFLAG);
}
free_predicate_references(ld);
destroy_event_list(&ld->event.hook.onthreadexit);
free_thread_wait(ld);
#endif
#ifdef O_LOCALE
if ( ld->locale.current )
releaseLocale(ld->locale.current);
#endif
if ( ld->qlf.getstr_buffer )
free(ld->qlf.getstr_buffer);
clearThreadTablingData(ld);
if ( ld->tabling.node_pool )
free_alloc_pool(ld->tabling.node_pool);
#ifdef O_C_STACK_GUARDED
if ( ld->signal.alt_stack )
free(ld->signal.alt_stack);
#endif
#ifdef O_COVERAGE
free_coverage_data(ld);
#endif
free_undo_data(ld);
if ( ld->btrace_store )
{ btrace_destroy(ld->btrace_store);
ld->btrace_store = NULL;
}
cleanAbortHooks(ld);
unreferenceStandardStreams(ld);
}
/* The following definitions aren't necessary for compiling, and in fact
* you could comment this whole section out without breaking the code.
* However, they don't take up much space in the binary and they assist
* in C-level debugging, so I'm leaving them in regardless of O_DEBUG. */
const intptr_t __PL_ld = -1;
const intptr_t PL__ctx = -1;
inline PL_local_data_t*
(__FIND_LD)(PL_local_data_t *pl_ld, control_t pl_ctx, PL_local_data_t *fallback)
{ if ((intptr_t)pl_ld != -1)
{ return pl_ld; }
if ((intptr_t)pl_ctx != -1)
{ return pl_ctx->engine; }
return fallback;
}
#ifndef no_local_ld
PL_local_data_t*
no_local_ld(void)
{ return NULL; }
#endif
/*******************************
* PREDICATES *
*******************************/
int
set_stack_limit(size_t limit)
{ GET_LD
if ( limit < LD->stacks.limit &&
limit < sizeStack(local) +
sizeStack(global) +
sizeStack(trail) )
{ garbageCollect(GC_USER);
trimStacks(TRUE);
if ( limit < sizeStack(local) +
sizeStack(global) +
sizeStack(trail) )
{ term_t ex;
return ( (ex=PL_new_term_ref()) &&
PL_put_int64(ex, limit) &&
PL_error(NULL, 0, NULL, ERR_PERMISSION,
ATOM_limit, ATOM_stacks, ex)
);
}
}
LD->stacks.limit = limit;
return TRUE;
}
static
PRED_IMPL("$set_prolog_stack", 4, set_prolog_stack, 0)
{ PRED_LD
atom_t a, k;
Stack stack = NULL;
term_t name = A1;
term_t prop = A2;
term_t old = A3;
term_t value = A4;
if ( PL_get_atom(name, &a) )
{ if ( a == ATOM_local )
stack = (Stack) &LD->stacks.local;
else if ( a == ATOM_global )
stack = (Stack) &LD->stacks.global;
else if ( a == ATOM_trail )
stack = (Stack) &LD->stacks.trail;
else if ( a == ATOM_argument )
stack = (Stack) &LD->stacks.argument;
}
if ( !stack )
return PL_error(NULL, 0, NULL, ERR_EXISTENCE, ATOM_stack, name);
if ( PL_get_atom_ex(prop, &k) )
{ if ( k == ATOM_low )
return (PL_unify_int64(old, stack->small) &&
PL_get_size_ex(value, &stack->small));
if ( k == ATOM_factor )
return (PL_unify_integer(old, stack->factor) &&
PL_get_integer_ex(value, &stack->factor));
if ( k == ATOM_limit )
{ size_t newlimit;
if ( !printMessage(ATOM_warning,
PL_FUNCTOR_CHARS, "deprecated", 1,
PL_FUNCTOR_CHARS, "set_prolog_stack", 2,
PL_TERM, A1,
PL_ATOM, ATOM_limit) )
return FALSE;
return ( PL_unify_int64(old, LD->stacks.limit) &&
PL_get_size_ex(value, &newlimit) &&
set_stack_limit(newlimit)
);
}
if ( k == ATOM_spare )
{ size_t spare = stack->def_spare/sizeof(word);
if ( PL_unify_int64(old, spare) &&
PL_get_size_ex(value, &spare) )
{ stack->def_spare = spare*sizeof(word);
trim_stack(stack);
return TRUE;
}
return FALSE;
}
if ( k == ATOM_min_free )
{ size_t minfree = stack->min_free/sizeof(word);
if ( PL_unify_int64(old, minfree) &&
PL_get_size_ex(value, &minfree) )
{ stack->min_free = minfree*sizeof(word);
trim_stack(stack);
return TRUE;
}
return FALSE;
}
return PL_error(NULL, 0, NULL, ERR_DOMAIN, ATOM_stack_parameter, prop);
}
fail;
}
/*******************************
* PUBLISH PREDICATES *
*******************************/
BeginPredDefs(setup)
PRED_DEF("$set_prolog_stack", 4, set_prolog_stack, 0)
PRED_DEF("trim_stacks", 0, trim_stacks, 0)
PRED_DEF("$on_signal", 4, on_signal, 0)
#ifdef SIG_ALERT
PRED_DEF("prolog_alert_signal", 2, prolog_alert_signal, 0)
#endif
EndPredDefs
|
cdbde6ac3e5a4d60cd868b1bcbe10a51fcf1b97c
|
16562bb52c1be895800765cb5242ecb442a81fd5
|
/src/libtommath/mp_from_ubin.c
|
8272185b8ae6a57c2b17df0c2f73cba1f1112d6a
|
[
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"Unlicense"
] |
permissive
|
odin-lang/Odin
|
c046115a8029cdacdd50ace26f65da42640c0d2c
|
434c84043d7de8e2d579e4b3444da9f579b32237
|
refs/heads/master
| 2023-08-31T10:48:14.047795
| 2023-08-31T08:08:02
| 2023-08-31T08:08:02
| 74,583,692
| 4,708
| 606
|
BSD-3-Clause
| 2023-09-14T19:08:51
| 2016-11-23T14:22:10
|
Odin
|
UTF-8
|
C
| false
| false
| 699
|
c
|
mp_from_ubin.c
|
#include "tommath_private.h"
#ifdef MP_FROM_UBIN_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
/* reads a uint8_t array, assumes the msb is stored first [big endian] */
mp_err mp_from_ubin(mp_int *a, const uint8_t *buf, size_t size)
{
mp_err err;
/* make sure there are at least two digits */
if ((err = mp_grow(a, 2)) != MP_OKAY) {
return err;
}
/* zero the int */
mp_zero(a);
/* read the bytes in */
while (size-- > 0u) {
if ((err = mp_mul_2d(a, 8, a)) != MP_OKAY) {
return err;
}
a->dp[0] |= *buf++;
a->used += 1;
}
mp_clamp(a);
return MP_OKAY;
}
#endif
|
6aa17ee5c13b7f593a76d099f6296c91a4fdb5b9
|
f4ea6db9183b38e0cb1af1d317b0a02db24455d1
|
/test/t-0000152/b.c
|
658223d276ab7662c3d46deb6a6ba934ea2b4423
|
[
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
ldmud/ldmud
|
1446ff7101f5a47ee1dfa4cfb97d5a326f2edcce
|
f1cfc9a8d911412d854055058889bb32432da2db
|
refs/heads/master
| 2023-05-25T00:36:28.318383
| 2023-02-14T21:07:35
| 2023-02-18T10:20:44
| 1,085,012
| 124
| 71
|
NOASSERTION
| 2023-09-01T16:54:48
| 2010-11-16T12:13:17
|
C
|
UTF-8
|
C
| false
| false
| 154
|
c
|
b.c
|
string text = "B";
string var;
string get_text()
{
return text;
}
void set_var(string str)
{
var = str;
}
string get_var()
{
return var;
}
|
3767f51af20d804d68b12d8931a1e0f11f78d293
|
245ea48b285eed1a1a3393fdeb50d3fb70158066
|
/src/o.var/o.var.c
|
8a4a08a597d854b5c38591a64ae78317366a8cae
|
[] |
no_license
|
CNMAT/CNMAT-odot
|
d2b7405f3629bf60776e00c5945f10a67ada7195
|
9c3aa97a1059bdb80249ab9943a92a267f9e2e75
|
refs/heads/master
| 2023-07-25T08:13:13.657100
| 2023-07-17T16:04:05
| 2023-07-17T16:04:05
| 5,643,332
| 110
| 15
| null | 2015-07-01T16:13:52
| 2012-09-01T21:07:06
|
Max
|
UTF-8
|
C
| false
| false
| 15,270
|
c
|
o.var.c
|
/*
Written by John MacCallum, The Center for New Music and Audio Technologies,
University of California, Berkeley. Copyright (c) 2011, The Regents of
the University of California (Regents).
Permission to use, copy, modify, distribute, and distribute modified versions
of this software and its documentation without fee and without a signed
licensing agreement, is hereby granted, provided that the above copyright
notice, this paragraph and the following two paragraphs appear in all copies,
modifications, and distributions.
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NAME: o.var
DESCRIPTION: A variable to store OSC bundles
AUTHORS: John MacCallum
COPYRIGHT_YEARS: 2011
SVN_REVISION: $LastChangedRevision: 587 $
VERSION 0.0: First try
VERSION 1.0: using libo
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
#if !defined(ODOT_UNION) && !defined(ODOT_DIFFERENCE) && !defined(ODOT_INTERSECTION)
#define OMAX_DOC_NAME "o.var"
#define OMAX_DOC_SHORT_DESC "Store a bundle and bang it out later"
#define OMAX_DOC_LONG_DESC "o.var copies an OSC packet and stores it for later use. Since FullPacket messages are references to data stored in memory, objects wishing to store a packet must make a copy of it rather than just save the FullPacket message. Use o.var or o.message to store a packet, not zl reg or any other normal Max object."
#define OMAX_DOC_INLETS_DESC (char *[]){"OSC packet will be stored and sent out immediately; Bang to trigger output", "OSC packet to be stored (no output)"}
#define OMAX_DOC_OUTLETS_DESC (char *[]){"Stored OSC packet"}
#endif
#include "odot_version.h"
#ifdef OMAX_PD_VERSION
#include "m_pd.h"
#include "omax_pd_proxy.h"
#define proxy_getinlet(x) (((t_ovar *)(x))->inlet)
#else
#include "ext.h"
#include "ext_obex.h"
#include "ext_obex_util.h"
#include "ext_critical.h"
#endif
#include "osc.h"
#include "osc_mem.h"
#include "osc_bundle_s.h"
#include "omax_util.h"
#include "omax_doc.h"
#include "omax_dict.h"
#include "osc_bundle_s.r"
#include "o.h"
/*
Workaround for duplicate symbol problem on Linux.
I regret what I've done...
*/
#if defined(ODOT_UNION)
#define ovar_anything ounion_anything
#define ovar_doc ounion_doc
#define ovar_assist ounion_assist
#define ovar_free ounion_free
#define ovar_bang ounion_bang
#define ovar_fullPacket ounion_fullPacket
#define ovar_clear ounion_clear
#define ovar_fullPacket_in1 ounion_fullPacket_in1
#define ovar_doAnything ounion_doAnything
#define ovar_new ounion_new
#define ovar_doFullPacket ounion_doFullPacket
#define ovar_class ounion_class
#define ovar_proxy_class ounion_proxy_class
#elif defined(ODOT_DIFFERENCE)
#define ovar_anything odifference_anything
#define ovar_doc odifference_doc
#define ovar_assist odifference_assist
#define ovar_free odifference_free
#define ovar_bang odifference_bang
#define ovar_fullPacket odifference_fullPacket
#define ovar_clear odifference_clear
#define ovar_fullPacket_in1 odifference_fullPacket_in1
#define ovar_doAnything odifference_doAnything
#define ovar_new odifference_new
#define ovar_doFullPacket odifference_doFullPacket
#define ovar_class odifference_class
#define ovar_proxy_class odifference_proxy_class
#elif defined(ODOT_INTERSECTION)
#define ovar_anything ointersection_anything
#define ovar_doc ointersection_doc
#define ovar_assist ointersection_assist
#define ovar_free ointersection_free
#define ovar_bang ointersection_bang
#define ovar_fullPacket ointersection_fullPacket
#define ovar_clear ointersection_clear
#define ovar_fullPacket_in1 ointersection_fullPacket_in1
#define ovar_doAnything ointersection_doAnything
#define ovar_new ointersection_new
#define ovar_doFullPacket ointersection_doFullPacket
#define ovar_proxy_class ointersection_proxy_class
#endif
typedef struct _ovar{
t_object ob;
void *outlet;
#ifdef OMAX_PD_VERSION
void **proxy;
#else
void *proxy;
#endif
long inlet;
long len;
char *bndl;
long buflen;
t_critical lock;
char emptybndl[OSC_HEADER_SIZE];
} t_ovar;
#ifdef OMAX_PD_VERSION
t_omax_pd_proxy_class *ovar_class;
t_omax_pd_proxy_class *ovar_proxy_class;
#else
void *ovar_class;
#endif
void ovar_clear(t_ovar *x);
void ovar_anything(t_ovar *x, t_symbol *msg, int argc, t_atom *argv);
void ovar_doFullPacket(t_ovar *x, long len, char *ptr, long inlet)
{
osc_bundle_s_wrap_naked_message(len, ptr);
if(inlet == 1){
if(len > 0){
critical_enter(x->lock);
if(len > x->buflen){
x->bndl = osc_mem_resize(x->bndl, len);
if(!(x->bndl)){
object_error((t_object *)x, "ran out of memory!\n");
critical_exit(x->lock);
return;
}
x->buflen = len;
}
memcpy(x->bndl, ptr, len);
x->len = len;
critical_exit(x->lock);
}
}else{
#if (defined ODOT_UNION || defined ODOT_INTERSECTION || defined ODOT_DIFFERENCE)
critical_enter(x->lock);
long copylen = x->len;
//char copy[copylen];
char *copy = osc_mem_alloc(copylen);
memcpy(copy, x->bndl, copylen);
critical_exit(x->lock);
long bndllen = 0;
char *bndl = NULL;
#ifdef ODOT_UNION
t_osc_bndl_s *lhs = osc_bundle_s_alloc(len, ptr);
t_osc_bndl_s *rhs = osc_bundle_s_alloc(copylen, copy);
t_osc_bndl_s *res = osc_bundle_s_union(lhs, rhs);
omax_util_outletOSC(x->outlet, osc_bundle_s_getLen(res), osc_bundle_s_getPtr(res));
osc_bundle_s_free(lhs);
osc_bundle_s_deepFree(rhs);
osc_bundle_s_deepFree(res);
//osc_bundle_s_union(len, ptr, copylen, copy, &bndllen, &bndl);
#else
#if defined ODOT_INTERSECTION
osc_bundle_s_intersection(len, ptr, copylen, copy, &bndllen, &bndl);
#elif defined ODOT_DIFFERENCE
osc_bundle_s_difference(len, ptr, copylen, copy, &bndllen, &bndl);
#endif
omax_util_outletOSC(x->outlet, bndllen, bndl);
if(bndl){
osc_mem_free(bndl);
}
if(copy){
osc_mem_free(copy);
}
#endif
#else // o.var
if(len > 0){
critical_enter(x->lock);
if(len > x->buflen){
x->bndl = osc_mem_resize(x->bndl, len);
if(!(x->bndl)){
object_error((t_object *)x, "ran out of memory!\n");
critical_exit(x->lock);
return;
}
x->buflen = len;
}
memcpy(x->bndl, ptr, len);
x->len = len;
critical_exit(x->lock);
}
omax_util_outletOSC(x->outlet, len, ptr);
#endif
}
}
//void ovar_fullPacket(t_ovar *x, long len, long ptr)
void ovar_fullPacket(t_ovar *x, t_symbol *msg, int argc, t_atom *argv)
{
OMAX_UTIL_GET_LEN_AND_PTR
int inlet = proxy_getinlet((t_object *)x);
ovar_doFullPacket(x, len, ptr, inlet);
}
void ovar_clear(t_ovar *x)
{
critical_enter(x->lock);
x->len = 0;
critical_exit(x->lock);
}
void ovar_doAnything(t_ovar *x, t_symbol *msg, int argc, t_atom *argv, long inlet)
{
t_symbol *address = NULL;
if(msg){
if(*(msg->s_name) != '/'){
object_error((t_object *)x, "OSC address must begin with a '/'");
return;
}
address = msg;
}else{
if(atom_gettype(argv) == A_SYM){
if(*(atom_getsym(argv)->s_name) != '/'){
object_error((t_object *)x, "OSC address must begin with a '/'");
return;
}
address = atom_getsym(argv);
argv++;
argc--;
}
}
if(!address){
object_error((t_object *)x, "no OSC address found");
return;
}
t_osc_bndl_u *bndl_u = osc_bundle_u_alloc();
t_osc_msg_u *msg_u = NULL;
t_osc_err e = omax_util_maxAtomsToOSCMsg_u(&msg_u, address, argc, argv);
if(e){
object_error((t_object *)x, "%s", osc_error_string(e));
return;
}
osc_bundle_u_addMsg(bndl_u, msg_u);
t_osc_bndl_s *bs = osc_bundle_u_serialize(bndl_u);
if(bndl_u){
osc_bundle_u_free(bndl_u);
}
if(bs){
ovar_doFullPacket(x, osc_bundle_s_getLen(bs), osc_bundle_s_getPtr(bs), inlet);
osc_bundle_s_deepFree(bs);
}
}
void ovar_anything(t_ovar *x, t_symbol *msg, int argc, t_atom *argv)
{
ovar_doAnything(x, msg, argc, argv, proxy_getinlet((t_object *)x));
}
void ovar_bang(t_ovar *x)
{
int inlet = proxy_getinlet((t_object *)x);
if(inlet == 1){
return;
}
#if (defined ODOT_UNION || defined ODOT_INTERSECTION || defined ODOT_DIFFERENCE)
ovar_doFullPacket(x, OSC_HEADER_SIZE, (long)x->emptybndl, inlet);
#else
if(x->len){
critical_enter(x->lock);
long len = x->len;
char bndl[len];
memcpy(bndl, x->bndl, len);
critical_exit(x->lock);
omax_util_outletOSC(x->outlet, len, bndl);
OSC_MEM_INVALIDATE(bndl);
}else{
omax_util_outletOSC(x->outlet, OSC_HEADER_SIZE, x->emptybndl);
}
#endif
}
#ifndef OMAX_PD_VERSION
OMAX_DICT_DICTIONARY(t_ovar, x, ovar_fullPacket);
void ovar_assist(t_ovar *x, void *b, long io, long num, char *buf)
{
omax_doc_assist(io, num, buf);
}
#endif
void ovar_doc(t_ovar *x)
{
omax_doc_outletDoc(x->outlet);
}
void ovar_free(t_ovar *x)
{
#ifdef OMAX_PD_VERSION
pd_free(x->proxy[0]);
pd_free(x->proxy[1]);
free(x->proxy);
#else
object_free(x->proxy);
#endif
if(x->bndl){
osc_mem_free(x->bndl);
}
critical_free(x->lock);
}
#ifdef OMAX_PD_VERSION
void ovar_fullPacket_in1(t_ovar *x, t_symbol *msg, int argc, t_atom *argv)
{
OMAX_UTIL_GET_LEN_AND_PTR
ovar_doFullPacket(x, len, ptr, 1);
}
void *ovar_new(t_symbol *msg, short argc, t_atom *argv)
{
t_ovar *x;
if((x = (t_ovar *)object_alloc(ovar_class->class))){
x->outlet = outlet_new(&x->ob, gensym("FullPacket"));
x->proxy = (void **)malloc(2 * sizeof(t_omax_pd_proxy *));
x->proxy[0] = proxy_new((t_object *)x, 0, &(x->inlet), ovar_proxy_class);
x->proxy[1] = proxy_new((t_object *)x, 1, &(x->inlet), ovar_proxy_class);
critical_new(&(x->lock));
x->len = 0;
x->buflen = 0;
x->bndl = NULL;
memset(x->emptybndl, '\0', OSC_HEADER_SIZE);
osc_bundle_s_setBundleID(x->emptybndl);
/*
#if !defined ODOT_UNION && !defined ODOT_INTERSECTION && !defined ODOT_DIFFERENCE
int nargs = attr_args_offset(argc, argv);
if(nargs){
if(atom_gettype(argv) == A_SYM){
if(osc_error_validateAddress(atom_getsym(argv)->s_name)){
object_error((t_object *)x, "arguments must begin with a valid OSC address");
return NULL;
}
t_symbol *address = atom_getsym(argv);
t_osc_bndl_u *bndl_u = osc_bundle_u_alloc();
t_osc_msg_u *msg_u = NULL;
t_osc_err e = omax_util_maxAtomsToOSCMsg_u(&msg_u, address, argc - 1, argv + 1);
if(e){
object_error((t_object *)x, "%s", osc_error_string(e));
return NULL;
}
osc_bundle_u_addMsg(bndl_u, msg_u);
x->buflen = 0;
x->bndl = NULL;
osc_bundle_u_serialize(bndl_u, &(x->buflen), &(x->bndl));
x->len = x->buflen;
if(bndl_u){
osc_bundle_u_free(bndl_u);
}
}else{
object_error((t_object *)x, "arguments must begin with a valid OSC address");
return NULL;
}
}
#endif
*/
}
return x;
}
#ifdef ODOT_UNION
int setup_o0x2eunion(void)
{
t_symbol *name = gensym("o.union");
#elif defined ODOT_INTERSECTION
int setup_o0x2eintersection(void)
{
t_symbol *name = gensym("o.intersection");
#elif defined ODOT_DIFFERENCE
int setup_o0x2edifference(void)
{
t_symbol *name = gensym("o.difference");
#else
int setup_o0x2evar(void)
{
t_symbol *name = gensym("o.var");
#endif
omax_pd_class_new(ovar_class, name, (t_newmethod)ovar_new, (t_method)ovar_free, sizeof(t_ovar), CLASS_NOINLET, A_GIMME, 0);
t_omax_pd_proxy_class *c = NULL;
omax_pd_class_new(c, NULL, NULL, NULL, sizeof(t_omax_pd_proxy), CLASS_PD | CLASS_NOINLET, 0);
omax_pd_class_addmethod(c, (t_method)odot_version, gensym("version"));
omax_pd_class_addmethod(c, (t_method)ovar_fullPacket, gensym("FullPacket"));
omax_pd_class_addmethod(c, (t_method)ovar_clear, gensym("clear"));
omax_pd_class_addanything(c, (t_method)ovar_anything);
omax_pd_class_addbang(c, (t_method)ovar_bang);
omax_pd_class_addmethod(c, (t_method)ovar_doc, gensym("doc"));
ovar_proxy_class = c;
ODOT_PRINT_VERSION;
return 0;
}
#else
void *ovar_new(t_symbol *msg, short argc, t_atom *argv)
{
t_ovar *x;
if((x = (t_ovar *)object_alloc(ovar_class))){
x->outlet = outlet_new((t_object *)x, "FullPacket");
x->proxy = proxy_new((t_object *)x, 1, &(x->inlet));
critical_new(&(x->lock));
x->len = 0;
x->buflen = 0;
x->bndl = NULL;
memset(x->emptybndl, '\0', OSC_HEADER_SIZE);
osc_bundle_s_setBundleID(x->emptybndl);
#if !defined ODOT_UNION && !defined ODOT_INTERSECTION && !defined ODOT_DIFFERENCE
int nargs = attr_args_offset(argc, argv);
if(nargs){
if(atom_gettype(argv) == A_SYM){
if(osc_error_validateAddress(atom_getsym(argv)->s_name)){
object_error((t_object *)x, "arguments must begin with a valid OSC address");
return NULL;
}
t_symbol *address = atom_getsym(argv);
t_osc_bndl_u *bndl_u = osc_bundle_u_alloc();
t_osc_msg_u *msg_u = NULL;
t_osc_err e = omax_util_maxAtomsToOSCMsg_u(&msg_u, address, argc - 1, argv + 1);
if(e){
object_error((t_object *)x, "%s", osc_error_string(e));
return NULL;
}
osc_bundle_u_addMsg(bndl_u, msg_u);
x->buflen = 0;
x->bndl = NULL;
t_osc_bndl_s *bs = osc_bundle_u_serialize(bndl_u);
if(bs){
x->buflen = osc_bundle_s_getLen(bs);
x->bndl = osc_bundle_s_getPtr(bs);
osc_bundle_s_free(bs);
}
x->len = x->buflen;
if(bndl_u){
osc_bundle_u_free(bndl_u);
}
}else{
object_error((t_object *)x, "arguments must begin with a valid OSC address");
return NULL;
}
}
#endif
}
return x;
}
int main(void){
#ifdef ODOT_UNION
t_class *c = class_new("o.union", (method)ovar_new, (method)ovar_free, sizeof(t_ovar), 0L, A_GIMME, 0);
#elif defined ODOT_INTERSECTION
t_class *c = class_new("o.intersection", (method)ovar_new, (method)ovar_free, sizeof(t_ovar), 0L, A_GIMME, 0);
#elif defined ODOT_DIFFERENCE
t_class *c = class_new("o.difference", (method)ovar_new, (method)ovar_free, sizeof(t_ovar), 0L, A_GIMME, 0);
#else
t_class *c = class_new("o.var", (method)ovar_new, (method)ovar_free, sizeof(t_ovar), 0L, A_GIMME, 0);
#endif
//class_addmethod(c, (method)ovar_fullPacket, "FullPacket", A_LONG, A_LONG, 0);
class_addmethod(c, (method)ovar_fullPacket, "FullPacket", A_GIMME, 0);
class_addmethod(c, (method)ovar_assist, "assist", A_CANT, 0);
class_addmethod(c, (method)stdinletinfo, "inletinfo", A_CANT, 0);
class_addmethod(c, (method)ovar_doc, "doc", 0);
class_addmethod(c, (method)ovar_bang, "bang", 0);
class_addmethod(c, (method)ovar_anything, "anything", A_GIMME, 0);
// remove this if statement when we stop supporting Max 5
//if(omax_dict_resolveDictStubs()){
class_addmethod(c, (method)omax_dict_dictionary, "dictionary", A_GIMME, 0);
//}
class_addmethod(c, (method)ovar_clear, "clear", 0);
class_addmethod(c, (method)odot_version, "version", 0);
class_register(CLASS_BOX, c);
ovar_class = c;
common_symbols_init();
ODOT_PRINT_VERSION;
return 0;
}
#endif
|
5076a694504d69f517ede3b35566a1bef7a6831e
|
b0f08154e3eebc7d8465efc57597e52d08d69c18
|
/src/base/event_log.h
|
7538757bce92ad6b765b2d590fb6bdd00d1204ef
|
[
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
CUBRID/cubrid
|
8f71a0010243b72e43ba887d229210650f4e901e
|
3b952af33230839a1b561a78ecd4b773374b66f8
|
refs/heads/develop
| 2023-08-18T19:16:30.987583
| 2023-08-18T08:18:05
| 2023-08-18T08:18:05
| 52,080,367
| 287
| 294
|
NOASSERTION
| 2023-09-14T21:29:09
| 2016-02-19T10:25:32
|
C
|
UTF-8
|
C
| false
| false
| 1,743
|
h
|
event_log.h
|
/*
* Copyright 2008 Search Solution Corporation
* Copyright 2016 CUBRID Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* event_log.h - event log module (server)
*/
#ifndef _EVENT_LOG_H_
#define _EVENT_LOG_H_
#ident "$Id$"
#include "query_list.h"
#include "thread_compat.hpp"
#include <stdio.h>
// forward declarations
struct clientids;
#define EVENT_EMPTY_QUERY "***EMPTY***"
extern void event_log_init (const char *db_name);
extern void event_log_final (void);
extern FILE *event_log_start (THREAD_ENTRY * thread_p, const char *event_name);
extern void event_log_end (THREAD_ENTRY * thread_p);
extern void event_log_print_client_info (int tran_index, int indent);
extern void event_log_sql_string (THREAD_ENTRY * thread_p, FILE * log_fp, XASL_ID * xasl_id, int indent);
extern void event_log_bind_values (THREAD_ENTRY * thread_p, FILE * log_fp, int tran_index, int bind_index);
extern void event_log_log_flush_thr_wait (THREAD_ENTRY * thread_p, int flush_count, clientids * client_info,
int flush_time, int flush_wait_time, int writer_time);
extern void event_log_sql_without_user_oid (FILE * fp, const char *format, int indent, const char *hash_text);
#endif /* _EVENT_LOG_H_ */
|
ee3b7c502e88e82b14c851fdd1a099ea3acad37e
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/wayland-protocols/gtk/gtk/gtkprintunixdialog.h
|
fa0b23183306576b7776b9d184d3f7d92dde3618
|
[
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"LGPL-2.0-only",
"LGPL-2.1-only"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 4,240
|
h
|
gtkprintunixdialog.h
|
/* GtkPrintUnixDialog
* Copyright (C) 2006 John (J5) Palmieri <johnp@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_PRINT_UNIX_DIALOG_H__
#define __GTK_PRINT_UNIX_DIALOG_H__
#if !defined (__GTK_UNIX_PRINT_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtkunixprint.h> can be included directly."
#endif
#include <gtk/gtk.h>
#include <gtk/gtkprinter.h>
#include <gtk/gtkprintjob.h>
G_BEGIN_DECLS
#define GTK_TYPE_PRINT_UNIX_DIALOG (gtk_print_unix_dialog_get_type ())
#define GTK_PRINT_UNIX_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_UNIX_DIALOG, GtkPrintUnixDialog))
#define GTK_IS_PRINT_UNIX_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_UNIX_DIALOG))
typedef struct _GtkPrintUnixDialog GtkPrintUnixDialog;
GDK_AVAILABLE_IN_ALL
GType gtk_print_unix_dialog_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_print_unix_dialog_new (const char *title,
GtkWindow *parent);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_page_setup (GtkPrintUnixDialog *dialog,
GtkPageSetup *page_setup);
GDK_AVAILABLE_IN_ALL
GtkPageSetup * gtk_print_unix_dialog_get_page_setup (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_current_page (GtkPrintUnixDialog *dialog,
int current_page);
GDK_AVAILABLE_IN_ALL
int gtk_print_unix_dialog_get_current_page (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
GtkPrintSettings *settings);
GDK_AVAILABLE_IN_ALL
GtkPrintSettings * gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
GtkPrinter * gtk_print_unix_dialog_get_selected_printer (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
GtkWidget *child,
GtkWidget *tab_label);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
GtkPrintCapabilities capabilities);
GDK_AVAILABLE_IN_ALL
GtkPrintCapabilities gtk_print_unix_dialog_get_manual_capabilities (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_support_selection (GtkPrintUnixDialog *dialog,
gboolean support_selection);
GDK_AVAILABLE_IN_ALL
gboolean gtk_print_unix_dialog_get_support_selection (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_has_selection (GtkPrintUnixDialog *dialog,
gboolean has_selection);
GDK_AVAILABLE_IN_ALL
gboolean gtk_print_unix_dialog_get_has_selection (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
void gtk_print_unix_dialog_set_embed_page_setup (GtkPrintUnixDialog *dialog,
gboolean embed);
GDK_AVAILABLE_IN_ALL
gboolean gtk_print_unix_dialog_get_embed_page_setup (GtkPrintUnixDialog *dialog);
GDK_AVAILABLE_IN_ALL
gboolean gtk_print_unix_dialog_get_page_setup_set (GtkPrintUnixDialog *dialog);
G_END_DECLS
#endif /* __GTK_PRINT_UNIX_DIALOG_H__ */
|
f2a31d825eb9e4f73db05fafc642866f5fe66cea
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/world/area_obk/obk_05/obk_05.h
|
3cc353a50b1f9b533fa9a51c09ca9a6484c2b9f1
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 588
|
h
|
obk_05.h
|
/// @file obk_05.h
/// @brief Boo's Mansion - Pot Room
#include "common.h"
#include "message_ids.h"
#include "map.h"
#include "../obk.h"
#include "mapfs/obk_05_shape.h"
#include "mapfs/obk_05_hit.h"
#include "sprite/npc/Boo.h"
enum {
NPC_Boo_01 = 0,
NPC_Boo_02 = 1,
};
enum {
MF_IsRetroMario = MapFlag(10),
};
#define NAMESPACE obk_05
extern EvtScript N(EVS_Main);
extern EvtScript N(EVS_SetupMusic);
extern EvtScript N(EVS_SetupRockingChairs);
extern EvtScript N(EVS_ManageHole);
extern NpcGroupList N(DefaultNPCs);
extern EvtScript N(EVS_MakeEntities);
|
64339caefe346be582df3f1f333dca63b1e957b5
|
4d28185e7a78a569f9a449f39f183cac3024f711
|
/packages/Python/lldbsuite/test/python_api/frame/inlines/inlines.h
|
265d7b4966ed350b3399f85ce1fbb1f7f594f002
|
[
"NCSA",
"Apache-2.0",
"LLVM-exception"
] |
permissive
|
apple/swift-lldb
|
2789bf44f648609a1674ee520ac20b64c95de072
|
d74be846ef3e62de946df343e8c234bde93a8912
|
refs/heads/stable
| 2023-04-06T00:28:15.882479
| 2019-10-25T22:46:59
| 2019-10-25T22:46:59
| 44,838,862
| 780
| 291
|
Apache-2.0
| 2020-01-10T19:28:43
| 2015-10-23T21:13:18
|
C++
|
UTF-8
|
C
| false
| false
| 149
|
h
|
inlines.h
|
int inner_inline (int inner_input, int mod_value);
int outer_inline (int outer_input);
int not_inlined_2 (int input);
int not_inlined_1 (int input);
|
cd50d9ef1cbaa377956420ea4108494dac957bc5
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/arm/broadcom/bcm283x_platform.c
|
7249d27ec59111b534953fb7b2077575024cb356
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 40,228
|
c
|
bcm283x_platform.c
|
/* $NetBSD: bcm283x_platform.c,v 1.49 2023/04/07 08:55:30 skrll Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.49 2023/04/07 08:55:30 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_bcm283x.h"
#include "opt_cpuoptions.h"
#include "opt_ddb.h"
#include "opt_evbarm_boardtype.h"
#include "opt_kgdb.h"
#include "opt_fdt.h"
#include "opt_rpi.h"
#include "opt_vcprop.h"
#include "sdhc.h"
#include "bcmsdhost.h"
#include "bcmdwctwo.h"
#include "bcmspi.h"
#include "bsciic.h"
#include "plcom.h"
#include "com.h"
#include "genfb.h"
#include "ukbd.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/device.h>
#include <sys/endian.h>
#include <sys/kmem.h>
#include <sys/termios.h>
#include <net/if_ether.h>
#include <prop/proplib.h>
#include <dev/fdt/fdtvar.h>
#include <uvm/uvm_extern.h>
#include <machine/bootconfig.h>
#include <arm/armreg.h>
#include <arm/cpufunc.h>
#include <libfdt.h>
#include <arm/broadcom/bcm2835reg.h>
#include <arm/broadcom/bcm2835var.h>
#include <arm/broadcom/bcm283x_platform.h>
#include <arm/broadcom/bcm2835_intr.h>
#include <arm/broadcom/bcm2835_mbox.h>
#include <arm/broadcom/bcm2835_pmwdogvar.h>
#include <evbarm/dev/plcomreg.h>
#include <evbarm/dev/plcomvar.h>
#include <evbarm/fdt/machdep.h>
#include <dev/ic/ns16550reg.h>
#include <dev/ic/comreg.h>
#include <evbarm/rpi/vcio.h>
#include <evbarm/rpi/vcpm.h>
#include <evbarm/rpi/vcprop.h>
#include <arm/fdt/arm_fdtvar.h>
#include <arm/cortex/gtmr_var.h>
#if NGENFB > 0
#include <dev/videomode/videomode.h>
#include <dev/videomode/edidvar.h>
#include <dev/wscons/wsconsio.h>
#endif
#if NUKBD > 0
#include <dev/usb/ukbdvar.h>
#endif
#ifdef DDB
#include <machine/db_machdep.h>
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
#endif
#define RPI_CPU_MAX 4
void bcm2835_platform_early_putchar(char c);
void bcm2835_aux_platform_early_putchar(char c);
void bcm2836_platform_early_putchar(char c);
void bcm2837_platform_early_putchar(char c);
void bcm2711_platform_early_putchar(char c);
extern void bcmgenfb_set_console_dev(device_t dev);
void bcmgenfb_set_ioctl(int(*)(void *, void *, u_long, void *, int, struct lwp *));
extern void bcmgenfb_ddb_trap_callback(int where);
static int rpi_ioctl(void *, void *, u_long, void *, int, lwp_t *);
extern struct bus_space arm_generic_bs_tag;
extern struct bus_space arm_generic_a4x_bs_tag;
/* Prototypes for all the bus_space structure functions */
bs_protos(arm_generic);
bs_protos(arm_generic_a4x);
bs_protos(bcm2835);
bs_protos(bcm2835_a4x);
bs_protos(bcm2836);
bs_protos(bcm2836_a4x);
bs_protos(bcm2711);
bs_protos(bcm2711_a4x);
struct bus_space bcm2835_bs_tag;
struct bus_space bcm2835_a4x_bs_tag;
struct bus_space bcm2836_bs_tag;
struct bus_space bcm2836_a4x_bs_tag;
struct bus_space bcm2711_bs_tag;
struct bus_space bcm2711_a4x_bs_tag;
static paddr_t bcm2835_bus_to_phys(bus_addr_t);
static paddr_t bcm2836_bus_to_phys(bus_addr_t);
static paddr_t bcm2711_bus_to_phys(bus_addr_t);
#ifdef VERBOSE_INIT_ARM
#define VPRINTF(...) printf(__VA_ARGS__)
#else
#define VPRINTF(...) __nothing
#endif
static paddr_t
bcm2835_bus_to_phys(bus_addr_t ba)
{
/* Attempt to find the PA device mapping */
if (ba >= BCM283X_PERIPHERALS_BASE_BUS &&
ba < BCM283X_PERIPHERALS_BASE_BUS + BCM283X_PERIPHERALS_SIZE)
return BCM2835_PERIPHERALS_BUS_TO_PHYS(ba);
return ba & ~BCM2835_BUSADDR_CACHE_MASK;
}
static paddr_t
bcm2836_bus_to_phys(bus_addr_t ba)
{
/* Attempt to find the PA device mapping */
if (ba >= BCM283X_PERIPHERALS_BASE_BUS &&
ba < BCM283X_PERIPHERALS_BASE_BUS + BCM283X_PERIPHERALS_SIZE)
return BCM2836_PERIPHERALS_BUS_TO_PHYS(ba);
if (ba >= BCM2836_ARM_LOCAL_BASE &&
ba < BCM2836_ARM_LOCAL_BASE + BCM2836_ARM_LOCAL_SIZE)
return ba;
return ba & ~BCM2835_BUSADDR_CACHE_MASK;
}
static paddr_t
bcm2711_bus_to_phys(bus_addr_t ba)
{
/* Attempt to find the PA device mapping */
if (ba >= BCM283X_PERIPHERALS_BASE_BUS &&
ba < BCM283X_PERIPHERALS_BASE_BUS + BCM283X_PERIPHERALS_SIZE)
return BCM2711_PERIPHERALS_BUS_TO_PHYS(ba);
if (ba >= BCM2711_SCB_BASE_BUS &&
ba < BCM2711_SCB_BASE_BUS + BCM2711_SCB_SIZE)
return BCM2711_SCB_BUS_TO_PHYS(ba);
if (ba >= BCM2711_ARM_LOCAL_BASE_BUS &&
ba < BCM2711_ARM_LOCAL_BASE_BUS + BCM2711_ARM_LOCAL_SIZE)
return BCM2711_ARM_LOCAL_BUS_TO_PHYS(ba);
return ba & ~BCM2835_BUSADDR_CACHE_MASK;
}
int
bcm2835_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag,
bus_space_handle_t *bshp)
{
const paddr_t pa = bcm2835_bus_to_phys(ba);
return bus_space_map(&arm_generic_bs_tag, pa, size, flag, bshp);
}
paddr_t
bcm2835_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags)
{
const paddr_t pa = bcm2835_bus_to_phys(ba);
return bus_space_mmap(&arm_generic_bs_tag, pa, offset, prot, flags);
}
paddr_t
bcm2835_a4x_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags)
{
return bcm2835_bs_mmap(t, ba, 4 * offset, prot, flags);
}
int
bcm2836_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag,
bus_space_handle_t *bshp)
{
const paddr_t pa = bcm2836_bus_to_phys(ba);
return bus_space_map(&arm_generic_bs_tag, pa, size, flag, bshp);
}
paddr_t
bcm2836_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags)
{
const paddr_t pa = bcm2836_bus_to_phys(ba);
return bus_space_mmap(&arm_generic_bs_tag, pa, offset, prot, flags);
}
paddr_t
bcm2836_a4x_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags)
{
return bcm2836_bs_mmap(t, ba, 4 * offset, prot, flags);
}
int
bcm2711_bs_map(void *t, bus_addr_t ba, bus_size_t size, int flag,
bus_space_handle_t *bshp)
{
const paddr_t pa = bcm2711_bus_to_phys(ba);
return bus_space_map(&arm_generic_bs_tag, pa, size, flag, bshp);
}
paddr_t
bcm2711_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags)
{
const paddr_t pa = bcm2711_bus_to_phys(ba);
return bus_space_mmap(&arm_generic_bs_tag, pa, offset, prot, flags);
}
paddr_t
bcm2711_a4x_bs_mmap(void *t, bus_addr_t ba, off_t offset, int prot, int flags)
{
return bcm2711_bs_mmap(t, ba, 4 * offset, prot, flags);
}
#if defined(SOC_BCM2835)
static const struct pmap_devmap *
bcm2835_platform_devmap(void)
{
static const struct pmap_devmap devmap[] = {
DEVMAP_ENTRY(BCM2835_PERIPHERALS_VBASE, BCM2835_PERIPHERALS_BASE,
BCM283X_PERIPHERALS_SIZE), /* 16Mb */
DEVMAP_ENTRY_END
};
return devmap;
}
#endif
#if defined(SOC_BCM2836)
static const struct pmap_devmap *
bcm2836_platform_devmap(void)
{
static const struct pmap_devmap devmap[] = {
DEVMAP_ENTRY(BCM2836_PERIPHERALS_VBASE, BCM2836_PERIPHERALS_BASE,
BCM283X_PERIPHERALS_SIZE), /* 16Mb */
DEVMAP_ENTRY(BCM2836_ARM_LOCAL_VBASE, BCM2836_ARM_LOCAL_BASE,
BCM2836_ARM_LOCAL_SIZE),
#if defined(MULTIPROCESSOR) && defined(__aarch64__)
/* for fdt cpu spin-table */
DEVMAP_ENTRY(BCM2836_ARM_SMP_VBASE, BCM2836_ARM_SMP_BASE,
BCM2836_ARM_SMP_SIZE),
#endif
DEVMAP_ENTRY_END
};
return devmap;
}
static const struct pmap_devmap *
bcm2711_platform_devmap(void)
{
static const struct pmap_devmap devmap[] = {
DEVMAP_ENTRY(BCM2711_PERIPHERALS_VBASE, BCM2711_PERIPHERALS_BASE,
BCM283X_PERIPHERALS_SIZE), /* 16Mb */
DEVMAP_ENTRY(BCM2711_ARM_LOCAL_VBASE, BCM2711_ARM_LOCAL_BASE,
BCM2711_ARM_LOCAL_SIZE),
#if defined(MULTIPROCESSOR) && defined(__aarch64__)
/* for fdt cpu spin-table */
DEVMAP_ENTRY(BCM2711_ARM_SMP_VBASE, BCM2836_ARM_SMP_BASE,
BCM2836_ARM_SMP_SIZE),
#endif
DEVMAP_ENTRY_END
};
return devmap;
}
#endif
/*
* Macros to translate between physical and virtual for a subset of the
* kernel address space. *Not* for general use.
*/
#ifndef RPI_FB_WIDTH
#define RPI_FB_WIDTH 1280
#endif
#ifndef RPI_FB_HEIGHT
#define RPI_FB_HEIGHT 720
#endif
int uart_clk = BCM2835_UART0_CLK;
int core_clk;
static struct {
struct vcprop_buffer_hdr vb_hdr;
struct vcprop_tag_clockrate vbt_uartclockrate;
struct vcprop_tag_clockrate vbt_vpuclockrate;
struct vcprop_tag end;
} vb_uart __cacheline_aligned = {
.vb_hdr = {
.vpb_len = htole32(sizeof(vb_uart)),
.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_uartclockrate = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
.vpt_len =
htole32(VCPROPTAG_LEN(vb_uart.vbt_uartclockrate)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
.id = htole32(VCPROP_CLK_UART)
},
.vbt_vpuclockrate = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
.vpt_len = htole32(VCPROPTAG_LEN(vb_uart.vbt_vpuclockrate)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
.id = htole32(VCPROP_CLK_CORE)
},
.end = {
.vpt_tag = htole32(VCPROPTAG_NULL)
}
};
static struct {
struct vcprop_buffer_hdr vb_hdr;
struct vcprop_tag_fwrev vbt_fwrev;
struct vcprop_tag_boardmodel vbt_boardmodel;
struct vcprop_tag_boardrev vbt_boardrev;
struct vcprop_tag_macaddr vbt_macaddr;
struct vcprop_tag_memory vbt_memory;
struct vcprop_tag_boardserial vbt_serial;
struct vcprop_tag_dmachan vbt_dmachan;
struct vcprop_tag_cmdline vbt_cmdline;
struct vcprop_tag_clockrate vbt_emmcclockrate;
struct vcprop_tag_clockrate vbt_armclockrate;
struct vcprop_tag_clockrate vbt_vpuclockrate;
struct vcprop_tag_clockrate vbt_emmc2clockrate;
struct vcprop_tag end;
} vb __cacheline_aligned = {
.vb_hdr = {
.vpb_len = htole32(sizeof(vb)),
.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_fwrev = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_FIRMWAREREV),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_fwrev)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_boardmodel = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_BOARDMODEL),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_boardmodel)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_boardrev = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_BOARDREVISION),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_boardrev)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_macaddr = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_MACADDRESS),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_macaddr)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_memory = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_ARMMEMORY),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_memory)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_serial = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_BOARDSERIAL),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_serial)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_dmachan = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_DMACHAN),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_dmachan)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_cmdline = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CMDLINE),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_cmdline)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_emmcclockrate = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_emmcclockrate)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
.id = htole32(VCPROP_CLK_EMMC)
},
.vbt_armclockrate = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_armclockrate)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
.id = htole32(VCPROP_CLK_ARM)
},
.vbt_vpuclockrate = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
.vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_vpuclockrate)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
.id = htole32(VCPROP_CLK_CORE)
},
.vbt_emmc2clockrate = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
.vpt_len =
htole32(VCPROPTAG_LEN(vb.vbt_emmc2clockrate)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
.id = htole32(VCPROP_CLK_EMMC2)
},
.end = {
.vpt_tag = htole32(VCPROPTAG_NULL)
}
};
#if NGENFB > 0
static struct {
struct vcprop_buffer_hdr vb_hdr;
struct vcprop_tag_edidblock vbt_edid;
struct vcprop_tag end;
} vb_edid __cacheline_aligned = {
.vb_hdr = {
.vpb_len = htole32(sizeof(vb_edid)),
.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_edid = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_EDID_BLOCK),
.vpt_len = htole32(VCPROPTAG_LEN(vb_edid.vbt_edid)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.blockno = htole32(0),
},
.end = {
.vpt_tag = htole32(VCPROPTAG_NULL)
}
};
static struct {
struct vcprop_buffer_hdr vb_hdr;
struct vcprop_tag_fbres vbt_res;
struct vcprop_tag_fbres vbt_vres;
struct vcprop_tag_fbdepth vbt_depth;
struct vcprop_tag_fbalpha vbt_alpha;
struct vcprop_tag_allocbuf vbt_allocbuf;
struct vcprop_tag_blankscreen vbt_blank;
struct vcprop_tag_fbpitch vbt_pitch;
struct vcprop_tag end;
} vb_setfb __cacheline_aligned = {
.vb_hdr = {
.vpb_len = htole32(sizeof(vb_setfb)),
.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_res = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_SET_FB_RES),
.vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_res)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.width = htole32(0),
.height = htole32(0),
},
.vbt_vres = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_SET_FB_VRES),
.vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_vres)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.width = htole32(0),
.height = htole32(0),
},
.vbt_depth = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_SET_FB_DEPTH),
.vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_depth)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.bpp = htole32(32),
},
.vbt_alpha = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_SET_FB_ALPHA_MODE),
.vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_alpha)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.state = htole32(VCPROP_ALPHA_IGNORED),
},
.vbt_allocbuf = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_ALLOCATE_BUFFER),
.vpt_len =
htole32(VCPROPTAG_LEN(vb_setfb.vbt_allocbuf)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.address = htole32(PAGE_SIZE), /* alignment */
},
.vbt_blank = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_BLANK_SCREEN),
.vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_blank)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
.state = htole32(VCPROP_BLANK_OFF),
},
.vbt_pitch = {
.tag = {
.vpt_tag = htole32(VCPROPTAG_GET_FB_PITCH),
.vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_pitch)),
.vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
},
.end = {
.vpt_tag = htole32(VCPROPTAG_NULL),
},
};
#endif
static int rpi_video_on = WSDISPLAYIO_VIDEO_ON;
#if defined(RPI_HWCURSOR)
#define CURSOR_BITMAP_SIZE (64 * 8)
#define CURSOR_ARGB_SIZE (64 * 64 * 4)
static uint32_t hcursor = 0;
static bus_addr_t pcursor = 0;
static uint32_t *cmem = NULL;
static int cursor_x = 0, cursor_y = 0, hot_x = 0, hot_y = 0, cursor_on = 0;
static uint32_t cursor_cmap[4];
static uint8_t cursor_mask[8 * 64], cursor_bitmap[8 * 64];
#endif
u_int
bcm283x_clk_get_rate_uart(void)
{
if (vcprop_tag_success_p(&vb_uart.vbt_uartclockrate.tag))
return le32toh(vb_uart.vbt_uartclockrate.rate);
return 0;
}
u_int
bcm283x_clk_get_rate_vpu(void)
{
if (vcprop_tag_success_p(&vb.vbt_vpuclockrate.tag) &&
vb.vbt_vpuclockrate.rate != 0) {
return le32toh(vb.vbt_vpuclockrate.rate);
}
return 0;
}
u_int
bcm283x_clk_get_rate_emmc(void)
{
if (vcprop_tag_success_p(&vb.vbt_emmcclockrate.tag) &&
vb.vbt_emmcclockrate.rate != 0) {
return le32toh(vb.vbt_emmcclockrate.rate);
}
return 0;
}
u_int
bcm283x_clk_get_rate_emmc2(void)
{
if (vcprop_tag_success_p(&vb.vbt_emmc2clockrate.tag) &&
vb.vbt_emmc2clockrate.rate != 0) {
return le32toh(vb.vbt_emmc2clockrate.rate);
}
return 0;
}
static void
bcm283x_uartinit(bus_space_tag_t iot, bus_space_handle_t ioh)
{
uint32_t res;
bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC,
KERN_VTOPHYS((vaddr_t)&vb_uart));
bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res);
/*
* RPI4 has Cortex A72 processors which do speculation, so
* we need to invalidate the cache for an updates done by
* the firmware
*/
cpu_dcache_inv_range((vaddr_t)&vb_uart, sizeof(vb_uart));
if (vcprop_tag_success_p(&vb_uart.vbt_uartclockrate.tag))
uart_clk = le32toh(vb_uart.vbt_uartclockrate.rate);
if (vcprop_tag_success_p(&vb_uart.vbt_vpuclockrate.tag))
core_clk = le32toh(vb_uart.vbt_vpuclockrate.rate);
}
#if defined(SOC_BCM2835)
static void
bcm2835_uartinit(void)
{
const paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
const bus_space_tag_t iot = &bcm2835_bs_tag;
const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_uartinit(iot, ioh);
}
#endif
#if defined(SOC_BCM2836)
static void
bcm2836_uartinit(void)
{
const paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
const bus_space_tag_t iot = &bcm2836_bs_tag;
const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_uartinit(iot, ioh);
}
static void
bcm2711_uartinit(void)
{
const paddr_t pa = BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
const bus_space_tag_t iot = &bcm2711_bs_tag;
const bus_space_handle_t ioh = BCM2711_IOPHYSTOVIRT(pa);
bcm283x_uartinit(iot, ioh);
}
#endif
#define BCM283x_MINIMUM_SPLIT (128U * 1024 * 1024)
static size_t bcm283x_memorysize;
static void
bcm283x_bootparams(bus_space_tag_t iot, bus_space_handle_t ioh)
{
uint32_t res;
bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANPM, (
#if (NSDHC > 0)
(1 << VCPM_POWER_SDCARD) |
#endif
#if (NPLCOM > 0)
(1 << VCPM_POWER_UART0) |
#endif
#if (NBCMDWCTWO > 0)
(1 << VCPM_POWER_USB) |
#endif
#if (NBSCIIC > 0)
(1 << VCPM_POWER_I2C0) | (1 << VCPM_POWER_I2C1) |
/* (1 << VCPM_POWER_I2C2) | */
#endif
#if (NBCMSPI > 0)
(1 << VCPM_POWER_SPI) |
#endif
0) << 4);
bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC,
KERN_VTOPHYS((vaddr_t)&vb));
bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res);
/*
* RPI4 has Cortex A72 processors which do speculation, so
* we need to invalidate the cache for an updates done by
* the firmware
*/
cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb));
if (!vcprop_buffer_success_p(&vb.vb_hdr)) {
bootconfig.dramblocks = 1;
bootconfig.dram[0].address = 0x0;
bootconfig.dram[0].pages = atop(BCM283x_MINIMUM_SPLIT);
return;
}
struct vcprop_tag_memory *vptp_mem = &vb.vbt_memory;
if (vcprop_tag_success_p(&vptp_mem->tag)) {
size_t n = vcprop_tag_resplen(&vptp_mem->tag) /
sizeof(struct vcprop_memory);
bcm283x_memorysize = 0;
bootconfig.dramblocks = 0;
for (int i = 0; i < n && i < DRAM_BLOCKS; i++) {
bootconfig.dram[i].address =
le32toh(vptp_mem->mem[i].base);
bootconfig.dram[i].pages =
atop(le32toh(vptp_mem->mem[i].size));
bootconfig.dramblocks++;
bcm283x_memorysize += le32toh(vptp_mem->mem[i].size);
}
}
if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag))
curcpu()->ci_data.cpu_cc_freq =
le32toh(vb.vbt_armclockrate.rate);
#ifdef VERBOSE_INIT_ARM
if (vcprop_tag_success_p(&vb.vbt_memory.tag))
printf("%s: memory size %zu\n", __func__,
bcm283x_memorysize);
if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag))
printf("%s: arm clock %d\n", __func__,
le32toh(vb.vbt_armclockrate.rate));
if (vcprop_tag_success_p(&vb.vbt_vpuclockrate.tag))
printf("%s: vpu clock %d\n", __func__,
le32toh(vb.vbt_vpuclockrate.rate));
if (vcprop_tag_success_p(&vb.vbt_emmcclockrate.tag))
printf("%s: emmc clock %d\n", __func__,
le32toh(vb.vbt_emmcclockrate.rate));
if (vcprop_tag_success_p(&vb.vbt_emmc2clockrate.tag))
printf("%s: emmc2 clock %d\n", __func__,
le32toh(vb.vbt_emmcclockrate.rate));
if (vcprop_tag_success_p(&vb.vbt_fwrev.tag))
printf("%s: firmware rev %x\n", __func__,
le32toh(vb.vbt_fwrev.rev));
if (vcprop_tag_success_p(&vb.vbt_boardmodel.tag))
printf("%s: board model %x\n", __func__,
le32toh(vb.vbt_boardmodel.model));
if (vcprop_tag_success_p(&vb.vbt_macaddr.tag))
printf("%s: mac-address %" PRIx64 "\n", __func__,
le64toh(vb.vbt_macaddr.addr));
if (vcprop_tag_success_p(&vb.vbt_boardrev.tag))
printf("%s: board rev %x\n", __func__,
le32toh(vb.vbt_boardrev.rev));
if (vcprop_tag_success_p(&vb.vbt_serial.tag))
printf("%s: board serial %" PRIx64 "\n", __func__,
le64toh(vb.vbt_serial.sn));
if (vcprop_tag_success_p(&vb.vbt_dmachan.tag))
printf("%s: DMA channel mask 0x%08x\n", __func__,
le32toh(vb.vbt_dmachan.mask));
if (vcprop_tag_success_p(&vb.vbt_cmdline.tag))
printf("%s: cmdline %s\n", __func__,
vb.vbt_cmdline.cmdline);
#endif
}
#if defined(SOC_BCM2835)
static void
bcm2835_bootparams(void)
{
const paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
const bus_space_tag_t iot = &bcm2835_bs_tag;
const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_bootparams(iot, ioh);
}
#endif
#if defined(SOC_BCM2836)
static void
bcm2836_bootparams(void)
{
const paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
const bus_space_tag_t iot = &bcm2836_bs_tag;
const bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_bootparams(iot, ioh);
}
static void
bcm2711_bootparams(void)
{
const paddr_t pa = BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_ARMMBOX_BASE);
const bus_space_tag_t iot = &bcm2711_bs_tag;
const bus_space_handle_t ioh = BCM2711_IOPHYSTOVIRT(pa);
bcm283x_bootparams(iot, ioh);
}
#if defined(MULTIPROCESSOR)
static int
cpu_enable_bcm2836(int phandle)
{
bus_space_tag_t iot = &bcm2836_bs_tag;
bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE;
uint64_t mpidr;
fdtbus_get_reg64(phandle, 0, &mpidr, NULL);
const u_int cpuno = __SHIFTOUT(mpidr, MPIDR_AFF0);
bus_space_write_4(iot, ioh, BCM2836_LOCAL_MAILBOX3_SETN(cpuno),
KERN_VTOPHYS((vaddr_t)cpu_mpstart));
return 0;
}
ARM_CPU_METHOD(bcm2836, "brcm,bcm2836-smp", cpu_enable_bcm2836);
#endif
#endif /* SOC_BCM2836 */
#if NGENFB > 0
static bool
rpi_fb_parse_mode(const char *s, uint32_t *pwidth, uint32_t *pheight)
{
char *x;
if (strncmp(s, "disable", 7) == 0)
return false;
x = strchr(s, 'x');
if (x) {
*pwidth = strtoul(s, NULL, 10);
*pheight = strtoul(x + 1, NULL, 10);
}
return true;
}
#define RPI_EDIDSIZE 1024
static bool
rpi_fb_get_edid_mode(uint32_t *pwidth, uint32_t *pheight)
{
struct edid_info ei;
uint32_t res;
int error;
error = bcmmbox_request(BCMMBOX_CHANARM2VC, &vb_edid,
sizeof(vb_edid), &res);
if (error) {
printf("%s: mbox request failed (%d)\n", __func__, error);
return false;
}
if (!vcprop_buffer_success_p(&vb_edid.vb_hdr) ||
!vcprop_tag_success_p(&vb_edid.vbt_edid.tag) ||
vb_edid.vbt_edid.status != 0)
return false;
uint8_t *edid_data = kmem_alloc(RPI_EDIDSIZE, KM_SLEEP);
memset(edid_data, 0, RPI_EDIDSIZE);
memcpy(edid_data, vb_edid.vbt_edid.data,
sizeof(vb_edid.vbt_edid.data));
edid_parse(edid_data, &ei);
#ifdef VERBOSE_INIT_ARM
edid_print(&ei);
#endif
if (ei.edid_preferred_mode) {
*pwidth = ei.edid_preferred_mode->hdisplay;
*pheight = ei.edid_preferred_mode->vdisplay;
}
kmem_free(edid_data, RPI_EDIDSIZE);
return true;
}
/*
* Initialize framebuffer console.
*
* Some notes about boot parameters:
* - If "fb=disable" is present, ignore framebuffer completely.
* - If "fb=<width>x<height> is present, use the specified mode.
* - If "console=fb" is present, attach framebuffer to console.
*/
static bool
rpi_fb_init(prop_dictionary_t dict, void *aux)
{
uint32_t width = 0, height = 0;
uint32_t res;
char *ptr;
int integer;
int error;
bool is_bgr = true;
if (get_bootconf_option(boot_args, "fb",
BOOTOPT_TYPE_STRING, &ptr)) {
if (rpi_fb_parse_mode(ptr, &width, &height) == false)
return false;
}
if (width == 0 || height == 0) {
rpi_fb_get_edid_mode(&width, &height);
}
if (width == 0 || height == 0) {
width = RPI_FB_WIDTH;
height = RPI_FB_HEIGHT;
}
vb_setfb.vbt_res.width = htole32(width);
vb_setfb.vbt_res.height = htole32(height);
vb_setfb.vbt_vres.width = htole32(width);
vb_setfb.vbt_vres.height = htole32(height);
error = bcmmbox_request(BCMMBOX_CHANARM2VC, &vb_setfb,
sizeof(vb_setfb), &res);
if (error) {
printf("%s: mbox request failed (%d)\n", __func__, error);
return false;
}
if (!vcprop_buffer_success_p(&vb_setfb.vb_hdr) ||
!vcprop_tag_success_p(&vb_setfb.vbt_res.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_vres.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_depth.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_allocbuf.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_blank.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_pitch.tag)) {
printf("%s: prop tag failed\n", __func__);
return false;
}
#ifdef VERBOSE_INIT_ARM
printf("%s: addr = 0x%x size = %d\n", __func__,
le32toh(vb_setfb.vbt_allocbuf.address),
le32toh(vb_setfb.vbt_allocbuf.size));
printf("%s: depth = %d\n", __func__, le32toh(vb_setfb.vbt_depth.bpp));
printf("%s: pitch = %d\n", __func__,
le32toh(vb_setfb.vbt_pitch.linebytes));
printf("%s: width = %d height = %d\n", __func__,
le32toh(vb_setfb.vbt_res.width), le32toh(vb_setfb.vbt_res.height));
printf("%s: vwidth = %d vheight = %d\n", __func__,
le32toh(vb_setfb.vbt_vres.width),
le32toh(vb_setfb.vbt_vres.height));
#endif
if (vb_setfb.vbt_allocbuf.address == 0 ||
vb_setfb.vbt_allocbuf.size == 0 ||
vb_setfb.vbt_res.width == 0 ||
vb_setfb.vbt_res.height == 0 ||
vb_setfb.vbt_vres.width == 0 ||
vb_setfb.vbt_vres.height == 0 ||
vb_setfb.vbt_pitch.linebytes == 0) {
printf("%s: failed to set mode %ux%u\n", __func__,
width, height);
return false;
}
prop_dictionary_set_uint32(dict, "width",
le32toh(vb_setfb.vbt_res.width));
prop_dictionary_set_uint32(dict, "height",
le32toh(vb_setfb.vbt_res.height));
prop_dictionary_set_uint8(dict, "depth",
le32toh(vb_setfb.vbt_depth.bpp));
prop_dictionary_set_uint16(dict, "linebytes",
le32toh(vb_setfb.vbt_pitch.linebytes));
prop_dictionary_set_uint32(dict, "address",
le32toh(vb_setfb.vbt_allocbuf.address));
/*
* Old firmware uses BGR. New firmware uses RGB. The get and set
* pixel order mailbox properties don't seem to work. The firmware
* adds a kernel cmdline option bcm2708_fb.fbswap=<0|1>, so use it
* to determine pixel order. 0 means BGR, 1 means RGB.
*
* See https://github.com/raspberrypi/linux/issues/514
*/
if (get_bootconf_option(boot_args, "bcm2708_fb.fbswap",
BOOTOPT_TYPE_INT, &integer)) {
is_bgr = integer == 0;
}
prop_dictionary_set_bool(dict, "is_bgr", is_bgr);
/* if "genfb.type=<n>" is passed in cmdline, override wsdisplay type */
if (get_bootconf_option(boot_args, "genfb.type",
BOOTOPT_TYPE_INT, &integer)) {
prop_dictionary_set_uint32(dict, "wsdisplay_type", integer);
}
#if defined(RPI_HWCURSOR)
struct fdt_attach_args *faa = aux;
bus_space_handle_t hc;
hcursor = rpi_alloc_mem(CURSOR_ARGB_SIZE, PAGE_SIZE,
MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_HINT_PERMALOCK);
pcursor = rpi_lock_mem(hcursor);
#ifdef RPI_IOCTL_DEBUG
printf("hcursor: %08x\n", hcursor);
printf("pcursor: %08x\n", (uint32_t)pcursor);
printf("fb: %08x\n", (uint32_t)vb_setfb.vbt_allocbuf.address);
#endif
if (bus_space_map(faa->faa_bst, pcursor, CURSOR_ARGB_SIZE,
BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE, &hc) != 0) {
printf("couldn't map cursor memory\n");
} else {
int i, j, k;
cmem = bus_space_vaddr(faa->faa_bst, hc);
k = 0;
for (j = 0; j < 64; j++) {
for (i = 0; i < 64; i++) {
cmem[i + k] =
((i & 8) ^ (j & 8)) ? 0xa0ff0000 : 0xa000ff00;
}
k += 64;
}
cpu_dcache_wb_range((vaddr_t)cmem, CURSOR_ARGB_SIZE);
rpi_fb_initcursor(pcursor, 0, 0);
#ifdef RPI_IOCTL_DEBUG
rpi_fb_movecursor(600, 400, 1);
#else
rpi_fb_movecursor(cursor_x, cursor_y, cursor_on);
#endif
}
#endif
return true;
}
#if defined(RPI_HWCURSOR)
static int
rpi_fb_do_cursor(struct wsdisplay_cursor *cur)
{
int pos = 0;
int shape = 0;
if (cur->which & WSDISPLAY_CURSOR_DOCUR) {
if (cursor_on != cur->enable) {
cursor_on = cur->enable;
pos = 1;
}
}
if (cur->which & WSDISPLAY_CURSOR_DOHOT) {
hot_x = cur->hot.x;
hot_y = cur->hot.y;
pos = 1;
shape = 1;
}
if (cur->which & WSDISPLAY_CURSOR_DOPOS) {
cursor_x = cur->pos.x;
cursor_y = cur->pos.y;
pos = 1;
}
if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
int i;
uint32_t val;
for (i = 0; i < uimin(cur->cmap.count, 3); i++) {
val = (cur->cmap.red[i] << 16 ) |
(cur->cmap.green[i] << 8) |
(cur->cmap.blue[i] ) |
0xff000000;
cursor_cmap[i + cur->cmap.index + 2] = val;
}
shape = 1;
}
if (cur->which & WSDISPLAY_CURSOR_DOSHAPE) {
int err;
err = copyin(cur->mask, cursor_mask, CURSOR_BITMAP_SIZE);
err += copyin(cur->image, cursor_bitmap, CURSOR_BITMAP_SIZE);
if (err != 0)
return EFAULT;
shape = 1;
}
if (shape) {
int i, j, idx;
uint8_t mask;
for (i = 0; i < CURSOR_BITMAP_SIZE; i++) {
mask = 0x01;
for (j = 0; j < 8; j++) {
idx = ((cursor_mask[i] & mask) ? 2 : 0) |
((cursor_bitmap[i] & mask) ? 1 : 0);
cmem[i * 8 + j] = cursor_cmap[idx];
mask = mask << 1;
}
}
/* just in case */
cpu_dcache_wb_range((vaddr_t)cmem, CURSOR_ARGB_SIZE);
rpi_fb_initcursor(pcursor, hot_x, hot_y);
}
if (pos) {
rpi_fb_movecursor(cursor_x, cursor_y, cursor_on);
}
return 0;
}
#endif
static int
rpi_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l)
{
switch (cmd) {
case WSDISPLAYIO_SVIDEO:
{
int d = *(int *)data;
if (d == rpi_video_on)
return 0;
rpi_video_on = d;
rpi_fb_set_video(d);
#if defined(RPI_HWCURSOR)
rpi_fb_movecursor(cursor_x, cursor_y,
d ? cursor_on : 0);
#endif
}
return 0;
case WSDISPLAYIO_GVIDEO:
*(int *)data = rpi_video_on;
return 0;
#if defined(RPI_HWCURSOR)
case WSDISPLAYIO_GCURPOS:
{
struct wsdisplay_curpos *cp = (void *)data;
cp->x = cursor_x;
cp->y = cursor_y;
}
return 0;
case WSDISPLAYIO_SCURPOS:
{
struct wsdisplay_curpos *cp = (void *)data;
cursor_x = cp->x;
cursor_y = cp->y;
rpi_fb_movecursor(cursor_x, cursor_y, cursor_on);
}
return 0;
case WSDISPLAYIO_GCURMAX:
{
struct wsdisplay_curpos *cp = (void *)data;
cp->x = 64;
cp->y = 64;
}
return 0;
case WSDISPLAYIO_SCURSOR:
{
struct wsdisplay_cursor *cursor = (void *)data;
return rpi_fb_do_cursor(cursor);
}
#endif
default:
return EPASSTHROUGH;
}
}
#endif
SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl machdep subtree setup (rpi)")
{
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
CTLTYPE_INT, "firmware_revision", NULL, NULL, 0,
&vb.vbt_fwrev.rev, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
CTLTYPE_INT, "board_model", NULL, NULL, 0,
&vb.vbt_boardmodel.model, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
CTLTYPE_INT, "board_revision", NULL, NULL, 0,
&vb.vbt_boardrev.rev, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READONLY|CTLFLAG_HEX|CTLFLAG_PRIVATE,
CTLTYPE_QUAD, "serial", NULL, NULL, 0,
&vb.vbt_serial.sn, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
}
#if defined(SOC_BCM2835)
static void
bcm2835_platform_bootstrap(void)
{
bcm2835_bs_tag = arm_generic_bs_tag;
bcm2835_a4x_bs_tag = arm_generic_a4x_bs_tag;
bcm2835_bs_tag.bs_map = bcm2835_bs_map;
bcm2835_bs_tag.bs_mmap = bcm2835_bs_mmap;
bcm2835_a4x_bs_tag.bs_map = bcm2835_bs_map;
bcm2835_a4x_bs_tag.bs_mmap = bcm2835_a4x_bs_mmap;
fdtbus_set_decoderegprop(false);
bcm2835_uartinit();
bcm2835_bootparams();
}
#endif
#if defined(SOC_BCM2836)
static void
bcm2836_platform_bootstrap(void)
{
bcm2836_bs_tag = arm_generic_bs_tag;
bcm2836_a4x_bs_tag = arm_generic_a4x_bs_tag;
bcm2836_bs_tag.bs_map = bcm2836_bs_map;
bcm2836_bs_tag.bs_mmap = bcm2836_bs_mmap;
bcm2836_a4x_bs_tag.bs_map = bcm2836_bs_map;
bcm2836_a4x_bs_tag.bs_mmap = bcm2836_a4x_bs_mmap;
fdtbus_set_decoderegprop(false);
bcm2836_uartinit();
bcm2836_bootparams();
#ifdef MULTIPROCESSOR
arm_cpu_max = RPI_CPU_MAX;
arm_fdt_cpu_bootstrap();
#endif
}
static void
bcm2711_platform_bootstrap(void)
{
bcm2711_bs_tag = arm_generic_bs_tag;
bcm2711_a4x_bs_tag = arm_generic_a4x_bs_tag;
bcm2711_bs_tag.bs_map = bcm2711_bs_map;
bcm2711_bs_tag.bs_mmap = bcm2711_bs_mmap;
bcm2711_a4x_bs_tag.bs_map = bcm2711_bs_map;
bcm2711_a4x_bs_tag.bs_mmap = bcm2711_a4x_bs_mmap;
fdtbus_set_decoderegprop(false);
bcm2711_uartinit();
bcm2711_bootparams();
#ifdef MULTIPROCESSOR
arm_cpu_max = RPI_CPU_MAX;
arm_fdt_cpu_bootstrap();
#endif
}
#endif
#if defined(SOC_BCM2835)
static void
bcm2835_platform_init_attach_args(struct fdt_attach_args *faa)
{
faa->faa_bst = &bcm2835_bs_tag;
}
#endif
#if defined(SOC_BCM2836)
static void
bcm2836_platform_init_attach_args(struct fdt_attach_args *faa)
{
faa->faa_bst = &bcm2836_bs_tag;
}
static void
bcm2711_platform_init_attach_args(struct fdt_attach_args *faa)
{
faa->faa_bst = &bcm2711_bs_tag;
}
#endif
static void __noasan
bcm283x_platform_early_putchar(vaddr_t va, paddr_t pa, char c)
{
volatile uint32_t *uartaddr =
cpu_earlydevice_va_p() ?
(volatile uint32_t *)va :
(volatile uint32_t *)pa;
while ((le32toh(uartaddr[PL01XCOM_FR / 4]) & PL01X_FR_TXFF) != 0)
continue;
uartaddr[PL01XCOM_DR / 4] = htole32(c);
while ((le32toh(uartaddr[PL01XCOM_FR / 4]) & PL01X_FR_TXFE) == 0)
continue;
}
static void __noasan
bcm283x_aux_platform_early_putchar(vaddr_t va, paddr_t pa, char c)
{
volatile uint32_t *uartaddr =
cpu_earlydevice_va_p() ?
(volatile uint32_t *)va :
(volatile uint32_t *)pa;
while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0)
continue;
uartaddr[com_data] = htole32(c);
}
void __noasan
bcm2835_platform_early_putchar(char c)
{
paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_UART0_BASE);
vaddr_t va = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_platform_early_putchar(va, pa, c);
}
void __noasan
bcm2835_aux_platform_early_putchar(char c)
{
paddr_t pa = BCM2835_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE);
vaddr_t va = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_aux_platform_early_putchar(va, pa, c);
}
void __noasan
bcm2836_platform_early_putchar(char c)
{
paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_UART0_BASE);
vaddr_t va = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_platform_early_putchar(va, pa, c);
}
void __noasan
bcm2837_platform_early_putchar(char c)
{
paddr_t pa = BCM2836_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE);
vaddr_t va = BCM2835_IOPHYSTOVIRT(pa);
bcm283x_aux_platform_early_putchar(va, pa, c);
}
void __noasan
bcm2711_platform_early_putchar(char c)
{
paddr_t pa = BCM2711_PERIPHERALS_BUS_TO_PHYS(BCM2835_AUX_UART_BASE);
vaddr_t va = BCM2711_IOPHYSTOVIRT(pa);
bcm283x_aux_platform_early_putchar(va, pa, c);
}
#define BCM283x_REF_FREQ 19200000
static void
bcm283x_platform_device_register(device_t dev, void *aux)
{
prop_dictionary_t dict = device_properties(dev);
if (device_is_a(dev, "bcmdmac") &&
vcprop_tag_success_p(&vb.vbt_dmachan.tag)) {
prop_dictionary_set_uint32(dict,
"chanmask", le32toh(vb.vbt_dmachan.mask));
}
#if NSDHC > 0
if (booted_device == NULL &&
device_is_a(dev, "ld") &&
device_is_a(device_parent(dev), "sdmmc")) {
booted_partition = 0;
booted_device = dev;
}
#endif
if ((device_is_a(dev, "usmsc") ||
device_is_a(dev, "mue") ||
device_is_a(dev, "genet")) &&
vcprop_tag_success_p(&vb.vbt_macaddr.tag)) {
const uint64_t addr = le64toh(vb.vbt_macaddr.addr);
const uint8_t enaddr[ETHER_ADDR_LEN] = {
(addr >> 0) & 0xff, (addr >> 8) & 0xff,
(addr >> 16) & 0xff, (addr >> 24) & 0xff,
(addr >> 32) & 0xff, (addr >> 40) & 0xff
};
prop_dictionary_set_data(dict, "mac-address", enaddr,
ETHER_ADDR_LEN);
}
#if NGENFB > 0
if (device_is_a(dev, "genfb")) {
char *ptr;
bcmgenfb_set_console_dev(dev);
bcmgenfb_set_ioctl(&rpi_ioctl);
#ifdef DDB
db_trap_callback = bcmgenfb_ddb_trap_callback;
#endif
if (rpi_fb_init(dict, aux) == false)
return;
if (get_bootconf_option(boot_args, "console",
BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) {
prop_dictionary_set_bool(dict, "is_console", true);
#if NUKBD > 0
/* allow ukbd to be the console keyboard */
ukbd_cnattach();
#endif
} else {
prop_dictionary_set_bool(dict, "is_console", false);
}
}
#endif
}
static u_int
bcm283x_platform_uart_freq(void)
{
/*
* We are safe to access stdout phandle - consinit did before
* calling fp_uart_freq
*/
const int phandle = fdtbus_get_stdout_phandle();
static const struct device_compatible_entry aux_compat_data[] = {
{ .compat = "brcm,bcm2835-aux-uart" },
DEVICE_COMPAT_EOL
};
if (of_compatible_match(phandle, aux_compat_data))
return core_clk * 2;
return uart_clk;
}
#if defined(SOC_BCM2835)
static const struct fdt_platform bcm2835_platform = {
.fp_devmap = bcm2835_platform_devmap,
.fp_bootstrap = bcm2835_platform_bootstrap,
.fp_init_attach_args = bcm2835_platform_init_attach_args,
.fp_device_register = bcm283x_platform_device_register,
.fp_reset = bcm2835_system_reset,
.fp_delay = bcm2835_tmr_delay,
.fp_uart_freq = bcm283x_platform_uart_freq,
};
FDT_PLATFORM(bcm2835, "brcm,bcm2835", &bcm2835_platform);
#endif
#if defined(SOC_BCM2836)
static const struct fdt_platform bcm2836_platform = {
.fp_devmap = bcm2836_platform_devmap,
.fp_bootstrap = bcm2836_platform_bootstrap,
.fp_init_attach_args = bcm2836_platform_init_attach_args,
.fp_device_register = bcm283x_platform_device_register,
.fp_reset = bcm2835_system_reset,
.fp_delay = gtmr_delay,
.fp_uart_freq = bcm283x_platform_uart_freq,
.fp_mpstart = arm_fdt_cpu_mpstart,
};
static const struct fdt_platform bcm2837_platform = {
.fp_devmap = bcm2836_platform_devmap,
.fp_bootstrap = bcm2836_platform_bootstrap,
.fp_init_attach_args = bcm2836_platform_init_attach_args,
.fp_device_register = bcm283x_platform_device_register,
.fp_reset = bcm2835_system_reset,
.fp_delay = gtmr_delay,
.fp_uart_freq = bcm283x_platform_uart_freq,
.fp_mpstart = arm_fdt_cpu_mpstart,
};
static const struct fdt_platform bcm2711_platform = {
.fp_devmap = bcm2711_platform_devmap,
.fp_bootstrap = bcm2711_platform_bootstrap,
.fp_init_attach_args = bcm2711_platform_init_attach_args,
.fp_device_register = bcm283x_platform_device_register,
.fp_reset = bcm2835_system_reset,
.fp_delay = gtmr_delay,
.fp_uart_freq = bcm283x_platform_uart_freq,
.fp_mpstart = arm_fdt_cpu_mpstart,
};
FDT_PLATFORM(bcm2836, "brcm,bcm2836", &bcm2836_platform);
FDT_PLATFORM(bcm2837, "brcm,bcm2837", &bcm2837_platform);
FDT_PLATFORM(bcm2711, "brcm,bcm2711", &bcm2711_platform);
#endif
|
c27fea366f0e8d650515bbd568f0045ac32f0e06
|
7d7900e1c25b729fc8c208673a449c0520ba466e
|
/lib/kernel/ocml/src/privD.h
|
ff6cad4615e37c0e6f62e6f81da5f5d2942b8e03
|
[
"MIT",
"BSD-2-Clause",
"NCSA"
] |
permissive
|
pocl/pocl
|
384091e15c8f6abf29fd2c6deace34a7de5a6ac6
|
5a99e12d0bb78427ad948ac368589135507f1b59
|
refs/heads/main
| 2023-09-02T14:16:21.381680
| 2023-08-21T12:13:47
| 2023-08-21T12:13:47
| 12,292,999
| 775
| 250
|
MIT
| 2023-09-14T06:50:34
| 2013-08-22T09:26:12
|
C
|
UTF-8
|
C
| false
| false
| 3,359
|
h
|
privD.h
|
/*===--------------------------------------------------------------------------
* ROCm Device Libraries
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*===------------------------------------------------------------------------*/
#define MATH_CLZI(U) ({ \
uint _clzi_u = U; \
uint _clzi_z = BUILTIN_FIRSTBIT_U32(_clzi_u); \
uint _clzi_ret = _clzi_u == 0u ? 32u : _clzi_z; \
_clzi_ret; \
})
#define MATH_CLZL(U) ({ \
ulong _clzl_u = U; \
uint2 _clzl_u2 = AS_UINT2(_clzl_u); \
uint _clzl_zlo = BUILTIN_FIRSTBIT_U32(_clzl_u2.lo); \
uint _clzl_zhi = BUILTIN_FIRSTBIT_U32(_clzl_u2.hi); \
uint _clzl_clo = (_clzl_u2.lo == 0 ? 32 : _clzl_zlo) + 32; \
uint _clzl_ret = _clzl_u2.hi == 0 ? _clzl_clo : _clzl_zhi; \
_clzl_ret; \
})
#define MATH_MAD(A,B,C) BUILTIN_FMA_F64(A, B, C)
#define MATH_FAST_RCP(X) ({ \
double _frcp_x = X; \
double _frcp_ret; \
_frcp_ret = BUILTIN_RCP_F64(_frcp_x); \
_frcp_ret = BUILTIN_FMA_F64(BUILTIN_FMA_F64(-_frcp_x, _frcp_ret, 1.0), _frcp_ret, _frcp_ret); \
_frcp_ret = BUILTIN_FMA_F64(BUILTIN_FMA_F64(-_frcp_x, _frcp_ret, 1.0), _frcp_ret, _frcp_ret); \
_frcp_ret; \
})
#define MATH_RCP(X) BUILTIN_DIV_F64(1.0, X)
#define MATH_FAST_DIV(X, Y) ({ \
double _fdiv_x = X; \
double _fdiv_y = Y; \
double _fdiv_ret; \
double _fdiv_r = BUILTIN_RCP_F64(_fdiv_y); \
_fdiv_r = BUILTIN_FMA_F64(BUILTIN_FMA_F64(-_fdiv_y, _fdiv_r, 1.0), _fdiv_r, _fdiv_r); \
_fdiv_r = BUILTIN_FMA_F64(BUILTIN_FMA_F64(-_fdiv_y, _fdiv_r, 1.0), _fdiv_r, _fdiv_r); \
_fdiv_ret = _fdiv_x * _fdiv_r; \
_fdiv_ret = BUILTIN_FMA_F64(BUILTIN_FMA_F64(-_fdiv_y, _fdiv_ret, _fdiv_x), _fdiv_r, _fdiv_ret); \
_fdiv_ret; \
})
#define MATH_DIV(X,Y) BUILTIN_DIV_F64(X, Y)
#define MATH_FAST_SQRT(X) ({ \
double _fsqrt_x = X; \
double _fsqrt_y = BUILTIN_RSQRT_F64(_fsqrt_x); \
double _fsqrt_s0 = _fsqrt_x * _fsqrt_y; \
double _fsqrt_h0 = 0.5 * _fsqrt_y; \
double _fsqrt_r0 = BUILTIN_FMA_F64(-_fsqrt_h0, _fsqrt_s0, 0.5); \
double _fsqrt_h1 = BUILTIN_FMA_F64(_fsqrt_h0, _fsqrt_r0, _fsqrt_h0); \
double _fsqrt_s1 = BUILTIN_FMA_F64(_fsqrt_s0, _fsqrt_r0, _fsqrt_s0); \
double _fsqrt_d0 = BUILTIN_FMA_F64(-_fsqrt_s1, _fsqrt_s1, _fsqrt_x); \
double _fsqrt_ret = BUILTIN_FMA_F64(_fsqrt_d0, _fsqrt_h1, _fsqrt_s1); \
_fsqrt_ret; \
})
#define MATH_SQRT(X) ({ \
double _sqrt_x = X; \
bool _sqrt_b = _sqrt_x < 0x1.0p-767; \
_sqrt_x *= _sqrt_b ? 0x1.0p+256 : 1.0; \
double _sqrt_y = BUILTIN_RSQRT_F64(_sqrt_x); \
double _sqrt_s0 = _sqrt_x * _sqrt_y; \
double _sqrt_h0 = 0.5 * _sqrt_y; \
double _sqrt_r0 = BUILTIN_FMA_F64(-_sqrt_h0, _sqrt_s0, 0.5); \
double _sqrt_h1 = BUILTIN_FMA_F64(_sqrt_h0, _sqrt_r0, _sqrt_h0); \
double _sqrt_s1 = BUILTIN_FMA_F64(_sqrt_s0, _sqrt_r0, _sqrt_s0); \
double _sqrt_d0 = BUILTIN_FMA_F64(-_sqrt_s1, _sqrt_s1, _sqrt_x); \
double _sqrt_s2 = BUILTIN_FMA_F64(_sqrt_d0, _sqrt_h1, _sqrt_s1); \
double _sqrt_d1 = BUILTIN_FMA_F64(-_sqrt_s2, _sqrt_s2, _sqrt_x); \
double _sqrt_ret = BUILTIN_FMA_F64(_sqrt_d1, _sqrt_h1, _sqrt_s2); \
_sqrt_ret *= _sqrt_b ? 0x1.0p-128 : 1.0; \
_sqrt_ret = (_sqrt_x == 0.0) | (_sqrt_x == (double)INFINITY) ? _sqrt_x : _sqrt_ret; \
_sqrt_ret; \
})
|
0056d5ea59ab64aa104522cbaf27849a6a3df589
|
39bbabca04b639979145ebd373e45f83cf3c6f10
|
/ambf_framework/afEnums.h
|
302580a2aad3433cf1667004b89b1f54c857feae
|
[] |
no_license
|
WPI-AIM/ambf
|
5a26fff8fa5f150dfdad597562aac42da126cb01
|
189cb5ec8b7ae03b12c0e215d5f67c26c31f6ffe
|
refs/heads/ambf-2.0
| 2023-08-05T07:26:05.634330
| 2023-07-26T19:57:11
| 2023-07-26T19:57:11
| 168,765,517
| 137
| 71
| null | 2023-05-24T18:07:23
| 2019-02-01T21:58:25
|
C++
|
UTF-8
|
C
| false
| false
| 4,229
|
h
|
afEnums.h
|
//==============================================================================
/*
Software License Agreement (BSD License)
Copyright (c) 2019-2021, AMBF
(https://github.com/WPI-AIM/ambf)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of authors nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
\author <amunawar@wpi.edu>
\author Adnan Munawar
*/
//==============================================================================
//------------------------------------------------------------------------------
#ifndef AF_ENUMS_H
#define AF_ENUMS_H
//------------------------------------------------------------------------------
///
/// \brief The afActuatorType enum
///
enum class afActuatorType{
CONSTRAINT = 0,
INVALID = 1
};
///
/// \brief The afAxisType enum
///
enum class afAxisType{
X = 0,
Y = 1,
Z = 2
};
///
/// \brief The afBodyType enum
///
enum class afBodyType{
RIGID_BODY=0,
SOFT_BODY=1
};
///
/// \brief The afType enum
///
enum class afType{
INVALID,
OBJECT,
ACTUATOR,
CAMERA,
INPUT_DEVICE,
LIGHT,
RIGID_BODY,
SOFT_BODY,
GHOST_OBJECT,
SENSOR,
VEHICLE,
VOLUME,
MODEL,
POINT_CLOUD,
WORLD,
JOINT
};
///
/// \brief The afPluginType enum
///
enum afPluginType{
SIMULATOR,
WORLD,
MODEL,
OBJECT
};
///
/// \brief The afControlType enum
///
enum class afControlType{
POSITION=0,
FORCE=1,
VELOCITY=2
};
///
/// \brief The afGeometryType enum
///
enum class afGeometryType{
INVALID=0,
MESH=1,
SINGLE_SHAPE=2,
COMPOUND_SHAPE=3
};
///
/// \brief The JointType enum
///
enum class afJointType{
REVOLUTE = 0,
PRISMATIC = 1,
LINEAR_SPRING = 2,
TORSION_SPRING = 3,
P2P = 4,
FIXED = 5,
CONE_TWIST = 6,
SIX_DOF = 7,
SIX_DOF_SPRING = 8,
INVALID = 9
};
///
/// \brief The afPrimitiveShapeType enum
///
enum class afPrimitiveShapeType{
INVALID = 0,
PLANE = 1,
BOX = 2,
SPHERE = 3,
CYLINDER = 4,
CAPSULE = 5,
CONE = 6,
};
enum class afCollisionMeshShapeType{
CONCAVE_MESH=0,
CONVEX_MESH=1,
CONVEX_HULL=2,
POINT_CLOUD=3
};
///
/// \brief The afSensorType enum
///
enum class afSensorType{
RAYTRACER = 0,
RANGE = 1,
RESISTANCE = 2,
INVALID = 3
};
///
/// \brief The afSensactorSpecificationType enum
///
enum class afSensactorSpecificationType{
ARRAY = 0,
MESH = 1,
PARAMETRIC = 2,
INVALID = 3
};
///
/// \brief The ShadowQuality enum
///
enum class afShadowQualityType{
NO_SHADOW=0,
VERY_LOW=1,
LOW=2,
MEDIUM=3,
HIGH=4,
VERY_HIGH=5
};
///
/// \brief The afWheelRepresentationType enum
///
enum class afWheelRepresentationType{
MESH=0,
RIGID_BODY=1,
INVALID=2
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.