Commit graph

6893 commits

Author SHA1 Message Date
David Given 074b42aa97 Add some missing libc functions: setenv, unsetenv, strdup.
--HG--
branch : dtrg-videocore
rename : lang/cem/libcc.ansi/stdlib/getenv.c => lang/cem/libcc.ansi/stdlib/setenv.c
rename : lang/cem/libcc.ansi/string/strlen.c => lang/cem/libcc.ansi/string/strdup.c
2013-05-29 21:41:58 +01:00
David Given f522aba4af Add support for snprintf and vsnprintf. Try and make the return value a bit
more standards-compliant.

--HG--
extra : source : a19eb606871f918e3d9e195b487b5276855edc8e
2013-05-29 17:10:58 +01:00
David Given 69953d016c Add support for snprintf and vsnprintf. Try and make the return value a bit
more standards-compliant.

--HG--
branch : dtrg-videocore
2013-05-29 17:10:58 +01:00
David Given d3e3e72860 Update from trunk.
--HG--
branch : dtrg-videocore
2013-05-29 15:03:48 +01:00
David Given 6fff2d45fe Attempt to fix 64-bitness error in ashow. Deprecate the structure format macros in h/out.h because they make no sense on 64-bit platforms. 2013-05-29 14:48:51 +01:00
David Given e0c121d6e6 Use relocation enumerations rather than hard-coded values for relocation types
(these were causing problems due to the enumeration values having changed).
2013-05-29 14:11:04 +01:00
David Given 1f36370d87 Implement nop (the C compiler sometimes generates this!).
--HG--
branch : dtrg-videocore
2013-05-26 22:54:53 +01:00
David Given ae993b1eb2 Add a crude README.
--HG--
branch : dtrg-videocore
2013-05-26 19:54:22 +01:00
David Given 38e4726f5c Boot code now works properly in both kernel and bare-metal mode.
--HG--
branch : dtrg-videocore
2013-05-26 19:41:37 +01:00
David Given ef25c53c9c Fix bug in ine/dee.
--HG--
branch : dtrg-videocore
2013-05-26 18:59:19 +01:00
David Given e01f00e320 Allow reading from the mini UART. Add a check to not touch the UART unless it's been initialised (in case of accidents when running in kernel mode).
--HG--
branch : dtrg-videocore
2013-05-26 18:58:54 +01:00
David Given 366cd10194 Remainders are calculated correctly. printf now works.
--HG--
branch : dtrg-videocore
2013-05-26 13:13:58 +01:00
David Given 510888e6d5 .csb now works.
--HG--
branch : dtrg-videocore
rename : mach/vc4/libem/csa.s => mach/vc4/libem/csb.s
2013-05-26 13:06:25 +01:00
David Given 6284512b37 Fix erroneous section check (symbols may not have a defined section in pass 1).
--HG--
branch : dtrg-videocore
2013-05-26 00:35:15 +01:00
David Given bd9497be77 Renamed the pi-specific functions to be a bit cleaner.
--HG--
branch : dtrg-videocore
rename : plat/rpi/libsys/phys_to_user.s => plat/rpi/libsys/pi_phys_to_user.s
rename : plat/rpi/libsys/uart.s => plat/rpi/libsys/pi_uart.s
rename : plat/rpi/libsys/user_to_phys.s => plat/rpi/libsys/pi_user_to_phys.s
2013-05-26 00:22:39 +01:00
David Given 308d41e083 Added triple-quad load and store (used by the signal stuff).
--HG--
branch : dtrg-videocore
2013-05-26 00:22:08 +01:00
David Given e299cc3bcf stdio (output only) now works.
--HG--
branch : dtrg-videocore
2013-05-25 23:59:31 +01:00
David Given 8c21a2ef9b Stop fighting the terrible code and remove the regvar support --- it didn't help much and was a pain.
--HG--
branch : dtrg-videocore
2013-05-25 23:58:35 +01:00
David Given 6a672d5e96 Heap allocations now works.
--HG--
branch : dtrg-videocore
2013-05-25 23:28:47 +01:00
David Given 3b07fee160 Major bugfix where instructions weren't being shrunk correctly. (Turns out there's built-in support for doing this, which I hadn't found.)
--HG--
branch : dtrg-videocore
2013-05-25 23:26:10 +01:00
David Given b6680a48cc Disable register variables. The code is a bit worse, but having two stackable registers makes things much easier to understand.
--HG--
branch : dtrg-videocore
2013-05-25 13:31:58 +01:00
David Given d7efb0a32c Implement .csa.
--HG--
branch : dtrg-videocore
rename : mach/vc4/libem/dummy.s => mach/vc4/libem/csa.s
2013-05-25 13:31:27 +01:00
David Given 2ee79ab0b2 Encode comparing branch correctly.
--HG--
branch : dtrg-videocore
2013-05-25 13:31:01 +01:00
David Given ec25fec145 Build binaries that will run bare metal. Add enough syscall library to init the uart and write text.
--HG--
branch : dtrg-videocore
rename : plat/rpi/libsys/libsys.h => plat/rpi/libsys/libsysasm.h
rename : plat/rpi/libsys/_sys_rawread.s => plat/rpi/libsys/phys_to_user.s
rename : plat/rpi/libsys/_sys_rawread.s => plat/rpi/libsys/uart.s
rename : plat/rpi/libsys/_sys_rawread.s => plat/rpi/libsys/user_to_phys.s
2013-05-25 00:35:29 +01:00
David Given 472f778342 Don't write out constant data as big-endian! Some other cleanups.
--HG--
branch : dtrg-videocore
2013-05-25 00:33:38 +01:00
David Given 98e745d04c Fix awful bug where uint32_t was sometimes defined as a short.
--HG--
branch : dtrg-videocore
2013-05-25 00:33:01 +01:00
David Given 98a51732ab Various codegen tweaks.
--HG--
branch : dtrg-videocore
2013-05-24 17:04:29 +01:00
David Given 2c7ee27206 Double-quads can be loaded and stored (more) correctly.
--HG--
branch : dtrg-videocore
2013-05-22 23:55:23 +01:00
David Given 6cbe6e1c4e Better treatment of sign extension.
--HG--
branch : dtrg-videocore
2013-05-22 23:12:48 +01:00
David Given 8f338f9b44 Now actually runs on real hardware.
--HG--
branch : dtrg-videocore
2013-05-22 22:46:10 +01:00
David Given 7537c85e0a Generate adds instructions when a shift-and-add is seen (useful for array indexing).
--HG--
branch : dtrg-videocore
2013-05-22 21:37:48 +01:00
David Given b5e5df4a63 Allocate a user stack to run code in.
--HG--
branch : dtrg-videocore
2013-05-22 18:25:30 +01:00
David Given cdce394b6c Generate ld rd, (rs) instructions properly.
--HG--
branch : dtrg-videocore
2013-05-22 11:02:46 +01:00
David Given 9e556d8b7b Optimise direct access to globals, and incrementing and decrementing locals.
--HG--
branch : dtrg-videocore
2013-05-22 10:55:13 +01:00
David Given 0068952bd1 Build the Raspberry Pi code.
--HG--
branch : dtrg-videocore
2013-05-22 09:47:22 +01:00
David Given 6b5316dcfa More typo fixes.
--HG--
branch : dtrg-videocore
2013-05-22 00:52:58 +01:00
David Given 08c4334224 Typo fixes.
--HG--
branch : dtrg-videocore
2013-05-22 00:44:04 +01:00
David Given 72542288cd Adjust bootstrap code to build kernels that work with the mailbox test app.
--HG--
branch : dtrg-videocore
2013-05-22 00:16:59 +01:00
David Given f904465e9c Fix signedness problem that was showing up on ARM.
--HG--
branch : dtrg-videocore
2013-05-22 00:16:16 +01:00
David Given 5e9102955c Reworked VC4 relocations and some of the instruction encoding to be actually correct. Now generating what could be real code!
--HG--
branch : dtrg-videocore
2013-05-21 23:17:30 +01:00
David Given 1312fe298b Now compiles (incorrectly) the entire libc, libpc, libm2 and libbasic!
--HG--
branch : dtrg-videocore
2013-05-21 20:05:26 +01:00
David Given 92817a6ad7 Allow platforms to specify size of long double; seperate alignment from size.
--HG--
branch : dtrg-videocore
2013-05-21 19:18:11 +01:00
David Given 877e06ed89 Lots more opcodes including float support. Define float and double to be the
same thing (as the VC4 seems not to have double-precision float support).

--HG--
branch : dtrg-videocore
2013-05-21 18:16:30 +01:00
David Given 6cdea73e84 Add a lot more opcodes.
--HG--
branch : dtrg-videocore
2013-05-20 23:27:45 +01:00
David Given d6565f4d5b Fix typo.
--HG--
branch : dtrg-videocore
2013-05-20 23:27:31 +01:00
David Given e5341e4167 Remember to clear ackflags on reset.
--HG--
branch : dtrg-videocore
2013-05-20 22:41:27 +01:00
David Given 970f2bae62 Major revamp to simplify and use 2op instructions. Better code. Now looks like it may work one day.
--HG--
branch : dtrg-videocore
2013-05-20 22:35:12 +01:00
David Given 5082b2a5d7 Add lea instruction. Fix dependency issues.
--HG--
branch : dtrg-videocore
2013-05-20 19:56:33 +01:00
David Given 11890026db Push/pop are the right way round. Don't corrup short-form ALU instructions. Correct encoding of push/pop register ranges.
--HG--
branch : dtrg-videocore
2013-05-19 23:34:42 +01:00
David Given 76ba0bf6b3 First steps towards a code generator.
--HG--
branch : dtrg-videocore
2013-05-19 23:33:42 +01:00