.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
---|
3 | | - * Licensed under the GPL |
---|
4 | 4 | */ |
---|
5 | 5 | |
---|
6 | 6 | #include <linux/delay.h> |
---|
.. | .. |
---|
13 | 13 | #include <linux/sched.h> |
---|
14 | 14 | #include <linux/sched/task.h> |
---|
15 | 15 | #include <linux/kmsg_dump.h> |
---|
| 16 | +#include <linux/suspend.h> |
---|
16 | 17 | |
---|
17 | | -#include <asm/pgtable.h> |
---|
18 | 18 | #include <asm/processor.h> |
---|
19 | 19 | #include <asm/sections.h> |
---|
20 | 20 | #include <asm/setup.h> |
---|
.. | .. |
---|
53 | 53 | }; |
---|
54 | 54 | |
---|
55 | 55 | union thread_union cpu0_irqstack |
---|
56 | | - __attribute__((__section__(".data..init_irqstack"))) = |
---|
| 56 | + __section(".data..init_irqstack") = |
---|
57 | 57 | { .thread_info = INIT_THREAD_INFO(init_task) }; |
---|
58 | 58 | |
---|
59 | 59 | /* Changed in setup_arch, which is called in early boot */ |
---|
.. | .. |
---|
77 | 77 | |
---|
78 | 78 | static void *c_start(struct seq_file *m, loff_t *pos) |
---|
79 | 79 | { |
---|
80 | | - return *pos < NR_CPUS ? cpu_data + *pos : NULL; |
---|
| 80 | + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; |
---|
81 | 81 | } |
---|
82 | 82 | |
---|
83 | 83 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
---|
.. | .. |
---|
113 | 113 | |
---|
114 | 114 | /* Set in uml_mem_setup and modified in linux_main */ |
---|
115 | 115 | long long physmem_size = 32 * 1024 * 1024; |
---|
| 116 | +EXPORT_SYMBOL(physmem_size); |
---|
116 | 117 | |
---|
117 | 118 | static const char *usage_string = |
---|
118 | 119 | "User Mode Linux v%s\n" |
---|
.. | .. |
---|
358 | 359 | os_check_bugs(); |
---|
359 | 360 | } |
---|
360 | 361 | |
---|
| 362 | +void apply_retpolines(s32 *start, s32 *end) |
---|
| 363 | +{ |
---|
| 364 | +} |
---|
| 365 | + |
---|
| 366 | +void apply_returns(s32 *start, s32 *end) |
---|
| 367 | +{ |
---|
| 368 | +} |
---|
| 369 | + |
---|
361 | 370 | void apply_alternatives(struct alt_instr *start, struct alt_instr *end) |
---|
362 | 371 | { |
---|
363 | 372 | } |
---|
| 373 | + |
---|
| 374 | +void *text_poke(void *addr, const void *opcode, size_t len) |
---|
| 375 | +{ |
---|
| 376 | + /* |
---|
| 377 | + * In UML, the only reference to this function is in |
---|
| 378 | + * apply_relocate_add(), which shouldn't ever actually call this |
---|
| 379 | + * because UML doesn't have live patching. |
---|
| 380 | + */ |
---|
| 381 | + WARN_ON(1); |
---|
| 382 | + |
---|
| 383 | + return memcpy(addr, opcode, len); |
---|
| 384 | +} |
---|
| 385 | + |
---|
| 386 | +void text_poke_sync(void) |
---|
| 387 | +{ |
---|
| 388 | +} |
---|
| 389 | + |
---|
| 390 | +#ifdef CONFIG_PM_SLEEP |
---|
| 391 | +void uml_pm_wake(void) |
---|
| 392 | +{ |
---|
| 393 | + pm_system_wakeup(); |
---|
| 394 | +} |
---|
| 395 | + |
---|
| 396 | +static int init_pm_wake_signal(void) |
---|
| 397 | +{ |
---|
| 398 | + /* |
---|
| 399 | + * In external time-travel mode we can't use signals to wake up |
---|
| 400 | + * since that would mess with the scheduling. We'll have to do |
---|
| 401 | + * some additional work to support wakeup on virtio devices or |
---|
| 402 | + * similar, perhaps implementing a fake RTC controller that can |
---|
| 403 | + * trigger wakeup (and request the appropriate scheduling from |
---|
| 404 | + * the external scheduler when going to suspend.) |
---|
| 405 | + */ |
---|
| 406 | + if (time_travel_mode != TT_MODE_EXTERNAL) |
---|
| 407 | + register_pm_wake_signal(); |
---|
| 408 | + return 0; |
---|
| 409 | +} |
---|
| 410 | + |
---|
| 411 | +late_initcall(init_pm_wake_signal); |
---|
| 412 | +#endif |
---|