1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* |
4 |
|
|
* This program and the accompanying materials are made available under the |
5 |
|
|
* terms of the MIT License which is available at |
6 |
|
|
* https://opensource.org/licenses/MIT. |
7 |
|
|
* |
8 |
|
|
* SPDX-License-Identifier: MIT |
9 |
|
|
**************************************************************************/ |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/**************************************************************************/ |
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/** */ |
15 |
|
|
/** USBX Component */ |
16 |
|
|
/** */ |
17 |
|
|
/** Utility */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
/* Include necessary system files. */ |
23 |
|
|
|
24 |
|
|
#define UX_SOURCE_CODE |
25 |
|
|
|
26 |
|
|
#include "ux_api.h" |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
/**************************************************************************/ |
30 |
|
|
/* */ |
31 |
|
|
/* FUNCTION RELEASE */ |
32 |
|
|
/* */ |
33 |
|
|
/* _ux_utility_memory_allocate_mulv_safe PORTABLE C */ |
34 |
|
|
/* 6.1 */ |
35 |
|
|
/* AUTHOR */ |
36 |
|
|
/* */ |
37 |
|
|
/* Chaoqiong Xiao, Microsoft Corporation */ |
38 |
|
|
/* */ |
39 |
|
|
/* DESCRIPTION */ |
40 |
|
|
/* */ |
41 |
|
|
/* This function allocates a block of memory for the specified */ |
42 |
|
|
/* multiplied size and alignment. */ |
43 |
|
|
/* */ |
44 |
|
|
/* Note if multiplying result overflow, no memory is allocated. */ |
45 |
|
|
/* Note it's assumed all factors to multiply is variables for */ |
46 |
|
|
/* possible code optimization. */ |
47 |
|
|
/* */ |
48 |
|
|
/* INPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* align Memory alignment required */ |
51 |
|
|
/* cache Memory pool source */ |
52 |
|
|
/* size_mul_v0 Number of bytes variable to */ |
53 |
|
|
/* multiply */ |
54 |
|
|
/* size_mul_v1 Number of bytes variable to */ |
55 |
|
|
/* multiply */ |
56 |
|
|
/* */ |
57 |
|
|
/* OUTPUT */ |
58 |
|
|
/* */ |
59 |
|
|
/* Pointer to block of memory */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLS */ |
62 |
|
|
/* */ |
63 |
|
|
/* _ux_utility_memory_allocate Allocate block of memory */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* USBX Components */ |
68 |
|
|
/* */ |
69 |
|
|
/* RELEASE HISTORY */ |
70 |
|
|
/* */ |
71 |
|
|
/* DATE NAME DESCRIPTION */ |
72 |
|
|
/* */ |
73 |
|
|
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ |
74 |
|
|
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ |
75 |
|
|
/* resulting in version 6.1 */ |
76 |
|
|
/* */ |
77 |
|
|
/**************************************************************************/ |
78 |
|
2 |
VOID* _ux_utility_memory_allocate_mulv_safe(ULONG align,ULONG cache,ULONG size_mul_v0,ULONG size_mul_v1) |
79 |
|
|
{ |
80 |
✓✓ |
2 |
return UX_UTILITY_MEMORY_ALLOCATE_MULV_SAFE(align, cache, size_mul_v0, size_mul_v1); |
81 |
|
|
} |