Commit Graph

38528 Commits

Author SHA1 Message Date
svenbarth
d15304c25e Also check for the type of the register when replacing it. In certain circumstances this can still lead to access to invalid memory resulting either in an access violation or invalid registers.
git-svn-id: trunk@22779 -
2012-10-19 19:35:45 +00:00
sergei
ee62a1ed50 * Fixed unclosed comment from r22775.
git-svn-id: trunk@22777 -
2012-10-19 18:21:43 +00:00
florian
dc8a3779e5 * restored overwritten test
git-svn-id: trunk@22776 -
2012-10-19 17:32:33 +00:00
sergei
6d70009f06 + ELF linker. Works on x86_64-linux and i386-linux good enough to pass the testsuite, but still requires a lot of work in nearly all aspects. In particular, no attempt to resolve symbols from shared libs is done, everything is just treated as imports. Symbol versioning isn't supported either.
x86_64 is the most elaborated, has some degree of indirect function (GNU_IFUNC) and TLS support, so it is even able to link with static libc/pthreads code (tw14265) and produce an executable that can launch (but still fails due to invalid DWARF unwind info).

i386 produces working shared libraries if they are compiled with -Cg, without one your mileage may vary. tw14265 does not link yet due to missing COMDAT group support.

git-svn-id: trunk@22775 -
2012-10-19 17:21:08 +00:00
florian
92510963da * test uses rax so it is x86-64 only
git-svn-id: trunk@22774 -
2012-10-19 16:48:31 +00:00
florian
a499a30ca9 * fixes to avx support by Torsten Grundke
git-svn-id: trunk@22773 -
2012-10-19 16:45:53 +00:00
pierre
b21cff6ea3 Fix m68k default target code
git-svn-id: trunk@22772 -
2012-10-19 16:09:02 +00:00
pierre
322b793506 Try to do something for m68k integer/address registers; not working yet :!(
git-svn-id: trunk@22771 -
2012-10-19 15:52:57 +00:00
pierre
6bc6036fd5 Set cai_align and cai_cpu
git-svn-id: trunk@22769 -
2012-10-19 15:38:39 +00:00
pierre
963e211644 Try to add all add_move_instruction calls
git-svn-id: trunk@22768 -
2012-10-19 15:38:11 +00:00
Jonas Maebe
20a6b7fa3d * fixed compilation after introduction of nostackframe checks
git-svn-id: trunk@22767 -
2012-10-19 14:43:00 +00:00
pierre
0b404fea69 * more 68000 fixref changes
git-svn-id: trunk@22764 -
2012-10-19 12:34:41 +00:00
pierre
d8c2930454 Also accept R_ADDRESSREGISTER in a_load_cgparaloc_anyreg method
git-svn-id: trunk@22763 -
2012-10-19 11:55:39 +00:00
pierre
f81954760b More 68000 restrictions taken into account for fixref and TST instruction
git-svn-id: trunk@22762 -
2012-10-19 11:54:05 +00:00
pierre
b104d9c9e6 Add some missing instructions to spilling_get_operation_type method
git-svn-id: trunk@22760 -
2012-10-19 10:18:16 +00:00
pierre
d472b40149 Move conversion to address register of base reference to common code in fixref
git-svn-id: trunk@22759 -
2012-10-19 09:57:49 +00:00
pierre
34279864ef Remove double cgutils in uses clause
git-svn-id: trunk@22758 -
2012-10-19 07:31:18 +00:00
svenbarth
825fa86824 Added missing unit for tcpuregisterset
git-svn-id: trunk@22754 -
2012-10-18 20:39:35 +00:00
svenbarth
f7c333cee0 Enabled signal handlers
git-svn-id: trunk@22752 -
2012-10-18 20:12:41 +00:00
svenbarth
a01677e546 Removed debug line
git-svn-id: trunk@22751 -
2012-10-18 20:12:37 +00:00
svenbarth
7bc5995d4d Implement SysCall interface for m68k-linux. This is especially useful for testing code using
QEMU's userspace emulation as no libraries are needed then.

git-svn-id: trunk@22750 -
2012-10-18 20:12:32 +00:00
svenbarth
ca6ca31953 The message scan_f_illegal_char seems to have gained additional parameters since it was
introduced. Take that into account to avoid an access violation.

git-svn-id: trunk@22749 -
2012-10-18 20:12:28 +00:00
svenbarth
2ada9a528b Fix a critical bug in the register allocator (at least for CPUs with seperate address
registers like the M68k): check whether the register type of the base/index register
of the instruction's reference is the same as the one we are doing register allocation
for. Otherwise the address registers can become corrupted.

git-svn-id: trunk@22748 -
2012-10-18 20:12:24 +00:00
svenbarth
75baec5985 Mark all integer registers as volatile.
git-svn-id: trunk@22747 -
2012-10-18 20:12:20 +00:00
svenbarth
d9a61f2082 * make internal error unique
* add MULU and MULS to taicpu.get_spilling_operation_type

git-svn-id: trunk@22746 -
2012-10-18 20:12:16 +00:00
svenbarth
ff0eebf1ff Also change RTL helper FPC_DIV_CARDINAL to FPC_DIV_DWORD
git-svn-id: trunk@22745 -
2012-10-18 20:12:12 +00:00
svenbarth
8e07ddb2bc * made internal errors for M68K unique
* fixed comment
* added comment regarding the potential usage of an address register instead of an int one

git-svn-id: trunk@22744 -
2012-10-18 20:12:07 +00:00
svenbarth
322dbe5b65 Various adjustments to the RTL for m68k:
* enable the 6 parameter syscall variant (still everything dummied out though)
* add termios constants
* don't change signal handlers for now
* disable assembly set routines as set handling was changed

git-svn-id: trunk@22743 -
2012-10-18 20:12:02 +00:00
svenbarth
2db54da2b3 m68k also uses a non fixed stack with an equivalent to PUSH/POP so don't reorder parameters
if the required stack offset tells otherwise.

git-svn-id: trunk@22742 -
2012-10-18 20:11:56 +00:00
svenbarth
786e814d49 Use the correct frame pointer register: A6 on Unixes and A5 on everything else. The only
open question is embedded systems (currently it counts as "everything else").

git-svn-id: trunk@22741 -
2012-10-18 20:11:49 +00:00
svenbarth
43d8da7aa3 Replace DBRA instruction for Coldfire with a SUB/BRA combination in the for-loop-code-
generation and the assembly helpers in the RTL as DBRA is not supported by Coldfire.

git-svn-id: trunk@22740 -
2012-10-18 20:11:45 +00:00
svenbarth
d5523e6af6 For now completely disable (I)MUL/(I)DIV support for Coldfire and pass through the RTL routines
(of which the names had changed from FPC_MUL_LONGWORD->FPC_MUL_DWORD and FPC_MOD_CARDINAL->
FPC_MOD_DWORD).
Also disable the usage of FPU opcodes for Coldfire.

git-svn-id: trunk@22739 -
2012-10-18 20:11:39 +00:00
svenbarth
dea2a205c9 Fixed reference handling mostly for Coldfire CPUs. While they are conceptually based on
M68000 CPUs they are nevertheless more restricted in some cases, so these need to be
handled explicitely (especially if symbols are involved).

git-svn-id: trunk@22738 -
2012-10-18 20:11:33 +00:00
svenbarth
63f4e44fd5 assemble.pas, texternalcompiler.makecmdline:
* pass the correct architecture to the assembler (later we might switch to a $ARCH approach...)

git-svn-id: trunk@22737 -
2012-10-18 20:11:29 +00:00
svenbarth
72a47ea27a m68k/cgcpu.pas, tcg68k.g_proc_exit:
* generate special return code for non-68020 CPU which don't support RTD instruction (based on
  out code a few lines further down)

