Commit fd5f452f authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Compile on aarch64 (Rpi)

parent 03f528e2
......@@ -164,7 +164,57 @@ do { \
#define va_free(list) free(((char *)(list).__ap) - sizeof(char *)*2)
#endif /* defined(__arm__) && defined(__ARM_EABI__) */
/* defined(__arm__) && defined(__ARM_EABI__) */
#elif defined(__aarch64__)
/*
typedef struct va_list {
void * stack; // next stack param
void * gr_top; // end of GP arg reg save area
void * vr_top; // end of FP/SIMD arg reg save area
int gr_offs; // offset from gr_top to next GP register arg
int vr_offs; // offset from vr_top to next FP/SIMD register arg
} va_list;
*/
#define va_new(list) \
do {\
char *ptr;\
\
ptr = malloc(8);\
(list).__stack = ptr;\
(list).__gr_top = ptr;\
(list).__vr_top = ptr;\
(list).__gr_offs = 0;\
(list).__vr_offs = 0;\
} while (0)
#define va_add(list, type, val) \
do { \
char *ptr_start = (list).__gr_top;\
char *ptr_end = (list).__vr_top;\
size_t size = ptr_end - ptr_start;\
\
size_t typesize = sizeof(type);\
if (typesize < 8) {\
typesize = 8;\
} else if (typesize > 8) {\
typesize = 16;\
}\
ptr_start = realloc(ptr_start, size + typesize);\
ptr_end = ptr_start + size;\
type tmpval = val; \
memcpy(ptr_end, &tmpval, sizeof(tmpval));\
ptr_end += typesize;\
\
(list).__stack = ptr_start;\
(list).__gr_top = ptr_start;\
(list).__vr_top = ptr_end;\
} while (0)
#define va_free(list) free((list).__gr_top)
#endif /* defined(__aarch64__) */
#endif /* _INCLUDE_DYNARG_H_ */
......@@ -438,20 +438,20 @@ static size_t on_message(void *plugin_private,
memcpy(text, buffer, buffer_size);
text[buffer_size] = 0;
sscanf(text, "%as ", &cmd);
sscanf(text, "%ms ", &cmd);
if (!strcmp(cmd, "trace")) {
int freq;
char *variable;
sscanf(text, "%*s %d %as", &freq, &variable);
sscanf(text, "%*s %d %ms", &freq, &variable);
start_trace(priv, freq, variable);
} else if (!strcmp(cmd, "command")) {
char *ident;
char *command;
sscanf(text, "%*s %as", &ident);
sscanf(text, "%*s %ms", &ident);
command = text + strlen(cmd) + strlen(ident) + 2;
do_command(ident, command);
......@@ -463,7 +463,7 @@ static size_t on_message(void *plugin_private,
struct command *command;
enum command_value_type vtype;
sscanf(text, "%*s %as %as", &name, &type);
sscanf(text, "%*s %ms %ms", &name, &type);
if (!strcmp(type, "bool")) {
int v;
sscanf(text, "%*s %*s %*s %d", &v);
......@@ -487,7 +487,7 @@ static size_t on_message(void *plugin_private,
} else if (!strcmp(cmd, "status")) {
char *ident;
sscanf(text, "%*s %as", &ident);
sscanf(text, "%*s %ms", &ident);
start_status(priv, ident);
} else {
server->send(priv->server, MESSAGE_TYPE_TEXT,
......
......@@ -250,7 +250,7 @@ static void update_status(struct status_server *stat_srv)
{
static time_t last = 0;
time_t now;
char status[100];
char status[136];
now = time(NULL);
if (now == last)
......@@ -258,8 +258,8 @@ static void update_status(struct status_server *stat_srv)
last = now;
snprintf(status, 99, "%s %e %e\n", current_auth, az_offset, el_offset);
status[99] = 0;
snprintf(status, 135, "%s %e %e\n", current_auth, az_offset, el_offset);
status[135] = 0;
status_server_send(stat_srv, status);
}
......
......@@ -43,7 +43,7 @@ int main (int argc, char **argv)
int r;
char buf[10];
char linebuf[1000];
char outbuf[1000];
char outbuf[1024];
int linepos;
char *az_pos = "Azimuth_Position";
char *el_pos = "Elevation_Position";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment