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 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. 'use strict'; const { Array, ArrayIsArray, ArrayPrototypeForEach, MathFloor, MathMin, MathTrunc, NumberIsNaN, NumberMAX_SAFE_INTEGER, NumberMIN_SAFE_INTEGER, ObjectDefineProperties, ObjectDefineProperty, ObjectSetPrototypeOf, RegExpPrototypeSymbolReplace, StringPrototypeCharCodeAt, StringPrototypeSlice, StringPrototypeToLowerCase, StringPrototypeTrim, SymbolSpecies, SymbolToPrimitive, TypedArrayPrototypeGetBuffer, TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteOffset, TypedArrayPrototypeFill, TypedArrayPrototypeGetLength, TypedArrayPrototypeSet, TypedArrayPrototypeSlice, Uint8Array, Uint8ArrayPrototype, } = primordials; const { byteLengthUtf8, compare: _compare, compareOffset, createFromString, fill: bindingFill, isAscii: bindingIsAscii, isUtf8: bindingIsUtf8, indexOfBuffer, indexOfNumber, indexOfString, swap16: _swap16, swap32: _swap32, swap64: _swap64, kMaxLength, kStringMaxLength, atob: _atob, btoa: _btoa, } = internalBinding('buffer'); const { constants: { ALL_PROPERTIES, ONLY_ENUMERABLE, }, getOwnNonIndexProperties, } = internalBinding('util'); const { customInspectSymbol, isInsideNodeModules, lazyDOMException, normalizeEncoding, kIsEncodingSymbol, defineLazyProperties, encodingsMap, } = require('internal/util'); const { isAnyArrayBuffer, isArrayBufferView, isUint8Array, isTypedArray, } = require('internal/util/types'); const { inspect: utilInspect, } = require('internal/util/inspect'); const { codes: { ERR_BUFFER_OUT_OF_BOUNDS, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_INVALID_BUFFER_SIZE, ERR_OUT_OF_RANGE, ERR_MISSING_ARGS, ERR_UNKNOWN_ENCODING, }, genericNodeError, } = require('internal/errors'); const { validateArray, validateBuffer, validateInteger, validateNumber, validateString, } = require('internal/validators'); // Provide validateInteger() but with kMaxLength as the default maximum value. const validateOffset = (value, name, min = 0, max = kMaxLength) => validateInteger(value, name, min, max); const { FastBuffer, markAsUntransferable, addBufferPrototypeMethods, createUnsafeBuffer, } = require('internal/buffer'); FastBuffer.prototype.constructor = Buffer; Buffer.prototype = FastBuffer.prototype; addBufferPrototypeMethods(Buffer.prototype); const constants = ObjectDefineProperties({}, { MAX_LENGTH: { __proto__: null, value: kMaxLength, writable: false, enumerable: true, }, MAX_STRING_LENGTH: { __proto__: null, value: kStringMaxLength, writable: false, enumerable: true, }, }); Buffer.poolSize = 8 * 1024; let poolSize, poolOffset, allocPool; function createPool() { poolSize = Buffer.poolSize; allocPool = createUnsafeBuffer(poolSize).buffer; markAsUntransferable(allocPool); poolOffset = 0; } createPool(); function alignPool() { // Ensure aligned slices if (poolOffset & 0x7) { poolOffset |= 0x7; poolOffset++; } } let bufferWarningAlreadyEmitted = false; let nodeModulesCheckCounter = 0; const bufferWarning = 'Buffer() is deprecated due to security and usability ' + 'issues. Please use the Buffer.alloc(), ' + 'Buffer.allocUnsafe(), or Buffer.from() methods instead.'; function showFlaggedDeprecation() { if (bufferWarningAlreadyEmitted || ++nodeModulesCheckCounter > 10000 || (!require('internal/options').getOptionValue('--pending-deprecation') && isInsideNodeModules())) { // We don't emit a warning, because we either: // - Already did so, or // - Already checked too many times whether a call is coming // from node_modules and want to stop slowing down things, or // - We aren't running with `--pending-deprecation` enabled, // and the code is inside `node_modules`. return; } process.emitWarning(bufferWarning, 'DeprecationWarning', 'DEP0005'); bufferWarningAlreadyEmitted = true; } function toInteger(n, defaultVal) { n = +n; if (!NumberIsNaN(n) && n >= NumberMIN_SAFE_INTEGER && n <= NumberMAX_SAFE_INTEGER) { return ((n % 1) === 0 ? n : MathFloor(n)); } return defaultVal; } function _copy(source, target, targetStart, sourceStart, sourceEnd) { if (!isUint8Array(source)) throw new ERR_INVALID_ARG_TYPE('source', ['Buffer', 'Uint8Array'], source); if (!isUint8Array(target)) throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target); if (targetStart === undefined) { targetStart = 0; } else { targetStart = toInteger(targetStart, 0); if (targetStart < 0) throw new ERR_OUT_OF_RANGE('targetStart', '>= 0', targetStart); } if (sourceStart === undefined) { sourceStart = 0; } else { sourceStart = toInteger(sourceStart, 0); if (sourceStart < 0 || sourceStart > source.length) throw new ERR_OUT_OF_RANGE('sourceStart', `>= 0 && <= ${source.length}`, sourceStart); } if (sourceEnd === undefined) { sourceEnd = source.length; } else { sourceEnd = toInteger(sourceEnd, 0); if (sourceEnd < 0) throw new ERR_OUT_OF_RANGE('sourceEnd', '>= 0', sourceEnd); } if (targetStart >= target.length || sourceStart >= sourceEnd) return 0; return _copyActual(source, target, targetStart, sourceStart, sourceEnd); } function _copyActual(source, target, targetStart, sourceStart, sourceEnd) { if (sourceEnd - sourceStart > target.length - targetStart) sourceEnd = sourceStart + target.length - targetStart; let nb = sourceEnd - sourceStart; const sourceLen = source.length - sourceStart; if (nb > sourceLen) nb = sourceLen; if (sourceStart !== 0 || sourceEnd < source.length) source = new Uint8Array(source.buffer, source.byteOffset + sourceStart, nb); TypedArrayPrototypeSet(target, source, targetStart); return nb; } /** * The Buffer() constructor is deprecated in documentation and should not be * used moving forward. Rather, developers should use one of the three new * factory APIs: Buffer.from(), Buffer.allocUnsafe() or Buffer.alloc() based on * their specific needs. There is no runtime deprecation because of the extent * to which the Buffer constructor is used in the ecosystem currently -- a * runtime deprecation would introduce too much breakage at this time. It's not * likely that the Buffer constructors would ever actually be removed. * Deprecation Code: DEP# SPDX-License-Identifier: GPL-2.0 ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif HAVE_KVM_STAT_SUPPORT := 1 PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 # # Syscall table generation for perf # out := $(OUTPUT)arch/powerpc/include/generated/asm header32 := $(out)/syscalls_32.c header64 := $(out)/syscalls_64.c sysprf := $(srctree)/tools/perf/arch/powerpc/entry/syscalls sysdef := $(sysprf)/syscall.tbl systbl := $(sysprf)/mksyscalltbl # Create output directory if not already present _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') $(header64): $(sysdef) $(systbl) $(Q)$(SHELL) '$(systbl)' '64' $(sysdef) > $@ $(header32): $(sysdef) $(systbl) $(Q)$(SHELL) '$(systbl)' '32' $(sysdef) > $@ clean:: $(call QUIET_CLEAN, powerpc) $(RM) $(header32) $(header64) archheaders: $(header32) $(header64)