1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:11:25 -07:00
go/usr/rsc/mem/malloc.h
Russ Cox 75647d2024 First pieces of malloc.
R=r
DELTA=756  (754 added, 0 deleted, 2 changed)
OCL=19266
CL=19378
2008-11-17 12:32:35 -08:00

33 lines
647 B
C

// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "../../../src/runtime/runtime.h"
typedef struct PageMap PageMap;
enum
{
PageShift = 12,
PageMask = (1<<PageShift) - 1,
};
enum {
PMBits = 64 - PageShift,
PMLevels = 4,
PMLevelBits = 13,
PMLevelSize = 1<<PMLevelBits,
PMLevelMask = PMLevelSize - 1,
};
struct PageMap
{
void *level0[PMLevelSize];
};
extern int64 allocator·footprint;
extern bool allocator·frozen;
void* trivalloc(int32);
void* pmlookup(PageMap*, uintptr);
void* pminsert(PageMap*, uintptr, void*);