Skip to content

Commit 3f15a1b

Browse files
committed
修改锁为 rt_spinlock
1 parent 9094953 commit 3f15a1b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

components/lwp/arch/common/vdso_kernel.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static union
5353
uint8_t raw[RT_VDSO_DATA_PAGE_COUNT * ARCH_PAGE_SIZE];
5454
} rt_vdso_data_page_store RT_VDSO_DATA_PAGE_ALIGNED;
5555
struct rt_vdso_data_page *rt_vdso_kernel_data_page = &rt_vdso_data_page_store.data_page;
56-
RT_DEFINE_HW_SPINLOCK(rt_vdso_data_page_lock);
56+
static struct rt_spinlock rt_vdso_data_page_lock;
5757
static int rt_vdso_runtime_status = RT_EOK;
5858

5959
static struct timespec rt_vdso_realtime_offset;
@@ -203,7 +203,7 @@ void rt_vdso_set_realtime(const struct timespec *realtime)
203203
struct timespec monotonic;
204204
rt_uint64_t counter;
205205
rt_uint64_t freq;
206-
206+
rt_base_t level;
207207
if (rt_vdso_runtime_status != RT_EOK || realtime == RT_NULL)
208208
{
209209
return;
@@ -214,13 +214,13 @@ void rt_vdso_set_realtime(const struct timespec *realtime)
214214
return;
215215
}
216216

217-
rt_hw_spin_lock(&rt_vdso_data_page_lock);
217+
level = rt_spin_lock_irqsave(&rt_vdso_data_page_lock);
218218
rt_vdso_data_page_write_begin(rt_vdso_kernel_data_page);
219219
rt_vdso_realtime_offset = rt_vdso_timespec_subtract(realtime, &monotonic);
220220
rt_vdso_realtime_offset_ready = RT_TRUE;
221221
rt_vdso_store_clock_snapshot(&monotonic, counter, freq);
222222
rt_vdso_data_page_write_end(rt_vdso_kernel_data_page);
223-
rt_hw_spin_unlock(&rt_vdso_data_page_lock);
223+
rt_spin_unlock_irqrestore(&rt_vdso_data_page_lock, level);
224224
}
225225

226226
static void *rt_vdso_map_physical_pages(struct rt_lwp *lwp, void *user_va,
@@ -337,11 +337,11 @@ void rt_vdso_sync_clock_data(void)
337337
return;
338338
}
339339

340-
rt_hw_spin_lock(&rt_vdso_data_page_lock);
340+
rt_spin_lock(&rt_vdso_data_page_lock);
341341
rt_vdso_data_page_write_begin(rt_vdso_kernel_data_page);
342342
rt_vdso_store_clock_snapshot(&monotonic, counter, freq);
343343
rt_vdso_data_page_write_end(rt_vdso_kernel_data_page);
344-
rt_hw_spin_unlock(&rt_vdso_data_page_lock);
344+
rt_spin_unlock(&rt_vdso_data_page_lock);
345345
}
346346

347347
static int rt_vdso_validate_elf_header(const void *image)

0 commit comments

Comments
 (0)