git-svn-id: trunk@22736 -
2012-10-18 20:11:25 +00:00
svenbarth
81069a7eca rtl/linux/m68k/prt0.as:
Add __stkptr variable

git-svn-id: trunk@22735 -
2012-10-18 20:11:21 +00:00
svenbarth
0217efc398 m68k/ag68kgas.pas, getreferencestring:
It seems that GNU as needs the syntax "offset(register.size*scale)" if the base address
  register is ommited instead of "offset(,register.size*scale)". Now the System unit
  assembles and nearly the complete RTL can be built.

git-svn-id: trunk@22734 -
2012-10-18 20:11:15 +00:00
svenbarth
cfadcf3769 m68k/cgcpu.pas, tcg68k.a_op_const_reg:
leave "and" and "or" as "and" and "or" as according to the assembly language reference the
  assembler should automatically choose the correct instruction (though Coldfire still should
  be tested for ORI/ANDI to CCR

git-svn-id: trunk@22733 -
2012-10-18 20:11:09 +00:00
svenbarth
f501a8fecc m68k/cgcpu.pas, tcg68k.a_op_const_reg:
* use andi/ori for constant values
  * use a scratch register if target is an address register (there seems to exist an omnious
    anda/ora instruction though, but GNU as doesn't seem to handle it... maybe I haven't set
    the CPU type correctly, so I'll need to investigate this so we can hopefully remove the
    need for a scratch register for certain CPU types ;) )

