miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
cc.h
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2026 Christian Spoo
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22
31#ifndef LWIP_ARCH_CC_H
32#define LWIP_ARCH_CC_H
33
34#include <stdint.h>
35#include <stddef.h>
36#include <string.h>
37
38#ifndef __ssize_t_defined
39typedef long ssize_t;
40#define __ssize_t_defined
41#endif
42
43/* Tell lwIP arch.h not to re-typedef ssize_t or pull in unistd.h */
44#ifndef SSIZE_MAX
45#define SSIZE_MAX __LONG_MAX__
46#endif
47
48/* lwIP basic types — x86_64-elf is LP64, little-endian */
49typedef uint8_t u8_t;
50typedef int8_t s8_t;
52typedef int16_t s16_t;
54typedef int32_t s32_t;
56
57#ifndef BYTE_ORDER
58#define BYTE_ORDER LITTLE_ENDIAN
59#endif
60
61/* Struct packing — GCC attribute */
62#define PACK_STRUCT_FIELD(x) x
63#define PACK_STRUCT_STRUCT __attribute__((packed))
64#define PACK_STRUCT_BEGIN
65#define PACK_STRUCT_END
66
67/* NO_SYS=1: single-threaded poll loop, no locking needed */
68#define SYS_ARCH_DECL_PROTECT(lev)
69#define SYS_ARCH_PROTECT(lev)
70#define SYS_ARCH_UNPROTECT(lev)
71
72/* Diagnostics — route through kernel printk */
73#ifndef _MINIOS_PRINTK_H_
74extern int printk(const char *fmt, ...);
75#endif
76#define LWIP_PLATFORM_DIAG(x) do { printk x; } while(0)
77#define LWIP_PLATFORM_ASSERT(x) do { printk("lwIP ASSERT: %s\n", x); for(;;); } while(0)
78
79#endif /* LWIP_ARCH_CC_H */
int32_t s32_t
Definition cc.h:54
uint32_t u32_t
Definition cc.h:53
uint8_t u8_t
Definition cc.h:49
uint16_t u16_t
Definition cc.h:51
long ssize_t
Definition cc.h:39
int printk(const char *fmt,...)
int8_t s8_t
Definition cc.h:50
int16_t s16_t
Definition cc.h:52
uintptr_t mem_ptr_t
Definition cc.h:55
signed short int16_t
Definition types.h:30
unsigned short uint16_t
Definition types.h:31
unsigned int uint32_t
Definition types.h:34
unsigned long uintptr_t
Definition types.h:59
signed int int32_t
Definition types.h:33
unsigned char uint8_t
Definition types.h:28
signed char int8_t
Definition types.h:27