libk  Check-in [03d58c0419]

Overview
Comment:add /arch readme file
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 03d58c0419c63b531389caa78631f1a66b11106db44db5d31f1a92b196df9c36
User & Date: lexi on 2019-08-25 01:47:31
Other Links: manifest | tags
Context
2019-08-25
02:42
arch: add script to generate linux syscall tables from generic headers; add arm.lin.64 (untested) check-in: c15c92895e user: lachs0r tags: trunk
01:47
add /arch readme file check-in: 03d58c0419 user: lexi tags: trunk
01:10
arch: add syscall table for x86.lin.32; rerun scripts check-in: fd97c8a737 user: lachs0r tags: trunk
Changes

Added arch/readme.md version [1fee89bb29].



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
# libk/arch
the arch directory of the libk repository contains system-specific definitions and headers, such as error codes and system call tables. none of the files in arch are compiled, but are included from compiled files.

whenever a file is passed to the assembler or C compiler, an include directory is selected based on the chosen target tuple (see /libk.md). thus, when compiling a file that contains the line `#include <system_calls.h>` on an x86-32 freebsd system, the compiler will be instructed search (among other directories) the `/arch/x86.fbsd.32` directory for headers.

## structure
each subdirectory should be named for a specific target tuple. the top level is reserved for development tools and files of relevance to more than one architecture; for instance, the standardized x86-64 SysV syscall ABI is kept at `/arch/x86.syscall.64.s`. these files should not be included directly from any files under the `/mod` directory; rather, they should be included from stub files in the appropriate target directory. this provides a consistent header selection mechanism.

## scripts
arch contains a number of shell scripts. unlike the shell scripts in /global, the shell scripts in /arch are not part of the build process; they are simply developer tools, usually for generating syscall tables for new architectures. the output of the scripts is written directly to the appropriate target directory; these files should be added to the source tree and committed.

- `mktbl.posix.sh <target> <ABI>`: generates the C headers for a particular target based on the system_calls.h and error_table.h files in its directory. the ABI parameter controls which syscalls are included; the ABI is the second column in the kernel system calls table.
- `mktbl.errno.linux.sh <target> <ABI>`: generates the errno table for a given architecture and ABI. requires the kernel source tree to be installed on the host system.