Remove the int_ from the interrupt enable/disable functions.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@425 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David Reid
2002-07-25 01:05:51 +00:00
parent 7438a7b7d0
commit d10f93e702
17 changed files with 211 additions and 215 deletions
+3 -3
View File
@@ -178,7 +178,7 @@ void i386_handle_trap(struct int_frame frame)
// get the old interrupt enable/disable state and restore to that
if(frame.flags & 0x200) {
// dprintf("page_fault: enabling interrupts\n");
int_enable_interrupts();
enable_interrupts();
}
ret = vm_page_fault(cr2, frame.eip,
(frame.error_code & 0x2) != 0,
@@ -243,11 +243,11 @@ void i386_handle_trap(struct int_frame frame)
}
if (ret == B_INVOKE_SCHEDULER) {
int state = int_disable_interrupts();
int state = disable_interrupts();
GRAB_THREAD_LOCK();
thread_resched();
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
}
if(frame.cs == USER_CODE_SEG || frame.vector == 99) {
+3 -2
View File
@@ -7,6 +7,7 @@
#include <arch/cpu.h>
#include <smp.h>
#include <int.h>
#include <atomic.h>
#include <arch/x86/selector.h>
@@ -37,7 +38,7 @@ selector_id i386_selector_add( selector_type type )
selector_id id = 0;
unsigned i;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock( &spinlock );
for ( i = 0; i < ENTRIES; i++ )
@@ -54,7 +55,7 @@ selector_id i386_selector_add( selector_type type )
}
release_spinlock( &spinlock );
int_restore_interrupts( state );
restore_interrupts( state );
if ( id ) {
asm("lgdt %0;"
+8 -12
View File
@@ -105,22 +105,18 @@ int arch_smp_init(kernel_args *ka)
void arch_smp_send_broadcast_ici(void)
{
int config;
int state;
state = int_disable_interrupts();
int state = disable_interrupts();
config = apic_read(APIC_ICR1) & APIC_ICR1_WRITE_MASK;
apic_write(APIC_ICR1, config | 0xfd | APIC_ICR1_DELMODE_FIXED | APIC_ICR1_DESTMODE_PHYS | APIC_ICR1_DEST_ALL_BUT_SELF);
int_restore_interrupts(state);
restore_interrupts(state);
}
void arch_smp_send_ici(int target_cpu)
{
int config;
int state;
state = int_disable_interrupts();
int state = disable_interrupts();
config = apic_read(APIC_ICR2) & APIC_ICR2_MASK;
apic_write(APIC_ICR2, config | cpu_apic_id[target_cpu] << 24);
@@ -128,7 +124,7 @@ void arch_smp_send_ici(int target_cpu)
config = apic_read(APIC_ICR1) & APIC_ICR1_WRITE_MASK;
apic_write(APIC_ICR1, config | 0xfd | APIC_ICR1_DELMODE_FIXED | APIC_ICR1_DESTMODE_PHYS | APIC_ICR1_DEST_FIELD);
int_restore_interrupts(state);
restore_interrupts(state);
}
void arch_smp_ack_interrupt(void)
@@ -153,7 +149,7 @@ int arch_smp_set_apic_timer(bigtime_t relative_timeout)
// calculation should be ok, since it's going to be 64-bit
ticks = ((relative_timeout * apic_timer_tics_per_sec) / 1000000);
state = int_disable_interrupts();
state = disable_interrupts();
config = apic_read(APIC_LVTT) | APIC_LVTT_M; // mask the timer
apic_write(APIC_LVTT, config);
@@ -165,7 +161,7 @@ int arch_smp_set_apic_timer(bigtime_t relative_timeout)
apic_write(APIC_ICRT, ticks); // start it up
int_restore_interrupts(state);
restore_interrupts(state);
return 0;
}
@@ -178,14 +174,14 @@ int arch_smp_clear_apic_timer(void)
if(apic == NULL)
return -1;
state = int_disable_interrupts();
state = disable_interrupts();
config = apic_read(APIC_LVTT) | APIC_LVTT_M; // mask the timer
apic_write(APIC_LVTT, config);
apic_write(APIC_ICRT, 0); // zero out the timer
int_restore_interrupts(state);
restore_interrupts(state);
return 0;
}
+1 -1
View File
@@ -155,7 +155,7 @@ void arch_thread_enter_uspace(addr entry, void *args, addr ustack_top)
// make sure the fpu is in a good state
asm("fninit");
int_disable_interrupts();
disable_interrupts();
i386_set_kstack(thread_get_current_thread()->kernel_stack_base + KSTACK_SIZE);
@@ -93,17 +93,16 @@ static void init_ptentry(ptentry *e)
static void _update_all_pgdirs(int index, pdentry e)
{
unsigned int state;
vm_translation_map *entry;
unsigned int state = disable_interrupts();
state = int_disable_interrupts();
acquire_spinlock(&tmap_list_lock);
for(entry = tmap_list; entry != NULL; entry = entry->next)
entry->arch_data->pgdir_virt[index] = e;
release_spinlock(&tmap_list_lock);
int_restore_interrupts(state);
restore_interrupts(state);
}
static int lock_tmap(vm_translation_map *map)
@@ -141,7 +140,7 @@ static void destroy_tmap(vm_translation_map *map)
return;
// remove it from the tmap list
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&tmap_list_lock);
entry = tmap_list;
@@ -159,7 +158,7 @@ static void destroy_tmap(vm_translation_map *map)
}
release_spinlock(&tmap_list_lock);
int_restore_interrupts(state);
restore_interrupts(state);
if(map->arch_data->pgdir_virt != NULL) {
@@ -412,7 +411,7 @@ static void flush_tmap(vm_translation_map *map)
if(map->arch_data->num_invalidate_pages <= 0)
return;
state = int_disable_interrupts();
state = disable_interrupts();
if(map->arch_data->num_invalidate_pages > PAGE_INVALIDATE_CACHE_SIZE) {
// invalidate all pages
// dprintf("flush_tmap: %d pages to invalidate, doing global invalidation\n", map->arch_data->num_invalidate_pages);
@@ -425,7 +424,7 @@ static void flush_tmap(vm_translation_map *map)
map->arch_data->num_invalidate_pages, 0, NULL, SMP_MSG_FLAG_SYNC);
}
map->arch_data->num_invalidate_pages = 0;
int_restore_interrupts(state);
restore_interrupts(state);
}
static int map_iospace_chunk(addr va, addr pa)
@@ -450,11 +449,11 @@ static int map_iospace_chunk(addr va, addr pa)
pt[i].present = 1;
}
state = int_disable_interrupts();
state = disable_interrupts();
arch_cpu_invalidate_TLB_range(va, va + (IOSPACE_CHUNK_SIZE - PAGE_SIZE));
smp_send_broadcast_ici(SMP_MSG_INVL_PAGE_RANGE, va, va + (IOSPACE_CHUNK_SIZE - PAGE_SIZE), 0,
NULL, SMP_MSG_FLAG_SYNC);
int_restore_interrupts(state);
restore_interrupts(state);
return 0;
}
@@ -613,7 +612,7 @@ dprintf("vm_translation_map_create\n");
// insert this new map into the map list
{
int state = int_disable_interrupts();
int state = disable_interrupts();
acquire_spinlock(&tmap_list_lock);
// copy the top portion of the pgdir from the current one
@@ -624,7 +623,7 @@ dprintf("vm_translation_map_create\n");
tmap_list = new_map;
release_spinlock(&tmap_list_lock);
int_restore_interrupts(state);
restore_interrupts(state);
}
return 0;
+7 -7
View File
@@ -53,7 +53,7 @@ static void *_cbuf_alloc(size_t *size)
// dprintf("cbuf_alloc: asked to allocate size %d\n", *size);
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&cbuf_lowlevel_spinlock);
// scan through the allocation bitmap, looking for the first free block
@@ -85,7 +85,7 @@ static void *_cbuf_alloc(size_t *size)
}
release_spinlock(&cbuf_lowlevel_spinlock);
int_restore_interrupts(state);
restore_interrupts(state);
return buf;
}
@@ -162,14 +162,14 @@ void cbuf_free_chain_noblock(cbuf *buf)
head = buf;
_clear_chain(head, &last);
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&noblock_spin);
last->next = cbuf_free_noblock_list;
cbuf_free_noblock_list = head;
release_spinlock(&noblock_spin);
int_restore_interrupts(state);
restore_interrupts(state);
}
void cbuf_free_chain(cbuf *buf)
@@ -246,14 +246,14 @@ cbuf *cbuf_get_chain_noblock(size_t len)
size_t chain_len = 0;
int state;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&noblock_spin);
while(chain_len < len) {
if(cbuf_free_noblock_list == NULL) {
dprintf("cbuf_get_chain_noblock: not enough cbufs\n");
release_spinlock(&noblock_spin);
int_restore_interrupts(state);
restore_interrupts(state);
if(chain != NULL)
cbuf_free_chain_noblock(chain);
@@ -271,7 +271,7 @@ cbuf *cbuf_get_chain_noblock(size_t len)
chain_len += chain->len;
}
release_spinlock(&noblock_spin);
int_restore_interrupts(state);
restore_interrupts(state);
// now we have a chain, fixup the first and last entry
chain->total_len = len;
+11 -11
View File
@@ -198,7 +198,7 @@ static void kernel_debugger_loop()
int argc;
struct debugger_command *cmd;
int_disable_interrupts();
disable_interrupts();
dprintf("kernel debugger on cpu %d\n", smp_get_current_cpu());
debugger_on_cpu = smp_get_current_cpu();
@@ -248,7 +248,7 @@ int panic(const char *fmt, ...)
dbg_set_serial_debug(true);
state = int_disable_interrupts();
state = disable_interrupts();
va_start(args, fmt);
ret = vsprintf(temp, fmt, args);
@@ -266,7 +266,7 @@ int panic(const char *fmt, ...)
kernel_debugger(NULL);
int_restore_interrupts(state);
restore_interrupts(state);
return ret;
}
@@ -289,7 +289,7 @@ int dprintf(const char *fmt, ...)
char dbg_putch(char c)
{
char ret;
int flags = int_disable_interrupts();
int flags = disable_interrupts();
acquire_spinlock(&dbg_spinlock);
if(serial_debug_on)
@@ -298,21 +298,21 @@ char dbg_putch(char c)
ret = c;
release_spinlock(&dbg_spinlock);
int_restore_interrupts(flags);
restore_interrupts(flags);
return ret;
}
void dbg_puts(const char *s)
{
int flags = int_disable_interrupts();
int flags = disable_interrupts();
acquire_spinlock(&dbg_spinlock);
if(serial_debug_on)
arch_dbg_con_puts(s);
release_spinlock(&dbg_spinlock);
int_restore_interrupts(flags);
restore_interrupts(flags);
}
int add_debugger_command(const char * name, int (*func)(int, char **), const char * desc)
@@ -328,14 +328,14 @@ int add_debugger_command(const char * name, int (*func)(int, char **), const cha
cmd->name = name;
cmd->description = desc;
flags = int_disable_interrupts();
flags = disable_interrupts();
acquire_spinlock(&dbg_spinlock);
cmd->next = commands;
commands = cmd;
release_spinlock(&dbg_spinlock);
int_restore_interrupts(flags);
restore_interrupts(flags);
return B_NO_ERROR;
}
@@ -346,7 +346,7 @@ int remove_debugger_command(const char * name, int (*func)(int, char **))
struct debugger_command *cmd;
struct debugger_command *prev;
flags = int_disable_interrupts();
flags = disable_interrupts();
acquire_spinlock(&dbg_spinlock);
prev = NULL;
@@ -367,7 +367,7 @@ int remove_debugger_command(const char * name, int (*func)(int, char **))
};
release_spinlock(&dbg_spinlock);
int_restore_interrupts(flags);
restore_interrupts(flags);
if (cmd) {
kfree(cmd);
+4 -4
View File
@@ -82,11 +82,11 @@ long install_interrupt_handler(long vector, interrupt_handler handler,
/* Disable the interrupts, get the spinlock for this irq only
* and then insert the handler */
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&io_vectors[vector].vector_lock);
insque(io, &io_vectors[vector].handler_list);
release_spinlock(&io_vectors[vector].vector_lock);
int_restore_interrupts(state);
restore_interrupts(state);
return 0;
}
@@ -124,7 +124,7 @@ long remove_interrupt_handler(long vector, interrupt_handler handler,
long rv = EINVAL;
/* lock the structures down so it is not modified while we search */
int state = int_disable_interrupts();
int state = disable_interrupts();
acquire_spinlock(&io_vectors[vector].vector_lock);
/* loop through the available handlers and try to find a match.
@@ -147,7 +147,7 @@ long remove_interrupt_handler(long vector, interrupt_handler handler,
* the value rv
*/
release_spinlock(&io_vectors[vector].vector_lock);
int_restore_interrupts(state);
restore_interrupts(state);
return rv;
}
+1 -1
View File
@@ -101,7 +101,7 @@ int _start(kernel_args *oldka, int cpu_num)
// this is run per cpu for each AP processor after they've been set loose
thread_init_percpu(cpu_num);
}
int_enable_interrupts();
enable_interrupts();
dprintf("main: done... begin idle loop on cpu %d\n", cpu_num);
for(;;)
+39 -39
View File
@@ -215,7 +215,7 @@ create_port(int32 queue_length, const char *name)
}
owner = proc_get_current_proc_id();
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LIST_LOCK();
// find the first empty spot
@@ -262,7 +262,7 @@ create_port(int32 queue_length, const char *name)
kfree(q);
out:
int_restore_interrupts(state);
restore_interrupts(state);
return retval;
}
@@ -280,12 +280,12 @@ close_port(port_id id)
slot = id % MAX_PORTS;
// walk through the sem list, trying to match name
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if (ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_BAD_PORT_ID;
}
@@ -293,7 +293,7 @@ close_port(port_id id)
ports[slot].closed = true;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_NO_ERROR;
}
@@ -317,12 +317,12 @@ delete_port(port_id id)
slot = id % MAX_PORTS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("delete_port: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
@@ -337,7 +337,7 @@ delete_port(port_id id)
ports[slot].name = NULL;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// delete the cbuf's that are left in the queue (if any)
for (i=0; i<capacity; i++) {
@@ -369,7 +369,7 @@ find_port(const char *port_name)
return B_BAD_PORT_ID;
// lock list of ports
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LIST_LOCK();
// loop over list
@@ -385,7 +385,7 @@ find_port(const char *port_name)
}
RELEASE_PORT_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return ret_val;
}
@@ -405,12 +405,12 @@ _get_port_info(port_id id, port_info *info, size_t size)
slot = id % MAX_PORTS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("get_port_info: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
@@ -424,7 +424,7 @@ _get_port_info(port_id id, port_info *info, size_t size)
info->total_count = ports[slot].total_count;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// from our port_entry
return B_NO_ERROR;
@@ -453,7 +453,7 @@ _get_next_port_info(team_id proc, int32 *cookie, struct port_info *info,
}
// spinlock
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LIST_LOCK();
info->port = -1; // used as found flag
@@ -477,7 +477,7 @@ _get_next_port_info(team_id proc, int32 *cookie, struct port_info *info,
slot++;
}
RELEASE_PORT_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if (info->port == -1)
return B_BAD_PORT_ID;
@@ -509,17 +509,17 @@ port_buffer_size_etc(port_id id,
slot = id % MAX_PORTS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("get_port_info: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// block if no message,
// if TIMEOUT flag set, block with timeout
@@ -574,12 +574,12 @@ port_count(port_id id)
slot = id % MAX_PORTS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("port_count: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
@@ -590,7 +590,7 @@ port_count(port_id id)
count = 0;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// return count of messages (sem_count)
return count;
@@ -638,12 +638,12 @@ read_port_etc(port_id id,
slot = id % MAX_PORTS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("read_port_etc: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
@@ -652,7 +652,7 @@ read_port_etc(port_id id,
// unlock port && enable ints/
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// XXX -> possible race condition if port gets deleted (->sem deleted too), therefore
// sem_id is cached in local variable up here
@@ -679,7 +679,7 @@ read_port_etc(port_id id,
return res;
}
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
t = ports[slot].tail;
@@ -702,7 +702,7 @@ read_port_etc(port_id id,
cached_semid = ports[slot].write_sem;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// copy message
*msg_code = code;
@@ -739,12 +739,12 @@ set_port_owner(port_id id, proc_id proc)
slot = id % MAX_PORTS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("set_port_owner: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
@@ -754,7 +754,7 @@ set_port_owner(port_id id, proc_id proc)
// unlock port
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_NO_ERROR;
}
@@ -799,19 +799,19 @@ write_port_etc(port_id id,
if (buffer_size > PORT_MAX_MESSAGE_SIZE)
return EINVAL;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
if(ports[slot].id != id) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("write_port_etc: invalid port_id %d\n", id);
return B_BAD_PORT_ID;
}
if (ports[slot].closed) {
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("write_port_etc: port %d closed\n", id);
return B_BAD_PORT_ID;
}
@@ -820,7 +820,7 @@ write_port_etc(port_id id,
cached_semid = ports[slot].write_sem;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
// XXX -> possible race condition if port gets deleted (->sem deleted too),
// and queue is full therefore sem_id is cached in local variable up here
@@ -866,7 +866,7 @@ write_port_etc(port_id id,
}
// attach copied message to queue
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LOCK(ports[slot]);
h = ports[slot].head;
@@ -884,7 +884,7 @@ write_port_etc(port_id id,
cached_semid = ports[slot].read_sem;
RELEASE_PORT_LOCK(ports[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
get_sem_count(ports[slot].read_sem, &c1);
get_sem_count(ports[slot].write_sem, &c2);
@@ -906,7 +906,7 @@ int delete_owned_ports(proc_id owner)
if(ports_active == false)
return B_BAD_PORT_ID;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LIST_LOCK();
for(i=0; i<MAX_PORTS; i++) {
@@ -914,18 +914,18 @@ int delete_owned_ports(proc_id owner)
port_id id = ports[i].id;
RELEASE_PORT_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
delete_port(id);
count++;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PORT_LIST_LOCK();
}
}
RELEASE_PORT_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return count;
}
+27 -27
View File
@@ -168,7 +168,7 @@ sem_id create_sem_etc(int count, const char *name, proc_id owner)
strcpy(temp_name, "default_sem_name");
}
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LIST_LOCK();
// find the first empty spot
@@ -201,7 +201,7 @@ sem_id create_sem_etc(int count, const char *name, proc_id owner)
kfree(temp_name);
out:
int_restore_interrupts(state);
restore_interrupts(state);
return retval;
}
@@ -233,12 +233,12 @@ int delete_sem_etc(sem_id id, int return_code)
slot = id % MAX_SEMS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("delete_sem: invalid sem_id %d\n", id);
return B_BAD_SEM_ID;
}
@@ -271,7 +271,7 @@ int delete_sem_etc(sem_id id, int return_code)
RELEASE_THREAD_LOCK();
}
int_restore_interrupts(state);
restore_interrupts(state);
kfree(old_name);
@@ -292,7 +292,7 @@ static int sem_timeout(timer *data)
return B_HANDLED_INTERRUPT;
slot = args->blocked_sem_id % MAX_SEMS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
// dprintf("sem_timeout: called on 0x%x sem %d, tid %d\n", to, to->sem_id, to->thread_id);
@@ -315,7 +315,7 @@ static int sem_timeout(timer *data)
}
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return B_INVOKE_SCHEDULER;
}
@@ -341,7 +341,7 @@ int acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout)
if (count <= 0)
return EINVAL;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
@@ -426,14 +426,14 @@ int acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout)
}
}
int_restore_interrupts(state);
restore_interrupts(state);
return t->sem_errcode;
}
err:
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return err;
}
@@ -459,7 +459,7 @@ int release_sem_etc(sem_id id, int count, int flags)
if (count <= 0)
return EINVAL;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
@@ -514,7 +514,7 @@ int release_sem_etc(sem_id id, int count, int flags)
err:
RELEASE_SEM_LOCK(sems[slot]);
outnolock:
int_restore_interrupts(state);
restore_interrupts(state);
return err;
}
@@ -533,12 +533,12 @@ int get_sem_count(sem_id id, int32* thread_count)
slot = id % MAX_SEMS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("sem_get_count: invalid sem_id %d\n", id);
return B_BAD_SEM_ID;
}
@@ -546,7 +546,7 @@ int get_sem_count(sem_id id, int32* thread_count)
*thread_count = sems[slot].count;
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_NO_ERROR;
}
@@ -565,12 +565,12 @@ int _get_sem_info(sem_id id, struct sem_info *info, size_t sz)
slot = id % MAX_SEMS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("get_sem_info: invalid sem_id %d\n", id);
return B_BAD_SEM_ID;
}
@@ -582,7 +582,7 @@ int _get_sem_info(sem_id id, struct sem_info *info, size_t sz)
info->latest_holder = sems[slot].q.head->id; // XXX not sure if this is correct
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_NO_ERROR;
}
@@ -611,7 +611,7 @@ int _get_next_sem_info(proc_id proc, uint32 *cookie, struct sem_info *info, size
return B_BAD_SEM_ID;
}
// spinlock
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LIST_LOCK();
while (slot < MAX_SEMS) {
@@ -633,7 +633,7 @@ int _get_next_sem_info(proc_id proc, uint32 *cookie, struct sem_info *info, size
slot++;
}
RELEASE_SEM_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if (slot == MAX_SEMS)
return B_BAD_SEM_ID;
@@ -659,12 +659,12 @@ int set_sem_owner(sem_id id, proc_id proc)
slot = id % MAX_SEMS;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LOCK(sems[slot]);
if (sems[slot].id != id) {
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("set_sem_owner: invalid sem_id %d\n", id);
return B_BAD_SEM_ID;
}
@@ -672,7 +672,7 @@ int set_sem_owner(sem_id id, proc_id proc)
sems[slot].owner = proc;
RELEASE_SEM_LOCK(sems[slot]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_NO_ERROR;
}
@@ -754,7 +754,7 @@ int sem_delete_owned_sems(proc_id owner)
if (owner < 0)
return B_BAD_SEM_ID;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LIST_LOCK();
for (i=0; i<MAX_SEMS; i++) {
@@ -762,18 +762,18 @@ int sem_delete_owned_sems(proc_id owner)
sem_id id = sems[i].id;
RELEASE_SEM_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
delete_sem_etc(id, 0);
count++;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_SEM_LIST_LOCK();
}
}
RELEASE_SEM_LIST_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return count;
}
+7 -7
View File
@@ -64,7 +64,7 @@ void acquire_spinlock(spinlock_t *lock)
{
if(smp_num_cpus > 1) {
int curr_cpu = smp_get_current_cpu();
if(int_is_interrupts_enabled())
if(are_interrupts_enabled())
panic("acquire_spinlock: attempt to acquire lock %p with interrupts enabled\n", lock);
while(1) {
while(*lock != 0)
@@ -104,14 +104,14 @@ static int find_free_message(struct smp_msg **msg)
retry:
while(free_msg_count <= 0)
;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&free_msg_spinlock);
if(free_msg_count <= 0) {
// someone grabbed one while we were getting the lock,
// go back to waiting for it
release_spinlock(&free_msg_spinlock);
int_restore_interrupts(state);
restore_interrupts(state);
goto retry;
}
@@ -278,7 +278,7 @@ static int smp_process_pending_ici(int curr_cpu)
// special case for the halt message
// we otherwise wouldn't have gotten the opportunity to clean up
if(halt) {
int_disable_interrupts();
disable_interrupts();
for(;;);
}
@@ -316,7 +316,7 @@ void smp_send_ici(int target_cpu, int message, unsigned long data, unsigned long
curr_cpu = smp_get_current_cpu();
if(target_cpu == curr_cpu) {
return_free_message(msg);
int_restore_interrupts(state);
restore_interrupts(state);
return; // nope, cant do that
}
@@ -349,7 +349,7 @@ void smp_send_ici(int target_cpu, int message, unsigned long data, unsigned long
return_free_message(msg);
}
int_restore_interrupts(state);
restore_interrupts(state);
}
}
@@ -404,7 +404,7 @@ void smp_send_broadcast_ici(int message, unsigned long data, unsigned long data2
return_free_message(msg);
}
int_restore_interrupts(state);
restore_interrupts(state);
}
// dprintf("smp_send_broadcast_ici: done\n");
}
+53 -53
View File
@@ -306,11 +306,11 @@ static struct thread *create_thread_struct(const char *name)
struct thread *t;
int state;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_dequeue(&dead_q);
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if(t == NULL) {
t = (struct thread *)kmalloc(sizeof(struct thread));
@@ -414,7 +414,7 @@ static thread_id _create_thread(const char *name, proc_id pid, addr entry, void
t->state = THREAD_STATE_BIRTH;
t->next_state = THREAD_STATE_SUSPENDED;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
// insert into global list
@@ -435,7 +435,7 @@ static thread_id _create_thread(const char *name, proc_id pid, addr entry, void
hash_remove(thread_hash, t);
RELEASE_THREAD_LOCK();
}
int_restore_interrupts(state);
restore_interrupts(state);
if(abort) {
delete_thread_struct(t);
return ERR_TASK_PROC_DELETED;
@@ -526,7 +526,7 @@ int thread_suspend_thread(thread_id id)
int retval;
bool global_resched = false;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_current_thread();
@@ -551,7 +551,7 @@ int thread_suspend_thread(thread_id id)
}
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if(global_resched) {
smp_send_broadcast_ici(SMP_MSG_RESCHEDULE, 0, 0, 0, NULL, SMP_MSG_FLAG_SYNC);
@@ -566,7 +566,7 @@ int thread_resume_thread(thread_id id)
struct thread *t;
int retval;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_thread_struct_locked(id);
@@ -581,7 +581,7 @@ int thread_resume_thread(thread_id id)
}
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return retval;
}
@@ -604,7 +604,7 @@ int thread_set_priority(thread_id id, int priority)
t->priority = priority;
retval = B_NO_ERROR;
} else {
int state = int_disable_interrupts();
int state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_thread_struct_locked(id);
@@ -623,7 +623,7 @@ int thread_set_priority(thread_id id, int priority)
}
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
}
return retval;
@@ -868,7 +868,7 @@ static int get_death_stack(void)
acquire_sem(death_stack_sem);
// grap the thread lock, find a free spot and release
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
bit = death_stack_bitmap;
bit = (~bit)&~((~bit)-1);
@@ -907,7 +907,7 @@ static void put_death_stack_and_reschedule(unsigned int index)
if(!(death_stack_bitmap & (1 << index)))
panic("put_death_stack: passed invalid stack index %d\n", index);
int_disable_interrupts();
disable_interrupts();
GRAB_THREAD_LOCK();
death_stack_bitmap &= ~(1 << index);
@@ -1047,21 +1047,21 @@ void thread_start_threading(void)
// XXX may not be the best place for this
// invalidate all of the other processors' TLB caches
state = int_disable_interrupts();
state = disable_interrupts();
arch_cpu_global_TLB_invalidate();
smp_send_broadcast_ici(SMP_MSG_GLOBAL_INVL_PAGE, 0, 0, 0, NULL, SMP_MSG_FLAG_SYNC);
int_restore_interrupts(state);
restore_interrupts(state);
// start the other processors
smp_send_broadcast_ici(SMP_MSG_RESCHEDULE, 0, 0, 0, NULL, SMP_MSG_FLAG_ASYNC);
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
thread_resched();
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
}
int user_thread_snooze(bigtime_t time)
@@ -1087,7 +1087,7 @@ static void thread_entry(void)
// simulates the thread spinlock release that would occur if the thread had been
// rescheded from. The resched didn't happen because the thread is new.
RELEASE_THREAD_LOCK();
int_enable_interrupts(); // this essentially simulates a return-from-interrupt
enable_interrupts(); // this essentially simulates a return-from-interrupt
}
// used to pass messages between thread_exit and thread_exit2
@@ -1107,7 +1107,7 @@ static void thread_exit2(void *_args)
memcpy(&args, _args, sizeof(struct thread_exit_args));
// restore the interrupts
int_restore_interrupts(args.int_state);
restore_interrupts(args.int_state);
// dprintf("thread_exit2, running on death stack 0x%lx\n", args.t->kernel_stack_base);
@@ -1118,7 +1118,7 @@ static void thread_exit2(void *_args)
// dprintf("thread_exit2: removing thread 0x%x from global lists\n", args.t->id);
// remove this thread from all of the global lists
int_disable_interrupts();
disable_interrupts();
GRAB_PROC_LOCK();
remove_thread_from_proc(kernel_proc, args.t);
RELEASE_PROC_LOCK();
@@ -1160,7 +1160,7 @@ void thread_exit(int retcode)
if(p != kernel_proc) {
// remove this thread from the current process and add it to the kernel
// put the thread into the kernel proc until it dies
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
remove_thread_from_proc(p, t);
insert_thread_into_proc(kernel_proc, t);
@@ -1173,7 +1173,7 @@ void thread_exit(int retcode)
RELEASE_PROC_LOCK();
// swap address spaces, to make sure we're running on the kernel's pgdir
vm_aspace_swap(kernel_proc->kaspace);
int_restore_interrupts(state);
restore_interrupts(state);
// dprintf("thread_exit: thread 0x%x now a kernel thread!\n", t->id);
}
@@ -1186,7 +1186,7 @@ void thread_exit(int retcode)
// XXX this can be optimized. There's got to be a better solution.
struct thread *temp_thread;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
// we can safely walk the list because of the lock. no new threads can be created
// because of the PROC_STATE_DEATH flag on the process
@@ -1197,7 +1197,7 @@ void thread_exit(int retcode)
temp_thread = next;
}
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
// Now wait for all of the threads to die
// XXX block on a semaphore
@@ -1230,7 +1230,7 @@ void thread_exit(int retcode)
args.death_stack = death_stack;
// disable the interrupts. Must remain disabled until the kernel stack pointer can be officially switched
args.int_state = int_disable_interrupts();
args.int_state = disable_interrupts();
// set the new kernel stack officially to the death stack, wont be really switched until
// the next function is called. This bookkeeping must be done now before a context switch
@@ -1253,7 +1253,7 @@ static int _thread_kill_thread(thread_id id, bool wait_on)
// dprintf("_thread_kill_thread: id %d, wait_on %d\n", id, wait_on);
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_thread_struct_locked(id);
@@ -1272,7 +1272,7 @@ static int _thread_kill_thread(thread_id id, bool wait_on)
}
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if(rc < 0)
return rc;
@@ -1321,7 +1321,7 @@ int thread_wait_on_thread(thread_id id, int *retcode)
struct thread *t;
int rc;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_thread_struct_locked(id);
@@ -1332,7 +1332,7 @@ int thread_wait_on_thread(thread_id id, int *retcode)
}
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
rc = acquire_sem(sem);
@@ -1341,14 +1341,14 @@ int thread_wait_on_thread(thread_id id, int *retcode)
rc = B_NO_ERROR;
if (retcode) {
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_current_thread();
dprintf("thread_wait_on_thread: thread %d got return code 0x%x\n",
t->id, t->sem_deleted_retcode);
*retcode = t->sem_deleted_retcode;
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
}
}
@@ -1380,7 +1380,7 @@ int proc_wait_on_proc(proc_id id, int *retcode)
thread_id tid;
int state;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
p = proc_get_proc_struct_locked(id);
if(p && p->main_thread) {
@@ -1389,7 +1389,7 @@ int proc_wait_on_proc(proc_id id, int *retcode)
tid = ERR_INVALID_HANDLE;
}
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if(tid < 0)
return tid;
@@ -1402,13 +1402,13 @@ struct thread *thread_get_thread_struct(thread_id id)
struct thread *t;
int state;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
t = thread_get_thread_struct_locked(id);
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return t;
}
@@ -1428,13 +1428,13 @@ static struct proc *proc_get_proc_struct(proc_id id)
struct proc *p;
int state;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
p = proc_get_proc_struct_locked(id);
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return p;
}
@@ -1770,11 +1770,11 @@ proc_id proc_create_proc(const char *path, const char *name, char **args, int ar
pid = p->id;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
hash_insert(proc_hash, p);
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
// copy the args over
pargs = (struct proc_arg *)kmalloc(sizeof(struct proc_arg));
@@ -1831,11 +1831,11 @@ err2:
kfree(pargs);
err1:
// remove the proc structure from the proc hash table and delete the proc structure
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
hash_remove(proc_hash, p);
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
delete_proc_struct(p);
//err:
return err;
@@ -1901,7 +1901,7 @@ int user_proc_get_table(struct proc_info *pbuf, size_t len)
if((addr)pbuf >= KERNEL_BASE && (addr)pbuf <= KERNEL_TOP)
return ERR_VM_BAD_USER_MEMORY;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
hash_open(proc_hash, &i);
@@ -1917,7 +1917,7 @@ int user_proc_get_table(struct proc_info *pbuf, size_t len)
hash_close(proc_hash, &i, false);
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if (count < max)
return count;
@@ -1934,7 +1934,7 @@ int proc_kill_proc(proc_id id)
thread_id tid = -1;
int retval = 0;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
p = proc_get_proc_struct_locked(id);
@@ -1945,7 +1945,7 @@ int proc_kill_proc(proc_id id)
}
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
if(retval < 0)
return retval;
@@ -1991,7 +1991,7 @@ static void _check_for_thread_sigs(struct thread *t, int state)
t->pending_signals &= ~SIG_KILL;
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
thread_exit(0);
// never gets to here
}
@@ -2014,7 +2014,7 @@ void thread_atkernel_entry(void)
t = thread_get_current_thread();
state = int_disable_interrupts();
state = disable_interrupts();
// track user time
now = system_time();
@@ -2028,7 +2028,7 @@ void thread_atkernel_entry(void)
_check_for_thread_sigs(t, state);
RELEASE_THREAD_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
}
// called when a thread exits kernel space to user space
@@ -2042,7 +2042,7 @@ void thread_atkernel_exit(void)
t = thread_get_current_thread();
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_THREAD_LOCK();
_check_for_thread_sigs(t, state);
@@ -2056,7 +2056,7 @@ void thread_atkernel_exit(void)
t->kernel_time += now - t->last_time;
t->last_time = now;
int_restore_interrupts(state);
restore_interrupts(state);
}
int user_getrlimit(int resource, struct rlimit * urlp)
@@ -2183,7 +2183,7 @@ int sys_setenv(const char *name, const char *value, int overwrite)
if (strlen(name) + strlen(value) + 1 >= SYS_THREAD_STRING_LENGTH_MAX)
return -1;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
strcpy(var, name);
@@ -2241,7 +2241,7 @@ int sys_setenv(const char *name, const char *value, int overwrite)
dprintf("sys_setenv: variable set.\n");
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return rc;
}
@@ -2283,7 +2283,7 @@ int sys_getenv(const char *name, char **value)
int len = strlen(name);
int rc = -1;
state = int_disable_interrupts();
state = disable_interrupts();
GRAB_PROC_LOCK();
envp = (char **)thread_get_current_thread()->proc->user_env_base;
@@ -2299,7 +2299,7 @@ int sys_getenv(const char *name, char **value)
}
RELEASE_PROC_LOCK();
int_restore_interrupts(state);
restore_interrupts(state);
return rc;
}
+4 -4
View File
@@ -132,7 +132,7 @@ status_t add_timer(timer *t, timer_hook hook, bigtime_t period, int32 flags)
t->hook = hook;
t->flags = flags;
state = int_disable_interrupts();
state = disable_interrupts();
curr_cpu = smp_get_current_cpu();
acquire_spinlock(&timer_spinlock[curr_cpu]);
@@ -144,7 +144,7 @@ status_t add_timer(timer *t, timer_hook hook, bigtime_t period, int32 flags)
arch_timer_set_hardware_timer(sched_time - curr_time);
release_spinlock(&timer_spinlock[curr_cpu]);
int_restore_interrupts(state);
restore_interrupts(state);
return B_OK;
}
@@ -201,7 +201,7 @@ bool cancel_timer(timer *event)
// if (event->sched_time == 0)
// return 0; // it's not scheduled
state = int_disable_interrupts();
state = disable_interrupts();
curr_cpu = smp_get_current_cpu();
// walk through all of the cpu's timer queues
@@ -237,7 +237,7 @@ done:
if (foundit)
release_spinlock(&timer_spinlock[cpu]);
int_restore_interrupts(state);
restore_interrupts(state);
if (foundit && ((bigtime_t)event->entry.key < system_time()))
return true;
+5 -5
View File
@@ -361,12 +361,12 @@ static int map_backing_store(vm_address_space *aspace, vm_store *store,
off_t commitment = (store->ops->commit)(store, offset + size); // Commit through to the new end
if(commitment < offset + size) { // Uh oh - didn't work
if(cache->temporary) { // If this is a temporary cache, Check to see if we ran out of space and return error.
int state = int_disable_interrupts();
int state = disable_interrupts();
acquire_spinlock(&max_commit_lock);
if (max_commit - old_store_commitment + commitment < offset + size) {
release_spinlock(&max_commit_lock);
int_restore_interrupts(state);
restore_interrupts(state);
mutex_unlock(&cache_ref->lock);
err = ERR_VM_WOULD_OVERCOMMIT;
goto err1a;
@@ -375,7 +375,7 @@ static int map_backing_store(vm_address_space *aspace, vm_store *store,
max_commit += (commitment - old_store_commitment) - (offset + size - cache->virtual_size);
cache->virtual_size = offset + size;
release_spinlock(&max_commit_lock);
int_restore_interrupts(state);
restore_interrupts(state);
} else {
mutex_unlock(&cache_ref->lock);
err = ENOMEM;
@@ -2158,11 +2158,11 @@ void vm_increase_max_commit(addr delta)
// dprintf("vm_increase_max_commit: delta 0x%x\n", delta);
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&max_commit_lock);
max_commit += delta;
release_spinlock(&max_commit_lock);
int_restore_interrupts(state);
restore_interrupts(state);
}
int user_memcpy(void *to, const void *from, size_t size)
+8 -8
View File
@@ -150,13 +150,13 @@ void vm_cache_release_ref(vm_cache_ref *cache_ref)
page = page->cache_next;
// remove it from the hash table
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_cache_table_lock);
hash_remove(page_cache_table, old_page);
release_spinlock(&page_cache_table_lock);
int_restore_interrupts(state);
restore_interrupts(state);
// dprintf("vm_cache_release_ref: freeing page 0x%x\n", old_page->ppn);
vm_page_set_state(old_page, PAGE_STATE_FREE);
@@ -187,13 +187,13 @@ vm_page *vm_cache_lookup_page(vm_cache_ref *cache_ref, off_t offset)
key.offset = offset;
key.ref = cache_ref;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_cache_table_lock);
page = hash_lookup(page_cache_table, &key);
release_spinlock(&page_cache_table_lock);
int_restore_interrupts(state);
restore_interrupts(state);
return page;
}
@@ -215,13 +215,13 @@ void vm_cache_insert_page(vm_cache_ref *cache_ref, vm_page *page, off_t offset)
page->cache_ref = cache_ref;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_cache_table_lock);
hash_insert(page_cache_table, page);
release_spinlock(&page_cache_table_lock);
int_restore_interrupts(state);
restore_interrupts(state);
}
@@ -231,13 +231,13 @@ void vm_cache_remove_page(vm_cache_ref *cache_ref, vm_page *page)
// dprintf("vm_cache_remove_page: cache 0x%x, page 0x%x\n", cache_ref, page);
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_cache_table_lock);
hash_remove(page_cache_table, page);
release_spinlock(&page_cache_table_lock);
int_restore_interrupts(state);
restore_interrupts(state);
if(cache_ref->cache->page_list == page) {
if(page->cache_next != NULL)
+20 -20
View File
@@ -117,25 +117,25 @@ static int pageout_daemon()
dprintf("here\n");
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
page = dequeue_page(&page_modified_queue);
page->state = PAGE_STATE_BUSY;
vm_cache_acquire_ref(page->cache_ref, true);
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
dprintf("got page %p\n", page);
if(page->cache_ref->cache->temporary && !trimming_cycle) {
// unless we're in the trimming cycle, dont write out pages
// that back anonymous stores
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
enqueue_page(&page_modified_queue, page);
page->state = PAGE_STATE_MODIFIED;
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
vm_cache_release_ref(page->cache_ref);
continue;
}
@@ -163,7 +163,7 @@ static int pageout_daemon()
vm_put_physical_page((addr)vecs->vec[0].iov_base);
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
if(page->ref_count > 0) {
page->state = PAGE_STATE_ACTIVE;
@@ -172,7 +172,7 @@ static int pageout_daemon()
}
enqueue_page(&page_active_queue, page);
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
vm_cache_release_ref(page->cache_ref);
}
@@ -291,7 +291,7 @@ static int page_scrubber(void *unused)
thread_snooze(100000); // 100ms
if(page_free_queue.count > 0) {
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
for(i=0; i<SCRUB_SIZE; i++) {
@@ -301,7 +301,7 @@ static int page_scrubber(void *unused)
}
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
scrub_count = i;
@@ -309,7 +309,7 @@ static int page_scrubber(void *unused)
clear_page(page[i]->ppn * PAGE_SIZE);
}
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
for(i=0; i<scrub_count; i++) {
@@ -318,7 +318,7 @@ static int page_scrubber(void *unused)
}
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
}
}
@@ -362,7 +362,7 @@ int vm_mark_page_range_inuse(addr start_page, addr len)
return EINVAL;
}
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
for(i = 0; i < len; i++) {
@@ -386,7 +386,7 @@ int vm_mark_page_range_inuse(addr start_page, addr len)
}
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
return i;
}
@@ -397,7 +397,7 @@ vm_page *vm_page_allocate_specific_page(addr page_num, int page_state)
int old_page_state = PAGE_STATE_BUSY;
int state;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
p = vm_lookup_page(page_num);
@@ -428,7 +428,7 @@ vm_page *vm_page_allocate_specific_page(addr page_num, int page_state)
out:
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
if(p != NULL && page_state == PAGE_STATE_CLEAR &&
(old_page_state == PAGE_STATE_FREE || old_page_state == PAGE_STATE_UNUSED)) {
@@ -460,7 +460,7 @@ vm_page *vm_page_allocate_page(int page_state)
return NULL; // invalid
}
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
p = dequeue_page(q);
@@ -479,7 +479,7 @@ vm_page *vm_page_allocate_page(int page_state)
enqueue_page(&page_active_queue, p);
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
if(page_state == PAGE_STATE_CLEAR && old_page_state == PAGE_STATE_FREE) {
clear_page(p->ppn * PAGE_SIZE);
@@ -497,7 +497,7 @@ vm_page *vm_page_allocate_page_run(int page_state, addr len)
start = 0;
state = int_disable_interrupts();
state = disable_interrupts();
acquire_spinlock(&page_lock);
for(;;) {
@@ -528,7 +528,7 @@ vm_page *vm_page_allocate_page_run(int page_state, addr len)
}
}
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
return first_page;
}
@@ -599,13 +599,13 @@ static int vm_page_set_state_nolock(vm_page *page, int page_state)
int vm_page_set_state(vm_page *page, int page_state)
{
int err;
int state = int_disable_interrupts();
int state = disable_interrupts();
acquire_spinlock(&page_lock);
err = vm_page_set_state_nolock(page, page_state);
release_spinlock(&page_lock);
int_restore_interrupts(state);
restore_interrupts(state);
return err;
}