Skip to content

Commit

Permalink
s390/sclp: convert early sclp console code to C
Browse files Browse the repository at this point in the history
The 31-bit assembler code for the early sclp console is error
prone as git commit fde24b54d976cc123506695c17db01438a11b673
"s390/sclp: clear upper register halves in _sclp_print_early"
has shown.

Convert the assembler code to C.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Martin Schwidefsky committed Jul 29, 2015
1 parent 1d2334c commit 22362a0
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 356 deletions.
2 changes: 2 additions & 0 deletions arch/s390/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ mflags-$(CONFIG_MARCH_Z196) := -march=z196
mflags-$(CONFIG_MARCH_ZEC12) := -march=zEC12
mflags-$(CONFIG_MARCH_Z13) := -march=z13

export CC_FLAGS_MARCH := $(mflags-y)

aflags-y += $(mflags-y)
cflags-y += $(mflags-y)

Expand Down
11 changes: 11 additions & 0 deletions arch/s390/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ static inline void __load_psw_mask (unsigned long mask)
: "=&d" (addr), "=Q" (psw) : "Q" (psw) : "memory", "cc");
}

/*
* Extract current PSW mask
*/
static inline unsigned long __extract_psw(void)
{
unsigned int reg1, reg2;

asm volatile("epsw %0,%1" : "=d" (reg1), "=a" (reg2));
return (((unsigned long) reg1) << 32) | ((unsigned long) reg2);
}

/*
* Rewind PSW instruction address by specified number of bytes.
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/include/asm/sclp.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ int sclp_pci_configure(u32 fid);
int sclp_pci_deconfigure(u32 fid);
int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode);
void sclp_early_detect(void);
long _sclp_print_early(const char *);
int _sclp_print_early(const char *);

#endif /* _ASM_S390_SCLP_H */
11 changes: 11 additions & 0 deletions arch/s390/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'

CFLAGS_sysinfo.o += -w

#
# Use -march=z900 for sclp.c to be able to print an error message if
# the kernel is started on a machine which is too old
#
CFLAGS_REMOVE_sclp.o = $(CC_FLAGS_FTRACE)
ifneq ($(CC_FLAGS_MARCH),-march=z900)
CFLAGS_REMOVE_sclp.o += $(CC_FLAGS_MARCH)
CFLAGS_sclp.o += -march=z900
endif
GCOV_PROFILE_sclp.o := n

obj-y := traps.o time.o process.o base.o early.o setup.o idle.o vtime.o
obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o
obj-y += debug.o irq.o ipl.o dis.o diag.o sclp.o vdso.o
Expand Down
1 change: 1 addition & 0 deletions arch/s390/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ ENTRY(startup_kdump)
xc 0x200(256),0x200 # partially clear lowcore
xc 0x300(256),0x300
xc 0xe00(256),0xe00
lctlg %c0,%c15,0x200(%r0) # initialize control registers
stck __LC_LAST_UPDATE_CLOCK
spt 6f-.LPG0(%r13)
mvc __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
Expand Down
Loading

0 comments on commit 22362a0

Please sign in to comment.