nseries: clean up coding style

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw: use ld_p/st_p instead of ld_raw/st_raw

The ld_raw and st_raw definitions are only needed in code that
must compile for both user-mode and softmmu emulation.  Device
models can use the equivalent ld_p/st_p which are simple
pointer accessors.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: start introducing SOFTMMU_CODE_ACCESS in softmmu_header.h

This preprocessor symbol is already used in softmmu_template.h.  We
will use it to distinguish the two "fake" ACCESS_TYPEs
NB_MMU_MODES and NB_MMU_MODES + 1.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move MMUSUFFIX under SOFTMMU_CODE_ACCESS

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move definition of CPU_MMU_INDEX to inclusion site, drop ACCESS_TYPE

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: make do_unaligned_access a method of CPU

We will reference it from more files in the next patch.  To avoid
ruining the small steps we're making towards multi-target, make
it a method of CPU rather than just a global.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move ALIGNED_ONLY to cpu.h

Prepare for moving softmmu_header.h inclusion out of .c files

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: commonize helper definitions

They do not need to be in op_helper.c.  Because cputlb.c now includes
softmmu_template.h twice for each size, io_readX must be elided the
second time through.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move softmmu_template.h out of include/

It is only included in cputlb.c now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-arm: move arm_*_code to a separate file

These will soon require cpu_ldst.h, so move them out of cpu.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: introduce cpu_ldst.h

This will collect all load and store helpers soon.  For now
it is just a replacement for softmmu_exec.h, which this patch
stops including directly, but we also include it where this will
be necessary in order to simplify the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move all load/store functions to cpu_ldst.h

Unify pieces of cpu-all.h, exec-all.h, softmmu_exec.h and tcg/tcg.h
into a single new header file with all helpers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: rename KSMAP to KNOSMAP

This is the mode where SMAP is overridden, put "NO" in its name.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: move check_io helpers to seg_helper.c

Prepare for adding _kernel accessors there in the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: fix kernel accesses with SMAP and CPL = 3

With SMAP, implicit kernel accesses from user mode always behave as
if AC=0.  To do this, kernel mode is not anymore a separate MMU mode.
Instead, KERNEL_IDX is renamed to KSMAP_IDX and the kernel mode accessors
wrap KSMAP_IDX and KNOSMAP_IDX.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: simplify SMAP handling in MMU_KSMAP_IDX

Do not use this MMU index at all if CR4.SMAP is false, and drop
the SMAP check from x86_cpu_handle_mmu_fault.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: fix coding standards in x86_cpu_handle_mmu_fault

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: commonize checks for 2MB and 4KB pages

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: commonize checks for 4MB and 4KB pages

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386: commonize checks for PAE and non-PAE

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>