mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
nuttx/binfmt: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* binfmt/binfmt_execsymtab.c
|
* binfmt/binfmt_execsymtab.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/binfmt/symtab.h>
|
#include <nuttx/binfmt/symtab.h>
|
||||||
|
|
||||||
@@ -116,10 +117,10 @@ void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols)
|
|||||||
* size are returned as a single atomic operation.
|
* size are returned as a single atomic operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
*symtab = g_exec_symtab;
|
*symtab = g_exec_symtab;
|
||||||
*nsymbols = g_exec_nsymbols;
|
*nsymbols = g_exec_nsymbols;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -147,10 +148,10 @@ void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols)
|
|||||||
* size are set as a single atomic operation.
|
* size are set as a single atomic operation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
g_exec_symtab = symtab;
|
g_exec_symtab = symtab;
|
||||||
g_exec_nsymbols = nsymbols;
|
g_exec_nsymbols = nsymbols;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_LIBC_EXECFUNCS */
|
#endif /* CONFIG_LIBC_EXECFUNCS */
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* binfmt/binfmt_schedunload.c
|
* binfmt/binfmt_schedunload.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/binfmt/binfmt.h>
|
#include <nuttx/binfmt/binfmt.h>
|
||||||
|
|
||||||
@@ -105,10 +106,10 @@ static void unload_list_add(pid_t pid, FAR struct binary_s *bin)
|
|||||||
* interrupts.
|
* interrupts.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
bin->flink = g_unloadhead;
|
bin->flink = g_unloadhead;
|
||||||
g_unloadhead = bin;
|
g_unloadhead = bin;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -313,13 +314,13 @@ int schedule_unload(pid_t pid, FAR struct binary_s *bin)
|
|||||||
|
|
||||||
/* Emergency removal from the list */
|
/* Emergency removal from the list */
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
if (unload_list_remove(pid) != bin)
|
if (unload_list_remove(pid) != bin)
|
||||||
{
|
{
|
||||||
blldbg("ERROR: Failed to remove structure\n");
|
blldbg("ERROR: Failed to remove structure\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user