OS: Rename B_USER_CLONEABLE_AREA to B_CLONEABLE_AREA.
It now lives in OS.h. The idea is that this will now be accessible to userland applications, so userland memory is protected from access by other processes, just as kernel memory is. No functional change (the constants are still the same, though I've changed some to use shifts to make clear which bits are allocated are which are unused.)
This commit is contained in:
@@ -111,9 +111,8 @@ typedef struct {
|
||||
#define B_ANY_KERNEL_BLOCK_ADDRESS (B_ANY_KERNEL_ADDRESS + 1)
|
||||
|
||||
/* area protection flags for the kernel */
|
||||
#define B_KERNEL_READ_AREA 16
|
||||
#define B_KERNEL_WRITE_AREA 32
|
||||
#define B_USER_CLONEABLE_AREA 256
|
||||
#define B_KERNEL_READ_AREA (1 << 4)
|
||||
#define B_KERNEL_WRITE_AREA (1 << 5)
|
||||
|
||||
/* MTR attributes for mapping physical memory (Intel Architecture only) */
|
||||
// TODO: rename those to something more meaningful
|
||||
|
||||
@@ -83,13 +83,14 @@ typedef struct area_info {
|
||||
#define B_RANDOMIZED_BASE_ADDRESS 7
|
||||
|
||||
/* area protection */
|
||||
#define B_READ_AREA 1
|
||||
#define B_WRITE_AREA 2
|
||||
#define B_EXECUTE_AREA 4
|
||||
#define B_STACK_AREA 8
|
||||
#define B_READ_AREA (1 << 0)
|
||||
#define B_WRITE_AREA (1 << 1)
|
||||
#define B_EXECUTE_AREA (1 << 2)
|
||||
#define B_STACK_AREA (1 << 3)
|
||||
/* "stack" protection is not available on most platforms - it's used
|
||||
to only commit memory as needed, and have guard pages at the
|
||||
bottom of the stack. */
|
||||
#define B_CLONEABLE_AREA (1 << 8)
|
||||
|
||||
extern area_id create_area(const char *name, void **startAddress,
|
||||
uint32 addressSpec, size_t size, uint32 lock,
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
// field is the only flag field, we currently use it for this.
|
||||
// A cleaner approach would be appreciated - maybe just an official generic
|
||||
// flags region in the protection field.
|
||||
#define B_OVERCOMMITTING_AREA 0x1000
|
||||
#define B_SHARED_AREA 0x2000
|
||||
/* 0x4000 was B_KERNEL_AREA until hrev52545 */
|
||||
#define B_OVERCOMMITTING_AREA (1 << 12)
|
||||
#define B_SHARED_AREA (1 << 13)
|
||||
|
||||
#define B_USER_AREA_FLAGS (B_USER_PROTECTION | B_OVERCOMMITTING_AREA)
|
||||
#define B_USER_AREA_FLAGS \
|
||||
(B_USER_PROTECTION | B_OVERCOMMITTING_AREA | B_CLONEABLE_AREA)
|
||||
#define B_KERNEL_AREA_FLAGS \
|
||||
(B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_SHARED_AREA)
|
||||
(B_KERNEL_PROTECTION | B_SHARED_AREA)
|
||||
|
||||
// mapping argument for several internal VM functions
|
||||
enum {
|
||||
|
||||
@@ -44,7 +44,7 @@ int32 api_version = B_CUR_DRIVER_API_VERSION; // revision of driver API used
|
||||
struct ChipInfo {
|
||||
uint16 chipID; // PCI device id of the chip
|
||||
ChipType chipType; // assigned chip type identifier
|
||||
const char* chipName; // user recognizable name for chip
|
||||
const char* chipName; // user recognizable name for chip
|
||||
// (must be < 32 chars)
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ static status_t device_open(const char* name, uint32 flags, void** cookie);
|
||||
static status_t device_close(void* dev);
|
||||
static status_t device_free(void* dev);
|
||||
static status_t device_read(void* dev, off_t pos, void* buf, size_t* len);
|
||||
static status_t device_write(void* dev, off_t pos, const void* buf,
|
||||
static status_t device_write(void* dev, off_t pos, const void* buf,
|
||||
size_t* len);
|
||||
static status_t device_ioctl(void* dev, uint32 msg, void* buf, size_t len);
|
||||
|
||||
@@ -106,7 +106,7 @@ static device_hooks gDeviceHooks =
|
||||
static inline uint32
|
||||
GetPCI(pci_info& info, uint8 offset, uint8 size)
|
||||
{
|
||||
return gPCI->read_pci_config(info.bus, info.device, info.function, offset,
|
||||
return gPCI->read_pci_config(info.bus, info.device, info.function, offset,
|
||||
size);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ GetPCI(pci_info& info, uint8 offset, uint8 size)
|
||||
static inline void
|
||||
SetPCI(pci_info& info, uint8 offset, uint8 size, uint32 value)
|
||||
{
|
||||
gPCI->write_pci_config(info.bus, info.device, info.function, offset, size,
|
||||
gPCI->write_pci_config(info.bus, info.device, info.function, offset, size,
|
||||
value);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ MapDevice(DeviceInfo& di)
|
||||
B_READ_AREA + B_WRITE_AREA,
|
||||
(void**)&si.videoMemAddr);
|
||||
|
||||
TRACE("Video memory, area: %ld, addr: 0x%lX, size: %ld\n",
|
||||
TRACE("Video memory, area: %ld, addr: 0x%lX, size: %ld\n",
|
||||
si.videoMemArea, (uint32)(si.videoMemAddr), videoRamSize);
|
||||
|
||||
if (si.videoMemArea < 0) {
|
||||
@@ -173,7 +173,7 @@ MapDevice(DeviceInfo& di)
|
||||
regsBase,
|
||||
regAreaSize,
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void**)&di.regs);
|
||||
|
||||
// If there was an error, delete other areas.
|
||||
@@ -221,7 +221,7 @@ InitDevice(DeviceInfo& di)
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(sharedSize),
|
||||
B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di.sharedArea < 0)
|
||||
return di.sharedArea; // return error code
|
||||
|
||||
@@ -304,7 +304,7 @@ init_hardware(void)
|
||||
pci_info pciInfo;
|
||||
const ChipInfo* pDevice = GetNextSupportedDevice(pciIndex, pciInfo);
|
||||
|
||||
TRACE("init_hardware() - %s\n",
|
||||
TRACE("init_hardware() - %s\n",
|
||||
pDevice == NULL ? "no supported devices" : "device supported");
|
||||
|
||||
put_module(B_PCI_MODULE_NAME); // put away the module manager
|
||||
@@ -313,7 +313,7 @@ init_hardware(void)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
init_driver(void)
|
||||
{
|
||||
// Get handle for the pci bus.
|
||||
@@ -425,7 +425,7 @@ device_open(const char* name, uint32 /*flags*/, void** cookie)
|
||||
*cookie = &di; // send cookie to opener
|
||||
}
|
||||
|
||||
TRACE("device_open() returning 0x%lx, open count: %ld\n", status,
|
||||
TRACE("device_open() returning 0x%lx, open count: %ld\n", status,
|
||||
di.openCount);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ MapDevice(DeviceInfo& di)
|
||||
regsBase,
|
||||
regAreaSize,
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void**)&di.regs);
|
||||
|
||||
// If there was an error, delete other areas.
|
||||
@@ -782,7 +782,7 @@ InitDevice(DeviceInfo& di)
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(sharedSize + vesaModeTableSize),
|
||||
B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di.sharedArea < 0)
|
||||
return di.sharedArea; // return error code
|
||||
|
||||
|
||||
@@ -466,7 +466,7 @@ char shared_name[B_OS_NAME_LENGTH];
|
||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||
/* 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,
|
||||
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di->sharedArea < 0) {
|
||||
/* return the error */
|
||||
result = di->sharedArea;
|
||||
|
||||
@@ -256,7 +256,7 @@ InitDevice(DeviceInfo& di)
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(sharedSize),
|
||||
B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di.sharedArea < 0)
|
||||
return di.sharedArea; // return error code
|
||||
|
||||
@@ -286,7 +286,7 @@ InitDevice(DeviceInfo& di)
|
||||
regsBase,
|
||||
regAreaSize,
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void**)&di.regs);
|
||||
|
||||
if (si.regsArea < 0) {
|
||||
|
||||
@@ -323,7 +323,7 @@ intel_extreme_init(intel_info &info)
|
||||
(void**)&info.shared_info, B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(sizeof(intel_shared_info)) + 3 * B_PAGE_SIZE,
|
||||
B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (info.shared_area < B_OK) {
|
||||
ERROR("error: could not create shared area!\n");
|
||||
gGART->unmap_aperture(info.aperture);
|
||||
@@ -354,7 +354,7 @@ intel_extreme_init(intel_info &info)
|
||||
info.pci->u.h0.base_registers[mmioIndex],
|
||||
info.pci->u.h0.base_register_sizes[mmioIndex],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void**)&info.registers);
|
||||
if (mmioMapper.InitCheck() < B_OK) {
|
||||
ERROR("error: could not map memory I/O!\n");
|
||||
|
||||
@@ -35,11 +35,6 @@
|
||||
|
||||
#define MAX_DEVICES 8
|
||||
|
||||
#ifndef __HAIKU__
|
||||
# undef B_USER_CLONEABLE_AREA
|
||||
# define B_USER_CLONEABLE_AREA 0
|
||||
#endif
|
||||
|
||||
/* Tell the kernel what revision of the driver API we support */
|
||||
int32 api_version = B_CUR_DRIVER_API_VERSION; // apsed, was 2, is 2 in R5
|
||||
|
||||
@@ -364,7 +359,7 @@ static status_t map_device(device_info *di)
|
||||
di->pcii.u.h0.base_registers[registers],
|
||||
di->pcii.u.h0.base_register_sizes[registers],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
B_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
(void **)&(di->regs));
|
||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||
|
||||
@@ -774,7 +769,7 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
/* 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,
|
||||
B_USER_CLONEABLE_AREA);
|
||||
B_CLONEABLE_AREA);
|
||||
if (di->shared_area < 0) {
|
||||
/* return the error */
|
||||
result = di->shared_area;
|
||||
|
||||
@@ -379,7 +379,7 @@ static status_t map_device(device_info *di)
|
||||
di->pcii.u.h0.base_registers[registers],
|
||||
di->pcii.u.h0.base_register_sizes[registers],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
B_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
(void **)&(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_register_sizes[registers2],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
B_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
(void **)&(di->regs2));
|
||||
si->clone_bugfix_regs2 = (uint32 *) di->regs2;
|
||||
|
||||
@@ -697,7 +697,7 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||
/* 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,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di->shared_area < 0) {
|
||||
/* return the error */
|
||||
result = di->shared_area;
|
||||
|
||||
@@ -29,11 +29,6 @@
|
||||
|
||||
#define MAX_DEVICES 8
|
||||
|
||||
#ifndef __HAIKU__
|
||||
# undef B_USER_CLONEABLE_AREA
|
||||
# define B_USER_CLONEABLE_AREA 0
|
||||
#endif
|
||||
|
||||
/* Tell the kernel what revision of the driver API we support */
|
||||
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||
|
||||
@@ -567,7 +562,7 @@ map_device(device_info *di)
|
||||
di->pcii.u.h0.base_registers_pci[registers],
|
||||
di->pcii.u.h0.base_register_sizes[registers],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
B_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
(void **)&(di->regs));
|
||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||
|
||||
@@ -890,7 +885,7 @@ open_hook(const char* name, uint32 flags, void** cookie)
|
||||
/* create this area with NO user-space read or write permissions, to prevent accidental damage */
|
||||
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_USER_CLONEABLE_AREA);
|
||||
B_CLONEABLE_AREA);
|
||||
if (di->shared_area < 0) {
|
||||
/* return the error */
|
||||
result = di->shared_area;
|
||||
@@ -911,7 +906,7 @@ open_hook(const char* name, uint32 flags, void** cookie)
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
2 * net_buf_size, /* take twice the net size so we can have MTRR-WC even on old systems */
|
||||
B_32_BIT_CONTIGUOUS, /* GPU always needs access */
|
||||
B_USER_CLONEABLE_AREA | B_READ_AREA | B_WRITE_AREA);
|
||||
B_CLONEABLE_AREA | B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: Physical aligning can be done without waste using the
|
||||
// private create_area_etc().
|
||||
/* on error, abort */
|
||||
|
||||
@@ -52,7 +52,7 @@ createGARTBuffer(GART_info *gart, size_t size)
|
||||
&gart->buffer.ptr, B_ANY_KERNEL_ADDRESS,
|
||||
size, B_FULL_LOCK,
|
||||
// TODO: really user read/write?
|
||||
B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (gart->buffer.area < 0) {
|
||||
SHOW_ERROR(1, "cannot create PCI GART buffer (%s)",
|
||||
strerror(gart->buffer.area));
|
||||
@@ -84,7 +84,7 @@ static status_t createGARTBuffer( GART_info *gart, size_t size )
|
||||
// question: is this necessary for a PCI GART because of bus snooping?
|
||||
gart->buffer.unaligned_area = create_area( "Radeon PCI GART buffer",
|
||||
&unaligned_addr, B_ANY_KERNEL_ADDRESS,
|
||||
2 * size, B_CONTIGUOUS/*B_FULL_LOCK*/, B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA );
|
||||
2 * size, B_CONTIGUOUS/*B_FULL_LOCK*/, B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA );
|
||||
// TODO: Physical aligning can be done without waste using the
|
||||
// private create_area_etc().
|
||||
if (gart->buffer.unaligned_area < 0) {
|
||||
@@ -151,7 +151,7 @@ static status_t initGATT( GART_info *gart )
|
||||
// TODO: Physical address is cast to 32 bit below! Use B_CONTIGUOUS,
|
||||
// when that is (/can be) fixed!
|
||||
// TODO: really user read/write?
|
||||
B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
|
||||
if (gart->GATT.area < 0) {
|
||||
SHOW_ERROR(1, "cannot create GATT table (%s)",
|
||||
|
||||
@@ -75,7 +75,7 @@ status_t Radeon_MapDevice( device_info *di, bool mmio_only )
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
/*// for "poke" debugging
|
||||
B_READ_AREA + B_WRITE_AREA*/
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void **)&(di->regs));
|
||||
if( si->regs_area < 0 )
|
||||
return si->regs_area;
|
||||
@@ -130,7 +130,7 @@ status_t Radeon_MapDevice( device_info *di, bool mmio_only )
|
||||
di->pcii.u.h0.base_registers[fb],
|
||||
di->pcii.u.h0.base_register_sizes[fb],
|
||||
B_ANY_KERNEL_BLOCK_ADDRESS | B_MTR_WC,
|
||||
B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void **)&(si->local_mem));
|
||||
|
||||
if( si->memory[mt_local].area < 0 ) {
|
||||
@@ -140,7 +140,7 @@ status_t Radeon_MapDevice( device_info *di, bool mmio_only )
|
||||
di->pcii.u.h0.base_registers[fb],
|
||||
di->pcii.u.h0.base_register_sizes[fb],
|
||||
B_ANY_KERNEL_BLOCK_ADDRESS,
|
||||
B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_READ_AREA | B_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void **)&(si->local_mem));
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ status_t Radeon_FirstOpen( device_info *di )
|
||||
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);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di->shared_area < 0) {
|
||||
result = di->shared_area;
|
||||
goto err8;
|
||||
@@ -280,7 +280,7 @@ status_t Radeon_FirstOpen( device_info *di )
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
(sizeof(virtual_card) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1),
|
||||
B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di->virtual_card_area < 0) {
|
||||
result = di->virtual_card_area;
|
||||
goto err7;
|
||||
|
||||
@@ -86,7 +86,7 @@ mapAtomBIOS(radeon_info &info, uint32 romBase, uint32 romSize)
|
||||
info.rom_area = create_area("radeon hd AtomBIOS",
|
||||
(void**)&info.atom_buffer, B_ANY_KERNEL_ADDRESS,
|
||||
romSize, B_NO_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
|
||||
if (info.rom_area < 0) {
|
||||
ERROR("%s: unable to map kernel AtomBIOS space!\n",
|
||||
@@ -107,7 +107,7 @@ mapAtomBIOS(radeon_info &info, uint32 romBase, uint32 romSize)
|
||||
|
||||
if (romValid == true) {
|
||||
set_area_protection(info.rom_area,
|
||||
B_KERNEL_READ_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_CLONEABLE_AREA);
|
||||
ERROR("%s: AtomBIOS verified and locked\n", __func__);
|
||||
} else
|
||||
ERROR("%s: AtomBIOS memcpy failed!\n", __func__);
|
||||
@@ -543,7 +543,7 @@ radeon_hd_init(radeon_info &info)
|
||||
info.shared_area = sharedCreator.Create("radeon hd shared info",
|
||||
(void**)&info.shared_info, B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(sizeof(radeon_shared_info)), B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (info.shared_area < B_OK) {
|
||||
ERROR("%s: card (%" B_PRId32 "): couldn't map shared area!\n",
|
||||
__func__, info.id);
|
||||
@@ -560,7 +560,7 @@ radeon_hd_init(radeon_info &info)
|
||||
info.pci->u.h0.base_registers[pciBarMmio],
|
||||
info.pci->u.h0.base_register_sizes[pciBarMmio],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void**)&info.registers);
|
||||
if (mmioMapper.InitCheck() < B_OK) {
|
||||
ERROR("%s: card (%" B_PRId32 "): couldn't map memory I/O!\n",
|
||||
|
||||
@@ -245,7 +245,7 @@ MapDevice(DeviceInfo& di)
|
||||
|
||||
si.regsArea = map_physical_memory(areaName, regsBase, regAreaSize,
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
(void**)(&(di.regs)));
|
||||
|
||||
if (si.regsArea < 0)
|
||||
@@ -412,7 +412,7 @@ InitDevice(DeviceInfo& di)
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
((sizeof(SharedInfo) + (B_PAGE_SIZE - 1)) & ~(B_PAGE_SIZE - 1)),
|
||||
B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di.sharedArea < 0)
|
||||
return di.sharedArea; // return error code
|
||||
|
||||
|
||||
@@ -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_register_sizes[registers],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
B_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
(void **)&(di->regs));
|
||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||
|
||||
@@ -649,7 +649,7 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||
/* 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,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di->shared_area < 0) {
|
||||
/* return the error */
|
||||
result = di->shared_area;
|
||||
|
||||
@@ -367,7 +367,7 @@ vesa_init(vesa_info& info)
|
||||
info.shared_area = create_area("vesa shared info",
|
||||
(void**)&info.shared_info, B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(sharedSize + modesSize), B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (info.shared_area < 0)
|
||||
return info.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_register_sizes[registers],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
B_USER_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
B_CLONEABLE_AREA | (si->use_clone_bugfix ? B_READ_AREA|B_WRITE_AREA : 0),
|
||||
(void **)&(di->regs));
|
||||
si->clone_bugfix_regs = (uint32 *) di->regs;
|
||||
|
||||
@@ -658,7 +658,7 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
di->pcii.bus, di->pcii.device, di->pcii.function);
|
||||
/* 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,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (di->shared_area < 0) {
|
||||
/* return the error */
|
||||
result = di->shared_area;
|
||||
|
||||
@@ -244,7 +244,7 @@ RequestAllocator::AllocateAddress(Address& address, int32 size, int32 align,
|
||||
areaSize, B_NO_LOCK,
|
||||
B_READ_AREA | B_WRITE_AREA
|
||||
#ifdef _KERNEL_MODE
|
||||
| B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA
|
||||
| B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA
|
||||
#endif
|
||||
);
|
||||
if (area < 0)
|
||||
|
||||
@@ -435,7 +435,7 @@ frame_buffer_console_init(kernel_args* args)
|
||||
sConsole.area = map_physical_memory("vesa frame buffer",
|
||||
args->frame_buffer.physical_buffer.start,
|
||||
args->frame_buffer.physical_buffer.size, B_ANY_KERNEL_ADDRESS,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA,
|
||||
&frameBuffer);
|
||||
if (sConsole.area < 0)
|
||||
return sConsole.area;
|
||||
|
||||
@@ -59,7 +59,7 @@ MessagingArea::Create(sem_id lockSem, sem_id counterSem)
|
||||
// create the area
|
||||
area->fID = create_area("messaging", (void**)&area->fHeader,
|
||||
B_ANY_KERNEL_ADDRESS, kMessagingAreaSize, B_FULL_LOCK,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA);
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
|
||||
if (area->fID < 0) {
|
||||
delete area;
|
||||
return NULL;
|
||||
|
||||
@@ -2110,7 +2110,7 @@ vm_clone_area(team_id team, const char* name, void** address,
|
||||
|
||||
if (!kernel && sourceAddressSpace == VMAddressSpace::Kernel()
|
||||
&& targetAddressSpace != VMAddressSpace::Kernel()
|
||||
&& !(sourceArea->protection & B_USER_CLONEABLE_AREA)) {
|
||||
&& !(sourceArea->protection & B_CLONEABLE_AREA)) {
|
||||
// kernel areas must not be cloned in userland, unless explicitly
|
||||
// declared user-cloneable upon construction
|
||||
#if KDEBUG
|
||||
|
||||
Reference in New Issue
Block a user