本文整理汇总了C++中cache_flush函数的典型用法代码示例。如果您正苦于以下问题:C++ cache_flush函数的具体用法?C++ cache_flush怎么用?C++ cache_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_flush函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setup_default_mtrrs
// could consider having an API to allow these to dynamically change
// MTRRs are for physical, static ranges. PAT are linear, more granular, and
// more dynamic
void setup_default_mtrrs(barrier_t* smp_barrier)
{
// disable interrupts
int8_t state = 0;
disable_irqsave(&state);
// barrier - if we're meant to do this for all cores, we'll be
// passed a pointer to an initialized barrier
if (smp_barrier)
waiton_barrier(smp_barrier);
// disable caching cr0: set CD and clear NW
lcr0((rcr0() | CR0_CD) & ~CR0_NW);
// flush caches
cache_flush();
// flush tlb
tlb_flush_global();
// disable MTRRs, and sets default type to WB (06)
#ifndef CONFIG_NOMTRRS
write_msr(IA32_MTRR_DEF_TYPE, 0x00000006);
// Now we can actually safely adjust the MTRRs
// MTRR for IO Holes (note these are 64 bit values we are writing)
// 0x000a0000 - 0x000c0000 : VGA - WC 0x01
write_msr(IA32_MTRR_PHYSBASE0, PTE_ADDR(VGAPHYSMEM) | 0x01);
// if we need to have a full 64bit val, use the UINT64 macro
write_msr(IA32_MTRR_PHYSMASK0, 0x0000000ffffe0800);
// 0x000c0000 - 0x00100000 : IO devices (and ROM BIOS) - UC 0x00
write_msr(IA32_MTRR_PHYSBASE1, PTE_ADDR(DEVPHYSMEM) | 0x00);
write_msr(IA32_MTRR_PHYSMASK1, 0x0000000ffffc0800);
// APIC/IOAPIC holes
/* Going to skip them, since we set their mode using PAT when we
* map them in
*/
// make sure all other MTRR ranges are disabled (should be unnecessary)
write_msr(IA32_MTRR_PHYSMASK2, 0);
write_msr(IA32_MTRR_PHYSMASK3, 0);
write_msr(IA32_MTRR_PHYSMASK4, 0);
write_msr(IA32_MTRR_PHYSMASK5, 0);
write_msr(IA32_MTRR_PHYSMASK6, 0);
write_msr(IA32_MTRR_PHYSMASK7, 0);
// keeps default type to WB (06), turns MTRRs on, and turns off fixed ranges
write_msr(IA32_MTRR_DEF_TYPE, 0x00000806);
#endif
// reflush caches and TLB
cache_flush();
tlb_flush_global();
// turn on caching
lcr0(rcr0() & ~(CR0_CD | CR0_NW));
// barrier
if (smp_barrier)
waiton_barrier(smp_barrier);
// enable interrupts
enable_irqsave(&state);
}
开发者ID:7perl,项目名称:akaros,代码行数:58,代码来源:pmap.c
示例2: delete_tags
/*
* Removes some or all tags from some or all contigs.
* If the contig list or tag list is blank it implies all contigs or all tags.
*
* Returns 0 on success
* -1 on failure
*/
int delete_tags(GapIO *io, int ncontigs, contig_list_t *contigs,
char *tag_list, int verbose) {
HashTable *h = NULL;
int ret = 0;
/* Hash tag types */
if (tag_list && *tag_list) {
int i;
if (SetActiveTags(tag_list) == -1) {
return -1;
}
h = HashTableCreate(32, 0);
for (i = 0; i < number_of_active_tags; i++) {
HashData hd;
hd.i = 0;
HashTableAdd(h, active_tag_types[i], 4, hd, NULL);
}
}
/* Iterate over contig list or all contigs */
if (verbose)
vfuncheader("Delete Tags");
if (ncontigs) {
int i;
for (i = 0; i < ncontigs; i++) {
contig_t *c = cache_search(io, GT_Contig, contigs[i].contig);
vmessage("Scanning contig %d of %d (%s)\n",
i+1, ncontigs, c->name);
ret |= delete_tag_single_contig(io, contigs[i].contig, h, verbose);
UpdateTextOutput();
cache_flush(io);
}
} else {
int i;
tg_rec *order = ArrayBase(tg_rec, io->contig_order);
for (i = 0; i < NumContigs(io); i++) {
contig_t *c = cache_search(io, GT_Contig, order[i]);
vmessage("Scanning contig %d of %d (%s)\n",
i+1, NumContigs(io), c->name);
ret |= delete_tag_single_contig(io, order[i], h, verbose);
UpdateTextOutput();
cache_flush(io);
}
}
SetActiveTags("");
if (h)
HashTableDestroy(h, 0);
return ret;
}
开发者ID:svn2github,项目名称:staden-trunk,代码行数:62,代码来源:tg_anno.c
示例3: get_free_cache_buff
struct cached_block* get_free_cache_buff(){
if(INODE_DEBUG) printf("get_free_cache_buff()\n");
int idx = bitmap_scan_and_flip(cache_bitmap, 0, 1, FREE);
if(idx != BITMAP_ERROR){
struct cached_block* newblock = buffcache + idx;
if(INODE_DEBUG) printf("get_free_cache_buff(): idx %d buffcache %x newblock %x buffcache+BUFF_CACHE_SIZE %x\n", idx, buffcache, newblock, buffcache+N_BUFFERS);
memset(newblock, 0, sizeof(struct cached_block));
list_push_front(&buffcachelist, &newblock->elem);
return newblock;
}
else{
struct cached_block* last_block = list_entry(list_back(&buffcache), struct cached_block, elem);
cache_flush(NULL, last_block->sector);
list_remove(&last_block->elem);
traverse_buffcachelist();
list_push_front(&buffcachelist, &last_block->elem);
memset(last_block->data, 0, BLOCK_SECTOR_SIZE);
last_block->inode=NULL;
last_block->sector=0;
if(INODE_DEBUG) printf("get_free_cache_buff(): idx %d buffcache %x lastblock %x buffcache+BUFF_CACHE_SIZE %x\n", idx, buffcache, last_block, buffcache+N_BUFFERS);
return last_block;
}
}
开发者ID:harshitm26,项目名称:operating_system_pintos,代码行数:29,代码来源:inode.c
示例4: cache_flush
//$02 cache
auto GSU::op_cache() {
if(regs.cbr != (regs.r[15] & 0xfff0)) {
regs.cbr = regs.r[15] & 0xfff0;
cache_flush();
}
regs.reset();
}
开发者ID:Asvel,项目名称:higan-compromise,代码行数:8,代码来源:instructions.cpp
示例5: cleanup_before_linux
int cleanup_before_linux (void)
{
/*
* this function is called just before we call linux
* it prepares the processor for linux
*
* we turn off caches etc ...
*/
disable_interrupts ();
#ifdef CONFIG_LCD
{
extern void lcd_disable(void);
extern void lcd_panel_disable(void);
lcd_disable(); /* proper disable of lcd & panel */
lcd_panel_disable();
}
#endif
/* turn off I/D-cache */
icache_disable();
dcache_disable();
/* flush I/D-cache */
cache_flush();
/*Workaround to enable L2CC during kernel decompressing*/
#ifdef fixup_before_linux
fixup_before_linux;
#endif
return 0;
}
开发者ID:vickylinuxer,项目名称:i.mx25-uboot,代码行数:32,代码来源:cpu.c
示例6: cleanup_before_linux
int cleanup_before_linux (void)
{
/*
* this function is called just before we call linux
* it prepares the processor for linux
*
* we turn off caches etc ...
*/
disable_interrupts ();
/*
* this function is called just before we call linux
* it prepares the processor for linux
*/
#ifdef CONFIG_BOARD_CLEANUP_BEFORE_LINUX
board_cleanup_before_linux();
#endif
/* turn off I/D-cache */
icache_disable();
dcache_disable();
/* flush I/D-cache */
cache_flush();
return 0;
}
开发者ID:digidotcom,项目名称:yocto-uboot,代码行数:27,代码来源:cpu.c
示例7: cache_flush
//$02 cache
void SuperFX::op_cache() {
if(regs.cbr != (regs.r[15] & 0xfff0)) {
regs.cbr = regs.r[15] & 0xfff0;
cache_flush();
}
regs.reset();
}
开发者ID:CarterLi,项目名称:bsnes-plus,代码行数:8,代码来源:opcodes.cpp
示例8: cleanup_before_linux
int cleanup_before_linux (void)
{
/*
* this function is called just before we call linux
* it prepares the processor for linux
*
* we turn off caches etc ...
* and we set the CPU-speed to 73 MHz - see start.S for details
*/
#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
disable_interrupts ();
/* turn off I-cache */
icache_disable();
dcache_disable();
/* flush I-cache */
cache_flush();
#ifdef CONFIG_ARM7_REVD
/* go to high speed */
IO_SYSCON3 = (IO_SYSCON3 & ~CLKCTL) | CLKCTL_73;
#endif
#elif defined(CONFIG_NETARM) || defined(CONFIG_S3C4510B) || defined(CONFIG_LPC2292)
disable_interrupts ();
/* Nothing more needed */
#elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR)
/* No cleanup before linux for IntegratorAP/CM720T as yet */
#else
#error No cleanup_before_linux() defined for this CPU type
#endif
return 0;
}
开发者ID:ClashTheBunny,项目名称:w732_kernel_src,代码行数:33,代码来源:cpu.c
示例9: main
int main(int argc, char **argv)
{
FILE *swp;
struct cache *c;
struct matrix *m;
FILE *matrix_shared;
readargs(argc, argv);
if ((swp = fopen(swapfile, "w+")) == NULL)
error("cannot open swap file");
c = cache_create(&access_info, swp, CACHE_SIZE);
/* Read traces. */
for (int i = 0; i < ntraces; i++)
{
FILE *trace;
if ((trace = fopen(tracefiles[i], "r")) == NULL)
error("cannot open trace file");
trace_read(c, trace, i);
fclose(trace);
fprintf(stderr, "\nFechado arquivo de trace da thread %d\n\n", i);
}
/* Flushe traces on swap file. */
cache_flush(c);
/* Create communication matrix. */
fseek(swp, 0, SEEK_SET);
m = matrix_create(QTD_THREADS, QTD_THREADS);
fprintf(stderr, "\nMatriz criada\n");
matrix_generate(swp, m);
if ((matrix_shared = fopen(outfile, "w")) == NULL)
error("cannot open output file");
fprintf(stderr, "\nGravar matriz no arquivo\n");
for (int i = 0; i < ntraces; i++)
{
for(int j = 0; j < ntraces; j++)
fprintf(matrix_shared, "%d;%d;%d\n", i, j, (int) matrix_get(m, i, j));
}
/* House keeping. */
fclose(matrix_shared);
fclose(swp);
fprintf(stderr, "\n\n FIM!\n");
return (EXIT_SUCCESS);
}
开发者ID:cart-pucminas,项目名称:mapper,代码行数:60,代码来源:main.c
示例10: cleanup_before_linux
int cleanup_before_linux(void)
{
unsigned int i;
/*
* this function is called just before we call linux
* it prepares the processor for linux
*
* we turn off caches etc ...
*/
disable_interrupts();
/* turn off I/D-cache */
icache_disable();
dcache_disable();
/* invalidate I-cache */
cache_flush();
#ifndef CONFIG_L2_OFF
/* turn off L2 cache */
l2_cache_disable();
/* invalidate L2 cache also */
v7_flush_dcache_all(get_device_type());
#endif
i = 0;
/* mem barrier to sync up things */
asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i));
#ifndef CONFIG_L2_OFF
l2_cache_enable();
#endif
return 0;
}
开发者ID:GlobalscaleTechnologiesInc,项目名称:D3-Firmware,代码行数:35,代码来源:cpu.c
示例11: inode_close
/* Closes INODE and writes it to disk.
If this was the last reference to INODE, frees its memory.
If INODE was also a removed inode, frees its blocks. */
void
inode_close (struct inode *inode)
{
/* Ignore null pointer. */
if (inode == NULL)
return;
/* Release resources if this was the last opener. */
if (--inode->open_cnt == 0)
{
/* Remove from inode list and release lock. */
list_remove (&inode->elem);
/* Deallocate blocks if removed. */
if (inode->removed) //inode is to be deleted
{
cache_remove(inode,SECTOR_NONE);
inode_deallocate_data_blocks(inode);
free_map_release (inode->sector, 1);
//free_map_release (inode->data.start, bytes_to_sectors (inode->data.length));
free(inode);
return;
}
cache_flush(inode,SECTOR_NONE);
cache_remove(inode,SECTOR_NONE);
free (inode);
}
}
开发者ID:harshitm26,项目名称:operating_system_pintos,代码行数:31,代码来源:inode.c
示例12: thread_master_start
THREADABLE_FUNCTION_END
//start the master thread, locking all the other threads
void thread_master_start(int narg,char **arg,void(*main_function)(int narg,char **arg))
{
//initialize reducing buffers
glb_single_reduction_buf=(float*)malloc(nthreads*sizeof(float));
glb_double_reduction_buf=(double*)malloc(nthreads*sizeof(double));
glb_quadruple_reduction_buf=(float_128*)malloc(nthreads*sizeof(float_128));
//lock the pool
thread_pool_locked=true;
cache_flush();
//control the proper working of all the threads...
thread_sanity_check();
//launch the main function
main_function(narg,arg);
//free global reduction buffers
free(glb_single_reduction_buf);
free(glb_double_reduction_buf);
free(glb_quadruple_reduction_buf);
//exit the thread pool
thread_pool_stop();
}
开发者ID:sunpho84,项目名称:nissa,代码行数:28,代码来源:thread.cpp
示例13: cache_destroy
void cache_destroy(struct cache *c)
{
cache_flush(c);
hashtable_destroy(c->h);
free(c->features);
free(c->feature_offset);
free(c);
}
开发者ID:Distrotech,项目名称:conntrack-tools,代码行数:8,代码来源:cache.c
示例14: filesys_done
/* Shuts down the file system module, writing any unwritten data
to disk. */
void
filesys_done (void)
{
/* Start of Project 4 */
cache_flush ();
/* End of Project 4 */
free_map_close ();
}
开发者ID:nikkhilmuthye,项目名称:Computer-Systems,代码行数:10,代码来源:filesys.c
示例15: arm_hook
int arm_hook (void *_org, void *dst, void **trampo) {
char *org = (char*)_org;
if (!org) return 0;
if (mprotect ((void*)((uint32_t)org & ~(PAGE_SIZE - 1)), 8, PROT_EXEC | PROT_WRITE | PROT_READ) != 0) {
LOGD ("mprotect error : %s", strerror (errno));
return 0;
}
char *tr = alloc_trampo ();
if (tr == 0)
return 0;
memcpy (tr, org, 8); /*提取原函数的前两个指令*/
emit_arm_jmp (tr + 8, org + 8);
cache_flush ((uint32_t)tr, (uint32_t)(tr + 16));
*trampo = tr;
emit_arm_jmp (org, dst); /*修改原函数头*/
cache_flush ((uint32_t)org, (uint32_t)(org + 8));
return 1;
}
开发者ID:0bj3ct,项目名称:xmono,代码行数:18,代码来源:hook.cpp
示例16: file_data_flush
void
file_data_flush(struct file *file, long long offset, int size)
{
if (file->cache) {
struct file_cache_id id={offset,size,file->name_id,0};
cache_flush(file_cache,&id);
dbg(1,"Flushing "LONGLONG_FMT" %d bytes\n",offset,size);
}
}
开发者ID:albertz,项目名称:navit,代码行数:9,代码来源:file.c
示例17: main
int main() {
hashset_t H;
for(int k = 0; k < K; ++k) H.multiplier[k] = getrand64();
H.vmultiplier= _mm256_loadu_si256((__m256i const * )H.multiplier);
uint64_t howmany = 100;
uint64_t * keys = malloc(sizeof(uint64_t) * howmany);
for(uint64_t k = 0; k < howmany; ++k) keys[k] = getrand64();
for(H.size = 1024; H.size < (UINT64_C(1) << 32) ; H.size *=2) {
H.sizemask = _mm256_set1_epi64x(H.size-1);
printf("alloc size = %f MB \n", H.size * sizeof(uint64_t) / (1024 * 1024.0));
H.data = calloc(H.size , sizeof(uint64_t));
for(int j = 0; j < howmany; j += 2) H.data[hash(H.multiplier[0],j) & (H.size - 1)] = j;
int answer = expected(&H,howmany,keys);
RDTSC_BEST(checkthemall(&H,howmany,keys), answer, cache_flush(&H,howmany,keys), 50,howmany);
RDTSC_BEST(avxcheckthemall(&H,howmany,keys), answer, cache_flush(&H,howmany,keys), 50,howmany);
free(H.data);
}
free(keys);
}
开发者ID:lemire,项目名称:Code-used-on-Daniel-Lemire-s-blog,代码行数:19,代码来源:karyaccess.c
示例18: thread_pool_unlock
//unlock the thread pool
void thread_pool_unlock()
{
THREAD_BARRIER_FORCE();
#ifdef THREAD_DEBUG
GET_THREAD_ID();
if(rank==0 && VERBOSITY_LV3) printf("thread %d unlocking the pool\n",thread_id);
#endif
thread_pool_locked=false;
cache_flush();
}
开发者ID:sunpho84,项目名称:sunpho,代码行数:11,代码来源:thread.cpp
示例19: cache_invalidate
void cache_invalidate (CACHE* cache) {
unsigned int i;
if(cache==NULL)
return;
cache_flush(cache);
for (i = 0; i < cache->numberOfPages; i++) {
cache->cacheEntries[i].sector = CACHE_FREE;
cache->cacheEntries[i].last_access = 0;
cache->cacheEntries[i].count = 0;
cache->cacheEntries[i].dirty = false;
}
}
开发者ID:CaptainCPS,项目名称:IRISMAN-346,代码行数:13,代码来源:disc_cache.c
示例20: print_tasks
static void print_tasks(void)
{
struct taskstat_delta *delta = NULL;
for (;;) {
delta = cache_walk(delta);
if (delta)
output->print_data(delta);
else
break;
}
cache_flush();
}
开发者ID:el8,项目名称:nlmon,代码行数:13,代码来源:nlmon.c
注:本文中的cache_flush函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论