本文整理汇总了C++中PADDR函数的典型用法代码示例。如果您正苦于以下问题:C++ PADDR函数的具体用法?C++ PADDR怎么用?C++ PADDR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PADDR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: vbesetup
static uint8_t*
vbesetup(Ureg *u, int ax)
{
// Yes, it's a PA, but it's a real mode PA, and 32 bits are fine.
uint32_t pa;
pa = PADDR(RMBUF);
memset(modebuf, 0, sizeof modebuf);
memset(u, 0, sizeof *u);
u->ax = ax;
u->es = (pa>>4)&0xF000;
u->di = pa&0xFFFF;
return modebuf;
}
开发者ID:Harvey-OS,项目名称:harvey,代码行数:14,代码来源:vgavesa.c
示例2: residential_enduse
plugload::plugload(MODULE *module) : residential_enduse(module)
{
// first time init
if (oclass==NULL)
{
// register the class definition
oclass = gl_register_class(module,"plugload",sizeof(plugload),PC_BOTTOMUP);
if (oclass==NULL)
throw "unable to register class plugload";
else
oclass->trl = TRL_QUALIFIED;
// publish the class properties
if (gl_publish_variable(oclass,
PT_INHERIT, "residential_enduse",
PT_double,"circuit_split",PADDR(circuit_split),
PT_double,"demand[unit]",PADDR(shape.load),
PT_double,"installed_power[kW]",PADDR(shape.params.analog.power), PT_DESCRIPTION, "installed plugs capacity",
PT_complex,"actual_power[kVA]",PADDR(plugs_actual_power),PT_DESCRIPTION,"actual power demand",
NULL)<1)
GL_THROW("unable to publish properties in %s",__FILE__);
}
}
开发者ID:gelliravi,项目名称:gridspice.simulator,代码行数:23,代码来源:plugload.cpp
示例3: switchuvm
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
pushcli();
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
cpu->gdt[SEG_TSS].s = 0;
cpu->ts.ss0 = SEG_KDATA << 3;
cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
ltr(SEG_TSS << 3);
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
lcr3(PADDR(p->pgdir)); // switch to new address space
popcli();
}
开发者ID:vantran24,项目名称:p4b,代码行数:15,代码来源:vm.c
示例4: mkmultiboot
void
mkmultiboot(void)
{
MMap *lmmap;
/* reuse the bios table memory */
multibootheader = (Mbi *)KADDR(BIOSTABLES);
memset(multibootheader, 0, sizeof *multibootheader);
lmmap = (MMap *)(multibootheader + 1);
memmove(lmmap, mmap, sizeof mmap);
multibootheader->cmdline = PADDR(BOOTLINE);
multibootheader->flags |= Fcmdline;
if(nmmap != 0){
multibootheader->mmapaddr = PADDR(lmmap);
multibootheader->mmaplength = nmmap*sizeof(MMap);
multibootheader->flags |= Fmmap;
}
multibootheader = (Mbi *)PADDR(multibootheader);
if(v_flag)
print("PADDR(&multibootheader) %#p\n", multibootheader);
}
开发者ID:Earnestly,项目名称:plan9,代码行数:23,代码来源:multiboot.c
示例5: page_init
void
page_init(void)
{
int i;
LIST_INIT (&page_free_list);
printf("freemem:\t%x\n", freemem);
freemem = ROUND(freemem, BY2PG);
printf("freemem:\t%x\n", freemem);
for (i = 0; i < PADDR(freemem) / BY2PG; i++) {
pages[i].pp_ref = 1;
}
printf("allocated pages:\t%d\n", i - 1);
for (i = PADDR(freemem) / BY2PG; i < npage; i++) {
pages[i].pp_ref = 0;
LIST_INSERT_HEAD(&page_free_list, &pages[i], pp_link);
}
printf("free pages:\t%d\n", npage - PADDR(freemem) / BY2PG);
}
开发者ID:SivilTaram,项目名称:Jos-mips,代码行数:23,代码来源:pmap.c
示例6: shootdown_tlb_all
/* XXX naive */
static void shootdown_tlb_all(pgd_t *pgdir)
{
int i;
//dump_processors();
for(i=0;i<sysconf.lcpu_count;i++){
struct cpu *cpu = per_cpu_ptr(cpus, i);
if(cpu->id == myid())
continue;
if(cpu->arch_data.tlb_cr3 != PADDR(pgdir))
continue;
//kprintf("XX_TLB_SHUTDOWN %d %d\n", myid(), i);
lapic_send_ipi(cpu, T_TLBFLUSH);
}
}
开发者ID:chnlkw,项目名称:ucore_plus,代码行数:15,代码来源:mp.c
示例7: check_boot_pgdir
static void
check_boot_pgdir(void) {
pte_t *ptep;
int i;
for (i = 0; i < npage; i += PGSIZE) {
assert((ptep = get_pte(boot_pgdir, (uintptr_t)KADDR(i), 0)) != NULL);
assert(PTE_ADDR(*ptep) == i);
}
assert(PDE_ADDR(boot_pgdir[PDX(VPT)]) == PADDR(boot_pgdir));
//cprintf("%08x\n",boot_pgdir[PDX(VPT)]);
//cprintf("%08x\n",PADDR(boot_pgdir));
assert(boot_pgdir[256] == 0);
struct Page *p;
p = alloc_page();
assert(page_insert(boot_pgdir, p, 0x40000100, PTE_TYPE_SRW) == 0);
assert(page_ref(p) == 1);
assert(page_insert(boot_pgdir, p, 0x40000100 + PGSIZE, PTE_TYPE_SRW) == 0);
assert(page_ref(p) == 2);
const char *str = "ucore: Hello world!!";
strcpy((void *)0x40000100, str);
assert(strcmp((void *)0x40000100, (void *)(0x40000100 + PGSIZE)) == 0);
cprintf("%s\n\n",(char*)0x40000100);
//cprintf("mstatus=%08x\n",read_mstatus_field(MSTATUS_PRV));
// cprintf("bageyalusilasiladi%s\n",((char*)0x40000100));
*(char *)(page2kva(p) + 0x100) = '\0';
//asm volatile("nop");
//asm volatile("nop");
//cprintf("\0\n");
// cprintf("%d\n",strlen((char *)0x40000100));
assert(strlen((const char *)0x40000100) == 0);
//assert(((const char *)0x30000100) == '\0');
//asm volatile("nop");
// asm volatile("nop");
free_page(p);
free_page(pde2page(boot_pgdir[256]));
//cprintf("haah2\n");
boot_pgdir[256] = 0;
cprintf("check_boot_pgdir() succeeded!\n");
}
开发者ID:lhh520,项目名称:os-4-risc-v,代码行数:50,代码来源:pmm.c
示例8: sdioiosetup
static void
sdioiosetup(int write, void *buf, int bsize, int bcount)
{
int len;
uintptr pa;
pa = PADDR(buf);
if(write && !PIOwrite){
WR(DmaLSB, pa);
WR(DmaMSB, pa>>16);
len = bsize * bcount;
cachedwbse(buf, len);
l2cacheuwbse(buf, len);
}else if(!write && !PIOread){
开发者ID:Earnestly,项目名称:plan9,代码行数:14,代码来源:sdio.c
示例9: link_object
series_reactor::series_reactor(MODULE *mod) : link_object(mod)
{
if(oclass == NULL)
{
pclass = link_object::oclass;
oclass = gl_register_class(mod,"series_reactor",sizeof(series_reactor),PC_PRETOPDOWN|PC_BOTTOMUP|PC_POSTTOPDOWN|PC_UNSAFE_OVERRIDE_OMIT|PC_AUTOLOCK);
if (oclass==NULL)
throw "unable to register class series_reactor";
else
oclass->trl = TRL_PROVEN;
if(gl_publish_variable(oclass,
PT_INHERIT, "link",
PT_complex, "phase_A_impedance[Ohm]",PADDR(phase_A_impedance),PT_DESCRIPTION,"Series impedance of reactor on phase A",
PT_double, "phase_A_resistance[Ohm]",PADDR(phase_A_impedance.Re()),PT_DESCRIPTION,"Resistive portion of phase A's impedance",
PT_double, "phase_A_reactance[Ohm]",PADDR(phase_A_impedance.Im()),PT_DESCRIPTION,"Reactive portion of phase A's impedance",
PT_complex, "phase_B_impedance[Ohm]",PADDR(phase_B_impedance),PT_DESCRIPTION,"Series impedance of reactor on phase B",
PT_double, "phase_B_resistance[Ohm]",PADDR(phase_B_impedance.Re()),PT_DESCRIPTION,"Resistive portion of phase B's impedance",
PT_double, "phase_B_reactance[Ohm]",PADDR(phase_B_impedance.Im()),PT_DESCRIPTION,"Reactive portion of phase B's impedance",
PT_complex, "phase_C_impedance[Ohm]",PADDR(phase_C_impedance),PT_DESCRIPTION,"Series impedance of reactor on phase C",
PT_double, "phase_C_resistance[Ohm]",PADDR(phase_C_impedance.Re()),PT_DESCRIPTION,"Resistive portion of phase C's impedance",
PT_double, "phase_C_reactance[Ohm]",PADDR(phase_C_impedance.Im()),PT_DESCRIPTION,"Reactive portion of phase C's impedance",
PT_double, "rated_current_limit[A]",PADDR(rated_current_limit),PT_DESCRIPTION,"Rated current limit for the reactor",
NULL) < 1) GL_THROW("unable to publish properties in %s",__FILE__);
//Publish deltamode functions
if (gl_publish_function(oclass, "interupdate_pwr_object", (FUNCTIONADDR)interupdate_link)==NULL)
GL_THROW("Unable to publish series reactor deltamode function");
//Publish restoration-related function (current update)
if (gl_publish_function(oclass, "update_power_pwr_object", (FUNCTIONADDR)updatepowercalc_link)==NULL)
GL_THROW("Unable to publish series reactor external power calculation function");
if (gl_publish_function(oclass, "check_limits_pwr_object", (FUNCTIONADDR)calculate_overlimit_link)==NULL)
GL_THROW("Unable to publish series reactor external power limit calculation function");
}
}
开发者ID:mafoti,项目名称:wso2-gridlabd,代码行数:37,代码来源:series_reactor.cpp
示例10: meminit
void
meminit(u32int)
{
MMap *map;
u32int modend;
u64int addr, last, len;
umbscan();
modend = PADDR(memstart);
last = 0;
for(map = mmap; map < &mmap[nmmap]; map++){
addr = (((u64int)map->base[1])<<32)|map->base[0];
len = (((u64int)map->length[1])<<32)|map->length[0];
switch(map->type){
default:
case 2: /* reserved */
case 3: /* ACPI Reclaim Memory */
case 4: /* ACPI NVS Memory */
break;
case 1: /* Memory */
if(addr < 1*MiB || addr+len < modend)
break;
if(addr < modend){
len -= modend - addr;
addr = modend;
}
mapraminit(addr, len);
break;
}
if(addr != last && addr > modend){
/*
* See the comments in main about space < 1MiB.
*/
if(addr >= 1*MiB || addr < 0x000A0000)
mapupainit(last, addr-last);
}
last = addr+len;
}
/*
changeconf("*noe820scan=1\n");
*/
if(MEMDEBUG)
memdebug();
}
开发者ID:99years,项目名称:plan9,代码行数:49,代码来源:memory.c
示例11: mmuptpalloc
static Page*
mmuptpalloc(void)
{
void* va;
Page *page;
/*
* Do not really need a whole Page structure,
* but it makes testing this out a lot easier.
* Could keep a cache and free excess.
* Have to maintain any fiction for pexit?
*/
lock(&mmuptpfreelist.l);
if((page = mmuptpfreelist.next) != nil) {
mmuptpfreelist.next = page->next;
mmuptpfreelist.ref--;
unlock(&mmuptpfreelist.l);
if(page->ref++ != 0)
panic("mmuptpalloc ref\n");
page->prev = page->next = nil;
memset(UINT2PTR(page->va), 0, PTSZ);
if(page->pa == 0)
panic("mmuptpalloc: free page with pa == 0");
return page;
}
unlock(&mmuptpfreelist.l);
if((page = malloc(sizeof(Page))) == nil) {
print("mmuptpalloc Page\n");
return nil;
}
if((va = mallocalign(PTSZ, PTSZ, 0, 0)) == nil) {
print("mmuptpalloc va\n");
free(page);
return nil;
}
page->va = PTR2UINT(va);
page->pa = PADDR(va);
page->ref = 1;
if(page->pa == 0)
panic("mmuptpalloc: no pa");
return page;
}
开发者ID:Shamar,项目名称:harvey,代码行数:49,代码来源:mmu.c
示例12: initialize_vm_64
void initialize_vm_64(void){
uint64_t* pml4e;
pages = boot_alloc(npages*sizeof(struct PageStruct));
procs = boot_alloc(NPROCS*sizeof(struct ProcStruct));
proc_free_list = procs;
pml4e = boot_alloc(PGSIZE);
boot_pml4e = pml4e;
boot_cr3 = (physaddr_t*)PADDR(pml4e);
kmemset(boot_pml4e,0,PGSIZE);
initialize_page_lists();
printf("Total free=%d",free_pages);
// while(i--);
if( map_vm_pm(boot_pml4e, (uint64_t)PHYSBASE,PADDR(PHYSBASE),(uint64_t)(boot_alloc(0)-PHYSBASE),PTE_P|PTE_W)==-1)
while(1);
if( map_vm_pm(boot_pml4e, (uint64_t)KERNBASE+PGSIZE,0x1000,0x7000000-0x1000,PTE_P|PTE_W)==-1)//KERNELSTACK =tss.rspp0
while(1);
if( map_vm_pm(boot_pml4e, (uint64_t)VIDEO_START,PADDR(VIDEO_START),10*0x1000,PTE_P|PTE_W)==-1)
while(1);
printf("TotalFREE=%d",free_pages);
lcr3(boot_cr3);
}
开发者ID:sghosh1991,项目名称:OS_X86_64,代码行数:24,代码来源:paging.c
示例13: test_tx_blocks
//test function to see if the Tx Buffers are properly linked.
void test_tx_blocks()
{
uint32_t start = e100_tx_info.tx_buff_va;
struct command_block * ptrcb;
int i ;
cprintf(" base va %x base Pa %x \n",start,PADDR(start));
cprintf("\n=====================================\n");
for ( i=0; i < E100_MAX_TX_BUFFERS ; i++)
{
ptrcb =(struct command_block * ) ( start + i * PGSIZE ) ;
cprintf(" [%d] : status %d , cmd : %d , link : %x \n",i,ptrcb->status,ptrcb->cmd,ptrcb->link);
}
cprintf("\n=====================================\n");
}
开发者ID:ganeshskudva,项目名称:JOS,代码行数:16,代码来源:e100.c
示例14: ohci_rtl8652_init
static int ohci_rtl8652_init(void)
{
/*register platform device*/
int retval;
//static struct platform_device *usb_dev_host = NULL;
if(usb_dev_host!=NULL)
{ printk("Ohci-rtl8652.c: OHCI device already init\n");
return -1;
}
struct resource r[2];
memset(&r, 0, sizeof(r));
r[0].start = PADDR(OHCI_RTL8652_USB_BASE);
r[0].end = PADDR(OHCI_RTL8652_USB_BASE)+sizeof(struct ohci_regs);
r[0].flags = IORESOURCE_MEM;
r[1].start = r[1].end = RTL8652_USB_IRQ;
r[1].flags = IORESOURCE_IRQ;
usb_dev_host = platform_device_register_simple("rtl8652-ohci", 0, r, 2);
usb_dev_host->dev.coherent_dma_mask = 0xffffffffUL;
usb_dev_host->dev.dma_mask = &usb_dev_host->dev.coherent_dma_mask;
if (IS_ERR(usb_dev_host))
{
retval = PTR_ERR(usb_dev_host);
usb_dev_host=NULL; //wei add
goto err;
}
return 0;
err:
return retval;
}
开发者ID:ClarkChen633,项目名称:rtl819x-toolchain,代码行数:36,代码来源:ohci-rtl8652.c
示例15: env_free
//
// Frees env e and all memory it uses.
//
void
env_free(struct Env *e)
{
pde_t *pgdir;
pte_t *pt;
uint32_t pdeno, pteno;
physaddr_t pa;
// If freeing the current environment, switch to kern_pgdir
// before freeing the page directory, just in case the page
// gets reused.
if (e == curenv)
lcr3(PADDR(kern_pgdir));
// Note the environment's demise.
cprintf("[%08x] free env %08x\n", curenv ? curenv->env_id : 0, e->env_id);
// Flush all mapped pages in the user portion of the address space
static_assert(UTOP % PTSIZE == 0);
pgdir = e->env_pgdir;
for (pdeno = 0; pdeno < PDX(UTOP); pdeno++) {
// only look at mapped page tables
if (!(pgdir[pdeno] & PTE_P))
continue;
// find the pa and va of the page table
pt = (pte_t *) KADDR(PTE_ADDR(pgdir[pdeno]));
// unmap all PTEs in this page table
for (pteno = 0; pteno <= PTX(~0); pteno++) {
if (pt[pteno] & PTE_P)
page_remove(pgdir, PGADDR(pdeno, pteno, 0));
}
// free the page table itself
pgdir[pdeno] = 0;
page_decref(kva2page(pt));
}
// free the page directory
e->env_pgdir = 0;
page_decref(kva2page(pgdir));
// return the environment to the free list
e->env_status = ENV_FREE;
e->env_link = env_free_list;
env_free_list = e;
}
开发者ID:rbowden91,项目名称:fp261,代码行数:51,代码来源:env.c
示例16: screeninit
void
screeninit(void)
{
uchar *fb;
fb = xspanalloc(Dx(xgscreen.r) * Dy(xgscreen.r) * 3, 64, 0);
print("%p\n", PADDR(fb));
memsetchan(&xgscreen, BGR24);
conf.monitor = 1;
xgdata.bdata = fb;
xgdata.ref = 1;
gscreen = &xgscreen;
gscreen->width = wordsperline(gscreen->r, gscreen->depth);
memimageinit();
}
开发者ID:Nurb432,项目名称:plan9front,代码行数:16,代码来源:screen.c
示例17: mmucreate
static uintptr*
mmucreate(uintptr *table, uintptr va, int level, int index)
{
uintptr *page, flags;
MMU *p;
flags = PTEWRITE|PTEVALID;
if(va < VMAP){
assert(up != nil);
assert((va < TSTKTOP) || (va >= KMAP && va < KMAP+KMAPSIZE));
p = mmualloc();
p->index = index;
p->level = level;
if(va < TSTKTOP){
flags |= PTEUSER;
if(level == PML4E){
if((p->next = up->mmuhead) == nil)
up->mmutail = p;
up->mmuhead = p;
m->mmumap[index/MAPBITS] |= 1ull<<(index%MAPBITS);
} else {
up->mmutail->next = p;
up->mmutail = p;
}
up->mmucount++;
} else {
if(level == PML4E){
up->kmaptail = p;
up->kmaphead = p;
} else {
up->kmaptail->next = p;
up->kmaptail = p;
}
up->kmapcount++;
}
page = p->page;
} else if(conf.mem[0].npage != 0) {
page = mallocalign(PTSZ, BY2PG, 0, 0);
} else {
page = rampage();
}
memset(page, 0, PTSZ);
table[index] = PADDR(page) | flags;
return page;
}
开发者ID:Nurb432,项目名称:plan9front,代码行数:46,代码来源:mmu.c
示例18: test_rx_blocks
void test_rx_blocks()
{
uint32_t start = e100_rx_info.tx_buff_va;
struct rfd * ptrrfd;
int *ptr;
int i ;
cprintf(" base va %x base Pa %x \n",start,PADDR(start));
cprintf("\n=====================================\n");
for ( i=0; i < E100_MAX_RX_BUFFERS ; i++)
{
ptrrfd =(struct rfd * ) ( start + i * PGSIZE ) ;
ptr = (int * ) ptrrfd;
cprintf(" [%d] : status %x , cmd : %x , link : %x size %x\n",i,ptrrfd->status,ptrrfd->cmd,ptrrfd->link,ptr[3]);
}
cprintf("\n=====================================\n");
}
开发者ID:ganeshskudva,项目名称:JOS,代码行数:17,代码来源:e100.c
示例19: ioringinit
/*
* initialise receive and transmit buffer rings.
*/
int
ioringinit(Ring* r, int nrdre, int ntdre, int bufsize)
{
int i, x;
/* the ring entries must be aligned on sizeof(BD) boundaries */
r->nrdre = nrdre;
if(r->rdr == nil)
r->rdr = bdalloc(nrdre);
/* the buffer size must align with cache lines since the cache doesn't snoop */
bufsize = (bufsize+CACHELINESZ-1)&~(CACHELINESZ-1);
if(r->rrb == nil)
r->rrb = malloc(nrdre*bufsize);
if(r->rdr == nil || r->rrb == nil)
return -1;
dcflush(r->rrb, nrdre*bufsize);
x = PADDR(r->rrb);
for(i = 0; i < nrdre; i++){
r->rdr[i].length = 0;
r->rdr[i].addr = x;
r->rdr[i].status = BDEmpty|BDInt;
x += bufsize;
}
r->rdr[i-1].status |= BDWrap;
r->rdrx = 0;
r->ntdre = ntdre;
if(r->tdr == nil)
r->tdr = bdalloc(ntdre);
if(r->txb == nil)
r->txb = malloc(ntdre*sizeof(Block*));
if(r->tdr == nil || r->txb == nil)
return -1;
for(i = 0; i < ntdre; i++){
r->txb[i] = nil;
r->tdr[i].addr = 0;
r->tdr[i].length = 0;
r->tdr[i].status = 0;
}
r->tdr[i-1].status |= BDWrap;
r->tdrh = 0;
r->tdri = 0;
r->ntq = 0;
return 0;
}
开发者ID:8l,项目名称:inferno,代码行数:48,代码来源:cpm.c
示例20: page_init
//
// Initialize page structure and memory free list.
// After this is done, NEVER use boot_alloc again. ONLY use the page
// allocator functions below to allocate and deallocate physical
// memory via the page_free_list.
//
void
page_init(void)
{
// LAB 4:
// Change your code to mark the physical page at MPENTRY_PADDR
// as in use
// The example code here marks all physical pages as free.
// However this is not truly the case. What memory is free?
// 1) Mark physical page 0 as in use.
// This way we preserve the real-mode IDT and BIOS structures
// in case we ever need them. (Currently we don't, but...)
// 2) The rest of base memory, [PGSIZE, npages_basemem * PGSIZE)
// is free.
// 3) Then comes the IO hole [IOPHYSMEM, EXTPHYSMEM), which must
// never be allocated.
// 4) Then extended memory [EXTPHYSMEM, ...).
// Some of it is in use, some is free. Where is the kernel
// in physical memory? Which pages are already in use for
// page tables and other data structures?
//
// Change the code to reflect this.
// NB: DO NOT actually touch the physical memory corresponding to
// free pages!
/*size_t i;
for (i = 0; i < npages; i++) {
pages[i].pp_ref = 0;
pages[i].pp_link = page_free_list;
page_free_list = &pages[i];
}*/
uint32_t page_mp_entry = MPENTRY_PADDR / PGSIZE;
uint32_t i;
page_free_list = NULL;
for (i = 1; i < npages_basemem && i != page_mp_entry; i++) {
pages[i].pp_ref = 0;
pages[i].pp_link = page_free_list;
page_free_list = &pages[i];
}
for (i = PGNUM(PADDR(boot_alloc(0))); i < npages; i++) {
pages[i].pp_ref = 0;
pages[i].pp_link = page_free_list;
page_free_list = &pages[i];
}
chunk_list = NULL;
}
开发者ID:Azard,项目名称:SE315-OperatingSystem,代码行数:51,代码来源:pmap.c
注:本文中的PADDR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论