Spinlock save cpu flags
This commit is contained in:
@@ -7,12 +7,15 @@
|
||||
#include <libk/printf.h>
|
||||
#include <libk/std.h>
|
||||
#include <libk/string.h>
|
||||
#include <status.h>
|
||||
#include <sys/debug.h>
|
||||
#include <proc/proc.h>
|
||||
#include <proc/reschedule.h>
|
||||
#include <status.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx* rctx,
|
||||
struct device* device) {
|
||||
uint64_t fd;
|
||||
|
||||
static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx* rctx, struct device* device) {
|
||||
struct dos_mbr mbr;
|
||||
memset (&mbr, 0, sizeof (mbr));
|
||||
size_t sector = 0;
|
||||
@@ -27,19 +30,19 @@ static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx
|
||||
[XDRV_WRITE] = &partdrv_write,
|
||||
};
|
||||
|
||||
spin_lock (&device->lock);
|
||||
spin_lock (&device->lock, &fd);
|
||||
|
||||
device_op (device, XDRV_GET_SECTOR_SIZE, proc, rctx, §or_size);
|
||||
|
||||
int ret = device_op (device, XDRV_READ, proc, rctx, §or, §or_count, &mbr);
|
||||
|
||||
if (ret < 0) {
|
||||
spin_unlock (&device->lock);
|
||||
spin_unlock (&device->lock, fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!(mbr.valid_sign[0] == 0x55 && mbr.valid_sign[1] == 0xAA)) {
|
||||
spin_unlock (&device->lock);
|
||||
spin_unlock (&device->lock, fd);
|
||||
return -ST_PARTITION_ERROR;
|
||||
}
|
||||
|
||||
@@ -59,9 +62,12 @@ static int device_probe_partitions_dos (struct proc* proc, struct reschedule_ctx
|
||||
device_create (key, ops, lengthof (ops), &partdrv_init, &partdrv_fini, &init, proc, rctx);
|
||||
}
|
||||
|
||||
spin_unlock (&device->lock);
|
||||
spin_unlock (&device->lock, fd);
|
||||
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int device_probe_partitions (struct proc* proc, struct reschedule_ctx* rctx, struct device* device) { return device_probe_partitions_dos (proc, rctx, device); }
|
||||
int device_probe_partitions (struct proc* proc, struct reschedule_ctx* rctx,
|
||||
struct device* device) {
|
||||
return device_probe_partitions_dos (proc, rctx, device);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user