Changeset 167 for soft/giet_vm/sys/drivers.c
- Timestamp:
- Jul 16, 2012, 10:26:27 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/drivers.c
r166 r167 491 491 unsigned int count ) 492 492 { 493 unsigned int user_vpn_min; 494 unsigned int user_vpn_max; 495 unsigned int vpn; // virtual page number in user space 496 unsigned int ppn; // physical page number 497 unsigned int flags; // page protection flags 498 unsigned int ix2; // Page index (for IOMMU page table) 499 unsigned int addr; // buffer address for IOC 500 page_table_t* user_ptp; // user page table pointer 501 unsigned int ko; // bool returned by _v2p_translate() 502 unsigned int ppn_first; // first physical page number for user buffer 493 unsigned int user_vpn_min; // first virtuel page index in user space 494 unsigned int user_vpn_max; // last virtual page index in user space 495 unsigned int vpn; // current virtual page index in user space 496 unsigned int ppn; // physical page number 497 unsigned int flags; // page protection flags 498 unsigned int ix2; // page index in IOMMU PT1 page table 499 unsigned int addr; // buffer address for IOC peripheral 500 unsigned int user_ptp; // page table pointer in user space 501 unsigned int ko; // bool returned by _v2p_translate() 502 unsigned int ppn_first; // first physical page number for user buffer 503 unsigned int ltid; // current task local index 504 static_scheduler_t* psched; // pointer on the current task scheduler 503 505 504 506 // check buffer alignment … … 509 511 unsigned int length = count*block_size; 510 512 511 // get user space page table base address 512 user_ptp = (page_table_t*)(_get_ptpr() << 13); 513 // get user space page table virtual address 514 psched = &_scheduler[_procid()]; 515 ltid = psched->current; 516 user_ptp = psched->context[ltid][CTX_PTAB_ID]; 513 517 514 518 user_vpn_min = user_vaddr >> 12; … … 520 524 { 521 525 // get ppn and flags for each vpn 522 ko = _v2p_translate( user_ptp, // user page table pointer523 vpn, // virtual page number524 &ppn, // physical page number525 &flags ); // protection flags526 ko = _v2p_translate( (page_table_t*)user_ptp, 527 vpn, 528 &ppn, 529 &flags ); 526 530 527 531 // check access rights … … 543 547 ppn, // Physical page number 544 548 flags ); // Protection flags 545 546 // buffer base address for IOC with IOMMU547 549 } 548 550 else // no IOMMU : check that physical pages are contiguous … … 563 565 // compute buffer base address for IOC depending on IOMMU activation 564 566 if ( GIET_IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF); 565 else addr = ppn_first| (user_vaddr & 0xFFF);567 else addr = (ppn_first << 12) | (user_vaddr & 0xFFF); 566 568 567 569 // get the lock on ioc device
Note: See TracChangeset
for help on using the changeset viewer.