diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2011-08-03 10:44:19 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-08-03 10:44:19 -0400 |
commit | 7dd6b3343fdc190712d1620ee8848d25c4c77c33 (patch) | |
tree | e4c3258880f88096f9ecf65fa2cca20e62b5813d /arch | |
parent | 944291de33b26a8b403f13f5eb0cc51fb982aa1e (diff) |
[S390] Add PSW restart shutdown trigger
With this patch a new S390 shutdown trigger "restart" is added. If under
z/VM "systerm restart" is entered or under the HMC the "PSW restart" button
is pressed, the PSW located at 0 (31 bit) or 0x1a0 (64 bit) bit is loaded.
Now we execute do_restart() that processes the restart action that is
defined under /sys/firmware/shutdown_actions/on_restart. Currently the
following actions are possible: reipl (default), stop, vmcmd, dump, and
dump_reipl.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/include/asm/lowcore.h | 11 | ||||
-rw-r--r-- | arch/s390/include/asm/system.h | 1 | ||||
-rw-r--r-- | arch/s390/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/s390/kernel/entry.S | 28 | ||||
-rw-r--r-- | arch/s390/kernel/entry64.S | 20 | ||||
-rw-r--r-- | arch/s390/kernel/ipl.c | 39 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 24 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 11 | ||||
-rw-r--r-- | arch/s390/mm/maccess.c | 16 |
9 files changed, 146 insertions, 5 deletions
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index f26280d9e88d..e85c911aabf0 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h | |||
@@ -18,6 +18,7 @@ void system_call(void); | |||
18 | void pgm_check_handler(void); | 18 | void pgm_check_handler(void); |
19 | void mcck_int_handler(void); | 19 | void mcck_int_handler(void); |
20 | void io_int_handler(void); | 20 | void io_int_handler(void); |
21 | void psw_restart_int_handler(void); | ||
21 | 22 | ||
22 | #ifdef CONFIG_32BIT | 23 | #ifdef CONFIG_32BIT |
23 | 24 | ||
@@ -150,7 +151,10 @@ struct _lowcore { | |||
150 | */ | 151 | */ |
151 | __u32 ipib; /* 0x0e00 */ | 152 | __u32 ipib; /* 0x0e00 */ |
152 | __u32 ipib_checksum; /* 0x0e04 */ | 153 | __u32 ipib_checksum; /* 0x0e04 */ |
153 | __u8 pad_0x0e08[0x0f00-0x0e08]; /* 0x0e08 */ | 154 | |
155 | /* 64 bit save area */ | ||
156 | __u64 save_area_64; /* 0x0e08 */ | ||
157 | __u8 pad_0x0e10[0x0f00-0x0e10]; /* 0x0e10 */ | ||
154 | 158 | ||
155 | /* Extended facility list */ | 159 | /* Extended facility list */ |
156 | __u64 stfle_fac_list[32]; /* 0x0f00 */ | 160 | __u64 stfle_fac_list[32]; /* 0x0f00 */ |
@@ -286,7 +290,10 @@ struct _lowcore { | |||
286 | */ | 290 | */ |
287 | __u64 ipib; /* 0x0e00 */ | 291 | __u64 ipib; /* 0x0e00 */ |
288 | __u32 ipib_checksum; /* 0x0e08 */ | 292 | __u32 ipib_checksum; /* 0x0e08 */ |
289 | __u8 pad_0x0e0c[0x0f00-0x0e0c]; /* 0x0e0c */ | 293 | |
294 | /* 64 bit save area */ | ||
295 | __u64 save_area_64; /* 0x0e0c */ | ||
296 | __u8 pad_0x0e14[0x0f00-0x0e14]; /* 0x0e14 */ | ||
290 | 297 | ||
291 | /* Extended facility list */ | 298 | /* Extended facility list */ |
292 | __u64 stfle_fac_list[32]; /* 0x0f00 */ | 299 | __u64 stfle_fac_list[32]; /* 0x0f00 */ |
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h index d382629a0172..6582f69f2389 100644 --- a/arch/s390/include/asm/system.h +++ b/arch/s390/include/asm/system.h | |||
@@ -113,6 +113,7 @@ extern void pfault_fini(void); | |||
113 | 113 | ||
114 | extern void cmma_init(void); | 114 | extern void cmma_init(void); |
115 | extern int memcpy_real(void *, void *, size_t); | 115 | extern int memcpy_real(void *, void *, size_t); |
116 | extern void copy_to_absolute_zero(void *dest, void *src, size_t count); | ||
116 | 117 | ||
117 | #define finish_arch_switch(prev) do { \ | 118 | #define finish_arch_switch(prev) do { \ |
118 | set_fs(current->thread.mm_segment); \ | 119 | set_fs(current->thread.mm_segment); \ |
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index 05d8f38734ec..199a537d4f36 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c | |||
@@ -142,6 +142,7 @@ int main(void) | |||
142 | DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area)); | 142 | DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area)); |
143 | DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area)); | 143 | DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area)); |
144 | DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area)); | 144 | DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area)); |
145 | DEFINE(__LC_SAVE_AREA_64, offsetof(struct _lowcore, save_area_64)); | ||
145 | #ifdef CONFIG_32BIT | 146 | #ifdef CONFIG_32BIT |
146 | DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr)); | 147 | DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr)); |
147 | #else /* CONFIG_32BIT */ | 148 | #else /* CONFIG_32BIT */ |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 3eab7cfab07c..02ec8fe7d03f 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -849,6 +849,34 @@ restart_crash: | |||
849 | restart_go: | 849 | restart_go: |
850 | #endif | 850 | #endif |
851 | 851 | ||
852 | # | ||
853 | # PSW restart interrupt handler | ||
854 | # | ||
855 | ENTRY(psw_restart_int_handler) | ||
856 | st %r15,__LC_SAVE_AREA_64(%r0) # save r15 | ||
857 | basr %r15,0 | ||
858 | 0: l %r15,.Lrestart_stack-0b(%r15) # load restart stack | ||
859 | l %r15,0(%r15) | ||
860 | ahi %r15,-SP_SIZE # make room for pt_regs | ||
861 | stm %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack | ||
862 | mvc SP_R15(4,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack | ||
863 | mvc SP_PSW(8,%r15),__LC_RST_OLD_PSW(%r0) # store restart old psw | ||
864 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0 | ||
865 | basr %r14,0 | ||
866 | 1: l %r14,.Ldo_restart-1b(%r14) | ||
867 | basr %r14,%r14 | ||
868 | |||
869 | basr %r14,0 # load disabled wait PSW if | ||
870 | 2: lpsw restart_psw_crash-2b(%r14) # do_restart returns | ||
871 | .align 4 | ||
872 | .Ldo_restart: | ||
873 | .long do_restart | ||
874 | .Lrestart_stack: | ||
875 | .long restart_stack | ||
876 | .align 8 | ||
877 | restart_psw_crash: | ||
878 | .long 0x000a0000,0x00000000 + restart_psw_crash | ||
879 | |||
852 | .section .kprobes.text, "ax" | 880 | .section .kprobes.text, "ax" |
853 | 881 | ||
854 | #ifdef CONFIG_CHECK_STACK | 882 | #ifdef CONFIG_CHECK_STACK |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 7a0fd426ca92..5f729d627cef 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -865,6 +865,26 @@ restart_crash: | |||
865 | restart_go: | 865 | restart_go: |
866 | #endif | 866 | #endif |
867 | 867 | ||
868 | # | ||
869 | # PSW restart interrupt handler | ||
870 | # | ||
871 | ENTRY(psw_restart_int_handler) | ||
872 | stg %r15,__LC_SAVE_AREA_64(%r0) # save r15 | ||
873 | larl %r15,restart_stack # load restart stack | ||
874 | lg %r15,0(%r15) | ||
875 | aghi %r15,-SP_SIZE # make room for pt_regs | ||
876 | stmg %r0,%r14,SP_R0(%r15) # store gprs %r0-%r14 to stack | ||
877 | mvc SP_R15(8,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack | ||
878 | mvc SP_PSW(16,%r15),__LC_RST_OLD_PSW(%r0)# store restart old psw | ||
879 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0 | ||
880 | brasl %r14,do_restart | ||
881 | |||
882 | larl %r14,restart_psw_crash # load disabled wait PSW if | ||
883 | lpswe 0(%r14) # do_restart returns | ||
884 | .align 8 | ||
885 | restart_psw_crash: | ||
886 | .quad 0x0002000080000000,0x0000000000000000 + restart_psw_crash | ||
887 | |||
868 | .section .kprobes.text, "ax" | 888 | .section .kprobes.text, "ax" |
869 | 889 | ||
870 | #ifdef CONFIG_CHECK_STACK | 890 | #ifdef CONFIG_CHECK_STACK |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index a689070be287..059c59027ac0 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -45,11 +45,13 @@ | |||
45 | * - halt | 45 | * - halt |
46 | * - power off | 46 | * - power off |
47 | * - reipl | 47 | * - reipl |
48 | * - restart | ||
48 | */ | 49 | */ |
49 | #define ON_PANIC_STR "on_panic" | 50 | #define ON_PANIC_STR "on_panic" |
50 | #define ON_HALT_STR "on_halt" | 51 | #define ON_HALT_STR "on_halt" |
51 | #define ON_POFF_STR "on_poff" | 52 | #define ON_POFF_STR "on_poff" |
52 | #define ON_REIPL_STR "on_reboot" | 53 | #define ON_REIPL_STR "on_reboot" |
54 | #define ON_RESTART_STR "on_restart" | ||
53 | 55 | ||
54 | struct shutdown_action; | 56 | struct shutdown_action; |
55 | struct shutdown_trigger { | 57 | struct shutdown_trigger { |
@@ -1544,17 +1546,20 @@ static char vmcmd_on_reboot[128]; | |||
1544 | static char vmcmd_on_panic[128]; | 1546 | static char vmcmd_on_panic[128]; |
1545 | static char vmcmd_on_halt[128]; | 1547 | static char vmcmd_on_halt[128]; |
1546 | static char vmcmd_on_poff[128]; | 1548 | static char vmcmd_on_poff[128]; |
1549 | static char vmcmd_on_restart[128]; | ||
1547 | 1550 | ||
1548 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot); | 1551 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot); |
1549 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic); | 1552 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic); |
1550 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt); | 1553 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt); |
1551 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff); | 1554 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff); |
1555 | DEFINE_IPL_ATTR_STR_RW(vmcmd, on_restart, "%s\n", "%s\n", vmcmd_on_restart); | ||
1552 | 1556 | ||
1553 | static struct attribute *vmcmd_attrs[] = { | 1557 | static struct attribute *vmcmd_attrs[] = { |
1554 | &sys_vmcmd_on_reboot_attr.attr, | 1558 | &sys_vmcmd_on_reboot_attr.attr, |
1555 | &sys_vmcmd_on_panic_attr.attr, | 1559 | &sys_vmcmd_on_panic_attr.attr, |
1556 | &sys_vmcmd_on_halt_attr.attr, | 1560 | &sys_vmcmd_on_halt_attr.attr, |
1557 | &sys_vmcmd_on_poff_attr.attr, | 1561 | &sys_vmcmd_on_poff_attr.attr, |
1562 | &sys_vmcmd_on_restart_attr.attr, | ||
1558 | NULL, | 1563 | NULL, |
1559 | }; | 1564 | }; |
1560 | 1565 | ||
@@ -1576,6 +1581,8 @@ static void vmcmd_run(struct shutdown_trigger *trigger) | |||
1576 | cmd = vmcmd_on_halt; | 1581 | cmd = vmcmd_on_halt; |
1577 | else if (strcmp(trigger->name, ON_POFF_STR) == 0) | 1582 | else if (strcmp(trigger->name, ON_POFF_STR) == 0) |
1578 | cmd = vmcmd_on_poff; | 1583 | cmd = vmcmd_on_poff; |
1584 | else if (strcmp(trigger->name, ON_RESTART_STR) == 0) | ||
1585 | cmd = vmcmd_on_restart; | ||
1579 | else | 1586 | else |
1580 | return; | 1587 | return; |
1581 | 1588 | ||
@@ -1707,6 +1714,34 @@ static void do_panic(void) | |||
1707 | stop_run(&on_panic_trigger); | 1714 | stop_run(&on_panic_trigger); |
1708 | } | 1715 | } |
1709 | 1716 | ||
1717 | /* on restart */ | ||
1718 | |||
1719 | static struct shutdown_trigger on_restart_trigger = {ON_RESTART_STR, | ||
1720 | &reipl_action}; | ||
1721 | |||
1722 | static ssize_t on_restart_show(struct kobject *kobj, | ||
1723 | struct kobj_attribute *attr, char *page) | ||
1724 | { | ||
1725 | return sprintf(page, "%s\n", on_restart_trigger.action->name); | ||
1726 | } | ||
1727 | |||
1728 | static ssize_t on_restart_store(struct kobject *kobj, | ||
1729 | struct kobj_attribute *attr, | ||
1730 | const char *buf, size_t len) | ||
1731 | { | ||
1732 | return set_trigger(buf, &on_restart_trigger, len); | ||
1733 | } | ||
1734 | |||
1735 | static struct kobj_attribute on_restart_attr = | ||
1736 | __ATTR(on_restart, 0644, on_restart_show, on_restart_store); | ||
1737 | |||
1738 | void do_restart(void) | ||
1739 | { | ||
1740 | smp_send_stop(); | ||
1741 | on_restart_trigger.action->fn(&on_restart_trigger); | ||
1742 | stop_run(&on_restart_trigger); | ||
1743 | } | ||
1744 | |||
1710 | /* on halt */ | 1745 | /* on halt */ |
1711 | 1746 | ||
1712 | static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action}; | 1747 | static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action}; |
@@ -1783,7 +1818,9 @@ static void __init shutdown_triggers_init(void) | |||
1783 | if (sysfs_create_file(&shutdown_actions_kset->kobj, | 1818 | if (sysfs_create_file(&shutdown_actions_kset->kobj, |
1784 | &on_poff_attr.attr)) | 1819 | &on_poff_attr.attr)) |
1785 | goto fail; | 1820 | goto fail; |
1786 | 1821 | if (sysfs_create_file(&shutdown_actions_kset->kobj, | |
1822 | &on_restart_attr.attr)) | ||
1823 | goto fail; | ||
1787 | return; | 1824 | return; |
1788 | fail: | 1825 | fail: |
1789 | panic("shutdown_triggers_init failed\n"); | 1826 | panic("shutdown_triggers_init failed\n"); |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 0c35dee10b00..18640ff0aa1a 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -346,7 +346,7 @@ setup_lowcore(void) | |||
346 | lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); | 346 | lc = __alloc_bootmem_low(LC_PAGES * PAGE_SIZE, LC_PAGES * PAGE_SIZE, 0); |
347 | lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | 347 | lc->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; |
348 | lc->restart_psw.addr = | 348 | lc->restart_psw.addr = |
349 | PSW_ADDR_AMODE | (unsigned long) restart_int_handler; | 349 | PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; |
350 | if (user_mode != HOME_SPACE_MODE) | 350 | if (user_mode != HOME_SPACE_MODE) |
351 | lc->restart_psw.mask |= PSW_ASC_HOME; | 351 | lc->restart_psw.mask |= PSW_ASC_HOME; |
352 | lc->external_new_psw.mask = psw_kernel_bits; | 352 | lc->external_new_psw.mask = psw_kernel_bits; |
@@ -529,6 +529,27 @@ static void __init setup_memory_end(void) | |||
529 | memory_end = memory_size; | 529 | memory_end = memory_size; |
530 | } | 530 | } |
531 | 531 | ||
532 | void *restart_stack __attribute__((__section__(".data"))); | ||
533 | |||
534 | /* | ||
535 | * Setup new PSW and allocate stack for PSW restart interrupt | ||
536 | */ | ||
537 | static void __init setup_restart_psw(void) | ||
538 | { | ||
539 | psw_t psw; | ||
540 | |||
541 | restart_stack = __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0); | ||
542 | restart_stack += ASYNC_SIZE; | ||
543 | |||
544 | /* | ||
545 | * Setup restart PSW for absolute zero lowcore. This is necesary | ||
546 | * if PSW restart is done on an offline CPU that has lowcore zero | ||
547 | */ | ||
548 | psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | ||
549 | psw.addr = PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; | ||
550 | copy_to_absolute_zero(&S390_lowcore.restart_psw, &psw, sizeof(psw)); | ||
551 | } | ||
552 | |||
532 | static void __init | 553 | static void __init |
533 | setup_memory(void) | 554 | setup_memory(void) |
534 | { | 555 | { |
@@ -792,6 +813,7 @@ setup_arch(char **cmdline_p) | |||
792 | setup_addressing_mode(); | 813 | setup_addressing_mode(); |
793 | setup_memory(); | 814 | setup_memory(); |
794 | setup_resources(); | 815 | setup_resources(); |
816 | setup_restart_psw(); | ||
795 | setup_lowcore(); | 817 | setup_lowcore(); |
796 | 818 | ||
797 | cpu_init(); | 819 | cpu_init(); |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index a6d85c0a7f20..70f4b9604575 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -468,6 +468,11 @@ int __cpuinit start_secondary(void *cpuvoid) | |||
468 | ipi_call_lock(); | 468 | ipi_call_lock(); |
469 | set_cpu_online(smp_processor_id(), true); | 469 | set_cpu_online(smp_processor_id(), true); |
470 | ipi_call_unlock(); | 470 | ipi_call_unlock(); |
471 | __ctl_clear_bit(0, 28); /* Disable lowcore protection */ | ||
472 | S390_lowcore.restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | ||
473 | S390_lowcore.restart_psw.addr = | ||
474 | PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler; | ||
475 | __ctl_set_bit(0, 28); /* Enable lowcore protection */ | ||
471 | /* Switch on interrupts */ | 476 | /* Switch on interrupts */ |
472 | local_irq_enable(); | 477 | local_irq_enable(); |
473 | /* cpu_idle will call schedule for us */ | 478 | /* cpu_idle will call schedule for us */ |
@@ -507,7 +512,11 @@ static int __cpuinit smp_alloc_lowcore(int cpu) | |||
507 | memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512); | 512 | memset((char *)lowcore + 512, 0, sizeof(*lowcore) - 512); |
508 | lowcore->async_stack = async_stack + ASYNC_SIZE; | 513 | lowcore->async_stack = async_stack + ASYNC_SIZE; |
509 | lowcore->panic_stack = panic_stack + PAGE_SIZE; | 514 | lowcore->panic_stack = panic_stack + PAGE_SIZE; |
510 | 515 | lowcore->restart_psw.mask = PSW_BASE_BITS | PSW_DEFAULT_KEY; | |
516 | lowcore->restart_psw.addr = | ||
517 | PSW_ADDR_AMODE | (unsigned long) restart_int_handler; | ||
518 | if (user_mode != HOME_SPACE_MODE) | ||
519 | lowcore->restart_psw.mask |= PSW_ASC_HOME; | ||
511 | #ifndef CONFIG_64BIT | 520 | #ifndef CONFIG_64BIT |
512 | if (MACHINE_HAS_IEEE) { | 521 | if (MACHINE_HAS_IEEE) { |
513 | unsigned long save_area; | 522 | unsigned long save_area; |
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 51e5cd9b906a..5dbbaa6e594c 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
@@ -85,3 +85,19 @@ int memcpy_real(void *dest, void *src, size_t count) | |||
85 | arch_local_irq_restore(flags); | 85 | arch_local_irq_restore(flags); |
86 | return rc; | 86 | return rc; |
87 | } | 87 | } |
88 | |||
89 | /* | ||
90 | * Copy memory to absolute zero | ||
91 | */ | ||
92 | void copy_to_absolute_zero(void *dest, void *src, size_t count) | ||
93 | { | ||
94 | unsigned long cr0; | ||
95 | |||
96 | BUG_ON((unsigned long) dest + count >= sizeof(struct _lowcore)); | ||
97 | preempt_disable(); | ||
98 | __ctl_store(cr0, 0, 0); | ||
99 | __ctl_clear_bit(0, 28); /* disable lowcore protection */ | ||
100 | memcpy_real(dest + store_prefix(), src, count); | ||
101 | __ctl_load(cr0, 0, 0); | ||
102 | preempt_enable(); | ||
103 | } | ||