git-svn-id: trunk@22732 -
2012-10-18 20:11:02 +00:00
svenbarth
9402a068a5 m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
* remove comments regarding needed LOC_JUMP implementation
* don't call flags2reg if the location is LOC_JUMP as there isn't a register to set the flags to
  (this allows fpc_mul_qword and fpc_mul_int64 to be assembled)

git-svn-id: trunk@22731 -
2012-10-18 20:10:56 +00:00
svenbarth
d91fbd3e10 aggas.pas: m68k-linux needs preceding ".section" as well
git-svn-id: trunk@22730 -
2012-10-18 20:10:52 +00:00
svenbarth
6034866050 rtl/m68k: Added mathu(h).inc with dummy implementations of SetExceptionMask and GetExceptionMask
git-svn-id: trunk@22729 -
2012-10-18 20:10:48 +00:00
svenbarth
07c3cff61d m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
implement case "LOC_JUMP" (with a more or less blindly copy from
  x86/nx86cnv.pas, tx86typeconvnode.second.int_to_bool; this now allows that the system unit can
  be compiled, but not yet assembled

git-svn-id: trunk@22728 -
2012-10-18 20:10:43 +00:00
svenbarth
9a9d941ee1 rtl/m68k/sysnr.inc:
adjust syscalls just enough so that we don't have any duplicate symbols; the correctness will
  be verified once we have linkable code

git-svn-id: trunk@22727 -
2012-10-18 20:10:38 +00:00
svenbarth
05e37e3ab1 m68k/cgcpu.pas, tcg68k: implement a_jmp_name
git-svn-id: trunk@22726 -
2012-10-18 20:10:33 +00:00
svenbarth
e87f0e1df4 m68k/ra68kmot.pas, tm68kmotreader.Assemble:
the asmr_d_*_reading messages need an argument which specifies in which style the assembler code
  is read; this is most importantly used on i386; on m68k we currently don't have multiple styles,
  so simply disable these messages

git-svn-id: trunk@22725 -
2012-10-18 20:10:29 +00:00
svenbarth
83da4592d3 m68k/aasmcpu, taicpu.spilling_get_operation_type: add support for A_SUBX
git-svn-id: trunk@22724 -
2012-10-18 20:10:24 +00:00
pierre
e01c7603b8 Rectify last commit: po_assembler alone still sets up a stack frame
git-svn-id: trunk@22722 -
2012-10-18 12:44:24 +00:00
pierre
a8591af2a9 Handle po_nostackframe for arm cpu
git-svn-id: trunk@22720 -
2012-10-18 11:41:57 +00:00
pierre
0b63af56aa * Fix nostackframe related problems
git-svn-id: trunk@22719 -
2012-10-18 11:19:27 +00:00