Make areas cloned by accelerants effectively cloneable.
Change-Id: I78046af6548e36571813ce516491c7fb64581967 Reviewed-on: https://review.haiku-os.org/513 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
0e9dc76e5f
commit
a3a41a5b14
@@ -173,7 +173,7 @@ MapDevice(DeviceInfo& di)
|
|||||||
regsBase,
|
regsBase,
|
||||||
regAreaSize,
|
regAreaSize,
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
0, // neither read nor write, to hide it from user space apps
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||||
(void**)&di.regs);
|
(void**)&di.regs);
|
||||||
|
|
||||||
// If there was an error, delete other areas.
|
// If there was an error, delete other areas.
|
||||||
@@ -220,7 +220,8 @@ InitDevice(DeviceInfo& di)
|
|||||||
(void**) &(di.sharedInfo),
|
(void**) &(di.sharedInfo),
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
ROUND_TO_PAGE_SIZE(sharedSize),
|
ROUND_TO_PAGE_SIZE(sharedSize),
|
||||||
B_FULL_LOCK, 0);
|
B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di.sharedArea < 0)
|
if (di.sharedArea < 0)
|
||||||
return di.sharedArea; // return error code
|
return di.sharedArea; // return error code
|
||||||
|
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ MapDevice(DeviceInfo& di)
|
|||||||
regsBase,
|
regsBase,
|
||||||
regAreaSize,
|
regAreaSize,
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
0, // neither read nor write, to hide it from user space apps
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||||
(void**)&di.regs);
|
(void**)&di.regs);
|
||||||
|
|
||||||
// If there was an error, delete other areas.
|
// If there was an error, delete other areas.
|
||||||
@@ -781,7 +781,8 @@ InitDevice(DeviceInfo& di)
|
|||||||
(void**) &(di.sharedInfo),
|
(void**) &(di.sharedInfo),
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
ROUND_TO_PAGE_SIZE(sharedSize + vesaModeTableSize),
|
ROUND_TO_PAGE_SIZE(sharedSize + vesaModeTableSize),
|
||||||
B_FULL_LOCK, 0);
|
B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di.sharedArea < 0)
|
if (di.sharedArea < 0)
|
||||||
return di.sharedArea; // return error code
|
return di.sharedArea; // return error code
|
||||||
|
|
||||||
|
|||||||
@@ -465,7 +465,8 @@ char shared_name[B_OS_NAME_LENGTH];
|
|||||||
di->pcii.vendor_id, di->pcii.device_id,
|
di->pcii.vendor_id, di->pcii.device_id,
|
||||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||||
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
||||||
di->sharedArea = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(ET6000SharedInfo) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK, 0);
|
di->sharedArea = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(ET6000SharedInfo) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK,
|
||||||
|
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di->sharedArea < 0) {
|
if (di->sharedArea < 0) {
|
||||||
/* return the error */
|
/* return the error */
|
||||||
result = di->sharedArea;
|
result = di->sharedArea;
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ InitDevice(DeviceInfo& di)
|
|||||||
(void**) &(di.sharedInfo),
|
(void**) &(di.sharedInfo),
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
ROUND_TO_PAGE_SIZE(sharedSize),
|
ROUND_TO_PAGE_SIZE(sharedSize),
|
||||||
B_FULL_LOCK, 0);
|
B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di.sharedArea < 0)
|
if (di.sharedArea < 0)
|
||||||
return di.sharedArea; // return error code
|
return di.sharedArea; // return error code
|
||||||
|
|
||||||
@@ -285,7 +286,7 @@ InitDevice(DeviceInfo& di)
|
|||||||
regsBase,
|
regsBase,
|
||||||
regAreaSize,
|
regAreaSize,
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||||
(void**)&di.regs);
|
(void**)&di.regs);
|
||||||
|
|
||||||
if (si.regsArea < 0) {
|
if (si.regsArea < 0) {
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ static status_t map_device(device_info *di)
|
|||||||
di->pcii.u.h0.base_registers[registers],
|
di->pcii.u.h0.base_registers[registers],
|
||||||
di->pcii.u.h0.base_register_sizes[registers],
|
di->pcii.u.h0.base_register_sizes[registers],
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
(si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||||
(void **)&(di->regs));
|
(void **)&(di->regs));
|
||||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||||
|
|
||||||
@@ -396,7 +396,7 @@ static status_t map_device(device_info *di)
|
|||||||
di->pcii.u.h0.base_registers[registers2],
|
di->pcii.u.h0.base_registers[registers2],
|
||||||
di->pcii.u.h0.base_register_sizes[registers2],
|
di->pcii.u.h0.base_register_sizes[registers2],
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
(si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||||
(void **)&(di->regs2));
|
(void **)&(di->regs2));
|
||||||
si->clone_bugfix_regs2 = (uint32 *) di->regs2;
|
si->clone_bugfix_regs2 = (uint32 *) di->regs2;
|
||||||
|
|
||||||
@@ -696,7 +696,8 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
|||||||
di->pcii.vendor_id, di->pcii.device_id,
|
di->pcii.vendor_id, di->pcii.device_id,
|
||||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||||
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
||||||
di->shared_area = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK, 0);
|
di->shared_area = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di->shared_area < 0) {
|
if (di->shared_area < 0) {
|
||||||
/* return the error */
|
/* return the error */
|
||||||
result = di->shared_area;
|
result = di->shared_area;
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ static status_t map_device(device_info *di)
|
|||||||
di->pcii.u.h0.base_registers_pci[registers],
|
di->pcii.u.h0.base_registers_pci[registers],
|
||||||
di->pcii.u.h0.base_register_sizes[registers],
|
di->pcii.u.h0.base_register_sizes[registers],
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
(si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||||
(void **)&(di->regs));
|
(void **)&(di->regs));
|
||||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||||
|
|
||||||
@@ -648,7 +648,8 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
|||||||
di->pcii.vendor_id, di->pcii.device_id,
|
di->pcii.vendor_id, di->pcii.device_id,
|
||||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||||
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
||||||
di->shared_area = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK, 0);
|
di->shared_area = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di->shared_area < 0) {
|
if (di->shared_area < 0) {
|
||||||
/* return the error */
|
/* return the error */
|
||||||
result = di->shared_area;
|
result = di->shared_area;
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ static status_t map_device(device_info *di)
|
|||||||
di->pcii.u.h0.base_registers_pci[registers],
|
di->pcii.u.h0.base_registers_pci[registers],
|
||||||
di->pcii.u.h0.base_register_sizes[registers],
|
di->pcii.u.h0.base_register_sizes[registers],
|
||||||
B_ANY_KERNEL_ADDRESS,
|
B_ANY_KERNEL_ADDRESS,
|
||||||
(si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||||
(void **)&(di->regs));
|
(void **)&(di->regs));
|
||||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||||
|
|
||||||
@@ -657,7 +657,8 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
|||||||
di->pcii.vendor_id, di->pcii.device_id,
|
di->pcii.vendor_id, di->pcii.device_id,
|
||||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||||
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
/* create this area with NO user-space read or write permissions, to prevent accidental dammage */
|
||||||
di->shared_area = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK, 0);
|
di->shared_area = create_area(shared_name, (void **)&(di->si), B_ANY_KERNEL_ADDRESS, ((sizeof(shared_info) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)), B_FULL_LOCK,
|
||||||
|
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||||
if (di->shared_area < 0) {
|
if (di->shared_area < 0) {
|
||||||
/* return the error */
|
/* return the error */
|
||||||
result = di->shared_area;
|
result = di->shared_area;
|
||||||
|
|||||||
Reference in New Issue
Block a user